DEV Community

facilishz
facilishz

Posted on

MediaWiki Echo turns legacy job data into a PHP code-execution path

MediaWiki Echo turns legacy job data into a PHP code-execution path

The MediaWiki Echo extension can pass an attacker-controlled event_extra value into PHP unserialize() without restricting the classes it may construct. CVE-2026-132726 documents how a job parameter can reach that legacy branch. The Wikimedia security task rates the resulting path as critical because the job runner can call a PHP function chosen by the attacker, then run operating-system commands as the PHP-FPM user.

The chain has three separate security failures

Echo's Event::deserializeExtra() accepts JSON when the value begins with { or [. For older serialized values it calls unserialize() without allowed_classes. The reported gadget is Wikimedia\RequestTimeout\CriticalSectionScope, whose destructor invokes a callable stored in one property with an argument stored in another. A crafted object can therefore turn object injection into a callback with attacker-selected arguments.

The second link is the job path. EchoNotificationJob takes eventData from its job parameters when no eventId is present. The public Wikimedia task says an unsigned job-runner endpoint allowed job parameters to be forged. That job-runner issue is a separate fix. The third link is deployment authority: the job runner loads MediaWiki configuration and database credentials, so code execution there exposes more than the Echo feature.

The task is careful about proof. The unsigned job path was confirmed in production with a harmless null job. The Echo callback was reproduced locally, not tested as a full production compromise. CVE-2026-132726 discusses the local proof, the default production configuration, and the missing control that would let a normal web user drive the chain. Those distinctions matter when deciding whether an alert represents a vulnerability test, a configuration mistake, or an active intrusion.

Why JSON migration did not close the issue

MediaWiki changed new Echo writes to JSON in 1.45. The legacy PHP-serialized branch remained so older echo_event rows could still be read. That compatibility requirement kept an object-construction path alive for job data even though new events no longer needed PHP serialization. The proposed patch passes allowed_classes => false on the job path while leaving the database compatibility path unchanged.

This is a useful example of a migration that changes the storage format before it changes the trust boundary. Code that must read old rows continues to accept the old parser. If the same parser is reused for new transport data, the compatibility path becomes an attack surface.

Patch the parser and the job entry point

Apply the vendor's Echo security update to every maintained branch in use. Patch the unsigned job-runner endpoint as a separate dependency because either fix alone leaves a meaningful path open. A signed job with a stolen $wgSecretKey can still provide hostile parameters, and a direct write to echo_event can still reach the row-reading branch.

After patching, verify that job parameters cannot instantiate arbitrary classes. Test with a harmless recorder class if the project already has a safe reproduction harness. Do not use a shell command as the callback. Inspect the job runner's network policy and ensure that internal endpoints are not reachable from ordinary web users or untrusted workloads.

Find legacy rows and privileged job paths

Inventory Echo tables for event_extra values that do not begin with JSON. Query the legacy classes that legitimately appear and decide whether the database reader can be restricted to an allow-list. Migrate or expire old rows according to the supported maintenance process. Do not delete notification history without an approved retention decision.

Review who can write job parameters, who holds signing secrets, and which workloads can reach RunSingleJob.php. Rotate secrets only after coordinating the effect on legitimate jobs. Collect audit records for changes to Echo jobs, job-runner configuration, and MediaWiki vendor dependencies.

Detection that reflects the actual chain

Look for unusual job types, malformed eventData, and job requests from hosts that normally do not submit work. Correlate them with changes to Echo code, vendor packages, or the job-runner endpoint. A PHP warning from unserialize() may be a useful signal, but production logging often suppresses warnings. Do not treat the absence of a warning as proof that no object was created.

The strongest control is code-level: no untrusted bytes should reach an object-capable deserializer. The second control is architectural: compromise of a job worker should not expose application secrets and database credentials to every application callback. MediaWiki operators can act on both while preserving legitimate queued notifications.

References

Top comments (0)