Skip to content

Incorrect command name exposure in context object for message command aliases in CommandKit

Moderate
twlite published GHSA-fhwm-pc6r-4h2f Oct 11, 2025

Package

npm commandkit (npm)

Affected versions

>=1.2.0-rc.1 <=1.2.0-rc.11

Patched versions

1.2.0-rc.12

Description

Impact

A logic flaw exists in the message command handler of CommandKit 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, and the documentation describes middleware as suitable for “logging, authentication, permission checks, or any other cross-cutting concerns.” As a result, developers reasonably expect ctx.commandName to return the canonical command name and may rely on it for security-sensitive logic.

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.

Patches

Fixed in v1.2.0-rc.12.
ctx.commandName now consistently returns the actual canonical command name, regardless of the alias used to invoke it.

Workaround

If upgrading isn't immediately possible:

  • Use ctx.command.data.command.name for permission validations, or
  • Include all command aliases in your permission logic.

References

Severity

Moderate

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Local
Attack complexity
Low
Privileges required
Low
User interaction
None
Scope
Unchanged
Confidentiality
Low
Integrity
High
Availability
None

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:L/I:H/A:N

CVE ID

CVE-2025-62378

Weaknesses

No CWEs

Credits