Skip to content
Business logic Audit finding Intermediate

Marking a backup makes recovery impossible (recover list never queried)

A backup marked for recovery is moved from the backups list to a separate recover queue, but the function that looks up backups still reads only the original backups list. As a result, guardian share uploads for that backup fail with 'Backup not found', so the user can never collect enough shares to reconstruct the secret.

gwumex Follow with 0xchamel, 0xnija and 26 others

Originally disclosed on Code4rena

Submitted by gwumex, also found by 0xchamel, 0xnija, 0xpetern, 0xvd, Agontuk, arunabha003, boodieboodieboo, codertjay, CoMMaNDO, Cryptor, ETHworker, Evo, felconsec, fromeo_016, Garen, happykilling, hellnia, honey-k12, ht111111, kind0dev, oxwhite, pashap9990, Psycharis, shieldrey, slvDev, The_Amazing_One, touristS, and zubyoz

AccountSecrets::mark_recovery moves the chosen backup from the backups vector into the separate recover queue (lib/src/account/v0.rs#L516-L523). The Partisia endpoint /reconstruction/upload-share looks up a backup by calling account.recover_id, which, in turn, iterates AccountState::recover_backups. Because recover_backups mistakenly returns self.backups instead of the recover list (lib/src/account/v0.rs#L236-L247), any backup that has been marked for recovery disappears from what the contract can see. As a result, every guardian share upload for that backup fails with “Backup not found” (contracts/src/http/endpoints/reconstruction/upload_share.rs#L48-L50), and the user can never collect enough shares to reconstruct the secret, violating the recovery/liveness invariant.

Recommended mitigation steps

Change AccountStateV0::recover_backups to iterate the recover queue, or search both backups and recover depending on the intended semantics. Add regression tests that (1) create a backup, (2) call mark_recovery, and (3) verify that recover_id still returns the ciphertext so /reconstruction/upload-share accepts guardian shares. Optionally enforce that only backups present in recover are accepted to ensure the owner explicitly enabled recovery.

View detailed Proof of Concept

Swafe mitigated:

self.backups.iter().collect() → self.recover.iter().chain(once(&self.rec.social)).collect()

Status: Mitigation confirmed. Full details in reports from montecristo, niffylord, and DCENT09.


The original report as published on Code4rena, by gwumex. Images and videos are our own copies; raw HTML is shown as text. View it on Code4rena.

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

How it worked

Root cause

The recover_backups function returns the backups list instead of the recover queue, so marked backups are invisible to the lookup.

Impact

The user can never collect enough shares to reconstruct the secret, breaking the recovery and liveness guarantee.

What the attacker needed

A backup exists; the backup is marked for recovery

The fix

The recover_backups function was changed to iterate the recover queue (and the social recovery entry) instead of the backups list.

How it was found

  1. Create a backup.
  2. Call mark_recovery on the backup.
  3. Attempt to upload a guardian share for that backup.
  4. The upload fails with 'Backup not found'.

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 report has not been written yet. The Original tab links to the source.

A user can create a backup of their secret and later mark it for recovery. Marking it moves it to a different list, but the code that checks whether a backup exists still looks in the old list. So the system cannot find the backup and refuses to accept the pieces needed to rebuild the secret.

What is Business logic?

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.

More from Swafe

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.