Overview:
On December 4, 2024, Vestra_DAO was hacked due to a logic error in in the staking contract’s unStake()
function. The function failed to check whether a staking position was still active before allowing it to be unstaked, enabling the attacker to repeatedly claim yield from an already unstaked position. Exploiting this flaw, the attacker prepared for a month by initially staking VSTR tokens, then calling the unStake()
function multiple times to siphon yield repeatedly. The attack drained approximately $500,000 worth of tokens from the Vestra DAO contract.
VSTR is a token that provides semi-decentralized, Web2+Web3 hybrid services, launched and developed by the NFT community “CMLE” (Crypto Monster Limited Edition). Simultaneously, it operates as a Decentralized Autonomous Operation (DAO) project providing DeFi (Decentralized Finance) solutions. The project, built on the Ethereum platform, adheres to ERC20 standards.
Attack Transactions: 0x213991ca, 0xa0dcf9b
Vulnerable Contract: 0x8A30d6
Attacker Address: 0x954386
Attacker Contract Address: 0x81AD99
One month before the attack, the attacker staked an initial amount of 500,000 VSTR tokens in the Vestra DAO staking contract.
The lock period for staking was set to one month, allowing the attacker to wait and earn yield.
After lock period is over, the attacker used the same account to call the unStake()
function.
This action returned the initial 500,000 VSTR along with 20,000 VSTR in yield, marking the staking position as isActive = false
.
Due to a missing check for the isActive
status in the unStake()
function, the attacker could repeatedly call unStake()
on the same position.
Each subsequent call continued to yield an additional 20,000 VSTR despite the position being inactive.
To prevent an underflow in data.totalStaked
and data.countUser
, the attacker created new accounts or smart contracts.
These fresh accounts staked 500,000 VSTR each, ensuring the contract’s staking balance remained sufficient.
The attacker alternated between unstaking the original position to claim 20,000 VSTR in yield per call and staking fresh tokens using new accounts or contracts to maintain the data.totalStaked
and data.countUser
value.
The process was repeated until the contract’s token balance was fully drained, exploiting the unchecked logic to extract as much yield as possible.
The attack caused a financial loss of approximately $500,000 in VSTR tokens.
See the funds flow here:
Vestra DAO addressed the hack incident via their official Twitter (X) account:
- Ensure the
unStake()
function checks whether a staking position is still active before proceeding. - Remove the user’s staking data after a successful unstake to prevent repeated claims.
- Collaborate with reputable auditors like QuillAudits to analyse smart contracts and identify vulnerabilities.
Choosing a reputable audit firm like QuillAudits ensures that your protocol undergoes rigorous scrutiny from experienced security professionals. QuillAudits specializes in uncovering critical vulnerabilities and providing actionable remediation strategies. Our expertise helps safeguard your project from attacks, ensuring that security issues are addressed proactively.