# CVE-2026-34070 in langchain-core: reading files through a prompt config

*Advisory explainer. Facts come from the public advisory linked in the sources. Last checked: 2026-11-22.*

**Short answer:** CVE-2026-34070 is a path traversal bug in the legacy prompt-loading functions of `langchain-core`. If your app passes a prompt configuration that a user can influence to `load_prompt()` or `load_prompt_from_config()`, that user could read files from the server, limited by file extension. Fixed in `langchain-core` 1.2.22. The advisory says the legacy functions are now deprecated and will be removed in 2.0.0.

## What does the advisory record say?

**Short answer:** a high severity, CVSS 3.1 score 7.5, weakness type CWE-22 (path traversal), published on 2026-03-27 in the GitHub Advisory Database.

| Field | Value in the GitHub advisory |
| --- | --- |
| Advisory ID | GHSA-qh6h-p6c9-ff54 |
| CVE | CVE-2026-34070 |
| Package | `langchain-core` on PyPI |
| Affected versions | everything before 1.2.22 |
| Fixed version | 1.2.22 |
| CVSS 3.1 vector | AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N |

The advisory states that the affected functions read files from paths inside a config dictionary without checking for `..` sequences or absolute paths.

## What could an attacker read?

**Short answer:** files with the extensions the loader accepts. The advisory gives two groups.

- **`.txt` files**, through the keys `template_path`, `suffix_path` and `prefix_path`. Examples named in the advisory: mounted secrets, `requirements.txt` and internal system prompts.
- **`.json`, `.yaml` and `.yml` files**, through string `examples` and `example_prompt_path`. Examples named in the advisory: cloud credential files, Kubernetes manifests and CI configuration.

The advisory says this is exploitable in applications that accept prompt configs from untrusted sources, including low-code AI builders and API wrappers that expose `load_prompt_from_config()`. It also notes that the severity score reflects the extension limits.

## Is my product likely to be affected?

**Short answer:** only if untrusted input can reach a prompt config. The advisory describes these functions as undocumented legacy APIs, so many applications never call them. Check rather than assume.

Examples we use to look for exposure. The advisory itself names only low-code AI builders and API wrappers that expose `load_prompt_from_config()`:

- A prompt library that users or customers can edit and that stores config as JSON or YAML.
- An API endpoint or admin form that accepts a prompt definition.
- A shared prompt registry that a less-trusted team can write to.
- A workflow builder where a prompt step has a file path field.

## What should you check in your own system?

**Short answer:** version, calls, and what the process can read.

1. **Version.** Run `pip show langchain-core` in each deployed image. The fixed version is 1.2.22.
2. **Calls.** Search for `load_prompt`, `load_prompt_from_config`, `template_path`, `example_prompt_path` and `.save(` on prompt objects. Note who can write the config in each case.
3. **Migration.** The advisory names the `dumpd`, `dumps`, `load` and `loads` APIs as the replacement, with an allowlist security model. This is a change of format, not a rename, so plan it as a small migration. Read the related advisory [CVE-2025-68664](/guides/langchain-core-serialization-cve-2025-68664) before you move, because that serialization path had its own bug and its own breaking changes.
4. **The escape hatch.** The fix rejects absolute paths and `..` by default and adds a keyword argument, `allow_dangerous_paths=True`, for trusted inputs. Do not set it on any config that a user can influence.
5. **File access.** List what files the process can read. Mounted secrets and cloud credential files should only be present when the process needs them. A container that mounts only the files it needs, and no credential files, limits what a file read bug can expose.
6. **Regression test.** Place a canary file outside the prompt directory in a test environment. Submit a prompt config that points to it, once with an absolute path and once with `..` segments. Assert that the call fails and the canary content never appears. Keep the test in CI, see the [AI security regression tests guide](/guides/ai-security-regression-tests).

## Sources

A record does not mean anyone was attacked.

- GitHub Advisory Database, [GHSA-qh6h-p6c9-ff54](https://github.com/advisories/GHSA-qh6h-p6c9-ff54). Published 2026-03-27.
- National Vulnerability Database, [CVE-2026-34070](https://nvd.nist.gov/vuln/detail/CVE-2026-34070).
- LangChain release [langchain-core 1.2.22](https://github.com/langchain-ai/langchain/releases/tag/langchain-core==1.2.22).

We re-check this page against the advisory when it is updated. If you see a difference, write to contact@arviser.com.

<!--digest-card:advisory-->

**Next:** [CVE-2025-68664 serialization injection](/guides/langchain-core-serialization-cve-2025-68664) · [Agent tool permissions and MCP](/guides/agent-tool-permissions-mcp) · [Twelve security tests](/guides/ai-security-twelve-tests) · [AI Security Review](/ai-security) · [Request scope](/#scope)
