Burner role cannot be revoked
The admin function that grants permission to burn game items only sets the permission to true and cannot set it back to false. If an admin accidentally grants this permission to the wrong address, that address can burn any user's tokens and the permission cannot be revoked.
Timenov Follow with 0x11singh99, vnavascues and 12 others
Originally disclosed on Code4rena
Submitted by Timenov, also found by 0x11singh99, vnavascues, MrPotatoMagic, Rolezn, merlinboii (1, 2), btk, andywer, 0xblackskull, josephdara, CodeWasp, MidgarAudits, Sabit, SovaSlava, lil_eth, and sobieski
In GameItems::setAllowedBurningAddresses the admin can update the allowedBurningAddresses mapping.
function setAllowedBurningAddresses(address newBurningAddress) public {
require(isAdmin[msg.sender]);
allowedBurningAddresses[newBurningAddress] = true;
}
This mapping is used to check if the msg.sender has permission to burn specific amount of game items from an account. This can happen through the burn function.
function burn(address account, uint256 tokenId, uint256 amount) public {
require(allowedBurningAddresses[msg.sender]);
_burn(account, tokenId, amount);
}
However setAllowedBurningAddresses() works only one way. I mean that the admin can give permission, but not revoke it.
Proof of Concept
Imagine the following scenario. Admin calls setAllowedBurningAddresses with wrong address. Now this address has the permission to burn any token from any user. Now no one can remove the wrong address from the mapping.
Recommended Mitigation Steps
Use adjustAdminAccess function as an example:
function adjustAdminAccess(address adminAddress, bool access) external {
require(msg.sender == _ownerAddress);
isAdmin[adminAddress] = access;
}
So the new setAllowedBurningAddresses function should look something like this:
function adjustBurningAccess(address burningAddress, bool access) public {
require(isAdmin[msg.sender]);
allowedBurningAddresses[burningAddress] = access;
}
Now even if the admin sets the wrong address, he can immediately change it.
hickuphh3 (judge) decreased severity to Medium and commented:
Similar to M-02, but the root causes are different even though the effect is the same.
https://github.com/ArenaX-Labs/2024-02-ai-arena-mitigation/pull/18
Status: Not fully mitigated. Full details in report from d3e4, and also included in the Mitigation Review section below.
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 setAllowedBurningAddresses function only sets the mapping entry to true and provides no way to set it to false, so permissions cannot be revoked.
Impact
If an admin accidentally grants burning permission to the wrong address, that address can burn any user's tokens and the permission cannot be revoked.
What the attacker needed
Admin grants burning permission to wrong address
The fix
The function should be changed to accept a boolean so the admin can both grant and revoke burning permission.
How it was found
- Admin calls setAllowedBurningAddresses with a wrong address.
- That address now has permission to burn any token from any user.
- No one can remove the wrong address from the mapping.
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 this game contract, an admin can allow certain addresses to destroy (burn) other players' items. The function that gives this permission only turns it on; there is no way to turn it off. So if the admin makes a mistake and allows the wrong address, that address can destroy anyone's items forever.
What is Access control?
A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.