PyPI: langroid
CVE-2026-25879
Safety vulnerability ID: SFTY-20260527-21978
Safety legacy ID: pyup.io-99660
Affected versions of the langroid package are vulnerable to SQL Injection leading to Remote Code Execution due to the absence of query validation in the SQLChatAgent component. The run_query method in sql_chat_agent.py executes LLM-generated SQL statements directly against the configured database without parsing or restricting the allowed statement types. An attacker who can influence the agent's input, including indirectly through prompt injection via data returned to the LLM, can coerce execution of dangerous database primitives such as PostgreSQL's COPY FROM PROGRAM to achieve arbitrary command execution on the database host.
Overview
Langroid has Prompt to SQL Injection, Leading to RCE
Advisory
Affected versions of the langroid package are vulnerable to SQL Injection leading to Remote Code Execution due to the absence of query validation in the SQLChatAgent component. The run_query method in sql_chat_agent.py executes LLM-generated SQL statements directly against the configured database without parsing or restricting the allowed statement types. An attacker who can influence the agent's input, including indirectly through prompt injection via data returned to the LLM, can coerce execution of dangerous database primitives such as PostgreSQL's COPY FROM PROGRAM to achieve arbitrary command execution on the database host.
How to Fix
Mitigation and Workarounds
---
Vulnerable Functions
Functions linked to known vulnerabilities.
References
- https://getsafety.com/vulnerabilities/SFTY-20260527-21978/CVE-2026-25879
- https://github.com/langroid/langroid/security/advisories/GHSA-mxfr-6hcw-j9rq
- https://nvd.nist.gov/vuln/detail/CVE-2026-25879
- https://github.com/pypa/advisory-database/tree/main/vulns/langroid/PYSEC-2026-382.yaml
- https://pypi.org/project/langroid
- https://github.com/advisories/GHSA-mxfr-6hcw-j9rq
Verified by Safety
Our Cybersecurity Intelligence Team reviewed this vulnerability. We combine public data with our own research to find issues not yet reported to public sources.
Learn more
