Skip to content

Raw CONNECT tunnels bypass the Eval contamination filter and the egress audit log #2977

Closed

Description

@Astro-Han

packages/eval/harbor/egress_filter.py implements only the request hook and classifies flow.request.pretty_url. mitmproxy does not fire request for a CONNECT, and when the bytes inside an established tunnel are neither TLS nor HTTP, next_layer falls back to a raw TCP layer, so no hook runs at all. The flow reaches no contamination rule, and because hits.jsonl records only blocks and policy errors, it leaves no audit record either.

The namespace contract still holds — the traffic does go through mitmproxy. What does not hold is "audited", and with it the contamination blocklist the cohort leans on.

Reproduction

Against maka-eval-egress-proxy:12.2.3 built from packages/eval/harbor/egress-proxy/Dockerfile, from a subject under the proxy-only policy:

HTTP  http://tbench.ai/x   -> 451 tbench_domain          filter works for plain HTTP
HTTP  http://example.com/  -> 200
CONNECT ssh.github.com:443 -> HTTP/1.1 200 Connection established
  first bytes from peer:      SSH-2.0-...  KEXINIT
CONNECT tbench.ai:443      -> HTTP/1.1 200 Connection established

GitHub's real SSH banner and key exchange came back, so git clone [email protected]:... through ssh.github.com:443 traverses the proxy without ever being classified. Note the second line too: tbench.ai is on the blocklist, and the CONNECT to it is answered 200. For a TLS client the inner request is still blocked after interception, so the exposure is raw tunnels.

Deliberate to exploit, not something a subject hits by accident.

Candidate directions

  • Apply the host rules at http_connect, so a blocklisted host is refused before the tunnel opens rather than after interception. Closes the blocklisted-host case, not the arbitrary-host one.
  • Hook tcp_start and kill flows that fall back to raw TCP, with an audit record. Fail-closed, and nothing in a coding benchmark legitimately needs a non-HTTP tunnel through this proxy — SSH egress is already impossible except through it.
  • Record every tunnel, not only blocks. Changes what hits.jsonl means and interacts with its 1 MiB cap.

Scope

Found while adjudicating the reviews of #2960, which states the gap in the README rather than closing it. This is the contamination blocklist's completeness, a separate concern from the namespace isolation that PR is about, and it needs mitmproxy hook work with its own tests.

Activity

  1. added
    bug
    help wanted
    on Aug 13, 2026
  2. 1625567290 commented on Aug 14, 2026

    @1625567290
    Contributor

    I'm working on this. I'll refuse blocklisted hosts at http_connect before the tunnel opens, and kill raw TCP fallbacks in tcp_start with a raw_tunnel audit record. HTTPS interception for unrelated hosts stays on the existing request hook.

    Grok is assisting with the implementation; I will review the change and remain the human contributor of record.

    简体中文对照

    我来做这个。黑名单 host 在 http_connect 建隧道之前拒绝;落到 raw TCP 的流量在 tcp_start 杀掉并写 raw_tunnel 审计。无关 host 的 HTTPS 拦截仍走现有的 request hook。

    Grok 协助实现,我会审阅改动并作为 human contributor of record。

  3. added a commit that references this issue on Aug 14, 2026
    2632b85
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bughelp wanted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions