News for hackers. Stuff that matters.
Re:The CNAME of the Game: Large-scale Analysis of DNS-based ... by thrwwy0304 on Thursday March 04, 2021 @05:00PM (#26349022)
This is false. Safari and Firefox both have strong third party cookie protections that prevent linking identities across different sites.

At this point, the only way an ad network can tell that the same user is on Website A and Website B is if both site owners tell the ad network the current user's email address or other common identifier.

If both sites are opting into this, CNAME protections won't do anything.

Re:The CNAME of the Game: Large-scale Analysis of DNS-based ... by donmcronald on Thursday March 04, 2021 @05:12PM (#26349169)
The CNAMEs change it to a same site / first party relationship. It says it right in the article summary. I assume the way it works is that instead of `tracking.example.com` where everyone can block `example.com`, they have users set up CNAMEs instead. So you get:

- extras.example.net --> tracking company IP behind a huge CDN

- awesone.example.org --> tracking company IP behind a huge CDN

The sites are different, but when you visit them you're hitting the tracking servers who get to see you hit both sites. Even worse, they can set cookies on the the domain, which is why someone else said there are security implications.

I've been saying it for years. Eventually everything will appear to be first party and hitting huge CDN IPs. It's easy to do right now already. Go read the Cloudflare blog article on proxying Google Fonts via Workers. Then think about the Cloudflare Apps and how easy it would be to build an app that rotated first party CNAMES and used Workers to dynamically rewrite HTML to proxy the tracking to ad companies.

TLDR; We're super screwed.

Re:The CNAME of the Game: Large-scale Analysis of DNS-based ... by volderette on Friday March 05, 2021 @12:15AM (#26353024)
Nope, not super screwed at all. Safari even limits http cookies if the cname doesnt match.

„On Safari 14 (requires Big Sur) and on all major iOS and iPadOS 14.2+ browser apps, expiration of cookies set with Set-Cookie HTTP response headers is 7 days at most, if the response originates from a subdomain that has a CNAME alias to a cross-site origin“

https://www.cookiestatus.com/

Re:The CNAME of the Game: Large-scale Analysis of DNS-based ... by Krisando on Friday March 05, 2021 @05:56AM (#26355401)
You should read the paper, it literally discusses how they were getting around that and discovered vulnerabilities because of it.
Re:The CNAME of the Game: Large-scale Analysis of DNS-based ... by thrwwy0304 on Thursday March 04, 2021 @05:19PM (#26349252)
We're not super screwed.

extras.example.net is still third-party to awesome.example.org.

The tracking company has no way of knowing that an HTTP request to extras.example.net is from the same user as an HTTP request to awesome.example.org.

If you were operating the tracking company, how would you try to determine the same user is behind both requests? Happy to be proven wrong, but I don't believe it's possible with third-party cookie protections in place.

Re:The CNAME of the Game: Large-scale Analysis of DNS-based ... by fluidcruft on Thursday March 04, 2021 @05:44PM (#26349559)
Based on reading the links someone posted, my understanding is that the way this CNAME stuff works is:

1. awesome.example.org would add a CNAME record that resolves tracking-you.example.org to the server referenced by evil.com

2. awesome.other.net would add a CNAME record that resolves tracking-you.other.net to the server referenced by evil.com

3. etc everywhere on the internet

Because these are CNAME, DNS hides all of this from the browser and it just sees the resolved address and the original requested name.

So tracking-you.example.org and tracking-you.other.net both now think the server controlled by evil.com is first-party. evil.com now gets all the first-party cookies. In the past they would have only got third-party cookies and the first-party cookies wouldn't be seen by evil.com.

But it gets worse because evil.com is also tracking you (it's what they're explicitly doing) so they can link users across the sites. This means evil.com has all it needs to spoof you cross-site because they now have all the first-party auth tokens. Unless you diligently never use the sites simultaneously and remember to log out between using websites. But even if you did, they can still do anything they want as you while you're logged in to the site.

So, yeah. It actually looks like a disaster and we're super screwed.

Re:The CNAME of the Game: Large-scale Analysis of DNS-based ... by tinus_hn on Thursday March 04, 2021 @07:16PM (#26350499)
This doesn’t work because browsers only see the original domain names. A page loaded from awesome.example.org can only set cookies on awesome.example.org and on example.org and not on evil.com, no matter what CNAME tricks you pull.
Re:The CNAME of the Game: Large-scale Analysis of DNS-based ... by fluidcruft on Thursday March 04, 2021 @07:26PM (#26350609)
What's said is that query on CNAME returns the resolved address of evil.com, not "evil.com" as a name that needs to be further resolved.

Isn't cookie validity selected by the site? A diligent site could setup subdomains to isolate the tracking cookines. Say, .awesome.example.org rather than .example.org. tracking-you.example.org wouldn't match anymore. But then it's a third-party cookie again and ad-block could just keep cookie whitelists for .awesome.example.org and throw any other .example.org cookies out.

Re:The CNAME of the Game: Large-scale Analysis of DNS-based ... by tinus_hn on Friday March 05, 2021 @05:13AM (#26355104)
It doesn’t work like this. Cookie domains, like cookie paths, are not a security feature because scripts in documents can manipulate other documents that are considered by the browser to have the same origin. A site can’t change the origin rules, the origin for both ‘awesome.example.org’ and ‘tracking-you.example.org’ both is example.org .
Re:The CNAME of the Game: Large-scale Analysis of DNS-based ... by fluidcruft on Friday March 05, 2021 @10:26AM (#26357834)
Yeah, exactly. awesome.example.org is the example.org site's code and tracking-you.example.org is evil.com's code.
Re:The CNAME of the Game: Large-scale Analysis of DNS-based ... by thrwwy0304 on Thursday March 04, 2021 @05:57PM (#26349706)
Your example is reliant on UserA visiting example.com having the same "auth token" as UserA visiting other.net.

That's not the case. Both example.com and other.net are likely to be generating completely unique auth tokens.

example.org and other.net can certainly both coordinate with evil.com to manually share more detail (e.g. the current user is [email protected]), but if that's the threat then browsers have no chance at offering protection.

Re:The CNAME of the Game: Large-scale Analysis of DNS-based ... by fluidcruft on Thursday March 04, 2021 @06:00PM (#26349731)
No, it's not reliant on that at all. The CNAME trick means that the browser forwards each site's auth tokens directly to evil.com's servers whenever you use that site. And since evil.com's entire reason d'etre is to track you across sites, it's trivial for them to store and link your auth tokens from all the sites you visit.
Re:The CNAME of the Game: Large-scale Analysis of DNS-based ... by thrwwy0304 on Friday March 05, 2021 @10:44AM (#26358082)
> The bottom line is that evil.com would not be asking sites to install CNAME tricks in their domains if evil.com cannot leverage those tricks to track users across sites. That should be obvious.

This is the leap I believe is incorrect. The paper doesn't explain how CNAME cloaking helps evil.com track users across sites. It says that it does, but it doesn't actually explain the attack vector.

It is far more plausible to me that CNAME tricks are being added so that evil.com can track a user on an individual site. When uBlock Origin is putting a hard block on all traffic to evil.com, there's still quite a bit to be gained by shifting evil.com to evil.foo.com if that means requests start succeeding again.

Another poster said something similar here: https://news.ycombinator.com/item?id=26349987

Re:The CNAME of the Game: Large-scale Analysis of DNS-based ... by thrwwy0304 on Thursday March 04, 2021 @09:38PM (#26351836)
When evil.com receives an auth token for a user visiting example.org, how does it know which user that token is associated with?

Then, when evil.com receives a different auth token for the same user visiting other.net, how does evil.com know that new auth token correlates to the same user on example.org?

This is the third-party identity linking that's now impossible for evil.com to accomplish independently. They need other.net and example.org to share some common information (like an email address) to make the link. For logged out users, it should be impossible without resorting to fingerprinting.

This was Firefox and Safari's entire reason d'etre for launching Total Cookie Protection and Intelligent Tracking Protection. I don't believe CNAME cloaking overcomes their protections, or at the very least, I don't see where this paper explains an attack vector.

Re:The CNAME of the Game: Large-scale Analysis of DNS-based ... by tatersolid on Friday March 05, 2021 @01:14AM (#26353431)
Except your auth tokens on the each site should be opaque identifiers and can’t be linked. Unless both sites are using the disaster that is JWT/JOSE as their token format with signing only and not encryption.
Re:The CNAME of the Game: Large-scale Analysis of DNS-based ... by fluidcruft on Friday March 05, 2021 @10:28AM (#26357854)
The reason sites are adding these CNAME tricks is specifically to enable evil.com to track you across sites to sell ads. So it's not just the CNAME trick, it's specifically what evil.com is doing that links accounts across sites.

The bottom line is that evil.com would not be asking sites to install CNAME tricks in their domains if evil.com cannot leverage those tricks to track users across sites. That should be obvious.

Re:The CNAME of the Game: Large-scale Analysis of DNS-based ... by nybble41 on Thursday March 04, 2021 @07:40PM (#26350771)
It's the other way around. The main site is example.com and the ads/tracking are at ads.example.com (which is a CNAME pointing to some server controlled by the advertiser). So they have the same second-level domain and are considered related origins.

Of course ads.example.com could just as well have A/AAAA records pointing to the same ad server, which would neutralize any attempt to infer separate origins based on CNAME records. It would just be slightly more difficult to administer since the owner of example.com would need to update their DNS records whenever the ad server's IP address changed—but that could be automated, and the IPs are probably mostly static anyway.

Re:The CNAME of the Game: Large-scale Analysis of DNS-based ... by JdeBP on Friday March 05, 2021 @10:58AM (#26358253)
It's called "CNAME Flattening" (or "ALIAS records") and has been widely available from hosting providers since 2014. I was talking about server-side aliases a decade before that, and I was far from the only person doing so.

You have the explanation right. But your hypothetical future dystopia is actually the world of today. (-:

Re:The CNAME of the Game: Large-scale Analysis of DNS-based ... by mildred593 on Friday March 05, 2021 @03:20AM (#26354274)
I always thought that was a bad decision, thinking that subdomains could be related security-wise to other domains looking the same.

DNS was thought out from the beginning so you could split it anywhere you wanted to delegate things, and you can also delegate with CNAME too.

I'd welcome a security model that does not use origins. It's doable, but the origin trick was a convenient way to enforce some security measures bolted on as an after thought without breaking much the compatibility.

Re:The CNAME of the Game: Large-scale Analysis of DNS-based ... by tinus_hn on Thursday March 04, 2021 @07:11PM (#26350451)
They can both set and read cookies for example.org .

You can specify the domain when you set cookies, but it is limited to the domain your page is on (and browsers have lists of domain parts that are banned so you can’t for instance set cookies on co.uk )

Re:The CNAME of the Game: Large-scale Analysis of DNS-based ... by donmcronald on Thursday March 04, 2021 @06:27PM (#26349987)
> extras.example.net is still third-party to awesome.example.org

Yes, that's right. I'm making the assumption that letting the request succeed at all is on the losing side of the battle.

For me, I know I'm 100% trackable across the internet with my IP address (it hasn't changed in 2 years) and my screen resolution (the only 4k monitors behind that IP). If I don't block the request in the first place, the tracking company fingerprints my browser and sets that as a cookie.

The reason I say we're completely screwed is that I think we'll see all kinds of dirty tricks. Ex: auth = ads under the header and auth.example.net is actually a tracking domain. That's much harder to prevent than sending ads.example.com to a black hole.

Re:The CNAME of the Game: Large-scale Analysis of DNS-based ... by thrwwy0304 on Thursday March 04, 2021 @09:29PM (#26351764)
Agreed - letting the request fire at all is the critical point, and I believe that's the true motivation behind using CNAMEs (they evade blacklists).

CNAMEs and first-party cookie access aren't helping networks link identities across sites in Firefox and Safari - at this point they're stuck relying on browser fingerprinting. And as you point out, fingerprinting can be quite effective, especially for people on static IPs :|

This paper is claiming that CNAMEs are evading the protections offered by Safari and Firefox but that's just not the case. Or at least, the paper hasn't explained how.

Re:The CNAME of the Game: Large-scale Analysis of DNS-based ... by jrochkind1 on Thursday March 04, 2021 @10:23PM (#26352199)
You are talking about the rules for javascript access to cookies, or other rules for "cross-domain cookies".

The rules for "block third-party cookies" features are different than these, and are browser-specific rather than bound by a standard.

I believe that both Chrome and Firefox will not block cookies from a subdomain of the same base domain as "third-party". Although I'm not totally sure where to find this documented. I think if they did, it would break many more sites than "block third-party cookies" do now.

Re:The CNAME of the Game: Large-scale Analysis of DNS-based ... by thrwwy0304 on Thursday March 04, 2021 @11:39PM (#26352781)
The way tracking used to work is:

1. UserA visits foo.com which embeds a script from evil.com. When the script is requested, evil.com sees there's no tracking cookie for this user yet, so it drops one.

2. When evil.com was loaded, the Referer header showed the request was coming from foo.com. EvilCo adds an entry that UserA visited foo.com.

3. UserA now visits bar.com which also embeds a script from evil.com. Now, the tracking cookie from Step 1 already exists, so it's sent with the request to load the script from evil.com.

4. evil.com looks at the Cookie and Referer header, and adds an entry that UserA has visited bar.com.

---

Now, what Firefox and Safari have done, is they've made it impossible for ANY third party to access their cookies while a user is visiting a different site.

I completely understand that evil.com is promoting itself to first-party by routing under evil.foo.com and evil.bar.com, and that allows it to set and receive cookies on those hosts, but that alone isn't enough to break out of the new browser protections.

In this new world, evil.foo.com and evil.bar.com are still third party to each other, and so there's no way to sync identifiers between them, even though they're both operated by evil.com.

To sync identities across evil.foo.com and evil.bar.com, EvilCo is forced to do some kind of browser fingerprinting, or to rely on the operators of foo.com and bar.com to manually share additional data about the user.

---

Source - I've tried it! Run two separate domains and see if you can get the same unique identifier in cookies on both domains. The only workarounds are OAuth2 and the Storage Access API - both of which require explicit user permission.

Re:The CNAME of the Game: Large-scale Analysis of DNS-based ... by jrochkind1 on Friday March 05, 2021 @11:36AM (#26358784)
Thanks for trying to explain.

What I'm not following is that you say:

> In this new world, evil.foo.com and evil.bar.com are still third party to each other, and so there's no way to sync identifiers between them, even though they're both operated by evil.com.

But in your original 1-4 description, foo.com and evil.com already were third-party to each other. So apparenty that was not a barrier? Your original description doesn't actually mention mention any shared identifiers between evil.com and foo.com, just that evil.com would use a referer header to see that the rquest was coming from foo.com.

Won't this work exactly the same way with evil.foo.com and evil.bar.com?

Your original 1-4 stopped working because FF and Chrome stopped letting evil.com set cookies at all when loaded from foo.com. That is the restriction that broke 1-4 (it wasn't other restrictions that were in place when 1-4 was working fine), and that is the restriction you get around with evil.foo.com, restoring the situation where your 1-4 steps worked.

What am I missing?

Re:The CNAME of the Game: Large-scale Analysis of DNS-based ... by thrwwy0304 on Friday March 05, 2021 @02:57PM (#26361310)
Trying my best! This is really confusing stuff, and I probably shouldn't have come out so hot with "This is false." Safari's rollout of ITP broke my company's code three times over, so I've been in the weeds on this for a while.

I think you're missing that setting cookies alone isn't what allowed evil.com to sync identities. They needed to set the cookie from one site, and receive that same cookie when the user visited a different site.

With CNAME cloaking, it's true that EvilCo can set cookies on both evil.foo.com and evil.bar.com. But when a user is on evil.foo.com, there's no way to make a request to evil.bar.com that includes evil.bar.com's cookies. This is the mechanism that stops syncing identities.

Does that help?

Re:The CNAME of the Game: Large-scale Analysis of DNS-based ... by jrochkind1 on Friday March 05, 2021 @10:15PM (#26364876)
OK, so here's the basic issue.

What did banning third-party cookies actually stop then? Nothing?

So whatever they were able to do before banning third-party cookies, why did banning third-party cookies matter at all?

The whole point of the CNAME as described is to get around third-party cookie bans. If getting around the third-party cookie ban doesn't actually help -- that seems to suggest the third-party cookie ban in the first place didn't actually do anything, if getting around it doesn't give you anything? no?

Re:The CNAME of the Game: Large-scale Analysis of DNS-based ... by thrwwy0304 on Sunday March 07, 2021 @09:37AM (#26376129)
It stopped syncing identities with the first-class web APIs, and forced trackers to use browser fingerprinting.

That _does_ help. It adds noise to things and helps us shift our focus to stopping fingerprinting.

Re:The CNAME of the Game: Large-scale Analysis of DNS-based ... by JdeBP on Friday March 05, 2021 @11:10AM (#26358400)
You now need to read the next step in the dance, which the NextDNS people explained back in 2019 as "Security implications of CNAME Cloaking".

* https://medium.com/nextdns/cname-cloaking-the-dangerous-disg... (https://news.ycombinator.com/item?id=21604825)

Re:The CNAME of the Game: Large-scale Analysis of DNS-based ... by thrwwy0304 on Thursday March 04, 2021 @05:07PM (#26349116)
The cookie protections I'm referencing are Safari's "Intelligent Tracking Protection" and Firefox's "Total Cookie Protection."

Efforts would be much better spent trying to stop fingerprinting, trying to convince Chrome to add third party cookie protection, or lobbying for regulation.

Re:The CNAME of the Game: Large-scale Analysis of DNS-based ... by rodgerd on Thursday March 04, 2021 @05:39PM (#26349491)
The third of those. This isn't a technical problem, it's a "greedy maw of the surveillance economy" problem.