Skip to content
Smart contracts Write-up Advanced

The Gempad lock exploit investigation

A vulnerability in Gempad's liquidity lock contract allowed an attacker to drain over $3 million from locked tokens and liquidity. The attacker used a fake token with a custom transfer function to trigger reentrancy in the collectFees function, repeatedly draining LP tokens.

medium.com

Published on medium.com

The crypto community is shaken after more than $3 million has disappeared from Gempad’s liquidity lock. Now, more than a two months later, all the affected projects and investors are reeling from their losses.

JohnXBT, on medium.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the lock contract's collectFees function did not follow the checks-effects-interactions pattern, allowing a malicious token's transfer function to re-enter and drain funds.

Impact

More than $3 million of investor funds were stolen from over 30 projects and LPs, and the stolen crypto was washed via Tornado Cash, making recovery impossible.

What the attacker needed

Access to the vulnerable lock contract; Ability to create a fake token

The fix

The contract should be re-audited and fixed to prevent reentrancy, but the text says the team is still using the same exploited lock without a new audit.

How it was found

  1. Create a fake token with a custom transfer function that triggers reentrancy.
  2. Use the fake token to interact with the vulnerable lock contract.
  3. Combine Uniswap V2 and V3 liquidity manipulations to repeatedly drain LP tokens.
  4. Swap the drained tokens to native tokens such as ETH or BNB.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

A reentrancy attack happens when a smart contract calls another contract before updating its own records, letting the attacker call back into the original function repeatedly. Here, the attacker created a fake token whose transfer function re-entered the fee collection function, so the contract kept releasing funds. This let the attacker drain locked liquidity from many projects.

What is Smart contracts?

Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.

Similar reports

View all

Same bug class and techniques, clearest first.

Smart contract vulnerabilities

The lesson behind this report.

Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.