sql - sp_MSforeachtable Abuse (Modification needed) -


recently hacked our database using sp_msforeachtable, multiline query if im right.

now question how can modify sys.sp_msforeachtable, using @command1 , other commands execute query in order drop our tables.

xxxx=censored db name (somehow spaces in front of use)  use xxxx;   exec sp_msforeachtable "alter table ? nocheck constraint all"; exec sp_msforeachtable @command1 = "drop table ?" 

then sql profiler shows:

select @mscat = ltrim(str(convert(int, 0x0002)))  exec(n'declare hcforeachtable cursor global select ''['' + replace(schema_name(syso.schema_id), n'']'', n'']]'') + '']'' + ''.'' + ''['' + replace(object_name(o.id), n'']'', n'']]'') + '']'' dbo.sysobjects o join sys.all_objects syso on o.id = syso.object_id '          + n' objectproperty(o.id, n''isusertable'') = 1 ' + n' , o.category & ' + @mscat + n' = 0 '          + @whereand)  declare hcforeachtable cursor global select '[' + replace(schema_name(syso.schema_id), n']', n']]') + ']' + '.' + '[' + replace(object_name(o.id), n']', n']]') + ']' dbo.sysobjects o join sys.all_objects syso on o.id = syso.object_id  objectproperty(o.id, n'isusertable') = 1  , o.category & 2 = 0   exec @retval = sys.sp_msforeach_worker @command1, @replacechar, @command2, @command3, 0  create table #qtemp (   /* temp command storage */                 qnum                int             not null,                 qchar               nvarchar(2000)  collate database_default null         ) 

could let me know how secure these things? sql profiler showing me application name php5, register page or login panel injection..


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -