Skip to content
Business logic Audit finding Beginner

Blocklist can be circumvented due to incorrect blocking logic in request_decider::can_accept_deposit_request

The deposit request check accepted a request if any single input address was not blocklisted, rather than requiring all inputs to be clean. An attacker could therefore deposit funds from a blocklisted address by adding a tiny non-blocklisted input to the request.

n4nika Follow

Originally disclosed on Immunefi

  • Disclosed after under an hour

#37500 [BC-Low] Blocklist can be circumvented due to incorrect blocking logic in `request_decider::c

Submitted on Dec 6th 2024 at 12:31:58 UTC by @n4nika for Attackathon | Stacks

Description

Note to immunefi

This issue was discussed with the Stacks team on discord and I was asked by @Evonide to submit it without the need for a PoC, which is why none is provided on this issue

Summary

request_decider::can_accept_deposit_request currently returns Ok(true) if there is at least one non-blocklisted address as an input to a deposit UTXO. This means anyone can circumvent the blocklist by adding a tiny non-blocklisted UTXO as an input to their deposit request.

Finding Description

can_accept_deposit_request uses the following code to determine whether a certain UTXO can be accepted:

RS
async fn can_accept_deposit_request(&self, req: &model::DepositRequest) -> Result<bool, Error> {

    // [getting addresses from the request]

    let responses = futures::stream::iter(&addresses)
        .then(|address| async { client.can_accept(&address.to_string()).await })
        .inspect_err(|error| tracing::error!(%error, "blocklist client issue"))
        .collect::<Vec<_>>()
        .await;

    // If any of the inputs addresses are fine then we pass the deposit
    // request.
    let can_accept = responses.into_iter().any(|res| res.unwrap_or(false));
    Ok(can_accept)
}

As we can see, we create a responses vector with elements for each input address, either being true if the address can be accepted or false if it should be rejected.

Then can_accept is determined by using .any on the responses. any returns true if there is at least one true element in responses.

Impact

Say a user has a big UTXO which is blacklisted but wants to deposit it. They can just create a deposit request including a very small UTXO from a non-blocklisted address, allowing them to successfully deposit their bitcoins to Stacks from an address which should not be allowed to do so.

Mitigation

Consider using .all instead of .any to ensure none of the inputs to the UTXO come from blocklisted addresses.

Proof of Concept

Omitted due to direct request from Stacks team

The original report as published on Immunefi, by n4nika. 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

The code combined per-address blocklist results with an 'any' check instead of an 'all' check, so one allowed input was enough to pass.

Impact

A user holding a blocklisted UTXO could deposit it to Stacks by including a very small non-blocklisted UTXO, bypassing the blocklist.

What the attacker needed

A blocklisted UTXO to deposit; a small non-blocklisted UTXO

The fix

The check should use 'all' instead of 'any' so that every input address must pass the blocklist.

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 blocklist is a list of addresses the system is meant to refuse. This code checked a deposit's inputs and let the deposit through if even one input was not on the list, so a banned address could slip through by pairing it with a small allowed one.

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 n4nika

View all

13 more disclosed reports, best first.

More from Stacks

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.