> For the complete documentation index, see [llms.txt](https://beafn28.gitbook.io/beafn28/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://beafn28.gitbook.io/beafn28/web-security/laboratorios-portswigger/api-testing.md).

# API testing

## Lab: Exploiting an API endpoint using documentation

### Enunciado

Para resolver el laboratorio, encuentra la documentación de la API expuesta y elimina al usuario carlos.

Puedes iniciar sesión en tu propia cuenta con las siguientes credenciales:

* **Usuario:** `wiener`
* **Contraseña:** `peter`

### Resolución

Nos logueamos. Normalmente la API está en la ruta **/api**.

<figure><img src="https://469389308-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbKXfRjFOYJgGlV1An6Cf%2Fuploads%2FYjkV0vlfWmJ8KhCwx7Ko%2Fimage.png?alt=media&amp;token=227aab3f-426d-4c3c-86cf-fb7d62d369fc" alt=""><figcaption></figcaption></figure>

Enviamos petición.

<figure><img src="https://469389308-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbKXfRjFOYJgGlV1An6Cf%2Fuploads%2FipeBzjUiMzLFVmBorKWy%2Fimage.png?alt=media&amp;token=7c40b3f3-213a-401c-851a-a3ef4267382d" alt=""><figcaption></figcaption></figure>

Estamos autenticados con el usuario wiener. Sabiendo esto vamos a probar a borrar con el endpoint el usuario carlos (no valida bien los permisos).

<figure><img src="https://469389308-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbKXfRjFOYJgGlV1An6Cf%2Fuploads%2FP1rTgCLmt4f7Xpznkbbs%2Fimage.png?alt=media&amp;token=d65b6c95-7091-4daa-86f5-ede59c35fcdc" alt=""><figcaption></figcaption></figure>

Lo borramos sin problemas.

<figure><img src="https://469389308-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbKXfRjFOYJgGlV1An6Cf%2Fuploads%2FrOxSRCPx1B0LpzrwmbGI%2Fimage.png?alt=media&amp;token=a7649a01-a56f-43e8-9efe-c3e8e8673aab" alt=""><figcaption></figcaption></figure>
