Hacker News new | ask | show | jobs
by carterparks 977 days ago
Your website has the worst permalinks ever.
5 comments

> This blog is now STATELESS. The entire post is contained in the URL that you are visiting now. All my "blog" is now is a hard-coded main page that contains links to posts I claim authorship of. Of course the entire post is contained in each of these links.

https://joshcsimmons.com/post/H4sIAAAAAAAA%2F3xV227cRgx911cQ...

Yep, Josh has given everyone (apparent) write access to his site.
Awesome - and the first time I've actually had someone "post" on my site.
Watch out: virus/scam/spam sites can detect sites like yours and write tons of redirects, link them somewhere, and use your site's good reputation to get their scams on the home page. This is also a huge problem for redirect services.

If the wrong person publishes the wrong link, you can get your domain banned from Google and tons of other sites as a "security risk", which can spread to your email (if you use @joshcsimmons.com).

It's fine if you don't care about blacklists of course, but this kind of abuse can easily sneak up on you.

You're welcome. :D

The client-side XSS is mostly harmless (assuming you don't have any other sensitive services running with cookies scoped to this domain), although it's technically a persistent XSS, which means it could be indexed by search engines.

But is there a server-side component to this? I noticed that the "disclaimer" is added in the source returned by the server, so I assume there is some code that checks whether the post is present on the home page? If so, that could be dangerous, if there is a bug in that code such that a malicious payload in the URL could get RCE in your server process.

I've just added some defensive programming to the site. Sorry to say. Appreciate that you hacked it with your image onerror, pretty clever.

TBH I haven't thought about most of these things. Nobody typically reads my blogs when I've made them before and this is likely the only interest it will get for quite a while.

lol :) nice fix

Can't promise I won't circumvent it when I've got some time...

https://joshcsimmons.com/post/H4sIAAAAAAAAAyXMQQrCMBCF4b2neO...

Doesn't need to release tools... gzip, base64 and uri encode uh huh.

So if the author fix a small typo in the post, they break all the links to it. The blog is not "stateless", it’s just that its state is stored in the homepage. Having all posts on that page with anchor links would achieve the same thing with shorter links that don’t depend on the content.
It won’t break any existing links. It just means that existing links will still have the typo.
doesn't this mean I could embed salacious material into a link and fool people into thinking the person who owned this website wrote it?
> Anything can be generated here. You could even host your own blog that uses my website as a renderer if you really wanted to. It supports markdown.

> Every post that I want to publicly claim authorship of lives at the root of this site. If you are reading a post that I have claimed it will look like this page. Posts of unknown authorship have a disclaimer at the top of the page.

https://joshcsimmons.com/post/H4sIAAAAAAAA%2F3xV227cRgx911cQ...

(His permalinks are horrible, lol)

>Posts of unknown authorship have a disclaimer at the top of the page.

Problem is, the posts can contain <script> elements. So it's easy to just write a little JavaScript that removes the disclaimer at the top. See this hastily-made, immature example of mine:

https://joshcsimmons.com/post/H4sIABO8LmUC/3VT0W7aQBB85yu2QV...

As it stands, this really isn't the most secure system. Something much more malicious could be injected into this!

This gave me a pretty good laugh. I have some sanitization and guards set up now. TBH I never really expected anyone to visit my blog.
Shouldn’t it be “shat”?

Either way, considering the submission we’re commenting on, the author of the blog may appreciate your humour.

Correct
I was halfway expecting goatse
unfortunately patched now
XSS as a feature, neat
I don't understand how this helps ownership of content? What situation is this trying to avoid? You already "own" your URL if you own your domain?

EDIT: understand you are not the OP btw, just wondering out loud.

The only thing I can think of is if they want to share controversial posts while having the ability to deny that they wrote it (as long as they don’t actually create a link to it from their own site).

It’s not a good use case IMO, but that is all I can think of lol

Huh, cool. I think it's a pretty terrible idea, but I'm glad people are still doing fun/creative things with websites. Keeping the spirit of the early web alive. haha :)
Tranlsation: This guy is insufferable
If you're going to do that, you should at least generate shortened URLs as well.
But then it’s not stateless anymore.
It's not stateless at all because of the main page, so this is more of a weird anti-optimization.
But how does it know whether it should print the pretext?
oh no -- it's actually vulnerable to xss...!!!

https://joshcsimmons.com/post/eNpTVlaoKC5WSEnNzefisilOLsosKL...

(this just injects a <script> alert but.... that's bad)

just tried contacting the author via linkedin (since I don't see an email address on their site)

@joshcsimmons are you around?

The author is aware.

> Every post that I want to publicly claim authorship of lives at the root of this site. If you are reading a post that I have claimed it will look like this page. Posts of unknown authorship have a disclaimer at the top of the page.

https://joshcsimmons.com/post/H4sIAAAAAAAA%2F3xV227cRgx911cQ...

> The author is aware.

Since the website is vulnerable to XSS, you could inject a script that removes the disclaimer.

Very clever. For those wondering, this won't gunzip since it's compressed using zlib. you must do a chain like this: URL Decode -> Base64 Decode -> Zlib Inflate.
right on! I used https://bugdays.com/gzip-base64 to go back and forth.

base64 generates slashes, so the site (and I) run encodeURIComponent in the devtools on the resulting base64 to make sure it's completely url-safe.

---

the poc "payload" is

eNqzKU4uyiwosUvJTy7NTc0r0UtPLXHNSQUxi50qnXMSi4v9EnNTNdRzMtMzStQ1ow1i9YpSc%2FPLUjU0bfShmrm4lBVKMjKLFYAoKTEFACeDHYg%3D

which uri-component-decodes to:

eNqzKU4uyiwosUvJTy7NTc0r0UtPLXHNSQUxi50qnXMSi4v9EnNTNdRzMtMzStQ1ow1i9YpSc/PLUjU0bfShmrm4lBVKMjKLFYAoKTEFACeDHYg=

which un-base64+gzip's to (using the site I posted above):

  <script>document.getElementsByClassName('light')[0].remove()</script>

  # this is bad
Hah this is clever. Mixed feelings on patching this but I patched it for now.
s/removes the disclaimer/exploits a browser 0-day/
There are much less weird links you can give someone if you have 0-day. I don't think that's a problem worth worrying about for the author.
It’s a problem worth worrying about for users who maintain whitelists of domains they allow JavaScript from.
for sure, there's awareness and then there's disregard of any basic web security.

the second they start hosting any application/backend/cookie-enabled thing on this domain name, anyone could inject a script via their /post/ gzip-base64 scheme, and do bad things...?

I don't think html sanitization would go against the principle of this idea. just... at the very least strip the tags! :-)

Apparently the post data is encoded in the URL.

I'm not saying you're wrong. You're right, but at least it's for an interesting reason.

Agreed. Went to share the link and it was such a wall of text I deleted it.
Did the same thing. I guess it's fine if he doesn't want anybody to share his website, but in that case ... Why have a website
The secret 3rd option
Similar idea to itty.bitty.site, smolsite.zip, or parameter.page