# Cleartext Storage of Sensitive Information in an Environment Variable (CWE-526) The product uses environment variables to store sensitive information, but the environment is accessible to other processes or users. - Prevalence: Media 1 lenguajes cubiertos - Impact: Alto 1 reglas de severidad alta - Prevention: Documentada 1 ejemplos de corrección **OWASP:** Security Misconfiguration (A05:2021-Security Misconfiguration) - #5 ## Description Environment variables are often visible to child processes and may be logged or exposed through error messages. Storing sensitive information like credentials in environment variables can lead to information disclosure. ## Prevention ### Go Never log or expose environment variables containing secrets ## Consequences - Leer datos de la aplicación - Obtener privilegios ## Mitigations - Usa sistemas dedicados de gestión de secretos - Cifra los valores sensibles antes de almacenarlos en variables de entorno - Limita el acceso al entorno del proceso ## Detection - Total rules: 1 - Languages: go ## Rules by Language ### Go (1 rules) - **Environment Variable Exposure** [HIGH]: Environment variables logged or included in HTTP responses. - Remediation: Use environment variables for configuration only, never log or expose them. ```go dbURL := os.Getenv("DATABASE_URL") // Use dbURL for connection only // Never log it: log.Printf("DB: %s", dbURL) // Wrong! ``` Learn more: https://shoulder.dev/learn/go/cwe-526/env-var-exposure