Back to skill

Security audit

SONiC KVM Testbed

Security checks for vulnerabilities and agentic risk

Overview

The skill is a coherent SONiC lab setup guide, but it recommends weak default credentials and root-equivalent Docker access that should be reviewed before use.

Install only for an isolated disposable lab host. Before following it, replace all default passwords with unique secrets, avoid sshpass -p, do not set /var/run/docker.sock to 0666, avoid unrestricted NOPASSWD sudo where possible, restrict management network reachability, and pin reviewed git commits and container image digests.

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)

T05 · Unauthorized Access and Privilege Escalation

Error
Location
SKILL.md:110
Finding

Predictable Administrative Credentials with Unrestricted Passwordless Sudo

Content
View full analysis
@ # Create admin user sudo useradd -m -s /bin/bash -G sudo,docker admin echo 'admin:password' | sudo chpasswd sudo bash -c "echo 'admin ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/admin" ``` The same unsafe pattern is provided for both local and CI-built images: ```bash sudo useradd -m -s /bin/bash -G sudo,docker echo ':password' | sudo chpasswd sudo bash -c "echo ' ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/" sudo useradd -m -s /bin/bash -G sudo,docker admin echo 'admin:password' | sudo chpasswd sudo bash -c "echo 'admin ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/admin" ``` ### Technical Analysis The documented procedure creates an SSH-capable administrative account with the predictable password `password`. It then grants that account unrestricted passwordless sudo through an `ALL=(ALL) NOPASSWD:ALL` rule. This configuration violates least privilege and converts disclosure or guessing of the account password directly into root-level access. Membership in the `docker` group provides an additional root-equivalent privilege path because the account can ask the Docker daemon to start privileged containers or mount host filesystems. Although the environment is described as a virtual testbed, the management network and DUT remain reachable system components. The documentation does not require SSH key authentication, firewall restrictions, password rotation, or disabling password-based login. ### Attack Path 1. An attacker obtains network connectivity to the DUT management address, such as through the host, testbed management bridge, another testbed container, or an exposed management route. 2. The attacker identifies the doc ...[truncated 929 chars]
Remediation
View remediation

T05 · Unauthorized Access and Privilege Escalation

Error
Location
SKILL.md:117
Finding

World-Writable Docker Socket Enables Local Root Privilege Escalation

Content
View full analysis
Remediation
View remediation
&2 exit 1 fi ``` ]]>

T09 · Insecure Skill Coding Practices

Error
Location
references/credentials.md:47
Finding

Hard-Coded Default Passwords and Plaintext Vault Password

Content
View full analysis
~/sonic-mgmt/ansible/password.txt ``` ```yaml sonic_login: "" sonic_password: "password" ansible_altpassword: "YourPaSsWoRd" ``` ```yaml sonicadmin_user: "admin" sonicadmin_password: "password" sonicadmin_initial_password: "password" ``` ```bash echo "abc" > ansible/password.txt ``` The documentation also identifies reusable EOS credentials: ```text Default EOS creds are `admin` / `123456` (in `group_vars/eos/creds.yml`). ``` A password is additionally exposed as a command-line argument: ```bash sshpass -p password ssh admin@ "show ip bgp summary" ``` ### Technical Analysis The deployment instructions rely on predictable shared passwords such as `password`, `123456`, and a vault password of `abc`. These values offer negligible resistance to guessing and are publicly disclosed in the project documentation. The vault password is written to disk without an explicit restrictive file mode. Its effective permissions consequently depend on the user's `umask`. If it is readable by another account, encrypted Ansible content protected by that vault password can be decrypted. Using `sshpass -p` exposes the SSH password in the process command line on systems where other users can inspect process arguments. Commands may also be retained in shell history or operational logs. These patterns create several credential disclosure channels: - Publicly known default values. - Plaintext configuration files. - A plaintext vault-password file. - Process listings and command histories. - Accidental inclusion in backups or source control. ### Attack Path 1. An attacker reads the public deployment instructions or discovers the generated configuration files. 2. The ...[truncated 1226 chars]
Remediation
View remediation
ansible/password.txt chmod 0600 ansible/password.txt ``` 5. Add `password.txt`, credential overrides, and other secret-bearing files to `.gitignore`. 6. Avoid `sshpass -p`. Use SSH keys or, if unavoidable, a protected file descriptor or securely permissioned password file. 7. Disable or rotate vendor/default cEOS credentials during deployment. 8. Add automated secret scanning to detect known defaults and accidentally committed credentials. 9. Ensure shell history and CI logs do not record secret-bearing commands. 10. Rotate all credentials that may already have been deployed using these instructions. ]]>

T08 · Insecure Dependencies

Warning
Location
SKILL.md:45
Finding

Mutable and Unverified Third-Party Code and Container Dependencies

Content
View full analysis
Remediation
View remediation
``` 2. Verify the selected commit with a trusted signed tag or commit-signing policy. 3. Pin every container image by immutable digest: ```bash docker pull sonicdev-microsoft.azurecr.io/docker-ptf@sha256: ``` 4. Record approved commit hashes and image digests in a version-controlled lock or bill-of-materials file. 5. Verify image signatures with an appropriate tool such as Cosign and enforce trusted identities. 6. Scan retrieved images and source revisions before execution. 7. Avoid `latest` and other mutable tags in operational instructions. 8. Review privileged setup scripts at the exact pinned revision before running them. 9. Use a restricted deployment environment so a compromised dependency cannot directly access unrelated host credentials or resources. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (61)

Credential Access

High
Category
Privilege Escalation
Confidence
97% confidence
Finding

The explicit creation of password.txt containing a known static secret creates credential material on disk in plaintext. In a shared workstation, CI runner, or lab host, such files are commonly exposed through permissive permissions, backups, logs, or accidental commits.

Content

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

./setup-container.sh -n sonic-mgmt -d /data

Create vault password file

echo "abc" > ~/sonic-mgmt/ansible/password.txt

text

### 2. Configure Credentials and Settings

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
85% 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 · SKILL.md (reported line 96)May include surrounding context.

bash
# Fix configs + remove stale .bak
bash fix-configs.sh
rm -f vars/topo_<TOPO>.yml.bak

# Inside sonic-mgmt container:
./testbed-cli.sh -t vtestbed.yaml add-topo <TESTBED_NAME> password.txt

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
85% 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 · SKILL.md (reported line 126)May include surrounding context.

bash
# Fix configs + remove stale .bak
bash fix-configs.sh
rm -f vars/topo_<TOPO>.yml.bak

# Inside sonic-mgmt container:
./testbed-cli.sh -t vtestbed.yaml add-topo <TESTBED_NAME> password.txt

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
85% 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 · SKILL.md (reported line 159)May include surrounding context.

bash
# Fix configs + remove stale .bak
bash fix-configs.sh
rm -f vars/topo_<TOPO>.yml.bak

# Inside sonic-mgmt container:
./testbed-cli.sh -t vtestbed.yaml add-topo <TESTBED_NAME> password.txt

Credential Access

High
Category
Privilege Escalation
Confidence
93% confidence
Finding

Passing password.txt into operational commands indicates repeated use of the plaintext secret and increases the chance it becomes embedded in scripts, screenshots, shell history, or shared runbooks. Reuse of a weak bootstrap secret across lifecycle actions broadens the blast radius if disclosed.

Content

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

rm -f vars/topo_.yml.bak

Inside sonic-mgmt container:

./testbed-cli.sh -t vtestbed.yaml add-topo <TESTBED_NAME> password.txt

text

**Duration**: ~15-20 minutes (VM boot + cEOS startup).

Missing User Warnings

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The skill sets a predictable admin:password credential on the DUT and does so without any warning or requirement to rotate it. In a network lab environment with bridged management access, this can enable trivial unauthorized access, credential reuse attacks, and persistence if the system is ever reachable beyond the intended boundary.

Content

No source excerpt is available for this finding.

Chaining Abuse

High
Category
Tool Misuse
Confidence
95% confidence
Finding

Piping echo 'admin:password' into sudo chpasswd chains a predictable credential directly into privileged account configuration. In context, this compounds other risky instructions by creating an easily guessable admin account that also receives elevated privileges elsewhere in the document.

Content

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

md
# Create admin user
sudo useradd -m -s /bin/bash -G sudo,docker admin
echo 'admin:password' | sudo chpasswd
sudo bash -c "echo 'admin ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/admin"

# Fix docker socket

Docker Socket Access

High
Category
Privilege Escalation
Confidence
100% confidence
Finding

The skill explicitly modifies permissions on /var/run/docker.sock, which is effectively a root-equivalent control channel to the Docker daemon. In this context, any local user or compromised container/process that can access the socket can create privileged containers or mount the host filesystem to gain full host control.

Content

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

sudo bash -c "echo 'admin ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/admin"

Fix docker socket

sudo chmod 666 /var/run/docker.sock

text

### 5. Deploy Minigraph

Missing User Warnings

High
Category
Not specified by scanner
Confidence
100% confidence
Finding

Making /var/run/docker.sock world-writable effectively grants root-equivalent control over the host to any local user or process able to reach the socket. This is a severe privilege-escalation risk because Docker socket access can be used to start privileged containers, mount the host filesystem, and escape normal user boundaries.

Content

No source excerpt is available for this finding.

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
98% confidence
Finding

The chmod 666 instruction is an abusive parameter choice because it deliberately grants excessive permissions to a highly sensitive resource. Even in a local testbed, this weakens host isolation and can turn any local foothold into root-equivalent Docker control.

Content

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

sudo bash -c "echo 'admin ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/admin"

Fix docker socket

sudo chmod 666 /var/run/docker.sock

text

### 5. Deploy Minigraph

Credential Access

High
Category
Privilege Escalation
Confidence
93% confidence
Finding

This step continues the insecure plaintext credential workflow for deployment operations, reinforcing secret reuse over time. In a virtual network lab, compromise of orchestration credentials can enable unauthorized topology changes and access to DUT/neighbor systems.

Content

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

bash fix-configs.sh rm -f vars/topo_.yml.bak

./testbed-cli.sh -t vtestbed.yaml deploy-mg <TESTBED_NAME> veos_vtb password.txt

text

**Duration**: ~5-10 minutes.

Credential Access

High
Category
Privilege Escalation
Confidence
92% confidence
Finding

Using the same plaintext credential file during teardown shows the secret remains long-lived and broadly reused across the environment lifecycle. Long-lived reusable secrets materially increase exposure and are especially risky on multi-user lab hosts.

Content

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

bash
bash fix-configs.sh
rm -f vars/topo_<TOPO>.yml.bak
./testbed-cli.sh -t vtestbed.yaml remove-topo <TESTBED_NAME> password.txt

Duration: ~12-15 minutes.

Chaining Abuse

High
Category
Tool Misuse
Confidence
97% confidence
Finding

Piping a hardcoded password into 'sudo chpasswd' automates privileged credential setting in a way that is easy to copy, misuse, and leave unchanged across environments. It bakes predictable credentials into setup instructions and reduces visibility and control around secret handling.

Content

Scanner excerpt · references/credentials.md (reported line 17)May include surrounding context.

md
# For CI image (has admin, needs your local user):
ssh admin@<DUT_IP>
sudo useradd -m -s /bin/bash -G sudo,docker <your_user>
echo '<your_user>:password' | sudo chpasswd
sudo bash -c "echo '<your_user> ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/<your_user>"

# For local build (has your user, needs admin):

Chaining Abuse

High
Category
Tool Misuse
Confidence
97% confidence
Finding

This chained password-setting step assigns the predictable password 'password' to the admin account through a privileged pipeline. In combination with the subsequent passwordless sudo grant, it materially lowers the barrier to full system compromise.

Content

Scanner excerpt · references/credentials.md (reported line 23)May include surrounding context.

md
# For local build (has your user, needs admin):
ssh <your_user>@<DUT_IP>
sudo useradd -m -s /bin/bash -G sudo,docker admin
echo 'admin:password' | sudo chpasswd
sudo bash -c "echo 'admin ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/admin"

# Always fix docker socket:

Docker Socket Access

High
Category
Privilege Escalation
Confidence
99% confidence
Finding

Granting broad access to /var/run/docker.sock exposes a root-equivalent control channel to the local system. Any process able to talk to the socket can start privileged containers, mount the host filesystem, and fully compromise the host.

Content

Scanner excerpt · references/credentials.md (reported line 27)May include surrounding context.

sudo bash -c "echo 'admin ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/admin"

Always fix docker socket:

sudo chmod 666 /var/run/docker.sock

text

### Identifying the Build User

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
98% confidence
Finding

Using 'chmod 666' as a blanket fix is dangerous parameter abuse because it weakens access controls far beyond what is needed. On a Docker socket this effectively converts a troubleshooting step into a host-compromise primitive.

Content

Scanner excerpt · references/credentials.md (reported line 27)May include surrounding context.

sudo bash -c "echo 'admin ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/admin"

Always fix docker socket:

sudo chmod 666 /var/run/docker.sock

text

### Identifying the Build User

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · references/credentials.md (reported line 38)May include surrounding context.

sudo qemu-nbd --connect=/dev/nbd0 sonic-vs.img sudo mount /dev/nbd0p3 /mnt sudo mount -t squashfs /mnt/image-*/fs.squashfs /mnt2 grep -v nologin /mnt2/etc/passwd # Look for UID 1000 sudo umount /mnt2 && sudo umount /mnt && sudo qemu-nbd -d /dev/nbd0

text

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

sudo mount /dev/nbd0p3 /mnt sudo mount -t squashfs /mnt/image-*/fs.squashfs /mnt2 grep -v nologin /mnt2/etc/passwd # Look for UID 1000 sudo umount /mnt2 && sudo umount /mnt && sudo qemu-nbd -d /dev/nbd0

text

## Files to Configure

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 · references/credentials.md (reported line 39)May include surrounding context.

sudo mount /dev/nbd0p3 /mnt sudo mount -t squashfs /mnt/image-*/fs.squashfs /mnt2 grep -v nologin /mnt2/etc/passwd # Look for UID 1000 sudo umount /mnt2 && sudo umount /mnt && sudo qemu-nbd -d /dev/nbd0

text

## Files to Configure

Credential Access

High
Category
Privilege Escalation
Confidence
97% confidence
Finding

The document directs users to store admin credentials in a secrets.yml file using default hardcoded values. Even in a lab setting, embedding predictable credentials in repo-managed configuration increases the chance of credential reuse, leakage, and unauthorized access to the virtual network devices.

Content

Scanner excerpt · references/credentials.md (reported line 65)May include surrounding context.

vm_host_become_password: ''

text

### group_vars/lab/secrets.yml

```yaml
sonicadmin_user: "admin"

Credential Access

High
Category
Privilege Escalation
Confidence
96% confidence
Finding

Writing a static password into ansible/password.txt encourages plaintext credential storage on disk, where it may be leaked via source control, backups, logs, or local compromise. In this skill, the convenience guidance makes insecure handling of credentials more likely.

Content

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

use_converged_peers: true

text

### password.txt

```bash
echo "abc" > ansible/password.txt

Credential Access

High
Category
Privilege Escalation
Confidence
95% confidence
Finding

The explicit statement that EOS credentials are 'admin/123456' normalizes use of known default credentials. If those defaults remain in place, any party with network reachability to the cEOS neighbors can authenticate easily.

Content

Scanner excerpt · references/credentials.md (reported line 118)May include surrounding context.

password.txt

bash
echo "abc" > ansible/password.txt

EOS credentials

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

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

md
#    CI image → "admin", local build → your username

# 4. remove-topo (deletes DUT disk) → add-topo (re-copies from source)
./testbed-cli.sh -t vtestbed.yaml -m veos_vtb remove-topo <testbed> password.txt
./testbed-cli.sh -t vtestbed.yaml -m veos_vtb add-topo <testbed> password.txt

# 5. VERIFY the image after deploy

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

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

md
#    CI image → "admin", local build → your username

# 4. remove-topo (deletes DUT disk) → add-topo (re-copies from source)
./testbed-cli.sh -t vtestbed.yaml -m veos_vtb remove-topo <testbed> password.txt
./testbed-cli.sh -t vtestbed.yaml -m veos_vtb add-topo <testbed> password.txt

# 5. VERIFY the image after deploy

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
85% 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 64)May include surrounding context.

md
**Symptom**: `testbed-cli.sh add-topo` fails with `KeyError: 'ARISTA02T1'` (or similar).
**Cause**: Stale `vars/topo_<TOPO>.yml.bak` from a previous converged run.
**Fix**: `rm -f vars/topo_*.yml.bak` before running `add-topo`.

## Config Files Revert

Static analysis

No suspicious patterns detected.