问大家一个问题,什么叫SQL注入式攻击???,SQL语句该如何写,比如我的一个查询语句判断当前登录用户是否合法,可以这样:
select id,name,password from czy where id="& textbox1.text &" and password="& textbox2.text &"
可是为了防止注入式攻击,我该如何写才对呢??

解决方案 »

  1.   

    http://chichi.6to23.com/Article_Show2.asp?ArticleID=1686http://www.911m.com/2005/8-11/1475.htm
      

  2.   

    所谓注入式攻击,就是客户通过输入使sql语句变成   where id="kllsld" and password="lll" or 1=1
    这种句子。要防止注入式攻击,可以使用存储过程,也可以采用参数的方法 如select id,name,password from czy where id=@IdName and password=@PassWord
    然后把IdName,Password加入参数表,并赋值
      

  3.   

    关键是不要连接字符串式的组合sql====CSDN 小助手 V2.0 2005年10月16日发布====
    CSDN小助手是一款脱离浏览器也可以访问Csdn论坛的软件
    界面:http://blog.csdn.net/Qqwwee_Com/archive/2005/10/16/504620.aspx
    下载:http://szlawbook.com/csdnv2/csdnv2.rar为神六喝彩,向所有科技工作者致敬!
    拒绝日货。
      

  4.   

    http://community.csdn.net/Expert/topicview.asp?id=3803170
      

  5.   

    SQL注入式攻击是利用是指利用设计上的漏洞,在目标服务器上运行Sql命令以及进行其他方式的攻击
    动态生成Sql命令时没有对用户输入的数据进行验证是Sql注入攻击得逞的主要原因。
    所以防范的时候需要对用户的输入进行检查。特别式一些特殊字符,比如单引号,双引号,分号,逗号,冒号,连接号等进行转换或者过滤。需要过滤的特殊字符及字符串有: net user  xp_cmdshell  /add  exec master.dbo.xp_cmdshell
       net localgroup administrators  select  count   Asc   char   mid  '   :
       "   insert   delete from   drop table   update   truncate   from   %
      

  6.   

    http://www.cnblogs.com/weekzero/articles/182675.htmlSQL注入天书之ASP注入漏洞全接触
    .net也是一样的
      

  7.   

    sql server 用存储过程
    access 用参数的方式
      

  8.   

    方法:
    1、select id,name,password from czy where id="& textbox1.text &" and password="& textbox2.text &"写为select id,name,password from czy where name="& textbox1.text &"
    然后再根据查到的密码判断密码是否正确。2、
    Replace("'","");
    转化'3、
    用SqlParameter传参数。4、用正则式在后台判断textbox1.text的值是否含有有害字符。