π° Originally published on Securityelites β AI Red Team Education β the canonical, fully-updated version of this article.
π€ AI/LLM HACKING COURSE
FREE
Part of the AI/LLM Hacking Course β 90 Days
Day 28 of 90 Β· 31.1% complete
β οΈ Authorised Targets Only: Adversarial ML attacks testing against deployed content moderation systems, toxicity classifiers, and safety filters must only be performed against authorised targets. Testing content moderation bypass can generate content that violates platform terms of service even in a testing context β agree explicit content handling procedures with the engagement contact before starting.
Every content moderation system Iβve tested has had a unicode gap. Not every system, actually β let me be more precise. Every content moderation system Iβve tested has had a gap somewhere in the coverage between direct blocked terms and the full semantic space of what it was trained to block. Sometimes the gap is unicode. Sometimes itβs paraphrase. Sometimes itβs context shift. The gap is always there because classifiers are trained on finite datasets against a semantically infinite attack surface.
Adversarial ML attacks operate at a different layer than everything else in this course. Prompt injection, jailbreaking, extraction β those target the modelβs behaviour via its context. Adversarial ML targets the modelβs perception: crafting inputs that the model classifies incorrectly because they fall in a region the training data didnβt adequately cover. The distinction matters for understanding what youβre testing. Youβre not trying to convince the model to do something different. Youβre trying to find inputs the model perceives differently than a human would. The gap between human perception and model perception is the attack surface. Day 28 maps it.
Have you tested a content moderation or safety classifier for adversarial bypass?
No β I didnβt know this was a testable vulnerability Basic β Iβve tried homoglyphs or simple substitution Systematic β I probe the decision boundary methodically Full methodology β probing + perturbation + semantic reframing
π― What Youβll Master in Day 28
Understand the adversarial ML attack surface for LLMs and safety classifiers
Apply homoglyph and unicode substitution to bypass tokenizer-based classification
Use zero-width character insertion to split token sequences
Apply semantic reframing and paraphrase attacks against coverage-limited classifiers
Run systematic black-box probing to map a classifierβs decision boundary
Test LLM robustness against adversarial inputs in image and multimodal contexts
β±οΈ Day 28 Β· 3 exercises Β· Kali Terminal + Think Like Hacker + Kali Terminal ### β Prerequisites - Day 2 β How LLMs Work β tokenisation is central to understanding why homoglyph attacks work; the tokenizer section from Day 2 is prerequisite - Day 15 β AI Jailbreaking β the distinction between jailbreaking (behavioural) and adversarial ML (perceptual) becomes clearer with Day 15βs content as context - Python with unicodedata and requests installed β Exercise 1 builds the automated perturbation testing toolkit ### π Adversarial ML Attacks β Day 28 Contents 1. The Adversarial Attack Surface for LLMs 2. Homoglyph and Unicode Substitution Attacks 3. Zero-Width Character Insertion 4. Semantic Reframing and Paraphrase Attacks 5. Black-Box Decision Boundary Probing 6. Reporting Adversarial Robustness Findings In Day 27 you built the engagement operational methodology. Day 28 covers a specific attack family that sits alongside but distinct from the injection and extraction techniques of Phase 2 and 3 β adversarial ML attacks on the modelβs classification and perception layer. Day 29 covers enterprise AI security β the specific attack surfaces that emerge in LangChain, LlamaIndex, and enterprise AI gateway deployments.
The Adversarial Attack Surface for LLMs
LLM deployments typically include at least one classifier β a content moderation system, a toxicity filter, a safety classifier, or a query router β that sits either before or after the main language model. These classifiers are separate models, trained on separate datasets, and they have their own adversarial attack surfaces that are independent of the main LLMβs prompt injection vulnerabilities.
The adversarial attack surface for a classifier is defined by the gap between its training distribution and the space of possible inputs. Classifiers are trained on finite examples. The space of all possible text inputs is infinite. Adversarial attacks craft inputs that fall in the uncovered regions β the parts of the input space where the classifierβs training didnβt provide adequate coverage. These inputs look valid to humans but land outside the classifierβs learned decision boundary, producing incorrect classifications.
Homoglyph and Unicode Substitution Attacks
Homoglyphs are Unicode characters that look identical or near-identical to other characters in common fonts. βaβ (U+0061, Latin) and βΠ°β (U+0430, Cyrillic) are visually indistinguishable in most display contexts. A tokenizer processes them as completely different tokens. A safety classifier trained on the Latin character set may not match the Cyrillic version β the pattern it learned to detect is a specific sequence of token IDs, and different Unicode code points produce different token IDs even when the visual representation is identical.
HOMOGLYPH SUBSTITUTION β AUTOMATED GENERATIONCopy
Python: generate homoglyph variants of a target string
import unicodedata
Common Latin β Cyrillic / Greek homoglyphs
HOMOGLYPHS = {
βaβ: [βΠ°β, βΙβ, βΞ±β], # Cyrillic Π°, Latin alpha, Greek alpha
βeβ: [βΠ΅β, βΡβ, βΞ΅β], # Cyrillic Π΅, Cyrillic Ρ, Greek epsilon
βoβ: [βΠΎβ, βΞΏβ, β0β], # Cyrillic ΠΎ, Greek omicron, digit zero
βcβ: [βΡβ, βΟ²β], # Cyrillic Ρ, Greek lunate sigma
βpβ: [βΡβ, βΟβ], # Cyrillic Ρ, Greek rho
βxβ: [βΡ
β, βΟβ], # Cyrillic Ρ
, Greek chi
βiβ: [βΡβ, βΞΉβ, β1β], # Cyrillic Ρ, Greek iota, digit one
}
π Read the complete guide on Securityelites β AI Red Team Education
This article continues with deeper technical detail, screenshots, code samples, and an interactive lab walk-through. Read the full article on Securityelites β AI Red Team Education β
This article was originally written and published by the Securityelites β AI Red Team Education team. For more cybersecurity tutorials, ethical hacking guides, and CTF walk-throughs, visit Securityelites β AI Red Team Education.

Top comments (0)