2.6
CWE
79
Advisory Published
CVE Published
Updated

CVE-2011-4940: XSS

First published: Wed Mar 14 2012(Updated: )

A flaw was reported [1] in Python's SimpleHTTPServer's list_directory() function. Due to a missing charset parameter, if a user were to connect to SimpleHTTPServer using IE7, which engages in encoding-sniffing and can be tricked into interpretting the output as UTF7. Because of this, an attacker could hide &lt;script&gt; tags in UTF7-encoded characters which do not get quoted by cgi.encode(), allowing XSS attacks. This has been corrected upstream in version 2.6.7rc2 [2], 2.5.6c1 [3]. It may be fixed in 2.7 as well, but I was unable to find a commit to match it against. [1] <a href="http://bugs.python.org/issue11442">http://bugs.python.org/issue11442</a> [2] <a href="http://svn.python.org/view/python/branches/release26-maint/Lib/SimpleHTTPServer.py?r1=66717&amp;r2=88831&amp;view=patch">http://svn.python.org/view/python/branches/release26-maint/Lib/SimpleHTTPServer.py?r1=66717&amp;r2=88831&amp;view=patch</a> [3] <a href="http://svn.python.org/view/python/branches/release25-maint/Lib/SimpleHTTPServer.py?r1=53148&amp;r2=88815&amp;view=patch">http://svn.python.org/view/python/branches/release25-maint/Lib/SimpleHTTPServer.py?r1=53148&amp;r2=88815&amp;view=patch</a>

Credit: secalert@redhat.com

Affected SoftwareAffected VersionHow to fix
debian/python2.7
2.7.18-8+deb11u1
Python 2.7<=2.5.6
Python 2.7=0.9.0
Python 2.7=0.9.1
Python 2.7=1.2
Python 2.7=1.3
Python 2.7=1.5.2
Python 2.7=1.6
Python 2.7=1.6.1
Python 2.7=2.0.1
Python 2.7=2.1.1
Python 2.7=2.1.2
Python 2.7=2.1.3
Python 2.7=2.2.1
Python 2.7=2.2.2
Python 2.7=2.2.3
Python 2.7=2.3.1
Python 2.7=2.3.2
Python 2.7=2.3.3
Python 2.7=2.3.4
Python 2.7=2.3.5
Python 2.7=2.3.7
Python 2.7=2.4.1
Python 2.7=2.4.2
Python 2.7=2.4.3
Python 2.7=2.4.4
Python 2.7=2.4.6
Python 2.7=2.5.1
Python 2.7=2.5.2
Python 2.7=2.5.3
Python 2.7=2.5.4
Python 2.7=2.6.1
Python 2.7=2.6.2
Python 2.7=2.6.3
Python 2.7=2.6.4
Python 2.7=2.6.5
Python 2.7=2.6.6
Python 2.7=2.7.1
Python 2.7=2.7.1-rc1
Python 2.7=2.7.2-rc1

Never miss a vulnerability like this again

Sign up to SecAlerts for real-time vulnerability data matched to your software, aggregated from hundreds of sources.

Reference Links

Frequently Asked Questions

  • What is the severity of CVE-2011-4940?

    CVE-2011-4940 has been assigned a moderate severity level due to its potential for information disclosure through improper handling of character encoding.

  • How do I fix CVE-2011-4940?

    To remediate CVE-2011-4940, upgrade to the fixed versions of Python that include the charset parameter in the list_directory() function.

  • Which versions of Python are affected by CVE-2011-4940?

    CVE-2011-4940 affects Python versions up to 2.5.6 and versions 2.6.x prior to patches that address this issue.

  • Can CVE-2011-4940 be exploited remotely?

    Yes, CVE-2011-4940 can be exploited remotely if an attacker tricks users into connecting to a vulnerable SimpleHTTPServer.

  • What is the cause of CVE-2011-4940?

    The cause of CVE-2011-4940 is a flaw in the list_directory() function of Python's SimpleHTTPServer due to a missing charset parameter.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2025 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203