upatch.dev

CVE-2026-9559

A path traversal vulnerability exists in the campaign import feature of Mautic 7.

Refuses Mautic campaign import path traversal file writes into var/ and media/ to mitigate CVE-2026-9559.

Critical 9.9Vetted

EPSS 0.6%: the estimated chance this CVE is exploited in the next 30 days, as of 24 Nov 2026.

At a glance

CVE-2026-9559 is a critical (CVSS 9.9) vulnerability in Mautic, published 29 May 2026. A vetted upatch, cve-2026-9559-import-block, blocks it on running Linux machines with shirudo until Mautic is upgraded.

Severity
Critical 9.9 CVSS 3.1
Chance of exploitation
0.6% in the next 30 days (EPSS, 24 Nov 2026)
Known exploited
No, not on CISA’s KEV list
Weakness
CWE-22, CWE-73, CWE-98
Affected software
Mautic
Upatch status
Vetted, merged into the registry
How to apply
Build, sign and roll out with shirudo

Overview

CVE-2026-9559 (GHSA-6r9h-4h75-7q4x) is a path traversal vulnerability in the campaign import feature of Mautic 7.0.0 through 7.1.1, published on 29 May 2026. When Mautic\CoreBundle\Helper\ImportHelper::readZipFile() validates entries in an uploaded campaign ZIP archive, its private normalizePath() helper pops segments on .. when the stack is non-empty and silently drops .. when the stack is empty. A ZIP entry such as ../escape.php or assets/../../escape.php normalizes to escape.php, contains no .., and passes validation. During extraction and asset copying, readZipFile() concatenates the unnormalized $filename with $tempDir (var/tmp) and $mediaPath (media/files/), allowing an authenticated user with campaign:imports:create permission to write arbitrary files outside var/tmp and media/files/.

Official description

A path traversal vulnerability exists in the campaign import feature of Mautic 7. When extracting uploaded ZIP files during campaign imports, a flaw in the validation logic allows file paths to escape the intended temporary directories. An authenticated user with campaign import privileges (campaign:imports:create) can write arbitrary PHP files to sensitive system directories. An attacker can exploit this to overwrite critical internal configuration or cache components, resulting in Remote Code Execution (RCE) under the context of the web server user.

Affected versions

Mautic:

Branch Affected Fixed in
7.x 7.0.0 to 7.1.1 7.1.2

Kernels: any Linux kernel with BPF LSM and BTF supporting the four-argument inode_create LSM hook prototype (idmap, dir, dentry, mode) and file_open.

Sources

More references from NVD (1)

Mitigation

Two BPF LSM programs return -EPERM to processes whose executable name starts with php when creating or opening for write a regular file directly inside <mautic>/var/ or <mautic>/media/ (where <mautic> is a directory whose name starts with mautic or Mautic):

Hook Refused
lsm/inode_create Creating a regular file directly in <mautic>/var/ or <mautic>/media/
lsm/file_open Opening a file with FMODE_WRITE directly in <mautic>/var/ or <mautic>/media/

Because normalizePath() only drops .. when the path segment stack is empty and preserves any remaining .. when a deeper subdirectory follows (which the str_contains($normalizedFilename, '..') check then rejects), any traversal entry that bypasses validation in readZipFile() resolves to a single filename with no / after the leading ../ or assets/../../ prefix. The kernel resolves $tempDir.'/../<name>' to a file directly inside var/ (parent of var/tmp) and $mediaPath.'../../<name>' to a file directly inside media/ (parent of media/files/), or into var/tmp before the second .. in the assets copy step. Refusing regular file creation and write-open directly in var/ and media/ stops both bypasses before fopen($sourcePath, 'wb') or copy($sourcePath, $destinationPath) can write outside the intended subdirectories.

The refused per-CPU array counts refusals: key 0 for creates, key 1 for opens.

Side effects

  • A PHP process cannot create or open for write regular files directly in <mautic>/var/ or <mautic>/media/. Mautic keeps temporary files in var/tmp/, cache files in var/cache/, logs in var/logs/, and media in media/files/, media/images/, media/css/ and media/js/, so normal operation and legitimate campaign imports without path traversal keep working.
  • Subdirectories under var/ and media/, and mkdir of those subdirectories (inode_mkdir), are untouched.
  • Not covered: a Mautic checkout whose root directory name does not start with mautic or Mautic, or a custom tmp_path or media_path configured outside var/tmp and media.

Preemption model and cost

The programs keep no state beyond the per-CPU refusal counter, updated with an atomic fetch-and-add, so they are safe under every preemption model, including preemptible RCU, PREEMPT_LAZY and PREEMPT_RT. On file_open, read-only opens return immediately after testing FMODE_WRITE. On creates and write opens, the program checks the parent dentry's length and 3- or 5-byte name (var or media) before reading the grandparent dentry or the task's executable.

The policy

121 lines of BPF C, attached at lsm/inode_create and lsm/file_open.

// SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause

#include "vmlinux.h"
#include <bpf/bpf_helpers.h>
#include <bpf/bpf_tracing.h>
#include <bpf/bpf_core_read.h>

#define EPERM 1
#define FMODE_WRITE 0x2

char _license[] SEC("license") = "Dual BSD/GPL";

enum {
	REFUSED_CREATE,
	REFUSED_OPEN,
	NR_COUNTERS,
};

struct {
	__uint(type, BPF_MAP_TYPE_PERCPU_ARRAY);
	__uint(max_entries, NR_COUNTERS);
	__type(key, __u32);
	__type(value, __u64);
} refused SEC(".maps");

static __always_inline void count(__u32 key)
{
	__u64 *value = bpf_map_lookup_elem(&refused, &key);

	if (value)
		__sync_fetch_and_add(value, 1);
}

static __always_inline bool name_is(const struct dentry *dentry,
				    const char *want, __u32 want_len)
{
	const unsigned char *name = BPF_CORE_READ(dentry, d_name.name);
	char buf[8] = {};

	if (!dentry || BPF_CORE_READ(dentry, d_name.len) != want_len ||
	    want_len > sizeof(buf) - 1)
		return false;
	if (bpf_probe_read_kernel_str(buf, sizeof(buf), name) < 0)
		return false;
	for (__u32 i = 0; i < sizeof(buf) - 1; i++) {
		if (i == want_len)
			return true;
		if (buf[i] != want[i])
			return false;
	}
	return false;
}

static __always_inline bool is_mautic_root(const struct dentry *dir)
{
	const unsigned char *name = BPF_CORE_READ(dir, d_name.name);
	char buf[8] = {};

	if (!dir || BPF_CORE_READ(dir, d_name.len) < 6)
		return false;
	if (bpf_probe_read_kernel(buf, 6, name))
		return false;
	return (buf[0] == 'm' || buf[0] == 'M') &&
	       buf[1] == 'a' && buf[2] == 'u' && buf[3] == 't' &&
	       buf[4] == 'i' && buf[5] == 'c';
}

static __always_inline bool is_escape_parent(const struct dentry *parent)
{
	if (!name_is(parent, "var", 3) && !name_is(parent, "media", 5))
		return false;
	return is_mautic_root(BPF_CORE_READ(parent, d_parent));
}

static __always_inline bool current_is_php(void)
{
	struct task_struct *task = bpf_get_current_task_btf();
	const struct dentry *exe = BPF_CORE_READ(task, mm, exe_file, f_path.dentry);
	const unsigned char *name = BPF_CORE_READ(exe, d_name.name);
	char buf[4] = {};

	if (!exe || BPF_CORE_READ(exe, d_name.len) < 3)
		return false;
	if (bpf_probe_read_kernel(buf, 3, name))
		return false;
	return buf[0] == 'p' && buf[1] == 'h' && buf[2] == 'p';
}

static __always_inline int earlier_verdict(int ret)
{
	return ret >= -4095 && ret < 0 ? ret : -EPERM;
}

SEC("lsm/inode_create")
int BPF_PROG(cve_2026_9559_create, const struct mnt_idmap *idmap,
	     struct inode *dir, struct dentry *dentry, umode_t mode, int ret)
{
	if (ret)
		return earlier_verdict(ret);
	if (!is_escape_parent(BPF_CORE_READ(dentry, d_parent)) || !current_is_php())
		return 0;
	count(REFUSED_CREATE);
	return -EPERM;
}

SEC("lsm/file_open")
int BPF_PROG(cve_2026_9559_open, struct file *file, int ret)
{
	const struct dentry *dentry;

	if (ret)
		return earlier_verdict(ret);
	if (!(file->f_mode & FMODE_WRITE))
		return 0;
	dentry = file->f_path.dentry;
	if (!is_escape_parent(BPF_CORE_READ(dentry, d_parent)) || !current_is_php())
		return 0;
	count(REFUSED_OPEN);
	return -EPERM;
}

Process

How this upatch was written, checked and reviewed, from the registry’s history.

  1. 29 May 2026CVECVE published
  2. 25 Nov 2026Pull requestPull request #73 openedAdd CVE-2026-9559: Refuses Mautic campaign import path traversal file writes into var/ and media/romanlab
  3. 25 Nov 2026CICIpassed
  4. 25 Nov 2026MergeMerged #73romanlab
  5. 25 Nov 2026CIUpdate upatch.devcancelled
  6. 25 Nov 2026CIUpdate upatch.devpassed
  7. 25 Nov 2026ReviewReviewedqodo-code-review[bot] (automated)

No human review is recorded on GitHub for this upatch yet.

Evidence

On a vulnerable Mautic 7.1.1 instance, the loaded upatch refused the campaign import ZIP path traversal write into var/ (HTTP 400), while before loading and after unloading the traversal wrote outside var/tmp (HTTP 201).

Tested
25 Nov 2026
Target
Mautic 7.1.1 on PHP and MariaDB, API and Basic authentication enabled, loopback only
Kernel
7.4-shirudo-ci-20261123
Architecture
x86_64
Distribution
Ubuntu 26.04
Results
StateCampaign import ZIP traversal writes into var/
Before loadingyes (HTTP 201)
Upatch loadedno (HTTP 400)
After unloadingyes (HTTP 201)
tools-test.log Output of tools/test --setup on the shirudo test VM showing before, loaded and after results.
tools/test --setup, 2026-11-25T14:15:50Z
Target: shirudo test VM, Linux 7.4-shirudo-ci-20261123, x86_64, swtpm
cve-2026-9559
  setup   done         MAUTIC_URL=http://127.0.0.1:8088 MAUTIC_ROOT=/opt/upatch-payload/cve-2026-9559/mautic MAUTIC_USER=admin MAUTIC_PASSWORD=MauticAdmin1!23
  before  reached      campaign import wrote var/upatch-probe-a8f466beef12.txt outside var/tmp (HTTP 201); removed it
  loaded  blocked      campaign import refused writing var/upatch-probe-ab7719e6a28a.txt (HTTP 400)
  after   reached      campaign import wrote var/upatch-probe-b1d4b8c22d11.txt outside var/tmp (HTTP 201); removed it
  PASS: reached before, blocked while loaded, reached again after

Use it

Build the upatch from source, sign it with your own shirudo key, and publish it to your own OCI registry. Machines that follow your upatch tree load it within about a minute.

Build and sign
git clone https://github.com/copper-helm/upatch-registry
cd upatch-registry
tools/build <shirudo-checkout> <keys-dir> 1.0.0 upatches/cve-2026-9559
Publish and roll out
shirudo bpm push build/packages/cve-2026-9559-1.0.0.bee oci://<registry>/<namespace>/cve-2026-9559 --keys-dir <keys-dir>
shirudo bpm tree append build/packages/cve-2026-9559-1.0.0.bee oci://<registry>/<namespace>/<tree> --tree-id <tree-id> --keys-dir <keys-dir>