[php代码审计] apache 后缀名解析“漏洞”
不能说是漏洞,只是 apache 特性而已。
下面是apache httpd.conf中截取的一段:
<IfModule mime_module>
#
# TypesConfig points to the file containing the list of mappings from
# filename extension to MIME-type.
#
TypesConfig conf/mime.types #
# AddType allows you to add to or override the MIME configuration
# file specified in TypesConfig for specific file types.
#
#AddType application/x-gzip .tgz
#
# AddEncoding allows you to have certain browsers uncompress
# information on the fly. Note: Not all browsers support this.
#
AddEncoding x-compress .Z
AddEncoding x-gzip .gz .tgz
#
# If the AddEncoding directives above are commented-out, then you
# probably should define those extensions to indicate media types:
#
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddType application/x-httpd-php .php
AddType application/x-httpd-php .php3 #
# AddHandler allows you to map certain file extensions to "handlers":
# actions unrelated to filetype. These can be either built into the server
# or added with the Action directive (see below)
#
# To use CGI scripts outside of ScriptAliased directories:
# (You will also need to add "ExecCGI" to the "Options" directive.)
#
#AddHandler cgi-script .cgi # For type maps (negotiated resources):
#AddHandler type-map var #
# Filters allow you to process content before it is sent to the client.
#
# To parse .shtml files for server-side includes (SSI):
# (You will also need to add "Includes" to the "Options" directive.)
#
#AddType text/html .shtml
#AddOutputFilter INCLUDES .shtml </IfModule>
由上可知道,.php 或 .php3后缀的文件会被php解析。


Index.php.a文件有两个后缀,分别是.php和.a,apache无法识别.a但可以识别.php,然后件给php去解析。
如果去掉后缀 (.php) ,则无法解析,按照默认设置(DefaultType text/plain),对于无法识别的后缀,按纯文本发给浏览器。
如下图(.a后缀无法识别,按默认):

如果在 httpd.conf 中添加AddType application/x-httpd-php .a如图:


Apache按从右到左的顺序识别文件后缀,直至找到后缀能匹配配置文件中的设置。index.php.txt,将会被识别为纯文本(text/plain);
index.php.Z将会被识别为压缩文件。Index.php.a 若.a没有被设置或mime.types没有定义,则会识别为.php后缀的文件,交给php解析。
在mine.types中设置后缀匹配识别:

[php代码审计] apache 后缀名解析“漏洞”的更多相关文章
- IIS 6.0/7.0/7.5、Nginx、Apache 等服务器解析漏洞总结
IIS 6.0 1.目录解析:/xx.asp/xx.jpg xx.jpg可替换为任意文本文件(e.g. xx.txt),文本内容为后门代码 IIS6.0 会将 xx.jpg 解析为 asp 文件. ...
- Apache HTTPD 换行解析漏洞--CVE-2017-15715
CVE-2017-15715 一.漏洞描述 Apache HTTPD是一款HTTP服务器,它可以通过mod_php来运行PHP网页.其2.4.0~2.4.29版本中存在一个解析漏洞,在解析PHP时,1 ...
- Apache解析漏洞复现(CVE-2017-15715),可以绕过黑名单
照着P神的文章准备复现一下(总结一下经验) 环境的安装 这里面直接使用的vulhub里面的环境来进行安装的(为了方便吗) 基础环境如下  实际上Apache版本在2.4.0~2.4.29即可 i ...
- Apache解析漏洞详解
很多次听到人说apache的“解析漏洞”了,正好今天又有人问,那就简单科普一下这个“解析漏洞”是何物. 先来看测试过程和结果的对比吧. 结果一 首先,我安装了apache 2.x版本,同时以modul ...
- 漏洞复现——Apache HTTPD多后缀解析漏洞
漏洞原理:Apache Httpd支持一个文件拥有多个后缀,不同的后缀执行不同的命令,也就是说当我们上传的文件中只要后缀名含有php,该文件就可以被解析成php文件,利用Apache Httpd这个特 ...
- apache httpd多后缀解析漏洞复现
apache httpd多后缀解析漏洞复现 一.漏洞描述 Apache Httpd支持一个文件拥有多个后缀,不同的后缀执行不同的命令,也就是说当我们上传的文件中只要后缀名含有php,该文件就可以被解析 ...
- Apache HTTPD 未知后缀解析漏洞
环境搭建 https://blog.csdn.net/qq_36374896/article/details/84102101 该环境版本: PHP 7.x 最新版 Apache HTTPD 2.4. ...
- 文件解析漏洞总结(IIS,APACHE,NGINX)
(本文主体来自https://blog.csdn.net/qq_36119192/article/details/82834063) 文件解析漏洞 文件解析漏洞主要由于网站管理员操作不当或者 Web ...
- apache、nginx、Tomcat、IIS引擎解析漏洞
引擎解析漏洞 常见的web容器有IIS.Apache.Nginx.Tomcat等,以下是详细讲解 IIS IIS简介 是 ...
随机推荐
- [CSP-S模拟测试]:骆驼(模拟+构造)
题目描述 我们都熟悉走马步,现在我们定义一种新的移动方式——骆驼步,它在一个国际棋盘上的移动规则是这样的. 以看出,骆驼步可以向八个方向走动,且不能走出棋盘范围. 现在给出一个$N\times N$的 ...
- oracle各服务说明及cmd启动启动命令
成功安装Oracle 11g后,共有7个服务,一.这七个服务的含义分别为:1. Oracle ORCL VSS Writer Service:Oracle卷映射拷贝写入服务,VSS(Volume Sh ...
- vue 拖动调整左右两侧div的宽度
原文链接:https://www.cnblogs.com/layaling/p/11009570.html 原文是左中右三种情况的拖动.由于项目需要,我删除掉了右边的,直接左右区域拖动调整div宽度 ...
- p2p传输协议
老司机是如何飙车的——P2P传输协议 转载来自2017-03-27 15:23 点波蓝字关注变智者 秋明山上人行稀,常有车手较高低,如今车道依旧在,不见当年老司机.其实老司机们从未离去,只不过好的车手 ...
- AtomicInteger 源码分析
AtomicInteger AtomicInteger 能解决什么问题?什么时候使用 AtomicInteger? 支持原子更新的 int 值. 如何使用 AtomicInteger? 1)需要被多线 ...
- 001-spring boot概述与课程概要
一.Spring Boot介绍 Spring Boot的目的在于创建和启动新的基于spring框架的项目.Spring boot会选择最适合的Spring 子项目和第三方开源库进行整合.大部分Spri ...
- dropna()函数
参数: axis: default 0指行,1为列 how: {‘any’, ‘all’}, default ‘any’指带缺失值的所有行;'all’指清除全是缺失值的 thr ...
- iview在项目中遇到的坑
1.下拉框选中某一项搜索发现总是搜不到,最后发现是选中后选中值后边莫名多了很长的空格,原因很简单,在代码中opction闭合标签和主体没有在一行. 2.iview+vue项目中,用百分比或者displ ...
- Caffe参数交换源码分析
对境准备:对于多个GPU而言,一台机器2个GPU,参数交换的流程图: 参数交换从main()进入train()函数,在train函数中找到对应源码为: . . . . . ) { caffe::P2P ...
- node和数据库建立连接
var express = require('express') , app = express(); var querystring = require('querystring'); var ut ...