Description:Description\
_depositEth function is using a function swapExactETHForTokens from UniswapV2Router but providing deadline as block.timestamp + 1000
Attack Scenario\
Using block.timestamp + 1000 is effectively bypassing the security check. As the block.timestamp will be determined once the transaction gets mined, the check will always pass.
Failing to provide a proper deadline value enables pending transactions to be maliciously executed at a later point. Transactions providing too little gas will have their execution delayed, and can be picked by malicious actors or MEV bots to be executed at a later point when they can profit from it, whilst negatively affecting the transaction sender.
Attachments
Proof of Concept (PoC) File
Calls to UniswapV2Router02::swapExactETHForTokens() are protected by a deadline parameter to limit the execution of delayed/ old transactions. Functions that modify liquidity of the pool check this parameter against the current block timestamp in order to discard expired interactions:
The deadline provided by the caller is checked to be larger or equal to the current block timestamp. The implemention of the deadline in _depositEth function is using a function swapExactETHForTokens :
Github username: -- Twitter username: -- Submission hash (on-chain): 0x26c76a511048c54a3920a95a9b36a993381b7dfcf4bccf696a571d4d5581ae4e Severity: medium
Description: Description\ _depositEth function is using a function
swapExactETHForTokens
from UniswapV2Router but providing deadline asblock.timestamp + 1000
Attack Scenario\ Using block.timestamp + 1000 is effectively bypassing the security check. As the block.timestamp will be determined once the transaction gets mined, the check will always pass.
Failing to provide a proper deadline value enables pending transactions to be maliciously executed at a later point. Transactions providing too little gas will have their execution delayed, and can be picked by malicious actors or MEV bots to be executed at a later point when they can profit from it, whilst negatively affecting the transaction sender.
Attachments
The modifier ensure(deadline):
The deadline provided by the caller is checked to be larger or equal to the current block timestamp. The implemention of the deadline in _depositEth function is using a function
swapExactETHForTokens
: