典型登入驗證程式 (VB/ADO 範例) 拼接 SQL 字串:
sqlstr = "select * from users where name='" & Text1.Text & "' and pwd='" & Text2.Text & "'"
輸入帳號任意 (如 123),密碼輸入 a' or 'a'='a,實際執行 SQL 變為:
select * from users where name='123' and pwd='a' or 'a'='a'
'a'='a' 恆真,只要 users 表有任一記錄,RecordCount > 0 即通過驗證,繞過認證機制。
SQL Injection 歷經二十年仍屬 OWASP Top 10 首位,根治唯有參數化查詢一條路。