Back to skill

Security audit

HypDiscordGOD

Security checks for vulnerabilities and agentic risk

Overview

This Discord-bot skill is coherent overall, but it ships starter dashboard code that can expose or alter moderation data without authentication, so it needs review before use.

Install only if you treat the bundled dashboard and moderation examples as development starters. Before exposing them to users or the internet, add authentication and guild-level authorization to every moderation endpoint, restrict CORS, set strong session secrets and secure cookies, define transcript retention/access rules, and pin dependencies with a lockfile.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • 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
Findings (2)

T05 · Unauthorized Access and Privilege Escalation

Error
Location
assets/moderation-dashboard-starter/src/server.ts:34
Finding

Unauthenticated Moderation and Audit API

Content
View full analysis

Vulnerability Details

File Location: assets/moderation-dashboard-starter/src/server.ts:34-61
Vulnerability Type: Missing authentication, missing guild-level authorization, and client-controlled actor attribution
Risk Level: High

Vulnerable Code

ts
app.get('/warnings/:guildId/:userId', (req, res) => {
  const rows = db.prepare('SELECT * FROM warnings WHERE guild_id = ? AND user_id = ? ORDER BY id DESC').all(req.params.guildId, req.params.userId);
  res.json(rows);
});
app.post('/warnings', (req, res) => {
  const now = new Date().toISOString();
  db.prepare('INSERT INTO warnings (guild_id, user_id, moderator_user_id, reason, created_at) VALUES (?, ?, ?, ?, ?)')
    .run(req.body.guildId, req.body.userId, req.body.moderatorUserId, req.body.reason, now);
  db.prepare('INSERT INTO audit_log (actor_user_id, guild_id, action_type, payload_json, created_at) VALUES (?, ?, ?, ?, ?)')
    .run(req.body.moderatorUserId, req.body.guildId, 'warning.create', JSON.stringify(req.body), now);
  res.json({ ok: true, createdAt: now });
});
app.post('/mod-actions', (req, res) => {
  const now = new Date().toISOString();
  db.prepare('INSERT INTO mod_actions (guild_id, target_user_id, moderator_user_id, action_type, reason, created_at) VALUES (?, ?, ?, ?, ?, ?)')
    .run(req.body.guildId, req.body.targetUserId, req.body.moderatorUserId, req.body.actionType, req.body.reason, now);
  db.prepare('INSERT INTO audit_log (actor_user_id, guild_id, action_type, payload_json, created_at) VALUES (?, ?, ?, ?, ?)')
    .run(req.body.moderatorUserId, req.body.guildId, `mod.${req.body.actionType}`, JSON.stringify(req.body), now);
  res.json({ ok: true, createdAt: now });
});
app.get('/audit-log/:guildId', (req, res) => {
  const rows = db.prepare('SELECT * FROM audit_log WHERE guild_id = ? ORDER BY id DESC LIMIT 100').all(req.params.guildId);
  res.json(rows);
});

Technical Analysis

All moderation ...[truncated 2041 chars]

Remediation
View remediation

Remediation Suggestions

  1. Require authentication middleware on every warning, moderation-action, and audit endpoint.
  2. Derive the acting moderator ID from the authenticated session or verified service credential; never accept authoritative actor identity from the request body.
  3. On every request, verify that the authenticated user belongs to the specified guild and possesses the required Discord moderation or administrative permission.
  4. Enforce tenant isolation in the data-access layer so records can only be queried or modified for authorized guilds.
  5. Restrict CORS to an explicit configuration-based allowlist rather than using unrestricted cors().
  6. Validate request bodies with a strict schema, including Discord snowflake format, allowed action types, required text fields, and reasonable length limits.
  7. Return generic authorization errors without disclosing whether unauthorized guild or user records exist.
  8. Add rate limiting, security logging, and tests covering unauthenticated access, moderator impersonation, and cross-guild requests.

T09 · Insecure Skill Coding Practices

Warning
Location
assets/dashboard-api-starter/src/server.ts:9
Finding

Insecure Dashboard Session and Cookie Defaults

Content
View full analysis

Vulnerability Details

File Location: assets/dashboard-api-starter/src/server.ts:9-10, assets/dashboard-api-starter/src/auth.ts:18-19,64-65, and assets/dashboard-api-starter/src/csrf.ts:6-10
Vulnerability Type: Known fallback signing secret, insecure cookie transport, and overly permissive credentialed CORS
Risk Level: Medium

Vulnerable Code

From assets/dashboard-api-starter/src/server.ts:

ts
const app = express();
app.use(cors({ origin: true, credentials: true }));
app.use(cookieParser(process.env.SESSION_COOKIE_SECRET || 'dev-secret'));

From assets/dashboard-api-starter/src/auth.ts:

ts
export function startDiscordOauth(req: Request, res: Response) {
  const state = crypto.randomUUID();
  res.cookie('discord_oauth_state', state, { httpOnly: true, sameSite: 'lax', secure: false, signed: true });
  const params = new URLSearchParams({
    client_id: process.env.DISCORD_CLIENT_ID || '',
    redirect_uri: process.env.DISCORD_REDIRECT_URI || '',
    response_type: 'code',
    scope: 'identify guilds',
    state,
    prompt: 'none'
  });
  res.redirect(`https://discord.com/oauth2/authorize?${params.toString()}`);
}
ts
const sessionId = crypto.randomUUID();
createSession(sessionId, user.id, tokenData.access_token, tokenData.refresh_token);
res.clearCookie('discord_oauth_state');
res.cookie('dashboard_session', sessionId, { httpOnly: true, sameSite: 'lax', secure: false, signed: true });
res.redirect('/');

From assets/dashboard-api-starter/src/csrf.ts:

ts
if (!req.signedCookies.csrf_token) {
  res.cookie('csrf_token', crypto.randomUUID(), {
    httpOnly: false,
    sameSite: 'lax',
    secure: false,
    signed: true
  });
}

Technical Analysis

The server silently uses the public string dev-secret if SESSION_COOKIE_SECRET is absent. This makes the integrity key for signed cookies predictable in a deployme ...[truncated 2592 chars]

Remediation
View remediation

Remediation Suggestions

  1. Refuse to start outside an explicitly selected development mode when SESSION_COOKIE_SECRET is missing.
  2. Require a cryptographically random, high-entropy signing secret supplied through secure deployment configuration.
  3. Set secure: true for OAuth-state, dashboard-session, and CSRF cookies in production.
  4. Enforce HTTPS and redirect or reject plaintext HTTP requests at the application or trusted reverse proxy.
  5. Configure an explicit CORS allowlist and enable credentials only for the actual dashboard origin.
  6. Consider SameSite=Strict where compatible with the OAuth flow; otherwise retain Lax only where OAuth redirects require it.
  7. Set explicit cookie paths, expiration or maximum age, and consistent attributes when clearing cookies.
  8. Rotate session identifiers after authentication and revoke associated OAuth credentials where appropriate on logout.
  9. Use a durable, encrypted server-side session store for production and protect stored access and refresh tokens at rest.
  10. Add deployment checks and documentation that clearly distinguish development-only cookie settings from production-safe settings.
Vulnerability Patterns
  • 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
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (72)

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · assets/docker/docker-compose.yml (reported line 6)May include surrounding context.

yaml
build: .
    restart: unless-stopped
    env_file:
      - .env

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
90% confidence
Finding

The skill instructs the agent to inspect repositories, implement changes directly, validate changes, and use bundled assets, which implies access to environment data and network-capable operations. Because the skill does not declare any explicit tool scope or allowed-tools restrictions, an execution environment may grant broader capabilities than intended, increasing the risk of unintended secret exposure, external calls, or repository modifications. In a code-generation and debugging skill for Discord bots, this matters more because those tasks commonly involve tokens, OAuth credentials, webhooks, and deployment settings.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · assets/dashboard-api-starter/src/auth.ts (reported line 38)May include surrounding context.

ts
return;
  }

  const tokenRes = await fetch('https://discord.com/api/oauth2/token', {
    method: 'POST',
    headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
    body: new URLSearchParams({

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
87% confidence
Finding

This code transmits OAuth credentials to Discord, reads sensitive environment variables including DISCORD_CLIENT_SECRET, retrieves a user access token, and stores that token in a session, but there is no visible confirmation, logging, comment, or docstring warning users about these privacy- and credential-relevant operations. Under SQP-2 for code files, network transmission of user/system data and access to sensitive credentials should have some form of disclosure unless clearly warned elsewhere in the file.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
85% confidence
Finding

The POST handlers create persistent warning, moderation-action, and audit-log records, which are user-data-affecting file/database writes. While this behavior may be functionally intended, the code provides no confirmation prompt, user-facing notice, or explanatory comment/docstring disclosing that these actions will be recorded and retained.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The audit log endpoint returns stored moderation payloads for any supplied guild ID without any authentication or authorization checks. Because the server also enables unrestricted CORS, an external site or unauthenticated caller could enumerate guild IDs and retrieve sensitive moderation history, moderator identifiers, reasons, and other stored request data.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The bot exports full ticket message contents and attachment URLs to a local transcript file without any notice to users that their support conversation will be retained outside Discord. Ticket channels often contain sensitive personal or operational information, so undisclosed persistence increases privacy and data-handling risk, especially if the host filesystem is shared, backed up, or insufficiently access-controlled.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The flow explicitly includes exporting ticket transcripts but provides no indication that users are notified, consent is considered, or retention/access controls are defined. In a Discord ticketing context, transcripts can contain sensitive user reports, moderation details, and personal data, so omitting privacy handling guidance can lead to unauthorized disclosure or noncompliant data retention.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The notes explicitly mention transcript export to local files and attachment URL capture, but provide no warning about privacy, retention, access control, or legal/compliance implications. In a Discord ticketing context, transcripts often contain user-submitted support content, personal data, moderation evidence, and private attachments, so omitting safeguards can lead downstream implementers to store sensitive data insecurely or longer than necessary.

Content

No source excerpt is available for this finding.

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
40% confidence
Finding

Dependencies lack version pinning, allowing potential malicious package updates. Consider pinning versions.

Content

Scanner excerpt · assets/bun-template/package.json (reported line 11)May include surrounding context.

json
"register": "bun run src/register-commands.ts"
  },
  "dependencies": {
    "discord.js": "^14.21.0",
    "dotenv": "^16.6.1"
  }
}

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
40% confidence
Finding

Dependencies lack version pinning, allowing potential malicious package updates. Consider pinning versions.

Content

Scanner excerpt · assets/discord-js-ts-template/package.json (reported line 13)May include surrounding context.

json
"register": "bun run src/register-commands.ts"
  },
  "dependencies": {
    "discord.js": "^14.21.0",
    "dotenv": "^16.6.1"
  }
}

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
40% confidence
Finding

Dependencies lack version pinning, allowing potential malicious package updates. Consider pinning versions.

Content

Scanner excerpt · assets/ticket-bot-starter/package.json (reported line 13)May include surrounding context.

json
"register": "bun run src/register-commands.ts"
  },
  "dependencies": {
    "discord.js": "^14.21.0",
    "dotenv": "^16.6.1"
  }
}

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
40% confidence
Finding

Dependencies lack version pinning, allowing potential malicious package updates. Consider pinning versions.

Content

Scanner excerpt · assets/dashboard-api-starter/package.json (reported line 21)May include surrounding context.

json
"devDependencies": {
    "tsx": "^4.20.5",
    "typescript": "^5.9.2",
    "@types/cookie-parser": "^1.4.9",
    "@types/express": "^5.0.3",
    "@types/node": "^24.3.0"
  }

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
40% confidence
Finding

Dependencies lack version pinning, allowing potential malicious package updates. Consider pinning versions.

Content

Scanner excerpt · assets/dashboard-frontend-starter/package.json (reported line 12)May include surrounding context.

json
"preview": "vite preview"
  },
  "dependencies": {
    "react": "^19.1.1",
    "react-dom": "^19.1.1"
  },
  "devDependencies": {

Unverifiable Dependency: react has 2 known advisory(ies) (CVE-2013-7035 (Cross-Site Scripting in react); GHSA-hg79-j56m-fxgv (Cross-Site Scripting in react)), but the manifest does not pin a version, so it is unknown whether the installed release is affected

Low
Category
Supply Chain
Confidence
40% confidence
Finding

Dependency has known vulnerabilities (CVEs). Using packages with unpatched security flaws exposes the environment to known exploits.

Content

No source excerpt is available for this finding.

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
40% confidence
Finding

Dependencies lack version pinning, allowing potential malicious package updates. Consider pinning versions.

Content

Scanner excerpt · assets/dashboard-frontend-starter/package.json (reported line 13)May include surrounding context.

json
},
  "dependencies": {
    "react": "^19.1.1",
    "react-dom": "^19.1.1"
  },
  "devDependencies": {
    "typescript": "^5.9.2",

Unverifiable Dependency: react-dom has 1 known advisory(ies) (CVE-2018-6341 (Cross-Site Scripting in react-dom)), but the manifest does not pin a version, so it is unknown whether the installed release is affected

Low
Category
Supply Chain
Confidence
40% confidence
Finding

Dependency has known vulnerabilities (CVEs). Using packages with unpatched security flaws exposes the environment to known exploits.

Content

No source excerpt is available for this finding.

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
40% confidence
Finding

Dependencies lack version pinning, allowing potential malicious package updates. Consider pinning versions.

Content

Scanner excerpt · assets/dashboard-api-starter/package.json (reported line 20)May include surrounding context.

json
"react-dom": "^19.1.1"
  },
  "devDependencies": {
    "typescript": "^5.9.2",
    "vite": "^7.1.3",
    "@types/react": "^19.1.12",
    "@types/react-dom": "^19.1.9"

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
40% confidence
Finding

Dependencies lack version pinning, allowing potential malicious package updates. Consider pinning versions.

Content

Scanner excerpt · assets/dashboard-frontend-starter/package.json (reported line 16)May include surrounding context.

json
"react-dom": "^19.1.1"
  },
  "devDependencies": {
    "typescript": "^5.9.2",
    "vite": "^7.1.3",
    "@types/react": "^19.1.12",
    "@types/react-dom": "^19.1.9"

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
40% confidence
Finding

Dependencies lack version pinning, allowing potential malicious package updates. Consider pinning versions.

Content

Scanner excerpt · assets/discord-js-ts-template/package.json (reported line 18)May include surrounding context.

json
"react-dom": "^19.1.1"
  },
  "devDependencies": {
    "typescript": "^5.9.2",
    "vite": "^7.1.3",
    "@types/react": "^19.1.12",
    "@types/react-dom": "^19.1.9"

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
40% confidence
Finding

Dependencies lack version pinning, allowing potential malicious package updates. Consider pinning versions.

Content

Scanner excerpt · assets/drizzle-starter/package.json (reported line 19)May include surrounding context.

json
"react-dom": "^19.1.1"
  },
  "devDependencies": {
    "typescript": "^5.9.2",
    "vite": "^7.1.3",
    "@types/react": "^19.1.12",
    "@types/react-dom": "^19.1.9"

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
40% confidence
Finding

Dependencies lack version pinning, allowing potential malicious package updates. Consider pinning versions.

Content

Scanner excerpt · assets/moderation-dashboard-starter/package.json (reported line 19)May include surrounding context.

json
"react-dom": "^19.1.1"
  },
  "devDependencies": {
    "typescript": "^5.9.2",
    "vite": "^7.1.3",
    "@types/react": "^19.1.12",
    "@types/react-dom": "^19.1.9"

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
40% confidence
Finding

Dependencies lack version pinning, allowing potential malicious package updates. Consider pinning versions.

Content

Scanner excerpt · assets/prisma-starter/package.json (reported line 18)May include surrounding context.

json
"react-dom": "^19.1.1"
  },
  "devDependencies": {
    "typescript": "^5.9.2",
    "vite": "^7.1.3",
    "@types/react": "^19.1.12",
    "@types/react-dom": "^19.1.9"

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
40% confidence
Finding

Dependencies lack version pinning, allowing potential malicious package updates. Consider pinning versions.

Content

Scanner excerpt · assets/ticket-bot-starter/package.json (reported line 19)May include surrounding context.

json
"react-dom": "^19.1.1"
  },
  "devDependencies": {
    "typescript": "^5.9.2",
    "vite": "^7.1.3",
    "@types/react": "^19.1.12",
    "@types/react-dom": "^19.1.9"

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
40% confidence
Finding

Dependencies lack version pinning, allowing potential malicious package updates. Consider pinning versions.

Content

Scanner excerpt · assets/dashboard-frontend-starter/package.json (reported line 17)May include surrounding context.

json
},
  "devDependencies": {
    "typescript": "^5.9.2",
    "vite": "^7.1.3",
    "@types/react": "^19.1.12",
    "@types/react-dom": "^19.1.9"
  }

Static analysis

Detected: suspicious.env_credential_access

Environment variable access combined with network send.

Critical
Code
suspicious.env_credential_access
Location
assets/dashboard-api-starter/src/auth.ts:7

Environment variable access combined with network send.

Critical
Code
suspicious.env_credential_access
Location
assets/ticket-bot-starter/src/index.ts:36