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.
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
- Attacker deposits 500 Vader
- Attacker receives credit for 500 while the xVader contract gets the 500 - fee.
- Attacker calls
leave()leaving the contract with a difference of the fee. - https://www.financegates.net/2021/07/28/another-polygon-yield-farm-crashes-to-zero-after-exploit/
- https://github.com/code-423n4/2021-11-vader/blob/main/contracts/x-vader/XVader.sol
- 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
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
- Attacker deposits 500 Vader tokens.
- Attacker receives credit for 500 while the contract receives 500 minus the fee.
- 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.