Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions commandinjection.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using System.Diagnostics;

namespace Injections
{
public class OsCommandInjection
{
public void RunOsCommand(string command)
{
// ruleid: os-command-injection
var process = Process.Start(command);
}

//
public void RunOsCommandWithProcessParam(string command)
{
Process process = new Process();

process.StartInfo.FileName = command;
// ruleid: os-command-injection
process.Start();
}

public void RunConstantAppWithArgs(string args)
{
ProcessStartInfo processStartInfo = new ProcessStartInfo()
{
FileName = "constant",
Arguments = "constant"
};

// ok: os-command-injection
var process = Process.Start(processStartInfo);
}
}
}