SQL InjectionWeakness · CWE-89

CVE-2024-7764

HIGH · 8.1 CVSS v3.0 Published 2025-03-20
Mitigation only
No fix yet — a mitigation exists. There is no fixed release. A documented workaround reduces exposure in the meantime.
See remediation →
87/100
Remediation priority · High
Remotely reachable Zero-click

Official description Straight from the sourceThe vendor's or NVD's own wording, published unedited. Authoritative, but often terse — it says what broke, rarely what to do.

NVD · unedited
Vanna-ai v0.6.2 is vulnerable to SQL Injection due to insufficient protection against injecting additional SQL commands from user requests. The vulnerability occurs when the `generate_sql` function calls `extract_sql` with the LLM response. An attacker can include a semi-colon between a search data field and their own command, causing the `extract_sql` function to remove all LLM generated SQL and execute the attacker's command if it passes the `is_sql_valid` function. This allows the execution of user-defined SQL beyond the expected boundaries, notably the trained schema.

Technical summary Written by usOur analysis, written from the advisory, the CVSS vector and the affected-version data. It adds context the advisory leaves out, and never invents facts that are not in the source.

dbcve analysis · high confidence

Vanna-ai v0.6.2 contains a SQL injection vulnerability in the `generate_sql` function's processing of LLM responses. Attackers can inject arbitrary SQL commands by including a semicolon in search data fields, causing the `extract_sql` function to strip the legitimate LLM-generated SQL and execute the attacker's command if it passes the `is_sql_valid` validation function. This allows SQL execution beyond the trained schema boundaries.

MitigationImplement strict input sanitization to block or escape semicolon characters in user search data before it reaches the LLM prompt, and enhance the `is_sql_valid` function to reject queries containing multiple statement separators or queries targeting schemas outside the trained context.

Verify against the referenced sources before acting — the references below are authoritative for this CVE, this summary is not.

CVSS breakdown How the score is builtThe industry scoring standard. It rates how the flaw is reached, what it takes to exploit, and what an attacker gains — the score is derived from those, not the other way round.

From the vector
Attack vector
Network
Complexity
Low
Privileges
Low
User interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
None

CVSS:3.0/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N

Am I affected? How to checkSteps we derive from the advisory and the affected-version data, so you can decide whether this CVE reaches your setup. They are a guide, not a scan — your own configuration is the authority.

dbcve checks

Work through these to decide whether this CVE applies to you.

  1. Identify Vanna-ai installation and version
    Locate the Vanna package in your environment (typically via pip list, package.json, or project dependencies) and verify the installed version number matches 0.6.2
    Affected if The installed version is exactly 0.6.2 or falls within the affected range around v0.6.2
  2. Verify generate_sql function is in use
    Search your codebase for imports or calls to the generate_sql function from Vanna (often found in API endpoints, chat handlers, or SQL generation modules)
    Affected if Your application code calls generate_sql to convert LLM responses into executable SQL queries
  3. Inspect is_sql_valid function implementation
    Locate the is_sql_valid validation function in your Vanna installation or codebase and examine whether it rejects queries with semicolon separators or queries outside trained schemas
    Affected if The is_sql_valid function is absent, permissive, or fails to block semicolon-separated statements
  4. Check input sanitization for search data fields
    Review how user-provided search data reaches the LLM prompt - examine the data flow from user input to the generate_sql function and look for any semicolon character filtering or escaping
    Affected if User search data fields are passed to generate_sql without blocking or escaping semicolon characters
  5. Test for SQL injection via semicolon injection
    Submit a test query containing a semicolon followed by a simple SQL command (e.g., 'test; SELECT 1') through your Vanna interface and observe if the second statement executes
    Affected if The system executes multiple SQL statements when semicolons are present in search data

You are affected if running Vanna-ai v0.6.2 (or equivalent version) with generate_sql in use and without proper semicolon blocking in input sanitization or strict schema validation in is_sql_valid.

Generated from the published advisory. Verify against your own configuration.

Check your environment

Paste your version and any relevant configuration and it will be compared against the affected criteria above. Do not include secrets or credentials.

AI-assisted, checked against the advisory. Informational, not a guarantee.

Remediation Closing itWhat it takes to close this. Where a vendor fix exists we point at it; where none exists we say so plainly, and can build one. Effort estimates are scoped from the advisory, not from your codebase.

From vendor data
Mitigation available No clean upgrade yet — mitigate in the meantime
Mitigation

Implement strict input sanitization to block or escape semicolon characters in user search data before it reaches the LLM prompt, and enhance the `is_sql_valid` function to reject queries containing multiple statement separators or queries targeting schemas outside the trained context.

Have this fixed Scoped from the published advisory
  • Consultation6.0 h
  • Implementation12.0 h
  • Testing10.0 h
  • Review / QA4.0 h
32.0 hours of engineering $5,580
Get help mitigating

An estimate, not a bill — we confirm scope with you before any work starts. Need it this week? Rush from $8,928.

Scan for this in your stack

Free · runs locally
dbcve dependency scanner

Check whether your project pulls in CVE-2024-7764 — or any other known-vulnerable package — straight from your lock files. Free and open source; it runs locally and uploads nothing.

References Go to the primary sourcePrimary sources — vendor advisories, patches and trackers. Where our summary and a reference disagree, the reference wins.

Primary sources

Practitioner notes

Contributed

Peer-ranked notes from engineers who’ve handled CVE-2024-7764 in production — separate from our analysis above.

No notes yet

Be the first to add a field note for this CVE — a mitigation you’ve verified, a version caveat, or a link to a working fix. Sign in above to contribute.

What this is

A place for practitioners to share what actually worked: a mitigation you’ve tested, a configuration change, a version- or environment-specific caveat, or a link to a verified patch. The most useful notes rise to the top as peers upvote them, so the signal stays high.

What belongs here
  • Verified mitigations, workarounds, and config changes
  • Version or environment caveats, and links to real fixes
  • No weaponised exploit code, or anything meant to cause harm
  • No spam, self-promotion, credentials, or personal data