Back to skill

Security audit

Statsoft-CLI / 统计软件接入助手

Security checks for vulnerabilities and agentic risk

Overview

The skill is transparent about automating local statistical software, but a shared Windows launcher can let crafted filenames run unintended shell commands, so it needs review before installation.

Review or patch the Windows launcher before using execution wrappers, especially batch conversion on untrusted directories. Avoid setting STATSOFT_AUTO_WRITE or STATSOFT_CONFIRM broadly, inspect planned commands and input filenames, and prefer a version that replaces cmd.exe /c string assembly with structured process arguments and redirected output.

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/common/invoke_hidden.ps1:52
Finding

Arbitrary command execution through unescaped StatTransfer batch filenames

Content
View full analysis

Vulnerability Details

File Location: scripts/common/invoke_hidden.ps1:52-73, reachable from scripts/windows-only/StatTransfer/statsoft-stattransfer.ps1:253-270
Vulnerability Type: Windows command injection
Risk Level: High

Complete Code Snippet

Caller processing automatically enumerated filenames:

powershell
# scripts/windows-only/StatTransfer/statsoft-stattransfer.ps1:253-270
foreach ($file in $files) {
    $baseName = [System.IO.Path]::GetFileNameWithoutExtension($file.Name)
    $outExt = switch ($file.Extension) {
        ".sav"  { ".csv" }
        ".dta"  { ".csv" }
        ".sas7bdat" { ".csv" }
        ".csv"  { ".dta" }
        ".xlsx" { ".csv" }
        default { ".csv" }
    }
    $outFile = Join-Path $outputDir "$baseName$outExt"

    Write-Host "  -> $($file.Name) -> $outFile" -ForegroundColor White -NoNewline

    try {
        $result = Invoke-StatExe -FilePath $stExePath -ArgumentList $file.FullName,$outFile

Vulnerable command construction and shell execution:

powershell
# scripts/common/invoke_hidden.ps1:52-73
$sb = New-Object System.Text.StringBuilder
[void]$sb.Append('"').Append($FilePath).Append('"')
foreach ($a in $ArgumentList) {
    [void]$sb.Append(' ')
    if ($a -match '\s') { [void]$sb.Append('"').Append($a).Append('"') }
    else { [void]$sb.Append($a) }
}
[void]$sb.Append(' > "').Append($outFile).Append('" 2> "').Append($errFile).Append('"')
$inner = $sb.ToString()

try {
    $psi = New-Object System.Diagnostics.ProcessStartInfo
    $psi.FileName = 'cmd.exe'
    $psi.Arguments = ('/c "' + $inner + '"')
    $psi.WindowStyle = [System.Diagnostics.ProcessWindowStyle]::Hidden
    $psi.UseShellExecute = $false

Technical Analysis

Invoke-StatExe does not preserve arguments as a structured argument vector. Instead, it concatenates the executable path and all arguments into a single command string a ...[truncated 2896 chars]

Remediation
View remediation

Remediation Suggestions

  1. Remove cmd.exe /c from the launch path. Start the configured executable directly with System.Diagnostics.ProcessStartInfo.
  2. Preserve argument boundaries. On supported PowerShell/.NET versions, populate ProcessStartInfo.ArgumentList once per argument rather than building a command string.
  3. Capture output without shell redirection. Set:
    • UseShellExecute = $false
    • RedirectStandardOutput = $true
    • RedirectStandardError = $true
    • CreateNoWindow = $true where compatible with the target application
  4. Retain arguments as data. Do not perform manual joining, quoting, or redirection through CMD.
  5. Add defense-in-depth filename validation. Until the shared launcher is replaced, reject filenames containing CMD metacharacters. This should be treated only as a temporary mitigation, not the primary fix.
  6. Review every Invoke-StatExe caller. Determine whether input filenames, output paths, configuration values, or additional arguments can originate from imported files, shared directories, or other lower-trust sources.
  7. Add regression tests using filenames containing spaces and Windows shell-significant characters, including &, ^, %, (, and ). Verify that the target executable receives each filename literally and that no secondary process is launched.
  8. Keep the existing authorization gate. It remains useful for controlling expected file writes, but it must not be relied upon as protection against argument injection.
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (139)

Env Variable Harvesting

High
Category
Data Exfiltration
Confidence
60% confidence
Finding

Code enumerates, copies, or searches environment variables for secrets. Bulk environment access can collect credentials unrelated to the skill's stated purpose.

Content

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

md
ClawHub SkillSpector 审计继续修复(v2.6.4 仍 `suspicious`,20 项发现;审计主题进一步升级到「默认拒绝授权 / 最小子进程环境 / 临时脚本注入 / 环境变量持久化 / 文档范围漂移」)。本轮按审计器 remediation 模式彻底修复:

- **全部授权闸门改为默认拒绝(SDI-4,多处 MEDIUM)**:`Test-UserAuthorizedToRun`(`statsoft-spss.ps1` / `statsoft-statistica.ps1` / `statsoft-r.ps1`)与 `user_authorized_to_run`(`statsoft-cmdstan.py`)、`_opt_in_confirm`(`spss_helper.py`)由「默认 proceed」翻转为 **default-deny**:默认返回 False,仅当 `STATSOFT_AUTO_WRITE set to 1`(非交互/agent)或 `STATSOFT_CONFIRM set to 1`+TTY 回答 y 时才放行。SPSS 授权提示补述「将执行第三方外部二进制」。
- **SPSS 子进程最小环境(E2 HIGH)**:`spss_helper.py` 新增 `_minimal_env()`,以允许列表(PATH/SYSTEMROOT 等 + 必要 PYTHONPATH)构建子进程环境,替换 `run_internal` / `show_version` 中的 `os.environ.copy()`,防止把用户密钥泄漏给 SPSS 子进程。
- **SPSS .spj 语法校验(AST4 MEDIUM)**:`spss_helper.py` 新增 `_validate_spj()`,在 `run_console` / `run_exe` 执行前拒绝 .spj/.sps 中的 `HOST COMMAND` / `INSERT FILE` / `PRESERVE` / `RESTORE` 等危险语法。
- **SPSS run_internal 去插值(SQP-2)**:语法路径改为经 `sys.argv[2]` 传参,不再插值进包装脚本字面量。
- **CmdStan 输出净化 + 默认拒绝(OH1 HIGH / SDI-4)**:`cmdstan_info` 的 `stanc --version` 输出经 `_sanitize()` 后再打印;`user_authorized_to_run` 默认拒绝。

Hidden Instructions

High
Category
Prompt Injection
Confidence
70% confidence
Finding

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

Content

Scanner excerpt · references/config-templates.md (reported line 29)May include surrounding context.

md
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       print="false" syntaxErrorHandling="continue"
       syntaxFormat="interactive" unicode="true">
    <!-- locale auto-detect: in Chinese environments inject country="CN" language="zh" automatically; in other environments omit this element so SPSS inherits the system locale (avoids hardcoding locale that changes parsing/encoding/reproducibility, SQP-3) -->
    <output outputFormat="viewer" outputPath="output.spv"/>
    <syntax syntaxPath="syntax.sps"/>
  </job>

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/cross-platform/R/setup_r.sh (reported line 200)May include surrounding context.

sh
LANG_ZH "" ""
            echo "$(LANG_ZH "本技能不自动执行 sudo 安装。请在确认来源后,手动以管理员权限运行以下命令安装 R:" "This skill does not auto-run sudo. After verifying the source, manually install R as admin with:")"
            if command -v apt &>/dev/null; then
                echo "  sudo apt update && sudo apt install -y r-base"
            elif command -v yum &>/dev/null; then
                echo "  sudo yum install -y R"
            elif command -v dnf &>/dev/null; then

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 · scripts/windows-only/AMOS/setup_amos.ps1 (reported line 1)May include surrounding context.

text
# statsoft-stata.ps1 — STATA EXECUTION wrapper (NOT a setup/detection tool).
# Mirrors statsoft-sas.ps1: this script INVOKES the third-party Stata binary and
# CREATES temporary/log files. It does NOT modify config.json or environment variables.
#

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 · scripts/windows-only/EViews/setup_eviews.ps1 (reported line 1)May include surrounding context.

text
# statsoft-stata.ps1 — STATA EXECUTION wrapper (NOT a setup/detection tool).
# Mirrors statsoft-sas.ps1: this script INVOKES the third-party Stata binary and
# CREATES temporary/log files. It does NOT modify config.json or environment variables.
#

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 · scripts/windows-only/EViews/statsoft-eviews.ps1 (reported line 1)May include surrounding context.

text
# statsoft-stata.ps1 — STATA EXECUTION wrapper (NOT a setup/detection tool).
# Mirrors statsoft-sas.ps1: this script INVOKES the third-party Stata binary and
# CREATES temporary/log files. It does NOT modify config.json or environment variables.
#

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 · scripts/windows-only/GraphPad/setup_graphpad.ps1 (reported line 1)May include surrounding context.

text
# statsoft-stata.ps1 — STATA EXECUTION wrapper (NOT a setup/detection tool).
# Mirrors statsoft-sas.ps1: this script INVOKES the third-party Stata binary and
# CREATES temporary/log files. It does NOT modify config.json or environment variables.
#

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 · scripts/windows-only/GraphPad/statsoft-graphpad.ps1 (reported line 1)May include surrounding context.

text
# statsoft-stata.ps1 — STATA EXECUTION wrapper (NOT a setup/detection tool).
# Mirrors statsoft-sas.ps1: this script INVOKES the third-party Stata binary and
# CREATES temporary/log files. It does NOT modify config.json or environment variables.
#

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 · scripts/windows-only/JMP/setup_jmp.ps1 (reported line 1)May include surrounding context.

text
# statsoft-stata.ps1 — STATA EXECUTION wrapper (NOT a setup/detection tool).
# Mirrors statsoft-sas.ps1: this script INVOKES the third-party Stata binary and
# CREATES temporary/log files. It does NOT modify config.json or environment variables.
#

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 · scripts/windows-only/JMP/statsoft-jmp.ps1 (reported line 1)May include surrounding context.

text
# statsoft-stata.ps1 — STATA EXECUTION wrapper (NOT a setup/detection tool).
# Mirrors statsoft-sas.ps1: this script INVOKES the third-party Stata binary and
# CREATES temporary/log files. It does NOT modify config.json or environment variables.
#

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 · scripts/windows-only/Limdep/setup_limdep.ps1 (reported line 1)May include surrounding context.

text
# statsoft-stata.ps1 — STATA EXECUTION wrapper (NOT a setup/detection tool).
# Mirrors statsoft-sas.ps1: this script INVOKES the third-party Stata binary and
# CREATES temporary/log files. It does NOT modify config.json or environment variables.
#

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 · scripts/windows-only/Mathematica/setup_mathematica.ps1 (reported line 1)May include surrounding context.

text
# statsoft-stata.ps1 — STATA EXECUTION wrapper (NOT a setup/detection tool).
# Mirrors statsoft-sas.ps1: this script INVOKES the third-party Stata binary and
# CREATES temporary/log files. It does NOT modify config.json or environment variables.
#

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 · scripts/windows-only/Microfit/setup_microfit.ps1 (reported line 1)May include surrounding context.

text
# statsoft-stata.ps1 — STATA EXECUTION wrapper (NOT a setup/detection tool).
# Mirrors statsoft-sas.ps1: this script INVOKES the third-party Stata binary and
# CREATES temporary/log files. It does NOT modify config.json or environment variables.
#

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 · scripts/windows-only/Minitab/setup_minitab.ps1 (reported line 1)May include surrounding context.

text
# statsoft-stata.ps1 — STATA EXECUTION wrapper (NOT a setup/detection tool).
# Mirrors statsoft-sas.ps1: this script INVOKES the third-party Stata binary and
# CREATES temporary/log files. It does NOT modify config.json or environment variables.
#

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 · scripts/windows-only/Mplus/setup_mplus.ps1 (reported line 1)May include surrounding context.

text
# statsoft-stata.ps1 — STATA EXECUTION wrapper (NOT a setup/detection tool).
# Mirrors statsoft-sas.ps1: this script INVOKES the third-party Stata binary and
# CREATES temporary/log files. It does NOT modify config.json or environment variables.
#

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 · scripts/windows-only/NCSS/setup_ncss.ps1 (reported line 1)May include surrounding context.

text
# statsoft-stata.ps1 — STATA EXECUTION wrapper (NOT a setup/detection tool).
# Mirrors statsoft-sas.ps1: this script INVOKES the third-party Stata binary and
# CREATES temporary/log files. It does NOT modify config.json or environment variables.
#

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 · scripts/windows-only/NLOGIT/setup_nlogit.ps1 (reported line 1)May include surrounding context.

text
# statsoft-stata.ps1 — STATA EXECUTION wrapper (NOT a setup/detection tool).
# Mirrors statsoft-sas.ps1: this script INVOKES the third-party Stata binary and
# CREATES temporary/log files. It does NOT modify config.json or environment variables.
#

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 · scripts/windows-only/Origin/setup_origin.ps1 (reported line 1)May include surrounding context.

text
# statsoft-stata.ps1 — STATA EXECUTION wrapper (NOT a setup/detection tool).
# Mirrors statsoft-sas.ps1: this script INVOKES the third-party Stata binary and
# CREATES temporary/log files. It does NOT modify config.json or environment variables.
#

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 · scripts/windows-only/Q_MRKS/setup_q.ps1 (reported line 1)May include surrounding context.

text
# statsoft-stata.ps1 — STATA EXECUTION wrapper (NOT a setup/detection tool).
# Mirrors statsoft-sas.ps1: this script INVOKES the third-party Stata binary and
# CREATES temporary/log files. It does NOT modify config.json or environment variables.
#

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 · scripts/windows-only/SHAZAM/setup_shazam.ps1 (reported line 1)May include surrounding context.

text
# statsoft-stata.ps1 — STATA EXECUTION wrapper (NOT a setup/detection tool).
# Mirrors statsoft-sas.ps1: this script INVOKES the third-party Stata binary and
# CREATES temporary/log files. It does NOT modify config.json or environment variables.
#

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 · scripts/windows-only/SPSS/setup_modeler.ps1 (reported line 1)May include surrounding context.

text
# statsoft-stata.ps1 — STATA EXECUTION wrapper (NOT a setup/detection tool).
# Mirrors statsoft-sas.ps1: this script INVOKES the third-party Stata binary and
# CREATES temporary/log files. It does NOT modify config.json or environment variables.
#

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 · scripts/windows-only/SPSS/setup_spss.ps1 (reported line 1)May include surrounding context.

text
# statsoft-stata.ps1 — STATA EXECUTION wrapper (NOT a setup/detection tool).
# Mirrors statsoft-sas.ps1: this script INVOKES the third-party Stata binary and
# CREATES temporary/log files. It does NOT modify config.json or environment variables.
#

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 · scripts/windows-only/SPSS/statsoft-modeler.ps1 (reported line 1)May include surrounding context.

text
# statsoft-stata.ps1 — STATA EXECUTION wrapper (NOT a setup/detection tool).
# Mirrors statsoft-sas.ps1: this script INVOKES the third-party Stata binary and
# CREATES temporary/log files. It does NOT modify config.json or environment variables.
#

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 · scripts/windows-only/SPSS/statsoft-spss.ps1 (reported line 1)May include surrounding context.

text
# statsoft-stata.ps1 — STATA EXECUTION wrapper (NOT a setup/detection tool).
# Mirrors statsoft-sas.ps1: this script INVOKES the third-party Stata binary and
# CREATES temporary/log files. It does NOT modify config.json or environment variables.
#

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 · scripts/windows-only/StatTransfer/statsoft-stattransfer.ps1 (reported line 1)May include surrounding context.

text
# statsoft-stata.ps1 — STATA EXECUTION wrapper (NOT a setup/detection tool).
# Mirrors statsoft-sas.ps1: this script INVOKES the third-party Stata binary and
# CREATES temporary/log files. It does NOT modify config.json or environment variables.
#

Static analysis

No suspicious patterns detected.