Skip to content
Misconfiguration Audit finding Intermediate

Typed receipt encoding does not conform to standard Ethereum RPC format

The debug_getRawReceipts RPC method encoded typed transaction receipts using plain RLP instead of the EIP-2718 format, so the required transaction type prefix byte was missing. Clients and tools expecting standard Ethereum receipts could fail to parse them or misinterpret the receipt type.

Evo Follow

Originally disclosed on Code4rena

Submitted by Evo

bft/monad-rpc/src/handlers/debug.rs #L126

Root Cause

The debug_getRawReceipts RPC method in bft/monad-rpc/src/handlers/debug.rs violates the EIP-2718 specification by using incorrect encoding for typed transaction receipts. The method uses plain RLP encoding (r.encode()) instead of EIP-2718 encoding (r.encode_2718()), resulting in receipts that are missing their required transaction type prefix byte.

Technical Details

Current Implementation:

https://github.com/code-423n4/2025-09-monad/blob/main/bft/monad-rpc/src/handlers/debug.rs#L126

// In bft/monad-rpc/src/handlers/debug.rs, monad_debug_getRawReceipts function
let encode_receipts = |receipts: Vec<ReceiptEnvelope<alloy_primitives::Log>>| {
    let receipts = receipts
        .into_iter()
        .map(|r| {
            let mut res = Vec::new();
            r.encode(&mut res);  // ← ISSUE: Using plain RLP encoding
            hex::encode(&res)
        })
        .collect();
    Ok(MonadDebugGetRawReceiptsResult { receipts })
};

Correct Implementation (as seen in debug_getRawTransaction in the same file L156):

https://github.com/code-423n4/2025-09-monad/blob/main/bft/monad-rpc/src/handlers/debug.rs#L156

let mut res = Vec::new();
let tx: TxEnvelope = tx.into();
tx.encode_2718(&mut res);  // ← CORRECT: Using EIP-2718 encoding

The EIP-2718 Violation

According to the EIP-2718 specification:

“Receipt is either TransactionType || ReceiptPayload or LegacyReceipt”

And critically:

“The TransactionType of the receipt MUST match the TransactionType of the transaction with a matching Index.”

The specification defines that for typed transactions:

  • TransactionType is a positive unsigned 8-bit number between 0 and 0x7f
  • ReceiptPayload is an opaque byte array whose interpretation depends on the TransactionType
  • The format MUST be: TransactionType || ReceiptPayload where || is the concatenation operator

Example of the violation for an EIP-1559 transaction:

Component | Expected (EIP-2718 compliant) | Actual (Current Implementation) |

Transaction | 0x02 \|\| TransactionPayload | 0x02 \|\| TransactionPayload ✓ |

Receipt | 0x02 \|\| ReceiptPayload | RLP([status, gas, bloom, logs]) ✗ |

The receipt is missing the critical 0x02 TransactionType byte prefix, violating the MUST requirement that “The TransactionType of the receipt MUST match the TransactionType of the transaction.”

Dependency Context

The project uses the alloy-consensus crate (v0.8.3) which provides the ReceiptEnvelope type. This type correctly implements the Encodable2718 trait in alloy-consensus-0.8.3/src/receipt/envelope.rs:

// From alloy-consensus-0.8.3/src/receipt/envelope.rs
impl Encodable2718 for ReceiptEnvelope {
    fn encode_2718(&self, out: &mut dyn BufMut) {
        match self.type_flag() {
            None => {}                    // Legacy receipts - no prefix
            Some(ty) => out.put_u8(ty),  // Typed receipts - adds type byte
        }
        self.as_receipt_with_bloom().unwrap().encode(out);
    }
}

The encode_2718() method automatically handles all receipt types:

  • Legacy (no prefix, remains as rlp([status, cumulativeGasUsed, logsBloom, logs]))
  • EIP-2930 (0x01 prefix)
  • EIP-1559 (0x02 prefix)
  • EIP-4844 (0x03 prefix)
  • EIP-7702 (0x04 prefix)

Impact

  • Malformed receipts could cause incorrect state verification or proof generation in systems relying on proper receipt encoding, and the tools and clients expecting EIP-2718 compliant receipts will fail to parse them correctly.
  • Violates EIP-2718’s MUST requirements - the spec requires matching TransactionType between transactions and receipts, and the method documentation falsely claims to return “EIP-2718 binary-encoded receipts”, as external clients cannot differentiate receipt types as the first byte should be in range [0, 0x7f] for typed transactions but instead contains RLP data.

Recommended mitigation steps

Replace the plain RLP encoding with EIP-2718 encoding in the debug_getRawReceipts function:

// In bft/monad-rpc/src/handlers/debug.rs, line ~49
let encode_receipts = |receipts: Vec<ReceiptEnvelope<alloy_primitives::Log>>| {
    let receipts = receipts
        .into_iter()
        .map(|r| {
            let mut res = Vec::new();
            r.encode_2718(&mut res);  // ← FIX: Use encode_2718 instead of encode
            hex::encode(&res)
        })
        .collect();
    Ok(MonadDebugGetRawReceiptsResult { receipts })
};

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

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 called the generic RLP encoder instead of the EIP-2718 encoder, so the transaction type byte was never written.

Impact

Tools and clients expecting EIP-2718 compliant receipts will fail to parse them correctly, and systems relying on proper receipt encoding could perform incorrect state verification or proof generation.

What the attacker needed

Access to the debug RPC method

The fix

The plain RLP encoding should be replaced with EIP-2718 encoding by calling encode_2718 instead of encode.

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.

Ethereum receipts are records that confirm what happened in a transaction. Newer transaction types must start with a small number that says which type they are, but this code left that number out. Anything that reads the receipt then cannot tell what kind of transaction it came from.

What is Misconfiguration?

Settings left unsafe: exposed panels, open storage buckets, debug modes, default credentials.

More by Evo

View all

7 more disclosed reports, best first.

More from Monad

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Security misconfiguration

The lesson behind this report.

Settings left unsafe: exposed panels, open storage buckets, debug modes, default credentials.