Skip to content
DoS Audit finding Intermediate

DoS might happen to `DineroWithdrawRequestManager#_initiateWithdrawImpl()` due to overflow on `++s_batchNonce`

The `s_batchNonce` variable in `DineroWithdrawRequestManager` is a `uint16`, so after 65535 withdrawals it overflows and causes `initiateWithdraw()` to revert. An attacker could repeatedly call stake and withdraw functions to exhaust the nonce, permanently blocking all WETH withdrawals.

0xpiken Follow with HeckerTrieuTien, Ledger_Patrol and 4 others

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2025-06-notional-exponent-judging/issues/580

Found by

0xpiken, HeckerTrieuTien, Ledger_Patrol, Ragnarok, X0sauce, heavyw8t, y4y

Summary

When DineroWithdrawRequestManager#initiateWithdraw() is called to initiate WETH withdrawal, DineroWithdrawRequestManager#_initiateWithdrawImpl() will be executed to initiate a redemption from PirexETH:

Solidity
    function _initiateWithdrawImpl(
        address /* account */,
        uint256 amountToWithdraw,
        bytes calldata /* data */
    ) override internal returns (uint256 requestId) {
        if (YIELD_TOKEN == address(apxETH)) {
            // First redeem the apxETH to pxETH before we initiate the redemption
            amountToWithdraw = apxETH.redeem(amountToWithdraw, address(this), address(this));
        }

        uint256 initialBatchId = PirexETH.batchId();
        pxETH.approve(address(PirexETH), amountToWithdraw);
        // TODO: what do we put for should trigger validator exit?
        PirexETH.initiateRedemption(amountToWithdraw, address(this), false);
        uint256 finalBatchId = PirexETH.batchId();
@>      uint256 nonce = ++s_batchNonce;

        // May require multiple batches to complete the redemption
        require(initialBatchId < MAX_BATCH_ID);
        require(finalBatchId < MAX_BATCH_ID);
        // Initial and final batch ids may overlap between requests so the nonce is used to ensure uniqueness
        return nonce << 240 | initialBatchId << 120 | finalBatchId;
    }

The returned requestId is composed by three variables: nonce, initialBatchId, and finalBatchId. nonce is calculated as below:

Solidity
        uint256 nonce = ++s_batchNonce;

However, s_batchNonce is a uint16 variable. Once its value reaches 65535, then ++s_batchNonce will revert the whole initiateWithdraw() function, resulting no one can withdraw WETH though DineroWithdrawRequestManager. Anyone asset deposited through DineroWithdrawRequestManager will be locked forever.

Root Cause

The capacity of s_batchNonce is too small.

Internal Pre-conditions

No response

External Pre-conditions

No response

Attack Path

Malicious attacker can call DineroWithdrawRequestManager#stakeTokens() and DineroWithdrawRequestManager#initiateWithdraw() repeatedly with different accounts through an approved vault to quickly increase s_batchNonce to 65535.

Impact

Once s_batchNonce reaches 65535, DineroWithdrawRequestManager#initiateWithdraw() call will always revert and no any WETH can be withdrawn from DineroWithdrawRequestManager.

PoC

No response

Mitigation

The reason that defining s_batchNonce as uint16 is that s_batchNonce will be used together with two uint120 variables to make a uint256 variable:

Solidity
        return nonce << 240 | initialBatchId << 120 | finalBatchId;

Since PirexETH.batchId() will increase one time only every 32 ether redemption, it is unnecessary to record two batchIds in requestId. requestId can be redesigned as below:

CODE
|255------136|135---------16|15---------0|
|s_batchNonce|initialBatchId|deltaBatchId|

Where uint16 deltaBatchId = finalBatchId - initialBatchId Then s_batchNonce can be defined as a uint120 variable.

Discussion

sherlock-admin2

The protocol team fixed this issue in the following PRs/commits: https://github.com/notional-finance/notional-v4/pull/20/files

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

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

Likely the `s_batchNonce` variable was declared as `uint16` instead of a larger integer type, causing an overflow when incremented beyond 65535.

Impact

Once the nonce overflows, all WETH withdrawals through `DineroWithdrawRequestManager` are permanently blocked, locking deposited assets.

What the attacker needed

Access to an approved vault; ability to call stakeTokens and initiateWithdraw

The fix

The issue was fixed by redesigning the request ID packing to allow `s_batchNonce` to be a `uint120`.

How it was found

  1. Call `stakeTokens()` and `initiateWithdraw()` repeatedly with different accounts through an approved vault.
  2. Each call increments `s_batchNonce` until it reaches 65535.
  3. After that, any call to `initiateWithdraw()` reverts due to overflow.

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 counter used to track withdrawal requests is stored in a small number type that can only hold up to 65535. If it goes over that limit, the function that increments it fails, and no one can withdraw their funds anymore. An attacker can speed up reaching the limit by making many small withdrawals.

What is DoS?

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.

More by 0xpiken

View all

29 more disclosed reports, best first.

More from Notional Exponent

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Denial of service

The lesson behind this report.

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.