T02 · Agent Memory Poisoning
- Location
scripts/generate-report.sh:8- Finding
Untrusted Remote Content Is Persisted in Agent Memory Without Sanitization
- Content
View full analysis
/dev/null else curl -s --max-time 10 "$url" -o "$output" 2>/dev/null fi } ``` For example, the Weibo response is transformed without validating or sanitizing the remote title: ```bash # scripts/fetch-hotspots.sh:48-58 if [[ "$USE_REAL_API" == "true" ]]; then # 尝试真实API(需要代理或特殊处理) local url="https://weibo.com/ajax/side/hotSearch" if fetch_url "$url" "$output.tmp"; then # 解析真实数据 if jq -e '.ok' "$output.tmp" > /dev/null 2>&1; then jq '[.data.realtime[] | {rank: .rank, title: .word, heat: .realpos, tag: .icon_desc}] | {platform: "weibo", date: "'$DATE'", time: "'$TIME'", data: .}' "$output.tmp" > "$output" rm -f "$output.tmp" log_info "微博热搜(真实数据)已保存" return fi fi ``` The same pattern is used for Baidu, Zhihu, and the third-party Douyin endpoint at `scripts/fetch-hotspots.sh:97-106`, `146-155`, and `195-204`. The report generator then renders remote titles verbatim: ```bash # scripts/generate-report.sh:25-41 generate_weibo_section() { local latest_file=$(ls -t "$DATA_DIR"/weibo_${DATE}_*.json 2>/dev/null | head -1) if [[ -z "$latest_file" ]]; then echo "⚠️ 未找到微博热搜数据" return fi echo "## 📱 微博热搜 TOP10" echo "" jq -r '.data[] | "\(.rank). \(.title) 🔥 \(.heat | tostring)热度"' "$latest_file" | head -10 echo "" } ...[truncated 3176 chars]- Remediation
View remediation
