Back to skill

Security audit

xAI OAuth Usage Checker

Security checks for vulnerabilities and agentic risk

Overview

This skill performs a disclosed read-only xAI quota check using the user's Hermes OAuth token, with no evidence of hidden persistence, mutation, or token disclosure.

Install only if you trust this publisher to read your Hermes xAI OAuth access token and send it to the Grok CLI billing endpoint for a quota check. The reviewed artifact is designed to avoid showing or saving tokens and does not modify credentials or billing settings.

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
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
Findings (11)

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 63)May include surrounding context.

md
3. If `status: ok`, report only usage, remaining quota, `period_end_jst`, approximate time remaining, and `product_usage`, using Hermes' display language.
4. If `remaining_percent` is zero and `remaining_seconds` is positive, treat the quota as not yet recovered.
5. If `status: error`, report only `error` and `http_status`. Do not automatically reauthenticate after a 401 or 403 response.
6. Never display, save, or include access tokens, refresh tokens, ID tokens, `auth.json` contents, or the raw API response in an answer.

Example report:

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 · scripts/check_xai_usage.py (reported line 118)May include surrounding context.

python
)
    if not isinstance(token, str) or not token.strip():
        raise UsageError(
            "xai-oauth access token is not configured",
            "xai-oauth access tokenが設定されていません",
        )
    return token.strip()

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 · scripts/check_xai_usage.py (reported line 119)May include surrounding context.

python
)
    if not isinstance(token, str) or not token.strip():
        raise UsageError(
            "xai-oauth access token is not configured",
            "xai-oauth access tokenが設定されていません",
        )
    return token.strip()

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 · tests/test_check_xai_usage.py (reported line 235)May include surrounding context.

python
)
    if not isinstance(token, str) or not token.strip():
        raise UsageError(
            "xai-oauth access token is not configured",
            "xai-oauth access tokenが設定されていません",
        )
    return token.strip()

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 · tests/test_check_xai_usage.py (reported line 236)May include surrounding context.

python
)
    if not isinstance(token, str) or not token.strip():
        raise UsageError(
            "xai-oauth access token is not configured",
            "xai-oauth access tokenが設定されていません",
        )
    return token.strip()

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 · tests/test_check_xai_usage.py (reported line 249)May include surrounding context.

python
)
    if not isinstance(token, str) or not token.strip():
        raise UsageError(
            "xai-oauth access token is not configured",
            "xai-oauth access tokenが設定されていません",
        )
    return token.strip()

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 · tests/test_check_xai_usage.py (reported line 262)May include surrounding context.

python
)
    if not isinstance(token, str) or not token.strip():
        raise UsageError(
            "xai-oauth access token is not configured",
            "xai-oauth access tokenが設定されていません",
        )
    return token.strip()

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
93% confidence
Finding

The skill invokes a Python script via the terminal and, by its own description, relies on environment data, filesystem access, and outbound network access, but it does not declare any explicit tool scope or permission boundaries. This creates a capability/visibility gap: reviewers and policy engines cannot easily constrain what the skill is allowed to do, increasing the chance of over-privileged execution or misuse if the script changes.

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

python
if hermes is None:
        return "en"
    try:
        result = subprocess.run(
            [hermes, "config", "get", "display.language"],
            capture_output=True,
            text=True,

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
81% confidence
Finding

The tests assert that detect_language() only returns ja for Japanese and defaults to en for other values including fr and unknown. This indicates the skill may override a user's configured locale unless it is Japanese, which is a natural-language locale policy concern because no broader user language choice is honored.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
79% confidence
Finding

The script normalizes language selection to either 'ja' or 'en' only, and later uses that binary choice for all user-facing output. This imposes a locale restriction in natural-language behavior without an explicit user opt-in for users whose environment may indicate another language.

Content

No source excerpt is available for this finding.

Static analysis

Detected: suspicious.dynamic_code_execution

Dynamic code execution detected.

Critical
Code
suspicious.dynamic_code_execution
Location
tests/test_check_xai_usage.py:20