Hack the Box Walkthrough: Jerry
嗯,用户让我总结一下这篇文章的内容,控制在100字以内,而且不需要用“文章内容总结”之类的开头。好的,我先看看这篇文章讲的是什么。 看起来这篇文章是关于Hack the Box的一个Red Team的介绍,今天他们遇到了一个简单的Windows靶机。他们尽量使用冒险模式,只有在卡住的时候才会切换到指导模式。然后他们进行了NMAP扫描,发现了一个Apache Tomcat服务器,可能是在Windows Server 2012上运行的Tomcat 7.0.88。 接下来他们尝试了一些CVE,比如CVE-2019-0232,但发现cgi-bin不可用,所以转而探索网页。尝试了默认的管理员账号登录,但没成功。然后他们找到了一个上传WAR文件的功能,利用MSFvenom生成了一个恶意的WAR包,并上传成功。之后通过netcat监听获得了反向shell,进入系统后找到了用户目录下的flag文件。 总结一下,文章描述了通过上传恶意WAR文件获取反向shell并最终拿到flag的过程。所以我要把这些关键点浓缩到100字以内。 首先确定主要步骤:NMAP扫描发现Tomcat,尝试CVE未果,上传WAR文件利用MSFvenom生成恶意包,获得shell后找到flag。这样应该能控制在100字左右。 </think> 文章描述了一次简单的Windows靶机渗透测试过程。通过NMAP扫描发现Apache Tomcat服务后尝试默认管理员账号未果。随后利用WAR文件上传功能结合MSFvenom生成恶意包并成功获得反向shell。最终进入系统后在用户目录中找到包含flag的文件完成任务。 2026-1-25 14:13:31 Author: infosecwriteups.com(查看原文) 阅读量:1 收藏

KarmicDragoon92

And here we are back to the Intro to Red Team track here on Hack the Box. Today we’ve got an easy Windows box. We’re going to be trying from here on out to do as much in adventure mode as we can, only really switching to guided if we’re really stuck. So without anymore yapping from me, let’s get into todays box.

NMAP scan results

Press enter or click to view image in full size

Looks like we have an Apache Tomcat running on probably Windows Server 2012? Let’s go ahead and navigate to the URL.

Checking the URL

Press enter or click to view image in full size

Here we see what looks like a fresh install of Tomcat 7.0.88. Let’s go ahead and maybe do some quick googling to see what exploits may or may not be available to us.

CVE-2019–0232?

After a little bit of googling we get a few interesting CVE’s.

Press enter or click to view image in full size

CVE Details

Press enter or click to view image in full size

NIST vulnerability Database

Looks like a potential attack vector, RCE when running on Windows?

Okay so after doing a little bit of reading this CVE requires that the /cgi-bin is one accessible and two has some .bat files in it. Due to how some Windows API things read arguments we can get RCE, but long story short /cgi-bin is not accessible here and we obviously don’t have access to reconfigure anything there or even view it. Speaking of viewing what can we view. Maybe we should focus on continuing to explore the application rather than immediately trying to find an exploit.

Back to Exploring the Web Page

On the landing page there’s the Manager App can we get into there?

Press enter or click to view image in full size

Crap, uh, admin admin?

Press enter or click to view image in full size

Damn. And this is one of those things where you gotta close the browser to try a different logon so this is annoying. Tried tomcat tomcat, apache apache, admin password, apache tomcat. Huh what could it be? You don’t think maybe the web server admins just used the example creds?

Press enter or click to view image in full size

Press enter or click to view image in full size

WAR Files

We have this file upload utility here that accepts a WAR file type? Not quite sure what that is… After doing a little bit of looking around I found this article. Essentially a WAR file is a Web ARchive file that has some Java type objects inside, some html/css and a web.xml file (typically). So, we should be able to craft our own malicious WAR file, upload it and then get a reverse shell from that, at least in theory. Below is the code from the article that should work?

Get KarmicDragoon92’s stories in your inbox

Join Medium for free to get updates from this writer.

Let’s craft our WAR package. Specific instructions are in the article mentioned above.

Press enter or click to view image in full size

Press enter or click to view image in full size

So when trying to compile the java it seems like we don’t have that right packages installed? We could go through and try to get this working, but I feel like there’s an easier answer. And after doing a little bit more digging I found that we can just do all of this with MSFvenom.

If you’re not familiar, MSFvenom is a payload generator developed by the same people who made/own Metasploit? One or the other, but I use this a lot when developing shellcode exploits for any binary exploitation I get up to, so with that being said.

Press enter or click to view image in full size

Let’s try it

Press enter or click to view image in full size

Hit deploy

Press enter or click to view image in full size

Now that we got that uploaded, what we’re going to want to do is set up our netcat listener and then navigate to the URL our malicious WAR file is located and after we do all that…

Press enter or click to view image in full size

System Exploration

And there we have it. Alright time to start poking around the file system, what’s going on inside our current directory?

Press enter or click to view image in full size

Long story short, there’s nothing here of interest. Note to myself you gotta be able to dig into every where in order to find what you’re looking for. And by everywhere I mean the most probable place which is in the \Users directory and checking any users home directories or the Admin home directory, which in this case we can and we see this wonderful file.

Press enter or click to view image in full size

Which conveniently has both of our flags in there.

Press enter or click to view image in full size

Conclusion

This was a very simple box as long as you just kinda observe what you have in front of you and don’t think about it too hard. That’s kinda what I took away from this one, instead of immediately trying to look for CVE’s and getting sent down those rabbit holes, sometimes it’s simpler than you think. And with that being said, thank you so much for joining me for this one and I will see you next time.


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