Veritensor is an open-source tool that secures the entire lifecycle of an AI model. It detects RCE malware in Pickle files using AST emulation, verifies hashes Veritensor is an open-source tool that secures the entire lifecycle of an AI model. It detects RCE malware in Pickle files using AST emulation, verifies hashes

Reverse Engineering the AI Supply Chain: Why Regex Won't Save Your PyTorch Models

\ 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.

Market Opportunity
null Logo
null Price(null)
--
----
USD
null (null) Live Price Chart
Disclaimer: The articles reposted on this site are sourced from public platforms and are provided for informational purposes only. They do not necessarily reflect the views of MEXC. All rights remain with the original authors. If you believe any content infringes on third-party rights, please contact [email protected] for removal. MEXC makes no guarantees regarding the accuracy, completeness, or timeliness of the content and is not responsible for any actions taken based on the information provided. The content does not constitute financial, legal, or other professional advice, nor should it be considered a recommendation or endorsement by MEXC.

You May Also Like

Nvidia shares fall 3%

Nvidia shares fall 3%

The post Nvidia shares fall 3% appeared on BitcoinEthereumNews.com. Home » AI » Nvidia shares fall 3% Chipmaker extends decline as investors continue to take profits from recent highs. Photo: Budrul Chukrut/SOPA Images/LightRocket via Getty Images Key Takeaways Nvidia’s stock decreased by 3% today. The decline extends Nvidia’s recent losing streak. Nvidia shares fell 3% today, extending the chipmaker’s recent decline. The stock dropped further during trading as the artificial intelligence chip leader continued its pullback from recent highs. Disclaimer Source: https://cryptobriefing.com/nvidia-shares-fall-2-8/
Share
BitcoinEthereumNews2025/09/18 03:13
Zero Knowledge Proof Kicks Off 2026 With Presale Auction Plus $5M Reward – Could This Spark Major Movement?

Zero Knowledge Proof Kicks Off 2026 With Presale Auction Plus $5M Reward – Could This Spark Major Movement?

Most crypto markets concentrate on popular names bouncing back from the latest drops, yet one presale auction grabs focus for completely different reasons. Zero
Share
LiveBitcoinNews2026/01/15 05:00
Uphold’s Massive 1.59 Billion XRP Holdings Shocks Community, CEO Reveals The Real Owners

Uphold’s Massive 1.59 Billion XRP Holdings Shocks Community, CEO Reveals The Real Owners

Uphold, a cloud-based digital financial service platform, has come under the spotlight after on-chain data confirmed that it safeguards approximately 1.59 billion XRP. According to Uphold’s Chief Executive Officer (CEO), Simon McLoughlin, these tokens are fully owned by customers, not the exchange itself.  Uphold Clarifies Massive XRP Holdings The crypto community was taken by surprise […]
Share
Bitcoinist2025/09/18 00:30