Skip to content
Access control Audit finding Intermediate

Uninitialized Variable marketWhitelist in RCTreasury.sol

The marketWhitelist variable in RCTreasury.sol is never initialised, so marketWhitelistCheck() always returns true and does not enforce any whitelist restriction. An attacker could bypass intended access controls on restricted markets.

leastwood Follow

Originally disclosed on Code4rena

Submitted by leastwood, also found by 0xsanson, gpersoon, hickuphh3 and JMukesh

The variable, marketWhitelist, is never initialized in the contract RCTreasury.sol. As a result, the function marketWhitelistCheck() does not perform a proper check on whitelisted users for a restricted market. Additionally, the function will always return true, even if a market wishes to restrict its users to a specific role.

The initial state variable is defined in RCTreasury.sol L75.

The state variable marketWhitelist is accessed in the function RCTreasury.marketWhitelistCheck() at RCTreasury.sol L269-L281.

The function RCTreasury.marketWhitelistCheck() is called in RCMarket.newRental() at RCMarket.sol L758-L761. The comment indicates that there should be some ability to restrict certain markets to specific whitelists, however, there are no methods in RCTreasury that allow a market creator to enable this functionality.

Recommend ensuring this behavior is intended. If this is not the case, consider adding a function that enables a market creator to restrict their market to a specific role by whitelisting users.

Splidge (Reality Cards) confirmed and disagreed with severity:

I think the severity could be double-checked on this one. It’s a close one but I’d be tempted to put it under 1 (low risk) as a “Function incorrect to spec”. Regardless, this will be fixed.

Edit: I notice the duplicates were both marked as 1 (low risk).

0xean (judge) commented:

based on ” but the function of the protocol or its availability could be impacted” in the code4 docs, I am going to agree with warden and leave this as a 2. The function of the protocol is certainly impacted in a case where the whitelist if not working correctly.

Splidge (Reality Cards) patched:

Fixed here

The original report as published on Code4rena, by leastwood. 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 state variable marketWhitelist was declared but never assigned, so the check function defaults to true.

Impact

The whitelist restriction is not enforced, so any user could access a market that was intended to be restricted to specific roles.

What the attacker needed

None

The fix

The issue was fixed by the 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 whitelist is a list of allowed users. The contract meant to check this list but never set it up, so the check always says 'yes' to everyone. This means anyone could use a market that was supposed to be limited to certain people.

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 leastwood

View all

70 more disclosed reports, best first.

More from Reality Cards (round 2)

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.