理解常用的登錄判斷
select * from user where username='admin' and password='123'
數據庫元信息
infomation_schema
懂PHP
php://input
php://input可以讀取沒有處理過的POST數據。
相較於$HTTP_RAW_POST_DATA而言,它給內存帶來的壓力較小,並且不需要特殊的php.ini設置。
php://input不能用於enctype=multipart/form-data
file_get_contents("php://input")獲取post數據的二進制流
with rollup:熟知偏門的SQL知識
select * from user group by id,name,age with rollup;
跟with rollup類似的還有with cube
獲取當前數據庫
select database()
獲取當前數據庫表
select table_name from information_schema.tables where table_schema='my_database'
SQL流程控制語句
SELECT Category =
CASE type
WHEN 'popular_comp' THEN 'Popular Computing'
WHEN 'mod_cook' THEN 'Modern Cooking'
WHEN 'business' THEN 'Business'
WHEN 'psychology' THEN 'Psychology'
WHEN 'trad_cook' THEN 'Traditional Cooking'
ELSE 'Not yet categorized'
END,
CAST(title AS varchar(25)) AS 'Shortened Title',
price AS Price
FROM titles
WHERE price IS NOT NULL
ORDER BY type, price
MySQL常用函數:不同數據庫不一樣
- ascii()
select ascii('1234');#返回1
SELECT ascii('1');#返回1
- substring(s from begIndex for length)
獲取子串
計時攻擊:服務器不返回具體信息
計時攻擊巧妙絕倫,雖然有運行SQL語句的權限,但是卻沒辦法獲取SQL輸出結果。
這時,可以通過時間來確定SQL輸出結果。
你雖然什么都沒說,但我看到你猶豫了。
case when (ascii(substring((select database()) from %d for 1))
& %d!=0)
then sleep(0.5)
else sleep(0)
end
對於長度為4的字符串,需要探測4×256次。
SQL中的空
select ''=0返回1
