Nested unserialize() can expose an outer object while its __unserialize() data is still being parsed
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 25/100
調査の方向性
The issue provides a PHP reproducer that triggers the bug in php-src's unserialize. Investigate the C parser handling nested unserialize calls and shared reference tables; no specific files are named. A fix requires a design decision on rejecting references versus preserving cyclic payloads, and validation with the reproducer.
索引モデルが issue の本文から書いたものです。
説明
Description
A nested unserialize() call from Serializable::unserialize() shares the outer reference table. An r/R record can therefore resolve to an outer object whose __unserialize() data is still being parsed. At that point __unserialize() has not been queued and cannot be called because the outer parser frame is suspended.
If inner code only stores the object, identity is preserved and it is initialized later. If it accesses the object immediately, it observes incomplete userland properties and could reach uninitialized native state for internal classes.
Unlike GH-19860, this object is not fully parsed, so finishing pending callbacks at the nested boundary cannot fix this case.
Reproducer
<?php
class Outer {
public string $value;
public function __unserialize(array $data): void {
$this->value = "ready";
}
}
class Legacy implements Serializable {
public function serialize(): string {
return "";
}
public function unserialize(string $data): void {
$object = unserialize($data);
var_dump(isset($object->value));
}
public function __serialize(): array {
return [];
}
public function __unserialize(array $data): void {}
}
$result = unserialize("O:5:\"Outer\":1:{i:0;C:6:\"Legacy\":4:{r:1;}}");
echo $result->value, "\n";
Output:
bool(false)
ready
Expected behavior
This needs a separate design decision. Rejecting these references prevents unsafe access, but breaks cyclic payloads that previously retained the object until initialization completed.
- 主要言語
- C
- スター
- 41.8k
- フォーク
- 8.5k
- 平均マージ
- 2日 12時間
- マージ済み PR(30日)
- 137
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
php/php-src のほかの issue
-
SNMP accepts malformed remote ports対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 2/5 半日 初心者へのやさしさ 62/100
php/php-src#25137 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Bug Status: Needs Triage
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
メンテナーはふだん 1 日以内に返信
-
quoted_printable_encode() produces lines longer than 76 characters for bytes 0xF5 to 0xFF対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
Bug Status: Needs Triage
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
php/php-src#24196 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Feature Status: Needs Triage
難易度 2/5 1〜3時間 初心者へのやさしさ 73/100
php/php-src#24183 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
似ている issue
-
enhancement good first issue help wanted
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
-
bug multiplayer status: planned
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
ChupathingyCE/chupathingyce#851 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 73/100
HigherOrderCO/Bend#2104 ·
-
research-radar
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
good first issue help wanted program
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
hffgzktbcc-blip/ounce-core#297 ·
メンテナーはふだん 1 日以内に返信