# [CTF] Solving Verilog CTF Onchain (Simple)

# 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 total supply of WMATICv2 token and our goal is to successfully call getBounty, which requires these two trackers to be significantly deviated.

# Using Blaz to Solve

Here are the contracts we are interested:

WMATICV2:

Bounty:

The contracts are exploitable before block number 35690977. We'll fork the chain at block number 35690976 and let Blaz find the exploit for us.

# Step 1

Select Polygon and click Next. Then, put the contract address and block number as follows:

Onchain Settings
Onchain Settings

# Step 2

Select all Common Vulnerabilities and submit the job. You'll find results in a few minutes.

Result Page
Result Page