# Improper Handling of Unicode Encoding (CWE-176) The product does not properly handle when an input contains Unicode encoding. **Stack:** Go - Prevalence: Mittel 3 Sprachen abgedeckt - Impact: Mittel Review empfohlen - Prevention: Dokumentiert 3 Fix-Beispiele **OWASP:** Injection (A03:2021-Injection) - #3 ## Description Unicode characters can have multiple encodings or representations. If an application does not properly handle Unicode, attackers may be able to bypass security filters or cause unexpected behavior using alternate encodings. ## Prevention Präventionsstrategien für Improper Handling of Unicode basierend auf 1 Shoulder-Erkennungsregeln. ### Go Normalize strings with NFKC before security-sensitive comparisons ## Consequences - Schutzmechanismus umgehen - Nicht autorisierten Code ausführen ## Mitigations - Unicode-Eingaben vor der Verarbeitung in eine kanonische Form normalisieren - Sicherheitsprüfungen erst nach der Unicode-Normalisierung anwenden - Verwende Vergleichsfunktionen, die Unicode korrekt behandeln ## Detection - Total rules: 3 - Languages: go, javascript, typescript, python ## Rules by Language ### Go (1 rules) - **Unicode Normalization Security Issues** [MEDIUM]: Security-sensitive string comparison without Unicode normalization. - Remediation: Normalize strings with NFKC before security-sensitive comparisons. ```go import "golang.org/x/text/unicode/norm" func isAdmin(username string) bool { normalized := norm.NFKC.String(strings.ToLower(username)) return normalized == "admin" } ``` Learn more: https://shoulder.dev/learn/go/cwe-176/unicode-normalization