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.
Issue remediation
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 __utmz cookie appears to be vulnerable to SQL injection attacks. The payload 'waitfor%20delay'0%3a0%3a20'-- was submitted in the __utmz cookie. The application took 91665 milliseconds to respond to the request, compared with 832 milliseconds for the original request, indicating that the injected SQL command caused a time delay.
The database appears to be Microsoft SQL Server.
Request
GET /corpPortalWeb/ContactUs.jsp?ln=en HTTP/1.1 Host: www.crimsonlogic.com Proxy-Connection: keep-alive Referer: http://www.crimsonlogic.com/corpPortalWeb/Home.jsp Cache-Control: max-age=0 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: JSESSIONID=rrp8NZgL5sLPtJ4Mh2hJzfX9hLnQ3sQNy0K21YQT3n0z3NxymmhX!1184770189; __utmz=101305299.1297735795.1.1.utmcsr=crimsonlogic.com|utmccn=(referral)|utmcmd=referral|utmcct=/'waitfor%20delay'0%3a0%3a20'--; __utma=101305299.191032906.1297735795.1297735795.1297735795.1; __utmc=101305299; __utmb=101305299.2.10.1297735795
Response
HTTP/1.1 200 OK Date: Tue, 15 Feb 2011 02:34:28 GMT Server: Apache Content-Length: 10496 X-Powered-By: Servlet/2.5 JSP/2.1 Content-Type: text/html;charset=UTF-8
<!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. ...[SNIP]...
The __utmb cookie appears to be vulnerable to SQL injection attacks. A single quote was submitted in the __utmb cookie, and a general 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.
Request 1
GET /corpPortalWeb/Solutions-Services-overview.jsp?ln=en HTTP/1.1 Host: www.crimsonlogic.com Proxy-Connection: keep-alive Referer: http://www.crimsonlogic.com/corpPortalWeb/Home.jsp?ln=en 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: JSESSIONID=rrp8NZgL5sLPtJ4Mh2hJzfX9hLnQ3sQNy0K21YQT3n0z3NxymmhX!1184770189; __utmz=101305299.1297735795.1.1.utmcsr=crimsonlogic.com|utmccn=(referral)|utmcmd=referral|utmcct=/; __utma=101305299.191032906.1297735795.1297735795.1297735795.1; __utmc=101305299; __utmb=101305299.4.10.1297735795'
Response 1
HTTP/1.1 500 Internal Server Error Date: Tue, 15 Feb 2011 02:25:46 GMT Server: Apache Content-Length: 10528 Connection: close Content-Type: text/html; charset=UTF-8
<!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"> <head> <meta http ...[SNIP]...
Request 2
GET /corpPortalWeb/Solutions-Services-overview.jsp?ln=en HTTP/1.1 Host: www.crimsonlogic.com Proxy-Connection: keep-alive Referer: http://www.crimsonlogic.com/corpPortalWeb/Home.jsp?ln=en 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: JSESSIONID=rrp8NZgL5sLPtJ4Mh2hJzfX9hLnQ3sQNy0K21YQT3n0z3NxymmhX!1184770189; __utmz=101305299.1297735795.1.1.utmcsr=crimsonlogic.com|utmccn=(referral)|utmcmd=referral|utmcct=/; __utma=101305299.191032906.1297735795.1297735795.1297735795.1; __utmc=101305299; __utmb=101305299.4.10.1297735795''
Response 2
HTTP/1.1 200 OK Date: Tue, 15 Feb 2011 02:26:28 GMT Server: Apache X-Powered-By: Servlet/2.5 JSP/2.1 Content-Type: text/html;charset=UTF-8 Content-Length: 12589
<!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 ...[SNIP]...
2. Cookie without HttpOnly flag setpreviousnext There are 2 instances of this issue:
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.
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.
Request
GET /corpPortalWeb/Home.jsp HTTP/1.1 Host: www.crimsonlogic.com Proxy-Connection: keep-alive Referer: http://crimsonlogic.com/ 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
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.
Request
GET /corpPortalWeb/Solutions-Services-overview.jsp?ln=en HTTP/1.1 Host: www.crimsonlogic.com Proxy-Connection: keep-alive Referer: http://www.crimsonlogic.com/corpPortalWeb/Solutions-Services-overview.jsp?ln=en 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: __utmz=101305299.1297772841.2.2.utmcsr=burp|utmccn=(referral)|utmcmd=referral|utmcct=/show/4; __utma=101305299.191032906.1297735795.1297735795.1297772841.2; __utmc=101305299; __utmb=101305299.1.10.1297772841
The response contains the following link to another domain:
http://gothere.sg/directions?output=embedded
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 /corpPortalWeb/ContactUs.jsp?ln=en HTTP/1.1 Host: www.crimsonlogic.com Proxy-Connection: keep-alive Referer: http://www.crimsonlogic.com/corpPortalWeb/Home.jsp Cache-Control: max-age=0 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: JSESSIONID=rrp8NZgL5sLPtJ4Mh2hJzfX9hLnQ3sQNy0K21YQT3n0z3NxymmhX!1184770189; __utmz=101305299.1297735795.1.1.utmcsr=crimsonlogic.com|utmccn=(referral)|utmcmd=referral|utmcct=/; __utma=101305299.191032906.1297735795.1297735795.1297735795.1; __utmc=101305299; __utmb=101305299.2.10.1297735795
Response
HTTP/1.1 200 OK Date: Tue, 15 Feb 2011 02:10:25 GMT Server: Apache Content-Length: 10074 X-Powered-By: Servlet/2.5 JSP/2.1 Content-Type: text/html;charset=UTF-8
The TRACE method is designed for diagnostic purposes. If enabled, the web server will respond to requests which use the TRACE method by echoing in its response the exact request which was received.
Although this behaviour is apparently harmless in itself, it can sometimes be leveraged to support attacks against other application users. If an attacker can find a way of causing a user to make a TRACE request, and can retrieve the response to that request, then the attacker will be able to capture any sensitive data which is included in the request by the user's browser, for example session cookies or credentials for platform-level authentication. This may exacerbate the impact of other vulnerabilities, such as cross-site scripting.
Issue remediation
The TRACE method should be disabled on the web server.
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 following email address was disclosed in the response:
helpdesk@crimsonlogic.com
Request
GET /corpPortalWeb/Feedback.jsp HTTP/1.1 Host: www.crimsonlogic.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close Cookie: JSESSIONID=rrp8NZgL5sLPtJ4Mh2hJzfX9hLnQ3sQNy0K21YQT3n0z3NxymmhX!1184770189; __utmz=101305299.1297735795.1.1.utmcsr=crimsonlogic.com|utmccn=(referral)|utmcmd=referral|utmcct=/; __utma=101305299.191032906.1297735795.1297735795.1297735795.1; __utmc=101305299; __utmb=101305299.8.10.1297735795;
Response
HTTP/1.1 200 OK Date: Tue, 15 Feb 2011 02:15:31 GMT Server: Apache X-Powered-By: Servlet/2.5 JSP/2.1 Connection: close Content-Type: text/html;charset=UTF-8 Content-Length: 32309
<!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 ...[SNIP]... <a href="mailto:helpdesk@crimsonlogic.com"> ...[SNIP]...
The following email address was disclosed in the response:
sales@crimsonlogic.com
Request
GET /corpPortalWeb/Home.jsp?ln=en HTTP/1.1 Host: www.crimsonlogic.com Proxy-Connection: keep-alive Referer: http://www.crimsonlogic.com/corpPortalWeb/ContactUs.jsp?ln=en 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: JSESSIONID=rrp8NZgL5sLPtJ4Mh2hJzfX9hLnQ3sQNy0K21YQT3n0z3NxymmhX!1184770189; __utmz=101305299.1297735795.1.1.utmcsr=crimsonlogic.com|utmccn=(referral)|utmcmd=referral|utmcct=/; __utma=101305299.191032906.1297735795.1297735795.1297735795.1; __utmc=101305299; __utmb=101305299.3.10.1297735795
Response
HTTP/1.1 200 OK Date: Tue, 15 Feb 2011 02:11:23 GMT Server: Apache X-Powered-By: Servlet/2.5 JSP/2.1 Content-Type: text/html;charset=UTF-8 Content-Length: 19184
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http ...[SNIP]... governments work, share information and deliver services for the benefits of governments, citizens, and businesses they serve. Call for Action, To discuss how we can help your organization email us at sales@crimsonlogic.com or call us at +65 6887 7888."> ...[SNIP]...
The following email address was disclosed in the response:
sales@crimsonlogic.com
Request
GET /corpPortalWeb/Services-HCMS.jsp HTTP/1.1 Host: www.crimsonlogic.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close Cookie: JSESSIONID=rrp8NZgL5sLPtJ4Mh2hJzfX9hLnQ3sQNy0K21YQT3n0z3NxymmhX!1184770189; __utmz=101305299.1297735795.1.1.utmcsr=crimsonlogic.com|utmccn=(referral)|utmcmd=referral|utmcct=/; __utma=101305299.191032906.1297735795.1297735795.1297735795.1; __utmc=101305299; __utmb=101305299.8.10.1297735795;
Response
HTTP/1.1 200 OK Date: Tue, 15 Feb 2011 02:17:00 GMT Server: Apache Content-Length: 12074 X-Powered-By: Servlet/2.5 JSP/2.1 Connection: close Content-Type: text/html;charset=UTF-8
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
The following email address was disclosed in the response:
sales@crimsonlogic.com
Request
GET /corpPortalWeb/Services-overview.jsp HTTP/1.1 Host: www.crimsonlogic.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close Cookie: JSESSIONID=rrp8NZgL5sLPtJ4Mh2hJzfX9hLnQ3sQNy0K21YQT3n0z3NxymmhX!1184770189; __utmz=101305299.1297735795.1.1.utmcsr=crimsonlogic.com|utmccn=(referral)|utmcmd=referral|utmcct=/; __utma=101305299.191032906.1297735795.1297735795.1297735795.1; __utmc=101305299; __utmb=101305299.8.10.1297735795;
Response
HTTP/1.1 200 OK Date: Tue, 15 Feb 2011 02:24:45 GMT Server: Apache X-Powered-By: Servlet/2.5 JSP/2.1 Connection: close Content-Type: text/html;charset=UTF-8 Content-Length: 12372
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
The following email address was disclosed in the response:
helpdesk@crimsonlogic.com
Request
GET /corpPortalWeb/Training.jsp HTTP/1.1 Host: www.crimsonlogic.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close Cookie: JSESSIONID=rrp8NZgL5sLPtJ4Mh2hJzfX9hLnQ3sQNy0K21YQT3n0z3NxymmhX!1184770189; __utmz=101305299.1297735795.1.1.utmcsr=crimsonlogic.com|utmccn=(referral)|utmcmd=referral|utmcct=/; __utma=101305299.191032906.1297735795.1297735795.1297735795.1; __utmc=101305299; __utmb=101305299.8.10.1297735795;
Response
HTTP/1.1 200 OK Date: Tue, 15 Feb 2011 02:15:20 GMT Server: Apache Content-Length: 10488 X-Powered-By: Servlet/2.5 JSP/2.1 Connection: close Content-Type: text/html;charset=UTF-8
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">