CVE-2015-5159
Python-kdcproxy < 0.3.2 allows remote DoS via large POST request
- CVSS 7.5
- CWE-20 Improper Input Validation
- Resource Management
- Remote
python-kdcproxy before 0.3.2 allows remote attackers to cause a denial of service via a large POST request.
- CVSS base score
- 7.5
- Published
- 2018-10-30
- OWASP
- A08 Software and Data Integrity Failures
- Orthogonal defect classification
- Function
- Code defect classification
- Incorrect Functionality
- Category
- Resource Management
- Subcategory
- Resource Exhaustion
- Accessibility scope
- Remote
- Impact
- Denial of Service (DoS)
- Affected component
- python-kdcproxy
- Fixed by upgrading
- Yes
Solution
Update python-kdcproxy to version 0.3.2 or higher.
Vulnerable code sample
from flask import Flask, request
app = Flask(__name__)
@app.route('/your_endpoint', methods=['POST'])
def your_endpoint():
# No limit on the size of POST request
data = request.json
# Process the data (potentially large)
return "Data processed successfully", 200
if __name__ == '__main__':
app.run()Patched code sample
from flask import Flask, request, abort
app = Flask(__name__)
# Set a maximum content length to prevent large POST requests
app.config['MAX_CONTENT_LENGTH'] = 16 * 1024 # 16 KB
@app.route('/your_endpoint', methods=['POST'])
def your_endpoint():
# Handle the POST request
data = request.json
# Process the data
return "Data processed successfully", 200
@app.errorhandler(413)
def request_entity_too_large(error):
return "Request entity too large", 413
if __name__ == '__main__':
app.run()Published fix
Public sources link this CVE to the changes below. The code samples above were generated to illustrate the defect; these links lead to the code the project actually changed.
- Enforce a maximum packet length (latchset/kdcproxy)
kdcproxy/__init__.py,kdcproxy/__init__.py · Application.__call__
Cite this entry
@misc{vaitp:cve20155159,
title = {{Python-kdcproxy < 0.3.2 allows remote DoS via large POST request}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2018},
note = {VAITP Python Vulnerability Dataset, entry CVE-2015-5159},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2015-5159/}}
}
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 ::
