Platform: Code4rena
Start Date: 27/01/2022
Pot Size: $75,000 USDC
Total HM: 10
Participants: 26
Period: 7 days
Judge: pauliax
Total Solo HM: 5
Id: 81
League: ETH
Rank: 15/26
Findings: 2
Award: $525.05
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: cmichel
Also found by: 0x1f8b, TomFrenchBlockchain, UncleGrandpa925, WatchPug, defsec, leastwood, pauliax, sirhashalot
UncleGrandpa925
In EIP1271Wallet.sol, the function _validateOrder
uses the deprecated latestAnswer
of Chainlink. This function might suddenly stop working if Chainlink stopped supporting it, and also will not error if no answer has been reached but returns 0.
Possibility of requiring contract redeployment if the API is no longer supported, or unexpected behavior when it returns 0.
Use V3 interface functions: https://docs.chain.link/docs/price-feeds-api-reference/
There have been many similar issues, some of them are: https://github.com/code-423n4/2021-06-tracer-findings/issues/145 https://github.com/code-423n4/2021-06-tracer-findings/issues/73 https://blog.openzeppelin.com/opyn-gamma-protocol-audit/ - Chainlink pricer is using a deprecated API issue
I proposed this as a Medium issue with reference to the above mentioned issues of C4 where the possibility of requiring contract redeployment justified Medium severity.
#0 - jeffywu
2022-02-06T14:34:16Z
Duplicate of #178
#1 - pauliax
2022-02-12T12:15:57Z
A duplicate of #197
🌟 Selected for report: WatchPug
Also found by: TomFrenchBlockchain, UncleGrandpa925, cmichel, hyh, pauliax
UncleGrandpa925
There are 3 ways for users to mint sNOTE: mintFromNOTE, mintFromWETH & mintFromETH, and all 3 of them use the _mintFromAssets
function.
Looking at the _mintFromAssets
, it basically just forces add all the liquidity in the Balancer pool without any slippage check. As a result, any miners can perform a sandwich attack on these mint sNOTE transactions, causing loss to users. The situation is further worsened by the fact that Notional is on Ethereum where miners have abundant time to do this kind of attack.
BALANCER_VAULT.joinPool{value: msgValue}( NOTE_ETH_POOL_ID, address(this), address(this), // sNOTE will receive the BPT IVault.JoinPoolRequest( assets, maxAmountsIn, abi.encode( IVault.JoinKind.EXACT_TOKENS_IN_FOR_BPT_OUT, maxAmountsIn, 0 // Accept however much BPT the pool will give us ), false // Don't use internal balances ) );
Take mintFromNOTE for example, the sandwich attack can be done as follows:
Obviously, the attacker will have to calculate exactly how much NOTE to buy in the first place to maximize the profit, but this is trivially doable & applicable to all transactions.
All sNOTE minters are prone to receive much less BPT (therefore sNOTE) than they initially plan (since there is no slippage protection).
#0 - jeffywu
2022-02-06T15:09:19Z
Duplicate #181
#1 - pauliax
2022-02-13T10:22:56Z
A duplicate of #181