Summary
Microsoft UFO's logging subsystem constructs session log paths directly from a user-controlled task_name value, allowing crafted input to escape the intended logs/ directory.
An authenticated client can embed path traversal sequences in task_name, causing UFO to create log directories and files in arbitrary filesystem locations reachable by the service account.
Affected context
This vulnerability appears in Microsoft UFO deployments that:
- Use version 3.0.1-4-ge2626659 (or code with similar log path construction)
- Generate per-task or per-session logs based on a task_name parameter
- Rely on the logs/ directory as the boundary for log file storage
The issue manifests when the application interpolates task_name into filesystem paths without normalizing or constraining it to a safe base directory.
Exploit preconditions
- Attack surface: Application interfaces (e.g., API endpoints, automation jobs) that accept a task_name parameter and trigger logging.
- Required access: Valid authenticated client access to the UFO framework, with the ability to submit or control task_name.
- Trigger point: Any code path that constructs log directory or file paths using task_name, then creates directories or opens files for writing.
- Why exploitation is possible: The logging logic concatenates task_name directly into filesystem paths without robust validation, canonicalization, or enforcement that the resulting path remains within the intended logs/ directory.
Why this happens
The root cause aligns with CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') and CWE-73: External Control of File Name or Path.
The UFO framework trusts a user-supplied task_name to build log paths, typically via string concatenation or naive path joining, without checking for traversal sequences (e.g., ../) or resolving the final path against a fixed, allowed base.
As a result, an authenticated client can influence the effective filesystem location where log directories and log files are created, breaking the assumption that all logs are confined to the logs/ directory.
Potential impact
- Creation of log directories and files in unintended filesystem locations.
- Overwriting or clobbering existing files that the service account can write to, potentially impacting system behavior.
- Planting log content into sensitive or monitored directories, which can confuse diagnostics or incident response.
- Facilitating secondary attacks when other components later trust or process files based on their presence or location.
- Leakage of internal directory structure information through error messages or observable behavior.
General mitigation guidance
Effective mitigation focuses on decoupling user-controlled values from filesystem locations and enforcing strict directory boundaries:
- Constrain log file creation to a pre-defined base directory and resolve all paths to canonical form before use; reject any path that escapes the base.
- Avoid using raw user input in path construction; instead, map task_name to a sanitized identifier (e.g., using whitelisting, slugification, or an internal ID).
- Normalize and validate task_name against a strict allowlist of characters and length, avoiding characters used in path traversal (such as path separators).
- Use filesystem APIs that support secure path joining and base directory enforcement instead of manual string concatenation.
- Apply least-privilege principles to the UFO service account so that even if traversal occurs, the process can write only to non-sensitive locations.
How teams detect issues like this
Detection generally combines code-centric and runtime-focused practices:
- Static analysis: Configure rules to flag any use of user-controlled input in file or directory path construction, especially where
../or absolute paths might be interpreted. - Code review: Examine logging and file output logic for string concatenation with request parameters like task_name; confirm that canonicalization and base-directory checks are in place.
- Security testing: Perform targeted path traversal tests using authenticated clients, attempting to write logs outside the logs/ directory and verifying both behavior and resulting filesystem paths.
- Monitoring and logging: Instrument the system to record unexpected log path locations or failures to open files; alerts can be raised when log paths leave the expected directory tree.

