240
submitted 1 year ago* (last edited 1 year ago) by [email protected] to c/[email protected]

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
[-] [email protected] 4 points 1 year ago

I still wouldn't use the admin account as my daily driver. Leave it open in another browser/private tab specifically to perform admin actions (as noted) but not for browsing/posting/community modding. I understand how that's a pain but given how early days we are with this platform and the high probability of more issues surfacing, it's a necessary pain.

I'd really like to see the devs add some tools to mitigate future risk and further protect admin accounts. The least of which being that admin actions require stronger validation than a browser side cookie, and frequent re-validation to perform admin actions.

[-] [email protected] 2 points 1 year ago

I still wouldn’t use the admin account as my daily driver. Leave it open in another browser/private tab specifically to perform admin actions

i've thought about switching to a different account for non-admin tasks but I was a normal user here first and I want to keep using this account for normal posting too. I think using a different account is kind of pointless from a security standpoint, because performing mod and admin actions requires looking at user-generated content anyway and there is no way around that (except for maybe moving to a very clipboard-heavy workflow which would make everything take much longer).

There is work underway to fix these XSS bugs in a more comprehensive way (better CSP, and HttpOnly cookies...) which will hopefully land soon.

(i am not a lemmy developer but i'm reading the github and matrix chat...)

[-] [email protected] 2 points 1 year ago

I mean. You could still be a normal user and have a separate admin account.

I get your point. But it's a huge risk.

[-] [email protected] 1 points 1 year ago* (last edited 1 year ago)

I get your point. But it’s a huge risk.

Using a separate account doesn't substantially mitigate the risk. It might reduce the chances of getting randomly exploited, but it's easy to post things admins need to see to do their job so any attacker wanting to target admins would still be able to even if we used separate accounts.

Systemically fixing the XSS problems is necessary either way :)

edit: actually I guess most common admin activities could be separated from the rarely used ones, at least... or the infrequent actions could simply require re-authenticating. That wouldn't be a bad idea.

[-] [email protected] 1 points 1 year ago

To be clear I'm not talking about separate mod accounts. I'm talking just admin.

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

Lemmy Administration

694 readers
1 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