Back to skill

Security audit

Google Services Secure

Security checks for vulnerabilities and agentic risk

Overview

This Google Workspace helper is purpose-aligned, but its implementation does not match its strong security claims and stores OAuth tokens in a predictable local file.

Review this before installing in any account with sensitive mail, files, calendars, or contacts. Treat the enterprise security claims as unsupported until token storage, OAuth request binding, permission enforcement, confirmations, validation, and rate limiting are implemented and tested. Use only low-scope test credentials if evaluating it.

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

T09 · Insecure Skill Coding Practices

Error
Location
scripts/auth-google.sh:140
Finding

OAuth Access and Refresh Tokens Are Persisted in a Predictable Plaintext File

Content
View full analysis
"$TOKEN_FILE" chmod 600 "$TOKEN_FILE" print_success "Tokens saved to: $TOKEN_FILE" # Log to audit (redact tokens) log_action "EXCHANGE_CODE" "success" # Export for current session export ACCESS_TOKEN="$access_token" export REFRESH_TOKEN="$refresh_token" ``` ```bash # Read refresh token from file local refresh_token=$(grep -oP '"refresh_token":\s*"\K[^"]*' "$TOKEN_FILE" | head -1) if [ -z "$refresh_token" ]; then print_error "Refresh token not found" return 1 fi # Make POST request to refresh local response=$(curl -s -X POST \ "https://oauth2.googleapis.com/token" \ -H "Content-Type: application/x-www-form-urlencoded" \ -d "client_id=$GOOGLE_CLIENT_ID" \ -d "client_secret=$GOOGLE_CLIENT_SECRET" \ -d "refresh_token=$refresh_token" \ -d "grant_type=refresh_token") if echo "$response" | grep -q '"access_token"'; then local access_token=$(echo "$response" | grep -oP '"access_token":\s*"\K[^"]*' | head -1) local new_refresh_token=$(echo "$response" | grep -oP '"refresh_token":\s*"\K[^"]*' | head -1) local expires_in=$(echo "$response" | grep -oP '"expires_in":\s* ...[truncated 2590 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/auth-google.sh:83
Finding

OAuth Authorization Flow Omits State and PKCE and Does Not Encode Request Parameters

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/validate-setup.sh:120
Finding

Advertised Permission, Confirmation, Rate-Limiting, and Validation Controls Are Not Enforced

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/auth-google.sh:48
Finding

Client Secret Is Unsafely Interpolated into a sed Expression

Content
View full analysis
> "$AUDIT_LOG" # Redact client secret in logs sed -i "s/$GOOGLE_CLIENT_SECRET/REDACTED_SECRET/g" "$AUDIT_LOG" } ``` ### Technical Analysis `GOOGLE_CLIENT_SECRET` is inserted directly into a sed program. It is not escaped as a literal pattern. Client secrets containing `/`, backslashes, brackets, anchors, wildcard expressions, newlines, or other sed and regular-expression metacharacters can change the meaning of the command or make it syntactically invalid. Because the script enables `set -e`, a malformed sed expression can terminate authentication after an OAuth response has already been written to the token file. Broad or manipulated regular expressions can also replace unrelated portions of historical audit records, damaging audit integrity. The function does not need this replacement at all because its newly generated log entry does not contain the client secret. Reprocessing the complete log on every event increases the impact and cost of the unsafe expression. ### Attack Path 1. A malformed or attacker-controlled `GOOGLE_CLIENT_SECRET` containing sed delimiter or regular-expression syntax is supplied through the execution environment. 2. The user invokes authentication, refresh, revocation, or another action that calls `log_action`. 3. The secret is interpolated into `sed -i "s/.../.../g"` as program syntax. 4. The resulting expression fails or matches unintended log content. 5. The script may terminate because of `set -e`, or historical audit ...[truncated 944 chars]
Remediation
View remediation
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • YARA SignaturesMalware Match, Webshell Match, Cryptominer Match
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
Findings (63)

Instruction Override

High
Category
Prompt Injection
Confidence
90% confidence
Finding

This pattern attempts to override system instructions or ignore safety constraints. Without LLM analysis, manual review is recommended.

Content

Scanner excerpt · CONTRIBUTING.md (reported line 36)May include surrounding context.

md
### What We Reject

- ❌ Features that bypass security validations
- ❌ Removal of audit logging
- ❌ Hardcoded OAuth tokens or secrets
- ❌ Weakening of permission systems

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

md
- Generate OAuth 2.0 authorization URL
- Open browser for user consent
- Capture authorization code
- Exchange code for access token
- Store tokens securely in memory

### 5. Use Google Services

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

md
- Generate OAuth 2.0 authorization URL
- Open browser for user consent
- Capture authorization code
- Exchange code for access token
- Store tokens securely in memory

### 5. Use Google Services

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

md
- Generate OAuth 2.0 authorization URL
- Open browser for user consent
- Capture authorization code
- Exchange code for access token
- Store tokens securely in memory

### 5. Use Google Services

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/auth-google.sh (reported line 113)May include surrounding context.

sh
- Generate OAuth 2.0 authorization URL
- Open browser for user consent
- Capture authorization code
- Exchange code for access token
- Store tokens securely in memory

### 5. Use Google Services

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/auth-google.sh (reported line 127)May include surrounding context.

sh
- Generate OAuth 2.0 authorization URL
- Open browser for user consent
- Capture authorization code
- Exchange code for access token
- Store tokens securely in memory

### 5. Use Google Services

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/auth-google.sh (reported line 174)May include surrounding context.

sh
- Generate OAuth 2.0 authorization URL
- Open browser for user consent
- Capture authorization code
- Exchange code for access token
- Store tokens securely in memory

### 5. Use Google Services

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/auth-google.sh (reported line 237)May include surrounding context.

sh
- Generate OAuth 2.0 authorization URL
- Open browser for user consent
- Capture authorization code
- Exchange code for access token
- Store tokens securely in memory

### 5. Use Google Services

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/auth-google.sh (reported line 246)May include surrounding context.

sh
- Generate OAuth 2.0 authorization URL
- Open browser for user consent
- Capture authorization code
- Exchange code for access token
- Store tokens securely in memory

### 5. Use Google Services

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/auth-google.sh (reported line 324)May include surrounding context.

sh
- Generate OAuth 2.0 authorization URL
- Open browser for user consent
- Capture authorization code
- Exchange code for access token
- Store tokens securely in memory

### 5. Use Google Services

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/auth-google.sh (reported line 325)May include surrounding context.

sh
- Generate OAuth 2.0 authorization URL
- Open browser for user consent
- Capture authorization code
- Exchange code for access token
- Store tokens securely in memory

### 5. Use Google Services

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

The skill is presented as a secure Google Workspace integration layer, but the content mostly provides setup guidance and direct API calls rather than an actual controlled integration framework. Overstated behavior in a security-sensitive skill can cause users or agents to trust unaudited direct actions involving mail, files, contacts, and calendars.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

The skill is presented as a secure Google Workspace integration layer, but the content mostly provides setup guidance and direct API calls rather than an actual controlled integration framework. Overstated behavior in a security-sensitive skill can cause users or agents to trust unaudited direct actions involving mail, files, contacts, and calendars.

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 · references/security.md (reported line 53)May include surrounding context.

md
This skill implements multiple layers of protection:

### OAuth Token Management
- Access tokens stored only in memory (RAM)
- Never written to files
- Automatic refresh for long-term access
- Secure storage with chmod 600 for token file (if used)

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

md
### 4. OAuth Token Leaks

**Attack:** Leaking access tokens in logs, errors, or browser storage

**Mitigation:**
- Token redaction in logs

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

md
### 4. OAuth Token Leaks

**Attack:** Leaking access tokens in logs, errors, or browser storage

**Mitigation:**
- Token redaction in logs

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

md
### 4. OAuth Token Leaks

**Attack:** Leaking access tokens in logs, errors, or browser storage

**Mitigation:**
- Token redaction in logs

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

md
### 4. OAuth Token Leaks

**Attack:** Leaking access tokens in logs, errors, or browser storage

**Mitigation:**
- Token redaction in logs

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 · references/security.md (reported line 132)May include surrounding context.

md
### 4. OAuth Token Leaks

**Attack:** Leaking access tokens in logs, errors, or browser storage

**Mitigation:**
- Token redaction in logs

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 · references/security.md (reported line 308)May include surrounding context.

md
### 4. OAuth Token Leaks

**Attack:** Leaking access tokens in logs, errors, or browser storage

**Mitigation:**
- Token redaction in logs

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 · references/security.md (reported line 254)May include surrounding context.

md
1. **Immediate Actions:**
   - Rotate all OAuth tokens immediately
   - Revoke access tokens via Google Cloud Console
   - Switch to readonly permission mode
   - Isolate affected systems

YARA rule 'backdoor_persistence': Backdoor persistence with malicious payloads (shell commands, SSH key injection, hidden root users) [malware]

High
Category
YARA Match
Confidence
75% confidence
Finding

YARA rule matched a known malware signature (reverse shell, backdoor, ransomware, C2 framework, or info stealer).

Content

Scanner excerpt · references/security.md (reported line 298)May include surrounding context.

fo]

🔒 Best Practices

For Users

  1. Environment Variables

    bash
    # ✅ DO: Set at system level
    export GOOGLE_CLIENT_ID="your-client-id.apps.googleusercontent.com"
    export GOOGLE_CLIENT_SECRET="your-client-secret"
    
    # ❌ DON'T: Store in files
    echo 'export GOOGLE_CLIENT_SECRET="..."' >> ~/.bashrc  # ⚠️ INSECURE
    
  2. Permission Mode

    • Use readonly in production
    • Only use restricted when necessary
    • Never use full in production
    • Regular reviews of permission changes
  3. OAuth Token Management

    • Never share access tokens
    • Revoke unused tokens regularly
    • Monitor OAuth consent history
    • Use minimal required scopes
  4. Regular Reviews

    • Review audit logs weekly
    • Rotate OAuth tokens monthly
    • Update dependencies regularly
    • Monitor Google Cloud quota usage
    • Check for

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

md
local refresh_token=$(echo "$response" | grep -oP '"refresh_token":\s*"\K[^"]*' | head -1)
        local expires_in=$(echo "$response" | grep -oP '"expires_in":\s*\K[^,]*' | head -1)
        
        print_success "Access token received"
        print_info "Token expires in: ${expires_in}s (${expires_in} seconds)"
        
        # Save tokens securely

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/auth-google.sh (reported line 145)May include surrounding context.

sh
local refresh_token=$(echo "$response" | grep -oP '"refresh_token":\s*"\K[^"]*' | head -1)
        local expires_in=$(echo "$response" | grep -oP '"expires_in":\s*\K[^,]*' | head -1)
        
        print_success "Access token received"
        print_info "Token expires in: ${expires_in}s (${expires_in} seconds)"
        
        # Save tokens securely

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/auth-google.sh (reported line 209)May include surrounding context.

sh
local refresh_token=$(echo "$response" | grep -oP '"refresh_token":\s*"\K[^"]*' | head -1)
        local expires_in=$(echo "$response" | grep -oP '"expires_in":\s*\K[^,]*' | head -1)
        
        print_success "Access token received"
        print_info "Token expires in: ${expires_in}s (${expires_in} seconds)"
        
        # Save tokens securely