T09 · Insecure Skill Coding Practices
- Location
templates/modes_switch.py:387- Finding
Port-Only Service Identification Can Terminate Unrelated Processes
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill is coherent and mostly disclosed, but it can change VPN state and stop/start local processes with weak safeguards that could affect unrelated processes or connectivity.
Review the YAML carefully before use, run only selftests and dry runs first, and avoid running the switcher with administrator privileges. Do not schedule the watchdog or use real VPN/service commands until process ownership checks and VPN unknown-state handling are tightened, because a mode switch can disrupt connectivity or terminate unrelated local processes.
templates/modes_switch.py:387Port-Only Service Identification Can Terminate Unrelated Processes
templates/modes_switch.py:274Weak PID-File Validation Can Target Reused or Attacker-Selected Processes
templates/modes_switch.py:326VPN Status Failures Are Incorrectly Treated as a Disconnected State
Referenced artifact was not completely inspected
| `SKILL.md` | this file |
Skill manipulates agent memory, state, or stored context. Memory corruption can alter personality, override safety rules, or cause unpredictable behavior.
assert load_wd_state(base_cfg, tmp) == {}, "missing state file -> fail open"
with open(wd_state_path(base_cfg, tmp), "w", encoding="utf-8") as f:
f.write("{not json")
assert load_wd_state(base_cfg, tmp) == {}, "corrupt state file -> fail open"
save_wd_state(base_cfg, tmp, {"repair_ts": [1.0]})
assert load_wd_state(base_cfg, tmp) == {"repair_ts": [1.0]}, "round trip"
import shutil
This markdown file states that one command can flip the whole machine stack, including VPN, background agents, local services, and model tier, but it does not include any warning about service disruption, connectivity changes, or other impacts to the user's system. For markdown files, descriptions that imply changes affecting system integrity or availability should disclose those risks.
This markdown file includes a command to 'flip the real machine' and elsewhere explains that modes control VPN state, background agents, and local services. Although functionality is described, there is no direct user warning near the real-machine command that running it will actively stop or start components and may disrupt connectivity or running workflows.
The skill describes and instructs use of local scripts that read and write files and execute shell commands, but it does not declare any explicit tool scope such as permissions or allowed-tools. That creates a mismatch between documented behavior and enforcement, increasing the risk that an agent runtime grants broader-than-expected filesystem and command execution access when the skill is invoked.
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
def _run(argv, timeout=15, cwd=None):
return subprocess.run(argv, capture_output=True, text=True, timeout=timeout,
cwd=cwd, encoding="utf-8", errors="replace",
creationflags=_NO_WINDOW)
This code launches detached background processes from configuration-controlled argv and cwd values without any trust boundary enforcement, signature check, or executable allowlist. In the context of a skill that explicitly starts and stops VPNs, agents, and services, a malicious or tampered modes.yaml can cause arbitrary code execution whenever a mode switch occurs, and the detached/no-console design makes such execution less visible to the user.
kwargs["creationflags"] = _DETACH
else:
kwargs[_ON_WINDOWS_FLAG] = True
subprocess.Popen([str(a) for a in argv], **kwargs)
log(f"started {what or argv[0]}")
No suspicious patterns detected.