Skip to content

Latest commit

 

History

History
37 lines (21 loc) · 2.43 KB

CVE-2024.1.19-2.md

File metadata and controls

37 lines (21 loc) · 2.43 KB

CVE

Vendor

Ethereum blockchain

Vulnerability Type

Incorrect Access Control

Abstract

We found a vulnerability in the UniswapFrontRunBot Ethereum smart contract that can lead to financial losses. This vulnerability is due to incorrect access control which can lead to a reentrancy attack. This attack allows an attacker to withdraw more funds than they should be able to.

Details

The UniswapFrontRunBot contract contains several functions that are vulnerable to a reentrancy attack. Specifically, the start and withdrawal functions transfer the contract's balance to an external address without any state change before the transfer. This could allow an attacker to re-enter the function during the call to the transfer function and extract funds multiple times.

Furthermore, the setOwner function can be called by anyone, allowing anyone to become the owner of the contract. This is a serious security issue because the owner can call the withdrawal function to withdraw all the funds in the contract.

Lastly, the WETH_CONTRACT_ADDRESS and TOKEN_CONTRACT_ADDRESS are hardcoded to the same address. If these two addresses should be different, this could cause incorrect contract behavior.

Attack Process

Step 1 An attacker calls the setOwner function to become the owner of the contract.

Step 2 The attacker calls the start function which transfers the contract's balance to an external address.

Step 3 The external contract's fallback function is triggered, which calls the start function again, extracting more funds.

Step 4 This process can be repeated until the contract's funds are depleted.

Other

Permission Control: The setOwner function can be called by anyone, which means anyone can become the owner of the contract. This is a serious security issue because the owner can call the withdrawal function to withdraw all the funds in the contract.

Hardcoded Address: WETH_CONTRACT_ADDRESS and TOKEN_CONTRACT_ADDRESS are hardcoded to the same address, which could be a mistake. If these two addresses should be different, then this will cause incorrect contract behavior.

Conclusion

This vulnerability is due to incorrect access control in the UniswapFrontRunBot contract. The impact of this vulnerability is significant as it can lead to financial losses. It's recommended that access control is correctly implemented in the contract to prevent unauthorized access and potential reentrancy attacks.