CVE-2023-6568
Reflected XSS via unsanitized Content-Type header in mlflow repository.
- CVSS 6.1
- CWE-79
- Input Validation and Sanitization
- Remote
A reflected Cross-Site Scripting (XSS) vulnerability exists in the mlflow/mlflow repository, specifically within the handling of the Content-Type header in POST requests. An attacker can inject malicious JavaScript code into the Content-Type header, which is then improperly reflected back to the user without adequate sanitization or escaping, leading to arbitrary JavaScript execution in the context of the victim's browser. The vulnerability is present in the mlflow/server/auth/__init__.py file, where the user-supplied Content-Type header is directly injected into a Python formatted string and returned to the user, facilitating the XSS attack.
- CWE
- CWE-79
- CVSS base score
- 6.1
- Published
- 2023-12-07
- OWASP
- A03 Injection
- Orthogonal defect classification
- Checking
- Code defect classification
- Incorrect Check
- Category
- Input Validation and Sanitization
- Subcategory
- Cross-Site Scripting (XSS)
- Accessibility scope
- Remote
- Impact
- Arbitrary Code Execution
- Affected component
- mlflow
- Fixed by upgrading
- Yes
Solution
Sanitize and escape the Content-Type header input before reflecting it back to the user. Upgrade to the latest version of mlflow where this issue is fixed.
Vulnerable code sample
from flask import Flask, request
app = Flask(__name__)
@app.route('/post', methods=['POST'])
def handle_post():
content_type = request.headers.get('Content-Type', '')
return f"Content-Type received: {content_type}"
if __name__ == '__main__':
app.run()Patched code sample
from flask import Flask, request, escape
app = Flask(__name__)
@app.route('/post', methods=['POST'])
def handle_post():
content_type = request.headers.get('Content-Type', '')
escaped_content_type = escape(content_type)
return f"Content-Type received: {escaped_content_type}"
if __name__ == '__main__':
app.run()Payload
<script>alert('XSS Vulnerability Exploited!');</script>
Cite this entry
@misc{vaitp:cve20236568,
title = {{Reflected XSS via unsanitized Content-Type header in mlflow repository.}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2023},
note = {VAITP Python Vulnerability Dataset, entry CVE-2023-6568},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2023-6568/}}
}
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 ::
