Back to skill

Security audit

unattended-task-pitfalls

Security checks for vulnerabilities and agentic risk

Overview

This skill is a disclosed hardening guide for unattended automation, with purpose-aligned examples but some operational patterns users should apply carefully.

Install only if you want Chinese-language guidance for hardening scheduled or unattended tasks. When applying it, keep background jobs bounded, log them clearly, scope file scans and deletions to known workspaces, and avoid adapting the examples to destructive uploads, deletes, or publishes without explicit user approval and idempotency checks.

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
  • Rogue AgentSelf-Modification, Session Persistence
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
Findings (8)

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
84% confidence
Finding

The skill explicitly describes shell execution and file-writing workflows, including backgrounding commands and manipulating task artifacts, but it does not declare any tool restrictions or permissions boundary in metadata. In an agent ecosystem, this increases the chance the skill is invoked with broader-than-necessary capabilities, enabling misuse or unsafe adaptation of the documented shell patterns in sensitive environments.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The main instructional content is presented in Chinese, and the usage guidance begins immediately in that language. This creates a language/locale constraint without any opt-in, alternative language path, or stated region-specific justification, which matches the policy-violation category for forced language choice.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
89% confidence
Finding

Use of nohup in the recommended command detaches task execution from the initiating session and allows it to survive disconnects or gateway termination. In a skill context this can be abused or accidentally applied to unsafe commands, leading to persistent shell activity, reduced operator visibility, and difficulty stopping unintended side effects once launched.

Content

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

md
### §2.1 后台化(防进程被杀)
- 长任务(打包/上传/批量处理)禁止在前台直接跑:平台网关常有 2-10 分钟超时,超时杀进程 → 留下半成品文件
- 标准模式:`setsid nohup <cmd> > /tmp/task.log 2>&1 &`,然后轮询日志/文件时间戳确认进度
- 佐证数据:同一个备份脚本,前台跑两次两次被杀,后台跑零事故

### §2.2 半成品的危害大于失败

Session Persistence

Medium
Category
Rogue Agent
Confidence
89% confidence
Finding

Use of nohup in the recommended command detaches task execution from the initiating session and allows it to survive disconnects or gateway termination. In a skill context this can be abused or accidentally applied to unsafe commands, leading to persistent shell activity, reduced operator visibility, and difficulty stopping unintended side effects once launched.

Content

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

md
### §2.1 后台化(防进程被杀)
- 长任务(打包/上传/批量处理)禁止在前台直接跑:平台网关常有 2-10 分钟超时,超时杀进程 → 留下半成品文件
- 标准模式:`setsid nohup <cmd> > /tmp/task.log 2>&1 &`,然后轮询日志/文件时间戳确认进度
- 佐证数据:同一个备份脚本,前台跑两次两次被杀,后台跑零事故

### §2.2 半成品的危害大于失败

Session Persistence

Medium
Category
Rogue Agent
Confidence
65% 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 43)May include surrounding context.

md
进程被杀不是"任务失败",而是"任务产出了一个损坏的产物"。若下游逻辑(上传/清理/状态标记)不感知损坏,坏产物会流转进正式链路(本例:坏备份被上传到云端"永久保留"区)。

### §2.3 网关 504 ≠ 命令失败
- 工具调用层报 504 Gateway Timeout,**底层命令可能已经执行成功**(尤其 setsid 后台任务不受会话死亡影响)
- 正确处置:先 `ps` 查进程、查产物文件时间戳,确认实际状态再决定是否重发
- 危险反面案例:盲目重发副作用命令(删除/上传/发布)→ 重复执行事故
- 504 后重发的三个前置检查:进程在不在 / 产物变没变 / 任务是否幂等

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The file’s user-facing documentation and messages are entirely in Chinese, which imposes a specific language/locale choice on users. The file does not offer a language option or explain that the skill is intentionally region-specific, so this is a natural-language policy concern under the locale rule.

Content

No source excerpt is available for this finding.

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

python
def verify_archive(archive_path):
    """产物双重验证:gzip 流完整性 + tar 归档结构。
    返回 (ok, reason)。截断文件在 gzip -t 暴露;tar 头损坏在 -tzf 暴露。"""
    rc1 = subprocess.run(["gzip", "-t", archive_path],
                         capture_output=True).returncode
    if rc1 != 0:
        return False, f"gzip -t failed (rc={rc1}): truncated or corrupt"

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

python
capture_output=True).returncode
    if rc1 != 0:
        return False, f"gzip -t failed (rc={rc1}): truncated or corrupt"
    rc2 = subprocess.run(["tar", "-tzf", archive_path],
                         capture_output=True).returncode
    if rc2 != 0:
        return False, f"tar -tzf failed (rc={rc2}): archive structure corrupt"