T02 · Agent Memory Poisoning
- Location
src/index.js:139- Finding
Persistent Agent Memory Poisoning Through Untrusted Ingested Content
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill does what it claims, but it persists Discord, web, file, and chat-export content into agent memory using several under-scoped URL, file-write, and subprocess patterns that need review before installation.
Install only if you are comfortable giving this skill access to the specific Discord channels, local files, URLs, and memory directory you intend to ingest. Avoid autonomous or scheduled ingestion until URL allowlists, file path containment, secret-safe subprocess use, and privacy/retention rules are added; sanitize chat exports and web content before storing them in agent memory.
src/index.js:139Persistent Agent Memory Poisoning Through Untrusted Ingested Content
src/index.js:139Server-Side Request Forgery Through Unrestricted URL Ingestion
src/index.js:219Arbitrary File Append Through Unsanitized Memory Filename
AGENT_GUIDE.md:171Shell Command Injection and Secret Exposure in Documented Agent Subprocess Pattern
Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).
### Duplicates still being imported
- Verify dedup is enabled (default): check `~/.openclaw/workspace/memory/.ingest_hashes.json`
- Reset hashes if needed: `rm ~/.openclaw/workspace/memory/.ingest_hashes.json`
### JSON parsing errors
- Ensure input is valid JSON: `cat input.json | jq .` should work
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
# Option 1: Environment variable
export DISCORD_TOKEN="your_token_here"
# Option 2: .env file (add to .gitignore)
echo "DISCORD_TOKEN=your_token_here" > .env
# Option 3: OpenClaw secret vault (recommended)
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
# Option 1: Environment variable
export DISCORD_TOKEN="your_token_here"
# Option 2: .env file (add to .gitignore)
echo "DISCORD_TOKEN=your_token_here" > .env
# Option 3: OpenClaw secret vault (recommended)
Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).
1. Bump version in package.json
2. Create git tag: `git tag vX.Y.Z`
3. Push: `git push origin vX.Y.Z`
4. Re-submit to ClawhHub with new version
## Cross-Linking
The description overstates the scope of this code chunk. The implementation is narrowly focused on Discord data access: logging into Discord, fetching forum/thread/channel content, extracting metadata, and normalizing messages into a record format. While comments mention integration with a deduplication framework, no actual record-level deduplication logic appears here; the only dedupe present is removing duplicate URLs in extracted links, which is not the same as automatic ingestion deduplication. Likewise, there is no evidence of multi-source support in this chunk, nor any agent-ready orchestration/pattern features. Discord support is accurately represented, but the overall declared purpose does not accurately match this code chunk.
The description is broader than the supplied code. This chunk is not a general multi-source ingestion component; it is a Discord-specific ingestion runner focused on forum content. While it does support ingestion and can invoke deduplication behavior through the ingest module, deduplication is not implemented here directly and may be skipped depending on configuration. Additionally, the code includes an undeclared capability to write intermediate results to the filesystem when outputPath is provided. 'Agent-ready patterns' is vague, but the code does expose autonomous ingestion modes and progress handling, so that part is not clearly inconsistent. Overall, the description does not accurately match this specific code chunk.
The code generally matches the core idea of multi-source memory ingestion and includes automatic deduplication for files, JSON, and text. However, the description explicitly claims Discord support, and there is no Discord-specific ingestion path, API integration, parser, or trigger in the code. Instead, the implemented sources are files, URLs, JSON, and text. The code also clearly performs local filesystem reads/writes and URL network fetching, while the declared permissions are empty. Those are meaningful capabilities/resources not reflected in the declaration. 'Agent-ready patterns' is only loosely supported through frontmatter formatting and batching, but not as a distinct feature. Overall, the description is only partially accurate and omits important actual behaviors while claiming an unsupported one.
The lockfile includes brace-expansion 1.1.12, which is flagged for denial-of-service issues involving pathological brace patterns. In this skill, the package appears only as a transitive dependency used for globbing and development tooling, so the issue is real but only likely exploitable if attacker-controlled glob or brace patterns are processed.
The lockfile contains flatted 3.3.4, which is reported as vulnerable to parse-time denial of service and prototype pollution. However, it is a dev-only transitive dependency here, so the vulnerability is real in the dependency but unlikely to affect the shipped runtime unless development tooling parses attacker-supplied serialized data.
brace-expansion 2.0.2 is present and reportedly vulnerable to resource-exhaustion conditions from crafted expansion inputs. In this lockfile it is nested under glob, so the main risk is denial of service when processing attacker-controlled glob or brace syntax rather than direct code execution.
js-yaml 4.1.1 is listed with CPU-consumption issues tied to malicious YAML structures. In this file it is only a dev dependency through eslint, so the finding is valid at the dependency level but the operational risk to the skill runtime is limited unless development workflows parse untrusted YAML.
lodash 4.17.23 is present via @sapphire/shapeshift and is associated with prototype pollution and template-related code injection advisories. The code-injection path often depends on direct use of _.template, which is not demonstrated here, but prototype-pollution risks can become relevant if untrusted structured input is merged or transformed by dependent libraries.
undici 6.21.3 is a runtime network library used by discord.js and is reported with multiple HTTP parsing and smuggling class issues. Because this skill supports Discord ingestion and likely performs network communication in production, a vulnerable HTTP client stack materially increases exposure to request smuggling, header injection, or connection-poisoning scenarios.
ws 8.19.0 is a runtime websocket dependency used by the Discord stack and is flagged for memory disclosure and memory exhaustion issues. Given this skill's Discord support, websocket handling is part of the live attack surface, so malformed or adversarial traffic could plausibly affect availability or confidentiality depending on exploitability of the upstream bug.
The guide encourages autonomous Discord ingestion using a bot token and forum ID, but does not warn that Discord messages may contain personal, confidential, or regulated data that will be collected and stored in memory. In an agent-facing guide, this omission is meaningful because it normalizes bulk collection of user content without consent, minimization, or retention guidance.
The example offers an outputPath to save fetched forum data to disk but does not warn that this creates a persistent local copy of potentially sensitive conversations. This increases risk of unintended disclosure through insecure storage, backups, logs, or later reuse by other tools and agents.
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
{
type: 'urls',
data: [
'https://api.example.com/docs',
'https://api.example.com/guide'
],
metadata: {
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
{
type: 'urls',
data: [
'https://api.example.com/docs',
'https://api.example.com/guide'
],
metadata: {
The Slack export ingestion example treats team discussions as ordinary input without warning that chat exports often include sensitive business decisions, employee information, secrets, and private conversations. In a memory-ingestion skill, that omission can lead operators to ingest high-sensitivity internal communications into broader agent-accessible storage.
This markdown file documents autonomous ingestion of Discord forum content, including message text, usernames, IDs, mentions, links, and an optional outputPath for saving results, but it does not warn users that the operation may collect and persist potentially sensitive conversation data. Under the markdown-file criteria for missing user warnings, behaviours affecting user data and privacy should be disclosed explicitly.
The guide explicitly encourages ingesting data sources such as Discord, Slack, GitHub, local notes, and URLs into memory, but it does not warn that these inputs may contain credentials, personal data, proprietary discussions, or other sensitive content that could later be surfaced by retrieval. In an agent-memory context, silent persistence and later automatic recall meaningfully increases the risk of unintentional disclosure across future prompts and workflows.
Code scans file system directories looking for sensitive files. This could be reconnaissance for credential theft.
### No output after ingestion
- Run with verbose: `clawtext-ingest ... -v`
- Check memory directory: `ls -la ~/.openclaw/workspace/memory/`
- Verify ClawText clusters rebuilt: `clawtext-ingest rebuild`
### Duplicates still being imported
The examples present programmatic Discord ingestion, including use of forum/thread access tokens, without user-facing guidance on secure token handling or the sensitivity of transmitted content. In practice, agents and developers may copy these patterns into logs, config files, or subprocess calls that expose credentials and ingest private community data without adequate safeguards.
The documentation explicitly promotes scheduled ingestion and recurring Discord monitoring but does not warn users about continuous collection of third-party data, retention implications, rate limits, or the need for authorization from the monitored service/community. In an agent-focused skill, omission of these guardrails increases the chance that autonomous workflows will be deployed in ways that over-collect data or violate user expectations and platform policies.
Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.
### 2. **Agent Autonomy Guide Missing**
**Status:** No documentation for agents to use this autonomously
**Impact:** Agents won't know how to ingest data programmatically
**Fix:** Create AGENT_GUIDE.md with examples
### 3. **ClawhHub Integration Not Documented**
**Status:** No instructions on how to submit to ClawhHub
Detected: suspicious.dangerous_exec, suspicious.env_credential_access