CVE-2022-4396
RDFlib pyRdfa3 (CVE: VDB-215249) allows remote cross-site scripting via _get_option function
- CVSS 5.4
- CWE-79
- Configuration Issues
- Remote
** UNSUPPORTED WHEN ASSIGNED ** A vulnerability was found in RDFlib pyrdfa3 and classified as problematic. This issue affects the function _get_option of the file pyRdfa/__init__.py. The manipulation leads to cross site scripting. The attack may be initiated remotely. The name of the patch is ffd1d62dd50d5f4190013b39cedcdfbd81f3ce3e. It is recommended to apply a patch to fix this issue. The identifier VDB-215249 was assigned to this vulnerability. NOTE: This vulnerability only affects products that are no longer supported by the maintainer.
- CWE
- CWE-79
- CVSS base score
- 5.4
- Published
- 2022-12-10
- OWASP
- A06 Vulnerable and Outdated Components
- Orthogonal defect classification
- Function
- Code defect classification
- Incorrect Functionality
- Category
- Configuration Issues
- Subcategory
- Cross-Site Scripting (XSS)
- Accessibility scope
- Remote
- Impact
- Arbitrary Code Execution
- Affected component
- RDFlib pyrdfa3
- Fixed by upgrading
- Yes
Solution
Upgrade to patch ffd1d62dd50d5f4190013b39cedcdfbd81f3ce3e.
Vulnerable code sample
def _get_option(option_name):
# Vulnerable implementation that directly returns user input
# without any sanitization or escaping
return option_namePatched code sample
import html
def _get_option(option_name):
# Example of a potentially vulnerable implementation
# original_value = some_data_source.get(option_name)
# Simulating a user input that could lead to XSS
original_value = option_name # This is where the vulnerability lies
# Fix: Escape the output to prevent XSS
safe_value = html.escape(original_value)
return safe_valuePublished 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.
- xss changes (RDFLib/pyrdfa3)
pyRdfa/__init__.py,pyRdfa/__init__.py · processURI,pyRdfa/__init__.py · pyRdfa.rdf_from_sources
Cite this entry
@misc{vaitp:cve20224396,
title = {{RDFlib pyRdfa3 (CVE: VDB-215249) allows remote cross-site scripting via _get_option function}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2022},
note = {VAITP Python Vulnerability Dataset, entry CVE-2022-4396},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2022-4396/}}
}
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 ::
