GHSA-55V6-G8PM-PW4C

GHSA-55V6-G8PM-PW4C is a medium-severity server-side request forgery (SSRF) vulnerability in rembg (pip), affecting versions < 2.0.75. It is fixed in 2.0.75.

Summary

GitHub Security Lab (GHSL) Vulnerability Report, rembg: GHSL-2024-161, GHSL-2024-162

The GitHub Security Lab team has identified potential security vulnerabilities in rembg.

We are committed to working with you to help resolve these issues. In this report you will find everything you need to effectively coordinate a resolution of these issues with the GHSL team.

If at any point you have concerns or questions about this process, please do not hesitate to reach out to us at [email protected] (please include GHSL-2024-161 or GHSL-2024-162 as a reference). See also this blog post written by GitHub's Advisory Curation team which explains what CVEs and advisories are, why they are important to track vulnerabilities and keep downstream users informed, the CVE assigning process, and how they are used to keep open source software secure.

If you are NOT the correct point of contact for this report, please let us know!

rembg server is vulnerable to Server-Side Request Forgery (SSRF) and a weak default CORS configuration, which may allow an attacker website to send requests to servers on the internal network and view image responses.

Project

rembg

Tested Version

v2.0.57

Details

Issue 1: SSRF via /api/remove (GHSL-2024-161)

The /api/remove endpoint takes a URL query parameter that allows an image to be fetched, processed and returned. An attacker may be able to query this endpoint to view pictures hosted on the internal network of the rembg server.

 async def get_index(
        url: str = Query(
            default=..., description="URL of the image that has to be processed."
        ),
        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)

Proof of Concept

curl -s "http://localhost:7000/api/remove?url=http://0.0.0.0/secret.png" -o output.png

Issue 2: CORS misconfiguration (GHSL-2024-162)

The following CORS middleware is setup incorrectly. All origins are reflected, which allows any website to send cross site requests to the rembg server and thus query any API. Even if authentication were to be enabled, allow_credentials is set to True, which would allow any website to send authenticated cross site requests.

    app.add_middleware(
        CORSMiddleware,
        allow_credentials=True,
        allow_origins=["*"],
        allow_methods=["*"],
        allow_headers=["*"],
    )

Impact

This issue may increase the severity of other vulnerabilities.

Remediation

Create an allowlist of specific endpoints that can send cross site requests to the rembg server.

Proof of Concept

An attacker website can host the following code:

const response = await fetch("http://localhost:7000/api/remove?url=https://0.0.0.0/secret.jpg");

If a victim running rembg server were to access the attacker website, the attacker website could read the file secret.jpg from the server hosted on the victim's internal network.

GitHub Security Advisories

We recommend you create a private GitHub Security Advisory for these findings. This also allows you to invite the GHSL team to collaborate and further discuss these findings in private before they are published.

Credit

These issues were discovered and reported by GHSL team member @Kwstubbs (Kevin Stubbings).

Contact

You can contact the GHSL team at [email protected], please include a reference to GHSL-2024-161 or GHSL-2024-162 in any communication regarding these issues.

Disclosure Policy

This report is subject to a 90-day disclosure deadline, as described in more detail in our coordinated disclosure policy.

Impact

This issue may lead to Information Disclosure.

Untrusted input controls the target URL of a server-initiated request, which may reach internal services not otherwise accessible from outside. Typical impact: access to internal metadata services, internal APIs, or cloud credentials.

GHSA-55V6-G8PM-PW4C has a CVSS score of 4.3 (Medium). The vector is network-reachable, no privileges required, and user interaction required. A CVSS score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether this affects your application depends on whether the vulnerable code is present and reachable in your environment. A fixed version is available (2.0.75); upgrading removes the vulnerable code path.

Affected versions

rembg (< 2.0.75)

Security releases

rembg → 2.0.75 (pip)

Kodem intelligence

Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.

Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.

See it in your environment

Remediation advice

Ensure that the IP address specified is not a local address. If resolving a domain name, ensure that the resolved IP address is not local.

Frequently Asked Questions

  1. What is GHSA-55V6-G8PM-PW4C? GHSA-55V6-G8PM-PW4C is a medium-severity server-side request forgery (SSRF) vulnerability in rembg (pip), affecting versions < 2.0.75. It is fixed in 2.0.75. Untrusted input controls the target URL of a server-initiated request, which may reach internal services not otherwise accessible from outside.
  2. How severe is GHSA-55V6-G8PM-PW4C? GHSA-55V6-G8PM-PW4C has a CVSS score of 4.3 (Medium). This score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether it represents real risk in your environment depends on whether the vulnerable code is present and reachable.
  3. Which versions of rembg are affected by GHSA-55V6-G8PM-PW4C? rembg (pip) versions < 2.0.75 is affected.
  4. Is there a fix for GHSA-55V6-G8PM-PW4C? Yes. GHSA-55V6-G8PM-PW4C is fixed in 2.0.75. Upgrade to this version or later.
  5. Is GHSA-55V6-G8PM-PW4C exploitable, and should I be worried? Whether GHSA-55V6-G8PM-PW4C is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
  6. What actually determines whether GHSA-55V6-G8PM-PW4C is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
  7. How do I fix GHSA-55V6-G8PM-PW4C? Upgrade rembg to 2.0.75 or later.

Other vulnerabilities in rembg

Stop the waste.
Protect your environment with Kodem.