feat(probes): add Mathematical Bold encoding probe (#152)#1982
Conversation
Signed-off-by: L0K10D1NS0N <karimgohary.gohary@gmail.com>
|
Can you provide any information on how this has been tested? The project needs to validate that the technique works, preferably against some live target, even if it is a minimal system. Something the team can reproduce is preferred. We would like to see some clear documentation of how this adds signal and its degree of practicality to understand if deployments are likely to need to be evaluated using this method. A small survey of a few recent targets may help establish the value from this probe. |
|
Thanks for the review! I've run the probe against live targets and documented the signal below. The InjectMathBold probe tests a critical vulnerability path: Unicode normalization discrepancies between safety guardrails and the LLM itself, as many lightweight prompt filters, WAFs, and embedding-based classifiers operate strictly on standard ASCII. They often fail to perform NFKC/NFKD Unicode normalization before scanning. also modern LLMs are trained on vast internet text and can perfectly read Mathematical Bold Unicode (e.g., 𝐀 instead of A) as regular English text. This probe evaluates whether a deployment's defense-in-depth architecture properly normalizes user input. If an application relies on basic blocklists or ASCII-only filters, this probe will successfully smuggle payloads to the LLM. I've successfully tested against two live hugging face models:
commands to reproduce: Minimal systempython3 -m garak --model_type huggingface --model_name sshleifer/tiny-gpt2 --probes encoding.InjectMathBoldFull GPT-2python3 -m garak --model_type huggingface --model_name gpt2 --probes encoding.InjectMathBold
The more capable model partially processed and echoed the Mathematical Bold payloads, demonstrating the probe captures real behavioral variance. This confirms the probe adds practical signal. more capable models are more likely to comprehend and reflect Unicode-encoded content, which is precisely the bypass vector this tests. Deployments relying on ASCII-only input filtering would be blind to this. |
Adds a new
InjectMathBoldprobe togarak.probes.encodingto fulfill the Mathematical Bold encoding request in #152.This probe maps standard ASCII characters (
A-Z,a-z,0-9) to their Mathematical Bold Unicode equivalents using pure Python string manipulation (ord()/chr()). It inherits fromEncodingMixinandgarak.probes.Probeto seamlessly transform prompts before dispatching.Transparency Statement: Developed with AI agent assistance and verified locally via dry-run execution.
Please ensure you are submitting from a unique branch in your repository to
mainupstream.Verification
List the steps needed to make sure this thing works
Supporting configuration such as generator configuration filepython3 -m garak --model_type test --model_name Blank --probes encoding.InjectMathBoldpython -m pytest tests/probes/test_probes_encoding.pyexceptblocks, no default docstring values)