靶机描述:

下载地址:http://www.vulnhub.com/entry/matrix-1,259/
级别:中级
目标:得到root权限和打开flag.txt

扫描靶机ip

arp-scan -l
攻击机:192.168.86.138

靶机:192.168.86.162

查看开放端口及版本信息

nmap -sV -p- 192.168.86.162

访问80端口页面,Follow the White Rabbit(跟随白色兔子),Welcome to the real world, Neo. I'm glad you're here(欢迎来到真实世界,尼奥。很高兴你能在这里)。(ps~黑客帝国帝国的片段)

http://192.168.86.162:80

查看网页源码时发现发现图片链接


打开后是一只白兔,并图片命名为31337.png,根据提示那重要信息应该在31337端口中

打开31337端口页面,Cypher(暗号),"You know.. I know this steak doesn't exist. I know when I put it in my mouth; the Matrix is telling my brain that it is juicy, and delicious. After nine years.. you know what I realize? Ignorance is bliss."(“我知道这块牛排不存在。我知道当我放进嘴里时,矩阵正在告诉我的大脑它是美味多汁的。九年之后,你知道我意识到什么了吗?无知是幸福的。”)

http://192.168.86.162:31337

查看网页源码,找到用base64编码的一段话


解码后,Then you'll see, that it is not the spoon that bends, it is only yourself.>Cypher.matrix(你将会看见,弯曲的不是汤勺,而是你的信念。)

https://base64.us/

尝试以/Cypher.matrix为路径打开网页,出现了下载文件提示

http://192.168.86.162:31337/Cypher.matrix

下载文件查看,文件内容使用brainfuch编码加密,进行解码后得到提示,You can enter into matrix as guest, with password k1ll0rXX Note: Actually, I forget last two characters so I have replaced with XX try your luck and find correct string of password.(你可以以guest进入到矩阵,密码为k1ll0rXX 提示:事实上,我忘记了最后两个字符,所以我用XX替代了它们,你够幸运的话去找到正确的密码字符串)

https://www.splitbrain.org/services/ook

使用crunch字典生成工具生成密码字典,选择要使用的字符集范围,选择使用lalpha-numeric字符集

文件路径:/usr/share/crunch/charset.lst

生成字符字典

crunch 8 8 -f /usr/share/crunch/charset.lst lalpha-numeric -t k1ll0r@@ > pwd.dic

8 8:表示密码的长度为8位
-f /usr/share/crunch/charset.lst lalpha-numeric:指定字符集
-t k1ll0r@@:指定模式,@@插入小写字符> pwd.dic:生成字典文件


得到字典文件后使用hydra通过连接ssh进行密码破解

hydra -l guest -P pwd.dic  -v 192.168.86.162 ssh 

-l:指定用户

-P:指定字典

-v:显示爆破详细信息

登录ssh成功

ssh guest@192.168.86.162 

由于bash shell功能受限,所以采取rbash绕过方式

重新登录ssh,成功绕过rbash

ssh guest@192.168.86.162  -t "bash --noprofile"

使用命令查看目前用户权限

sudo -l

成功切换到root用户,得到flag.txt

sudo su root