CVE-2026-42181: Lemmy api common Image Vulnerability

MODERATE
Advisory Identifier: GHSA-h6hf-9846-xwrq
CVSS 6.5
CWE-918
Published
Advisory Summary

CVE-2026-42181 is a MODERATE (CVSS 6.5) image vulnerability (CWE-918: Server-Side Request Forgery (SSRF)) affecting Lemmy api common libraries in the crates.io ecosystem. The issue involves image. Remediation is available by upgrading affected packages to version 0.19.18.

CVE-2026-42181 at a Glance

CVE Identifier CVE-2026-42181
GHSA Identifier GHSA-h6hf-9846-xwrq
Severity MODERATE
CVSS v3.1 Base Score 6.5
CWE Classification CWE-918: Server-Side Request Forgery (SSRF)
Affected Product Lemmy api common
Package Ecosystem crates.io
Published Date
Last Updated

Security Impact

CVSS: 6.5

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required Low (PR:L)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity None (I:N)
Availability None (A:N)

How to Fix CVE-2026-42181

To remediate this vulnerability, upgrade all affected Lemmy api common 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_api_common fixed: 0.19.18
Upgrade lemmy_api_common to 0.19.18
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_api_common

How to Check if You Are Affected

To determine whether your application is affected by CVE-2026-42181, inspect your project dependencies for Lemmy api common:

inspect dependencies for lemmy_api_common

Analyze the terminal output to locate any version of Lemmy api common in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.19.18), 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-918: Server-Side Request Forgery (SSRF), where the web server receives a url or similar request from an upstream component and retrieves the contents of this url, but it does not sufficiently ensure that the request is being sent to the expected destination. In Lemmy api common, 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 Lemmy fetches metadata for user-supplied post URLs and, under the default `StoreLinkPreviews` image mode, downloads the preview image through local pict-rs. While the top-level page URL is checked against internal IP ranges, the extracted `og:image` URL is not subject to the same restriction. As a result, an authenticated low-privileged user can submit an attacker-controlled public page whose Open Graph image points to an internal image endpoint. Lemmy will fetch that internal image server-side and store a local thumbnail that can then be served back to users. ### Details The metadata fetch logic applies an internal-address check only to the initial post URL. After HTML parsing, `extract_opengraph_data()` accepts absolute `og:image` values and returns them as-is. Later, `generate_post_link_metadata()` passes that second-hop image URL into `generate_pictrs_thumbnail()`, which instructs local pict-rs to fetch it through `image/download?url=...`. This creates a two-stage source-to-sink chain where the first URL is constrained, but the security boundary is bypassed through an unvalidated secondary resource. Core vulnerable code path: ```rust // crates/api_common/src/request.rs let metadata = match &post.url { Some(url) => fetch_link_metadata(url, &context, false).await.unwrap_or_default(), _ => Default::default(), }; ``` ```rust // crates/api_common/src/request.rs let og_image = page .opengraph .images .first() .and_then(|ogo| url.join(&ogo.url).ok()); ``` ```rust // crates/api_common/src/request.rs let thumbnail_url = if let (true, Some(url)) = (allow_generate_thumbnail, image_url.clone()) { generate_pictrs_thumbnail(&url, &context).await.ok().map(Into::into).or(image_url) } else { image_url.clone() }; ``` ```rust // crates/api_common/src/request.rs let fetch_url = format!( "{}image/download?url={}&resize={}", pictrs_config.url, encode(image_url.as_str()), context.settings().pictrs_config()?.max_thumbnail_size ); ``` These snippets show that only the outer page URL is checked, while the extracted `og:image` value becomes a server-side fetch target without an equivalent internal-address guard. ### PoC Prerequisites: - The attacker has a valid low-privileged account. - The instance uses the default link preview storage mode. - The attacker can post a link to a community they can access. Practical reproduction flow: 1. Host a public HTML page under attacker control. 2. Add an Open Graph image tag whose value points to an internal image URL reachable from the Lemmy host, such as `http://127.0.0.1:8081/internal.png`. 3. Create a Lemmy post whose `url` is the attacker-controlled page. 4. Observe Lemmy fetch the public page, extract `og:image`, and then fetch the internal image through pict-rs. 5. Observe the created post receive a local thumbnail URL, demonstrating that the internal image was retrieved and cached. Complete PoC attacker page: ```html <html><head> <meta property="og:image" content="http://127.0.0.1:8081/internal.png"> </head><body>x</body></html> ``` Complete PoC request: ```http POST /api/v3/post HTTP/1.1 Host: victim.example Authorization: Bearer <low-priv-jwt> Content-Type: application/json { "name": "thumb-ssrf", "community_id": 1, "url": "https://attacker.example/og.html", "body": null, "alt_text": null, "honeypot": null, "nsfw": false, "language_id": null, "custom_thumbnail": null } ``` Outcome: - The post creation request succeeds. - The internal image endpoint receives a request from the Lemmy server. - The created post is updated with a local `thumbnail_url`, indicating that the internal image was fetched and cached. ### Impact This issue upgrades an attacker-controlled external page into an internal image fetch primitive. It can be used to retrieve internal image resources, expose content that is otherwise reachable only from the application host, and publish those internal resources through Lemmy's own thumbnail serving path. Because the vulnerable mode is the documented default behavior for link previews, the issue is relevant even without non-default privacy settings.

CVE-2026-42181 Affected Lemmy api common Versions

1 component(s)
Fixed Versions:
0.19.18
Product / Package Ecosystem Affected Versions Fixed Version
lemmy_api_common
crates.io
< 0.19.18
0.19.18

References

Frequently Asked Questions

What is CVE-2026-42181?
CVE-2026-42181 is a security vulnerability in Lemmy api common involving image under CWE-918: Server-Side Request Forgery (SSRF).
Which Lemmy api common versions are affected?
Affected versions include releases prior to 0.19.18 across affected packages: lemmy_api_common.
What version fixes CVE-2026-42181?
Upgrading to 0.19.18 (or the latest patched release for your respective branch) resolves the vulnerability.
Is lemmy_api_common affected?
Yes, lemmy_api_common is affected in releases prior to 0.19.18. Upgrade your dependency to 0.19.18 or later.
What is the CVSS score of CVE-2026-42181?
CVE-2026-42181 has a CVSS v3.1 base score of 6.5 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N.
What CWE is associated with CVE-2026-42181?
CVE-2026-42181 is classified under CWE-918: Server-Side Request Forgery (SSRF) (The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination.).
How can I check crates.io dependencies for CVE-2026-42181?
Run the dependency tree command: 'inspect dependencies for lemmy_api_common'. 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-h6hf-9846-xwrq",
  "modified" : "2026-05-13T13:34:02Z",
  "published" : "2026-04-24T15:21:58Z",
  "aliases" : [ "CVE-2026-42181" ],
  "summary" : "Lemmy has SSRF and internal image disclosure in post link metadata via unvalidated og:image",
  "details" : "### Summary\nLemmy fetches metadata for user-supplied post URLs and, under the default `StoreLinkPreviews` image mode, downloads the preview image through local pict-rs. While the top-level page URL is checked against internal IP ranges, the extracted `og:image` URL is not subject to the same restriction.\n\nAs a result, an authenticated low-privileged user can submit an attacker-controlled public page whose Open Graph image points to an internal image endpoint. Lemmy will fetch that internal image server-side and store a local thumbnail that can then be served back to users.\n\n### Details\nThe metadata fetch logic applies an internal-address check only to the initial post URL. After HTML parsing, `extract_opengraph_data()` accepts absolute `og:image` values and returns them as-is. Later, `generate_post_link_metadata()` passes that second-hop image URL into `generate_pictrs_thumbnail()`, which instructs local pict-rs to fetch it through `image/download?url=...`.\n\nThis creates a two-stage source-to-sink chain where the first URL is constrained, but the security boundary is bypassed through an unvalidated secondary resource.\n\nCore vulnerable code path:\n\n```rust\n// crates/api_common/src/request.rs\nlet metadata = match &post.url {\n  Some(url) => fetch_link_metadata(url, &context, false).await.unwrap_or_default(),\n  _ => Default::default(),\n};\n```\n\n```rust\n// crates/api_common/src/request.rs\nlet og_image = page\n  .opengraph\n  .images\n  .first()\n  .and_then(|ogo| url.join(&ogo.url).ok());\n```\n\n```rust\n// crates/api_common/src/request.rs\nlet thumbnail_url = if let (true, Some(url)) = (allow_generate_thumbnail, image_url.clone()) {\n  generate_pictrs_thumbnail(&url, &context).await.ok().map(Into::into).or(image_url)\n} else {\n  image_url.clone()\n};\n```\n\n```rust\n// crates/api_common/src/request.rs\nlet fetch_url = format!(\n  \"{}image/download?url={}&resize={}\",\n  pictrs_config.url,\n  encode(image_url.as_str()),\n  context.settings().pictrs_config()?.max_thumbnail_size\n);\n```\n\nThese snippets show that only the outer page URL is checked, while the extracted `og:image` value becomes a server-side fetch target without an equivalent internal-address guard.\n\n### PoC\nPrerequisites:\n\n- The attacker has a valid low-privileged account.\n- The instance uses the default link preview storage mode.\n- The attacker can post a link to a community they can access.\n\nPractical reproduction flow:\n\n1. Host a public HTML page under attacker control.\n2. Add an Open Graph image tag whose value points to an internal image URL reachable from the Lemmy host, such as `http://127.0.0.1:8081/internal.png`.\n3. Create a Lemmy post whose `url` is the attacker-controlled page.\n4. Observe Lemmy fetch the public page, extract `og:image`, and then fetch the internal image through pict-rs.\n5. Observe the created post receive a local thumbnail URL, demonstrating that the internal image was retrieved and cached.\n\nComplete PoC attacker page:\n\n```html\n<html><head>\n<meta property=\"og:image\" content=\"http://127.0.0.1:8081/internal.png\">\n</head><body>x</body></html>\n```\n\nComplete PoC request:\n\n```http\nPOST /api/v3/post HTTP/1.1\nHost: victim.example\nAuthorization: Bearer <low-priv-jwt>\nContent-Type: application/json\n\n{\n  \"name\": \"thumb-ssrf\",\n  \"community_id\": 1,\n  \"url\": \"https://attacker.example/og.html\",\n  \"body\": null,\n  \"alt_text\": null,\n  \"honeypot\": null,\n  \"nsfw\": false,\n  \"language_id\": null,\n  \"custom_thumbnail\": null\n}\n```\n\nOutcome:\n\n- The post creation request succeeds.\n- The internal image endpoint receives a request from the Lemmy server.\n- The created post is updated with a local `thumbnail_url`, indicating that the internal image was fetched and cached.\n\n### Impact\nThis issue upgrades an attacker-controlled external page into an internal image fetch primitive. It can be used to retrieve internal image resources, expose content that is otherwise reachable only from the application host, and publish those internal resources through Lemmy's own thumbnail serving path.\n\nBecause the vulnerable mode is the documented default behavior for link previews, the issue is relevant even without non-default privacy settings.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "lemmy_api_common"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.19.18"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/LemmyNet/lemmy/security/advisories/GHSA-h6hf-9846-xwrq"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-42181"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/LemmyNet/lemmy/commit/9ffe586dafac1a46acf17edf90e0165e5503b2f1"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/LemmyNet/lemmy"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/LemmyNet/lemmy/releases/tag/0.19.18"
  }, {
    "type" : "WEB",
    "url" : "https://join-lemmy.org/news/2026-04-20_-_Lemmy_Release_v0.19.18"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-918" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-04-24T15:21:58Z",
    "nvd_published_at" : "2026-05-08T20:16:31Z"
  }
}