# Improper Handling of Unicode Encoding (CWE-176) The product does not properly handle when an input contains Unicode encoding. **Stack:** Go - Prevalence: 中 3 言語をカバー - Impact: ミディアム レビュー推奨 - Prevention: 文書化済み 3 件の修正例 **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 1 件の Shoulder 検出ルールに基づく Improper Handling of Unicode の予防策。 ### Go Normalize strings with NFKC before security-sensitive comparisons ## Consequences - 保護メカニズムの回避 - 未承認コードの実行 ## Mitigations - 処理前に Unicode 入力を正規形に正規化する - Unicode 正規化の後にセキュリティチェックを適用する - Unicode を考慮した比較関数を使用する ## 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