Back to skill

Security audit

Database Query Best Practices

Security checks for vulnerabilities and agentic risk

Overview

The skill is a legitimate database troubleshooting guide, but it recommends overly broad commands that can kill unrelated local processes or terminate production database sessions without enough scoping or confirmation.

Review this skill carefully before installing. Its general advice to close database connections is useful, but do not let an agent run the documented `pkill -9` or `pg_terminate_backend` commands automatically. Replace them with scoped, preview-first procedures that show affected processes or database sessions and require explicit approval before termination.

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
SKILL.md:133
Finding

Unscoped Forced Termination of Local Development Processes

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
SKILL.md:198
Finding

Overbroad Termination of Production Database Sessions

Content
View full analysis
Remediation
View remediation
pg_backend_pid()`. 5. Exclude administrative, migration, monitoring, replication, and other protected sessions. 6. Require explicit human confirmation after displaying PID, user, application, client address, state, and idle duration. 7. Terminate sessions individually or in small bounded batches and monitor connection usage after each batch. 8. Run the recovery query through a least-privileged operational role whose termination rights are limited to project-owned sessions. 9. Prefer fixing application pool sizing, connection leaks, and server-side idle timeouts over routinely terminating sessions. A safer candidate-selection pattern would be: ```sql SELECT pid, usename, application_name, client_addr, state, state_change FROM pg_stat_activity WHERE datname = 'railway' AND usename = '' AND application_name = '' AND state = 'idle' AND state_change < NOW() - INTERVAL '10 minutes' AND pid <> pg_backend_pid(); ``` Termination should occur only after the returned rows have been reviewed. ]]>

T09 · Insecure Skill Coding Practices

Note
Location
SKILL.md:85
Finding

Uninitialized Cursor Variable Masks Database Connection Failures

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep

Static analysis

No suspicious patterns detected.