logo

Database

Rust Actix Insecure Http Bind

Description

This vulnerability detector identifies insecure HTTP server bindings in Rust applications using the Actix Web framework. When HTTP servers are configured to bind using cleartext protocols instead of HTTPS, all communication between clients and the server is transmitted unencrypted, exposing sensitive data to potential interception and manipulation by attackers.

Weakness:

022 - Use of an insecure channel

Category: Information Collection

Detection Strategy

    Scans Rust source code files that import the 'actix_web' library

    Identifies method calls with names that indicate cleartext HTTP binding operations

    Verifies that the method call is being made on an HTTP server object or instance

    Excludes test files from analysis to avoid false positives on development/testing code

    Reports vulnerabilities when cleartext binding methods are found on HTTP server instances in production code

Vulnerable code example

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

#[actix_web::main]
async fn main() -> std::io::Result<()> {
    // VULNERABLE: HttpServer bound without TLS encryption
    HttpServer::new(|| App::new())
        .bind(("127.0.0.1", 8080))?  
        .run()...

✅ Secure code example

use actix_web::{web, App, HttpServer};
use rustls::ServerConfig;

fn rustls_config() -> ServerConfig {
    unimplemented!()
}

#[actix_web::main]...