To patch a critical GitLab vulnerability you upgrade to a release that contains the fix published in GitLab's security advisories or release blog posts. The safe sequence is: confirm which versions are affected, run a full backup that GitLab itself can restore from, take the backup outside the instance, install the patched package with the distribution's package manager, run the reconfigure and upgrade checks, then verify the version plus the specific behaviour the fix addresses. The critical part is preparation: once you upgrade, rolling back is painful unless you have a restorable backup, and "it is up and reachable" is not the same as "the vulnerability is closed".

This guide assumes a Linux package (Omnibus) installation, which includes the common self-managed builds on Debian/Ubuntu and RHEL-family systems. If you run GitLab in Docker, in Kubernetes with the official GitLab Helm chart, or on GitLab.com, the mechanics differ: containers mean pulling the new image tag instead of running apt or dnf, Kubernetes clusters need a chart or image update through your own deployment pipeline, and GitLab.com is patched by GitLab. The verification section is broadly the same.

What You'll Need

  • SSH or console access to the GitLab server plus a sudo-capable account.
  • The current official security advisory or release post for your GitLab version, and the exact patched version number from it.
  • Enough free disk space for a full backup and then some, because the backup writes to disk before you move it.
  • The details of how the instance is backed up (where the backup lands, and the encryption or remote-storage settings, if any), so you can restore from it.
  • A known maintenance window and agreement with users, since the upgrade involves downtime while services restart, and a short downtime window can become a long one if something goes wrong.
  • A second person or an out-of-band channel if the instance is your single point of failure.

Step-by-Step

  1. Identify the affected versions and the target version. Read the official advisory for the release series you run and note which versions are vulnerable and which carry the fix. Do not guess from the release blog's title. If your instance is several minor releases behind, GitLab's documentation requires upgrading through supported intermediary versions in order, not jumping straight to the latest, so map out the path before you touch anything.
  2. Check what you are running. On the server, run sudo gitlab-rake gitlab:env:info and note the GitLab version, the edition (CE or EE) and the database version. Also check sudo gitlab-ctl status so you know which services are healthy before you start.
  3. Take a full backup and confirm it completed. Run sudo gitlab-backup create (on older versions the task name is gitlab-rake gitlab:backup:create). It prints a backup ID; record it. Note that this backup does not include /etc/gitlab configuration secrets by default, so copy /etc/gitlab/gitlab-secrets.json and /etc/gitlab/gitlab.rb to a secure location yourself. Then copy the whole backup off the server. A backup that only exists on the machine you are about to upgrade is not a backup.
  4. Test restore access. At minimum, verify the backup archive is present and non-trivial in size and that you have the configuration files. Where possible, do a rehearsal restore on a separate, non-production instance first, which is the only way to know your backup is usable.
  5. Stop the services. Run sudo gitlab-ctl stop (you may need sudo gitlab-ctl stop puma and the sidekiq equivalent if you want to keep other services up during a large background job). In practice, stopping everything is simpler and less error-prone for a security patch.
  6. Install the patched package. First refresh the packages the way your distribution expects, then install the exact version. On Debian or Ubuntu the command type is sudo apt-get update followed by sudo apt-get install gitlab-ee or gitlab-ce matching your edition; on RHEL or CentOS it is sudo yum update gitlab-ee or the equivalent. Pin the exact version from the advisory rather than letting the package manager choose, because the package repositories may already carry a later release than your target.
  7. Reconfigure and run the upgrade checks. Run sudo gitlab-ctl reconfigure and watch for errors. Then run any database migrations the release requires (GitLab tells you the task in the release notes; typically sudo gitlab-rake db:migrate). Reconfigure has to be run before migrations in the standard order.
  8. Start the services and check the version. Run sudo gitlab-ctl start and confirm with sudo gitlab-rake gitlab:check and an admin-page lookup that the reported version matches the patched release. If it still shows the old version, the package did not actually install, so stop and inspect your package manager log.
  9. Verify the fix in practice. Do not stop at the version number. Check the advisory's description of the vulnerability, find a safe, non-destructive way to confirm the changed behaviour — for example, an unauthorised request that was previously accepted now being rejected, or a UI or API action that was broken now working — and try it on a test project. If the advisory describes a setting or default that changed, confirm the setting is present and correct.
  10. Watch the instance afterwards. Follow the logs (sudo gitlab-ctl tail) for errors, run a repository check if the release notes recommend it, confirm CI runners still register, and re-enable monitoring and alerts. Keep the backup and configuration copies until you are confident, and note the exact upgrade and verification in your change records.

Common Mistakes

The most frequent problem is treating a backup on disk as a backup. People run the backup task, see "completed", upgrade, and only later discover the archive was never removed from the machine. Copy it off and keep the configuration files with it.

Second is skipping intermediary versions. A jump across several minor releases can leave you with a database schema that neither the old nor the new version can use cleanly. Third, running gitlab-ctl reconfigure but not watching it: reconfigure can exit with a partially applied config, and starting services on top of that gives confusing secondary failures. Fourth, forgetting that package managers may upgrade you past the patched version, which can silently change behaviour beyond the security fix. Fifth, upgrading in the middle of a large background job or while a runner fleet is busy, which turns a fast restart into a long one. Finally, declaring victory at "the login page loads" without checking the specific behaviour the advisory describes.

Tips

Always install the exact version from the advisory rather than the latest, so you know precisely what changed. Snapshot the VM outside GitLab as well if your platform offers that; it is a different recovery path when the backup restore itself fails. Schedule the window after a database-consistent period, and communicate downtime clearly. If you run a deployment with external services such as Redis, Postgres or object storage, check whether the release has minimum supported versions before you begin — a security patch is not the moment to discover a version mismatch. Keep the upgrade path and verification commands in a runbook so the next patch takes minutes rather than hours.

Troubleshooting

Service starts then stops. Look at sudo gitlab-ctl tail around the failure. The usual causes are a failed migration, a permissions issue on /var/opt/gitlab, or insufficient memory during the reindexing steps.

Package manager resolves the wrong version. Check which repository is configured and confirm the candidate version with a dry run. If the repository already contains a later release, install the explicit patched version, not the latest.

Reconfigure fails. Fix the reported error and rerun it before starting services; do not start anything on top of a failed reconfigure. If it fails on a TLS or certificate path, confirm the certificate files still exist and are readable.

The site loads but shows the old version. The package may have installed to a different edition than you expect, or a running process holds an old image. Restart all services and recheck.

You need to roll back. This is destructive: restoring the backup returns the database to the pre-upgrade state and discards anything created after the backup. Downgrading packages alone is often unsupported after migrations run. If restore is the plan, warn stakeholders first and confirm the backup ID.

Verification test still shows the old behaviour. Confirm you are testing the right endpoint or screen, that caches are cleared, and that you are on the patched version. If the version is correct and behaviour persists, re-read the advisory — it may have described a condition that no longer applies, or need a configuration change you missed.

Frequently Asked Questions

Do I have to take the instance offline to patch it?

For a package installation, yes in practice. Stop the services, install, reconfigure, migrate and start. Plan for downtime rather than fighting it.

Is the built-in backup enough?

It covers the database and many files, but not everything by default. Copy gitlab-secrets.json and gitlab.rb separately, or the restored instance may not work.

How soon should a critical be patched?

GitLab's own guidance is to treat security releases seriously and patch quickly. Your organisation's policy sets the exact window; the safe rule is as soon as you have verified the backup.

Can I verify the fix without touching production?

Usually yes. A cloned or snapshot instance on the same version lets you rehearse the upgrade and test the behaviour first. That is the safest pattern.

Do I need to patch runners too?

Check the advisory. Some fixes affect GitLab Runner separately from the server, and runner versions have their own release notes.

Is GitLab.com affected by this?

No action is needed from you on GitLab.com; it is patched by GitLab. The steps here are for self-managed instances.