In the popular gem package , which has a total of 113 million downloads, malicious code injection (CVE-2019-15224), which downloads executable commands and sends information to an external host. The attack occurred through of the developer account of rest-client in the rubygems.org repository, after which attackers published versions 1.6.10-1.6.13 on August 13 and 14, with malicious changes included. About a thousand users managed to download the malicious versions before they were blocked (the attackers released updates for older versions to avoid drawing attention).
The malicious change overrides the ‘#authenticate’ method in the class
Identity, resulting in each call to the method causing the email and password provided during the authentication attempt to be sent to the attackers' host. This allows interception of user login parameters for services using the Identity class that have installed a vulnerable version of the rest-client library, which as a dependency in many popular Ruby packages, including ast (64 million downloads), oauth (32 million), fastlane (18 million), and kubeclient (3.7 million).
Additionally, a backdoor was added to the code allowing arbitrary Ruby code to be executed via the eval function. The code is transmitted via a cookie signed with the attacker's key. To inform the attackers about the installation of the malicious package on an external host, the URL of the victim's system and a set of environment details, such as saved database and cloud service passwords, are sent. Attempts to upload cryptocurrency mining scripts have been recorded using the aforementioned malicious code.
After examining the malicious code, it was found that similar changes are also present in 10 packages cron-parser doge_coin coin_base
- : 4.2.2, 4.2.1
- : 0.0.6, 0.0.7
- : 1.18.0
- : 1.0.2
- : 0.5.5
- : 4.3.3
- : 0.0.3
- : 0.2.8
- : 1.0.1
- : 1.0.12, 1.0.13, 0.1.4
The first malicious package from this list was uploaded on May 12, but most appeared in July. In total, the specified packages have been downloaded about 2500 times.
Source: opennet.ru
