Back to skill

Security audit

miaoda-app-chat-sync

Security checks for vulnerabilities and agentic risk

Overview

This skill performs its stated repository-to-JSON job, but it handles private code, GitHub tokens, and downstream file overwrites with enough unsafe scoping to require review.

Install only if you are comfortable exporting repository contents into JSON and sending them to another agent. Use fine-grained read-only tokens, trusted exact GitHub URLs, explicit commit hashes, exclude .env and credential files, review generated file paths and content before applying, and do not let a downstream agent blindly overwrite files.

Vulnerability Patterns
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • 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 (5)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/git/repository.py:53
Finding

GitHub Token Disclosure to Attacker-Controlled Hosts Through Weak Host Validation

Content
View full analysis
str: """Convert repo URL to use authentication if token is provided""" if not self.token or 'github.com' not in repo_url: return repo_url # Remove .git suffix for consistency repo_url = repo_url.rstrip('/') if repo_url.endswith('.git'): repo_url = repo_url[:-4] if '@' in repo_url and '://' in repo_url: parts = repo_url.split('://') # Re-add token return f"{parts[0]}://x-access-token:{self.token}@{parts[1].split('@')[1]}" if repo_url.startswith('https://'): return repo_url.replace('https://', f'https://x-access-token:{self.token}@') elif repo_url.startswith('http://'): return repo_url.replace('http://', f'https://x-access-token:{self.token}@') return repo_url ``` The credential-bearing URL is subsequently used as a Git remote: ```python auth_url = self._make_authenticated_url(repo_url) subprocess.run( ['git', 'remote', 'add', 'origin', auth_url], cwd=target_dir, capture_output=True, timeout=30 ) ``` ### Technical Analysis The code decides whether a repository is hosted by GitHub using the substring condition: ```python 'github.com' in repo_url ``` This does not validate the parsed network hostname. Attacker-controlled addresses such as the following pass the test: ```text https://github.com.attacker.example/repository https://attacker.example/path/github.com/repository ``` For an HTTPS input, the function inserts `GITHUB_TOKEN` into the URL before Git accesses it. Git may therefore transmit the token as HTTP authentication data to an attacker-controlled server. The arbitrary repository URL is accepted directly from the command line without a trusted-host al ...[truncated 1149 chars]
Remediation
View remediation

T01 · Skill Instruction Hijacking

Error
Location
scripts/core/prompts.py:15
Finding

Generated Instructions Force Downstream Agents to Overwrite Repository-Controlled File Paths

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/core/temp_manager.py:69
Finding

Private Repository Contents and Token-Bearing Git Configuration Stored in World-Traversable Temporary Directories

Content
View full analysis
str: """ Create a unique temporary directory. Returns: Path to the created temporary directory """ unique_id = uuid.uuid4().hex[:8] sanitized_prefix = self._sanitize_filename(self.prefix) dir_name = f"{sanitized_prefix}-{unique_id}" self._path = os.path.join(self.base_dir, dir_name) self._owns_path = True # Ensure parent directory exists os.makedirs(self.base_dir, exist_ok=True) # Create directory with restricted permissions (Unix) or standard (Windows) os.makedirs(self._path, mode=0o755, exist_ok=True) ``` The authenticated remote is written into the temporary repository by `scripts/git/repository.py:130-144`: ```python auth_url = self._make_authenticated_url(repo_url) # Step 1: Initialize git repo subprocess.run(['git', 'init'], cwd=target_dir, capture_output=True, timeout=30) # Step 2: Configure git user (required for operations) subprocess.run(['git', 'config', 'user.email', 'sync@github.com'], cwd=target_dir, capture_output=True, timeout=10) subprocess.run(['git', 'config', 'user.name', 'GitHub Sync'], cwd=target_dir, capture_output=True, timeout=10) # Step 3: Add remote subprocess.run(['git', 'remote', 'add', 'origin', auth_url], cwd=target_dir, capture_output=True, timeout=30) ``` ### Technical Analysis On Unix-like systems, mode `0755` permits all local users to traverse and read entries whose individual file permissions allow access. Standard Git checkout files are commonly readable by other users. The temporary clone can contain private source code, configuration, and other repository data. In addition, `git remote add origin ` writes the credential-bearing URL to `.git/config`. Random dire ...[truncated 1356 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/git/repository.py:472
Finding

Sensitive and Unbounded Repository Files Are Included in Generated Agent Payloads

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/git/repository.py:130
Finding

GitHub Token Is Exposed Through Subprocess Arguments and Persisted in Git Configuration

Content
View full analysis
@`. 3. That URL is passed as an argument to `git remote add`. 4. A local process monitor, audit tool, or another authorized local user observes the argume ...[truncated 505 chars]
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • System Prompt LeakageDirect Leakage, Indirect Extraction, Tool-Based Exfiltration
  • Rogue AgentSelf-Modification, Session Persistence
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
Findings (49)

Self-Modification

High
Category
Rogue Agent
Confidence
85% confidence
Finding

Skill modifies its own code, configuration, or behavior at runtime. Self-modification enables an agent to escalate privileges, disable safety constraints, or install persistent backdoors.

Content

Scanner excerpt · PROMPTS.md (reported line 150)May include surrounding context.

md
"3. MUST NOT reformat, optimize, or 'improve' any code",
        "4. MUST maintain all whitespace, indentation, and line endings",
        "5. MUST use exact file paths - no path manipulation",
        "6. MUST overwrite existing files completely (no merging)",
        "7. MUST create new files if they don't exist",
        "8. MUST output complete list of all updated files after execution",
        "9. MUST NOT ask for confirmation - execute immediately",

Direct Prompt Extraction

High
Category
System Prompt Leakage
Confidence
85% confidence
Finding

Skill contains instructions that could directly expose system prompts, internal rules, or hidden instructions to users or external parties.

Content

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

md
| `--exclude` | Exclude files matching patterns | None |
| `--max-files` | Maximum number of files to process | 50 |
| `--output` | Save output to file | Terminal only |
| `--no-instructions` | Output pure JSON (no formatted instructions) | Show instructions |

#### Examples

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

Private Repositories (Token Required):

bash
# Step 1: Create token (GitHub → Settings → Developer settings → Personal access tokens)
# Step 2: Set environment variable
export GITHUB_TOKEN="ghp_your_token"
# Step 3: Use the tool

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The declared description centers on retrieving code from Git hosting platforms and converting it into structured JSON instructions for AI workflows. The supplied code instead defines a CircuitBreaker class, a custom exception, and a with_retry decorator implementing retry logic with exponential backoff and jitter. These are generic reliability helpers and do not perform any repository access, code conversion, or JSON generation. This is a clear material mismatch in primary purpose and implemented capabilities.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

The declared description emphasizes a platform-agnostic tool that retrieves code from Git repositories and generates structured JSON instructions for AI agents. This code chunk does not interact with GitHub, GitLab, repositories, networking, or code parsing at all. Instead, it only stores and returns hardcoded prompt dictionaries that instruct an agent to create or overwrite files based on existing JSON input. That is a materially different purpose from fetching repository code and converting it to JSON instructions, so this chunk does not accurately represent the declared behavior.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The declared purpose focuses on repository access and transformation of code into structured JSON instructions for AI workflows. The supplied code chunk does not fetch from Git repositories, parse code, generate JSON, or perform agent-instruction conversion. Instead, it implements security-oriented sanitization and logging helpers for redacting secrets such as GitHub tokens, Slack tokens, API keys, bearer tokens, passwords, and URL credentials. This is a materially different primary purpose, not merely a supporting detail of the declared functionality.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

There is a clear mismatch between the declared purpose and the supplied code. The description claims repository retrieval and transformation of code into structured JSON instructions for AI agents. However, the code only manages temporary directories on the local filesystem: creating unique temp folders, sanitizing names, registering cleanup handlers, and deleting directories on exit or signal. These are generic utility functions and do not implement or directly support the claimed core behavior of fetching repositories or producing JSON instructions.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The declared description promises substantial functionality: repository fetching, platform-agnostic Git support, and generation of structured JSON instructions. The provided code chunk does not implement any of these behaviors; it is effectively an empty module placeholder with only a comment. This is a material mismatch because the actual code does not substantiate the declared primary purpose.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

The declared description promises substantial functionality: retrieving code from Git platforms and converting it into structured JSON instructions. The supplied code chunk does not implement any of these behaviors; it is only a package initializer with a comment. Because the actual code does not reflect the described primary purpose or capabilities, this is a clear description-behavior mismatch.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding

The declared description presents a platform-agnostic Git repository ingestion and JSON-instruction generation tool. This code chunk only handles local filesystem traversal and reading of text files, plus simple stats collection. While file processing could be a supporting component of a larger repository-to-JSON pipeline, the chunk itself does not implement the central declared capabilities of fetching from Git providers or producing structured JSON instructions for AI agents. Therefore the description does not accurately represent this supplied code chunk's actual behavior.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
91% confidence
Finding

The code chunk is an instruction/output formatter, not a repository fetcher. Its main functions accept pre-provided file contents, repo metadata, or commit info and then generate JSON plus human-readable wrappers. It also saves output to files and prints to terminal. While this partially aligns with 'generates structured JSON instructions for AI agents,' the declared description specifically claims it fetches code from Git repositories (GitHub, GitLab, etc.), which this code does not do at all. The chunk also supports commit-info and full-change reporting, extending beyond the declared core purpose. Therefore the description does not accurately represent the actual behavior.

Content

No source excerpt is available for this finding.

Ssd 3

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The documented workflow explicitly moves repository contents into JSON for downstream AI/automation systems, creating a semantic exfiltration path. For private repositories, this can leak source code, secrets accidentally present in files, and internal architecture to external processors or chat systems.

Content

No source excerpt is available for this finding.

Ssd 3

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The template orders downstream agents to reproduce all file contents exactly and return complete file lists, effectively packaging repository data as natural-language/JSON instructions. This makes bulk code disclosure and replication easy, and the 'must follow exactly' framing increases the chance that downstream agents will treat embedded malicious text or unsafe paths as authoritative.

Content

No source excerpt is available for this finding.

Ssd 3

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The info command is documented to expose complete file contents for all changed files, which is a direct data-disclosure behavior rather than merely informational metadata. In practice this can leak sensitive code, embedded credentials, internal comments, or legal/proprietary content whenever commit details are requested.

Content

No source excerpt is available for this finding.

Ssd 3

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The sync workflow instructs users or agents to send full file-update payloads via chat to another tool, turning source code into chat content. This is a high-risk exfiltration channel because chat systems may log, retain, or further process the payload, and the downstream tool is told to apply it without confirmation.

Content

No source excerpt is available for this finding.

Credential Access

High
Category
Privilege Escalation
Confidence
90% confidence
Finding

Including *.env in recommended sync/export filters risks collecting and propagating environment files that commonly contain credentials, secrets, and service endpoints. Since the workflow then serializes file contents into JSON and may forward them to another AI/chat system, the exposure path is direct and severe.

Content

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

md
# Batch 1: Configuration
python3 scripts/generator.py sync \
  --repo https://github.com/username/large-project \
  --filter "*.json,*.yaml,*.toml,*.env" \
  --max-files 20 \
  --output batch1.json

Missing User Warnings

High
Category
Not specified by scanner
Confidence
96% confidence
Finding

The workflow repeatedly instructs downstream agents to overwrite files completely, skip confirmation, and not omit any file, but it does not prominently warn users about destructive data-loss risk. In an agent ecosystem this can cause silent loss of local changes, propagation of malicious repository content, or mass overwrite of a target project.

Content

No source excerpt is available for this finding.

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

md
"publishedAt": 1745851829,
  "env": {
    "GITHUB_TOKEN": {
      "description": "GitHub Personal Access Token for private repository access",
      "required": false,
      "scope": "repo (read-only)"
    }

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 · _meta.json (reported line 8)May include surrounding context.

json
"publishedAt": 1745851829,
  "env": {
    "GITHUB_TOKEN": {
      "description": "GitHub Personal Access Token for private repository access",
      "required": false,
      "scope": "repo (read-only)"
    }

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

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

Content

Scanner excerpt · scripts/core/constants.py (reported line 12)May include surrounding context.

python
'.html', '.css', '.scss', '.less',
    '.json', '.yaml', '.yml', '.toml',
    '.md', '.txt', '.sh', '.bash',
    '.xml', '.sql', '.env',
    '.vue', '.svelte', '.rst',
}

Missing User Warnings

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The sync prompt explicitly instructs the agent to overwrite existing files, create missing files, avoid confirmation, and skip no files. In a skill that converts repository content into instructions for AI agents, these directives can drive blind application of untrusted changes, enabling destructive repository tampering or propagation of malicious code if the upstream JSON is attacker-controlled.

Content

No source excerpt is available for this finding.

Missing User Warnings

High
Category
Not specified by scanner
Confidence
96% confidence
Finding

The same unsafe no-confirmation overwrite behavior appears in the INFO prompt, which is especially dangerous because users may reasonably expect 'info' to be non-destructive. This increases the chance of accidental execution of repository-wide writes under a misleading command name, amplifying the risk beyond the sync prompt alone.

Content

No source excerpt is available for this finding.

Direct Prompt Extraction

High
Category
System Prompt Leakage
Confidence
85% confidence
Finding

Skill contains instructions that could directly expose system prompts, internal rules, or hidden instructions to users or external parties.

Content

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

md
if command not in prompts:
            raise ValueError(f"Unknown command: {command}. Available: {list(prompts.keys())}")
        
        return prompts[command].copy()

Direct Prompt Extraction

High
Category
System Prompt Leakage
Confidence
85% confidence
Finding

Skill contains instructions that could directly expose system prompts, internal rules, or hidden instructions to users or external parties.

Content

Scanner excerpt · scripts/core/prompts.py (reported line 82)May include surrounding context.

python
if command not in prompts:
            raise ValueError(f"Unknown command: {command}. Available: {list(prompts.keys())}")
        
        return prompts[command].copy()

Env Variable Harvesting

High
Category
Data Exfiltration
Confidence
72% confidence
Finding

Copying the entire parent environment into git subprocesses can unintentionally propagate sensitive credentials or unsafe git-related environment variables to a network-capable child process. In this skill context, which fetches untrusted remote repositories, inherited variables such as custom git helpers, proxy settings, SSH-related settings, or credentials can broaden the attack surface and leak secrets through subprocess behavior or indirect tooling interactions.

Content

Scanner excerpt · scripts/git/repository.py (reported line 45)May include surrounding context.

python
def _get_git_env(self) -> Dict[str, str]:
        """Get environment variables for git commands with authentication"""
        env = os.environ.copy()
        if self.token:
            env['GIT_ASKPASS'] = 'echo'
            env['GIT_TERMINAL_PROMPT'] = '0'