The setAmountPerRound
function allows the contract owner to set the amountPerRound
value without enforcing an upper limit. This absence of a ceiling permits the owner to assign an arbitrarily large value to amountPerRound
, which governs the maximum funds a buyer agent can spend per round.
https://github.com/Cyfrin/2024-10-swan-dria/blob/main/contracts/swan/BuyerAgent.sol#L393
The minFundAmount
function calculates the minimum required funds as the sum of amountPerRound
and the oracle fee obtained from the Swan contract. Although Solidity version ^0.8.0 inherently protects against arithmetic overflows by reverting transactions on overflow conditions, the lack of explicit validation or caps on either amountPerRound
can lead to scenarios where minFundAmount
could become unreasonably large.
The issue require ownership privileges, limiting their exploitability to malicious owners or those who have compromised ownership keys, or an owner who mistakenly has set larger amount per round. However, if exploited, the impact is substantial as it can disrupt the interactions within the Swan ecosystem.
Manual Review
Introduce a maximum allowable value for amountPerRound
within the BuyerAgent contract to prevent it from being set to excessively high values.
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.