Skip to content
Access control Audit finding Intermediate

possibility of minting rJOE tokens before ownership is changed to RocketJoeStaking

The rJOE token contract allowed the owner to mint tokens without staking JOE, and ownership was to be transferred to a staking contract. An attacker with owner privileges could mint tokens before the transfer, potentially diluting the staking pool.

hubble Follow

Originally disclosed on Code4rena

Submitted by hubble

There is a possibility of the rJOE tokens in RocketJoeToken.sol to be minted by original owner without staking any JOE, before the ownership is transferred to RocketJoeStaking

Proof of Concept

Contract : RocketJoeToken.sol Line : 37 function mint(address _to, uint256 _amount) external onlyOwner { _mint(_to, _amount); }

Recommended Mitigation Steps

The transferOwnership(address) function inherited from Ownable.sol is used to change to a new owner i.e., RocketJoeStaking. In the RocketJoeToken.sol contract, define and override this function with an additional check that the totalSupply <= 0

cryptofish7 (Trader Joe) acknowledged


The original report as published on Code4rena, by hubble. 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 mint function is restricted only to the owner, and the ownership transfer does not prevent minting before the transfer, so the original owner can mint without staking.

Impact

The original owner could mint rJOE tokens without staking JOE before ownership is transferred, potentially diluting the staking pool.

What the attacker needed

Owner privileges before ownership transfer

The fix

Override the transferOwnership function to require that totalSupply is zero before ownership can be transferred.

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.

In many crypto projects, a special owner account can create new tokens. Here, the owner could create rJOE tokens without putting up the required JOE tokens first. If that owner is malicious or compromised, they could make extra tokens before control is handed to the staking contract, which might reduce the value of everyone else's 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.

More by hubble

View all

11 more disclosed reports, best first.

More from Trader Joe 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.