Langroid: SQLChatAgent _validate_query blocklist misses pg_read_file family enabling arbitrary file read
CVE-2026-50180 · GHSA-pmch-g965-grmr · published 2026-07-02
- Severity
- High
- CVSS score
- 8.7
- Chance of exploitation (EPSS)
- 0.69%
- Fixed in
- 0.64.0
- Exploitation No known exploitation
- Automatable Yes
- Technical impact Partial
- CISA SSVC
Arbitrary file read from the PostgreSQL host: pgreadfile() reads files from PGDATA-relative paths by default and can take absolute paths when the DB role holds pgreadserverfiles (or equivalent in managed-Postgres setups). For self-managed PostgreSQL deployments the DB role is frequently a superuser, in which case absolute paths are always accepted and the impact extends to postgresql.conf, pghba.conf, ~/.pgpass, TLS keys, and any other file readable by the PostgreSQL OS user. Filesystem reconnaissance via pgstatfile() (file existence, size, mtime, isdir), pglslogdir(), pglswaldir(), pglstmpdir(), pglsarchivestatusdir(), pgcurrentlogfile().
Upgrade langroid to 0.64.0 or later.
Patch DANGEROUSSQLPATTERNS to cover the full family rather than individual function names. Two compatible approaches; either is enough. Approach 1 — family-prefix regex (minimal change, simplest to review): Approach 2 — sqlglot AST walk in addition to regex. sqlglot is already imported by sqlchatagent.py; iterate every function-call node (sqlglotexp.Anonymous / sqlglotexp.Func) inside the parsed statements and reject when the lower-cased name starts with pgread, pgstat, pgls, pgcurrentlogfile, lo, or matches the MSSQL extended-procedure prefixes (xp, sp_oa). AST matching is robust to whitespace, comments, and case games inside identifiers, at the cost of broader per-dialect maintenance.
| Package | Registry | Affected | Fixed in |
|---|---|---|---|
| langroid | PyPI | <= 0.63.0 | 0.64.0 |
- CriticalMCP Path Traversal Allows Full-Filesystem Read and JWT Secret Exfiltration Leading to Account Takeoverlangflow, langflow-base
- Critical@zereight/mcp-gitlab: Unauthenticated arbitrary file read via `upload_markdown` enables PAT exfiltration and full account takeover@zereight/mcp-gitlab
- CriticalFlowise RCE via SQL Database Chain Nodeflowise, flowise-components
- Criticalfast-mcp-telegram: Bearer token path traversal bypasses reserved Telegram session protectionfast-mcp-telegram
- CriticalMCP Toolbox HTTP tool path parameters allow traversal to unintended endpointsgithub.com/googleapis/mcp-toolbox
- CriticalLangflow: BaseFileComponent-based nodes arbitrary file read with RCE exploitlangflow
- CriticalLangroid: Neo4jChatAgent executes LLM-generated Cypher without validation (prompt-to-Cypher injection; config-conditional RCE), mirroring thlangroid
- CriticalLangroid: SQLChatAgent dangerous-function blocklist can be bypassed with quoted or schema-qualified pg_read_file callslangroid
- CriticalLangroid: Sandbox Escape to Remote Code Execution via Incomplete `eval()` Mitigation in TableChatAgentlangroid
- CriticalLangroid has Prompt to SQL Injection, Leading to RCElangroid
- CriticalLangroid has WAF Bypass Leading to RCE in TableChatAgentlangroid
- CriticalLangroid has a Code Injection vulnerability in TableChatAgentlangroid
The impact, patch and workaround text comes from the advisory, shortened (GitHub Advisory Database, CC BY 4.0). Proof-of-concept and reproduction sections and code are left out; the original advisory has them.