Skip to content
Smart contracts Write-up Advanced

15+ projects

The ERC1271 reference implementation for smart contract signatures did not include the smart account address in the signed digest, allowing a signature from one smart account to be replayed on another smart account with the same owner. An attacker could reuse a signature to authorise actions on a different account owned by the same person.

mirror.xyz

Published on mirror.xyz

Sep 25, 2023, I found an issue in a widely used implementation of the ERC1271 pattern that affected 15+ teams. This blog describes the sequence of events regarding how it all came together.

The author, on mirror.xyz

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 ERC1271 reference implementation did not bind the signed digest to the smart account address, so signatures were not domain-separated per account.

Impact

Signatures could be replayed across smart accounts with a common owner, potentially allowing unauthorised actions; however, wallets that hash the account address themselves, such as Safe or Sequence, were not affected.

What the attacker needed

Victim owns multiple smart accounts; attacker obtains a signature for one account; wallet uses vulnerable ERC1271 implementation

The fix

The issue should be fixed by adding the account address inside the signed digest, as Safe does, though discussions continue on avoiding opaque signatures.

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 smart contract wallet checks signatures using a standard called ERC1271. The example code for this standard only checked that the signature came from the owner, not which wallet it was for. So if someone owned two wallets, a signature made for one could be used on the other.

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.