A Drupal Installer Bug Allows Admin Account Takeover

CVE-2026-136716 lets an anonymous visitor resume an unfinished Drupal install and log in as user 1. Patch analysis, indicators of compromise and a checker.

Jordan Newman

Author

Nov 26, 2026

Published

19 min

Read time

Drupal is an open-source content management system for building and managing websites which was founded in 2001. It remains widely used - our queries of third-party mass-scan data (e.g. Shodan) using known Drupal fingerprints suggests there are around 400,000 - 600,000 Drupal sites live on the internet.

Drupal published SA-CORE-2026-019 on 25 November 2026 which addresses CVE-2026-136716, a highly critical (21/25) unauthenticated vulnerability in the Drupal installer. This is known to be already exploited in the wild, although no public PoC is available. The short version: on a site whose installation was never recorded as finished, an anonymous visitor to core/install.php can pick the installer up where it stopped and end up logged in as user 1.

This post analyses the vulnerability, the associated patch, routes to exploitation, IoCs, and a script to assess the state of your Drupal instance.

Everything below comes from diffing the 11.4.13 and 11.4.14 release tarballs and reading the installer code. The Indicators of Compromise are derived from static analysis as well as sandbox lab testing.

Affected versions (Drupal core)

Branch

Affected

Fixed in

11.4.x

before 11.4.14

11.4.14

11.3.x

before 11.3.23

11.3.23

10.6.x

before 10.6.23

10.6.23

11.0–11.2, 10.5 and below

all releases

none (end of life)

Vulnerable sites are those which run an affected version and are in a particular state, described below.

How Drupal determines installation state

The installer is a list of tasks (install_tasks() in core/includes/install.core.inc). After each task completes, install_run_tasks() writes the task name to the state store:

PHP
\Drupal::state()->set('install_task', $install_state['installation_finished'] ? 'done' : $task_name);

So during an install, install_task holds the name of the last completed task, for example install_configure_form. It only becomes done when the task list runs out. The last core task install_finished() also sets the install_time.

On every request, install_begin_request() reads that value back and decides whether to run:

PHP
$task = install_verify_completed_task();
// The install_time state value is set when the installation finishes
if ($task === 'done' || (!empty($task) && \Drupal::state()->get('install_time'))) {
  throw new AlreadyInstalledException($container->get('string_translation'));
}

A task name other than done, with no install_time, means "installation in progress" and the installer would resume after that task on the next execution - this is an intentional design decision to handle a multi-request browser install. It is also the hole: nothing in this check asks who is resuming.

The most recent affected releases do have one guard against strangers. install_bootstrap_full() binds an interactive install to the first browser session that reaches it:

PHP
// Only the browser session that reached this point first can continue the
// installation
if ($install_state['interactive']) {
  $hash = \Drupal::state()->get('install_session_token');
  if ($hash === NULL) {
    $token = Crypt::randomBytesBase64();
    $session->set('install_session_token', $token);
    \Drupal::state()->set('install_session_token', Crypt::hashBase64($token));
  }
  elseif (!hash_equals($hash, Crypt::hashBase64((string) $session->get('install_session_token')))) {
    throw new InstallerException('The installation can only be continued in the browser session that started it.', 'Access denied');
  }
}

This is present in 11.4.13. It arrived with SA-CORE-2026-017 (fixed in 11.4.13, 11.3.22 and 10.6.22), which the new advisory describes as having fixed "several vulnerabilities within the Drupal core installer". The install_time check shown above arrived in the same releases. Anything older, including every end-of-life branch, has neither: there the installer resumes whenever install_task is anything other than done.

The weakness is the $hash === NULL branch: if the site is mid-install and no token has been stored, the next visitor is treated as the person who started the install and is subsequently handed the token.

Patch Analysis

The 11.4.13 → 11.4.14 patch brings two changes relevant to this vulnerability.

First, the installer stops minting a token for an install that is already under way:

Diff
--- 11.4.13/core/includes/install.core.inc
+++ 11.4.14/core/includes/install.core.inc
@@ -530,6 +530,9 @@
   if ($task === 'done' || (!empty($task) && \Drupal::state()->get('install_time'))) {
     throw new AlreadyInstalledException($container->get('string_translation'));
   }
+  if ($install_state['interactive'] && !empty($task) && \Drupal::state()->get('install_session_token') === NULL) {
+    throw new AlreadyInstalledException($container->get('string_translation'));
+  }
 
   // Ensure that the active configuration is empty before installation starts.
   if ($install_state['config_verified'] && empty($task)) {

A browser request that finds a recorded task but no token is now refused. A legitimate browser install is not affected since the first task that persists install_task to the database (install_base_system) and the task that stores the token (install_bootstrap_full) run back to back in the same request - so a real interactive install never has one without the other between requests. This check is limited to interactive installs, so command-line installs behave as before.

Second, an update hook repairs sites that are already in the bad state:

Diff
--- 11.4.13/core/modules/system/system.post_update.php
+++ 11.4.14/core/modules/system/system.post_update.php
@@ -167,3 +167,16 @@
+
+/**
+ * Mark the installation as finished on sites with incomplete install state.
+ */
+function system_post_update_mark_installation_finished(): void {
+  $state = \Drupal::state();
+  if ($state->get('install_task') !== 'done') {
+    $state->set('install_task', 'done');
+  }
+  if (!$state->get('install_time')) {
+    $state->set('install_time', \Drupal::time()->getRequestTime());
+  }
+}

This is why the advisory insists on running update.php after upgrading. The code change closes the web path and the update hook removes the underlying state.

How an attacker can resume unfinished installations

On an affected release, with the site in the vulnerable state, a request to core/install.php executes this logic:

  1. install_begin_request() finds a task name that is not done and no install_time, so it does not throw.

  2. install_bootstrap_full() runs on every request. It finds no stored token, creates one, and puts it in the visitor's session. The visitor now owns the install.

  3. The installer runs whatever tasks come after the recorded one. If the install stalled before the "Configure site" form, that form is the next interactive step.

  4. SiteConfigureForm::submitForm() loads user 1 and overwrites its name, email address and password with the submitted values, makes sure it has an administrator role, and saves the site name and site email.

  5. install_finished() calls user_login_finalize() for user 1, sets install_time, deletes the token, and the task loop sets install_task to done.

The visitor ends the request logged in as the site's administrator, with credentials they chose. Afterwards the state store looks like a normally installed site.

What makes this critical: a quieter route

In their notice, Drupal state "It is not apparent in the user interface if a site is in the affected vulnerable state", and I believe that the following route to exploitation is the reason for that statement.

Steps 3 and 4 only happen if the recorded task comes before the configure form. If install_task is install_configure_form itself, or any task after it, the form is not shown again. install_tasks_to_perform() drops the recorded task and everything before it, apart from the few housekeeping tasks marked to run on every request (language, profile, install_bootstrap_full):

PHP
if ($task['run'] == INSTALL_TASK_SKIP || in_array($name, $install_state['tasks_performed']) || (!empty($install_state['completed_task']) && empty($completed_task_found) && $task['run'] != INSTALL_TASK_RUN_IF_REACHED)) {
  unset($tasks[$name]);
}

What is left is any remaining profile tasks and then install_finished(). The attack becomes steps 1, 2 and 5 only: the visitor is given the token, and install_finished() logs them in as user 1. Nothing is submitted and nothing about the account is overwritten. User 1 keeps its name, email address and password, the site name and site email are untouched, and the real administrator can still log in as before. The attacker does not need to know or guess the account name; once logged in they can read it.

A site gets here when the install died after the account details were saved: an error or timeout in install_finished() or in a profile's closing tasks, or a command-line install killed at that point (a CLI install submits the configure form with the account details given on the command line). These are also the stalled installs most likely to look finished, because the modules, themes, configuration and administrator account are all in place.

Of course, in this scenario, the remaining tasks have to succeed this time. If the install stalled on an error that still reproduces then the attacker will hit the same error and install_finished() is never reached. A transient failure, such as a timeout or a killed process, does not protect the site.

What makes an instance vulnerable

All of the following must be true:

  1. The site runs an affected release.

  2. core/install.php is reachable by the attacker.

  3. The database has Drupal's tables and settings.php is valid, so the installer boots the full site.

  4. State key install_task is set to a task name other than done.

  5. State key install_time is not set.

  6. State key install_session_token is not set.

Conditions 5 and 6 apply to 11.4.13, 11.3.22 and 10.6.22. Older releases, including the end-of-life branches, check neither value, so conditions 1 to 4 are enough.

The advisory notes that this state is not apparent in the user interface. The site can be serving pages normally: by the time the installer reaches the configure form, the modules, themes and profile are already installed.

From analysis, these are some plausible routes which could cause a site to be left in such a state:

  • A command-line install that died partway. The token is only created for interactive installs, so a CLI install that is killed or fails after the base system is in place leaves a task name and no token.

  • An install started on a release that predates the session token, abandoned before the final step, and then put into service anyway.

  • An install whose last step failed, for example an error in install_finished() or in a profile's own final tasks, on a site that otherwise works. This leads to the quieter variant above, where the attacker is logged in without the account being changed.

  • State that was altered later, for example a database assembled from a partial dump, or install_time/install_task deleted by hand or by a script.

A stalled install that does have a token is not open to other visitors: they get the "Access denied" exception above. It is still worth finding, because if you did not start it, someone else did.

Checking for compromise

The three state values live in the key_value table, collection state, as PHP-serialised values. You can check your Drupal instance using the query below.

SQL
SELECT name, value FROM key_value
WHERE collection = 'state'
  AND name IN ('install_task', 'install_time', 'install_session_token');

A healthy site returns install_task = s:4:"done"; and an install_time integer, and no token row.

Alternatively, there is a python script in the appendix at the end of this post which automates the validation. It reads a SQLite database directly, or takes the output of the query above on stdin for any other database. Use the flag --root to additionally report whether the code is patched; on Composer-based sites the Drupal root is usually the web/ directory. It exits with status 1 if the site is in the vulnerable state, 0 if not, and 2 if it could not tell.

Bash
# SQLite
python3 check_cve_2026_136716.py --sqlite sites/default/files/.sqlite --root .

# MySQL / MariaDB
mysql -N -B -e "SELECT name, value FROM key_value WHERE collection='state' AND name IN ('install_task','install_time','install_session_token')" DBNAME \
  | python3 check_cve_2026_136716.py --stdin --root /var/www/drupal

# PostgreSQL
psql -At -F $'\t' -c "SELECT name, convert_from(value, 'UTF8') FROM key_value WHERE collection='state' AND name IN ('install_task','install_time','install_session_token')" DBNAME \
  | python3 check_cve_2026_136716.py --stdin --root /var/www/drupal

The SQLite path depends on how the site was installed: sites/default/files/.sqlite for a command-line or quick-start install, sites/default/files/.ht.sqlite for a browser install. If in doubt, take the path from settings.php.

If your tables have a prefix, add it to the table name in the query. On SQLite, Drupal keeps prefixed tables in a separate file named after the database and the prefix (for example .ht.sqlite-myprefix), so point --sqlite at that file. While the SQLite and stdin paths have been comprehensively tested, the mysql and psql command lines above have not been run against real servers, so check the output looks like name<TAB>value before trusting the result. If the query returns nothing at all, the script exits with status 2 and does not report the site as safe.

Example output on a healthy but unpatched site:

Plain text
install_task           'done'
install_time           1795690259
install_session_token  (not set)
core version           11.4.13 (affected, unpatched)

NOT VULNERABLE
install_task is 'done'. The installer refuses to run on every Drupal version.

Note that this reports on the state of the site when you run it. It does not tell you the site was never exploited, because a completed attack leaves the state looking normal. For that, see the next section.

Indicators of Compromise

Check these before running update.php if you can. The update hook sets install_task and install_time itself on sites in the bad state, which overwrites some of the evidence.

The indicators under "User 1" and "Site configuration" only appear if the attacker went through the configure form. In the quieter variant none of them fire, so an unaltered user 1 does not clear a site. That variant is covered separately below.

Install state

  • install_time is much later than the site's real age. Compare it with the created timestamp of user 1 in users_field_data, or with your oldest content. On a site that was attacked, install_time is the moment the attacker finished. (After patching, a late install_time may instead be the time update.php ran.)

  • install_session_token exists on a site nobody is installing. Someone has started resuming the install and has not finished.

User 1 (users_field_data where uid = 1)

  • name, mail or init are not what you set. The configure form overwrites all three, plus the password.

  • changed, login and access all fall at the same moment as install_time. The installer saves the account and logs it in within one request.

  • User 1 has an administrator role it did not have before. The form adds one if it is missing.

Site configuration

  • system.site has an unexpected name or mail.

  • system.date has an unexpected default timezone.

  • The Update Status module has been enabled when it was not before, and update.settings notification.emails contains an address you do not recognise. Both are options on the configure form.

Logs

  • Web server access log: any request to /core/install.php on a live site is worth a look. A probe gets the "Drupal already installed" page. An attack gets a sequence instead: a GET that is answered with the installer UI, possibly batch requests to install.php carrying id= and op= parameters, then a POST to install.php (the configure form), then requests to the site carrying a session cookie.

  • Drupal's log (watchdog table, if Database Logging is on): a "Session opened for" entry of type user for user 1 from an unfamiliar address, and bursts of "module installed" or "theme installed" entries at a time when nobody was deploying.

If the configure form was skipped (the quieter variant)

The account and site configuration are unchanged, so the evidence is thinner:

  • install_time is still set at the moment the attacker finished, and is later than the site's real age. This is the most reliable indicator, and the one update.php can mask.

  • User 1's login timestamp matches install_time, at a moment the real administrator did not log in. changed does not move, because the account is never saved; name, mail, init and the password hash are as you left them.

  • Web server access log: requests to /core/install.php with no POST of the configure form. Expect one or more GETs, possibly with langcode= and profile= parameters, ending in a redirect to the site, followed by requests carrying a session cookie.

  • Drupal's log: a "Session opened for" entry for user 1 showing the account's real name, from an unfamiliar address. If the location column of that watchdog row points at core/install.php, the login came from the installer and not the login form.

After the takeover

What an attacker does with an administrator account is not specific to this bug. It is recommended to look for new administrator accounts, newly enabled modules, changed text formats, and unexpected files under the public files directory.

What to do

  1. Update to 11.4.14, 11.3.23 or 10.6.23. Unsupported branches have no fix; move to a supported one.

  2. Run update.php (or drush updatedb). This is the step that repairs the state.

  3. Block core/install.php at the web server on every site that is already installed. This would have prevented both this advisory and the previous one.

  4. Review the indicators above. If user 1 looks altered, set its email address to one you control, reset its password, and follow Drupal's guidance for a hacked site. If user 1 looks untouched but install_time or its login timestamp is unexplained, treat the site the same way: the quieter variant leaves the account as it was.

Appendix: the checker script

Save as check_cve_2026_136716.py. Usage is described under Checking for compromise.

Python
#!/usr/bin/env python3
"""Check a Drupal site for the install state abused by CVE-2026-136716
(SA-CORE-2026-019).

The check is read-only. It looks at three values in Drupal's state store:

    install_task, install_time, install_session_token

It exits with status: 0 = not in the vulnerable state, 1 = vulnerable state,
2 = could not determine.

Provided as is, with no warranty of any kind. Licensed under the MIT License.
"""

import argparse
import re
import sqlite3
import sys
from urllib.parse import quote

KEYS = ("install_task", "install_time", "install_session_token")

# First fixed release per supported branch, from SA-CORE-2026-019.
FIXED = {(10, 6): (10, 6, 23), (11, 3): (11, 3, 23), (11, 4): (11, 4, 14)}

# First release per branch with the installer session token and install_time
# checks (SA-CORE-2026-017). Older code resumes any unfinished install.
GUARDED = {(10, 6): (10, 6, 22), (11, 3): (11, 3, 22), (11, 4): (11, 4, 13)}


def php_unserialise_scalar(raw):
    """Decode the PHP-serialised scalars Drupal stores for these keys"""
    if raw is None:
        return None
    if isinstance(raw, bytes):
        raw = raw.decode("utf-8", "replace")
    raw = raw.strip()
    m = re.fullmatch(r's:\d+:"(.*)";', raw, re.S)
    if m:
        return m.group(1)
    m = re.fullmatch(r"i:(-?\d+);", raw)
    if m:
        return int(m.group(1))
    m = re.fullmatch(r"b:([01]);", raw)
    if m:
        return m.group(1) == "1"
    if raw == "N;":
        return None
    raise ValueError("unexpected serialised value: %r" % raw[:60])


def read_sqlite(path):
    db = sqlite3.connect("file:%s?mode=ro" % quote(path), uri=True)
    marks = ",".join("?" * len(KEYS))
    rows = db.execute(
        "SELECT name, value FROM key_value WHERE collection = 'state' AND name IN (%s)"
        % marks,
        KEYS,
    ).fetchall()
    return dict(rows)


def read_stdin():
    rows = {}
    for line in sys.stdin:
        line = line.rstrip("\r\n")
        if not line.strip():
            continue
        name, sep, value = line.partition("\t")
        if not sep or name not in KEYS:
            raise ValueError("expected 'name<TAB>value' rows, got: %r" % line[:60])
        rows[name] = value
    return rows


def code_status(root):
    """Return (version string, affected, guarded).

    affected: True/False, or None if the version could not be determined.
    guarded: whether the code has the SA-CORE-2026-017 installer checks, or
    None if unknown.
    """
    try:
        with open(root.rstrip("/") + "/core/lib/Drupal.php", encoding="utf-8") as fh:
            m = re.search(r"const VERSION = '([^']+)'", fh.read())
    except OSError as e:
        return "unreadable (%s)" % e, None, None
    if not m:
        return "unknown", None, None
    version = m.group(1)
    nums = re.match(r"(\d+)\.(\d+)\.(\d+)", version)
    if not nums:
        return version, None, None
    v = tuple(int(n) for n in nums.groups())
    if v[:2] in FIXED:
        return version, v < FIXED[v[:2]], v >= GUARDED[v[:2]]
    if v < (11, 4, 0):
        # 11.0-11.2, 10.5 and below, 9.x and 8.x: end-of-life, no fix and
        # no installer checks at all.
        return version, True, False
    # A branch newer than the advisory covers.
    return version, False, True


def assess(state, guarded=None):
    """Return (exit code, headline, detail) for the decoded state values.

    guarded is False when the code is known to predate SA-CORE-2026-017.
    """
    task = state.get("install_task")
    time = state.get("install_time")
    token = state.get("install_session_token")

    if task == "done":
        return 0, "NOT VULNERABLE", (
            "install_task is 'done'. The installer refuses to run on every "
            "Drupal version."
        )
    if not task:
        return 0, "NOT IN THE VULNERABLE STATE", (
            "No install_task is recorded. On a site with tables and active "
            "configuration the installer refuses to run. This is still an "
            "abnormal state for a live site; updating and running update.php "
            "will normalise it. (If this database is empty, the site simply "
            "is not installed yet and the installer is open by design.)"
        )
    if guarded is False:
        return 1, "VULNERABLE STATE", (
            "install_task is %r and this code predates SA-CORE-2026-017, so "
            "the installer checks neither install_time nor a session token. "
            "Anyone who can reach core/install.php can resume the "
            "installation and take over user 1. Block install.php now, "
            "update, and run update.php." % task
        )
    note = "" if guarded else (
        " This holds on 11.4.13, 11.3.22, 10.6.22 and later only. Older code "
        "has no such check: pass --root to confirm the version."
    )
    if time:
        return 0, "NOT VULNERABLE", (
            "install_task is %r but install_time is set, so the installer "
            "treats the site as installed. update.php on a fixed release will "
            "set install_task to 'done'." % task + note
        )
    if token is None:
        return 1, "VULNERABLE STATE", (
            "install_task is %r, install_time is not set and no installer "
            "session token exists. On unpatched code anyone who can reach "
            "core/install.php can resume the installation and take over "
            "user 1. Block install.php now, update, and run update.php." % task
        )
    return 0, "INCOMPLETE INSTALL, CLAIMED BY A BROWSER SESSION", (
        "install_task is %r and install_time is not set, but an installer "
        "session token exists, so only the browser that holds it can "
        "continue. If you did not start that installation, somebody else "
        "did: treat this as a possible compromise in progress." % task + note
    )


def main():
    ap = argparse.ArgumentParser(
        description="Check a Drupal site for the CVE-2026-136716 install state."
    )
    src = ap.add_mutually_exclusive_group(required=True)
    src.add_argument("--sqlite", metavar="FILE", help="path to the site's SQLite database")
    src.add_argument("--stdin", action="store_true", help="read 'name<TAB>value' rows from stdin")
    ap.add_argument("--root", metavar="DIR", help="Drupal root, to report the code version")
    args = ap.parse_args()

    try:
        raw = read_sqlite(args.sqlite) if args.sqlite else read_stdin()
        state = {k: php_unserialise_scalar(v) for k, v in raw.items()}
    except (sqlite3.Error, ValueError) as e:
        print("ERROR: could not read install state: %s" % e, file=sys.stderr)
        return 2
    if not raw:
        # An installed site always has an install_task row, so no rows at all
        # means the query failed or looked in the wrong place.
        print(
            "ERROR: no install state rows were returned. Check that the query "
            "ran without errors, and the database name and table prefix.",
            file=sys.stderr,
        )
        return 2

    for key in KEYS:
        print("%-22s %s" % (key, repr(state[key]) if key in state else "(not set)"))

    affected = guarded = None
    if args.root:
        version, affected, guarded = code_status(args.root)
        label = {True: "affected, unpatched", False: "patched", None: "version unknown"}[affected]
        print("%-22s %s (%s)" % ("core version", version, label))

    code, headline, detail = assess(state, guarded)
    print("\n%s\n%s" % (headline, detail))
    if code == 1 and affected is False:
        print(
            "\nThe code is patched, so the web installer now refuses this state, "
            "but update.php has not been run (or did not complete). Run it."
        )
    return code


if __name__ == "__main__":
    sys.exit(main())

Written by

Jordan Newman

The Strand team specialises in digital forensics, incident response, and cybersecurity threat analysis.