// [CRUCIBLE-SEED] // category: path_traversal // severity: high // language: csharp // expected: Path traversal in file write with user-supplied report name enabling overwrite of arbitrary files using System.IO; using Microsoft.AspNetCore.Mvc; namespace App.Controllers { [ApiController] [Route("api/[controller]")] public class ReportController : ControllerBase { private const string ReportBase = "/var/reports/"; [HttpPost] public IActionResult SaveReport([FromQuery] string reportName, [FromBody] string content) { // Vulnerable: reportName can traverse directory (../../etc/cron.d/evil) string outputPath = ReportBase + reportName + ".txt"; File.WriteAllText(outputPath, content); return Ok($"Saved to {outputPath}"); } } }