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.

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.

Advertisement. Scroll to continue reading.

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 a managing editor at SecurityWeek. He worked as a high school IT teacher for two years before starting a career in journalism as Softpedia’s security news reporter. Eduard holds a bachelor’s degree in industrial informatics and a master’s degree in computer techniques applied in electrical engineering.

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.

Discover strategies for vendor selection, integration to minimize redundancies, and maximizing ROI from your cybersecurity investments. Gain actionable insights to ensure your stack is ready for tomorrow’s challenges.

Register

Dive into critical topics such as incident response, threat intelligence, and attack surface management. Learn how to align cyber resilience plans with business objectives to reduce potential impacts and secure your organization in an ever-evolving threat landscape.

Register

People on the Move

Karl Triebes has joined Ivanti as Chief Product Officer.

Steven Hernandez has joined USAID as CISO and Deputy CIO.

Data security and privacy firm Protegrity has named Michael Howard as its CEO.

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.