C and C++ Binaries


BADFUNC.PATH._EXEC : Use of _exec

Summary

A use of an _exec-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 _exec
Significance security
Mnemonic BADFUNC.PATH._EXEC
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 _exec"
To enable all BSI-related classes, including all BSI-specific BADFUNC classes, use the bsi configuration preset.

Triggering Functions

int _execl(const char *cmdname, const char *arg0, ...)
int _execle(const char *cmdname, const char *arg0, ...)
int _execlp(const char *cmdname, const char *arg0, ...)
int _execlpe(const char *cmdname, const char *arg0, ...)
int _execv(const char *cmdname, const char *const *argv)
int _execve(const char *cmdname, const char *const *argv, const char *const *envp)
int _execvp(const char *cmdname, const char *const *argv)
int _execvpe(const char *cmdname, const char *const *argv, const char *const *envp)
int _wexecl(const wchar_t *cmdname, const wchar_t *arg0, ... const wchar_t *argn, NULL)
int _wexecle(const wchar_t *cmdname, const wchar_t *arg0, ...)
int _wexeclp(const wchar_t *cmdname, const wchar_t *arg0, ...)
int _wexeclpe(const wchar_t *cmdname, const wchar_t *arg0, ...)
int _wexecv(const wchar_t *cmdname, const wchar_t *const *argv)
int _wexecve(const wchar_t *cmdname, const wchar_t *const *argv, const wchar_t *const *envp)
int _wexecvp(const wchar_t *cmdname, const wchar_t *const *argv)
int _wexecvpe(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.