[CTF] Verilog CTF (Onchain)
Introduction
Source code of the challenge: https://github.com/Verilog-Solutions/CTF-2022-wMaticV2
The project consists of a buggy WMATICv2 token contract containing a function redeem
allowing reentrancy attack. Additionally, there is a Bounty.sol
contract, which rewards the first person who successfully calls its getBounty
function.
There are two trackers of the total supply of WMATICv2 tokens and our goal is to successfully call getBounty
, which requires these two trackers to be significantly deviated.
Below is the intended solution that conducts flash loan and reentrancy attacks:
Using ItyFuzz to Solve
Here are the contracts we are interested in:
The contracts are exploitable before block number 35690977. We'll fork the chain at block number 35690976 and let ItyFuzz find the exploit.
To conduct an ItyFuzz campaign, run the following command:
Optionally, you can also use your RPC instead of the default public RPC by setting environment variable ETH_RPC_URL
. For instance, to use your local RPC, run:
After a few seconds to minutes, you should see ItyFuzz exit with the full exploit to take the fund.
Last updated