nyx/tests/fixtures/xxe/php/safe_xxe.php
2026-05-07 01:29:31 -04:00

8 lines
398 B
PHP

<?php
// Safe: simplexml_load_string is XXE-safe by default in libxml ≥ 2.9 when
// the dangerous LIBXML_NOENT flag is not passed. The gate's `dangerous_values`
// list is restricted to LIBXML_NOENT / LIBXML_DTDLOAD / LIBXML_DTDATTR, so
// the default options literal here suppresses the finding.
$xml = $_GET['xml'];
$doc = simplexml_load_string($xml, "SimpleXMLElement", 0);
echo $doc->title;