DEV Community

Cover image for Lab: Accidental exposure of private GraphQL fields
tRavOndAtrACk
tRavOndAtrACk

Posted on

Lab: Accidental exposure of private GraphQL fields

Author: travondatrack
Date: 14/01/2026
Category: Pentest | Web | Security
Difficulty: PRACTITIONER
Tags: GraphQL


Mô tả

The user management functions for this lab are powered by a GraphQL endpoint. The lab contains an access control vulnerability whereby you can induce the API to reveal user credential fields.

To solve the lab, sign in as the administrator and delete the username carlos.

Link: https://portswigger.net/web-security/graphql/lab-graphql-accidental-field-exposure


Phân tích vấn đề

Recon

  • Truy cập "My account" → thử login bất kỳ → request là POST GraphQL mutation với username/password.
  • Endpoint: /graphql
  • Login mutation không thành công nhưng vẫn đi qua GraphQL.
  • Introspection query bị bật → có thể khám phá toàn bộ schema.

Khai thác

Bước 1: Khám phá schema

  • Intercept login request (GraphQL mutation) → Send to Repeater
  • Right-click trong request body → GraphQL > Set introspection query
  • Send → response trả về full schema
  • Sử dụng extension InQL để dễ dàng xem schema.

Bước 2: Lấy credential của administrator

  • Nhập bừa tài khoản để bắt URL.

  • Dễ dàng nhận thấy GraphQL Introspection bị bật công khai. Dùng extension InQL để xem rõ schema.

  • Trong getUser có chứa cái field nhạy cảm.

  • Mẫu truy vấn có dạng:

query {
  getUser(id: ...) {
    username
    password
  }
}

Enter fullscreen mode Exit fullscreen mode
  • Thử truy vấn với id=1.

==> Lộ username + password của admin.


### Submit

==> DONE!

Top comments (0)