PyPI: langroid

CVE-2026-25879

Safety vulnerability ID: SFTY-20260527-21978

Safety legacy ID: pyup.io-99660

Affected versions of the langroid package are vulnerable to SQL Injection leading to Remote Code Execution due to the absence of query validation in the SQLChatAgent component. The run_query method in sql_chat_agent.py executes LLM-generated SQL statements directly against the configured database without parsing or restricting the allowed statement types. An attacker who can influence the agent's input, including indirectly through prompt injection via data returned to the LLM, can coerce execution of dangerous database primitives such as PostgreSQL's COPY FROM PROGRAM to achieve arbitrary command execution on the database host.

Created at: Jun 4, 2026Updated at: Jun 4, 2026

Overview

Langroid has Prompt to SQL Injection, Leading to RCE

Advisory

Affected versions of the langroid package are vulnerable to SQL Injection leading to Remote Code Execution due to the absence of query validation in the SQLChatAgent component. The run_query method in sql_chat_agent.py executes LLM-generated SQL statements directly against the configured database without parsing or restricting the allowed statement types. An attacker who can influence the agent's input, including indirectly through prompt injection via data returned to the LLM, can coerce execution of dangerous database primitives such as PostgreSQL's COPY FROM PROGRAM to achieve arbitrary command execution on the database host.

Affected Package

Affecting langroid package, versions<0.63.0

Also affects

---

How to Fix

Upgradelangroidto0.63.0or higher.

Mitigation and Workarounds

---

Vulnerable Functions

Functions linked to known vulnerabilities.

Vulnerable function data is available for Enterprise customers

Book a call with us to see Safety in action.

Safety

Verified by Safety

Our Cybersecurity Intelligence Team reviewed this vulnerability. We combine public data with our own research to find issues not yet reported to public sources.

Learn more