strong_password 0.0.7 on RubyGems downloaded and ran code from a stranger after the attacker published it on 25 June 2019.
strong_password 0.0.7 has the identifier CVE-2019-13354. Version 0.0.6 is clean.
The original maintainer, Brian McManus, lost control of his RubyGems account. The GitHub repository showed no change.
What happened
An attacker took over the owner's RubyGems account and published version 0.0.7 on 25 June 2019.
- The new code sat at the end of
lib/strong_password/strength_checker.rb. - A background thread waited a random time and checked that the app ran in production.
- The thread fetched code from a Pastebin post and ran it with
eval. - The code sent the
URL_HOSTvalue to a remote domain. - Added Rack middleware ran Base64 commands that came in an HTTP cookie.
A researcher found the problem on 3 July 2019 by comparing RubyGems.org with GitHub. RubyGems.org then yanked the release. SecurityWeek reports 537 downloads of 0.0.7.
Affected versions
- strong_password 0.0.7 (malicious, CVE-2019-13354).
- strong_password 0.0.6 (clean).
Indicators of compromise
- Pastebin URL
https://pastebin.com/raw/xa456PFt. - Domain
smiley.zzz.com.ua. - A production check of the form
Rails.env[0]=="p"instrength_checker.rb. - An HTTP cookie with an
___idparameter that carries Base64 text.
How to check
Search the installed gem files for the Pastebin address. Replace the path with the installed gem directory.
grep -rn 'pastebin' /path/to/installed/strong_password
Check Gemfile.lock and its history for the affected version.
grep -n strong_password Gemfile.lock
What to do now
- Pin strong_password to 0.0.6 or update to a fixed release, and run
bundle update strong_password. - If a production app ran 0.0.7, treat the server as compromised. Rotate secrets, keys and database credentials.
- Search outbound logs for
pastebin.comandsmiley.zzz.com.ua. - Turn on two-factor authentication for every RubyGems account you own.
Frequently asked questions
Which strong_password version is malicious?
Version 0.0.7. Version 0.0.6 is clean.
How was the gem hijacked?
The researcher says the account fell to credential reuse across breached services and no two-factor authentication.
How can I find this kind of attack?
Compare gem contents on RubyGems.org with the source repository when you audit dependencies.
Sources
Send this page to the person who looks after AI at your company.