mySql 注入攻击
注入攻擊
1.原理:
a.只要是帶有參數的動態網頁且此網頁訪問了數據庫,那么就有可能存在SQL注入;
b.字符串拼接和沒有判斷用戶輸入是否合法------>導致用戶可以玩填字游戲----->SQL注入攻擊會導致的數據庫安全風險包括:刷庫、拖庫、撞庫。
2.簡單解決方法:
預防字符串拼接---->可以使用變量綁定避免注入攻擊.
? 以查詢語句為例:
?
正確輸入名稱與密碼
name = "hello" password = "wangergou"
"select price from houses where name = %s and paswd = %s"%(name,password)
非法輸入名稱與密碼
name = "'' a' or 1=1 or ('1'='1'?" password = "?'abc') or '1'='1'?"
"select price from houses where name = %s and paswd = %s"%(name,password)
"select price from houses where name =' a' or 1=1 or ('1'='1' and paswd = 'abc') or '1'='1'?
解決方式: ?"select price from houses where name = %s and paswd = %s",name,password ----->Tornado 框架中使用的版本
?? ?
轉載于:https://www.cnblogs.com/weilsppython/p/6116637.html
《新程序員》:云原生和全面數字化實踐50位技術專家共同創作,文字、視頻、音頻交互閱讀總結
以上是生活随笔為你收集整理的mySql 注入攻击的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: C#开发微信门户及应用(25)-微信企业
- 下一篇: RequireJS首次加载偶尔失败