GHSA-wr2m-38xh-rpc9: Lemmy server Lemmy User Purging Users Or Vulnerability

MODERATE
CWE-708
Published
Advisory Summary

GHSA-wr2m-38xh-rpc9 is a MODERATE lemmy user purging users or vulnerability (CWE-708: Incorrect Ownership Assignment) affecting Lemmy server libraries in the crates.io ecosystem. The issue involves lemmy user purging users or communities or banning users can delete images they didn't upload/exclusively use. Remediation is available by upgrading affected packages to version 0.19.11.

GHSA-wr2m-38xh-rpc9 at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-wr2m-38xh-rpc9
Severity MODERATE
CVSS v3.1 Base Score N/A
CWE Classification CWE-708: Incorrect Ownership Assignment
Affected Product Lemmy server
Package Ecosystem crates.io
Published Date
Last Updated

How to Fix GHSA-wr2m-38xh-rpc9

To remediate this vulnerability, upgrade all affected Lemmy server dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

lemmy_server fixed: 0.19.11
Upgrade lemmy_server to 0.19.11
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for lemmy_server

How to Check if You Are Affected

To determine whether your application is affected by GHSA-wr2m-38xh-rpc9, inspect your project dependencies for Lemmy server:

inspect dependencies for lemmy_server

Analyze the terminal output to locate any version of Lemmy server in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.19.11), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-708: Incorrect Ownership Assignment, where the product assigns an owner to a resource, but the owner is outside of the intended control sphere. In Lemmy server, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Summary An improper uploaded media ownership check can result in inadvertent deletion of media when a user is banned with content removal or purged. This can lead to deletion of media that was not uploaded by the banned/purged user. This also applies to purged communities, in which case all media posted in that community will get deleted without proper ownership check. This is limited to media with an `image/*` content-type returned by pict-rs. ### Details Lemmy did not associate users with media uploads until version 0.19.0 ([#3927](https://github.com/LemmyNet/lemmy/pull/3927)). Back when the first parts of content purging were implemented for 0.17.0 ([#1809](https://github.com/LemmyNet/lemmy/pull/1809)), it was therefore not possible to properly identify media belonging to a specific user for situations in which this data should get erased from pict-rs, Lemmy's media storage backend. Pict-rs deduplicates uploaded files transparently. As a result, it has two types of media deletion. A regular deletion will only remove the referenced alias, and if there are not other aliases pointing to the same file, the backing file will also be deleted. A purge on the other hand will delete all aliases pointing to the specified file, as well as the file itself. The logic implemented in 0.17.0 iterated over media URLs related to users and communities when purging them and purged them from pict-rs. This results in a full deletion of the backing media, even if either the same URL was the result of an upload by a different user, or the same media being uploaded by another user with a different alias. For user purges, Lemmy iterated over all posts they created and applied this to all media referenced in post URLs and post thumbnails. For community purges, this applied to all posts within this community. Additionally, the deletion of user avatars, banners, as well as the media from all their posts was implemented when users were banned with content removal. This includes local bans and also bans received via federation, when a user gets banned on their home instance. The function for purging images from pict-rs performs a check at the start to verify that the media `Content-Type` header returned by pict-rs starts with `image/`, which limits this to not affect other media types supported by Lemmy and pict-rs, such as videos. ### Impact #### Instances with open federation The vast majority of Lemmy instances has open federation, which means that this can be exploited remotely without any authentication. #### Instances with limited or no federation Exploitation requires user interaction by an admin of the targeted instance or a federation-linked instance if federation is enabled. It may also require authentication, as instances may not have open registrations.

GHSA-wr2m-38xh-rpc9 Affected Lemmy server Versions

1 component(s)
Fixed Versions:
0.19.11
Product / Package Ecosystem Affected Versions Fixed Version
lemmy_server
crates.io
≥ 0.17.0
< 0.19.11
0.19.11

References

Frequently Asked Questions

What is GHSA-wr2m-38xh-rpc9?
GHSA-wr2m-38xh-rpc9 is a security vulnerability in Lemmy server involving Lemmy user purging users or communities or banning users can delete images they didn't upload/exclusively use under CWE-708: Incorrect Ownership Assignment.
Which Lemmy server versions are affected?
Affected versions include releases prior to 0.19.11 across affected packages: lemmy_server.
What version fixes GHSA-wr2m-38xh-rpc9?
Upgrading to 0.19.11 (or the latest patched release for your respective branch) resolves the vulnerability.
Is lemmy_server affected?
Yes, lemmy_server is affected in releases prior to 0.19.11. Upgrade your dependency to 0.19.11 or later.
What CWE is associated with GHSA-wr2m-38xh-rpc9?
GHSA-wr2m-38xh-rpc9 is classified under CWE-708: Incorrect Ownership Assignment (The product assigns an owner to a resource, but the owner is outside of the intended control sphere.).
How can I check crates.io dependencies for GHSA-wr2m-38xh-rpc9?
Run the dependency tree command: 'inspect dependencies for lemmy_server'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-wr2m-38xh-rpc9",
  "modified" : "2025-04-08T17:38:59Z",
  "published" : "2025-04-08T17:38:59Z",
  "aliases" : [ ],
  "summary" : "Lemmy user purging users or communities or banning users can delete images they didn't upload/exclusively use",
  "details" : "### Summary\nAn improper uploaded media ownership check can result in inadvertent deletion of media when a user is banned with content removal or purged. This can lead to deletion of media that was not uploaded by the banned/purged user. This also applies to purged communities, in which case all media posted in that community will get deleted without proper ownership check.\nThis is limited to media with an `image/*` content-type returned by pict-rs.\n\n### Details\nLemmy did not associate users with media uploads until version 0.19.0 ([#3927](https://github.com/LemmyNet/lemmy/pull/3927)).\nBack when the first parts of content purging were implemented for 0.17.0 ([#1809](https://github.com/LemmyNet/lemmy/pull/1809)), it was therefore not possible to properly identify media belonging to a specific user for situations in which this data should get erased from pict-rs, Lemmy's media storage backend.\n\nPict-rs deduplicates uploaded files transparently. As a result, it has two types of media deletion. A regular deletion will only remove the referenced alias, and if there are not other aliases pointing to the same file, the backing file will also be deleted. A purge on the other hand will delete all aliases pointing to the specified file, as well as the file itself.\n\nThe logic implemented in 0.17.0 iterated over media URLs related to users and communities when purging them and purged them from pict-rs. This results in a full deletion of the backing media, even if either the same URL was the result of an upload by a different user, or the same media being uploaded by another user with a different alias.\nFor user purges, Lemmy iterated over all posts they created and applied this to all media referenced in post URLs and post thumbnails. For community purges, this applied to all posts within this community.\n\nAdditionally, the deletion of user avatars, banners, as well as the media from all their posts was implemented when users were banned with content removal. This includes local bans and also bans received via federation, when a user gets banned on their home instance.\n\nThe function for purging images from pict-rs performs a check at the start to verify that the media `Content-Type` header returned by pict-rs starts with `image/`, which limits this to not affect other media types supported by Lemmy and pict-rs, such as videos.\n\n### Impact\n\n#### Instances with open federation\nThe vast majority of Lemmy instances has open federation, which means that this can be exploited remotely without any authentication.\n\n#### Instances with limited or no federation\nExploitation requires user interaction by an admin of the targeted instance or a federation-linked instance if federation is enabled.\nIt may also require authentication, as instances may not have open registrations.",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:L/VA:N/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "lemmy_server"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.17.0"
      }, {
        "fixed" : "0.19.11"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/LemmyNet/lemmy/security/advisories/GHSA-wr2m-38xh-rpc9"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/LemmyNet/lemmy/pull/1809"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/LemmyNet/lemmy/pull/3927"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/LemmyNet/lemmy/pull/5566"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/LemmyNet/lemmy"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-708" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2025-04-08T17:38:59Z",
    "nvd_published_at" : null
  }
}