问大家一个问题,什么叫SQL注入式攻击???,SQL语句该如何写,比如我的一个查询语句判断当前登录用户是否合法,可以这样:
select id,name,password from czy where id="& textbox1.text &" and password="& textbox2.text &"
可是为了防止注入式攻击,我该如何写才对呢??
select id,name,password from czy where id="& textbox1.text &" and password="& textbox2.text &"
可是为了防止注入式攻击,我该如何写才对呢??
这种句子。要防止注入式攻击,可以使用存储过程,也可以采用参数的方法 如select id,name,password from czy where id=@IdName and password=@PassWord
然后把IdName,Password加入参数表,并赋值
CSDN小助手是一款脱离浏览器也可以访问Csdn论坛的软件
界面:http://blog.csdn.net/Qqwwee_Com/archive/2005/10/16/504620.aspx
下载:http://szlawbook.com/csdnv2/csdnv2.rar为神六喝彩,向所有科技工作者致敬!
拒绝日货。
动态生成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 %
.net也是一样的
access 用参数的方式
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的值是否含有有害字符。