> 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/ssti/ssti-information-disclosure-via-python-user-objects.md).

# كشف المعلومات عبر SSTI باستخدام كائنات مستخدم Python

### حقن القوالب من جهة الخادم مع إفشاء المعلومات عبر كائنات يقدّمها المستخدم

الهدف من المختبر هو استخدام ثغرة SSTI الناتجة عن الطريقة التي يُمرَّر بها كائن إلى القالب لاستخراج البيانات الحساسة، وبالأخص المفتاح السري للإطار. / لدينا حساب: `content-manager: C0nt3ntM4n4g3r`.

#### تحليل وتحديد ITST

الخطوة الأولى هي التسبب في خطأ في محرك القوالب باستخدام التعبير التالي:

```
{{}}
```

<figure><img src="/files/2aa30b37cc72cc57d9a93a2e6bf87bcbf7ea8b3d" alt=""><figcaption></figcaption></figure>

* هذا يؤكد أننا نستطيع حقن كود قالب من جهة الخادم.

ثم حاول عرض المزيد من معلومات التصحيح عبر حقن: / `{% debug %}`

```python
{% debug %}
```

* ومع ذلك، لا تظهر أي معلومات مثيرة للاهتمام أو حساسة في الناتج.

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

#### استرجاع المفتاح السري

* بما أن الكائن الممرَّر إلى القالب يوفّر الوصول إلى الإعدادات، نحاول قراءة المفتاح السري للإطار مباشرة عبر المعاملات: / `{{settings.SECRET_KEY}}`

```python
{{settings.SECRET_KEY}}
```

<figure><img src="/files/12bd4462908df5f9e575d1458dd28d92a92656b0" 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/ssti/ssti-information-disclosure-via-python-user-objects.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.
