#learn365 Day-20: GraphQL Series Part - 1
- GraphQL is a query language for the underlying API.
- A single endpoint can be used as a query API to perform all the actions including Create, Read, Update & Delete.
(2/n)
- GraphQL has its own type of system that’s used to define the schema of an API. The syntax for writing schemas is called Schema Definition Language (SDL).
# A GraphQL operation can be of type: 1. query (a read-only fetch) 2. mutation (a write followed by fetch)
(3/n) 3. subscription (a long‐lived request that fetches data in response to source events.)
- A GraphQL document can contain one or more of these operations (i.e multiple queries/mutations/subscriptions).
- Mutations queries modify data in the data store and returns a value.
(4/n)
- Fields: describes a discrete piece of info. This info could be simple or complex with relationships between data.
- Directives are identifiers that add additional functionality wi/o affecting the value of the response but can affect what response comes back to the client.
(5/n)
# Introspection Queries
A GraphQL server supports introspection over its schema using the same GraphQL query language.
A server exposes the following introspection queries on the Query operation type.
__schema
__type
__typename
Note that introspection queries start with __
(6/n)
# Some Attacks in GraphQL 1. Unauthenticated Access to GraphQL Endpoint 2. Introspection Queries are Enabled 3. GraphQL in Debug Mode 4. Application Level DoS 5. SQL Injection 6. IDOR 7. Data Exposure through Error Messages 8. Misc. GraphQL Attacks
(7/n)
# Unauthenticated Access to the GraphQL Endpoint
1. Supposed your target runs GraphQL, now as an unauthenticated user hit the following URL:
https://your_target/graphiql 2. If you are able to access the GraphQL Console, try running some schema extraction or other queries
(8/n) 3. Alternatively you can also try to query https://your_target_url/graphql?query={query_here} 4. If you are able to extract information as an unauthenticated user, this is an issue.
# I will cover some other GraphQL Attack Vectors in the coming days.
Pentesting GraphQL may look hard if you are not familiar but there is still a lot to explore and exploit once you understand how it works. Today, It's all about continue reading and some good resources.
#learn365 Day-21: GraphQL Vulnerabilities (Part-2) 1. Information Disclosure via Error Messages
- Similar to the normal information disclosure via error triggering.
- Provide malformed or unexpected input within GraphQL queries.
(2/n)
- Sometimes you may observe verbose error messages revealing sensitive information.
2. GraphQL Denial of Service
- Due to an improper limit on the maximum query depth, it might be possible to perform a denial of service in graphql implementation.
(3/n)
- Nest a query to unlimited depth and send this query on a GraphQL endpoint to observe anything suspicious.
- A good example: owasp-skf.gitbook.io/asvs-write-ups…
WebSocket is a network protocol that enables 2-way communication b/w client & server. In the HTTP standard, where the one-party has to wait for the req./res from another party before performing the next action.
(2/n)
The major goal of WebSocket is to enable real-time communication and can widely be seen in IM applications.
I will be diving the WebSocket learning into 3 parts and I will post more about various attacks in the next two days.
(3/n)
# Web socket Protocol Scheme
1. Websockets use wss:// and ws:// as the protocol scheme. 2. This is similar to HTTPS and HTTP. Here, the WSS:// is a secure channel where WS:// is an insecure channel.
#learn365 Day-12: Unicode Normalization
This attack is hard to explain w/o proper graphics. Please refer to the references mentioned for a detailed explanation. This is a really good attack vector to try and consider while doing PT/BB.
(1/n) #bugbountytips#AppSec#infosec
(2/n)
Unicode to ASCII Transformation is a two-step process.
1. Normalization: Where the characters are converted to a standardized form 2. Punycoding: Where the Unicode is turned into ASCII
There are two overall types of equivalence between characters:......
(3/n) 1. Canonical Equivalence: Characters are assumed to have the same appearance and meaning when printed or displayed.
2. Compatibility Equivalence: This is a weaker equivalence, in that two values may represent the same abstract character but can be displayed differently.
#Learn365 Day-11: Cache Poisoned Denial of Service (CPDos)
AIO Resource: cpdos.org
- One of a kind of Web Cache Poisoning attack that affects the resources used by an application to create a denial of service situation.
The working of this attack is theoretically very simple to understand:
1. The attacker sends a request to the server containing a malicious header with a malicious value. This can be any random header.
ex: x-mal-example: tohackthehacker
(3/n) 2. This request is first processed by the intermediate cache server to check if the copy exists. 3. The cache server forwards the attacker's request with malicious headers to the origin server as it doesn't store a fresh copy of the requested resource.
#Learn365 Day - 8: JSONP Attack
(Deleted prev. post and re-sharing as there are some modifications & to avoid false statement)
JSONP stands for JavaScript Object Notation with Padding which allows sending JSON data across domains without worrying about Cross-Domain Issues. (1/n)
(2/n)
It utilizes <script> tag to perform the action instead of using XHR. However, the function requires to be existing in the global scope.
It is an insecure communication method & should be used when no personal/sensitive data is involved & sanitizing the callback function.
(3/n)There are multiple attacks affecting the JSONP implementation as it doesn't have a security feature.
The “padding” or function to call with the JSON data, is often specified as a parameter. Often this parameter is called callback and is reflected as-is in the response.