Back to skill

Security audit

calibre-reference-ingest

Security checks for vulnerabilities and agentic risk

Overview

ClawScan’s verdict is benign with medium confidence: its scan reports no AIG findings, and the listed Skillspector alerts are mostly flagged as expected for the skill’s apparent reference-ingest purpose or arise from tests and cautionary instructions.

The verdict is benign, but confidence is medium and the tool-scope and trigger notes are worth considering before installing. The scan reports complete component coverage; however, Skillspector also reported an exit status of 1 with serializer warnings, so its result carries that caveat.

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
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Output HandlingUnvalidated Output Injection, Cross-Context Output, Unbounded Output
  • Rogue AgentSelf-Modification, Session Persistence
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
Findings (13)

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · tests/test_ebook_archive.py (reported line 56)May include surrounding context.

python
for linktype in (tarfile.SYMTYPE, tarfile.LNKTYPE):
            f = self.root / (str(linktype) + '.tar')
            with tarfile.open(f, 'w') as t:
                e = tarfile.TarInfo('escape.pdf'); e.type = linktype; e.linkname = '/etc/passwd'; t.addfile(e)
            with self.subTest(linktype=linktype), self.assertRaisesRegex(ValueError, 'links'):
                arc.inventory(f)

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · tests/test_reference_ingest.py (reported line 64)May include surrounding context.

python
self.assertNotEqual(mod.canonical_url('https://example.org/docs/'), mod.canonical_url('https://example.org/docs'))

    def test_rejects_credential_urls(self):
        for url in ('https://***@example.org/doc', 'file:///etc/passwd', 'https://example.org/doc?access_token=%2A%2A%2A', 'https://example.org/doc?X-Amz-Signature=%2A%2A%2A', 'https://example.org/a b'):
            with self.subTest(url=url), self.assertRaises(ValueError):
                mod.canonical_url(url)

Skill declares no tool scope ('permissions' or 'allowed-tools') but code capabilities were detected: env, file_read, file_write, network, 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.

Shadow Command Trigger

Medium
Category
Trigger Abuse
Confidence
70% confidence
Finding

Shadow Command Trigger: description clause 'Invoke proactively during research under a standing auto-save instruction, without waiting for a save request' conflicts with built-in command 'save'

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
60% confidence
Finding

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.

Content

Scanner excerpt · SKILL.md (reported line 40)May include surrounding context.

md
- Archive manifests require both archive_member and archive_sha256. Member-aware source identity keeps different books in one archive distinct; file SHA256 still catches the same ebook from other downloads. One manifest per selected book.
   - Completion: evidenced metadata, truthful stored-file coverage, chosen tags, clean source URL, and archive provenance where applicable.

4. Create a saved dry-run plan. Choose a new private RUN directory under ~/.local/state/calibre-reference-ingest/runs/REF_ID (or an explicit user state/cache path).

       python3 "{baseDir}/scripts/reference_ingest.py" prepare \
         --input-json /absolute/reference.json --run-dir /absolute/NEW-run \

Autonomous Decision Making

Medium
Category
Excessive Agency
Confidence
80% 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 · SKILL.md (reported line 58)May include surrounding context.

md
- The helper checks original-file hashes, repeats duplicate lookup, takes a local per-library lock, writes an intent receipt, adds one ebook and sets metadata only on its token-identified new record. Credentials use CALIBRE_USERNAME/CALIBRE_PASSWORD or --username/--password-env; passwords go through Calibre stdin, never raw argv or plans. No dotenv loading or server discovery.
   - Completion: status=imported_verified with ID, title, tags, format and receipt_file. Readback verifies metadata and format presence, not byte-for-byte server storage, rendering or semantic completeness. Inspect the imported document if fidelity matters.
   - Timeouts, failures, existing receipts or stale locks: inspect actual state, do not blindly retry add, delete receipts/locks or automatically delete a partially imported book. Read-only verification:

         python3 "{baseDir}/scripts/reference_ingest.py" verify --plan-file /absolute/run/plan.json

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/reference_ingest.py (reported line 154)May include surrounding context.

python
cmd += ['--password', '<stdin>']
        env = {k: os.environ[k] for k in ('PATH', 'HOME', 'LANG', 'LC_ALL', 'SYSTEMROOT', 'WINDIR', 'CALIBRE_CONFIG_DIRECTORY', 'QT_QPA_PLATFORM') if k in os.environ}
        try:
            p = subprocess.run(cmd, input=self.secret, text=True, capture_output=True, timeout=150, env=env)
        except (OSError, subprocess.TimeoutExpired) as exc:
            raise RuntimeError('calibredb could not complete; inspect any apply receipt before retrying') from exc
        if p.returncode:

Tainted flow: 'self.secret' from os.environ.get (line 144, credential/environment) → subprocess.run (code execution)

Medium
Category
Data Flow
Confidence
65% confidence
Finding

Data from a source is assigned to a variable that is later passed to a sink, creating a variable-mediated taint flow.

Content

Scanner excerpt · scripts/reference_ingest.py (reported line 154)May include surrounding context.

python
cmd += ['--password', '<stdin>']
        env = {k: os.environ[k] for k in ('PATH', 'HOME', 'LANG', 'LC_ALL', 'SYSTEMROOT', 'WINDIR', 'CALIBRE_CONFIG_DIRECTORY', 'QT_QPA_PLATFORM') if k in os.environ}
        try:
            p = subprocess.run(cmd, input=self.secret, text=True, capture_output=True, timeout=150, env=env)
        except (OSError, subprocess.TimeoutExpired) as exc:
            raise RuntimeError('calibredb could not complete; inspect any apply receipt before retrying') from exc
        if p.returncode:

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/reference_ingest.py (reported line 428)May include surrounding context.

python
require(not source.is_symlink() and source.is_file() and file_hash(source) == p['source_sha256'], 'staged source changed during verification; do not clean it up')
            require(shutil.which('trash'), 'trash is required for reversible cleanup; never fall back to permanent deletion')
            try:
                cp = subprocess.run(['trash', '--', *map(str, targets)], capture_output=True, text=True, timeout=60)
            except (OSError, subprocess.TimeoutExpired) as exc:
                raise RuntimeError('cleanup could not complete; inspect source/trash state before retrying') from exc
            require(cp.returncode == 0 and all(not f.exists() for f in targets), 'trash cleanup failed; inspect local state')

Tainted flow: 'value' from pathlib.Path.read_text (line 132, file read) → pathlib.Path.write_text (file write)

Medium
Category
Data Flow
Confidence
65% confidence
Finding

Data from a source is assigned to a variable that is later passed to a sink, creating a variable-mediated taint flow.

Content

Scanner excerpt · tests/test_reference_ingest.py (reported line 135)May include surrounding context.

python
value = json.loads(plan_file.read_text())
        value['plan']['schema'] = 1
        value['digest'] = mod.digest_bytes(mod.encoded(value['plan']))
        plan_file.write_text(json.dumps(value))
        with self.assertRaisesRegex(ValueError, 'unsupported schema'):
            mod.load_plan(plan_file)

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_reference_ingest.py (reported line 281)May include surrounding context.

python
write_epub(self.source)

    def execute(self, *args, ok=True):
        p = subprocess.run(list(map(str, args)), env=self.env, capture_output=True, text=True, timeout=160)
        if ok and p.returncode:
            self.fail(str(args) + '\n' + p.stdout + '\n' + p.stderr)
        if not ok:

Unknown authors must be labeled in Japanese without a user-selected locale.

Low
Category
Output Handling
Confidence
96% confidence
Finding

The instruction requires using the Japanese placeholder 著者不明 whenever an author is unknown. It offers no language choice or justification for imposing Japanese on this metadata, unlike the separate instructions to preserve existing library tag labels.

Content

No source excerpt is available for this finding.

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/ebook_archive.py (reported line 60)May include surrounding context.

python
def bind(lib, name, result, args):
    fn = getattr(lib, name)
    fn.restype = result
    fn.argtypes = args
    return fn