Theft of ETH of free floating SLOT holders
A reward-accounting bug in the Syndicate contract lets a malicious user overwrite rather than accumulate the accrued ETH per share, so they can claim ETH that belongs to free floating SLOT holders. The reporter states an attacker can steal all claimable ETH of those holders.
clems4ever Follow with HE1M
Originally disclosed on Code4rena
Submitted by clems4ever, also found by HE1M
https://github.com/code-423n4/2022-11-stakehouse/blob/39a3a84615725b7b2ce296861352117793e4c853/contracts/syndicate/Syndicate.sol#L369 https://github.com/code-423n4/2022-11-stakehouse/blob/39a3a84615725b7b2ce296861352117793e4c853/contracts/syndicate/Syndicate.sol#L668 https://github.com/code-423n4/2022-11-stakehouse/blob/39a3a84615725b7b2ce296861352117793e4c853/contracts/syndicate/Syndicate.sol#L228
A malicious user can steal all claimable ETH belonging to free floating SLOT holders…
Proof of Concept
https://gist.github.com/clems4ever/f1149743897b2620eab0734f88208603
Run it in the test suite with forge
Tools Used
Manual review / forge
Recommended Mitigation Steps
+= operator instead of = in https://github.com/code-423n4/2022-11-stakehouse/blob/39a3a84615725b7b2ce296861352117793e4c853/contracts/syndicate/Syndicate.sol#L228 ?
The logic for keeping the rewards up-to-date is also quite complex in my opinion. The main thing that triggered it for me was the lazy call to updateAccruedETHPerShares. Why not keep the state updated after each operation instead?
vince0656 (Stakehouse) confirmed
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 an assignment operator overwrites the accrued ETH-per-share value instead of adding to it, combined with lazy updates of that state.
Impact
An attacker could take all claimable ETH belonging to free floating SLOT holders.
What the attacker needed
A position in the Syndicate contract; claimable ETH held for free floating SLOT holders
The fix
The reporter suggests using an additive assignment for the accrued value and keeping state updated after each operation rather than lazily; the project confirmed the issue.
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 keeps track of how much reward money each participant has earned. Here the code replaced the running total with a new value instead of adding to it, so earlier earnings were wiped out and could be taken by someone else. The result is that honest holders lose money they had already earned.
What is Smart contracts?
Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.