ID PACKETSTORM:136341 Type packetstorm Reporter redteam-pentesting.de Modified 2016-03-22T00:00:00
Description
`Advisory: Cross-site Scripting in Securimage 3.6.2
RedTeam Pentesting discovered a cross-site scripting (XSS) vulnerability
in the Securimage CAPTCHA software, which allows attackers to inject
arbitrary JavaScript code via a crafted URL.
Details
=======
Product: Securimage
Affected Versions: >= 3.2RC1
Fixed Versions: 3.6.4
Vulnerability Type: Cross-site Scripting
Security Risk: high
Vendor URL: https://www.phpcaptcha.org/
Vendor Status: fixed version released
Advisory URL: https://www.redteam-pentesting.de/advisories/rt-sa-2016-002
Advisory Status: published
CVE: GENERIC-MAP-NOMATCH
CVE URL: https://cve.mitre.org/cgi-bin/cvename.cgi?name=GENERIC-MAP-NOMATCH
Introduction
============
"Securimage is an open-source free PHP CAPTCHA script for generating
complex images and CAPTCHA codes to protect forms from spam and abuse.
It can be easily added into existing forms on your website to provide
protection from spam bots. It can run on most any web server as long as
you have PHP installed, and GD support within PHP. Securimage does
everything from generating the CAPTCHA images to validating the typed
code. Audible codes can be streamed to the browser with Flash for the
vision impaired."
(from the project's homepage)
More Details
============
The Securimage download package and GitHub repository include several
example scripts to demonstrate the usage of the library. Among these
scripts is the file example_form.ajax.php. It returns JavaScript code
that includes an unencoded value from the variable $_SERVER['PHP_SELF']
directly embedded into the website.
In Securimage versions from 3.2RC1 to 3.5 the following code is
vulnerable:
------------------------------------------------------------------------
function processForm()
{
new Ajax.Request('<?php echo $_SERVER['PHP_SELF'] ?>', {
method: 'post',
parameters: $('contact_form').serialize(),
onSuccess: function(transport) {
------------------------------------------------------------------------
In Securimage versions from 3.5.2 to 3.6.2 the following code is
vulnerable:
------------------------------------------------------------------------
function processForm()
{
jQuery.ajax({
url: '<?php echo $_SERVER['PHP_SELF'] ?>',
type: 'POST',
data: jQuery('#contact_form').serialize(),
dataType: 'json',
}).done(function(data) {
------------------------------------------------------------------------
The problem here is that the value of the variable $_SERVER['PHP_SELF']
can, depending on the configuration of the web server, often be
manipulated by an attacker to include special characters like
apostrophes.
Proof of Concept
================
The following URL can be used to demonstrate the vulnerability for
Securimage versions from 3.2RC1 to 3.5 on with a vulnerable web server
configuration:
http://www.example.com/example_form.ajax.php/');}alert('RedTeam Pentesting');a=function(){a('
Securimage versions from 3.5.2 to 3.6.2 can be exploited with the
following URL:
http://www.example.com/example_form.ajax.php/'});}alert('RedTeam Pentesting');a=function(){a({x:'
The result is a notification showing the text "RedTeam Pentesting". The
value of the variable $_SERVER['PHP_SELF'] is embedded in verbatim into
the HTML source code of the resulting web page.
Workaround
==========
The file example_form.ajax.php should be deleted from the Securimage
directory on a web server.
Fix
===
Update to version 3.6.4.
Security Risk
=============
This security vulnerability is rated as a high risk. It allows executing
arbitrary JavaScript code in users' browsers if they access URLs
prepared by attackers. This provides many possibilities for further
attacks against these users. Since Securimage is usually used as a
software library to provide CAPTCHA functionality for web applications,
the vulnerability could be used to exploit all web applications hosted
on the same domain.
Timeline
========
2016-02-03 Vulnerability identified
2016-02-12 Customer approved disclosure to vendor
2016-02-23 CVE number requested
2016-02-24 CVE number not assigned, "non-prioritized product"
2016-03-02 Vendor contacted
2016-03-03 Vendor releases fixed version
2016-03-22 Advisory released
References
==========
https://www.phpcaptcha.org/uncategorized/securimage-3-6-4-released/
RedTeam Pentesting GmbH
=======================
RedTeam Pentesting offers individual penetration tests performed by a
team of specialised IT-security experts. Hereby, security weaknesses in
company networks or products are uncovered and can be fixed immediately.
As there are only few experts in this field, RedTeam Pentesting wants to
share its knowledge and enhance the public knowledge with research in
security-related areas. The results are made available as public
security advisories.
More information about RedTeam Pentesting can be found at:
https://www.redteam-pentesting.de/
--
RedTeam Pentesting GmbH Tel.: +49 241 510081-0
Dennewartstr. 25-27 Fax : +49 241 510081-99
52068 Aachen https://www.redteam-pentesting.de
Germany Registergericht: Aachen HRB 14004
Geschäftsführer: Patrick Hof, Jens Liebchen
`
{"id": "PACKETSTORM:136341", "type": "packetstorm", "bulletinFamily": "exploit", "title": "Securimage 3.6.2 Cross Site Scripting", "description": "", "published": "2016-03-22T00:00:00", "modified": "2016-03-22T00:00:00", "cvss": {"vector": "NONE", "score": 0.0}, "href": "https://packetstormsecurity.com/files/136341/Securimage-3.6.2-Cross-Site-Scripting.html", "reporter": "redteam-pentesting.de", "references": [], "cvelist": [], "lastseen": "2016-11-03T10:18:10", "viewCount": 4, "enchantments": {"score": {"value": -0.3, "vector": "NONE", "modified": "2016-11-03T10:18:10", "rev": 2}, "dependencies": {"references": [], "modified": "2016-11-03T10:18:10", "rev": 2}, "vulnersScore": -0.3}, "sourceHref": "https://packetstormsecurity.com/files/download/136341/rt-sa-2016-002.txt", "sourceData": "`Advisory: Cross-site Scripting in Securimage 3.6.2 \n \nRedTeam Pentesting discovered a cross-site scripting (XSS) vulnerability \nin the Securimage CAPTCHA software, which allows attackers to inject \narbitrary JavaScript code via a crafted URL. \n \n \nDetails \n======= \n \nProduct: Securimage \nAffected Versions: >= 3.2RC1 \nFixed Versions: 3.6.4 \nVulnerability Type: Cross-site Scripting \nSecurity Risk: high \nVendor URL: https://www.phpcaptcha.org/ \nVendor Status: fixed version released \nAdvisory URL: https://www.redteam-pentesting.de/advisories/rt-sa-2016-002 \nAdvisory Status: published \nCVE: GENERIC-MAP-NOMATCH \nCVE URL: https://cve.mitre.org/cgi-bin/cvename.cgi?name=GENERIC-MAP-NOMATCH \n \n \nIntroduction \n============ \n \n\"Securimage is an open-source free PHP CAPTCHA script for generating \ncomplex images and CAPTCHA codes to protect forms from spam and abuse. \nIt can be easily added into existing forms on your website to provide \nprotection from spam bots. It can run on most any web server as long as \nyou have PHP installed, and GD support within PHP. Securimage does \neverything from generating the CAPTCHA images to validating the typed \ncode. Audible codes can be streamed to the browser with Flash for the \nvision impaired.\" \n \n(from the project's homepage) \n \n \nMore Details \n============ \n \nThe Securimage download package and GitHub repository include several \nexample scripts to demonstrate the usage of the library. Among these \nscripts is the file example_form.ajax.php. It returns JavaScript code \nthat includes an unencoded value from the variable $_SERVER['PHP_SELF'] \ndirectly embedded into the website. \n \nIn Securimage versions from 3.2RC1 to 3.5 the following code is \nvulnerable: \n \n------------------------------------------------------------------------ \nfunction processForm() \n{ \nnew Ajax.Request('<?php echo $_SERVER['PHP_SELF'] ?>', { \nmethod: 'post', \nparameters: $('contact_form').serialize(), \nonSuccess: function(transport) { \n------------------------------------------------------------------------ \n \nIn Securimage versions from 3.5.2 to 3.6.2 the following code is \nvulnerable: \n \n------------------------------------------------------------------------ \nfunction processForm() \n{ \njQuery.ajax({ \nurl: '<?php echo $_SERVER['PHP_SELF'] ?>', \ntype: 'POST', \ndata: jQuery('#contact_form').serialize(), \ndataType: 'json', \n}).done(function(data) { \n------------------------------------------------------------------------ \n \nThe problem here is that the value of the variable $_SERVER['PHP_SELF'] \ncan, depending on the configuration of the web server, often be \nmanipulated by an attacker to include special characters like \napostrophes. \n \n \nProof of Concept \n================ \n \nThe following URL can be used to demonstrate the vulnerability for \nSecurimage versions from 3.2RC1 to 3.5 on with a vulnerable web server \nconfiguration: \n \nhttp://www.example.com/example_form.ajax.php/');}alert('RedTeam Pentesting');a=function(){a(' \n \nSecurimage versions from 3.5.2 to 3.6.2 can be exploited with the \nfollowing URL: \n \nhttp://www.example.com/example_form.ajax.php/'});}alert('RedTeam Pentesting');a=function(){a({x:' \n \nThe result is a notification showing the text \"RedTeam Pentesting\". The \nvalue of the variable $_SERVER['PHP_SELF'] is embedded in verbatim into \nthe HTML source code of the resulting web page. \n \n \nWorkaround \n========== \n \nThe file example_form.ajax.php should be deleted from the Securimage \ndirectory on a web server. \n \n \nFix \n=== \n \nUpdate to version 3.6.4. \n \n \nSecurity Risk \n============= \n \nThis security vulnerability is rated as a high risk. It allows executing \narbitrary JavaScript code in users' browsers if they access URLs \nprepared by attackers. This provides many possibilities for further \nattacks against these users. Since Securimage is usually used as a \nsoftware library to provide CAPTCHA functionality for web applications, \nthe vulnerability could be used to exploit all web applications hosted \non the same domain. \n \n \nTimeline \n======== \n \n2016-02-03 Vulnerability identified \n2016-02-12 Customer approved disclosure to vendor \n2016-02-23 CVE number requested \n2016-02-24 CVE number not assigned, \"non-prioritized product\" \n2016-03-02 Vendor contacted \n2016-03-03 Vendor releases fixed version \n2016-03-22 Advisory released \n \n \nReferences \n========== \n \nhttps://www.phpcaptcha.org/uncategorized/securimage-3-6-4-released/ \n \n \nRedTeam Pentesting GmbH \n======================= \n \nRedTeam Pentesting offers individual penetration tests performed by a \nteam of specialised IT-security experts. Hereby, security weaknesses in \ncompany networks or products are uncovered and can be fixed immediately. \n \nAs there are only few experts in this field, RedTeam Pentesting wants to \nshare its knowledge and enhance the public knowledge with research in \nsecurity-related areas. The results are made available as public \nsecurity advisories. \n \nMore information about RedTeam Pentesting can be found at: \nhttps://www.redteam-pentesting.de/ \n \n-- \nRedTeam Pentesting GmbH Tel.: +49 241 510081-0 \nDennewartstr. 25-27 Fax : +49 241 510081-99 \n52068 Aachen https://www.redteam-pentesting.de \nGermany Registergericht: Aachen HRB 14004 \nGesch\u00e4ftsf\u00fchrer: Patrick Hof, Jens Liebchen \n`\n"}