Skip to content

Security: /api/hello health endpoint leaks server version via Actix default headers #101

Description

@anshul23102

Security Bug: Health Endpoint Discloses Actix Web and Rust Version Information

Description

The /api/hello health check endpoint is accessible without authentication and
returns response headers including Server: actix-web/X.Y.Z. This discloses
the exact web framework version to any caller. An attacker scanning for
vulnerable Actix Web versions can quickly identify whether this deployment is
running a version with known CVEs without any privileged access.

Steps to Reproduce

  1. Send a request to the health endpoint:
    curl -I http://localhost:8000/api/hello
  2. Observe the response headers:
    Server: actix-web/4.x.x
    
  3. Cross-reference the version against the Actix Web CVE database.

Root Cause

Actix Web includes a Server header with the framework name and version by
default. No middleware removes or replaces this header.

Impact

Version disclosure enables targeted exploitation of known framework
vulnerabilities without any brute-force or active probing.

Proposed Fix

Disable or replace the default Server header:

use actix_web::{middleware, App, HttpServer};

HttpServer::new(|| {
    App::new()
        .wrap(middleware::DefaultHeaders::new()
            .add(("Server", "rust-tune"))  // Generic name, no version
        )
        .service(hello)
})
.disable_signals()
.bind("0.0.0.0:8000")?
.run()
.await

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions