# CVE-2024-21513: langchain-experimental vulnerable to Arbitrary Code Execution

> Archived entry. Full-text search covers entries since 2026-11-10; exact IDs work for all years.

- **Severity:** HIGH 8.5
- **CVSS:** 8.5 (v3.1, CNA) `CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:C/C:H/I:H/A:H/E:P`
- **CVSS metrics:** Attack vector: Network; Attack complexity: High; Privileges required: Low; User interaction: None; Scope: Changed (impact reaches other components); Confidentiality impact: High; Integrity impact: High; Availability impact: High; E: P
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Remote, login needed
- **EPSS:** 2.88% (percentile 88, 2026-11-26)
- **CWE:** CWE-94
- **Aliases:** GHSA-cgcg-p68q-3w7v, PYSEC-2024-62
- **Published:** 2024-07-15T05:00:04.083Z
- **Modified:** 2026-06-17T07:09:39.050Z

## Who should check

- Projects that depend on PyPI package langchain-experimental (\< 0.0.21)
- Anyone running langchain-experimental \>= 0.0.15, \< 0.0.21

## Description

Versions of the package langchain-experimental from 0.0.15 and before 0.0.21 are vulnerable to Arbitrary Code Execution when retrieving values from the database, the code will attempt to call 'eval' on all values. An attacker can exploit this vulnerability and execute arbitrary python code if they can control the input prompt and the server is configured with VectorSQLDatabaseChain.\*\*Notes:\*\*Impact on the Confidentiality, Integrity and Availability of the vulnerable component:Confidentiality: Code execution happens within the impacted component, in this case langchain-experimental, so all resources are necessarily accessible.Integrity: There is nothing protected by the impacted component inherently. Although anything returned from the component counts as 'information' for which the trustworthiness can be compromised.Availability: The loss of availability isn't caused by the attack itself, but it happens as a result during the attacker's post-exploitation steps.Impact on the Confidentiality, Integrity and Availability of the subsequent system:As a legitimate low-privileged user of the package (PR:L) the attacker does not have more access to data owned by the package as a result of this vulnerability than they did with normal usage (e.g. can query the DB). The unintended action that one can perform by breaking out of the app environment and exfiltrating files, making remote connections etc. happens during the post exploitation phase in the subsequent system - in this case, the OS.AT:P: An attacker needs to be able to influence the input prompt, whilst the server is configured with the VectorSQLDatabaseChain plugin.

## Affected and fixed versions

- PyPI `langchain-experimental`: affected \< 0.0.21; fixed 0.0.21 (osv)
- langchain-experimental: \>= 0.0.15, \< 0.0.21 (cvelist)

## Mitigation

- Upgrade langchain-experimental to 0.0.21 or later.

## Check your systems with an agent

Paste this into a coding agent:

```text
Check whether anything I run is affected by CVE-2024-21513. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2024-21513.md
Affected: langchain-experimental < 0.0.21
Fixed in: 0.0.21

Steps:
1. Search this machine and project for langchain-experimental (PyPI), langchain-experimental: dependency manifests and lockfiles, installed packages, container images and running services.
2. For each match, note the installed version and whether it is inside the affected range.
3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
```

## FAQ

### Is CVE-2024-21513 being exploited?

There is no confirmed exploitation: CVE-2024-21513 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 2.88% chance of exploitation in the next 30 days (as of 2026-11-26).

### How serious is CVE-2024-21513?

High: CVSS 8.5 (v3.1, scored by CNA). Remote, login needed. The attack needs conditions outside the attacker's control, which makes it harder.

### Which versions are affected by CVE-2024-21513?

langchain-experimental \< 0.0.21.

### Is there a fix for CVE-2024-21513?

Yes. Fixed in 0.0.21. Upgrade langchain-experimental to 0.0.21 or later.

### How do I check if I'm affected by CVE-2024-21513?

Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.

## References

- vendor: <https://nvd.nist.gov/vuln/detail/CVE-2024-21513>
- vendor: <https://github.com/advisories/GHSA-cgcg-p68q-3w7v>
- patch: <https://github.com/langchain-ai/langchain/commit/7b13292e3544b2f5f2bfb8a27a062ea2b0c34561>
- other: <https://security.snyk.io/vuln/SNYK-PYTHON-LANGCHAINEXPERIMENTAL-7278171>
- other: <https://github.com/langchain-ai/langchain/blob/672907bbbb7c38bf19787b78e4ffd7c8a9026fe4/libs/experimental/langchain_experimental/sql/vector_sql.py%23L81>
- other: <https://github.com/langchain-ai/langchain>
- other: <https://github.com/langchain-ai/langchain/blob/672907bbbb7c38bf19787b78e4ffd7c8a9026fe4/libs/experimental/langchain_experimental/sql/vector_sql.py#L81>
- other: <https://github.com/pypa/advisory-database/tree/main/vulns/langchain-experimental/PYSEC-2024-62.yaml>

## Attribution

- CVE Program: CVE® is a registered trademark of The MITRE Corporation. CVE records © 1999–2026 The MITRE Corporation. <https://www.cve.org/Legal/TermsOfUse>
- NVD: This product uses data from the NVD API but is not endorsed or certified by the NVD. <https://nvd.nist.gov/vuln/detail/CVE-2024-21513>
- OSV: CC-BY 4.0 <https://osv.dev/vulnerability/GHSA-cgcg-p68q-3w7v> (license: <https://creativecommons.org/licenses/by/4.0/>)
- OSV: CC-BY 4.0 <https://osv.dev/vulnerability/PYSEC-2024-62> (license: <https://creativecommons.org/licenses/by/4.0/>)

HTML: <https://flawdb.com/CVE-2024-21513> · JSON: <https://flawdb.com/api/v1/entries/CVE-2024-21513>
