Skip to content

[SPDM] Copilot scan risks #603

@liuw1

Description

@liuw1

Review Findings

  • High / DoS risk (mod.rs – MigtdTransport::receive): The loop that fills the vmcall header/body never breaks if transport.read returns Ok(0) (peer closed/EOF). recvd stays constant so the while-loop spins forever, blocking the SPDM stack and preventing any error path from running. The transport should detect 0 bytes, return an error, and let the caller tear down the session instead of looping indefinitely.
  • Medium / Framing integrity (mod.rs – same function): payload_size + VMCALL_SPDM_MESSAGE_HEADER_SIZE is computed directly, so on 32‑bit builds a crafted length close to u32::MAX wraps around and makes the check succeed even though the message doesn’t fit in the buffer. That allows the transport to accept a truncated packet while leaving the remainder on the wire, desynchronizing the stream (and potentially leading to panic on the next read). Use a checked add (or validate payload_size before the comparison) to prevent overflow-driven framing attacks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions