Skip to content
Business logic Audit finding Intermediate

FlashAuction doesn’t pass the initiator to the recipient

The flashAction callback does not pass the initiator address to the recipient, unlike other flashloan implementations. This makes it harder for recipients to verify the legitimacy of the call, potentially allowing attackers to execute the callback and abuse integrations that do not implement additional checks.

Ruhum Follow

Originally disclosed on Code4rena

Submitted by Ruhum

https://github.com/code-423n4/2023-01-astaria/blob/main/src/CollateralToken.sol#L307-L310

Existing flashloans pass the initiator to the recipient in the function’s params, e.g. AAVE or Uniswap. It’s done to allow the recipient to verify the legitimacy of the call.

The CollateralToken’s flashAction() function doesn’t pass the initiator. That makes it more difficult to integrate the flashAction functionality. To protect yourself against other people executing the callback you have to:

  • create a flag
  • add an authorized function that sets the flag to true
  • only allow onFlashAction() to be executed when the flag is true

Considering that most people won’t bother with that there’s a significant risk of this being abused. While this doesn’t affect the Astaria protocol directly, it potentially affects its users and their funds. Because of that, I decided to rate it as MEDIUM.

Proof of Concept

onFlashAction() is executed with the ERC721 token data (contract addr, ID, and return address) as well as the arbitrary data bytes.

receiver.onFlashAction(
        IFlashAction.Underlying(s.clearingHouse[collateralId], addr, tokenId),
        data
      )

Recommended Mitigation Steps

Add the initiator to the callback to allow easy authentication.

androolloyd (Astaria) acknowledged

Picodes (judge) commented:

Considering the number of exploits we’ve seen with this, this is nearly high severity in my opinion.


The original report as published on Code4rena, by Ruhum. Images and videos are our own copies; raw HTML is shown as text. View it on Code4rena.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the flashAction callback omits the initiator address from its parameters, preventing recipients from authenticating the caller.

Impact

This could allow attackers to abuse integrations that do not implement additional checks, potentially affecting users and their funds, though the Astaria protocol itself is not directly affected.

What the attacker needed

Victim integrates flashAction without checks

The fix

The callback should include the initiator address so recipients can easily authenticate the call.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

A flashloan is a loan that must be borrowed and repaid in the same transaction. When the loan is sent to a receiver contract, the receiver is called back to perform actions. Other systems include the address of the person who started the loan so the receiver can check that the call is legitimate. Here that address is missing, so a receiver cannot easily tell who initiated the loan, which could let someone else trigger the callback and misuse the receiver's funds.

What is Business logic?

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.

More by Ruhum

View all

55 more disclosed reports, best first.

More from Astaria contest

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.