tryhackme-Cyborg(赛博格)


根据题目的描述,这是一个一个涉及加密档案、源代码分析等的盒子靶机。

启动靶机都进行信息收集

信息收集

使用nmap进行端口扫描

扫描到靶机开放两个端口2280端口

注:由于国内网络扫描会出现很慢的问题,根据我后续的扫描结果,该题目确实只有这两个端口开放,实际中要对端口采用更详细的信息收集。

由于22端口只可能包含CVE或者私钥泄露一些常见的漏洞,这里把攻击面主要针对80端口

通过浏览器访问该靶机的web服务

这是一个apache的默认页面,尝试使用目录扫描

gobuster dir -u http://10.10.87.131/ -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt


扫描到含有/admin/etc目录,访问/etc查看找到了passwdsquid.conf文件,并将其下载查看内容

passwdsquid.conf文件内容

通过查找资料找到得知squid是一个代理服务器的中间件,没有太大的用处,之类在passwd中得到一个密码,使用john进行密码破解

得到密码为squidward

在使用ssh服务用户名music_archive和密码squidward登录并没有成功,猜测可能是用户名错误,继续在web信息收集查找有没有相关的用户名,果然不出意外,找到一些用户名,在/admin/admin.html中,如下

############################################
############################################
[Yesterday at 4.32pm from Josh]
Are we all going to watch the football game at the weekend??
############################################
############################################
[Yesterday at 4.33pm from Adam]
Yeah Yeah mate absolutely hope they win!
############################################
############################################
[Yesterday at 4.35pm from Josh]
See you there then mate!
############################################
############################################
[Today at 5.45am from Alex]
Ok sorry guys i think i messed something up, uhh i was playing around with the squid proxy i mentioned earlier.
I decided to give up like i always do ahahaha sorry about that.
I heard these proxy things are supposed to make your website secure but i barely know how to use it so im probably making it more insecure in the process.
Might pass it over to the IT guys but in the meantime all the config files are laying about.
And since i dont know how it works im not sure how to delete them hope they don't contain any confidential information lol.
other than that im pretty sure my backup "music_archive" is safe just to confirm.
############################################
############################################

从中我们得到一些用户名,并且得知alex将一些文件进行的备份,并且他说是安全的,这里后续在做研究。

使用得到的用户名尝试用户名爆破登录,并没有成功

我们回到上述他说的备份,在源代码中我们看到有一个archive.tar压缩包可以下载

解压后得到一些文件,暂时不知道有什么作用,不过在README中发现这是一个Borg Backup的文件

在网上搜索borg backup等相关的信息后,得到解开的方法,参考详细使用文档:https://www.modb.pro/db/220215
borg backup是一个备份工具,类似于压缩,我们可以使用borg命令进行备份和还原,还原的命令为borg extract,如下

borg extract home/field/dev/final_archive::music_archive

注:上述中music_archive就是passwd中给我们的提示

输入该命令后提示我们输入密码,因为alex在进行备份的时候设置还原需要密码,就是我们破解出的密码squidward

还原后得到如下信息

secret.txtnote.txt中有信息,查看如下

一段鼓励我们的话,得到alex的密码为S3cretP@s3

权限提升

使用ssh登录后进行权限提升

使用sudo -l查看得到我们可以运行/etc/mp3backups/backup.sh脚本,查看其内容

由于看不懂shell脚本,本人的代码审计能比比较弱需要提升,但是简单的看到了flag,通过查资料得到getopts方法应该是获取我们输入的内容,但是不会利用。

看到大佬的博客得知使用-c参数调用即可,最终得到root权限

user.txt

root.txt

我们也可以使用该脚本进行权限提升,获取更流畅的shell权限,例如:
第一步复制bash文件到tmp目录

然后使用chmod赋予rootbash文件xs执行+suid权限,最后执行rootbash -p获得root权限

总结

1.仔细进行信息收集,不能掉以轻心,当做真实环境,不懂多去搜索,得到的文件认真进行分析。
2.常见需提升代码通用能力,的php,python,java,C,shell,mysql等常用语言的基础语法、常用方法的普及。

posted @ 2024-03-03 22:15  Junglezt  阅读(11)  评论(0编辑  收藏  举报