Back to skill

Security audit

PostgreSQL Database

Security checks for vulnerabilities and agentic risk

Overview

This PostgreSQL skill is mostly coherent, but it can perform high-impact database changes and destructive restores without clear safeguards or confirmation guidance.

Install only if you are comfortable giving an agent PostgreSQL credentials and authority to run database operations. Use least-privileged database accounts, avoid production targets unless explicitly intended, review every mutating SQL or restore command before execution, and treat backups/schema exports as sensitive files.

Vulnerability Patterns
  • 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
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • Taint TrackingDirect Taint Flow, Variable-Mediated Taint Flow, Credential Exfiltration Chain
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
Findings (22)

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

The Chinese description likewise overstates the skill as a general-purpose PostgreSQL operations tool while the detected implementation appears much narrower and centered on schema metadata export. In multilingual manifests, inconsistent or inflated descriptions can cause users and orchestration logic to invoke the skill for actions it is not designed or reviewed to perform.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

The Chinese description likewise overstates the skill as a general-purpose PostgreSQL operations tool while the detected implementation appears much narrower and centered on schema metadata export. In multilingual manifests, inconsistent or inflated descriptions can cause users and orchestration logic to invoke the skill for actions it is not designed or reviewed to perform.

Content

No source excerpt is available for this finding.

Env Variable Harvesting

High
Category
Data Exfiltration
Confidence
60% confidence
Finding

Code enumerates, copies, or searches environment variables for secrets. Bulk environment access can collect credentials unrelated to the skill's stated purpose.

Content

Scanner excerpt · scripts/backup.py (reported line 16)May include surrounding context.

python
def get_env(dbname=None):
    """Get environment for pg_dump"""
    env = os.environ.copy()
    env['PGHOST'] = os.environ.get('PGHOST', 'localhost')
    env['PGPORT'] = os.environ.get('PGPORT', '5432')
    env['PGDATABASE'] = dbname or os.environ.get('PGDATABASE', 'postgres')

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
95% confidence
Finding

The skill advertises database querying, backup, and schema export capabilities but does not declare any tool scope or permissions despite requiring shell, filesystem, and environment-variable access. In an agent setting, this creates an overbroad and opaque execution surface where sensitive credentials, local files, and shell commands may be accessed without explicit review or restriction.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The trigger phrases are broad and open-ended, covering general mentions of PostgreSQL, SQL queries, schema, and backups without boundaries or exclusions. In an agent environment, this can cause the skill to activate in contexts involving sensitive production databases or destructive requests, even when a narrower, safer tool would be more appropriate.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The skill description includes INSERT/UPDATE/DELETE and backup/restore capabilities but provides no warning about data loss, modification risk, or the need for explicit confirmation before destructive actions. In the database context, this materially increases the chance of accidental writes, restores, or recovery steps impacting live systems.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The document includes destructive database commands like DROP DATABASE without any caution, confirmation guidance, or backup prerequisites. In a database operations skill, users may copy commands directly, and omission of safety context materially increases the risk of accidental irreversible data loss or service disruption.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

Showing DROP TABLE without warning can lead users to remove entire tables irreversibly, including schema and data. Because this skill is meant for operational PostgreSQL usage, the command is especially likely to be executed verbatim in real environments.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

DELETE FROM examples are presented without emphasizing the importance of restrictive WHERE clauses, transaction use, or rollback planning. This can easily cause mass deletion of production data if a user omits or mis-specifies the condition.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The pg_restore command uses the cleanup option (-c), which can drop existing database objects before restore, yet no warning explains overwrite or destruction risk. In an admin-focused skill, this omission can lead to accidental replacement or loss of live database contents.

Content

No source excerpt is available for this finding.

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/backup.py (reported line 57)May include surrounding context.

python
env = get_env(dbname)
    
    try:
        result = subprocess.run(cmd, env=env, capture_output=True, text=True)
        if result.returncode == 0:
            size = os.path.getsize(backup_path)
            print(f"Backup created: {backup_path} ({size:,} bytes)")

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/backup.py (reported line 90)May include surrounding context.

python
env = get_env(dbname)
    
    try:
        result = subprocess.run(cmd, env=env, capture_output=True, text=True)
        if result.returncode == 0:
            size = os.path.getsize(backup_path)
            print(f"Backup created: {backup_path} ({size:,} bytes)")

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/backup.py (reported line 124)May include surrounding context.

python
env = get_env(dbname)
    
    try:
        result = subprocess.run(cmd, env=env, capture_output=True, text=True)
        if result.returncode == 0:
            size = os.path.getsize(backup_path)
            print(f"Backup created: {backup_path} ({size:,} bytes)")

Tainted flow: 'cmd' from os.environ.get (line 119, credential/environment) → subprocess.run (code execution)

Medium
Category
Data Flow
Confidence
65% confidence
Finding

Data from a source is assigned to a variable that is later passed to a sink, creating a variable-mediated taint flow.

Content

Scanner excerpt · scripts/backup.py (reported line 57)May include surrounding context.

python
env = get_env(dbname)
    
    try:
        result = subprocess.run(cmd, env=env, capture_output=True, text=True)
        if result.returncode == 0:
            size = os.path.getsize(backup_path)
            print(f"Backup created: {backup_path} ({size:,} bytes)")

Tainted flow: 'cmd' from os.environ.get (line 119, credential/environment) → subprocess.run (code execution)

Medium
Category
Data Flow
Confidence
65% confidence
Finding

Data from a source is assigned to a variable that is later passed to a sink, creating a variable-mediated taint flow.

Content

Scanner excerpt · scripts/backup.py (reported line 90)May include surrounding context.

python
env = get_env(dbname)
    
    try:
        result = subprocess.run(cmd, env=env, capture_output=True, text=True)
        if result.returncode == 0:
            size = os.path.getsize(backup_path)
            print(f"Backup created: {backup_path} ({size:,} bytes)")

Tainted flow: 'cmd' from os.environ.get (line 119, credential/environment) → subprocess.run (code execution)

Medium
Category
Data Flow
Confidence
65% confidence
Finding

Data from a source is assigned to a variable that is later passed to a sink, creating a variable-mediated taint flow.

Content

Scanner excerpt · scripts/backup.py (reported line 124)May include surrounding context.

python
env = get_env(dbname)
    
    try:
        result = subprocess.run(cmd, env=env, capture_output=True, text=True)
        if result.returncode == 0:
            size = os.path.getsize(backup_path)
            print(f"Backup created: {backup_path} ({size:,} bytes)")

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The restore operation always uses --clean, which drops existing database objects, yet the CLI provides no explicit warning, dry-run mode, or confirmation gate before destructive execution. In a database administration skill, this is more dangerous because users are likely to run it against production-like systems and may assume restore is non-destructive or reversible.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The script executes any SQL string passed via the --query argument directly with cur.execute(query), including write, schema-changing, and potentially destructive statements. In the context of an agent skill, this is dangerous because an LLM or downstream caller could be induced to run DROP, UPDATE, DELETE, COPY, or privilege-altering commands without any confirmation, policy checks, or restriction to read-only queries.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
72% confidence
Finding

The manifest description presents activation cues in Chinese, such as "用户提到" and several Chinese trigger terms, while the rest of the document is primarily in English. This may impose a language-specific activation policy without explicit user opt-in or documented justification.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
88% confidence
Finding

The manifest instructs users to supply database credentials via environment variables but gives no privacy or credential-handling guidance. In practice, this can lead to secret exposure through logs, shell history, subprocess inheritance, debugging output, or accidental disclosure in backups and exported artifacts.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
80% confidence
Finding

The entire skill content is presented in Chinese, with no indication that language choice is configurable or that the resource is intentionally scoped to a Chinese-speaking audience. Per the policy rule, forcing a specific language without user opt-in can be a natural-language policy issue.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
86% confidence
Finding

This code writes the exported schema to an arbitrary output file, and schema metadata can reveal table names, column names, defaults, and relationships that may be sensitive in some environments. Although the script prints a success message after writing, there is no prior user-facing warning in the code comments, docstring, or interface about the sensitivity of the exported content.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.