-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18093 from MathiasVP/more-win32-command-execution…
…-functions C++: Add more `CommandExecutionFunction`s
- Loading branch information
Showing
2 changed files
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
cpp/ql/lib/semmle/code/cpp/models/implementations/Win32CommandExecution.qll
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
private import semmle.code.cpp.models.interfaces.CommandExecution | ||
|
||
/** The `ShellExecute` family of functions from Win32. */ | ||
class ShellExecute extends Function { | ||
ShellExecute() { this.hasGlobalName("ShellExecute" + ["", "A", "W"]) } | ||
} | ||
|
||
private class ShellExecuteModel extends ShellExecute, CommandExecutionFunction { | ||
override predicate hasCommandArgument(FunctionInput input) { input.isParameterDeref(2) } | ||
} | ||
|
||
/** The `WinExec` function from Win32. */ | ||
class WinExec extends Function { | ||
WinExec() { this.hasGlobalName("WinExec") } | ||
} | ||
|
||
private class WinExecModel extends WinExec, CommandExecutionFunction { | ||
override predicate hasCommandArgument(FunctionInput input) { input.isParameterDeref(0) } | ||
} | ||
|
||
/** The `CreateProcess` family of functions from Win32. */ | ||
class CreateProcess extends Function { | ||
CreateProcess() { this.hasGlobalName("CreateProcess" + ["", "A", "W"]) } | ||
} | ||
|
||
private class CreateProcessModel extends CreateProcess, CommandExecutionFunction { | ||
override predicate hasCommandArgument(FunctionInput input) { input.isParameterDeref(0) } | ||
} | ||
|
||
/** The `CreateProcessAsUser` family of functions from Win32. */ | ||
class CreateProcessAsUser extends Function { | ||
CreateProcessAsUser() { this.hasGlobalName("CreateProcessAsUser" + ["", "A", "W"]) } | ||
} | ||
|
||
private class CreateProcessAsUserModel extends CreateProcessAsUser, CommandExecutionFunction { | ||
override predicate hasCommandArgument(FunctionInput input) { input.isParameterDeref(1) } | ||
} | ||
|
||
/** The `CreateProcessWithLogonW` function from Win32. */ | ||
class CreateProcessWithLogonW extends Function { | ||
CreateProcessWithLogonW() { this.hasGlobalName("CreateProcessWithLogonW") } | ||
} | ||
|
||
private class CreateProcessWithLogonModel extends CreateProcessWithLogonW, CommandExecutionFunction { | ||
override predicate hasCommandArgument(FunctionInput input) { input.isParameterDeref(4) } | ||
} | ||
|
||
/** The `CreateProcessWithTokenW` function from Win32. */ | ||
class CreateProcessWithTokenW extends Function { | ||
CreateProcessWithTokenW() { this.hasGlobalName("CreateProcessWithTokenW") } | ||
} | ||
|
||
private class CreateProcessWithTokenWModel extends CreateProcessWithTokenW, CommandExecutionFunction | ||
{ | ||
override predicate hasCommandArgument(FunctionInput input) { input.isParameterDeref(2) } | ||
} |