Date: 2026-02-02 (Updated) Version: 0.3.3 Status: ✅ COMPREHENSIVE SECURITY HARDENING COMPLETE
| Category | Critical | High | Medium | Low | Total | Fixed |
|---|---|---|---|---|---|---|
| npm Dependencies | 0 | 0 | 0 | 0 | 0 | ✅ 34/34 |
| Code Vulnerabilities | 0 | 0 | 0 | 0 | 0 | ✅ ALL FIXED |
| Total | 0 | 0 | 0 | 0 | 0 | ✅ |
Result: All security issues fixed. Production-ready with comprehensive hardening.
| Vulnerability | Severity | Original Package | Fix Applied |
|---|---|---|---|
| axios CSRF/SSRF | HIGH | @orca-so/whirlpool-sdk | Override to axios ^1.7.4 |
| bigint-buffer overflow | HIGH | Solana packages | Override to @vekexasia/bigint-buffer2 ^1.0.4 |
| elliptic crypto risk | HIGH | secp256k1 | Replaced with @noble/secp256k1 ^3.0.0 |
| nanoid predictable | MODERATE | @drift-labs/sdk | Override to nanoid ^3.3.8 |
| nodemailer DoS | MODERATE | Direct dependency | Updated to ^7.0.13 |
| undici DoS | MODERATE | discord.js | Override to undici ^6.23.0 |
| @cosmjs/crypto | HIGH | @wormhole-foundation/sdk | Override to ^0.38.1 (uses @noble/curves) |
found 0 vulnerabilities
- Original:
execSync()with string interpolation allowing shell injection - Fix: Replaced with
execFileSync()with array arguments across all files:src/nodes/index.ts- notifications, clipboard, say, open, commandExistssrc/process/index.ts- commandExistssrc/permissions/index.ts- resolveCommandPathsrc/hooks/index.ts- checkRequirementssrc/daemon/index.ts- launchctl commandssrc/macos/index.ts- runAppleScriptSyncsrc/agents/index.ts- exec_python
- Status: ALL FIXED - 15+ injection points remediated
- Original:
new Function()sandbox is bypassable - Fix: Sandbox now DISABLED by default. Requires
ALLOW_UNSAFE_SANDBOX=trueenv var to enable. - Status: ✅ FIXED - Secure by default
- Original:
Math.random().toString(36)used for IDs across 21+ files - Fix: Created
src/utils/id.tswithcrypto.randomBytes()based generators - Files Fixed: alerts, usage, memory, media, cron, hooks, arbitrage, canvas, embeddings, agents, all extensions
- Status: ✅ FIXED - All IDs now cryptographically secure
- Original: Browser-side
eval()executed arbitrary JS from WebSocket - Fix: JS eval disabled by default. Requires
CANVAS_ALLOW_JS_EVAL=trueto enable. - Status: ✅ FIXED - Secure by default
- Original:
spawn()withshell: trueallowed command injection - Fix: Replaced with
execFile(), added command validation, restricted env vars - Status: ✅ FIXED - No shell interpretation
- Original: User input rendered via
innerHTMLwithout sanitization - Fix: Added
escapeHtml()andsanitizeStyle()to all component renderers - Status: ✅ FIXED - All output escaped
- Original:
Access-Control-Allow-Credentials: truesent with wildcard origin - Fix: Credentials only allowed with specific origin allowlist
- Status: ✅ FIXED - Proper CORS handling
- Original: No IP-based rate limiting on gateway
- Fix: Added sliding window rate limiter (100 req/min default, configurable)
- Status: ✅ FIXED -
CLODDS_IP_RATE_LIMITenv var
- Original: No HSTS, X-Frame-Options, etc.
- Fix: Added all recommended security headers + HTTPS enforcement option
- Status: ✅ FIXED -
CLODDS_HSTS_ENABLED,CLODDS_FORCE_HTTPSenv vars
- Original: No validation of incoming WebSocket message structure
- Fix: Added
isValidWebMessage()validator + 1MB size limit - Status: ✅ FIXED - Type + size validation
- Original: Session IDs used
Math.random() - Fix: Now uses
crypto.randomBytes(16).toString('hex') - Status: ✅ FIXED - Cryptographically secure sessions
- Original: Escrow keypairs stored only in memory (
Map<string, Keypair>) - Risk: Server restart = lost keypairs = funds unrecoverable
- Fix: Keypairs now encrypted (AES-256-GCM) and stored in SQLite database
- Encryption: Uses
CLODDS_ESCROW_KEYorCLODDS_CREDENTIAL_KEYenv var - Status: ✅ FIXED - Keypairs survive server restarts
| Risk | Original Status | New Status |
|---|---|---|
| Rate limiting | Recommended | ✅ IMPLEMENTED |
| Math.random() IDs | Accepted | ✅ FIXED |
| Input validation | Accepted | ✅ IMPROVED |
| Security headers | Recommended | ✅ IMPLEMENTED |
| # | Issue | Fix | Status |
|---|---|---|---|
| 1 | nodemailer | Updated to 7.0.13 | ✅ DONE |
| 2 | Command injection | execFileSync with array args | ✅ DONE |
| 3 | Unsafe sandbox | Disabled by default | ✅ DONE |
| 4 | elliptic/secp256k1 | Replaced with @noble/secp256k1 | ✅ DONE |
| 5 | bigint-buffer | Override to @vekexasia/bigint-buffer2 | ✅ DONE |
| 6 | axios in orca-sdk | Override to axios ^1.7.4 | ✅ DONE |
| 7 | discord.js undici | Override to undici ^6.23.0 | ✅ DONE |
| 8 | nanoid | Override to nanoid ^3.3.8 | ✅ DONE |
| 9 | @cosmjs/* elliptic | Override to ^0.38.1 | ✅ DONE |
| 10 | Math.random() IDs | crypto.randomBytes() in 21 files | ✅ DONE |
| 11 | Canvas eval() | Disabled by default | ✅ DONE |
| 12 | Task runner shell injection | execFile + validation | ✅ DONE |
| 13 | XSS in canvas | HTML escaping | ✅ DONE |
| 14 | CORS misconfiguration | Proper credential handling | ✅ DONE |
| 15 | Missing rate limiting | IP-based sliding window | ✅ DONE |
| 16 | Missing security headers | HSTS, X-Frame-Options, etc. | ✅ DONE |
| 17 | WebSocket validation | Type + size validation | ✅ DONE |
| 18 | Weak session IDs | crypto.randomBytes() | ✅ DONE |
All previously identified issues have been remediated.
✅ Encrypted credentials - AES-256-GCM at rest ✅ No hardcoded secrets - All from environment ✅ HTTPS enforced - For all API calls ✅ Webhook signature verification - HMAC validation ✅ SQL injection prevention - Parameterized queries ✅ Audit logging - All trades logged ✅ Modern crypto libraries - @noble/* instead of deprecated elliptic ✅ Security Shield - Code scanner (75 rules/9 categories), scam DB (70+ addresses from Etherscan/Mandiant/CertiK), multi-chain address checker, pre-trade tx validator, input sanitizer (zero-width/RTL/homoglyph/prompt injection detection)
The following headers are now automatically added by the gateway:
// Always added:
'X-Content-Type-Options': 'nosniff'
'X-Frame-Options': 'DENY'
'X-XSS-Protection': '1; mode=block'
// When CLODDS_HSTS_ENABLED=true or connection is HTTPS:
'Strict-Transport-Security': 'max-age=31536000; includeSubDomains'# Enable HSTS header
CLODDS_HSTS_ENABLED=true
# Force HTTP to HTTPS redirect
CLODDS_FORCE_HTTPS=true
# IP rate limiting (requests per minute)
CLODDS_IP_RATE_LIMIT=100The MCP stdio server includes 5 security layers, all opt-in via environment variables:
| Layer | Env Var | Default | Description |
|---|---|---|---|
| Tool allowlist | CLODDS_MCP_ALLOWED_TOOLS |
(all) | Comma-separated list of allowed tool names |
| Tool blocklist | CLODDS_MCP_BLOCKED_TOOLS |
(none) | Comma-separated list of blocked tool names |
| Tool profiles | CLODDS_MCP_TOOL_PROFILE |
full |
Predefined access: read-only, trading, full |
| Rate limiting | CLODDS_MCP_RATE_LIMIT |
60 |
Max calls per minute per client |
| Audit logging | CLODDS_MCP_AUDIT |
true |
Structured JSON audit logs to stderr |
Input sanitization runs automatically on all tool calls — string arguments are scanned for SQL injection, command injection, XSS, and path traversal patterns using the existing detectInjection() function.
# Example: restrict MCP to read-only tools with audit logging
CLODDS_MCP_TOOL_PROFILE=read-only
CLODDS_MCP_RATE_LIMIT=30
CLODDS_MCP_AUDIT=true- Fix nodemailer vulnerability
- Fix command injection in nodes/index.ts
- Add sandbox warning
- Fix all npm audit vulnerabilities (34 → 0)
- Replace elliptic with @noble/secp256k1
- Override bigint-buffer with secure fork
- Test all trading functions work after updates
- Run
npm audit- shows 0 vulnerabilities
Security issues should be reported to: security@clodds.dev (or GitHub Security Advisories)
Do NOT create public issues for security vulnerabilities.
Security audit completed on 2026-01-30 All 34 npm vulnerabilities fixed Ready for npm publish
Clodds includes a built-in server hardening command for production deployments.
# Apply all hardening with interactive prompts
clodds secure
# Preview changes without modifying
clodds secure --dry-run
# Run security audit only
clodds secure audit
# Non-interactive mode (skip prompts)
clodds secure --yes
# Custom SSH port
clodds secure --ssh-port=2222
# Skip specific components
clodds secure --skip-firewall --skip-fail2ban| Component | Changes Applied |
|---|---|
| SSH | Disable password auth, root login, MaxAuthTries=3 |
| Firewall (ufw) | Allow SSH + custom ports, deny incoming by default |
| fail2ban | Protect against brute force (5 failures = 1hr ban) |
| Auto-updates | Enable unattended-upgrades for security patches |
| Kernel | sysctl hardening (SYN cookies, ICMP redirects, etc.) |
$ clodds secure audit
🔒 Clodds Server Security Hardening
ℹ === Security Audit ===
✔ SSH Password Auth: Disabled
✔ SSH Root Login: Disabled
⚠ SSH Port: Port 22 (consider changing from default)
✔ Firewall (ufw): Active
✔ fail2ban: Active (1 jail)
✔ Auto-updates: Configured
5 passed, 1 warnings, 0 failed
- Test SSH access in a new terminal before closing current session
- Verify firewall rules don't block required ports
- Monitor fail2ban logs for legitimate users being blocked
- Keep SSH key backed up securely