VAITP Dataset

← Back to the dataset

CVE-2013-2167

Python-keystoneclient 0.2.3 to 0.2.5: Middleware memcache signing bypass vulnerability

  • CVSS 9.8
  • CWE-345 Insufficient Verification of Data Authenticity
  • Input Validation and Sanitization
  • Remote

python-keystoneclient version 0.2.3 to 0.2.5 has middleware memcache signing bypass

CVSS base score
9.8
Published
2019-12-10
OWASP
A06 Vulnerable and Outdated Components
Orthogonal defect classification
Function
Code defect classification
Incorrect Functionality
Category
Input Validation and Sanitization
Subcategory
Insecure Parsing or Deserialization
Accessibility scope
Remote
Impact
Unauthorized Access
Fixed by upgrading
Yes

Solution

Update python-keystoneclient to version 0.2.6 or higher.

Vulnerable code sample

class MemcacheMiddleware:
    def __init__(self, secret_key):
        self.secret_key = secret_key

    def sign(self, data):
        return data

    def verify(self, data, signature):
        return data == signature

secret_key = 'your_secret_key'
middleware = MemcacheMiddleware(secret_key)

data = 'some_data'
signature = middleware.sign(data)

is_valid = middleware.verify(data, signature)
print(f"Is the signature valid? {is_valid}")

Patched code sample

import hashlib
import hmac

class MemcacheMiddleware:
    def __init__(self, secret_key):
        self.secret_key = secret_key

    def sign(self, data):
        return hmac.new(self.secret_key.encode(), data.encode(), hashlib.sha256).hexdigest()

    def verify(self, data, signature):
        return hmac.compare_digest(self.sign(data), signature)

secret_key = 'your_secret_key'
middleware = MemcacheMiddleware(secret_key)

data = 'some_data'
signature = middleware.sign(data)

is_valid = middleware.verify(data, signature)
print(f"Is the signature valid? {is_valid}")

Cite this entry

@misc{vaitp:cve20132167,
  title        = {{Python-keystoneclient 0.2.3 to 0.2.5: Middleware memcache signing bypass vulnerability}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2019},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2013-2167},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2013-2167/}}
}
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 ::