top of page

Identify and Fix Unquoted Paths Vulnerability Automatically

Updated: Sep 5

The unquoted paths vulnerability is a security flaw that occurs when a software application or service running on a system references executable files or scripts without enclosing the file path in quotation marks. This can lead to a potentially exploitable security gap because the operating system interprets the unquoted path incorrectly.

When a program with an unquoted path runs, the OS may attempt to execute the name of the directory with the space.


C:\Program Files (x86)\Application.exe

C:\Program Files (x86)\Application One\

An attacker can place a malicious executable in a directory with a similar name to the one referenced in the unquoted path. When the vulnerable program runs, it might mistakenly execute the malicious code, enabling unauthorized access, privilege escalation, or other security breaches.

To mitigate this vulnerability, developers should always use quotation marks around file paths in their code to ensure that the correct executable is executed, and users should keep their systems updated to patch any discovered unquoted paths. vulnerabilities.

For demo purposes, the system has been intentionally afflicted with unquoted path vulnerabilities.

This output is from a dedicated Unquoted script found @

This output is from a far more extensive suite of scripts that search many vulnerabilities and configuration errors and present the results in an HTML format that can be imported into Excel and can be found @

While the capacity to spot vulnerabilities is valuable, my approach focuses on automatically addressing these issues during deployments whilst also reviewing the output. Resolving security vulnerabilities is then built into MDT and SCCM (MECM) Task Sequences. Equally, the reporting and resolution of this issue can be accomplished manually by executing the scripts with Admin privileges from PowerShell.

No manual intervention is required, any application that falls through the gaps eg a member of staff deploying an app without following the process, that's if the process exists.

Back to Github to download the 2nd script that 'fixes' Unquoted paths.

Output is provided to any actions taken both to PowerShell and a log file.

The script adds the double-quotation marks both preceding and following the imagepath, ensuring that the path is properly enclosed within quotation marks.

1 view0 comments
bottom of page