Skip to content
Business logic Audit finding Intermediate

Users unable to withdraw their funds due to FRAX admin action

The FRAX admin can withdraw all native ETH from the redemption queue contract, causing the adaptor's redemption NFT burn to fail and leaving Napier users unable to withdraw their funds.

xiaoming90 Follow

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2024-01-napier-judging/issues/95

The protocol has acknowledged this issue.

Found by

xiaoming90

Summary

FRAX admin action can lead to the fund of Naiper protocol and its users being stuck, resulting in users being unable to withdraw their assets.

Vulnerability Detail

Per the contest page, the admins of the protocols that Napier integrates with are considered "RESTRICTED". This means that any issue related to FRAX's admin action that could negatively affect Napier protocol/users will be considered valid in this audit contest.

Q: Are the admins of the protocols your contracts integrate with (if any) TRUSTED or RESTRICTED? RESTRICTED

When the Adaptor needs to unstake its staked ETH to replenish its ETH buffer so that users can redeem/withdraw their funds, it will first join the FRAX's redemption queue, and the queue will issue a redemption NFT afterward. After a certain period, the adaptor can claim their ETH by burning the redemption NFT at Line 65 via the burnRedemptionTicketNft function.

https://github.com/sherlock-audit/2024-01-napier/blob/main/napier-v1/src/adapters/frax/SFrxETHAdapter.sol#L65

Solidity
File: SFrxETHAdapter.sol
53:     function claimWithdrawal() external override {
54:         uint256 _requestId = requestId;
55:         uint256 _withdrawalQueueEth = withdrawalQueueEth;
56:         if (_requestId == 0) revert NoPendingWithdrawal();
57: 
58:         /// WRITE ///
59:         delete withdrawalQueueEth;
60:         delete requestId;
61:         bufferEth += _withdrawalQueueEth.toUint128();
62: 
63:         /// INTERACT ///
64:         uint256 balanceBefore = address(this).balance;
65:         REDEMPTION_QUEUE.burnRedemptionTicketNft(_requestId, payable(this));
66:         if (address(this).balance < balanceBefore + _withdrawalQueueEth) revert InvariantViolation();
67: 
68:         IWETH9(Constants.WETH).deposit{value: _withdrawalQueueEth}();
69:     }

However, it is possible for FRAX's admin to disrupt the redemption process of the adaptor, resulting in Napier users being unable to withdraw their funds. When the burnRedemptionTicketNft function is executed, the redemption NFT will be burned, and native ETH residing in the FraxEtherRedemptionQueue contract will be sent to the adaptor at Line 498 below

https://etherscan.io/address/0x82bA8da44Cd5261762e629dd5c605b17715727bd#code#L3761

Solidity
File: FraxEtherRedemptionQueue.sol
473:     function burnRedemptionTicketNft(uint256 _nftId, address payable _recipient) external nonReentrant {
..SNIP..
494:         // Effects: Burn frxEth to match the amount of ether sent to user 1:1
495:         FRX_ETH.burn(_redemptionQueueItem.amount);
496: 
497:         // Interactions: Transfer ETH to recipient, minus the fee
498:         (bool _success, ) = _recipient.call{ value: _redemptionQueueItem.amount }("");
499:         if (!_success) revert InvalidEthTransfer();

FRAX admin could execute the recoverEther function to transfer out all the Native ETH residing in the FraxEtherRedemptionQueue contract, resulting in the NFT redemption failing due to lack of ETH.

https://etherscan.io/address/0x82bA8da44Cd5261762e629dd5c605b17715727bd#code#L3381

Solidity
File: FraxEtherRedemptionQueue.sol
185:     /// @notice Recover ETH from exits where people early exited their NFT for frxETH, or when someone mistakenly directly sends ETH here
186:     /// @param _amount Amount of ETH to recover
187:     function recoverEther(uint256 _amount) external {
188:         _requireSenderIsTimelock();
189: 
190:         (bool _success, ) = address(msg.sender).call{ value: _amount }("");
191:         if (!_success) revert InvalidEthTransfer();
192: 
193:         emit RecoverEther({ recipient: msg.sender, amount: _amount });
194:     }

As a result, Napier users will not be able to withdraw their funds.

Impact

The fund of Naiper protocol and its users will be stuck, resulting in users being unable to withdraw their assets.

Code Snippet

https://github.com/sherlock-audit/2024-01-napier/blob/main/napier-v1/src/adapters/frax/SFrxETHAdapter.sol#L65

Tool used

Manual Review

Recommendation

Ensure that the protocol team and its users are aware of the risks of such an event and develop a contingency plan to manage it.

Discussion

sherlock-admin

1 comment(s) were left on this issue during the judging contest.

takarez commented:

valid: per contest ReadMe; this should be valid; medium(11)

The original report as published on Sherlock, by xiaoming90. 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 adaptor relies on FRAX's redemption queue holding enough ETH, but the FRAX admin can remove all ETH via recoverEther, breaking the adaptor's claim.

Impact

Napier protocol and user funds could become stuck, preventing users from withdrawing their assets.

What the attacker needed

FRAX admin acts maliciously or recklessly; Napier adaptor has a pending redemption

The fix

The protocol team and users should be made aware of this risk and a contingency plan should be developed.

How it was found

  1. The adaptor joins FRAX's redemption queue and receives a redemption NFT.
  2. The FRAX admin calls recoverEther to remove all native ETH from the redemption queue contract.
  3. The adaptor calls claimWithdrawal, which burns the redemption NFT and tries to send ETH to the adaptor.
  4. The ETH transfer fails because the queue has no ETH, so the adaptor cannot replenish its buffer and users cannot withdraw.

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.

When users want their money back, the Napier protocol asks FRAX to return the ETH it holds. FRAX has a special admin function that can empty the ETH pool. If the admin uses it, Napier cannot get its ETH back, so users cannot withdraw.

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 by xiaoming90

View all

122 more disclosed reports, best first.

More from Napier

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.