# Insecure Defaults Detection
<!--
ref: @skills/insecure-defaults
tags: [security, configuration, secrets, fail-open, audit]
triggers: [application runs with weak secrets, hardcoded credentials found, production config missing]
trigger_prompt: When conducting a security audit or reviewing deployment configurations, especially if there are concerns about default settings or hardcoded secrets.
category: security
version: 1
updated_at: 2026-07-11T14:24:01.465Z
-->
Finds **fail-open** vulnerabilities where applications run insecurely when configuration is missing, and distinguishes them from fail-secure patterns that crash safely.
- **Fail-open (CRITICAL):** `SECRET = env.get('KEY') or 'default'` → app runs with a weak secret
- **Fail-secure (SAFE):** `SECRET = env['KEY']` → app crashes if missing
## When to use
Security audits of production applications (auth, crypto, API security); configuration review of deployment files, IaC templates, Docker configs; code review of env-var handling and secrets management; pre-deployment checks for hardcoded credentials.
**Not for:** test fixtures scoped to test environments (`test/`, `spec/`, `__tests__/`); `.example`/`.template`/`.sample` files; development-only tooling; documentation examples; build-time config replaced at deployment; crash-on-missing (fail-secure) behavior. When in doubt: trace the code path to determine whether the app runs with the default or crashes.
## Rationalizations to reject
- "It's just a development default" → if it reaches production code, it's a finding
- "The production config overrides it" → verify the prod config exists; the code-level vulnerability remains if not
- "This would never run without proper config" → prove it with a code trace; many apps fail silently
- "It's behind authentication" → defense in depth; a compromised session still exploits weak defaults
- "We'll fix it before release" → document now; "later" rarely comes
## Workflow (per potential finding)
**1. SEARCH — project discovery, then pattern hunt.** Determine language, framework, and conventions; from those, locate secret storage, secret usage, credentialed integrations, and crypto. Search `**/config/`, `**/auth/`, `**/database/`, and env files for:
- Fallback secrets: `getenv.*\) or ['"]` · `process\.env\.[A-Z_]+ \|\| ['"]` · `ENV\.fetch.*default:`
- Hardcoded credentials: `password.*=.*['"][^'"]{8,}['"]` · `api[_-]?key.*=.*['"][^'"]+['"]`
- Weak defaults: `DEBUG.*=.*true` · `AUTH.*=.*false` · `CORS.*=.*\*`
- Crypto: `MD5|SHA1|DES|RC4|ECB` in security contexts
Focus on production-reachable code, not fixtures or examples.
**2. VERIFY — actual behavior.** Trace the code path: when does this execute (startup vs runtime)? What happens if the variable is missing? Is there validation enforcing secure configuration?
**3. CONFIRM — production impact.** Production config provides the variable → lower severity (still a code-level vulnerability). Production config missing or using the default → CRITICAL.
**4. REPORT — with evidence.** Example shape:
```
Finding: Hardcoded JWT Secret Fallback
Location: src/auth/jwt.ts:15
Pattern: const secret = process.env.JWT_SECRET || 'default';
Verification: app starts without JWT_SECRET; secret used in jwt.sign() at line 42
Production Impact: Dockerfile missing JWT_SECRET
Exploitation: attacker forges JWTs using 'default', gains unauthorized access
```
## Quick verification checklist
| Pattern | Verify | Skip |
|---------|--------|------|
| Fallback secret `SECRET = env.get(X) or Y` | App starts without the env var? Secret used in crypto/auth? | Test fixtures, example files |
| Default credentials (hardcoded user/password) | Active in deployed config? No runtime override? | Disabled accounts, doc examples |
| Fail-open toggle `AUTH_REQUIRED = env.get(X, 'false')` | Default is insecure (false/disabled/permissive)? | App crashes, or default is secure |
| Weak crypto (MD5/SHA1/DES/RC4/ECB) | Used for passwords, encryption, or tokens? | Checksums, non-security hashing |
| Permissive access (CORS `*`, `0777`, public-by-default) | Default allows unauthorized access? | Explicitly configured with justification |
| Debug features (stack traces, introspection) | Enabled by default? Exposed in responses? | Logging-only, not user-facing |
---
**Source:** [insecure-defaults](https://github.com/trailofbits/skills/blob/main/plugins/insecure-defaults/skills/insecure-defaults/SKILL.md) — Trail of Bits skills, CC-BY-SA-4.0. Bundled `references/examples.md` (detailed examples and counter-examples) listed-and-linked at source, not harvested.
**Converted via:** `@protocol/skill-to-protocol`
---
*Related: `@content/web/github/2026-11-29-convex-backend-skill-issue-64` · `@protocol/groom-protocols` · `@content/youtube/tiago-forte/i-connected-claude-to-everything-then-i-saw-the-gap` · `@content/youtube/indy-dev-dan/mac-mini-agents-openclaw-is-a-nightmare-use-these-skills-instead` · `@content/youtube/cole-medin/your-ai-second-brain-is-slowly-rotting-here-s-how-to-fix-it`*
---
*You're reading a protocol on [protocol.supply](https://protocol.supply) — hosted, searchable knowledge for AI agents. Think Agent Skills, as an API: bootstrap once (`curl -sL https://api.protocol.supply/bootstrap`), search (`/search?q=…`), fetch (`/@repo/slug`).*
*Any skill can become a protocol, and any protocol installs as a local skill — tell your agent "install this as a skill" or see [`@protocol/protocol-to-skill`](https://api.protocol.supply/@protocol/protocol-to-skill).*