Skip to content

Stored Cross-Site Scripting (XSS) via Markdown Reference Links

Moderate
nodiscc published GHSA-2hgr-63wv-x462 May 23, 2026

Package

Shaarli

Affected versions

<=v0.16.1

Patched versions

>=v0.16.2

Description

Summary

A stored Cross-Site Scripting (XSS) vulnerability exists in the Markdown-to-HTML conversion process used in the Bookmark Description field in Shaarli. An authenticated user can inject a malicious javascript: URI inside a Markdown link. The payload is converted to HTML without proper sanitization and executed when a user clicks the rendered link on the homepage.

Details

The vulnerability originates in the filterProtocols method within BookmarkMarkdownFormatter.php.

This method attempts to sanitize Markdown links by filtering dangerous protocols (such as javascript:) before rendering. It uses the following regular expression: (#]\((.*?)\)#is). This regex is designed to detect inline Markdown links.

However, it fails to detect Markdown reference-style links, Because reference-style links are resolved by the Markdown parser after preprocessing, the filterProtocols method never inspects the actual URL used in these references. As a result, an attacker can supply a javascript: URI inside a reference definition. When the Markdown parser converts this to HTML, it generates a valid <a> tag with a malicious href attribute:

PoC

xss.in.shaarli.-.03.mp4

Steps to reproduce:

  1. Log in to Shaarli.
  2. Add a new link (Shaare).
  3. Set any valid URL.
  4. Set the Description field to:
[Click Me for XSS][1]
[1]: javascript:alert('XSS_MARKDOWN')
  1. Save the bookmark.
  2. Navigate to the homepage.
  3. Click the "Click Me for XSS" link.
  4. Observe that the JavaScript payload executes immediately.

Impact

Impacted Users:

  • Any user viewing bookmarks containing malicious Markdown descriptions
  • Administrators and privileged users are also affected

Potential Consequences:

  • Session hijacking
  • Account takeover
  • CSRF token theft
  • Unauthorized actions performed on behalf of the victim
  • Delivery of additional malicious client-side payloads

Because the vulnerability is stored and requires only a user click, it poses a significant risk in multi-user environments or shared instances.

Severity

Moderate

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Local
Attack complexity
Low
Privileges required
High
User interaction
Required
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
None

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:L/AC:L/PR:H/UI:R/S:U/C:H/I:H/A:N

CVE ID

CVE-2026-48822

Weaknesses

Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')

The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. Learn more on MITRE.

Credits