Incorrect burn address in Vader.sol
The internal _transfer function incorrectly uses msg.sender as the burn address when burning fees, instead of the sender parameter. This causes fees to be burned from the wrong account for transferFrom and transferTo calls, leading to incorrect token balances and potential fund loss.
Vader Protocol contest
Originally disclosed on Code4rena
The internal _transfer() function is called from external facing transfer(), transferFrom(), and transferTo() functions all of which have different sender addresses. It is msg.sender for transfer(), sender parameter for transferFrom() and tx.origin for transferTo().
These different senders are reflected in the sender parameter of _transfer() function. While this sender parameter is correctly used for transfer of tokens within _transfer, the call to _burn() on L129 incorrectly uses msg.sender as the burn address which is correct only in the case of the transfer() caller’s context. This is incorrect for transferFrom() and transferTo() caller contexts.
This will incorrectly burn the fees from a different (intermediate contract) account for all users of the protocol interacting with the transferTo() and transferFrom() functions and lead to incorrect accounting of token balances or exceptional conditions. Protocol will break and lead to fund loss.
Recommend changing L129 to: _burn(sender, _fee);
strictly-scarce (vader) confirmed:
Valid, disagree with severity though. Funds-not-at-risk. Recommend: 2
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
Impact
This could lead to incorrect accounting of token balances or exceptional conditions, potentially causing the protocol to break and funds to be lost.
What the attacker needed
Users interact with transferFrom or transferTo
The fix
The fix is to change the _burn call to use the sender parameter instead of msg.sender.
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.
In a smart contract, when tokens are transferred, a fee is sometimes taken and burned (destroyed). The code mistakenly takes the fee from the person who initiated the transaction (msg.sender) rather than from the actual sender of the tokens. This means for some transfer methods, the wrong account loses tokens, which can mess up balances and cause losses.
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.