> For the complete documentation index, see [llms.txt](https://g4b0.gitbook.io/g4b0-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://g4b0.gitbook.io/g4b0-docs/documentation/cheatsheets/attacking-common-applications.md).

# Attacking Common Applications

## Application Discovery & Enumeration

Una organización debería mantener un **inventario de activos** (dispositivos, software, aplicaciones). Si no sabe qué hay en su red, no puede protegerlo. Como pentesters, nuestra **enumeración** ayuda al cliente a construir/mejorar ese inventario.

> Solemos encontrar: apps olvidadas, demos con licencia expirada (ej. Splunk sin auth), credenciales por defecto/débiles, apps mal configuradas o con vulnerabilidades públicas.

Empezando con poca o ninguna info (black box o solo rangos CIDR), el flujo típico es: **ping sweep** → **port scanning** dirigido → escaneo profundo de servicios. En redes grandes, esos datos se vuelven inmanejables → herramientas de screenshotting.

***

### 1. Enumeración inicial (Nmap)

Escaneo de puertos web comunes:

```bash
sudo nmap -p 80,443,8000,8080,8180,8888,10000 --open -oA web_discovery -iL scope_list
```

| Flag                 | Descripción                                       |
| -------------------- | ------------------------------------------------- |
| `-p 80,443,8000,...` | Puertos web comunes.                              |
| `--open`             | Solo muestra puertos abiertos.                    |
| `-oA web_discovery`  | Salida en los 3 formatos (normal, XML, grepable). |
| `-iL scope_list`     | Lee la lista de objetivos de un archivo.          |

> Prestar atención a los **hostnames**: los que tienen `dev` en el FQDN pueden correr features no probadas o **debug mode**. Un `gitlab-dev` es "interesting host" → repos Git públicos con posibles credenciales.

#### Escaneo de versiones de un host

```bash
sudo nmap --open -sV 10.129.201.50
# 80/tcp   Microsoft IIS httpd 10.0
# 8000/tcp Splunkd httpd
# 8080/tcp Indy httpd ... (PRTG bandwidth monitor)
# 8089/tcp Splunkd httpd (free license)
```

| Flag  | Descripción                        |
| ----- | ---------------------------------- |
| `-sV` | Detección de versión de servicios. |

> Revisar host por host es **ineficiente** en entornos medianos/grandes → screenshotting.

***

### 2. EyeWitness

Toma el XML de Nmap (o Nessus) y genera un **reporte con screenshots** de cada web app (vía Selenium). Además **categoriza**, hace fingerprint y **sugiere credenciales por defecto**.

```bash
sudo apt install eyewitness
```

Ejecutar con la salida XML de Nmap:

```bash
eyewitness --web -x web_discovery.xml -d inlanefreight_eyewitness
```

| Flag              | Descripción                                |
| ----------------- | ------------------------------------------ |
| `--web`           | Screenshots HTTP con Selenium.             |
| `-x <file.xml>`   | Input: XML de Nmap o .nessus.              |
| `-f <file>`       | Input: archivo de URLs (una por línea).    |
| `--single <URL>`  | Un solo host.                              |
| `-d <dir>`        | Directorio de salida.                      |
| `--prepend-https` | Antepone http\:// y https\:// a cada host. |

***

### 3. Aquatone

Similar a EyeWitness. Toma un `.txt` de hosts o un XML de Nmap (con `-nmap`).

```bash
wget https://github.com/michenriksen/aquatone/releases/download/v1.7.0/aquatone_linux_amd64_1.7.0.zip
unzip aquatone_linux_amd64_1.7.0.zip
```

Ejecutar con el XML de Nmap:

```bash
cat web_discovery.xml | ./aquatone -nmap
```

> Mover el binario a un directorio del `$PATH` (ej. `/usr/local/bin`) para llamarlo desde cualquier lado. Genera un `aquatone_report.html` con los screenshots agrupados por similitud.

***

### 4. Interpretar los resultados

El reporte organiza los hosts por categorías, con **High Value Targets** primero. En entornos de 500-5000 hosts, esto ahorra horas.

Hosts que merecen atención inmediata:

| App                                 | Por qué / qué probar                                                                    |
| ----------------------------------- | --------------------------------------------------------------------------------------- |
| **Tomcat**                          | Credenciales default en `/manager` y `/host-manager` → subir WAR malicioso → RCE (JSP). |
| **Custom web apps**                 | Variedad amplia de vulnerabilidades; siempre testear.                                   |
| **CMS** (WordPress, Joomla, Drupal) | Vulnerabilidades conocidas por versión.                                                 |
| **osTicket** (support)              | Vulns históricas; acceso a info sensible, posible social engineering.                   |
| **Splunk / Jenkins / PRTG**         | Frecuentes en pentest externo; a menudo con default creds.                              |

> ⚠️ Seguimos en **information gathering**. No atacar de inmediato: anotar hosts/URL/versión y revisar **todo** el reporte antes, para no caer en rabbit holes y perder algo crítico.

#### Qué esperar por tipo de assessment

| Assessment  | Apps típicas                                                                                                                         |
| ----------- | ------------------------------------------------------------------------------------------------------------------------------------ |
| **Externo** | Custom apps, CMS, Tomcat, Jenkins, Splunk, RDS, SSL VPN, OWA, O365, portales de red edge.                                            |
| **Interno** | Impresoras (posibles creds LDAP en claro), ESXi/vCenter, iLO/iDRAC, dispositivos de red, IoT, IP phones, repos internos, SharePoint. |

***

### 5. Organización (notetaking)

Fechar y sellar cada escaneo, guardar la salida y la **sintaxis exacta** + hosts objetivo (útil si el cliente pregunta por la actividad).

Estructura sugerida (OneNote u otro) para la fase de discovery:

```
External Penetration Test - <Cliente>
├── Scope (IPs/rangos, URLs, hosts frágiles, ventanas de tiempo, limitaciones)
├── Client Points of Contact
├── Credentials
├── Discovery/Enumeration
│   ├── Scans
│   └── Live hosts
├── Application Discovery
│   ├── Scans
│   └── Interesting/Notable Hosts
├── Exploitation
│   └── <Host o IP>
└── Post-Exploitation
    └── <Host o IP>
```

> Montar el esqueleto del reporte al inicio permite ir rellenándolo mientras corren los escaneos → ahorra tiempo al final y asegura exhaustividad.

***

### Resumen rápido

| Paso                     | Herramienta  | Comando clave                               |
| ------------------------ | ------------ | ------------------------------------------- |
| 1. Descubrir puertos web | Nmap         | `-p 80,443,... --open -oA -iL scope_list`   |
| 2. Versiones             | Nmap         | `-sV`                                       |
| 3. Screenshots           | EyeWitness   | `--web -x web_discovery.xml -d <dir>`       |
| 3. Screenshots (alt)     | Aquatone     | `cat web_discovery.xml \| ./aquatone -nmap` |
| 4. Interpretar           | Reporte HTML | Priorizar High Value Targets.               |

> Los escaneos son **inputs** para la validación **manual**, no un reemplazo: el elemento humano encuentra las vulnerabilidades más únicas y severas. Metodología repetible + organización + notas detalladas = base de un buen reporte.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://g4b0.gitbook.io/g4b0-docs/documentation/cheatsheets/attacking-common-applications.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
