CVE-2018-20061
SQL injection in ERPNext 10.x and 11.x
- CVSS 7.5
- CWE-89 Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
- Input Validation and Sanitization
- Remote
A SQL injection issue was discovered in ERPNext 10.x and 11.x through 11.0.3-beta.29. This attack is only available to a logged-in user; however, many ERPNext sites allow account creation via the web. No special privileges are needed to conduct the attack. By calling a JavaScript function that calls a server-side Python function with carefully chosen arguments, a SQL attack can be carried out which allows SQL queries to be constructed to return any columns from any tables in the database. This is related to /api/resource/Item?fields= URIs, frappe.get_list, and frappe.call.
- CVSS base score
- 7.5
- Published
- 2018-12-11
- OWASP
- A03 Injection
- Orthogonal defect classification
- Function
- Code defect classification
- Incorrect Functionality
- Category
- Input Validation and Sanitization
- Subcategory
- SQL Injection
- Accessibility scope
- Remote
- Impact
- Information Disclosure
- Fixed by upgrading
- Yes
Solution
Update ERPNext to version 11.0.4-beta.1 or higher.
Vulnerable code sample
import frappe
@frappe.whitelist()
def get_list(doctype, fields=None, filters=None, limit=None):
return frappe.get_list(doctype, fields=fields, filters=filters, limit=limit)Patched code sample
import frappe
from frappe import _
@frappe.whitelist()
def get_list(doctype, fields=None, filters=None, limit=None):
allowed_fields = frappe.get_meta(doctype).get_fieldnames()
if fields is not None:
fields = [field for field in fields if field in allowed_fields]
return frappe.get_list(doctype, fields=fields, filters=filters, limit=limit)Cite this entry
@misc{vaitp:cve201820061,
title = {{SQL injection in ERPNext 10.x and 11.x}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2018},
note = {VAITP Python Vulnerability Dataset, entry CVE-2018-20061},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2018-20061/}}
}
Introducing the "VAITP dataset": a specialized repository of Python vulnerabilities and patches, meticulously compiled for the use of the security research community. As Python's prominence grows, understanding and addressing potential security vulnerabilities become crucial. Crafted by and for the cybersecurity community, this dataset offers a valuable resource for researchers, analysts, and developers to analyze and mitigate the security risks associated with Python. Through the comprehensive exploration of vulnerabilities and corresponding patches, the VAITP dataset fosters a safer and more resilient Python ecosystem, encouraging collaborative advancements in programming security.
The supreme art of war is to subdue the enemy without fighting.
Sun Tzu – “The Art of War”
:: Shaping the future through research and ingenuity ::
