Virtual Event Today: CodeSecCon - Learn to Secure Your Software > Join Event
Connect with us

Hi, what are you looking for?

SecurityWeekSecurityWeek

Cybercrime

Malicious Code Planted in ‘strong_password’ Ruby Gem

A developer discovered that an update released for the ‘strong_password’ Ruby gem contained malicious code that allowed an attacker to remotely execute arbitrary code.

A developer discovered that an update released for the ‘strong_password’ Ruby gem contained malicious code that allowed an attacker to remotely execute arbitrary code.

Developer Tute Costa was updating gems used by a Rails application when he noticed that version 0.0.7 of strong_password was pushed out on RubyGems.org, the Ruby community’s gem hosting service, but not on GitHub.

Strong_password is a Ruby gem that developers can integrate into their applications to ensure that the passwords being set are strong. The gem has been downloaded nearly 250,000 times, including over 38,000 times in the case of version 0.0.6.

An analysis of strong_password 0.0.7, released on June 25, revealed that a few lines of code had been appended to the end of a file. The code was designed to wait for a random number of seconds (up to one hour), check if the application using the gem was running in production and, if so, fetch and run code from a Pastebin post.

The Pastebin post was editable so the payload could have been changed by the attacker at any time.

After discovering the malicious code, Costa reached out to the developer of strong_password, Brian McManus, who said someone had hijacked the gem and he had lost ownership. After being alerted by Costa, RubyGems representatives pulled the malicious version, locked the account used by the attacker, and assigned McManus as the owner of the gem.

Advertisement. Scroll to continue reading.

The issue has been assigned the CVE identifier CVE-2019-13354. Rubysec, which provides security resources for the Ruby community, has advised users who installed version 0.0.7 to immediately downgrade to version 0.0.6.

Unfortunately, data from rubygems.com shows that the malicious version was downloaded 537 times before it was pulled.

The incident has been discussed by many on Hacker News. Some expressed concern that the attack may have been the result of a vulnerability affecting the entire Ruby ecosystem, while others believe the attacker most likely compromised the gem developer’s account. Some believe a powerful vulnerability would have likely been exploited against a much more popular gem — the most popular have tens and even hundreds of millions of downloads — while others think this may have been part of a targeted attack.

This is not the first time a malicious Ruby gem has been discovered this year. In late March, someone pushed out a malicious version of bootstrap-sass, which has roughly 29 million downloads. The malicious version included a stealthy backdoor that allowed attackers to execute arbitrary commands on server-side Rails applications.

Related: Cryptocurrency-Stealing Code Distributed via Popular Library

Related: Several Vulnerabilities Patched in RubyGems

Related: Researchers Uncover Critical RubyGems Vulnerabilities

Related: Critical Vulnerability Addressed in Popular Code Libraries

Written By

Eduard Kovacs (@EduardKovacs) is senior managing editor at SecurityWeek. He worked as a high school IT teacher before starting a career in journalism in 2011. Eduard holds a bachelor’s degree in industrial informatics and a master’s degree in computer techniques applied in electrical engineering.

Daily Briefing Newsletter

Subscribe to the SecurityWeek Email Briefing for the latest cybersecurity threats, trends, and expert insights.

Click to comment

Trending

Daily Briefing Newsletter

Subscribe to the SecurityWeek Email Briefing to stay informed on the latest threats, trends, and technology, along with insightful columns from industry experts.

Join this live webinar as we explore if detection-first security operations can keep pace with AI, or if it’s time to rethink prevention as the strongest default.

Register

CodeSecCon bridges the gap between dev and security. Discover best practices for secure coding, innovative risk-reduction tools, and safe AI integration to cultivate a true DevSecOps culture. Safely secure your apps!

Register

People on the Move

Dali Rajic is joining OpenAI as Chief Revenue Officer.

Erika Dean has been appointed Chief Information Security Officer at Tricentis.

C1 has named Jeff St. Clair Chief Revenue Officer.

More People On The Move

Expert Insights

Daily Briefing Newsletter

Subscribe to the SecurityWeek Email Briefing to stay informed on the latest cybersecurity news, threats, and expert insights. Unsubscribe at any time.