Reproduced Exploit
Pheasant BondManager: the second withdrawal request locks the first 100
A depositor withdraws in two steps: executeWithdrawBond, then finalizeWithdrawalBond. The execute call subtracts the amount from bonds immediately and stores a single bondWithdrawal. A second execute replaces that struct. Finalize pays only the second amount. The first amount has already left bonds…
Loss
100 bond tokens stay in the contract. A 1000 deposit with requests of 100 and then 300 pays only 300
Chain
Ethereum
Category
untagged
Date
May 2023
Source
AuditVault
EVM Playground
Source-level debugger — step opcodes and Solidity in sync
The attack replays in your browser. Step through it by Solidity line or by opcode.
The attack is replayed in an in-browser EVM preloaded with the exact dumped fork state. The execution tree shows every call; step by Solidity line or by opcode across all depths — source, Stack, Memory, Storage, Balances (native / ERC-20 / NFT), Transient storage and Return value stay in sync. Click a tree node, opcode, or source line to jump. Query opens a search over the trace: previous and next writes, balance changes and calls, breakpoints, and a diff of everything that changed between two steps. No backend, no live RPC.
Source & credit. Reproduction of a public audit finding curated by AuditVault — the original finding: 60331-relayers-bond-funds-can-be-lost-quantstamp-pheasant-network. Standalone Foundry PoC and full write-up: 60331-relayers-bond-funds-can-be-lost-quantstamp-pheasant-network_exp in the
evm-hack-registrymirror.
Vulnerability classes:
vuln/logic·vuln/defi
Key info#
| Field | Value |
|---|---|
| Loss | 100 bond tokens stay in the contract. A 1000 deposit with requests of 100 and then 300 pays only 300 |
| Vulnerable contract | BondManager.executeWithdrawBond |
| Attacker EOA | 0x1111111111111111111111111111111111111111 |
| Attack contract | Exploit |
| Attack tx | Exploit.run() |
| Chain / block / date | Ethereum model · block 0 · 2023-05 |
| Compiler | solc 0.8.27, cancun, via IR |
| Bug class | One pending-withdrawal slot is overwritten after the amount was already deducted |
TL;DR#
A depositor withdraws in two steps: executeWithdrawBond, then finalizeWithdrawalBond. The execute call subtracts the amount from bonds immediately and stores a single bondWithdrawal. A second execute replaces that struct. Finalize pays only the second amount. The first amount has already left bonds and is never transferred.
The report's numbers, here in 18-decimal units: deposit 1000, request 100 (bonds = 900), request 300 (bonds = 600), finalize pays 300. The contract still holds 700. 700 − 600 = 100 has no withdrawal record.
The fixed manager rejects a new request while one is pending. Finalizing the 100 before requesting the 300 pays both. Stuck is 0, not 100.
The vulnerable code#
function executeWithdrawBond(uint256 tokenId, uint256 amount) external {
bonds[tokenId] -= amount;
bondWithdrawal[msg.sender] = Withdrawal(block.timestamp, tokenId, amount); // @> VULN
}
finalizeWithdrawalBond transfers bondWithdrawal.amount and nothing else.
Root cause#
The deduction and the record are not the same object. bonds is reduced on every request. The record that finalize reads can remember only one request. Replacing the record does not put the previous amount back into bonds.
Preconditions#
- The caller has a bond balance of at least 400, so both requests succeed.
- The caller invokes
executeWithdrawBondtwice beforefinalizeWithdrawalBond. - No admin key is required. Deposit and both withdrawal calls are open to the depositor.
Attack walkthrough#
- Deposit 1000.
bonds[1] = 1000. executeWithdrawBond(1, 100).bonds[1] = 900. Pending amount is 100.executeWithdrawBond(1, 300).bonds[1] = 600. Pending amount is 300. The 100 record is gone.- Finalize transfers 300.
- The contract holds 700 and
bondssays 600. The gap of 100 is stuck.
Diagrams#
Impact#
The depositor asked to withdraw 400 and can receive only 300. The other 100 remains in BondManager and is not tracked by bonds or by bondWithdrawal, so a later finalize of the remaining 600 does not return it.
How to reproduce#
cd 60331-relayers-bond-funds-can-be-lost-quantstamp-pheasant-network_exp
forge test -vv
test_run_overwrittenRequestLocks100 calls run() and checks the stuck amount is 100, the payout is 300, and bonds is 600. test_control_finalizeBetweenRequestsPaysBoth pays 400 and checks the stuck amount is 0, not 100.
Sources#
- AuditVault finding: https://github.com/Auditware/AuditVault/blob/main/findings/60331-relayers-bond-funds-can-be-lost-quantstamp-pheasant-network.md
- Quantstamp Pheasant Network: https://certificate.quantstamp.com/full/pheasant-network/0b120935-78d1-45a1-88c4-f770c8e5fa52/index.html
Sources & further analysis#
Reproductions & code
- Standalone PoC + full trace: 60331-relayers-bond-funds-can-be-lost-quantstamp-pheasant-network_exp (evm-hack-registry mirror).
- AuditVault finding: 60331-relayers-bond-funds-can-be-lost-quantstamp-pheasant-network.
Alerts & third-party analyses
These dashboards index community alerts tweets, post-mortems, and independent write-ups. Reach them through the protocol name above to cross-check this reproduction against other analyses.