Vault Weight accounting is wrong for withdrawals
The contract tracks the combined weight of all synths a member has deposited in a single storage variable. When a member withdraws the full amount of one synth, the entire combined weight is reduced, leaving the other synth effectively weightless and causing the member to receive fewer rewards.
Vader Protocol contest
Originally disclosed on Code4rena
When depositing two different synths, their weight is added to the same mapMember_weight[_member] storage variable. When withdrawing the full amount of one synth with _processWithdraw(synth, member, basisPoints=10000 the full weight is decreased.
The second deposited synth is now essentially weightless.
Users that deposited more than one synth can not claim their fair share of rewards after a withdrawal.
Recommed that the weight should be indexed by the synth as well.
strictly-scarce (vader) confirmed:
This is valid.
The weight should be reduced only as applied to a specific synth
There is no loss of funds, just less rewards for that member, disputing severity level.
Our decision matrix for severity:
0: No-risk: Code style, clarity, off-chain monitoring (events etc), exclude gas-optimisations 1: Low Risk: UX, state handling, function incorrect as to spec 2: Funds-Not-At-Risk, but can impact the functioning of the protocol, or leak value with a hypothetical attack path with stated assumptions, but external requirements 3: Funds can be stolen/lost directly, or indirectly if a valid attack path shown that does not have handwavey hypotheticals.
Recommended: 2
My viewpoint on this and the last several reward based high risk issues is that loss of rewards is loss of funds. High risk is appropriate.
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 weight is stored per member rather than per member and synth, so withdrawing one synth incorrectly reduces the weight associated with other synths.
Impact
Users who deposited more than one synth cannot claim their fair share of rewards after a withdrawal; there is no loss of principal funds, only reduced rewards.
What the attacker needed
Deposit more than one synth; withdraw the full amount of one synth
The fix
The weight should be indexed by the synth as well, so that withdrawing one synth only reduces the weight for that specific synth.
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 synth is a synthetic asset. The contract gives each member a 'weight' based on how much they have deposited, and this weight determines their share of rewards. The bug is that the weight for all synths is stored together, so withdrawing one synth wipes out the weight for the others too, meaning the member gets fewer rewards than they should.
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.