# Active Debug Code (CWE-489) The product is deployed to unauthorized actors with debugging code still enabled or active, which can create unintended entry points or information leaks. **Stack:** Go - Prevalence: Alta Frecuentemente explotada - Impact: Crítico 1 reglas de severidad crítica - Prevention: Documentada 6 ejemplos de corrección **OWASP:** Security Misconfiguration (A05:2021-Security Misconfiguration) - #5 ## Description Debug code is often written to allow easier testing and debugging. This code is not intended to be shipped to production but is sometimes inadvertently left in the product. Debug code often exposes information about the product's internal structure or creates additional attack surface. ## Prevention Estrategias de prevención para Active Debug Code basadas en 3 reglas de detección de Shoulder. ### Go Disable Echo debug mode in production to prevent stack trace exposure Disable Fiber debug output and route printing in production Set Gin to release mode in production to suppress debug output ## Consequences - Leer datos de la aplicación - Eludir mecanismo de protección - Ejecutar código no autorizado ## Mitigations - Elimina el código de depuración antes de desplegar el producto en producción - Usa configuraciones de build que excluyan automáticamente el código de depuración de las compilaciones de producción - Audita el código en busca de endpoints de depuración y puertas traseras antes del lanzamiento ## Detection - Total rules: 6 - Critical: 1 - Languages: python, go, javascript, typescript ## Rules by Language ### Go (3 rules) - **Echo Debug Mode in Production** [MEDIUM]: Echo debug mode exposes stack traces and verbose errors in production. - Remediation: Disable debug mode in production. ```go e := echo.New() e.Debug = false ``` Learn more: https://shoulder.dev/learn/go/cwe-489/debug-mode - **Fiber Debug Mode in Production** [MEDIUM]: Fiber debug configuration exposes route structure and stack traces. - Remediation: Use production configuration to disable debug output. ```go app := fiber.New(fiber.Config{ DisableStartupMessage: true, EnablePrintRoutes: false, }) ``` Learn more: https://shoulder.dev/learn/go/cwe-489/debug-mode - **Gin Debug Mode in Production** [MEDIUM]: Gin debug mode exposes routing info and verbose errors in production. - Remediation: Set release mode before creating the router. ```go gin.SetMode(gin.ReleaseMode) r := gin.Default() ``` Learn more: https://shoulder.dev/learn/go/cwe-489/debug-mode