By using this site, you agree to the Privacy Policy and Terms of Use.
Accept
World of SoftwareWorld of SoftwareWorld of Software
  • News
  • Software
  • Mobile
  • Computing
  • Gaming
  • Videos
  • More
    • Gadget
    • Web Stories
    • Trending
    • Press Release
Search
  • Privacy
  • Terms
  • Advertise
  • Contact
Copyright © All Rights Reserved. World of Software.
Reading: Reverse Engineering the AI Supply Chain: Why Regex Won’t Save Your PyTorch Models | HackerNoon
Share
Sign In
Notification Show More
Font ResizerAa
World of SoftwareWorld of Software
Font ResizerAa
  • Software
  • Mobile
  • Computing
  • Gadget
  • Gaming
  • Videos
Search
  • News
  • Software
  • Mobile
  • Computing
  • Gaming
  • Videos
  • More
    • Gadget
    • Web Stories
    • Trending
    • Press Release
Have an existing account? Sign In
Follow US
  • Privacy
  • Terms
  • Advertise
  • Contact
Copyright © All Rights Reserved. World of Software.
World of Software > Computing > Reverse Engineering the AI Supply Chain: Why Regex Won’t Save Your PyTorch Models | HackerNoon
Computing

Reverse Engineering the AI Supply Chain: Why Regex Won’t Save Your PyTorch Models | HackerNoon

News Room
Last updated: 2026/01/14 at 9:37 AM
News Room Published 14 January 2026
Share
Reverse Engineering the AI Supply Chain: Why Regex Won’t Save Your PyTorch Models | HackerNoon
SHARE

We treat AI models like data assets. We version them, we store them in S3, and we cache them. But technically, a PyTorch model (.pt) or a Pickle file (.pkl) is not data. It is a program.

And right now, MLOps pipelines are blindly executing these programs with full privileges.

I built Veritensor, an open-source security scanner, to solve this. Here is a deep dive into why simple scanning fails and how we implemented a proper defense using Abstract Interpretation.

The Attack Vector: Pickle is a VM

The pickle protocol is a stack-based virtual machine. It has opcodes to push data onto a stack, call functions (REDUCE), and manipulate memory (MEMO).

A naive attacker writes this:

class Virus: 
  def __reduce__(self): 
    return (os.system, ("rm -rf /",))

A naive defender writes a Regex scanner:

if "os.system" in file_content:     
  alert("Virus!")

Why Regex Fails (The Obfuscation Problem)

A sophisticated attacker knows you are grepping for os and system. So they use the STACK_GLOBAL opcode to assemble the function name dynamically at runtime.

Instead of importing os, they do this (conceptually):

  1. Push string “o”
  2. Push string “s”
  3. Concatenate -> “os”
  4. Import module by name from stack.

The string “os” never appears in the file as a contiguous block. Your Regex scanner sees nothing. The model loads, the VM executes the assembly, and you get pwned.

The Solution: Static Analysis via Stack Emulation

To catch this, Veritensor doesn’t just read the file. It emulates the Pickle VM.

We wrote an engine that iterates through the opcodes (PROTO, BINUNICODE, STACK_GLOBAL, etc.) and maintains a virtual stack. We don’t execute the functions, but we track what is being called.

When the scanner sees STACK_GLOBAL, it looks at the virtual stack to see what module and function are being requested. Even if the strings were constructed dynamically, the emulator sees the final result: os.system.

This allows us to enforce a Strict Allowlist policy. If a model tries to import anything outside of torch, numpy, or collections, Veritensor kills it before it executes.

Beyond Malware: The Integrity Problem

Scanning for malware is step one. Step two is ensuring the file hasn’t been tampered with (MITM attacks) or corrupted.

Veritensor implements a Hash-to-API verification.

  1. It calculates the SHA256 of your local artifact.
  2. It queries the Hugging Face Hub API for the official manifest of the repository you think you are using.
  3. It compares the hashes.

If you downloaded bert-base-uncased but the hash doesn’t match Google’s official release, Veritensor blocks the deployment. This protects against “Typosquatting” models that mimic popular architectures but contain backdoors.

Supply Chain Trust (Sigstore)

Finally, once a model is scanned and verified, we need to ensure it stays that way. Veritensor integrates with Sigstore Cosign.

If the scan passes (PASS), the tool uses your private key to sign the Docker container containing the model. The signature includes metadata:

{ 
  "scanned_by": "veritensor", 
  "scan_date": "2025-01-14T12:00:00Z", 
  "status": "clean" 
}

Your Kubernetes Admission Controller can then verify this signature and reject any unsigned or “stale” images.

Try it out

Veritensor is fully open source (Apache 2.0). It supports PyTorch, Keras (detects Lambda layer injections), Safetensors, and GGUF.

pip install veritensor

GitHub: https://github.com/ArseniiBrazhnyk/Veritensor

I’d love to hear your feedback on the detection logic or edge cases you’ve encountered with Pickle files.

Sign Up For Daily Newsletter

Be keep up! Get the latest breaking news delivered straight to your inbox.
By signing up, you agree to our Terms of Use and acknowledge the data practices in our Privacy Policy. You may unsubscribe at any time.
Share This Article
Facebook Twitter Email Print
Share
What do you think?
Love0
Sad0
Happy0
Sleepy0
Angry0
Dead0
Wink0
Previous Article The year of ultra-ultraportable Windows laptops is here The year of ultra-ultraportable Windows laptops is here
Next Article London’s Tube network extends 4G/5G connectivity | Computer Weekly London’s Tube network extends 4G/5G connectivity | Computer Weekly
Leave a comment

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Stay Connected

248.1k Like
69.1k Follow
134k Pin
54.3k Follow

Latest News

Vercel Open-Sources Bash Tool for Context Retrieval Using Local Filesystems
Vercel Open-Sources Bash Tool for Context Retrieval Using Local Filesystems
News
memory and storage can stop them in 2026
memory and storage can stop them in 2026
Mobile
What Shipping a Mobile Game in an Emerging Market Taught Me About Product Decisions | HackerNoon
What Shipping a Mobile Game in an Emerging Market Taught Me About Product Decisions | HackerNoon
Computing
Bandcamp takes a stand against AI music, banning it from the platform |  News
Bandcamp takes a stand against AI music, banning it from the platform | News
News

You Might also Like

What Shipping a Mobile Game in an Emerging Market Taught Me About Product Decisions | HackerNoon
Computing

What Shipping a Mobile Game in an Emerging Market Taught Me About Product Decisions | HackerNoon

6 Min Read
AI Agents Are Becoming Privilege Escalation Paths
Computing

AI Agents Are Becoming Privilege Escalation Paths

9 Min Read
GeekWire’s ‘Agents of Transformation’ event will explore what’s next in AI
Computing

GeekWire’s ‘Agents of Transformation’ event will explore what’s next in AI

2 Min Read
GlobalFoundries Acquires Synopsys ARC Processor IP, To Be Integrated Into MIPS
Computing

GlobalFoundries Acquires Synopsys ARC Processor IP, To Be Integrated Into MIPS

1 Min Read
//

World of Software is your one-stop website for the latest tech news and updates, follow us now to get the news that matters to you.

Quick Link

  • Privacy Policy
  • Terms of use
  • Advertise
  • Contact

Topics

  • Computing
  • Software
  • Press Release
  • Trending

Sign Up for Our Newsletter

Subscribe to our newsletter to get our newest articles instantly!

World of SoftwareWorld of Software
Follow US
Copyright © All Rights Reserved. World of Software.
Welcome Back!

Sign in to your account

Lost your password?