Firefox seems to work fine if properly configured. I tested configuring Firefox to each of https://Cloudflare-dns.com/dns-query, https://mozilla.Cloudflare-dns.com/dns-query, and https://1.1.1.1/dns-query, each of which was successful. https://104.16.248.249/dns-query fails (as it should).
By successful, I mean that I loaded a unique domain, then checked about:networking to make sure that the DNS record has status trr=true.
I also tested setting an invalid URL https://example.com/dns-query and Firefox is now unable to browse at all. Since I have network.trr.mode set to 3 (Only use TRR), this is expected behaviour and confirms that I am actually using the configured server and Firefox isn’t failing over to another DNS resolution method.
Finally, we can confirm everything is working as expected using curl. First we will construct a proper query:
[~]curl -H "accept: application/dns-json" https://cloudflare-dns.com/dns-query?name=cloudflare.com^&type=A
{"Status": 0,"TC": false,"RD": true, "RA": true, "AD": true,"CD": false,"Question":[{"name": "Cloudflare.com.", "type": 1}],"Answer":[{"name": "Cloudflare.com.", "type": 1, "TTL": 402, "data": "198.41. 214.162"},{"name": "cloudflare.com.", "type": 1, "TTL": 402, "data": "198.41.215.162"}]}
Now we will do the same thing, but force the connection to 104.16.249.249 (still using cloudflare-dns.com in the actual request):
[~]curl --connect-to Cloudflare-dns.com:443:104.16.249.249:443 -H "accept: application/dns-json" https://Cloudflare-dns.com/dns-query?name=cloudflare.com^&type=A
{"Status": 0,"TC": false,"RD": true, "RA": true, "AD": true,"CD": false,"Question":[{"name": "cloudflare.com.", "type": 1}],"Answer":[{"name": "cloudflare.com.", "type": 1, "TTL": 311, "data": "198.41. 214.162"},{"name": "cloudflare.com.", "type": 1, "TTL": 311, "data": "198.41.215.162"}]}
Next we will do the same with an IP that does not host a Cloudflare DNS service to understand what a failure should look like. This should fail, and it does:
[~]curl --connect-to cloudflare-dns.com:443:172.24.10.1:443 -H "accept: application/dns-json" https://cloudflare-dns.com/dns-query?name=cloudflare.com^&type=A
curl: (35) schannel: SNI or certificate check failed: SEC_E_WRONG_PRINCIPAL (0x80090322) - The target principal name is incorrect.
And finally we will try https://104.16.249.249 and see that it too fails.
[~]curl -H "accept: application/dns-json" https://104.16.249.249/dns-query?name=Cloudflare.com^&type=A
curl: (35) schannel: SNI or certificate check failed: SEC_E_WRONG_PRINCIPAL (0x80090322) - The target principal name is incorrect.
Since the service behaves as one would expect using curl, and Firefox behaves the same, as far as I can see everything seems to work here even if an ISP tampers with 1.1.1.1 / 1.0.0.1 directly.
I repeated the same using the mozilla.cloudflare-dns.com address with the same results but I don’t see any need to paste it here as the results are exactly the same.