News for hackers. Stuff that matters.
Re:We spent $20 to achieve RCE and accidentally became the a... by varun_ch on Wednesday September 11, 2024 @02:09PM (#41513838)
I can think of two reasons: 1. it's immediately clear to users that they're seeing content that doesn't belong to your business but instead belongs to your business's users. maybe less relevant for github, but imagine if someone uploaded something phishing-y and it was visible on a page with a url like google.com/uploads/asdf.

2. if a user uploaded something like an html file, you wouldn't want it to be able to run javascript on google.com (because then you can steal cookies and do bad stuff), csp rules exist, but it's a lot easier to sandbox users content entirely like this.

Re:We spent $20 to achieve RCE and accidentally became the a... by mananaysiempre on Wednesday September 11, 2024 @02:44PM (#41514140)
> if a user uploaded something like an html file, you wouldn't want it to be able to run javascript on google.com (because then you can steal cookies and do bad stuff)

Cookies are the only problem here, as far as I know, everything else should be sequestered by origin, which includes the full domain name (and port and protocol). Cookies predate the same-origin policy and so browsers scope them using their best guess at what the topmost single-owner domain name is, using—I kid you not—a compiled-in list[1]. (It’s as terrifying as it sounds.)

[1] https://publicsuffix.org/

Re:We spent $20 to achieve RCE and accidentally became the a... by theendisney on Wednesday September 11, 2024 @04:21PM (#41515032)
There might be reason to block your user content.
Re:We spent $20 to achieve RCE and accidentally became the a... by Andrew_nenakhov on Wednesday September 11, 2024 @04:08PM (#41514930)
Wouldn't usercontent.github.com work just as well?
Re:We spent $20 to achieve RCE and accidentally became the a... by defen on Wednesday September 11, 2024 @04:39PM (#41515163)
A completely separate domain is more secure because it's impossible to mess up. From the browser's point of view githubusercontent.com is completely unrelated to github.com, so there's literally nothing github could accidentally do or a hacker could maliciously do with the usercontent site that would grant elevated access to the main site. Anything they could do is equally doable with their own attacker-controlled domain.
Re:We spent $20 to achieve RCE and accidentally became the a... by bobince on Wednesday September 11, 2024 @04:46PM (#41515202)
Script running on usercontent.github.com:

- is allowed to set cookies scoped to *.github.com, interfering with cookie mechanisms on the parent domain and its other subdomains, potentially resulting in session fixation attacks

- will receive cookies scoped to *.github.com. In IE, cookies set from a site with address "github.com" will by default be scoped to *.github.com, resulting in session-stealing attacks. (Which is why it's traditionally a good idea to prefer keeping 'www.' as the canonical address from which apps run, if there might be any other subdomains at any point.)

So if you've any chance of giving an attacker scripting access into that origin, best it not be a subdomain of anything you care about.

Re:We spent $20 to achieve RCE and accidentally became the a... by codazoda on Wednesday September 11, 2024 @04:51PM (#41515236)
I think one reason is that a subdomain of github.com (like username.github.com) might be able to read and set cookies that are shared with the main github.com domain. There are ways to control this but using a different domain (github.io is the one I'm familiar with) creates wider separation and probably helps reduce mistakes.

I read about this a while back but I can't find the link anymore (and it's not the same one that op pointed to).

Re:We spent $20 to achieve RCE and accidentally became the a... by genewitch on Wednesday September 11, 2024 @06:45PM (#41515935)
client browsers have no "idea" of subdomains, either. if i have example.com login saved, and also a one.example.com and a two.example.com, a lot of my browsers and plugins will get weird about wanting to save that two.example.com login as a separate entity. I run ~4 domains so i use a lot of subdomains, and the root domain (example.com) now has dozens of passwords saved. I stand up a new service on three.example.com and it will suggest some arbitrary subset of those passwords from example.com, one.example.com, two.example.com.

Imagine if eg.com allowed user subdomains, and some users added logins to their subdomains for whatever reason, there's a potential for an adversarial user to have a subdomain and just record all logins attempted, because browsers will automagically autofill into any subdomain.

if you need proof i can take a screenshot, it's ridiculous, and i blame google - it used to be the standard way of having users on your service, and then php and apache rewrite style usage made example.com/user1 more common than user1.example.com.

Re:We spent $20 to achieve RCE and accidentally became the a... by j16sdiz on Wednesday September 11, 2024 @09:44PM (#41516864)
> client browsers have no "idea" of subdomains, either.

They have. That's why PSL list exists. It applies to all CSP rules.

> if i have example.com login saved,

It's the passsword wallet thing. It uses different rules and have no standards

Re:We spent $20 to achieve RCE and accidentally became the a... by wiradikusuma on Wednesday September 11, 2024 @02:35PM (#41514057)
I'm wondering, many SaaS offer companyname.mysaas.com. Is that totally secure?
Re:We spent $20 to achieve RCE and accidentally became the a... by asmor on Wednesday September 11, 2024 @03:31PM (#41514586)
If it's on the PSL it gets treated similarly to second level "TLDs" like co.uk.
Re:We spent $20 to achieve RCE and accidentally became the a... by mhio on Wednesday September 11, 2024 @08:46PM (#41516598)
PSL = Public Suffix List

https://publicsuffix.org/

Re:We spent $20 to achieve RCE and accidentally became the a... by thayne on Wednesday September 11, 2024 @08:55PM (#41516640)
3. If someone uploads something bad, it could potentially get your entire base domain blocklisted by various services, firewalls, anti-malware software, etc.