Hack the Box Walkthrough: Sau
嗯,用户让我帮忙总结一篇文章,控制在100字以内,而且不需要特定的开头。首先,我得仔细阅读这篇文章,理解它的主要内容。看起来这篇文章是关于红队的一个Linux靶机渗透测试的过程。 文章开始介绍了使用Nmap扫描发现开放的端口22和55555。接着,他们探索了55555端口上的Web应用,发现这是一个HTTP请求容器,并且通过版本号找到了相关的CVE漏洞,这是一个SSRF漏洞。利用这个漏洞,他们成功访问了内部网络资源。 然后,他们下载了一个PoC脚本进行测试,成功转发请求到自己的服务器,并进一步尝试访问内部服务,最终找到了一个Maltrail页面。通过进一步的漏洞利用和权限提升步骤,包括使用linPEAS工具和系统漏洞(如CVE-2023-26604),他们最终获得了root权限。 总结的时候要注意控制字数,并且直接描述内容。我需要涵盖主要步骤:扫描、发现漏洞、利用PoC、访问内部服务、权限提升和获取root。确保每个关键点都简明扼要地表达出来。 </think> 文章描述了一次针对Linux靶机的渗透测试过程。通过Nmap扫描发现开放端口22和55555,并利用该端口上的Web应用发现SSRF漏洞(CVE相关),成功访问内部网络资源。随后通过PoC脚本获取用户权限,并利用系统漏洞(如CVE-2023-26604)实现权限提升,最终获取root权限。 2026-1-25 14:13:38 Author: infosecwriteups.com(查看原文) 阅读量:0 收藏

KarmicDragoon92

Hello and once again welcome back to the Intro to Red Team series, we’ll be handling this easy Linux box today. I’ll be going into this blind as always and we’ll see if I get stuck anywhere, so let’s just dive into it and get after it.

Our Nmap Scan

Press enter or click to view image in full size

Alright here we see the results of our classic nmap scan, ports 22 and 55555 open. 55555 isn’t recognized, but we can see form the fingerprint it may be some type of web application let’s go ahead and see.

Exploring the Web App

Press enter or click to view image in full size

Interesting, looks like some kind of HTTP request container? I made a bucket that you can see in the right hand “My Buckets” section and essentially if you navigate to the bucket it kinda just collects HTTP requests sent to it like sort of proxy. In the bottom left we see the version number for this application so let’s go ahead and google that and see what we can accomplish.

Press enter or click to view image in full size

Well this looks promising. Long story short this CVE is a SSRF vulnerability in the /api/baskets/[basket name] endpoint allowing us to access internal network resources. A little bit of an oversimplification maybe, but let’s get to it.

Here we see a PoC exploit from entr0pie (link towards the bottom) that covers how the exploit works and the actual exploit code itself. Alright cool, let’s download it using the wget command provided to us and then try it out.

Press enter or click to view image in full size

Alright, we’ve downloaded it, lets give it a run and see how it works.

Press enter or click to view image in full size

Okay so after downloading the PoC we run it and set the forwarding server just to a netcat listener I have running on port 8000 cause we just want to see if and how this works. But so after firing that off if we try to navigate to the URL of our created basket…

Press enter or click to view image in full size

The request gets forwarded to our listener okay cool so it works as intended. But how do we actually use it to exploit the web server. Well maybe there’s a chance this same server is hosting another application on a different port to the internal network. Let’s try a few different common ports on the localhost and see if the server forwards us to any of those?

Press enter or click to view image in full size

Let’s see, we’ll try 8000 first?

Press enter or click to view image in full size

Okay no dice, let’s try 80 and 8080 next.

Press enter or click to view image in full size

Press enter or click to view image in full size

Yo oh my God it worked let’s go. We are accessing a web application not accessible to people outside of the targets local network, that’s awesome. Let’s see what this application is all about

The Internal Web App

See we landed on this janky looking not very configured Maltrail page being run on the target on port 80. Okay cool let’s see where we can maybe go from here.

Press enter or click to view image in full size

Alright, we got our version number here, let’s see where that gets us.

Press enter or click to view image in full size

Oh, well, this looks very promising. Let’s explore shall we?

Press enter or click to view image in full size

While this definitely looks like an intriguing exploit, I’m not too sure if we can actually get to a Maltrail’s login page as the login hyperlink seems broken, but let’s see.

Press enter or click to view image in full size

So this URL forwards to /login, let’s see if we can navigate there.

Press enter or click to view image in full size

Well that doesn’t seem great. Let’s just try the exploit anyways and see what happens? So after downloading the exploit or copy and pasting it in my case this should work hopefully?

Press enter or click to view image in full size

Oh my bad the exploit appends the login page to the URL, my bad. We also see that the targeted endpoint is localhost:80/login/login so this actually might work. So if we set up our netcat listener again and run the exploit on the basket that got us to the Maltrail page…

Press enter or click to view image in full size

Lets… Go. I am so happy right now.

User Flag

Okay so we’re puma huh? What’s in the current directory?

Press enter or click to view image in full size

Some interesting stuff, but not our flag. Probably in the users home directory?

And there it is, I am so elated right now. First user flag I’ve gotten with 0 hints so I am feeling really good right now. Alright time to escalate our privileges.

Privilege Escalation

After getting our reverse shell, let’s run

python3 -c 'import pty; pty.spawn("/bin/bash")'

to gain a fully interactive shell. From there we’re gonna get linPEAS onto our target system and do all that stuff.

Press enter or click to view image in full size

linPEAS link: https://github.com/peass-ng/PEASS-ng/tree/master/linPEAS

Get KarmicDragoon92’s stories in your inbox

Join Medium for free to get updates from this writer.

Okay let’s download linPEAS.

Press enter or click to view image in full size

Press enter or click to view image in full size

Very good, let’s get it over to our victim system

Let’s start a simple HTTP server on our attack box in the same directory as our linPEAS script.

Now let’s go ahead and download it to our victims machine.

Press enter or click to view image in full size

Right, probably not in this directory, that makes sense…

Press enter or click to view image in full size

There we go. Let’s run it and save output to a file.

Quick little break while that runs… How’re you doing? I’m doing very well, this box seems to be going well so far yeah? Oh script is done.

Press enter or click to view image in full size

Alright looks like that just wrapped up. Lets take a little peak at the tail end of the output just to see if it worked.

Press enter or click to view image in full size

Okay cool, let’s get that back to our host and do a more in depth analysis of the output.

Press enter or click to view image in full size

Very good. So after scanning through our output the most interesting find in a sudo command puma can run.

Press enter or click to view image in full size

Which is just checking the status of probably the Maltrail app? Let’s run it just to see.

Press enter or click to view image in full size

Mmm, we get some good information regarding the service and even can see that our current shell was spawned by it (obviously, but fun to see). Okay honestly not sure exactly where to go from here… Truthfully there is where I need a little nudge in the right direction and it has to do with this.

Press enter or click to view image in full size

This version of systemd has vulnerability we should be able to leverage. Let’s do some googling.

Press enter or click to view image in full size

You can see I already maybe peaked at the article of interest.

Press enter or click to view image in full size

From: https://medium.com/@zenmoviefornotification/saidov-maxim-cve-2023-26604-c1232a526ba7 So that little pager that popped up when we ran systemctl, you can spawn a shell from it by simply suppling an argument to the pager before hitting return.

Press enter or click to view image in full size

It took a minute to register, but here we are. Awesome, let’s go find our flag.

Root Flag

Conclusion

I was actually really proud of myself this time, no help for user flag and I did need to peak at the writeup to know where to go next after we hit the sudoers file. Definitely need to keep working on my priv esc skills, but thank you for checking out my writeup and as always I will see you for the next one!

Other References:

Exploit from Entr0pie


文章来源: https://infosecwriteups.com/hack-the-box-walkthrough-sau-8039559ab3e7?source=rss----7b722bfd1b8d---4
如有侵权请联系:admin#unsafe.sh