GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — PhpBench XML report insecure deserialization · Issue #1155 · phpbench/phpbench

PhpBench XML report insecure deserialization #1155

New issue
Copy link
New issue
Copy link
Open
Open
PhpBench XML report insecure deserialization#1155
Copy link

Description

@fa1c4
fa1c4
opened on Jun 29, 2026
Issue body actions

1. Bug Topic

Insecure PHP object deserialization in PhpBench\Serializer\XmlDecoder when decoding XML report parameters.

2. Release Version / Commit Hash / Affected Range

composer.json identifies the package as phpbench/phpbench with branch alias dev-master: 1.2-dev. Exact commit hash was not included.

3. Bug Type

Insecure deserialization / PHP object injection.

4. CWE

CWE-502: Deserialization of Untrusted Data.

5. Bug Summary

When decoding XML report parameters, PhpBench calls unserialize(base64_decode(...)) for parameters with type="serialized". XML files can be supplied through phpbench report --file and baseline-related command flows, so a malicious XML report can instantiate attacker-controlled PHP objects.

6. Root Cause

XmlDecoder::getParameters() assumes serialized parameter data is trusted internal data. It does not pass allowed_classes => false, does not restrict classes, and does not validate the decoded value before unserializing.

7. Attack Preconditions

A user or CI job processes an attacker-controlled XML report file with PhpBench. Exploit severity depends on loaded classes and available PHP magic-method gadget chains.

8. Impact Analysis

The primitive can trigger magic methods such as __wakeup() during XML decoding. Depending on the runtime class set, impact may range from unexpected side effects to arbitrary file writes or code execution through gadget chains.

9. Affected Code

  • lib/Serializer/XmlDecoder.php::getParameters() raw unserialize(base64_decode(...)) for PARAM_TYPE_SERIALIZED.
  • lib/Console/Command/Handler/SuiteCollectionHandler.php::suiteCollectionFromInput() accepts --file and calls decodeFiles().
  • ReportCommand and RunCommand expose this path through command-line workflows.

10. PoC

Use the standalone PoC in https://github.com/fa1c4/security-advisories/tree/main/phpbench:

docker build -t poc-phpbench-xml-deserialization .
docker run --rm poc-phpbench-xml-deserialization

Successful output contains:

[VULNERABLE] unserialize() instantiated an attacker-controlled object and executed __wakeup during XML decoding.

Activity

  1. dantleech commented on Jul 5, 2026

    @dantleech
    dantleech
    on Jul 5, 2026
    Member
    More actions

    I think the chances of somebody exploting this are low however there's no good reason to call store serialized values, and from what I can see the only values serialized in this way are DateTime instances. So it's probably enough to either prohibit objet serialization for parameters at all or to allow DateTimeInterface instances.

    B/C needs to be taken into account - and I think that while technically it's a B/C break, functionally I don't think it matters. The XML documents are used to generate reports and/or act as baselines serializing the object seems pretty pointless.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402520 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.