JBToken: mint function could mint arbitrary amount of tokens
The JBToken contract's mint function is restricted only to the owner, and ownership can be transferred to any address via the changeTokenOf function, allowing that address to mint an arbitrary number of tokens.
Submitted by cccz
The owner of the JBToken contract can mint arbitrary amount of tokens.
In general, the owner of the JBToken contract is the JBTokenStore contract, and the minting of the tokens is controlled by the JBController contract, but when the changeTokenOf function of the JBController contract is called, the owner will be transferred to any address, which can mint arbitrary amount of tokens.
function mint(
uint256 _projectId,
address _account,
uint256 _amount
) external override onlyOwner {
_projectId; // Prevents unused var compiler and natspec complaints.
return _mint(_account, _amount);
}
Proof of Concept
Recommended Mitigation Steps
Consider setting minter as the JBTokenStore contract and adding the onlyminter modifier to the mint function.
mejango (Juicebox) acknowledged
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 mint function only checks that the caller is the owner, but ownership can be reassigned to an arbitrary address, so the access control is too broad.
Impact
An attacker who becomes the owner could mint an unlimited number of tokens, potentially devaluing the token and harming holders.
What the attacker needed
Attacker becomes owner via changeTokenOf
The fix
The mint function should be restricted to a specific minter (the JBTokenStore contract) rather than any owner, for example by adding an onlyMinter modifier.
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 token contract lets someone create new tokens out of thin air. Here, the contract's owner can do that, and the owner can be changed to any address, so whoever becomes owner can create as many tokens as they want.
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.