---
id: "CVE-2026-115924"
kind: "vulnerability"
aliases: ["CVE-2026-115924"]
title: "Rembg: unauthenticated sam_model injection reads server files and runs ONNX code"
severity: "high"
cvss: 8.6
epss: null
exploited: false
status: "open"
category: "package"
products: []
ecosystems: []
tags: ["package", "python", "rembg", "self-hosted"]
not_affected_if: ["auth-required", "default-config"]
published_at: "2026-10-26T20:17:52+00:00"
first_seen_at: "2026-10-26T20:50:17+00:00"
updated_at: "2026-10-26T20:51:37+00:00"
sources: [{"source": "nvd", "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-115924", "first_seen_at": "2026-10-26T20:50:17+00:00"}]
---

# Rembg: unauthenticated sam_model injection reads server files and runs ONNX code

Rembg, a Python tool that removes image backgrounds, passed an attacker-controlled sam_model value from its public /api/remove endpoint into SAM model filenames and download URLs without pinning hashes. A remote, unauthenticated attacker can make the server download malicious ONNX models and read complete files the rembg process can access, returning their bytes in the PNG mask.

_Summary, check and fix written by a model from the sources; labelled as such._

## How to check

- Run `pip show rembg` and compare the version with `2.0.82`
- Check whether the service exposes the /api/remove endpoint to untrusted networks (unknown if the sources list the exact deployment setup)

## Fix

- Upgrade rembg to `2.0.82` or later
- Until upgraded, block or restrict access to the /api/remove endpoint

## Timeline

- 2026-10-26T20:50:17+00:00 nvd https://nvd.nist.gov/vuln/detail/CVE-2026-115924

## From the sources

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.

---

_Free to read at a human pace. An API with keys and an MCP server are in preparation; early access: hello@infrastack.ai_
