mirror of
https://github.com/HackTricks-wiki/hacktricks.git
synced 2025-10-10 18:36:50 +00:00
141 lines
7.1 KiB
Markdown
141 lines
7.1 KiB
Markdown
# Pentesting gRPC-Web
|
|
|
|
{{#include ../banners/hacktricks-training.md}}
|
|
|
|
## **gRPC-Web Payloads में हेरफेर करना**
|
|
|
|
gRPC-Web अनुरोधों में Content-Type: `application/grpc-web-text` का उपयोग करता है, जो कि बेस64 एन्कोडेड फॉर्म में एक प्रकार का protobuf है, आप [gprc-coder](https://github.com/nxenon/grpc-pentest-suite) टूल का उपयोग कर सकते हैं, और आप इसका [Burp Suite Extension](https://github.com/nxenon/grpc-pentest-suite) भी इंस्टॉल कर सकते हैं।
|
|
|
|
### **gGRPC Coder Tool के साथ मैनुअल**
|
|
|
|
1. सबसे पहले पेलोड को डिकोड करें:
|
|
```bash
|
|
echo "AAAAABYSC0FtaW4gTmFzaXJpGDY6BVhlbm9u" | python3 grpc-coder.py --decode --type grpc-web-text | protoscope > out.txt
|
|
```
|
|
2. डिकोडेड पेलोड की सामग्री संपादित करें
|
|
```
|
|
nano out.txt
|
|
2: {"Amin Nasiri Xenon GRPC"}
|
|
3: 54
|
|
7: {"<script>alert(origin)</script>"}
|
|
```
|
|
3. नए पेलोड को एन्कोड करें
|
|
```bash
|
|
protoscope -s out.txt | python3 grpc-coder.py --encode --type grpc-web-text
|
|
```
|
|
4. Burp इंटरसेप्टर में आउटपुट का उपयोग करें:
|
|
```
|
|
AAAAADoSFkFtaW4gTmFzaXJpIFhlbm9uIEdSUEMYNjoePHNjcmlwdD5hbGVydChvcmlnaW4pPC9zY3JpcHQ+
|
|
```
|
|
### **Manual with gRPC-Web Coder Burp Suite Extension**
|
|
|
|
आप [gRPC-Web Pentest Suite](https://github.com/nxenon/grpc-pentest-suite) में gRPC-Web Coder Burp Suite Extension का उपयोग कर सकते हैं जो आसान है। आप इसके रिपॉजिटरी में स्थापना और उपयोग के निर्देश पढ़ सकते हैं।
|
|
|
|
## **Analysing gRPC-Web Javascript Files**
|
|
|
|
हर gRPC-Web एप्लिकेशन में कम से कम एक Javascript फ़ाइल होती है। आप नए संदेश, एंडपॉइंट और सेवाओं को खोजने के लिए फ़ाइल का विश्लेषण कर सकते हैं। [gRPC-Scan](https://github.com/nxenon/grpc-pentest-suite) टूल का उपयोग करने की कोशिश करें।
|
|
|
|
1. Javascript gRPC-Web फ़ाइल डाउनलोड करें
|
|
2. इसे grpc-scan.py के साथ स्कैन करें:
|
|
```bash
|
|
python3 grpc-scan.py --file main.js
|
|
```
|
|
3. आउटपुट का विश्लेषण करें और नए एंडपॉइंट्स और नई सेवाओं का परीक्षण करें:
|
|
```
|
|
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 |
|
|
+--------------+----------------+--------------+
|
|
```
|
|
## संदर्भ
|
|
|
|
- [Amin Nasiri द्वारा gRPC-Web में हैकिंग लेख](https://infosecwriteups.com/hacking-into-grpc-web-a54053757a45)
|
|
- [gRPC-Web पेंटेस्ट सूट](https://github.com/nxenon/grpc-pentest-suite)
|
|
|
|
{{#include ../banners/hacktricks-training.md}}
|