Langflow RCE and Cloud Metadata Discovery

High severity TLP:CLEAR Part 1 of 2 Research by Rapid7 Published 18 Nov 2026

Hypothesis

An attacker is exploiting unauthenticated remote code execution vulnerabilities in Langflow AI endpoints and subsequently querying the cloud metadata service to harvest identity tokens for lateral movement.

Brief

Why hunt for Langflow exploitation

Recent vulnerability research highlighted in the Rapid7 — Metasploit Wrap Up: Langflow, MongoDB, and More describes unauthenticated remote code execution (RCE) in Langflow. Because Langflow serves as an orchestration layer for AI pipelines, these instances often reside in cloud environments with attached identity roles. An attacker who gains code execution on a Langflow container can immediately pivot to the cloud provider's metadata service to steal credentials. This hunt identifies those critical hand-off points between initial access and lateral movement.

How the hunt flows

The hunt begins by scoping the estate. The first query checks the software inventory for any packages matching Langflow. If the inventory is outdated or incomplete, the analyst uses this list of known hosts to narrow the subsequent network telemetry queries, though the hunt can run across the full estate if necessary.

Once the scope is defined, the hunt runs three queries in parallel to gather behavioral evidence. The first query monitors HTTP activity for requests hitting sensitive endpoints such as /api/v1/build, /api/v1/validate, or eval_custom_component_code. These are the primary vectors for the Metasploit modules and represent the initial access phase.

The second parallel query looks for outbound HTTP traffic from those same hosts to the cloud metadata service IP. While some applications legitimately query metadata for configuration, a sudden spike or a request originating from an AI orchestration service is a high-fidelity indicator of post-exploitation discovery. This provides the link between the web-facing exploit and the cloud environment.

The final parallel query baselines external traffic. It stack-counts source IPs hitting the Langflow endpoints and filters for those appearing on three or fewer hosts. This helps the analyst ignore wide-scale automated scanners or internal health checks, focusing instead on targeted exploitation attempts from rare external actors.

An analyst then triages the results by correlating the time and source IP of the API requests with the metadata access events. A match across both surfaces indicates a successful intrusion and immediate credential theft, leading to host isolation and session revocation.

What this hunt cannot see

This hunt faces two primary blind spots. First, without TLS decryption or application-level logging of HTTP request bodies, the analyst cannot see the specific Python code an attacker submits. They can confirm the endpoint was called and the status code returned, but the payload remains opaque. Second, the hunt sees the attempt to reach the metadata service but cannot confirm if the request was successful or if the cloud environment uses IMDSv2 protections that would prevent token theft. Audit logs from the cloud provider are required to confirm if the stolen identity was used.

How to run the hunt

This hunt is provided as an open hunt.md playbook. You can import it into Huntbase or any runtime that supports the hunt.md format. The playbook includes the SQLite queries for HTTP and inventory surfaces, the triage logic for the analyst, and the remediation steps for isolating compromised instances.

In this series

Steps

  1. Query, scoping

    Identify Langflow Installations

    Locate hosts running Langflow to establish the hunt scope.

    sql, reads hb_software_inventory
    SELECT device_hostname, package_name, package_version, install_pathFROM hb_software_inventoryWHERE LOWER(package_name) LIKE '%langflow%'

    What a hit looks like. A list of hosts and their Langflow versions. Silence means the product is not recorded in the package inventory.

  2. Query, detection candidate

    Detect Suspicious API Calls

    Find HTTP requests to the Langflow endpoints targeted by the Metasploit modules.

    sql, reads hb_http_activity
    SELECT device_hostname, src_endpoint_ip, url_path, status_code, user_agent, timeFROM hb_http_activityWHERE (LOWER(url_path) LIKE '%/api/v1/build%' OR LOWER(url_path) LIKE '%/api/v1/validate%' OR LOWER(url_path) LIKE '%eval_custom_component_code%')  AND ('{{scope_hosts}}' = '' OR instr(',' || '{{scope_hosts}}' || ',', ',' || device_hostname || ',') > 0)  AND time >= datetime('now', '-{{lookback_days}} days')

    What a hit looks like. Requests to sensitive build or validate endpoints. Frequent 200 OK responses from unusual source IPs indicate potential successful exploitation.

  3. Query, enrichment

    Detect Metadata Access

    Identify attempts to reach the cloud metadata service from the same hosts.

    sql, reads hb_http_activity
    SELECT device_hostname, src_endpoint_ip, url_full, user_agent, timeFROM hb_http_activityWHERE (url_hostname = '{{metadata_ip}}' OR dst_endpoint_ip = '{{metadata_ip}}')  AND ('{{scope_hosts}}' = '' OR instr(',' || '{{scope_hosts}}' || ',', ',' || device_hostname || ',') > 0)  AND time >= datetime('now', '-{{lookback_days}} days')

    What a hit looks like. Outbound HTTP requests to the metadata service. This is anomalous for standard AI workflow builder operations and suggests credential theft.

  4. Query, baseline

    Baseline External Traffic

    Stack-count source IPs to isolate rare external actors hitting Langflow endpoints.

    sql, reads hb_http_activity
    SELECT src_endpoint_ip, COUNT(DISTINCT device_hostname) AS host_count, COUNT(*) AS request_count, MIN(time) AS first_seenFROM hb_http_activityWHERE (LOWER(url_path) LIKE '%/api/v1/build%' OR LOWER(url_path) LIKE '%/api/v1/validate%')  AND time >= datetime('now', '-{{lookback_days}} days')GROUP BY src_endpoint_ipHAVING host_count <= 3ORDER BY host_count ASC

    What a hit looks like. A list of source IPs hitting Langflow on 3 or fewer hosts. High-volume, fleet-wide traffic usually indicates internal health checks or automated scanners.

  5. Agent triage

    Triage Langflow Intrusion

    Analyze the HTTP traffic patterns to determine if an intrusion has occurred.

  6. Decision

    Route on Verdict

    Direct the hunt based on the agent's confidence in the detected activity.

  7. Response action

    Isolate Host

    Prevent further credential exfiltration by containing the compromised host.

  8. Analyst task

    Analyst Remediation

    Verify the extent of the breach and identify any stolen secrets.

  9. Analyst task

    Close-out

    Record the hunt results and finalize documentation.

Coverage

2 of 5 stages covered

Stage and ATT&CK techniqueCoveredHow, or why not
Exploitation of Langflow Endpoints
T1190
Yes identify-langflow-installations, detect-suspicious-api-calls
Cloud Metadata Service Abuse
T1552.005
Yes detect-metadata-access
Python Remote Code Execution
T1059.006
Out of scope Belongs to another part of the 'Metasploit Wrap Up: Langflow, MongoDB, and More' series.
Credential and Secret Access
T1552.001 T1555
Out of scope Belongs to another part of the 'Metasploit Wrap Up: Langflow, MongoDB, and More' series.
Persistence via Database Modification
T1505.003
Out of scope Belongs to another part of the 'Metasploit Wrap Up: Langflow, MongoDB, and More' series.

Blind spots

  • Needs TLS decryption at the proxy or application-level logging of HTTP request bodies. An analyst can see that the endpoint was called but cannot distinguish between a legitimate workflow build and a malicious RCE payload without the body content. It would answer: What Python code was submitted to the validate or build endpoints?
  • Needs Cloud provider instance audit logs or IMDSv2 configuration state. A request to 169.254.169.254 might be blocked by IMDSv2 or local firewall rules, but hb_http_activity may only show the attempt. It would answer: Was the metadata request successful and were credentials actually exfiltrated?

Parameters and data

Parameters

ParameterTypeDefaultWhat it is
lookback_daysnumber14Days of historical HTTP activity to examine.
metadata_ipip169.254.169.254The common cloud metadata service IP address.
scope_hostslist[host]noneOptional list of hosts to narrow the hunt; leave empty to scan the full estate.

Data sources

SourceCategoryTelemetry
Endpoint telemetry (hb_ surfaces)endpointendpoint
Web server / proxy logssiemnetwork

Source

An open hunt.md file. It runs anywhere that reads the format.

hunt.md
---
analysis: A simple detection rule might trigger on any metadata access, but this hunt
  correlates the presence of vulnerable AI software with specific unauthenticated
  HTTP paths and applies a baseline to ignore frequent internal scanners.
blind_spots:
- id: http-payload-visibility
  question: What Python code was submitted to the validate or build endpoints?
  requires: TLS decryption at the proxy or application-level logging of HTTP request
    bodies
  risk: An analyst can see that the endpoint was called but cannot distinguish between
    a legitimate workflow build and a malicious RCE payload without the body content.
  stage: initial-access-langflow-exploit
- id: metadata-response-status
  question: Was the metadata request successful and were credentials actually exfiltrated?
  requires: Cloud provider instance audit logs or IMDSv2 configuration state
  risk: A request to 169.254.169.254 might be blocked by IMDSv2 or local firewall
    rules, but hb_http_activity may only show the attempt.
  stage: lateral-movement-cloud-metadata
coverage:
- stage: initial-access-langflow-exploit
  status: covered
  steps:
  - identify-langflow-installations
  - detect-suspicious-api-calls
- stage: lateral-movement-cloud-metadata
  status: covered
  steps:
  - detect-metadata-access
- reason: 'Belongs to another part of the ''Metasploit Wrap Up: Langflow, MongoDB,
    and More'' series.'
  stage: execution-python-rce
  status: out_of_scope
- reason: 'Belongs to another part of the ''Metasploit Wrap Up: Langflow, MongoDB,
    and More'' series.'
  stage: credential-access-secrets-theft
  status: out_of_scope
- reason: 'Belongs to another part of the ''Metasploit Wrap Up: Langflow, MongoDB,
    and More'' series.'
  stage: persistence-database-modification
  status: out_of_scope
guardrails:
  claims: no_unsupported
  evidence: citation_required
  missing_data: not_benign
  telemetry: untrusted
hunt:
  applicability: campaign-specific
  handoff: promote-to-detection
  justification: Langflow RCEs are unauthenticated and offer immediate access to the
    compute context. Given the frequent use of Langflow in cloud-native AI pipelines,
    these hosts often have powerful identity tokens that can be used to move laterally
    into the cloud control plane.
  methodology: model-assisted
  trigger: intel-report
hypothesis: An attacker is exploiting unauthenticated remote code execution vulnerabilities
  in Langflow AI endpoints and subsequently querying the cloud metadata service to
  harvest identity tokens for lateral movement.
labels:
- hunt
- attack.t1190
- attack.t1552.005
- credential access
- execution
- initial access
- lateral movement
- persistence
name: Langflow RCE and Cloud Metadata Discovery
parameters:
  lookback_days:
    default: '14'
    description: Days of historical HTTP activity to examine.
    type: number
  metadata_ip:
    default: 169.254.169.254
    description: The common cloud metadata service IP address.
    type: ip
  scope_hosts:
    default: []
    description: Optional list of hosts to narrow the hunt; leave empty to scan the
      full estate.
    type: list[host]
provenance:
  authors:
  - name: Huntbase hunt generation
    org: huntbase.io
  generated:
    by: huntbase-hunt-generation
    from: https://www.rapid7.com/blog/post/pt-metasploit-wrap-up-langflow-mongodb-and-more
    gates:
    - dry-run
    - lint
    - critic
    model: hb_google/gemini-3-flash-preview
rationale: Begin by searching the software inventory for Langflow. If the inventory
  is stale, run the HTTP queries across all application server subnets.
references:
- name: "Rapid7 \u2014 Metasploit Wrap Up: Langflow, MongoDB, and More"
  url: https://www.rapid7.com/blog/post/pt-metasploit-wrap-up-langflow-mongodb-and-more
related:
- hunt: langflow-post-exploitation-python-behavior
  reason: This hunt focuses on the network-level initial access and discovery; the
    internal execution of Python and child processes is handled in a separate execution-focused
    hunt.
  relation: out-of-scope-alternative
scenario:
  stages:
  - name: Exploitation of Langflow Endpoints
    observables:
    - /api/v1/build/
    - /api/v1/validate
    - eval_custom_component_code
    slug: initial-access-langflow-exploit
    tactic: initial-access
    techniques:
    - T1190
  - name: Python Remote Code Execution
    observables:
    - Python child processes spawning shells
    - langflow process executing arbitrary Python strings
    - Meterpreter python payload execution
    slug: execution-python-rce
    tactic: execution
    techniques:
    - T1059.006
  - name: Credential and Secret Access
    observables:
    - Accessing Langflow database files
    - Reading application secrets from database tables
    - Retrieval of SSO email addresses and phone numbers
    slug: credential-access-secrets-theft
    tactic: credential-access
    techniques:
    - T1552.001
    - T1555
  - name: Cloud Metadata Service Abuse
    observables:
    - HTTP requests to 169.254.169.254
    - Abuse of cloud metadata endpoints for tenant lateral movement
    slug: lateral-movement-cloud-metadata
    tactic: lateral-movement
    techniques:
    - T1552.005
  - name: Persistence via Database Modification
    observables:
    - Modification of tool_code in the Langflow database
    - SQL updates to public flows to re-execute attacker code
    slug: persistence-database-modification
    tactic: persistence
    techniques:
    - T1505.003
  summary: This article describes multiple Metasploit modules targeting vulnerabilities
    in Langflow and OpenCTI, providing unauthenticated remote code execution capabilities.
    In Langflow environments, successful exploitation allows attackers to execute
    arbitrary Python code, access application secrets, pivot to cloud metadata services,
    and maintain persistence by injecting malicious code into the application's database.
series:
  index: 1
  slug: metasploit-wrap-up-langflow-mongodb-and-more
  title: 'Metasploit Wrap Up: Langflow, MongoDB, and More'
  total: 2
severity: high
targets:
  analyst:
    name: Tier-2 analyst
    role: analyst
  endpoint:
    category: endpoint
    name: Endpoint telemetry (hb_ surfaces)
    telemetry:
    - endpoint
  hunter:
    agent: true
    name: Hunt agent
  web:
    category: siem
    name: Web server / proxy logs
    telemetry:
    - network
tlp: clear
type: investigation
---


# Langflow RCE and Cloud Metadata Discovery

This hunt identifies Langflow installations within the estate and monitors for exploitation attempts against the build and validate API endpoints. It correlates these suspicious HTTP requests with outbound traffic to the cloud metadata service (169.254.169.254), a common post-exploitation step used to pivot from a compromised container or instance into the cloud control plane. The hunt uses a stack-counting baseline to isolate rare external actors hitting these sensitive AI orchestration paths.

## identify-langflow-installations
<!-- Identify Langflow Installations -->
Locate hosts running Langflow to establish the hunt scope.

```sqlite target=endpoint role=scoping
~~~yaml
expected: A list of hosts and their Langflow versions. Silence means the product is
  not recorded in the package inventory.
reads:
- device_hostname
- install_path
- package_name
- package_version
silence: not_evidence_of_absence
source: hb_software_inventory
verified: dry-run
verified_at: '2026-11-18'
~~~
SELECT device_hostname, package_name, package_version, install_path FROM hb_software_inventory WHERE LOWER(package_name) LIKE '%langflow%'
```

## fan-out-telemetry
<!-- Fan-out Telemetry -->
parallel:
- → detect-suspicious-api-calls
- → detect-metadata-access
- → baseline-external-traffic
join: → triage-langflow-intrusion

## detect-suspicious-api-calls
<!-- Detect Suspicious API Calls -->
Find HTTP requests to the Langflow endpoints targeted by the Metasploit modules.

```sqlite target=web role=detection-candidate params=(scope_hosts=scope_hosts, lookback_days=lookback_days)
~~~yaml
expected: Requests to sensitive build or validate endpoints. Frequent 200 OK responses
  from unusual source IPs indicate potential successful exploitation.
reads:
- device_hostname
- src_endpoint_ip
- status_code
- time
- url_path
- user_agent
silence: not_evidence_of_absence
source: hb_http_activity
verified: dry-run
verified_at: '2026-11-18'
~~~
SELECT device_hostname, src_endpoint_ip, url_path, status_code, user_agent, time FROM hb_http_activity WHERE (LOWER(url_path) LIKE '%/api/v1/build%' OR LOWER(url_path) LIKE '%/api/v1/validate%' OR LOWER(url_path) LIKE '%eval_custom_component_code%') AND ('{{scope_hosts}}' = '' OR instr(',' || '{{scope_hosts}}' || ',', ',' || device_hostname || ',') > 0) AND time >= datetime('now', '-{{lookback_days}} days')
```

## detect-metadata-access
<!-- Detect Metadata Access -->
Identify attempts to reach the cloud metadata service from the same hosts.

```sqlite target=web role=enrichment params=(metadata_ip=metadata_ip, scope_hosts=scope_hosts, lookback_days=lookback_days)
~~~yaml
expected: Outbound HTTP requests to the metadata service. This is anomalous for standard
  AI workflow builder operations and suggests credential theft.
reads:
- device_hostname
- dst_endpoint_ip
- src_endpoint_ip
- time
- url_full
- url_hostname
- user_agent
silence: not_evidence_of_absence
source: hb_http_activity
verified: dry-run
verified_at: '2026-11-18'
~~~
SELECT device_hostname, src_endpoint_ip, url_full, user_agent, time FROM hb_http_activity WHERE (url_hostname = '{{metadata_ip}}' OR dst_endpoint_ip = '{{metadata_ip}}') AND ('{{scope_hosts}}' = '' OR instr(',' || '{{scope_hosts}}' || ',', ',' || device_hostname || ',') > 0) AND time >= datetime('now', '-{{lookback_days}} days')
```

## baseline-external-traffic
<!-- Baseline External Traffic -->
Stack-count source IPs to isolate rare external actors hitting Langflow endpoints.

```sqlite target=web role=baseline params=(lookback_days=lookback_days)
~~~yaml
baseline:
  compare: first_seen
  window: '{{lookback_days}}d'
expected: A list of source IPs hitting Langflow on 3 or fewer hosts. High-volume,
  fleet-wide traffic usually indicates internal health checks or automated scanners.
prevalence:
  by: device_hostname
  key:
  - src_endpoint_ip
  rare_below: 3
reads:
- device_hostname
- src_endpoint_ip
- time
- url_path
silence: not_evidence_of_absence
source: hb_http_activity
verified: dry-run
verified_at: '2026-11-18'
~~~
SELECT src_endpoint_ip, COUNT(DISTINCT device_hostname) AS host_count, COUNT(*) AS request_count, MIN(time) AS first_seen FROM hb_http_activity WHERE (LOWER(url_path) LIKE '%/api/v1/build%' OR LOWER(url_path) LIKE '%/api/v1/validate%') AND time >= datetime('now', '-{{lookback_days}} days') GROUP BY src_endpoint_ip HAVING host_count <= 3 ORDER BY host_count ASC
```

## triage-langflow-intrusion
<!-- Triage Langflow Intrusion -->
```agent target=hunter
cite: required
context:
- identify-langflow-installations
- detect-suspicious-api-calls
- detect-metadata-access
- baseline-external-traffic
max_iterations: 5
objective: Determine if any Langflow host is being actively exploited and whether
  the actor is attempting to steal cloud credentials through the metadata service.
success_criteria: A per-host verdict citing rows from both the API and metadata queries.
tools:
- endpoint
- web
```

## route-on-verdict
<!-- Route on Verdict -->
if~: "the triage-langflow-intrusion verdict is malicious for at least one host" (confidence: high, judge=hunter)
then: → isolate-host
indeterminate: → analyst-remediation
unavailable: → analyst-remediation (blind_spot: http-payload-visibility)
else: → close-out

## isolate-host
<!-- Isolate Host -->
```action target=endpoint
~~~yaml
approval: required
~~~
Isolate the compromised Langflow endpoint from the network and revoke any cloud session tokens associated with its instance identity.
```
→ analyst-remediation

## analyst-remediation
<!-- Analyst Remediation -->
```manual target=analyst
Review the full HTTP transaction logs if available. Check the cloud provider audit logs for unusual API calls using the identity of the isolated instance. Rotate any credentials stored in Langflow's environment variables.
```
→ close-out

## close-out
<!-- Close-out -->
```manual target=analyst
Document the number of Langflow instances identified and the status of their patches. Record any successful exploitation chains for future detection tuning.
```
→ end

Run this hunt against your own data.

In Huntbase, Scout runs every step across the tools you already connect, checks back through your history and returns a verdict with the evidence. The hunt.md file is open, so you can also take it anywhere that reads the format.

Drafted by machine (huntbase-hunt-generation, hb_google/gemini-3-flash-preview), checked by dry-run, lint, critic, then reviewed by a person.

Content pack

Sign up to open

Pack contents open in Huntbase.