Skip to content

Commit f3397d9

Browse files
scan_sni: verify dns.google TLS (#98)
The scan-sni DoH client to dns.google was using NoVerify — an on-path MITM could forge PTR answers and poison the discovered SNI pool. This is a public HTTPS request, not a fronted probe, so certificate validation belongs ON. Switched to the normal webpki root store.
1 parent 7be2449 commit f3397d9

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

‎src/scan_sni.rs‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -571,9 +571,13 @@ pub async fn fetch_dns_info(url_addr: &str) -> Result<String, Box<dyn std::error
571571
)
572572
.await??;
573573

574+
// DoH is a normal public HTTPS request, not a fronted probe. Keep
575+
// certificate validation on so an on-path MITM can't forge PTR data and
576+
// poison the discovered SNI pool.
577+
let mut root_store = RootCertStore::empty();
578+
root_store.extend(webpki_roots::TLS_SERVER_ROOTS.iter().cloned());
574579
let tls_cfg = ClientConfig::builder()
575-
.dangerous()
576-
.with_custom_certificate_verifier(Arc::new(NoVerify))
580+
.with_root_certificates(root_store)
577581
.with_no_client_auth();
578582
let connector = TlsConnector::from(Arc::new(tls_cfg));
579583
let server_name = ServerName::try_from(host.to_string())?;

0 commit comments

Comments
 (0)