Overwrite benRevocable
The vest function in Vesting.sol allows any caller to overwrite the benRevocable mapping for any beneficiary, erasing previous revocation status. An attacker could set any beneficiary to revocable, bypassing the owner-only revoke mechanism.
Submitted by gpersoon, also found by pauliax, WatchPug, cmichel, hyh, and leastwood
Impact
Anyone can call the function vest() of Vesting.sol, for example with a smail \_amount of tokens, for any \_beneficiary.
The function overwrites the value of benRevocable\[\_beneficiary], effectively erasing any previous value.
So you can set any \_beneficiary to Revocable. Although revoke() is only callable by the owner, this is circumventing the entire mechanism of benRevocable.
Proof of Concept
function vest(address \_beneficiary, uint256 \_amount, uint256 \_isRevocable) external payable whenNotPaused {
...
if(\_isRevocable == 0){
benRevocable\[\_beneficiary] = \[false,false]; // just overwrites the value
}
else if(\_isRevocable == 1){
benRevocable\[\_beneficiary] = \[true,false]; // just overwrites the value
}
Recommended Mitigation Steps
Whitelist the calling of vest() Or check if values for benRevocable are already set.
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 vest function unconditionally overwrites the benRevocable mapping without checking if a value already exists or restricting who can call it.
Impact
An attacker could set any beneficiary to revocable, circumventing the owner-only revoke mechanism.
What the attacker needed
None
The fix
Whitelist the calling of vest() or check if values for benRevocable are already set.
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 smart contract has a function that lets anyone set a flag for any address, overwriting previous settings. This means the owner's control over who can be revoked is bypassed, because anyone can change the flag.
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.