SQL Injection occurs when data input for example by a user is interpreted as a SQL command rather than normal data by the backend database. This is an extremely common vulnerability and its successful exploitation can have critical implications. Netsparker confirmed the vulnerability by executing a test SQL Query on the back-end database.
Impact
Depending on the backend database, the database connection settings and the operating system, an attacker can mount one or more of the following type of attacks successfully:
Reading, Updating and Deleting arbitrary data from the database
Executing commands on the underlying operating system
Reading, Updating and Deleting arbitrary tables from the database
Actions to Take
See the remedy for solution.
If you are not using a database access layer (DAL), consider using one. This will help you to centralise the issue. You can also use an ORM (object relational mapping). Most of the ORM systems use only parameterised queries and this can solve the whole SQL Injection problem.
Locate all of the dynamically generated SQL queries and convert them to parameterised queries (If you decide to use a DAL/ORM, change all legacy code to use these new libraries)
Use your weblogs and application logs to see if there was any previous but undetected attack to this resource.
Remedy
A robust method for mitigating the threat of SQL Injection based vulnerabilities is to use parameterized queries (prepared statements). Almost all modern languages provide built in libraries for this. Wherever possible do not create dynamic SQL queries or SQL queries with string concatenation.
Required Skills for Successful Exploitation
There are numerous freely available tools to exploit SQL Injection vulnerabilities. This is a complex area with many dependencies, however it should be noted that the numerous resources available in this area have raised both attacker awareness of the issues and their ability to discover and leverage them. SQL Injection is one of the most common web application vulnerabilities.
(select 1 and row(1,1)>(select count(*),concat(CONCAT(CHAR(95),CHAR(33),CHAR(64),CHAR(52),CHAR(100),CHAR(105),CHAR(108),CHAR(101),CHAR(109),CHAR(109),CHAR(97)),0x3a,floor(rand()*2))x from (select 1 union select 2)a group by x limit 1))
r
GET
705910
Extracted Data
5.0.77-log
Request
GET /www/delivery/tjs.php?trackerid=(select+1+and+row(1%2c1)%3e(select+count(*)%2cconcat(CONCAT(CHAR(95)%2CCHAR(33)%2CCHAR(64)%2CCHAR(52)%2CCHAR(100)%2CCHAR(105)%2CCHAR(108)%2CCHAR(101)%2CCHAR(109)%2CCHAR(109)%2CCHAR(97))%2c0x3a%2cfloor(rand()*2))x+from+(select+1+union+select+2)a+group+by+x+limit+1))&r=705910 HTTP/1.1 User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322) Cache-Control: no-cache Host: s1.srtk.net Cookie: sessionID=phpads4e1c583f94ad85.71513255 Accept-Encoding: gzip, deflate
SELECT t.clientid AS advertiser_id,t.trackerid AS tracker_id,t.trackername AS name,t.description AS description,t.viewwindow AS viewwindow,t.clickwindow AS clickwindow,t.blockwindow AS blockwindow,t.appendcode AS appendcode FROM trackers AS t WHERE t.trackerid IN ((select 1 and row(1,1)>(select count(*),concat(CONCAT(CHAR(95),CHAR(33),CHAR(64),CHAR(52),CHAR(100),CHAR(105),CHAR(108),CHAR(101),CHAR(109),CHAR(109),CHAR(97)),0x3a,floor(rand()*2))x from (select 1 union select 2)a group by x limit 1)))Duplicate entry '_!@4dilemma:1' for key 1SELECT v.variableid AS variable_id,v.trackerid AS tracker_id,v.name AS name,v.datatype AS type FROM variables AS v WHERE v.trackerid IN ((select 1 and row(1,1)>(select count(*),concat(CONCAT(CHAR(95),CHAR(33),CHAR(64),CHAR(52),CHAR(100),CHAR(105),CHAR(108),CHAR(101),CHAR(109),CHAR(109),CHAR(97)),0x3a,floor(rand()*2))x from (select 1 union select 2)a group by x limit 1)))Duplicate entry '_!@4dilemma:0' for key 1document.write("");
SQL Injection occurs when data input for example by a user is interpreted as a SQL command rather than normal data by the backend database. This is an extremely common vulnerability and its successful exploitation can have critical implications. Even though Netsparker believes that there is a SQL Injection in here it could not confirm it. There can be numerous reasons for Netsparker not being able to confirm this. We strongly recommend investigating the issue manually to ensure that it is an SQL Injection and that it needs to be addressed. You can also consider sending the details of this issue to us, in order that we can address this issue for the next time and give you a more precise result.
Impact
Depending on the backend database, database connection settings and the operating system, an attacker can mount one or more of the following type of attacks successfully:
Reading, Updating and Deleting arbitrary data from the database
Executing commands on the underlying operating system
Reading, Updating and Deleting arbitrary tables from the database
Actions to Take
See the remedy for solution.
If you are not using a database access layer (DAL) within the architecture consider its benefits and implement if appropriate. As a minimum the use of s DAL will help centralize the issue and its resolution. You can also use an ORM (object relational mapping). Most ORM systems use parameterized queries and this can solve many if not all SQL Injection based problems.
Locate all of the dynamically generated SQL queries and convert them to parameterised queries. (If you decide to use a DAL/ORM, change all legacy code to use these new libraries)
Monitor and review weblogs and application logs in order to uncover active or previous exploitation attempts.
Remedy
A very robust method for mitigating the threat of SQL Injection based vulnerabilities is to use parameterized queries (prepared statements). Almost all modern languages provide built in libraries for this. Wherever possible do not create dynamic SQL queries or SQL queries with string concatenation.
Required Skills for Successful Exploitation
There are numerous freely available tools to test for SQL Injection vulnerabilities. This is a complex area with many dependencies, however it should be noted that the numerous resources available in this area have raised both attacker awareness of the issues and their ability to discover and leverage them. SQL Injection is one of the most common web application vulnerabilities.
SELECT t.clientid AS advertiser_id,t.trackerid AS tracker_id,t.trackername AS name,t.description AS description,t.viewwindow AS viewwindow,t.clickwindow AS clickwindow,t.blockwindow AS blockwindow,t.appendcode AS appendcode FROM trackers AS t WHERE t.trackerid=%27You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '%27' at line 1SELECT v.variableid AS variable_id,v.trackerid AS tracker_id,v.name AS name,v.datatype AS type FROM variables AS v WHERE v.trackerid=%27You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '%27' at line 1document.write("");
A Cookie was not marked as secure and transmitted over HTTPS. This means the cookie could potentially be stolen by an attacker who can successfully intercept and decrypt the traffic or following a successful MITM (Man in the middle) attack.
Impact
This cookie will be transmitted over a HTTP connection, therefore if this cookie is important (such as a session cookie) an attacker might intercept it and hijack a victim's session. If the attacker can carry out a MITM attack, he/she can force victim to make a HTTP request to steal the cookie.
Actions to Take
See the remedy for solution.
Mark all cookies used within the application as secure. (If the cookie is not related to authentication or does not carry any personal information you do not have to mark it as secure.))
Remedy
Mark all cookies used within the application as secure.
Required Skills for Successful Exploitation
To exploit this issue, the attacker needs to be able to intercept traffic. This generally requires local access to the web server or victim's network. Attackers need to be understand layer 2, have physical access to systems either as way points for the traffic, or locally (have gained access to) to a system between the victim and the web server.
Netsparker identified that the target web site is connecting to the backend database by using a user that has administrative privileges. This issue has been confirmed by checking the connection privileges via an identified SQL Injection vulnerability in the application.
Impact
This can allow an attacker to gain extra privileges via SQL Injection attacks. Here is the list of attacks that the attacker might carry out:
Gain full access to the database server.
Gain a reverse shell to the database server and execute commands on the underlying operating system.
Access the database with full permissions. Where it may be possible to read, update or delete arbitrary data from the database.
Furthermore, depending on the platform and the database system user an attacker might carry out a privilege escalation attack to gain administrator access to the target system.
Remedy
Create a database user with the least possible permissions for your application and connect to the database with that user. Always follow the principle of providing the least privileges for all users and applications.
SELECT t.clientid AS advertiser_id,t.trackerid AS tracker_id,t.trackername AS name,t.description AS description,t.viewwindow AS viewwindow,t.clickwindow AS clickwindow,t.blockwindow AS blockwindow,t.appendcode AS appendcode FROM trackers AS t WHERE t.trackerid IN ((select 1 and row(1,1)>(select count(*),concat(CONCAT(CHAR(95),CHAR(33),CHAR(64),CHAR(52),CHAR(100),CHAR(105),CHAR(108),CHAR(101),CHAR(109),CHAR(109),CHAR(97)),0x3a,floor(rand()*2))x from (select 1 union select 2)a group by x limit 1)))Duplicate entry '_!@4dilemma:1' for key 1SELECT v.variableid AS variable_id,v.trackerid AS tracker_id,v.name AS name,v.datatype AS type FROM variables AS v WHERE v.trackerid IN ((select 1 and row(1,1)>(select count(*),concat(CONCAT(CHAR(95),CHAR(33),CHAR(64),CHAR(52),CHAR(100),CHAR(105),CHAR(108),CHAR(101),CHAR(109),CHAR(109),CHAR(97)),0x3a,floor(rand()*2))x from (select 1 union select 2)a group by x limit 1)))Duplicate entry '_!@4dilemma:0' for key 1document.write("");
Netsparker identified Open Policy Crossdomain.xml file.
Impact
Open Policy Crossdomain.xml file allows other SWF files to make HTTP requests to your web server and see its response. This can be used for accessing one time tokens and CSRF nonces to bypass CSRF restrictions.
Remedy
Configure your Crossdomain.xml to prevent access from everywhere to your domain.
XSS (Cross-site Scripting) allows an attacker to execute a dynamic script (Javascript, VbScript) in the context of the application. This allows several different attack opportunities, mostly hijacking the current session of the user or changing the look of the page by changing the HTML on the fly to steal the user's credentials. This happens because the input entered by a user has been interpreted as HTML/Javascript/VbScript by the browser.
Netsparker believes that there is a XSS (Cross-site Scripting) in here it could not confirm it. We strongly recommend investigating the issue manually to ensure that it is an XSS (Cross-site Scripting) and needs to be addressed.
XSS targets the users of the application instead of the server. Although this is a limitation, since it allows attackers to hijack other users' session, an attacker might attack an administrator to gain full control over the application.
Impact
There are many different attacks that can be leveraged through the use of XSS, including:
Hi-jacking users' active session
Changing the look of the page within the victims browser.
Mounting a successful phishing attack.
Intercept data and perform man-in-the-middle attacks.
Remedy
The issue occurs because the browser interprets the input as active HTML, Javascript or VbScript. To avoid this, all input and output from the application should be filtered / encoded. Output should be filtered / encoded according to the output format and location.
There are a number of pre-defined, well structured white-list libraries available for many different environments, good examples of these include, OWASP Reform and Microsoft Anti Cross-site Scripting libraries are good examples.
Due to content-type of the response exploitation of this vulnerability might not be possible in all browsers or might not be possible at all. Content-type indicates that there is a possibility of exploitation by changing the attack however Netsparker does not support confirming these issues. You need to manually confirm this problem. Generally lack of filtering in the response can cause Cross-site Scripting vulnerabilities in browsers with auto mime sniffing such as Internet Explorer.
Request
GET /www/delivery/tjs.php?trackerid='%22--%3E%3C/style%3E%3C/script%3E%3Cscript%3Enetsparker(0x000073)%3C/script%3E&r=705910 HTTP/1.1 User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322) Cache-Control: no-cache Host: s1.srtk.net Cookie: sessionID=phpads4e1c583f94ad85.71513255 Accept-Encoding: gzip, deflate
SELECT t.clientid AS advertiser_id,t.trackerid AS tracker_id,t.trackername AS name,t.description AS description,t.viewwindow AS viewwindow,t.clickwindow AS clickwindow,t.blockwindow AS blockwindow,t.appendcode AS appendcode FROM trackers AS t WHERE t.trackerid=\'\"--></style></script><script>netsparker(0x000073)</script>You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '\'\"--></style></script><script>netsparker(0x000073)</script>' at line 1SELECT v.variableid AS variable_id,v.trackerid AS tracker_id,v.name AS name,v.datatype AS type FROM variables AS v WHERE v.trackerid=\'\"--></style></script><script>netsparker(0x000073)</script>You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '\'\"--></style></script><script>netsparker(0x000073)</script>' at line 1document.write("");
"Auto Complete" was enabled in one or more of the form fields. These were either "password" fields or important fields such as "Credit Card".
Impact
Data entered in these fields will be cached by the browser. An attacker who can access the victim's browser could steal this information. This is especially important if the application is commonly used in shared computers such as cyber cafes or airport terminals.
Remedy
Add the attribute autocomplete="off" to the form tag or to individual "input" fields.
Actions to Take
See the remedy for the solution.
Find all instances of inputs which store private data and disable autocomplete. Fields which contain data such as "Credit Card" or "CCV" type data should not be cached. You can allow the application to cache usernames and remember passwords, however, in most cases this is not recommended.
Re-scan the application after addressing the identified issues to ensure that all of the fixes have been applied properly.
Required Skills for Successful Exploitation
Dumping all data from a browser can be fairly easy and there exist a number of automated tools to undertake this. Where the attacker cannot dump the data, he/she could still browse the recently visited websites and activate the auto-complete feature to see previously entered values.
Cookie was not marked as HTTPOnly. HTTPOnly cookies can not be read by client-side scripts therefore marking a cookie as HTTPOnly can provide an additional layer of protection against Cross-site Scripting attacks..
Impact
During a Cross-site Scripting attack an attacker might easily access cookies and hijack the victim's session.
Actions to Take
See the remedy for solution
Consider marking all of the cookies used by the application as HTTPOnly (After these changes javascript code will not able to read cookies.
Remedy
Mark the cookie as HTTPOnly. This will be an extra layer of defence against XSS. However this is not a silver bullet and will not protect the system against Cross-site Scripting attacks. An attacker can use a tool such as XSS Tunnel to bypass HTTPOnly protection.
Netsparker identified that the target web server is an Apache server. This was disclosed through the HTTP response. This information can help an attacker to gain a greater understanding of the systems in use and potentially develop further attacks targeted at the specific version of Apache.
Impact
An attacker can search for specific security vulnerabilities for the version of Apache identified within the SERVER header.
Remedy
Configure your web server to prevent information leakage from the SERVER header of its HTTP response.
Netsparker identified that the target web server is disclosing the PHP version in use through the HTTP response. This information can help an attacker to gain a greater understanding of the systems in use and potentially develop further attacks targeted at the specific version of PHP.
Impact
An attacker can look for specific security vulnerabilities for the version identified. Also the attacker can use this information in conjunction with the other vulnerabilities in the application or the web server.
The error message may disclose sensitive information and this information can be used by an attacker to mount new attacks or to enlarge the attack surface. In rare conditions this may be a clue for an SQL Injection vulnerability. Most of the time Netsparker will detect and report that problem separately.
Remedy
Do not provide any error messages on production environments. Save error messages with a reference number to a backend storage such as a text file or database, then show this number and a static user-friendly error message to the user.
SELECT t.clientid AS advertiser_id,t.trackerid AS tracker_id,t.trackername AS name,t.description AS description,t.viewwindow AS viewwindow,t.clickwindow AS clickwindow,t.blockwindow AS blockwindow,t.appendcode AS appendcode FROM trackers AS t WHERE t.trackerid=\"& ping -n 26 127.0.0.1 &You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '\"& ping -n 26 127.0.0.1 &' at line 1SELECT v.variableid AS variable_id,v.trackerid AS tracker_id,v.name AS name,v.datatype AS type FROM variables AS v WHERE v.trackerid=\"& ping -n 26 127.0.0.1 &You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '\"& ping -n 26 127.0.0.1 &' at line 1document.write("");
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"><html><head><title>403 Forbidden</title></head><body><h1>Forbidden</h1><p>You don't have permission to access /www/delivery/on this server.</p><hr></body></html>
Netsparker identified that the target web site is using a MySQL Server. This is generally not a security issue and is reported here for information purposes.
Impact
This issue is reported as additional information only, there is no direct impact arising from this issue.
SELECT t.clientid AS advertiser_id,t.trackerid AS tracker_id,t.trackername AS name,t.description AS description,t.viewwindow AS viewwindow,t.clickwindow AS clickwindow,t.blockwindow AS blockwindow,t.appendcode AS appendcode FROM trackers AS t WHERE t.trackerid IN ((select 1 and row(1,1)>(select count(*),concat(CONCAT(CHAR(95),CHAR(33),CHAR(64),CHAR(52),CHAR(100),CHAR(105),CHAR(108),CHAR(101),CHAR(109),CHAR(109),CHAR(97)),0x3a,floor(rand()*2))x from (select 1 union select 2)a group by x limit 1)))Duplicate entry '_!@4dilemma:1' for key 1SELECT v.variableid AS variable_id,v.trackerid AS tracker_id,v.name AS name,v.datatype AS type FROM variables AS v WHERE v.trackerid IN ((select 1 and row(1,1)>(select count(*),concat(CONCAT(CHAR(95),CHAR(33),CHAR(64),CHAR(52),CHAR(100),CHAR(105),CHAR(108),CHAR(101),CHAR(109),CHAR(109),CHAR(97)),0x3a,floor(rand()*2))x from (select 1 union select 2)a group by x limit 1)))Duplicate entry '_!@4dilemma:0' for key 1document.write("");
Netsparker found e-mail addresses on the web site.
Impact
E-mail addresses discovered within the application can be used by both spam email engines and also brute force tools. Furthermore valid email addresses may lead to social engineering attacks .
Remedy
Use generic email addresses such as contact@ or info@ for general communications, remove user/people specific e-mail addresses from the web site, should this be required use submission forms for this purpose.
/*+---------------------------------------------------------------------------+| Max Media Manager v0.3 || ================= || || Copyright (c) 2003-2005 m3 Media Services Limited || For contact details, see: http://www.m3.net/ || || Copyright (c) 2000-2003 the phpAdsNew developers || For contact details, see: http://www.phpadsnew.com/ || || This program is free software; you can redistribute it and/or modify || it under the terms of the GNU General Public License as published by || the Free Software Foundation; either version 2 of the License, or || (at your option) any later version. || || This program is distributed in the hope that it will be useful, || but WITHOUT ANY WARRANTY; without even the implied warranty of || MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the || GNU General Public License for more details. || || You should have received a copy of the GNU General Public License || along with this program; if not, write to the Free Software || Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |+---------------------------------------------------------------------------+$Id: js-gui.js 4320 2006-02-28 15:32:32Z matteo@beccati.com $*//*********************************************************//* Enable accesskeys in IE *//*********************************************************/var accessKeyEnabled = true;function useAccessKey (evt) { if (accessKeyEnabled == true) { if (event.altKey) { event.srcElement.click(); } } else { event.srcElement.blur(); accessKeyEnabled = true; }}function releaseAccessKey() { if (accessKeyEnabled == false) { accessKeyEnabled = true; }}function initAccessKey() { if (navigator.appName == "Microsoft Internet Explorer") { for (i=0;i<document.all.length;i++) { a = document.all(i); if (a.tagName == 'A' && a.accessKey != '') { a.blur(); a.onfocus = useAccessKey; } } if (event.altKey) { accessKeyEnabled = false; document.onkeyup = releaseAccessKey; setTimeout ('releaseAccessKey()', 100); } }}/*********************************************************//* General functions *//*********************************************************/function findObj(n, d) { var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=findObj(n,d.layers[i].document); if(!x && document.getElementById) x=document.getElementById(n); return x;}function openWindow(theURL,winName,features) { window.open(theURL,winName,features); return false;}function setTextOfLayer(objName,newText) { while (obj = document.getElementById(objName)) { with (obj) if (document.layers) {document.write(unescape(newText)); document.close();} else innerHTML = unescape(newText); obj.id = ''; }}/*********************************************************//* Confirm form submit *//*********************************************************/function confirm_submit(o, str){ f = findObj(o); if(confirm(str)) f.submit();}/*********************************************************//* Open Search window *//*********************************************************/function search_window(keyword, where){ path = where+'?keyword='+keyword; SearchWindow = window.open("","Search","toolbar=no,location=no,status=no,scrollbars=yes,width=600,height=500,innerheight=50,screenX=100,screenY=100,pageXoffset=100,pageYoffset=100,resizable=yes"); if (SearchWindow.frames.length == 0) { SearchWindow = window.open(path,"Search","toolbar=no,location=no,status=no,scrollbars=yes,width=700,height=600,innerheight=50,screenX=100,screenY=100,pageXoffset=100,pageYoffset=100,resizable=yes"); } else { SearchWindow.location.href = path; SearchWindow.focus(); }}/*********************************************************//* Focus the first field of the login screen *//*********************************************************/function login_focus(){ if (document.login.username.value == '') { document.login.username.focus(); } else { document.login.password.focus(); }}/*********************************************************//* Copy the contents of a field to the clipboard *//*********************************************************/function max_CopyClipboard(obj){ obj = findObj(obj); if (obj) { window.clipboardData.setData('Text', obj.value); }}/*********************************************************//* Setup all event handlers for use on the page *//*********************************************************/function initPage(){ initAccessKey(); boxrow_init();}