T09 · Insecure Skill Coding Practices
- Location
scripts/main.py:45- Finding
Database Password Exposure Through Command-Line Arguments
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill does provide database access as advertised, but it handles saved connection data, credentials, and database-changing commands too loosely for a clean install.
Review before installing. Use only least-privilege database accounts, avoid production mutation unless explicitly intended, avoid --batch for untrusted SQL, do not pass literal passwords or shell-expanded secrets on the command line, do not embed credentials in database URLs, and avoid this on shared machines unless the connection store is moved to a private protected location and TLS is enforced.
scripts/main.py:45Database Password Exposure Through Command-Line Arguments
scripts/connections_store.py:142Connection Metadata Stored in a Predictable Temporary File Without Explicit Access Controls
scripts/main.py:132Unredacted Database URLs Are Persisted and Printed
scripts/connection_manager.py:177Database Authentication and Query Traffic Are Not Protected by Enforced TLS
Persisting database connection records to a temp-directory JSON file creates a real security concern even if passwords are omitted, because URLs, usernames, hostnames, and driver metadata are sensitive operational information. In multi-user or weakly isolated environments, temp directories may expose connection inventories that aid lateral movement, credential targeting, or reconnaissance against internal databases.
Persisting database connection records to a temp-directory JSON file creates a real security concern even if passwords are omitted, because URLs, usernames, hostnames, and driver metadata are sensitive operational information. In multi-user or weakly isolated environments, temp directories may expose connection inventories that aid lateral movement, credential targeting, or reconnaissance against internal databases.
Persisting database connection records to a temp-directory JSON file creates a real security concern even if passwords are omitted, because URLs, usernames, hostnames, and driver metadata are sensitive operational information. In multi-user or weakly isolated environments, temp directories may expose connection inventories that aid lateral movement, credential targeting, or reconnaissance against internal databases.
The code claims plain-text passwords are never persisted, but to_dict() always serializes the full url, and many database URL formats allow embedded credentials such as user:password@host or password query parameters. This can silently store secrets on disk in a predictable temp-directory file, creating credential exposure to other local users, backup systems, or forensic recovery.
Skill manipulates agent memory, state, or stored context. Memory corruption can alter personality, override safety rules, or cause unpredictable behavior.
self._cm.close_connection(conn)
def execute_update(self, sql: str, *params: Any) -> int:
"""Execute an UPDATE, INSERT, or DELETE statement.
Args:
sql: SQL statement with ``?`` placeholders.
The skill declares significant capabilities—environment-variable access, file read/write, and network/database connectivity—but does not define any explicit tool scope or permission boundaries. In an agent setting, this increases the chance of overbroad execution, misuse of credentials, unintended data exfiltration, or destructive database operations because the agent may invoke capabilities beyond what users expect.
This code expands ${VAR} placeholders by reading from process environment variables, which can expose or consume sensitive credentials without any confirmation prompt, user-facing log, or warning comment/docstring about that behavior. For code files, access to sensitive environment variables should have some visible disclosure unless clearly documented elsewhere.
Connection metadata is written to a JSON file in the system temp directory without any explicit disclosure or consent flow. In this skill context, saved records may include sensitive infrastructure details such as internal hosts, database names, usernames, labels, and potentially credentials via the URL, making temp-directory persistence materially riskier than ordinary application state.
The CLI explicitly supports UPDATE/INSERT/DELETE operations, and later executes them directly via execute_update without any confirmation prompt or upfront warning about modifying database state. Because these are potentially destructive or irreversible operations, the file should provide some visible disclosure beyond the terse argument help.
The --batch option accepts a file of SQL statements and _do_batch executes them all, which can include destructive changes, but the code provides no confirmation prompt or explicit warning about the risk. This is a safety-critical operation because it can modify or destroy large amounts of data in one run.