Skip to content

Uniswap callback is not protected

Description

The Uniswap callback function is not properly protected, potentially allowing unauthorized access. This can be mitigated by adding a validation or check to ensure the callback is coming from a trusted source.

Examples

Insecure Code

solidity
function uniswapV2Call(...) {...}

Secure Code

solidity
function uniswapV2Call(...) {
   require(msg.sender == UNISWAP_POOL, "Unauthorized");
   ...}

Remediation

Add a validation or check to the callback function to ensure it is coming from a trusted source, such as the Uniswap pool contract.

Rule Details

FieldValue
IDCODE-0485
CategoryAccessControl
SeverityHIGH
CWECWE-284
ConfidenceLOW
ImpactHIGH
LikelihoodMEDIUM
ExploitabilityMODERATE
Tagsuniswap, callback, access control
OWASPN/A

References