diff --git a/docs/checks/index.mdx b/docs/checks/index.mdx
index 93785fb..4cfe4ff 100644
--- a/docs/checks/index.mdx
+++ b/docs/checks/index.mdx
@@ -19,6 +19,7 @@ import { Card, CardGrid, LinkCard } from '@/components/docs';
+
## Severity
diff --git a/docs/checks/protocol.mdx b/docs/checks/protocol.mdx
new file mode 100644
index 0000000..9092a04
--- /dev/null
+++ b/docs/checks/protocol.mdx
@@ -0,0 +1,50 @@
+---
+title: HTTP/2 & HTTP/3 Protocol-Specific
+description: Whether the proxy trusts the client-supplied HTTP/2 :authority pseudo-header during its conversion to the backend.
+---
+
+import { Aside } from '@/components/docs';
+
+HTTP/2 carries request metadata in pseudo-headers (`:authority`, `:path`,
+`:scheme`, `:method`) that a proxy must convert to HTTP/1.1
+Host/request-line semantics for most backends. Mistrusting or
+mis-converting those pseudo-headers is the root of a class of HTTP/2
+routing and desync issues.
+
+
+
+| Check ID | Title | CVSS 4.0 | CWE | OWASP |
+| --- | --- | --- | --- | --- |
+| `protocol.h2_authority_trust` | HTTP/2 :authority Pseudo-Header Trusted / Reflected | 5.3 | [CWE-444](https://cwe.mitre.org/data/definitions/444.html) | API8:2023 |
+
+## `protocol.h2_authority_trust`
+
+Over a forced HTTP/2 connection, sends a distinctive, non-routable marker
+as the `:authority` pseudo-header and reports a finding only when the proxy
+reflects it (in the body or a response header) while a clean control
+request does not — the proxy trusts a client-supplied `:authority` it never
+validated. This is the HTTP/2 analogue of Host-header injection: it can
+influence routing, cache keys, and absolute-URL generation via the h2
+control plane. Against an HTTP/1.1-only target (no ALPN `h2`), the check
+skips.
+
+**Remediate:** validate the `:authority` against the proxy's configured
+virtual hosts, and ensure the `:authority`→`Host` conversion toward the
+backend is consistent and canonicalized.
+
+## Not yet covered
+
+Three checklist items are intentionally deferred:
+
+- **Stream multiplexing / rapid-reset abuse (CVE-2023-44487)** — exercising
+ it *is* the denial-of-service attack, inappropriate to run against a live
+ target.
+- **QUIC / HTTP/3 malformed frame handling** — no stable HTTP/3 stack is
+ available in the Go standard library, and malformed-frame fuzzing is
+ intrusive.
+- **Protocol downgrade as a smuggling precondition** — requires raw HTTP/2
+ frame construction; it is tracked alongside the Request Smuggling work.
diff --git a/proxy/checks.go b/proxy/checks.go
index 4683e68..284e51e 100644
--- a/proxy/checks.go
+++ b/proxy/checks.go
@@ -37,6 +37,7 @@ import (
xforwardedfor "github.com/cerberauth/proxyaudit/proxy/checks/headertrust/x_forwarded_for"
xforwardedhost "github.com/cerberauth/proxyaudit/proxy/checks/headertrust/x_forwarded_host"
xrealip "github.com/cerberauth/proxyaudit/proxy/checks/headertrust/x_real_ip"
+ h2authoritytrust "github.com/cerberauth/proxyaudit/proxy/checks/protocol/h2_authority_trust"
missingthrottling "github.com/cerberauth/proxyaudit/proxy/checks/ratelimit/missing_throttling"
oversizedheader "github.com/cerberauth/proxyaudit/proxy/checks/ratelimit/oversized_header"
spoofedipbypass "github.com/cerberauth/proxyaudit/proxy/checks/ratelimit/spoofed_ip_bypass"
@@ -128,6 +129,9 @@ func AllChecks() ([]harnessx.Check, map[harnessx.CheckID]checkdef.CheckDef) {
missingthrottling.Check,
spoofedipbypass.Check,
oversizedheader.Check,
+
+ // HTTP/2 & HTTP/3 Protocol-Specific (Agg-tier, --aggressive).
+ h2authoritytrust.Check,
}
defs := map[harnessx.CheckID]checkdef.CheckDef{
@@ -183,6 +187,8 @@ func AllChecks() ([]harnessx.Check, map[harnessx.CheckID]checkdef.CheckDef) {
missingthrottling.Check.ID: missingthrottling.Def,
spoofedipbypass.Check.ID: spoofedipbypass.Def,
oversizedheader.Check.ID: oversizedheader.Def,
+
+ h2authoritytrust.Check.ID: h2authoritytrust.Def,
}
return checks, defs
diff --git a/proxy/checks/protocol/h2_authority_trust/check.go b/proxy/checks/protocol/h2_authority_trust/check.go
new file mode 100644
index 0000000..883841e
--- /dev/null
+++ b/proxy/checks/protocol/h2_authority_trust/check.go
@@ -0,0 +1,71 @@
+// Package h2authoritytrust tests the HTTP/2-specific pseudo-header
+// conversion in item 1 of the protocol epic: a client over HTTP/2 supplies
+// the target host in the :authority pseudo-header, which the proxy must
+// convert to an HTTP/1.1 Host (or route on) for the backend. If the proxy
+// trusts a client-supplied :authority it never validated — reflecting it,
+// or routing on it — an attacker controls request routing / absolute-URL
+// generation over the HTTP/2 control plane, the h2 analogue of Host-header
+// injection.
+//
+// The probe sends a benign, distinctive marker as the :authority over a
+// forced-HTTP/2 connection and reports a finding only when that marker
+// comes back while a clean control request did not contain it. It needs
+// HTTP/2 (ALPN "h2"); against an HTTP/1.1-only target it skips.
+//
+// Requires --aggressive: it sends a spoofed-authority probe, part of the
+// opt-in attack-simulation suite.
+package h2authoritytrust
+
+import (
+ "context"
+ _ "embed"
+
+ "github.com/cerberauth/harnessx"
+ "github.com/cerberauth/harnessx/checkdef"
+ "github.com/cerberauth/proxyaudit/proxy/checks/protocol/h2probe"
+ "github.com/cerberauth/proxyaudit/proxy/probebase"
+ "github.com/cerberauth/proxyaudit/proxy/scanctx"
+)
+
+//go:embed check.yaml
+var checkYAML []byte
+
+var Def = checkdef.MustParseCheckDefYAML("h2_authority_trust", checkYAML)
+
+// spoofedAuthority is a distinctive, non-routable hostname whose later
+// reflection is attributable to the :authority we sent.
+const spoofedAuthority = probebase.SpoofedHostMarker
+
+var Check = checkdef.NewCheck(Def, func(ctx context.Context, target harnessx.Target, _ harnessx.ResultStore) (harnessx.Result, error) {
+ sctx := scanctx.TargetContext(target)
+ if !sctx.Aggressive {
+ return harnessx.Result{Skipped: true, SkipReason: "aggressive-suite check — rerun with --aggressive to send an HTTP/2 :authority probe"}, nil
+ }
+
+ // Control: an ordinary HTTP/2 request. If it can't be made, the target
+ // doesn't speak HTTP/2 and the check doesn't apply. If the marker is
+ // already present, reflection can't be attributed.
+ control := h2probe.RoundTrip(ctx, sctx, target.URL, "", spoofedAuthority)
+ if control.Err != nil {
+ return harnessx.Result{Skipped: true, SkipReason: "target did not negotiate HTTP/2 (ALPN h2) — HTTP/2-specific check not applicable"}, nil
+ }
+ if control.ReflectedInBody || control.ReflectedHeader != "" {
+ return harnessx.Result{Skipped: true, SkipReason: "control response already contains the probe marker — can't attribute a reflection to :authority"}, nil
+ }
+
+ probe := h2probe.RoundTrip(ctx, sctx, target.URL, spoofedAuthority, spoofedAuthority)
+ if probe.Err != nil || !probe.Reflected() {
+ return harnessx.Result{}, nil
+ }
+
+ where := "response body"
+ if probe.ReflectedHeader != "" {
+ where = "the " + probe.ReflectedHeader + " response header"
+ }
+ return harnessx.Result{Observations: []harnessx.Observation{{
+ Title: "Proxy trusts the client-supplied HTTP/2 :authority pseudo-header",
+ Description: "Over HTTP/2, a request carrying :authority = " + spoofedAuthority + " (a host the client has no claim to) was reflected back in " + where + ", while a clean control request was not. The proxy converts/trusts the client-supplied :authority without validating it against its own configuration — the HTTP/2 analogue of Host-header injection, letting an attacker influence routing, cache keys, or absolute-URL generation via the h2 control plane.",
+ Evidence: ":authority: " + spoofedAuthority + " -> reflected in " + where,
+ Metadata: map[string]string{"authority": spoofedAuthority, "reflected_header": probe.ReflectedHeader},
+ }}}, nil
+}, checkdef.WithSkip(probebase.SkipUnlessFetched))
diff --git a/proxy/checks/protocol/h2_authority_trust/check.yaml b/proxy/checks/protocol/h2_authority_trust/check.yaml
new file mode 100644
index 0000000..1f4fd10
--- /dev/null
+++ b/proxy/checks/protocol/h2_authority_trust/check.yaml
@@ -0,0 +1,13 @@
+id: "protocol.h2_authority_trust"
+name: "HTTP/2 :authority Pseudo-Header Trusted / Reflected"
+description: "Over a forced HTTP/2 connection, sends a distinctive marker as the :authority pseudo-header and reports when the proxy reflects it (in the body or a response header) while a clean control request does not — the proxy converts/trusts a client-supplied :authority it never validated, the HTTP/2 analogue of Host-header injection (influencing routing, cache keys, absolute-URL generation). Skips against HTTP/1.1-only targets. Requires --aggressive."
+link: "https://portswigger.net/web-security/host-header"
+tags:
+ - protocol
+ - http2
+depends_on:
+ - "probe.http_fetch"
+cvss_vector: "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:L/VI:L/VA:N/SC:N/SI:N/SA:N"
+cvss_score: 5.3
+cwe_id: "CWE-444"
+owasp: "API8:2023"
diff --git a/proxy/checks/protocol/h2probe/h2probe.go b/proxy/checks/protocol/h2probe/h2probe.go
new file mode 100644
index 0000000..8f301e4
--- /dev/null
+++ b/proxy/checks/protocol/h2probe/h2probe.go
@@ -0,0 +1,100 @@
+// Package h2probe sends requests over a forced HTTP/2 connection (ALPN
+// "h2"), so a check can exercise HTTP/2-specific behaviour — here, whether
+// the proxy trusts the client-supplied :authority pseudo-header — rather
+// than whatever protocol net/http happens to negotiate. It forces HTTP/2
+// through the standard library's http.Transport (Protocols), not raw
+// framing.
+package h2probe
+
+import (
+ "context"
+ "crypto/tls"
+ "fmt"
+ "io"
+ "net/http"
+
+ "github.com/cerberauth/proxyaudit/proxy/probebase"
+ "github.com/cerberauth/proxyaudit/proxy/scanctx"
+)
+
+const maxBodyBytes = 1 << 20 // 1 MiB
+
+// Result is one HTTP/2 round-trip. Err is set when an HTTP/2 connection
+// could not be established at all (no ALPN "h2"), which callers read as
+// "target does not speak HTTP/2" and skip.
+type Result struct {
+ StatusCode int
+ Proto string
+ Header http.Header
+ Body []byte
+ ReflectedInBody bool
+ ReflectedHeader string
+ Err error
+}
+
+// Reflected reports whether the marker came back in the body or a header.
+func (r *Result) Reflected() bool {
+ return r != nil && r.Err == nil && (r.ReflectedInBody || r.ReflectedHeader != "")
+}
+
+// RoundTrip sends one GET to url over HTTP/2. When authority is non-empty
+// it is sent as the :authority pseudo-header (net/http derives :authority
+// from Request.Host), modelling a client that supplies an authority the
+// transport peer didn't. It reports whether marker is reflected in the
+// response.
+func RoundTrip(ctx context.Context, sctx *scanctx.ScanContext, url, authority, marker string) *Result {
+ // Force HTTP/2 only: ALPN must negotiate "h2" or the round-trip fails,
+ // which callers read as "no HTTP/2" and skip.
+ var protocols http.Protocols
+ protocols.SetHTTP2(true)
+ protocols.SetHTTP1(false)
+ tr := &http.Transport{TLSClientConfig: tlsConfig(sctx), Protocols: &protocols}
+ defer tr.CloseIdleConnections()
+
+ req, err := http.NewRequestWithContext(ctx, http.MethodGet, url, nil)
+ if err != nil {
+ return &Result{Err: err}
+ }
+ if authority != "" {
+ req.Host = authority // becomes the :authority pseudo-header
+ }
+
+ resp, err := tr.RoundTrip(req)
+ if err != nil {
+ return &Result{Err: err}
+ }
+ defer resp.Body.Close()
+ // Guard against any HTTP/1.1 fallback: this check is HTTP/2-specific,
+ // so a non-h2 response means the target doesn't offer HTTP/2 and the
+ // caller should skip.
+ if resp.ProtoMajor != 2 {
+ return &Result{Err: fmt.Errorf("target negotiated %s, not HTTP/2", resp.Proto)}
+ }
+ body, _ := io.ReadAll(io.LimitReader(resp.Body, maxBodyBytes))
+
+ inBody, header := probebase.FindMarker(resp.Header, body, marker)
+ return &Result{
+ StatusCode: resp.StatusCode,
+ Proto: resp.Proto,
+ Header: resp.Header,
+ Body: body,
+ ReflectedInBody: inBody,
+ ReflectedHeader: header,
+ }
+}
+
+// tlsConfig mirrors the scan client's trust settings (so a test server's
+// self-signed cert, or an --insecure scan, works over the forced-h2
+// connection) and pins ALPN to h2.
+func tlsConfig(sctx *scanctx.ScanContext) *tls.Config {
+ cfg := &tls.Config{MinVersion: tls.VersionTLS12, NextProtos: []string{"h2"}}
+ if t, ok := sctx.HTTPClient.Transport.(*http.Transport); ok && t.TLSClientConfig != nil {
+ cfg.RootCAs = t.TLSClientConfig.RootCAs
+ cfg.InsecureSkipVerify = t.TLSClientConfig.InsecureSkipVerify
+ cfg.ServerName = t.TLSClientConfig.ServerName
+ }
+ if sctx.RootCAs != nil {
+ cfg.RootCAs = sctx.RootCAs
+ }
+ return cfg
+}
diff --git a/proxy/checks/protocol/protocol_test.go b/proxy/checks/protocol/protocol_test.go
new file mode 100644
index 0000000..2c19872
--- /dev/null
+++ b/proxy/checks/protocol/protocol_test.go
@@ -0,0 +1,82 @@
+// Package protocol_test exercises the checks/protocol scanners against an
+// HTTP/2-enabled httptest.Server driven through a harnessx.Engine as
+// proxyaudit would.
+package protocol_test
+
+import (
+ "context"
+ "net/http"
+ "net/http/httptest"
+ "testing"
+
+ "github.com/cerberauth/harnessx"
+ "github.com/stretchr/testify/assert"
+ "github.com/stretchr/testify/require"
+
+ h2authoritytrust "github.com/cerberauth/proxyaudit/proxy/checks/protocol/h2_authority_trust"
+ "github.com/cerberauth/proxyaudit/proxy/probebase"
+ "github.com/cerberauth/proxyaudit/proxy/scanctx"
+)
+
+// h2Server starts a TLS server with HTTP/2 enabled serving handler.
+func h2Server(t *testing.T, handler http.Handler) *httptest.Server {
+ t.Helper()
+ srv := httptest.NewUnstartedServer(handler)
+ srv.EnableHTTP2 = true
+ srv.StartTLS()
+ t.Cleanup(srv.Close)
+ return srv
+}
+
+func run(t *testing.T, srv *httptest.Server, aggressive bool, check harnessx.Check) harnessx.ScanSummary {
+ t.Helper()
+ target := scanctx.NewTarget(srv.URL, &scanctx.ScanContext{HTTPClient: srv.Client(), Aggressive: aggressive})
+ engine := harnessx.New(harnessx.WithChecks(probebase.HTTPFetchCheck, check))
+ summary, err := engine.Run(context.Background(), target)
+ require.NoError(t, err)
+ return summary
+}
+
+// reflectsAuthority echoes the request's :authority (r.Host) into the body
+// — a backend/proxy that trusts the client-supplied authority.
+func reflectsAuthority() http.Handler {
+ return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ //nolint:gosec // G705: test reflector deliberately echoes the request authority
+ _, _ = w.Write([]byte("host=" + r.Host))
+ })
+}
+
+func TestH2AuthorityTrust_Reflected_Flagged(t *testing.T) {
+ srv := h2Server(t, reflectsAuthority())
+ summary := run(t, srv, true, h2authoritytrust.Check)
+ require.Len(t, summary.Observations, 1)
+ assert.Equal(t, probebase.SpoofedHostMarker, summary.Observations[0].Metadata["authority"])
+}
+
+func TestH2AuthorityTrust_NotReflected_NoFindings(t *testing.T) {
+ srv := h2Server(t, http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
+ _, _ = w.Write([]byte("static body"))
+ }))
+ assert.Empty(t, run(t, srv, true, h2authoritytrust.Check).Observations)
+}
+
+func TestH2AuthorityTrust_NoHTTP2_Skipped(t *testing.T) {
+ // Plaintext HTTP/1.1 server: no ALPN h2, the check doesn't apply.
+ srv := httptest.NewServer(reflectsAuthority())
+ defer srv.Close()
+ assert.True(t, skipped(run(t, srv, true, h2authoritytrust.Check), h2authoritytrust.Check.ID))
+}
+
+func TestH2AuthorityTrust_NotAggressive_Skipped(t *testing.T) {
+ srv := h2Server(t, reflectsAuthority())
+ assert.True(t, skipped(run(t, srv, false, h2authoritytrust.Check), h2authoritytrust.Check.ID))
+}
+
+func skipped(summary harnessx.ScanSummary, id harnessx.CheckID) bool {
+ for _, r := range summary.Results {
+ if r.CheckID == id {
+ return r.Skipped
+ }
+ }
+ return false
+}