GHSA-h648-g954-826q: 
Ruby Analyse et atténuation de la vulnérabilité

Summary

The keynav_js paginator decodes the page request parameter (base64url-encoded JSON) into internal pagination state without validation. The @last value taken from the cursor is interpolated without HTML escaping into the info_tag and input_nav_js helpers, so a crafted page parameter containing an HTML string is reflected verbatim into the response — a reflected cross-site scripting vector. No authentication is required: the only gate is a cookie check satisfied by sending no cookie.

Details

Root cause. Pagy::Keyset::Keynav#assign_page (gem/lib/pagy/classes/keyset/keynav.rb) destructures the client-supplied cursor straight into pagination state, with no validation:

storage_key, @page, @last, @prior_cutoff, @page_cutoff = @options[:page]

@options[:page] comes from Pagy::KeynavJsPaginator.paginate (gem/lib/pagy/toolbox/paginators/keynav_js.rb), which base64url/JSON-decodes the request page parameter via Keyset.decode. The only check is an equality test between the request cookie and the first decoded element; sending no pagy cookie together with a null storage key passes it. Nothing constrains @last to an integer. @last is then interpolated without escaping into:

  • info_tag — Page #{@page} of #{@last} (gem/lib/pagy/toolbox/helpers/info_tag.rb)
  • input_nav_js — max="#{@last}" and the label text (gem/lib/pagy/toolbox/helpers/input_nav_js.rb) A string @last such as "><img src=x onerror=...> is emitted into the HTML response unescaped and runs in the victim's browser. Precondition / reachability. The page must render info_tag or input_nav_js and must not render series_nav/series_nav_js before them: those raise on a string @last (comparison of Integer with String), so a page containing them fails closed with a 500 before reaching the vulnerable helpers. The bundled keynav.ru demo renders series_nav first and is therefore not exploitable; an app showing only an info line and/or the input nav is.

Proof of concept

Verified with Docker (Ruby 3.4, real ActiveRecord + SQLite) over HTTP against an app rendering only info_tag + input_nav_js on a keynav page.

  1. The decoded cursor array is [cookie_match, storage_key, @page, @last, @prior_cutoff, @page_cutoff]; sending no cookie makes cookie_match = null pass the check. Encode with Pagy::B64.urlsafe_encode(array.to_json).
  2. Keyset [animal, name, birthdate, id]. Cursor (the page_cutoff is required so pagination does not raise before rendering):
[null, null, 2, "\"><img src=x onerror=alert(document.domain)>", null, ["zzzzzz","zzzzzz","1900-01-01",999999999]]
  1. Request GET /?page=<encoded>. The HTTP 200 response body contains the raw markup, unescaped, in both the info text and the input max attribute:
Page 2 of "><img src=x onerror=alert(document.domain)>

Opening this URL in a browser executes the injected script.

Impact

Applications paginating with pagy(:keynav_js, ...) that render info_tag or input_nav_js on the keynav page without rendering series_nav/series_nav_js first. An attacker who gets a victim to open a crafted link executes arbitrary script in the victim's session on the application's origin. CWE-79 (Improper Neutralization of Input During Web Page Generation). CVSS v3.1 AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N = 6.1 (Moderate). A related denial-of-service issue with the same root cause (unvalidated keynav cursor) is reported in a separate advisory.

Patches

Fixed in 43.8.3. The decoded page array is validated: page and last must be integers, with page between 1 and last, and each cutoff must match its position. A malformed array restarts the pagination from page 1, so no client-supplied string reaches info_tag or input_nav_js. The fix was reviewed and verified by @7a6163, who also reported the vulnerability.

Workarounds

Upgrade to 43.8.3 or later. Until then, the only workaround is to replace :keynav_js with another paginator (e.g. :keyset or :countless).


Source: NVD

Connexe Ruby Vulnérabilités :

CVE ID

Gravité

Partition

Technologies

Nom du composant

Exploit CISA KEV

A corrigé

Date de publication

GHSA-v472-jp5g-c53fHIGH7.5
  • Ruby logoRuby
  • pagy
NonOuiNov 18, 2026
CVE-2026-115472MEDIUM6.5
  • Ruby logoRuby
  • doorkeeper
NonOuiNov 17, 2026
GHSA-h648-g954-826qMEDIUM6.1
  • Ruby logoRuby
  • pagy
NonOuiNov 18, 2026
GHSA-w5jj-r577-97mqMEDIUM5.3
  • Ruby logoRuby
  • faye
NonOuiNov 17, 2026
GHSA-wqwf-8p4q-mwqjHIGHN/A
  • Ruby logoRuby
  • graphql
NonOuiNov 17, 2026

Évaluation gratuite des vulnérabilités

Évaluez votre posture de sécurité cloud

Évaluez vos pratiques de sécurité cloud dans 9 domaines de sécurité afin d’évaluer votre niveau de risque et d’identifier les lacunes dans vos défenses.

Évaluation de la demande

Ressources Wiz supplémentaires

Obtenez une démo personnalisée

Prêt(e) à voir Wiz en action ?

"La meilleure expérience utilisateur que j’ai jamais vue, offre une visibilité totale sur les workloads cloud."
David EstlickRSSI
"Wiz fournit une interface unique pour voir ce qui se passe dans nos environnements cloud."
Adam FletcherChef du service de sécurité
"Nous savons que si Wiz identifie quelque chose comme critique, c’est qu’il l’est réellement."
Greg PoniatowskiResponsable de la gestion des menaces et des vulnérabilités