31 votes

This GitHub profile has a custom background

12 comments

  1. fxgn
    Link
    This seems to work due to the fact that MathJax doesn't sanitize the font property of the \unicode macro, so eg with \unicode[Inter; color:red]{x0041} You'll get this CSS: font-family: Inter;...

    This seems to work due to the fact that MathJax doesn't sanitize the font property of the \unicode macro, so eg with

    \unicode[Inter; color:red]{x0041}
    

    You'll get this CSS:

    font-family: Inter; color: red;
    
    14 votes
  2. [2]
    Johz
    Link
    ```math \ce{$\unicode[goombafont; color:red; pointer-events: none; z-index: -10; position: fixed; top: 0; left: 0; height: 100vh; object-fit: cover; background-size: cover; width: 130vw; opacity:...
    ```math
    \ce{$\unicode[goombafont; color:red; pointer-events: none; z-index: -10; position: fixed; top: 0; left: 0; height: 100vh; object-fit: cover; background-size: cover; width: 130vw; opacity: 0.5; background: url('https://github.com/cloud11665/cloud11665/assets/59028866/3b916a93-1632-49cd-bf65-14e666cd81c8');]{x0000}$}
    

    This is the raw contents of the readme. It looks like it uses some feature of the math mode renderer that allows you to inject CSS styles into a particular element. Once you've done that, you can position that element however you want and wherever you want on the page — in this case, they've made it appear as the background of the entire page.

    It's clever, although I imagine GitHub will be fixing it pretty soon!

    14 votes
  3. balooga
    Link
    And, of all the custom backgrounds they could choose from, it’s a waifu. Of course it’s a waifu.

    And, of all the custom backgrounds they could choose from, it’s a waifu. Of course it’s a waifu.

    12 votes
  4. [6]
    gravitas
    Link
    I was immediately worried that this could be an issue (although in any case the impact would be limited), but it turns out... nope. GitHub’s security is on point. (who’d’ve thought?!) Request...

    I was immediately worried that this could be an issue (although in any case the impact would be limited), but it turns out... nope. GitHub’s security is on point. (who’d’ve thought?!)

    Request failure message

    Content-Security-Policy: The page’s settings blocked the loading of a resource (img-src) at https://example.com/ because it violates the following directive: “img-src 'self' data: https://github.githubassets.com https://media.githubusercontent.com https://camo.githubusercontent.com https://identicons.github.com https://avatars.githubusercontent.com https://github-cloud.s3.amazonaws.com https://objects.githubusercontent.com https://secured-user-images.githubusercontent.com/ https://user-images.githubusercontent.com/ https://private-user-images.githubusercontent.com https://opengraph.githubassets.com https://github-production-user-asset-6210df.s3.amazonaws.com https://customer-stories-feed.github.com https://spotlights-feed.github.com https://objects-origin.githubusercontent.com https://*.githubusercontent.com”

    If you’re like, a regular person, the above inscrutable message means that an attacker cannot use GitHub to initiate a GET request to an arbitrary domain, whenever someone’s profile is loaded.

    If this worked (again, GitHub’s security totally prevents any of these attacks), this could either:

    • Leak someone’s IP address when they visit a GitHub profile (this is a privacy leak, but one that’s generally accepted by the Internet; nothing would be leaked besides the IP address and this is not a big deal).

    • DDoS someone. I was going to say that this isn't a big deal because GitHub traffic is minimal, but all you’d have to do is have a thousand references to some large file, different query parameters, and a lot of traffic to that profile, and maybe you could raise somebody’s CDN bill by a few dollars (ballpark).

    • Cross-site request forgery, which fortunately has been wholly solved by the Internet At Large.

    Which means that the worst impact of this flaw is basically that somebody could change the website’s background. (The Internet has gotten very good at removing potential attack surfaces, by necessity!)

    I’d imagine this to be fixed by patching whatever math renderer GitHub uses, along with maybe some CSS magic? I’m not familiar enough (read: at all) with stacking contexts to know if they could be used to clip any z-index elements to an element.

    Using an iframe would isolate it too, but it wouldn’t work in this case because an iframe doesn’t change size to fit its contents.

    9 votes
    1. [5]
      fxgn
      Link Parent
      Yeah, this is basically exactly the case that CSP was made for The worst use case I managed to come up with is just replacing the entire site with and image and preventing the user from doing...

      Yeah, this is basically exactly the case that CSP was made for

      The worst use case I managed to come up with is just replacing the entire site with and image and preventing the user from doing anything on the page

      https://github.com/flexagoon/trollface

      7 votes
      1. [3]
        mantrid
        Link Parent
        I just see a normal page with "unicode macro is not supported" in the readme section. Has it already been patched?

        I just see a normal page with "unicode macro is not supported" in the readme section. Has it already been patched?

        4 votes
        1. caliper
          Link Parent
          That’s interesting, you’re right! It was working for me yesterday, but I’m now seeing the same thing as you are.

          That’s interesting, you’re right! It was working for me yesterday, but I’m now seeing the same thing as you are.

          5 votes
        2. fxgn
          Link Parent
          Yes, it has been patched already unfortunately. You can see what it used to look like on the Wayback Machine

          Yes, it has been patched already unfortunately. You can see what it used to look like on the Wayback Machine

          4 votes
      2. gravitas
        Link Parent
        Ah, good catch on the interaction! Yeah, that’s a little more serious than changing the background, hah.

        Ah, good catch on the interaction! Yeah, that’s a little more serious than changing the background, hah.

        2 votes
  5. tomf
    Link
    shame they patched it. I had a background set for the day and was really looking forward to myspace 2.0

    shame they patched it. I had a background set for the day and was really looking forward to myspace 2.0

    8 votes