T02 · Agent Memory Poisoning
- Location
sync.js:35- Finding
Untrusted Calendar Content Is Persisted into Agent State and HEARTBEAT.md
- Content
View full analysis
{ const t = parseInt(e.start_time.timestamp); return t < (Date.now()/1000 + 86400); }); if (next24h.length === 0) { calendarSection = "## 📅 Calendar (Next 24h)\n\n- No upcoming events in the next 24 hours.\n"; } else { next24h.forEach(e => { const start = getTimestampCST(parseInt(e.start_time.timestamp) * 1000).split(' ')[1]; calendarSection += `- [ ] ${start} - ${e.summary}\n`; }); } const calendarRegex = /## (?:📅 )?Calendar.*?(?=\n## |$)/s; if (calendarRegex.test(heartbeatContent)) { heartbeatContent = heartbeatContent.replace(calendarRegex, calendarSection.trim()); } else { const insertPos = heartbeatContent.indexOf('## Morning'); if (insertPos !== -1) { heartbeatContent = heartbeatContent.slice(0, insertPos) + calendarSection + "\n" + heartbeatContent.slice(insertPos); } else { heartbeatContent += "\n" + calendarSection; } } fs.writeFileSync(heartbeatPath, heartbeatContent, 'utf8'); } ``` ### Technical Analysis Calendar events are obtained from the external Feishu service and written into two persistent project-level files. In particular, `e.summary` is interpolate ...[truncated 2201 chars]- Remediation
View remediation
