/

CVE-2026-116522

Severity:

HIGH RISK

(7.2)

Stored XSS (CWE-79) in Relevanssi WordPress Plugin

CVE-2026-116522

Deferred

Vulnerability type

Category:

Stored Cross-Site Scripting

CWE:

CWE-79

Impact:

Client-Side Code Execution and Session-Context Abuse

Severity:

HIGH RISK

(7.2)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

Relevanssi contains a stored cross-site scripting vulnerability in its handling of the comment parameter, allowing unauthenticated attackers to store scripts that execute in visitors' browsers. The issue becomes risky when comment indexing and comment highlighting are enabled and a visitor opens a matching singular-page permalink containing the highlight query parameter.

Relevanssi contains a stored cross-site scripting vulnerability in its handling of the comment parameter, allowing unauthenticated attackers to store scripts that execute in visitors' browsers. The issue becomes risky when comment indexing and comment highlighting are enabled and a visitor opens a matching singular-page permalink containing the highlight query parameter.

Affected context

The vulnerability occurs in WordPress sites using the Relevanssi search plugin when both comment indexing and comment highlighting are enabled. An injected value may be retained and later rendered on a singular page reached through a Relevanssi search-result permalink with the relevant highlight query parameter. The script executes when another user visits the affected page.

The vulnerability occurs in WordPress sites using the Relevanssi search plugin when both comment indexing and comment highlighting are enabled. An injected value may be retained and later rendered on a singular page reached through a Relevanssi search-result permalink with the relevant highlight query parameter. The script executes when another user visits the affected page.

Exploit preconditions

  • Attack surface: Relevanssi search-result and highlighting functionality in a WordPress site
  • Required access: No authentication is required to submit the relevant input
  • Configuration requirement: Comment indexing and comment highlighting must both be enabled
  • Trigger point: A visitor must access an affected singular page through a Relevanssi search-result permalink carrying the highlight query parameter
  • Why exploitation is possible: The comment parameter is insufficiently sanitized and later rendered without adequate context-aware output escaping
  • Attack surface: Relevanssi search-result and highlighting functionality in a WordPress site
  • Required access: No authentication is required to submit the relevant input
  • Configuration requirement: Comment indexing and comment highlighting must both be enabled
  • Trigger point: A visitor must access an affected singular page through a Relevanssi search-result permalink carrying the highlight query parameter
  • Why exploitation is possible: The comment parameter is insufficiently sanitized and later rendered without adequate context-aware output escaping

Why this happens

The underlying bug is insufficient validation or sanitization of user-controlled comment-related input combined with inadequate output encoding. When the value is stored or propagated into a search-result highlighting context, it can be interpreted as browser-executable markup or script rather than displayed as text. This behavior maps to CWE-79: Improper Neutralization of Input During Web Page Generation, commonly known as cross-site scripting.

The underlying bug is insufficient validation or sanitization of user-controlled comment-related input combined with inadequate output encoding. When the value is stored or propagated into a search-result highlighting context, it can be interpreted as browser-executable markup or script rather than displayed as text. This behavior maps to CWE-79: Improper Neutralization of Input During Web Page Generation, commonly known as cross-site scripting.

Potential impact

  • Arbitrary JavaScript may execute in a visitor's browser
  • Attackers could alter visible page content or present deceptive forms
  • Session-context actions may be performed where browser privileges permit
  • Sensitive information accessible to the affected page could be exposed
  • Visitors could be redirected to malicious or phishing content
  • Arbitrary JavaScript may execute in a visitor's browser
  • Attackers could alter visible page content or present deceptive forms
  • Session-context actions may be performed where browser privileges permit
  • Sensitive information accessible to the affected page could be exposed
  • Visitors could be redirected to malicious or phishing content

General mitigation guidance

Mitigation generally focuses on treating comment and search parameters as untrusted data throughout their full lifecycle.

Common defensive patterns include:

  • Applying context-aware output encoding immediately before rendering values in HTML, attributes, URLs, or scripts
  • Using allowlisted input validation and reducing the amount of user-controlled data accepted by highlighting features
  • Ensuring stored values are sanitized according to their intended rendering context rather than relying on generic filtering
  • Disabling comment indexing or comment highlighting when those features are not required
  • Applying restrictive Content Security Policy controls as defense in depth
  • Limiting administrative and editorial privileges to reduce the consequences of stored content abuse

Mitigation generally focuses on treating comment and search parameters as untrusted data throughout their full lifecycle.

Common defensive patterns include:

  • Applying context-aware output encoding immediately before rendering values in HTML, attributes, URLs, or scripts
  • Using allowlisted input validation and reducing the amount of user-controlled data accepted by highlighting features
  • Ensuring stored values are sanitized according to their intended rendering context rather than relying on generic filtering
  • Disabling comment indexing or comment highlighting when those features are not required
  • Applying restrictive Content Security Policy controls as defense in depth
  • Limiting administrative and editorial privileges to reduce the consequences of stored content abuse

How teams detect issues like this

Organizations can identify similar issues through:

  • Static analysis rules for unescaped output of request parameters, comment data, and search-highlight values
  • Code review checks that trace user-controlled input from request handling through storage, transformation, and rendering
  • Tests that verify special characters remain encoded in every output context
  • Dynamic testing of search-result permalinks and highlighting functionality with inert XSS markers
  • Policy enforcement requiring context-specific escaping and security tests for plugin configuration combinations
  • Neutral automated code-review or application-security tools that flag common unsafe output patterns

Organizations can identify similar issues through:

  • Static analysis rules for unescaped output of request parameters, comment data, and search-highlight values
  • Code review checks that trace user-controlled input from request handling through storage, transformation, and rendering
  • Tests that verify special characters remain encoded in every output context
  • Dynamic testing of search-result permalinks and highlighting functionality with inert XSS markers
  • Policy enforcement requiring context-specific escaping and security tests for plugin configuration combinations
  • Neutral automated code-review or application-security tools that flag common unsafe output patterns

Sources

SourceLink
github.comgithub.com/msaari/relevanssi/commit/b0324957b27e2dfc2aa116c96dcf578fbec9e0e5
plugins.trac.wordpress.orgplugins.trac.wordpress.org/browser/relevanssi/tags/4.28.5/lib/common.php#L1037
plugins.trac.wordpress.orgplugins.trac.wordpress.org/browser/relevanssi/tags/4.28.5/lib/excerpts-highlights.php#L1698
plugins.trac.wordpress.orgplugins.trac.wordpress.org/browser/relevanssi/tags/4.28.5/lib/excerpts-highlights.php#L521
plugins.trac.wordpress.orgplugins.trac.wordpress.org/browser/relevanssi/tags/4.28.5/lib/excerpts-highlights.php#L688
plugins.trac.wordpress.orgplugins.trac.wordpress.org/browser/relevanssi/tags/4.28.5/lib/init.php#L140
plugins.trac.wordpress.orgplugins.trac.wordpress.org/changeset?reponame=&new=3767703%40relevanssi%2Ftags%2F4.28.6&old=3761637%40relevanssi%2Ftags%2F4.28.5
wordfence.comwordfence.com/threat-intel/vulnerabilities/id/442403ae-9011-4373-a363-e98e07ec7e9b?source=cve

Frequently asked

questions

Yes. The described attack does not require authentication to submit the relevant input, although the affected plugin options must be enabled and a visitor must follow the triggering search-result permalink.

No. Execution depends on the site configuration and the specific trigger path: a visitor must reach a singular page through a Relevanssi search-result permalink carrying the highlight query parameter.

Treat the parameter as untrusted at every processing stage, apply context-aware output encoding at the final rendering point, and disable unnecessary comment indexing or highlighting functionality.

Use allowlisted input handling, context-specific escaping, security-focused code review, and automated tests covering stored, reflected, and search-result rendering paths.

Yes. The described attack does not require authentication to submit the relevant input, although the affected plugin options must be enabled and a visitor must follow the triggering search-result permalink.

No. Execution depends on the site configuration and the specific trigger path: a visitor must reach a singular page through a Relevanssi search-result permalink carrying the highlight query parameter.

Treat the parameter as untrusted at every processing stage, apply context-aware output encoding at the final rendering point, and disable unnecessary comment indexing or highlighting functionality.

Use allowlisted input handling, context-specific escaping, security-focused code review, and automated tests covering stored, reflected, and search-result rendering paths.

Find out what's already
exploitable in your codebase.