UTC
Critical

Langroid: SQLChatAgent dangerous-function blocklist can be bypassed with quoted or schema-qualified pg_read_file calls

CVE-2026-54760 · GHSA-6xc5-4r68-67fc · published 2026-07-06

Severity
Critical
CVSS score
9.3
Chance of exploitation (EPSS)
0.65%
Fixed in
0.65.1
  • Exploitation Public proof of concept
  • Automatable Yes
  • Technical impact Total
  • CISA SSVC
What it is

On a deployment using SQLChatAgent against PostgreSQL with a role able to call pgreadfile (superuser, or a role granted pgreadserverfiles), an attacker who can influence LLM-generated SQL can coerce the agent into emitting one of the obfuscated queries and read files accessible to the PostgreSQL server process through pgreadfile. This is the same impact and precondition shape as the published pgreadfile advisory, but it targets the bypassability of the current regex-based fix rather than the pre-fix absence of a pgread_file block. Severity: High by parity with the published parent advisory; not Critical. CWE-184 leading to server-side file read.

What to do

Upgrade langroid to 0.65.1 or later.

Do not rely on raw-text regex matching for dangerous-call detection. After the existing sqlglot parse, walk the AST and reject any function invocation whose normalized, unquoted, schema-stripped, case-folded name is in a dangerous set such as pgreadfile, pgreadbinaryfile, pglsdir, pgstatfile, loimport, loexport, loadfile, or loadextension. Also recommend running SQLChatAgent with a least-privilege database role that lacks pgreadserverfiles.

Affected
PackageRegistryAffectedFixed in
langroidPyPI<= 0.65.00.65.1

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.

Sources: GitHub Advisory Database, reviewed and malware advisories (CC BY 4.0, https://github.com/advisories); advisories published by Cursor (https://github.com/cursor/cursor/security/advisories); advisories published by OpenClaw (https://github.com/openclaw/openclaw/security/advisories); advisories published by vLLM (https://github.com/vllm-project/vllm/security/advisories); advisories published by Open WebUI (https://github.com/open-webui/open-webui/security/advisories); advisories published by n8n (https://github.com/n8n-io/n8n/security/advisories); advisories published by Flowise (https://github.com/FlowiseAI/Flowise/security/advisories); advisories published by Langflow (https://github.com/langflow-ai/langflow/security/advisories); advisories published by the MCP Python SDK project (https://github.com/modelcontextprotocol/python-sdk/security/advisories); advisories published by MLflow (https://github.com/mlflow/mlflow/security/advisories); CISA Known Exploited Vulnerabilities catalog (CC0). Data as of 2026-11-22. ShieldMap describes how each problem works and how to fix it; it does not publish exploit code. Report a correction to [email protected].