Skip to content
Access control Write-up Intermediate

Zapper Arbitrary Call Data Bug Fix Review

The Zapper 'zap out' contracts allowed users to supply arbitrary call data to any liquidity pool without validation. An attacker could encode a transferFrom call to steal all LP tokens from any victim who had approved the Zapper contract.

immunefi.com

Published on immunefi.com

Whitehat Lucash-dev, a recipient of the Whitehat Scholarship at Immunefi, found a critical vulnerability in Zapper on June 9 that would have allowed a malicious user to steal LP tokens on an ongoing basis through injecting arbitrary call data. After Immunefi’s disclosure of the bug, Zapper paused its contracts using…

The author, on immunefi.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

The contract failed to validate user-supplied call data, allowing an attacker to specify a transferFrom call that moved LP tokens from a victim to the attacker.

Impact

An attacker could steal all LP tokens from any user who had approved the Zapper contract, potentially affecting many users.

What the attacker needed

Victim has approved Zapper contract; attacker has an Ethereum address

The fix

The vulnerable function was blocked from accepting arbitrary calldata, and future permit parameters will be computed on-chain.

How it was found

  1. Identify a victim who has approved the Zapper contract to spend their LP tokens.
  2. Encode a transferFrom call to move the victim's LP tokens to the attacker's address.
  3. Call the vulnerable ZapOut2PairTokenWithPermit function with the encoded data.
  4. The contract executes the transferFrom, stealing the victim's LP tokens.

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.

Zapper is a tool that helps people manage cryptocurrency investments. Users give Zapper permission to move their special tokens (LP tokens) on their behalf. The bug was that Zapper let anyone tell it to move those tokens to any address, so an attacker could take tokens from anyone who had given Zapper permission.

What is Access control?

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.