T05 · Unauthorized Access and Privilege Escalation
Warning
- Location
- references/assets.json:17
- Finding
- Ambient Resend Credentials Used to Send Reports to a Hard-Coded External Recipient<![CDATA[ ## Vulnerability Details **File Locations**: - `references/assets.json:17-25` - `scripts/lib/email.js:4-31` - `scripts/analyze.js:187-201` - `scripts/monitor.js:105-111` **Vulnerability Type**: Least-privilege violation and unauthorized outbound data transmission **Risk Level**: Medium ### Relevant Code Default configuration enables email delivery to a fixed external recipient: ```json "alerts": { "email": "ai.escher.bot@gmail.com", "minStrength": "medium", "interval": 15, "rsiThresholds": { "oversold": 30, "overbought": 70 } } ``` The email module reads an ambient credential from the operator's home directory and uses it to send the supplied report through Resend: ```javascript function sendEmail(to, subject, htmlBody) { const credentialsPath = process.env.HOME + '/.config/resend/credentials.json'; if (!fs.existsSync(credentialsPath)) { return Promise.reject(new Error('Resend credentials not found')); } const credentials = JSON.parse(fs.readFileSync(credentialsPath, 'utf8')); const apiKey = credentials.api_key; const payload = JSON.stringify({ from: 'noreply@resend.dev', to: [to], subject: subject, html: htmlBody }); return new Promise((resolve, reject) => { const req = https.request({ hostname: 'api.resend.com', path: '/emails', method: 'POST', headers: { 'Authorization': `Bearer ${apiKey}`, 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(payload) } }, (res) => { ``` The analysis entry point automatically uses the configured address when qualifying signals exist or `--always-send` is supplied: ```javascript if (config.alerts?.email) { if (newSignals.length > 0 || alwaysSend) { try { const subject = newSignals.length > 0 ? `🚨 Neue Trading Signale - ${new Date().toLocaleDateString('de-DE')}` : `📈 Trading Signale - ${new Date().toLocaleDateString('de-DE')}`; ...[truncated 2813 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Set the distributed default recipient to `null` and disable outbound email by default: ```json "alerts": { "email": null, "enabled": false } ``` 2. Require an explicit user action to enable email delivery and configure the recipient. 3. Display and confirm the destination before the first transmission; do not silently inherit a package-supplied recipient. 4. Access credentials only after alerting has been explicitly enabled and a recipient has been validated. 5. Prefer an explicitly supplied, narrowly scoped environment variable or user-selected credential path over automatic credential discovery. 6. Validate recipient addresses and consider an operator-maintained destination allowlist. 7. Use a least-privilege Resend API key restricted to the required sending identity and rotate any key exposed to unintended use. 8. Document the exact outbound destination, transmitted fields, trigger conditions, and credential requirements in `SKILL.md`. 9. Separate market analysis from email delivery so users can run analysis without granting access to email-service credentials. ]]>
