Skip to content
DoS Audit finding Intermediate

A malicious user can DoS force withdraw request

A malicious user can submit a forceWithdraw request for another user's account ID, which is later invalidated by the operator. Until that invalidation, the legitimate account holder cannot submit their own forceWithdraw request because only one request per account is allowed at a time.

CanYeRest298751 Follow

Originally disclosed on Immunefi

Informational View original
  • Disclosed after under an hour

25892 - [SC - Insight] A malicious user can DoS force withdraw request...

Submitted on Nov 20th 2023 at 22:59:01 UTC by @CanYeRest298751 for Boost | DeGate

Report ID: #25892

Report type: Smart Contract

Report severity: Insight

Target: https://etherscan.io/address/0x9C07A72177c5A05410cA338823e790876E79D73B#code

Impacts:

  • Griefing (e.g. no profit motive for an attacker, but damage to the users or the protocol)

Description

Bug Description

A malicious user can request a forceWithdraw request on behalf of another accountID. This is correctly handled by the prover, and the request will be invalidated when processed by the operator. However in the meantime, the user with the account accountID cannot request a forceWithdraw, since only one forceWithdraw can be requested at a time.

Impact

A malicious user can prevent a legitimate one to request forceWithdraw for her funds. Thereby denying the access to funds if operator is also malicious. This can be used to keep big accounts inside the platform, and is a big centralization risk

Risk Breakdown

Difficulty to Exploit: Easy Weakness: CVSS2 Score:

Recommendation

Also include the from variable in the mapping to check if forceWithdraw has been requested, since from can be invalid at request time.

References

Proof of concept

import as a test in a forge project and run forge test -vvvv

// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;

import "forge-std/Test.sol";

interface IExchangeV3 {
    function forceWithdraw(
        address from,
        address tokenId,
        uint32 accountId
    ) external payable;
}

contract CounterTest is Test {
    IExchangeV3 public exchangeV3 =
        IExchangeV3(0x9C07A72177c5A05410cA338823e790876E79D73B);

    address usdc = 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48;

    address attacker = address(1);
    address legitimate_user = address(2);

    uint32 accountId = 1;

    function setUp() public {}

    function testForceWithdrawalDos() public {
        //This withdraw is bound to fail because accountId does not belong to address attacker
        vm.prank(attacker);
        exchangeV3.forceWithdraw{value: 1e18}(attacker, usdc, accountId);

        //This withdraw request can succeed, because this is the right value for from
        vm.prank(legitimate_user);
        exchangeV3.forceWithdraw{value: 1e18}(legitimate_user, usdc, accountId);
    }
}

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

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 contract tracks pending forceWithdraw requests only by account ID and does not verify that the caller's address matches the account owner at request time.

Impact

A malicious user could prevent a legitimate user from requesting a forceWithdraw, which may deny access to funds if the operator is also malicious.

What the attacker needed

Attacker can call forceWithdraw; victim has an account ID; operator does not immediately invalidate

The fix

The contract should include the from address when checking whether a forceWithdraw has already been requested, because from can be invalid at request time.

How it was found

  1. The attacker calls forceWithdraw with their own address as the from parameter but with the victim's account ID.
  2. The contract records a pending forceWithdraw request for that account ID.
  3. The legitimate user tries to call forceWithdraw for the same account ID but is blocked because a request already exists.

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 force withdraw is a way for a user to ask for their funds back directly from a smart contract. The contract only allows one such request per account at a time. An attacker can send a request using someone else's account number, which blocks the real owner from making their own request until the bad request is cleaned up.

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 from DeGate

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.