Skip to content

Add Firefox 148 fingerprint (with X25519MLKEM768) and make it HelloFirefox_Auto - #8

Open
scarletjess77 wants to merge 1 commit into
MetaCubeX:v1.7.0-mod-metafrom
scarletjess77:firefox-148
Open

scarletjess77 wants to merge 1 commit into
MetaCubeX:v1.7.0-mod-metafrom
scarletjess77:firefox-148

Conversation

@scarletjess77

Copy link
Copy Markdown

This brings over upstream's Firefox 148 ClientHello (refraction-networking/utls@fc716b2, by Mingye Chen) and points HelloFirefox_Auto at it.

Why

HelloFirefox_Auto is still Firefox 120, which sends no X25519MLKEM768; Firefox has sent it since 132. Since XTLS/REALITY@8cdf7bf (in Xray-core v26.9.30 and later), REALITY servers turn away a Client Hello without X25519MLKEM768 before X25519, and pass it on to the target as a normal visitor.

So in mihomo, client-fingerprint: firefox can't reach a REALITY server on a current Xray, even with support-x25519mlkem768: true. The log shows REALITY authentication failed. chrome works, because Chrome 133 has the key share. Xray clients work with firefox, because upstream uTLS already has Firefox 148.

What changes

  • HelloFirefox_148, the spec from upstream unchanged: X25519MLKEM768 first, then X25519 and P-256 key shares, cert compression, ECH GREASE and record size limit, as Firefox 148 sends them.
  • Key share reuse, as Firefox does: the X25519 key share reuses the classical half of the hybrid one (ReuseHybridAndClassicalKeyShares). Specs that don't ask for it are unchanged.
  • HelloFirefox_Auto = HelloFirefox_148. HelloFirefox_120 stays, so mihomo's firefox120 keeps the classical hello.
  • Upstream's tests for the spec and the reuse (u_parrots_test.go).

The only conflict was the imports: mlkem comes from internal/mlkem here, as in the rest of the fork, so only crypto/ecdh is added.

Testing

  • go build ./..., go vet . and go test . pass on Go 1.20.14 and Go 1.27.3.
  • mihomo v1.19.33 built against this branch (replace github.com/metacubex/utls), VLESS REALITY outbound with client-fingerprint: firefox and support-x25519mlkem768: true, against a local Xray-core v26.10.31 REALITY server:
    • mihomo v1.19.33 as released: every connection fails with REALITY authentication failed (20 of 20).
    • with this branch: no failures, and the log reports is using X25519MLKEM768 for TLS' communication: true.

firefox still needs support-x25519mlkem768: true for REALITY, like chrome, since mihomo leaves the hybrid key share out otherwise.

For browsers that sends pq hybrid and classical keyshare pairs, it may
or may not choose to reuse the classical part between them. Add a
helper to be used when crafting the spec to signify that the reuse
should happen, and implement the reuse when generating keyshares.
Existing specs will still generate keys independently.

Add Firefox 148 spec that uses this reuse.

Ported from refraction-networking/utls@fc716b2. The only conflict was the
imports: mlkem comes from internal/mlkem here, so only crypto/ecdh is added.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants