Skip to content
Business logic Audit finding Beginner

Misuse of error

The transaction submission function returns a 'TooManyTransactions' error when the sender is not whitelisted, instead of a more appropriate error. This mislabelling could confuse protocol users and developers, making debugging harder, but does not directly enable an attack.

okmxuse Follow

Originally disclosed on Immunefi

Informational View original
  • Disclosed after under an hour

#42895 [BC-Insight] Misuse of error

Submitted on Mar 28th 2025 at 13:56:45 UTC by @okmxuse for Attackathon | Movement Labs

Description

Description

The function submit_transaction is invoked during the transaction processing pipeline. Within this function, the following check is performed:

Rust
async fn submit_transaction(
    &mut self,
    transaction: SignedTransaction,
) -> Result<SubmissionStatus, Error> {
    // Check whether the account is whitelisted
    if !self.is_whitelisted(&transaction.sender())? {
        return Ok((MempoolStatus::new(MempoolStatusCode::TooManyTransactions), None));
    }

If transaction.sender is not whitelisted, the function returns an error. However, the error type used here is MempoolStatusCode::TooManyTransactions.

This error code, as its name suggests, is intended to indicate that an account has reached its maximum transaction capacity:

Rust
// Account reached max capacity per account
TooManyTransactions = 3,

This intended use is further reinforced by its correct application in transaction_store.rs::insert:

Rust
if txns.len() >= self.capacity_per_user {
    return MempoolStatus::new(MempoolStatusCode::TooManyTransactions).with_message(
        format!(
            "Mempool over capacity for account. Number of transactions from account: {} Capacity per account: {}",
            txns.len(),
            self.capacity_per_user,
        ),
    );
}

Here, the error is returned only when the number of transactions from an account exceeds the allowed limit.

Impact

The primary issue with the current implementation is the confusion it may cause for both protocol users and developers. Misusing TooManyTransactions in a whitelist check introduces ambiguity in error handling and makes debugging more difficult.

Recommendation

We recommend either:

  • Introducing a new, more appropriate error code to indicate that a transaction sender is not whitelisted.
  • Handling the whitelist rejection differently, ensuring error messages accurately reflect the underlying issue.

Proof of Concept

POC

  • The submit_transaction function is called during transaction processing.
  • If the sender is not whitelisted, the following check triggers an error:
Rust
if !self.is_whitelisted(&transaction.sender())? {
    return Ok((MempoolStatus::new(MempoolStatusCode::TooManyTransactions), None));
}
  • However, MempoolStatusCode::TooManyTransactions is meant to indicate that the user has exceeded their transaction limit.
  • In this case, the sender is simply not whitelisted, making the error misleading.
  • This misrepresentation can cause confusion for both interacting protocols and users.

The original report as published on Immunefi, by okmxuse. 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 whitelist check reuses an existing error code meant for a different condition (exceeding transaction capacity) instead of defining a specific error for non-whitelisted senders.

Impact

The misuse of the error code may cause confusion for protocol users and developers, making debugging more difficult, but it does not directly lead to a security breach.

What the attacker needed

None

The fix

The error handling should be fixed by introducing a new, more appropriate error code for non-whitelisted senders or by handling the whitelist rejection differently so that error messages accurately reflect the underlying issue.

How it was found

  1. The submit_transaction function is called during transaction processing.
  2. If the sender is not whitelisted, the check triggers an error.
  3. The error returned is MempoolStatusCode::TooManyTransactions, which is meant for exceeding transaction limits.
  4. This misrepresentation can cause confusion for protocols and users.

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.

This report is about a confusing error message in a blockchain system. When a transaction comes from an account that is not allowed (not whitelisted), the system says 'too many transactions' instead of 'not allowed'. That mix-up can make it harder for people to understand what went wrong, but it does not let anyone break in.

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 okmxuse

View all

9 more disclosed reports, best first.

More from Movement Labs

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.