Back to skill

Security audit

wk-govern-skill

Security checks for vulnerabilities and agentic risk

Overview

ClawScan rates this skill suspicious because a confirmed concern says its Git status check may run commands from an untrusted repository configuration; the overall confidence is medium.

Consider the confirmed Git configuration risk and the missing tool-scope declaration before installing. The PyYAML version also remains unverified. The scan inspected all listed components but reported several unresolved local references, so its evidence has caveats.

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
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Rogue AgentSelf-Modification, Session Persistence
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
Findings (18)

Self-Modification

High
Category
Rogue Agent
Confidence
90% 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 · references/commands.md (reported line 110)May include surrounding context.

md
| revision_conflict、git_revision_conflict、candidate_git_revision_conflict、candidate_repository_conflict | 定向检查活跃目标与原候选,保留旧证据,按新检查结果重新暂存;不要改指纹或强行覆盖。 |
| editable_stage_required、fixed_editable_directory_required、linked_write_path | 使用 stage-git --editable 返回的原 stage 与固定真实编辑目录,不重定向到其他路径。 |
| candidate_entry_required、upstream_name_change_requires_discussion、candidate_description_required | 恢复合法 SKILL.md、原 name 和非空简介;改名需求另行讨论。 |
| editable_contains_git_metadata、incomplete_tree_or_internal_links、self_update_payload_contains_runtime_data | 从编辑目录移除误带的 Git 元数据、内部链接或本机运行数据,重新审阅后封存;不动活跃技能或原 payload。 |
| git_update_requires_repository_payload | Git 定制更新改用上述可编辑暂存路线,不把无 .git 的编辑副本直接交给 stage-copy。 |

应用失败查看报告中的 recovery_archive、backup、restored/restore_error:恢复成功仅代表当前项恢复,已成功项不回退;恢复失败保留现场和备份,说明活跃文件可能受影响,停止本批。不要自动重试或扩大权限。

Self-Modification

High
Category
Rogue Agent
Confidence
90% 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 · tests/test_govern.py (reported line 314)May include surrounding context.

python
ops.apply_update(self.config, self.root, stage, 'New', True)
        self.assertTrue((target / 'old.txt').is_file())

    def test_self_update_preserves_runtime_and_excludes_it_from_fingerprint(self):
        self.root = Path(self.roots['global']) / 'wk-govern-skill'
        self.root.mkdir()
        self.config = lib.setup(self.root, 'ja', 'follow', roots=self.roots)

Self-Modification

High
Category
Rogue Agent
Confidence
90% 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 · tests/test_govern.py (reported line 879)May include surrounding context.

python
with self.assertRaisesRegex(ValueError, 'incomplete_tree_or_internal_links'):
            ops.seal_stage(self.config, self.root, Path(staged['stage']), staged['candidate_revision'])

    def test_seal_rejects_self_update_runtime(self):
        _, target, staged, edit = self.editable_stage()
        # 将工具根迁入同一受管实体,模拟真实自更新;不修改任何实库。
        old_root = self.root

Self-Modification

High
Category
Rogue Agent
Confidence
90% 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 · tests/test_govern.py (reported line 891)May include surrounding context.

python
info['editable_path'] = str(stage / 'editable')
        lib.save_json(stage / 'manifest.json', info)
        (stage / 'editable/inventory.json').write_text('{}')
        with self.assertRaisesRegex(ValueError, 'self_update_payload_contains_runtime_data'):
            ops.seal_stage(self.config, self.root, stage, staged['candidate_revision'])

    def test_sealed_tampering_and_failed_seal_cannot_be_applied(self):

Self-Modification

High
Category
Rogue Agent
Confidence
90% 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/operations.py (reported line 330)May include surrounding context.

python
for name in RUNTIME:
            item = payload / name
            if exists(item):
                raise ValueError('self_update_payload_contains_runtime_data')
    info = dict(id=token, target=str(path), expected_revision=revision,
                candidate_revision=snapshot(payload, root)['fingerprint'],
                upstream_revision=upstream_revision, source_kind=current['source']['kind'],

Self-Modification

High
Category
Rogue Agent
Confidence
90% 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/operations.py (reported line 418)May include surrounding context.

python
if not isinstance(meta.get('description'), str) or not meta['description'].strip():
        raise ValueError('candidate_description_required')
    if key(path) == key(root) and any(exists(edit / name) for name in RUNTIME):
        raise ValueError('self_update_payload_contains_runtime_data')
    if edited['fingerprint'] == revision:
        verify(edit, root, edited['fingerprint'])
        check_original()

exec() call detected

High
Category
Dangerous Code Execution
Confidence
85% confidence
Finding

Direct exec() call allows arbitrary code execution. An attacker can inject code that runs with the full privileges of the process.

Content

Scanner excerpt · tests/test_govern.py (reported line 814)May include surrounding context.

python
result = ops.apply_update(self.config, self.root, Path(sealed['stage']), 'Process tables and audit records.', True)
        self.assertTrue(result['applied'])
        namespace = {}
        exec((target / 'tool.py').read_text(), namespace)
        self.assertEqual((namespace['VERSION'], namespace['LOCAL_MULTIPLIER']), (2, 7))
        self.assertIn('audit', namespace['FEATURES'])
        self.assertIn(b'User paragraph', (target / 'SKILL.md').read_bytes())

Skill declares no tool scope ('permissions' or 'allowed-tools') but code capabilities were detected: env, file_read, file_write, shell.

Medium
Category
MCP Least Privilege
Confidence
70% confidence
Finding

Without declared permissions the skill's intent is opaque and cannot be validated.

Content

No source excerpt is available for this finding.

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
94% confidence
Finding

Although the argument-list invocation avoids ordinary shell interpolation, Git can execute commands specified by repository configuration. update_checks runs git status on managed repositories without disabling executable configuration such as core.fsmonitor, so an attacker-controlled repository configuration could turn an apparently read-only update check into code execution with the agent's privileges.

Content

Scanner excerpt · scripts/library.py (reported line 201)May include surrounding context.

python
def git(path, *args):
    result = subprocess.run(['git', '-C', str(path), *args], capture_output=True, text=True,
                            encoding='utf-8', errors='replace', timeout=45,
                            env={**os.environ, 'GIT_OPTIONAL_LOCKS': '0', 'GIT_TERMINAL_PROMPT': '0'})
    return dict(exit_code=result.returncode, stdout=result.stdout.strip(), stderr=result.stderr.strip())

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/operations.py (reported line 356)May include surrounding context.

python
raise ValueError('unsupported_upstream_ref')
    acquisition = work_root(root) / 'staging' / ('acquire-' + uuid.uuid4().hex)
    acquisition.parent.mkdir(parents=True, exist_ok=True)
    result = subprocess.run(['git', 'clone', '--no-hardlinks', '--single-branch', '--branch', branch,
                             '--', check['remote_url'], str(acquisition)], capture_output=True,
                            text=True, encoding='utf-8', errors='replace', timeout=120,
                            env={**os.environ, 'GIT_TERMINAL_PROMPT': '0'})

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/operations.py (reported line 588)May include surrounding context.

python
command = [executable, '-NoProfile', '-ExecutionPolicy', 'Bypass', '-File', str(script)]
    diagnostics['command'] = command
    try:
        completed = subprocess.run(command, capture_output=True, text=True, encoding='utf-8',
                                   errors='replace', timeout=30)
    except (OSError, subprocess.TimeoutExpired) as error:
        diagnostics['reason'] = ('timeout' if isinstance(error, subprocess.TimeoutExpired)

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · tests/test_govern.py (reported line 361)May include surrounding context.

python
def test_cli_missing_setup_and_missing_scope_do_not_scan(self):
        command = [sys.executable, str(SCRIPTS / 'govern.py'), '--root', str(self.root)]
        status = subprocess.run(command + ['status'], capture_output=True, text=True, encoding='utf-8')
        self.assertFalse(json.loads(status.stdout)['setup_required'])
        scope = subprocess.run(command + ['scan'], capture_output=True, text=True, encoding='utf-8')
        self.assertNotEqual(scope.returncode, 0)

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · tests/test_govern.py (reported line 363)May include surrounding context.

python
command = [sys.executable, str(SCRIPTS / 'govern.py'), '--root', str(self.root)]
        status = subprocess.run(command + ['status'], capture_output=True, text=True, encoding='utf-8')
        self.assertFalse(json.loads(status.stdout)['setup_required'])
        scope = subprocess.run(command + ['scan'], capture_output=True, text=True, encoding='utf-8')
        self.assertNotEqual(scope.returncode, 0)
        self.assertFalse((self.root / 'inventory.json').exists())
        empty_root = self.base / 'uninitialized'

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · tests/test_govern.py (reported line 367)May include surrounding context.

python
self.assertNotEqual(scope.returncode, 0)
        self.assertFalse((self.root / 'inventory.json').exists())
        empty_root = self.base / 'uninitialized'
        missing = subprocess.run([sys.executable, str(SCRIPTS / 'govern.py'), '--root', str(empty_root),
                                  'check', '--skill', 'sample'], capture_output=True, text=True, encoding='utf-8')
        self.assertEqual(json.loads(missing.stdout)['error'], 'setup_required')
        self.assertFalse(empty_root.exists())

Environment Pass-Through to Child Process

Low
Category
Data Exfiltration
Confidence
20% confidence
Finding

The copy of os.environ is only handed to a child process launched through subprocess or asyncio, so the child receives the environment the skill already runs in. No other read of the copy was found.

Content

Scanner excerpt · scripts/library.py (reported line 203)May include surrounding context.

python
def git(path, *args):
    result = subprocess.run(['git', '-C', str(path), *args], capture_output=True, text=True,
                            encoding='utf-8', errors='replace', timeout=45,
                            env={**os.environ, 'GIT_OPTIONAL_LOCKS': '0', 'GIT_TERMINAL_PROMPT': '0'})
    return dict(exit_code=result.returncode, stdout=result.stdout.strip(), stderr=result.stderr.strip())

Environment Pass-Through to Child Process

Low
Category
Data Exfiltration
Confidence
20% confidence
Finding

The copy of os.environ is only handed to a child process launched through subprocess or asyncio, so the child receives the environment the skill already runs in. No other read of the copy was found.

Content

Scanner excerpt · scripts/operations.py (reported line 359)May include surrounding context.

python
result = subprocess.run(['git', 'clone', '--no-hardlinks', '--single-branch', '--branch', branch,
                             '--', check['remote_url'], str(acquisition)], capture_output=True,
                            text=True, encoding='utf-8', errors='replace', timeout=120,
                            env={**os.environ, 'GIT_TERMINAL_PROMPT': '0'})
    if result.returncode:
        raise ValueError('git_staging_failed:' + result.stderr.strip())
    head = git(acquisition, 'rev-parse', 'HEAD')

Dynamic attribute access via getattr()

Low
Category
Dangerous Code Execution
Confidence
50% confidence
Finding

Dynamic getattr() with a non-literal attribute name can access arbitrary object attributes, potentially bypassing access controls.

Content

Scanner excerpt · scripts/operations.py (reported line 595)May include surrounding context.

python
else 'tool_missing' if isinstance(error, FileNotFoundError)
                                 else 'permission_denied' if isinstance(error, PermissionError) else 'unknown')
        for field in ('stdout', 'stderr'):
            value = getattr(error, field, '') or ''
            diagnostics[field] = value.decode('utf-8', errors='replace') if isinstance(value, bytes) else value
        raise JunctionError(str(error), diagnostics) from error
    diagnostics.update(returncode=completed.returncode, stdout=completed.stdout, stderr=completed.stderr)

Unverifiable Dependency: PyYAML has 8 known advisory(ies) (CVE-2019-20477 (Deserialization of Untrusted Data in PyYAML); CVE-2020-1747 (Improper Input Validation in PyYAML); CVE-2020-14343 (Improper Input Validation in PyYAML) +5 more), but the manifest does not pin a version, so it is unknown whether the installed release is affected

Low
Category
Supply Chain
Confidence
40% confidence
Finding

OSV returned advisories for this package, but its resolved version is unknown. A package-name lookup does not establish whether the installed release is affected by those advisories.

Content

No source excerpt is available for this finding.