/

CVE-2026-24891

Severity:

HIGH RISK

(7.5)

Unsafe Deserialization in openITCOCKPIT Gearman Worker

CVE-2026-24891

Analyzed

Vulnerability type

Category:

Unsafe Deserialization

CWE:

CWE-502

Impact:

Remote Code Execution via PHP Object Injection

Severity:

HIGH RISK

(7.5)

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

openITCOCKPIT contains an unsafe deserialization sink in its Gearman worker implementation, where job payloads are passed directly to PHP's unserialize() without class restrictions or provenance checks.

In deployments where the Gearman service is reachable from untrusted systems, attackers may submit crafted job payloads that trigger PHP Object Injection in the worker process, potentially leading to remote code execution under the worker's privileges.

Affected context

This vulnerability occurs in openITCOCKPIT installations that use the Gearman worker functionality and process serialized job payloads via PHP.

The design assumes that only trusted internal components enqueue Gearman jobs, but this assumption is not enforced in the worker code.

The issue becomes particularly relevant when:

  • The Gearman service listens on non-localhost interfaces
  • Network access to TCP port 4730 is not tightly restricted
  • Untrusted or semi-trusted systems can submit Gearman jobs into the same queue

Exploit preconditions

  • Attack surface: Gearman job queue exposed over TCP (typically port 4730)
  • Required access: Ability to connect to the Gearman service and enqueue jobs to the oitc_gearman worker function (no application-level authentication enforced at the sink)
  • Trigger point: Processing of a Gearman job where the payload is passed to unserialize() inside the worker process
  • Why exploitation is possible:
  • The worker calls unserialize() on job payloads without:
  • Restricting which PHP classes can be instantiated
  • Validating or authenticating the source of the job data
  • PHP Object Injection becomes possible if any autoloaded or included class in the application has magic methods (__wakeup, __destruct, etc.) that can be abused for unintended behavior

Why this happens

The core issue aligns with CWE-502: Deserialization of Untrusted Data.

The Gearman worker implementation in openITCOCKPIT assumes that all Gearman job payloads are trustworthy and thus calls PHP's unserialize() directly on incoming data.

Deserialization in PHP is not a purely data-oriented operation: it reconstructs full object graphs and triggers magic methods, which can be leveraged when any gadget chain exists in the codebase or its dependencies.

Because the code does not enforce a strong trust boundary, does not restrict which classes may be instantiated, and does not perform input validation or integrity checks, arbitrary attacker-controlled serialized data can be interpreted as logic rather than simple data.

Potential impact

  • Remote code execution within the Gearman worker process, subject to the worker's OS and application privileges
  • Execution of attacker-controlled methods via PHP Object Injection gadget chains
  • Manipulation or corruption of monitoring configuration or state handled by the worker
  • Unauthorized access to or modification of monitored data, alerts, or metrics
  • Lateral movement within the infrastructure if the worker has access to other internal services or credentials
  • Denial of service by causing crashes or resource exhaustion in the worker

General mitigation guidance

Risk reduction for this class of vulnerability typically focuses on eliminating unsafe deserialization and enforcing trust boundaries in code, rather than relying solely on network layout or assumptions about internal components.

Useful defensive patterns include:

  • Avoiding use of unserialize() for data that may traverse network boundaries; prefer structured, data-only formats such as JSON with json_encode/json_decode or other typed, schema-based encodings.
  • If deserialization is unavoidable, using mechanisms that:
  • Whitelist allowed classes or types
  • Reject unexpected or unknown types
  • Treat incoming payloads as data, not as arbitrary object graphs
  • Applying explicit authentication or integrity controls to job payloads, such as:
  • Cryptographic signatures over messages to ensure they originate from trusted producers
  • Strict association between worker queues and authenticated producers
  • Minimizing the set of loaded classes and "gadget" functionality in worker processes, and avoiding magic methods with side effects that can be triggered during object construction or destruction.
  • Running Gearman workers and associated processes with least privilege, separating them from other sensitive components and restricting filesystem, network, and credential access.
  • Configuring network-level controls so that queues intended to be internal are not inadvertently exposed, recognizing that network controls complement but do not replace secure coding patterns.

How teams detect issues like this

Detection often combines code-centric and environment-centric approaches:

  • Static analysis and code scanning:
  • Search for direct usage of unserialize() on data influenced by external input, particularly in worker, queue, or message-handling code.
  • Define static analysis rules or linters that flag unsafe deserialization APIs and require justification or secure wrappers.
  • Look for magic methods (__wakeup, __destruct, __sleep, __toString) in classes that perform I/O, execute commands, or modify global state, as they can form gadget chains.
  • Code review practices:
  • Treat any use of unserialize() or similar APIs as a security-sensitive hotspot that mandates review.
  • Verify that trust boundaries are enforced in code, not only documented or assumed at the infrastructure level.
  • Check that job-processing logic validates payload structure and origin before acting on it.
  • Runtime and operational monitoring:
  • Monitor Gearman endpoints for unusual job sources, atypical payload sizes, or patterns of malformed jobs.
  • Log and review deserialization errors, unexpected exceptions in workers, or anomalous worker restarts, which may indicate probing attempts.
  • Automated tools and policy:
  • Integrate SAST tools into CI/CD pipelines with rules for unsafe deserialization.
  • Enforce coding policies that ban or tightly constrain dangerous APIs like unserialize() in new code.

Sources

SourceLink
github.comgithub.com/openITCOCKPIT/openITCOCKPIT/releases/tag/openITCOCKPIT-5.4.0
github.comgithub.com/openITCOCKPIT/openITCOCKPIT/security/advisories/GHSA-x4mq-8gfg-frc4

Frequently asked

questions

It can be, if the Gearman service or relevant queues are exposed beyond a strictly controlled internal network and untrusted systems can connect to TCP port 4730 or otherwise enqueue jobs. In tightly segmented and correctly restricted environments, exposure is reduced but the unsafe sink remains present.

An attacker needs the ability to connect to the Gearman service and submit jobs that will be processed by the vulnerable worker function. No additional authentication is enforced at the deserialization point itself; control over the job payload is the critical requirement.

The most robust fix is to remove unsafe deserialization entirely: stop using unserialize() on job payloads and adopt data-only serialization formats like JSON, combined with strict schema validation. Where deserialization must remain, apply class whitelisting, enforce payload integrity, and ensure that no sensitive side effects can be triggered during object reconstruction.

Treat message queues and workers as crossing explicit trust boundaries, regardless of expected deployment, and design protocols around them as data-oriented rather than object-oriented. Avoid deserialization of untrusted data, require authentication or signing of messages, minimize gadget-like code constructs, and embed security checks—such as input validation and class restrictions—directly in the code handling incoming messages. Integrating static analysis and security reviews into the development lifecycle further reduces the chance of reintroducing unsafe deserialization patterns.

Find out what's already
exploitable in your codebase.