← PHP / Laravel · 目次

PHP-092 / 上級

XML Billion Laughs(実体展開 DoS)

A05:2021 Security Misconfiguration · CWE-776 Improper Restriction of Recursive Entity References

なぜ問題になるのか?

入れ子の実体により数 GB のメモリ展開が発生します。

修正方法

php
$dom = new DOMDocument(); $dom->loadXML($request->getContent(), LIBXML_NONET);  // NOENT を除去し、サイズ制限

参考資料