Skip to content
Business logic Audit finding Intermediate

VADER contains a Fee-On-Transfer

The Vader token charges a fee on transfers, but the xVader contract credits depositors with the full amount they send, not the amount actually received. An attacker could repeatedly enter and leave the contract to drain the fee difference.

jayjonah8 Follow

Originally disclosed on Code4rena

Submitted by jayjonah8, also found by rfa, shri4net, and xYrYuYx

Impact

The whitepaper says that the Vader token contains a Fee-On-Transfer so in XVader.sol, an attacker may be able to keep calling enter() and leave() while being credited more tokens than the contract actually receives eventually draining it.

Proof of Concept

  1. Attacker deposits 500 Vader
  2. Attacker receives credit for 500 while the xVader contract gets the 500 - fee.
  3. Attacker calls leave() leaving the contract with a difference of the fee.
  4. https://www.financegates.net/2021/07/28/another-polygon-yield-farm-crashes-to-zero-after-exploit/
  5. https://github.com/code-423n4/2021-11-vader/blob/main/contracts/x-vader/XVader.sol
  6. https://www.vaderprotocol.io/whitepaper

Tools Used

Manually code review

Recommended Mitigation Steps

There should be pre and post checks on balances to get the real amount

0xstormtrooper (Vader) acknowledged:

Vader fee on transfer will be removed

The original report as published on Code4rena, by jayjonah8. 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

The contract credits users based on the amount they specify, not the actual balance increase, so the fee-on-transfer token causes a mismatch.

Impact

An attacker could repeatedly enter and leave to drain the contract's funds, as the contract credits more than it receives.

What the attacker needed

Vader token has a fee-on-transfer mechanism; Attacker has some Vader tokens to deposit

The fix

The contract should check balances before and after transfers to credit only the actual amount received.

How it was found

  1. Attacker deposits 500 Vader tokens.
  2. Attacker receives credit for 500 while the contract receives 500 minus the fee.
  3. Attacker calls leave() and the contract is left with a deficit equal to the fee.

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.

Some tokens take a small cut (a fee) when they are transferred. The xVader contract assumed it received the full amount, so it gave the attacker more credit than it actually got. By repeating this, the attacker could slowly empty the contract.

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 jayjonah8

View all

18 more disclosed reports, best first.

More from Vader Protocol 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.