Back to skill

Security audit

J6B泊车日志分析

Security checks for vulnerabilities and agentic risk

Overview

This is a mostly coherent J6B log-diagnostics skill, but it ships root-based remote log collection and long-running monitoring guidance with unsafe scoping and a confirmed command-injection risk.

Install only if you intentionally need J6B/QNX diagnostics and are comfortable reviewing shell scripts first. Use a least-privilege read-only account where possible, do not pass untrusted module names to download_log.sh, avoid broad log or coredump exports unless approved, store downloaded diagnostics securely, and run background monitoring only with a defined stop time and cleanup plan.

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

Error
Location
scripts/download_log.sh:64
Finding

Remote Command Injection Through Unvalidated Module Names

Content
View full analysis
/dev/null 2>&1; then mkdir -p "${SAVE_DIR}/${module}" scp -r ${REMOTE_USER}@${REMOTE_IP}:${REMOTE_LOG_DIR}/${module}/* "${SAVE_DIR}/${module}/" 2>/dev/null ``` ### Technical Analysis Every positional argument not beginning with a hyphen is appended directly to `MODULES`. The script defines a list of supported modules in `ALL_MODULES`, but it never verifies user-supplied module names against that list or applies a strict identifier validation rule. The value of `module` is interpolated into a command string passed to SSH: ```sh ssh root@ "test -d /app/apa/log/${module}" ``` Although the outer command string is quoted for the local shell, SSH sends the resulting string to a shell on the remote host. Shell metacharacters contained in `module`, such as a command separator, can consequently change the structure of the remote command rather than being treated as part of a directory name. The script uses the hard-coded `root` account for the SSH connection. Therefore, successful command injection executes with full administrative privileges on the target J6B board. The same untrusted v ...[truncated 1684 chars]
Remediation
View remediation
&2 exit 1 fi done ``` 2. **Apply strict syntactic validation as defense in depth** Only accept expected identifier characters: ```sh case "$module" in ''|*[!A-Za-z0-9_]*) echo "Invalid module name" >&2 exit 1 ;; esac ``` Syntactic validation should supplement, not replace, the fixed allowlist. 3. **Avoid interpolating input into remote shell programs** Use a fixed remote command and pass the validated value as a positional parameter: ```sh ssh "${REMOTE_USER}@${REMOTE_IP}" \ 'module=$1; test -d "/app/apa/log/$module"' sh "$module" ``` This approach still requires strict validation because remote argument transport can vary between SSH implementations. 4. **Quote all connection and path operands** Quote the SSH destination and local operands consistently. Where supported, use `--` to terminate command options and prefer an SCP/SFTP implementation that does not invoke a remote shell. 5. **Apply least privilege** Replace direct root access with a dedicated account that has read-only access to `/app/apa/log`. If archive creation is necessary, expose a narrowly scoped privileged helper rather than an unrestricted root shell. 6. **Harden SSH access** Restrict the diagnostic account using SSH key policies, source-address restrictions, forced commands, and disabled interactive shell access where operationally feasible. 7. **Add negative security tests** ...[truncated 201 chars]
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
Findings (34)

Tp4

High
Category
MCP Tool Poisoning
Confidence
89% confidence
Finding

声明覆盖的核心方向是“日志分析”,这一点与代码基本一致:脚本确实对模块日志进行扫描、错误识别、摘要统计和简单模式检测,并支持生成分析报告。但声明中列出的多项具体能力在代码中没有实现,属于明显的描述-行为不一致。首先,未见任何scp、cp、rsync或网络传输逻辑,因此不支持“日志下载”。其次,没有top/ps/free/vmstat/proc读取等资源采集逻辑,也没有CPU、内存、负载性能统计,仅在日志内容中搜索诸如OOM等关键字,不能等同于“系统资源性能分析”。再次,所谓“日志文件定位”仅限于在固定目录下find *.log并按模块遍历,不是通用定位能力;“日志读取”也并非真正提供tail/cat/按条件查看日志,而只是grep统计和摘要输出。总体上,代码的实际能力更窄,主要是固定目录下的错误日志分析脚本,因此应判定为存在能力描述夸大/不准确的 mismatch。

Content

No source excerpt is available for this finding.

Chaining Abuse

High
Category
Tool Misuse
Confidence
75% 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/download_log.sh (reported line 118)May include surrounding context.

sh
scp ${REMOTE_USER}@${REMOTE_IP}:${REMOTE_ARCHIVE} "${SAVE_DIR}/"
    
    echo -e "${BLUE}  3/4 解压日志文件...${NC}"
    cd "${SAVE_DIR}" && tar xzf "${ARCHIVE_NAME}" && rm -f "${ARCHIVE_NAME}"
    
    echo -e "${BLUE}  4/4 清理板端临时文件...${NC}"
    ssh ${REMOTE_USER}@${REMOTE_IP} "rm -f ${REMOTE_ARCHIVE}"

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The trigger list is very broad and includes generic troubleshooting terms such as '日志', '错误', '异常', '失败', '性能', and '下载'. This increases the chance of unintended activation in unrelated conversations, which is risky because the skill contains guidance for remote access, command execution, and log exfiltration via ssh/scp.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The skill documents remote log download and remote command execution using ssh/scp and tar, but does not require an explicit warning or confirmation about transferring potentially sensitive logs off-device. In a diagnostics context, logs may contain credentials, internal paths, identifiers, or operational telemetry, so silent or assumed transfer increases data exposure risk.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
87% confidence
Finding

Using 'nohup ... &' enables session-persistent background execution, which can continue monitoring after the initiating session ends. In this skill's context, that persistence is more sensitive because it is paired with root-level remote administration and continuous log generation, creating the possibility of unreviewed long-running activity on the target system.

Content

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

md
/userdata/monitor_cpu.sh

# 后台运行(适合长期监控)
nohup /userdata/monitor_cpu.sh > /dev/null 2>&1 &

# 查看监控日志
tail -f /userdata/log/cpu_monitor/cpu_monitor_*.log

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
87% confidence
Finding

The file's title and all user-facing guidance are written entirely in Chinese, with no indication that another language is available or that Chinese is required for a region-specific purpose. Under the stated policy, forcing a specific language without user opt-in is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The document provides direct SCP and SSH commands to collect and export logs and coredumps from an embedded system but does not warn that those artifacts may contain sensitive diagnostic data, credentials, network details, crash memory, or proprietary telemetry. In a log-analysis skill, this omission materially increases the chance that users will exfiltrate sensitive data to less controlled environments or share it insecurely during troubleshooting.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
65% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

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

/userdata/monitor_cpu.sh

后台运行(长期监控)

nohup /userdata/monitor_cpu.sh > /dev/null 2>&1 &

text

**输出解读**:

Session Persistence

Medium
Category
Rogue Agent
Confidence
65% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

Scanner excerpt · references/performance.md (reported line 308)May include surrounding context.

/userdata/monitor_cpu.sh

后台运行(长期监控)

nohup /userdata/monitor_cpu.sh > /dev/null 2>&1 &

text

**输出解读**:

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

Destructive process-termination commands like slay are documented without any caution about service interruption, child-process termination, or safety implications on an embedded parking system. In this context, an agent or operator may treat them as normal troubleshooting steps and disrupt critical functions.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

This reference section includes privileged administration actions such as switching to root, changing permissions/ownership, restarting services, and modifying system time, which go beyond the skill's stated log-analysis purpose. In an agent skill, such documentation can expand the model's perceived action space and normalize risky system changes during troubleshooting, increasing the chance of unsafe guidance or misuse.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

Privilege escalation and permission-changing commands are presented as routine references without warnings about system integrity, persistence, or accidental lockout. In an agent skill, this can lead to over-privileged troubleshooting guidance and unsafe filesystem modifications beyond the intended log-analysis task.

Content

No source excerpt is available for this finding.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
92% confidence
Finding

Documenting su - normalizes full root shells in a context that should primarily support inspection and diagnostics. A root shell dramatically increases the chance of accidental or intentional system changes unrelated to log analysis.

Content

Scanner excerpt · references/qnx-commands.md (reported line 319)May include surrounding context.

bash
# 切换到root
su -

# 以root执行命令
sudo command

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
91% confidence
Finding

The explicit recommendation to execute commands with sudo expands privilege use inside a skill intended for log analysis. This increases the risk that an agent or user performs unnecessary actions as root, magnifying the blast radius of mistakes or abuse.

Content

Scanner excerpt · references/qnx-commands.md (reported line 322)May include surrounding context.

su -

以root执行命令

sudo command

text

### 修改文件权限

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
87% confidence
Finding

Permission-changing commands such as chmod 755 can alter file access semantics and are not needed for ordinary log reading. In this skill context, they encourage remedial system modification instead of safe diagnosis and may expose files or break expected protections.

Content

Scanner excerpt · references/qnx-commands.md (reported line 329)May include surrounding context.

bash
# 修改权限
chmod 755 file.sh

# 修改所有者
chown root:root file.sh

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

System time modification is documented without warning, even though changing time can break log correlation, invalidate forensic timelines, and disrupt time-sensitive services. In a log-analysis skill, this is especially dangerous because it directly undermines the reliability of the logs being analyzed.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The instruction says every response to system-resource questions must strictly follow this template, and the entire template is fixed in Chinese. This imposes a specific language on users without any opt-in or alternative locale handling, which matches the language/locale policy-violation category.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The script's user-facing title, usage examples, help text, and output strings are all presented in Chinese, with no indication that users may select another language or that the tool is intentionally region-specific. This can violate language/locale policy where user-facing tooling must not force a single language without opt-in.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The manifest describes this skill primarily as reading, locating, analyzing, and downloading logs, plus system resource performance analysis. This script implements ongoing CPU monitoring that creates a new local log directory/file and deletes older logs, which is a behavioral expansion from analysis into persistent log generation and lifecycle management.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The trigger words are very broad and overlap with normal conversation terms such as '错误', '性能', '下载', and 'log'. In an agent context, this increases the chance of accidental activation of a skill that suggests or initiates sensitive diagnostics, remote access, or data transfer workflows without the user intentionally invoking this capability.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The documentation provides direct SSH/SCP examples using the root account and local file writes, but does not warn about sensitive log contents, host authenticity verification, destination trust, or the risk of copying confidential data off-device. In practice this can lead users to exfiltrate logs containing secrets, identifiers, crash data, or proprietary telemetry to insecure endpoints or machines.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The manual states that the monitoring script automatically writes logs and deletes old ones after seven days, but does not clearly present these as filesystem-modifying behaviors requiring user awareness and approval. Hidden or insufficiently disclosed background write/delete actions can cause unintended persistence, storage consumption, or loss of forensic data valuable for troubleshooting and incident review.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
90% confidence
Finding

The use of 'nohup ... &' instructs users to launch a long-running background process that survives session termination, creating persistence on the target device. While presented for monitoring, persistent unattended execution can consume resources, continue collecting data unexpectedly, and remain active beyond the user's intended diagnostic window.

Content

Scanner excerpt · 用户使用手册.md (reported line 244)May include surrounding context.

md
/userdata/monitor_cpu.sh

# 后台运行(适合长期监控)
nohup /userdata/monitor_cpu.sh > /dev/null 2>&1 &

# 查看监控日志
tail -f /userdata/log/cpu_monitor/cpu_monitor_*.log

Session Persistence

Medium
Category
Rogue Agent
Confidence
90% confidence
Finding

This repeats the recommendation to start the monitoring script with 'nohup', again enabling session-persistent execution without emphasizing lifecycle limits or user consent. Repetition in FAQ guidance makes misuse more likely because users may adopt persistence as the normal operating mode rather than an exceptional diagnostic choice.

Content

Scanner excerpt · 用户使用手册.md (reported line 640)May include surrounding context.

A:

bash
# 后台运行监控脚本
nohup /userdata/monitor_cpu.sh > /dev/null 2>&1 &

# 查看监控日志
tail -f /userdata/log/cpu_monitor/cpu_monitor_*.log

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
84% confidence
Finding

The skill recommends deploying and running a persistent monitoring script that logs continuously and auto-deletes files, but it does not clearly warn that this changes system state and creates ongoing artifacts on the device. Even if operationally useful, persistent background monitoring can affect storage, performance, and forensic retention expectations if enabled without clear consent.

Content

No source excerpt is available for this finding.