.使用Docker搭建环境
1.首先拉取一个基础镜像
docker pull ubuntu:18.04

启动一个容器
docker run --name apachejs -itd -p 80:80 ubuntu:18.04

进入容器
docker exec -it apachejs bash

更换apt源
echo "deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse" > /etc/apt/sources.list apt-get update

安装web环境
apt-get install apache2
apt-get install php7.0
apt-get install php-pear
apt-get install libapache2-mod-php
启动apache
service apache2 start

环境搭建完成
2.漏洞复现 Apache解析文件的方法 一个重要文件 /etc/mime.types 这里记录了大量的文件后缀和mime类型,当客户端请求一个文件时,如果后缀在这个列表 里那么apache就返回对应的content-type给浏览器如果不在列表,apache不会返回content-type给浏览器,而直接文件内容,由浏览器自动处理。 Apache解析php的方法
cat /etc/mime.types | grep php
在web目录下创建一个1.php.yy.xx,然后访问该文件
echo "<?php phpinfo()?>" > /var/www/html/1.php.yy.xx
它的作用也是为了让apache把php文件交给php_ module解析,但是注意到它与SetHandler:它的后缀不 是用正则去匹配的。所以,在文件名的任何位置匹配到php后缀,它都会让php_ module解析。 现在重启一下apache服务,重新加载一下配置?
service apache2 restart?????????
?
现在可以发现成功解析了1.php.yy.xx?
|