Skip to content
Edit this page

NaïveProxy Protocol Specification

  • Document: NaïveProxy Protocol Specification
  • Category: Informational
  • Chinese edition: 简体中文

Status of This Memo

This document describes the wire format and endpoint behavior of the NaïveProxy protocol for compliant client and server implementations (Wind's client outbound lives in the wind-naive crate). It is not an Internet Standard.

Abstract

NaïveProxy is a censorship-resistant proxy protocol running over standard HTTP/2 and HTTP/3. By adopting mainstream browser network-stack behavior, applying randomized padding to initial headers and payloads, and responding to unauthorized probes as a standard web server, NaïveProxy mitigates passive traffic analysis and active probing.

1. Introduction

Deep Packet Inspection (DPI) systems commonly identify proxy traffic through TLS fingerprints, frame length distributions, and responses to active probes. NaïveProxy adheres strictly to HTTP/2 [RFC9113] and HTTP/3 [RFC9114] while adding header and early-payload padding to mask tunnel framing characteristics.

This specification outlines the wire format and core behaviors required by compliant NaïveProxy clients and servers.

2. Conventions and Terminology

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all capitals, as shown here.

3. Transport Protocol

NaïveProxy tunnels MUST operate over standard HTTP/2 (over TLS/TCP) [RFC9113] or HTTP/3 (over QUIC/UDP) [RFC9114], established via the HTTP CONNECT method [RFC9110].

4. Connection Establishment and Authentication

To open a tunnel, the client sends an HTTP CONNECT request that MUST include a Proxy-Authorization header carrying HTTP Basic Authentication credentials:

CONNECT target.example.com:443 HTTP/2
Host: target.example.com:443
Proxy-Authorization: Basic dXNlcjpwYXNz
Padding: !#$()+<>?@[]^`{}~~~~~~~~~~~~~~~~~~~

If the credentials are valid, the server MUST establish a connection to the target and return 200 OK.

4.1. Fast Open Behavior

To minimize initial latency, the server SHOULD implement Fast Open: after authenticating the client, the server MAY send the HTTP 200 OK response headers immediately, before the upstream target TCP/UDP connection completes.

5. Traffic Analysis Mitigation and Padding

Standard HTTP/2 and HTTP/3 multiplexing can expose early frame lengths. NaïveProxy applies custom padding to both the CONNECT headers and the initial tunnel payload blocks.

5.1. Header Padding

Both the client's CONNECT request and the server's 200 OK response MUST include a Padding header to randomize the size of the initial HEADERS frame.

The Padding value is 30 to 61 bytes long:

  • The first 16 characters MUST be randomly selected from the following non-Huffman-encoded ASCII set:
! # $ ( ) + < > ? @ [ ] ^ ` { }
  • All remaining bytes up to the chosen total length MUST be tildes (~).

5.2. Payload Padding

Payload padding applies only to the first 8 read and write operations (FIRST_PADDINGS = 8) in each direction on a newly established tunnel.

Each of those 8 blocks MUST be framed as:

 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|         Orig_Size (2B)        |  Pad_Len (1B) |               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+               +
|                                                               |
+                   Original Data (Orig_Size B)                 +
|                                                               |
+               +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|               |              Zeros (Pad_Len B)                |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  • Orig_Size (2B): Big-endian unsigned 16-bit length of the original payload.
  • Pad_Len (1B): Unsigned 8-bit count (0–255) of trailing padding bytes.
  • Original Data: Unmodified payload bytes.
  • Zeros: Padding bytes set to 0x00.

Once 8 padded frames have been sent or received in a direction, the padding codec for that direction MUST be disabled and all subsequent data MUST flow as raw bytes.

6. Active Probing Resistance and Camouflage

A NaïveProxy server MUST NOT reveal its nature as a proxy to active probers sending unauthorized or malformed requests.

Whenever a request satisfies either condition:

  1. The HTTP method is not CONNECT (e.g., GET, POST);
  2. The method is CONNECT, but Proxy-Authorization is missing or invalid.

The server MUST proxy the request to a pre-configured camouflage upstream (a legitimate web server) or serve static, benign HTML content. Response headers, status codes, and bodies MUST match a normal web server (for example, 200 OK for valid paths, 404 Not Found for missing paths, or 405 Method Not Allowed returned by the upstream for unauthorized CONNECT requests).

7. Security Considerations

  • Confidentiality and integrity rely entirely on the underlying TLS and QUIC layers.
  • Basic credentials travel inside the encrypted channel; clients SHOULD enforce strict certificate verification to prevent Man-in-the-Middle credential theft.
  • Both endpoints MUST strictly validate payload padding boundaries to prevent memory leaks or out-of-bounds reads.

8. Error Handling

For an authenticated CONNECT request encountering an upstream failure, the server MUST return an appropriate HTTP status code without leaking proxy characteristics to unauthorized observers:

  • Target hostname resolution failure (DNS error): the server SHOULD return 502 Bad Gateway.
  • Upstream TCP/UDP connect timeout or refusal: the server SHOULD return 504 Gateway Timeout or 502 Bad Gateway.
  • Protocol violation or premature upstream reset: the server SHOULD return 502 Bad Gateway.
  • Malformed payload padding from the client: the server MUST immediately terminate the tunnel (e.g., HTTP/2 RST_STREAM or HTTP/3 STOP_SENDING / RESET_STREAM) and log the anomaly.

9. References

  • [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, March 1997.
  • [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words", BCP 14, RFC 8174, May 2017.
  • [RFC9110] Fielding, R., Ed., Nottingham, M., Ed., and J. Reschke, Ed., "HTTP Semantics", STD 97, RFC 9110, June 2022.
  • [RFC9113] Thomson, M., Ed., and C. Benfield, Ed., "HTTP/2", RFC 9113, June 2022.
  • [RFC9114] Bishop, M., Ed., "HTTP/3", RFC 9114, June 2022.