Reproduced Exploit

Regnum Aurum: Bob redeposits the NFT he did not want and the next VRF word gives him Alice's NFT

redeemNFT draws an index from the current VRF word, sends that NFT to the caller, and requests a new word. depositAsset pushes any approved id, including the one just redeemed. Bob deposits NFT 1, Alice deposits NFT 2. The first word selects NFT 1. Bob redeposits it. The consumer's next fixed word…

May 2025•Ethereum•logic•4 min read

Loss

Bob holds Alice's NFT 2. The random draw he rejected, NFT 1, is back in the vault

Chain

Ethereum

Category

logic

Date

May 2025

Source

AuditVault

EVM Playground

Source-level debugger — step opcodes and Solidity in sync

evm-hack-analyzer

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.

Loading fork state…

Source & credit. Reproduction of a public audit finding curated by AuditVault — the original finding: 66173-h-11-randomness-can-be-manipulated-in-rwavault-redemptions-p. Standalone Foundry PoC and full write-up: 66173-h-11-randomness-can-be-manipulated-in-rwavault-redemptions-p_exp in the evm-hack-registry mirror.


Vulnerability classes: vuln/logic/missing-check · vuln/logic/incorrect-state-transition

Key info#

FieldValue
LossBob holds Alice's NFT 2. The random draw he rejected, NFT 1, is back in the vault
Vulnerable contractRWAVault.depositAsset
Attacker EOA0x1111111111111111111111111111111111111111
Attack contractExploit
Attack txExploit.run()
Chain / block / dateEthereum model · block 0 · 2025-05
Compilersolc 0.8.27, cancun, optimizer 200
Bug classNo cooldown between redeem and deposit of the same NFT

TL;DR#

redeemNFT draws an index from the current VRF word, sends that NFT to the caller, and requests a new word. depositAsset pushes any approved id, including the one just redeemed. Bob deposits NFT 1, Alice deposits NFT 2. The first word selects NFT 1. Bob redeposits it. The consumer's next fixed word selects NFT 2. Bob redeems it. He did not choose the words. He chose to roll again. There is no profit token. The harm is who holds NFT 2.

Background#

Pashov Audit Group, Regnum Aurum, May 2025, finding H-11. The vault uses Chainlink VRF to pick an NFT on redemption. The published test loops redeemNFT, depositAsset, and fulfillRandomWords until the id is 2. The recommendation is a cooldown on re-deposit. This run uses a two-word consumer so the loop is deterministic. The words are stored in the consumer constructor, not passed by Bob.

The vulnerable code#

SOLIDITY
rwa.transferFrom(msg.sender, address(this), id);
ids.push(id); // @> VULN: a just-redeemed id is accepted. No cooldown is stored.
DIFF
  rwa.transferFrom(msg.sender, address(this), id);
+ require(block.timestamp > redeemedAt[id] + cooldown, "cooldown");
  ids.push(id);

Root cause#

Redemption and deposit are separate and neither one records that this id was just drawn. A new VRF word changes the index. Putting the unwanted id back into the array lets the caller sample again.

Preconditions#

  • The vault holds at least two NFTs. Here, Bob's 1 and Alice's 2.
  • A VRF word is already available, and a later fulfillment changes the selection.
  • The caller can approve and deposit the NFT they just received.

Attack walkthrough#

  1. Bob deposits NFT 1. Alice deposits NFT 2. The array is [1, 2]. Word 0 selects index 0, NFT 1.
  2. Bob redeems NFT 1, approves the vault, and deposits it again.
  3. The consumer fulfills the next word. The array is [2, 1] and the new index is Alice's NFT.
  4. The loop stops. Bob redeems NFT 2.
  5. ownerOf(2) is Bob. ownerOf(1) is the vault. spins is at least 1.

Diagrams#

flowchart TD A["Bob deposits NFT 1 and Alice deposits NFT 2"] --> B["First VRF word selects NFT 1"] B --> C["Bob redeems NFT 1"] C --> D["VULN: depositAsset accepts that same id"] D --> E["Next VRF word selects NFT 2"] E --> F["Bob redeems NFT 2 and Alice's id is gone"]

Impact#

Alice no longer owns NFT 2. Bob does. NFT 1, the draw he rejected, is the one left in the vault. A cooldown on depositAsset would have reverted the redeposit, so he could not sample a second word in this transaction. The native profit is 0 because the loss is the NFT, not an ETH balance.

Remediation#

Record the redemption time of each id and reject depositAsset until a cooldown has passed, which is the report's recommendation.

How to reproduce#

BASH
cd 66173-h-11-randomness-can-be-manipulated-in-rwavault-redemptions-p_exp
forge test -vv

test_bob_rolls_until_he_receives_alices_nft asserts the first rejected id is 1, at least one retry, Bob owns 2, and the vault owns 1.

Sources#


Sources & further analysis#

Reproductions & code

Alerts & third-party analyses

  • Web3Sec X hacked database: search.
  • Rekt leaderboard: search.
  • Solodit incident search: search.

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.