CVE-2015-20108

9.8 CRITICAL

📋 TL;DR

This vulnerability in the ruby-saml gem allows XPath injection leading to remote code execution. Attackers can execute arbitrary code on systems using vulnerable versions of the gem. Any Ruby application using ruby-saml for SAML authentication is affected.

💻 Affected Systems

Products:
  • ruby-saml gem
Versions: All versions before 1.0.0
Operating Systems: All operating systems running Ruby
Default Config Vulnerable: ⚠️ Yes
Notes: Any Ruby application using ruby-saml for SAML authentication is vulnerable by default in affected versions.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Full system compromise with attacker gaining remote code execution, potentially leading to data theft, service disruption, or lateral movement.

🟠

Likely Case

Remote code execution allowing attackers to run arbitrary commands on the server, potentially accessing sensitive data or modifying application behavior.

🟢

If Mitigated

Attack prevented through proper input validation and prepared statements, with only failed exploitation attempts logged.

🌐 Internet-Facing: HIGH
🏢 Internal Only: MEDIUM

🎯 Exploit Status

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

The vulnerability is well-documented with public proof-of-concept available, making exploitation straightforward for attackers.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 1.0.0 and later

Vendor Advisory: https://github.com/SAML-Toolkits/ruby-saml/commit/9853651b96b99653ea8627d757d46bfe62ab6448

Restart Required: Yes

Instructions:

1. Update Gemfile to specify 'gem "ruby-saml", ">= 1.0.0"' 2. Run 'bundle update ruby-saml' 3. Restart the Ruby application server

🔧 Temporary Workarounds

Input validation wrapper

all

Implement custom input validation for SAML responses before passing to ruby-saml

🧯 If You Can't Patch

  • Implement WAF rules to block suspicious XPath patterns in SAML requests
  • Isolate the vulnerable application behind additional network segmentation

🔍 How to Verify

Check if Vulnerable:

Check Gemfile.lock or run 'bundle show ruby-saml' to see installed version

Check Version:

bundle show ruby-saml | grep -o '\d\.\d\.\d'

Verify Fix Applied:

Verify version is 1.0.0 or higher using 'bundle show ruby-saml'

📡 Detection & Monitoring

Log Indicators:

  • Unusual XPath expressions in SAML processing logs
  • Errors from xml_security.rb with malformed input

Network Indicators:

  • SAML requests containing unusual XML patterns or special characters in XPath expressions

SIEM Query:

source="application.log" AND "xml_security.rb" AND ("XPath" OR "injection")

🔗 References

📤 Share & Export