Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Client Hello reuse documentation #7

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.PHONY: run utlsproxy


all: utlsproxy

# note: marking "utlsproxy" as phony because we want to recompile
# each time in case we made changes locally to a dependency.

utlsproxy:
go build -o utlsproxy certstore.go main.go

run: utlsproxy
./utlsproxy
31 changes: 31 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,37 @@ All (to my knowledge) MITM proxies replay requests to servers with stdlib transp

Curious how? Most of the work is at [saucesteals/goproxy](https://github.com/saucesteals/goproxy) (credits to [elazarl/goproxy](https://github.com/elazarl/goproxy) for the base proxy implementation)

## Injecting a Client Hello from a previous session

Instead of fingerprinting the proxy client's ClientHello, you might want to save a ClientHello and re-inject it. E.g. you can save a Safari ClientHello and use it for your cURL requests.

### Saving a Client Hello

Simply define the `GOPROXY_CLIENT_HELLO_SAVE_DIR` variable:

```bash
GOPROXY_CLIENT_HELLO_SAVE_DIR="./client_hello" ./utlsproxy
```

This will save the client hello files in the `./client_hello` directory.

### Re-using a saved Client Hello

This time, define the `GOPROXY_OVERWRITE_CLIENT_HELLO` variable:

```bash
GOPROXY_OVERWRITE_CLIENT_HELLO="./client_hello/ch_safari_17.4.1_macOS_14.4.1.bin" ./utlsproxy
```

All requests will then have Safari's fingerprint.

To confirm

```bash
curl --silent --insecure --proxy localhost:8080 https://tls.peet.ws/api/tls | jq .tls.peetprint_hash
# "b2bafdc69377086c3416be278fd21121"
```

## mTLS

Like every other MITM, this will not work with mTLS. Find the client's certificate and private key, then add it to the tls.Config (Rarely will you need this, so this is only possible by cloning and adding it yourself)
Expand Down
Binary file added client_hello/ch_safari_17.4.1_macOS_14.4.1.bin
Binary file not shown.
3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ module github.com/saucesteals/utlsproxy

go 1.21.0

replace github.com/elazarl/goproxy => github.com/saucesteals/goproxy v0.0.0-20240124022437-840670a451ca
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revert/wait for saucesteals/goproxy#2 to update the version here

// replace github.com/elazarl/goproxy => github.com/saucesteals/goproxy v0.0.0-20240124022437-840670a451ca
replace github.com/elazarl/goproxy => ../goproxy

require (
github.com/elazarl/goproxy v0.0.0-20240124022437-840670a451ca
Expand Down