Description
Langroid is a framework for building large-language-model-powered applications. Prior to version 0.65.1, the `SQLChatAgent` SQL-injection mitigation, with default `allow_dangerous_operations=False`, combines a raw-text regex blocklist (`_DANGEROUS_SQL_PATTERNS`) with a `sqlglot` SELECT-only statement allowlist. The blocklist entries that target callable functions require the function name to be immediately followed by `\s*\(`. PostgreSQL accepts the same call with the name separated from `(` by a quoted identifier, an inline comment, or schema qualification. These forms evade the regex, still parse as `SELECT`, and execute the same PostgreSQL function. This restores the `pg_read_file` server-side file-read primitive that the prior CVE-2026-25879 / GHSA-pmch-g965-grmr fix was meant to block: the parent advisory fixed a missing `pg_read_file` blocklist entry, while this report shows that the added regex is bypassable. Version 0.65.1 fixes the issue.
Published: 2026-07-09
Score: 9.3 Critical
EPSS: < 1% Very Low
KEV: No
Impact: n/a
Action: n/a
AI Analysis

Impact

Langroid’s SQLChatAgent uses a regular‑expression blocklist to forbid dangerous PostgreSQL function calls such as pg_read_file, a remedy considered to mitigate SQL injection (CWE‑89). The blocklist requires the function name to be immediately followed by an opening parenthesis, but PostgreSQL accepts the same call when the identifier is quoted, contains an inline comment, or is prefixed by a schema name. These variations bypass the regex, still produce a valid SELECT statement, and allow the execution of pg_read_file. The result is a classic SQL injection that enables an attacker to read arbitrary files on the database server, revealing a CWE‑22 path‑influenced file read as part of the attack. The flaw resides in the SQLChatAgent component configured with the default setting allow_dangerous_operations=False in versions earlier than 0.65.1.

Affected Systems

Langroid, the open‑source framework for building large‑language‑model applications, is affected when its SQLChatAgent component uses the default configuration with allow_dangerous_operations set to False. Versions earlier than 0.65.1 are vulnerable because the blocklist can be bypassed, enabling dangerous PostgreSQL function calls such as pg_read_file. The database user employed by Langroid must at least have the vulnerability to be fully exploitable.

Risk and Exploitability

The CVSS score of 9.3 indicates a critical vulnerability, and the EPSS score of less than 1 % shows a very low but non‑zero likelihood of exploitation. The vulnerability is not listed in the CISA KEV catalog. Attackers can exploit the flaw by injecting a quoted or schema‑qualified call to pg_read_file through SQLChatAgent’s query generation interface. The attack leverages improper function‑name validation (CWE‑89) and allows a file‑read primitive that falls under CWE‑22 when the database user is privileged.

Generated by OpenCVE AI on July 29, 2026 at 11:37 UTC.

Remediation

No vendor fix or workaround currently provided.

OpenCVE Recommended Actions

  • Upgrade Langroid to version 0.65.1 or later, which removes the regex bypass and blocks pg_read_file calls.
  • Configure the database user employed by Langroid so that it cannot execute pg_read_file or other server‑side file‑read functions, limiting the impact of a potential injection.
  • Use parameterized queries or explicit allowlists in SQLChatAgent to neutralize the SQL injection weakness (CWE‑89) and enforce strict file access control (CWE‑22).
  • Apply strict input validation or sanitize user input before it reaches the SQLChatAgent component to prevent function‑blocklist bypasses.

Generated by OpenCVE AI on July 29, 2026 at 11:37 UTC.

Tracking

Sign in to view the affected projects.

Advisories
Source ID Title
Github GHSA Github GHSA GHSA-6xc5-4r68-67fc Langroid: SQLChatAgent dangerous-function blocklist can be bypassed with quoted or schema-qualified pg_read_file calls
History

Fri, 10 Jul 2026 16:30:00 +0000

Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'yes', 'Exploitation': 'poc', 'Technical Impact': 'total'}, 'version': '2.0.3'}


Fri, 10 Jul 2026 01:45:00 +0000

Type Values Removed Values Added
First Time appeared Langroid
Langroid langroid
Vendors & Products Langroid
Langroid langroid

Fri, 10 Jul 2026 00:15:00 +0000

Type Values Removed Values Added
Description Langroid is a framework for building large-language-model-powered applications. Prior to version 0.65.1, the `SQLChatAgent` SQL-injection mitigation, with default `allow_dangerous_operations=False`, combines a raw-text regex blocklist (`_DANGEROUS_SQL_PATTERNS`) with a `sqlglot` SELECT-only statement allowlist. The blocklist entries that target callable functions require the function name to be immediately followed by `\s*\(`. PostgreSQL accepts the same call with the name separated from `(` by a quoted identifier, an inline comment, or schema qualification. These forms evade the regex, still parse as `SELECT`, and execute the same PostgreSQL function. This restores the `pg_read_file` server-side file-read primitive that the prior CVE-2026-25879 / GHSA-pmch-g965-grmr fix was meant to block: the parent advisory fixed a missing `pg_read_file` blocklist entry, while this report shows that the added regex is bypassable. Version 0.65.1 fixes the issue.
Title Langroid: SQLChatAgent dangerous-function blocklist can be bypassed with quoted or schema-qualified pg_read_file calls
Weaknesses CWE-22
CWE-89
References
Metrics cvssV4_0

{'score': 9.3, 'vector': 'CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N'}


Subscriptions

Langroid Langroid
cve-icon MITRE

Status: PUBLISHED

Assigner: GitHub_M

Published:

Updated: 2026-07-10T15:27:12.550Z

Reserved: 2026-06-15T23:12:41.966Z

Link: CVE-2026-54760

cve-icon Vulnrichment

Updated: 2026-07-10T15:26:52.026Z

cve-icon NVD

No data.

cve-icon Redhat

No data.

cve-icon OpenCVE Enrichment

Updated: 2026-07-29T11:45:03Z

Weaknesses
  • CWE-22

    Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')

  • CWE-89

    Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')