Closed code423n4 closed 1 year ago
0xRobocop marked the issue as low quality report
Insufficient proof.
Invalid premises:
for instance, due to a misconfiguration or oversight, the constant MAX_PRICE_RATIO is set to a ridiculously high value of 10^10.
MAX_PRICE_RATIO
is hardcoded:
int256 constant MAX_PRICE_RATIO = 10**4; // to be comparable with the prices calculated through abdk math
0xRobocop marked the issue as duplicate of #6
0xRobocop marked the issue as sufficient quality report
0xRobocop marked the issue as not a duplicate
0xRobocop marked the issue as low quality report
0xRobocop marked the issue as primary issue
JustDravee marked the issue as unsatisfactory: Insufficient proof
Lines of code
https://github.com/code-423n4/2023-08-shell/blob/c61cf0e01bada04c3d6055acb81f61955ed600aa/src/proteus/EvolvingProteus.sol#L259
Vulnerability details
Impact
Vulnerable Part in Code:
The calculation ratio is 1
MAX_PRICE_RATIO is set to 10^10 (10 billion), the condition for the vulnerability is met:
This show the vulnerability triggers, and the system accepts this price ratio as valid, even though it's vastly different from what's expected and reasonable within the context of the application.
With this manipulation, an attacker can:
Proof of Concept
Scenario: Imagine an Automated Market Maker as AMM protocol that uses the code you provided, including the MAX_PRICE_RATIO value set to an unexpectedly high value. This protocol allows users to swap between two tokens, X and Y, based on their price ratio. The legitimate and reasonable price ratio range for this scenario is 1 to 100.
Exploitation Steps:
Attacker examines the smart contract code and discovers the MAX_PRICE_RATIO vulnerability. Attacker prepares a transaction to exploit the vulnerability.
Let's assume the following values:
The attacker calculates the expected price ratio:
Since expected_price_ratio is significantly lower than MAX_PRICE_RATIO, the attacker knows that a transaction involving this price ratio should be accepted, even though it's not reasonable.
The attacker crafts a swap transaction with the following parameters:
The attacker submits the transaction, and the system processes it successfully. The smart contract doesn't reject the transaction due to the vulnerability.
Tools Used
Recommended Mitigation Steps
Assessed type
Other