this post was submitted on 10 Jul 2023
231 points (100.0% liked)

Lemmy Administration

698 readers
3 users here now

Anything about running your own Lemmy instance. Including how to install it, maintain and customise it.

Be sure to check out the docs: https://join-lemmy.org/docs/en/administration/administration.html

If you have any problems, describe them here and we will try to help you fixing them.

founded 4 years ago
MODERATORS
 

UPDATE: The latest RC version of Lemmy-ui (0.18.2-rc.2) contains fixes for the issue, but if you believe you were vulnerable, you should still rotate your JWT secret after upgrading! Read below for instructions. Removing custom emoji is no longer necessary after upgrading.

Original post follows:


This post is intended as a central place that admins can reference regarding the XSS incident from this morning.

What happened?

A couple of the bigger Lemmy instances had several user accounts compromised through stolen authentication cookies. Some of these cookies belonged to admins, these admin cookies were used to deface instances. Only users that opened pages with malicious content during the incident were vulnerable. The malicious content was possible due to a bug with rendering custom emojis.

Stolen cookies gave attackers access to all private messages and e-mail addresses of affected users.

Am I vulnerable?

If your instance has ANY custom emojis, you are vulnerable. Note that it appears only local custom emojis are affected, so federated content with custom emojis from other instances should be safe.

I had custom emojis on my instance, what should I do?

This should be enough to mitigate now:

  1. Remove custom emoji
DELETE FROM custom_emoji_keyword;
DELETE FROM custom_emoji;
  1. Rotate your JWT secret (invalidates all current login sessions)
-- back up your secret first, just in case
SELECT * FROM secret;
-- generate a new secret
UPDATE secret SET jwt_secret = gen_random_uuid();
  1. Restart Lemmy server

If you need help with any of this, you can reach out to me on Matrix (@sunaurus:matrix.org) or on Discord (@sunaurus)

Legal

If your instance was affected, you may have some legal obligations. Please check this comment for more info: https://lemmy.world/comment/1064402

More context:

https://github.com/LemmyNet/lemmy-ui/issues/1895

https://github.com/LemmyNet/lemmy-ui/pull/1897

you are viewing a single comment's thread
view the rest of the comments
[–] escaped_cruzader@lemmy.world -1 points 1 year ago (1 children)

Why is lemmy creating html nodes concatenating strings? This is going to happen again and again

I should have expected this judging by the state of the WS bugs

[–] sunaurus@lemm.ee 8 points 1 year ago (2 children)

This is not the general way of doing things in Lemmy. It was just a mistake that unfortunately did not get caught in code review. These things happen from time to time (even in projects which are FAR bigger and better funded than Lemmy)

[–] dan@upvote.au 1 points 1 year ago* (last edited 1 year ago)

It's probably worth having someone audit the codebase to ensure that there's no other places that build HTML using string concatenation. https://github.com/LemmyNet/lemmy-ui/pull/1897 looks like a temporary patch rather than an actual fix. I can try to take a look if I get some free time.

[–] Gestrid@lemmy.ca 1 points 1 year ago

As an example, Google's own website domain was once bought by someone other than Google after they discovered it on a list of domains for sale. Out of curiosity, they tried to buy it and were (to their surprise) successful. The person owned it for about a minute before Google caught on and reversed the transaction. https://money.cnn.com/2016/01/29/technology/google-domain-purchase/index.html