# Weak Password Requirements (CWE-521) The product does not require that users should have strong passwords, which makes it easier for attackers to compromise user accounts. **Stack:** Go - Prevalence: 高 频繁被利用 - Impact: 高 1 条严重级别为高的规则 - Prevention: 已记录 2 个修复示例 **OWASP:** Identification and Authentication Failures (A07:2021-Identification and Authentication Failures) - #7 ## Description Without strong password requirements, users often choose weak, easily guessable passwords. This makes brute-force and dictionary attacks more likely to succeed. ## Prevention 基于 1 条 Shoulder 检测规则的 Weak Password Requirements 预防策略。 ### Go Enforce minimum 12-character passwords with complexity requirements ## Consequences - 获取权限 - 绕过保护机制 ## Mitigations - 强制最小密码长度 (推荐 12 个或以上字符) - 将密码与已知泄露数据库进行比对 - 实施多因素身份验证 ## Detection - Total rules: 2 - Languages: go, javascript, typescript ## Rules by Language ### Go (1 rules) - **Weak Password Policy** [MEDIUM]: Password validation requires fewer than 8 characters. - Remediation: Enforce minimum password length of 12+ characters with complexity requirements. ```go func validatePassword(password string) error { if len(password) < 12 { return errors.New("password must be at least 12 characters") } // Add complexity checks: uppercase, lowercase, digit, special char return nil } ``` Learn more: https://shoulder.dev/learn/go/cwe-521/weak-password-policy