Skip to content

AMI: unbounded pre-auth read buffer (memory-exhaustion DoS) #110

Description

@ryanmurf

Summary (file-only — out of the panic/UB lane, flagging for a sibling agent)

The AMI connection handler accumulates bytes into an unbounded String
(message_buf) until it sees the \r\n\r\n message terminator. A client that
connects and never sends a blank line — before authenticating — makes the
server buffer arbitrarily much data, a pre-auth memory-exhaustion DoS.

Location

crates/asterisk-ami/src/server.rs:282-321 (handle_connection read loop);
read_message in crates/asterisk-ami/src/protocol.rs:378 only returns once
the terminator is present, with no maximum-length guard.

Impact

Memory-exhaustion DoS, unauthenticated (AMI default binds 127.0.0.1, but is
frequently exposed). Not a panic/UB, so out of the memory-safety hardening lane
I'm working — recording it for the concurrency/DoS-limits agent.

Suggested fix

Cap message_buf length (and per-line length) and drop the connection with an
error when a single message exceeds a sane maximum (Asterisk uses a bounded
manager read buffer). Mirror the MAX_* limits already used in the SIP parser.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions