File tree 3 files changed +53
-2
lines changed
3 files changed +53
-2
lines changed Original file line number Diff line number Diff line change 1
- # nginx_shell
2
- 更优雅的nginx webshell/内存马
1
+ # 全链路内存马系列之 nginx 内存马
2
+
3
+ ![ ] ( img/webshellattckchain.jpg )
4
+ 其他内存马
5
+ - [ ebpf 内核马] ( https://github.com/veo/ebpf_shell )
6
+ - [ websocket 内存马] ( https://github.com/veo/wsMemShell )
7
+ - ### 注意
8
+ 本项目不含有完整的利用工具,仅提供无害化测试程序、防御加固方案,以及研究思路讨论
9
+ - ### 测试程序使用方式
10
+ 下载测试程序 [ releases] ( https://github.com/veo/nginx_shell/releases )
11
+
12
+ 将下载的so放至目标服务器上,修改 nginx.conf 配置文件在第一行添加以下内容,path为路径,ngx_http_cre_module.so名称最好不修改。
13
+ ```
14
+ load_module path/ngx_http_cre_module.so
15
+ ```
16
+ 然后重载nginx
17
+ ```
18
+ nignx -s reload
19
+ ```
20
+
21
+ POST HTTP header ` vtoken: whoami ` (测试程序只能使用 ` whoami ` 命令)
22
+ ![ ] ( img/run.jpg )
23
+
24
+ - ### 一、技术特点
25
+ 1 . 无需临时编译(传统的 nignx so backdoor 需要临时编译)
26
+ 2 . 兼容支持大部分 nignx 版本
27
+ 3 . 无需额外组件支持
28
+
29
+
30
+ - ### 二、技术缺点
31
+ 1 . 有so文件落地
32
+ 2 . 需要 nignx -s reload 权限
33
+
34
+ - ### 三、技术原理
35
+ nginx module 支持动态加载so,通过 __ attribute__ 的方式绕过nginx module version check,可以编译出适应所有nginx版本的module。
36
+ 使用header_filter可以取得命令执行的参数,通过body_filter可以返回命令执行后的结果
37
+
38
+
39
+ - ### 四、研究中遇到的问题
40
+ 1 . 绕过nginx对于module的版本检测
41
+
42
+ 通过 __ attribute__ 的方式绕过
43
+
44
+
45
+ 2 . 编写的module要兼容大部分版本
46
+
47
+ 使用较早版本的函数,不使用高版本新增函数
48
+
49
+
50
+ - ### 五、防御加固方案
51
+ 1 . 监测Nginx Module的加载,Nginx进程的行为
52
+ 2 . 查杀落地文件
53
+ 3 . 收敛 nignx -s reload 权限
You can’t perform that action at this time.
0 commit comments