Approve operation is not overridden to call transferSanity , thus its allowed to approve blacklisted accounts, which breaks protocol invariant
The token's approve function does not check whether the owner or spender is blacklisted, contrary to the documented invariant. A blacklisted account could therefore be approved and transact, breaking the protocol's blacklist enforcement.
Submitted by MrValioBg, also found by KupiaSec
In the readme invariant docs it is specified, as requirement for approval operations, the following conditions:
- Owner not being blacklisted
- Spender not being blacklisted
Note: to view the provided image, please see the original submission here.
However, this invariant is broken by the protocol’s implementation, as there is no logic to enforce that. The approve() function is not overridden and transferSanity() is not called for the operation.
Proof of Concept
To confirm we can refer to Token.sol:
The approve() function is not overridden.
Recommended mitigation steps
Override the approve function and check if the _msgSender() and spender are not blacklisted, before allowing the operation. This can be done with transferSanity() check, the same way it is already implemented for the other operations.
contract EURFToken is
ERC20MetaTxUpgradeable,
ERC20AdminUpgradeable,
ERC20ControlerMinterUpgradeable,
FeesHandlerUpgradeable,
UUPSUpgradeable
{
+ function approve(address spender, uint256 value) public override returns (bool) {
+ transferSanity(_msgSender(), spender, value);
+ return super.approve(spender, value);
+ }
The submission outlines a significant discrepancy between the code’s implementation and its documentation that can be considered an important issue; it is possible for blacklisted parties to become approved and thus transact.
I believe a medium-severity evaluation for this submission is correct as a direct, impactful, and unambiguous discrepancy between the documentation and the implementation has been defined.
To note, the sponsor does not intend to rectify this issue; however, it was judged as Medium due to C4 guidelines and how the discrepancy is provable and the documentation properly correlates to the code’s implementation.
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 approve function was not overridden to call the transferSanity check, so the blacklist invariant was not enforced for approvals.
Impact
Blacklisted parties could become approved and transact, breaking the protocol's documented invariant; the judge rated this as medium severity.
What the attacker needed
A blacklisted account; ability to call approve
The fix
Override the approve function to call transferSanity on the sender and spender before allowing the operation.
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 blacklist is meant to stop certain accounts from using a token. The token's approval step, which lets one account spend another's tokens, skipped the blacklist check. So a blocked account could still be given permission to move tokens.
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.