VAITP Dataset

← Back to the dataset

CVE-2017-1002150

Open redirect in python-fedora <= 0.8.0 results in CSRF protection loss

  • CVSS 6.1
  • CWE-601 URL Redirection to Untrusted Site ('Open Redirect')
  • Cryptographic
  • Remote

python-fedora 0.8.0 and lower is vulnerable to an open redirect resulting in loss of CSRF protection

CVSS base score
6.1
Published
2017-09-14
OWASP
A10 Server Side Request Forgery (SSRF)
Orthogonal defect classification
Function
Code defect classification
Incorrect Functionality
Category
Cryptographic
Subcategory
Improper SSL/TLS Certificate Validation
Accessibility scope
Remote
Impact
Unauthorized Access
Fixed by upgrading
Yes

Solution

Update python-fedora to version 0.9.0 or higher.

Vulnerable code sample

from flask import Flask, redirect, request

app = Flask(__name__)

@app.route('/redirect')
def redirect():
    next_url = request.args.get('next')
    return redirect(next_url)

if __name__ == '__main__':
    app.run()

Patched code sample

from flask import Flask, redirect, request, url_for, abort

app = Flask(__name__)

ALLOWED_HOSTS = {'example.com', 'another-example.com'}

def is_safe_url(target):
    from urllib.parse import urlparse
    parsed_url = urlparse(target)
    return parsed_url.netloc in ALLOWED_HOSTS

@app.route('/redirect')
def redirect():
    next_url = request.args.get('next')
    if next_url and is_safe_url(next_url):
        return redirect(next_url)
    else:
        abort(400)

if __name__ == '__main__':
    app.run()

Cite this entry

@misc{vaitp:cve20171002150,
  title        = {{Open redirect in python-fedora <= 0.8.0 results in CSRF protection loss}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2017},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2017-1002150},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2017-1002150/}}
}
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 ::