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

•1 day ago•CVE-2026-63462
7.5

CVE-2026-63462: Unauthenticated Stack Overflow Denial of Service in Unleash Server

An unauthenticated remote denial of service vulnerability exists in the Unleash feature management platform. By submitting a crafted JSON payload containing deeply nested structures to an OpenAPI-validated endpoint, an attacker can trigger uncontrolled recursion within the error formatting module. This leads to a call-stack exhaustion (RangeError: Maximum call stack size exceeded) inside the Node.js runtime, causing the service to crash immediately without recovery.

Alon Barad
Alon Barad
11 views•6 min read
•1 day ago•CVE-2026-63004
5.5

CVE-2026-63004: Server-Side Request Forgery in Unleash Addon and Integration Subsystem

CVE-2026-63004 is a server-side request forgery (SSRF) vulnerability in the Unleash feature management platform. Authenticated administrators with CREATE_ADDON or UPDATE_ADDON privileges can exploit this vulnerability to initiate requests to loopback addresses, private networks, and cloud metadata endpoints, potentially leading to information disclosure and credential extraction.

Amit Schendel
Amit Schendel
8 views•8 min read
•1 day ago•CVE-2026-63466
4.1

CVE-2026-63466: Process-Wide Security Degradation via Global Module Mutation in Unleash

Prior to version 8.0.3, Unleash's Markdown event formatter directly mutated the global template-escaping function of the shared mustache Node.js module, resulting in a process-wide security degradation where HTML/Markdown escaping was permanently disabled for the application lifetime.

Alon Barad
Alon Barad
3 views•6 min read
•2 days ago•CVE-2026-76904
9.8

CVE-2026-76904: Unauthenticated SQL Injection in GeoTools PostGIS DataStore Component

A critical SQL injection vulnerability exists in the GeoTools open-source Java library. This vulnerability is situated within the post-processing phase of OGC Filter conversion inside the PostGIS DataStore module. Specifically, the `jsonArrayContains` function does not validate or sanitize its arguments before constructing PostgreSQL SQL/JSON path evaluation queries. An unauthenticated remote attacker can exploit this weakness by submitting crafted filters via standard OGC services like WFS or WMS to execute arbitrary SQL commands on the underlying database system.

Alon Barad
Alon Barad
13 views•5 min read
•2 days ago•CVE-2026-61824
8.2

CVE-2026-61824: High-Severity Cross-Site Scripting (XSS) via Unsanitized Site Extractors in Defuddle

CVE-2026-61824 is a high-severity Cross-Site Scripting (XSS) vulnerability in kepano/defuddle before version 0.19.1. Custom site extractors for platforms such as X/Twitter, Substack, and YouTube constructed HTML representations via template string interpolation without output escaping. This allowed malicious pages to bypass standard parser sanitization routines and execute arbitrary JavaScript.

Amit Schendel
Amit Schendel
6 views•7 min read
•2 days ago•CVE-2026-63421
7.5

CVE-2026-63421: Query Limit Bypass via Negative Integer Input in KeystoneJS core resolvers

A high-severity vulnerability exists in KeystoneJS, a popular Node.js CMS and GraphQL framework, where the query resolution engine fails to validate signed negative integers within the pagination subsystem. Unauthenticated remote attackers can leverage this flaw to bypass the 'graphql.maxTake' safety boundary. By sending large negative values in the 'take' query parameter, the underlying Prisma ORM interprets the value as an instruction to fetch rows from the end of the collection, allowing malicious actors to bypass pagination limits, trigger database resource exhaustion, and execute application-level Denial of Service (DoS) attacks.

Alon Barad
Alon Barad
8 views•6 min read