Back to skill

Security audit

Cocktail Boy

Security checks for vulnerabilities and agentic risk

Overview

This is a local cocktail recipe lookup skill with minor quality and localization issues, but no hidden, destructive, persistent, or data-exfiltrating behavior found.

Install only if a Chinese-language cocktail lookup helper fits your workflow. Be aware that scene-based recommendations and the documented shortcut entrypoint appear incomplete, and unusual regex characters in searches may cause errors.

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

Note
Location
scripts/query.sh:28
Finding

User-Controlled Regular Expression Injection in Cocktail Search

Content
View full analysis

Vulnerability Details

File Location: scripts/query.sh, lines 28–33 and line 84
Vulnerability Type: User-controlled regular expression injection
Risk Level: Low

Vulnerable Code

bash
result=$(awk -F',' -v drink="$query" '
    NR==1 {next}  # Skip the header
    {
        if (tolower($1) ~ tolower(drink)) print $0
    }
' "$DB_FILE" | head -20)
bash
drinks=$(awk -F',' -v ing="$ingredient" 'NR==1 {next} tolower($2) ~ tolower(ing) {print $1}' "$DB_FILE" | sort -u)

Technical Analysis

The search_drink and search_by_ingredient functions pass command-line input into AWK variables and use those variables as the right-hand operand of the ~ operator. AWK therefore interprets the supplied cocktail name or ingredient as an Extended Regular Expression rather than as literal search text.

Shell quoting and AWK's -v argument prevent this input from becoming shell syntax, so the flaw does not permit arbitrary shell-command execution. However, an attacker can supply malformed expressions, such as an unmatched [, to trigger an AWK parsing error and make the requested operation fail. More complex regular expressions may also consume excessive CPU while being evaluated against the bundled database.

Attack Path

  1. An attacker invokes the script with a crafted search argument, for example:
    bash
    ./scripts/query.sh search '['
    
    or:
    bash
    ./scripts/query.sh ingredient '['
    
  2. main forwards the second command-line argument to search_drink or search_by_ingredient.
  3. The function places the argument in the AWK variable drink or ing.
  4. The AWK ~ operator compiles the attacker-controlled value as a regular expression.
  5. A malformed expression causes AWK to terminate with an error. A sufficiently expensive expression may increase CPU use during database scanning.

Impact Assessment

Exploitation can disrupt the current search operation and may cause localized denial of service through ...[truncated 336 chars]

Remediation
View remediation

Remediation Suggestions

Use literal substring matching instead of AWK's regular-expression operator:

bash
result=$(awk -F',' -v drink="$query" '
    NR == 1 { next }
    index(tolower($1), tolower(drink)) > 0 { print $0 }
' "$DB_FILE" | head -20)
bash
drinks=$(awk -F',' -v ing="$ingredient" '
    NR == 1 { next }
    index(tolower($2), tolower(ing)) > 0 { print $1 }
' "$DB_FILE" | sort -u)

Apply the following additional hardening measures:

  1. Reject unreasonably long search arguments before invoking AWK.
  2. Check AWK's exit status and return a controlled error instead of continuing with incomplete results.
  3. If regular-expression search is intentionally supported, validate patterns before use, impose input-length and execution-time limits, and clearly document that arguments are regular expressions.
  4. Add regression tests covering malformed metacharacters such as [, (, \, *, and {.
Vulnerability Patterns
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (7)

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

代码整体与“私人调酒师/鸡尾酒查询推荐工具”的描述大体一致:它确实查询本地鸡尾酒数据库,支持按酒名搜索、按原料搜索、随机推荐,并展示配方与调制方法,数据库规模描述也基本吻合(输出中写 1635 款,描述称 1635+)。但声明中明确提到“场景化推荐”,而实际代码仅实现了 search、ingredient、recommend 三类命令,没有任何基于场景(如聚会、约会、夏日、入门等)的筛选或推荐逻辑。因此存在描述与行为不完全一致的能力夸大,应判定为 mismatch。

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The manifest description and all user-facing instructions are written entirely in Chinese, which indicates the skill is presented in a single language with no opt-in or alternative locale. Under the language/locale policy, this is a natural-language policy concern unless the skill explicitly offers a language choice or documents a justified region-specific constraint.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

This shell script's comments and all displayed help/output are in Chinese, which imposes a specific language on users without offering an alternative or documenting a justified locale restriction. The policy explicitly flags language or locale constraints unless the skill provides user choice or clearly states a justified regional scope.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

This shell script's comments, prompts, usage text, and results are all presented in Chinese, including the main help output and error messages. Because the file provides no user opt-in, language selection, or documented region-specific justification, it violates the natural-language locale policy for skills that should not force a language unilaterally.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
87% confidence
Finding

The README says the language is English for drink names and ingredients, which imposes a specific locale/language expectation in the skill description. Under the policy, fixed language constraints should either offer user choice or be clearly justified as region-specific; this line does not do so.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
97% confidence
Finding

All user-facing strings in the script are in Chinese, including the title, prompts, and example utterances. This imposes a specific language/locale on users without any opt-in or documented justification, which matches the policy-violation category for language or locale constraints.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
87% confidence
Finding

This manifest presents the skill description and command arguments entirely in Chinese, including user-facing invocation patterns such as "/cocktail [酒名]" and "/scene [场景描述]". Under the policy, forcing a specific language without opt-in or documented justification is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.