Intel

AIKIDO-2026-608584

rembg is vulnerable to Path Traversal

Path TraversalGHSA-qr6x-7v33-6qmg Published 4 days ago

86

High Risk

This Affects:

PYTHONrembg
2.0.52 - 2.0.81
Fixed in 2.0.82
Are you affected? Scan for Free

TL;DR

The SAM background-removal session reads the sam_model value from the public extras payload of the /api/remove endpoint and interpolates it directly into GitHub download URLs and local model filenames without validation. Because an HTTP client drops a URL #fragment while the local POSIX path keeps it, a crafted value such as sam_vit_b_01ec64#/../../../evil fetches the legitimate asset but writes it outside the model directory. An unauthenticated request can place a malicious ONNX graph next to a target file; the graph then reads that file as external tensor data and encodes its bytes into the returned mask, disclosing arbitrary files readable by the rembg process. The fix rejects any sam_model outside the three published SAM checkpoints before it reaches a path or URL and pins md5 digests for every SAM asset.

Who does this affect?

You are affected if you are using a version that falls within the vulnerable range and you run the rembg HTTP server, whose unauthenticated /api/remove endpoint accepts a user controlled sam_model value.

Background info

rembg is vulnerable to Path Traversal in versions 2.0.52 - 2.0.81.

How to fix this

Upgrade the rembg library to the patch version.

Are You Affected?

Connect your repositories to instantly see whether vulnerable or malicious packages exist in your codebase.

Free. No credit card required.

Aikido Platform