Skip to content

AMI: auth_timeout & auth_limit are configured but never enforced; no login rate-limit/backoff #130

Description

@ryanmurf

Summary

AmiServerConfig exposes auth_timeout (default 30s) and auth_limit (default 50 unauthenticated sessions), but neither is enforced anywhere. Unauthenticated AMI connections live forever and are unbounded, and Login has no failed-attempt rate-limit / backoff.

Location

  • crates/asterisk-ami/src/server.rs:37-39,51-52 — fields defined + defaulted.
  • crates/asterisk-ami/src/server.rs:212-219handle_connection(..., _config: AmiServerConfig): the config is received but the parameter is unused (_config). No auth deadline task, no cap on concurrent pre-auth sessions.
    $ grep -rn 'auth_timeout\|auth_limit' crates/asterisk-ami/src
    # only the struct fields, the defaults, and a test asserting the default — no enforcement
    
  • handle_login (actions.rs:227) has no per-source failed-attempt counter / delay.

Attack / impact

Recommended fix

  • Enforce auth_timeout: spawn a per-connection deadline that drops the socket if !authenticated when it fires (cancel on successful Login).
  • Enforce auth_limit: track unauthenticated session count; refuse/After-limit new connections.
  • Add a simple per-source failed-Login counter with exponential backoff or temporary block (mirror the SIP rate_limit.rs approach already in-tree).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions