Skip to content

Possible executable path hijacking (CreateProcess)

Description

Due to how `CreateProcess` parses spaces, an attacker may be able to exploit this function by creating a binary with the same name that is loaded first, depending on the search path order. Ensure that quotation marks around the executable path are used.

Examples

Insecure Code

c
CreateProcess(NULL, "C:\Program Files\MyApp.exe",...)

Secure Code

c
CreateProcessA(NULL, "\"C:\\Program Files\\MyApp.exe\"",...)

Remediation

Use quotation marks around the executable path, such as: `CreateProcessA(NULL, ""C:\Program Files\MyApp.exe"",...)`

Rule Details

FieldValue
IDCODE-0612
CategoryInjection
SeverityHIGH
CWECWE-78
ConfidenceHIGH
ImpactHIGH
LikelihoodMEDIUM
ExploitabilityMODERATE
Tagsexecutable path hijacking, CreateProcess
OWASPA1:2017-Injection, A03:2021-Injection