gRPC Calling Convention Simulation #2
DuckSoft
started this conversation in
Mind Blown
Replies: 2 comments
-
Beta Was this translation helpful? Give feedback.
0 replies
-
A Working PoC: package main
import (
"crypto/tls"
"golang.org/x/net/http2"
"io"
"log"
"net"
"net/http"
"os"
"time"
)
func main() {
client := http.Client{
Transport: &http2.Transport{AllowHTTP: false, DialTLS: func(network, addr string, cfg *tls.Config) (net.Conn, error) {
return net.Dial(network, addr)
}},
}
reader, writer := io.Pipe()
req, err := http.NewRequest(http.MethodPost, "https://127.0.0.1:23333/GunService/Tun", io.NopCloser(reader))
if err != nil {
panic(err)
}
req.Header.Set("content-type", "application/grpc+proto")
req.Header.Set("user-agent", "grpc-java/1.2.3")
go func() {
for {
n, err := writer.Write([]byte{0x00, 0x00, 0x00, 0x00, 0x04, 0x0A, 0x02, 0x2E, 0x0A})
time.Sleep(time.Second)
log.Printf("%d written", n)
if err != nil {
panic(err)
}
}
}()
resp, err := client.Do(req)
if err != nil {
panic(err)
}
_, _ = io.Copy(os.Stdout, resp.Body)
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
In this thread we are going to discuss the behaviour about how gRPC is (ab)using HTTP/2 Streams and Headers, and how is the exact subset of behaviour we need to become a legitimate client.
Found a documentation: https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md
Beta Was this translation helpful? Give feedback.
All reactions