Mint limit is not reduced when the Vault is burning TAU
When a Vault burns TAU on behalf of a user, the contract incorrectly reduces the Vault's minted token count by zero because it uses the user's balance instead of the Vault's. This prevents the Vault from minting new tokens up to its limit.
Source: https://github.com/sherlock-audit/2023-03-taurus-judging/issues/149
Found by
8olidity, Chinmay, GimelSec, HonorLt, LethL, Ruhum, SunSec, bytes032, cducrest-brainbot, chaduke, duc, mstpr-brainbot, nobody2018, shaka, tvdung94, y1cunhui
Summary
Upon burning TAU, it incorrectly updates the currentMinted when Vault is acting on behalf of users.
Vulnerability Detail
When the burn of TAU is performed, it calls _decreaseCurrentMinted to reduce the limit of tokens minted by the Vault:
function _decreaseCurrentMinted(address account, uint256 amount) internal virtual {
// If the burner is a vault, subtract burnt TAU from its currentMinted.
// This has a few highly unimportant edge cases which can generally be rectified by increasing the relevant vault's mintLimit.
uint256 accountMinted = currentMinted[account];
if (accountMinted >= amount) {
currentMinted[msg.sender] = accountMinted - amount;
}
}
The issue is that it subtracts accountMinted (which is currentMinted[account]) from currentMinted[msg.sender]. When the vault is burning tokens on behalf of the user, the account != msg.sender meaning the currentMinted[account] is 0, and thus the currentMinted of Vault will be reduced by 0 making it pretty useless.
Another issue is that users can transfer their TAU between accounts, and then amount > accountMinted will not be triggered.
Impact
currentMinted is incorrectly decreased upon burning so vaults do not get more space to mint new tokens.
Code Snippet
Tool used
Manual Review
Recommendation
A simple solution would be to:
uint256 accountMinted = currentMinted[msg.sender];
But I suggest revisiting and rethinking this function altogether.
Discussion
Sierraescape
https://github.com/protokol/taurus-contracts/pull/85
MLON33
Fixed here
IAm0x52
Fix looks good. _decreaseCurrentMinted now always uses msg.sender as account
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 function uses the wrong account when updating the minted count: it subtracts from the caller's count but reads the balance of the account passed as a parameter, which may be different.
Impact
The vault's minted token count is not reduced correctly, so it cannot mint new tokens up to its limit.
What the attacker needed
Vault burns TAU on behalf of a user
The fix
The fix was to always use the caller's address when updating the minted count.
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 vault is a smart contract that manages tokens for users. It has a limit on how many tokens it can create. When it destroys some tokens, the limit should go down, but a mistake means the limit stays the same, so the vault cannot create new tokens later.
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.