<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/'><id>tag:blogger.com,1999:blog-5864808148338766272.post2784905759304183044..comments</id><updated>2009-10-31T15:50:30.952+01:00</updated><title type='text'>Comments on Devels playground: Union select column count</title><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://devels-playground.blogspot.com/feeds/2784905759304183044/comments/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5864808148338766272/2784905759304183044/comments/default'/><link rel='alternate' type='text/html' href='http://devels-playground.blogspot.com/2007/08/union-select-column-count.html'/><author><name>Gnarf</name><uri>http://www.blogger.com/profile/13965983227056280166</uri><email>noreply@blogger.com</email></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>12</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-5864808148338766272.post-349531896731329798</id><published>2009-10-31T15:50:30.952+01:00</published><updated>2009-10-31T15:50:30.952+01:00</updated><title type='text'>so here is a question. You can inject on a site, h...</title><content type='html'>so here is a question. You can inject on a site, however when you perform the UNION ALL SELECT 1,2,3,4/* the web application bombs to false stating that the request is forbidden (returning a false?). As per testing the web application what would be the next logical step? I have run through every case i can think of. &lt;br /&gt;&lt;br /&gt;The request returns true for max_allowed_packet, version and for:&lt;br /&gt;&lt;br /&gt;order by 1,2,3,4/* where 4 being the highest in columns. &lt;br /&gt;&lt;br /&gt;When entering a select, or union it gives the same error. However, when inputting the suggested LIMIT 0 Union it also bombs...? I&amp;#39;m confused. &lt;br /&gt;&lt;br /&gt;The version did return true for =5 so i do know the web application is running version 5. &lt;br /&gt;&lt;br /&gt;More so, are there any other resources like this that i can learn from to help me along the way?&lt;br /&gt;&lt;br /&gt;Any suggestions would be a great help. &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Thanks.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5864808148338766272/2784905759304183044/comments/default/349531896731329798'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5864808148338766272/2784905759304183044/comments/default/349531896731329798'/><link rel='alternate' type='text/html' href='http://devels-playground.blogspot.com/2007/08/union-select-column-count.html?showComment=1257000630952#c349531896731329798' title=''/><author><name>Anonymous</name><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://devels-playground.blogspot.com/2007/08/union-select-column-count.html' ref='tag:blogger.com,1999:blog-5864808148338766272.post-2784905759304183044' source='http://www.blogger.com/feeds/5864808148338766272/posts/default/2784905759304183044' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-5864808148338766272.post-6678569610956253018</id><published>2008-09-09T05:29:00.000+02:00</published><updated>2008-09-09T05:29:00.000+02:00</updated><title type='text'>You will get alot more on www.unkn0wnfunk.com/foru...</title><content type='html'>You will get alot more on www.unkn0wnfunk.com/forum/&lt;BR/&gt;&lt;BR/&gt;&lt;BR/&gt;Cheers</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5864808148338766272/2784905759304183044/comments/default/6678569610956253018'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5864808148338766272/2784905759304183044/comments/default/6678569610956253018'/><link rel='alternate' type='text/html' href='http://devels-playground.blogspot.com/2007/08/union-select-column-count.html?showComment=1220930940000#c6678569610956253018' title=''/><author><name>paul gillam</name><uri>www.unkn0wnfunk.com</uri><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://devels-playground.blogspot.com/2007/08/union-select-column-count.html' ref='tag:blogger.com,1999:blog-5864808148338766272.post-2784905759304183044' source='http://www.blogger.com/feeds/5864808148338766272/posts/default/2784905759304183044' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-5864808148338766272.post-8166670426583110057</id><published>2008-01-08T00:06:00.000+01:00</published><updated>2008-01-08T00:06:00.000+01:00</updated><title type='text'>Hi Funky, i wrote a new article about this, i hope...</title><content type='html'>Hi Funky, i wrote a new article about this, i hope you'll find your answer there ;)&lt;BR/&gt;&lt;BR/&gt;http://devels-playground.blogspot.com/2008/01/sql-injection-getting-table-names.html&lt;BR/&gt;&lt;BR/&gt;Good luck!</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5864808148338766272/2784905759304183044/comments/default/8166670426583110057'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5864808148338766272/2784905759304183044/comments/default/8166670426583110057'/><link rel='alternate' type='text/html' href='http://devels-playground.blogspot.com/2007/08/union-select-column-count.html?showComment=1199747160000#c8166670426583110057' title=''/><author><name>Gnarf</name><uri>http://www.blogger.com/profile/13965983227056280166</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='11970261543216037829'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://devels-playground.blogspot.com/2007/08/union-select-column-count.html' ref='tag:blogger.com,1999:blog-5864808148338766272.post-2784905759304183044' source='http://www.blogger.com/feeds/5864808148338766272/posts/default/2784905759304183044' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-5864808148338766272.post-6803961570623733582</id><published>2008-01-05T18:10:00.000+01:00</published><updated>2008-01-05T18:10:00.000+01:00</updated><title type='text'>Ahh , I'm Very Thankfull To You , But Still There'...</title><content type='html'>Ahh , I'm Very Thankfull To You , But Still There's Some Prob For Me.....&lt;BR/&gt;&lt;BR/&gt;       I Have Learn't To How To Identify , Is The Site Is Vulnerable Or Not , By Using This Query -&lt;BR/&gt;&lt;BR/&gt;news.php=12+1=0+union+select+1,2,3,4,5,6,7,8,9,10,11/*&lt;BR/&gt;&lt;BR/&gt;&lt;BR/&gt;Ok , Now I Got The First Point...&lt;BR/&gt;&lt;BR/&gt;But , I'm Really Unable To Sort To How To Get The Needed Tables From The Victim Site ?????&lt;BR/&gt;&lt;BR/&gt;Just Like -&lt;BR/&gt;&lt;BR/&gt;customers&lt;BR/&gt;orders&lt;BR/&gt;tbl_users&lt;BR/&gt;shir_user&lt;BR/&gt;blah_user&lt;BR/&gt;&lt;BR/&gt;I Mean We Can't Just Guess These Tables ?????&lt;BR/&gt;&lt;BR/&gt;How To Get Them ???&lt;BR/&gt;&lt;BR/&gt;&lt;BR/&gt;Plzz Buddy , I'm Also An Noob And Really Wana Learn....&lt;BR/&gt;&lt;BR/&gt;Ur Help Will Be Appreciated.....</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5864808148338766272/2784905759304183044/comments/default/6803961570623733582'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5864808148338766272/2784905759304183044/comments/default/6803961570623733582'/><link rel='alternate' type='text/html' href='http://devels-playground.blogspot.com/2007/08/union-select-column-count.html?showComment=1199553000000#c6803961570623733582' title=''/><author><name>FuNkY</name><uri>http://xxxxxxxxvipxxxxxxxx.blogspot.com/</uri><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://devels-playground.blogspot.com/2007/08/union-select-column-count.html' ref='tag:blogger.com,1999:blog-5864808148338766272.post-2784905759304183044' source='http://www.blogger.com/feeds/5864808148338766272/posts/default/2784905759304183044' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-5864808148338766272.post-4320049219000250865</id><published>2007-08-23T09:40:00.000+02:00</published><updated>2007-08-23T09:40:00.000+02:00</updated><title type='text'>Thats right :) No problem with the 'noob' thing, e...</title><content type='html'>Thats right :) No problem with the 'noob' thing, everyone starts somewhere right ;)</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5864808148338766272/2784905759304183044/comments/default/4320049219000250865'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5864808148338766272/2784905759304183044/comments/default/4320049219000250865'/><link rel='alternate' type='text/html' href='http://devels-playground.blogspot.com/2007/08/union-select-column-count.html?showComment=1187854800000#c4320049219000250865' title=''/><author><name>Gnarf</name><uri>http://www.blogger.com/profile/13965983227056280166</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='11970261543216037829'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://devels-playground.blogspot.com/2007/08/union-select-column-count.html' ref='tag:blogger.com,1999:blog-5864808148338766272.post-2784905759304183044' source='http://www.blogger.com/feeds/5864808148338766272/posts/default/2784905759304183044' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-5864808148338766272.post-3384219819621692591</id><published>2007-08-23T00:56:00.000+02:00</published><updated>2007-08-23T00:56:00.000+02:00</updated><title type='text'>Ahh i get it now. I just thought the numbers in "S...</title><content type='html'>Ahh i get it now. I just thought the numbers in "SELECT 1,2" were the row numbers, when infact it is just whatever you want to add to the new row. Thanks alot for being so noob friendly :)</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5864808148338766272/2784905759304183044/comments/default/3384219819621692591'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5864808148338766272/2784905759304183044/comments/default/3384219819621692591'/><link rel='alternate' type='text/html' href='http://devels-playground.blogspot.com/2007/08/union-select-column-count.html?showComment=1187823360000#c3384219819621692591' title=''/><author><name>Anonymous</name><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://devels-playground.blogspot.com/2007/08/union-select-column-count.html' ref='tag:blogger.com,1999:blog-5864808148338766272.post-2784905759304183044' source='http://www.blogger.com/feeds/5864808148338766272/posts/default/2784905759304183044' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-5864808148338766272.post-6531259298390462434</id><published>2007-08-22T23:38:00.000+02:00</published><updated>2007-08-22T23:38:00.000+02:00</updated><title type='text'>Nope those 1,2 results can be anything you want em...</title><content type='html'>Nope those 1,2 results can be anything you want em to be.. If the current db user would have file rights you could display the /etc/passwd file using:&lt;BR/&gt;&lt;BR/&gt;SELECT page_title, page_url_id FROM page WHERE page_id = 1 LIMIT 0 union select load_file('/etc_passwd'),2;&lt;BR/&gt;&lt;BR/&gt;Or anything from the database (you have read rights to) using:&lt;BR/&gt;SELECT page_title, page_url_id FROM page WHERE page_id = 1 LIMIT 0 union select any_column,any_column FROM any_table;&lt;BR/&gt;&lt;BR/&gt;The 1's and 2's are just easy test values ;) After that the table / column guessing starts.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5864808148338766272/2784905759304183044/comments/default/6531259298390462434'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5864808148338766272/2784905759304183044/comments/default/6531259298390462434'/><link rel='alternate' type='text/html' href='http://devels-playground.blogspot.com/2007/08/union-select-column-count.html?showComment=1187818680000#c6531259298390462434' title=''/><author><name>Gnarf</name><uri>http://www.blogger.com/profile/13965983227056280166</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='11970261543216037829'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://devels-playground.blogspot.com/2007/08/union-select-column-count.html' ref='tag:blogger.com,1999:blog-5864808148338766272.post-2784905759304183044' source='http://www.blogger.com/feeds/5864808148338766272/posts/default/2784905759304183044' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-5864808148338766272.post-6471318086808383214</id><published>2007-08-22T19:08:00.000+02:00</published><updated>2007-08-22T19:08:00.000+02:00</updated><title type='text'>I must admit im still a little confused. Maybe im ...</title><content type='html'>I must admit im still a little confused. Maybe im being a little slow here, but that only shows the number id of the tables used, right? What is the next move then?&lt;BR/&gt;&lt;BR/&gt;(gdamn, i feel noobish)&lt;BR/&gt;Steven</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5864808148338766272/2784905759304183044/comments/default/6471318086808383214'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5864808148338766272/2784905759304183044/comments/default/6471318086808383214'/><link rel='alternate' type='text/html' href='http://devels-playground.blogspot.com/2007/08/union-select-column-count.html?showComment=1187802480000#c6471318086808383214' title=''/><author><name>Anonymous</name><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://devels-playground.blogspot.com/2007/08/union-select-column-count.html' ref='tag:blogger.com,1999:blog-5864808148338766272.post-2784905759304183044' source='http://www.blogger.com/feeds/5864808148338766272/posts/default/2784905759304183044' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-5864808148338766272.post-8907967005579404051</id><published>2007-08-22T10:03:00.000+02:00</published><updated>2007-08-22T10:03:00.000+02:00</updated><title type='text'>Ah, I get your problem :) Because the union select...</title><content type='html'>Ah, I get your problem :) Because the union select query results are 'added' to the original query results, the column names will stay intact. The column names used in the union select directive are discarded.&lt;BR/&gt;&lt;BR/&gt;Here is a simple example from the mysql command line:&lt;BR/&gt;&lt;BR/&gt;(the layout is a bit mixed up, but it should help you understand  ;)&lt;BR/&gt;&lt;BR/&gt;mysql&gt; select page_title, page_url_id FROM page WHERE page_id = 1;&lt;BR/&gt;+------------+-------------+&lt;BR/&gt;| page_title | page_url_id |&lt;BR/&gt;+------------+-------------+&lt;BR/&gt;| Home page  | home        |&lt;BR/&gt;+------------+-------------+&lt;BR/&gt;1 row in set (0.00 sec)&lt;BR/&gt;&lt;BR/&gt;mysql&gt; select page_title, page_url_id FROM page WHERE page_id = 1 LIMIT 0 union select 1,2;&lt;BR/&gt;+------------+-------------+&lt;BR/&gt;| page_title | page_url_id |&lt;BR/&gt;+------------+-------------+&lt;BR/&gt;| 1          | 2           |&lt;BR/&gt;+------------+-------------+&lt;BR/&gt;1 row in set (0.00 sec)</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5864808148338766272/2784905759304183044/comments/default/8907967005579404051'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5864808148338766272/2784905759304183044/comments/default/8907967005579404051'/><link rel='alternate' type='text/html' href='http://devels-playground.blogspot.com/2007/08/union-select-column-count.html?showComment=1187769780000#c8907967005579404051' title=''/><author><name>Gnarf</name><uri>http://www.blogger.com/profile/13965983227056280166</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='11970261543216037829'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://devels-playground.blogspot.com/2007/08/union-select-column-count.html' ref='tag:blogger.com,1999:blog-5864808148338766272.post-2784905759304183044' source='http://www.blogger.com/feeds/5864808148338766272/posts/default/2784905759304183044' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-5864808148338766272.post-5511062852633492991</id><published>2007-08-22T09:44:00.000+02:00</published><updated>2007-08-22T09:44:00.000+02:00</updated><title type='text'>Interesting, but there is something i still don't ...</title><content type='html'>Interesting, but there is something i still don't understand. Consider the following code:&lt;BR/&gt;&lt;BR/&gt;?php&lt;BR/&gt;mysql_connect("localhost","root","root");&lt;BR/&gt;mysql_select_db("test");&lt;BR/&gt;$a = $_GET['a'];&lt;BR/&gt;&lt;BR/&gt;$result = mysql_query("SELECT * FROM news where id =".$a);&lt;BR/&gt;while($row = mysql_fetch_array($result)) {&lt;BR/&gt;echo $row["subject"].$row["text"];&lt;BR/&gt;}&lt;BR/&gt;mysql_close();&lt;BR/&gt;?&lt;BR/&gt;&lt;BR/&gt;I understand how you can UNION this with another table, I just dont understand how you can make it echo other vars than what was intended. I mean how can $row["subject"] ever output a username or a password? Or do you use error messages for this somehow?&lt;BR/&gt;&lt;BR/&gt;Steven</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5864808148338766272/2784905759304183044/comments/default/5511062852633492991'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5864808148338766272/2784905759304183044/comments/default/5511062852633492991'/><link rel='alternate' type='text/html' href='http://devels-playground.blogspot.com/2007/08/union-select-column-count.html?showComment=1187768640000#c5511062852633492991' title=''/><author><name>Anonymous</name><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://devels-playground.blogspot.com/2007/08/union-select-column-count.html' ref='tag:blogger.com,1999:blog-5864808148338766272.post-2784905759304183044' source='http://www.blogger.com/feeds/5864808148338766272/posts/default/2784905759304183044' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-5864808148338766272.post-3496369003525911870</id><published>2007-08-22T09:20:00.000+02:00</published><updated>2007-08-22T09:20:00.000+02:00</updated><title type='text'>Hi there, thanks for the comment ;)The point of a ...</title><content type='html'>Hi there, thanks for the comment ;)&lt;BR/&gt;&lt;BR/&gt;The point of a union select query is to overwrite the expected results with other data. So if you have a news query like the above.&lt;BR/&gt;&lt;BR/&gt;SELECT * FROM `news` WHERE `news_id` = 121&lt;BR/&gt;&lt;BR/&gt;And we inject the following code:&lt;BR/&gt;http://www.domain.com/news.php?news=121 LIMIT 0 UNION SELECT 1,username,password,4,5,6,7,8,9,10,11,12 FROM users &lt;BR/&gt;&lt;BR/&gt;The actual query executed will become:&lt;BR/&gt;SELECT * FROM `news` WHERE `news_id` = 121 LIMIT 0 UNION SELECT 1,username,password,4,5,6,7,8,9,10,11,12 FROM users &lt;BR/&gt;&lt;BR/&gt;This means it will show a username and password, instead of the news title and author.&lt;BR/&gt;&lt;BR/&gt;This is a very simle example, but it shows the basic idea. You can inject SQL to get 'malicious' data from other tables, databases and sometimes you can even view server sided files using LOAD_FILE()</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5864808148338766272/2784905759304183044/comments/default/3496369003525911870'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5864808148338766272/2784905759304183044/comments/default/3496369003525911870'/><link rel='alternate' type='text/html' href='http://devels-playground.blogspot.com/2007/08/union-select-column-count.html?showComment=1187767200000#c3496369003525911870' title=''/><author><name>Gnarf</name><uri>http://www.blogger.com/profile/13965983227056280166</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='11970261543216037829'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://devels-playground.blogspot.com/2007/08/union-select-column-count.html' ref='tag:blogger.com,1999:blog-5864808148338766272.post-2784905759304183044' source='http://www.blogger.com/feeds/5864808148338766272/posts/default/2784905759304183044' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-5864808148338766272.post-2824502387501583569</id><published>2007-08-21T23:02:00.000+02:00</published><updated>2007-08-21T23:02:00.000+02:00</updated><title type='text'>Good post, but actually i knew that :) What i don'...</title><content type='html'>Good post, but actually i knew that :) What i don't know though is for what you can actually use a mysql injection point for (from a hackers perspective). I mean, you can't stack queries on mysql so in your "SELECT" example (which i think is the most common) you cant insert or drop anything. Infact, as far as I know you can only check if your querys are right, which means you have to do too much guessing for this to be usefull. Or am I wrong?</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5864808148338766272/2784905759304183044/comments/default/2824502387501583569'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5864808148338766272/2784905759304183044/comments/default/2824502387501583569'/><link rel='alternate' type='text/html' href='http://devels-playground.blogspot.com/2007/08/union-select-column-count.html?showComment=1187730120000#c2824502387501583569' title=''/><author><name>Anonymous</name><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://devels-playground.blogspot.com/2007/08/union-select-column-count.html' ref='tag:blogger.com,1999:blog-5864808148338766272.post-2784905759304183044' source='http://www.blogger.com/feeds/5864808148338766272/posts/default/2784905759304183044' type='text/html'/></entry></feed>