From 50b54942c337813a0a3d2e77e1766cc5914b7182 Mon Sep 17 00:00:00 2001 From: dt <98478153+realcorvus@users.noreply.github.com> Date: Mon, 6 Jan 2025 15:49:34 -0500 Subject: [PATCH] Add System.shell command injection --- lib/sobelow/ci/system.ex | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/sobelow/ci/system.ex b/lib/sobelow/ci/system.ex index be029eb..f3c5c26 100644 --- a/lib/sobelow/ci/system.ex +++ b/lib/sobelow/ci/system.ex @@ -1,6 +1,6 @@ defmodule Sobelow.CI.System do @moduledoc """ - # Command Injection in `System.cmd` + # Command Injection via `System` This submodule of the `CI` module checks for Command Injection vulnerabilities through usage of the `System.cmd` function. @@ -12,7 +12,7 @@ defmodule Sobelow.CI.System do $ mix sobelow -i CI.System """ @uid 2 - @finding_type "CI.System: Command Injection in `System.cmd`" + @finding_type "CI.System: Command Injection via `System` function" use Sobelow.Finding @@ -22,9 +22,17 @@ defmodule Sobelow.CI.System do Finding.init(@finding_type, meta_file.filename, confidence) |> Finding.multi_from_def(fun, parse_def(fun)) |> Enum.each(&Print.add_finding(&1)) + + Finding.init(@finding_type, meta_file.filename, confidence) + |> Finding.multi_from_def(fun, parse_def_shell(fun)) + |> Enum.each(&Print.add_finding(&1)) end def parse_def(fun) do Parse.get_fun_vars_and_meta(fun, 0, :cmd, [:System]) end + + def parse_def_shell(fun) do + Parse.get_fun_vars_and_meta(fun, 0, :shell, [:System]) + end end