# Pentesting gRPC-Web {% hint style="success" %} Leer & oefen AWS Hacking:[**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)\ Leer & oefen GCP Hacking: [**HackTricks Training GCP Red Team Expert (GRTE)**](https://training.hacktricks.xyz/courses/grte)
Support HackTricks * Kyk na die [**subskripsie planne**](https://github.com/sponsors/carlospolop)! * **Sluit aan by die** 💬 [**Discord groep**](https://discord.gg/hRep4RUj7f) of die [**telegram groep**](https://t.me/peass) of **volg** ons op **Twitter** 🐩 [**@hacktricks\_live**](https://twitter.com/hacktricks\_live)**.** * **Deel hacking truuks deur PRs in te dien na die** [**HackTricks**](https://github.com/carlospolop/hacktricks) en [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github repos.
{% endhint %} ## **Manipulasie van gRPC-Web Payloads** gRPC-Web gebruik Content-Type: `application/grpc-web-text` in versoeke wat 'n soort protobuf in base64-gecodeerde vorm is, jy kan die [gprc-coder](https://github.com/nxenon/grpc-pentest-suite) hulpmiddel gebruik, en jy kan ook sy [Burp Suite Extension](https://github.com/nxenon/grpc-pentest-suite) installeer. ### **Handmatig met gGRPC Coder Tool** 1. Eerstens decodeer die payload: ```bash echo "AAAAABYSC0FtaW4gTmFzaXJpGDY6BVhlbm9u" | python3 grpc-coder.py --decode --type grpc-web-text | protoscope > out.txt ``` 2. Wysig die inhoud van die gedecodeerde las ``` nano out.txt 2: {"Amin Nasiri Xenon GRPC"} 3: 54 7: {""} ``` 3. Kodifiseer die nuwe payload ```bash protoscope -s out.txt | python3 grpc-coder.py --encode --type grpc-web-text ``` 4. Gebruik uitvoer in Burp-interceptor: ``` AAAAADoSFkFtaW4gTmFzaXJpIFhlbm9uIEdSUEMYNjoePHNjcmlwdD5hbGVydChvcmlnaW4pPC9zY3JpcHQ+ ``` ### **Handleiding met gRPC-Web Coder Burp Suite Uitbreiding** Jy kan die gRPC-Web Coder Burp Suite Uitbreiding in [gRPC-Web Pentest Suite](https://github.com/nxenon/grpc-pentest-suite) gebruik wat makliker is. Jy kan die installasie- en gebruiksaanwysings in sy repo lees. ## **Analiseer gRPC-Web Javascript LĂȘers** Daar is ten minste een Javascript-lĂȘer in elke gRPC-Web toepassing. Jy kan die lĂȘer analiseer om nuwe boodskappe, eindpunte en dienste te vind. Probeer om die [gRPC-Scan](https://github.com/nxenon/grpc-pentest-suite) hulpmiddel te gebruik. 1. Laai die Javascript gRPC-Web LĂȘer af 2. Skandeer dit met grpc-scan.py: ```bash python3 grpc-scan.py --file main.js ``` 3. Analiseer die uitvoer en toets die nuwe eindpunte en nuwe dienste: ``` Output: Found Endpoints: /grpc.gateway.testing.EchoService/Echo /grpc.gateway.testing.EchoService/EchoAbort /grpc.gateway.testing.EchoService/NoOp /grpc.gateway.testing.EchoService/ServerStreamingEcho /grpc.gateway.testing.EchoService/ServerStreamingEchoAbort Found Messages: grpc.gateway.testing.EchoRequest: +------------+--------------------+--------------+ | Field Name | Field Type | Field Number | +============+====================+==============+ | Message | Proto3StringField | 1 | +------------+--------------------+--------------+ | Name | Proto3StringField | 2 | +------------+--------------------+--------------+ | Age | Proto3IntField | 3 | +------------+--------------------+--------------+ | IsAdmin | Proto3BooleanField | 4 | +------------+--------------------+--------------+ | Weight | Proto3FloatField | 5 | +------------+--------------------+--------------+ | Test | Proto3StringField | 6 | +------------+--------------------+--------------+ | Test2 | Proto3StringField | 7 | +------------+--------------------+--------------+ | Test3 | Proto3StringField | 16 | +------------+--------------------+--------------+ | Test4 | Proto3StringField | 20 | +------------+--------------------+--------------+ grpc.gateway.testing.EchoResponse: +--------------+--------------------+--------------+ | Field Name | Field Type | Field Number | +==============+====================+==============+ | Message | Proto3StringField | 1 | +--------------+--------------------+--------------+ | Name | Proto3StringField | 2 | +--------------+--------------------+--------------+ | Age | Proto3IntField | 3 | +--------------+--------------------+--------------+ | IsAdmin | Proto3BooleanField | 4 | +--------------+--------------------+--------------+ | Weight | Proto3FloatField | 5 | +--------------+--------------------+--------------+ | Test | Proto3StringField | 6 | +--------------+--------------------+--------------+ | Test2 | Proto3StringField | 7 | +--------------+--------------------+--------------+ | Test3 | Proto3StringField | 16 | +--------------+--------------------+--------------+ | Test4 | Proto3StringField | 20 | +--------------+--------------------+--------------+ | MessageCount | Proto3IntField | 8 | +--------------+--------------------+--------------+ grpc.gateway.testing.ServerStreamingEchoRequest: +-----------------+-------------------+--------------+ | Field Name | Field Type | Field Number | +=================+===================+==============+ | Message | Proto3StringField | 1 | +-----------------+-------------------+--------------+ | MessageCount | Proto3IntField | 2 | +-----------------+-------------------+--------------+ | MessageInterval | Proto3IntField | 3 | +-----------------+-------------------+--------------+ grpc.gateway.testing.ServerStreamingEchoResponse: +------------+-------------------+--------------+ | Field Name | Field Type | Field Number | +============+===================+==============+ | Message | Proto3StringField | 1 | +------------+-------------------+--------------+ grpc.gateway.testing.ClientStreamingEchoRequest: +------------+-------------------+--------------+ | Field Name | Field Type | Field Number | +============+===================+==============+ | Message | Proto3StringField | 1 | +------------+-------------------+--------------+ grpc.gateway.testing.ClientStreamingEchoResponse: +--------------+----------------+--------------+ | Field Name | Field Type | Field Number | +==============+================+==============+ | MessageCount | Proto3IntField | 1 | +--------------+----------------+--------------+ ``` ## Verwysings * [Hacking in gRPC-Web Artikel deur Amin Nasiri](https://infosecwriteups.com/hacking-into-grpc-web-a54053757a45) * [gRPC-Web Pentest Suite](https://github.com/nxenon/grpc-pentest-suite) {% hint style="success" %} Leer & oefen AWS Hacking:[**HackTricks Opleiding AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)\ Leer & oefen GCP Hacking: [**HackTricks Opleiding GCP Red Team Expert (GRTE)**](https://training.hacktricks.xyz/courses/grte)
Ondersteun HackTricks * Kyk na die [**subskripsie planne**](https://github.com/sponsors/carlospolop)! * **Sluit aan by die** 💬 [**Discord groep**](https://discord.gg/hRep4RUj7f) of die [**telegram groep**](https://t.me/peass) of **volg** ons op **Twitter** 🐩 [**@hacktricks\_live**](https://twitter.com/hacktricks\_live)**.** * **Deel hacking truuks deur PRs in te dien na die** [**HackTricks**](https://github.com/carlospolop/hacktricks) en [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github repos.
{% endhint %}