26423 - [SC - Insight] Timelock executeTransaction function will succe...
Submitted on Dec 2nd 2023 at 19:11:25 UTC by @hoshiyari for Boost | DeGate
Report ID: #26423
Report type: Smart Contract
Report severity: Insight
Target: https://etherscan.io/address/0xf2991507952d9594e71a44a54fb19f3109d213a5#code
Impacts:
Unrequired additional delays
Contract fails to deliver promised returns, but doesn't lose value
Griefing (e.g. no profit motive for an attacker, but damage to the users or the protocol)
Description
Bug Description
Where : Timelock for DepositContractProxy, Timelock for ExchangeContractProxy
Summary
Function
executeTransaction()
verify the queued transaction and then call the target address with 'data' passed in the argument.
Ideal expected behaviour is that the call to the target contract with correct data should be successful and if the call to the target contract fails somehow, the transaction should revert.
However, that is not the case every time. Assuming that target is mistakenly input with an address that doesnot have any code or any contract that is yet to deploy. The call to that particular address will succeed which is not the ideal contract behaviour.
Openzeppelin has similar Timelock execution issue open mentioning the same issue of call to non-existent contract.
Attaching POC for further understanding.
Impact
Timelock contract will execute the invalid transaction successfully while failing the expectations of the admin causing to repeat the process and thus adding delay to the protocol.
Although both queue transaction and execute transaction are under admin control. There could be a loss of admin funds in certain transaction scenario too.
Transactions with contracts that are yet to deploy like new Tokens, LP of new tokens whose address can be predetermined at risk while interacting with this contract.
Risk Breakdown
Difficulty to Exploit: Easy Weakness: CVSS2 Score:
Recommendation
References
Openzeppelin have this issue open and currently under discussion regarding it's mitigation. https://github.com/OpenZeppelin/openzeppelin-contracts/issues/3874 - "Consider adding a contract existence check in TimelockController's _execute function"
Proof of concept
Fork chain in local - anvil -f RPC_URL
Copy following test in foundry environment and run "forge test --match-contract DeGate --evm-version Shanghai -vvvv"
Last updated