【打靶日记】HackMyVm 之 hunter

主机发现

bash 复制代码
┌──(root㉿kali)-[~/Desktop/xhh/HMV/hunter]
└─# arp-scan -I eth1 -l
(...)
192.168.56.104  08:00:27:8c:11:2a       PCS Systemtechnik GmbH
(...)

发现主机地址为:192.168.56.104

端口扫描

bash 复制代码
┌──(root㉿kali)-[~/Desktop/xhh/HMV/hunter]
└─# nmap -p- 192.168.56.104                        
(...)
PORT     STATE SERVICE
22/tcp   open  ssh
8080/tcp open  http-proxy
(...)

探测8080端口

bash 复制代码
┌──(root㉿kali)-[~/Desktop/xhh/HMV/hunter]
└─# dirsearch -u http://192.168.56.104:8080/
/usr/lib/python3/dist-packages/dirsearch/dirsearch.py:23: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
  from pkg_resources import DistributionNotFound, VersionConflict

  _|. _ _  _  _  _ _|_    v0.4.3
 (_||| _) (/_(_|| (_| )

(...)
[20:04:59] 200 -   13B  - /admin
(...)
[20:05:48] 200 -   31B  - /robots.txt
(...)

发现有robots.txt和admin

查看robots.txt和admin

bash 复制代码
┌──(root㉿kali)-[~/Desktop/xhh/HMV/hunter]
└─# curl 192.168.56.104:8080/robots.txt      
User-agent: *
Disallow: /admin
                                                                                                                                               
┌──(root㉿kali)-[~/Desktop/xhh/HMV/hunter]
└─# curl 192.168.56.104:8080/admin           
Invalid JWT.
                                                                                                                                               
┌──(root㉿kali)-[~/Desktop/xhh/HMV/hunter]
└─# curl 192.168.56.104:8080/admin -v -X POST
(...)
< X-Secret-Creds: hunterman:thisisnitriilcisi
(...)
Invalid JWT.

拿到一个登录凭证hunterman:thisisnitriilcisi

登录hunterman

bash 复制代码
hunter:~$ ls -al
total 12
drwxr-sr-x    2 hunterman hunterman      4096 Nov 24 12:11 .
drwxr-xr-x    4 root     root          4096 Nov 16 14:12 ..
lrwxrwxrwx    1 hunterman hunterman         9 Nov 16 14:22 .ash_history -> /dev/null
-rw-------    1 hunterman hunterman        26 Nov 16 14:14 user.txt
hunter:~$ 

拿到user的flag

bash 复制代码
┌──(root㉿kali)-[~/Desktop/xhh/QQ]
└─# nmap -sT -sC -sV -O -p8080 192.168.56.104
Starting Nmap 7.95 ( https://nmap.org ) at 2025-11-24 20:18 CST
Nmap scan report for 192.168.56.104
Host is up (0.00088s latency).

PORT     STATE SERVICE VERSION
8080/tcp open  http    Golang net/http server

8080是Golang起的http服务

加上web下是这样的

bash 复制代码
hunter:~$ ls -al /var/www/html
total 24
drwxr-xr-x    4 root     root          4096 Nov 16 14:19 .
drwxr-xr-x    3 root     root          4096 Nov 16 14:18 ..
drwxr-xr-x    2 root     root          4096 Nov 16 14:19 admin
drwxr-xr-x    2 root     root          4096 Nov 16 14:19 beacon
-rw-r--r--    1 root     root            21 Nov 16 14:19 index
-rw-r--r--    1 root     root            36 Nov 16 14:19 robots.txt

不看robots.txt吃大亏

bash 复制代码
hunter:~$ cat /var/www/html/robots.txt 
h u n t e r g i r l:fickshitmichini

由于是Golang、PHP、Java 等语言构建的动态服务,所以:

bash 复制代码
http.HandleFunc("/robots.txt", func(w http.ResponseWriter, r *http.Request) {
    w.Write([]byte("User-agent: *\nDisallow: /admin"))
})

在外部查看的robots.txt和内部静态的robots.txt可能是不一样的

登录huntergirl

bash 复制代码
hunter:~$ su - huntergirl
Password: 
hunter:~$ whoami
huntergirl

权限提升

bash 复制代码
hunter:~$ sudo -l
Matching Defaults entries for huntergirl on hunter:
    secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin

Runas and Command-specific defaults for huntergirl:
    Defaults!/usr/sbin/visudo env_keep+="SUDO_EDITOR EDITOR VISUAL"

User huntergirl may run the following commands on hunter:
    (root) NOPASSWD: /usr/local/bin/rkhunter

允许无密码以root身份执行rkhunter

bash 复制代码
hunter:~$ sudo rkhunter
(...)
     -c, --check                       Check the local system
     -C, --config-check                Check the configuration file(s), then exit
  --cs2, --color-set2                  Use the second color set for output
         --configfile <file>           Use the specified configuration file
(...)
bash 复制代码
hunter:~$ sudo rkhunter --configfile /root/root.txt -C
Invalid SCRIPTDIR configuration option: No filename given, but it must exist.
Invalid INSTALLDIR configuration option - no installation directory specified.
The default logfile will be used: /var/log/rkhunter.log
Invalid TMPDIR configuration option: No filename given, but it must exist.
Invalid DBDIR configuration option: No filename given, but it must exist.
The internationalisation directory does not exist: /i18n
grep: bad regex ' HMV{FhOpuXDUlZFhOpuXDUlZ} ': Invalid contents of {}
Unknown configuration file option: HMV{FhOpuXDUlZFhOpuXDUlZ}

通过帮助信息读取到flag

相关推荐
草莓熊Lotso5 小时前
【Redis 初阶】Set 类型深度解析:去重集合的运算能力与实战场景
linux·网络·数据库·windows·redis·tcp/ip·缓存
张文君5 小时前
ubuntu26.04坏道坏块分区隔离急速版260831-V0.12
linux·python
贝锐14 小时前
从国产化信创设备到商用安卓终端,向日葵如何帮助企业实现统一运维管理?
linux·运维·远程控制
Julien200415 小时前
调查和解决 SELinux 问题
linux·运维·服务器·网络·学习方法
小张同学a.17 小时前
Docker 容器实战 1—— docker 基础与镜像构建
linux·运维·docker·容器
Best-Wishes19 小时前
BurpSuite Pro教育版在linux系统中配置
linux·运维·服务器·网络安全·burpsuite
wuminyu20 小时前
深入剖析 Panama Off-heap 的性能损耗与开销
java·linux·c语言·jvm·c++
虎王物联20 小时前
RK3568嵌入式Linux跑Docker:内核配置排查到AIoT容器化的完整路径
linux·运维·docker·rk3568·aiot·嵌入式linux
GeW20 小时前
不只靠技术:RHCE考试的5个隐藏得分点
linux
老当益壮梁奶奶21 小时前
Linux软件编程学习笔记(八):进程间通信详解(1)
linux·c语言·笔记·学习·算法