Penetration Testing mailing list archives
RE: custom xp_cmdshell on SQL Server
From: "Victor Chapela" <victor () sm4rt com>
Date: Sun, 17 Sep 2006 12:09:55 -0500
Hi Andy, 1) The problem with CREATE PROCEDURE is that it has to be the first statement in a batch query. Within a sql injection you are always, at least, the second statement after the one you injected into. 2) Sometimes xp_cmdshell seems not to be working (especially if you are doing it through openrowset which ends up being blind). You may have SQL Server running with an unprivileged user. Did you try a ping to localhost and check for the 4 sec delay? That almost always works. 3) Even if you do get execution by restoring xp_cmdshell, injecting through openrowset has severe complications when trying complex queries. The best way I have found to overcome these limitations is by temporarily increasing privileges of the user you are going through. ' and 1=(select * from openrowset('SQLOLEDB','DRIVER={SQLServer};SERVER=<server>;UID=sa;PWD=<passwo rd>',N'select user; declare @u varchar(50); set @u = (select system_user); exec master.dbo.sp_addsrvrolemember @u, ''sysadmin'''))-- Regards, Victor Chapela ------------------------------------------------------------------------ This List Sponsored by: Cenzic Need to secure your web apps? Cenzic Hailstorm finds vulnerabilities fast. Click the link to buy it, try it or download Hailstorm for FREE. http://www.cenzic.com/products_services/download_hailstorm.php ------------------------------------------------------------------------
Current thread:
- custom xp_cmdshell on SQL Server Andy Lester (Sep 13)
- RE: custom xp_cmdshell on SQL Server Clemens, Dan (Sep 14)
- Re: custom xp_cmdshell on SQL Server Steven M Gill (Sep 15)
- Re: custom xp_cmdshell on SQL Server Stefano Zanero (Sep 15)
- RE: custom xp_cmdshell on SQL Server Victor Chapela (Sep 17)
- RE: custom xp_cmdshell on SQL Server Andy Lester (Sep 18)
- RE: custom xp_cmdshell on SQL Server Victor Chapela (Sep 20)
- RE: custom xp_cmdshell on SQL Server Andy Lester (Sep 18)
- <Possible follow-ups>
- Re: custom xp_cmdshell on SQL Server Zed Qyves (Sep 14)
- User group tool Bud Gordon (Sep 14)
- Re: User group tool Tim (Sep 14)
- Re: User group tool John Skinner (Sep 15)
- RE: User group tool ballares (Sep 15)
- RE: User group tool Weir, Jason (Sep 15)
- User group tool Bud Gordon (Sep 14)
- RE: custom xp_cmdshell on SQL Server Andy Lester (Sep 18)