Astroport
The staking contract lacked a minimum liquidity requirement, so an attacker could stake a tiny amount and then donate a large amount of the staking token to inflate the total staked amount. This made later stakes mint zero xASTRO, breaking staking for everyone and potentially letting the attacker monopolise governance voting power.
defihacklabs.substack.com
Published on defihacklabs.substack.com
Do you know when round-down occurs in smart contracts? Recently, there have been many cases where round-down has caused problems, resulting in bugs that can inflate the value of tokens (also known as token inflation attacks) in DeFi.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the staking pool had no minimum liquidity requirement, so a large donation could skew the share calculation and make new mints round down to zero.
Impact
Staking could be broken for all users and the attacker could become the sole holder of the receipt token, potentially monopolising governance voting power; the contract reverting on a zero mint limited the damage.
What the attacker needed
Contract in initial state or fully drained; attacker holds a large amount of the staking token
The fix
The staking setup should enforce a minimum initial liquidity amount and send the corresponding receipt tokens to a dead address; the text says Astroport applied a patch.
How it was found
- Stake a minimal amount of the staking token to receive a minimal amount of the receipt token.
- Transfer the largest amount of the staking token the attacker can obtain into the staking contract as a donation.
- Any later staking attempt mints zero receipt tokens and fails unless the amount exceeds the attacker's donation.
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 write-up has not been written yet. The Original tab links to the source.
A staking contract gives you a receipt token in exchange for depositing tokens. The amount of receipt tokens you get depends on how much is already deposited, so if someone dumps a huge amount in without taking receipt tokens, everyone else's share becomes tiny. Here the maths rounded down to zero, so new people could not stake at all.
What is Smart contracts?
Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.