Back to skill

Security audit

token-tracker-daily

Security checks for vulnerabilities and agentic risk

Overview

The skill appears intended for local token usage reporting, but review is warranted because it overstates automation, recommends persistent cron jobs, and its scripts can store data outside the documented skill folder.

Review before installing. Use it only if you are comfortable with local token-count history being persisted, fix or verify the data path before running it, and inspect any cron job before enabling recurring reports. Do not rely on it for automatic usage accounting unless you separately wire token counts into the logger.

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

Warning
Location
log_token.py:14
Finding

Token Data Is Read and Written Outside the Skill Directory

Content
View full analysis

Vulnerability Details

File Location: log_token.py:14-36, daily_report.py:13-24, and weekly_report.py:12-23
Vulnerability Type: Improper filesystem path construction and unsafe file handling
Risk Level: Medium

Vulnerable Code

log_token.py:14-24:

python
# Data file path
DATA_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', 'data')
DATA_FILE = os.path.join(DATA_DIR, 'token_log.json')


def ensure_data_file():
    """Ensure the data file exists"""
    if not os.path.exists(DATA_DIR):
        os.makedirs(DATA_DIR)
    if not os.path.exists(DATA_FILE):
        with open(DATA_FILE, 'w', encoding='utf-8') as f:
            json.dump({}, f)

log_token.py:34-36:

python
def save_data(data):
    """Save data to the file"""
    with open(DATA_FILE, 'w', encoding='utf-8') as f:
        json.dump(data, f, ensure_ascii=False, indent=2)

daily_report.py:13-24:

python
# Data file path
DATA_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', 'data')
DATA_FILE = os.path.join(DATA_DIR, 'token_log.json')


def load_data():
    """Load the data file"""
    if not os.path.exists(DATA_FILE):
        return {}
    try:
        with open(DATA_FILE, 'r', encoding='utf-8') as f:
            return json.load(f)
    except:
        return {}

weekly_report.py:12-23:

python
# Data file path
DATA_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', 'data')
DATA_FILE = os.path.join(DATA_DIR, 'token_log.json')


def load_data():
    """Load the data file"""
    if not os.path.exists(DATA_FILE):
        return {}
    try:
        with open(DATA_FILE, 'r', encoding='utf-8') as f:
            return json.load(f)
    except:
        return {}

Technical Analysis

All three scripts are located in the project root. Appending .. to each script's directory therefore caus ...[truncated 2520 chars]

Remediation
View remediation

Remediation Suggestions

  1. Store runtime data in an explicitly authorized directory inside the Skill or in a user-specific application-data directory:

    python
    from pathlib import Path
    
    BASE_DIR = Path(__file__).resolve().parent
    DATA_DIR = BASE_DIR / "data"
    DATA_FILE = DATA_DIR / "token_log.json"
    
  2. If the intended package layout places scripts under scripts/, move the Python files into that directory and place the JSON file under the project-level data/ directory. Ensure the implementation and documentation describe the same layout.

  3. Resolve and validate the final path before access:

    python
    resolved_dir = DATA_DIR.resolve()
    if BASE_DIR not in resolved_dir.parents and resolved_dir != BASE_DIR:
        raise RuntimeError("Data path escapes the authorized directory")
    
  4. Reject unexpected symbolic links where the deployment model permits them. On supported systems, use secure open flags such as O_NOFOLLOW, and validate the opened file with fstat().

  5. Write updates atomically by creating a temporary file in the same directory, flushing and synchronizing it, and then applying os.replace().

  6. Apply restrictive directory and file permissions, such as owner-only access where appropriate.

  7. Use file locking when multiple logger processes can run concurrently, preventing lost updates and malformed JSON.

  8. Replace broad exception handlers with specific handling for json.JSONDecodeError and OSError. Report corruption instead of silently replacing the effective dataset with an empty dictionary.

Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (10)

Tp4

High
Category
MCP Tool Poisoning
Confidence
93% confidence
Finding

This finding reflects the same core issue: the skill presents functionality that suggests autonomous tracking and delivery, while the actual behavior appears to depend on explicit command invocation and local data processing. Such overclaiming can mislead operators into believing token consumption is being comprehensively monitored when it is not, reducing the effectiveness of audit and cost-control workflows.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

This finding reflects the same core issue: the skill presents functionality that suggests autonomous tracking and delivery, while the actual behavior appears to depend on explicit command invocation and local data processing. Such overclaiming can mislead operators into believing token consumption is being comprehensively monitored when it is not, reducing the effectiveness of audit and cost-control workflows.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
84% confidence
Finding

The markdown states that the skill supports cron-based automatic sending of reports, which implies automated transmission of usage data, but it does not warn users about what data is sent, where it is sent, or any privacy implications. For markdown files, user-facing documentation should disclose behaviours that could affect user data or privacy.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
89% confidence
Finding

The skill instructs use of local scripts that read and write persistent files (data/token_log.json) but does not declare any tool scope or permissions boundary. In an agent environment, undeclared file access weakens reviewability and can lead to unexpected data persistence or broader filesystem access than users and operators expect.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
84% confidence
Finding

The skill provides cron-based recurring report setup and states that token usage is stored locally, but it does not present a clear user warning or opt-in around ongoing persistence and repeated report generation. Recurring jobs can continue collecting and exposing usage patterns over time, increasing privacy and operational risk if users do not fully understand that monitoring is continuous.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The module docstring and all user-facing report strings indicate the skill is designed to produce output only in Chinese. For a general reporting tool, this is a natural-language locale constraint without user opt-in or documented regional justification, which fits the language/locale policy violation category.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The module docstring and all user-facing CLI messages are written only in Chinese, which imposes a specific language on users. The file does not offer an alternative language, user opt-in, or any explanation that the tool is intentionally region-specific.

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 and report strings in Chinese, and there is no indication that the user can opt into another language or that the skill is intentionally limited to a Chinese-speaking context. Under the language/locale policy, forcing a specific language without user choice is a policy concern.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
92% confidence
Finding

The README content is presented in Chinese and does not indicate that users may choose another language or that the skill is intentionally limited to a Chinese-speaking audience. This can violate a language/locale policy when a specific language is effectively forced without user opt-in or justification.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill content, operational instructions, and user-facing examples are presented exclusively in Chinese, which effectively forces a specific language for use and understanding. The file does not indicate that other languages are supported or that the user can choose their preferred language.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.