T09 · Insecure Skill Coding Practices
- Location
rss-redirect-server.js:29- Finding
Unauthenticated Public Disclosure and Deletion of Click-Tracking Data
- Content
View full analysis
${originalUrl}\n`); res.writeHead(302, { 'Location': originalUrl, 'Cache-Control': 'no-store, no-cache, must-revalidate', 'Pragma': 'no-cache' }); res.end(); return; } if (pathname === '/health') { res.writeHead(200, { 'Content-Type': 'text/plain' }); res.end('OK\nTunnel: ' + TUNNEL_URL); return; } if (pathname === '/clicks') { res.writeHead(200, { 'Content-Type': 'text/plain', 'Access-Control-Allow-Origin': '*' }); try { res.end(fs.readFileSync(LOG_FILE, 'utf8')); } catch (e) { res.end(''); } return; } if (pathname === '/clear') { fs.writeFileSync(LOG_FILE, ''); res.writeHead(200, { 'Content-Type': 'text/plain' }); res.end('Cleared'); return; } if (pathname === '/newclicks') { // Return clicks recorded after the supplied timestamp. const since = parsedUrl.query.since || '0'; const sinceTime = new Date(parseInt(since)); try { const data = fs.readFileSync(LOG_FILE, 'utf8'); const lines = data.trim().split('\n').filter(l => { const ts = l.match(/^\[(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2})\]/); return ts && new Date(ts[1]) > sinceTime; }); res.end(lines.join('\n')); } catch (e) { res.end(''); } return; } ``` ```javascript server.listen(PORT, '0.0.0.0', () => { console.log(`Server on port ${PORT}`); startTunnel(); }); ``` ### Technical Analysis The service records each visitor's source IP address and decoded destination URL in `/tmp/rss-clicks.log`. The `/clicks` and `/newclicks` endpoints disclose that information without authentication, while `/clear` permits unauthenticated deletion. The server ...[truncated 1529 chars]- Remediation
View remediation
