纯属无聊,研究了下,如果程序中的登录语句是一条 select * from users where name ='' and pwd = ''这样的话,
可以录入' or '1'='1,密码' or '1'='1来注入进去,那如果是先判断是否有这个用户,然后再找出这个用户的密码,
然后和你录入的密码做比较,怎么办呢?    If rs.EOF = False Then  'a处
        myPW = oDBCon.GETEncryptStr(txtPW.Text)
        If TurnNull(rs("ur_pw")) = myPW Then
            mykind = 1
            tUser.sID = TurnNull(rs("ur_id"))
            tUser.sName = TurnNull(rs("ur_name"))
            tUser.sUPID = TurnNull(rs("ur_up_id"))
            Unload Me
            MDIMain.Show
        Else
            MsgBox "没有此ID或密码不正确!"
            TxtUser.SetFocus
            TxtUser.SelStart = 0
            TxtUser.SelLength = Len(TxtUser.Text)
        End If
    Else
        MsgBox "没有此ID或密码不正确!"
        TxtUser.SetFocus
        TxtUser.SelStart = 0
        TxtUser.SelLength = Len(TxtUser.Text)
    End If
我可以过 通过录入or '1'='1来让程序走进a处,但是比较密码就不行了,
高手来看看,怎么注入呢,当然也不要加上一行空值,那样是没有权限的,我试过
可以通过进入系统,但是没法获取权限。

解决方案 »

  1.   

    2楼的不行的,他不是一条语句的,是先select * from users where name = ''
    先判断有没有这个用户,有的话程序走到A处,然后再比较select * from users where name = ''
    这句所提取的密码是否和录入的相同
      

  2.   


    if exists(select * from users where name ='' and pwd = '') 
    不是这样判断?
      

  3.   

    不是的,
    代码这样吧 strSql = "select * from users where ur_id = '" & TxtUser.Text & "' and ur_stat = '1'"
        con.ConnectionString = sCon
        con.Open
        rs.Open strSql, con
        If rs.EOF = False Then
            myPW = oDBCon.GETEncryptStr(txtPW.Text)
            If TurnNull(rs("ur_pw")) = myPW Then
                mykind = 1
                tUser.sID = TurnNull(rs("ur_id"))
                tUser.sName = TurnNull(rs("ur_name"))
                tUser.sUPID = TurnNull(rs("ur_up_id"))
                Unload Me
                MDIMain.Show
            Else
                MsgBox "没有此ID或密码不正确!"
                TxtUser.SetFocus
                TxtUser.SelStart = 0
                TxtUser.SelLength = Len(TxtUser.Text)
            End If
        Else
            MsgBox "没有此ID或密码不正确!"
            TxtUser.SetFocus
            TxtUser.SelStart = 0
            TxtUser.SelLength = Len(TxtUser.Text)
        End If
      

  4.   

    后面是读出来比较,这样子就不能利用sql语句了。第二步不能利用