From 5da1a6f873b70220a9700ab1a3486d7236306393 Mon Sep 17 00:00:00 2001 From: Jack Cutrara Date: Thu, 12 Nov 2026 12:39:33 -0500 Subject: [PATCH] =?UTF-8?q?fix:=20send=20Chrome's=20GREASE=20extensions=20?= =?UTF-8?q?in=20chrome100=E2=80=93chrome142?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit chrome100 to chrome142 now send Chrome's two GREASE extensions, as chrome151 to chrome157 already do: an empty one first and a 1-byte one last (after ECH, and before padding in chrome100 to chrome116). Real Chrome 116 to 142 sends both in every TCP ClientHello. chrome100's extension order no longer lists Grease and Padding, which the opt-in now places. JA3 and JA4 skip GREASE values, so these extensions don't affect them. --- impit/src/fingerprint/database/chrome.rs | 99 ++++++++++++++++++------ 1 file changed, 75 insertions(+), 24 deletions(-) diff --git a/impit/src/fingerprint/database/chrome.rs b/impit/src/fingerprint/database/chrome.rs index 8442af11..3f992338 100644 --- a/impit/src/fingerprint/database/chrome.rs +++ b/impit/src/fingerprint/database/chrome.rs @@ -190,8 +190,7 @@ pub mod chrome_155 { /// profile leaves it out. /// /// Relative to the chrome_142 profile, Chrome 151 leads its signature_algorithms -/// list with the three ML-DSA codepoints, and this profile also sends the GREASE -/// extensions above. +/// list with the three ML-DSA codepoints. pub mod chrome_151 { use super::*; @@ -348,6 +347,9 @@ pub mod chrome_151 { } /// Chrome 142 fingerprint module +/// +/// Sends Chrome's two GREASE extensions, an empty one first and a 1-byte one +/// last, as real Chrome 142 does in every TCP ClientHello. pub mod chrome_142 { use super::*; @@ -438,7 +440,8 @@ pub mod chrome_142 { ExtensionType::ApplicationSettings, ], ) - .with_new_alps_codepoint(true), + .with_new_alps_codepoint(true) + .with_grease_first_and_last(true), // ECH configuration (GREASE mode) Some(EchConfig::new( EchMode::Grease { @@ -495,6 +498,9 @@ pub mod chrome_142 { } /// Chrome 136 fingerprint module +/// +/// Sends Chrome's two GREASE extensions, an empty one first and a 1-byte one +/// last, as real Chrome 136 does in every TCP ClientHello. pub mod chrome_136 { use super::*; @@ -585,7 +591,8 @@ pub mod chrome_136 { ExtensionType::ApplicationSettings, ], ) - .with_new_alps_codepoint(true), + .with_new_alps_codepoint(true) + .with_grease_first_and_last(true), // ECH configuration (GREASE mode) Some(EchConfig::new( EchMode::Grease { @@ -642,6 +649,9 @@ pub mod chrome_136 { } /// Chrome 133 fingerprint module +/// +/// Sends Chrome's two GREASE extensions, an empty one first and a 1-byte one +/// last, as real Chrome 133 does in every TCP ClientHello. pub mod chrome_133 { use super::*; @@ -726,7 +736,8 @@ pub mod chrome_133 { ExtensionType::CompressCertificate, ExtensionType::ApplicationSettings, ], - ), + ) + .with_grease_first_and_last(true), // ECH configuration (GREASE mode) Some(EchConfig::new( EchMode::Grease { @@ -783,6 +794,9 @@ pub mod chrome_133 { } /// Chrome 124 fingerprint module +/// +/// Sends Chrome's two GREASE extensions, an empty one first and a 1-byte one +/// last, as real Chrome 124 does in every TCP ClientHello. pub mod chrome_124 { use super::*; @@ -867,7 +881,8 @@ pub mod chrome_124 { ExtensionType::CompressCertificate, ExtensionType::ApplicationSettings, ], - ), + ) + .with_grease_first_and_last(true), // ECH configuration (GREASE mode) Some(EchConfig::new( EchMode::Grease { @@ -924,6 +939,9 @@ pub mod chrome_124 { } /// Chrome 131 fingerprint module +/// +/// Sends Chrome's two GREASE extensions, an empty one first and a 1-byte one +/// last, as real Chrome 131 does in every TCP ClientHello. pub mod chrome_131 { use super::*; @@ -1011,7 +1029,8 @@ pub mod chrome_131 { ExtensionType::CompressCertificate, ExtensionType::ApplicationSettings, ], - ), + ) + .with_grease_first_and_last(true), // ECH configuration (GREASE mode) Some(EchConfig::new( EchMode::Grease { @@ -1068,6 +1087,11 @@ pub mod chrome_131 { } /// Chrome 100 fingerprint module +/// +/// Its TLS fingerprint, which chrome_101 to chrome_116 reuse, sends Chrome's two +/// GREASE extensions: an empty one first and a 1-byte one last, then padding. +/// This follows real Chrome 116, where it was measured, and BoringSSL, which +/// already placed them this way before Chrome 100. pub mod chrome_100 { use super::*; @@ -1134,7 +1158,6 @@ pub mod chrome_100 { false, None, vec![ - ExtensionType::Grease, ExtensionType::ServerName, ExtensionType::ExtendedMasterSecret, ExtensionType::RenegotiationInfo, @@ -1150,12 +1173,10 @@ pub mod chrome_100 { ExtensionType::SupportedVersions, ExtensionType::CompressCertificate, ExtensionType::ApplicationSettings, - // No trailing GREASE: rustls has one GREASE extension type, and repeating it - // makes BoringSSL servers reject the ClientHello (#575). - ExtensionType::Padding, ], ) - .with_padding(true), // Chrome 100 uses padding extension + .with_padding(true) // Chrome 100 uses padding extension + .with_grease_first_and_last(true), // No ECH in Chrome 100 None, // ALPN protocols @@ -1371,6 +1392,9 @@ pub mod chrome_116 { } /// Chrome 125 fingerprint module +/// +/// Sends Chrome's two GREASE extensions, an empty one first and a 1-byte one +/// last, as real Chrome 125 does in every TCP ClientHello. pub mod chrome_125 { use super::*; @@ -1457,7 +1481,8 @@ pub mod chrome_125 { ExtensionType::CompressCertificate, ExtensionType::ApplicationSettings, ], - ), + ) + .with_grease_first_and_last(true), // ECH configuration (GREASE mode) Some(EchConfig::new( EchMode::Grease { @@ -1653,24 +1678,50 @@ mod tests { } } - // Chrome's two GREASE extensions: an empty one first and a 1-byte one last. impit's hello carries GREASE ECH and - // no pre_shared_key, so last also means after ECH. + // Chrome's two GREASE extensions: an empty one first and a 1-byte one last, after ECH when the profile sends it. + // Only padding follows the last one (impit's hello here carries no pre_shared_key). #[test] fn chrome_profiles_send_grease_extensions_first_and_last() { - for (name, fp) in [ - ("chrome_157", chrome_157::fingerprint()), - ("chrome_156", chrome_156::fingerprint()), - ("chrome_155", chrome_155::fingerprint()), - ("chrome_151", chrome_151::fingerprint()), + // (profile, sends GREASE ECH) + for (name, fp, has_ech) in [ + ("chrome_157", chrome_157::fingerprint(), true), + ("chrome_156", chrome_156::fingerprint(), true), + ("chrome_155", chrome_155::fingerprint(), true), + ("chrome_151", chrome_151::fingerprint(), true), + ("chrome_142", chrome_142::fingerprint(), true), + ("chrome_136", chrome_136::fingerprint(), true), + ("chrome_133", chrome_133::fingerprint(), true), + ("chrome_131", chrome_131::fingerprint(), true), + ("chrome_125", chrome_125::fingerprint(), true), + ("chrome_124", chrome_124::fingerprint(), true), + ("chrome_116", chrome_116::fingerprint(), false), + ("chrome_110", chrome_110::fingerprint(), false), + ("chrome_107", chrome_107::fingerprint(), false), + ("chrome_104", chrome_104::fingerprint(), false), + ("chrome_101", chrome_101::fingerprint(), false), + ("chrome_100", chrome_100::fingerprint(), false), ] { let (_, _, exts) = client_hello(fp); - assert!(exts.iter().any(|(t, _)| *t == 0xfe0d), "{name}: no ECH"); assert_eq!(exts[0], (0xbaba, vec![]), "{name}: first extension"); assert_eq!( - *exts.last().unwrap(), - (0xaaaa, vec![0]), - "{name}: last extension" + exts.iter().filter(|(t, _)| is_grease(*t)).count(), + 2, + "{name}: two GREASE extensions" ); + let last = exts + .iter() + .position(|(t, _)| *t == 0xaaaa) + .unwrap_or_else(|| panic!("{name}: no 0xaaaa")); + assert_eq!(exts[last].1, vec![0], "{name}: 0xaaaa body"); + assert!( + exts[last + 1..].iter().all(|(t, _)| *t == 0x0015), + "{name}: only padding after 0xaaaa" + ); + let ech = exts.iter().position(|(t, _)| *t == 0xfe0d); + assert_eq!(ech.is_some(), has_ech, "{name}: ECH"); + if let Some(ech) = ech { + assert!(ech < last, "{name}: ECH before 0xaaaa"); + } } } }