Back to skill

Security audit

Macliner

Security checks for vulnerabilities and agentic risk

Overview

ClawScan marked this Mac cleanup skill suspicious because scanners report risky automatic and privileged deletions, unsafe command handling, and incomplete analysis; the verdict does not establish malicious intent.

Consider the verdict a reason to avoid installing until the reported deletion and privileged execution risks are independently reviewed and addressed. The scan covered 75% of components; one script was only partially inspected, so the evidence is incomplete and does not support treating the skill as safe.

Vulnerability Patterns
  • 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
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (2)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/macliner.py
Finding

Unvalidated application bundle identifiers can expand deletion to unrelated protected data

Content
View full analysis

Impact

Recursive deletion can remove writable contents of ~/Library, including Mail, Messages, keychains, and other explicitly protected descendants. The protection check applies only to the deletion root; shutil.rmtree does not recheck descendants.

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/macliner.py
Finding

Administrator command output permits shell injection through application filenames

Content
View full analysis

Impact

Pasting the command can execute attacker-selected commands as the user. Injected sudo commands may also execute with administrator privileges when permitted and authenticated.

Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Rogue AgentSelf-Modification, Session Persistence
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
Findings (42)

Incomplete referenced artifact analysis

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
script `scripts/macliner.py` does the measuring and the deleting; it needs only

Env Variable Harvesting

High
Category
Data Exfiltration
Confidence
60% confidence
Finding

Code enumerates, copies, or searches environment variables for secrets. Bulk environment access can collect credentials unrelated to the skill's stated purpose.

Content

Scanner excerpt · scripts/macliner.py (reported line 35)May include surrounding context.

python
HOME = os.path.expanduser("~")
H = lambda p: os.path.join(HOME, p)
ENV = dict(os.environ, PATH="/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:" + os.environ.get("PATH", ""),
           HOMEBREW_NO_AUTO_UPDATE="1", HOMEBREW_NO_ENV_HINTS="1", HOMEBREW_NO_ASK="1", NO_COLOR="1", TERM="dumb")
DEFAULT_PLAN = os.path.join(tempfile.gettempdir(), "macliner-plan.json")
ANSWERS = H(".config/macliner/answers.json")

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

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

Content

Scanner excerpt · scripts/macliner.py (reported line 51)May include surrounding context.

python
H("Desktop"), H("Documents"), H("Library/Mobile Documents"), H("Library/CloudStorage"),
    H("Pictures/*.photoslibrary"), H("Pictures/Photo Booth Library"), H("Music/Music"), H("Music/iTunes"),
    H("Music/GarageBand"), H("Movies/TV"), H("Movies/*.imovielibrary"), H("Movies/*.fcpbundle"),
    H("Library/Mail"), H("Library/Messages"), H("Library/Keychains"), "/Library/Keychains",
    H("Library/Application Support/MobileSync"),                   # iPhone and iPad backups
    H(".ssh"), H(".gnupg"), H(".config"), H(".local"), H(".aws"), H(".kube"), H(".docker"),
    H(".claude"), H(".claude.json"), H(".codex"), H(".gemini"), H(".agents"), H(".cursor"),

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

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

Content

Scanner excerpt · scripts/macliner.py (reported line 51)May include surrounding context.

python
H("Desktop"), H("Documents"), H("Library/Mobile Documents"), H("Library/CloudStorage"),
    H("Pictures/*.photoslibrary"), H("Pictures/Photo Booth Library"), H("Music/Music"), H("Music/iTunes"),
    H("Music/GarageBand"), H("Movies/TV"), H("Movies/*.imovielibrary"), H("Movies/*.fcpbundle"),
    H("Library/Mail"), H("Library/Messages"), H("Library/Keychains"), "/Library/Keychains",
    H("Library/Application Support/MobileSync"),                   # iPhone and iPad backups
    H(".ssh"), H(".gnupg"), H(".config"), H(".local"), H(".aws"), H(".kube"), H(".docker"),
    H(".claude"), H(".claude.json"), H(".codex"), H(".gemini"), H(".agents"), H(".cursor"),

Automatic simulator deletion contradicts the explicit never-touch policy for simulators.

High
Category
Excessive Agency
Confidence
99% confidence
Finding

The automatically selected xcrun simctl delete unavailable command bypasses delete() and the protected-path policy entirely. Unavailable simulators can still contain valuable application state or become usable after reinstalling a runtime, so this cleanup can destroy data explicitly described as never touched.

Content

No source excerpt is available for this finding.

Recursive deletion can remove paths explicitly promised to be protected.

High
Category
Excessive Agency
Confidence
100% confidence
Finding

delete() checks only the deletion target and its ancestors before recursively removing the whole subtree. An unprotected parent can therefore contain protected descendants, including a path added through remember --protect, and applying its cleanup action permanently deletes those descendants despite the protection guarantee.

Content

No source excerpt is available for this finding.

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.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

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

md
- Deleting is for real (no Trash). Lines that need a choice are done only after
  the person says yes to that line.
- Never type or ask for a password and never run `sudo` yourself (the script
  itself only probes `sudo -n true`, which never asks and changes nothing). Lines that
  need an administrator are printed by the script as commands; show them to the
  person to paste into Terminal.
- Never change a setting unless the person asks for that setting. Never install

Autonomous Decision Making

Medium
Category
Excessive Agency
Confidence
92% confidence
Finding

The automatic cleanup category includes irreversible deletion of Trash items older than one day, unfinished downloads, and startup items inferred to belong to removed apps. These are not necessarily reproducible or unwanted, so treating them like disposable caches can destroy recoverable files or disable useful functionality without item-specific approval.

Content

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

md
Read all of it. Every line ends with its id in square brackets, for
   example `[dev-caches]`. The groups:
   - «Done without asking»: caches, logs, the Trash (items trashed more than a
     day ago), Homebrew's old downloads, unfinished downloads, start-up items
     of removed apps, Xcode build leftovers. All of it comes back by itself
     or was already thrown away.

Autonomous Decision Making

Medium
Category
Excessive Agency
Confidence
87% confidence
Finding

The read-only and update-only branches appropriately limit actions, but requests such as 'speed up' or 'make it perfect' are mapped to the entire cleanup workflow. Those broad goals do not clearly authorize permanent deletion of Trash contents and other potentially valuable items.

Content

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

md
Which steps follow depends on the request. «How much can be freed» or
   «how is my Mac doing»: stop here and report free space, what would go
   without asking (its total), the choices with sizes, problems found. Only
   «update»: skip step 3, ask nothing but the updates (step 4) and go on to
   step 5 with their ids. Otherwise (clean up, speed up, «make it perfect»):
   all steps.

Autonomous Decision Making

Medium
Category
Excessive Agency
Confidence
91% confidence
Finding

This step executes every automatically classified deletion before asking the user about choices. Although the plan and open-app checks reduce risk, they do not provide consent or recovery for valuable files incorrectly included in the automatic category; the helper's actual protections cannot be verified from this file.

Content

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

/usr/bin/python3 SCRIPT apply

text

It does every «Done without asking» line and prints what it freed. Apps
that are open are skipped and named; that is normal.
4. If the plan had choices or updates, ask about them in one message: one
numbered line each, with its size and what it means, grouped (all

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 · SKILL.md (reported line 180)May include surrounding context.

/usr/bin/python3 SCRIPT remember --yes ID ... --no ID ... --protect PATH ...

text

`--yes` choices and updates are then done without asking, `--no` lines are
left, and `--protect` paths are never deleted. Settings cannot be given a
standing yes. The file is
`~/.config/macliner/answers.json`; say where it is. Ids of apps, duplicates

Autonomous Decision Making

Medium
Category
Excessive Agency
Confidence
90% confidence
Finding

The manual fallback authorizes permanent deletion of non-Apple cache folders without the script workflow's explicit choice for large caches or its automated open-app checks. Cache locations can contain offline media, downloaded models, or application state, so a broad location-based classification can cause data loss despite the exact-path and protected-folder rules.

Content

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

md
`du -sh ~/Library/Caches/* ~/Library/Logs ~/.Trash 2>/dev/null | sort -h | tail -20`;
   `brew cleanup --prune=all -n` and `brew outdated` if Homebrew is there;
   `softwareupdate --list`.
2. Show the plan with sizes: what goes without asking (caches in
   `~/Library/Caches` except folders starting with `com.apple.`, the logs in
   `~/Library/Logs`, Homebrew's cleanup) and what needs a choice (the Trash,
   Downloads, developer caches, apps).

Session Persistence

Medium
Category
Rogue Agent
Confidence
75% 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 · scripts/macliner.py (reported line 24)May include surrounding context.

python
import hashlib
import json
import os
import plistlib
import re
import shutil
import socket

Session Persistence

Medium
Category
Rogue Agent
Confidence
75% 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 · scripts/macliner.py (reported line 387)May include surrounding context.

python
for plist in sorted(glob.glob(H("Library/LaunchAgents/*.plist")) + glob.glob("/Library/LaunchAgents/*.plist")
                        + glob.glob("/Library/LaunchDaemons/*.plist")):
        try:
            with open(plist, "rb") as f:
                d = plistlib.load(f)
        except Exception:
            continue

Session Persistence

Medium
Category
Rogue Agent
Confidence
75% 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 · scripts/macliner.py (reported line 388)May include surrounding context.

python
+ glob.glob("/Library/LaunchDaemons/*.plist")):
        try:
            with open(plist, "rb") as f:
                d = plistlib.load(f)
        except Exception:
            continue
        label = d.get("Label", os.path.basename(plist))

Session Persistence

Medium
Category
Rogue Agent
Confidence
75% 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 · scripts/macliner.py (reported line 391)May include surrounding context.

python
d = plistlib.load(f)
        except Exception:
            continue
        label = d.get("Label", os.path.basename(plist))
        prog = d.get("Program") or (d.get("ProgramArguments") or [None])[0]
        if not isinstance(prog, str):
            continue

Session Persistence

Medium
Category
Rogue Agent
Confidence
75% 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 · scripts/macliner.py (reported line 507)May include surrounding context.

python
ids = {}
    for a in apps:
        try:
            with open(os.path.join(a, "Contents/Info.plist"), "rb") as f:
                i = plistlib.load(f).get("CFBundleIdentifier")
            if i:
                ids[i.lower()] = a

Session Persistence

Medium
Category
Rogue Agent
Confidence
75% 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 · scripts/macliner.py (reported line 508)May include surrounding context.

python
for a in apps:
        try:
            with open(os.path.join(a, "Contents/Info.plist"), "rb") as f:
                i = plistlib.load(f).get("CFBundleIdentifier")
            if i:
                ids[i.lower()] = a
        except Exception:

Session Persistence

Medium
Category
Rogue Agent
Confidence
75% 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 · scripts/macliner.py (reported line 541)May include surrounding context.

python
for r in roots:
        base = H("Library/" + r)
        for n in listdir(base):
            key = re.sub(r"\.(plist|savedState|binarycookies)$", "", n)
            key = re.sub(r"^[A-Z0-9]{10}\.", "", key)  # team id in front of group containers
            key = re.sub(r"^group\.", "", key).lower()
            parts = key.split(".")

Session Persistence

Medium
Category
Rogue Agent
Confidence
75% 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 · scripts/macliner.py (reported line 575)May include surrounding context.

python
for a in sorted(glob.glob("/Applications/*.app")):
        name = os.path.basename(a)
        try:
            with open(os.path.join(a, "Contents/Info.plist"), "rb") as f:
                bid = plistlib.load(f).get("CFBundleIdentifier", "")
        except Exception:
            continue

Session Persistence

Medium
Category
Rogue Agent
Confidence
75% 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 · scripts/macliner.py (reported line 576)May include surrounding context.

python
name = os.path.basename(a)
        try:
            with open(os.path.join(a, "Contents/Info.plist"), "rb") as f:
                bid = plistlib.load(f).get("CFBundleIdentifier", "")
        except Exception:
            continue
        if not bid or bid.startswith("com.apple.") or name.startswith("Xcode") or protected(a):

Session Persistence

Medium
Category
Rogue Agent
Confidence
75% 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 · scripts/macliner.py (reported line 675)May include surrounding context.

python
fw_on = "enabled" in run([fw, "--getglobalstate"], 10)[1]
    stealth = "stealth mode is on" in run([fw, "--getstealthmode"], 10)[1]
    airplay = any(p.startswith("ControlCe") for port, p in listen if port in ("5000", "7000"))
    analytics = rd("/Library/Application Support/CrashReporter/DiagnosticMessagesHistory.plist", "AutoSubmit") == "1"
    auto_macos = rd(su, "AutomaticallyInstallMacOSUpdates") == "1"
    smb = any(p == "smbd" for _, p in listen)
    ssh = any(port == "22" for port, _ in listen)

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
99% confidence
Finding

Subprocess execution is expected for this maintenance tool, but apply() accepts executable command arrays, including before/then hooks, directly from an unauthenticated JSON plan. Anyone able to replace or modify that plan can obtain arbitrary command execution when it is applied; hostname and timestamp checks do not establish authenticity, and shell=False does not prevent attacker-selected executables.

Content

Scanner excerpt · scripts/macliner.py (reported line 86)May include surrounding context.

python
def run(cmd, timeout=60):
    """Run a command with a hard time limit; never reads stdin. Returns (exit code, stdout+stderr)."""
    try:
        p = subprocess.run(cmd, stdin=subprocess.DEVNULL, stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
                           env=ENV, timeout=timeout, universal_newlines=True, errors="replace")
        return p.returncode, p.stdout
    except subprocess.TimeoutExpired:

Tainted flow: 'ENV' from os.environ.get (line 35, 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/macliner.py (reported line 86)May include surrounding context.

python
def run(cmd, timeout=60):
    """Run a command with a hard time limit; never reads stdin. Returns (exit code, stdout+stderr)."""
    try:
        p = subprocess.run(cmd, stdin=subprocess.DEVNULL, stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
                           env=ENV, timeout=timeout, universal_newlines=True, errors="replace")
        return p.returncode, p.stdout
    except subprocess.TimeoutExpired: