Back to skill

Security audit

herclaw-agentsystem

Security checks for vulnerabilities and agentic risk

Overview

This looks like a self-learning agent framework, but it gives itself persistent memory, generated-skill deployment, remote upload/deployment paths, and automatic nudges without enough scoping or user-control safeguards.

Review this carefully before installing. Use it only in a controlled single-user environment unless the publisher adds explicit consent gates, per-user data isolation, secret redaction, retention controls, HTTPS allowlists for remote endpoints, safe path validation, and human approval before generated skills, nudges, backups, deletion, sync, or deployment run.

Vulnerability Patterns
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
Findings (9)

T05 · Unauthorized Access and Privilege Escalation

Error
Location
scripts/memory_manager.py:89
Finding

Persistent Memory Does Not Enforce User Isolation

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/memory_manager.py:173
Finding

Sensitive Interaction Data and Backups Are Stored in Plaintext

Content
View full analysis
Remediation
View remediation

T01 · Skill Instruction Hijacking

Error
Location
scripts/skill_creator.py:247
Finding

Untrusted Experience Data Can Poison Auto-Generated Skill Instructions

Content
View full analysis
Dict: results = { 'passed': 0, 'failed': 0, 'total': len(test_cases), 'details': [] } for case in test_cases: try: expected = case.get('expected_outcome', 'success') actual = case.get('simulated_outcome', 'success') if expected == actual: results['passed'] += 1 results['details'].append({ 'case': case['name'], 'status': 'passed' }) ``` ```python skill_path = skill_dir / 'SKILL.md' with open(skill_path, 'w', encoding='utf-8') as f: f.write(skill.to_skill_md()) skill_record = { 'name': skill.name, 'description': skill.description, 'confidence': skill.confidence, 'created_at': skill.created_at, 'status': 'deployed', 'path': str(skill_dir) } ``` ### Technical Analysis Action strings from stored experiences are treated as trusted Skill instructions and inserted verbatim into a generated `SKILL.md`. No distinction exists between descriptive data and executable Agent directives. The purported sandbox only writes the document to a temp ...[truncated 1510 chars]
Remediation
View remediation

T05 · Unauthorized Access and Privilege Escalation

Error
Location
scripts/skill_creator.py:487
Finding

Unvalidated Skill Names Permit Filesystem Path Traversal

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/skill_creator.py:643
Finding

Configurable Hub Endpoint Can Exfiltrate API Credentials and Skill Content

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/self_evolution.py:823
Finding

Remote Deployment Transmits Tokens and Behavior Models over Configurable Plaintext HTTP

Content
View full analysis
Remediation
View remediation

T02 · Agent Memory Poisoning

Warning
Location
scripts/pattern_recorder.py:112
Finding

Pattern Recording Consent Control Defaults to Approval

Content
View full analysis
str: """ Record a new pattern. IMPORTANT: user_confirmed must be True for pattern to be stored. """ if not user_confirmed: print("⚠️ Pattern recording requires user confirmation") return "" ``` ```python pattern = Pattern( id=pattern_id, name=name or self._generate_name(task_type, steps), description=description or f"自动记录的{task_type}工作流程", task_type=task_type, steps=steps, conditions=context, success_rate=1.0 if success else 0.0, usage_count=1, created_at=now, updated_at=now, user_confirmed=True ) ``` ### Technical Analysis The API claims that explicit confirmation is mandatory, but the confirmation parameter defaults to `True`. Any caller that omits the argument is treated as having obtained consent. The stored record is then unconditionally marked confirmed. A plain Boolean supplied by the same caller that requests storage also does not provide evidence that the user actually approved the operation. ### Attack Path 1. An application or malicious integration calls `record()` with attacker-controlled steps and context. 2. The caller omits `user_confirmed`. 3. The default value evaluates to `True`, so the record is accepted. 4. The pattern is persisted with `user_confirmed=True`. 5. Future pattern recall can expose or apply the unapproved workflow. ### Impact Assessment Unapproved workflow steps and contextual data can persist across sessions and influence future recommendations or generated Skills. The scope is the local pattern database and downstream co ...[truncated 40 chars]
Remediation
View remediation

T02 · Agent Memory Poisoning

Warning
Location
scripts/nudge_system.py:199
Finding

Proactive Nudges Can Trigger State-Changing Actions Without Fresh Authorization

Content
View full analysis
Dict: stats = self.memory.get_stats() if nudge.data.get('action') == 'cleanup': cleanup_result = self.memory.cleanup() return {'action': 'cleanup', 'result': cleanup_result} elif nudge.data.get('action') == 'backup': backup_path = nudge.data.get( 'backup_path', './memory_backup.json' ) self.memory.backup(backup_path) return {'action': 'backup', 'path': backup_path} ``` ```python def execute(self, nudge: Nudge) -> Dict: experiences = nudge.data.get('experiences', []) if experiences: results = self.creator.scan_and_create(experiences) return { 'created_skills': len( [r for r in results if r['success']] ), 'results': results } ``` ```python for nudge in due_nudges: result = self._execute_nudge(nudge) results.append(result) ``` ### Technical Analysis The experience-count condition does not inspect an actual count and always evaluates as satisfied. A persisted condition-based Skill-creation nudge can therefore run on the next scheduler check regardless of its configured threshold. Handlers can create and deploy generated Skills, delete old memory, or write complete backups. Execution does not require fresh authorization at the time of the state-changing action. Stored nudge data is also loaded from JSON without integrity verification. This is application-level cross-session automation. The code does not install an operating-sys ...[truncated 837 chars]
Remediation
View remediation

T08 · Insecure Dependencies

Note
Location
requirements.txt:1
Finding

Runtime Network Dependency Is Undeclared and Unpinned

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • System Prompt LeakageDirect Leakage, Indirect Extraction, Tool-Based Exfiltration
  • Memory PoisoningPersistent Context Injection, Context Window Stuffing, Memory Manipulation
  • Rogue AgentSelf-Modification, Session Persistence
Findings (46)

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

The code chunk only provides the persistent memory portion of the declared system. It does align with the 'cross-session three-layer memory' claim by implementing episodic memory, semantic knowledge storage, and a user model/preferences layer with local persistence. However, there is no code for autonomous learning from experience, no pattern extraction or skill generation, no reinforcement-learning or self-improvement logic, and no trigger/nudge mechanism. Therefore the declared description materially overstates the implemented capabilities relative to this code chunk.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The declared description significantly overstates and mischaracterizes the code. The supplied module is narrowly focused on recording and recalling task patterns, with user confirmation gating storage. It uses SQLite for persistence, computes simple match scores from context, success rate, usage, and recency, and supports basic pattern management operations. There is no evidence of autonomous agent behavior, reinforcement learning, self-evolution, automatic skill generation, layered memory systems, or proactive nudging. While the pattern store could be considered a small supporting piece of a larger learning system, this code chunk by itself does not substantiate the declared framework and instead has a materially different and much narrower purpose.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

The code partially matches the declared 'self-evolution' / RL continuous improvement portion: it collects trajectories, computes rewards, trains a simplified policy model, monitors performance, and can deploy/rollback models. However, several major declared features are absent from this chunk: there is no autonomous skill generation, no persistent cross-session memory layer, and no proactive nudge/trigger mechanism. More importantly, the code includes an undeclared capability: remote deployment to staging/production environments using HTTP requests with auth tokens from environment variables, plus health checks. That is a materially different operational capability involving network access and remote system interaction, which is not represented in the description or declared permissions. Therefore the description does not accurately represent the supplied code chunk.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

The declared description presents a broad self-improving agent framework with several major subsystems: autonomous learning, reinforcement-learning-based self-evolution, persistent multi-layer memory, and a nudge/proactive trigger system. The supplied code chunk does not implement those broader framework features. Instead, it is a narrower module centered on skill creation from experience patterns. It scans experience records, infers task types heuristically, generates templated skill definitions, performs lightweight simulated validation, stores skills in a local registry, supports rollback, and includes an undeclared HubSync component that uploads/fetches skills over the network using an API key. While 'Skill Creation' is consistent with one declared feature, the actual code materially underdelivers on the main declared framework claims and also adds undeclared remote-sync/marketplace behavior. Therefore the description does not accurately represent this code chunk.

Content

No source excerpt is available for this finding.

Memory Manipulation

High
Category
Memory Poisoning
Confidence
80% confidence
Finding

Skill manipulates agent memory, state, or stored context. Memory corruption can alter personality, override safety rules, or cause unpredictable behavior.

Content

Scanner excerpt · references/memory-system.md (reported line 197)May include surrounding context.

md
1. **Local-Only Storage**: No cloud or external storage
2. **User Consent**: All operations require user awareness
3. **Data Minimization**: Only store necessary information
4. **Easy Deletion**: Users can clear memory anytime

### Data Access Control

Memory Manipulation

High
Category
Memory Poisoning
Confidence
80% confidence
Finding

Skill manipulates agent memory, state, or stored context. Memory corruption can alter personality, override safety rules, or cause unpredictable behavior.

Content

Scanner excerpt · references/pattern-recording.md (reported line 274)May include surrounding context.

md
### Do's ✅

1. **Always confirm with user** before recording
2. **Include clear context** conditions
3. **Track success metrics** actively
4. **Cleanup low-quality patterns** regularly
5. **Use descriptive names** for patterns

Intent-Code Divergence

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

clear_all is documented as clearing memory for a single user, but it deletes all episodes and all knowledge globally while only restricting deletion of user_models by user_id. In a multi-user or shared-agent deployment, one user's request could destroy other users' data, causing cross-tenant data loss and denial of service.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The comment states that deployment is simulated, but the implementation imports requests and performs a real HTTP POST with authorization headers and model data. This mismatch is dangerous because reviewers or operators may underestimate the code’s capability, leading to accidental execution of live remote changes and unnoticed data transmission.

Content

No source excerpt is available for this finding.

Direct Prompt Extraction

High
Category
System Prompt Leakage
Confidence
85% confidence
Finding

Skill contains instructions that could directly expose system prompts, internal rules, or hidden instructions to users or external parties.

Content

Scanner excerpt · scripts/skill_creator.py (reported line 331)May include surrounding context.

python
actions_text = "\n".join([f"   {i+1}. {action}" for i, action in enumerate(pattern['common_actions'])])
            instructions += f"\n\n## Detected Action Pattern\n{actions_text}"
        
        return instructions
    
    def _generate_triggers(self, pattern: Dict, opportunity: Opportunity) -> Dict:
        """Generate skill triggers."""

Self-Modification

High
Category
Rogue Agent
Confidence
85% confidence
Finding

Skill modifies its own code, configuration, or behavior at runtime. Self-modification enables an agent to escalate privileges, disable safety constraints, or install persistent backdoors.

Content

Scanner excerpt · scripts/skill_creator.py (reported line 396)May include surrounding context.

python
"""Create isolated sandbox for testing."""
        sandbox_dir = tempfile.mkdtemp(prefix='skill_sandbox_')
        
        # Write skill file
        skill_path = os.path.join(sandbox_dir, 'SKILL.md')
        with open(skill_path, 'w', encoding='utf-8') as f:
            f.write(skill.to_skill_md())

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
84% confidence
Finding

The skill presents code and architecture that imply broad capabilities including persistent storage, filesystem interaction, and likely networked components, but it declares no explicit tool scope or permission boundaries. In an autonomous, self-improving agent context, missing capability declarations increase the chance of overbroad execution and reduce a user's ability to assess what the skill may access or modify.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The skill advertises persistent memory and a user model but does not warn users that their inputs, context, and inferred preferences may be stored across sessions. In a system centered on autonomous learning, omission of this notice undermines informed consent and increases privacy and data-governance risk.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The skill describes autonomous skill generation and self-evolution without warning users that behavior may change over time or that new capabilities may be synthesized automatically. That creates governance and safety risk because users may rely on a stable behavior profile while the system can alter itself or expand its functionality.

Content

No source excerpt is available for this finding.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The interaction capture logic stores full user_input, context, actions, outcome, feedback, and embeddings, then persists them without any stated filtering, minimization, or sensitive-data restrictions. In an autonomous memory system, this can accumulate secrets, personal data, or confidential context that may later be retrieved, exposed in prompts, or mishandled across sessions.

Content

No source excerpt is available for this finding.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The persistent memory design retrieves user-model data and prior experiences as future context, which can surface private historical information in later prompts or outputs. Because this skill's purpose is cross-session learning and adaptation, the context makes the issue more dangerous: sensitive data is not only retained, but actively reused to influence future behavior.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The documentation promises user awareness and privacy-first handling, but the backup() and restore() examples lack any user identity, consent check, or audit context. In a persistent memory system, restore operations can reintroduce deleted data or import another user's state, creating privacy and integrity risks if implemented as shown.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
87% confidence
Finding

The usage examples hard-code Chinese text for both user_input and query, which presents the skill as operating in a specific language by default. The document does not state that the memory system is region-specific or provide any user opt-in or language selection, so this is a natural-language locale policy concern.

Content

No source excerpt is available for this finding.

Autonomous Decision Making

Medium
Category
Excessive Agency
Confidence
75% confidence
Finding

Skill enables autonomous high-impact decisions without human-in-the-loop verification. Critical operations (destructive commands, financial transactions, data deletion) should require explicit user confirmation.

Content

Scanner excerpt · references/memory-system.md (reported line 332)May include surrounding context.

md
2. **Monitor Size**: Keep storage under limit
3. **Backup Important Data**: Before major operations
4. **User Awareness**: Inform users about memory usage
5. **Privacy First**: Never store sensitive data without consent

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

This markdown file includes a user interaction example entirely in Chinese, including the confirmation phrase the user is expected to provide. Because the document does not offer a language choice or explain that the skill is intentionally region-specific, it implies a fixed language behavior that may violate language/locale policy requirements.

Content

No source excerpt is available for this finding.

Autonomous Decision Making

Medium
Category
Excessive Agency
Confidence
75% confidence
Finding

Skill enables autonomous high-impact decisions without human-in-the-loop verification. Critical operations (destructive commands, financial transactions, data deletion) should require explicit user confirmation.

Content

Scanner excerpt · references/pattern-recording.md (reported line 281)May include surrounding context.

md
### Don'ts ❌

1. **Never record without confirmation**
2. **Don't store sensitive information** in patterns
3. **Avoid overly specific patterns** (low reusability)
4. **Don't ignore quality metrics**

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The recommendation display hard-codes the agent's user-facing response in Chinese, which can violate language/locale policy when users have not opted into that language. The surrounding documentation does not indicate this is a China-specific skill or provide any mechanism for user language selection.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The code example emits a progress message using Chinese text (执行:), which imposes a specific language for runtime interaction. There is no indication that the language is configurable or that the skill is limited to a Chinese-language context.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The module explicitly promises user awareness and consent, but the implementation performs persistence, retrieval, cleanup, deletion, and backup with no consent, authentication, or authorization enforcement. In a self-improving agent with persistent cross-session memory, this mismatch can lead to silent collection and processing of sensitive user data contrary to user expectations and policy claims.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The example invocation hard-codes Chinese-language user input and outcome strings, which signals a language-specific interaction pattern in the skill file without offering any user choice or documenting this as a justified locale-specific tool. Under the language/locale policy, forcing a specific language without opt-in is a natural-language policy concern.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The scheduler persists nudge metadata and associated data to disk automatically in nudges.json without any consent, disclosure, retention limit, or access control. Because nudge payloads can include experiences and operational context, this creates a privacy and local data-exposure risk if the host is shared, backed up, or inspected by other processes/users.

Content

No source excerpt is available for this finding.