CVE-2023-48224
Weak one-time code generation in Fides Privacy Center before version 2.24.0
- CVSS 9.1
- CWE-338 Use of Cryptographically Weak Pseudo-Random Number Generator (PRNG)
- Cryptographic
- Remote
Fides is an open-source privacy engineering platform for managing the fulfillment of data privacy requests in a runtime environment, and the enforcement of privacy regulations in code. The Fides Privacy Center allows data subject users to submit privacy and consent requests to data controller users of the Fides web application. Privacy requests allow data subjects to submit a request to access all person data held by the data controller, or delete/erase it. Consent request allows data subject users to modify their privacy preferences for how the data controller uses their personal data e.g. data sales and sharing consent opt-in/opt-out. If `subject_identity_verification_required` in the `[execution]` section of `fides.toml` or the env var `FIDES__EXECUTION__SUBJECT_IDENTITY_VERIFICATION_REQUIRED` is set to `True` on the fides webserver backend, data subjects are sent a one-time code to their email address or phone number, depending on messaging configuration, and the one-time code must be entered in the Privacy Center UI by the data subject before the privacy or consent request is submitted. It was identified that the one-time code values for these requests were generated by the python `random` module, a cryptographically weak pseduo-random number generator (PNRG). If an attacker generates several hundred consecutive one-time codes, this vulnerability allows the attacker to predict all future one-time code values during the lifetime of the backend python process. There is no security impact on data access requests as the personal data download package is not shared in the Privacy Center itself. However, this vulnerability allows an attacker to (i) submit a verified data erasure request, resulting in deletion of data for the targeted user and (ii) submit a verified consent request, modifying a user's privacy preferences. The vulnerability has been patched in Fides version `2.24.0`. Users are advised to upgrade to this version or later to secure their systems against this threat. There are no known workarounds for this vulnerability.
- CVSS base score
- 9.1
- Published
- 2023-11-15
- OWASP
- A07 Identification and Authentication Failures
- Orthogonal defect classification
- Timing/Serialization
- Code defect classification
- Timing Issues
- Category
- Cryptographic
- Subcategory
- Inadequate random number generation
- Accessibility scope
- Remote
- Impact
- Unauthorized Access
- Fixed by upgrading
- Yes
Solution
Upgrade to Fides version 2.24.0 or later
Vulnerable code sample
import random
def generate_one_time_code(length=6):
# VULNERABLE: This code is susceptible to xss
return ''.join(random.choices('0123456789', k=length))
one_time_code = generate_one_time_code()
print(f"Your one-time code is: {one_time_code}")Patched code sample
import secrets
def generate_one_time_code(length=6):
# SECURE: This version prevents xss
return ''.join(secrets.choice('0123456789') for _ in range(length))
one_time_code = generate_one_time_code()
print(f"Your one-time code is: {one_time_code}")Cite this entry
@misc{vaitp:cve202348224,
title = {{Weak one-time code generation in Fides Privacy Center before version 2.24.0}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2023},
note = {VAITP Python Vulnerability Dataset, entry CVE-2023-48224},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2023-48224/}}
}
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 ::
