HardhatFoundry
30,000 USDC
View results
Submission Details
Severity: medium
Invalid

Limitations on Assigning State Variable Values

File location:

https://github.com/Cyfrin/2024-07-biconomy/blob/9590f25cd63f7ad2c54feb618036984774f3879d/contracts/lib/ExecLib.sol#L32-L36

Summary

The 'decodeSingle' function in the 'ExecLib' contract allows setting state variable values ​​without a maximum limit, which can lead to exploits by providing very large values. This can impact the security and integrity of the contract.

Vulnerability Details

In the 'ExecLib' contract, the 'decodeSingle' function does not limit the maximum value that can be assigned to the 'value' variable. When very large values ​​are assigned, this can cause integrity issues with the contract, including potential overflow attacks or unintended resource utilization.

Impact

  • Overflow attack.

  • Excessive gas consumption.

  • Potential damage to contract logic.

Tools Used

  • Inspection manual

  • Solidity

Recommendations

Code snippet:

L32-L36

function decodeSingle(bytes calldata executionCalldata) internal pure returns (address target, uint256 value, bytes calldata callData) {
target = address(bytes20(executionCalldata[0:20]));
value = uint256(bytes32(executionCalldata[20:52]));
callData = executionCalldata[52:];
}

Fixed code:

To fix the problem, you can add logic to ensure that the 'value' value is within reasonable limits. For example, you can set a maximum limit for 'value'.

Updates

Lead Judging Commences

0xnevi Lead Judge
11 months ago
0xnevi Lead Judge 11 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.