Pythia Hack
What happened
On 3 September 2024, an attacker drained about 21 ETH (around $53,000) from Pythia Finance's staking contract on Ethereum. QuillAudits reported the exploit. Cointelegraph describes Pythia as an algorithmic stablecoin project that planned to manage its treasury with AI.
The flaw was in how staking rewards were paid. The staking contract's verified source tracks rewards with a global rewards-per-share value (shareBasedPoints) and a per-holder pointsCorrection, and a claim pays shareBasedPoints times the holder's staked balance, adjusted by that correction. Staked positions (sPYTHIA) are ordinary ERC-20 tokens, and their transfers never call the contract's adjustPointsForTransfer helper. A fresh address that received sPYTHIA therefore had no correction and could claim rewards on its whole balance as if it had held it since the first distribution. The attacker (0xd861...74c0) used attack contract 0x5425...3647 to pass one staked position through a series of fresh helper contracts. Each helper claimed rewards on the full balance, and the attacker restaked what they collected. QuillAudits and Cointelegraph described the attack as a reentrancy on claimRewards. The public PoC, however, shows repeated claims across transferred balances rather than a callback loop.
How it happened
- The attacker's contract swapped 0.5 ETH for PYTHIA on Uniswap V2 and staked it, receiving sPYTHIA.
- It deployed a new helper contract and transferred its entire sPYTHIA balance to it.
- The helper called
claimRewards(). Because the transfer had not updatedpointsCorrection, the reward was the helper's full sPYTHIA balance times the accumulatedshareBasedPoints. The helper then sent the PYTHIA rewards and the sPYTHIA back to the attack contract. - The attack contract staked the new PYTHIA, which enlarged its position, and repeated steps 2-3 with a new helper, 30 times in the PoC.
- The inflated staked balance and rewards were cashed out, about 21 ETH (around $53K) in total.
Protocol details
Evidence
- report QuillAudits security alert on Pythia Staking Contract (X, via fxtwitter mirror) x.com
- report Sourcify verified source: PythiaTokenStaking (contracts/PythiaTokenStaking.sol, contracts/base/AbstractRewards.sol), exact match sourcify.dev
- transaction Etherscan: attack transaction 0x7e19f8ed...0a6c3 etherscan.io
- analysis DeFiLlama defillama.com
- analysis DeFiHackLabs Pythia_exp.sol PoC raw.githubusercontent.com
- analysis 2 auditors miss $27M Penpie flaw, Pythia's 'claim rewards' bug: Crypto-Sec (Cointelegraph Magazine, 9 Sep 2024; Wayback copy) cointelegraph.com
- analysis Sep 2024 - Pythia Finance Staking Contract Vulnerability And Rug Pull (Quadriga Initiative) quadrigainitiative.com
- analysis ratpythia.ai page ratpythia.ai ratpythia.ai
Understand the attack patterns
Build your security review skills
Work through hands-on labs covering real exploit mechanics, review techniques, and defensive patterns.