AWS Builder Center
Your system is compromised, and you don't even know it !!!

Your system is compromised, and you don't even know it !!!

AI coding agents install hundreds of npm packages without asking, and any one of them can steal your keys , or mess up tour Kernel . I built PkgGuard, a malware checker for agents, on serverless AWS, and learned how to lock a sandbox down until nothing can escape.

It started with a late night and a simple task: "add authentication to this project."
My AI agent said sure, ran  npm install , and pulled in forty-something packages in about six seconds. I didn't read a single one of them. I didn't even see the list. That's the deal we've all quietly accepted with AI coding agents — they move fast, and trust is implicit.
Then I remembered event-stream. ua-parser-js. colors and faker. Real packages, millions of downloads, that turned malicious — sometimes hijacked, sometimes sabotaged by their own maintainer. And now there's Shai-Hulud, a worm that steals your tokens and republishes itself into the packages you depend on next.
Nobody reads the code anymore. Not humans, and definitely not agents installing on autopilot.
That thought didn't let me sleep. So I built something to fix it.
What if every install had to prove itself first?
That's the whole idea behind PkgGuard. Before a package touches your machine, it runs through five checks and comes back with one verdict — SAFE, SUSPICIOUS, or MALICIOUS — backed by evidence, not a guess.

Threat intel first, checking it against known malware databases. Then package info — install scripts, how new it is, whether ownership just changed hands. Then a static read of the actual source code, hunting for hidden  eval s and reverse shells.
Then the part I'm proudest of: we actually run it, inside a SANDBOX with no real internet and fake credentials planted like bait. If a package tries to phone home with a stolen password, that's not a theory anymore — that's proof. Last, a language model reads all the evidence and explains its call in plain English.
Once a package is scanned, that verdict is cached and shared with everyone. The first person to check a package pays the wait of a minute . Every person after that gets an instant answer — from the CLI, from an AI agent, from the website.

Why it had to be built on AWS

I could not have built the sandbox part anywhere else, and that's not a sales line, it's just true.
Running real, sometimes-malicious code needs a blast radius of exactly zero. AWS Fargate gave me throwaway containers, spun up fresh per scan and destroyed right after. Inside that container's VPC, there's no internet gateway and no NAT — nothing to reach even if the malware tries. Route 53 DNS Firewall allows a short list of names and nothing else. The only way out is through a handful of private VPC endpoints straight to the AWS services the sandbox actually needs.

Everything upstream of the cage runs serverless: API Gateway takes the request, a Lambda checks DynamoDB for a cached verdict, and if it's a package we've never seen, Step Functions kicks off a scan with retries and a timeout built in. The scan Lambda pulls the package, queries OSV and SafeDep for threat intel, statically reads the code, and hands the evidence to a model on Amazon Bedrock before the sandbox even runs. Full reports land in S3, verdicts in DynamoDB, and CloudWatch and AWS Budgets keep an eye on the whole thing so nothing runs away — in behavior or in cost.
No server I provisioned myself. No fleet I had to patch or babysit. AWS scaled the parts that needed scaling and locked down the one part that absolutely could not be trusted — the container running unknown code. That's the whole pitch for going all-in on AWS: it let a solo hackathon build behave like it had a security team behind it.

It's already out there, being used

I put PkgGuard in front of a few friends, half expecting silence. Instead, in two days, it quietly ran around 450 real scans — actual packages, actual installs, actual "wait, is this one safe?" moments. That number, more than anything else, is what told me this wasn't just a hackathon toy.
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article