Back to skill

Security audit

BOOK BRAIN – LYGO 3-Brain Filesystem Helper

Security checks for vulnerabilities and agentic risk

Overview

This skill is mostly a workspace organizer, but it asks users to run mutable installers and includes a helper script that can overwrite files despite promising additive-only behavior.

Install only after reviewing the publisher and pinning exact versions. Run scaffold_haven.py in dry-run first, approve only a specific workspace root, and avoid using write_ref_stub.py on absolute paths, existing files, symlinks, or paths outside the intended reference directory. Do not store secrets in the generated memory or reference files.

Vulnerability Patterns
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • 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
Findings (2)

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/write_ref_stub.py:13
Finding
Unrestricted Reference-Stub Path Allows Existing Files to Be Overwritten<![CDATA[ ## Vulnerability Details **File Location**: `scripts/write_ref_stub.py:13-33` **Vulnerability Type**: Unrestricted file write and overwrite **Risk Level**: Medium ### Vulnerable Code ```python ap.add_argument("--out", type=Path, required=True) ap.add_argument("--title", required=True) ap.add_argument("--lines", nargs="*", default=[]) ap.add_argument("--resonance-to", help="Outer brain label for lyra-brain style edge") args = ap.parse_args() lines = [ f"Title: {args.title}", f"Last updated: {datetime.now(timezone.utc).date()}", "", ] if args.resonance_to: day = datetime.now(timezone.utc).strftime("%Y%m%d") lines.insert(0, f"SESSION_{day} --resonance--> {args.resonance_to}") for line in args.lines: lines.append(line) lines.append("") out = args.out out.parent.mkdir(parents=True, exist_ok=True) out.write_text("\n".join(lines), encoding="utf-8") ``` ### Technical Analysis The `--out` argument accepts an unrestricted absolute or relative filesystem path. The destination is not constrained to an approved workspace or reference directory. The script also does not validate the expected `.ref.txt` or `.md` extension, reject symbolic links, or refuse an existing destination. `Path.write_text()` opens the destination for truncating write. Consequently, an existing writable file is silently replaced. This behavior conflicts with the additive-only and no-overwrite guarantees declared in: - `SKILL.md:3` - `references/AGENT_CONTRACT.md:9,15` - `references/SECURITY.md:9,12` The vulnerability does not independently elevate operating-system privileges; it operates with the permissions of the invoking process. However, within that permission boundary, it provides an unrestricted file-overwrite primitive. ### Attack Path 1. An attacker influences a command, automation input, or agent-generated invocation of `write_ref_stub.py`. 2. The attacker supplies an existing writable file through `--out`, such as a project configuration, agent stat ...[truncated 1115 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Require an explicit approved workspace root and resolve both root and destination: ```python root = args.root.resolve(strict=True) out = (root / args.out).resolve(strict=False) if not out.is_relative_to(root): raise SystemExit("Output must remain inside the approved root") ``` 2. Require `--out` to be relative and restrict writes to an intended directory such as `reference/` or `memory/reference/`. 3. Enforce allowed filename suffixes, preferably `.ref.txt` and optionally `.md`. 4. Reject existing destinations by creating the file exclusively: ```python with out.open("x", encoding="utf-8") as handle: handle.write(content) ``` 5. If replacement is genuinely required, place it behind a separate `--force` option and require explicit confirmation. 6. Reject symbolic links in the destination and relevant parent components. 7. Use a temporary file followed by an atomic rename for approved replacement operations. 8. Add tests covering absolute paths, `../` traversal, existing files, symlink destinations, and destinations outside the approved root. ]]>

T08 · Insecure Dependencies

Warning
Location
SKILL.md:11
Finding
Installation Instructions Execute a Mutable Unpinned Package<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:11-13` **Vulnerability Type**: Unpinned executable dependency and supply-chain exposure **Risk Level**: Medium ### Vulnerable Code ```bash npx clawhub@latest install deepseekoracle/book-brain npx clawhub@latest install deepseekoracle/lyra-brain # graph grow/recall — recommended pair ``` ### Technical Analysis The documented installation process invokes `npx` with the mutable `clawhub@latest` tag. `npx` may retrieve and execute package code from the configured package registry. Because `latest` is not immutable, the effective installer can change after this project has been reviewed. The command also installs Skills by publisher/name without documenting an immutable version or integrity digest. The paired `lyra-brain` package is outside this audited project, so its behavior cannot be inferred from the local files. This is a supply-chain weakness rather than evidence that the current upstream packages are malicious. The risk arises because future upstream changes, registry compromise, publisher-account compromise, or dependency compromise can alter code executed by users following the documentation. ### Attack Path 1. The `clawhub` package referenced by `latest`, one of its transitive dependencies, or the relevant publisher account is compromised or updated with malicious behavior. 2. A user follows the installation command in `SKILL.md`. 3. `npx` resolves `clawhub@latest` at execution time and downloads the then-current package. 4. The downloaded installer executes with the privileges and environment of the invoking user. 5. Malicious installer behavior could access files, environment variables, credentials available to that process, or install altered Skill content. ### Impact Assessment The potential scope is the invoking user's account and any resources available to the installer process. Depending on the compromised package behavior, impact could include: - Reading or modifying user- ...[truncated 472 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Replace `clawhub@latest` with a reviewed exact version: ```bash npx clawhub@X.Y.Z install deepseekoracle/book-brain@A.B.C ``` 2. Pin the optional paired Skill to an exact reviewed version rather than an unversioned publisher/name reference. 3. Publish and verify package integrity hashes or registry signatures before execution. 4. Use lockfiles where supported and retain reviewed dependency metadata with the project. 5. Document the expected registry and warn users not to install from alternate or similarly named sources. 6. Separate installation of `lyra-brain` into an explicit optional step so users can independently review and approve that package. 7. Prefer installing the CLI without executing lifecycle scripts where the package manager and workflow permit it. 8. Re-audit pinned artifacts whenever dependency versions or integrity values change. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (13)

Tp4

High
Category
MCP Tool Poisoning
Confidence
91% confidence
Finding
The code generally matches the additive scaffolding purpose: it creates folder structure and seed files, defaults to dry-run, and only creates files if they do not already exist. However, key declared behaviors are absent: there is no implementation for generating .ref.txt outer links or daily indexes. The script instead creates a simpler set of directories plus INDEX/state seed files and appends a log entry. These differences are material enough that the declared description overstates capabilities the code chunk does not provide.

Ae4

Medium
Category
analysis-evasion
Confidence
80% confidence
Finding
Suspicious Unicode normalization or mixed-script content

Lp3

Medium
Category
MCP Least Privilege
Confidence
91% confidence
Finding
The skill clearly instructs file reads and writes and describes scaffolding directories and indexes, but it does not declare an explicit tool scope such as allowed-tools or permissions. This creates ambiguity about what filesystem access the agent may use, which can lead to broader-than-intended write access in environments that rely on declarative scoping.

Rp1

Medium
Category
MCP Rug Pull
Confidence
94% confidence
Finding
The install command uses 'npx clawhub@latest', which pulls whatever package version is current at execution time. This is a supply-chain risk because a compromised or breaking upstream release could be fetched and run unexpectedly, and the skill encourages users to execute it directly.

Rp1

Medium
Category
MCP Rug Pull
Confidence
94% confidence
Finding
This second install command also uses 'npx clawhub@latest' for the paired skill, creating the same unpinned remote execution risk. Because the workflow recommends pairing with another skill, the attack surface expands to multiple packages fetched dynamically at runtime.

Ae4

Medium
Category
analysis-evasion
Confidence
80% confidence
Finding
Suspicious Unicode normalization or mixed-script content

Rp1

Medium
Category
MCP Rug Pull
Confidence
96% confidence
Finding
The instruction 'npx clawhub@latest inspect ...' fetches and executes the latest package version at runtime, which is an unpinned supply-chain risk. If the package or one of its dependencies is compromised, or a breaking/malicious release is published, users following the skill could execute unreviewed code on their machine.

Ae4

Medium
Category
analysis-evasion
Confidence
80% confidence
Finding
Suspicious Unicode normalization or mixed-script content

Ae4

Medium
Category
analysis-evasion
Confidence
80% confidence
Finding
Suspicious Unicode normalization or mixed-script content

Ae4

Medium
Category
analysis-evasion
Confidence
80% confidence
Finding
Suspicious Unicode normalization or mixed-script content

Ae4

Medium
Category
analysis-evasion
Confidence
80% confidence
Finding
Suspicious Unicode normalization or mixed-script content

Ae4

Medium
Category
analysis-evasion
Confidence
80% confidence
Finding
Suspicious Unicode normalization or mixed-script content

Ae4

Medium
Category
analysis-evasion
Confidence
80% confidence
Finding
Suspicious Unicode normalization or mixed-script content

Static analysis

No suspicious patterns detected.