Skip to main content
Vulnerability Database/CVE-2024-25122

CVE-2024-25122: Sidekiq-unique-jobs XSS Vulnerability

CVE-2024-25122 is a cross-site scripting vulnerability in sidekiq-unique-jobs admin web UI that allows attackers to execute malicious code and steal sensitive data. This article covers the technical details, affected versions, and mitigation.

Published:

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

CVE-2024-25122 Overview

CVE-2024-25122 is a reflected Cross-Site Scripting (XSS) vulnerability in sidekiq-unique-jobs, a Ruby gem that prevents simultaneous Sidekiq jobs with identical unique arguments from running concurrently. The flaw resides in the admin web UI, where GET request parameters passed to the /changelogs, /locks, and /expiring_locks endpoints are rendered without proper sanitization. An attacker can craft a malicious link that, when visited by an authenticated administrator, executes arbitrary JavaScript in the victim's browser session. The issue is tracked as [CWE-79] and has been fixed in versions 7.1.33 and 8.0.7.

Critical Impact

Successful exploitation allows attackers to steal cookies, session tokens, and local storage data from the host application that mounts the sidekiq-unique-jobs web UI.

Affected Products

  • mhenrixon/sidekiq-unique-jobs versions prior to 7.1.33 (7.x branch)
  • mhenrixon/sidekiq-unique-jobs versions prior to 8.0.7 (8.x branch)
  • Any Rack/Rails application mounting the sidekiq-unique-jobs admin web UI

Discovery Timeline

  • 2024-02-13 - CVE-2024-25122 published to NVD
  • 2026-06-17 - Last updated in NVD database

Technical Details for CVE-2024-25122

Vulnerability Analysis

The vulnerability exists in lib/sidekiq_unique_jobs/web.rb, which defines the Sinatra-based admin web UI routes. User-supplied query parameters such as filter, count, cursor, and prev_cursor are assigned to instance variables and later rendered into HTML templates without HTML entity encoding. An attacker who tricks an authenticated administrator into clicking a crafted URL can inject JavaScript that executes in the context of the parent application. Because the admin UI is typically mounted within a privileged Rails application, the stolen session material often grants access to sensitive backend functionality.

Root Cause

The root cause is missing output encoding on request-controlled parameters before they are embedded in server-rendered HTML. The three affected endpoints — /changelogs, /locks, and /expiring_locks — accepted raw query string values and passed them directly into views. The patch wraps each parameter in the h() helper, which performs HTML escaping before the values are interpolated into templates.

Attack Vector

Exploitation requires user interaction. An attacker sends a crafted link containing a JavaScript payload in one of the vulnerable parameters to an authorized administrator. When the administrator opens the link while logged into the sidekiq-unique-jobs admin UI, the payload executes in their browser. The scope is Changed because the executed script runs in the context of the host web application, not merely the admin component.

ruby
       end
 
       app.get "/changelogs" do
-        @filter         = params[:filter] || "*"
+        @filter         = h(params[:filter] || "*")
         @filter         = "*" if @filter == ""
-        @count          = (params[:count] || 100).to_i
-        @current_cursor = params[:cursor].to_i
-        @prev_cursor    = params[:prev_cursor].to_i
+        @count          = h(params[:count] || 100).to_i
+        @current_cursor = h(params[:cursor]).to_i
+        @prev_cursor    = h(params[:prev_cursor]).to_i
         @total_size, @next_cursor, @changelogs = changelog.page(
           cursor: @current_cursor,
           pattern: @filter,

Source: GitHub commit ec3afd9 — the fix applies the h() escape helper to all request-controlled parameters.

Detection Methods for CVE-2024-25122

Indicators of Compromise

  • HTTP GET requests to /changelogs, /locks, or /expiring_locks containing <script>, javascript:, or URL-encoded equivalents such as %3Cscript%3E in the filter, count, cursor, or prev_cursor parameters.
  • Referer headers pointing to external domains for requests to the sidekiq-unique-jobs admin UI.
  • Unexpected outbound requests from administrator browsers to attacker-controlled hosts shortly after visiting the admin UI.

Detection Strategies

  • Review web server and reverse proxy access logs for suspicious query string content targeting the three vulnerable endpoints.
  • Deploy a Web Application Firewall (WAF) rule that blocks or alerts on HTML and JavaScript metacharacters in query parameters to the sidekiq-unique-jobs mount path.
  • Enumerate installed Ruby gems across production environments and flag any sidekiq-unique-jobs versions below 7.1.33 or 8.0.7.

Monitoring Recommendations

  • Enable Content Security Policy (CSP) reporting on the host application to surface injected inline scripts.
  • Alert on administrator sessions whose user-agent, IP, or geolocation changes shortly after accessing the admin UI, which may indicate session theft.
  • Correlate admin UI access logs with authentication events to identify anomalous access patterns.

How to Mitigate CVE-2024-25122

Immediate Actions Required

  • Upgrade sidekiq-unique-jobs to version 7.1.33 or 8.0.7 immediately using bundle update sidekiq-unique-jobs.
  • Restrict access to the admin web UI to trusted networks or require strong authentication and multi-factor authentication (MFA) at the host application layer.
  • Rotate any administrator session cookies or API tokens that may have been exposed before the upgrade.

Patch Information

The fix is delivered in commit ec3afd9 and documented in GitHub Security Advisory GHSA-cmh9-rx85-xj38. The patch sanitizes the filter, count, cursor, and prev_cursor parameters with Sinatra's h() HTML escape helper across the /changelogs, /locks, and /expiring_locks routes. Upgrade to 7.1.33 (7.x branch) or 8.0.7 (8.x branch).

Workarounds

  • No official workarounds exist per the vendor advisory; upgrading is required.
  • As an interim compensating control, unmount the sidekiq-unique-jobs admin web UI from the host application until the gem can be upgraded.
  • Deploy a WAF rule or reverse proxy filter to reject requests containing HTML control characters in query parameters to the affected endpoints.
bash
# Upgrade sidekiq-unique-jobs in your Gemfile
# For the 8.x branch:
bundle update sidekiq-unique-jobs --conservative

# Verify the installed version is patched
bundle list | grep sidekiq-unique-jobs
# Expected: sidekiq-unique-jobs (>= 7.1.33, < 8.0.0) or (>= 8.0.7)

# Optional: temporarily unmount the admin UI in config/routes.rb
# Comment out the mount line, for example:
# mount SidekiqUniqueJobs::Web, at: "/sidekiq_unique_jobs"

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.