Back to skill

Security audit

huawei-cloud-publish-work-to-gallery

Security checks for vulnerabilities and agentic risk

Overview

This publishing skill has a legitimate workflow, but its credential handling, automatic setup changes, and trust in shared temporary files need security review.

Review before installing. Use an isolated environment without administrator privileges, verify downloaded executables, and require setup to stay within one Python environment. Remove secret-printing diagnostics, protect credential files, and fix temporary-file trust and archive symlink handling before using real accounts or private projects. Explicitly approve the IAM delegation and any lasting tunnel, and inspect the final upload contents. The evidence supports security concerns rather than deliberate credential theft; external OAuth and tunnel behavior remains unverified.

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

T09 · Insecure Skill Coding Practices

Error
Location
scripts/build-cover.mjs
Finding

Shared font-gate metadata selects a locally executed program

Content
View full analysis

Impact

Arbitrary local code execution occurs during the --version probe, before the selected program needs to behave as a Python interpreter.

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/publish-work.mjs
Finding

Temporary STS credentials can be readable by other local users

Content
View full analysis

Impact

An attacker can copy a valid STS access key, secret key, and security token and authenticate as the victim during their validity period. references/self-verify-publish.md documents that this credential establishes the caller's gallery identity for publishing.

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/gitcode-oauth.ensure.mjs
Finding

An unrelated loopback listener can impersonate the OAuth service

Content
View full analysis

Impact

The attacker can substitute the browser authorization destination and install attacker-selected credentials in the victim's auth.toml, producing account substitution and a credible phishing path.

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/build-detail-zip.mjs
Finding

Resource symlinks can pull files outside the selected project into the upload archive

Content
View full analysis

Impact

The target bytes are copied into detail.zip under an image filename and pass the shown local extension-and-size checks. If publishing proceeds, the wrapper sends those bytes to the gallery endpoint.

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/gitcode-oauth.ensure.mjs
Finding

OAuth cleanup trusts a shared PID file when killing processes

Content
View full analysis

Impact

The attacker can induce termination of a process they cannot directly signal, interrupting the victim's work or services. The operating system still limits which processes the victim may terminate.

Vulnerability Patterns
  • 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
  • Output HandlingUnvalidated Output Injection, Cross-Context Output, Unbounded Output
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
Findings (70)

Description-Behavior Mismatch

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

The supplied script’s primary purpose is font provisioning, not publishing work. It contains no platform authentication, work upload, gallery submission, or activity-registration logic. Its network requests retrieve font assets, and its persistent changes affect local font installation. Although comments suggest a relationship to screenshot rendering, the supplied code does not establish that font installation is a necessary supporting step for the declared publishing workflow. This is a functional mismatch in the provided chunk, not evidence of malicious intent.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
MCP Tool Poisoning
Confidence
92% confidence
Finding

The supplied script contains no platform-specific publishing, uploading, activity submission, or authentication logic. Its implemented purpose is screenshot preparation and capture for arbitrary HTTP(S) pages. Screenshot generation could support a larger publishing workflow, but no such integration is demonstrated in this chunk. The mismatch concerns its primary functionality, not incidental browser operations or local file writes. There is no evident credential theft or unrelated data exfiltration.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
MCP Tool Poisoning
Confidence
90% confidence
Finding

Creating an IAM delegation is a persistent account-security change, not merely generating a short-lived publication token. Although the workflow mentions SELF_VERIFY creation, it treats selecting a project directory as consent without clearly explaining the delegation's persistence, trust policy, or removal, risking inadequately authorized cloud-account changes.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
MCP Tool Poisoning
Confidence
87% confidence
Finding

Checking authentication configuration could support publishing, but this snippet exposes actual secret keys and security tokens rather than merely reporting whether they are configured. That credential-disclosure behavior is not represented by the declared publishing purpose. The snippet does not show network transmission or external exfiltration.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
MCP Tool Poisoning
Confidence
86% confidence
Finding

The chunk performs cloud CLI configuration and IAM domain discovery, not platform publishing. Although labeled as troubleshooting, the supplied code establishes no connection between these account-level operations and the declared publishing workflow. The mismatch is the unrelated resource access, not simply the absence of an upload command in this chunk.

Content

No source excerpt is available for this finding.

Incomplete referenced artifact analysis

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
发布作品至华为云高校运营平台。**优先调用内置脚本**(单入口、fail-fast、自带 `--help`),报错才查 [references/troubleshooting.md](references/troubleshooting.md)。

Incomplete referenced artifact analysis

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
- **hcloud + AK/SK**:Step 1 需要。未装/未配置 → [troubleshooting#domain-id-resolution-issues](references/troubleshooting.md#domain-id-resolution-issues)。

Incomplete referenced artifact analysis

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
ut `#domain=<id> name=<name>`。凭证优先级:env → hcloud 已配置 → 引导用户([troubleshooting#2](references/troubleshooting.md#2-hcloud-credentials-not-configured))。Windows 已由 `

Incomplete referenced artifact analysis

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
| [troubleshooting.md](references/troubleshooting.md) | 网络/各步骤失败排查 | 脚本报错→先查这里 |

Incomplete referenced artifact analysis

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
js 15s、check-version.mjs 6s、gitcode-oauth --wait 默认 300s,均在各自 `--help`/源码标注) ④ `detect-env.mjs` 确定平台后只读对应平台 reference(按目录跳转,不全读)⑤ **合并无依赖的 bash 调用**:用 `;` 串联进一条

Incomplete referenced artifact analysis

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
/`python`/`bash` 解释器前缀(该说法仅 Linux 成立;**Windows 下 .mjs/.py 需 `node`/`python` 前缀、`preflight.ps1` 需 `powershell` 前缀**);若安装器未恢复可执行位(Linux 直接调用报 `Permission denied`)

Incomplete referenced artifact analysis

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
- **git**:Step 3。**zip** 仅 `build-detail-zip.mjs` 不可用时的备选(Linux `yum install zip`;Windows .NET `ZipFile`,见 [windows-setup.md](references/windows-setup.md))。

Incomplete referenced artifact analysis

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
| [windows-setup.md](references/windows-setup.md) | Windows 首次准备:编码/Playwright/zip | Windows 环境首次 |

Incomplete referenced artifact analysis

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
- **git**:Step 3。**zip** 仅 `build-detail-zip.mjs` 不可用时的备选(Linux `yum install zip`;Windows .NET `ZipFile`,见 [windows-setup.md](references/windows-setup.md))。

Incomplete referenced artifact analysis

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
2. **打包 zip + 校验一步到位**(`build-detail-zip.mjs` 内置正确目录结构 README.md@根 + resources/,打包后自动跑服务端同源校验,跨平台无需 zip/ZipFile):

Incomplete referenced artifact analysis

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
references/troubleshooting.md#2-hcloud-credentials-not-configured))。Windows 已由 `install-hcloud.ps1` 装好并写入用户 PATH,通常无需 `--hcloud`。

Incomplete referenced artifact analysis

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
cover.png --detail /tmp/detail.zip --strict --max-age 3600 --quiet`(exit 0 才继续;`publish-work.mjs` 内置 `verifyGates()` 也会拦截)。`publish-work.mjs` 还会在发请求前校验 `envUrl`

Incomplete referenced artifact analysis

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
p}/shot-index.png`)** + 原 tagline/description,仅换 `--title "<workName'>"` 重跑 `build-cover.mjs`(一键覆盖截图+合成+校验,且退出后不再处理 tmp):

Incomplete referenced artifact analysis

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
若 `coverTmp` 已被清理/不存在,重跑 `build-cover.mjs` 不带 `--screenshot`(会重新截图,需本地服务仍存活)。

External Script Fetching

High
Category
Supply Chain
Confidence
95% confidence
Finding

The command immediately executes an installer downloaded from a mutable latest URL without checking a pinned digest or signature. The vendor-associated HTTPS endpoint supports a legitimate installation purpose, but compromised distribution content would still execute with the caller's privileges, potentially as root under the accompanying guidance.

Content

Scanner excerpt · references/troubleshooting.md (reported line 168)May include surrounding context.

bash
# Linux/macOS — 一键式安装(官方源 qs-hcli/hcli_02_003_02;默认装 /usr/local/hcloud/ → /usr/local/bin/)
curl -sSL https://cn-north-4-hdn-koocli.obs.cn-north-4.myhuaweicloud.com/cli/latest/hcloud_install.sh -o ./hcloud_install.sh && bash ./hcloud_install.sh
# 无交互跳过: 末尾加 -y;提示权限不足时切换 root 重跑。无 root 沙箱用户级分步(包内含扁平 hcloud 二进制):
#   echo $HOSTTYPE   # x86_64=AMD64 / aarch64=ARM64(URL 按架构替换 amd64/arm64)
#   curl -sSL "https://cn-north-4-hdn-koocli.obs.cn-north-4.myhuaweicloud.com/cli/latest/huaweicloud-cli-linux-amd64.tar.gz" | tar -xz -C ~/.local/bin

Credential diagnostics expose raw secrets without warning the user.

High
Category
Output Handling
Confidence
99% confidence
Finding

The Bash diagnostics print actual access keys, secret keys, and security tokens rather than merely reporting their presence. In an agent workflow, this can copy cloud credentials into tool outputs, conversation history, or retained logs, potentially enabling access within the credentials' permissions.

Content

No source excerpt is available for this finding.

Chaining Abuse

High
Category
Tool Misuse
Confidence
70% confidence
Finding

Tool calls are chained to bypass individual safety checks or escalate capabilities beyond what any single tool call would allow.

Content

Scanner excerpt · scripts/detect-env.mjs (reported line 9)May include surrounding context.

js
//
// 字段:
//   os      win32 | linux | darwin      (process.platform)
//   shell   powershell | git-bash | bash
//   distro  linux 下: rhel(含 EulerOS/HCE/CentOS) | debian | other;其他平台 n/a
//   sandbox linux 下探测 CodeArts 沙箱(127.0.0.1:19300/healthz == ok)
//   tunnel  true=可开 DevBridge 隧道(仅 linux);false=无隧道能力(win32/darwin)→ envUrl="" 跳过隧道

Credential Access

High
Category
Privilege Escalation
Confidence
90% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/ensure-gitcode-credential.mjs (reported line 12)May include surrounding context.

js
//   node ensure-gitcode-credential.mjs
//
// 行为:
//   1. 检测本机已有 GitCode 凭证(git credential fill / ~/.git-credentials / $GITCODE_TOKEN / cmdkey)
//   2. 有凭证 → exit 0,stdout "#credential=found source=<来源>"
//   3. 无凭证 → exit 0,stdout "#credential=missing",指引执行 gitcode-oauth.ensure.mjs
//      (该脚本自带二进制自动安装:存在不下载,缺失自动装至用户级工具目录)

Credential Access

High
Category
Privilege Escalation
Confidence
90% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/ensure-gitcode-credential.mjs (reported line 55)May include surrounding context.

js
const fillOut = tryExec('echo -e "protocol=https\\nhost=gitcode.com" | git credential fill 2>/dev/null');
if (fillOut && fillOut.includes("password=")) credSource = "git-credential-fill";

// ~/.git-credentials
if (!credSource) {
  const credFile = path.join(homedir(), ".git-credentials");
  if (existsSync(credFile)) {

Credential Access

High
Category
Privilege Escalation
Confidence
90% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/ensure-gitcode-credential.mjs (reported line 57)May include surrounding context.

js
// ~/.git-credentials
if (!credSource) {
  const credFile = path.join(homedir(), ".git-credentials");
  if (existsSync(credFile)) {
    const raw = readFileSync(credFile, "utf8");
    if (raw.includes("gitcode.com")) credSource = "git-credentials-file";