The yield claiming functionality might be susceptible to front-running attacks.
In functions like _claimYield on line 332 in AaveDIVAWrapperCore.sol, the contract interacts with external protocols to claim yield for users, but there is no mechanism in place to prevent a malicious actor from front-running the transaction. For example, an attacker could observe a yield claim transaction and submit their transaction with a higher gas price to execute before the legitimate claim, possibly exploiting the claim mechanism.
An attacker could potentially steal yield or manipulate the protocol's state by exploiting the lack of protection against front-running, resulting in unfair distribution of yield or loss of funds.
The vulnerability arises due to the ability of an attacker to front-run legitimate yield claims by monitoring the mempool and submitting their own transaction with a higher gas fee before the original user's transaction is confirmed. This could allow an attacker to manipulate the system by claiming rewards in a way that benefits them unfairly, potentially impacting other users' expected yield.
Actors:
Attacker: A malicious user monitoring pending transactions and front-running reward claims.
Victim: A legitimate user attempting to claim their earned yield.
Protocol: The smart contract managing the yield distribution.
Working Test Case (PoC):
** Initial Setup**
The protocol has a claimYield() function that allows users to claim their accumulated rewards.
The function doesn't implement access control or measures to prevent transaction ordering manipulation (e.g., commit-reveal schemes or delays).
** Attack Strategy**
The attacker monitors the mempool for claimYield() transactions.
Before the victim's transaction is confirmed, the attacker submits their own yield claim with a higher gas price, ensuring their transaction is processed first.
If there’s a reward cap per block, the attacker's transaction might fully consume the available yield, starving the victim of their rightful rewards.
PoC Implementation (Hardhat Test Case in TypeScript)
Exploit Scenario
The victim has yield ready to claim.
The attacker is monitoring the mempool.
The victim submits a claimYield() transaction.
The attacker detects it in the mempool.
The attacker submits their own claimYield() transaction with a higher gas price.
The attacker’s transaction gets prioritized and executed first.
The victim's claim executes after the attacker, potentially receiving less or no yield if rewards are capped per block.
The attacker unfairly claims rewards before the victim.
If the protocol has a per-block yield cap, the victim might receive reduced or zero rewards.
Users may experience unfair yield distribution.
The attacker can repeatedly exploit this mechanism.
It erodes user trust in the fairness of the protocol.
Manual code review
✅ Commit-Reveal Scheme:
Require users to commit their intention to claim rewards (by submitting a hash of their claim) in one transaction.
Users then reveal their claim in a later transaction, preventing front-running.
Introduce randomized processing delays or batch processing, making it harder to predict and front-run transactions.
Give priority to users based on their stake duration or first-seen transaction rather than gas price.
Allow users to submit private transactions that bypass the public mempool, preventing front-running.
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.