The contract improperly decodes metadata using abi.decode and fails to perform sufficient validation on the extracted values. This could lead to incorrect protocol selection, potentially causing unintended behavior or security issues.
In the _runSwap function, the contract decodes metadata to extract the protocol and corresponding swap data:
The function expects metadata to be correctly formatted, containing a valid PROTOCOL enum and associated bytes data.
However, there is no check ensuring that metadata actually has the expected structure before decoding.
If metadata[0] or metadata[1] contains invalid or malformed data, abi.decode could return incorrect values, leading to improper execution flow or unintended reverts.
Reverts on Unexpected Data**: If metadata is incorrectly formatted or manipulated, the contract may revert unexpectedly, leading to failed swaps.
Invalid Protocol Execution: If an attacker can manipulate metadata in a way that bypasses the validation, they may cause the contract to process the wrong protocol, potentially leading to asset mismanagement.
Potential DOS Vector: If an external caller supplies bad data, the system may become unresponsive due to constant reverts.
Manual Review
To mitigate the risk associated with improper abi.decode usage, implement the following checks in a unified manner:
There is no real proof, concrete root cause, specific impact, or enough details in those submissions. Examples include: "It could happen" without specifying when, "If this impossible case happens," "Unexpected behavior," etc. Make a Proof of Concept (PoC) using external functions and realistic parameters. Do not test only the internal function where you think you found something.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.