T09 · Insecure Skill Coding Practices
- Location
scripts/netdiag.py:1774- Finding
Configuration Validation Exposes Telegram Credentials
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This is a coherent Telegram network diagnostics skill, but it should be reviewed carefully because it can expose bot credentials, send live Telegram messages, and run as a persistent background network worker.
Install only if you control the Telegram bot, chat, host, and config files. Keep telegram_api_host set to api.telegram.org unless you intentionally trust another endpoint, keep redaction enabled, protect or minimize logs, avoid --proxy until the plaintext runtime-config behavior is fixed, prefer foreground mode for testing, and rotate the bot token if validate-config output or .netdiag.runtime.config.json may have exposed it.
scripts/netdiag.py:1774Configuration Validation Exposes Telegram Credentials
scripts/netdiag.py:1834Proxy Override Persists a Plaintext Copy of the Bot Token
scripts/netdiag.py:1247Unrestricted API Host Can Redirect Bot Credentials to a Non-Telegram Server
scripts/netdiag.py:1710Unverified PID File Can Terminate an Unrelated Process
The skill describes operational behavior that clearly relies on shell execution, file reads/writes, and likely environment access for credentials, but it does not declare any explicit tool scope or permissions boundary. This increases the chance that an agent runs the skill with broader-than-necessary capabilities, making unintended command execution, file access, or secret exposure harder to review and constrain.
The skill actively sends real Telegram messages and may poll for acknowledgements from a personal chat, but the user-facing description does not prominently warn about these externally visible side effects. This can cause unintended message delivery, surprise user interaction, rate-limit exposure, or accidental testing against production accounts without informed consent.
The logging model states that records may include IPs, ports, DNS snapshots, TLS metadata, HTTP headers, payload sizes, rate-limit metadata, and stack traces, yet the skill lacks a clear warning that these logs can contain sensitive operational and network information. If logs are retained, shared, or analyzed later, they may expose infrastructure details, identifiers, or secrets-in-context that increase reconnaissance and privacy risk.
The script executes external networking tools such as dig, traceroute, and ping, which gives the skill direct host-level probing capability. While arguments are mostly fixed, this still broadens the attack surface and can be abused for reconnaissance, traffic generation, or running privileged diagnostics from within the agent environment.
The skill includes start/stop/status process-management and persistent background execution via PID files and signals, which exceeds pure diagnostics and creates session persistence on the host. In an agent skill context, this is risky because it enables long-lived autonomous activity and can continue network probing or message sending after the initial invocation ends.
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
"--background",
]
process = subprocess.Popen(
cmd,
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL,
The explicit 'start background worker' capability provides persistence beyond the immediate command session. In a security-sensitive agent ecosystem, persistence materially increases risk because the tool can continue polling Telegram, generating logs, and interacting with the network without continuous operator awareness.
run_parser.add_argument("--pid-file", default="./logs/netdiag.pid", help="PID file path")
run_parser.add_argument("--background", action="store_true", help=argparse.SUPPRESS)
start_parser = sub.add_parser("start", help="Start background worker")
start_parser.add_argument("--config", help="Path to config JSON")
start_parser.add_argument("--proxy", help="Override proxy URL")
start_parser.add_argument("--pid-file", default="./logs/netdiag.pid", help="PID file path")
When --proxy is used, the code writes a .netdiag.runtime.config.json file containing the merged configuration, including bot token and personal chat ID, without warning or permission hardening. This creates a plaintext secret-spillage risk on disk, especially in shared workspaces, repositories, backups, or multi-user systems.
Dynamic getattr() with a non-literal attribute name can access arbitrary object attributes, potentially bypassing access controls.
for signame in ("SIGINT", "SIGTERM"):
if hasattr(signal, signame):
sig = getattr(signal, signame)
try:
loop.add_signal_handler(sig, _handle_signal, signame)
except NotImplementedError:
No suspicious patterns detected.