Skip to content

Releases

gguf-radar 0.1.9

Choose a tag to compare

@github-actions github-actions released this 03 Dec 21:21
d29fed7

What's Changed

  • Raise the minimum versions of jinja2 and pytest, and audit them in CI by @Root0ne in #51
  • Prepare release 0.1.9 by @Root0ne in #52
  • Date release 0.1.9 on the day it is published by @Root0ne in #54
  • Release 0.1.9 by @Root0ne in #53

Full Changelog: v0.1.8...v0.1.9

gguf-radar 0.1.8

Choose a tag to compare

@github-actions github-actions released this 02 Dec 21:14
df885d6

What's Changed

  • Grade content branches by what they write by @Root0ne in #44
  • Report x86-64 syscall stubs in the padding and after the last tensor by @rujui7142 in #46
  • Recognise system call stubs by the convention of the platform by @Root0ne in #47
  • Prepare release 0.1.8 by @Root0ne in #48
  • Release 0.1.8 by @Root0ne in #49

Full Changelog: v0.1.7...v0.1.8

gguf-radar 0.1.7

Choose a tag to compare

@github-actions github-actions released this 01 Dec 21:27
60da1ab

What's Changed

  • Use one README logo that is readable on light and dark backgrounds by @Root0ne in #36
  • Describe every block format in one layout table and cover partly unused bits by @Root0ne in #38
  • Follow message content, constant strings and shell quoting in the template check by @Root0ne in #37
  • Compare two input lengths instead of a fixed time limit in one template test by @Root0ne in #39
  • Report content tests through the data flow as notes and follow Jinja scoping by @Root0ne in #40
  • State the limits as classes and name the defence for each by @Root0ne in #41
  • Prepare release 0.1.7 by @Root0ne in #42
  • Release 0.1.7 by @Root0ne in #43

Full Changelog: v0.1.6...v0.1.7

gguf-radar 0.1.6

Choose a tag to compare

@github-actions github-actions released this 01 Dec 16:44
ce9434a

What's Changed

  • Create the release tag with a workflow by @Root0ne in #30
  • Extract the rows of UNUSED tokens and check that the tokenizer cannot produce them by @rujui7142 in #31
  • Bound the memory of the UNUSED token check and correct its description by @Root0ne in #32
  • Prepare release 0.1.6 by @Root0ne in #33
  • Release 0.1.6 by @Root0ne in #35

New Contributors

Full Changelog: v0.1.5...v0.1.6

gguf-radar 0.1.5

Choose a tag to compare

@github-actions github-actions released this 30 Nov 11:26
f26f0a7

Security

  • Strings that a test on message content only requires to be absent, such as 'took ' in 'took ' not in content, are no longer listed as trigger words of conditional_logic_bomb, unless the if has an elif or else part, which runs when the string is present. not, not in, !=, and and or are followed, so double negations and De Morgan forms are read correctly. The finding and the verdict do not change. The description of a finding changes only where such a string is left out of the list trigger literal(s): [...], which happens only for an if without elif or else parts, and no sentence was added to any description. Every finding in the JSON report now has the keys trigger_literals, absent_literals, branch_text and known_template, which are empty for findings of other categories, so stored reports gain these fields. The printed output shows the strings and the text below a finding of this kind. branch_text holds up to 200 characters of the fixed text written in the branch itself, with the text of elif and else parts labelled. compare-template compares findings by severity, category and description, as before, and ignores the new fields.
  • A short list of known community templates, matched by the SHA-256 hash of the whole template text, in src/gguf_radar/known_templates.py. It holds 18 templates: the 16 template files of froggeric/Qwen-Fixed-Chat-Templates from v17 to v22.2 at revision 855bffc, and the chat template of NVIDIA Nemotron Nano v2 in the version of the NVIDIA repository and in the copy in llama.cpp. A template is listed only when the only effect of its reported branches is a warning inside the tool response, an empty thinking block that switches reasoning off for one reply, or a documented switch of the vendor. froggeric v15 and v16 are not listed, because they write text in the voice of the assistant at the start of its reply. Every reported branch in the listed templates, and every place that uses what the branch sets, is described next to the list. For a listed template, these branches give the new note known_template_branch instead of conditional_logic_bomb, and they do not change the verdict. All other findings apply in full. Only CRLF line ends and one trailing newline more or less are accepted as differences, so a modified copy stays SUSPICIOUS. scripts/known_template_hashes.py checks the hashes against the upstream files. On the two files of the report, the unmodified v21.3 template in nerun/OxCoder-9B-i1-MTP-GGUF now gives CLEAN with a note, and the copy in peculiar-ragdoll/Nail-Qwen3.6-35B-A3B-GGUF-MTP, which has a system prompt added to the template, stays SUSPICIOUS. Thanks to @nerun for the report in #25.
  • Scanning and sanitize cover named chat templates. A GGUF file can hold tokenizer.chat_template.<name> next to the default template, and llama.cpp uses a named template when a request needs it or when the default is empty. Before, scan read only the default key, so a payload in tokenizer.chat_template.tool_use gave CLEAN, and sanitize left the named keys in the file. Thanks to @agentik-os for the report in #21 and to @shiwng for the fix in #23.

Changed

  • The findings of every analyzed chat template are reported. Each finding has a new field template_key with the key of its template, and the printed findings name it. The result has a new field template_key with the key of the template with the highest risk score. The verdict is still the one of the worst finding. No field was renamed or removed.
  • The templates of a GGUF file are collected by one function, gguf_template_texts, which compare-template uses as well. compare-template now keeps a named template called default apart from the real default template, so the named one no longer replaces it.
  • scan reads the object form of chat_template in tokenizer_config.json, a mapping from names to templates, as it already read the list form. A list item without a name is read too.
  • sanitize --replace-template writes the new text under tokenizer.chat_template, adds the key if the file had none, and removes all named templates. --strip-template removes the default and all named templates. Both options also remove the array tokenizer.chat_templates, so it never lists a name without a template. The summary lists the removed keys in the new fields named_templates_removed and template_names_removed.
  • The default template and the template named tool_use are the two that llama.cpp reads, so a scan always analyzes them. A file that holds thousands of named templates or a very long template cannot make a scan slow, because the work is limited. Besides these two, a scan analyzes at most 16 named templates with at most 1,048,576 characters in total, and of any template it analyzes the first 1,048,576 characters. A file beyond a limit gets the finding too_many_chat_templates or chat_template_too_large and the verdict SUSPICIOUS. The fingerprint is still that of the whole template.
  • In tokenizer_config.json, the template named default is the default template, and two entries with the same name, or a nameless entry whose position equals another name, no longer replace each other. The Transformers library uses the last entry of a repeated name, and other runtimes may use the first, so every entry named default or tool_use is always analyzed, up to 4 entries for each name. For a name with more entries, the first 3 and the last one are analyzed, and the entries in between count against the limits for the other templates.
  • The scan of a repository and of a directory reads the files additional_chat_templates/<name>.jinja, which version 5 of the Transformers library loads as named templates. The files default.jinja and file.jinja set the default template in that library, and llama.cpp asks for tool_use, so these three files are always read. Of the other files, at most 16 are read, and a folder with more files gets the finding too_many_chat_templates. Their findings name the key chat_template.<name>, or chat_template for default.jinja and file.jinja. Only regular files are read, so a directory named x.jinja is skipped, and a file in the folder that is also found by the directory scan is scanned once.
  • A local file that is not a regular file, such as a symbolic link to /dev/zero or a named pipe, gives ERROR in scan, compare-template and sanitize, and does not exhaust memory or wait forever. A .jinja template file is read up to 4 MiB, and a JSON template file up to 16 MiB, in a local scan and in a scan of a repository alike. A longer file gets the finding chat_template_too_large and the verdict SUSPICIOUS, so a payload after the limit is not reported as CLEAN. The list file of scan -l, the replacement template of sanitize and a local base file of compare-template are read only if they are regular files, so a named pipe gives an error and does not wait forever. Files are opened in binary mode on Windows, and the tests run on Windows in CI.
  • tests/test_performance.py has scan-time tests for a file with many metadata entries and named templates, a file with a tensor section of 48 MB and templates at and beyond the limits. The tests of the limits compare a scan with the limits to a scan without them. The other tests use bounds that are several times the time on a development machine.
  • The reading of a template list or mapping in a JSON file is bounded. Only the first three and the last entry named default, the first three and the last entry named tool_use, and the first 16 other entries are kept, and all other entries are counted in one too_many_chat_templates finding without storing their text. The time to read such a file grows in proportion to the number of entries. The JSON limit is 16 MiB, because 16 MiB of small objects need about 500 MB of memory while they are parsed.

Full changelog: v0.1.4...v0.1.5

gguf-radar 0.1.4

Choose a tag to compare

@github-actions github-actions released this 29 Nov 13:52
9145f17

What's Changed

  • Inspect zero-scale blocks of the IQ formats by @myamada9999 in #14
  • Develop on dev and keep main for releases by @Root0ne in #15
  • Take the unreleased IQ zero-scale checks off main by @Root0ne in #19
  • Build releases in a workflow and pin the actions to commit hashes by @Root0ne in #18
  • Bound the memory of the IQ zero-scale checks and close their gaps by @Root0ne in #16
  • Recognise network redirection, alternate data streams and registry changes in templates by @Root0ne in #17
  • Release 0.1.4 by @Root0ne in #20
  • Release 0.1.4 by @Root0ne in #22

New Contributors

Full Changelog: v0.1.3...v0.1.4

gguf-radar 0.1.3

Choose a tag to compare

@Root0ne Root0ne released this 28 Nov 21:01
4e10c41

This release fixes two security problems in scan, makes the template check recognise templates that download their payload, and adds the compare-template command.

Upgrade with:

pip install --upgrade git+https://github.com/Root0ne/gguf-radar@v0.1.3

Added

  • The compare-template command compares the chat template of a GGUF file or of a Hugging Face repository with the template of the original model, without depending on attack patterns. The original model must be named with --base, because the metadata of a file cannot vouch for itself. It reports IDENTICAL, OLDER or DIFFERENT, prints a diff and the findings of the template check for both sides, and exits with 0, 2 or 1. OLDER means that the template equals an earlier revision of the base. The command reads every GGUF file of a repository, repeats failed requests and writes control characters of the model file in a visible form. Comparing a chat template with the original model describes it.
  • A check against clean public models. scripts/check_clean_models.py scans 19 pinned Hugging Face repositories without a download and 7 pinned GGUF files that it downloads completely, and it fails if any of them is not CLEAN. The Clean models workflow runs it every week and in pull requests that change src/. Contributing describes how to run it.

Security

  • The template check recognises templates that download their payload from another host. Commands such as iwr, irm, certutil -urlcache, bitsadmin /transfer, mshta, curl -o and wget -O, and text that is piped into a shell or a script interpreter, now give MALICIOUS. Before, several of these forms gave only SUSPICIOUS because of the web address, and a command without http:// could pass as CLEAN.
  • scan checks every GGUF file in a Hugging Face repository. Before, it skipped files named like the second or third part of a split model, so a file could be hidden from the scan by its name.
  • Text from model files and repositories is written with control characters in a visible form in the output of scan, sanitize and compare-template. A file name, a template or a metadata value could contain escape sequences that changed what the terminal showed. The JSON reports escape all non-ASCII characters.

Changed

  • --max-files of scan has no limit by default. When a limit leaves files out, the output and the JSON report list them, and the repository is reported as ERROR and not as CLEAN.

Fixed

  • A chat template that uses the generation, break or continue tag is no longer reported as SUSPICIOUS for a syntax error. These tags belong to the Jinja2 setup of the Transformers library, and real templates use them. The model ggml-org/SmolLM3-3B-GGUF was affected. Everything inside a generation tag is still inspected.

gguf-radar 0.1.2

Choose a tag to compare

@Root0ne Root0ne released this 28 Nov 17:48
7f911b9

This release checks every tensor and six more block types for hidden data in zero-scale blocks, and it fixes a false positive in the readable text check.

Upgrade with:

pip install --upgrade git+https://github.com/Root0ne/gguf-radar@v0.1.2

Added

  • Zero-scale blocks are now checked and cleaned in Q4_0, Q5_0, Q2_K, Q3_K, Q5_K and Q6_K tensors, as well as in Q8_0 and Q4_K tensors. File signatures and readable text are looked for in all of them. The flatness test is used for Q2_K, Q3_K, Q4_0 and Q6_K, where real quantizer output was measured to be clearly apart from random bytes. It is not used for Q5_K and Q5_0, where it was not.
  • In Q2_K, Q4_K and Q5_K, a block with a zero d and a non-zero dmin is now counted, checked and cleaned. Its values are unused, and in a test model with very small weights most of the affected Q4_K blocks were of this kind.

Changed

  • All tensors are scanned for zero-scale bytes. Before, the scan stopped after 128 tensors, so data in a later tensor was not seen. scan_local_gguf and scan_dead_blocks still accept a limit.
  • Tensors are read in pieces of 64 MiB, in the scan and in sanitize, so a tensor of several gigabytes no longer has to fit into memory. A program header or readable text that crosses the border between two pieces is still found, and the report does not depend on the size of the pieces.
  • A scale stored as negative zero is a finding only in Q8_0 and Q4_K. The quantizers of Q4_0, Q5_0, Q3_K and Q6_K write negative zero themselves, so it counts there as an ordinary zero scale.
  • A scan of a local file now reads the whole file, so it takes about as long as reading the file once. Before, most of the weights were skipped.
  • Readable text in zero-scale bytes is reported only when it fills at least 128 bytes in consecutive blocks, uses at least 16 different characters and contains spaces or line breaks in the way that text does. How the checks work lists the conditions. Text with few or no spaces, such as Base64 data, is no longer reported as text, except in a Q8_0 block that the quantizer cannot have written.
  • A tensor with more MZ markers than the scan can follow is reported as holding an excessive number of Windows program markers.
  • sanitize no longer scans the zero-scale blocks of the input a second time. It reads each tensor once.

Fixed

  • A clean Q4_K model is no longer reported as MALICIOUS because its leftover bytes look like text. This happened in 0.1.1 with a real quantizer run on a tensor that held a tight group of very small positive weights and a few larger ones.
  • A Windows program hidden in zero-scale bytes is now found even when many MZ byte pairs that are not programs come before it.

gguf-radar 0.1.1

Choose a tag to compare

@Root0ne Root0ne released this 28 Nov 13:46
d856e4a

This release fixes a false positive.

Fixed

  • Clean models are no longer reported as MALICIOUS because of bytes under zero scales. The quantizer leaves such bytes behind when a very small scale rounds to zero, which happens in models with pruned, untrained or very small weights. These blocks are now counted and shown as a note, and they do not change the verdict. Thanks to @zachisfine for the report and the analysis in #1.

Changed

  • Zero-scale bytes now give MALICIOUS only when they contain a known file signature or readable text. They give SUSPICIOUS when a Q8_0 block cannot have been written by the quantizer or when a stretch of 4096 bytes is as flat as encrypted data.
  • The JSON report has the new fields zero_scale_data_blocks, zero_scale_content and zero_scale_tensors. The field dead_block_payloads now counts only the blocks whose bytes do not look like quantizer output.
  • sanitize is unchanged. It still clears every zero-scale byte.

The documentation explains the checks in How the checks work and their limits in Limitations.

Upgrade

pip install --upgrade git+https://github.com/Root0ne/gguf-radar@v0.1.1

gguf-radar 0.1.0

Choose a tag to compare

@Root0ne Root0ne released this 27 Nov 16:43

First release.

GGUF Radar finds poisoned chat templates and hidden payloads in LLM models without running them. It checks local .gguf files, Hugging Face model links (reading only the header and the end of each file through HTTP Range requests) and the chat template files of Safetensors and PyTorch models. The sanitize command rebuilds a clean GGUF file with the weights unchanged.

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