Support transparent TLS interception on HTTP proxy port

Aperta
#2,786 8 commenti 0 reazioni 1 assegnatario Vedi su GitHub

@NghiaTranUIT ci sta già lavorando.

Dal 7/10/2026.

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

✅ Done enhancement

Description

This was noticed when using https://github.com/httptoolkit/frida-interception-and-unpinning. Using it with Proxyman (with and without SOCKS) doesn't work (related: https://github.com/httptoolkit/frida-interception-and-unpinning/issues/126). This feature request focuses on the non-SOCKS case since it's significantly simpler and can be tested more representatively without Frida (after getting pcaps of the SOCKS case I still have no idea what the issue is).

I vibed out a repro Python script (stdlib only, tested on Python 3.14):

#!/usr/bin/env python3
"""Repro: transparent HTTPS interception (no proxy protocol) a la
httptoolkit/frida-interception-and-unpinning with PROXY_SUPPORTS_SOCKS5=false.

What the Frida scripts do in transparent mode: rewrite the socket destination
to the proxy's host:port and then speak *normal* HTTP/TLS, as if talking
directly to the origin. The proxy is expected to sniff Host/SNI and MITM.
HTTP Toolkit handles this on its port. This script checks whether the proxy
under test does too.

Usage:
    python3 proxyman-transparent-repro.py --proxy 127.0.0.1 --port 9090
    python3 proxyman-transparent-repro.py --proxy 127.0.0.1 --port 8000

Exit code 0 = transparent HTTP+HTTPS both work (agent target state).
Exit code 1 = transparent interception unsupported/broken.

For HTTPS to be MITM'd (rather than blind-tunneled), enable SSL Proxying /
decryption for example.com in the proxy under test first.
"""

import argparse
import socket
import ssl
import sys

SNI = "example.com"
TIMEOUT = 10


def check_plain_http(host, port):
    """Origin-form HTTP request straight at the proxy port (transparent)."""
    try:
        s = socket.create_connection((host, port), timeout=TIMEOUT)
        s.sendall(
            f"GET / HTTP/1.1\r\nHost: {SNI}\r\n"
            "User-Agent: transparent-repro/1.0\r\n"
            "Connection: close\r\n\r\n".encode()
        )
        resp = b""
        while True:
            chunk = s.recv(65536)
            if not chunk:
                break
            resp += chunk
        s.close()
        head = resp.split(b"\r\n", 1)[0] if resp else b"<empty>"
        ok = head.startswith(b"HTTP/1.1 200") or head.startswith(b"HTTP/1.0 200")
        return ok, f"first line: {head!r} ({len(resp)} bytes total)"
    except Exception as e:
        return False, f"{type(e).__name__}: {e}"


def check_transparent_tls(host, port):
    """Raw TLS ClientHello with SNI straight at the proxy port (transparent).

    No CONNECT, no SOCKS handshake - exactly what the Frida connect hooks
    produce. Expects the proxy to MITM with its own CA-issued cert.
    """
    try:
        raw = socket.create_connection((host, port), timeout=TIMEOUT)
        ctx = ssl.create_default_context()
        ctx.check_hostname = False
        ctx.verify_mode = ssl.CERT_NONE
        # SNI = example.com lets a transparent proxy route + forge the cert.
        tls = ctx.wrap_socket(raw, server_hostname=SNI)
        info = tls.getpeercert() or {}
        issuer = dict(x[0] for x in info.get("issuer", []))
        issuer_cn = issuer.get("commonName", issuer) if isinstance(issuer, dict) else issuer
        der = tls.getpeercert(binary_form=True)
        if not der:
            tls.close()
            return False, "handshake ok but peer presented no certificate"
        tls.sendall(
            f"GET / HTTP/1.1\r\nHost: {SNI}\r\n"
            "User-Agent: transparent-repro/1.0\r\n"
            "Connection: close\r\n\r\n".encode()
        )
        resp = b""
        while True:
            try:
                chunk = tls.recv(65536)
            except ssl.SSLError:
                break
            if not chunk:
                break
            resp += chunk
        tls.close()
        head = resp.split(b"\r\n", 1)[0] if resp else b"<empty>"
        ok = head.startswith(b"HTTP/1.1 200") or head.startswith(b"HTTP/1.0 200")
        return ok, f"issuer_cn={issuer_cn} first line: {head!r} ({len(resp)} bytes total)"
    except Exception as e:
        return False, f"{type(e).__name__}: {e}"


def main():
    ap = argparse.ArgumentParser()
    ap.add_argument("--proxy", default="127.0.0.1")
    ap.add_argument("--port", type=int, required=True)
    args = ap.parse_args()

    print(f"Transparent interception repro against {args.proxy}:{args.port} (SNI/host={SNI})")
    results = []

    ok, detail = check_plain_http(args.proxy, args.port)
    results.append(ok)
    print(f"[{'PASS' if ok else 'FAIL'}] transparent plain HTTP : {detail}")

    ok, detail = check_transparent_tls(args.proxy, args.port)
    results.append(ok)
    print(f"[{'PASS' if ok else 'FAIL'}] transparent TLS+HTTP   : {detail}")

    if all(results):
        print("RESULT: PASS - transparent interception works")
        return 0
    print("RESULT: FAIL - transparent interception unsupported/broken")
    return 1


if __name__ == "__main__":
    sys.exit(main())

HTTP Toolkit:

Transparent interception repro against 127.0.0.1:8000 (SNI/host=example.com)
[PASS] transparent plain HTTP : first line: b'HTTP/1.1 200 OK' (931 bytes total)
[PASS] transparent TLS+HTTP   : issuer_cn={} first line: b'HTTP/1.1 200 OK' (931 bytes total)
RESULT: PASS - transparent interception works

Proxyman:

Transparent interception repro against 127.0.0.1:9090 (SNI/host=example.com)
[PASS] transparent plain HTTP : first line: b'HTTP/1.1 200 OK' (931 bytes total)
[FAIL] transparent TLS+HTTP   : SSLEOFError: [SSL: UNEXPECTED_EOF_WHILE_READING] EOF occurred in violation of protocol (_ssl.c:1082)
RESULT: FAIL - transparent interception unsupported/broken

Why this feature/change is important?

Using those Frida hooks allows proxying basically any iOS app, including Flutter apps, without any code changes. It's extremely useful but seemingly cannot be used with Proxyman currently (at least macOS v26.0.1).

Lingua principale
Nessun dato sulla lingua
Stelle
7.1k
Fork
238
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di ProxymanApp/Proxyman

Tutte le issue di ProxymanApp/Proxyman

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.