CVE-2015-4707
IPython < 3.2 XSS in /api/notebooks
- CVSS 6.1
- CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
- Configuration Issues
- Remote
Cross-site scripting (XSS) vulnerability in IPython before 3.2 allows remote attackers to inject arbitrary web script or HTML via vectors involving JSON error messages and the /api/notebooks path.
- CVSS base score
- 6.1
- Published
- 2017-09-20
- OWASP
- A03 Injection
- Orthogonal defect classification
- Checking
- Code defect classification
- Incorrect Check
- Category
- Configuration Issues
- Subcategory
- Cross-Site Scripting (XSS)
- Accessibility scope
- Remote
- Impact
- Arbitrary Code Execution
- Fixed by upgrading
- Yes
Solution
Update to IPython version 3.2 or higher
Vulnerable code sample
import json
from flask import Flask, request, jsonify
app = Flask(__name__)
@app.route('/api/notebooks', methods=['POST'])
def create_notebook():
data = request.json
if not data or 'name' not in data:
error_message = "Invalid notebook data."
return jsonify({'error': error_message}), 400
notebook_name = data['name']
return jsonify({'message': f'Notebook {notebook_name} created successfully!'}), 201
if __name__ == '__main__':
app.run()Patched code sample
import json
from flask import Flask, request, jsonify, escape
app = Flask(__name__)
@app.route('/api/notebooks', methods=['POST'])
def create_notebook():
data = request.json
if not data or 'name' not in data:
error_message = escape("Invalid notebook data.")
return jsonify({'error': error_message}), 400
notebook_name = escape(data['name'])
return jsonify({'message': f'Notebook {notebook_name} created successfully!'}), 201
if __name__ == '__main__':
app.run()Cite this entry
@misc{vaitp:cve20154707,
title = {{IPython < 3.2 XSS in /api/notebooks}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2017},
note = {VAITP Python Vulnerability Dataset, entry CVE-2015-4707},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2015-4707/}}
}
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 ::
