Back to skill

Security audit

l4d2-server

Security checks for vulnerabilities and agentic risk

Overview

This skill matches its L4D2 server-admin purpose, but it needs Review because it enables unrestricted RCON control and handles RCON secrets in ways that can leak them.

Install only if you administer the target L4D2 servers and understand that RCON grants live administrative control. Keep RCON off public networks, use a VPN or SSH tunnel, restrict firewall access, avoid putting passwords on the command line, lock config files to the owner, and manually confirm any command that changes maps, kicks/bans players, toggles cheats, or alters server state.

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

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/rcon_cmd.py:137
Finding
RCON Password Exposed Through Command-Line Arguments<![CDATA[ ## Vulnerability Details **File Location**: `scripts/rcon_cmd.py:137-139` **Vulnerability Type**: Credential exposure through process arguments and shell history **Risk Level**: Medium ### Vulnerable Code ```python host = sys.argv[1] port = int(sys.argv[2]) password = sys.argv[3] ``` The documented invocation in `SKILL.md:86-89` also explicitly places the password on the command line: ```bash python3 scripts/rcon_cmd.py <host> <port> <password> <command> ``` ### Technical Analysis The RCON password is supplied through `argv`. Depending on the operating system and process-monitoring configuration, command-line arguments can be visible to other local users, administrators, monitoring agents, process accounting systems, diagnostic collectors, and CI/CD logs. If an operator types the documented command into an interactive shell, the complete command—including the plaintext password—may also be retained in shell history. Although the Python script does not print the password directly, reading it from `sys.argv[3]` causes the secret to cross multiple disclosure-prone interfaces before authentication occurs. ### Attack Path 1. An administrator invokes the script using the documented syntax and includes the RCON password in the command line. 2. The complete invocation is recorded in shell history, process telemetry, audit logs, or a process listing while the command is running. 3. A local user or service with access to one of those sources obtains the plaintext password. 4. The attacker connects to the configured game server's RCON port. 5. The attacker authenticates with the recovered password and executes any command permitted by the RCON service. ### Impact Assessment Successful exploitation exposes the server's RCON administrative credential. The attacker may execute privileged game-server commands, change maps and server settings, enable cheats, remove or ban players, disrupt active sessions, and invoke commands exposed by installed server pl ...[truncated 167 chars]
Remediation
<![CDATA[ ## Remediation Suggestions - Remove the password positional argument from the command-line interface. - Prompt for the password using Python's `getpass.getpass()` so input is not echoed or stored in shell history. - Alternatively, read the secret from a permission-protected file descriptor or a dedicated secret-management system. - If a configuration file is used, require ownership by the executing user and mode `0600` before reading it. - Avoid exposing the password through environment variables where process or diagnostic tooling can inspect them. - Update all examples in `SKILL.md` so they no longer encourage placing credentials in command-line arguments. - Rotate any password that has previously been used with the documented invocation method. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
SKILL.md:102
Finding
Plaintext RCON Configuration Is Updated Through an Insecure Predictable Temporary File<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:102-111` **Vulnerability Type**: Insecure temporary-file handling and insufficient credential permission enforcement **Risk Level**: Medium ### Vulnerable Code ```bash cat ~/.openclaw/workspace/config/l4d2-servers.json ``` ```bash jq '.servers.myserver = {"host": "192.168.1.100", "port": 27015, "rcon_password": "xxx"}' \ ~/.openclaw/workspace/config/l4d2-servers.json > /tmp/l4d2.json && \ mv /tmp/l4d2.json ~/.openclaw/workspace/config/l4d2-servers.json ``` The configuration described in `SKILL.md:19-27` stores the credential directly in the JSON file: ```json { "servers": { "alias": { "host": "192.168.1.100", "port": 27015, "rcon_password": "your_rcon_password" } } } ``` ### Technical Analysis The documented update procedure writes the complete configuration, including the plaintext RCON password, to the fixed shared path `/tmp/l4d2.json`. It does not set a restrictive `umask`, use an securely generated temporary filename, verify file ownership, or explicitly apply mode `0600`. On a multi-user system, a permissive process `umask` can cause the temporary file to be created with permissions that allow another user to read it. A predictable shared pathname also creates race and pre-creation risks. Depending on operating-system hardening and existing filesystem permissions, an attacker may attempt to pre-create or manipulate that path before the privileged user runs the command. The final `mv` also replaces the configuration with the temporary file's permissions. Consequently, even if the original configuration was protected, the replacement file may become more broadly readable. ### Attack Path 1. An administrator follows the documented `jq` command to add or modify a server. 2. The complete configuration, including every stored RCON password, is written to the predictable `/tmp/l4d2.json` path. 3. If the administrator's `umask` permits group or world acce ...[truncated 1020 chars]
Remediation
<![CDATA[ ## Remediation Suggestions - Create the configuration directory with mode `0700` and configuration files with mode `0600`. - Set `umask 077` before creating any file containing credentials. - Replace the fixed `/tmp/l4d2.json` path with `mktemp` in the protected configuration directory. - Install the completed file atomically and preserve restrictive permissions. - Verify that the configuration is a regular file owned by the current user before reading it. - Do not follow symbolic links when opening security-sensitive configuration files where supported. - Prefer a secret manager or operating-system credential store instead of embedding RCON passwords directly in JSON. - A safer documented pattern would be: ```bash umask 077 config="$HOME/.openclaw/workspace/config/l4d2-servers.json" tmp="$(mktemp "$HOME/.openclaw/workspace/config/.l4d2-servers.XXXXXX")" || exit 1 jq '.servers.myserver = {"host":"192.168.1.100","port":27015,"rcon_password":"xxx"}' \ "$config" > "$tmp" && chmod 600 "$tmp" && mv -- "$tmp" "$config" ``` - Ensure cleanup traps remove the temporary file if processing fails. - Rotate credentials if the configuration was previously written with permissive permissions. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/rcon_cmd.py:67
Finding
RCON Credentials and Administrative Commands Are Transmitted Without Transport Encryption<![CDATA[ ## Vulnerability Details **File Location**: `scripts/rcon_cmd.py:67-74` **Vulnerability Type**: Cleartext transmission of administrative credentials and commands **Risk Level**: Medium ### Vulnerable Code ```python sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.settimeout(timeout) try: sock.connect((host, port)) auth_packet = create_packet(1, SERVERDATA_AUTH, password) sock.sendall(auth_packet) ``` ### Technical Analysis The client opens a direct TCP socket and sends the RCON authentication packet without TLS or another encrypted transport. The password is encoded into the packet body and transmitted over the network using the native RCON protocol. An attacker able to observe traffic between the client and server may capture the authentication exchange, commands, and responses. An attacker able to manipulate the network path may also interfere with the connection or impersonate the intended endpoint because the client performs no cryptographic server authentication. This is partly a limitation of the underlying RCON protocol, but the skill does not enforce or provide an encrypted tunnel and does not restrict use to trusted network paths. ### Attack Path 1. An administrator runs the RCON client against a server over a shared, compromised, or otherwise untrusted network. 2. An attacker with a suitable network position captures the TCP traffic or redirects the connection. 3. The attacker extracts the RCON password from the cleartext authentication packet. 4. The attacker connects to the real server's RCON port using the captured credential. 5. The attacker executes privileged game-server commands. ### Impact Assessment A successful interception exposes both the RCON password and administrative activity. The attacker can gain the same game-server privileges as the legitimate administrator, including modifying server settings, disrupting sessions, changing maps, and invoking installed plugin commands. The vulnerabil ...[truncated 196 chars]
Remediation
<![CDATA[ ## Remediation Suggestions - Do not expose RCON directly over public or untrusted networks. - Require access through a trusted VPN, SSH tunnel, or another authenticated encrypted channel. - Restrict the RCON port with host and network firewalls to approved management addresses. - Document clearly that native RCON does not provide transport confidentiality. - Where practical, bind the RCON service to a private management interface. - Rotate the RCON password after any suspected network interception. - Use a unique, high-entropy password and do not reuse it for other systems. - Consider adding an operational safeguard that refuses connections to non-private destinations unless an explicit override confirms that an encrypted tunnel is in use. ]]>
Vulnerability Patterns
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (8)

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding
代码行为与描述部分重合:它确实执行 A2S 协议查询并解析服务器状态,且适用于 L4D2 等 Source 引擎服务器。但声明中的另外两项核心能力——多服务器信息管理、RCON 命令执行——在该代码片段中完全没有体现。代码也没有任何服务器持久化存储、别名管理、配置管理或 RCON 网络交互逻辑。因此,当前代码只覆盖了声明中的一部分功能,且实际更像是单一的 A2S 查询工具,而不是完整的“L4D2 服务器管理助手”。

Missing User Warnings

High
Confidence
95% confidence
Finding
The skill advertises direct RCON execution and lists destructive or administrative commands like map changes, kicks, bans, cheat toggles, and entity deletion, but does not prominently warn about their operational impact or require safeguards. In the context of a remote game-server administration skill, insufficient warning and lack of explicit safety controls can enable accidental or unauthorized disruptive actions against live servers.

Vague Triggers

Medium
Confidence
94% confidence
Finding
该 markdown 文件适用 SQP-1。L003 中将“L4D2、求生之路、服务器状态、rcon、a2s 查询”统称为触发词,其中“服务器状态”表述较泛,而整组触发词也未说明必须组合出现、适用上下文或排除条件,容易与一般聊天或其他服务器排障场景重叠。

Missing User Warnings

Medium
Confidence
92% confidence
Finding
The documentation states that RCON status output may include player IP addresses and related connection details, but it does not frame this as sensitive data exposure or advise minimization. In this skill's context, querying and displaying player network metadata can leak personal or semi-sensitive information to operators or downstream logs, increasing privacy and compliance risk.

Natural-Language Policy Violations

Medium
Confidence
90% confidence
Finding
The file’s docstring and CLI usage/help text are presented only in Chinese, which imposes a specific language on users without any opt-in or alternative. The policy explicitly calls for flagging language or locale constraints when they are forced rather than optional or justified as region-specific.

Vague Triggers

Low
Confidence
82% confidence
Finding
This JSON file is a manifest/config-type file, so vague-trigger review applies. The entry is broadly labeled as an example configuration without any narrowing metadata or constraints describing when it should be used versus ignored, which can contribute to ambiguous activation or unintended use in systems that ingest config examples directly.

Natural-Language Policy Violations

Low
Confidence
93% confidence
Finding
The description field is written in Chinese, and the file provides no indication that language selection is optional or that the configuration is intentionally region-specific. Under the language/locale policy, hardcoding a specific language without user opt-in or justification can be a natural-language policy concern.

Natural-Language Policy Violations

Low
Confidence
96% confidence
Finding
The module docstring and user-facing usage text are written only in Chinese, and later help/error output is also Chinese-only. For a general-purpose utility, this imposes a language choice on users without opt-in or a documented region/language limitation.

Static analysis

No suspicious patterns detected.