CVE-2020-13258
Contentful Python (pre-2020-05-21) reflected XSS via 'api' parameter in the-example-app.py
- CVSS 6.1
- CWE-79 Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
- Configuration Issues
- Remote
Contentful through 2020-05-21 for Python allows reflected XSS, as demonstrated by the api parameter to the-example-app.py.
- CVSS base score
- 6.1
- Published
- 2020-05-21
- 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
- Contentful
- Fixed by upgrading
- Yes
Solution
Update Contentful for Python to a version that fixes the reflected XSS vulnerability, if available.
Vulnerable code sample
from flask import Flask, request
app = Flask(__name__)
@app.route('/example', methods=['GET'])
def example():
# Vulnerable to reflected XSS
api_param = request.args.get('api', '')
return f'API parameter: {api_param}'
if __name__ == '__main__':
app.run()Patched code sample
from flask import Flask, request, escape
app = Flask(__name__)
@app.route('/example', methods=['GET'])
def example():
# Properly escape the user input to prevent XSS
api_param = escape(request.args.get('api', ''))
return f'API parameter: {api_param}'
if __name__ == '__main__':
app.run()Cite this entry
@misc{vaitp:cve202013258,
title = {{Contentful Python (pre-2020-05-21) reflected XSS via 'api' parameter in the-example-app.py}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2020},
note = {VAITP Python Vulnerability Dataset, entry CVE-2020-13258},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2020-13258/}}
}
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 ::
