If you write Python, you use pip install. We all do. It is almost muscle memory. But have you ever paused to think about what actually happens the millisecond you hit enter?

The moment a package starts installing, its setup scripts can execute arbitrary code on your machine. If that package was hijacked overnight, or if you accidentally typed request instead of requests, your workstation or production environment is already compromised.

Traditional vulnerability scanners (like my own desktop app, Alter Alert) are fantastic, and absolutely necessary. But they usually run after the fact. They scan your environments or requirements.txt once everything is already downloaded and unpacked. If a malicious script has already executed and dropped an info-stealer on your machine, a warning log an hour later is simply too little, too late.

This exact blind spot, along with the recent and alarming spikes in software supply chain attacks, drove my motivation to build AlterKS (ALTER KILL SWITCH), an active, pre-install gatekeeper designed specifically to stop Python supply chain attacks before they ever reach your system.

AlterKS Command Line Interface showing a blocked malicious package

The Growing Problem of Modern PyPI Attacks

The Python Package Index (PyPI) is an incredible open resource, but that very openness makes it a prime target for adversaries. Recent incidents have proven that supply chain attacks are no longer theoretical, they are highly automated and happening daily. Look at the devastating XZ Utils backdoor attempt or the constant flood of info-stealing malware hidden inside fake Python packages. We are seeing a massive spike in three specific types of attacks:

  • Typosquatting: Attackers upload packages with names confusingly similar to popular ones (e.g., coloroma instead of colorama, or matplotlip instead of matplotlib).
  • Dependency Confusion: Attackers register a package on the public PyPI that shares a name with your company's private internal package, forcing pip to download the malicious public one by mistake.
  • Account Hijacking: A legitimate open-source maintainer gets their account compromised (like the django-log-tracker package compromise), and a malicious, backdoored update is pushed to a normally trusted library.

Because these attacks involve brand new, freshly published code, they do not have known CVEs (Common Vulnerabilities and Exposures) yet. If a security tool only looks for known CVEs, these zero-day attacks will slip right past it.

How AlterKS Changes the Game

AlterKS acts like an uncompromising bouncer for your Python environment. Instead of running pip install requests, you run:

alterks install requests

Before pip is even allowed to touch the network to pull down the code, AlterKS intercepts the request and performs a rigorous two-part security check:

1. The OSV Vulnerability Check

First, AlterKS queries the open-source OSV.dev database. If the package and version you requested has any known vulnerabilities, AlterKS evaluates the severity. If it hits a critical or high threshold, the installation is instantly blocked.

2. The Heuristic Risk Engine

This is where AlterKS truly shines. To catch those zero-day attacks that do not have CVEs yet, AlterKS downloads the package's metadata and calculates a composite Risk Score out of 100 based on several heuristics:

  • Typosquatting: Is the name dangerously similar to one of the top 5,000 downloaded Python packages?
  • Package Age: Was this package created just two days ago?
  • Maintainer Count: Is there only a single mysteriously named maintainer?
  • Release Pattern: Did the author suddenly push ten new versions in one hour?
  • Metadata Quality: Is the package missing basic elements like a proper homepage or description?

If a package scores too high on this risk matrix, AlterKS assumes it is an active supply chain attack and immediately kills the installation process.

Quarantine: Inspecting Threats Without the Risk

I know that strict security tools can sometimes get in the way of development and exploration. Sometimes a package flagged as "High Risk" is actually just a brand new, poorly documented internal tool you wrote yourself yesterday.

Instead of just blindly blocking it, AlterKS offers a smart Quarantine feature. If a package triggers the kill switch, AlterKS gives you the option to install it into a completely isolated, hidden virtual environment (~/.alterks/quarantine/).

[QUARANTINE]: sketchy-pdf-tool==1.0.0 (risk score 85 >= threshold 60)

This allows absolute peace of mind. Security engineers and developers can safely inspect the source code of the suspicious package without risking their primary development environment or host machine. If the code turns out to be safe, you can seamlessly release it from quarantine into your main workflow.

Continuous Monitoring for the Long Haul

Security does not stop after installation. A package that was perfectly safe on Monday might have a critical vulnerability publicly disclosed on Thursday.

AlterKS includes a lightweight, built-in monitoring daemon:

alterks monitor --webhook-url https://hooks.slack.com/services/...

You can point this at a production server or a developer workstation. It will quietly rescan your environment at your configured intervals. The second a newly disclosed CVE impacts one of your running packages, AlterKS will fire off an HMAC-signed, secure webhook to your team's Slack, Discord, or corporate security dashboard.

Built for Teams and CI/CD

I designed AlterKS to be flexible. Every action it takes, whether to block, quarantine, alert, or allow, is handled by a simple policy you can define right inside your project's pyproject.toml package file.

You can set strict thresholds for production pipelines (failing CI/CD builds instantly if a bad package makes it into a requirements file) and perhaps slightly more relaxed alerting thresholds for local developer workstations.

Get Started Today

Integrating AlterKS into your workflow takes less than a minute. You can install it directly via pip from PyPI:

pip install alterks

And immediately check your current project's health:

alterks scan

The open-source Python ecosystem is brilliant, but it is moving fast, and adversaries are paying very close attention. With AlterKS, you are no longer just hoping the packages you download are safe. You are proactively enforcing it.

Check out the package on PyPI here: https://pypi.org/project/alterks/

← Back to Insights