Back to skill

Security audit

YouTube 批量发布器

Security checks for vulnerabilities and agentic risk

Overview

The skill is a coherent YouTube uploader, but its OAuth token file is stored and loaded in an unsafe way that could expose account access or execute code if tampered with.

Review before installing. Use only a test or intended YouTube account, verify every video, thumbnail, title, and privacy setting before upload, and avoid running this from a shared or writable project directory until token storage is changed to a non-executable format with private permissions.

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
youtube_publisher.py:45
Finding

Unsafe Deserialization of the OAuth Token File Enables Arbitrary Code Execution

Content
View full analysis

Vulnerability Details

File Location: youtube_publisher.py, lines 45-47
Vulnerability Type: Unsafe Python pickle deserialization
Risk Level: High

python
if TOKEN_FILE.exists():
    with open(TOKEN_FILE, 'rb') as token:
        creds = pickle.load(token)

Technical Analysis

The application automatically deserializes credentials/token.pickle using pickle.load() whenever a YouTubePublisher instance is initialized. Python pickle files are executable serialization streams rather than passive data formats. A crafted pickle can invoke attacker-selected Python callables during deserialization.

The application performs no integrity, ownership, file-type, or permission checks before loading the file. Because TOKEN_FILE points to a predictable location inside the project, any attacker who can create or replace that file can convert the next application invocation into arbitrary code execution.

Attack Path

  1. An attacker obtains write access to the project directory, the credentials directory, or an artifact deployment process that supplies token.pickle.
  2. The attacker creates a malicious pickle whose reduction operation invokes an arbitrary command or Python callable.
  3. The malicious file is placed at credentials/token.pickle.
  4. A user starts the command-line tool or initializes YouTubePublisher.
  5. _authenticate() detects the file and calls pickle.load(token).
  6. The embedded operation executes before the returned object is validated or used as an OAuth credential.

This path requires the attacker to obtain write access to the token location; the code does not independently provide remote access to that location.

Impact Assessment

Successful exploitation provides arbitrary code execution with the privileges of the account running the Skill. The attacker could read or modify files available to that account, steal OAuth credentials, alter uploaded content, execute netw ...[truncated 150 chars]

Remediation
View remediation

Remediation Suggestions

  • Remove pickle-based credential storage entirely.
  • Serialize credentials as non-executable JSON using Credentials.to_json().
  • Reload credentials with Credentials.from_authorized_user_file() while specifying the expected scopes.
  • Validate the JSON structure and reject unexpected credential types or fields.
  • Store the token outside the project directory in an operating-system-specific private application-data directory or credential manager.
  • Before reading a filesystem token, reject symbolic links and verify that the file is a regular file owned by the expected user.
  • Apply owner-only permissions to both the credential directory and token file.
  • If integrity against local replacement is required, protect the token through an operating-system credential service rather than relying only on file permissions.

T09 · Insecure Skill Coding Practices

Warning
Location
youtube_publisher.py:61
Finding

Reusable OAuth Credentials Are Persisted Without Enforced Access Permissions

Content
View full analysis

Vulnerability Details

File Location: youtube_publisher.py, lines 61-63
Vulnerability Type: Insecure storage of sensitive OAuth credentials
Risk Level: Medium

python
CREDENTIALS_DIR.mkdir(parents=True, exist_ok=True)
with open(TOKEN_FILE, 'wb') as token:
    pickle.dump(creds, token)

Technical Analysis

The application stores reusable Google OAuth credentials in credentials/token.pickle. File creation relies entirely on the process's existing umask and the ambient permissions of the project and credential directories. The code does not explicitly enforce owner-only access, verify directory ownership, prevent symbolic-link traversal, or create the token atomically.

Depending on the host configuration, another local account may be able to read the token or replace the destination file. OAuth credential objects may contain an access token and refresh token. A readable refresh token may permit continued acquisition of access tokens for the granted YouTube upload scope.

A writable token file also compounds the unsafe-deserialization finding because an attacker could replace it with a malicious pickle.

Attack Path

  1. The Skill runs in an environment with permissive directory permissions or a permissive umask.
  2. OAuth authentication completes and the application writes credentials/token.pickle without explicitly restricting its mode.
  3. Another local user or process with access to the directory reads the stored credential data or replaces the file.
  4. If read, the OAuth token may be reused subject to its validity, refresh capability, granted scope, and Google's authorization controls.
  5. If replaced, the malicious file is loaded during a later initialization, potentially triggering the separate pickle-deserialization code-execution vulnerability.

Exploitability depends on the effective filesystem permissions and the attacker's local access. The source code does not guarantee that the r ...[truncated 598 chars]

Remediation
View remediation

Remediation Suggestions

  • Prefer an operating-system credential store or secret-management service for OAuth refresh tokens.
  • If file storage is unavoidable, place credentials in a private per-user application-data directory rather than within the project.
  • Create the credential directory with mode 0700 and the token file with mode 0600.
  • Use secure, exclusive file creation and atomic replacement to reduce race-condition and overwrite risks.
  • Reject symbolic links and verify the ownership and mode of the directory and token file before reading or writing.
  • Replace pickle serialization with Google's supported JSON credential serialization.
  • Add the token path to version-control ignore rules and deployment exclusion rules.
  • Document token revocation procedures and instruct users to revoke affected authorization through their Google account if exposure is suspected.
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
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (10)

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

md
### 1. 准备凭证

在技能目录下创建 `credentials` 文件夹,并放入 YouTube OAuth 2.0 凭证文件:
- `youtube_credentials.json` - Google Cloud Console 下载的 OAuth 2.0 客户端凭证

### 2. 命令行使用

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 · youtube_publisher.py (reported line 40)May include surrounding context.

python
### 1. 准备凭证

在技能目录下创建 `credentials` 文件夹,并放入 YouTube OAuth 2.0 凭证文件:
- `youtube_credentials.json` - Google Cloud Console 下载的 OAuth 2.0 客户端凭证

### 2. 命令行使用

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The README advertises bulk uploading and modification of YouTube videos, metadata, privacy settings, and thumbnails for an external account, but it does not warn users that the skill can perform high-impact actions on their live YouTube content. In an agent/tooling context, missing disclosure around externally visible account modifications increases the risk of accidental misuse, unintended publication, or unauthorized changes if a user does not fully understand the scope of the actions.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill clearly describes automated YouTube uploads, including video files, thumbnails, and metadata, but it does not explicitly warn users that local content will be transmitted to Google/YouTube services. This creates a real privacy and data-handling risk because users may invoke the skill without understanding that sensitive local files and descriptive metadata leave the local environment.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This Python file contains natural-language descriptions, CLI help text, and runtime messages entirely in Chinese, starting with the module docstring and continuing throughout the command-line interface. Under the policy, forcing a specific language without user opt-in is a natural-language policy violation unless the locale constraint is explicitly justified, which is not present here.

Content

No source excerpt is available for this finding.

Insecure deserialization: pickle.load()

Medium
Category
Dangerous Code Execution
Confidence
96% confidence
Finding

The code deserializes TOKEN_FILE with pickle.load(), which can execute arbitrary Python code if the token file is replaced or tampered with. In a local automation skill that reads credentials from disk, this turns writable filesystem access into code execution under the skill's privileges.

Content

Scanner excerpt · youtube_publisher.py (reported line 53)May include surrounding context.

python
# 尝试加载已保存的 token
        if TOKEN_FILE.exists():
            with open(TOKEN_FILE, 'rb') as token:
                creds = pickle.load(token)
        
        # 如果没有有效凭证,获取新的
        if not creds or not creds.valid:

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
84% confidence
Finding

The skill documentation is presented in Chinese while the surrounding audit prompt and file context are otherwise English, and the file does not indicate that the skill is intentionally locale-specific or provide an opt-in language choice. This can constitute a language/locale policy issue when a skill implicitly forces one language without explanation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
90% confidence
Finding

All user-facing instructions and examples in the file are presented in Chinese, and the document does not indicate that this language choice is optional or region-specific. Under the stated policy, forcing a specific language without user opt-in is a natural-language policy concern.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
81% confidence
Finding

The description is written entirely in Chinese, which can constitute a language/locale policy issue when the skill metadata does not offer any language choice or document that the package is intended only for a Chinese-speaking audience. This may reduce accessibility for users who expect neutral or multilingual package metadata.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Low
Category
Not specified by scanner
Confidence
78% confidence
Finding

The module docstring and class/method documentation present this skill as a YouTube video publisher/uploader, centered on automatic upload and publishing. The get_video_status method adds a separate read/query capability against uploaded videos that is not described in the stated purpose, making it broader than a pure publishing skill.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.