Crash in unserialize()
Open
Nobody has claimed this yet.
Bug
Status: Verified
- Dominant language
- C
- Stars
- 40.4k
- Forks
- 8.1k
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 96
Description
Description
Originally reported by @calysteon.
<?php
class Trigger {
public function __destruct() {
@unserialize('i:1;');
}
}
$payload = 'a:1019:{';
for ($i = 0; $i < 1017; $i++) {
$payload .= "i:$i;s:1:\"A\";";
}
// Entry that overflows into a second var_entries block
$payload .= 'i:1017;O:7:"Trigger":0:{}';
// Duplicate key overwrites Trigger, pushing it to dtor list (refcount stays at 1)
$payload .= 'i:1017;i:0;}';
$result = @unserialize($payload);
PHP Version
-
Operating System
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the supplied PHP reproducer and tracing the unserialize() entry point, including the destructor-triggering behavior shown in the example. Done means this payload no longer crashes PHP and the regression is covered by an appropriate test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, php
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100