/

CVE-2026-29782

Severity:

HIGH RISK

(7.2)

Unsafe Deserialization in OpenSTAManager OAuth2 Endpoint

CVE-2026-29782

Analyzed

Vulnerability type

Category:

Unsafe Deserialization

CWE:

CWE-502

Impact:

Remote Code Execution and Application Compromise

Severity:

HIGH RISK

(7.2)

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

OpenSTAManager's oauth2.php endpoint unsafely calls PHP's unserialize() on attacker-influenced data from the database without any class restrictions.

Because this endpoint is unauthenticated and uses a user-controlled GET parameter to select the record, an attacker who can influence the serialized access_token field may trigger arbitrary object instantiation and potentially achieve remote code execution or application compromise.

Affected context

The vulnerability occurs in the OAuth2 integration flow implemented by OpenSTAManager's oauth2.php script.

This endpoint:

  • Is explicitly configured to skip permission checks (unauthenticated access)
  • Selects a record from the zz_oauth2 table using the attacker-controlled state GET parameter
  • Deserializes the access_token field using PHP's unserialize() with no class restrictions

The risk is most pronounced when the stored access_token field can be influenced, directly or indirectly, by untrusted input or when dangerous gadget classes are available in the application's codebase.

Exploit preconditions

  • Attack surface: Publicly reachable web endpoint oauth2.php.
  • Required access: No authentication required; attacker needs HTTP access to the endpoint and a way to reference or influence records in zz_oauth2.
  • Trigger point: Invocation of the OAuth2 configuration or callback flow where oauth2.php:
  • Reads the state parameter from the query string
  • Loads the corresponding record from zz_oauth2
  • Calls unserialize() on the access_token column.
  • Why exploitation is possible:
  • state is used directly to select the database record, giving the attacker control over which serialized blob is deserialized.
  • PHP's unserialize() is used without any class whitelist or allowed_classes restriction.
  • Presence of autoloaded classes and known gadget chains can allow attacker-controlled objects to execute logic during deserialization.

Why this happens

The core issue is the use of PHP's unserialize() on data that is not guaranteed to be fully trusted, with no restrictions on which classes may be instantiated.

This fits CWE-502: Deserialization of Untrusted Data, where serialized structures are treated as inherently safe and deserialized into live objects within the application's execution context.

In this pattern:

  • A database field (access_token) stores serialized PHP data.
  • An unauthenticated request parameter (state) determines which record is loaded.
  • The application assumes the stored serialized blob is safe and invokes unserialize() directly.

Because PHP object deserialization can trigger magic methods (__wakeup, __destruct, etc.) and other side effects, any available gadget chain in the application or its dependencies can potentially be abused by attackers to perform unauthorized actions, including remote code execution.

Potential impact

  • Remote code execution via gadget chains present in application or library classes
  • Execution of arbitrary application-level actions with the server's privileges
  • Unauthorized access to or manipulation of application data
  • Session hijacking or elevation of privileges if sensitive objects are deserialized
  • Interference with OAuth2 integration, including token theft or misuse
  • Denial of service by crafting payloads that cause resource exhaustion or fatal errors during deserialization

General mitigation guidance

Effective mitigation focuses on eliminating unsafe deserialization and tightening trust boundaries around serialized data:

  • Avoid using unserialize() for application data where possible; prefer safer data formats such as JSON that do not carry code or object behavior.
  • If deserialization is unavoidable, use mechanisms that:
  • Restrict allowed classes (e.g., allowed_classes) to a minimal, well-reviewed set of simple value objects.
  • Store only primitive data structures and reconstruct objects explicitly in application logic.
  • Treat all data loaded from external systems or databases that may be influenced by users as untrusted:
  • Validate and sanitize inputs that determine which records are loaded (such as state).
  • Ensure that the records being deserialized cannot be modified by low-privilege or unauthenticated users.
  • Reduce the power of gadget chains by:
  • Reviewing classes with dangerous side effects in magic methods and refactoring them to avoid network, filesystem, or command execution in those methods.
  • Apply least-privilege principles to the web server and application runtime, so that a successful exploit has reduced impact.

How teams detect issues like this

Organizations can identify and monitor unsafe deserialization patterns using several complementary approaches:

  • Static analysis:
  • Define rules to flag uses of unserialize() and similar APIs across the codebase.
  • Highlight cases where deserialization sources are database fields or request-driven selections.
  • Look for absence of allowed class restrictions or explicit checks on data being deserialized.
  • Code review practices:
  • Treat any usage of serialization/deserialization APIs as high-risk and require security-focused review.
  • Inspect OAuth2 and other integration flows for unauthenticated endpoints that process dynamic or indirect input from users.
  • Review magic methods (__wakeup, __sleep, __destruct) for side effects that could form gadget chains.
  • Runtime and logging:
  • Add logging around deserialization operations to capture unexpected or malformed payloads.
  • Monitor for anomalies such as unusual state parameter values or repeated failed OAuth2 flows.
  • Automated tooling:
  • Integrate SAST tools that detect unsafe deserialization patterns into CI/CD pipelines.
  • Use dependency and configuration scanners to identify known gadget-prone libraries or prior unsafe deserialization issues.

Sources

SourceLink
github.comgithub.com/devcode-it/openstamanager/commit/d2e38cbdf91a831cefc0da1548e02b297ae644cc
github.comgithub.com/devcode-it/openstamanager/releases/tag/v2.10.2
github.comgithub.com/devcode-it/openstamanager/security/advisories/GHSA-whv5-4q2f-q68g

Frequently asked

questions

Yes. The affected oauth2.php endpoint is unauthenticated, and an attacker with network access to the application can send crafted requests to trigger deserialization, provided they can reference or influence the targeted serialized access_token data.

No user authentication is required for the vulnerable endpoint itself. However, practical exploitation may depend on whether an attacker can create or modify OAuth2 records or otherwise cause controlled serialized data to be present in the zz_oauth2 table.

The safest pattern is to remove reliance on PHP's unserialize() for user-influenced or indirectly controlled data and replace it with safer, data-only formats like JSON. Where deserialization is truly necessary, enforce strict class whitelisting and ensure that only benign, data-only structures are ever deserialized.

Establish a development guideline that treats serialization APIs as dangerous by default, requiring explicit justification and security review. Prefer data-only encodings, limit which endpoints are unauthenticated, validate all request parameters used to select records, and periodically scan the codebase for unsafe deserialization and gadget-prone classes as part of continuous security practices.

Find out what's already
exploitable in your codebase.