Severity:

HIGH RISK

(7.8)

Unsafe Deserialization in TYPO3 CMS Mailer

CVE-2026-0859

Analyzed

Vulnerability type

Category:

Unsafe Deserialization

CWE:

CWE-502

Impact:

Arbitrary Code Execution on Web Server

Severity:

HIGH RISK

(7.8)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

TYPO3 CMS contains an unsafe deserialization issue in its mail-file spool handling, where spool files are deserialized when the mailer:spool:send command runs.

Local users with write access to the mail spool directory can craft malicious spool files that trigger arbitrary PHP code execution on the web server during mail processing.

Affected context

The vulnerability occurs in TYPO3 CMS instances configured to use file-based mail spooling, where outgoing emails are queued as serialized data on disk and later processed via the mailer:spool:send command.

It becomes relevant in environments where:

  • The mail spool directory is writable by local users or other processes beyond the TYPO3 runtime user
  • Spool files are treated as trusted and deserialized without strict validation or isolation
  • Scheduled tasks, cron jobs, or maintenance workflows regularly execute the mailer spool send command through the TYPO3 CLI or automation tooling

Exploit preconditions

  • Attack surface: Local to the host or container running TYPO3, specifically the file-based mail spool directory.
  • Required access: Ability to create or modify files in the TYPO3 mail spool directory (e.g., same system user, shared hosting accounts, compromised local service).
  • Trigger point: Execution of the mailer:spool:send command via CLI, cron, or task scheduler that processes spool files and deserializes their contents.
  • Why exploitation is possible: The mail spool implementation deserializes file contents assuming they are trusted, allowing attacker-controlled serialized PHP data to instantiate objects or invoke code paths that can be leveraged for arbitrary PHP code execution.

Why this happens

This vulnerability stems from using PHP's deserialization mechanisms on data stored in the file-based mail spool without treating that data as untrusted input.

The mailer logic assumes that spool files only contain legitimate serialized mail objects produced by TYPO3, and does not enforce integrity checks, strict typing, or isolation of the deserialization process.

This aligns with CWE-502: Deserialization of Untrusted Data, where serialized data from a potentially accessible storage location is deserialized into application objects, and the resulting object graph can trigger gadget chains or magic methods that lead to arbitrary code execution.

In abstract terms, the pattern is:

  • Persist complex objects via serialization for deferred processing
  • Store them in a location that can be influenced by other local actors
  • Later deserialize with full trust and execution privileges, without verification of origin or structure

Potential impact

  • Execution of arbitrary PHP code in the context of the web server or TYPO3 CLI user
  • Complete compromise of the TYPO3 instance, including modification of content and configuration
  • Access to database credentials and sensitive configuration secrets stored in TYPO3
  • Lateral movement to other applications or services reachable from the compromised host
  • Installation of web shells, backdoors, or persistent malware on the server

General mitigation guidance

Effective mitigation generally focuses on eliminating unsafe deserialization paths and hardening file-based queues:

  • Prefer mail transport mechanisms that do not rely on generic serialization for spooling or queuing (e.g., database-backed queues or direct SMTP with retry mechanisms that do not deserialize complex objects).
  • Restrict access to the mail spool directory so that only the dedicated TYPO3 runtime user and trusted system services can read or write files there.
  • Introduce strong integrity or authenticity checks for queued mail data (for example, signing or checksumming) before deserialization to detect tampering.
  • Limit the complexity of objects stored in the spool by using simple, well-defined data structures rather than arbitrary object graphs.
  • Run the TYPO3 web and CLI processes with least-privilege OS accounts, and minimize their file system permissions to reduce blast radius if exploitation occurs.
  • Consider isolating mail-processing commands in dedicated environments (containers, chroot jails, or separate hosts) so that a compromise of the mailer process does not automatically imply full system compromise.

How teams detect issues like this

Detection approaches can combine code-centric analysis with operational monitoring:

  • Static analysis: Search for use of generic unserialize() or equivalent deserialization APIs in mail or spool-related code paths, especially where input originates from the file system or other shared resources.
  • Code review signals: Flag patterns where serialized data is read from disk and directly deserialized without validation, integrity checks, or strict whitelisting of allowed object types.
  • Configuration review: Regularly audit permissions on TYPO3-related directories, including the mail spool, ensuring only the expected service account has write access.
  • Runtime monitoring: Monitor the spool directory for unexpected files, unusual ownership changes, or anomalous write patterns from non-TYPO3 processes.
  • Process and log monitoring: Track invocations of mailer:spool:send and correlate with unusual application behavior, errors during deserialization, or unexpected outbound connections.
  • Automated SAST or code-scanning tools can be configured to flag deserialization usage in persistence or queueing layers to help catch these issues early in development.

Sources

SourceLink
github.comgithub.com/TYPO3/typo3/commit/3225d705080a1bde57a66689621c947da5a4782f
github.comgithub.com/TYPO3/typo3/commit/722bf71c118b0a8e4f2c2494854437d846799a13
github.comgithub.com/TYPO3/typo3/commit/e0f0ceee480c203fbb60b87454f5f193e541d27f
typo3.orgtypo3.org/security/advisory/typo3-core-sa-2026-004

Frequently asked

questions

Not directly in its described form. Exploitation typically requires local or equivalent access that allows writing to the mail spool directory. However, if an attacker can chain another vulnerability to gain such write access, they may be able to leverage this issue for code execution.

The attacker needs the ability to create or modify files in the TYPO3 mail spool directory. This can include local OS users, compromised system services that share the same runtime environment, or other tenants in shared-hosting scenarios where directory permissions are overly broad.

The most robust fix is to avoid deserializing untrusted data altogether in the mail spool and related components. Where queueing is necessary, migrate to formats that do not support arbitrary object graphs (such as JSON with strict schemas) and ensure that any queued data is stored in locations with strict filesystem permissions and integrity checks.

Treat any serialized data as untrusted unless its source is strongly authenticated and integrity-protected. Use data-only serialization formats with explicit schemas, enforce strict access control on storage locations for queued or temporary files, and include deserialization sinks as high-risk areas in threat modeling, code review, and automated static analysis policies.

Find out what's already
exploitable in your codebase.