{"answers":{"affected":"3 open source packages ship an affected version, including langchain-experimental. It affects 1 product.","exploited":"There is no known exploitation of CVE-2024-21513 in the wild and no public exploit code.","fix":"Upgrade langchain-experimental to 0.0.21 or later.","what":"CVE-2024-21513 is a high-severity code injection vulnerability in langchain-experimental, published on 15 Jul 2024. Any signed-in user can exploit it over the network, with no action from the victim."},"fix_prompt":"Check this codebase for CVE-2024-21513 and fix it if it is affected.\n\nWhat it is: CVE-2024-21513 is a high-severity code injection vulnerability in langchain-experimental, published on 15 Jul 2024. Any signed-in user can exploit it over the network, with no action from the victim.\nExploitation: There is no known exploitation of CVE-2024-21513 in the wild and no public exploit code.\n\nAffected packages and fixed versions:\n- langchain-experimental (PyPI): affected all versions; fixed in 0.0.21\n- langchain-experimental (PyPI): affected all versions; fixed in 0.0.21\n- langchain-experimental (PyPI): affected all versions; fixed in 0.0.21\n\nTask:\n1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.\n2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.\n3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.\n4. Run the tests and summarise what changed and why.\n5. If nothing in the project is affected, say so and change nothing.\n\nReference: https://insights.sbomify.com/CVE-2024-21513/ (Markdown: https://insights.sbomify.com/CVE-2024-21513/index.md)","id":"CVE-2024-21513","markdown":"https://insights.sbomify.com/CVE-2024-21513/index.md","name":"CVE-2024-21513","record":{"aliases":["GHSA-cgcg-p68q-3w7v","PYSEC-2024-62"],"analysis":{"component_type":"library","fix_type":"upgrade","impacts":["code_execution"],"network_reachable":"yes","non_default_config":true,"product_category":"Python AI library","requires_auth":"low_privilege","summary":"Attackers can execute arbitrary Python code via prompt injection in langchain-experimental when VectorSQLDatabaseChain is enabled.","user_interaction":"not_required","vuln_class":"code_injection"},"analysis_generated_by":"qwen3.8-flash-next","assigner":"snyk","cpe":[{"product":"langchain-experimental","vendor":"langchain"}],"cvss":{"score":8.5,"severity":"high","source":"cna","vector":"CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:C/C:H/I:H/A:H/E:P","version":"3.1"},"cwes":[{"id":"CWE-94","name":"Improper Control of Generation of Code"}],"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.\r\r**Notes:**\r\rImpact on the Confidentiality, Integrity and Availability of the vulnerable component:\r\rConfidentiality: Code execution happens within the impacted component, in this case langchain-experimental, so all resources are necessarily accessible.\r\rIntegrity: 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.\r\rAvailability: The loss of availability isn't caused by the attack itself, but it happens as a result during the attacker's post-exploitation steps.\r\r\rImpact on the Confidentiality, Integrity and Availability of the subsequent system:\r\rAs 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.\r\rAT:P: An attacker needs to be able to influence the input prompt, whilst the server is configured with the VectorSQLDatabaseChain plugin.","ecosystems":["PyPI"],"exploits":{"exploitdb":0,"first_seen":"2025-03-04","github_poc":2,"max_poc_stars":0,"metasploit":0,"nuclei":0,"refs":[{"date":"2025-03-04T13:11:44Z","kind":"github_poc","ref":"https://github.com/SavageSanta11/Reproduce-CVE-2024-21513","stars":0,"title":null},{"date":"2025-04-09T16:13:18Z","kind":"github_poc","ref":"https://github.com/nskath/CVE-2024-21513","stars":0,"title":"PoC for CVE-2024-21513"}],"tier":"poc_unverified"},"has_fix":true,"headline":"langchain-experimental vulnerable to Arbitrary Code Execution","id":"CVE-2024-21513","indexable":true,"kev":null,"kind":"cve","links":{"ecosystem":"PyPI","product":null,"products":[],"type":"code_injection","year":"2024"},"n_packages":3,"n_references":3,"next":{"headline":"SQL injection in opencart","id":"CVE-2024-21514"},"packages":[{"ecosystem":"PyPI","fixed":["0.0.21"],"introduced":["0"],"last_affected":[],"package":"langchain-experimental","purl":null,"source":"GHSA-cgcg-p68q-3w7v"},{"ecosystem":"PyPI","fixed":["0.0.21"],"introduced":["0"],"last_affected":[],"package":"langchain-experimental","purl":"pkg:pypi/langchain-experimental","source":"GHSA-cgcg-p68q-3w7v"},{"ecosystem":"PyPI","fixed":["0.0.21"],"introduced":["0"],"last_affected":[],"package":"langchain-experimental","purl":"pkg:pypi/langchain-experimental","source":"PYSEC-2024-62"}],"prev":{"headline":"mysql2 vulnerable to Prototype Pollution","id":"CVE-2024-21512"},"products":["langchain-experimental"],"published":"2024-07-15","related":[{"cvss_score":9.8,"headline":"LangChain Experimental Eval Injection vulnerability","id":"CVE-2024-46946","kev_date_added":null,"published":"2024-09-19"},{"cvss_score":9.8,"headline":"LangChain Experimental vulnerable to arbitrary code execution","id":"CVE-2024-27444","kev_date_added":null,"published":"2024-02-26"},{"cvss_score":7.8,"headline":"langchain_experimental Code Execution via Python REPL access","id":"CVE-2024-38459","kev_date_added":null,"published":"2024-06-16"}],"sources":[{"class":"attribution","licence":"CVE Terms of Use (MITRE)","name":"CVE List","prefix":"CVE"},{"class":"attribution","licence":"CC BY 4.0","name":"GitHub Advisory Database","prefix":"GHSA"},{"class":"attribution","licence":"CC BY 4.0","name":"PyPA Advisory Database","prefix":"PYSEC"},{"class":"attribution","licence":"US public information, NVD API terms","name":"NVD"},{"class":"attribution","licence":"CWE Terms of Use","name":"CWE (MITRE)"},{"class":"attribution","licence":"FIRST CVSS licence","name":"CVSS (FIRST)"},{"class":"open","licence":"CC0","name":"PoC-in-GitHub"}],"ssvc":{"automatable":"no","exploitation":"none","technical_impact":"total"},"state":"PUBLISHED","updated":"2024-08-01","vendors":["n/a"]},"summary":"Attackers can execute arbitrary Python code via prompt injection in langchain-experimental when VectorSQLDatabaseChain is enabled.","url":"https://insights.sbomify.com/CVE-2024-21513/"}