Skip to content
Business logic Audit finding Intermediate

Shelter claimed mapping is set with _to address and not msg.sender

The Shelter contract's withdraw function tracks claimed withdrawals using the recipient address (_to) instead of the caller (msg.sender), allowing any user with a small share to repeatedly withdraw and drain all funds.

0xliumin Follow

Originally disclosed on Code4rena

Submitted by 0xliumin, also found by cmichel, leastwood, and pauliax

Any user can withdraw all the funds from the shelter. This is done by calling withdraw repeatedly until all funds are drained. You only need to have a small share.

Even if the claimed mapping was checked, there would still be a vulnerability. This is because the claimed mapping is updated with the _to address, not the msg.sender address.

Recommended Mitigation Steps

Remediation is to change the _to to msg.sender. Shelter.sol#L55

leekt (Concur) confirmed

Alex the Entreprenerd (judge) increased severity to High and commented:

Am marking this as a unique finding as this one shows another issue with the Shelter withdraw function.

Because this also allows for draining of all rewards, am raising to High Severity.


The original report as published on Code4rena, by 0xliumin. 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

The claimed mapping is updated with the _to address instead of msg.sender, so the same caller can withdraw repeatedly by varying the recipient.

Impact

Any user with a small share could drain all funds from the shelter.

What the attacker needed

A small share in the shelter

The fix

The fix is to change the _to to msg.sender when updating the claimed mapping.

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 lets people withdraw funds, but it keeps a record of who has already withdrawn using the address that receives the funds, not the address that asked for them. An attacker can ask for funds to be sent to a different address each time, so the record never shows they already withdrew, and they can keep taking money until the contract is empty.

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 0xliumin

View all

5 more disclosed reports, best first.

More from Concur Finance contest

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.