Back to skill

Security audit

insentek-openapi

Security checks for vulnerabilities and agentic risk

Overview

The skill is mostly a coherent IoT data-query tool, but it handles API credentials in ways that could expose them if the API endpoint or command arguments are influenced.

Install only if you trust the publisher and can control the runtime environment. Do not set INSENTEK_API_BASE or --api-base to anything other than the official HTTPS API unless you intentionally want credentials sent there, avoid passing tokens on the command line, and treat ~/.config/insentek/credentials.json as sensitive even though it is encrypted.

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

T09 · Insecure Skill Coding Practices

Error
Location
scripts/insentek_cli.py:39
Finding

Credential and bearer-token exfiltration through an unrestricted API base URL override

Content
View full analysis
({})); // ... } ``` ...[truncated 2895 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
packages/insentek-skill-cli/lib/core/credentials.js:22
Finding

Credential files are created before restrictive permissions are applied and use a predictable machine-derived key

Content
View full analysis
bytes: username = getpass.getuser() hostname = socket.gethostname() material = ( f"{hostname}:{username}{KEY_MATERIAL_SUFFIX}" ).encode("utf-8") return hashlib.scrypt( material, salt=SCRYPT_SALT, n=2**14, r=8, p=1, dklen=32 ) with open(CREDENTIALS_FILE, "w", encoding="utf-8") as handle: json.dump(payload, handle, ensure_ascii=False, indent=2) if platform.system() != "Windows": os.chmod( CREDENTIALS_FILE, stat.S_IRUSR | stat.S_IWUSR ) ``` ### Technical Analysis The AES-GCM primitive and random nonce are ...[truncated 3081 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/export_excel.py:247
Finding

Sensitive API bearer tokens can be supplied through command-line arguments

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Taint TrackingDirect Taint Flow, Variable-Mediated Taint Flow, Credential Exfiltration Chain
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
Findings (191)

Tainted flow: 'req' from os.environ.get (line 38, credential/environment) → urllib.request.urlopen (network output)

Critical
Category
Data Flow
Confidence
96% confidence
Finding

The request URL is derived from API_BASE_URL, which can be overridden via an environment variable and again via the --api-base CLI argument, then used directly in urllib.request.urlopen. Because the script also attaches the Authorization token to every request, an attacker who can influence the base URL can redirect traffic to an attacker-controlled host and exfiltrate credentials or sensitive device data; in an agent/skill context, user-controlled parameters make this more dangerous than a normal local admin-only script.

Content

Scanner excerpt · scripts/export_excel.py (reported line 43)May include surrounding context.

python
for k, v in headers.items():
            req.add_header(k, v)
    try:
        with urllib.request.urlopen(req, timeout=30) as resp:
            return json.loads(resp.read().decode("utf-8"))
    except urllib.error.HTTPError as e:
        body = e.read().decode("utf-8")

Tainted flow: 'req' from os.environ.get (line 78, credential/environment) → urllib.request.urlopen (network output)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

The request target is derived from INSENTEK_API_BASE and then used directly in urllib.request.urlopen, allowing an attacker who can influence the environment or CLI --api-base to redirect authenticated API traffic to an arbitrary host. Because this client sends tokens and may fetch fresh credentials-derived tokens, the behavior creates an SSRF/exfiltration risk rather than a mere configurability feature.

Content

Scanner excerpt · scripts/insentek_cli.py (reported line 87)May include surrounding context.

python
req.data = json.dumps(data).encode("utf-8")

    try:
        with urllib.request.urlopen(req, timeout=30) as resp:
            return json.loads(resp.read().decode("utf-8"))
    except urllib.error.HTTPError as e:
        # 认证失败,尝试刷新 token 后重试一次

Tainted flow: 'req' from os.environ.get (line 78, credential/environment) → urllib.request.urlopen (network output)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

The environment check accepts a caller-controlled api_base and performs a network request to it, which can be abused for SSRF or internal network probing if an attacker can influence the argument or environment. This specific path does not include authentication material, so the impact is lower than the main request path, but it still extends network reach beyond the declared data-query purpose.

Content

Scanner excerpt · scripts/insentek_cli.py (reported line 571)May include surrounding context.

python
# 7. API 可达性(不带认证,只检查服务是否在线)
    try:
        req = urllib.request.Request(f"{api_base}/v3/token", method="GET")
        with urllib.request.urlopen(req, timeout=10) as resp:
            # 400 是正常的(缺少参数),说明服务在线
            results["api_reachable"] = {
                "ok": True,

External Script Fetching

High
Category
Supply Chain
Confidence
90% confidence
Finding

Remote code is downloaded and executed. This bypasses code review and could introduce malicious code.

Content

Scanner excerpt · CHANGELOG.md (reported line 71)May include surrounding context.

md
Added
-----

- **`latest` 子命令**:`scripts/insentek_cli.py` 新增 `latest --sn SN`,统一走加密凭据 + 自动刷新 token,取代 SKILL.md 之前不可执行的 `curl /v3/device/{sn}/latest` 示例(Agent 无法从加密凭据中拿到明文 token)
- **统一错误信封 `normalize_error`**:`cmd_data` / `get_latest` 现在把内部 `_validation_error` / `_http_error` / `authentication_required` 统一转换为 `{success: false, error: <kind>, message: ...}`,并对上游 WAF HTML 错误页截断到 500 字符

Fixed

External Script Fetching

High
Category
Supply Chain
Confidence
90% confidence
Finding

Remote code is downloaded and executed. This bypasses code review and could introduce malicious code.

Content

Scanner excerpt · CHANGELOG.md (reported line 71)May include surrounding context.

md
Added
-----

- **`latest` 子命令**:`scripts/insentek_cli.py` 新增 `latest --sn SN`,统一走加密凭据 + 自动刷新 token,取代 SKILL.md 之前不可执行的 `curl /v3/device/{sn}/latest` 示例(Agent 无法从加密凭据中拿到明文 token)
- **统一错误信封 `normalize_error`**:`cmd_data` / `get_latest` 现在把内部 `_validation_error` / `_http_error` / `authentication_required` 统一转换为 `{success: false, error: <kind>, message: ...}`,并对上游 WAF HTML 错误页截断到 500 字符

Fixed

Hidden Instructions

High
Category
Prompt Injection
Confidence
60% confidence
Finding

Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.

Content

Scanner excerpt · CLAUDE.md (reported line 1)May include surrounding context.

md
# insentek-api-skills

This is a GSD-managed project. Use `/gsd-progress` to check status and next steps.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The documented behavior materially exceeds the declared purpose: besides IoT data querying, the skill performs package installation, runtime discovery, environment checks, credential storage, token handling, and local file generation. This mismatch is dangerous because users and policy systems may grant trust based on a benign description while the skill exercises far broader local and network capabilities.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The documented behavior materially exceeds the declared purpose: besides IoT data querying, the skill performs package installation, runtime discovery, environment checks, credential storage, token handling, and local file generation. This mismatch is dangerous because users and policy systems may grant trust based on a benign description while the skill exercises far broader local and network capabilities.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The documented behavior materially exceeds the declared purpose: besides IoT data querying, the skill performs package installation, runtime discovery, environment checks, credential storage, token handling, and local file generation. This mismatch is dangerous because users and policy systems may grant trust based on a benign description while the skill exercises far broader local and network capabilities.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The documented behavior materially exceeds the declared purpose: besides IoT data querying, the skill performs package installation, runtime discovery, environment checks, credential storage, token handling, and local file generation. This mismatch is dangerous because users and policy systems may grant trust based on a benign description while the skill exercises far broader local and network capabilities.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The documented behavior materially exceeds the declared purpose: besides IoT data querying, the skill performs package installation, runtime discovery, environment checks, credential storage, token handling, and local file generation. This mismatch is dangerous because users and policy systems may grant trust based on a benign description while the skill exercises far broader local and network capabilities.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The documented behavior materially exceeds the declared purpose: besides IoT data querying, the skill performs package installation, runtime discovery, environment checks, credential storage, token handling, and local file generation. This mismatch is dangerous because users and policy systems may grant trust based on a benign description while the skill exercises far broader local and network capabilities.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The documented behavior materially exceeds the declared purpose: besides IoT data querying, the skill performs package installation, runtime discovery, environment checks, credential storage, token handling, and local file generation. This mismatch is dangerous because users and policy systems may grant trust based on a benign description while the skill exercises far broader local and network capabilities.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The documented behavior materially exceeds the declared purpose: besides IoT data querying, the skill performs package installation, runtime discovery, environment checks, credential storage, token handling, and local file generation. This mismatch is dangerous because users and policy systems may grant trust based on a benign description while the skill exercises far broader local and network capabilities.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The documented behavior materially exceeds the declared purpose: besides IoT data querying, the skill performs package installation, runtime discovery, environment checks, credential storage, token handling, and local file generation. This mismatch is dangerous because users and policy systems may grant trust based on a benign description while the skill exercises far broader local and network capabilities.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

The documented behavior materially exceeds the declared purpose: besides IoT data querying, the skill performs package installation, runtime discovery, environment checks, credential storage, token handling, and local file generation. This mismatch is dangerous because users and policy systems may grant trust based on a benign description while the skill exercises far broader local and network capabilities.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The documented behavior materially exceeds the declared purpose: besides IoT data querying, the skill performs package installation, runtime discovery, environment checks, credential storage, token handling, and local file generation. This mismatch is dangerous because users and policy systems may grant trust based on a benign description while the skill exercises far broader local and network capabilities.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The documented behavior materially exceeds the declared purpose: besides IoT data querying, the skill performs package installation, runtime discovery, environment checks, credential storage, token handling, and local file generation. This mismatch is dangerous because users and policy systems may grant trust based on a benign description while the skill exercises far broader local and network capabilities.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The documented behavior materially exceeds the declared purpose: besides IoT data querying, the skill performs package installation, runtime discovery, environment checks, credential storage, token handling, and local file generation. This mismatch is dangerous because users and policy systems may grant trust based on a benign description while the skill exercises far broader local and network capabilities.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The documented behavior materially exceeds the declared purpose: besides IoT data querying, the skill performs package installation, runtime discovery, environment checks, credential storage, token handling, and local file generation. This mismatch is dangerous because users and policy systems may grant trust based on a benign description while the skill exercises far broader local and network capabilities.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The documented behavior materially exceeds the declared purpose: besides IoT data querying, the skill performs package installation, runtime discovery, environment checks, credential storage, token handling, and local file generation. This mismatch is dangerous because users and policy systems may grant trust based on a benign description while the skill exercises far broader local and network capabilities.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The documented behavior materially exceeds the declared purpose: besides IoT data querying, the skill performs package installation, runtime discovery, environment checks, credential storage, token handling, and local file generation. This mismatch is dangerous because users and policy systems may grant trust based on a benign description while the skill exercises far broader local and network capabilities.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The documented behavior materially exceeds the declared purpose: besides IoT data querying, the skill performs package installation, runtime discovery, environment checks, credential storage, token handling, and local file generation. This mismatch is dangerous because users and policy systems may grant trust based on a benign description while the skill exercises far broader local and network capabilities.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The documented behavior materially exceeds the declared purpose: besides IoT data querying, the skill performs package installation, runtime discovery, environment checks, credential storage, token handling, and local file generation. This mismatch is dangerous because users and policy systems may grant trust based on a benign description while the skill exercises far broader local and network capabilities.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The documented behavior materially exceeds the declared purpose: besides IoT data querying, the skill performs package installation, runtime discovery, environment checks, credential storage, token handling, and local file generation. This mismatch is dangerous because users and policy systems may grant trust based on a benign description while the skill exercises far broader local and network capabilities.

Content

No source excerpt is available for this finding.

Static analysis

Detected: suspicious.dangerous_exec, suspicious.potential_exfiltration

Shell command execution detected (child_process).

Critical
Code
suspicious.dangerous_exec
Location
packages/insentek-skill-cli/lib/python.js:9

Shell command execution detected (child_process).

Critical
Code
suspicious.dangerous_exec
Location
packages/insentek-skill-cli/lib/utils.js:34

Shell command execution detected (child_process).

Critical
Code
suspicious.dangerous_exec
Location
packages/insentek-skill-cli/test/cli-json.test.js:11

Sensitive-looking file read is paired with a network send.

Warn
Code
suspicious.potential_exfiltration
Location
packages/insentek-skill-cli/lib/core/credentials.js:119