Metadata-Version: 2.4
Name: gguf-radar
Version: 0.1.3
Summary: Checks LLM model files for hidden malware and poisoned chat templates without running them, and builds clean copies of GGUF files.
Author: Root0ne
License: MIT License
        
        Copyright (c) 2026 @Root0ne
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/Root0ne/gguf-radar
Project-URL: Repository, https://github.com/Root0ne/gguf-radar
Project-URL: Issues, https://github.com/Root0ne/gguf-radar/issues
Project-URL: Changelog, https://github.com/Root0ne/gguf-radar/blob/main/CHANGELOG.md
Project-URL: Research, https://malspark.com/blog/malicious-gguf-models-hugging-face/
Keywords: gguf,safetensors,chat-template,llm-security,supply-chain,malware-analysis,cdr,huggingface,yara
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Information Technology
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Environment :: Console
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Security
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
License-File: LICENSE-ASSETS
Requires-Dist: numpy>=1.24
Requires-Dist: jinja2>=3.1
Provides-Extra: dev
Requires-Dist: pytest>=7.4; extra == "dev"
Requires-Dist: ruff>=0.6; extra == "dev"
Dynamic: license-file

<p align="center">
  <picture>
    <source media="(prefers-color-scheme: dark)" srcset="assets/gguf-radar-logo-white.svg">
    <img alt="GGUF Radar" src="assets/gguf-radar-logo-black.svg" width="282">
  </picture>
</p>

<p align="center">
  <a href="https://github.com/Root0ne/gguf-radar/actions/workflows/ci.yml"><img alt="CI" src="https://github.com/Root0ne/gguf-radar/actions/workflows/ci.yml/badge.svg"></a>
  <a href="https://github.com/Root0ne/gguf-radar/releases"><img alt="Release" src="https://img.shields.io/github/v/release/Root0ne/gguf-radar"></a>
  <img alt="Python 3.10+" src="https://img.shields.io/badge/python-3.10%2B-blue">
  <a href="LICENSE"><img alt="License: MIT" src="https://img.shields.io/badge/license-MIT-green"></a>
</p>

# GGUF Radar

GGUF Radar checks LLM model files for hidden malware and poisoned chat templates. It never runs the model or its template. If it finds something in a GGUF file, it can also build a clean copy of that file with the same model weights.

It works on GGUF files on your disk and on models hosted on Hugging Face. For Hugging Face models it downloads only the small parts it needs, so a scan takes seconds even for very large models. It also checks the chat templates of Safetensors and PyTorch models.

## Why this matters

A GGUF file holds the model weights and a chat template, which is a small program that formats every conversation before the model reads it. Attackers have used both. They hide programs after the end of the weights, where model loaders never look, and they change the chat template so that the model tells the user to run a command or tells a coding agent to download a script. These attacks are described in [this research post](https://malspark.com/blog/malicious-gguf-models-hugging-face/).

## Install

GGUF Radar needs Python 3.10 or newer.

```bash
pip install git+https://github.com/Root0ne/gguf-radar
```

## Quick start

Check a file on your disk:

```bash
gguf-radar scan ./model.gguf
```

Check a model on Hugging Face:

```bash
gguf-radar scan Qwen/Qwen2.5-0.5B-Instruct-GGUF
```

Build a clean copy of a file:

```bash
gguf-radar sanitize suspicious.gguf -o clean.gguf
```

Compare the chat template of a GGUF file with the template of the original model:

```bash
gguf-radar compare-template ./model.gguf --base Qwen/Qwen2.5-0.5B-Instruct
```

## Results

Every scan ends with one of four verdicts.

| Verdict | What it means |
| --- | --- |
| `CLEAN` | Nothing suspicious was found. |
| `SUSPICIOUS` | Something unusual was found. A person should look at it. |
| `MALICIOUS` | The file shows a pattern used in real attacks. Do not use it. |
| `ERROR` | The file or the repository could not be read. |

The command exits with code `0` for `CLEAN`, `2` for `SUSPICIOUS` or `MALICIOUS`, and `1` for `ERROR`, so it can stop a CI pipeline.

## Documentation

- [Getting started](docs/getting-started.md)
- [Scanning files and Hugging Face models](docs/scanning.md)
- [Building a clean copy](docs/sanitizing.md)
- [Comparing a chat template with the original model](docs/comparing-templates.md)
- [Understanding the results](docs/results.md)
- [How the checks work](docs/how-it-works.md)
- [Using GGUF Radar in CI and in Python](docs/ci-and-python.md)
- [Limitations](docs/limitations.md)

The YARA rules for the attacks in the research post are in [`rules/`](rules/gguf_supply_chain_threats.yar).

## Contributing and security

Bug reports, missed detections and false alarms are welcome as [issues](https://github.com/Root0ne/gguf-radar/issues/new/choose). Please read [`CONTRIBUTING.md`](CONTRIBUTING.md) before you open a pull request. If you find a security problem in GGUF Radar itself, please report it privately as described in [`SECURITY.md`](SECURITY.md).

## License

The code is released under the [MIT License](LICENSE). The logo, the documentation and the YARA rules are released under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/), as described in [`LICENSE-ASSETS`](LICENSE-ASSETS). Both licenses only ask that you keep the credit to @Root0ne.
