Skip to content
Access control Write-up Advanced

Enzyme Finance Privilege Check

Enzyme's paymaster contract failed to verify that the trusted forwarder address passed in a relayed transaction was legitimate. An attacker could deploy a malicious forwarder, bypass signature verification, and manipulate relay fees to drain the paymaster's vault.

immunefi.com

Published on immunefi.com

On Mar 28, 2023, whitehat rootrescue submitted a critical bug in Enzyme Finance via Immunefi, which the Enzyme team quickly confirmed and fixed. This critical bug could have led to the draining of Enzyme’s Vault which funds paymasters and enables Enzyme’s contracts to utilize the Gas Station Network.

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 paymaster contract overrode the function that checks the forwarder address, so it did not verify that the forwarder was trusted before accepting relayed calls.

Impact

An attacker could drain the paymaster's vault, which holds funds for gasless transactions, by repeatedly submitting crafted relay calls.

What the attacker needed

Access to Ethereum network; ability to deploy a malicious forwarder contract

The fix

The paymaster was fixed to verify that the forwarder address is trusted and revert otherwise.

How it was found

  1. Deploy a malicious forwarder contract.
  2. Craft a relayCall with the malicious forwarder address, a high percentage relay fee, and the paymasterData flag set to true.
  3. Submit many relayCalls to the RelayHub until the target fund's vault is drained.

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 paymaster is a contract that pays gas fees for users so they don't need ETH. It relies on a trusted forwarder to check that a request really came from the user. Because the paymaster didn't check which forwarder was used, an attacker could use their own fake forwarder to pretend to be anyone and make the paymaster pay out huge fees.

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.