CVE-2013-2104
Python-keystoneclient < 0.2.4 allows authenticated users to use expired and revoked tokens
- CVSS 5.5
- CWE-264
- Authentication, Authorization, and Session Management
- Remote
python-keystoneclient before 0.2.4, as used in OpenStack Keystone (Folsom), does not properly check expiry for PKI tokens, which allows remote authenticated users to (1) retain use of a token after it has expired, or (2) use a revoked token once it expires.
- CWE
- CWE-264
- CVSS base score
- 5.5
- Published
- 2014-01-21
- 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-keystoneclient
- Fixed by upgrading
- Yes
Solution
Update python-keystoneclient to version 0.2.4 or higher.
Vulnerable code sample
class PKIToken:
def __init__(self, token_id, expires_at):
self.token_id = token_id
self.expires_at = expires_at
def is_valid(self):
# Vulnerable: does not check if the token has expired
return True # Always returns True, allowing expired tokens to be used
# Example usage
def use_token(token):
if token.is_valid():
print("Token is valid, proceeding with request.")
else:
print("Token is invalid.")
# Simulating token creation and usage
expires_at = datetime.utcnow() - timedelta(seconds=60) # Token already expired
token = PKIToken("example_token_id", expires_at)
# Using the expired token
use_token(token)Patched code sample
from datetime import datetime, timedelta
from keystoneclient.exceptions import Unauthorized
class PKIToken:
def __init__(self, token_id, expires_at):
self.token_id = token_id
self.expires_at = expires_at
def is_valid(self):
# Check if the token has expired
if datetime.utcnow() >= self.expires_at:
raise Unauthorized("Token has expired")
return True
# Example usage
def use_token(token):
try:
if token.is_valid():
print("Token is valid, proceeding with request.")
except Unauthorized as e:
print(e)
# Simulating token creation and usage
expires_at = datetime.utcnow() + timedelta(seconds=60) # Token valid for 60 seconds
token = PKIToken("example_token_id", expires_at)
# Simulate waiting for the token to expire
import time
time.sleep(61) # Wait for token to expire
use_token(token)Cite this entry
@misc{vaitp:cve20132104,
title = {{Python-keystoneclient < 0.2.4 allows authenticated users to use expired and revoked tokens}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2014},
note = {VAITP Python Vulnerability Dataset, entry CVE-2013-2104},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2013-2104/}}
}
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 ::
