In the Purchase()
function, the loop size depends on data from Oracle. The oracle could potentially return an extremely large array of assets.
Without an upper limit on the array.length
it will be risky to your contract. It could result in excessive gas consumption and a DOS attack if the oracle returns a very large array.
No limit on loop iteration or gas limits.
https://github.com/Cyfrin/2024-10-swan-dria/blob/main/contracts/swan/BuyerAgent.sol
Potential Denial Of Service attack
Transaction Failures due to gas Limits.
No limits on loop iterations or gas consumptions.
An attacker could manipulate the Oracle result to return a very large array of assets which could cause the loop to make many external calls which could hit block gas limits
resulting to transaction failure.
Manual Review
Set a Maximum limit to array.length
to prevent excessive looping.
Avoid relying on Oracle data for controlling execution flow by using internally managed checks and validations wherever possible.
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.