C and C++ Binaries


BADFUNC.PATH._SPAWN : Use of _spawn

Summary

A use of a _spawn-family function that takes a path argument (see full list below). These functions are vulnerable to path spoofing if the path argument is not securely specified.

Properties

Class Name Use of _spawn
Significance security
Mnemonic BADFUNC.PATH._SPAWN
Categories
CWE CWE:676 Use of Potentially Dangerous Function
DISA-3r10 DISA-3r10:V-6157 The designer will ensure the application does not contain invalid URL or path references.
BSI BSI:Exec-SearchPath-01  
  BSI:Exec-SearchPath-02  
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 _spawn"
To enable all BSI-related classes, including all BSI-specific BADFUNC classes, use the bsi configuration preset.

Triggering Functions

int _spawnl(int mode, const char *cmdname, const char *arg0, ...)
int _spawnle(int mode, const char *cmdname, const char *arg0, ...)
int _spawnlp(int mode, const char *cmdname, const char *arg0, ...)
int _spawnlpe(int mode, const char *cmdname, const char *arg0, ...)
int _spawnv(int mode, const char *cmdname, const char *const *argv)
int _spawnve(int mode, const char *cmdname, const char *const *argv, const char *const *envp)
int _spawnvp(int mode, const char *cmdname, const char *const *argv)
int _spawnvpe(int mode, const char *cmdname, const char *const *argv, const char *const *envp)
int _wspawnl(int mode, const wchar_t *cmdname, const wchar_t *arg0, ...)
int _wspawnle(int mode, const wchar_t *cmdname, const wchar_t *arg0, ...)
int _wspawnlp(int mode, const wchar_t *cmdname, const wchar_t *arg0, ...)
int _wspawnlpe(int mode, const wchar_t *cmdname, const wchar_t *arg0, ...)
int _wspawnv(int mode, const wchar_t *cmdname, const wchar_t *const *argv)
int _wspawnve(int mode, const wchar_t *cmdname, const wchar_t *const *argv, const wchar_t *const *envp)
int _wspawnvp(int mode, const wchar_t *cmdname, const wchar_t *const *argv)
int _wspawnvpe(int mode, const wchar_t *cmdname, const wchar_t *const *argv, const wchar_t *const *envp)

Resolution

When you are warned about a use of one of these functions, make sure that the cmdname argument is a fully-specified path name (including file extension) from a trusted source.

Once you are satisfied that these conditions hold, 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.