Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

post-registration alerts for packages with similar names (typosquatting) #2268

Open
ncoghlan opened this issue Aug 2, 2017 · 11 comments
Open
Labels
APIs/feeds blocked Issues we can't or shouldn't get to yet feature request

Comments

@ncoghlan
Copy link
Contributor

ncoghlan commented Aug 2, 2017

The question of typosquatting as a threat vector occasionally comes up in discussion of open publication platforms like PyPI, and while I generally agree with this post from npm's Laurie Voss that it's unlikely to be a particularly good attack vector in practice, I still keep an eye out for mitigation ideas that might reduce the threat from "relatively ineffective" to "almost entirely ineffective".

Prompted by this comment https://twitter.com/teabass/status/892708535494217728 about checking the Levenshtein distance between project names, a possibility occurred to me that might actually be viable at scale: rather than notifying the PyPI maintainers, it may be possible to instead notify the maintainers of the packages that have similar names.

While an active alert could make sense for new package name registrations, it could also just be a widget on the project's PyPI page that lists "packages with similar names". For coincidental naming choices, such may help folks discover projects that are genuinely related in some way to the one they're looking at, while for malicious packages, it would significantly reduce the odds of them going unnoticed (especially if the widget noted "first published" dates).

Anyway, I don't think this is urgent (for the reasons stated in Voss's post linked above), but also figured it made sense to share the idea.

@ncoghlan
Copy link
Contributor Author

ncoghlan commented Aug 3, 2017

Recent incident report from NPM covering a case where downloads of a genuinely malicious package were being induced via typo-squatting: http://blog.npmjs.org/post/163723642530/crossenv-malware-on-the-npm-registry?utm_content=buffer42b52&utm_medium=social&utm_source=twitter.com&utm_campaign=buffer

@ncoghlan
Copy link
Contributor Author

ncoghlan commented Sep 16, 2017

Report from Slovakia's National Security Authority regarding specific instances of typosquatting specifically on PyPI: http://www.nbu.gov.sk/skcsirt-sa-20170909-pypi/

The folks at https://pytosquatting.overtag.dk also claim to have contacted the PyPI admins about their work, but I don't recall seeing anything from them on any of the relevant mailing lists (i.e. distutils-sig, PSF Infra, PSF Infra Staff).

Maybe they contacted @dstufft or @ewdurbin privately?

@ewdurbin
Copy link
Member

i believe there was a report to the PSRT (Python Security Response Team) @ncoghlan, it was only conferred to myself as an instance of packages to be taken down.

@ncoghlan
Copy link
Contributor Author

ncoghlan commented Sep 17, 2017

Sorry, I conflated two different things in my comment. Victor posted to python-dev regarding the information sharing from the Slovakian security agency, which did indeed come in through PSRT: https://mail.python.org/pipermail/python-dev/2017-September/149569.html

The comment I'm not clear on is the "our primer didn't get reactions from the PyPI admins" one on the Pytosquatting page. Maybe they're confused about the fact that the main organisations they need to be bugging about this topic are the commercial vendors redistributing PyPI clients for profit, rather than the volunteers and non-profit organisations making the platform available for community use?

@dstufft
Copy link
Member

dstufft commented Sep 17, 2017

No, they're talking about an email they sent to myself, Richard, and Martin that I forgot about because it was PGP encrypted and I first received it on my phone, then it had slipped my mind by the time I was back at my desktop.

@ncoghlan
Copy link
Contributor Author

Ah, fair enough - that's unfortunate, but it's understandable they might be confused about the lack of response in that case.

In relation to the SK-CSIRT report, I posted a separate issue asking whether or not we might want to make "reserved by admins" clearly distinguishable from other cases of names being reserved: #2401

@brainwane brainwane added this to the 6. Post Legacy Shutdown milestone Feb 16, 2018
@brainwane brainwane added the help needed We'd love volunteers to advise on or help fix/implement this. label Mar 14, 2018
@amirouche
Copy link

What is required to go forward regarding this subect?

@brainwane
Copy link
Contributor

Warehouse plans to work on this issue later this year:

systems for the automated detection of malicious uploads will lower the time to response and improve the resiliency of PyPI against attacks such as “pytosquatting”.

@brainwane brainwane changed the title Idea: post-registration alerts for packages with similar names post-registration alerts for packages with similar names (typosquatting) Jun 21, 2019
@brainwane
Copy link
Contributor

Thanks for starting this issue, Nick! (A few of us discussed it today.)

I'm making a distinction here: #4998 is about typosquatting prevention/detection before/during upload, and is distinct from this issue (which is about notifications, alerts, a "packages with similar names" widget, etc.).

@brainwane brainwane added blocked Issues we can't or shouldn't get to yet and removed help needed We'd love volunteers to advise on or help fix/implement this. labels Sep 2, 2019
@brainwane
Copy link
Contributor

Blocked on #4998.

@rendorHaevyn
Copy link

hi folks,
has this found any traction with respect to actual implementation?

I just read an article around this, and noticed a specific user (https://pypi.org/user/wbengtson/) has created over 4,000 typo-squatted packages in order to prevent any attacks in this space.

I'd have thought that pypi or pip etc could simply re-map / re-direct such typos to the correct packages upon pip install x command, with a prompt for user confirmation.
At least, as a user, that kind of behaviour would be logical to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
APIs/feeds blocked Issues we can't or shouldn't get to yet feature request
Projects
None yet
Development

No branches or pull requests

7 participants