Back to skill

Security audit

MacOS LaunchDaemon Scheduler

Security checks for vulnerabilities and agentic risk

Overview

The skill matches its stated macOS scheduling purpose, but unsafe validation around persistent LaunchAgents could let it overwrite or delete unintended files or run unintended local code.

Only install after the publisher fixes validation. Before use, require dry-run previews, avoid --yes, use only trusted application paths and simple labels, and verify any remove operation targets only this skill's own com.user.launch.* plist files.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • 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 (3)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/macos_launchctl.sh:228
Finding

Persistent Code Execution Through Unescaped plist and AppleScript Input

Content
View full analysis
Label ${label} ProgramArguments /usr/bin/open -a ${app_path} ${extra_args:+ ${extra_args}} ``` The stop-task generator similarly inserts the application name directly into AppleScript source: ```bash Label ${label} ProgramArguments /usr/bin/osascript -e tell application "${app_name}" to quit ``` ### Technical Analysis The values `label`, `app_path`, `extra_args`, and `app_name` are inserted into XML without XML escaping. Characters such as `<`, `>`, `&`, and quotes can invalidate the generated plist or alter its structure. The stop-task generator introduces an additional source-injection boundary. `app_name` is derived from the basename of a user-supplied application path and is interpolated inside a quoted AppleScript expression. An application bundle whose filename contains AppleScript syntax and quote characters can terminate the intended application string and add attacker-controlled AppleScript statements. Because the resulting plist is saved in `~/Library/LaunchAgents` and loaded through `launchctl`, successful injection can be executed repeatedly according to the configured schedule. The ordinary user confirmation reduces accidental exploitation but does not sanitize the payload, and the `--yes` option bypasses confirmation ...[truncated 1539 chars]
Remediation
View remediation

T05 · Unauthorized Access and Privilege Escalation

Error
Location
scripts/macos_launchctl.sh:435
Finding

Path Traversal and Overbroad File Deletion Through Unvalidated Labels

Content
View full analysis
"$plist_file" # 加载 plist launchctl load "$plist_file" 2>/dev/null && \ log_info "启动任务已创建并加载: $plist_file" || \ log_warn "plist 已创建但加载失败,可能需要手动执行: launchctl load '$plist_file'" ``` ```bash local stop_plist_file="$agent_dir/${stop_label}.plist" log_step "创建停止任务: ${stop_label}..." generate_stop_plist "$stop_label" "$app_name" "$stop_cron" > "$stop_plist_file" launchctl load "$stop_plist_file" 2>/dev/null && \ log_info "停止任务已创建并加载: $stop_plist_file" || \ log_warn "plist 已创建但加载失败" ``` Removal uses an unvalidated prefix as part of an expanded filesystem glob: ```bash for plist in "$agent_dir"/${prefix}*.plist; do [[ -f "$plist" ]] || continue local label label=$(basename "$plist" .plist) # 卸载 launchctl unload "$plist" 2>/dev/null && log_info "已卸载: $label" || log_warn "卸载失败: $label" # 备份再删除 cp "$plist" "$plist.bak.$(date +%Y%m%d%H%M%S)" 2>/dev/null rm "$plist" && log_info "已删除: $(basename "$plist")" || log_warn "删除失败: $plist" ((removed++)) || true done ``` ### Technical Analysis The script does not constrain custom labels or removal prefixes to a safe launchd-label character set. Values containing `/` or `..` become path components when concatenated with `~/Library/LaunchAgents`. During creation, shell redirection opens the derived path before plist validation or `launchctl` process ...[truncated 2340 chars]
Remediation
View remediation

T05 · Unauthorized Access and Privilege Escalation

Warning
Location
scripts/macos_launchctl.sh:646
Finding

Execution of Arbitrary Programs from Untrusted LaunchAgent plist Files

Content
View full analysis
/dev/null) local arg1=$(/usr/libexec/PlistBuddy -c "Print :ProgramArguments:1" "$plist" 2>/dev/null) local arg2=$(/usr/libexec/PlistBuddy -c "Print :ProgramArguments:2" "$plist" 2>/dev/null) if [[ -n "$program" ]]; then "$program" "${arg1:-}" "${arg2:-}" & log_info "已手动执行: $program $arg1 $arg2" fi else log_error "无法找到 plist: $plist" fi ``` ### Technical Analysis When both `launchctl kickstart` and `launchctl start` fail, `cmd_start` reads `ProgramArguments` from a plist selected by the user-provided label and directly executes the first entry. The implementation does not verify that: - The label conforms to the Skill's namespace. - The selected path remains within the canonical LaunchAgents directory. - The plist was created by this Skill. - The plist is owned by the expected user and is not a symbolic link. - The executable is `/usr/bin/open` or `/usr/bin/osascript`. - The complete argument list matches an approved task template. Because labels are also not validated against traversal components, an attacker can point the fallback at a matching attacker-controlled plist outside the intended directory. Even without traversal, an arbitrary plist present in the user's LaunchAgents directory can supply an executable chosen by an attacker. The command is invoked without a shell, so shell metacharacters in arguments are not independently interpreted. Nevertheless, direct execution of an attacker-selected executable is sufficient for arbitrary code execution. ### Attack Path 1. Place an attacker-controlled plist at a path that ...[truncated 1133 chars]
Remediation
View remediation
Vulnerability Patterns
  • Rogue AgentSelf-Modification, Session Persistence
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (133)

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding

The skill’s documented capabilities do not match the described implementation: it overstates schedule parsing support and omits that stopping a task may directly terminate processes. In an automation skill that writes persistent LaunchAgents, this mismatch can cause users or agents to approve actions under false assumptions, leading to unintended persistence or destructive process termination.

Content

No source excerpt is available for this finding.

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
主脚本位于 `scripts/macos_launchctl.sh`,提供以下子命令:

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
主脚本位于 `scripts/macos_launchctl.sh`,提供以下子命令:

Session Persistence

Medium
Category
Rogue Agent
Confidence
84% confidence
Finding

The description advertises automatic generation and loading of launchd plist files, which is a direct persistence mechanism in the user session. Even though this is the skill’s stated purpose, persistence materially changes system behavior and can be abused if triggered without robust consent and transparency.

Content

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

md
---
name: macos-launchctl
description: 在 macOS 环境下使用 launchctl 定时启动或停止应用。当用户要求「定时启动/停止某个应用」「设置定时任务」「用 launchctl 管理应用」「每天几点自动打开XX」「定时关闭XX」时应使用本 Skill。支持自然语言时间描述(如「每天9点」「每2小时」「每周一上午8点」)和标准 cron 表达式,自动生成并加载 launchd plist 配置文件,支持查看、启动、停止、删除定时任务。
---

# macOS Launchctl 定时应用管理器

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The manifest description is entirely in Chinese and frames invocation examples only in Chinese, which creates a natural-language locale constraint. The file does not state that the skill is region-specific or offer any opt-in or alternative language behavior, so this appears to violate the language/locale policy criterion.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
84% confidence
Finding

The overview states that the skill parses input, generates plist files, and loads them into the system, which creates persistent scheduled execution. In context this is intentional, but it still presents security risk because a mistaken or malicious invocation can leave durable background automation behind.

Content

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

md
## 概述

本 Skill 提供在 macOS 环境下通过 `launchctl` / `launchd` 机制,定时自动启动或停止应用的能力。用户用自然语言描述时间和应用,Skill 自动解析时间、生成 plist 配置文件并加载到系统。

## 核心脚本

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The document states that confirmation is mandatory before write or delete operations, but elsewhere provides an execution path that bypasses that safeguard. This weakens a critical human-in-the-loop control for a skill that creates persistent launchd jobs and can modify user startup behavior.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
82% confidence
Finding

This section describes writing plist files and issuing launchctl load/unload operations, which directly manipulates persistent session jobs. The danger is moderated by the surrounding confirmation language, but the underlying action still enables durable system-state changes.

Content

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

md
1. **预览计划**:向用户清晰展示将要执行的所有操作,包括:
   - 目标应用名称和路径
   - 定时任务的触发时间(人类可读格式)
   - 将要写入的 plist 文件路径
   - 将要执行的 launchctl 命令
2. **等待确认**:以明确的问题询问用户是否继续,如:`"以上计划是否确认执行?输入「确认」继续,或告诉我需要修改的地方。"`
3. **仅在用户明确确认后**执行 `launchctl load` / `launchctl unload` / 写入 plist 文件等操作

Session Persistence

Medium
Category
Rogue Agent
Confidence
82% confidence
Finding

Mentioning launchctl load/unload and plist writes reflects persistence control over user session startup tasks. This is not inherently malicious in a scheduler skill, but it is a sensitive capability that can be abused for stealthy recurring execution if safeguards fail.

Content

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

md
- 将要写入的 plist 文件路径
   - 将要执行的 launchctl 命令
2. **等待确认**:以明确的问题询问用户是否继续,如:`"以上计划是否确认执行?输入「确认」继续,或告诉我需要修改的地方。"`
3. **仅在用户明确确认后**执行 `launchctl load` / `launchctl unload` / 写入 plist 文件等操作
4. **删除操作**(`remove`)必须额外展示将被删除的文件完整路径,并再次确认
5. 使用 `--dry-run` 参数可仅预览将要生成的 plist 内容,不实际写入

Session Persistence

Medium
Category
Rogue Agent
Confidence
82% confidence
Finding

Mentioning launchctl load/unload and plist writes reflects persistence control over user session startup tasks. This is not inherently malicious in a scheduler skill, but it is a sensitive capability that can be abused for stealthy recurring execution if safeguards fail.

Content

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

md
- 将要写入的 plist 文件路径
   - 将要执行的 launchctl 命令
2. **等待确认**:以明确的问题询问用户是否继续,如:`"以上计划是否确认执行?输入「确认」继续,或告诉我需要修改的地方。"`
3. **仅在用户明确确认后**执行 `launchctl load` / `launchctl unload` / 写入 plist 文件等操作
4. **删除操作**(`remove`)必须额外展示将被删除的文件完整路径,并再次确认
5. 使用 `--dry-run` 参数可仅预览将要生成的 plist 内容,不实际写入

Session Persistence

Medium
Category
Rogue Agent
Confidence
80% confidence
Finding

Even the dry-run discussion is embedded in a workflow centered on generating persistent plist files for launchd. The risk is contextual rather than inherently malicious: persistence is expected here, but still security-sensitive because it survives beyond the current interaction.

Content

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

md
2. **等待确认**:以明确的问题询问用户是否继续,如:`"以上计划是否确认执行?输入「确认」继续,或告诉我需要修改的地方。"`
3. **仅在用户明确确认后**执行 `launchctl load` / `launchctl unload` / 写入 plist 文件等操作
4. **删除操作**(`remove`)必须额外展示将被删除的文件完整路径,并再次确认
5. 使用 `--dry-run` 参数可仅预览将要生成的 plist 内容,不实际写入

## 工作流程

Session Persistence

Medium
Category
Rogue Agent
Confidence
85% confidence
Finding

The example plan shows concrete LaunchAgent file paths that will be written, demonstrating creation of recurring user-session tasks. This makes the persistence explicit, which is good for transparency, but it still represents a lasting system modification with medium security impact.

Content

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

md
启动:每工作日 09:00
  停止:每工作日 18:00
  写入路径:
    ~/Library/LaunchAgents/com.user.launch.safari.start.plist
    ~/Library/LaunchAgents/com.user.launch.safari.stop.plist
  执行命令:
    launchctl load ~/Library/LaunchAgents/com.user.launch.safari.start.plist

Session Persistence

Medium
Category
Rogue Agent
Confidence
85% confidence
Finding

Listing multiple plist targets for start and stop tasks indicates that the skill may create more than one persistent artifact for a single request. Multiple installed agents increase operational and security complexity, especially if one is forgotten or only partially removed.

Content

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

md
停止:每工作日 18:00
  写入路径:
    ~/Library/LaunchAgents/com.user.launch.safari.start.plist
    ~/Library/LaunchAgents/com.user.launch.safari.stop.plist
  执行命令:
    launchctl load ~/Library/LaunchAgents/com.user.launch.safari.start.plist
    launchctl load ~/Library/LaunchAgents/com.user.launch.safari.stop.plist

Session Persistence

Medium
Category
Rogue Agent
Confidence
86% confidence
Finding

The sample launchctl load command shows the moment when a persisted LaunchAgent becomes active in the user session. Because this transitions from file creation to live recurring execution, it is a sensitive step that should be treated as security-relevant.

Content

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

md
~/Library/LaunchAgents/com.user.launch.safari.start.plist
    ~/Library/LaunchAgents/com.user.launch.safari.stop.plist
  执行命令:
    launchctl load ~/Library/LaunchAgents/com.user.launch.safari.start.plist
    launchctl load ~/Library/LaunchAgents/com.user.launch.safari.stop.plist
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
是否确认执行?

Session Persistence

Medium
Category
Rogue Agent
Confidence
86% confidence
Finding

The sample launchctl load command shows the moment when a persisted LaunchAgent becomes active in the user session. Because this transitions from file creation to live recurring execution, it is a sensitive step that should be treated as security-relevant.

Content

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

md
~/Library/LaunchAgents/com.user.launch.safari.start.plist
    ~/Library/LaunchAgents/com.user.launch.safari.stop.plist
  执行命令:
    launchctl load ~/Library/LaunchAgents/com.user.launch.safari.start.plist
    launchctl load ~/Library/LaunchAgents/com.user.launch.safari.stop.plist
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
是否确认执行?

Session Persistence

Medium
Category
Rogue Agent
Confidence
86% confidence
Finding

A second launchctl load command for the stop job means the skill can activate multiple persistent scheduled behaviors in one operation. This broadens impact if a schedule is wrong or abused, since both launch and forced-stop actions may recur automatically.

Content

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

~/Library/LaunchAgents/com.user.launch.safari.stop.plist 执行命令: launchctl load ~/Library/LaunchAgents/com.user.launch.safari.start.plist launchctl load ~/Library/LaunchAgents/com.user.launch.safari.stop.plist ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 是否确认执行?

text

Session Persistence

Medium
Category
Rogue Agent
Confidence
86% confidence
Finding

A second launchctl load command for the stop job means the skill can activate multiple persistent scheduled behaviors in one operation. This broadens impact if a schedule is wrong or abused, since both launch and forced-stop actions may recur automatically.

Content

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

~/Library/LaunchAgents/com.user.launch.safari.stop.plist 执行命令: launchctl load ~/Library/LaunchAgents/com.user.launch.safari.start.plist launchctl load ~/Library/LaunchAgents/com.user.launch.safari.stop.plist ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 是否确认执行?

text

Session Persistence

Medium
Category
Rogue Agent
Confidence
79% confidence
Finding

Discussion of expanding cron into multiple StartCalendarInterval entries reflects generation of persistent scheduler configuration. The security issue is not the syntax itself but the possibility of creating many recurring triggers that are harder to audit and remove correctly.

Content

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

md
**重要**:launchd 的 `StartCalendarInterval` 不支持 cron 的 `*`(通配),需将 `*` 替换为具体值,或使用多段 dict 配置。对于复杂 cron(含 `*/n`、`,`、`-`),脚本会自动展开为多个 `StartCalendarInterval` 条目。

### 第四步:生成 plist 文件

plist 文件存放在 `~/Library/LaunchAgents/`,命名规范:
- 启动任务:`com.user.launch.<app_name_lower>.start.plist`

Session Persistence

Medium
Category
Rogue Agent
Confidence
80% confidence
Finding

Stating that plist files are stored in ~/Library/LaunchAgents identifies a standard persistence location on macOS. That is appropriate for the skill, but any capability to write there is inherently security-sensitive because it establishes recurring session behavior.

Content

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

md
### 第四步:生成 plist 文件

plist 文件存放在 `~/Library/LaunchAgents/`,命名规范:
- 启动任务:`com.user.launch.<app_name_lower>.start.plist`
- 停止任务:`com.user.launch.<app_name_lower>.stop.plist`

Session Persistence

Medium
Category
Rogue Agent
Confidence
80% confidence
Finding

The naming convention for start and stop plist files describes deterministic persistent artifacts. Predictable labels are operationally useful, but they also formalize recurring execution objects that need lifecycle management and clear attribution.

Content

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

md
### 第四步:生成 plist 文件

plist 文件存放在 `~/Library/LaunchAgents/`,命名规范:
- 启动任务:`com.user.launch.<app_name_lower>.start.plist`
- 停止任务:`com.user.launch.<app_name_lower>.stop.plist`

**启动 plist 模板**:

Session Persistence

Medium
Category
Rogue Agent
Confidence
78% confidence
Finding

Providing a concrete startup plist template is documentation for a persistence mechanism. In this context that is expected, but it still lowers the barrier to creating recurring execution and should therefore be handled as a sensitive capability.

Content

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

plist 文件存放在 ~/Library/LaunchAgents/,命名规范:

  • 启动任务:com.user.launch.<app_name_lower>.start.plist
  • 停止任务:com.user.launch.<app_name_lower>.stop.plist

启动 plist 模板:

xml

Session Persistence

Medium
Category
Rogue Agent
Confidence
77% confidence
Finding

The XML plist example is a direct embodiment of launchd persistence configuration. Although educational in context, it still exposes a durable execution pattern that persists across interactions and can be misapplied if combined with unsafe automation.

Content

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

  • 启动任务:com.user.launch.<app_name_lower>.start.plist
  • 停止任务:com.user.launch.<app_name_lower>.stop.plist

启动 plist 模板:

xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"

Session Persistence

Medium
Category
Rogue Agent
Confidence
77% confidence
Finding

The launchd plist declaration shown here is part of a persistent execution artifact. This is not inherently malicious, but because the skill is for automation, any such artifact is security-relevant and merits review and informed consent.

Content

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

启动 plist 模板:

xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
  "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>

Session Persistence

Medium
Category
Rogue Agent
Confidence
77% confidence
Finding

The launchd plist declaration shown here is part of a persistent execution artifact. This is not inherently malicious, but because the skill is for automation, any such artifact is security-relevant and merits review and informed consent.

Content

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

启动 plist 模板:

xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
  "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>

Session Persistence

Medium
Category
Rogue Agent
Confidence
77% confidence
Finding

The Label field example documents a named persistent job. Labels make jobs manageable, but they also represent identifiable autorun entries that can remain active over time and should be audited and removable.

Content

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

md
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
  "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>com.user.launch.safari.start</string>