# SSH

## Enumeración

```bash
nxc ssh scope.txt
```

### Algoritmos y cifrados soportados

```bash
nmap -sV --script=ssh2-enum-algos -p 22 192.168.1.100
```

## Vulnerabilidades

### CVE-2024-6387 - RegreSSHion

```bash
git clone https://github.com/xaitax/CVE-2024-6387_Check
cd CVE-2024-6387_Check
python3 CVE-2024-6387_Check.py <ip>
python3 CVE-2024-6387_Check.py <ip> -p 22,2222
python3 CVE-2024-6387_Check.py -l <ip list.txt>
```

### CVE-2018-15473 - Enumeración de usuarios

<https://github.com/epi052/cve-2018-15473>

Para comprobar esta vulnerabilidad, se comprueba si la respuesta obtenida en el caso de un usuario existente y no existente en el sistema difiere.&#x20;

```bash
python3 ssh-username-enum.py 192.168.1.100 -u root
```

Si el usuario con nombre no existente (nombre *random* que no se sospeche que pueda estar creado en el sistema), no se obtendrá respuesta. Verificando que los usuarios para los que se tenga una respuesta satisfactoria, serán válidos.

```bash
python3 ssh-username-enum.py 192.168.1.100 -u noexists
```

Para obtener una respuesta en formato CSV de múltiples *hosts*:

{% code overflow="wrap" %}

```bash
#!/bin/bash

while read -r host; do
    # Ejecuta ssh-username-enum.py y almacena ambos resultados en variables
    NOUSER=$(python3 ssh-username-enum.py "$host" -u tarlogic | grep -q "found\!")
    USER=$(python3 ssh-username-enum.py "$host" -u root | grep -q "found\!")

    # Verifica los resultados de NOUSER y USER
    if [[ $? -eq 0 ]]; then
        if [[ $? -eq 0 ]]; then
            echo "$host;vulnerable"
        else
            continue
        fi
    else
        echo "$host;no vulnerable"
    fi
done < "$1"

```

{% endcode %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://www.xtormin.com/pentesting-en-infraestructuras/servicios/ssh.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
