/

CVE-2026-57859

Severity:

HIGH RISK

(7.5)

PHP Unsafe Deserialization (CWE-502) in e107 e_array

CVE-2026-57859

Deferred

Vulnerability type

Category:

Unsafe Deserialization

CWE:

CWE-502

Impact:

Remote Code Execution

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

e107 prior to version 2.3.8 contains an unsafe PHP deserialization flaw in the e_array handler that leads directly to code execution via eval().

An attacker who can write crafted data into the user_prefs database column can trigger arbitrary PHP execution when user preferences are loaded, potentially compromising the entire application.

e107 prior to version 2.3.8 contains an unsafe PHP deserialization flaw in the e_array handler that leads directly to code execution via eval().

An attacker who can write crafted data into the user_prefs database column can trigger arbitrary PHP execution when user preferences are loaded, potentially compromising the entire application.

Affected context

This vulnerability occurs in e107 installations that store user preferences in a database column and rely on the e_array::unserialize() handler to reconstruct these preferences at runtime.

It is relevant where out-of-band mechanisms (plugins, integrations, auxiliary services, or indirect database access paths) can write to the user_prefs column without robust validation.

The risk materializes when e_user_pref::load() is invoked for an affected user, causing the stored payload to be processed by eval() inside core_functions.php.

This vulnerability occurs in e107 installations that store user preferences in a database column and rely on the e_array::unserialize() handler to reconstruct these preferences at runtime.

It is relevant where out-of-band mechanisms (plugins, integrations, auxiliary services, or indirect database access paths) can write to the user_prefs column without robust validation.

The risk materializes when e_user_pref::load() is invoked for an affected user, causing the stored payload to be processed by eval() inside core_functions.php.

Exploit preconditions

  • Attack surface: Application runtime when loading user preferences via e_user_pref::load()
  • Required access: Ability to perform out-of-band writes or indirect modifications to the user_prefs database column
  • Trigger point: Deserialization of the stored preference string by e_array::unserialize(), followed by eval() execution
  • Why exploitation is possible: The handler performs only a simple prefix check for the string "array" and then passes the entire value to eval(), treating attacker-controlled data as PHP code
  • Attack surface: Application runtime when loading user preferences via e_user_pref::load()
  • Required access: Ability to perform out-of-band writes or indirect modifications to the user_prefs database column
  • Trigger point: Deserialization of the stored preference string by e_array::unserialize(), followed by eval() execution
  • Why exploitation is possible: The handler performs only a simple prefix check for the string "array" and then passes the entire value to eval(), treating attacker-controlled data as PHP code

Why this happens

The underlying bug is an unsafe deserialization pattern where serialized data is trusted and executed as code.

In e107, e_array::unserialize() assumes that any string starting with "array" represents a benign serialized structure and forwards it directly to eval().

This maps to CWE-502 (Unsafe Deserialization) because untrusted or indirectly controlled data is deserialized using an execution primitive, allowing arbitrary PHP to run whenever stored preferences are materialized.

The underlying bug is an unsafe deserialization pattern where serialized data is trusted and executed as code.

In e107, e_array::unserialize() assumes that any string starting with "array" represents a benign serialized structure and forwards it directly to eval().

This maps to CWE-502 (Unsafe Deserialization) because untrusted or indirectly controlled data is deserialized using an execution primitive, allowing arbitrary PHP to run whenever stored preferences are materialized.

Potential impact

  • An attacker may execute arbitrary PHP code in the context of the web server.
  • An attacker could read or modify application data, including credentials and configuration settings.
  • An attacker can potentially escalate privileges within the application or underlying system, depending on environment hardening.
  • An attacker may install backdoors or modify content, impacting site integrity and availability.
  • An attacker may execute arbitrary PHP code in the context of the web server.
  • An attacker could read or modify application data, including credentials and configuration settings.
  • An attacker can potentially escalate privileges within the application or underlying system, depending on environment hardening.
  • An attacker may install backdoors or modify content, impacting site integrity and availability.

General mitigation guidance

Effective mitigation typically focuses on removing execution semantics from deserialization paths and reducing trust in persisted data.

Recommended patterns include:

  • Replace eval()-based reconstruction with safe, structured parsing or native serialization mechanisms that do not execute code.
  • Enforce strict typing and schema validation on all preference data before deserialization, rejecting malformed or unexpected formats.
  • Treat data read from the database as untrusted until validated, especially when written by asynchronous processes or third-party integrations.
  • Apply least-privilege principles to application components that can modify user_prefs, limiting write capabilities to well-audited code paths.
  • Introduce centralized sanitization and encoding routines for preference data to ensure it cannot be interpreted as executable PHP.

Effective mitigation typically focuses on removing execution semantics from deserialization paths and reducing trust in persisted data.

Recommended patterns include:

  • Replace eval()-based reconstruction with safe, structured parsing or native serialization mechanisms that do not execute code.
  • Enforce strict typing and schema validation on all preference data before deserialization, rejecting malformed or unexpected formats.
  • Treat data read from the database as untrusted until validated, especially when written by asynchronous processes or third-party integrations.
  • Apply least-privilege principles to application components that can modify user_prefs, limiting write capabilities to well-audited code paths.
  • Introduce centralized sanitization and encoding routines for preference data to ensure it cannot be interpreted as executable PHP.

How teams detect issues like this

Detection generally combines code-level inspection with behavioral monitoring:

  • Use static analysis to flag eval() usage and custom deserialization handlers that operate on database-backed fields like user_prefs.
  • During code review, treat any function that converts strings to executable PHP (e.g., eval, create_function, dynamic includes) as a high-risk pattern, especially when input originates from persistence layers.
  • Establish security linters or CI policies that block unsafe deserialization constructs and require justification or redesign for dynamic execution paths.
  • Monitor application logs and database records for anomalous or code-like payloads in preference fields, which may indicate attempted exploitation.

Detection generally combines code-level inspection with behavioral monitoring:

  • Use static analysis to flag eval() usage and custom deserialization handlers that operate on database-backed fields like user_prefs.
  • During code review, treat any function that converts strings to executable PHP (e.g., eval, create_function, dynamic includes) as a high-risk pattern, especially when input originates from persistence layers.
  • Establish security linters or CI policies that block unsafe deserialization constructs and require justification or redesign for dynamic execution paths.
  • Monitor application logs and database records for anomalous or code-like payloads in preference fields, which may indicate attempted exploitation.

Sources

SourceLink
github.comgithub.com/e107inc/e107
github.comgithub.com/e107inc/e107/commit/40e73cefde85b32e1227dfac9956a5cb87046277
github.comgithub.com/e107inc/e107/security/advisories/GHSA-568x-w5qj-vr7c
vulncheck.comvulncheck.com/advisories/e107-second-order-code-execution-via-eval-based-deserialization-in-e-array-unserialize

Frequently asked

questions

It can be, if an attacker can influence writes to the user_prefs column through exposed functionality, integrations, or other indirect channels. Direct database access is not strictly required if application features allow crafting the stored payload.

The attacker needs the ability to write or manipulate data in the user_prefs field out-of-band or via application logic. Once the crafted payload is stored, routine loading of user preferences will execute it.

Remove eval() from the deserialization path, adopt safe serialization formats (such as native PHP serialization or JSON), and ensure that preference data is treated strictly as data, never as executable code.

Avoid dynamic execution of serialized content, enforce strong validation for any data read from storage, incorporate static analysis and security-focused code review into development workflows, and establish architectural guidelines that prohibit eval-based logic for configuration or preference handling.

It can be, if an attacker can influence writes to the user_prefs column through exposed functionality, integrations, or other indirect channels. Direct database access is not strictly required if application features allow crafting the stored payload.

The attacker needs the ability to write or manipulate data in the user_prefs field out-of-band or via application logic. Once the crafted payload is stored, routine loading of user preferences will execute it.

Remove eval() from the deserialization path, adopt safe serialization formats (such as native PHP serialization or JSON), and ensure that preference data is treated strictly as data, never as executable code.

Avoid dynamic execution of serialized content, enforce strong validation for any data read from storage, incorporate static analysis and security-focused code review into development workflows, and establish architectural guidelines that prohibit eval-based logic for configuration or preference handling.

Find out what's already
exploitable in your codebase.