@jgamaraalv/ts-dev-kit 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +24 -0
- package/.claude-plugin/plugin.json +24 -0
- package/CHANGELOG.md +24 -0
- package/LICENSE +21 -0
- package/README.md +128 -0
- package/agents/accessibility-pro.md +139 -0
- package/agents/api-builder.md +110 -0
- package/agents/code-reviewer.md +190 -0
- package/agents/database-expert.md +138 -0
- package/agents/debugger.md +241 -0
- package/agents/docker-expert.md +51 -0
- package/agents/multi-agent-coordinator.md +378 -0
- package/agents/nextjs-expert.md +136 -0
- package/agents/performance-engineer.md +138 -0
- package/agents/playwright-expert.md +126 -0
- package/agents/react-specialist.md +97 -0
- package/agents/security-scanner.md +105 -0
- package/agents/test-generator.md +221 -0
- package/agents/typescript-pro.md +253 -0
- package/agents/ux-optimizer.md +93 -0
- package/docs/rules/orchestration.md.template +126 -0
- package/package.json +28 -0
- package/skills/bullmq/SKILL.md +225 -0
- package/skills/bullmq/references/flows-and-schedulers.md +186 -0
- package/skills/bullmq/references/job-types-and-options.md +163 -0
- package/skills/bullmq/references/patterns.md +273 -0
- package/skills/bullmq/references/production.md +308 -0
- package/skills/composition-patterns/SKILL.md +58 -0
- package/skills/composition-patterns/references/architecture-avoid-boolean-props.md +87 -0
- package/skills/composition-patterns/references/architecture-compound-components.md +107 -0
- package/skills/composition-patterns/references/patterns-children-over-render-props.md +77 -0
- package/skills/composition-patterns/references/patterns-explicit-variants.md +87 -0
- package/skills/composition-patterns/references/react19-no-forwardref.md +37 -0
- package/skills/composition-patterns/references/state-context-interface.md +194 -0
- package/skills/composition-patterns/references/state-decouple-implementation.md +96 -0
- package/skills/composition-patterns/references/state-lift-state.md +126 -0
- package/skills/conventional-commits/SKILL.md +148 -0
- package/skills/docker/SKILL.md +55 -0
- package/skills/docker/references/compose-configs.md +95 -0
- package/skills/docker/references/monorepo-dockerfile.md +111 -0
- package/skills/drizzle-pg/SKILL.md +202 -0
- package/skills/drizzle-pg/references/advanced.md +299 -0
- package/skills/drizzle-pg/references/migrations.md +214 -0
- package/skills/drizzle-pg/references/queries.md +321 -0
- package/skills/drizzle-pg/references/relations.md +272 -0
- package/skills/drizzle-pg/references/schema-pg.md +256 -0
- package/skills/drizzle-pg/references/sql-operator.md +215 -0
- package/skills/fastify-best-practices/SKILL.md +143 -0
- package/skills/fastify-best-practices/references/hooks-and-lifecycle.md +122 -0
- package/skills/fastify-best-practices/references/plugins-and-encapsulation.md +137 -0
- package/skills/fastify-best-practices/references/request-reply-errors.md +189 -0
- package/skills/fastify-best-practices/references/routes-and-handlers.md +134 -0
- package/skills/fastify-best-practices/references/server-and-options.md +127 -0
- package/skills/fastify-best-practices/references/typescript-and-logging.md +223 -0
- package/skills/fastify-best-practices/references/validation-and-serialization.md +190 -0
- package/skills/ioredis/SKILL.md +51 -0
- package/skills/ioredis/references/advanced-patterns.md +312 -0
- package/skills/ioredis/references/cluster-sentinel.md +280 -0
- package/skills/ioredis/references/connection-options.md +187 -0
- package/skills/ioredis/references/core-api.md +179 -0
- package/skills/nextjs-best-practices/SKILL.md +194 -0
- package/skills/nextjs-best-practices/references/async-patterns.md +84 -0
- package/skills/nextjs-best-practices/references/bundling.md +192 -0
- package/skills/nextjs-best-practices/references/data-patterns.md +310 -0
- package/skills/nextjs-best-practices/references/debug-tricks.md +127 -0
- package/skills/nextjs-best-practices/references/directives.md +74 -0
- package/skills/nextjs-best-practices/references/error-handling.md +237 -0
- package/skills/nextjs-best-practices/references/file-conventions.md +152 -0
- package/skills/nextjs-best-practices/references/font.md +175 -0
- package/skills/nextjs-best-practices/references/functions.md +116 -0
- package/skills/nextjs-best-practices/references/hydration-error.md +86 -0
- package/skills/nextjs-best-practices/references/image.md +184 -0
- package/skills/nextjs-best-practices/references/metadata.md +305 -0
- package/skills/nextjs-best-practices/references/parallel-routes.md +299 -0
- package/skills/nextjs-best-practices/references/route-handlers.md +154 -0
- package/skills/nextjs-best-practices/references/rsc-boundaries.md +168 -0
- package/skills/nextjs-best-practices/references/runtime-selection.md +40 -0
- package/skills/nextjs-best-practices/references/scripts.md +148 -0
- package/skills/nextjs-best-practices/references/self-hosting.md +210 -0
- package/skills/nextjs-best-practices/references/suspense-boundaries.md +67 -0
- package/skills/owasp-security-review/SKILL.md +98 -0
- package/skills/owasp-security-review/references/a01-broken-access-control.md +78 -0
- package/skills/owasp-security-review/references/a02-security-misconfiguration.md +81 -0
- package/skills/owasp-security-review/references/a03-supply-chain-failures.md +65 -0
- package/skills/owasp-security-review/references/a04-cryptographic-failures.md +82 -0
- package/skills/owasp-security-review/references/a05-injection.md +106 -0
- package/skills/owasp-security-review/references/a06-insecure-design.md +76 -0
- package/skills/owasp-security-review/references/a07-authentication-failures.md +83 -0
- package/skills/owasp-security-review/references/a08-integrity-failures.md +72 -0
- package/skills/owasp-security-review/references/a09-logging-alerting-failures.md +76 -0
- package/skills/owasp-security-review/references/a10-exceptional-conditions.md +131 -0
- package/skills/postgresql/SKILL.md +50 -0
- package/skills/postgresql/references/ddl-schema.md +300 -0
- package/skills/postgresql/references/indexes.md +257 -0
- package/skills/postgresql/references/jsonb.md +261 -0
- package/skills/postgresql/references/performance.md +291 -0
- package/skills/postgresql/references/psql-cli.md +153 -0
- package/skills/postgresql/references/queries.md +287 -0
- package/skills/postgresql/references/transactions.md +280 -0
- package/skills/react-best-practices/SKILL.md +110 -0
- package/skills/react-best-practices/references/advanced-patterns.md +91 -0
- package/skills/react-best-practices/references/async-patterns.md +233 -0
- package/skills/react-best-practices/references/bundle-optimization.md +201 -0
- package/skills/react-best-practices/references/client-patterns.md +178 -0
- package/skills/react-best-practices/references/js-performance.md +210 -0
- package/skills/react-best-practices/references/rendering-performance.md +209 -0
- package/skills/react-best-practices/references/rerender-optimization.md +316 -0
- package/skills/react-best-practices/references/server-performance.md +274 -0
- package/skills/service-worker/SKILL.md +195 -0
- package/skills/service-worker/references/api-reference.md +114 -0
- package/skills/service-worker/references/caching-strategies.md +202 -0
- package/skills/service-worker/references/push-and-sync.md +261 -0
- package/skills/typescript-conventions/SKILL.md +51 -0
- package/skills/ui-ux-guidelines/SKILL.md +105 -0
- package/skills/ui-ux-guidelines/references/accessibility-and-interaction.md +74 -0
- package/skills/ui-ux-guidelines/references/forms-content-checklist.md +126 -0
- package/skills/ui-ux-guidelines/references/layout-typography-animation.md +95 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# A03:2025 Software Supply Chain Failures
|
|
2
|
+
|
|
3
|
+
Expanded from "Vulnerable and Outdated Components". 6 CWEs, 5.72% avg incidence. Highest average exploit (8.17) and impact (5.23) scores.
|
|
4
|
+
|
|
5
|
+
## What to look for
|
|
6
|
+
|
|
7
|
+
**Vulnerable dependencies:**
|
|
8
|
+
|
|
9
|
+
- Outdated packages with known CVEs (check `package.json`, `requirements.txt`, `Gemfile`, etc.)
|
|
10
|
+
- No lock file (`yarn.lock`, `package-lock.json`) — versions unpinned
|
|
11
|
+
- Lock file not committed to version control
|
|
12
|
+
- No automated vulnerability scanning (Dependabot, Snyk, npm audit, etc.)
|
|
13
|
+
- Transitive dependencies with known vulnerabilities
|
|
14
|
+
|
|
15
|
+
**Untrusted sources:**
|
|
16
|
+
|
|
17
|
+
- Packages installed from unofficial registries or URLs
|
|
18
|
+
- Git dependencies pointing to forks or unknown repos
|
|
19
|
+
- Unsigned packages or missing integrity hashes
|
|
20
|
+
- `.npmrc` or pip config pointing to non-standard registries
|
|
21
|
+
|
|
22
|
+
**Build pipeline risks:**
|
|
23
|
+
|
|
24
|
+
- CI/CD pipelines without integrity checks
|
|
25
|
+
- Build scripts that `curl | bash` from external URLs
|
|
26
|
+
- No separation of duties (same person writes and deploys code)
|
|
27
|
+
- Secrets in CI config files or build logs
|
|
28
|
+
- Missing branch protection rules
|
|
29
|
+
- No signed commits or artifact signing
|
|
30
|
+
|
|
31
|
+
**Unmaintained components:**
|
|
32
|
+
|
|
33
|
+
- Dependencies with no updates in 2+ years
|
|
34
|
+
- Libraries with known EOL (end of life) status
|
|
35
|
+
- No alternative available for deprecated packages
|
|
36
|
+
|
|
37
|
+
**Post-install scripts:**
|
|
38
|
+
|
|
39
|
+
- npm `postinstall` scripts that execute arbitrary code
|
|
40
|
+
- pip `setup.py` with network calls or system commands
|
|
41
|
+
|
|
42
|
+
## Prevention checklist
|
|
43
|
+
|
|
44
|
+
- [ ] Generate and maintain an SBOM (Software Bill of Materials) — use CycloneDX or SPDX
|
|
45
|
+
- [ ] Track all direct AND transitive dependencies
|
|
46
|
+
- [ ] Run `npm audit` / `yarn audit` / `pip-audit` in CI
|
|
47
|
+
- [ ] Enable Dependabot, Renovate, or similar for automated dependency updates
|
|
48
|
+
- [ ] Pin dependency versions; use lock files; commit lock files
|
|
49
|
+
- [ ] Only use packages from trusted registries with verified publishers
|
|
50
|
+
- [ ] Prefer signed packages; verify checksums
|
|
51
|
+
- [ ] Review and approve dependency updates before merging
|
|
52
|
+
- [ ] Remove unused dependencies to reduce attack surface
|
|
53
|
+
- [ ] Harden CI/CD: enable MFA, lock down IAM, separate duties, sign builds
|
|
54
|
+
- [ ] Use staged rollouts for dependency updates
|
|
55
|
+
- [ ] Monitor CVE databases: NVD, OSV, GitHub Advisory Database
|
|
56
|
+
- [ ] Audit npm postinstall scripts before adding new dependencies
|
|
57
|
+
|
|
58
|
+
## Key CWEs
|
|
59
|
+
|
|
60
|
+
| CWE | Name | Common in |
|
|
61
|
+
| ---- | ------------------------------------------------ | ------------------- |
|
|
62
|
+
| 1104 | Use of Unmaintained Third Party Components | Abandoned libraries |
|
|
63
|
+
| 1395 | Dependency on Vulnerable Third-Party Component | Known CVEs |
|
|
64
|
+
| 1329 | Reliance on Component That is Not Updateable | Locked-in versions |
|
|
65
|
+
| 1357 | Reliance on Insufficiently Trustworthy Component | Unverified sources |
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# A04:2025 Cryptographic Failures
|
|
2
|
+
|
|
3
|
+
32 CWEs, 3.80% avg incidence, 1.6M+ occurrences. Leads to sensitive data exposure or system compromise.
|
|
4
|
+
|
|
5
|
+
## What to look for
|
|
6
|
+
|
|
7
|
+
**Data in transit:**
|
|
8
|
+
|
|
9
|
+
- HTTP used instead of HTTPS
|
|
10
|
+
- Missing HSTS header
|
|
11
|
+
- TLS < 1.2 allowed
|
|
12
|
+
- Weak cipher suites (CBC mode, RC4, DES)
|
|
13
|
+
- Self-signed certificates accepted without validation
|
|
14
|
+
- Certificate chain not validated
|
|
15
|
+
- STARTTLS used instead of implicit TLS
|
|
16
|
+
- FTP, SMTP, or other unencrypted protocols for sensitive data
|
|
17
|
+
|
|
18
|
+
**Data at rest:**
|
|
19
|
+
|
|
20
|
+
- Sensitive data stored in plaintext (passwords, tokens, PII, credit cards)
|
|
21
|
+
- Database columns with sensitive data not encrypted
|
|
22
|
+
- Backups not encrypted
|
|
23
|
+
- Sensitive data in log files
|
|
24
|
+
|
|
25
|
+
**Password storage:**
|
|
26
|
+
|
|
27
|
+
- MD5 or SHA1 used for password hashing
|
|
28
|
+
- Passwords hashed without salt
|
|
29
|
+
- Fast hash functions (SHA-256 without key stretching) for passwords
|
|
30
|
+
- Missing work factor — use Argon2, scrypt, bcrypt, or PBKDF2
|
|
31
|
+
|
|
32
|
+
**Key management:**
|
|
33
|
+
|
|
34
|
+
- Hardcoded encryption keys or API keys in source code
|
|
35
|
+
- Keys committed to version control
|
|
36
|
+
- Keys not rotated
|
|
37
|
+
- Weak key generation (predictable seeds, insufficient entropy)
|
|
38
|
+
- Keys stored in plaintext files
|
|
39
|
+
- Same key used across environments
|
|
40
|
+
|
|
41
|
+
**Weak algorithms:**
|
|
42
|
+
|
|
43
|
+
- MD5, SHA1 for integrity/signatures
|
|
44
|
+
- DES, 3DES, RC4 for encryption
|
|
45
|
+
- RSA without OAEP padding
|
|
46
|
+
- ECB mode for block ciphers
|
|
47
|
+
- `Math.random()` or similar non-CSPRNG for security purposes
|
|
48
|
+
|
|
49
|
+
**Missing encryption:**
|
|
50
|
+
|
|
51
|
+
- Caching of responses containing sensitive data (CDN, Redis, browser)
|
|
52
|
+
- Sensitive data in URL query strings
|
|
53
|
+
- Sensitive data in cookies without encryption
|
|
54
|
+
|
|
55
|
+
## Prevention checklist
|
|
56
|
+
|
|
57
|
+
- [ ] Classify data by sensitivity; apply controls per classification
|
|
58
|
+
- [ ] Encrypt all data in transit with TLS >= 1.2, forward secrecy ciphers
|
|
59
|
+
- [ ] Enable HSTS with `includeSubDomains` and `preload`
|
|
60
|
+
- [ ] Encrypt sensitive data at rest
|
|
61
|
+
- [ ] Hash passwords with Argon2, scrypt, or bcrypt (with appropriate work factor)
|
|
62
|
+
- [ ] Use authenticated encryption (AES-GCM, ChaCha20-Poly1305) — never just encryption
|
|
63
|
+
- [ ] Generate keys with CSPRNG; store in HSM or secrets manager
|
|
64
|
+
- [ ] Rotate keys regularly; never hardcode keys in source
|
|
65
|
+
- [ ] Disable caching for responses with sensitive data
|
|
66
|
+
- [ ] Drop support for TLS < 1.2 and CBC ciphers
|
|
67
|
+
- [ ] Don't store sensitive data unnecessarily; discard when no longer needed
|
|
68
|
+
- [ ] Use `crypto.randomUUID()` or `crypto.getRandomValues()` (Node.js) — never `Math.random()`
|
|
69
|
+
- [ ] Validate server certificates and trust chains
|
|
70
|
+
|
|
71
|
+
## Key CWEs
|
|
72
|
+
|
|
73
|
+
| CWE | Name | Common in |
|
|
74
|
+
| --- | --------------------------------------- | --------------------------- |
|
|
75
|
+
| 327 | Broken or Risky Cryptographic Algorithm | MD5, SHA1, DES usage |
|
|
76
|
+
| 328 | Reversible One-Way Hash | Weak password hashing |
|
|
77
|
+
| 330 | Use of Insufficiently Random Values | Predictable tokens |
|
|
78
|
+
| 338 | Cryptographically Weak PRNG | Math.random() for secrets |
|
|
79
|
+
| 321 | Use of Hard-coded Cryptographic Key | Keys in source code |
|
|
80
|
+
| 319 | Cleartext Transmission | HTTP, unencrypted protocols |
|
|
81
|
+
| 326 | Inadequate Encryption Strength | Short keys, weak ciphers |
|
|
82
|
+
| 916 | Password Hash With Insufficient Effort | Fast hashing for passwords |
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# A05:2025 Injection
|
|
2
|
+
|
|
3
|
+
- [What to look for](#what-to-look-for)
|
|
4
|
+
- [Prevention checklist](#prevention-checklist)
|
|
5
|
+
- [Code patterns](#code-patterns)
|
|
6
|
+
- [Key CWEs](#key-cwes)
|
|
7
|
+
|
|
8
|
+
37 CWEs, 3.08% avg incidence, 1.4M+ occurrences, 62K+ CVEs. Includes XSS (30K+ CVEs) and SQLi (14K+ CVEs).
|
|
9
|
+
|
|
10
|
+
## What to look for
|
|
11
|
+
|
|
12
|
+
**SQL Injection:**
|
|
13
|
+
|
|
14
|
+
- String concatenation in SQL queries: `"SELECT * FROM users WHERE id = " + userId`
|
|
15
|
+
- Template literals in SQL: `` `SELECT * FROM users WHERE id = ${userId}` ``
|
|
16
|
+
- ORM raw queries with user input interpolated
|
|
17
|
+
- Stored procedures that concatenate user input
|
|
18
|
+
- Missing parameterized queries / prepared statements
|
|
19
|
+
|
|
20
|
+
**Cross-Site Scripting (XSS):**
|
|
21
|
+
|
|
22
|
+
- User input rendered in HTML without encoding/escaping
|
|
23
|
+
- `dangerouslySetInnerHTML` in React with unsanitized content
|
|
24
|
+
- `innerHTML`, `outerHTML`, `document.write()` with user input
|
|
25
|
+
- URL parameters reflected in page without encoding
|
|
26
|
+
- Missing Content-Security-Policy header
|
|
27
|
+
- SVG or HTML file uploads served inline
|
|
28
|
+
|
|
29
|
+
**Command Injection:**
|
|
30
|
+
|
|
31
|
+
- Shell commands built via string concatenation with user input
|
|
32
|
+
- Using `exec()` instead of `execFile()` with argument arrays in Node.js
|
|
33
|
+
- User input passed to `eval()`, `Function()`, `setTimeout(string)`
|
|
34
|
+
- Template engines with unescaped user input (SSTI)
|
|
35
|
+
|
|
36
|
+
**NoSQL Injection:**
|
|
37
|
+
|
|
38
|
+
- MongoDB queries with user-controlled operators (`$gt`, `$ne`, `$where`)
|
|
39
|
+
- JSON body parsed directly into query filters without validation
|
|
40
|
+
|
|
41
|
+
**Other injection types:**
|
|
42
|
+
|
|
43
|
+
- LDAP queries with unescaped user input
|
|
44
|
+
- XPath queries with string concatenation
|
|
45
|
+
- Header injection (CRLF in user-controlled header values)
|
|
46
|
+
- Log injection (unescaped user input in log messages)
|
|
47
|
+
- Expression Language injection (Spring EL, OGNL)
|
|
48
|
+
|
|
49
|
+
**LLM Prompt Injection:**
|
|
50
|
+
|
|
51
|
+
- User input passed directly into LLM prompts without sanitization
|
|
52
|
+
- See OWASP LLM Top 10 for detailed guidance
|
|
53
|
+
|
|
54
|
+
## Prevention checklist
|
|
55
|
+
|
|
56
|
+
- [ ] Use parameterized queries / prepared statements for ALL database access
|
|
57
|
+
- [ ] Use ORM methods properly — avoid raw query interpolation
|
|
58
|
+
- [ ] Context-aware output encoding (HTML, JS, URL, CSS contexts)
|
|
59
|
+
- [ ] In React: avoid `dangerouslySetInnerHTML`; if necessary, sanitize with DOMPurify
|
|
60
|
+
- [ ] Set `Content-Security-Policy` header to restrict inline scripts
|
|
61
|
+
- [ ] Use `execFile()` with argument arrays instead of shell string interpolation
|
|
62
|
+
- [ ] Never use `eval()` or `Function()` with user input
|
|
63
|
+
- [ ] Validate and sanitize all input server-side (allowlist preferred over denylist)
|
|
64
|
+
- [ ] For file uploads: validate MIME type, don't serve inline, use Content-Disposition: attachment
|
|
65
|
+
- [ ] Encode user input in log messages to prevent log injection
|
|
66
|
+
- [ ] Use SAST/DAST tools in CI/CD to catch injection flaws early
|
|
67
|
+
|
|
68
|
+
## Code patterns
|
|
69
|
+
|
|
70
|
+
**Bad — SQL string concatenation (Node.js):**
|
|
71
|
+
|
|
72
|
+
```js
|
|
73
|
+
db.query(`SELECT * FROM users WHERE email = '${req.body.email}'`);
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
**Good — Parameterized query:**
|
|
77
|
+
|
|
78
|
+
```js
|
|
79
|
+
db.query("SELECT * FROM users WHERE email = $1", [req.body.email]);
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
**Bad — Shell command with string interpolation:**
|
|
83
|
+
|
|
84
|
+
```js
|
|
85
|
+
// DANGEROUS: allows command injection
|
|
86
|
+
const cmd = "convert " + req.query.filename + " output.png";
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
**Good — Argument array (no shell):**
|
|
90
|
+
|
|
91
|
+
```js
|
|
92
|
+
// SAFE: arguments passed as array, not interpreted by shell
|
|
93
|
+
execFile("convert", [req.query.filename, "output.png"]);
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Key CWEs
|
|
97
|
+
|
|
98
|
+
| CWE | Name | Common in |
|
|
99
|
+
| --- | ------------------------------------ | -------------------- |
|
|
100
|
+
| 79 | Cross-site Scripting (XSS) | Web frontends |
|
|
101
|
+
| 89 | SQL Injection | Database queries |
|
|
102
|
+
| 78 | OS Command Injection | Shell commands |
|
|
103
|
+
| 94 | Code Injection | eval(), dynamic code |
|
|
104
|
+
| 77 | Command Injection | Subprocess calls |
|
|
105
|
+
| 20 | Improper Input Validation | All input handling |
|
|
106
|
+
| 116 | Improper Encoding/Escaping of Output | Template rendering |
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# A06:2025 Insecure Design
|
|
2
|
+
|
|
3
|
+
39 CWEs, 1.86% avg incidence. Focuses on design and architecture flaws — not implementation bugs.
|
|
4
|
+
|
|
5
|
+
## What to look for
|
|
6
|
+
|
|
7
|
+
**Missing threat modeling:**
|
|
8
|
+
|
|
9
|
+
- No documented threat model for the application
|
|
10
|
+
- Security requirements not part of user stories
|
|
11
|
+
- No abuse/misuse cases defined
|
|
12
|
+
- Business logic not validated against adversarial use
|
|
13
|
+
|
|
14
|
+
**Business logic flaws:**
|
|
15
|
+
|
|
16
|
+
- No rate limiting on high-value operations (purchases, transfers, account creation)
|
|
17
|
+
- Price/quantity manipulation possible via client-side values
|
|
18
|
+
- Multi-step workflows that can be skipped or replayed
|
|
19
|
+
- State transitions not validated (e.g., order status jumps from "pending" to "shipped")
|
|
20
|
+
- Race conditions in concurrent operations (double-spend, TOCTOU)
|
|
21
|
+
|
|
22
|
+
**Missing security controls by design:**
|
|
23
|
+
|
|
24
|
+
- Client-side-only enforcement of security rules
|
|
25
|
+
- No server-side validation of business rules
|
|
26
|
+
- Trust boundary violations (trusting client-sent data as authoritative)
|
|
27
|
+
- No separation of concerns between public/private/admin functionality
|
|
28
|
+
- Insufficient tenant isolation in multi-tenant systems
|
|
29
|
+
|
|
30
|
+
**Credential handling:**
|
|
31
|
+
|
|
32
|
+
- Unprotected storage of credentials
|
|
33
|
+
- Knowledge-based recovery ("security questions")
|
|
34
|
+
- Credentials sent via insecure channels
|
|
35
|
+
|
|
36
|
+
**File upload issues:**
|
|
37
|
+
|
|
38
|
+
- No file type validation (server-side)
|
|
39
|
+
- Dangerous file types accepted (.exe, .php, .jsp)
|
|
40
|
+
- File content not inspected (MIME type spoofing)
|
|
41
|
+
- Uploaded files stored in web-accessible directories
|
|
42
|
+
- No file size limits
|
|
43
|
+
|
|
44
|
+
**Insufficient compartmentalization:**
|
|
45
|
+
|
|
46
|
+
- Monolithic permissions (all-or-nothing access)
|
|
47
|
+
- No network segmentation between tiers
|
|
48
|
+
- Single failure point brings down entire system
|
|
49
|
+
|
|
50
|
+
## Prevention checklist
|
|
51
|
+
|
|
52
|
+
- [ ] Perform threat modeling for critical flows (auth, payments, data access)
|
|
53
|
+
- [ ] Define security requirements in user stories
|
|
54
|
+
- [ ] Write misuse cases alongside use cases
|
|
55
|
+
- [ ] Validate all business logic server-side — never trust the client
|
|
56
|
+
- [ ] Rate-limit high-value operations
|
|
57
|
+
- [ ] Validate state transitions (only allow legal state changes)
|
|
58
|
+
- [ ] Implement proper tenant isolation in multi-tenant systems
|
|
59
|
+
- [ ] Segregate application tiers on network level
|
|
60
|
+
- [ ] Validate file uploads: type, size, content; store outside web root
|
|
61
|
+
- [ ] Use secure design patterns from OWASP library
|
|
62
|
+
- [ ] Test critical flows for race conditions
|
|
63
|
+
- [ ] Replace security questions with secure recovery methods (email/SMS link)
|
|
64
|
+
|
|
65
|
+
## Key CWEs
|
|
66
|
+
|
|
67
|
+
| CWE | Name | Common in |
|
|
68
|
+
| --- | ----------------------------------------------- | ---------------------- |
|
|
69
|
+
| 434 | Unrestricted Upload of File with Dangerous Type | File uploads |
|
|
70
|
+
| 269 | Improper Privilege Management | Role systems |
|
|
71
|
+
| 501 | Trust Boundary Violation | Client/server boundary |
|
|
72
|
+
| 522 | Insufficiently Protected Credentials | Password storage |
|
|
73
|
+
| 362 | Race Condition | Concurrent operations |
|
|
74
|
+
| 602 | Client-Side Enforcement of Server-Side Security | Frontend-only checks |
|
|
75
|
+
| 799 | Improper Control of Interaction Frequency | Missing rate limiting |
|
|
76
|
+
| 841 | Improper Enforcement of Behavioral Workflow | Skippable steps |
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# A07:2025 Authentication Failures
|
|
2
|
+
|
|
3
|
+
36 CWEs, 2.92% avg incidence, 1.1M+ occurrences.
|
|
4
|
+
|
|
5
|
+
## What to look for
|
|
6
|
+
|
|
7
|
+
**Credential attacks not mitigated:**
|
|
8
|
+
|
|
9
|
+
- No rate limiting on login attempts
|
|
10
|
+
- No account lockout or progressive delays after failed attempts
|
|
11
|
+
- No detection of credential stuffing or password spray attacks
|
|
12
|
+
- No CAPTCHA or bot protection on login forms
|
|
13
|
+
|
|
14
|
+
**Weak password policies:**
|
|
15
|
+
|
|
16
|
+
- No minimum password length (NIST recommends >= 8 chars, allow up to 64+)
|
|
17
|
+
- Forcing complexity rules instead of checking against breached password lists
|
|
18
|
+
- Forced periodic password rotation (counterproductive per NIST 800-63b)
|
|
19
|
+
- Not checking passwords against known breached lists (haveibeenpwned.com)
|
|
20
|
+
- Allowing commonly used passwords ("password", "123456", "admin")
|
|
21
|
+
|
|
22
|
+
**Missing MFA:**
|
|
23
|
+
|
|
24
|
+
- No multi-factor authentication option
|
|
25
|
+
- MFA easily bypassed via fallback mechanisms
|
|
26
|
+
- SMS-only MFA without stronger alternatives (TOTP, WebAuthn)
|
|
27
|
+
|
|
28
|
+
**Session management issues:**
|
|
29
|
+
|
|
30
|
+
- Session ID not regenerated after login (session fixation)
|
|
31
|
+
- Session ID in URL or hidden fields
|
|
32
|
+
- Sessions not invalidated on logout
|
|
33
|
+
- No idle timeout or absolute timeout
|
|
34
|
+
- SSO logout doesn't invalidate all sessions (missing SLO)
|
|
35
|
+
|
|
36
|
+
**Hardcoded credentials:**
|
|
37
|
+
|
|
38
|
+
- Default passwords in code or config
|
|
39
|
+
- API keys or service account credentials in source code
|
|
40
|
+
- Test/admin accounts with known passwords in production
|
|
41
|
+
|
|
42
|
+
**Account enumeration:**
|
|
43
|
+
|
|
44
|
+
- Different error messages for "user not found" vs "wrong password"
|
|
45
|
+
- Registration form reveals if an email is already registered
|
|
46
|
+
- Password reset reveals if an email exists
|
|
47
|
+
- Timing differences between existing/non-existing users
|
|
48
|
+
|
|
49
|
+
**JWT issues:**
|
|
50
|
+
|
|
51
|
+
- Missing signature validation
|
|
52
|
+
- `alg: none` accepted
|
|
53
|
+
- Weak signing keys
|
|
54
|
+
- No `aud` or `iss` claim validation
|
|
55
|
+
- Token not checked for expiry
|
|
56
|
+
|
|
57
|
+
## Prevention checklist
|
|
58
|
+
|
|
59
|
+
- [ ] Implement MFA for all users; enforce for admin accounts
|
|
60
|
+
- [ ] Rate-limit login attempts with progressive delays
|
|
61
|
+
- [ ] Check passwords against top 10K worst passwords + breached credential lists
|
|
62
|
+
- [ ] Follow NIST 800-63b: min 8 chars, allow 64+, no forced rotation, no complexity rules
|
|
63
|
+
- [ ] Use the same error message for all login failures ("Invalid credentials")
|
|
64
|
+
- [ ] Regenerate session ID after successful login
|
|
65
|
+
- [ ] Invalidate sessions server-side on logout; set idle + absolute timeouts
|
|
66
|
+
- [ ] Never hardcode credentials; use secrets managers
|
|
67
|
+
- [ ] Remove default accounts or force password change on first login
|
|
68
|
+
- [ ] Validate JWT claims: `aud`, `iss`, `exp`, `nbf`; reject `alg: none`
|
|
69
|
+
- [ ] Use well-tested auth libraries/frameworks instead of custom implementations
|
|
70
|
+
- [ ] Log all authentication failures; alert on patterns (stuffing, brute force)
|
|
71
|
+
|
|
72
|
+
## Key CWEs
|
|
73
|
+
|
|
74
|
+
| CWE | Name | Common in |
|
|
75
|
+
| --- | ----------------------------------------------- | ----------------------- |
|
|
76
|
+
| 287 | Improper Authentication | Custom auth logic |
|
|
77
|
+
| 307 | Improper Restriction of Excessive Auth Attempts | Missing rate limiting |
|
|
78
|
+
| 384 | Session Fixation | Session not regenerated |
|
|
79
|
+
| 521 | Weak Password Requirements | Poor password policy |
|
|
80
|
+
| 798 | Use of Hard-coded Credentials | Creds in source code |
|
|
81
|
+
| 613 | Insufficient Session Expiration | Long-lived sessions |
|
|
82
|
+
| 306 | Missing Authentication for Critical Function | Unprotected endpoints |
|
|
83
|
+
| 640 | Weak Password Recovery Mechanism | Security questions |
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# A08:2025 Software or Data Integrity Failures
|
|
2
|
+
|
|
3
|
+
14 CWEs, 2.75% avg incidence, 501K+ occurrences. Focuses on trust boundaries and integrity verification.
|
|
4
|
+
|
|
5
|
+
## What to look for
|
|
6
|
+
|
|
7
|
+
**Insecure deserialization:**
|
|
8
|
+
|
|
9
|
+
- Deserializing data from untrusted sources (user input, cookies, APIs)
|
|
10
|
+
- Java `ObjectInputStream` on untrusted data
|
|
11
|
+
- Python: using unsafe deserialization (e.g., `pickle`) on untrusted data — use JSON instead
|
|
12
|
+
- PHP `unserialize()` on user input
|
|
13
|
+
- Node.js YAML deserialization of untrusted data
|
|
14
|
+
- JSON with type coercion enabling prototype pollution
|
|
15
|
+
|
|
16
|
+
**Untrusted code inclusion:**
|
|
17
|
+
|
|
18
|
+
- Scripts loaded from third-party CDNs without Subresource Integrity (SRI) hashes
|
|
19
|
+
- `<script src="...">` without `integrity` attribute
|
|
20
|
+
- Dynamic import of modules from user-controlled paths
|
|
21
|
+
- iframes loading content from untrusted domains
|
|
22
|
+
|
|
23
|
+
**Unsigned updates:**
|
|
24
|
+
|
|
25
|
+
- Auto-update mechanisms that don't verify signatures
|
|
26
|
+
- Firmware/software updates downloaded over HTTP
|
|
27
|
+
- Package installations without checksum verification
|
|
28
|
+
- Docker images pulled without digest verification
|
|
29
|
+
|
|
30
|
+
**CI/CD integrity:**
|
|
31
|
+
|
|
32
|
+
- Build artifacts not signed or verified
|
|
33
|
+
- Pipeline pulls code/artifacts from untrusted sources
|
|
34
|
+
- No separation between build and deploy permissions
|
|
35
|
+
- Build environment not isolated
|
|
36
|
+
|
|
37
|
+
**Cookie/data integrity:**
|
|
38
|
+
|
|
39
|
+
- Cookies used for authorization decisions without server-side validation
|
|
40
|
+
- Client-side data (hidden fields, local storage) trusted for security decisions
|
|
41
|
+
- API responses cached and reused without revalidation
|
|
42
|
+
|
|
43
|
+
**Prototype pollution (JavaScript):**
|
|
44
|
+
|
|
45
|
+
- Recursive merge of user input into objects
|
|
46
|
+
- `Object.assign()` or lodash `_.merge()` with untrusted data
|
|
47
|
+
- `__proto__`, `constructor`, `prototype` not filtered from input
|
|
48
|
+
|
|
49
|
+
## Prevention checklist
|
|
50
|
+
|
|
51
|
+
- [ ] Use digital signatures to verify software/data integrity
|
|
52
|
+
- [ ] Add Subresource Integrity (SRI) hashes to all CDN scripts/styles
|
|
53
|
+
- [ ] Verify checksums/signatures for all downloaded packages and updates
|
|
54
|
+
- [ ] Use trusted, vetted package registries; consider internal mirrors
|
|
55
|
+
- [ ] Implement code review for all changes before deployment
|
|
56
|
+
- [ ] Ensure CI/CD has proper segregation, access control, and audit logging
|
|
57
|
+
- [ ] Never deserialize untrusted data with unsafe serializers; use JSON with schema validation
|
|
58
|
+
- [ ] Validate all serialized data with integrity checks before processing
|
|
59
|
+
- [ ] Filter `__proto__`, `constructor`, `prototype` from user input in JavaScript
|
|
60
|
+
- [ ] Pin Docker image versions by digest, not just tag
|
|
61
|
+
- [ ] Sign build artifacts and verify before deployment
|
|
62
|
+
|
|
63
|
+
## Key CWEs
|
|
64
|
+
|
|
65
|
+
| CWE | Name | Common in |
|
|
66
|
+
| --- | --------------------------------------------------------------- | --------------------- |
|
|
67
|
+
| 502 | Deserialization of Untrusted Data | API payloads, cookies |
|
|
68
|
+
| 829 | Inclusion of Functionality from Untrusted Sphere | CDN scripts |
|
|
69
|
+
| 494 | Download of Code Without Integrity Check | Auto-updates |
|
|
70
|
+
| 345 | Insufficient Verification of Data Authenticity | Unsigned artifacts |
|
|
71
|
+
| 915 | Improperly Controlled Modification of Dynamic Object Attributes | Prototype pollution |
|
|
72
|
+
| 565 | Reliance on Cookies without Validation | Auth cookies |
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# A09:2025 Security Logging & Alerting Failures
|
|
2
|
+
|
|
3
|
+
5 CWEs, 3.91% avg incidence. Underrepresented in data but critical for incident detection.
|
|
4
|
+
|
|
5
|
+
## What to look for
|
|
6
|
+
|
|
7
|
+
**Missing audit logs:**
|
|
8
|
+
|
|
9
|
+
- Login attempts (successful AND failed) not logged
|
|
10
|
+
- Access control failures not logged
|
|
11
|
+
- High-value transactions not logged
|
|
12
|
+
- Admin actions not logged
|
|
13
|
+
- Password changes/resets not logged
|
|
14
|
+
- Input validation failures not logged
|
|
15
|
+
|
|
16
|
+
**Insufficient log context:**
|
|
17
|
+
|
|
18
|
+
- Logs missing timestamp, user ID, IP address, action performed
|
|
19
|
+
- Logs missing request ID for correlation
|
|
20
|
+
- Error logs without stack traces (in backend logs, not user-facing)
|
|
21
|
+
- No distinction between security events and operational events
|
|
22
|
+
|
|
23
|
+
**Log integrity issues:**
|
|
24
|
+
|
|
25
|
+
- Logs stored only locally (no centralized log management)
|
|
26
|
+
- Logs not protected from tampering (mutable storage)
|
|
27
|
+
- No backup of log files
|
|
28
|
+
- Log retention too short for forensic analysis
|
|
29
|
+
|
|
30
|
+
**Log injection vulnerabilities:**
|
|
31
|
+
|
|
32
|
+
- User input written to logs without encoding/escaping
|
|
33
|
+
- Newlines in user input can forge log entries
|
|
34
|
+
- Special characters that manipulate log viewers (ANSI escape codes)
|
|
35
|
+
|
|
36
|
+
**Sensitive data in logs:**
|
|
37
|
+
|
|
38
|
+
- Passwords, tokens, API keys logged in plaintext
|
|
39
|
+
- Credit card numbers, SSNs, or PII in log entries
|
|
40
|
+
- Session IDs logged
|
|
41
|
+
- Request bodies with sensitive fields logged without redaction
|
|
42
|
+
|
|
43
|
+
**Missing alerting:**
|
|
44
|
+
|
|
45
|
+
- No alerts on repeated failed login attempts
|
|
46
|
+
- No alerts on access control violations
|
|
47
|
+
- No alerts on unusual patterns (geographic anomalies, time-based anomalies)
|
|
48
|
+
- DAST/pentest scans don't trigger alerts
|
|
49
|
+
- No incident response plan or playbook
|
|
50
|
+
- Alert fatigue from too many false positives
|
|
51
|
+
|
|
52
|
+
## Prevention checklist
|
|
53
|
+
|
|
54
|
+
- [ ] Log all authentication events (login, logout, failed attempts, MFA events)
|
|
55
|
+
- [ ] Log all access control failures with user context
|
|
56
|
+
- [ ] Log all input validation failures
|
|
57
|
+
- [ ] Include: timestamp, user ID, IP, action, resource, outcome in every log entry
|
|
58
|
+
- [ ] Encode/escape user input in log messages (prevent log injection)
|
|
59
|
+
- [ ] Never log passwords, tokens, credit cards, or other secrets
|
|
60
|
+
- [ ] Redact sensitive fields before logging (mask PII)
|
|
61
|
+
- [ ] Send logs to centralized, append-only log management (ELK, Datadog, etc.)
|
|
62
|
+
- [ ] Protect log integrity — use append-only storage, monitor for tampering
|
|
63
|
+
- [ ] Set up alerting for: repeated auth failures, access control violations, unusual patterns
|
|
64
|
+
- [ ] Create and test incident response playbooks
|
|
65
|
+
- [ ] Set appropriate log retention (regulatory requirements vary)
|
|
66
|
+
- [ ] Use structured logging (JSON) for machine-parseable log entries
|
|
67
|
+
- [ ] Add honeytokens to detect unauthorized access with near-zero false positives
|
|
68
|
+
|
|
69
|
+
## Key CWEs
|
|
70
|
+
|
|
71
|
+
| CWE | Name | Common in |
|
|
72
|
+
| --- | ----------------------------------------- | ------------------------ |
|
|
73
|
+
| 778 | Insufficient Logging | Missing audit trail |
|
|
74
|
+
| 532 | Sensitive Information in Log File | Logging passwords/tokens |
|
|
75
|
+
| 117 | Improper Output Neutralization for Logs | Log injection |
|
|
76
|
+
| 223 | Omission of Security-relevant Information | Incomplete logs |
|