Back to skill

Security audit

syself-autopilot-hetzner

Security checks for vulnerabilities and agentic risk

Overview

The skill matches its SySelf/Hetzner purpose, but its helper scripts can upload powerful cloud and SSH credentials or create infrastructure using whichever Kubernetes context is active.

Install only if you are comfortable reviewing and controlling the Kubernetes target yourself. Before running the helper scripts, set an explicit kubeconfig/context/namespace, verify the API server and organization namespace, avoid the default namespace unless intentional, and consider replacing the secret creation flow with a safer method that does not expose credentials in process arguments. Rotate Hetzner or SSH credentials if they may have been submitted to the wrong cluster.

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

T09 · Insecure Skill Coding Practices

Error
Location
scripts/02-create-management-secrets.sh:17
Finding
Sensitive Hetzner credentials are exposed through command-line arguments<![CDATA[ ## Vulnerability Details **File Location**: `scripts/02-create-management-secrets.sh:17-22` **Vulnerability Type**: Sensitive credentials in process arguments **Risk Level**: High ### Vulnerable Code ```bash echo "==> Creating or updating 'hetzner' secret..." kubectl create secret generic hetzner \ --from-literal=hcloud="$HCLOUD_TOKEN" \ --from-literal=robot-user="$HETZNER_ROBOT_USER" \ --from-literal=robot-password="$HETZNER_ROBOT_PASSWORD" \ --dry-run=client -o yaml | kubectl apply -f - ``` ### Technical Analysis The script expands the HCloud API token, Robot username, and Robot password directly into the argument list of the `kubectl` process. Although the resulting manifest is sent through standard output to another `kubectl` process, the original secret values are still present in the process arguments. Depending on operating-system process visibility and host security configuration, these values may be accessible through process inspection, audit or endpoint-monitoring systems, command tracing, debugging tools, or crash diagnostics. The use of `set -x` by a caller would create an additional disclosure risk. Creating Kubernetes Secrets is necessary for the Skill's declared SySelf Autopilot workflow. However, placing secret values in process arguments is not the minimum-exposure method required to implement that functionality. ### Attack Path 1. An operator exports `HCLOUD_TOKEN`, `HETZNER_ROBOT_USER`, and `HETZNER_ROBOT_PASSWORD`. 2. The operator runs `scripts/02-create-management-secrets.sh`. 3. The script expands those values into the `kubectl create secret` process arguments. 4. A local process observer, privileged user, monitoring agent, or audit collector records or reads the argument list while the command is running. 5. The observer extracts the HCloud token and Robot credentials. 6. The exposed credentials are used against the corresponding Hetzner services, subject to their assigned privileges. ### Impact Assessment Disclo ...[truncated 502 chars]
Remediation
<![CDATA[ ## Remediation Suggestions - Do not pass secret values through `--from-literal` command-line arguments. - Prefer a Kubernetes client library or another implementation that constructs the Secret in memory and transmits it without placing credentials in process arguments. - If file-based handling is required, create protected temporary files with mode `0600`, use a private directory, ensure cleanup through a shell trap, and avoid exposing generated Secret YAML in logs. - Explicitly prohibit shell tracing while credentials are processed and fail if an unsafe debugging mode is active. - Ensure logs and monitoring systems never capture generated Secret manifests or sensitive environment-variable values. - Use narrowly scoped, separately managed credentials where supported, and rotate the HCloud token and Robot password after any suspected disclosure. ]]>

T09 · Insecure Skill Coding Practices

Error
Location
scripts/02-create-management-secrets.sh:5
Finding
Privileged Kubernetes writes use an unverified ambient cluster context<![CDATA[ ## Vulnerability Details **File Locations**: - `scripts/02-create-management-secrets.sh:5-29` - `scripts/04-register-baremetal-hosts.sh:14-19` - `scripts/05-apply-cluster.sh:14-28` **Vulnerability Type**: Unverified destination for privileged Kubernetes operations **Risk Level**: High ### Vulnerable Code `scripts/02-create-management-secrets.sh`: ```bash echo "==> Using context: $(kubectl config current-context 2>/dev/null || echo unknown)" : "${HCLOUD_TOKEN:?Must be set}" : "${HETZNER_ROBOT_USER:?Must be set}" : "${HETZNER_ROBOT_PASSWORD:?Must be set}" : "${SSH_KEY_NAME:?Must be set}" : "${HETZNER_SSH_PUB_PATH:?Must be set}" : "${HETZNER_SSH_PRIV_PATH:?Must be set}" [[ -f "$HETZNER_SSH_PUB_PATH" ]] || { echo "Missing public key: $HETZNER_SSH_PUB_PATH" >&2; exit 1; } [[ -f "$HETZNER_SSH_PRIV_PATH" ]] || { echo "Missing private key: $HETZNER_SSH_PRIV_PATH" >&2; exit 1; } echo "==> Creating or updating 'hetzner' secret..." kubectl create secret generic hetzner \ --from-literal=hcloud="$HCLOUD_TOKEN" \ --from-literal=robot-user="$HETZNER_ROBOT_USER" \ --from-literal=robot-password="$HETZNER_ROBOT_PASSWORD" \ --dry-run=client -o yaml | kubectl apply -f - echo "==> Creating or updating 'robot-ssh' secret..." kubectl create secret generic robot-ssh \ --from-literal=sshkey-name="$SSH_KEY_NAME" \ --from-file=ssh-privatekey="$HETZNER_SSH_PRIV_PATH" \ --from-file=ssh-publickey="$HETZNER_SSH_PUB_PATH" \ --dry-run=client -o yaml | kubectl apply -f - ``` `scripts/04-register-baremetal-hosts.sh`: ```bash echo "==> Using context: $(kubectl config current-context 2>/dev/null || echo unknown)" echo "==> Applying bare metal host manifests..." kubectl apply -f "$MANIFEST_PATH" echo "==> Current HetznerBareMetalHost objects:" kubectl get hetznerbaremetalhost ``` `scripts/05-apply-cluster.sh`: ```bash echo "==> Using context: $(kubectl config current-context 2>/dev/null || echo unknown)" echo "==> Applying ClusterStack objects..." kubectl apply -f "$S ...[truncated 3471 chars]
Remediation
<![CDATA[ ## Remediation Suggestions - Require explicit `--kubeconfig`, `--context`, and `--namespace` parameters for every script that performs Kubernetes writes. - Do not silently fall back to the ambient current context for secret creation or infrastructure mutation. - Resolve and display the API server URL, context, authenticated identity, and target namespace before performing writes. - Verify that the selected context corresponds to the expected SySelf management cluster and that the namespace matches the assigned organization namespace. - Reject the `default` namespace for management operations unless the user explicitly overrides the protection after reviewing the risk. - Add a confirmation prompt before credential upload, bare-metal registration, and cluster creation. Provide an explicit noninteractive flag for controlled automation. - Pass the validated kubeconfig, context, and namespace to every `kubectl` invocation rather than relying on process-global state. - Perform authorization preflight checks with `kubectl auth can-i` for only the required resources and verbs. - Use Kubernetes credentials restricted to the assigned organization namespace and to the minimum required resource types and operations. - Separate validation from mutation and terminate immediately if the context, endpoint, namespace, or authenticated identity does not match expectations. - Rotate all credentials and SSH keys if they may already have been submitted to an unintended cluster. ]]>
Vulnerability Patterns
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
Findings (84)

Credential Access

High
Category
Privilege Escalation
Content
fi

if [[ ! -f "$KUBECONFIG_PATH" ]]; then
	echo "Kubeconfig file not found: $KUBECONFIG_PATH" >&2
	exit 1
fi
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
echo "Usage: $0 <workload-kubeconfig-path>" >&2
}

WORKLOAD_KUBECONFIG="${1:-${KUBECONFIG:-}}"

if [[ -z "$WORKLOAD_KUBECONFIG" ]]; then
	usage
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
echo "Usage: $0 <workload-kubeconfig-path>" >&2
}

WORKLOAD_KUBECONFIG="${1:-${KUBECONFIG:-}}"

if [[ -z "$WORKLOAD_KUBECONFIG" ]]; then
	usage
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
echo "Usage: $0 <workload-kubeconfig-path>" >&2
}

WORKLOAD_KUBECONFIG="${1:-${KUBECONFIG:-}}"

if [[ -z "$WORKLOAD_KUBECONFIG" ]]; then
	usage
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
echo "Usage: $0 <workload-kubeconfig-path>" >&2
}

WORKLOAD_KUBECONFIG="${1:-${KUBECONFIG:-}}"

if [[ -z "$WORKLOAD_KUBECONFIG" ]]; then
	usage
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
echo "Usage: $0 <workload-kubeconfig-path>" >&2
}

WORKLOAD_KUBECONFIG="${1:-${KUBECONFIG:-}}"

if [[ -z "$WORKLOAD_KUBECONFIG" ]]; then
	usage
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
echo "Usage: $0 <workload-kubeconfig-path>" >&2
}

WORKLOAD_KUBECONFIG="${1:-${KUBECONFIG:-}}"

if [[ -z "$WORKLOAD_KUBECONFIG" ]]; then
	usage
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
echo "Usage: $0 <workload-kubeconfig-path>" >&2
}

WORKLOAD_KUBECONFIG="${1:-${KUBECONFIG:-}}"

if [[ -z "$WORKLOAD_KUBECONFIG" ]]; then
	usage
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
echo "Usage: $0 <workload-kubeconfig-path>" >&2
}

WORKLOAD_KUBECONFIG="${1:-${KUBECONFIG:-}}"

if [[ -z "$WORKLOAD_KUBECONFIG" ]]; then
	usage
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
echo "Usage: $0 <workload-kubeconfig-path>" >&2
}

WORKLOAD_KUBECONFIG="${1:-${KUBECONFIG:-}}"

if [[ -z "$WORKLOAD_KUBECONFIG" ]]; then
	usage
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
echo "Usage: $0 <workload-kubeconfig-path>" >&2
}

WORKLOAD_KUBECONFIG="${1:-${KUBECONFIG:-}}"

if [[ -z "$WORKLOAD_KUBECONFIG" ]]; then
	usage
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
echo "Usage: $0 <workload-kubeconfig-path>" >&2
}

WORKLOAD_KUBECONFIG="${1:-${KUBECONFIG:-}}"

if [[ -z "$WORKLOAD_KUBECONFIG" ]]; then
	usage
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
echo "Usage: $0 <workload-kubeconfig-path>" >&2
}

WORKLOAD_KUBECONFIG="${1:-${KUBECONFIG:-}}"

if [[ -z "$WORKLOAD_KUBECONFIG" ]]; then
	usage
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
echo "Usage: $0 <workload-kubeconfig-path>" >&2
}

WORKLOAD_KUBECONFIG="${1:-${KUBECONFIG:-}}"

if [[ -z "$WORKLOAD_KUBECONFIG" ]]; then
	usage
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
echo "Usage: $0 <workload-kubeconfig-path>" >&2
}

WORKLOAD_KUBECONFIG="${1:-${KUBECONFIG:-}}"

if [[ -z "$WORKLOAD_KUBECONFIG" ]]; then
	usage
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
echo "Usage: $0 <workload-kubeconfig-path>" >&2
}

WORKLOAD_KUBECONFIG="${1:-${KUBECONFIG:-}}"

if [[ -z "$WORKLOAD_KUBECONFIG" ]]; then
	usage
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
echo "Usage: $0 <workload-kubeconfig-path>" >&2
}

WORKLOAD_KUBECONFIG="${1:-${KUBECONFIG:-}}"

if [[ -z "$WORKLOAD_KUBECONFIG" ]]; then
	usage
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
echo "Usage: $0 <workload-kubeconfig-path>" >&2
}

WORKLOAD_KUBECONFIG="${1:-${KUBECONFIG:-}}"

if [[ -z "$WORKLOAD_KUBECONFIG" ]]; then
	usage
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
echo "Usage: $0 <workload-kubeconfig-path>" >&2
}

WORKLOAD_KUBECONFIG="${1:-${KUBECONFIG:-}}"

if [[ -z "$WORKLOAD_KUBECONFIG" ]]; then
	usage
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
echo "Usage: $0 <workload-kubeconfig-path>" >&2
}

WORKLOAD_KUBECONFIG="${1:-${KUBECONFIG:-}}"

if [[ -z "$WORKLOAD_KUBECONFIG" ]]; then
	usage
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
echo "Usage: $0 <workload-kubeconfig-path>" >&2
}

WORKLOAD_KUBECONFIG="${1:-${KUBECONFIG:-}}"

if [[ -z "$WORKLOAD_KUBECONFIG" ]]; then
	usage
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
echo "Usage: $0 <workload-kubeconfig-path>" >&2
}

WORKLOAD_KUBECONFIG="${1:-${KUBECONFIG:-}}"

if [[ -z "$WORKLOAD_KUBECONFIG" ]]; then
	usage
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
echo "Usage: $0 <workload-kubeconfig-path>" >&2
}

WORKLOAD_KUBECONFIG="${1:-${KUBECONFIG:-}}"

if [[ -z "$WORKLOAD_KUBECONFIG" ]]; then
	usage
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
echo "Usage: $0 <workload-kubeconfig-path>" >&2
}

WORKLOAD_KUBECONFIG="${1:-${KUBECONFIG:-}}"

if [[ -z "$WORKLOAD_KUBECONFIG" ]]; then
	usage
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
echo "Usage: $0 <workload-kubeconfig-path>" >&2
}

WORKLOAD_KUBECONFIG="${1:-${KUBECONFIG:-}}"

if [[ -z "$WORKLOAD_KUBECONFIG" ]]; then
	usage
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Static analysis

No suspicious patterns detected.