Mend.io Vulnerability Database
The largest open source vulnerability database
What is a Vulnerability ID?
New vulnerability? Tell us about it!
MAI-2023-0001
Published:May 16, 2026
Updated:May 16, 2026
Web applications that integrate Large Language Models (LLMs) using Langchain or similar middleware are susceptible to Prompt-to-SQL (P2SQL) injection attacks. This vulnerability arises when unsanitized user prompts are manipulated to compel the LLM to produce malicious SQL queries, thereby facilitating unauthorized access to the database, including both read and write operations. The vulnerability effectively circumvents security measures that rely solely on prompt engineering to restrict LLM behavior. Mitigation steps: **For AI Developers:** * Implement database roles and permissions to restrict LLM database connections to `SELECT` statements, ensuring data confidentiality and integrity. * Pre-load relevant user data into the LLM prompt to minimize database queries during interactions, enhancing data confidentiality. **For Model Trainers/Fine-tuners:** * Develop mechanisms to sanitize and rewrite SQL queries generated by the LLM, ensuring access is limited to authorized user data. * Utilize a separate LLM instance to validate SQL query results, identifying and flagging potentially malicious content before integration with the main LLM.
Related Resources (1)
Do you need more information?
Contact Us
CVSS v4
Base Score:
9.3
Attack Vector
NETWORK
Attack Complexity
LOW
Attack Requirements
NONE
Privileges Required
NONE
User Interaction
NONE
Vulnerable System Confidentiality
HIGH
Vulnerable System Integrity
HIGH
Vulnerable System Availability
HIGH
Subsequent System Confidentiality
NONE
Subsequent System Integrity
NONE
Subsequent System Availability
NONE
CVSS v3
Base Score:
9.8
Attack Vector
NETWORK
Attack Complexity
LOW
Privileges Required
NONE
User Interaction
NONE
Scope
UNCHANGED
Confidentiality
HIGH
Integrity
HIGH
Availability
HIGH
AIVSS
Base Score:
5