I built KEIP as a PoC to experiment with "install-time enforcement". It uses BPF LSM hooks to monitor the pip process tree and strictly enforces a whitelist for connect() syscalls. Anything not destined for the package repo (PyPI) gets blocked.
It successfully stopped 100% of the active C2 exfiltration attempts in the dataset I tested.
Open source (GPL). The code is a bit rough but works on kernel 5.8+ with BTF. Repo: https://github.com/Otsmane-Ahmed/KEIP ,Write-up: https://medium.com/@rafik222dz/every-pip-install-you-run-is-a-bet-you-are-making-with-your-machine-9fce4526fc8e
Curious to hear thoughts on kernel-level enforcement vs user-space sandboxing for package managers.