CVE-2026-115924

Rembg: Unauthenticated SAM model injection permits local-file disclosure through malicious ONNX graphs

Published Oct 26, 2026 CVSS 3.1 · 8.6 High EPSS < 1% KEV · Not listed
Description
Rembg is a tool to remove images background. Prior to 2.0.82, the public /api/remove endpoint passes attacker-controlled extras.sam_model through rembg/commands/s_command.py to rembg/sessions/sam.py, where it is interpolated into SAM filenames and GitHub download URLs passed to pooch.retrieve() without a pinned hash. An unauthenticated attacker can supply a sam_model value combining path traversal with URL fragment syntax to exploit the HTTP request discarding the fragment while the local POSIX path retains it. The first request primes the attacker-selected path tree, and an identical repeated request downloads malicious ONNX encoder and decoder files beside a readable target file. The graphs can load the target through ONNX external data and encode its bytes into the returned PNG mask, disclosing complete files accessible to the rembg process and allowing arbitrary ONNX computation. This issue is fixed in version 2.0.82.

Analysis

AI-generated

Technical impact

Rembg, a tool for background removal, contains a flaw that lets an unauthenticated attacker supply a specially crafted SAM model name that interleaves path‑traversal sequences with URL‑fragment syntax. The sanitization logic in the public /api/remove endpoint fails to strip the fragment part, allowing the attacker to create a local path that contains both a valid file name and a fragment marker. The first request establishes the targeted directory structure; a second identical request downloads malicious ONNX encoder and decoder files onto that path using GitHub URLs that are not pinned with a hash. Because the ONNX runtime can load external data, those files can refer to arbitrary files on the host, making the attacker read any file that the rembg process can access and embed the file’s contents into the PNG mask returned to the client. The vulnerability is a classic local‑file‑disclosure weakness (CWE‑22) and also permits arbitrary ONNX computation, potentially elevating the impact if the ONNX files perform privileged operations.

Affected Systems

The affected product is Rembg, maintained by danielgatis. All releases prior to version 2.0.82 are vulnerable. The flaw resides in the public /api/remove endpoint and in the use of the rembg/sessions/sam.py and rembg/commands/s_command.py modules. Upgrading to 2.0.82 or later removes the ability to provide a crafted sam_model string and pins GitHub download URLs via a hash.

Risk and Exploitability

The CVSS score of 8.6 signals high severity, and the attack vector is unauthenticated access to a public HTTP endpoint. No EPSS score is available and the vulnerability is not listed in CISA KEV, indicating that large‑scale exploitation has not yet been observed. However, the flaw allows reading of any file readable by the rembg process and exposure of its contents over the network. The risk is confined to the filesystem accessible by the rembg user, but sensitive data could be disclosed if that user can read it. The absence of authentication on the endpoint means an attacker does not need any credentials beyond sending an HTTP request, and the combination of path traversal and uncontrolled ONNX file creation makes exploitation straightforward for a skilled adversary.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Upgrade Rembg to v2.0.82 or later to remove the SAM model injection flaw and pin the GitHub download URLs.
  • If an upgrade is not immediately possible, disable or protect the /api/remove endpoint by requiring authentication or blocking unauthenticated traffic with a firewall or reverse‑proxy rule.
  • Run the Rembg process under a dedicated, least‑privileged user account that does not have read access to sensitive files on the host.

Generated by OpenCVE AI on October 26, 2026 at 21:24 UTC.

Tracking

Sign in to view the affected projects.

Advisories

Source ID Title
Github GHSA Github GHSA GHSA-qr6x-7v33-6qmg Rembg: Unauthenticated SAM model injection permits local-file disclosure through malicious ONNX graphs
History
Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'yes', 'Exploitation': 'poc', 'Technical Impact': 'partial'}, 'version': '2.0.3'}

Type Values Removed Values Added
First Time appeared Danielgatis
Danielgatis rembg
Vendors & Products Danielgatis
Danielgatis rembg
Type Values Removed Values Added
Description Rembg is a tool to remove images background. Prior to 2.0.82, the public /api/remove endpoint passes attacker-controlled extras.sam_model through rembg/commands/s_command.py to rembg/sessions/sam.py, where it is interpolated into SAM filenames and GitHub download URLs passed to pooch.retrieve() without a pinned hash. An unauthenticated attacker can supply a sam_model value combining path traversal with URL fragment syntax to exploit the HTTP request discarding the fragment while the local POSIX path retains it. The first request primes the attacker-selected path tree, and an identical repeated request downloads malicious ONNX encoder and decoder files beside a readable target file. The graphs can load the target through ONNX external data and encode its bytes into the returned PNG mask, disclosing complete files accessible to the rembg process and allowing arbitrary ONNX computation. This issue is fixed in version 2.0.82.
Title Rembg: Unauthenticated SAM model injection permits local-file disclosure through malicious ONNX graphs
Weaknesses CWE-22
References
Metrics cvssV3_1

{'score': 8.6, 'vector': 'CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:L/A:L'}

Weaknesses
  • CWE-22

    Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')

Sources

Status
PUBLISHED
Assigner
GitHub_M
Published
Updated
Oct 31, 2026, 1:44 AM
Reserved
Oct 23, 2026, 8:21 PM
Status
Deferred
Published
Oct 26, 2026, 8:17 PM
Modified
Oct 31, 2026, 2:17 AM