CVE-2019-10842

9.8 CRITICAL

📋 TL;DR

CVE-2019-10842 is a critical backdoor vulnerability in bootstrap-sass 3.2.0.3 that allows unauthenticated remote code execution via a specially crafted cookie. Attackers can exploit this by sending a malicious ___cfduid cookie containing base64-encoded code that gets executed via eval(). This affects any Ruby application using the compromised version downloaded from rubygems.org.

💻 Affected Systems

Products:
  • bootstrap-sass Ruby gem
Versions: Version 3.2.0.3 only (specifically the malicious version uploaded to rubygems.org)
Operating Systems: All operating systems running Ruby applications
Default Config Vulnerable: ⚠️ Yes
Notes: Only affects version 3.2.0.3 downloaded from rubygems.org between March 26-27, 2019. Other versions are not affected. This was a supply chain attack where a malicious version was uploaded to the package repository.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete system compromise allowing attackers to execute arbitrary commands, steal data, install malware, or pivot to other systems.

🟠

Likely Case

Remote code execution leading to data theft, service disruption, or cryptocurrency mining malware installation.

🟢

If Mitigated

Limited impact if proper network segmentation, WAF rules, and input validation are in place.

🌐 Internet-Facing: HIGH - Exploitation requires no authentication and can be performed remotely via HTTP requests.
🏢 Internal Only: MEDIUM - Internal applications could still be exploited if attackers gain internal network access.

🎯 Exploit Status

Public PoC: ⚠️ Yes
Weaponized: CONFIRMED
Unauthenticated Exploit: ⚠️ Yes
Complexity: LOW

Exploitation is trivial - attackers simply need to send an HTTP request with the malicious cookie. The vulnerability was actively exploited in the wild before being discovered.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: Remove version 3.2.0.3 and use version 3.4.1 or later

Vendor Advisory: https://github.com/twbs/bootstrap-sass/issues/1195

Restart Required: Yes

Instructions:

1. Remove bootstrap-sass 3.2.0.3 from your Gemfile. 2. Update to bootstrap-sass 3.4.1 or later. 3. Run 'bundle update bootstrap-sass'. 4. Restart your Ruby application server.

🔧 Temporary Workarounds

Block malicious cookie at WAF/load balancer

all

Configure WAF or proxy to block requests containing the ___cfduid cookie

# Example nginx config:
location / {
    if ($http_cookie ~* "___cfduid") {
        return 403;
    }
}

Input validation middleware

linux

Add Ruby middleware to reject requests with suspicious cookie names

# In config/application.rb or middleware:
class CookieFilter
  def initialize(app)
    @app = app
  end
  
  def call(env)
    if env['HTTP_COOKIE']&.include?('___cfduid')
      return [403, {}, ['Forbidden']]
    end
    @app.call(env)
  end
end

🧯 If You Can't Patch

  • Isolate affected systems from internet and critical internal networks
  • Implement strict network monitoring for suspicious outbound connections from Ruby applications

🔍 How to Verify

Check if Vulnerable:

Check Gemfile.lock for 'bootstrap-sass (3.2.0.3)' or run 'bundle show bootstrap-sass' and verify version

Check Version:

bundle show bootstrap-sass

Verify Fix Applied:

Run 'bundle show bootstrap-sass' and confirm version is 3.4.1 or later, and verify Gemfile.lock no longer contains 3.2.0.3

📡 Detection & Monitoring

Log Indicators:

  • HTTP requests with ___cfduid cookie in access logs
  • Unusual Ruby eval() errors or backtrace in application logs
  • Suspicious outbound network connections from Ruby process

Network Indicators:

  • HTTP requests containing '___cfduid' cookie with base64 payload
  • Unusual traffic patterns from Ruby application servers

SIEM Query:

source="web_access_logs" AND "___cfduid" OR source="app_logs" AND "eval" AND "bootstrap-sass"

🔗 References

📤 Share & Export