Skip to content
Access control Audit finding Intermediate

addInvestor() Does Not Check Availability of investors_supply

The addInvestor() function does not check that the total amount allocated to investors stays within the investors_supply limit. An attacker with the admin private key could allocate more tokens than available and then claim all tokens.

Meta0xNull Follow

Originally disclosed on Code4rena

Submitted by Meta0xNull

Impact

When add investor, addInvestor() does not check how many tokens is available from investors_supply. The total tokens allocated for Investors could more than investors_supply.

Possible Attack Scenario:

  1. Attacker who have Admin Private key call addInvestor() and Input \_amount >= investors_supply.
  2. Attacker can Claim All Available Tokens Now.

Proof of Concept

https://github.com/code-423n4/2021-11-bootfinance/blob/main/vesting/contracts/InvestorDistribution.sol#L85-L94

Tools Used

Manual Review

Recommended

  1. Add require(\_amount <= (investors_supply - Allocated_Amount))
  2. When Add an Investor add the amount to Allocated_Amount with SafeMath

chickenpie347 (Boot Finance) acknowledged:

While this is true, the addInvestor would be a one-time routine at deployment which would precisely send the allocated number of tokens to the contract as per to the allocatations.

The original report as published on Code4rena, by Meta0xNull. 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

Likely the addInvestor() function lacks a check to ensure the sum of allocated amounts does not exceed investors_supply.

Impact

An attacker with the admin private key could allocate more tokens than the investors_supply and claim all available tokens.

What the attacker needed

Admin private key

The fix

The function should be fixed by adding a require statement to ensure the amount does not exceed the remaining supply and by tracking allocated amounts with SafeMath.

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.

This is a smart contract bug where a function that adds investors doesn't verify that the total tokens given out don't exceed the supply set aside for investors. Someone with the admin key could give themselves more tokens than allowed and then take all the tokens in the contract.

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 Meta0xNull

View all

3 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.