[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简介 是 ...
随机推荐
- Java 实现 对象和转字符串之间的互转 (json格式)
添加依赖: <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId> ...
- shell 中使用正则表达式
ls | xargs echo | sed 's/.*\(\w\+\)\s\(\w\+\s\)*\1d.*/\1/' 说明 \w\+表示一段连续的字符串 \s\+ 一个或者多个空格 \s* 0个或者多 ...
- CMAK找不到相关编译器的问题
本机安装了vs2019,在编译vulkansdk所带的samples时,遇到 错误提示: CMake Error at CMakeLists.txt: (project): Generator Vis ...
- fedora bash shell 为什么不能使用ctrl+c了?
无法使用ctrl+c? 原来是因为, 在shell中, 为了选择和复制粘贴文字内容的方便, 对shell的快捷键进行了设置, 将复制设置为 ctrl+c了, 将zhantie设置为ctrl+v了 所以 ...
- CBAM: Convolutional Block Attention Module
1. 摘要 作者提出了一个简单但有效的注意力模块 CBAM,给定一个中间特征图,我们沿着空间和通道两个维度依次推断出注意力权重,然后与原特征图相乘来对特征进行自适应调整. 由于 CBAM 是一个轻量级 ...
- sqlalchemy批量添加数据-数据源是json(小算法)
需求: 想要写1个增加case的接口 问题: sqlalchemy添加case的方式,只能是1条数据1条数据的插入,像这样: ro2 = Role(name='user') db.session.ad ...
- error: exportArchive: You don’t have permission to save the file “HelloWorld.ipa” in the folder “HelloWorld”.
成功clean环境和生成archive文件之后,最后一步导出ipa包,遇到了权限问题: you don’t have permission to save the file “HelloWorld.i ...
- 查看centos的版本信息
1.查看centos的版本信息 cat /etc/centos-release
- npm 中的 --
-- 命令告诉cli-parser停止向下解析, --后面的内容会传给命令行作为命令行参数 文档地址: https://docs.npmjs.com/misc/config.html
- Week 12 - 673.Number of Longest Increasing Subsequence
Week 12 - 673.Number of Longest Increasing Subsequence Given an unsorted array of integers, find the ...