CVE-2025-52047

6.5 MEDIUM

📋 TL;DR

This SQL injection vulnerability in Frappe ERPNext allows attackers to execute arbitrary SQL queries through the filters.disabled parameter in the get_income_account() function. Attackers can extract sensitive data from databases including user credentials, financial records, and business data. All organizations running vulnerable versions of ERPNext are affected.

💻 Affected Systems

Products:
  • Frappe ERPNext
Versions: v15.57.5 and potentially earlier versions
Operating Systems: All platforms running ERPNext
Default Config Vulnerable: ⚠️ Yes
Notes: The vulnerability exists in the default configuration of affected versions. Any installation using the vulnerable function is at risk.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete database compromise leading to data exfiltration of all sensitive information, including user credentials, financial transactions, customer data, and business intellectual property.

🟠

Likely Case

Extraction of sensitive business data, user information, and potential privilege escalation through credential harvesting.

🟢

If Mitigated

Limited data exposure if proper input validation and database permissions are implemented, though SQL injection attempts would still be logged.

🌐 Internet-Facing: HIGH if the vulnerable endpoint is exposed to the internet, as SQL injection can be exploited remotely.
🏢 Internal Only: MEDIUM for internal systems, as attackers would need network access but could still cause significant damage.

🎯 Exploit Status

Public PoC: ✅ No
Weaponized: UNKNOWN
Unauthenticated Exploit: ✅ No
Complexity: MEDIUM

Exploitation requires understanding of the application's API endpoints and SQL injection techniques. The vulnerability is in a specific function with documented parameters.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: Fixed in commit 6320f7290f93a5278ffdfaa790af70427c20a1c8

Vendor Advisory: https://github.com/frappe/erpnext/pull/49192/commits/6320f7290f93a5278ffdfaa790af70427c20a1c8

Restart Required: No

Instructions:

1. Update to the latest ERPNext version. 2. Apply the specific commit 6320f7290f93a5278ffdfaa790af70427c20a1c8 if not updating fully. 3. Verify the fix by checking the queries.py file for proper parameter sanitization.

🔧 Temporary Workarounds

Input Validation Filter

all

Implement server-side validation to sanitize the filters.disabled parameter before processing.

Database Permission Restriction

all

Limit database user permissions to read-only for the application account where possible.

🧯 If You Can't Patch

  • Implement a web application firewall (WAF) with SQL injection rules
  • Restrict access to the vulnerable endpoint using network ACLs or authentication

🔍 How to Verify

Check if Vulnerable:

Check if your ERPNext version is v15.57.5 or earlier and review the erpnext/controllers/queries.py file for the vulnerable get_income_account() function.

Check Version:

bench version

Verify Fix Applied:

Verify that the queries.py file includes proper parameter sanitization and SQL injection prevention in the get_income_account() function.

📡 Detection & Monitoring

Log Indicators:

  • Unusual SQL queries in database logs
  • Multiple requests to the vulnerable endpoint with SQL-like parameters
  • Error messages containing SQL syntax in application logs

Network Indicators:

  • Unusual patterns of requests to API endpoints with SQL injection payloads
  • High volume of requests to the queries.py related endpoints

SIEM Query:

source=application_logs AND ("filters.disabled" OR "get_income_account") AND (sql OR union OR select OR "--" OR ";")

🔗 References

📤 Share & Export