Skip to content
Access control Audit finding Intermediate

changeTokenOf makes it impossible for holders of oldToken to redeem the overflowed assets.

The changeTokenOf function allows the project owner to replace the project's token, which prevents holders of the old token from redeeming overflowed assets. An attacker (the owner) could change the token and lock out existing holders from their redeemable funds.

cccz Follow

Originally disclosed on Code4rena

Submitted by cccz

When the owner calls the changeTokenOf function of the JBController contract, the token corresponding to the current project will be changed, which will make the oldToken holder unable to redeem the overflowing assets.

Proof of Concept

https://github.com/jbx-protocol/juice-contracts-v2-code4rena//blob/828bf2f3e719873daa08081cfa0d0a6deaa5ace5/contracts/JBController.sol#L588-L606

https://github.com/jbx-protocol/juice-contracts-v2-code4rena//blob/828bf2f3e719873daa08081cfa0d0a6deaa5ace5/contracts/JBTokenStore.sol#L236-L269

Recommended Mitigation Steps

Consider adding a delay to changeTokenOf, or adding a function to convert oldToken to newToken.

mejango (Juicebox) confirmed

mejango (Juicebox) resolved:

PR with fix: PR #1

berndartmueller (warden) reviewed mitigation:

Once a token is set for a project, it can not be changed anymore.


The original report as published on Code4rena, by cccz. 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 changeTokenOf function replaces the project's token without preserving redemption rights for holders of the previous token.

Impact

Holders of the old token could be unable to redeem overflowed assets after the owner changes the token.

What the attacker needed

Owner calls changeTokenOf; project has overflowed assets

The fix

The project resolved it by making the token unchangeable once set for a project.

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 project has a token that holders can redeem for a share of extra funds (overflow). The owner can switch to a new token, and the old token is no longer recognised for redemption. So people holding the old token lose access to their funds.

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 cccz

View all

104 more disclosed reports, best first.

More from Juicebox Buyback Delegate

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.