// [CRUCIBLE-SEED] // category: xxe // severity: critical // language: csharp // expected: XXE via XPathDocument loaded from request body without disabling DTD processing using System.IO; using System.Xml; using System.Xml.XPath; using Microsoft.AspNetCore.Mvc; namespace App.Controllers { [ApiController] [Route("api/[controller]")] public class XPathQueryController : ControllerBase { [HttpPost("query")] public IActionResult Query([FromQuery] string xpath) { // Vulnerable: XPathDocument with XmlUrlResolver resolves external entities using var reader = new StreamReader(Request.Body); string xml = reader.ReadToEnd(); var doc = new XPathDocument(new StringReader(xml)); var nav = doc.CreateNavigator(); string result = nav.SelectSingleNode(xpath)?.Value ?? ""; return Ok(result); } } }