Rust Sensitive Information In Url
Description
This vulnerability detector identifies instances in Rust code where sensitive information may be exposed through URLs in HTTP redirects or outbound requests. When applications include sensitive data like passwords, tokens, or personal information in URLs, this information can be logged in web server logs, browser history, or referrer headers, creating a security risk.
Detection Strategy
• Scans Rust source code that imports the actix_web library
• Identifies HTTP redirect operations that may include sensitive data in the URL
• Identifies outbound HTTP requests that may include sensitive information in the URL
• Reports vulnerabilities when sensitive data could be exposed through URL parameters or paths in web requests
Vulnerable code example
use actix_web::{get, web, HttpResponse};
use awc::Client;
#[get("/reset")]
async fn reset_vulnerable(query: web::Query<std::collections::HashMap<String, String>>) -> HttpResponse {
let token = query.get("token").unwrap();
// VULNERABLE: User-controlled token interpolated into Location header...✅ Secure code example
use actix_web::{get, web, HttpResponse};
use awc::Client;
#[get("/reset")]
async fn reset_secure(query: web::Query<std::collections::HashMap<String, String>>) -> HttpResponse {
let token = query.get("token").unwrap();
// SAFE: Token sent via Authorization header, not exposed in Location URL...Search for vulnerabilities in your apps for free with Fluid Attacks' automated security testing! Start your 21-day free trial and discover the benefits of the Continuous Hacking Essential plan. If you prefer the Advanced plan, which includes the expertise of Fluid Attacks' hacking team, fill out this contact form.