> For the complete documentation index, see [llms.txt](https://books.spartan-cybersec.com/cpna/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://books.spartan-cybersec.com/cpna/tecnicas-de-enumeracion-en-iam/enumeracion-manual-con-awscli/enumerando-usuarios.md).

# Enumerando usuarios

{% hint style="danger" %}
¿Crees tener lo que se necesita para ser un experto en Pentesting contra AWS? Si nuestro libro te abrió los ojos a las posibilidades de la ciberseguridad ofensiva o si ya cuentas con habilidades en este campo, es momento de subir de nivel. Te retamos a certificarte en el [CPNA - Curso Profesional de Pentesting Contra AWS](https://spartan-cybersec.com/cursos/pentesting-contra-la-nube-de-aws/). No será fácil: te enfrentarás a un examen riguroso de 12 horas donde deberás hackear una infraestructura completa alojada en AWS. ¿Listo para el desafío? Acepta el reto y demuestra tu verdadero potencial.
{% endhint %}

### <mark style="color:orange;">**Enumeración de Usuarios**</mark>

El siguiente comando proporciona una lista de todos los usuarios IAM en la cuenta de AWS. Es el primer paso para entender quién tiene acceso.

```json
PS C:\Users\gerh-> aws iam list-users
{
    "Users": [
        {
            "Path": "/",
            "UserName": "admin.spartan",
            "UserId": "AIDAYPUD57AEVKOX7Z2MG",
            "Arn": "arn:aws:iam::583318501385:user/admin.spartan",
            "CreateDate": "2023-04-28T14:25:25+00:00",
            "PasswordLastUsed": "2023-11-15T00:32:54+00:00"
        },
        {
            "Path": "/",
            "UserName": "cpna.9100",
            "UserId": "AIDAYPUD57AE7E6OE33YY",
            "Arn": "arn:aws:iam::583318501385:user/cpna.9100",
            "CreateDate": "2024-01-17T01:31:58+00:00",
            "PasswordLastUsed": "2024-01-31T23:11:10+00:00"
        },
        {
            "Path": "/",
            "UserName": "estudiante.cpna",
            "UserId": "AIDAYPUD57AEQYMJPXY7O",
            "Arn": "arn:aws:iam::583318501385:user/estudiante.cpna",
            "CreateDate": "2024-02-03T20:17:33+00:00"
        }]
}
```

### <mark style="color:orange;">**Verificación de Grupos por Usuario**</mark><mark style="color:orange;">:</mark>

Revela los grupos IAM a los que pertenece un usuario específico, lo cual es crucial para comprender la estructura de permisos.

```json
PS C:\Users\gerh-> aws iam list-groups-for-user --user-name estudiante.cpna
{
    "Groups": [
        {
            "Path": "/",
            "GroupName": "Spartan-Developers",
            "GroupId": "AGPAYPUD57AEZ5EKN7YQ6",
            "Arn": "arn:aws:iam::583318501385:group/Spartan-Developers",
            "CreateDate": "2024-02-03T20:45:58+00:00"
        }
    ]
}
```

### <mark style="color:orange;">**Dispositivos MFA Virtuales**</mark><mark style="color:orange;">:</mark>

Identifica todos los dispositivos MFA virtuales en la cuenta, una pieza clave para la seguridad de autenticación de dos factores.

```json
PS C:\Users\gerh-> aws iam list-virtual-mfa-devices
{
    "VirtualMFADevices": [
        {
            "SerialNumber": "arn:aws:iam::583318501385:mfa/Phone-Gerh",
            "User": {
                "UserName": "labs-cpna",
                "UserId": "583318501385",
                "Arn": "arn:aws:iam::583318501385:root",
                "CreateDate": "2023-04-18T17:35:00+00:00",
                "PasswordLastUsed": "2024-02-03T20:11:48+00:00"
            },
            "EnableDate": "2023-04-26T23:58:38+00:00"
        }
    ]
}
```

### <mark style="color:orange;">**Políticas Asociadas a Usuarios**</mark><mark style="color:orange;">:</mark>

Proporciona detalles sobre las políticas IAM que están directamente vinculadas a un usuario IAM específico.

```json
PS C:\Users\gerh-> aws iam list-attached-user-policies --user-name estudiante.cpna
{
    "AttachedPolicies": [
        {
            "PolicyName": "SecurityAudit",
            "PolicyArn": "arn:aws:iam::aws:policy/SecurityAudit"
        }
    ]
}
```

Enumera las políticas IAM que están asignadas a un usuario IAM, lo que incluye políticas en línea definidas específicamente para ese usuario.

```json
PS C:\Users\gerh-> aws iam list-user-policies --user-name estudiante.cpna
{
    "PolicyNames": []
}
```


---

# 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://books.spartan-cybersec.com/cpna/tecnicas-de-enumeracion-en-iam/enumeracion-manual-con-awscli/enumerando-usuarios.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.
