GHSA-QR6X-7V33-6QMG

Vulnerability from github – Published: 2026-10-27 14:45 – Updated: 2026-10-27 14:45
VLAI
Summary
Rembg: Unauthenticated SAM model injection permits local-file disclosure through malicious ONNX graphs
Details

The public /api/remove endpoint uses attacker-controlled extras.sam_model in both SAM filenames and GitHub download URLs. Path traversal plus a URL fragment lets an unauthenticated attacker place malicious ONNX models beside a target file. The models read the file as ONNX external data and encode its bytes into the returned PNG.

This issue affects SAM's sam_model in 2.0.81 and returns complete file contents.

image

Screenshot 1 — First unauthenticated request primes the path and returns HTTP 500.

Technical details

rembg/commands/s_command.py:188-223,384-397 accepts public extras JSON and passes it to new_session(). rembg/sessions/sam.py:313-355 inserts sam_model into encoder/decoder filenames and fixed GitHub URLs, then invokes pooch.retrieve() without a pinned hash.

Requests removes the URL #fragment; the local POSIX path retains it. Pooch creates attacker-selected parent directories without enforcing cache containment. The first request creates the path tree and returns HTTP 500. The identical second request downloads the attacker asset twice and stores it as both SAM models beside the target.

The graph uses a relative external tensor to read the target and maps every byte to mask pixels. rembg returns the mask as a PNG, which the attacker decodes back into the original bytes.

image

Screenshot 2 — The identical second request returns HTTP 200 with an encoded PNG.

image

Proof of concept

The attached loopback-only PoC produced:

VULNERABLE: unauthenticated SAM model injection disclosed the synthetic /flag
first-http=500 second-http=200
decoded-value=REMBG_AUDIT_SYNTHETIC_FLAG_2026_08_28

The /etc/passwd variant produced:

VULNERABLE: disclosed /etc/passwd (839 bytes)
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
...
nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin

The decoded contents matched /etc/passwd inside the owned container. Testing used a local TLS stand-in for GitHub; no public target was contacted.

image

Screenshot 3 — The decoder reconstructs all 839 bytes of /etc/passwd.

Impact

An unauthenticated attacker can execute arbitrary ONNX computation and disclose complete files that rembg can reach under the required filesystem permissions. The supplied root-running container exposed both /flag and /etc/passwd.

Remediation

Allow only fixed SAM identifiers mapped server-side to fixed filenames, URLs, and pinned hashes. Reject path and URL syntax; canonicalize destinations and enforce cache containment before creating directories. Run the container as a non-root user with a read-only root filesystem.

decode_samfragment_png.py samfragment_04.py samfragment_etc_passwd_lab.py

Show details on source website

{
  "affected": [
    {
      "package": {
        "ecosystem": "PyPI",
        "name": "rembg"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0"
            },
            {
              "fixed": "2.0.82"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    }
  ],
  "aliases": [
    "CVE-2026-115924"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-22"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2026-10-27T14:45:36Z",
    "nvd_published_at": "2026-10-26T20:17:52Z",
    "severity": "HIGH"
  },
  "details": "The public `/api/remove` endpoint uses attacker-controlled `extras.sam_model` in both SAM filenames and GitHub download URLs. Path traversal plus a URL fragment lets an unauthenticated attacker place malicious ONNX models beside a target file. The models read the file as ONNX external data and encode its bytes into the returned PNG.\n\n This issue affects SAM\u0027s `sam_model` in 2.0.81 and returns complete file contents.\n\n\n\u003cimg width=\"2172\" height=\"1182\" alt=\"image\" src=\"https://github.com/user-attachments/assets/70aacab1-5ef8-4aad-b30e-e3780adef4d2\" /\u003e\n\n *Screenshot 1 \u2014 First unauthenticated request primes the path and returns HTTP 500.*\n\n\n### Technical details\n\n`rembg/commands/s_command.py:188-223,384-397` accepts public `extras` JSON and passes it to `new_session()`. `rembg/sessions/sam.py:313-355` inserts `sam_model` into encoder/decoder filenames and fixed GitHub URLs, then invokes `pooch.retrieve()` without a pinned hash.\n\nRequests removes the URL `#fragment`; the local POSIX path retains it. Pooch creates attacker-selected parent directories without enforcing cache containment. The first request creates the path tree and returns HTTP 500. The identical second request downloads the attacker asset twice and stores it as both SAM models beside the target.\n\nThe graph uses a relative external tensor to read the target and maps every byte to mask pixels. rembg returns the mask as a PNG, which the attacker decodes back into the original bytes.\n\n\n\u003cimg width=\"2432\" height=\"1254\" alt=\"image\" src=\"https://github.com/user-attachments/assets/99215c39-3619-4952-8f41-5ef2034f7499\" /\u003e\n\n *Screenshot 2 \u2014 The identical second request returns HTTP 200 with an encoded PNG.*\n  \n\u003cimg width=\"2858\" height=\"1548\" alt=\"image\" src=\"https://github.com/user-attachments/assets/26322071-101c-41aa-a356-08a4969ef475\" /\u003e\n\n\n### Proof of concept\n\nThe attached loopback-only PoC produced:\n\n```text\nVULNERABLE: unauthenticated SAM model injection disclosed the synthetic /flag\nfirst-http=500 second-http=200\ndecoded-value=REMBG_AUDIT_SYNTHETIC_FLAG_2026_08_28\n```\n\nThe `/etc/passwd` variant produced:\n\n```text\nVULNERABLE: disclosed /etc/passwd (839 bytes)\nroot:x:0:0:root:/root:/bin/bash\ndaemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin\n...\nnobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin\n```\n\nThe decoded contents matched `/etc/passwd` inside the owned container. Testing used a local TLS stand-in for GitHub; no public target was contacted.\n\n\n\u003cimg width=\"1816\" height=\"1146\" alt=\"image\" src=\"https://github.com/user-attachments/assets/664eaf25-5963-4ca6-b7eb-3e198499194a\" /\u003e\n\n *Screenshot 3 \u2014 The decoder reconstructs all 839 bytes of `/etc/passwd`.*\n\n### Impact\n\nAn unauthenticated attacker can execute arbitrary ONNX computation and disclose complete files that rembg can reach under the required filesystem permissions. The supplied root-running container exposed both `/flag` and `/etc/passwd`.\n\n### Remediation\n\nAllow only fixed SAM identifiers mapped server-side to fixed filenames, URLs, and pinned hashes. Reject path and URL syntax; canonicalize destinations and enforce cache containment before creating directories. Run the container as a non-root user with a read-only root filesystem.\n\n[decode_samfragment_png.py](https://github.com/user-attachments/files/31601255/decode_samfragment_png.py)\n[samfragment_04.py](https://github.com/user-attachments/files/31601256/samfragment_04.py)\n[samfragment_etc_passwd_lab.py](https://github.com/user-attachments/files/31601258/samfragment_etc_passwd_lab.py)",
  "id": "GHSA-qr6x-7v33-6qmg",
  "modified": "2026-10-27T14:45:36Z",
  "published": "2026-10-27T14:45:36Z",
  "references": [
    {
      "type": "WEB",
      "url": "https://github.com/danielgatis/rembg/security/advisories/GHSA-qr6x-7v33-6qmg"
    },
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-115924"
    },
    {
      "type": "WEB",
      "url": "https://github.com/danielgatis/rembg/commit/b2758c6b39bb2b02df90a03128110339476984d3"
    },
    {
      "type": "PACKAGE",
      "url": "https://github.com/danielgatis/rembg"
    },
    {
      "type": "WEB",
      "url": "https://github.com/danielgatis/rembg/releases/tag/v2.0.82"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:L/A:L",
      "type": "CVSS_V3"
    }
  ],
  "summary": "Rembg: Unauthenticated SAM model injection permits local-file disclosure through malicious ONNX graphs"
}



Log in or create an account to share your comment.




Tags
Taxonomy of the tags.


Loading…

Loading…

Loading…

Drag nodes to arrange them. Double-click a related vulnerability to open it, or a source to visit its link. The Physics button on the left tunes the layout and the simulation; the legend at the bottom left hides or shows nodes by kind and by sighting type.

Forecast uses a logistic model when the trend is rising, or an exponential decay model when the trend is falling. Fitted via linearized least squares.

Sightings

Author Source Type Date Other

Nomenclature

  • Seen: The vulnerability was mentioned, discussed, or observed by the user.
  • Confirmed: The vulnerability has been validated from an analyst's perspective.
  • Published Proof of Concept: A public proof of concept is available for this vulnerability.
  • Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
  • Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
  • Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
  • Not confirmed: The user expressed doubt about the validity of the vulnerability.
  • Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.
Vulnerability timeline

Sightings and recorded dates, grouped by day · UTC

JSON
Events included in the timeline

Loading timeline…


    Loading…

    Loading…

    Loading…

    Related by attack behaviour

    Vulnerabilities whose description is nearest to this one in the vector space of the CIRCL/vulnerability-attack-technique-biencoder model. This is a similarity search over the bi-encoder space (plain cosine), not a classification, and it has no measured accuracy.