Summary
The H5PxAPIkatchu WordPress plugin has a stored cross-site scripting vulnerability in its xapi parameter because input is not sufficiently sanitized and output is not properly escaped. An unauthenticated attacker may inject scripts that run when users view an affected page; the nonce needed to access the insert endpoint is exposed on pages displaying H5P content.
Affected context
The issue affects the plugin's handling of the xapi parameter in versions up to and including 0.4.24. Risk arises when an attacker can reach the insert endpoint and submit content that is stored and later rendered without context-appropriate output escaping. The endpoint nonce is publicly available through the listener.js script URL on pages displaying H5P content, so it does not prevent anonymous access to that endpoint.
Exploit preconditions
- Attack surface: The plugin's unauthenticated insert endpoint, which processes the
xapiparameter - Required access: No authenticated account is required; the endpoint nonce is exposed on pages displaying H5P content
- Trigger point: A user views a page where attacker-supplied content is stored and rendered
- Why exploitation is possible: Insufficient input sanitization and output escaping allow injected script content to execute in a visitor's browser
Why this happens
The plugin accepts input through the xapi parameter without adequate sanitization and later renders it without sufficient output escaping. This is a stored cross-site scripting flaw mapped to CWE-79: Improper Neutralization of Input During Web Page Generation. Public exposure of the endpoint nonce also means it should not be treated as an authentication or authorization control.
Potential impact
- Malicious scripts may run in the browser of a user who views an affected page
- Attackers could interact with the page or perform actions in the context of the affected site, subject to the victim's privileges
- Sensitive information accessible to the page may be exposed
- The site's reputation and user trust could be harmed
General mitigation guidance
Defensive patterns focus on treating submitted data as untrusted and preventing it from being interpreted as executable content.
- Apply strict, purpose-specific validation and sanitization to input, using allowlists where appropriate
- Escape output for its exact rendering context, including HTML, attribute, and script contexts
- Prefer safe rendering APIs that encode content by default
- Enforce authorization independently of publicly visible nonces; use nonces as request-integrity controls, not as proof of identity
- Minimize the data and privileges available to code running in users' browsers, and use browser security policies such as Content Security Policy as an additional layer
How teams detect issues like this
- Use static analysis to identify unsanitized request parameters flowing into HTML or script-capable output
- Review endpoint authorization separately from nonce checks, especially for routes intended to be unauthenticated
- Inspect code paths that store user-controlled content and later render it, verifying context-appropriate escaping
- Use security tests and policy checks to flag unsafe output APIs and missing validation at trust boundaries
- Monitor for unexpected script-capable markup in stored plugin content

