VAITP Dataset

← Back to the dataset

CVE-2017-1000433

pysaml2 versions <= 4.4.0 Allows unauthorized login with Python optimizations

  • CVSS 8.1
  • CWE-287 Improper Authentication
  • Authentication, Authorization, and Session Management
  • Remote

pysaml2 version 4.4.0 and older accept any password when run with python optimizations enabled. This allows attackers to log in as any user without knowing their password.

CVSS base score
8.1
Published
2018-01-02
OWASP
A07 Identification and Authentication Failures
Orthogonal defect classification
Function
Code defect classification
Incorrect Functionality
Category
Authentication, Authorization, and Session Management
Subcategory
Insecure Authentication Mechanisms
Accessibility scope
Remote
Impact
Unauthorized Access
Affected component
Python
Fixed by upgrading
Yes

Solution

Update pysaml2 to version 4.5.0 or higher.

Vulnerable code sample

class User:
    def __init__(self, username, password):
        self.username = username
        self.password = password  # Plaintext password stored

class AuthSystem:
    def __init__(self):
        self.users = {}

    def register_user(self, username, password):
        self.users[username] = User(username, password)

    def login(self, username, password):
        user = self.users.get(username)
        if user and (password == user.password):  # Vulnerable check
            print(f"User  {username} logged in successfully.")
        else:
            print("Invalid username or password.")

# Example usage
auth_system = AuthSystem()
auth_system.register_user('alice', 'securepassword')

# Attempt to log in with correct and incorrect passwords
auth_system.login('alice', 'securepassword')  # Successful login
auth_system.login('alice', 'wrongpassword')    # Failed login

Patched code sample

import hashlib

class User:
    def __init__(self, username, password):
        self.username = username
        self.password_hash = self.hash_password(password)

    def hash_password(self, password):
        return hashlib.sha256(password.encode()).hexdigest()

    def check_password(self, password):
        return self.password_hash == self.hash_password(password)

class AuthSystem:
    def __init__(self):
        self.users = {}

    def register_user(self, username, password):
        self.users[username] = User(username, password)

    def login(self, username, password):
        user = self.users.get(username)
        if user and user.check_password(password):
            print(f"User  {username} logged in successfully.")
        else:
            print("Invalid username or password.")

# Example usage
auth_system = AuthSystem()
auth_system.register_user('alice', 'securepassword')

# Attempt to log in with correct and incorrect passwords
auth_system.login('alice', 'securepassword')  # Successful login
auth_system.login('alice', 'wrongpassword')    # Failed login

Published fix

Public sources link this CVE to the changes below. The code samples above were generated to illustrate the defect; these links lead to the code the project actually changed.

Cite this entry

@misc{vaitp:cve20171000433,
  title        = {{pysaml2 versions <= 4.4.0 Allows unauthorized login with Python optimizations}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2018},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2017-1000433},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2017-1000433/}}
}

Download this entry as JSON Download the whole dataset

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 ::

Before you use the VAITP AI models

Please read and accept the following disclaimer:

By choosing "I understand and accept", you acknowledge that you understand and agree to these terms.