Backdoored Python Library Caught Stealing SSH Credentials

Python logo glitched

Barely a week has passed from the last attempt to hide a backdoor in a code library, and we have a new case today. This time around, the backdoor was found in a Python module, and not an npm (JavaScript) package.

The module’s name is SSH Decorator (ssh-decorate), developed by Israeli developer Uri Goren, a library for handling SSH connections from Python code.

On Monday, another developer noticed that multiple recent versions of the SSH Decorate module contained code that collected users’ SSH credentials and sent the data to a remote server located at:

Github page

Backdoor code

Developer: Backdoor the result of a hack

After having the issue brought to his attention, Goren said the backdoor was not intentional and was the result of a hack.

“I have updated my PyPI password, and reposted the package under a new name ssh-decorator,” he said. “I have also updated the readme of the repository, to make sure my users are also aware of this incident.” The README file read:

It has been brought to our attention, that previous versions of this module had been hijacked and uploaded to PyPi unlawfully. Make sure you look at the code of this package (or any other package that asks for your credentials) prior to using it.

But after the incident become a trending topic on Reddit yesterday, and some people threw some accusations his way, Goren decided to remove the package altogether, from both GitHub and PyPI — the Python central repo hub.

If you’re still using the SH Decorator (ssh-decorate) module in your projects, the last safe version was 0.27. Versions 0.28 through 0.31 were deemed malicious.

There have been previous incidents

This is also not the first time that libraries get backdoored and uploaded on central code repositories. The last incident happened last week, when the npm team found a cleverly hidden backdoor that made its way into a popular package.

Back in August 2017, the same npm team also removed 38 JavaScript npm packages that were caught stealing environment variables from infected projects.

Something similar happened on PyPI — Python Package Index — the official third-party software repository for the Python programming language. Back in September 2017, the Slovak National Security Office (NBU) found and reported ten malicious Python packages on PyPI, which were promptly removed.

Click to comment

Leave a Reply

Your email address will not be published. Required fields are marked *

Most Popular

To Top