GHSA-pmch-g965-grmr: Langroid: SQLChatAgent _validate_query blocklist misses pg_read_file family enabling arbitrary file read
Langroid versions up to 0.63.0 contain a vulnerability in the SQLChatAgent component where the _validate_query method's regex blocklist fails to block certain PostgreSQL functions that can read arbitrary files from the host filesystem. This allows an attacker who can influence the LLM-generated SQL queries to perform unauthorized file reads via SELECT statements, bypassing the agent's default restrictions. No PostgreSQL credentials are required, as the agent holds them. The vulnerability also affects some SQLite and SQL Server functions due to incomplete blocklisting. No official patch or fix is currently documented.
AI Analysis
Technical Summary
The SQLChatAgent in langroid uses a regex-based blocklist (_DANGEROUS_SQL_PATTERNS) to prevent dangerous SQL operations by blocking specific function names. However, this blocklist omits several PostgreSQL filesystem-disclosure functions such as pg_read_file(), pg_stat_file(), pg_ls_logdir(), pg_ls_waldir(), and pg_current_logfile(), which return file contents or directory listings. These functions are callable via SELECT statements, which pass the agent's statement-type allowlist and evade the regex blocklist, reaching the SQLAlchemy execution engine. Consequently, an attacker able to influence the LLM's generated SQL query string can read arbitrary files on the PostgreSQL host without needing database credentials. Similar gaps exist for SQLite's ATTACH without the DATABASE keyword and SQL Server's OPENDATASOURCE. The affected versions are langroid <= 0.63.0. No patch or official fix is currently available.
Potential Impact
An attacker who can influence the SQL queries generated by the LLM in langroid's SQLChatAgent can read arbitrary files from the PostgreSQL host filesystem. This can lead to unauthorized disclosure of sensitive data stored on the database server. The attack requires no direct database credentials from the attacker, as the agent holds them. The vulnerability bypasses existing query type restrictions and regex-based blocklists, making it a high-severity information disclosure risk.
Mitigation Recommendations
Patch status is not yet confirmed — check the vendor advisory for current remediation guidance. Until an official fix is released, restrict or sanitize inputs that influence the LLM-generated SQL queries to prevent injection of dangerous function calls. Consider disabling or limiting the use of SQLChatAgent features that allow arbitrary query execution, or deploy additional query validation layers that explicitly block the missing PostgreSQL functions (e.g., pg_read_file, pg_stat_file, pg_ls_logdir, pg_ls_waldir, pg_current_logfile).
GHSA-pmch-g965-grmr: Langroid: SQLChatAgent _validate_query blocklist misses pg_read_file family enabling arbitrary file read
Description
Langroid versions up to 0.63.0 contain a vulnerability in the SQLChatAgent component where the _validate_query method's regex blocklist fails to block certain PostgreSQL functions that can read arbitrary files from the host filesystem. This allows an attacker who can influence the LLM-generated SQL queries to perform unauthorized file reads via SELECT statements, bypassing the agent's default restrictions. No PostgreSQL credentials are required, as the agent holds them. The vulnerability also affects some SQLite and SQL Server functions due to incomplete blocklisting. No official patch or fix is currently documented.
CVSS v4.0
Affected software
Run on your own infrastructure? Check whether these packages are installed with threat-finder — our free open-source scanner.
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
The SQLChatAgent in langroid uses a regex-based blocklist (_DANGEROUS_SQL_PATTERNS) to prevent dangerous SQL operations by blocking specific function names. However, this blocklist omits several PostgreSQL filesystem-disclosure functions such as pg_read_file(), pg_stat_file(), pg_ls_logdir(), pg_ls_waldir(), and pg_current_logfile(), which return file contents or directory listings. These functions are callable via SELECT statements, which pass the agent's statement-type allowlist and evade the regex blocklist, reaching the SQLAlchemy execution engine. Consequently, an attacker able to influence the LLM's generated SQL query string can read arbitrary files on the PostgreSQL host without needing database credentials. Similar gaps exist for SQLite's ATTACH without the DATABASE keyword and SQL Server's OPENDATASOURCE. The affected versions are langroid <= 0.63.0. No patch or official fix is currently available.
Potential Impact
An attacker who can influence the SQL queries generated by the LLM in langroid's SQLChatAgent can read arbitrary files from the PostgreSQL host filesystem. This can lead to unauthorized disclosure of sensitive data stored on the database server. The attack requires no direct database credentials from the attacker, as the agent holds them. The vulnerability bypasses existing query type restrictions and regex-based blocklists, making it a high-severity information disclosure risk.
Mitigation Recommendations
Patch status is not yet confirmed — check the vendor advisory for current remediation guidance. Until an official fix is released, restrict or sanitize inputs that influence the LLM-generated SQL queries to prevent injection of dangerous function calls. Consider disabling or limiting the use of SQLChatAgent features that allow arbitrary query execution, or deploy additional query validation layers that explicitly block the missing PostgreSQL functions (e.g., pg_read_file, pg_stat_file, pg_ls_logdir, pg_ls_waldir, pg_current_logfile).
Technical Details
- Gcve Source
- db.gcve.eu
- Osv Id
- GHSA-pmch-g965-grmr
- Osv Schema Version
- 1.4.0
- Aliases
- ["CVE-2026-50180"]
- Ecosystems
- ["PyPI"]
- Database Specific Severity
- HIGH
- Cvss Version
- 4.0
Threat ID: 6a46ecc427e9c7971943d784
Added to database: 07/02/2026, 22:57:08 UTC
Last enriched: 07/02/2026, 23:17:30 UTC
Last updated: 07/02/2026, 23:17:30 UTC
Views: 2
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.