r/PowerShell • u/L1ttl3J1m • Aug 20 '26
Information PSA: Never use a wildcard in an install-module command.
Mean and nasty people are filling the repository with almost-right spelling of the real modules.
Just check the output of this command: Find-Module Microsoft.Graph.auth*
There are currently 1 real one and 25 malicious ones
115
Upvotes
89
u/dodexahedron Aug 20 '26
It's wild that MS doesn't at least protect names starting with stuff like...oh...I don't know.... Microsoft.Graph, even just for trademark purposes, let alone name squatters.
26
u/PDQ_Brockstar Aug 20 '26
Great PSA. Looks like all the malicious modules were last updated 8/16.
It might be a loosing battle, but I'd like to think that reporting them on PSGallery's site is useful.
8
u/Thotaz Aug 20 '26
Whenever I install modules it's always a two step process, first I run
Find-Module *XYZ*, then I copy the exact name and runInstall-Module <Ctrl+V>. I hope I'd be aware enough to question all the similar looking modules, and that I don't make a typo in the original search.15
u/JSChronicles Aug 20 '26
Yeah this has been a known thing forever for pretty much any language.. you always explicitly install via the full name.
That still doesn't stop people from package takeovers though which is a whole other problem. Check out npm for fun stuff
7
u/I_see_farts Aug 20 '26
Interesting, all those are posted by the same person on 8/16/26.
I'm looking at the code for one now... yikes!
The GitHub repo that it downloaded from has been deleted. Got the ol' 404 error.
6
u/Cadder Aug 21 '26
Silly as it may sound, I've never even assumed this was possible, let alone desirable. Install modules specifically by name. 🤷♂️
3
u/800oz_gorilla Aug 21 '26
this is a great PSA, but to tack on: they are clearly typo squatting. installing it manually by full name only works if you aren't so rushed you fat finger it.
3
u/purplemonkeymad Aug 21 '26
Huh interesting, apparently the PSResourceGet module has different results for that wildcard search:
3
u/SolidKnight Aug 21 '26
Install-Module * -Force -Scope AllUsers
1
u/evolutionxtinct Aug 21 '26
Good to know! I think we sometimes take this for granted
1
u/NFX_7331 Aug 23 '26
Damn thought PSG was official enough that they would check what gets uploaded, atleast to some degree but this is pretty bananas.
And why would they not copy the current version and descpription that the legit one got, seems stupid.
0
u/BlackV Aug 20 '26 edited Aug 21 '26
LAWL, great idea by the hackers
yet another reason MS will be moving their modules to ACR (soontm )
people need to stop using
install-Module Microsoft.Graph(so you don't get 1 million modules) and install specific scoped modules, don't be lazyvalidate your input, validate your sources, be explicit in your installs, security 101
this applies to npm, winget, chocolaty, psgallery, and the million other repos out there
Edit: come on, be honest it's a well documented and "solved" problem with module pinning (name/fqdn/version)
-4
u/xueimelb Aug 20 '26
You mean I should be precise in the software I install? Never would have crossed my mind. /s