Skip to main content
CVE-2024-7042VulnerabilityPublished Updated

CVE-2024-7042: langchain-ai/langchainjs · Improper Neutralization of Special Elements used in an SQL Command

Affects langchain-ai/langchainjsSource CVE Database V5

0

Not known to be exploited · CVSS 4.9 Medium.

Data as of 25 Oct 2026, 19:02 UTC

CVSS 3.0 base score
4.9Medium
How severe the flaw is on the 0–10 CVSS scale.
EPSS
0.3% chance of exploitation in 30 days – higher than 23% of CVEsExploit Prediction Scoring System: the likelihood attackers will use this flaw soon.
CVSS:3.0/AV:L/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:L

Exploitation evidence

  1. Disclosed: evidence found.

    CVE published 29 Oct 2024

  2. Detectable: no evidence on record.

    No public nuclei template indexed

  3. Weaponised: no evidence on record.

    No public exploit code indexed in Metasploit or Exploit-DB

  4. Exploited in the wild: no evidence on record.

    Not in CISA KEV and no source reports exploitation

  5. Observed by OffSeq Mirage: no evidence on record.

    No attack traffic recorded by OffSeq Mirage sensors

A missing step is not evidence of safety. Sources: cve.org (opens in a new tab), the Metasploit, Exploit-DB and nuclei-templates index as of 2026-10-25.

What to do

Affected software

ProductAffectedFixed in
GitHublangchain-ai/langchainjspkg:github/langchain-ai/langchainjsOther threatsAffected
  • =0.2.5
Fixed in–

Check your own hosts for these packages with threat-finder (opens in a new tab), our free open-source scanner.

AI-suggested

To mitigate CVE-2024-7042, organizations should first monitor for official patches or updates from langchain-ai and apply them promptly once available. In the absence of patches, developers must implement strict input validation and sanitization to prevent injection of malicious payloads into SQL queries. Employing parameterized queries or prepared statements within the GraphCypherQAChain class can effectively neutralize special characters and prevent SQL injection. Conduct thorough code reviews focusing on all user-controllable inputs reaching database query layers. For multi-tenant environments, enforce strict tenant isolation and access controls to limit the blast radius of any potential exploit. Additionally, implement runtime monitoring and anomaly detection to identify unusual database activities indicative of exploitation attempts. Regularly audit and back up databases to enable recovery from potential data deletion attacks. Finally, educate developers and security teams about prompt injection risks in AI frameworks to foster secure coding practices.

Description

A vulnerability in the GraphCypherQAChain class of langchain-ai/langchainjs versions 0.2.5 and all versions with this class allows for prompt injection, leading to SQL injection. This vulnerability permits unauthorized data manipulation, data exfiltration, denial of service (DoS) by deleting all data, breaches in multi-tenant security environments, and data integrity issues. Attackers can create, update, or delete nodes and relationships without proper authorization, extract sensitive data, disrupt services, access data across different tenants, and compromise the integrity of the database.

References

Community reviews

Loading reviews…