C and C++ Binaries


BADFUNC.CREATEPROCESS : Use of CreateProcess

Summary

A use of CreateProcess() or a related function (see full list below), which requires that certain precautions be taken.

Properties

Class Name Use of CreateProcess
Significance security
Mnemonic BADFUNC.CREATEPROCESS
Categories
CWE CWE:676 Use of Potentially Dangerous Function
CERT-C CERT-C:WIN02-C Restrict privileges when spawning child processes
DISA-3r10 DISA-3r10:V-6157 The designer will ensure the application does not contain invalid URL or path references.
BSI BSI:CreateProcess-02 Use of CreateProcess
  BSI:CreateProcess-03 Use of CreateProcess
  BSI:CreateProcess-04 Use of CreateProcess
OWASP-2017 OWASP-2017:A9 Using components with known vulnerabilities
OWASP-2021 OWASP-2021:A6 Vulnerable and outdated components
Availability Available for C and C++.
Enabling Checks for this warning class are disabled by default. To enable them, add the following WARNING_FILTER rule to the project configuration file.
WARNING_FILTER += allow class="Use of CreateProcess"
To enable all BSI-related classes, including all BSI-specific BADFUNC classes, use the bsi configuration preset.

Triggering Functions

BOOL WINAPI CreateProcess(
  • __in_opt LPCTSTR lpApplicationName,
  • __inout_opt LPTSTR lpCommandLine,
  • __in_opt LPSECURITY_ATTRIBUTES lpProcessAttributes,
  • __in_opt LPSECURITY_ATTRIBUTES lpThreadAttributes,
  • __in BOOL bInheritHandles,
  • __in DWORD dwCreationFlags,
  • __in_opt LPVOID lpEnvironment,
  • __in_opt LPCTSTR lpCurrentDirectory,
  • __in LPSTARTUPINFO lpStartupInfo,
  • __out LPPROCESS_INFORMATION lpProcessInformation)
BOOL WINAPI CreateProcessAsUser(
  • __in_opt HANDLE hToken,
  • __in_opt LPCTSTR lpApplicationName,
  • __inout_opt LPTSTR lpCommandLine,
  • __in_opt LPSECURITY_ATTRIBUTES lpProcessAttributes,
  • __in_opt LPSECURITY_ATTRIBUTES lpThreadAttributes,
  • __in BOOL bInheritHandles,
  • __in DWORD dwCreationFlags,
  • __in_opt LPVOID lpEnvironment,
  • __in_opt LPCTSTR lpCurrentDirectory,
  • __in LPSTARTUPINFO lpStartupInfo,
  • __out LPPROCESS_INFORMATION lpProcessInformation)
BOOL WINAPI CreateProcessWithLogonW(
  • __in LPCWSTR lpUsername,
  • __in_opt LPCWSTR lpDomain,
  • __in LPCWSTR lpPassword,
  • __in DWORD dwLogonFlags,
  • __in_opt LPCWSTR lpApplicationName,
  • __inout_opt LPWSTR lpCommandLine,
  • __in DWORD dwCreationFlags,
  • __in_opt LPVOID lpEnvironment,
  • __in_opt LPCWSTR lpCurrentDirectory,
  • __in LPSTARTUPINFOW lpStartupInfo,
  • __out LPPROCESS_INFORMATION lpProcessInfo)

Resolution

When you are warned about a use of one of these functions, check that the following conditions are satisfied.

If so, you can change the warning state to Suppressed.

Relevant Configuration File Parameters

This class is implemented using a BAD_FUNCTION_* rule set in the general template configuration file.

The following configuration file parameters affect checks for this warning class.