CVE-2018-3650
Input validation flaw in INTEL Distribution for Python before IDP 2018 Update 2 lets unprivileged local users bypass URI sanitization in the Bleach module
- CVSS 7.8
- CWE-20 Improper Input Validation
- Input Validation and Sanitization
- Local
Insufficient Input Validation in Bleach module in INTEL Distribution for Python versions prior to IDP 2018 Update 2 allows unprivileged user to bypass URI sanitization via local vector.
- CVSS base score
- 7.8
- Published
- 2018-08-01
- OWASP
- A06 Vulnerable and Outdated Components
- Orthogonal defect classification
- Function
- Code defect classification
- Incorrect Functionality
- Category
- Input Validation and Sanitization
- Subcategory
- Command Injection
- Accessibility scope
- Local
- Impact
- Unauthorized Access
- Affected component
- Bleach
- Fixed by upgrading
- Yes
Solution
Update to IDP 2018 Update 2 or higher.
Vulnerable code sample
import bleach
# Example of insufficient URI sanitization that represents the vulnerability
def unsafe_sanitize_uri(input_uri):
# No proper validation of allowed protocols
sanitized_uri = bleach.clean(input_uri, tags=[], attributes={}, styles=[], strip=True)
return sanitized_uri # Returns potentially unsafe URI
# Example usage
user_input = "javascript:alert('XSS')" # Example of malicious input
unsafe_uri = unsafe_sanitize_uri(user_input)
print("Sanitized URI:", unsafe_uri) # This could output a dangerous URIPatched code sample
import bleach
# Example of sanitizing a URI input to prevent CVE-2018-3650
def sanitize_uri(input_uri):
# Allow only specific protocols and ensure proper validation
allowed_protocols = ['http', 'https', 'ftp']
sanitized_uri = bleach.clean(input_uri, tags=[], attributes={}, styles=[], strip=True)
# Validate the protocol
if any(sanitized_uri.startswith(protocol + '://') for protocol in allowed_protocols):
return sanitized_uri
else:
raise ValueError("Invalid URI: Only HTTP, HTTPS, and FTP protocols are allowed.")
# Example usage
try:
user_input = "javascript:alert('XSS')" # Example of malicious input
safe_uri = sanitize_uri(user_input)
print("Sanitized URI:", safe_uri)
except ValueError as e:
print(e)Cite this entry
@misc{vaitp:cve20183650,
title = {{Input validation flaw in INTEL Distribution for Python before IDP 2018 Update 2 lets unprivileged local users bypass URI sanitization in the Bleach module}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2018},
note = {VAITP Python Vulnerability Dataset, entry CVE-2018-3650},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2018-3650/}}
}
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 ::
