NewApp Monitoring is liveSign up free
AgentbeamBeta
AI agent vulnerability · Langflow

CVE-2026-33873: Langflow has Authenticated Code Execution in Agentic Assistant Validation

criticalCVSS 4.0 9.3GHSA-v8hw-mh8c-jxfc

Langflow 1.8.1 and earlier runs LLM-generated Python on the server during the Agentic Assistant's validation step. A user who can reach the assistant and influence the model's output can execute arbitrary code in the Langflow process. Fixed in Langflow 1.9.0.

Published Mar 26, 2026 · Updated Jun 6, 2026 · Analysis Oct 31, 2026

What an attacker can do

The Agentic Assistant helps users generate flow components. Its /assist endpoint calls execute_flow_with_validation(), which takes the code the model returns, extracts it, and passes it to validate_component_code(). That function ends in create_class() in lfx.custom.validate, which calls exec(...) and then instantiates the generated class. Validation therefore executes the code instead of only checking it.

The attacker needs access to the assistant, which means a valid login by bearer token, cookie or API key, and some way to steer the model output, for example through the request's input_value. They then get arbitrary Python in the Langflow process: OS commands, file reads and writes, and every secret the process can see, such as model API keys and database credentials.

The advisory calls this a feature-reachable code execution flaw, not an unauthenticated one. On a local single-user setup the user mostly attacks themselves. On shared or internet-facing servers it matters a lot. AUTO_LOGIN defaults to true and the /api/v1/auto_login endpoint then hands out a session, which can widen exposure.

Who is affected

The PyPI package langflow at 1.8.1 and earlier. Servers where other people or networks can reach the Agentic Assistant are the concern. Also check whether AUTO_LOGIN is still at its default of true.

Check your version:

pip show langflow

langflow

Ecosystem
PyPI
Affected
<= 1.8.1
Fixed in
1.9.0
Check
pip show langflow

How to fix it

Upgrade to Langflow 1.9.0.

pip install --upgrade langflow==1.9.0

The advisory lists no workaround. Until you upgrade, limit who can reach the Agentic Assistant and the Langflow server. Set AUTO_LOGIN to false outside development; its own description says it is for development only. That step is a sensible precaution, not a documented fix.

How to tell if you were hit

Look in access logs for POST requests to the Agentic Assistant /assist endpoint, especially from users who do not normally use it. On the host, check the Langflow process for unexpected child processes, outbound connections and new files. Review model output stored for assist sessions for code that imports os or subprocess or calls exec. Rotate keys the Langflow process can read if you find any.

Beam records the shell commands and MCP tool calls of AI agents on developer machines. It does not see inside a server-side Langflow process.

Original advisory

From the GitHub Advisory Database (CC BY 4.0).

Description

1. Summary

The Agentic Assistant feature in Langflow executes LLM-generated Python code during its validation phase. Although this phase appears intended to validate generated component code, the implementation reaches dynamic execution sinks and instantiates the generated class server-side.

In deployments where an attacker can access the Agentic Assistant feature and influence the model output, this can result in arbitrary server-side Python execution.

2. Description

2.1 Intended Functionality

The Agentic Assistant endpoints are designed to help users generate and validate components for a flow. Users can submit requests to the assistant, which returns candidate component code for further processing.

A reasonable security expectation is that validation should treat model output as untrusted text and perform only static or side-effect-free checks.

The externally reachable endpoints are:

https://github.com/langflow-ai/langflow/blob/f7f4d1e70ba5eecd18162ec96f3571c2cfbcd1fc/src/backend/base/langflow/agentic/api/router.py#L252-L297

The request model accepts attacker-influenceable fields such as input_value, flow_id, provider, model_name, session_id, and max_retries:

https://github.com/langflow-ai/langflow/blob/f7f4d1e70ba5eecd18162ec96f3571c2cfbcd1fc/src/backend/base/langflow/agentic/api/schemas.py#L20-L31

2.2 Root Cause

In the affected code path, Langflow processes model output through the following chain:

/assist → execute_flow_with_validation() → execute_flow_file() → LLM returns component code → extract_component_code() → validate_component_code() → create_class() → generated class is instantiated

The assistant service reaches the validation path here:

https://github.com/langflow-ai/langflow/blob/f7f4d1e70ba5eecd18162ec96f3571c2cfbcd1fc/src/backend/base/langflow/agentic/services/assistant_service.py#L58-L79

The code extraction step occurs here:

https://github.com/langflow-ai/langflow/blob/f7f4d1e70ba5eecd18162ec96f3571c2cfbcd1fc/src/backend/base/langflow/agentic/helpers/code_extraction.py#L11-L53

The validation entry point is here:

https://github.com/langflow-ai/langflow/blob/f7f4d1e70ba5eecd18162ec96f3571c2cfbcd1fc/src/backend/base/langflow/agentic/helpers/validation.py#L27-L47

The issue is that this validation path is not purely static. It ultimately invokes create_class() in lfx.custom.validate, where Python code is dynamically executed via exec(...), including both global-scope preparation and class construction.

https://github.com/langflow-ai/langflow/blob/f7f4d1e70ba5eecd18162ec96f3571c2cfbcd1fc/src/lfx/src/lfx/custom/validate.py#L241-L272

https://github.com/langflow-ai/langflow/blob/f7f4d1e70ba5eecd18162ec96f3571c2cfbcd1fc/src/lfx/src/lfx/custom/validate.py#L394-L399

https://github.com/langflow-ai/langflow/blob/f7f4d1e70ba5eecd18162ec96f3571c2cfbcd1fc/src/lfx/src/lfx/custom/validate.py#L441-L443

As a result, LLM-generated code is treated as executable Python rather than inert data. This means the “validation” step crosses a trust boundary and becomes an execution sink.

The streaming path can also reach this sink when the request is classified into the component-generation branch:

https://github.com/langflow-ai/langflow/blob/f7f4d1e70ba5eecd18162ec96f3571c2cfbcd1fc/src/backend/base/langflow/agentic/services/assistant_service.py#L142-L156

https://github.com/langflow-ai/langflow/blob/f7f4d1e70ba5eecd18162ec96f3571c2cfbcd1fc/src/backend/base/langflow/agentic/services/assistant_service.py#L259-L300

3. Proof of Concept (PoC)

  1. Send a request to the Agentic Assistant endpoint.
  2. Provide input that causes the model to return malicious component code.
  3. The returned code reaches the validation path.
  4. During validation, the server dynamically executes the generated Python.
  5. Arbitrary server-side code execution occurs.

4. Impact

  • Attackers who can access the Agentic Assistant feature and influence model output may execute arbitrary Python code on the server.
  • This can lead to:
  • OS command execution
  • file read/write
  • credential or secret disclosure
  • full compromise of the Langflow process

5. Exploitability Notes

This issue is most accurately described as an authenticated or feature-reachable code execution vulnerability, rather than an unconditional unauthenticated remote attack.

Severity depends on deployment model:

  • In local-only, single-user development setups, the issue may be limited to self-exposure by the operator.
  • In shared, team, or internet-exposed deployments, it may be exploitable by other users or attackers who can reach the assistant feature.

The assistant feature depends on an active user context:

https://github.com/langflow-ai/langflow/blob/f7f4d1e70ba5eecd18162ec96f3571c2cfbcd1fc/src/backend/base/langflow/api/utils/core.py#L38

Authentication sources include bearer token, cookie, or API key:

https://github.com/langflow-ai/langflow/blob/f7f4d1e70ba5eecd18162ec96f3571c2cfbcd1fc/src/backend/base/langflow/services/auth/utils.py#L39-L53

https://github.com/langflow-ai/langflow/blob/f7f4d1e70ba5eecd18162ec96f3571c2cfbcd1fc/src/backend/base/langflow/services/auth/utils.py#L156-L163

Default deployment settings may widen exposure, including AUTO_LOGIN=true and the /api/v1/auto_login endpoint:

https://github.com/langflow-ai/langflow/blob/f7f4d1e70ba5eecd18162ec96f3571c2cfbcd1fc/src/lfx/src/lfx/services/settings/auth.py#L71-L87

https://github.com/langflow-ai/langflow/blob/f7f4d1e70ba5eecd18162ec96f3571c2cfbcd1fc/src/backend/base/langflow/api/v1/login.py#L96-L135

6. Patch Recommendation

  • Remove all dynamic execution from the validation path.
  • Ensure validation is strictly static and side-effect-free.
  • Treat all LLM output as untrusted input.
  • If code generation must be supported, require explicit approval and run it in a hardened sandbox isolated from the main server process.

Discovered by: @kexinoh (https://github.com/kexinoh, works at Tencent Zhuque Lab)

Credited to kexinoh, andifilhohub.

Questions

Is Langflow 1.8.1 affected by CVE-2026-33873?

Yes. 1.8.1 and earlier are affected. The patched version is 1.9.0.

Does this need authentication?

Yes, an active user context is needed, from bearer token, cookie or API key. With the default AUTO_LOGIN=true, the auto_login endpoint can supply one, which widens exposure.

Is it exploited in the wild?

No source reports it, and it is not in CISA's KEV catalog. The EPSS score is 0.0182.

References

Read for this analysis:

How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. The analysis is written by an AI model from the sources listed above and checked by automated rules before it is published. Check versions against the vendor's advisory before you act. Methodology

More Langflow vulnerabilities

All Langflow entries