#650·LaVague

Code execution via eval of LLM output derived from untrusted web-page content (indirect prompt injection to RCE)

Author: geo-chenCreated Jun 12, 2026Updated Jul 27, 2026

Summary

LaVague's Python extraction engine builds a structured-data answer by running a retrieval query over the live HTML of the web page the agent is visiting, then passes the language model's response to eval. Because the model's response is derived from attacker-controlled page content, a malicious web page can steer the extraction model (indirect prompt injection) into emitting a Python code block, which LaVague then evals on the operator's host with no per-action review. This crosses the web-content-to-host-code-execution boundary and is distinct from LaVague's deliberately hardened YAML action-dispatch path. Confirmed against the real code: the extraction path executed __import__('os').system(...) from a model-style output.

Details

lavague-core/lavague/core/extractors.py, PythonFromMarkdownExtractor.extract_as_object (~line 140):

python
return eval(self.extract(text))

DynamicExtractor.extract_as_object (~lines 196 to 198) routes any python block to that eval. It is reached from PythonEngine.extract_structured_data (lavague-core/lavague/core/python_engine.py ~lines 81 to 83), called by execute_instruction (~line 199) and perform_fallback (~line 144). The text/output passed to the extractor is the extraction model's response to a RAG query over live page content: self.driver.get_html() -> clean_html -> VectorStoreIndex -> query_engine.query(prompt) (~lines 173 to 198). PythonEngine is the default "Python Engine" in the ActionEngine dispatch (action_engine.py ~lines 88, 100), reached whenever the WorldModel routes an extract / read / answer-from-page instruction.

The untrusted input is the web page the agent visits. The safe browser-automation path (the Selenium/Playwright YAML exec_code dispatch) is a deliberate hardening; this eval extractor predates and bypasses it.

PoC

Impact

A web page the LaVague agent visits achieves remote code execution on the operator's host, via indirect prompt injection that makes the extraction model emit a Python block which the engine evals, without any per-action user review. Because LaVague agents browse attacker-influenceable pages autonomously, a single poisoned page in a task's navigation reaches code execution.

Remediation

Do not eval model output. Parse the extracted structured data with a safe deserializer (ast.literal_eval for literals, or json.loads for a JSON contract) instead of eval, and reject anything that is not a pure literal/JSON. Treat all extraction-model output as untrusted (it is derived from page content). If executable extraction logic is genuinely required, run it under a real sandbox with explicit user confirmation.