AAK-LANGCHAIN-PROMPT-LOADER-PATH-001: LangChain load_prompt path traversal (CVE-2026-34070)
- Severity
- HIGH
- Category
- Tool Poisoning (
tool-poisoning) - Scanner
agent_audit_kit/scanners/langchain_prompt_loader.py- Auto-fixable
- No.
- SARIF name
LangChainPromptLoaderTraversal
What it detects
langchain.prompts.load_prompt(path) / PromptTemplate.from_file(path) accepts an attacker-influenced path without anchoring to a project root or allow-listed URI scheme. CVE-2026-34070 (CVSS 7.5): the lc:// scheme + raw file paths let a crafted prompt template read arbitrary files. Patched in langchain-core>=0.3.74; pinning a vulnerable version is also a finding.
How to fix
Validate every prompt path with agent_audit_kit.checks.path_under_root(path, root) before calling load_prompt. For S3 / HTTP backed prompt stores, prefer the explicit langchain_community.storage.* adapters; AAK exempts those via pattern-not-inside. Bump langchain-core to >= 0.3.74.
To confirm the finding is gone, report only this rule:
agent-audit-kit scan . --rules AAK-LANGCHAIN-PROMPT-LOADER-PATH-001
Limitations
Needs a non-constant path passed to load_prompt or from_file and, in the same function, a source spelled request.json, request.args, sys.argv, os.environ or the like; a path that arrives as a function parameter is not a source. Any os.path.realpath( in the function counts as a guard although it normalises the path and does not confine it to a directory. A file that imports from langchain_core.prompts.loading import load_prompt is skipped. A Python file over 512 KB is not read.
References
- CVE: CVE-2026-34070
- OWASP Agentic Top 10: ASI02 (Tool Misuse and Exploitation), ASI04 (Agentic Supply Chain Vulnerabilities)
- Incidents and advisories: LANGCHAIN-PROMPT-LOADER-2026-03
- CSA AI Controls Matrix (AICM): AIS-07
All rules. This page is generated from the rule registry when the documentation is built; to change it, change the rule in agent_audit_kit/rules/builtin.py. To give the rule a hand-written write-up, add docs/rules/AAK-LANGCHAIN-PROMPT-LOADER-PATH-001.md: the page then shows that text, with the registry reference appended under it.