← 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 并限制大小

延伸阅读