Trustwave and Cybereason Merge to Form Global MDR Powerhouse for Unparalleled Cybersecurity Value. Learn More

Trustwave and Cybereason Merge to Form Global MDR Powerhouse for Unparalleled Cybersecurity Value. Learn More

Services
Managed Detection & Response

Eliminate active threats with 24/7 threat detection, investigation, and response.

Co-Managed SOC (SIEM)

Maximize your SIEM investment, stop alert fatigue, and enhance your team with hybrid security operations support.

Advisory & Diagnostics

Advance your cybersecurity program and get expert guidance where you need it most.

Penetration Testing

Test your physical locations and IT infrastructure to shore up weaknesses before exploitation.

Database Security

Prevent unauthorized access and exceed compliance requirements.

Email Security

Stop email threats others miss and secure your organization against the #1 ransomware attack vector.

Digital Forensics & Incident Response

Prepare for the inevitable with 24/7 global breach response in-region and available on-site.

Firewall & Technology Management

Mitigate risk of a cyberattack with 24/7 incident and health monitoring and the latest threat intelligence.

Solutions
BY TOPIC
Microsoft Security
Unlock the full power of Microsoft Security
Offensive Security
Solutions to maximize your security ROI
Rapidly Secure New Environments
Security for rapid response situations
Securing the Cloud
Safely navigate and stay protected
Securing the IoT Landscape
Test, monitor and secure network objects
Why Trustwave
About Us
Awards and Accolades
Trustwave SpiderLabs Team
Trustwave Fusion Security Operations Platform
Trustwave Security Colony
Partners
Technology Alliance Partners
Key alliances who align and support our ecosystem of security offerings
Trustwave PartnerOne Program
Join forces with Trustwave to protect against the most advance cybersecurity threats

Open Challenge: Ruby YAML.load(YOUR_STRING_HERE) == RCE?

For some, the challenge may already be quite clear by the title of this post, but I'm going to add a little color for the sake of clarity.

Background

Back in January 2013, there was a lot of excitement about a vulnerability in Ruby on Rails (CVE-2013-0156). In short, the vulnerability allowed a remote attacker to craft a request to Rails that would allow object creation via YAML deserialization and result in remote code execution (RCE). You can check the plethora of blog posts that covered the topic at the time to learn more (I've provided some of the better ones below as references).

Since that time, there has been a lot of discussion surrounding the use of Ruby YAML.load on user-controlled content in any Ruby application because of the RCE risk. And of course, I understand that it's important for us to learn from past mistakes and try to make a safer way to load YAML content. Examples of this include using something like YAML.safe_load or using white-listing techniques to restrict your object class exposure when you actually need to deserialize objects using YAML.load.

 

My Concerns

However, one of my concerns about such potential RCE scenarios, and maybe I'm not alone, is that of context. The issue I have with context is that in all the public PoC's I've observed, the attacker needed either an existing object behaving badly (ie. ActionController::Routing::RouteSet::NamedRouteCollection) or the creation of a contrived dangerous object being loaded manually to achieve such RCE.

The question I'd like posited is whether or not it's possible to achieve arbitrary RCE with a YAML.load using only standard lib objects, which are loaded by default. After all, if you're allowing the loading of dangerous/contrived objects with eval behavior, isn't this in the same vein as evaluating a user-controlled string?

I've done a little bit of poking around this topic myself and frankly, I've come up short. I've even consulted other fellow Rubyists to provide such an example, and I've yet to get a positive response that was acceptable to demonstrate such a risk.

 

The Challenge

As a Rubyist and a Security professional, I'm compelled to test such things and seek the truth. As such, I'm opening up a community challenge to see if there are some smart people out there willing to take on such a challenge.

Here are the basic constraints:

  • Must use a currently supported Ruby version
  • Must be a string that is supplied to the YAML.load function
  • Must use STDLIB only (ie. whatever's available to you after typing "irb" at a command prompt, no additional libs, requires, or .irbrc-type behavior)
  • Must be able to do something with the RCE (i.e., throw a shell, exfill, etc.)

The challenge is open as of now and will be completed on Thursday, May 14th. I will update this post as soon as the challenge is solved or will provide an update if it goes unsolved in the time window.

 

Submissions

Please submit your solutions to the challenge by sending an e-mail to trustwaveadvisories@trustwave.com and include the subject line "Ruby YAML.load Challenge".

References

***UPDATE - May 29, 2015--No one solved the challenge, bummer. Thanks for playing!

ABOUT TRUSTWAVE

Trustwave is a globally recognized cybersecurity leader that reduces cyber risk and fortifies organizations against disruptive and damaging cyber threats. Our comprehensive offensive and defensive cybersecurity portfolio detects what others cannot, responds with greater speed and effectiveness, optimizes client investment, and improves security resilience. Learn more about us.

Latest Intelligence

Discover how our specialists can tailor a security program to fit the needs of
your organization.

Request a Demo