CVE-2009-5065
XSS vulnerability in feedparser.py < 5.0 allows remote script injection via nested CDATA
- CVSS 4.3
- CWE-79 Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
- Configuration Issues
- Remote
Cross-site scripting (XSS) vulnerability in feedparser.py in Universal Feed Parser (aka feedparser or python-feedparser) before 5.0 allows remote attackers to inject arbitrary web script or HTML via vectors involving nested CDATA stanzas.
- CVSS base score
- 4.3
- Published
- 2011-04-11
- OWASP
- A03 Injection
- 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
- feedparser
- Fixed by upgrading
- Yes
Solution
Update feedparser.py to version 5.0 or higher.
Vulnerable code sample
def parse_feed(feed_content):
# Example of vulnerable code that does not handle CDATA safely
# This is a simplified representation of how the vulnerability could exist
# Directly processing the feed_content without escaping
return feed_content
# Example usage
feed_content = "<![CDATA[<script>alert('XSS')</script>]]>"
parsed_content = parse_feed(feed_content)
print(parsed_content) # Output will be unsafe and vulnerable to XSSPatched code sample
import html
def parse_feed(feed_content):
# Example of how to handle CDATA safely
# This is a simplified representation of how the vulnerability could be fixed
safe_content = html.escape(feed_content)
# Continue processing the safe_content
return safe_content
# Example usage
feed_content = "<![CDATA[<script>alert('XSS')</script>]]>"
parsed_content = parse_feed(feed_content)
print(parsed_content) # Output will be safe and escapedCite this entry
@misc{vaitp:cve20095065,
title = {{XSS vulnerability in feedparser.py < 5.0 allows remote script injection via nested CDATA}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2011},
note = {VAITP Python Vulnerability Dataset, entry CVE-2009-5065},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2009-5065/}}
}
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 ::
