Summary
Grav Shortcode Core contains stored cross-site scripting vulnerabilities in the [lorem] tag parameter and [details] summary parameter when their contents are rendered without proper escaping. An attacker with page-edit access may store arbitrary HTML or JavaScript that executes in the browsers of page visitors, including administrators.
Affected context
The issue occurs in Grav sites using Shortcode Core where page authors or other users with page-edit permissions can supply values to the affected shortcode parameters. Risk is present when those values are persisted and later included in rendered pages without context-appropriate output encoding, allowing browsers of visitors to interpret attacker-controlled markup or scripts.
Exploit preconditions
- Attack surface: Publicly rendered Grav pages containing affected shortcodes
- Required access: Permission to create or edit pages or otherwise control shortcode parameter values
- Trigger point: A visitor loads a page containing the stored
[lorem]or[details]content - Why exploitation is possible: Parameter content is stored and rendered without sufficient escaping, causing browser-interpreted HTML or JavaScript to execute in the visitor's security context
Why this happens
The vulnerability results from treating user-controlled shortcode parameters as trusted presentation content. When values are written into HTML output without context-aware encoding or a restrictive sanitization policy, browser markup parsing can convert attacker-supplied data into executable script. This is a stored form of CWE-79: Improper Neutralization of Input During Web Page Generation, commonly known as cross-site scripting.
Potential impact
- Malicious scripts may execute in visitors' browsers
- Attacker-controlled code could access data available to the affected session
- Administrator sessions may be targeted for unauthorized actions
- Site content or configuration could be modified through privileged browser sessions
- Visitors could be redirected to fraudulent or malicious content
General mitigation guidance
Mitigation generally focuses on ensuring that shortcode parameters are treated as untrusted data throughout their lifecycle.
Common defensive patterns include:
- Applying context-appropriate output encoding before inserting values into HTML
- Allowing only narrowly defined, safe parameter formats where rich text is unnecessary
- Using a restrictive sanitizer and explicit allowlist when limited markup must be supported
- Separating trusted administrative content from user-supplied shortcode values
- Limiting page-edit permissions according to least privilege
- Protecting session cookies with appropriate browser security attributes and using a strong content security policy where practical
- Applying the same validation and encoding rules to stored content and rendered previews
How teams detect issues like this
Organizations can identify similar issues through:
- Static analysis rules that flag unescaped shortcode or template output
- Code review checks for direct insertion of request, form, or stored content into HTML
- Tests that render each shortcode parameter using representative markup and script-like input
- Dynamic application scans for stored payloads appearing in page responses
- Policy enforcement requiring output encoding or approved sanitization APIs at rendering boundaries
- Review of authorization controls governing page creation and editing
Automated security review tools may help identify unsafe output flows, but findings should be validated against the rendering context and supported markup requirements.

