Skip to content
Access control Audit finding Beginner

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.

gpersoon Follow

Originally disclosed on Code4rena

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

// https://github.com/code-423n4/2021-11-bootfinance/blob/7c457b2b5ba6b2c887dafdf7428fd577e405d652/vesting/contracts/Vesting.sol#L73-L98

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.

chickenpie347 (Boot Finance) confirmed

The original report as published on Code4rena, by gpersoon. Images and videos are our own copies; raw HTML is shown as text. View it on Code4rena.

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.

More by gpersoon

View all

47 more disclosed reports, best first.

More from Boot Finance contest

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

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.