CVE-2023-0488
Stored XSS in pyload/pyload < 0.5.0b3.dev42 GitHub
- CVSS 5.4
- CWE-79 Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
- Configuration Issues
- Remote
Cross-site Scripting (XSS) – Stored in GitHub repository pyload/pyload prior to 0.5.0b3.dev42.
- CVSS base score
- 5.4
- Published
- 2023-01-26
- OWASP
- A03 Injection
- Orthogonal defect classification
- Function
- Code defect classification
- Incorrect Functionality
- Category
- Configuration Issues
- Subcategory
- Cross-Site Scripting (XSS)
- Accessibility scope
- Remote
- Impact
- Arbitrary Code Execution
- Affected component
- pyload
- Fixed by upgrading
- Yes
Solution
Update pyload/pyload to version 0.5.0b3.dev42 or higher.
Vulnerable code sample
from flask import Flask, request, render_template
app = Flask(__name__)
# Example of a vulnerable endpoint
@app.route('/comments', methods=['POST'])
def post_comment():
comment = request.form['comment']
# Vulnerable to XSS: rendering user input directly without sanitization
return render_template('comments.html', comment=comment)
if __name__ == '__main__':
app.run()Patched code sample
from flask import Flask, request, render_template, escape
app = Flask(__name__)
# Example of a vulnerable endpoint
@app.route('/comments', methods=['POST'])
def post_comment():
comment = request.form['comment']
# Vulnerable to XSS if the comment is rendered directly
# return render_template('comments.html', comment=comment)
# Fixed code: escape the comment to prevent XSS
safe_comment = escape(comment)
return render_template('comments.html', comment=safe_comment)
if __name__ == '__main__':
app.run()Cite this entry
@misc{vaitp:cve20230488,
title = {{Stored XSS in pyload/pyload < 0.5.0b3.dev42 GitHub}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2023},
note = {VAITP Python Vulnerability Dataset, entry CVE-2023-0488},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2023-0488/}}
}
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 ::
