Pkg ecosystem: Learning from other's mistakes has gotten a bit long and wandering, as these discussions tend to. I’d like to have a very focused thread about attack vectors against the security of the package ecosystem. To that end, here are the attack vectors I’ve come up with so far. What are some other attack vectors?
Attack: find an existing bug in some package that you can exploit
Mitigation:
- fix the bug
- yank versions that have it
Prevention:
- testing
- fuzzing
- basically anything that improves program correctness in general
Attack: create a back door through normal development process
Mitigation:
- close the back door
- yank versions that have it
- blacklist the person who created it
Prevention:
- identify risky changes and bring more attention to them to check if they’re malicious
- use signatures to hold people responsible
Attack: introduce a back door by replacing an innocent package version with a malicious one
Mitigation:
- see prevention
- is there any other mitigation step here?
Prevention:
- serve code from trusted servers over secure protocols (e.g. HTTPS)
- identify versions by permanent secure hashes and don’t allow them to be changed
- verify that code has correct hashes on installation
- be ready to use newer hashes when old ones reach end of life (e.g. SHA1)
Attack: typo squatting
Mitigation:
- delete squatting packages from registries
Prevention:
- review names that might be squatting
- use spell checking to catch likely typos
- see https://github.com/JuliaLang/Pkg.jl/issues/931 for details
Attack: package deletion
Mitigation:
- find a fork of the package
- make the fork the official repo
Prevention:
- automatically fork all registered packages
- allow installation of packages from the automatic forks