请问:
字符串已经将一个单引号替换成2个单引号后,还会有注入的可能吗,
如可能请给出例子。

解决方案 »

  1.   

    鬼知道还有什么不为我们所知的黑客技术,好像url后面带参数也会被注吧?
      

  2.   

    是这样的,我已经将1个单引号替换成2个单引号,
    并且每个页面的url参数都通过cint处理。
      

  3.   

    将有可能出现的关键字也进行适当替换,比如insert,update,or等等。
      

  4.   

    请给出,1个单引号转换成2个单引号后还能被注入的可能。
    例如:
    var str = "";
    sql="select * from table1 where field1='"+str+"'";
    //假如str是页面url传入的参数。
      

  5.   

    sql="select * from table1 where field1='"+str+"'";这种还是用参数比较妥当。
      

  6.   

    sql="select * from table1 where field1='"+str+"'";
    这种不会有注入了。
      

  7.   

    我总结了一下SQL注入,有几种方式,仅供参考:
    1。SqlParameters参数方式.例如:
       SqlCommand SqlCommand1 = new SqlCommand("insert into bug_picture(RBP_ID, RB_CODE,    RBP_NAME,RBP_FILES) VALUES(@RBP_ID, @RB_CODE, @RBP_NAME, @RBP_FILES) ");
                        SqlCommand1.CommandType = System.Data.CommandType.Text;
                        SqlCommand1.Connection = conSql;
                        SqlCommand1.Parameters.Add("@RBP_ID", System.Data.SqlDbType.Int, 4).Value = sPhotoID;
                        SqlCommand1.Parameters.Add("@RB_CODE", System.Data.SqlDbType.VarChar, 64).Value = bugCode;
                        SqlCommand1.Parameters.Add("@RBP_NAME", System.Data.SqlDbType.VarChar, 200).Value = BugPhotoName;
                        SqlCommand1.Parameters.Add("@RBP_FILES", System.Data.SqlDbType.Image, 2147483647).Value = buffer;
                        SqlCommand1.ExecuteNonQuery();2。参数数组方式。例如:
            public DataSet GetDataSetTaskHistory(params string[] strSQL)
            {
                string strQuery = "select * from vw_search_task_record";
                if (strSQL[0] != "")
                {
                    strQuery += " where task_id=" + strSQL[0] + " and taskrd_starttime>='" + strSQL[1] + "'" + " and taskrd_endtime<='" + strSQL[2] + "'";            }
            }3.SQL语句分析方式.分析语句中是否有不合法的注入单词.
      

  8.   

    就像“Knight94(愚翁) ( ) 信誉:110    Blog ”所讲的,采用参数形式是最安全的作法,不一定要用存储过程,因为ACCESS没人会去用存储过程吧我做的B/S程序都是用参数形式传递所有用户提交的东西
      

  9.   

    sql="select * from table1 where field1='"+str+"'";这种还是用参数比较妥当。
    如果str中有单引号呢str.replace("'","''");