Back to skill

Security audit

阿里云SLS日志查询

Security checks for vulnerabilities and agentic risk

Overview

This skill does what it claims, but it handles cloud log access through unsafe command templates and command-line credentials.

Review this skill before installing. Use least-privilege Alibaba Cloud credentials, prefer configured profiles or secure credential providers, avoid putting AccessKey secrets or STS tokens in commands or chat, and do not execute generated commands unless parameters are trusted and safely quoted or passed as structured process arguments.

Vulnerability Patterns
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • 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
Findings (3)

T09 · Insecure Skill Coding Practices

Error
Location
SKILL.md:183
Finding

Shell Command Injection Through Untrusted Template Parameters

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 183–203
Vulnerability Type: Shell command injection
Risk Level: High

Vulnerable Code

bash
aliyunlog log get_log \
--project="{{project}}" \
--logstore="{{logstore}}" \
--from_time="{{from_time}}" \
--to_time="{{to_time}}" \
{{#if topic}}--topic="{{topic}}"{{/if}} \
{{#if query}}--query="{{query}}"{{/if}} \
{{#if reverse}}--reverse={{reverse}}{{/if}} \
{{#if offset}}--offset={{offset}}{{/if}} \
{{#if size}}--size={{size}}{{/if}} \
{{#if power_sql}}--power_sql={{power_sql}}{{/if}} \
{{#if access-id}}--access-id="{{access-id}}"{{/if}} \
{{#if access-key}}--access-key="{{access-key}}"{{/if}} \
{{#if sts-token}}--sts-token="{{sts-token}}"{{/if}} \
{{#if region-endpoint}}--region-endpoint="{{region-endpoint}}"{{/if}} \
{{#if client-name}}--client-name="{{client-name}}"{{/if}} \
{{#if profile}}--profile="{{profile}}"{{/if}} \
{{#if jmes-filter}}--jmes-filter="{{jmes-filter}}"{{/if}} \
{{#if decode-output}}--decode-output="{{decode-output}}"{{/if}} \
--format-output={{format_output|default("json,no_escape")}}

Technical Analysis

The skill constructs a shell command by directly interpolating multiple user-controlled values. Placing values inside double quotes is not sufficient shell escaping: command substitutions such as $(command) and backtick expressions can still be evaluated by a shell. Parameters rendered without quotes, including Boolean, integer, and output-format fields, present additional injection opportunities if their declared types are not strictly enforced before rendering.

The special-character guidance in the document only addresses selected query characters and does not provide a safe, general-purpose shell-argument encoding mechanism. The risk arises if an agent renders this template into a command string and executes it through a shell.

Attack Path

  1. An attacker supplies a malicious value for a ...[truncated 927 chars]
Remediation
View remediation

Remediation Suggestions

  • Do not execute a rendered command string through a shell.
  • Invoke aliyunlog with a structured argument array and disable shell interpretation, such as shell=False.
  • Enforce strict type checks for Boolean and integer parameters.
  • Validate project, logstore, profile, client name, output format, endpoint, and similar fields against narrowly defined allowlists.
  • Pass the query as one literal process argument rather than attempting manual shell escaping.
  • Reject control characters, unexpected option prefixes, and invalid endpoint formats where applicable.
  • If the skill only displays commands, use a platform-specific quoting library and clearly state that displayed text must not be passed to a shell without validation.
  • Require explicit user confirmation before executing commands containing sensitive parameters or unusually complex query input.

T08 · Insecure Dependencies

Warning
Location
SKILL.md:46
Finding

Unpinned Third-Party Package Installation and Automatic Upgrades

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 46–49 and 59–63
Vulnerability Type: Unsafe dependency installation
Risk Level: Medium

Vulnerable Code

bash
pip3 install aliyun-log-python-sdk aliyun-log-cli -U --no-cache

The same command is documented for both initial installation and upgrades.

Technical Analysis

The installation command retrieves mutable package versions from the environment's default Python package index without version constraints, integrity hashes, or a lockfile. The -U option explicitly selects newer available releases, meaning the code installed and executed can change independently of this skill's review.

Python package installation may execute package-controlled build or installation logic. Therefore, compromise of a package release, package index, maintainer account, or dependency chain could cause unreviewed code to execute locally. No evidence in the audited file establishes that these named packages are malicious; the finding concerns unsafe and non-reproducible dependency handling.

Attack Path

  1. A package release or one of its transitive dependencies is compromised or unexpectedly changes.
  2. A user follows the documented installation or upgrade command.
  3. pip resolves the latest acceptable packages from the configured package index.
  4. Package-controlled build or installation code executes under the invoking user's privileges.
  5. The compromised dependency can access or alter resources available to that user and affect subsequent skill operations.

Impact Assessment

Exploitation could result in arbitrary code execution with the privileges of the user running pip. Potentially exposed resources include local files, environment variables, Alibaba Cloud credentials, and other credentials accessible to the account. If installation is performed by an administrator or into a privileged environment, the impact increases accordingly.

Remediation
View remediation

Remediation Suggestions

  • Pin all direct dependencies to reviewed, exact versions.
  • Record transitive dependencies in a lockfile or constraints file.
  • Require cryptographic hashes, for example through pip --require-hashes.
  • Document and enforce a trusted package index rather than relying on ambient index configuration.
  • Remove automatic -U upgrades from the normal setup flow.
  • Test and review dependency updates before publishing revised pins.
  • Prefer installation in an isolated virtual environment under a non-privileged account.
  • Consider generating and reviewing a software bill of materials for the resolved environment.

T09 · Insecure Skill Coding Practices

Warning
Location
SKILL.md:80
Finding

Alibaba Cloud Credentials Exposed Through Command-Line Arguments

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 80–97 and 193–197
Vulnerability Type: Plaintext credential exposure
Risk Level: Medium

Vulnerable Code

bash
aliyunlog configure "你的AccessKey ID" "你的AccessKey Secret" "cn-hangzhou.log.aliyuncs.com"
bash
{{#if access-id}}--access-id="{{access-id}}"{{/if}} \
{{#if access-key}}--access-key="{{access-key}}"{{/if}} \
{{#if sts-token}}--sts-token="{{sts-token}}"{{/if}} \

The skill also demonstrates direct credential arguments in its temporary-credential example at lines 246–263.

Technical Analysis

The documented configuration flow and command template place AccessKey IDs, AccessKey secrets, and STS tokens directly in process arguments. Depending on the operating system and execution environment, command-line arguments may be captured in shell history, process inspection interfaces, terminal recordings, audit logs, agent transcripts, or orchestration telemetry.

Although line 288 advises users to avoid plaintext AccessKeys and prefer configuration files or environment variables, the primary templates continue to support and demonstrate the unsafe pattern. Environment variables also require careful handling because they may leak through diagnostics or child processes; a protected credential provider or permission-restricted configuration file is preferable.

Attack Path

  1. A user provides an AccessKey secret or STS token to the agent.
  2. The agent generates or executes a command containing that secret as a command-line argument.
  3. The command is retained in shell history, process telemetry, terminal logs, or the conversation transcript.
  4. Another local user, administrator, monitoring system, or party with access to retained logs obtains the credential.
  5. The exposed credential is used to access Alibaba Cloud resources permitted by its associated policies.

Impact Assessment

Exposure can enable unauthorized SLS log ...[truncated 386 chars]

Remediation
View remediation

Remediation Suggestions

  • Remove AccessKey secrets and STS tokens from command-line templates and examples.
  • Prefer short-lived, least-privilege credentials supplied by a secure credential provider or instance/workload identity mechanism.
  • Where a configuration file is necessary, create it with restrictive user-only permissions and document secure rotation and deletion procedures.
  • Never echo secrets in generated commands, terminal output, error messages, or agent responses.
  • Redact credential-shaped values before retaining transcripts or execution logs.
  • Disable or carefully manage shell history when sensitive configuration commands are unavoidable.
  • Restrict RAM policies to the required SLS projects, logstores, actions, and duration.
  • Rotate any credential that may already have been entered into a command line or retained transcript.
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
Findings (13)

Whitespace Padding

Medium
Category
Prompt Injection
Confidence
70% confidence
Finding

Large whitespace padding was detected (a block of blank lines or a long run of spaces). This can push injected instructions below or to the right of the visible area so a human reviewer never sees them while the agent still reads them. Manual review of the hidden content is recommended.

Content

Scanner excerpt · SKILL.md (reported line 11)May include surrounding context.

md
### 系统与软件要求

| 依赖项      | 要求                                                                                          |
| -------- | ------------------------------------------------------------------------------------------- |
| 操作系统     | Windows、Linux、macOS                                                                         |
| Python版本 | Python 2.7+ 或 Python 3.7+(推荐Python 3.7及以上)                                                  |

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

该技能是 markdown 文件,因此需要检查触发词是否足够具体。触发词列表中的“阿里云日志查询”“查询阿里云日志”“SLS日志分析”等属于常见请求式表达,文档未提供明确的触发边界、限制条件或负面示例,容易在一般讨论阿里云日志时被意外匹配。

Content

No source excerpt is available for this finding.

Whitespace Padding

Medium
Category
Prompt Injection
Confidence
70% confidence
Finding

Large whitespace padding was detected (a block of blank lines or a long run of spaces). This can push injected instructions below or to the right of the visible area so a human reviewer never sees them while the agent still reads them. Manual review of the hidden content is recommended.

Content

Scanner excerpt · SKILL.md (reported line 154)May include surrounding context.

md
### 业务参数
  
  | 参数名       | 类型      | 是否必选 | 默认值   | 描述                                                                                                    |
  | --------- | ------- | ---- | ----- | ----------------------------------------------------------------------------------------------------- |
  | project   | string  | 是    | -     | 阿里云SLS Project名称                                                                                      |
  | logstore  | string  | 是    | -     | 阿里云SLS Logstore名称                                                                                     |

Whitespace Padding

Medium
Category
Prompt Injection
Confidence
70% confidence
Finding

Large whitespace padding was detected (a block of blank lines or a long run of spaces). This can push injected instructions below or to the right of the visible area so a human reviewer never sees them while the agent still reads them. Manual review of the hidden content is recommended.

Content

Scanner excerpt · SKILL.md (reported line 156)May include surrounding context.

md
| 参数名       | 类型      | 是否必选 | 默认值   | 描述                                                                                                    |
  | --------- | ------- | ---- | ----- | ----------------------------------------------------------------------------------------------------- |
  | project   | string  | 是    | -     | 阿里云SLS Project名称                                                                                      |
  | logstore  | string  | 是    | -     | 阿里云SLS Logstore名称                                                                                     |
  | from_time | string  | 是    | -     | 查询开始时间,支持两种格式:<br>1. Unix时间戳(秒级)<br>2. `%Y-%m-%d %H:%M:%S<time_zone>` 格式,如 `2026-05-14 18:00:00+8:00` |
  | to_time   | string  | 是    | -     | 查询结束时间,格式同`from_time`                                                                                 |

Whitespace Padding

Medium
Category
Prompt Injection
Confidence
70% confidence
Finding

Large whitespace padding was detected (a block of blank lines or a long run of spaces). This can push injected instructions below or to the right of the visible area so a human reviewer never sees them while the agent still reads them. Manual review of the hidden content is recommended.

Content

Scanner excerpt · SKILL.md (reported line 163)May include surrounding context.

md
| 参数名       | 类型      | 是否必选 | 默认值   | 描述                                                                                                    |
  | --------- | ------- | ---- | ----- | ----------------------------------------------------------------------------------------------------- |
  | project   | string  | 是    | -     | 阿里云SLS Project名称                                                                                      |
  | logstore  | string  | 是    | -     | 阿里云SLS Logstore名称                                                                                     |
  | from_time | string  | 是    | -     | 查询开始时间,支持两种格式:<br>1. Unix时间戳(秒级)<br>2. `%Y-%m-%d %H:%M:%S<time_zone>` 格式,如 `2026-05-14 18:00:00+8:00` |
  | to_time   | string  | 是    | -     | 查询结束时间,格式同`from_time`                                                                                 |

Whitespace Padding

Medium
Category
Prompt Injection
Confidence
70% confidence
Finding

Large whitespace padding was detected (a block of blank lines or a long run of spaces). This can push injected instructions below or to the right of the visible area so a human reviewer never sees them while the agent still reads them. Manual review of the hidden content is recommended.

Content

Scanner excerpt · SKILL.md (reported line 157)May include surrounding context.

md
| 参数名       | 类型      | 是否必选 | 默认值   | 描述                                                                                                    |
  | --------- | ------- | ---- | ----- | ----------------------------------------------------------------------------------------------------- |
  | project   | string  | 是    | -     | 阿里云SLS Project名称                                                                                      |
  | logstore  | string  | 是    | -     | 阿里云SLS Logstore名称                                                                                     |
  | from_time | string  | 是    | -     | 查询开始时间,支持两种格式:<br>1. Unix时间戳(秒级)<br>2. `%Y-%m-%d %H:%M:%S<time_zone>` 格式,如 `2026-05-14 18:00:00+8:00` |
  | to_time   | string  | 是    | -     | 查询结束时间,格式同`from_time`                                                                                 |
  | topic     | string  | 否    | ""    | 日志主题,默认空字符串                                                                                           |

Whitespace Padding

Medium
Category
Prompt Injection
Confidence
70% confidence
Finding

Large whitespace padding was detected (a block of blank lines or a long run of spaces). This can push injected instructions below or to the right of the visible area so a human reviewer never sees them while the agent still reads them. Manual review of the hidden content is recommended.

Content

Scanner excerpt · SKILL.md (reported line 159)May include surrounding context.

md
| project   | string  | 是    | -     | 阿里云SLS Project名称                                                                                      |
  | logstore  | string  | 是    | -     | 阿里云SLS Logstore名称                                                                                     |
  | from_time | string  | 是    | -     | 查询开始时间,支持两种格式:<br>1. Unix时间戳(秒级)<br>2. `%Y-%m-%d %H:%M:%S<time_zone>` 格式,如 `2026-05-14 18:00:00+8:00` |
  | to_time   | string  | 是    | -     | 查询结束时间,格式同`from_time`                                                                                 |
  | topic     | string  | 否    | ""    | 日志主题,默认空字符串                                                                                           |
  | query     | string  | 否    | "*"   | 查询语句或SQL分析语句,默认查询所有日志                                                                                 |
  | reverse   | boolean | 否    | false | 仅基础查询有效,是否按时间戳降序返回日志<br>true:降序<br>false:升序(默认)                                                       |

Whitespace Padding

Medium
Category
Prompt Injection
Confidence
70% confidence
Finding

Large whitespace padding was detected (a block of blank lines or a long run of spaces). This can push injected instructions below or to the right of the visible area so a human reviewer never sees them while the agent still reads them. Manual review of the hidden content is recommended.

Content

Scanner excerpt · SKILL.md (reported line 161)May include surrounding context.

md
| project   | string  | 是    | -     | 阿里云SLS Project名称                                                                                      |
  | logstore  | string  | 是    | -     | 阿里云SLS Logstore名称                                                                                     |
  | from_time | string  | 是    | -     | 查询开始时间,支持两种格式:<br>1. Unix时间戳(秒级)<br>2. `%Y-%m-%d %H:%M:%S<time_zone>` 格式,如 `2026-05-14 18:00:00+8:00` |
  | to_time   | string  | 是    | -     | 查询结束时间,格式同`from_time`                                                                                 |
  | topic     | string  | 否    | ""    | 日志主题,默认空字符串                                                                                           |
  | query     | string  | 否    | "*"   | 查询语句或SQL分析语句,默认查询所有日志                                                                                 |
  | reverse   | boolean | 否    | false | 仅基础查询有效,是否按时间戳降序返回日志<br>true:降序<br>false:升序(默认)                                                       |

Whitespace Padding

Medium
Category
Prompt Injection
Confidence
70% confidence
Finding

Large whitespace padding was detected (a block of blank lines or a long run of spaces). This can push injected instructions below or to the right of the visible area so a human reviewer never sees them while the agent still reads them. Manual review of the hidden content is recommended.

Content

Scanner excerpt · SKILL.md (reported line 160)May include surrounding context.

md
| logstore  | string  | 是    | -     | 阿里云SLS Logstore名称                                                                                     |
  | from_time | string  | 是    | -     | 查询开始时间,支持两种格式:<br>1. Unix时间戳(秒级)<br>2. `%Y-%m-%d %H:%M:%S<time_zone>` 格式,如 `2026-05-14 18:00:00+8:00` |
  | to_time   | string  | 是    | -     | 查询结束时间,格式同`from_time`                                                                                 |
  | topic     | string  | 否    | ""    | 日志主题,默认空字符串                                                                                           |
  | query     | string  | 否    | "*"   | 查询语句或SQL分析语句,默认查询所有日志                                                                                 |
  | reverse   | boolean | 否    | false | 仅基础查询有效,是否按时间戳降序返回日志<br>true:降序<br>false:升序(默认)                                                       |
  | offset    | integer | 否    | 0     | 仅基础查询有效,查询开始行偏移量                                                                                      |

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The skill explicitly supports passing long-lived cloud credentials on the command line via --access-id and --access-key. Command-line arguments are commonly exposed through shell history, process listings, audit logs, and agent telemetry, so this creates an avoidable secret-exposure path in a log-query skill whose core function does not require inline secret handling.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The document warns users not to place AccessKey material on the command line, yet the command template and examples demonstrate exactly that behavior. This contradiction normalizes insecure secret handling and materially increases the chance that operators will leak credentials through terminal history, process inspection, screenshots, or orchestration logs.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The skill describes returning raw log data and metadata without warning that these outputs may contain secrets, tokens, internal IPs, user identifiers, or operational details. In a log-query context, omission of sensitivity guidance is materially risky because users may over-collect, over-display, or forward outputs into less trusted channels.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
77% confidence
Finding

文档内容和用户交互示例均固定为中文,未说明这是仅面向中文用户或中国区合规场景的限定技能,也未提供其他语言选项。根据语言/地区策略,若技能强制特定语言而无用户选择或合理限定,可能构成自然语言政策问题。

Content

No source excerpt is available for this finding.