Back to skill

Security audit

YTLong Daily Report

Security checks for vulnerabilities and agentic risk

Overview

This work-report skill mostly does what it says, but its command construction can let a hostile config or argument run unintended shell commands.

Review this before installing. It has no evidence of intentional theft or persistence, but it should not be run in untrusted repositories or with untrusted .reportrc.json files until the shell command construction is fixed. Expect it to generate git-based markdown reports only, not calendar or task reports, and review report contents before sharing because commit messages may contain confidential work details.

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 (1)

T09 · Insecure Skill Coding Practices

Error
Location
index.js:17
Finding
Shell Command Injection Through Repository Paths and Date Arguments<![CDATA[ ## Vulnerability Details **File Location**: `index.js`, lines 13–27; attacker-controlled values enter through lines 123–128 and 144–155 **Vulnerability Type**: OS command injection caused by unsafe shell command construction **Risk Level**: High ### Complete Vulnerable Code Snippet ```js function getGitLogs(since, until, repos = ['.']) { const commits = []; for (const repo of repos) { try { const cmd = `cd "${repo}" && git log --since="${since}" --until="${until}" --pretty=format:"%h|%s|%an|%ad" --date=short 2>/dev/null || echo ""`; const output = execSync(cmd, { encoding: 'utf-8' }).trim(); if (output) { output.split('\n').forEach(line => { const [hash, message, author, date] = line.split('|'); if (hash && message) { commits.push({ hash, message, author, date, repo }); } }); } } catch (e) { // 忽略错误 } } } ``` The command-line date values are accepted without validation: ```js case 'range': const fromIdx = args.indexOf('--from'); const toIdx = args.indexOf('--to'); since = fromIdx !== -1 ? args[fromIdx + 1] : today.toISOString().split('T')[0]; until = toIdx !== -1 ? args[toIdx + 1] : new Date(today.getTime() + 86400000).toISOString().split('T')[0]; break; ``` Repository paths are loaded from a working-directory configuration file and passed to the vulnerable function: ```js let config = { git: { repos: ['.'] }, output: { language: 'zh-CN' } }; const configPath = path.join(process.cwd(), '.reportrc.json'); if (fs.existsSync(configPath)) { try { config = { ...config, ...JSON.parse(fs.readFileSync(configPath, 'utf-8')) }; } catch (e) {} } // 获取提交并生成报告 const commits = getGitLogs(since, until, config.git.repos); ``` ### Technical Analysis The application constructs a shell command by directly interpolating `repo`, `since`, and `until`, then executes it through `execSync()`. These values originate from `.reportrc.json` ...[truncated 2261 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. **Remove the shell from the execution path.** Use `execFileSync()` or `spawnSync()` with a separate argument array and the `cwd` option: ```js const { execFileSync } = require('child_process'); function getGitLogs(since, until, repos = ['.']) { const commits = []; for (const repo of repos) { const resolvedRepo = path.resolve(repo); try { const output = execFileSync( 'git', [ 'log', `--since=${since}`, `--until=${until}`, '--pretty=format:%h|%s|%an|%ad', '--date=short' ], { cwd: resolvedRepo, encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'] } ).trim(); // Parse output as before. } catch (error) { // Report or safely handle the error. } } return commits; } ``` 2. **Strictly validate date arguments.** Require an exact `YYYY-MM-DD` representation and verify that it denotes a real date. Reject missing values after `--from` or `--to` rather than silently accepting `undefined`. 3. **Validate configuration structure.** Confirm that `config.git` is an object, `config.git.repos` is an array, and each repository entry is a non-empty string. 4. **Constrain repository paths.** Resolve and canonicalize every path. If the application should only inspect approved directories, verify that each canonical path remains under an explicitly allowed root and is an actual Git working tree. 5. **Avoid silent exception handling.** Emit a safe diagnostic that identifies which repository failed without exposing sensitive details. Silent failures can conceal attempted exploitation and operational errors. 6. **Add regression tests.** Test repository and date values containing command substitution, shell metacharacters, whitespace, quotes, and option-like prefixes. Verify that no external command or marker file is created. ]]>
Vulnerability Patterns
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • 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 (8)

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding
The skill declares broad report generation from git, calendar, and tasks, but the documented behavior and static finding indicate undeclared file reads and writes plus a mismatch between advertised and actual data sources. This is dangerous because users may grant trust expecting one scope of access while the skill silently accesses sensitive local repositories/configuration and stores derived reports on disk without explicit disclosure or permission expectations.

Missing User Warnings

Medium
Confidence
96% confidence
Finding
The skill handles potentially sensitive workplace data such as git history, calendar entries, and task lists, but the description does not warn users about that sensitivity. This increases the risk of unintentional exposure of confidential project names, commit contents, meeting details, and personal productivity data in generated reports or downstream storage/sharing.

Description-Behavior Mismatch

Medium
Confidence
98% confidence
Finding
The manifest describes a broader reporting skill that incorporates git commits, calendar events, and task lists. In this file, all data collection is limited to git log extraction and report formatting from commits, with no code for reading calendars or task systems.

Missing User Warnings

Medium
Confidence
96% confidence
Finding
The code builds a shell command with untrusted values from .reportrc.json (repo, since, until) and passes it to execSync. Even though repo is wrapped in double quotes, shell metacharacters such as command substitution can still be interpreted, allowing command injection and arbitrary code execution if a malicious config or arguments are supplied.

Natural-Language Policy Violations

Medium
Confidence
93% confidence
Finding
The report generator defaults `language` to `zh-CN`, and the configuration fallback later also defaults output language to `zh-CN`, which effectively forces a specific locale unless the user edits configuration. The policy requires offering language or locale choice or clearly justified constraints, neither of which is present here.

Natural-Language Policy Violations

Medium
Confidence
92% confidence
Finding
The default configuration sets `output.language` to `zh-CN`, creating a hard-coded locale preference in natural-language behavior. Since the file does not present this as an optional user choice or a justified region-specific limitation, it falls under the language/locale policy violation category.

Vague Triggers

Medium
Confidence
91% confidence
Finding
This manifest file describes the skill as 'Automatically generate daily/weekly work reports from git commits' but does not specify any explicit invocation phrases, boundaries, or exclusion conditions. In a manifest context, this broad automation description could overlap with common requests about reports and lacks specificity about when the skill should activate versus not activate.

Intent-Code Divergence

Low
Confidence
78% confidence
Finding
The module comment says this is a 'Daily Report Generator' without qualification, which in the context of the manifest suggests broader work-report generation. The actual code only builds reports from git commit history and does not implement other expected report inputs like calendar events or task lists.

Static analysis

Detected: suspicious.dangerous_exec

Shell command execution detected (child_process).

Critical
Code
suspicious.dangerous_exec
Location
index.js:19