XSS, www.ndbc.noaa.gov, Cross Site Scripting, CWE-79, CAPEC-86

CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')

Report generated by XSS.CX Research Blog at Sat Mar 05 11:17:56 CST 2011.


Loading

1. Cross-site scripting (reflected)

2. Cross-domain Referer leakage

3. Cross-domain script include

4. Email addresses disclosed

4.1. http://www.ndbc.noaa.gov/rss/ndbc_obs_search.php

4.2. http://www.ndbc.noaa.gov/rss/xsl_mop-up.js

4.3. http://www.ndbc.noaa.gov/sar.php

4.4. http://www.ndbc.noaa.gov/show_plot.php

4.5. http://www.ndbc.noaa.gov/station_realtime.php



1. Cross-site scripting (reflected)  next

Summary

Severity:   High
Confidence:   Certain
Host:   http://www.ndbc.noaa.gov
Path:   /rss/ndbc_obs_search.php

Issue detail

The name of an arbitrarily supplied request parameter is copied into the XML document as plain text between tags. The payload d6e4c<a%20xmlns%3aa%3d'http%3a//www.w3.org/1999/xhtml'><a%3abody%20onload%3d'alert(1)'/></a>04979842 was submitted in the name of an arbitrarily supplied request parameter. This input was echoed as d6e4c<a xmlns:a='http://www.w3.org/1999/xhtml'><a:body onload='alert(1)'/></a>04979842 in the application's response.

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

The response into which the attack is echoed contains XML data, which is not by default processed by the browser as HTML. However, by injecting XML elements which create a new namespace it is possible to trick some browsers (including Firefox) into processing part of the response as HTML. Note that this proof-of-concept attack is designed to execute when processed by the browser as a standalone response, not when the XML is consumed by a script within another page.

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 defenses: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 /rss/ndbc_obs_search.php/d6e4c<a%20xmlns%3aa%3d'http%3a//www.w3.org/1999/xhtml'><a%3abody%20onload%3d'alert(1)'/></a>04979842 HTTP/1.1
Host: www.ndbc.noaa.gov
Accept: */*
Accept-Language: en
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0)
Connection: close
Cookie: fsr.s={"v":1,"rid":"1298668135765_72177","pv":1,"to":3,"c":"http://www.noaa.gov/","lc":{"d0":{"v":1,"s":true}},"cd":0,"sd":0,"f":1298668316368};

Response

HTTP/1.1 200 OK
Date: Sat, 26 Feb 2011 02:29:20 GMT
Server: Apache
X-Powered-By: PHP/5.1.6
Cache-Control: max-age=600, must-revalidate
Expires: Sat, 26 Feb 2011 02:39:20 GMT
Vary: Accept-Encoding
Content-Length: 1650
Connection: close
Content-Type: text/xml

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="/rss/ndbcrss.xsl"?>
<rss version="2.0" xmlns:georss="http://www.georss.org/georss" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
...[SNIP]...
<br />
       Example: http://www.ndbc.noaa.gov/rss/ndbc_obs_search.php/d6e4c<a xmlns:a='http://www.w3.org/1999/xhtml'><a:body onload='alert(1)'/></a>04979842?lat=25.5&amp;lon=-90.1&amp;radius=200<br />
...[SNIP]...

2. Cross-domain Referer leakage  previous  next

Summary

Severity:   Information
Confidence:   Certain
Host:   http://www.ndbc.noaa.gov
Path:   /station_page.php

Issue detail

The page was loaded from a URL containing a query string:The response contains the following links to other domains:

Issue background

When a web browser makes a request for a resource, it typically adds an HTTP header, called the "Referer" header, indicating the URL of the resource from which the request originated. This occurs in numerous situations, for example when a web page loads an image or script, or when a user clicks on a link or submits a form.

If the resource being requested resides on a different domain, then the Referer header is still generally included in the cross-domain request. If the originating URL contains any sensitive information within its query string, such as a session token, then this information will be transmitted to the other domain. If the other domain is not fully trusted by the application, then this may lead to a security compromise.

You should review the contents of the information being transmitted to other domains, and also determine whether those domains are fully trusted by the originating application.

Today's browsers may withhold the Referer header in some situations (for example, when loading a non-HTTPS resource from a page that was loaded over HTTPS, or when a Refresh directive is issued), but this behaviour should not be relied upon to protect the originating URL from disclosure.

Note also that if users can author content within the application then an attacker may be able to inject links referring to a domain they control in order to capture data from URLs used within the application.

Issue remediation

The application should never transmit any sensitive information within the URL query string. In addition to being leaked in the Referer header, such information may be logged in various locations and may be visible on-screen to untrusted parties.

Request

GET /station_page.php?station=44018 HTTP/1.1
Host: www.ndbc.noaa.gov
Proxy-Connection: keep-alive
Referer: http://www.erh.noaa.gov/gyx/marine_weather.shtml
Accept: application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.13 (KHTML, like Gecko) Chrome/9.0.597.98 Safari/534.13
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
Cookie: fsr.s={"v":1,"rid":"1298668135765_72177","pv":1,"to":3,"c":"http://www.noaa.gov/","lc":{"d0":{"v":1,"s":true}},"cd":0,"sd":0,"f":1298668316368}

Response

HTTP/1.1 200 OK
Date: Fri, 25 Feb 2011 21:18:10 GMT
Server: Apache
X-Powered-By: PHP/5.1.6
Cache-Control: max-age=900, must-revalidate
Expires: Fri, 25 Feb 2011 21:33:10 GMT
Vary: Accept-Encoding
Connection: close
Content-Type: text/html; charset=ISO-8859-1
Content-Length: 60905

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-eq
...[SNIP]...
<link rel="stylesheet" href="/style/ndbc.css" type="text/css" />
<script src="http://maps.google.com/maps?oe=utf-8&amp;file=api&amp;v=2&amp;key=ABQIAAAAIoZKb9JrajP0IwKLFr335hTsk_juWuwt_LNtOqByAr93uT9HuRTzovVKWJSi3TQGBPsWMWPyWdIQdg&amp;client=gme-noaa&amp;sensor=false" type="text/javascript"></script>
...[SNIP]...
</a> <a href="http://www.weather.gov/"><span class="nwslink">
...[SNIP]...
<td align="right"><a href="http://www.weather.gov/"><img src="/images/nws/nwsright.jpg" alt="Select to go to the NWS homepage" width="85" height="78" border="0" />
...[SNIP]...
<td width="20%" align="center"><a href="http://www.weather.gov/organization.php" class="nav" target="_blank" onclick="window.open('http://www.weather.gov/organizaton.php','_blank','width=750,height=550,top=0,left=0,menubar=yes,toolbar=yes,scrollbars=yes');return false">Organization</a>
...[SNIP]...
<br />
           &nbsp;&nbsp;&nbsp;&nbsp;<a href="http://ioos.gov/" title="IOOS Program" class="nav">IOOS&#174; Program</a>
...[SNIP]...
<br />
           <a href="http://www.usa.gov/"><img src="/images/usagov_logo.gif" alt="USA.gov is the U.S. government's official web portal to all federal, state and local government web resources and services." width="110" height="30" hspace="3" v
...[SNIP]...
<h1 style="text-align:center; margin:3px;">Station 44018 <a href='http://www.navcen.uscg.gov/?pageName=lightLists' target='_blank'>(LLNR 560)</a>
...[SNIP]...
<div id="ndbcmapnwslinks" style="text-align:left;margin:0;background-color:white;color:black;float:right;width:20%;">
                           <a href="http://www.weather.gov/credits.php#googlemapping" target="_blank" onclick="window.open('http://www.weather.gov/credits.php#googlemapping','_blank','width=750,height=550,top=0,left=0,menubar=yes,toolbar=yes,scrollbars=yes');return false">Disclaimer</a>
...[SNIP]...
<td width="70%" align="left" class="gray_no_line"><a href="http://www.doc.gov/"><span class="gray_no_line">
...[SNIP]...
<td width="15%" align="left">
                   <a href="http://www.weather.gov/disclaimer.html" target="_blank" onclick="window.open('http://www.weather.gov/disclaimer.html','_blank','width=750,height=550,top=0,left=0,menubar=yes,toolbar=yes,scrollbars=yes');return false"><span class="gray_no_line">
...[SNIP]...
<br />
                   <a href="http://www.weather.gov/credits.php" target="_blank" onclick="window.open('http://www.weather.gov/credits.php','_blank','width=750,height=550,top=0,left=0,menubar=yes,toolbar=yes,scrollbars=yes');return false"><span class="gray_no_line">
...[SNIP]...
<br />
                   <a href="http://www.weather.gov/glossary/" target="_blank" onclick="window.open('http://www.weather.gov/glossary/','_blank','width=750,height=550,top=0,left=0,menubar=yes,toolbar=yes,scrollbars=yes');return false"><span class="gray_no_line">
...[SNIP]...
<td width="15%" align="left">
                   <a href="http://www.weather.gov/privacy.php" target="_blank" onclick="window.open('http://www.weather.gov/privacy.php','_blank','width=750,height=550,top=0,left=0,menubar=yes,toolbar=yes,scrollbars=yes');return false"><span class="gray_no_line">
...[SNIP]...
<br />                
                   <a href="http://www.weather.gov/admin.php" target="_blank" onclick="window.open('http://www.weather.gov/admin.php','_blank','width=750,height=550,top=0,left=0,menubar=yes,toolbar=yes,scrollbars=yes');return false"><span class="gray_no_line">
...[SNIP]...
<br />
                   <a href="http://www.weather.gov/careers.php" target="_blank" onclick="window.open('http://www.weather.gov/careers.php','_blank','width=750,height=550,top=0,left=0,menubar=yes,toolbar=yes,scrollbars=yes');return false"><span class="gray_no_line">
...[SNIP]...

3. Cross-domain script include  previous  next

Summary

Severity:   Information
Confidence:   Certain
Host:   http://www.ndbc.noaa.gov
Path:   /station_page.php

Issue detail

The response dynamically includes the following script from another domain:

Issue background

When an application includes a script from an external domain, this script is executed by the browser within the security context of the invoking application. The script can therefore do anything that the application's own scripts can do, such as accessing application data and performing actions within the context of the current user.

If you include a script from an external domain, then you are trusting that domain with the data and functionality of your application, and you are trusting the domain's own security to prevent an attacker from modifying the script to perform malicious actions within your application.

Issue remediation

Scripts should not be included from untrusted domains. If you have a requirement which a third-party script appears to fulfil, then you should ideally copy the contents of that script onto your own domain and include it from there. If that is not possible (e.g. for licensing reasons) then you should consider reimplementing the script's functionality within your own code.

Request

GET /station_page.php?station=44018 HTTP/1.1
Host: www.ndbc.noaa.gov
Proxy-Connection: keep-alive
Referer: http://www.erh.noaa.gov/gyx/marine_weather.shtml
Accept: application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.13 (KHTML, like Gecko) Chrome/9.0.597.98 Safari/534.13
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
Cookie: fsr.s={"v":1,"rid":"1298668135765_72177","pv":1,"to":3,"c":"http://www.noaa.gov/","lc":{"d0":{"v":1,"s":true}},"cd":0,"sd":0,"f":1298668316368}

Response

HTTP/1.1 200 OK
Date: Fri, 25 Feb 2011 21:18:10 GMT
Server: Apache
X-Powered-By: PHP/5.1.6
Cache-Control: max-age=900, must-revalidate
Expires: Fri, 25 Feb 2011 21:33:10 GMT
Vary: Accept-Encoding
Connection: close
Content-Type: text/html; charset=ISO-8859-1
Content-Length: 60905

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-eq
...[SNIP]...
<link rel="stylesheet" href="/style/ndbc.css" type="text/css" />
<script src="http://maps.google.com/maps?oe=utf-8&amp;file=api&amp;v=2&amp;key=ABQIAAAAIoZKb9JrajP0IwKLFr335hTsk_juWuwt_LNtOqByAr93uT9HuRTzovVKWJSi3TQGBPsWMWPyWdIQdg&amp;client=gme-noaa&amp;sensor=false" type="text/javascript"></script>
...[SNIP]...

4. Email addresses disclosed  previous
There are 5 instances of this issue:

Issue background

The presence of email addresses within application responses does not necessarily constitute a security vulnerability. Email addresses may appear intentionally within contact information, and many applications (such as web mail) include arbitrary third-party email addresses within their core content.

However, email addresses of developers and other individuals (whether appearing on-screen or hidden within page source) may disclose information that is useful to an attacker; for example, they may represent usernames that can be used at the application's login, and they may be used in social engineering attacks against the organisation's personnel. Unnecessary or excessive disclosure of email addresses may also lead to an increase in the volume of spam email received.

Issue remediation

You should review the email addresses being disclosed by the application, and consider removing any that are unnecessary, or replacing personal addresses with anonymous mailbox addresses (such as helpdesk@example.com).


4.1. http://www.ndbc.noaa.gov/rss/ndbc_obs_search.php  next

Summary

Severity:   Information
Confidence:   Certain
Host:   http://www.ndbc.noaa.gov
Path:   /rss/ndbc_obs_search.php

Issue detail

The following email address was disclosed in the response:

Request

GET /rss/ndbc_obs_search.php HTTP/1.1
Host: www.ndbc.noaa.gov
Accept: */*
Accept-Language: en
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0)
Connection: close
Cookie: fsr.s={"v":1,"rid":"1298668135765_72177","pv":1,"to":3,"c":"http://www.noaa.gov/","lc":{"d0":{"v":1,"s":true}},"cd":0,"sd":0,"f":1298668316368};

Response

HTTP/1.1 200 OK
Date: Sat, 26 Feb 2011 02:29:15 GMT
Server: Apache
X-Powered-By: PHP/5.1.6
Cache-Control: max-age=600, must-revalidate
Expires: Sat, 26 Feb 2011 02:39:15 GMT
Vary: Accept-Encoding
Content-Length: 1563
Connection: close
Content-Type: text/xml

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="/rss/ndbcrss.xsl"?>
<rss version="2.0" xmlns:georss="http://www.georss.org/georss" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
...[SNIP]...
<managingEditor>webmaster.ndbc@noaa.gov</managingEditor>
...[SNIP]...
<webMaster>webmaster.ndbc@noaa.gov</webMaster>
...[SNIP]...

4.2. http://www.ndbc.noaa.gov/rss/xsl_mop-up.js  previous  next

Summary

Severity:   Information
Confidence:   Certain
Host:   http://www.ndbc.noaa.gov
Path:   /rss/xsl_mop-up.js

Issue detail

The following email address was disclosed in the response:

Request

GET /rss/xsl_mop-up.js HTTP/1.1
Host: www.ndbc.noaa.gov
Proxy-Connection: keep-alive
Referer: http://www.ndbc.noaa.gov/rss/ndbc_obs_search.php/d6e4c%3Ca%20xmlns%3aa%3d'http%3a//www.w3.org/1999/xhtml'%3E%3Ca%3abody%20onload%3d'alert(document.cookie)'/%3E%3C/a%3E04979842
Accept: */*
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.13 (KHTML, like Gecko) Chrome/9.0.597.98 Safari/534.13
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3

Response

HTTP/1.1 200 OK
Date: Sat, 26 Feb 2011 14:08:39 GMT
Server: Apache
Last-Modified: Thu, 04 Oct 2007 21:37:32 GMT
ETag: "68813-aa3-97fc7f00"
Accept-Ranges: bytes
Content-Length: 2723
Cache-Control: must-revalidate
Connection: close
Content-Type: application/x-javascript

// -*-coding: latin-1;-*-
// Time-stamp: "2006-05-17 22:06:46 ADT" sburke@cpan.org

// A workaround for XSL-to-XHTML systems that don't
// implement XSL 'disable-output-escaping="yes"'.
//
// sburke@cpan.org, Sean M. Burke.
// - I hereby release this JavaScript code into the public domain.

var is_decoding;
var DEBUG = 0;

function complaining (s) { alert(s); return new Error(s,s); }

if(!( document.g
...[SNIP]...

4.3. http://www.ndbc.noaa.gov/sar.php  previous  next

Summary

Severity:   Information
Confidence:   Certain
Host:   http://www.ndbc.noaa.gov
Path:   /sar.php

Issue detail

The following email address was disclosed in the response:

Request

GET /sar.php HTTP/1.1
Host: www.ndbc.noaa.gov
Accept: */*
Accept-Language: en
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0)
Connection: close
Cookie: fsr.s={"v":1,"rid":"1298668135765_72177","pv":1,"to":3,"c":"http://www.noaa.gov/","lc":{"d0":{"v":1,"s":true}},"cd":0,"sd":0,"f":1298668316368};

Response

HTTP/1.1 200 OK
Date: Sat, 26 Feb 2011 02:29:16 GMT
Server: Apache
X-Powered-By: PHP/5.1.6
Cache-Control: max-age=900, must-revalidate
Expires: Sat, 26 Feb 2011 02:44:16 GMT
Vary: Accept-Encoding
Connection: close
Content-Type: text/html; charset=ISO-8859-1
Content-Length: 13082

<HTML lang="en-US">
<HEAD>
<title>NDBC - Station not found</title>
<LINK rel="stylesheet" href="/style/ndbc.css" type="text/css">
</HEAD>
<!-- Start Top Navbar -->
<body>

<table cellspacing="0" cellp
...[SNIP]...
<A
HREF="mailto:webmaster.ndbc@noaa.gov">
...[SNIP]...

4.4. http://www.ndbc.noaa.gov/show_plot.php  previous  next

Summary

Severity:   Information
Confidence:   Certain
Host:   http://www.ndbc.noaa.gov
Path:   /show_plot.php

Issue detail

The following email address was disclosed in the response:

Request

GET /show_plot.php HTTP/1.1
Host: www.ndbc.noaa.gov
Accept: */*
Accept-Language: en
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0)
Connection: close
Cookie: fsr.s={"v":1,"rid":"1298668135765_72177","pv":1,"to":3,"c":"http://www.noaa.gov/","lc":{"d0":{"v":1,"s":true}},"cd":0,"sd":0,"f":1298668316368};

Response

HTTP/1.1 200 OK
Date: Sat, 26 Feb 2011 02:29:16 GMT
Server: Apache
X-Powered-By: PHP/5.1.6
Cache-Control: max-age=900, must-revalidate
Expires: Sat, 26 Feb 2011 02:44:16 GMT
Vary: Accept-Encoding
Connection: close
Content-Type: text/html; charset=ISO-8859-1
Content-Length: 13297

<!-- Cannot put DOCTYPE in error page until navbar include files are cleaned up...
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.d
...[SNIP]...
<a
href="mailto:webmaster.ndbc@noaa.gov">
...[SNIP]...

4.5. http://www.ndbc.noaa.gov/station_realtime.php  previous

Summary

Severity:   Information
Confidence:   Certain
Host:   http://www.ndbc.noaa.gov
Path:   /station_realtime.php

Issue detail

The following email address was disclosed in the response:

Request

GET /station_realtime.php HTTP/1.1
Host: www.ndbc.noaa.gov
Accept: */*
Accept-Language: en
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0)
Connection: close
Cookie: fsr.s={"v":1,"rid":"1298668135765_72177","pv":1,"to":3,"c":"http://www.noaa.gov/","lc":{"d0":{"v":1,"s":true}},"cd":0,"sd":0,"f":1298668316368};

Response

HTTP/1.1 200 OK
Date: Sat, 26 Feb 2011 02:29:20 GMT
Server: Apache
X-Powered-By: PHP/5.1.6
Cache-Control: max-age=900, must-revalidate
Expires: Sat, 26 Feb 2011 02:44:20 GMT
Vary: Accept-Encoding
Connection: close
Content-Type: text/html; charset=ISO-8859-1
Content-Length: 13091

<html lang="en-US">
<head>
   <title>NDBC - Station not found</title>
   <link rel="stylesheet" href="/style/ndbc.css" type="text/css" />
</head>
<!-- Start Top Navbar -->
<body>

<table cellspacing="0" c
...[SNIP]...
<a
href="mailto:webmaster.ndbc@noaa.gov">
...[SNIP]...

Report generated by XSS.CX Research Blog at Sat Mar 05 11:17:56 CST 2011.