A few thoughts on security with Javascript NPM packages in this modern days and time.

Last week I got into conversation with several security experts. First at an appointment for a security audit of a software where at the end the conversation turned into a casual chat. This was the first time I was made aware of the currently threatening security risks of npm packages. On Friday I had a call with an acquaintance who has a company in the security area for large enterprises. Here I asked him about the current threatening situation and he was able to confirm all my research and concerns. And then just during the Super Bowl, I read an article online that is about this very topic, further substantiating my concerns and prompting me to write down my thoughts here.

In der vergangenen Woche bin ich mit verschiedenen Sicherheits-Experten in Gespräch gekommen. Erst bei einem Termin für einen Sicherheits-Audit einer Software wo am Ende das Gespräch zu einem lockeren Schnack wurde. Da wurde ich das erste Mal auf die momentan bedrohlichen Sicherheitsrisiken von npm Packages aufmerksam gemacht. Am Freitag dann einen Call mit einem Bekannten gehabt, der eine Firma im Sicherheitsbereich für Großunternehmen hat. Hier fragte ich ihn nach der aktuell bedrohlichen Situation und konnte mir alle meine Recherchen und Bedenken bestätigen. Und dann lese ich gerade während des Superbowls einen Artikel online, der sich genau um das Thema handelt und meine Bedenken noch weiter untermauern und mich dazu bringen, meine Gedanken hier niederzuschreiben.


image.png
Image by pixabay - https://pixabay.com/de/photos/code-programming-javascript-5113374/

Now I'm not the big backend / full stack developer who can write javascript from top to bottom in his sleep, but I know a little bit about the matter and how it works. The application npm is a package manager software used to load software for projects.

npm is a package manager for the JavaScript runtime environment Node.js. npm was programmed in 2010 by Isaac Schlueter as an employee of the Californian cloud platform provider Joyent. (Wikipedia)

Developers who program software based on NodeJS resort to the package manager NPM. Since is simple, fast and efficient. However, the thought process does not go to the normal developers who refer to code that is provided at npm, but around those who produce software and accordingly host their software at npm with their account. During the conversation after the security audit of a software the colleague told me that according to research about 80% of software developers who host their software e.g. at npm have not secured their accounts with a 2-factor authorization. This made me immediately suspicious and I had to question this more closely and my head was already rattling. That would directly mean that "potentially" 80% of the packages that can be viewed at npm could rather come from "insecure" sources. For example, if a software developer who releases his code to the world via npm, whose account is only secured by email address and password, it would be possible that the account has already been compromised and a malicious hacker could inject code into the packages.

I don't want to be alarmist or scary, but such code has already been found, and this is unfortunately the case time and time again. Categorize I now times the 3 most widespread attack vectors with e.g. with NPM. That does not have to mean that only alone with the package manager NPM these problems exist. There are many other package managers, e.g. also for Python etc..

The missing 2-factor

As described above, there are studies that confirm that about 80% of the accounts in npm no 2 factor Auth was set up, which is a corresponding security risk.

Selling access to the darknet

Of course, it is also possible that the person who successfully hacked an account or otherwise gained access to it - or even the actual owner of the account - is thinking of selling his code access and the thousands of installs. It is well known that there are many dark figures and also nasty blackhat hackers in the darknet, who are probably just waiting to get an account at npm, which has thousands of installations. Since the developers here provide software for the entire world as open source, they "actually" earn no money with the development but also with the further development of the software. There can come the one or the other already times such a thought to sell his account in the Darknet.

And now a particularly interesting approach, which I just came across while watching my feed during the Superbowl...

Buy an expired domain and create the npm account email address and reset the password.

And with this type it doesn't have to be npm.... it can be any provider that has a password reset feature. In the example, the hacker with a specific goal would either wait for the developer's domain to expire and then register it - or buy an already expired domain that has already been used by a developer. The hacker would now simply register the domain - create the user's matching mail address and request a new password. But this would only be possible if the 2 factor auth. was not activated. Which is not the case with about 80% of the users.


This has been on my mind several times during the last week and it popped into my head again while reading. I love open source software... but here again it gives me something to think about and think about. Especially about when a user just sells his account and malicious code "can" be infiltrated.

In conclusion, I would like to give you the following advice - If possible, include a 2nd factor in your login, if this is possible. And if not - use a strong password.

I'm watching the Superbowl now, the first quarter is over and I hope the Bengels get the win.

Ich bin jetzt nicht der große Backend / Full Stack Entwickler, der Javascript von oben bis unten im Schlaf schreiben kann, aber ein bisschen kenne ich mich mit der Materie aus und weiß, wie es funktioniert. Bei der Anwendung npm handelt es sich um eine Paketmanager Software mit der Software für Projekte geladen werden.

npm ist ein Paketmanager für die JavaScript-Laufzeitumgebung Node.js. npm wurde 2010 von Isaac Schlueter als Mitarbeiter der kalifornischen Cloud-Plattform-Anbieters Joyent programmiert. (Wikipedia)

Entwickler, die Software auf Basis von NodeJS programmieren greifen auf den Paketmanager NPM zurück. Da ist einfach, schnell und effizient. Der Gedankengang geht aber nicht an die normalen Entwickler, die sich auf Code beziehen, welcher bei npm bereitgestellt wird, sondern um diejenige, die Software herstellen und dementsprechend mit ihrem Konto ihre Software bei npm hosten. Bei dem Gespräch nach dem Sicherheits-Audit einer Software hat mir der Kollege erzählt, das laut Untersuchungen ca. 80% der Software-Entwickler, die ihre Software z.B. bei npm hosten, ihre Konten nicht mit einer 2-Faktor Authorisierung abgesichert haben. Das machte mich direkt stutzig und musste das einmal genauer hinterfragen und im Kopf ratterte es schon. Das würde ja direkt heißen, das "potentiell" 80% der Pakete, die man bei npm einsehen kann, eher aus "unsicheren" Quellen stammen könnten. Denn wenn z.B. ein Software Hersteller, der seinen Code über npm in die Welt hinausgibt, dem sein Konto nur durch E-Mail Adresse und Passwort abgesichert ist, wäre es Möglich, das das Konto schon komprimitiert wurde und ein bösartiger Hacker, dementsprechenden Code in die Pakete einschleusen kann.

Ich will den Teufel nun nicht an die Wand malen oder Ängste verbreiten aber dementsprechender Code wurde bereits gefunden und das ist leider immer wieder der Fall. Kategorisiere ich nun mal die 3 verbreitesten Angrissfs-Vektoren bei z.B. bei NPM. Das muss nicht heißen, das nur alleine bei dem Packagemanager NPM diese Probleme bestehen. Es gibt zig andere Paketmanager z.B. auch für Python etc.

Der fehlende 2-Faktor

Wie einleitend schon beschrieben, gibt es Untersuchungen, die bestätigen, das bei ca. 80% der Accounts bei npm keine 2 Faktor Auth eingerichtet wurde, was ein dementsprechendes Sicherheitsrisiko ist.

Das verkaufen vom Zugang ins Darknet

Was natürlich auch möglich ist, das derjenige, der ein Konto erfolgreich entweder gehackt oder anderweitig Zugriff drauf bekommen hat - oder auch der eigentliche Eigentümer des Accounts mit den Gedanken spielt, seinen Code Zugang und die tausendfachen Installs zu verkaufen. Es tummeln sich ja bekanntlich viele dunkle Gestalten und auch üble Blackhat Hacker im Darknet rum, die wahrscheinlich nur darauf warten, einen Account bei npm zu erhalten, die zig tausende Installationen haben. Da die Entwickler hier Software für die gesamte Welt als Open Source bereitstellen, verdienen diese "eigentlich" kein Geld mit der Entwicklung aber auch mit der Weiterentwicklung der Software. Da kann dem einen oder anderen schon mal so ein Gedanke kommen, seinen Account im Darknet zu verkaufen.

Und jetzt ein besonders interessanter Ansatz, über den ich gerade gestoßen bin, während ich so meinen Feed beim Superbowl schaun durchgucke...

Eine abgelaufene Domain kaufen und die E-Mail Adresse des npm Account anlegen sowie das Passwort zurücksetzen.

Und bei dieser Art muss es nicht unbedingt npm sein... es kann jeglicher Anbieter sein, der eine Passwort zurücksetzen Funktion hat. Bei dem Beispiel wäre es so, das Hacker, der ein bestimmtes Ziel hat, entweder darauf wartet, das die Domain des Entwicklers abläuft und diese dann registriert - oder eine bereits abgelaufene Domain kauft, die bereits von einem Entwickler verwendet wurde. Der Hacker würde nun simple die Domain registrieren - die passende Mail Adresse des Nutzers erstellen und ein neues Passwort anfordern. Dies wäre aber nur möglich, wenn die 2 Faktor Auth. nicht aktiviert wäre. Was bei ca. 80% der Nutzer ja nicht der Fall ist.


Das hat mich die gesamte letzte Woche nun mehrfach beschäftigt und schoss mir grad wieder beim Lesen durch den Kopf. Ich liebe ja Open Source Software... aber hier wiederrum gibt mir das ein wenig zum Denken und zum Nachdenken. Besonders darüber, wenn ein Nutzer sein Konto einfach verkauft und bösartiger Code eingeschleust werden "kann".

Schlussfoldernd möcht ich euch auf den Weg geben - Wenn möglich, bindet einen 2ten Faktor in euren Login ein, sofern dies Möglich ist. Und falls nicht - ein starkes Passwort werden.

Ich schau nun den Superbowl weiter, das erste Quarter ist durch und hoffe, das die Bengels den Win holen.




0
0
0.000

4 comments

Das ist auch aus meiner Sicht ein wirklich ernstzunehmendes Sicherheitsrisiko, welches leider von einigen Entwicklern nicht ernst genommen wird.
Natürlich sehe ich hier ein großes Risiko, in der Hauptsache bei geschlossenen Code. Dieser kann meist nicht von anderen oder unabhängigen Spezialisten überprüft werden und birgt ein großes Risiko von böswilligen Manipulationen. Aus diesem Grund meide ich proprietäre Software so gut es geht.
Danke für den Hinweis.

0
0
0.000

Hallo,

hab null Ahnung von der Thematik drum muss ich fragen.
Kann man ein Passwort nicht nur dann zurücksetzen wenn eine 2 Faktor Authentifizierung vorhanden ist?

0
0
0.000