黑马程序员技术交流社区

标题: Sql注入攻击 [打印本页]

作者: 朱君    时间: 2013-3-12 11:50
标题: Sql注入攻击
Sql注入攻击的那个字符串怎么写来着?
作者: 肖彬    时间: 2013-3-12 11:58
就是在登陆的时候将sql脚本写在登陆的用户名和密码中  、

比如的  username select * from tableName where 1=1
作者: 董华阳    时间: 2013-3-13 12:56
比如你要在数据库里查出用户名
select  *  from table where Name = " ";
你可以在登录的名后面这样写 name + or 1=1
好像是这样的  现在没发帮你 具体调试  
作者: 曾玉锋    时间: 2013-3-13 13:27
在数据库里面创建一个存储过程,有两个输入参数,@sname,@spwd
Create proc proc_stu
@sname varchar(50),
@spwd varchar(50)
as
   declare  @count int;
   select count(*) from stuinfo where sname=@sname and spwd=@spwd;
   if(count>0)
     //.....操作代码
go
exec proc_stu 第一个参数,第二个参数

如果传入的第一个参数类似于 " 任意字符 or 1=1 --"  ,则在数据库里面select.....where sname=任意字符 or 1=1 --.....

在数据库中 "--"表示注释的意思,而组成的sql语句where条件 始终为true  ,这就没有起到验证信息的作用,也就形成了注入攻击。






欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/) 黑马程序员IT技术论坛 X3.2