Dependency Audit — Framework, Package, and Toolchain Security
Audit project dependencies, frameworks, language runtimes, and dev tools for known vulnerabilities (CVEs), security anti-patterns, and supply chain risks.
Methodology
Step 1: Inventory the Stack
Identify everything in use — not just direct dependencies but the full chain:
Package manifests — read and catalog:
Node/JS: package.json, package-lock.json, yarn.lock, pnpm-lock.yaml
Python: requirements.txt, Pipfile.lock, pyproject.toml, poetry.lock
Ruby: Gemfile, Gemfile.lock
Go: go.mod, go.sum
Rust: Cargo.toml, Cargo.lock
Java: pom.xml, build.gradle
PHP: composer.json, composer.lock
.NET: *.csproj, packages.config
Framework and runtime versions:
- Check framework version (Next.js, Django, Rails, Spring, Laravel, Express, etc.)
- Check language/runtime version (Node.js, Python, Ruby, Go, Java, PHP, .NET)
- Check infrastructure tools (Docker base images, Terraform providers, Kubernetes versions)
Dev tools and CI/CD:
- Check CI/CD pipeline configs (.github/workflows, .gitlab-ci.yml, Jenkinsfile)
- Check pre-commit hooks, linters, formatters
- Check container base images and their update status
- Check IaC tool versions (Terraform, Pulumi, CDK)
Step 2: Run Automated Audit Tools
Run the appropriate audit command for the project:
# Node.js
npm audit
npm audit --json # For structured output
# Python
pip audit # If pip-audit installed
safety check # If safety installed
# Ruby
bundle audit
# Go
govulncheck ./...
# Rust
cargo audit
# PHP
composer audit
# .NET
dotnet list package --vulnerable
# Docker
docker scout cves <image>
trivy image <image>
# General (if Trivy is available)
trivy fs .
Step 3: Research Framework-Specific Known Issues
Beyond CVEs in packages, check for known vulnerability patterns specific to the framework in use. Search for recent advisories and common misconfiguration issues.
Next.js / React:
- Server Actions exposing internal endpoints (pre-14.1.1 middleware bypass CVE-2025-29927)
dangerouslySetInnerHTML without sanitization
- SSRF through image optimization (
next/image with unrestricted domains)
- Exposed
.env files in public directory or client bundle (NEXT_PUBLIC_ prefix leaking secrets)
- Middleware auth bypass patterns — check middleware.ts matches all protected routes
- Server Component / Client Component boundary leaking server-only data
- Outdated
next.config.js security headers
Django:
- DEBUG=True in production
- ALLOWED_HOSTS misconfigured (wildcard
*)
- Missing CSRF middleware or
@csrf_exempt on state-changing views
- Raw SQL via
extra(), raw(), or RawSQL without parameterization
- Pickle deserialization in sessions (use JSON serializer)
- Secret key committed to source control
Rails:
- Mass assignment without strong parameters
- SQL injection via
where("column = '#{input}'")
- Unpatched Action Pack, Action View, or Active Record CVEs
- Insecure deserialization in cookies (verify secret_key_base rotation)
- CSRF token bypass in API-only mode
Express / Node.js:
- Prototype pollution through
Object.assign, lodash.merge, deep-extend
- ReDoS (Regular Expression Denial of Service) in validation patterns
- Path traversal through
req.params in file serving routes
- Missing rate limiting on auth endpoints
eval() or Function() with user input
- Event loop blocking with synchronous operations
Spring / Java:
- Spring4Shell and related RCE vulnerabilities
- Deserialization attacks (Java native serialization, Jackson polymorphic types)
- SpEL injection in Spring Expression Language
- Missing CSRF protection on state-changing endpoints
- Actuator endpoints exposed without authentication
Laravel / PHP:
- APP_DEBUG=true in production (leaks env vars in error pages)
- SQL injection via raw DB queries without bindings
- Mass assignment without
$fillable / $guarded
- File upload without type validation (PHP execution via uploaded .php)
- Insecure deserialization in queued jobs
WordPress:
- Outdated core, theme, or plugin versions (most common attack vector)
- File editor enabled in wp-admin (allows code injection if admin is compromised)
- XML-RPC enabled (brute force amplification, SSRF)
- Default admin username, weak passwords
- Unpatched plugin vulnerabilities (check WPScan database)
Step 4: Check for Supply Chain Risks
Beyond known CVEs, look for supply chain attack indicators:
Dependency confusion / substitution:
- Private package names that could be claimed on public registries
- Missing
.npmrc or pip.conf scoping to private registry
- No lockfile integrity verification
Typosquatting:
- Package names that are close misspellings of popular packages
- Recently published packages with very few downloads
- Packages that changed ownership recently
Malicious packages:
- Postinstall scripts that make network requests or execute code (
scripts.postinstall in package.json)
- Packages with obfuscated code
- Excessive permission requests relative to functionality
Maintenance risk:
- Unmaintained packages (no commits in 2+ years, archived repos)
- Single-maintainer packages for critical functionality
- Packages with known but unpatched vulnerabilities (maintainer unresponsive)
Lockfile integrity:
- Is the lockfile committed to source control?
- Does CI install from the lockfile (
npm ci not npm install, pip install --require-hashes)?
- Are integrity hashes present and verified?
Step 5: Check Dev Tool and CI/CD Security
GitHub Actions:
pull_request_target trigger with checkout of PR code (code injection risk)
- Secrets accessible in forked PR workflows
- Unpinned action versions (
uses: actions/checkout@main vs @v4.1.0 or SHA pin)
- Script injection via
${{ github.event.issue.title }} in run: blocks
Docker:
- Running as root in container (missing
USER directive)
- Base image with known CVEs (check with
trivy or docker scout)
- Secrets baked into image layers (visible via
docker history)
latest tag instead of pinned version
Terraform / IaC:
- Hardcoded secrets in
.tf files
- Unpinned provider versions
- Missing state file encryption
- Over-permissive IAM in provider configuration
Output Format
# Dependency & Stack Security Audit
## Project: [name]
## Stack: [language, framework, key tools]
## Date: [date]
### Stack Inventory
| Component | Version | Latest | Status |
|-----------|---------|--------|--------|
### Known Vulnerabilities (CVEs)
| Package | Installed | Vuln | Severity | CVE | Fix Version |
|---------|-----------|------|----------|-----|-------------|
### Framework-Specific Issues
#### [SEVERITY] [Title]
**Component:** [framework/tool name and version]
**Issue:** [description]
**Evidence:** [code or config snippet]
**Remediation:** [specific fix]
### Supply Chain Risks
| Risk | Package/Component | Details | Remediation |
|------|-------------------|---------|-------------|
### Dev Tool / CI Security
| Tool | Issue | Severity | Remediation |
|------|-------|----------|-------------|
### Prioritized Action Plan
1. [Critical — actively exploited CVEs, RCE vulnerabilities]
2. [High — known CVEs with public exploits, supply chain risks]
3. [Medium — framework misconfigurations, outdated dependencies]
4. [Low — maintenance risks, best practice improvements]
Boundaries
- Only audit code and configurations the user provides
- When identifying CVEs, verify they apply to the actual installed version
- Provide specific fix versions or remediation steps for every finding
- Note when a vulnerability requires specific conditions to exploit (reducing effective severity)
- Refuse to help exploit found vulnerabilities against unauthorized targets
References
- OWASP Dependency-Check
- National Vulnerability Database (NVD)
- GitHub Advisory Database
- Snyk Vulnerability Database
- npm audit / pip-audit / bundler-audit documentation
- SLSA (Supply-chain Levels for Software Artifacts) framework
1---2name: dependency-audit3description: Audit project dependencies, frameworks, languages, and dev tools for known vulnerabilities, CVEs, and security anti-patterns. Use when the user mentions 'dependency audit,' 'npm audit,' 'CVE,' 'vulnerable packages,' 'supply chain security,' 'outdated dependencies,' 'known vulnerabilities,' 'security advisory,' 'package security,' 'framework vulnerability,' 'is this package safe,' or needs to check whether their stack has known security issues.4---56# Dependency Audit — Framework, Package, and Toolchain Security78Audit project dependencies, frameworks, language runtimes, and dev tools for known vulnerabilities (CVEs), security anti-patterns, and supply chain risks.910## Methodology1112### Step 1: Inventory the Stack1314Identify everything in use — not just direct dependencies but the full chain:1516**Package manifests — read and catalog:**17```18Node/JS: package.json, package-lock.json, yarn.lock, pnpm-lock.yaml19Python: requirements.txt, Pipfile.lock, pyproject.toml, poetry.lock20Ruby: Gemfile, Gemfile.lock21Go: go.mod, go.sum22Rust: Cargo.toml, Cargo.lock23Java: pom.xml, build.gradle24PHP: composer.json, composer.lock25.NET: *.csproj, packages.config26```2728**Framework and runtime versions:**29- Check framework version (Next.js, Django, Rails, Spring, Laravel, Express, etc.)30- Check language/runtime version (Node.js, Python, Ruby, Go, Java, PHP, .NET)31- Check infrastructure tools (Docker base images, Terraform providers, Kubernetes versions)3233**Dev tools and CI/CD:**34- Check CI/CD pipeline configs (.github/workflows, .gitlab-ci.yml, Jenkinsfile)35- Check pre-commit hooks, linters, formatters36- Check container base images and their update status37- Check IaC tool versions (Terraform, Pulumi, CDK)3839### Step 2: Run Automated Audit Tools4041Run the appropriate audit command for the project:4243```bash44# Node.js45npm audit46npm audit --json # For structured output4748# Python49pip audit # If pip-audit installed50safety check # If safety installed5152# Ruby53bundle audit5455# Go56govulncheck ./...5758# Rust59cargo audit6061# PHP62composer audit6364# .NET65dotnet list package --vulnerable6667# Docker68docker scout cves <image>69trivy image <image>7071# General (if Trivy is available)72trivy fs .73```7475### Step 3: Research Framework-Specific Known Issues7677Beyond CVEs in packages, check for known vulnerability patterns specific to the framework in use. Search for recent advisories and common misconfiguration issues.7879**Next.js / React:**80- Server Actions exposing internal endpoints (pre-14.1.1 middleware bypass CVE-2025-29927)81- `dangerouslySetInnerHTML` without sanitization82- SSRF through image optimization (`next/image` with unrestricted domains)83- Exposed `.env` files in public directory or client bundle (`NEXT_PUBLIC_` prefix leaking secrets)84- Middleware auth bypass patterns — check middleware.ts matches all protected routes85- Server Component / Client Component boundary leaking server-only data86- Outdated `next.config.js` security headers8788**Django:**89- DEBUG=True in production90- ALLOWED_HOSTS misconfigured (wildcard `*`)91- Missing CSRF middleware or `@csrf_exempt` on state-changing views92- Raw SQL via `extra()`, `raw()`, or `RawSQL` without parameterization93- Pickle deserialization in sessions (use JSON serializer)94- Secret key committed to source control9596**Rails:**97- Mass assignment without strong parameters98- SQL injection via `where("column = '#{input}'")`99- Unpatched Action Pack, Action View, or Active Record CVEs100- Insecure deserialization in cookies (verify secret_key_base rotation)101- CSRF token bypass in API-only mode102103**Express / Node.js:**104- Prototype pollution through `Object.assign`, `lodash.merge`, `deep-extend`105- ReDoS (Regular Expression Denial of Service) in validation patterns106- Path traversal through `req.params` in file serving routes107- Missing rate limiting on auth endpoints108- `eval()` or `Function()` with user input109- Event loop blocking with synchronous operations110111**Spring / Java:**112- Spring4Shell and related RCE vulnerabilities113- Deserialization attacks (Java native serialization, Jackson polymorphic types)114- SpEL injection in Spring Expression Language115- Missing CSRF protection on state-changing endpoints116- Actuator endpoints exposed without authentication117118**Laravel / PHP:**119- APP_DEBUG=true in production (leaks env vars in error pages)120- SQL injection via raw DB queries without bindings121- Mass assignment without `$fillable` / `$guarded`122- File upload without type validation (PHP execution via uploaded .php)123- Insecure deserialization in queued jobs124125**WordPress:**126- Outdated core, theme, or plugin versions (most common attack vector)127- File editor enabled in wp-admin (allows code injection if admin is compromised)128- XML-RPC enabled (brute force amplification, SSRF)129- Default admin username, weak passwords130- Unpatched plugin vulnerabilities (check WPScan database)131132### Step 4: Check for Supply Chain Risks133134Beyond known CVEs, look for supply chain attack indicators:135136**Dependency confusion / substitution:**137- Private package names that could be claimed on public registries138- Missing `.npmrc` or `pip.conf` scoping to private registry139- No lockfile integrity verification140141**Typosquatting:**142- Package names that are close misspellings of popular packages143- Recently published packages with very few downloads144- Packages that changed ownership recently145146**Malicious packages:**147- Postinstall scripts that make network requests or execute code (`scripts.postinstall` in package.json)148- Packages with obfuscated code149- Excessive permission requests relative to functionality150151**Maintenance risk:**152- Unmaintained packages (no commits in 2+ years, archived repos)153- Single-maintainer packages for critical functionality154- Packages with known but unpatched vulnerabilities (maintainer unresponsive)155156**Lockfile integrity:**157- Is the lockfile committed to source control?158- Does CI install from the lockfile (`npm ci` not `npm install`, `pip install --require-hashes`)?159- Are integrity hashes present and verified?160161### Step 5: Check Dev Tool and CI/CD Security162163**GitHub Actions:**164- `pull_request_target` trigger with checkout of PR code (code injection risk)165- Secrets accessible in forked PR workflows166- Unpinned action versions (`uses: actions/checkout@main` vs `@v4.1.0` or SHA pin)167- Script injection via `${{ github.event.issue.title }}` in `run:` blocks168169**Docker:**170- Running as root in container (missing `USER` directive)171- Base image with known CVEs (check with `trivy` or `docker scout`)172- Secrets baked into image layers (visible via `docker history`)173- `latest` tag instead of pinned version174175**Terraform / IaC:**176- Hardcoded secrets in `.tf` files177- Unpinned provider versions178- Missing state file encryption179- Over-permissive IAM in provider configuration180181## Output Format182183```markdown184# Dependency & Stack Security Audit185## Project: [name]186## Stack: [language, framework, key tools]187## Date: [date]188189### Stack Inventory190| Component | Version | Latest | Status |191|-----------|---------|--------|--------|192193### Known Vulnerabilities (CVEs)194| Package | Installed | Vuln | Severity | CVE | Fix Version |195|---------|-----------|------|----------|-----|-------------|196197### Framework-Specific Issues198#### [SEVERITY] [Title]199**Component:** [framework/tool name and version]200**Issue:** [description]201**Evidence:** [code or config snippet]202**Remediation:** [specific fix]203204### Supply Chain Risks205| Risk | Package/Component | Details | Remediation |206|------|-------------------|---------|-------------|207208### Dev Tool / CI Security209| Tool | Issue | Severity | Remediation |210|------|-------|----------|-------------|211212### Prioritized Action Plan2131. [Critical — actively exploited CVEs, RCE vulnerabilities]2142. [High — known CVEs with public exploits, supply chain risks]2153. [Medium — framework misconfigurations, outdated dependencies]2164. [Low — maintenance risks, best practice improvements]217```218219## Boundaries220221- Only audit code and configurations the user provides222- When identifying CVEs, verify they apply to the actual installed version223- Provide specific fix versions or remediation steps for every finding224- Note when a vulnerability requires specific conditions to exploit (reducing effective severity)225- Refuse to help exploit found vulnerabilities against unauthorized targets226227## References228229- OWASP Dependency-Check230- National Vulnerability Database (NVD)231- GitHub Advisory Database232- Snyk Vulnerability Database233- npm audit / pip-audit / bundler-audit documentation234- SLSA (Supply-chain Levels for Software Artifacts) framework