Back to skill

Security audit

Harmonyos Skill

Security checks for vulnerabilities and agentic risk

Overview

This HarmonyOS coding skill is mostly documentation, but it tells the agent to persistently rewrite and re-register expert files after conversations, so it needs Review before install.

Install only if you are comfortable disabling or manually reviewing the self-learning instructions. Do not allow the skill to edit agents/harmonyos-dev.md, append chat-derived content, or run register_expert.py without an explicit diff review and approval. Treat analytics, background location, enterprise quarantine/delete, and provider-endpoint examples as sensitive patterns that require consent, HTTPS, least-privilege credentials, and project-specific safeguards.

Vulnerability Patterns
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • 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)

T01 · Skill Instruction Hijacking

Error
Location
SKILL.md:202
Finding
Forced Self-Modification and Persistent Agent-State Mutation## Vulnerability Details **File Location**: `SKILL.md`, lines 202-284 **Vulnerability Type**: Forced instruction execution and persistent memory poisoning **Risk Level**: High ### Evidence The following is an English rendering of the operative instructions in the affected section: ```text ## Continuous Learning Mechanism — Mandatory Rule At the end of every conversation, the following self-check process must be executed. If a knowledge gap is found: Discover knowledge gap → Search Huawei official documentation → Verify the information → Update agents/harmonyos-dev.md → Run register_expert.py to register it again → Tell the user that new knowledge has been added Registration is mandatory: After any modification, regardless of size, the expert must be registered again. At the end of every conversation, determine whether new experience was produced. If so, append it to the following section at the end of the expert file: ## Practical Experience Repository If the experience corresponds to an error code not already present in the common compilation-error table, update that table as well. ``` ### Technical Analysis The Skill's declared purpose is to provide HarmonyOS and ArkTS development assistance. Editing an external agent definition, appending conversation-derived content to a persistent knowledge file, and executing `register_expert.py` are not necessary to answer HarmonyOS development questions. These instructions alter the agent's normal session goals by making filesystem modification and local command execution mandatory. They also create a persistent state channel: content encountered during a user conversation can be written into `agents/harmonyos-dev.md` and re-registered for future sessions. The persistence mechanism lacks: - User confirmation before modification or registration. - Validation or sanitization of conversation-derived content. - A restriction limiting writ ...[truncated 2220 chars]
Remediation
## Remediation Suggestions 1. Remove all mandatory instructions to edit `agents/harmonyos-dev.md` or execute `register_expert.py`. 2. Keep learning and reflection ephemeral by default; present proposed updates to the user instead of applying them. 3. Require explicit, per-operation user approval before any persistent write or registration action. 4. Restrict writes to a dedicated, non-executable data file inside an approved Skill-specific directory. 5. Never copy raw user content or remotely retrieved text into instructions, scripts, or executable configuration. 6. Apply schema validation, content sanitization, source attribution, and human review to proposed knowledge entries. 7. Pin approved documentation domains and treat all retrieved content as untrusted data. 8. Before executing any registration utility, verify its path, ownership, cryptographic digest, and expected behavior. 9. Add transactional backups, audit logs, and a rollback mechanism for approved updates. 10. Separate knowledge maintenance into an administrator-controlled workflow that is not invoked during ordinary user conversations.

T08 · Insecure Dependencies

Warning
Location
SKILL.md:1984
Finding
Unverified Third-Party AI Endpoint Receives an Environment-Sourced API Credential## Vulnerability Details **File Location**: `SKILL.md`, lines 1984-1995 **Vulnerability Type**: Unsafe external service and supply-chain trust configuration **Risk Level**: Medium ### Evidence ```json { "provider": { "deveco": { "name": "DevEco Code", "models": { "glm-5": { "tool_call": true, "limit": { "context": 200000, "output": 8192 } } }, "options": { "baseURL": "https://api.openbitfun.com/v1", "apiKey": "{env:DEVECO_API_KEY}" } } } } ``` ### Technical Analysis The configuration directs AI requests to `api.openbitfun.com` and obtains the authentication credential from `DEVECO_API_KEY`. The audited package provides no evidence that this endpoint is operated by Huawei, the model vendor, or another verified provider. It also provides no data-processing disclosure, endpoint allowlist, certificate pinning, request redaction, or credential-scope guidance. Using an environment variable is preferable to hardcoding a secret, but it does not prevent disclosure to the configured endpoint. The client must transmit the credential to authenticate, and prompts, source code, tool results, and other request content may also be sent to that service. A broadly scoped or incorrectly reused API key could therefore be exposed to a third-party operator or to an endpoint compromised later. The configuration is presented as a built-in provider option rather than as an explicitly untrusted example. That creates a supply-chain trust risk beyond the minimum functionality required for an offline HarmonyOS coding knowledge Skill. ### Attack Path 1. A user copies or activates the supplied provider configuration. 2. The user sets `DEVECO_API_KEY`, potentially using an existing or overly privileged credential. 3. The AI client substitutes the environment value into the provider authenticat ...[truncated 1052 chars]
Remediation
## Remediation Suggestions 1. Remove the preconfigured third-party endpoint unless its ownership and security posture have been formally verified. 2. Prefer official, documented provider endpoints and identify the operator clearly. 3. Require explicit user consent before sending prompts, source code, or credentials to any external model provider. 4. Use a dedicated, provider-specific, least-privileged API key; never reuse credentials from another service. 5. Document what data is transmitted, retained, logged, and used for training. 6. Add an endpoint allowlist and reject redirects to unapproved hosts. 7. Enforce TLS verification and consider certificate or public-key pinning where operationally appropriate. 8. Redact secrets, environment values, tokens, and sensitive source files before constructing model requests. 9. Disable automatic execution of model-generated tool calls and require user approval for sensitive operations. 10. Provide a local or user-selected provider configuration instead of silently recommending a bundled remote service.

T09 · Insecure Skill Coding Practices

Error
Location
SKILL.md:3978
Finding
File Upload and Download Examples Use Unencrypted HTTP## Vulnerability Details **File Location**: `SKILL.md`, lines 3978-4002 **Vulnerability Type**: Plaintext network transmission and missing transport integrity **Risk Level**: High ### Evidence ```typescript import { request } from '@kit.BasicServicesKit' let uploadTask = await request.agent.create(this.context, [fileUri], { url: 'http://server/upload', method: 'POST', title: 'Upload', data: { key: 'value' } }) uploadTask.on('progress', (info) => { /* Upload progress */ }) uploadTask.start() let downloadTask = await request.agent.create(this.context, { url: 'http://server/file.zip', saveas: './downloads/file.zip', title: 'Download' }) downloadTask.on('progress', (info) => { /* Download progress */ }) downloadTask.start() downloadTask.pause() downloadTask.resume() ``` ### Technical Analysis Both examples use `http://` rather than HTTPS. Files uploaded through this code are transmitted without transport confidentiality or authenticated server identity. Downloaded artifacts also lack transport integrity and can be replaced in transit. Although `server` is a placeholder hostname, this is presented as a reusable implementation pattern. Developers may replace only the hostname while retaining the insecure scheme. The example includes neither a warning nor a production-safe alternative, despite another section of the same Skill stating that production networking must use HTTPS. Encoding or encrypting unrelated values elsewhere in the document does not secure these transfers. No end-to-end encryption, signature verification, checksum validation, or authenticated transport is shown. ### Attack Path 1. A developer adopts the supplied upload or download implementation and substitutes a reachable host while retaining HTTP. 2. A user performs the transfer over an attacker-observable network. 3. A network-positioned attacker intercepts the connection through a rogue access point, compromise ...[truncated 1094 chars]
Remediation
## Remediation Suggestions 1. Replace every `http://` example with `https://`. 2. State explicitly that plaintext HTTP must not be used for uploads, downloads, credentials, or user data. 3. Enforce certificate and hostname validation; do not add permissive trust managers. 4. Restrict transfer destinations with a host allowlist and reject redirects to HTTP or unapproved domains. 5. Authenticate upload and download requests using short-lived, least-privileged credentials. 6. Validate downloaded files with a cryptographic digest or digital signature obtained through a trusted channel. 7. Enforce file-size, type, destination-path, and archive-extraction limits. 8. Store downloads in a non-executable application directory and never execute or import them automatically. 9. Avoid logging file contents, authorization headers, signed URLs, or transfer tokens. 10. Add automated checks that reject plaintext network URLs in production builds and documentation examples.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • YARA SignaturesMalware Match, Webshell Match, Cryptominer Match
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (17)

YARA rule 'agent_skill_mcp_tool_poisoning_metadata': MCP/tool metadata poisoning indicators in tool schemas or skill manifests [agent_skills]

High
Category
YARA Match
Content
---
name: harmonyos-code-workshop
version: 6.1.0
description: "HarmonyOS 7 (API 26) 全流程编码助手,精通ArkTS+ArkUI,提供高质量原生鸿蒙代码"
trigger:
  - 鸿蒙
  - HarmonyOS
  - ArkTS
  - ArkUI
  - 鸿蒙代码
  - 鸿蒙开发
  - 鸿蒙7
  - harmonyos code
  - arkts
  - 鸿蒙项目
  - 鸿蒙应用
  - 鸿蒙原生
  - 分布式
  - 元服务
  - atomic service
  -  Stage模型
  - 鸿蒙技能
  - 鸿蒙专家
  - HarmonyOS NEXT
  - 鸿蒙NEXT
  - DeveEco
  - 鸿蒙学习
  - 我想开发一个鸿蒙
  - 帮我写一个鸿蒙
agent_created: true
---

> 📌 **版本信息**:本Skill�
Confidence
80% confidence
Finding
YARA rule matched a hack tool or exploit indicator (offensive tools, reconnaissance, privilege escalation, or exploit frameworks).

Description-Behavior Mismatch

High
Confidence
98% confidence
Finding
The skill instructs the agent to modify its own expert files and re-register itself based on conversation content, which expands its authority from code assistance into persistent self-modification. This creates a durable prompt/data poisoning path and can cause the agent to write unreviewed or user-derived content into trusted local files, potentially altering future behavior without explicit approval.

Missing User Warnings

High
Confidence
97% confidence
Finding
The skill directs automatic local file writes and re-registration without clearly warning the user that persistent changes will occur. Hidden state-changing behavior violates least surprise and can be abused to persist poisoned instructions, sensitive dialogue content, or altered agent behavior.

Missing User Warnings

High
Confidence
96% confidence
Finding
Mandating that every conversation append experience into a persistent expert file creates silent retention of chat-derived material. This can store sensitive user content, operational details, or attacker-supplied prompt injections in a durable location that influences future runs.

Missing User Warnings

High
Confidence
93% confidence
Finding
The telemetry section demonstrates global click, navigation, and exposure tracking without strong privacy warnings, making it easy for generated code to implement pervasive monitoring by default. This is risky because the skill is positioned as a general coding assistant and may propagate tracking patterns into apps without adequate disclosure or consent flows.

Missing User Warnings

High
Confidence
97% confidence
Finding
The file isolation and irreversible deletion guidance describes destructive operations but does not prominently warn about their impact or authorization requirements. In a coding-assistant context, this can lead to generated remediation code that deletes or quarantines files without sufficient safeguards, review, or recovery planning.

Missing User Warnings

High
Confidence
91% confidence
Finding
Background and continuous location examples are privacy-sensitive, yet the skill does not clearly foreground the surveillance implications or consent requirements. As a code assistant, it may generate invasive location-tracking implementations without proper minimization, disclosure, or runtime UX safeguards.

Vague Triggers

Medium
Confidence
95% confidence
Finding
Overly broad trigger phrases increase the chance the skill activates in unrelated conversations, exposing users to its full instruction set and side effects unexpectedly. Because this skill also contains self-update/persistence directives, accidental activation materially raises risk.

Vague Triggers

Medium
Confidence
90% confidence
Finding
Claiming that any direct description of a need will automatically load the skill lacks clear boundaries and can cause unintended invocation. In combination with persistent write/update behavior elsewhere in the skill, this makes accidental execution more dangerous than a normal misfire.

Natural-Language Policy Violations

Medium
Confidence
96% confidence
Finding
该要求将输出语言固定为中文注释,未给用户提供语言选择或 opt-in 机制。根据语言/locale 政策,这种默认强制单一语言的要求会对非中文用户造成不必要限制。

Ssd 3

Medium
Confidence
96% confidence
Finding
The self-update workflow instructs the agent to write dialogue-derived content into internal files and announce the update, which formalizes a persistent natural-language poisoning path. This is especially risky because the stored content can influence future agent behavior beyond the current session.

Ssd 3

Medium
Confidence
95% confidence
Finding
Automatically appending conversation-derived knowledge to a persistent skill file creates a direct data retention channel from chats into internal state. Even if intended as operational learning, it risks storing personal data, proprietary code patterns, or adversarial instructions for future reuse.

Intent-Code Divergence

Medium
Confidence
89% confidence
Finding
Earlier guidance explicitly states that Router is deprecated and that Navigation is the recommended unified approach. Later sections still present Router-based patterns such as `router.pushDestinationByName` and HMRouter `pushUrl` usage as positive examples, which contradicts the earlier intent-level guidance rather than merely omitting detail.

Context-Inappropriate Capability

Medium
Confidence
87% confidence
Finding
The skill includes guidance for global user-behavior instrumentation and event reporting, which is outside the stated purpose of a coding assistant and introduces privacy-sensitive tracking patterns. In a skill context, this can normalize or encourage code generation that captures user actions broadly without adequate consent, minimization, or policy review.

External Transmission

Medium
Category
Data Exfiltration
Content
"deveco": {
      "name": "DevEco Code",
      "models": { "glm-5": { "tool_call": true, "limit": { "context": 200000, "output": 8192 } } },
      "options": { "baseURL": "https://api.openbitfun.com/v1", "apiKey": "{env:DEVECO_API_KEY}" }
    }
  }
}
Confidence
50% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Context-Inappropriate Capability

Medium
Confidence
95% confidence
Finding
This section covers `EnterpriseThreatProtectionKit` workflows for scanning bundle files, opening files across sandboxes, isolating threat files, restoring them, and permanently deleting them. Those are security-operations capabilities for enterprise antivirus-style software, not an obvious or necessary part of a general HarmonyOS coding assistant focused on ArkTS/ArkUI development help.

Intent-Code Divergence

Low
Confidence
82% confidence
Finding
The document states that all UI-context operations must be obtained through `this.getUIContext()` and earlier migration tables flag `getContext(this)` as deprecated. Later lifecycle and multi-HAP examples still use `getContext(this)` directly, contradicting the document's own prescriptive guidance.

Static analysis

No suspicious patterns detected.