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·13 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

•1 day ago•CVE-2026-9354
6.9

CVE-2026-9354: Arbitrary Mass Mention Bypass in NousResearch hermes-agent Slack and Mattermost Adapters

A vulnerability in the Slack and Mattermost platform adapters for NousResearch hermes-agent permits an unauthenticated remote attacker to execute arbitrary mass mentions. By leveraging prompt injection, an attacker can bypass output sanitization logic and trigger workspace-wide notification exhaustion.

Alon Barad
Alon Barad
21 views•6 min read
•1 day ago•CVE-2026-9306
6.3

CVE-2026-9306: Unauthenticated Insecure Direct Object Reference (IDOR) in QuantumNous new-api Midjourney Relay

CVE-2026-9306 is a critical unauthenticated Insecure Direct Object Reference (IDOR) vulnerability located in the QuantumNous new-api application, affecting versions up to and including 0.12.1. The flaw is caused by improper middleware ordering combined with a lack of object-level authorization checks. This allows remote, unauthenticated attackers to retrieve sensitive Midjourney images belonging to other users by supplying a valid task identifier.

Amit Schendel
Amit Schendel
7 views•5 min read
•2 days ago•GHSA-GGXF-37HM-9WQF
6.5

GHSA-GGXF-37HM-9WQF: Session Leakage via Unsafe Challenge Path Parsing in instagrapi

The instagrapi library prior to version 2.6.9 contains an improper input validation vulnerability within its challenge handling mechanism. Maliciously crafted server responses can manipulate the client into forwarding session cookies and credentials to an external attacker-controlled domain.

Amit Schendel
Amit Schendel
7 views•6 min read
•3 days ago•GHSA-QQQM-5547-774X
9.1

GHSA-QQQM-5547-774X: Unauthenticated Path Traversal in FileBrowser Quantum PATCH Handler

GHSA-QQQM-5547-774X is a critical path traversal vulnerability in the FileBrowser Quantum application, specifically within the Go backend package. The vulnerability resides in the HTTP handler responsible for processing bulk file modifications via the public API. Unauthenticated attackers can exploit an order-of-operations flaw in the path sanitization logic to bypass intended directory restrictions. This allows adversaries to arbitrarily read, move, and overwrite files on the underlying filesystem by supplying specially crafted HTTP PATCH requests.

Alon Barad
Alon Barad
4 views•6 min read
•3 days ago•CVE-2026-8723
5.3

CVE-2026-8723: Synchronous Denial of Service in qs npm Package via TypeError

The qs query string parsing and serialization library for Node.js is vulnerable to a synchronous Denial of Service (DoS) attack. The vulnerability manifests as a process-terminating TypeError when processing arrays with null or undefined elements under specific configuration parameters.

Amit Schendel
Amit Schendel
19 views•7 min read
•3 days ago•GHSA-7M8F-HGJQ-8GC9
7.5

GHSA-7M8F-HGJQ-8GC9: Pre-Authentication Denial of Service via Insecure Deserialization Order in aiosend

The aiosend library prior to version 3.0.6 contains a pre-authentication Denial of Service (DoS) vulnerability in its webhook handling mechanism. The software processes and deserializes incoming JSON payloads before verifying the cryptographic signature, allowing unauthenticated attackers to exhaust server CPU and memory resources by sending large, complex payloads.

Amit Schendel
Amit Schendel
3 views•6 min read