8009 - Pentesting Apache JServ Protocol (AJP)
Last updated
Last updated
Learn & practice AWS Hacking: Learn & practice GCP Hacking:
Hacking Insights Engage with content that delves into the thrill and challenges of hacking
Real-Time Hack News Keep up-to-date with fast-paced hacking world through real-time news and insights
Latest Announcements Stay informed with the newest bug bounties launching and crucial platform updates
Also interesting:
The ajp13 protocol is packet-oriented. A binary format was presumably chosen over the more readable plain text for reasons of performance. The web server communicates with the servlet container over TCP connections. To cut down on the expensive process of socket creation, the web server will attempt to maintain persistent TCP connections to the servlet container, and to reuse a connection for multiple request/response cycles
Default port: 8009
Ghostcat is a LFI vulnerability, but somewhat restricted: only files from a certain path can be pulled. Still, this can include files like WEB-INF/web.xml
which can leak important information like credentials for the Tomcat interface, depending on the server setup.
Patched versions at or above 9.0.31, 8.5.51, and 7.0.100 have fixed this issue.
When we come across an open AJP proxy port (8009 TCP), we can use Nginx with the ajp_module
to access the "hidden" Tomcat Manager. This can be done by compiling the Nginx source code and adding the required module, as follows:
Download the Nginx source code
Download the required module
Compile Nginx source code with the ajp_module
.
Create a configuration file pointing to the AJP Port
Comment out the entire server
block and append the following lines inside the http
block in /etc/nginx/conf/nginx.conf
.
Start Nginx and check if everything is working correctly by issuing a cURL request to your local host.
Replace TARGET-IP
in nginx.conf
witg AJP IP then build and run
Encountering an open port 8009 without any other accessible web ports is rare. However, it is still possible to exploit it using Metasploit. By leveraging Apache as a proxy, requests can be redirected to Tomcat on port 8009.
This setup offers the potential to bypass intrusion detection and prevention systems (IDS/IPS) due to the AJP protocol's binary nature, although this capability has not been verified. By directing a regular Metasploit Tomcat exploit to 127.0.0.1:80
, you can effectively seize control of the targeted system.
Hacking Insights Engage with content that delves into the thrill and challenges of hacking
Real-Time Hack News Keep up-to-date with fast-paced hacking world through real-time news and insights
Latest Announcements Stay informed with the newest bug bounties launching and crucial platform updates
Join server to communicate with experienced hackers and bug bounty hunters!
Join us on and start collaborating with top hackers today!
From:
AJP is a wire protocol. It an optimized version of the HTTP protocol to allow a standalone web server such as to talk to Tomcat. Historically, Apache has been much faster than Tomcat at serving static content. The idea is to let Apache serve the static content when possible, but proxy the request to Tomcat for Tomcat related content.
If the AJP port is exposed, Tomcat might be susceptible to the Ghostcat vulnerability. Here is an that works with this issue.
Join server to communicate with experienced hackers and bug bounty hunters!
Join us on and start collaborating with top hackers today!
Learn & practice AWS Hacking: Learn & practice GCP Hacking:
Check the !
Join the 💬 or the or follow us on Twitter 🐦 .
Share hacking tricks by submitting PRs to the and github repos.