Back to skill

Security audit

test2

Security checks for vulnerabilities and agentic risk

Overview

This is a straightforward NestJS TypeORM guidance skill, but its sample database password should be changed before use.

Install only if you are comfortable reviewing generated database configuration. Replace DB_PASSWORD=postgres and any password fallback with a required strong secret, use a dedicated least-privilege database role, and keep synchronize disabled outside local development.

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

T09 · Insecure Skill Coding Practices

Warning
Location
SKILL.md:119
Finding

Predictable Default Database Password in Generated Configuration

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 113–121 and 162–168
Vulnerability Type: Hardcoded and predictable default credential
Risk Level: Medium

The skill recommends a TypeORM configuration that silently uses the well-known password postgres when DB_PASSWORD is missing. Its environment-file example also assigns that same predictable password.

Vulnerable Code

ts
export default registerAs("database", () => ({
  type: "postgres",
  host: process.env.DB_HOST ?? "localhost",
  port: parseInt(process.env.DB_PORT ?? "5432", 10),
  username: process.env.DB_USERNAME ?? "postgres",
  password: process.env.DB_PASSWORD ?? "postgres",
  database: process.env.DB_NAME ?? "app_db",
}));
env
DB_HOST=localhost
DB_PORT=5432
DB_USERNAME=postgres
DB_PASSWORD=postgres
DB_NAME=app_db

Technical Analysis

The password fallback at line 119 causes the application to continue operating with a predictable credential rather than failing securely when DB_PASSWORD is absent. The environment example at line 167 reinforces this unsafe value and increases the likelihood that users will copy it into a deployed configuration without replacing it.

Because this file defines instructions and templates for generated NestJS applications, the vulnerability becomes exploitable when an agent applies the example to a real project and the resulting database account retains the documented password. Exploitation additionally requires network or local access to the PostgreSQL service.

Attack Path

  1. A developer or agent applies the database configuration from SKILL.md.
  2. The deployment omits DB_PASSWORD, or the provided environment example is copied without changing DB_PASSWORD=postgres.
  3. The application and database are configured to accept the predictable postgres credential.
  4. An attacker identifies an exposed or otherwise reachable PostgreSQL service.
  5. The attacker ...[truncated 778 chars]
Remediation
View remediation

Remediation Suggestions

  • Remove the password fallback and require an explicit secret:

    ts
    const password = process.env.DB_PASSWORD;
    if (!password) {
      throw new Error("DB_PASSWORD must be configured");
    }
    
  • Add startup configuration validation, such as a Joi or Zod schema, that rejects missing, empty, or known default database credentials.

  • Replace the value in .env.example with a clearly nonfunctional placeholder:

    env
    DB_PASSWORD=replace-with-a-strong-secret
    
  • Provision a unique, randomly generated password through a secret manager or protected deployment environment variable.

  • Use a dedicated application database role instead of the PostgreSQL superuser.

  • Grant that role only the permissions required by the application.

  • Prevent public database exposure through firewall rules, private networking, and PostgreSQL access controls.

  • Rotate the credential immediately if the documented default has already been used in any environment.

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

Detected: suspicious.exposed_secret_literal

File appears to expose a hardcoded API secret or token.

Critical
Code
suspicious.exposed_secret_literal
Location
SKILL.md:332