Skip to content
Business logic Audit finding Intermediate

Deposit whitelist enforced on msg.sender instead of user

The Treasury deposit function enforces a deposit whitelist on the msg.sender address rather than the user address credited. A user whose msg.sender is blacklisted can still deposit from another whitelisted msg.sender while keeping their user address for leaderboards and NFTs.

0xRajeev Follow

Originally disclosed on Code4rena

Submitted by 0xRajeev

The Treasury deposit() function credits amount to the user address in parameter instead of the msgSender() function that is actually making the deposit with the rationale (as explained in the Natspec comment) being that this may be called via contract or L1-L2 bot.

However, the deposit whitelist should ideally be enforced on the _user address. If msgSender() is blacklisted, user address can still deposit() from another whitelisted msgSender() address while retaining the user address that is used for leader boards and NFTs.

The impact of this is that even if the user misbehaves in interactions with the system (e.g. trolls, spams) and their corresponding msgSender() is removed from the whitelist. The user can continue to deposit into the system via another whitelisted msgSender() without any impact to leader boards or NFTs.

Recommend using whitelist on user address instead of msgSender().

Splidge (Reality Cards) disputed and disagreed with severity:

It is stated that the whitelist will “only allow certain addresses to deposit” hereand that toggleWhitelist() allows an address to deposit here.

I think that the whitelist is performing as intended, but thanks for this issue report as this could easily have been a larger issue.

We only plan to use the whitelist as a very rudimentary barrier just for the initial launch. I think that only allowing certain addresses to deposit is sufficient for now. Maybe if time allows I’ll make the changes but changing the whitelist to allow the _user instead of the msgSender() would also block contracts and layer1->layer2 bot, so there’d need to be exceptions made for them. I’d rather not play about with sensitive functions at the last minute when we aren’t going to be using the whitelist much anyway.

dmvt (Judge) commented:

Warden makes a good point. This could allow griefing of other parts of the system. If the barrier winds up being needed longer than expected or users act in unexpected ways, sponsor may wind up wishing they had reconsidered addressing this. Obviously, sponsor is free to ignore, but the issue seems to be a valid one with significant potential impact.

The original report as published on Code4rena, by 0xRajeev. 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 whitelist check is applied to the transaction sender (msg.sender) instead of the user address that receives the deposit credit.

Impact

A user removed from the whitelist could continue depositing via another whitelisted sender without affecting their leaderboard or NFT status, potentially enabling griefing or spam.

What the attacker needed

User address is whitelisted; attacker controls a whitelisted msg.sender

The fix

The whitelist should be enforced on the user address instead of the msg.sender address, though the sponsor noted this would require exceptions for contracts and L1-L2 bots.

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 smart contract has a deposit function that checks whether the address sending the transaction is on a whitelist. But the deposit is credited to a different user address given as a parameter. So if someone is removed from the whitelist, they can still deposit by using another whitelisted address to send the transaction, while the credit still goes to their own user address.

What is Business logic?

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.

More by 0xRajeev

View all

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

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.