Skip to content

GHSA-c27j-76xg-6x4f CVE-2022-39315

Kirby CMS vulnerable to user enumeration in the brute force protection

Medium Packagist
Severity
6.5 / 10
Medium · CVSS 3.1
Exploit chance (EPSS)
0.79%
Chance of exploitation in the next 30 days. Higher than 56.28% of scored vulnerabilities.
Known exploited
No
Not in CISA's catalog
Weakness
CWE-204 Observable Response Discrepancy
CWE-209 Generation of Error Message Containing Sensitive Information
CWE-668 Exposure of Resource to Wrong Sphere
Fix
3.5.8.2
Upgrade getkirby/cms to this version or later

Description

TL;DR

This vulnerability affects all Kirby sites with user accounts (unless Kirby's API and Panel are disabled in the config). It can only be exploited for targeted attacks because the attack does not scale to brute force.


Introduction

User enumeration is a type of vulnerability that allows attackers to confirm which users are registered in a Kirby installation. This information can be abused for social engineering attacks against users of the site or to find out the organizational structure of the company.

User enumeration attacks are performed by entering an existing and a non-existing user into the email address field of the login form. If the system returns a different response or behaves differently depending on whether the user exists, the attacker can enter unknown email addresses and use the different behavior as a clue for the (non-)existing user.

Impact

Kirby comes with a built-in brute force protection. By default, it will prevent further login attempts after 10 failed logins from a single IP address or of a single existing user. After every failed login attempt, Kirby inserts a random delay between one millisecond and two seconds to make automated attacks harder and to avoid leaking whether the user exists. Unfortunately, this random delay was not inserted after the brute force limit was reached.

Because Kirby only tracks failed login attempts per email address for existing users but always tracks failed login attempts per IP address, this behavior could be abused by attackers for user enumeration. For this to work, an attacker would need to create login requests beyond the trials limit (which is 10 by default) from two or more IP addresses. After the trials limit was reached, the login form immediately blocked further requests for existing users, but not for invalid users.

This exploit does not scale to brute force attacks because of the delay during the first 10 requests per user, the faint difference between the responses for valid and invalid users and the fact that code-based logins would send an email for every login attempt, which makes the attack easy to spot. The vulnerability is therefore only relevant for targeted attacks.

Patches

The problem has been patched in Kirby 3.5.8.2, Kirby 3.6.6.2, Kirby 3.7.5.1 and Kirby 3.8.1. Please update to one of these or a later version to fix the vulnerability.

In all of the mentioned releases, we have rewritten the affected code so that the delay is also inserted after the brute force limit is reached.

Affected versions

Packagist

PackageVulnerableFixed in
getkirby/cms
< 3.5.8.2
3.5.8.2
getkirby/cms
>= 3.6.0, < 3.6.6.2
3.6.6.2
getkirby/cms
>= 3.7.0, < 3.7.5.1
3.7.5.1
getkirby/cms
>= 3.8.0, < 3.8.1
3.8.1

How to fix

Move to the fixed version or later with your package manager, update the lockfile, and run your tests. If the package only arrives through another dependency, upgrade that dependency first. If none of its releases pulls a fixed version yet, force the version with your package manager's override.

getkirby/cms Packagist → 3.5.8.2

composer
composer require getkirby/cms:^3.5.8.2

Severity breakdown

CVSS 3.1 6.5

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N

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

Weakness

CWE-204: Observable Response Discrepancy

The product provides different responses to incoming requests in a way that reveals internal state information to an unauthorized actor outside of the intended control sphere.

How to prevent it
  • Architecture and Design: Compartmentalize the system to have "safe" areas where trust boundaries can be unambiguously drawn. Do not allow sensitive data to go outside of the trust boundary and always be careful when interfacing with a compartment outside of the safe area. Ensure that appropriate compartmentalization is built into the system design, and the compartmentalization allows for and reinforces privilege separation functionality. Architects and designers should rely on the principle of least privilege to decide the appropriate time to use privileges and the time to drop privileges.
  • Implementation: Ensure that error messages only contain minimal details that are useful to the intended audience and no one else. The messages need to strike the balance between being too cryptic (which can confuse users) or being too detailed (which may reveal more than intended). The messages should not reveal the methods that were used to determine the error. Attackers can use detailed information to refine or optimize their original attack, thereby increasing their chances of success. If errors must be captured in some detail, record them in log messages, but consider what could occur if the log messages can be viewed by attackers. Highly sensitive information such as passwords should never be saved to log files. Avoid inconsistent messaging that might accidentally tip off an attacker about internal state, such as whether a user account exists or not.

CWE-209: Generation of Error Message Containing Sensitive Information

The product generates an error message that includes sensitive information about its environment, users, or associated data.

How to prevent it
  • Implementation: Ensure that error messages only contain minimal details that are useful to the intended audience and no one else. The messages need to strike the balance between being too cryptic (which can confuse users) or being too detailed (which may reveal more than intended). The messages should not reveal the methods that were used to determine the error. Attackers can use detailed information to refine or optimize their original attack, thereby increasing their chances of success. If errors must be captured in some detail, record them in log messages, but consider what could occur if the log messages can be viewed by attackers. Highly sensitive information such as passwords should never be saved to log files. Avoid inconsistent messaging that might accidentally tip off an attacker about internal state, such as whether a user account exists or not.
  • Implementation: Handle exceptions internally and do not display errors containing potentially sensitive information to a user.
  • Implementation: Use naming conventions and strong types to make it easier to spot when sensitive data is being used. When creating structures, objects, or other complex entities, separate the sensitive and non-sensitive data as much as possible.
  • Implementation, Build and Compilation: Debugging information should not make its way into a production release.
  • Implementation, Build and Compilation: Debugging information should not make its way into a production release.
  • System Configuration: Where available, configure the environment to use less verbose error messages. For example, in PHP, disable the display_errors setting during configuration, or at runtime using the error_reporting() function.
  • System Configuration: Create default error pages or messages that do not leak any information.

CWE-668: Exposure of Resource to Wrong Sphere

The product exposes a resource to the wrong control sphere, providing unintended actors with inappropriate access to the resource.

References

Timeline

  1. Published
  2. Last updated by the source
  3. Latest EPSS score
AdvisorySeverityWhy it's related
GHSA-9vx2-j98c-p72w
Kirby: Access to image files and limited access to JSON files outside of the site root via path traversal in the media handling
High Also affects getkirby/cms
GHSA-6j4c-mgqr-qv76
Kirby: Access to image files outside of the site root via path traversal in the media handling
Medium Also affects getkirby/cms
GHSA-67mx-6wf2-92xp
Kirby: File upload permissions are not checked during processing of chunk data
High Also affects getkirby/cms
GHSA-rf2p-vh74-7vvh
Kirby: System path exposure from error messages in the REST API
Medium Also affects getkirby/cms
GHSA-r3w8-2c5r-h9j9
Kirby: `pages.access` permission is not checked in the `site/find` REST API route
High Also affects getkirby/cms
GHSA-89cp-7p28-jffg
Kirby: Access to files of top-level drafts is not protected by permissions
Medium Also affects getkirby/cms
GHSA-whxw-24jc-cwmv
Kirby: External Initialization of the Panel on reverse proxy setups with the `Forwarded` header
Critical Also affects getkirby/cms
GHSA-wr9h-4r83-f4v6
Kirby: Cross-site scripting (XSS) from incomplete HTML/XML sanitization in `Dom::sanitize()`
High Also affects getkirby/cms
Is this in your code?

MergeHarbor checks every repository's dependencies against this database, ranks what matters by exploitability and reachability, routes it to the owning team and opens the fix pull request.

Check your repos with MergeHarbor