Langroid: SQLChatAgent _validate_query blocklist misses pg_read_file family enabling arbitrary file read
Key facts
- Attack vector
- Network
- Privileges required
- None
- User interaction
- None
- Attack complexity
- Low
- Attack requirements
- None
- Impact type
- Information disclosure, SQL injection
- Confidentiality · integrity · availability
- High · None · None
- Fix status
- Fixed
Attack profile from CVSS 4.0 · CNA. Fix status from CNA and GitHub. Impact type from CWE-22, CWE-89 and the CVSS impact.
Summary
Langroid is a framework for building large-language-model-powered applications. Prior to version 0.64.0, `SQLChatAgent` in `langroid` ships a `_validate_query` defense-in-depth layer whose `_DANGEROUS_SQL_PATTERNS` regex blocklist enumerates dangerous SQL primitives by specific function name. The list misses the canonical PostgreSQL filesystem-disclosure family `pg_read_file()`, `pg_stat_file()`, `pg_ls_logdir()`, `pg_ls_waldir()`, `pg_current_logfile()` (and similar `SELECT`-shaped functions in the same family). It also leaves SQL Server `OPENDATASOURCE` and SQLite `ATTACH '<file>' AS x` (DATABASE keyword omitted) unblocked. An attacker able to shape the LLM's generated SQL (directly via prompt input or transitively via prompt-injection in data the LLM ingests) can read arbitrary files from the PostgreSQL host through ordinary `SELECT` queries, even with the agent's strict default configuration (`allow_dangerous_operations=False`, `allowed_statement_types=['SELECT']`). The payloads survive the statement-type allowlist (each is a `SELECT`) and pass through the regex blocklist (none of the function names match), then reach the live SQLAlchemy engine via `SQLChatAgent.run_query`. Version 0.64.0 contains a patch for the issue.
Why it matters now
SSVC decision points
CISA ADP · SSVC 2.0.3
- Exploitation
- None
- Automatable
- Yes
- Technical impact
- Partial
The decision (Track, Attend, Act) also depends on your mission and well-being impact; see CISA's SSVC guide.
Affected products
| Vendor | Product | Affected versions | Fixed in | Status | Source |
|---|---|---|---|---|---|
| langroid | langroid | before 0.64.0 | 0.64.0 | Patch available | CNA |
| — | langroid (PyPI) | before 0.64.0 | 0.64.0 | Patch available | GHSA-pmch-g965-grmr |
- langroid Vendorlangroid Affected before 0.64.0 Fixed in 0.64.0 Patch available CNA
- langroid (PyPI) Vendor— Affected before 0.64.0 Fixed in 0.64.0 Patch available GHSA-pmch-g965-grmr
Remediation
- Fix · CNA langroid (langroid) Fixed in 0.64.0
- Fix · GHSA-pmch-g965-grmr langroid (PyPI) Fixed in 0.64.0 Advisory →
Timeline
- 2026-10-02 Threatist record created from CVE-2026-50180
- 2026-10-03 Alias added: GHSA-pmch-g965-grmr
References
More langroid vulnerabilities
- TI-2026-39575 Langroid: Sandbox Escape to Remote Code Execution via Incomplete `eval()` Mitigation in TableChatAgent CVSS 3.1CRITICAL 10.0
- TI-2026-20919 Langroid has Prompt to SQL Injection, Leading to RCE CVSS 3.1CRITICAL 9.8
- TI-2026-20592 Langroid has WAF Bypass Leading to RCE in TableChatAgent CVSS 4.0CRITICAL 9.4
- TI-2025-29395 Langroid has a Code Injection vulnerability in TableChatAgent CVSS 3.1CRITICAL 9.8
- TI-2026-40145 Injection in langroid CVSS 4.0CRITICAL 9.2
- TI-2026-39566 Langroid: SQLChatAgent dangerous-function blocklist can be bypassed with quoted or schema-qualified pg_read_file calls CVSS 4.0CRITICAL 9.3
Sources
- CVE-2026-50180 · CVE Program
- CVE-2026-50180 · NVD
- FIRST EPSS
- GHSA-pmch-g965-grmr · GitHub Advisory Database · CC BY 4.0
This product uses the NVD API but is not endorsed or certified by the NVD. Sources and licences