CVE-2021-41129: Pterodactyl/panel Authentication Bypass Vulnerability

HIGH
Advisory Identifier: GHSA-5vfx-8w6m-h3v4
CVSS 8.1
CWE-639 CWE-502 CWE-287 CWE-807
Published
Advisory Summary

CVE-2021-41129 is a HIGH (CVSS 8.1) authentication bypass vulnerability (CWE-639: Authorization Bypass Through User-Controlled Key) affecting Pterodactyl/panel libraries in the Packagist ecosystem. The issue involves pterodactyl panel vulnerable to authentication bypass due to improper user-provided security token verification. Remediation is available by upgrading affected packages to version 1.6.2.

CVE-2021-41129 at a Glance

CVE Identifier CVE-2021-41129
GHSA Identifier GHSA-5vfx-8w6m-h3v4
Severity HIGH
CVSS v3.1 Base Score 8.1
CWE Classification CWE-639: Authorization Bypass Through User-Controlled Key
Affected Product Pterodactyl/panel
Package Ecosystem Packagist
Published Date
Last Updated

Security Impact

CVSS: 8.1

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H).

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability High (A:H)

How to Fix CVE-2021-41129

To remediate this vulnerability, upgrade all affected Pterodactyl/panel dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

pterodactyl/panel fixed: 1.6.2
Upgrade pterodactyl/panel to 1.6.2
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for pterodactyl/panel

How to Check if You Are Affected

To determine whether your application is affected by CVE-2021-41129, inspect your project dependencies for Pterodactyl/panel:

inspect dependencies for pterodactyl/panel

Analyze the terminal output to locate any version of Pterodactyl/panel in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.6.2), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-639: Authorization Bypass Through User-Controlled Key, where the system's authorization functionality does not prevent one user from gaining access to another user's data or record by modifying the key value identifying the data. In Pterodactyl/panel, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

A malicious user can modify the contents of a `confirmation_token` input during the two-factor authentication process to reference a cache value not associated with the login attempt. In rare cases this can allow a malicious actor to authenticate as a random user in the Panel. The malicious user must target an account with two-factor authentication enabled, and then must provide a correct two-factor authentication token before being authenticated as that user. ## Impact Due to a validation flaw in the logic handling user authentication during the two-factor authentication process a malicious user can trick the system into loading credentials for an arbitrary user by modifying the token sent to the server. This authentication flaw is present in the `LoginCheckpointController@__invoke` method which handles two-factor authentication for a user. This controller looks for a request input parameter called `confirmation_token` which is expected to be a 64 character random alpha-numeric string that references a value within the Panel's cache containing a `user_id` value. This value is then used to fetch the user that attempted to login, and lookup their two-factor authentication token. Due to the design of this system, any element in the cache that contains only digits could be referenced by a malicious user, and whatever value is stored at that position would be used as the `user_id`. There are a few different areas of the Panel that store values into the cache that are integers, and a user who determines what those cache keys are could pass one of those keys which would cause this code pathway to reference an arbitrary user. ## Scope At its heart this is a high-risk login bypass vulnerability. However, there are a few additional conditions that must be met in order for this to be successfully executed, notably: 1.) The account referenced by the malicious cache key **must** have two-factor authentication enabled. An account without two-factor authentication would cause an exception to be triggered by the authentication logic, thusly exiting this authentication flow. 2.) Even if the malicious user is able to reference a valid cache key that references a valid user account with two-factor authentication, they **must** provide a valid two-factor authentication token. However, due to the design of this endpoint once a valid user account is found with two-factor authentication enabled there is no rate-limiting present, thusly allowing an attacker to brute force combinations until successful. This leads to a third condition that must be met: 3.) For the duration of this attack sequence the cache key being referenced must continue to exist with a valid `user_id` value. Depending on the specific key being used for this attack, this value may disappear quickly, or be changed by other random user interactions on the Panel, outside the control of the attacker. ### About the Severity As you may have noticed, this is not a trivial authentication bypass bug to exploit, and is likely incredibly difficult for a layperson to pull off. However, the severity of this disclosure has been prepared based on the nature of the bug and the potential for unexpected administrative account access under very rare conditions. ## Mitigation In order to mitigate this vulnerability the underlying authentication logic was changed to use an encrypted session store that the user is therefore unable to control the value of. This completely removed the use of a user-controlled value being used. In addition, the code was audited to ensure this type of vulnerability is not present elsewhere. If you have any questions or concerns about the content of this disclosure please contact `Tactical Fish#8008` on Discord, or email `dane ät pterodactyl.io`.

CVE-2021-41129 Affected Pterodactyl/panel Versions

1 component(s)
Fixed Versions:
1.6.2
Product / Package Ecosystem Affected Versions Fixed Version
pterodactyl/panel
Packagist
≥ 1.0.0
< 1.6.2
1.6.2

References

Frequently Asked Questions

What is CVE-2021-41129?
CVE-2021-41129 is a security vulnerability in Pterodactyl/panel involving Pterodactyl Panel vulnerable to authentication bypass due to improper user-provided security token verification under CWE-639: Authorization Bypass Through User-Controlled Key.
Which Pterodactyl/panel versions are affected?
Affected versions include releases prior to 1.6.2 across affected packages: pterodactyl/panel.
What version fixes CVE-2021-41129?
Upgrading to 1.6.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is pterodactyl/panel affected?
Yes, pterodactyl/panel is affected in releases prior to 1.6.2. Upgrade your dependency to 1.6.2 or later.
What is the CVSS score of CVE-2021-41129?
CVE-2021-41129 has a CVSS v3.1 base score of 8.1 (HIGH) with vector string CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2021-41129?
CVE-2021-41129 is classified under CWE-639: Authorization Bypass Through User-Controlled Key (The system's authorization functionality does not prevent one user from gaining access to another user's data or record by modifying the key value identifying the data.).
How can I check Packagist dependencies for CVE-2021-41129?
Run the dependency tree command: 'inspect dependencies for pterodactyl/panel'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-5vfx-8w6m-h3v4",
  "modified" : "2022-08-15T20:12:39Z",
  "published" : "2021-10-04T20:14:13Z",
  "aliases" : [ "CVE-2021-41129" ],
  "summary" : "Pterodactyl Panel vulnerable to authentication bypass due to improper user-provided security token verification",
  "details" : "A malicious user can modify the contents of a `confirmation_token` input during the two-factor authentication process to reference a cache value not associated with the login attempt. In rare cases this can allow a malicious actor to authenticate as a random user in the Panel. The malicious user must target an account with two-factor authentication enabled, and then must provide a correct two-factor authentication token before being authenticated as that user.\n\n## Impact\nDue to a validation flaw in the logic handling user authentication during the two-factor authentication process a malicious user can trick the system into loading credentials for an arbitrary user by modifying the token sent to the server. This authentication flaw is present in the `LoginCheckpointController@__invoke` method which handles two-factor authentication for a user.\n\nThis controller looks for a request input parameter called `confirmation_token` which is expected to be a 64 character random alpha-numeric string that references a value within the Panel's cache containing a `user_id` value. This value is then used to fetch the user that attempted to login, and lookup their two-factor authentication token. Due to the design of this system, any element in the cache that contains only digits could be referenced by a malicious user, and whatever value is stored at that position would be used as the `user_id`.\n\nThere are a few different areas of the Panel that store values into the cache that are integers, and a user who determines what those cache keys are could pass one of those keys which would cause this code pathway to reference an arbitrary user.\n\n## Scope\nAt its heart this is a high-risk login bypass vulnerability. However, there are a few additional conditions that must be met in order for this to be successfully executed, notably:\n\n1.) The account referenced by the malicious cache key **must** have two-factor authentication enabled. An account without two-factor authentication would cause an exception to be triggered by the authentication logic, thusly exiting this authentication flow.\n2.) Even if the malicious user is able to reference a valid cache key that references a valid user account with two-factor authentication, they **must** provide a valid two-factor authentication token.\n\nHowever, due to the design of this endpoint once a valid user account is found with two-factor authentication enabled there is no rate-limiting present, thusly allowing an attacker to brute force combinations until successful. This leads to a third condition that must be met:\n\n3.) For the duration of this attack sequence the cache key being referenced must continue to exist with a valid `user_id` value. Depending on the specific key being used for this attack, this value may disappear quickly, or be changed by other random user interactions on the Panel, outside the control of the attacker.\n\n### About the Severity\nAs you may have noticed, this is not a trivial authentication bypass bug to exploit, and is likely incredibly difficult for a layperson to pull off. However, the severity of this disclosure has been prepared based on the nature of the bug and the potential for unexpected administrative account access under very rare conditions.\n\n## Mitigation\nIn order to mitigate this vulnerability the underlying authentication logic was changed to use an encrypted session store that the user is therefore unable to control the value of. This completely removed the use of a user-controlled value being used. In addition, the code was audited to ensure this type of vulnerability is not present elsewhere.\n\nIf you have any questions or concerns about the content of this disclosure please contact `Tactical Fish#8008` on Discord, or email `dane ät pterodactyl.io`.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "pterodactyl/panel"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.0.0"
      }, {
        "fixed" : "1.6.2"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/pterodactyl/panel/security/advisories/GHSA-5vfx-8w6m-h3v4"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-41129"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pterodactyl/panel/commit/4a84c36009be10dbd83051ac1771662c056e4977"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/pterodactyl/panel"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pterodactyl/panel/blob/v1.6.2/CHANGELOG.md#v162"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pterodactyl/panel/releases/tag/v1.6.2"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-287", "CWE-502", "CWE-639", "CWE-807" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-10-04T16:51:31Z",
    "nvd_published_at" : "2021-10-06T20:15:00Z"
  }
}