Self transfer can lead to unlimited mint
The transfer function in nTokenAction.sol incorrectly handles self-transfers by making the amount negative and then converting it back to positive, which can lead to unlimited minting of tokens. An attacker could exploit this to mint an arbitrary number of tokens.
Submitted by Omik, also found by gpersoon
The implementation of the transfer function in nTokenAction.sol is different from the usual erc20 token transfer function.
This happens because it counts the incentive that the user gets, but with a self-transfer, it can lead to unlimited mint. In L278, it makes the amount negative, but in L279, it returns the value to an amount that is not negative. So, in the L281-282, it finalizes a positive value, only because the negative value is changed to the positive value.
You can interact with this transfer function through nTokenERC20Proxy.sol.
Recommend adding (sender != recipient).
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
An attacker could mint an unlimited number of tokens, potentially devaluing the token and causing financial loss.
What the attacker needed
Ability to call transfer function
The fix
The transfer function should be fixed by adding a check that the sender and recipient are not the same address.
How it was found
- Interact with the transfer function through nTokenERC20Proxy.sol
- Perform a self-transfer (send tokens to yourself)
- Observe that the incentive calculation results in a positive amount, leading to unlimited mint
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 self-transfer is when you send tokens to yourself. The code that handles transfers mistakenly gives you extra tokens when you do this, and you can repeat it to create as many tokens as you want.
What is Smart contracts?
Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.