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 service@support.mexc.com 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

X to cut off InfoFi crypto projects from accessing its API

X to cut off InfoFi crypto projects from accessing its API

X, the most widely used app for crypto projects, is changing its API access policy. InfoFi projects, which proliferated non-organic bot content, will be cut off
Share
Cryptopolitan2026/01/16 02:50
X Just Killed Kaito and InfoFi Crypto, Several Tokens Crash

X Just Killed Kaito and InfoFi Crypto, Several Tokens Crash

The post X Just Killed Kaito and InfoFi Crypto, Several Tokens Crash appeared on BitcoinEthereumNews.com. X has revoked API access for apps that reward users for
Share
BitcoinEthereumNews2026/01/16 03:42
China Blocks Nvidia’s RTX Pro 6000D as Local Chips Rise

China Blocks Nvidia’s RTX Pro 6000D as Local Chips Rise

The post China Blocks Nvidia’s RTX Pro 6000D as Local Chips Rise appeared on BitcoinEthereumNews.com. China Blocks Nvidia’s RTX Pro 6000D as Local Chips Rise China’s internet regulator has ordered the country’s biggest technology firms, including Alibaba and ByteDance, to stop purchasing Nvidia’s RTX Pro 6000D GPUs. According to the Financial Times, the move shuts down the last major channel for mass supplies of American chips to the Chinese market. Why Beijing Halted Nvidia Purchases Chinese companies had planned to buy tens of thousands of RTX Pro 6000D accelerators and had already begun testing them in servers. But regulators intervened, halting the purchases and signaling stricter controls than earlier measures placed on Nvidia’s H20 chip. Image: Nvidia An audit compared Huawei and Cambricon processors, along with chips developed by Alibaba and Baidu, against Nvidia’s export-approved products. Regulators concluded that Chinese chips had reached performance levels comparable to the restricted U.S. models. This assessment pushed authorities to advise firms to rely more heavily on domestic processors, further tightening Nvidia’s already limited position in China. China’s Drive Toward Tech Independence The decision highlights Beijing’s focus on import substitution — developing self-sufficient chip production to reduce reliance on U.S. supplies. “The signal is now clear: all attention is focused on building a domestic ecosystem,” said a representative of a leading Chinese tech company. Nvidia had unveiled the RTX Pro 6000D in July 2025 during CEO Jensen Huang’s visit to Beijing, in an attempt to keep a foothold in China after Washington restricted exports of its most advanced chips. But momentum is shifting. Industry sources told the Financial Times that Chinese manufacturers plan to triple AI chip production next year to meet growing demand. They believe “domestic supply will now be sufficient without Nvidia.” What It Means for the Future With Huawei, Cambricon, Alibaba, and Baidu stepping up, China is positioning itself for long-term technological independence. Nvidia, meanwhile, faces…
Share
BitcoinEthereumNews2025/09/18 01:37