Dria

Swan
NFTHardhat
21,000 USDC
View results
Submission Details
Severity: medium
Valid

Oracle Manipulation in BuyerAgent.purchase()

Description:

The purchase() function in the BuyerAgent contract trusts the output from the oracle without any validation. A malicious oracle could return an arbitrary list of assets, causing the buyer to purchase unintended assets.

Summary:

The BuyerAgent contract's purchase() function executes purchases based on the oracle's output without performing any validation checks. This lack of validation allows a malicious oracle to manipulate the buyer agent's purchases by returning arbitrary asset addresses.

Vulnerability Details:

In the purchase() function of the BuyerAgent contract, the asset addresses to be purchased are directly obtained from the oracle's output using abi.decode(output, (address[])). The function then proceeds to purchase these assets without verifying if they meet the buyer's intended criteria or if they are legitimate assets within the Swan protocol.

Impact:

A malicious oracle could exploit this vulnerability to manipulate a buyer agent's purchases, causing the agent to spend its funds on undesirable or fraudulent assets. This could lead to financial losses for the buyer and potentially drain the agent's balance.

Tools Used:

  • Manual code review

Recommendations:

To mitigate this vulnerability, it is recommended to add validation checks on the oracle's output within the purchase() function. These checks should ensure that the assets returned by the oracle meet the buyer's predefined criteria and are valid assets within the Swan protocol. Additionally, implementing a mechanism to verify the integrity and authenticity of the oracle responses can further enhance the security of the purchasing process.

Updates

Lead Judging Commences

inallhonesty Lead Judge 8 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Appeal created

inallhonesty Lead Judge
8 months ago
inallhonesty Lead Judge 8 months ago
Submission Judgement Published
Validated
Assigned finding tags:

There is no oracle whitelisting

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.