/

CVE-2026-97641

Severity:

HIGH RISK

(7.2)

Stored XSS (CWE-79) in Relevanssi WordPress Plugin

CVE-2026-97641

Deferred

Vulnerability type

Category:

Stored Cross-Site Scripting

CWE:

CWE-79

Impact:

Arbitrary script execution in a victim's browser

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

The Relevanssi – A Better Search WordPress plugin contains a stored cross-site scripting vulnerability caused by insufficient sanitization of comment content and inadequate output escaping. Unauthenticated attackers may inject scripts that execute when a user visits an affected page, but exploitation generally requires a non-empty "Allowable tags in excerpts" setting with a matching prefix condition.

Affected context

The issue occurs in WordPress installations using the Relevanssi search plugin when comment content is incorporated into rendered excerpts without sufficient sanitization or escaping. Exploitability depends on the "Allowable tags in excerpts" setting being non-empty, such as a configuration containing HTML tag names that can satisfy the plugin's prefix-matching behavior.

Exploit preconditions

  • Attack surface: Comment content processed by Relevanssi and displayed in a rendered page
  • Required access: No authenticated account is generally required to submit the relevant comment content, subject to the site's comment settings
  • Trigger point: A visitor or administrator views a page containing the affected excerpt
  • Configuration condition: The "Allowable tags in excerpts" setting contains a non-empty value with a tag name that matches the required prefix condition
  • Why exploitation is possible: Attacker-controlled content can reach the output without adequate context-aware escaping

Why this happens

The vulnerability results from treating comment-derived content as trusted markup during excerpt generation and rendering. Insufficient input sanitization combined with missing or incomplete output encoding allows attacker-controlled HTML or script-capable content to be stored and later interpreted by a browser. This behavior maps to CWE-79: Improper Neutralization of Input During Web Page Generation, commonly known as stored cross-site scripting.

Potential impact

  • An attacker may execute arbitrary scripts in a visitor's browser
  • Session-related information or page data could be exposed, depending on browser and application controls
  • An attacker could perform actions with the victim's privileges
  • Administrators may be targeted for account compromise or content manipulation
  • Site reputation and visitor trust can be damaged

General mitigation guidance

Mitigation typically focuses on enforcing safe handling of untrusted comment content throughout processing and rendering.

Common defensive patterns include:

  • Apply context-appropriate output escaping at the final rendering boundary
  • Sanitize permitted markup using a strict allowlist rather than prefix-based tag matching
  • Use secure-by-default excerpt settings that do not permit unnecessary HTML
  • Reduce trust in user-submitted comments and review all transformation stages
  • Apply least privilege to WordPress accounts and administrative sessions
  • Use browser security controls such as a restrictive Content Security Policy where practical

How teams detect issues like this

Organizations can look for this class of issue through:

  • Static analysis rules that identify unescaped comment or excerpt data in HTML output
  • Code review signals involving HTML construction, regular-expression-based tag filtering, and inconsistent escaping
  • Tests that render hostile comment content under each allowable-tag configuration
  • Policy enforcement requiring context-aware escaping at template and response boundaries
  • Monitoring for suspicious markup in comments and unexpected script-capable content in generated excerpts
  • Automated security review tools that check WordPress output-escaping and sanitization patterns

Sources

SourceLink
github.comgithub.com/msaari/relevanssi/commit/3dddec3416fbda298e18649127f31557398d10b0
plugins.trac.wordpress.orgplugins.trac.wordpress.org/browser/relevanssi/tags/4.28.3/lib/admin-ajax.php#L492
plugins.trac.wordpress.orgplugins.trac.wordpress.org/browser/relevanssi/tags/4.28.3/lib/excerpts-highlights.php#L216
plugins.trac.wordpress.orgplugins.trac.wordpress.org/browser/relevanssi/tags/4.28.3/lib/excerpts-highlights.php#L421
plugins.trac.wordpress.orgplugins.trac.wordpress.org/browser/relevanssi/tags/4.28.3/lib/excerpts-highlights.php#L883
plugins.trac.wordpress.orgplugins.trac.wordpress.org/browser/relevanssi/tags/4.28.3/lib/indexing.php#L1067
wordfence.comwordfence.com/threat-intel/vulnerabilities/id/47751ff1-2f22-4335-8e75-7ff1b6214426?source=cve

Frequently asked

questions

It may be exploitable through normal comment submission if the site accepts unauthenticated comments and the affected configuration is enabled. A victim must then view a page containing the stored content.

No administrator access is inherently required to submit the content when public comments are permitted. The plugin setting and the site's comment policy determine the practical attack surface.

Treat comment content as untrusted, strictly allowlist any permitted markup, and apply context-aware escaping when generating excerpts and HTML responses.

Use secure-by-default HTML handling, test stored user content across configuration variants, enforce output-escaping policies in code review and CI, and limit administrative exposure to potentially affected pages.

Find out what's already
exploitable in your codebase.