CVEReports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Sitemap
  • RSS Feed

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Made with love by Amit Schendel & Alon Barad



GHSA-55V6-G8PM-PW4C

GHSA-55V6-G8PM-PW4C: Server-Side Request Forgery and CORS Misconfiguration in rembg API

Amit Schendel
Amit Schendel
Senior Security Researcher

Apr 11, 2026·5 min read·21 visits

Executive Summary (TL;DR)

Unvalidated URL parameters in rembg's API enable SSRF attacks against internal network resources, compounded by a permissive CORS configuration that allows credentialed cross-origin requests.

The rembg library's API server component contains a Server-Side Request Forgery (SSRF) vulnerability and a permissive Cross-Origin Resource Sharing (CORS) misconfiguration. These flaws allow attackers to probe internal networks and perform unauthorized cross-origin requests.

Vulnerability Overview

The rembg package provides a utility for removing backgrounds from images. When executed as a server, it exposes an HTTP API endpoint at /api/remove designed to process remote images via a url parameter. This endpoint suffers from a Server-Side Request Forgery (SSRF) vulnerability tracked as CVE-2025-25301.

Simultaneously, the API implements a flawed Cross-Origin Resource Sharing (CORS) configuration, tracked as CVE-2025-25302. The application utilizes the FastAPI CORSMiddleware configured to allow all origins while simultaneously permitting credentials. This violates security standards regarding cross-origin communication.

These vulnerabilities allow an external attacker to interact with the server in unintended ways. An attacker can supply internal network destinations to the SSRF endpoint, forcing the server to issue HTTP requests to internal subnets. The CORS misconfiguration expands the attack surface by enabling cross-site exploitation vectors.

Root Cause Analysis

The SSRF vulnerability originates in the routing logic for the /api/remove endpoint. The application accepts a user-provided string via the url parameter and passes it directly into an asynchronous HTTP client operation. The system instantiates an aiohttp.ClientSession and performs a GET request without verifying the scheme, hostname, or resolved IP address.

Because the underlying aiohttp client executes the request exactly as provided, it treats internal IP addresses and loopback interfaces as valid destinations. The application subsequently reads the HTTP response and feeds it into the background removal processing pipeline. This creates a direct conduit for an attacker to issue requests from the context of the server.

For the CORS vulnerability, the root cause is a misconfigured middleware definition. The application defines allow_origins=["*"] alongside allow_credentials=True. Modern browsers typically block this exact combination to prevent malicious origins from reading credentialed cross-origin responses, but older or improperly configured environments may still evaluate it, and it clearly indicates an overly permissive security posture.

Code Analysis

Prior to version 2.0.75, the rembg command handler blindly requested user-provided URLs. The get_index asynchronous function extracted the query parameter and invoked session.get(url). The following snippet illustrates the vulnerable implementation.

# Vulnerable implementation in rembg/commands/s_command.py
async def get_index(
    url: str = Query(default=..., description="URL of the image..."),
    commons: CommonQueryParams = Depends(),
):
    async with aiohttp.ClientSession() as session:
        async with session.get(url) as response:
            file = await response.read()
            return await asyncify(im_without_bg)(file, commons)

The maintainers addressed these issues in commit 07ad0d493057bddf821dcc3e2410eb7e065257c0. The patch modifies the CORSMiddleware configuration by setting allow_credentials=False. It also introduces URL validation logic to mitigate the SSRF, implementing _validate_url and _is_private_ip functions.

# Patch implementation restricting cross-origin requests
app.add_middleware(
    CORSMiddleware,
    allow_credentials=False,  # Patched from True
    allow_origins=["*"],
    allow_methods=["*"],
    allow_headers=["*"],
)

The SSRF patch ensures the URL scheme is strictly HTTP or HTTPS and attempts to resolve the provided hostname. The resolved addresses are checked against reserved ranges using the Python ipaddress module. If a private or loopback IP is detected, the server rejects the request before establishing the aiohttp connection.

Exploitation and Bypass Techniques

An attacker exploits the SSRF by identifying a target instance of the rembg server and sending an HTTP GET request to /api/remove with a crafted url parameter. A common payload targets the cloud provider metadata service. For example, submitting url=http://169.254.169.254/latest/meta-data/ forces the server to fetch its own cloud environment credentials.

Security researchers identified structural weaknesses in the provided patch for version 2.0.75. The _validate_url function performs DNS resolution via socket.getaddrinfo to check for private IPs. However, the subsequent aiohttp.ClientSession.get() call performs its own independent DNS resolution. This architecture creates a Time-of-Check to Time-of-Use (TOCTOU) vulnerability.

An attacker can execute a DNS Rebinding attack by hosting a custom DNS server. During the validation phase, the DNS server returns a benign public IP address. Milliseconds later, when aiohttp resolves the domain for the actual request, the DNS server returns a private internal IP address, bypassing the patch entirely. Additionally, because aiohttp follows redirects by default, an attacker can supply an external URL that redirects to an internal IP, evading the initial validation check.

Impact Assessment

The successful exploitation of CVE-2025-25301 grants unauthorized network visibility from the perspective of the application server. Attackers map internal subnets, discover administrative interfaces, and interact with microservices that lack authentication boundaries. This lateral movement capability compromises network isolation models.

If the server processes the fetched payload and reflects portions of the data back to the client, the vulnerability escalates to data exfiltration. Attackers retrieve sensitive configuration files, internal API responses, or cloud IAM tokens. The severity of the information disclosure depends heavily on the deployment environment and the exact behavior of the image processing routine.

The inclusion of CVE-2025-25302 compounds the risk profile. The permissive CORS implementation allows any malicious webpage visited by a victim to silently issue requests to the rembg server. If the target deployment relies on session cookies or intranet-based IP authentication, attackers leverage the victim's browser to pivot into the application.

Remediation and Mitigation

System administrators must upgrade rembg to version 2.0.75 or later. This release enforces a restrictive CORS policy and provides baseline protection against trivial SSRF payloads. Upgrading is the primary administrative action required to resolve the publicly disclosed advisory.

Due to the known bypasses involving DNS rebinding and HTTP redirects, upgrading the software is insufficient for complete protection. Organizations must deploy the rembg API server within an isolated network environment. Implement egress firewall rules that explicitly deny outbound connections to internal subnets, loopback addresses, and cloud metadata IP ranges.

Security teams should configure Web Application Firewalls (WAF) to inspect the url query parameter on the /api/remove endpoint. Create rules to drop requests containing local network identifiers, obvious metadata IP addresses, or excessively short TTL domains commonly associated with DNS rebinding frameworks.

Official Patches

danielgatisFix commit implementing URL validation and secure CORS settings.

Fix Analysis (1)

Technical Appendix

CVSS Score
7.5/ 10
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N
EPSS Probability
0.04%

Affected Systems

rembg HTTP API Server

Affected Versions Detail

Product
Affected Versions
Fixed Version
rembg
danielgatis
<= 2.0.572.0.75
AttributeDetail
CWE IDCWE-918
Attack VectorNetwork
CVSS v3.1 Score7.5 (High)
EPSS Score0.00037
Exploit StatusProof-of-Concept
CISA KEVNot Listed

MITRE ATT&CK Mapping

T1190Exploit Public-Facing Application
Initial Access
T1005Data from Local System
Collection
CWE-918
Server-Side Request Forgery (SSRF)

The application fails to properly validate the destination of HTTP requests it makes on behalf of users.

Vulnerability Timeline

Vulnerability reported via Private Vulnerability Reporting.
2024-07-17
Maintainer acknowledged the report.
2024-10-29
Public disclosure of GHSL-2024-161 and GHSL-2024-162.
2025-02-27
Official CVEs assigned and published.
2025-03-03
Version v2.0.75 released with security fixes.
2025-04-08

References & Sources

  • [1]GitHub Advisory: GHSA-55V6-G8PM-PW4C
  • [2]GitHub Security Lab Advisory: GHSL-2024-161 and GHSL-2024-162
  • [3]NVD Detail: CVE-2025-25301
Related Vulnerabilities
CVE-2025-25301CVE-2025-25302

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.

More Reports

•about 2 hours ago•CVE-2026-53766
6.1

CVE-2026-53766: Workspace Boundary Bypass in chrome-devtools-mcp via Symbolic Link Resolution Failure

A workspace boundary bypass vulnerability exists in the Chrome DevTools for Agents (chrome-devtools-mcp) Model Context Protocol (MCP) server from version 0.24.0 up to 1.1.0. The vulnerability allows an agent or malicious workspace containing symbolic links to read or modify arbitrary files outside the configured project workspace root directory. This occurs because the path validation function resolves paths lexically rather than physically.

Alon Barad
Alon Barad
1 views•7 min read
•about 3 hours ago•CVE-2026-56677
8.6

CVE-2026-56677: Unauthenticated Server-Side Request Forgery in 9Router OIDC Test Endpoint

A high-severity security vulnerability exists in 9Router, an AI router and token saver dashboard. When dashboard authentication features are disabled or left in default configurations, the application exposes administrative testing routines directly to the public internet. Unauthenticated network adversaries can exploit the OIDC configuration validation endpoint to initiate arbitrary HTTP requests, routing unauthorized traffic to local loops, adjacent container ports, and cloud resource metadata interfaces.

Amit Schendel
Amit Schendel
2 views•5 min read
•about 4 hours ago•CVE-2026-64849
9.3

CVE-2026-64849: Server-Side Request Forgery (SSRF) in MLflow Webhooks via DNS Rebinding

CVE-2026-64849 is a critical Server-Side Request Forgery (SSRF) vulnerability affecting MLflow tracking servers prior to version 3.15.0. It allows unauthenticated remote attackers to bypass outbound request destination filters using DNS rebinding or HTTP redirects. This exposure risks compromising sensitive cloud infrastructure metadata and internal microservices.

Alon Barad
Alon Barad
3 views•5 min read
•about 5 hours ago•CVE-2026-69146
6.5

CVE-2026-69146: Missing Authorization Bypass in MLflow Basic Authentication Middleware

This technical report details a missing authorization vulnerability (CVE-2026-69146 / GHSA-3p64-6gvh-82v5) affecting the MLflow platform from version 3.13.0 to 3.15.0. When MLflow is configured with the built-in basic-auth plugin, authenticated users can bypass run-level UPDATE authorization checks, enabling unauthorized dataset and model lineage metadata injection.

Alon Barad
Alon Barad
2 views•7 min read
•about 6 hours ago•CVE-2026-69148
7.1

CVE-2026-69148: Broken Object Level Authorization (BOLA) in MLflow Model Registry

MLflow prior to version 3.15.0 fails to perform proper authorization checks when registering model versions, allowing authenticated users with access to a registered model to link and access artifacts from runs and models belonging to other users without authorization.

Amit Schendel
Amit Schendel
5 views•7 min read
•about 7 hours ago•CVE-2026-59893
7.5

CVE-2026-59893: Regular Expression Denial of Service in sqlparse Lexer

A high-severity Regular Expression Denial of Service (ReDoS) vulnerability in the sqlparse Python library prior to version 0.6.0 allows unauthenticated remote attackers to trigger CPU exhaustion and application denial of service via crafted SQL inputs containing unmatched dollar-quoted literals or unclosed multiline comments.

Alon Barad
Alon Barad
6 views•6 min read