The StakingPool::DEAD_SHARES mechanism is insufficient to fully prevent inflation attacks, causing the exchange rate to significantly deviate from the expected 1:1 ratio.
Within the StakingPool contract, the totalStaked value can be manipulated through two methods, both of which lack permission restrictions:
Combined with the following _mintShares() casting logic, we can imagine a situation where the contract is deployed. A malicious user preempts the transaction and pledges 300 tokens, and then immediately calls donateTokens() to donate 1 ether to the contract. At this time, the exchange rate will deviate significantly from the 1:1 preset in the document. When subsequent users perform small pledges, they will not be able to obtain share.
The following code can be added to test/core/staking-pool.test.ts. Running the test will demonstrate the significant deviation in the exchange rate:
The StakingPool::DEAD_SHARES mechanism is insufficient to fully prevent inflation attacks, causing the exchange rate to significantly deviate from the expected 1:1 ratio.users with small deposits will not be able to obtain shares
Manual Review
it is recommended to implement permission controls for the donateTokens() and burn() functions, preventing unauthorized manipulation of the totalStaked value.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.