notes - b0ySie7e
GithubPortafolioWrite-ups
  • 馃憢Bienvenido a mi blog
  • Introducci贸n a la ciberseguridad
    • 馃摀驴Como inicio en la ciberseguridad?
  • Teoria y Conceptos
    • 馃摀Redes
      • Identificaci贸n de Dispositivos
      • Local Area Network (LAN)
      • Sub redes
      • Procolo ARP
      • Protocolo DHCP
    • 馃摀Pentesting
      • OSSTMM
      • OWASP
      • NCSC CAF
  • Sistemas Operativos
    • Linux
      • Comandos
    • Windows
      • Comandos
  • Enumeraci贸n
    • Enumeracion de red
      • Enumeracion de Hosts
      • Enumeracion de Puertos y servicios
    • FootPrinting
      • Domain Information
      • FTP
      • SMB
      • NFS
      • DNS
      • SMTP
      • IMAP-POP3
      • SNMP
      • MySQL
      • MSSQL
      • Oracle TNS
      • IPMI
      • Linux Remote Management Protocols
      • Windows Remote Management Protocols
    • Enumeraci贸n web
      • Uso de google dorks
      • Whois
      • Dig
      • Enumeraci贸nde subdominios
      • Enumeraci贸n automatizada
  • Hacking Web
    • Ataques Comunes
      • Fuzzing
      • Sub dominios
      • SQL Injection
      • Cross-Site Scripting
      • Local File Inclusion
      • Remote File Inclusion
      • File Upload Attacks
      • Command Injections
    • Otras explotaciones
  • Escalada de Privilegios
    • 馃摃Linux
      • Enumeraci贸n automatizada - Tools
      • Kernel Exploit
      • Sudo
      • SUID
      • Capabilities
      • Cron Jobs
      • Path
      • NFS
    • 馃摃Windows
      • Enumeraci贸n automatizada - Tools
      • Harvesting Passwords from Usual Spots
      • Other Quick Wins
      • Abusing Service Misconfigurations
      • Abusing dangerous privileges
      • Abusing vulnerable software
  • Guias y Herramientas
    • Git
    • Buffer Over Flow
    • MetaSploit
      • Introducci贸n
      • Modules
      • Targets
      • Payloads
      • Encoders
      • Sessions
    • Nmap
    • Pivoting Tunneling Port Forwarning
      • Port Forwarding SSH
      • Pivoting Metasploit
      • Socat Redirection with a Reverse Shell
      • Socat Redirection with a Bind Shell
      • Others tools for pivoting
    • Transferencias de Archivos
      • Evading Detection
      • Linux File Transfer Methods
      • Miscellaneous File Transfer Methods
      • Transferring Files with Code
      • Windows File Transfer Methods
      • Otros
        • Usando ICMP
        • Usando ncat y tar
    • Shell y Payloads
      • Spawning shell interactiva
      • Conexi贸n de RDP
    • Password Attacks
      • Cracking
      • Windows Local Password Attacks
      • Linux Local Password Attacks
      • Windows Lateral Movement
    • Fortinet
      • Configuraci贸n est谩tica de Firewall
      • Licencia
      • Configuraci贸n de interfaces
      • Primera pol铆tica
      • Rutas estaticas
  • Red Team Path - THM
    • Enumeraci贸n
      • Linux
      • Windows
    • Movimiento lateral
      • Movimiento Lateral
    • Pivoting
      • PortForwarining y pivoting
    • Host Evasion
      • Windows Internal
      • Introduccion a Windows
      • Abusing Windows Internal
      • Introducci贸n a Antivirus
      • AV Evasion ShellCode
      • Principios de Ofuscaci贸n
      • Evasi贸n de Firmas
      • Bypass UAC
      • Runtime Detection Evasion
      • Evading Logging and Monitoring
      • Living Off the Land
    • Networking Security Evasi贸n
      • Network Security Solutions
      • Firewalls
      • Sandbox Evasion
    • Comprometiendo un directorio activo
      • Active Directory Basics
      • Breaching Active Directory
      • Enumerating Active Directory
      • Exploiting Active Directory
      • Persisting Active Directory
      • Credentials Harvesting
Con tecnolog铆a de GitBook
En esta p谩gina
  • Default Configuration
  • Footprinting the Service
  • SSH-Audit
  • Change Authentication Method
  • Scanning for Rsync
  • Probing for Accessible Shares
  • Enumerating an Open Share
  • R-Services
  1. Enumeraci贸n
  2. FootPrinting

Linux Remote Management Protocols

Secure Shell (SSH) permite a dos ordenadores establecer una conexi贸n cifrada y directa dentro de una red posiblemente insegura en el puerto est谩ndar TCP 22. Esto es necesario para evitar que terceros intercepten el flujo de datos y, por tanto, intercepten datos sensibles. El servidor SSH tambi茅n puede configurarse para que s贸lo permita conexiones de clientes espec铆ficos. Una ventaja de SSH es que el protocolo funciona en todos los sistemas operativos comunes. Dado que originalmente es una aplicaci贸n Unix, tambi茅n est谩 implementado de forma nativa en todas las distribuciones de Linux y MacOS. SSH tambi茅n puede utilizarse en Windows, siempre que instalemos un programa adecuado. El conocido servidor SSH de OpenBSD (OpenSSH) en distribuciones Linux es una bifurcaci贸n de c贸digo abierto del servidor SSH original y comercial de SSH Communication Security. En consecuencia, existen dos protocolos que compiten entre s铆: SSH-1 y SSH-2.

Default Configuration

cat /etc/ssh/sshd_config  | grep -v "#" | sed -r '/^\s*$/d'

Include /etc/ssh/sshd_config.d/*.conf
ChallengeResponseAuthentication no
UsePAM yes
X11Forwarding yes
PrintMotd no
AcceptEnv LANG LC_*
Subsystem       sftp    /usr/lib/openssh/sftp-server

Footprinting the Service

SSH-Audit

git clone https://github.com/jtesta/ssh-audit.git && cd ssh-audit
./ssh-audit.py 10.129.14.132

# general
(gen) banner: SSH-2.0-OpenSSH_8.2p1 Ubuntu-4ubuntu0.3
(gen) software: OpenSSH 8.2p1
(gen) compatibility: OpenSSH 7.4+, Dropbear SSH 2018.76+
(gen) compression: enabled (zlib@openssh.com)                                   

# key exchange algorithms
(kex) curve25519-sha256                     -- [info] available since OpenSSH 7.4, Dropbear SSH 2018.76                            
(kex) curve25519-sha256@libssh.org          -- [info] available since OpenSSH 6.5, Dropbear SSH 2013.62
(kex) ecdh-sha2-nistp256                    -- [fail] using weak elliptic curves
                                            `- [info] available since OpenSSH 5.7, Dropbear SSH 2013.62
(kex) ecdh-sha2-nistp384                    -- [fail] using weak elliptic curves
                                            `- [info] available since OpenSSH 5.7, Dropbear SSH 2013.62
(kex) ecdh-sha2-nistp521                    -- [fail] using weak elliptic curves
                                            `- [info] available since OpenSSH 5.7, Dropbear SSH 2013.62
(kex) diffie-hellman-group-exchange-sha256 (2048-bit) -- [info] available since OpenSSH 4.4
(kex) diffie-hellman-group16-sha512         -- [info] available since OpenSSH 7.3, Dropbear SSH 2016.73
(kex) diffie-hellman-group18-sha512         -- [info] available since OpenSSH 7.3
(kex) diffie-hellman-group14-sha256         -- [info] available since OpenSSH 7.3, Dropbear SSH 2016.73

# host-key algorithms
(key) rsa-sha2-512 (3072-bit)               -- [info] available since OpenSSH 7.2
(key) rsa-sha2-256 (3072-bit)               -- [info] available since OpenSSH 7.2
(key) ssh-rsa (3072-bit)                    -- [fail] using weak hashing algorithm
                                            `- [info] available since OpenSSH 2.5.0, Dropbear SSH 0.28
                                            `- [info] a future deprecation notice has been issued in OpenSSH 8.2: https://www.openssh.com/txt/release-8.2
(key) ecdsa-sha2-nistp256                   -- [fail] using weak elliptic curves
                                            `- [warn] using weak random number generator could reveal the key
                                            `- [info] available since OpenSSH 5.7, Dropbear SSH 2013.62
(key) ssh-ed25519                           -- [info] available since OpenSSH 6.5
...SNIP...

Change Authentication Method

ssh -v cry0l1t3@10.129.14.132

OpenSSH_8.2p1 Ubuntu-4ubuntu0.3, OpenSSL 1.1.1f  31 Mar 2020
debug1: Reading configuration data /etc/ssh/ssh_config 
...SNIP...
debug1: Authentications that can continue: publickey,password,keyboard-interactive
ssh -v cry0l1t3@10.129.14.132 -o PreferredAuthentications=password

OpenSSH_8.2p1 Ubuntu-4ubuntu0.3, OpenSSL 1.1.1f  31 Mar 2020
debug1: Reading configuration data /etc/ssh/ssh_config
...SNIP...
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Next authentication method: password

cry0l1t3@10.129.14.132's password:

Scanning for Rsync

sudo nmap -sV -p 873 127.0.0.1

Starting Nmap 7.92 ( https://nmap.org ) at 2022-09-19 09:31 EDT
Nmap scan report for localhost (127.0.0.1)
Host is up (0.0058s latency).

PORT    STATE SERVICE VERSION
873/tcp open  rsync   (protocol version 31)

Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 1.13 seconds

Probing for Accessible Shares

 nc -nv 127.0.0.1 873

(UNKNOWN) [127.0.0.1] 873 (rsync) open
@RSYNCD: 31.0
@RSYNCD: 31.0
#list
dev            	Dev Tools
@RSYNCD: EXIT

Enumerating an Open Share

rsync -av --list-only rsync://127.0.0.1/dev

receiving incremental file list
drwxr-xr-x             48 2022/09/19 09:43:10 .
-rw-r--r--              0 2022/09/19 09:34:50 build.sh
-rw-r--r--              0 2022/09/19 09:36:02 secrets.yaml
drwx------             54 2022/09/19 09:43:10 .ssh

sent 25 bytes  received 221 bytes  492.00 bytes/sec
total size is 0  speedup is 0.00

R-Services

/etc/hosts.equiv

cat /etc/hosts.equiv

# <hostname> <local username>
pwnbox cry0l1t3

Scanning for R-Services

sudo nmap -sV -p 512,513,514 10.0.17.2

Starting Nmap 7.80 ( https://nmap.org ) at 2022-12-02 15:02 EST
Nmap scan report for 10.0.17.2
Host is up (0.11s latency).

PORT    STATE SERVICE    VERSION
512/tcp open  exec?
513/tcp open  login?
514/tcp open  tcpwrapped

Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 145.54 seconds

Access Control & Trusted Relationships

La principal preocupaci贸n de los r-services, y una de las principales razones por las que se introdujo SSH para sustituirlo, son los problemas inherentes al control de acceso de estos protocolos. Los r-servicios se basan en informaci贸n de confianza enviada desde el cliente remoto a la m谩quina anfitriona en la que intentan autenticarse. Por defecto, estos servicios utilizan Pluggable Authentication Modules (PAM) para la autenticaci贸n de usuarios en un sistema remoto; sin embargo, tambi茅n evitan esta autenticaci贸n mediante el uso de los archivos /etc/hosts.equiv y .rhosts en el sistema. Los archivos hosts.equiv y .rhosts contienen una lista de hosts (IPs o nombres de host) y usuarios en los que conf铆a el host local cuando se realiza un intento de conexi贸n utilizando r-commands. Las entradas en cualquiera de los dos archivos pueden tener el siguiente aspecto:

Sample .rhosts File

cat .rhosts

htb-student     10.0.17.5
+               10.0.17.10
+               +

Logging in Using Rlogin

rlogin 10.0.17.2 -l htb-student

Last login: Fri Dec  2 16:11:21 from localhost

[htb-student@localhost ~]$

Listing Authenticated Users Using Rwho

rwho

root     web01:pts/0 Dec  2 21:34
htb-student     workstn01:tty1  Dec  2 19:57  2:25

Listing Authenticated Users Using Rusers

rusers -al 10.0.17.5

htb-student     10.0.17.5:console          Dec 2 19:57     2:25
AnteriorIPMISiguienteWindows Remote Management Protocols

脷ltima actualizaci贸n hace 10 meses