Back to skill

Security audit

K10 Compile Server

Security checks for vulnerabilities and agentic risk

Overview

The skill fits its K10 remote-compile purpose, but it needs review because it uploads project contents and flashes firmware while disabling TLS verification, and one helper path can allow command injection on Windows-like shells.

Install only if you trust the compile server and network. Review the project archive before upload, remove secrets such as .env files, keys, certificates, and credentials, prefer a real or explicitly trusted certificate instead of -k, and avoid flashing firmware returned by an untrusted server. On Windows, prefer the PowerShell helper over the Bash helper under Git Bash/MSYS/Cygwin until the build_id/URL handling is fixed.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • 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
Findings (4)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/compile-project.sh:120
Finding

TLS Certificate Verification Is Disabled for Sensitive Server Operations

Content
View full analysis
/dev/null); then ``` ```bash SUBMIT=$(curl -skf -X POST "$SERVER/api/compile" \ -F "file=@$ZIP_FILE" 2>/dev/null) ``` ```bash if ! curl -skf -o "$OUTPUT" "$SERVER/api/build/$BUILD_ID/download" 2>/dev/null; then echo "❌ Firmware download failed" exit 1 fi ``` ```bash for FILE in bootloader partitions firmware; do if ! curl -skf -o "$FLASH_DIR/${FILE}.bin" "$SERVER/api/build/$BUILD_ID/file/${FILE}.bin" 2>/dev/null; then echo "❌ Failed to download ${FILE}.bin" exit 1 fi done ``` The PowerShell implementation uses the same insecure option: ```powershell $SubmitRaw = & curl.exe -skf -X POST "$Server/api/compile" -F "file=@$ZipFile" ``` ```powershell & curl.exe -skf -o $Target "$Server/api/build/$BuildId/file/$File.bin" ``` ### Technical Analysis The `-k`/`--insecure` option disables TLS certificate and hostname verification. Although the connection remains encrypted, the client no longer verifies that it is communicating with the intended compile server. This affects all sensitive stages of the workflow: - Uploading the complete project archive. - Receiving compilation status and build identifiers. - Downloading combined and individual firmware images. - Retrieving the flash manifest. - Triggering server-side flashing. A network-positioned attacker can present any certificate and impersonate the compile server. The helper performs no firmware signature, checksum, or provenance verification after downloading binaries. Consequently, transport-layer impersonation can directly become firmware substitution. The flagged pipelines at `SKILL.md:173` and `scripts/com ...[truncated 1574 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/compile-project.sh:175
Finding

PowerShell Command Injection Through the Web Serial URL

Content
View full analysis
/dev/null 2>&1 || return 1 ;; Linux*) xdg-open "$url" >/dev/null 2>&1 || return 1 ;; CYGWIN*|MINGW*|MSYS*) powershell.exe -NoProfile -Command "Start-Process '$url'" >/dev/null 2>&1 || return 1 ;; *) return 1 ;; esac } ``` The value passed into this function incorporates a server-returned build identifier: ```bash BUILD_ID=$(echo "$SUBMIT" | python3 -c "import sys,json;print(json.load(sys.stdin)['build_id'])" 2>/dev/null || echo "") ``` ```bash WEB_SERIAL_URL="$SERVER/?build_id=$BUILD_ID" if ! open_url "$WEB_SERIAL_URL"; then ``` ### Technical Analysis On CYGWIN, MINGW, and MSYS environments, the URL is interpolated directly into PowerShell source code: ```powershell Start-Process '$url' ``` Shell-level double quoting does not make the value safe for the nested PowerShell language. If `$url` contains an apostrophe, it can terminate the PowerShell string literal. PowerShell metacharacters following that apostrophe are then parsed as executable PowerShell statements. The URL contains both a user-controlled server value and a `build_id` supplied by the remote server. The script only checks that `BUILD_ID` is non-empty. It does not restrict the identifier to an expected format such as hexadecimal or UUID characters. The disabled certificate verification elsewhere in the script makes it possible for a network attacker, as well as a deliberately malicious server, to control the returned build identifier. ### Attack Path 1. The victim runs the helper under CYGWIN, MINGW, or MSYS with `--web-serial`. 2. A malicious or impersonated compile server responds to the compile request with a crafted JSON value such as a build identifier containi ...[truncated 1061 chars]
Remediation
View remediation

T05 · Unauthorized Access and Privilege Escalation

Warning
Location
scripts/compile-project.sh:193
Finding

Broad Project Archiving Can Upload Unrelated Secrets

Content
View full analysis
/dev/null 2>&1 ZIP_SIZE=$(stat --printf="%s" "$ZIP_FILE" 2>/dev/null || stat -f%z "$ZIP_FILE" 2>/dev/null) echo "🚀 Submitting compile job..." SUBMIT=$(curl -skf -X POST "$SERVER/api/compile" \ -F "file=@$ZIP_FILE" 2>/dev/null) ``` PowerShell implementation: ```powershell Get-ChildItem -LiteralPath $ProjectDir -Force | Where-Object { $_.Name -notin @(".pio", ".git", "build", "__pycache__") } | ForEach-Object { Copy-Item -LiteralPath $_.FullName -Destination $Stage -Recurse -Force } $tar = Get-Command tar.exe -ErrorAction SilentlyContinue if ($tar) { & $tar.Source -a -cf $ZipFile -C $Stage . } else { Compress-Archive -Path (Join-Path $Stage "*") -DestinationPath $ZipFile -Force } $SubmitRaw = & curl.exe -skf -X POST "$Server/api/compile" -F "file=@$ZipFile" ``` ### Technical Analysis The helpers package almost everything beneath the selected project directory. Only a small number of build and version-control paths are excluded. The archive can therefore include files that are not required to compile a PlatformIO project, including: - `.env` files. - Private keys and certificates. - Wi-Fi passwords, API tokens, and device credentials. - Editor metadata and local configuration. - Backups, logs, exported data, and unrelated source files. - Nested repository metadata not covered by the root-level patterns. The user is shown only the total archive size. The script does not display the archive manifest, scan for likely secrets ...[truncated 1397 chars]
Remediation
View remediation

T08 · Insecure Dependencies

Warning
Location
references/server-setup.md:8
Finding

Third-Party Build and Flash Dependencies Are Installed Without Version or Integrity Pinning

Content
View full analysis
Remediation
View remediation
esptool== ``` 2. Maintain a locked requirements file with SHA-256 hashes and install using: ```bash python3 -m pip install --require-hashes -r requirements.txt ``` 3. Pin the DFRobot platform to a reviewed immutable commit or signed release tag rather than the repository’s current default branch. 4. Record expected commit hashes and release checksums in the setup documentation. 5. Use a controlled package index, dependency proxy, or prebuilt container image for production deployment. 6. Run build and flashing tools under dedicated, non-administrative accounts with access only to required project paths and serial devices. 7. Establish an update process that reviews changelogs, verifies signatures or hashes, and tests new dependency versions before changing pins. ]]>
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
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
Findings (37)

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 · SKILL.md (reported line 93)May include surrounding context.

Health check API:

bash
curl -k https://localhost:8900/api/health

Expected response:

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
93% confidence
Finding

Using curl -k disables certificate validation, teaching operators to trust any certificate presented by the compile server. In this skill's context, that weakens the integrity of subsequent server interactions and can normalize insecure transport for firmware-related workflows.

Content

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

Health check API:

bash
curl -k https://localhost:8900/api/health

Expected response:

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 · SKILL.md (reported line 144)May include surrounding context.

bash
while true; do
  STATUS=$(curl -sk "$SERVER/api/build/$BUILD_ID/status")
  STATE=$(echo "$STATUS" | python3 -c "import sys,json;print(json.load(sys.stdin)['status'])")
  echo "Status: $STATE"
  if [ "$STATE" = "done" ]; then

External Script Fetching

High
Category
Supply Chain
Confidence
90% confidence
Finding

The skill instructs users to download firmware binaries from a remote server with curl -sk and then use them for flashing. Because TLS verification is disabled and the artifact is not authenticated, a man-in-the-middle or malicious server could supply trojaned firmware that leads to device compromise.

Content

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

bash
# Download combined firmware.bin
curl -sk -o firmware.bin "$SERVER/api/build/$BUILD_ID/download"
ls -lh firmware.bin

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
90% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

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

bash
# Clean PlatformIO build cache
rm -rf ~/.platformio/packages
# Clean temp build dirs
rm -rf /tmp/k10_compile_*

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
90% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

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

bash
# Clean PlatformIO build cache
rm -rf ~/.platformio/packages
# Clean temp build dirs
rm -rf /tmp/k10_compile_*

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
90% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

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

Clean PlatformIO build cache

rm -rf ~/.platformio/packages

Clean temp build dirs

rm -rf /tmp/k10_compile_*

text

## Web Serial Issues

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
90% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

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

Clean PlatformIO build cache

rm -rf ~/.platformio/packages

Clean temp build dirs

rm -rf /tmp/k10_compile_*

text

## Web Serial Issues

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
98% confidence
Finding

Using chmod 666 on a device node is an unsafe tool invocation because it intentionally weakens permissions to world read/write as a convenience shortcut. In a hardware-flashing workflow, that can allow any local process or user to interfere with or access the attached device.

Content

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

bash
sudo usermod -a -G dialout $USER
# Log out and back in, or:
sudo chmod 666 /dev/ttyUSB0  # Temporary

Docker Issues

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 · scripts/compile-project.sh (reported line 101)May include surrounding context.

sh
exit 1
fi

for CMD in curl python3 mktemp stat zip; do
  if ! command -v "$CMD" >/dev/null 2>&1; then
    echo "❌ Required command not found: $CMD"
    echo "   On Windows, prefer k10-compile-server/scripts/compile-project.ps1 to avoid WSL/Git Bash tool gaps."

External Script Fetching

High
Category
Supply Chain
Confidence
95% confidence
Finding

The script uploads the entire project archive to a user-supplied remote server using curl with '-k', which disables TLS certificate verification. In this skill's context, that means source code and build inputs can be intercepted or sent to a malicious compile server, enabling code theft, tampering with build results, or delivery of malicious firmware.

Content

Scanner excerpt · scripts/compile-project.sh (reported line 205)May include surrounding context.

sh
# ── Step 3: Submit compile ────────────────────────────────────

echo "🚀 Submitting compile job..."
SUBMIT=$(curl -skf -X POST "$SERVER/api/compile" \
  -F "file=@$ZIP_FILE" 2>/dev/null)

BUILD_ID=$(echo "$SUBMIT" | python3 -c "import sys,json;print(json.load(sys.stdin)['build_id'])" 2>/dev/null || echo "")

External Script Fetching

High
Category
Supply Chain
Confidence
97% confidence
Finding

The script downloads firmware from the remote server with curl using '-k' and then treats the artifact as trusted. In this skill, the downloaded binary is intended for device flashing, so a malicious or intercepted server response could supply trojaned firmware that compromises the connected K10.

Content

Scanner excerpt · scripts/compile-project.sh (reported line 273)May include surrounding context.

sh
fi

echo "💾 Downloading firmware to $OUTPUT"
if ! curl -skf -o "$OUTPUT" "$SERVER/api/build/$BUILD_ID/download" 2>/dev/null; then
  echo "❌ Firmware download failed"
  exit 1
fi

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/compile-project.sh (reported line 315)May include surrounding context.

sh
fi

  FLASH_DIR=$(mktemp -d /tmp/k10-flash-XXXXXX)
  trap "rm -f $ZIP_FILE; rm -rf $FLASH_DIR" EXIT
  echo "⬇️  Downloading flash files for local upload..."
  for FILE in bootloader partitions firmware; do
    if ! curl -skf -o "$FLASH_DIR/${FILE}.bin" "$SERVER/api/build/$BUILD_ID/file/${FILE}.bin" 2>/dev/null; then

External Script Fetching

High
Category
Supply Chain
Confidence
98% confidence
Finding

This line downloads bootloader, partition table, and firmware binaries from the remote server without certificate validation and then uses them for local flashing. Because these low-level images are written directly to the device, a malicious server or MITM attacker could deliver fully compromised firmware and persistent device takeover.

Content

Scanner excerpt · scripts/compile-project.sh (reported line 318)May include surrounding context.

sh
trap "rm -f $ZIP_FILE; rm -rf $FLASH_DIR" EXIT
  echo "⬇️  Downloading flash files for local upload..."
  for FILE in bootloader partitions firmware; do
    if ! curl -skf -o "$FLASH_DIR/${FILE}.bin" "$SERVER/api/build/$BUILD_ID/file/${FILE}.bin" 2>/dev/null; then
      echo "❌ Failed to download ${FILE}.bin"
      exit 1
    fi

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
94% confidence
Finding

The skill documents extensive shell-based actions but does not declare any tool scope or allowed-tools boundary. In an agent setting, that omission weakens enforcement and can let the skill invoke broader shell capabilities than a reviewer or runtime policy expects.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The configuration instruction is written as a mandatory directive in Chinese only, including the exact question the assistant should ask the user. This imposes a specific language on interactions without documenting user opt-in or offering an alternative locale, which is a natural-language policy violation under the language/locale rule.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The API reference documents uploading an entire project to a remote compile server but does not warn that source code, configuration, secrets, certificates, and other embedded files may be transmitted off-device. In this skill context, users are explicitly encouraged to use LAN/server compilation instead of local builds, so omission of a data-transfer warning increases the risk of inadvertent disclosure of proprietary or sensitive project contents.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The reference exposes a server-side flashing endpoint that writes firmware to USB-connected hardware but does not clearly warn that this is a device-modifying, potentially destructive operation. In the context of a compile-and-flash skill, a user may invoke flashing without appreciating that it can overwrite existing firmware, alter device state, or target the wrong attached device on the server.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The guide explicitly instructs users to bypass browser certificate warnings for a self-signed HTTPS endpoint. While framed for LAN convenience, this normalizes ignoring TLS trust failures and can train users to click through real certificate errors, increasing exposure to man-in-the-middle attacks if the network is not fully trusted or if DNS/IP spoofing occurs.

Content

No source excerpt is available for this finding.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

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

Port 8900 already in use

bash
sudo lsof -i :8900  # Find the process
sudo kill <PID>     # Kill it
# Or use a different port:
K10_COMPILE_PORT=8901 python3 main.py

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

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

Port 8900 already in use

bash
sudo lsof -i :8900  # Find the process
sudo kill <PID>     # Kill it
# Or use a different port:
K10_COMPILE_PORT=8901 python3 main.py

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

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

Port 8900 already in use

bash
sudo lsof -i :8900  # Find the process
sudo kill <PID>     # Kill it
# Or use a different port:
K10_COMPILE_PORT=8901 python3 main.py

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

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

Port 8900 already in use

bash
sudo lsof -i :8900  # Find the process
sudo kill <PID>     # Kill it
# Or use a different port:
K10_COMPILE_PORT=8901 python3 main.py

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

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

Port 8900 already in use

bash
sudo lsof -i :8900  # Find the process
sudo kill <PID>     # Kill it
# Or use a different port:
K10_COMPILE_PORT=8901 python3 main.py

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
72% confidence
Finding

sudo kill <PID> is a privileged process-termination command presented without caution or validation guidance. In troubleshooting documentation for an agent skill, users may kill the wrong process or terminate unrelated services, causing service disruption or denial of service on the host.

Content

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

Port 8900 already in use

bash
sudo lsof -i :8900  # Find the process
sudo kill <PID>     # Kill it
# Or use a different port:
K10_COMPILE_PORT=8901 python3 main.py

Static analysis

No suspicious patterns detected.