Summary
LaVague 0.2.35 evaluates untrusted Python code generated from language-model output that is influenced by web page content. An attacker who controls or can alter content processed by the extractor may use indirect prompt injection to execute arbitrary code on the operator's host without an additional review step.
Affected context
The vulnerability occurs in LaVague's PythonFromMarkdownExtractor.extract_as_object when it processes model-generated output derived from web content. Risk is higher when an operator or automated workflow retrieves attacker-influenced pages, allows model output to reach the extractor, and runs the resulting code with meaningful host permissions.
Exploit preconditions
- Attack surface: Web content ingestion followed by language-model-assisted extraction
- Required access: The attacker needs to influence content that the LaVague workflow retrieves or processes
- Trigger point: Processing model output through
PythonFromMarkdownExtractor.extract_as_object - Why exploitation is possible: Untrusted, content-derived output reaches a code evaluation path without sufficient isolation, validation, or human review
Why this happens
The underlying bug is the execution of dynamically generated Python based on data that may be controlled by external web content.
This maps to CWE-94: Improper Control of Generation of Code ('Code Injection'), because the application treats language-model output as executable program logic instead of inert data. Indirect prompt injection can influence that output and cause attacker-selected behavior to be evaluated in the application's execution context.
Potential impact
- Arbitrary code execution on the operator's host
- Exposure or modification of local files and application secrets
- Unauthorized network access from the affected host
- Persistence, data tampering, or disruption of automation workflows
- Potential compromise of connected systems when excessive privileges are available
General mitigation guidance
Mitigation generally focuses on removing dynamic code execution from data-processing paths and reducing trust in model output.
Common defensive patterns include:
- Representing extracted results as structured data rather than executable Python
- Using constrained parsers, schemas, and allowlisted transformations
- Treating web content and language-model output as untrusted across trust boundaries
- Requiring explicit human approval before any generated logic can run
- Isolating unavoidable evaluation in a hardened sandbox with minimal filesystem, network, and process privileges
- Running extraction workflows with dedicated low-privilege identities and narrowly scoped credentials
How teams detect issues like this
Organizations can look for:
- Static-analysis findings involving
eval,exec, dynamic imports, or equivalent code-generation and evaluation paths - Code-review signals where language-model output flows into interpreters, compilers, templates, or command execution
- Data-flow analysis connecting web retrieval or external content to executable APIs
- Policy checks requiring schemas, approval gates, and sandboxing for generated code
- Runtime monitoring for unexpected child processes, file access, network connections, or privilege use by extraction workers
Automated security review tools may help identify dangerous sinks, but findings should be validated against the complete data flow.

