From 6cddf2c0296e84052768fa3e4e681724f8f68bcc Mon Sep 17 00:00:00 2001 From: "David A. Wheeler" Date: Mon, 7 Oct 2024 13:46:50 -0400 Subject: [PATCH] Shell argument injection tweaks (#638) * shell-argument-injection.html: Tweak allowed answer Tweak required answer to be easier to read *and* more generous. JavaScript allows string constants with '...' or "..." or `...` (the last are a template, but you don't HAVE to use {...} inside them). The shell: false parameter isn't required. Also, whitespace is interpreted as "0 or more whitespace" in a pattern; use that to make the patterns easier to read. Signed-off-by: David A. Wheeler * Add more hints Signed-off-by: David A. Wheeler * Tweak instructions We don't require validation, presumably that was done elsewhere. Signed-off-by: David A. Wheeler * shell-argument-injection.html: Improve hints and formatting Signed-off-by: David A. Wheeler * Make name and filename equal Signed-off-by: David A. Wheeler * Add to list of available labs Signed-off-by: David A. Wheeler * Remove text not relevant to lab Since the lab doesn't require input validation, there is not need to explain it. Other lessons cover that point. Signed-off-by: David A. Wheeler * Make it clear parameter 2 is a list Signed-off-by: David A. Wheeler * MInor fixups Signed-off-by: David A. Wheeler * Update docs/labs/argument-injection.html Co-authored-by: Liran Tal Signed-off-by: David A. Wheeler --------- Signed-off-by: David A. Wheeler Co-authored-by: Liran Tal --- docs/labs/README.md | 2 +- ...injection.html => argument-injection.html} | 132 +++++++++++++----- 2 files changed, 99 insertions(+), 35 deletions(-) rename docs/labs/{shell-argument-injection.html => argument-injection.html} (57%) diff --git a/docs/labs/README.md b/docs/labs/README.md index 3447a74b..c94d6946 100644 --- a/docs/labs/README.md +++ b/docs/labs/README.md @@ -102,7 +102,7 @@ work on. * Introduction to Securely Calling Programs - The Basics * Calling Other Programs: Injection and Filenames * [SQL Injection](https://github.com/ossf/secure-sw-dev-fundamentals/blob/main/secure_software_development_fundamentals.md#sql-injection) - DONE-1 (@Elijah Everett, 2024-08-13) [sql-injection](sql-injection.html) - * OS Command (Shell) injection - DONE-1 (Marta Rybczynska) [shell-injection](shell-injection.html) + * OS Command (Shell) injection - DONE-1 (Marta Rybczynska) [shell-injection](shell-injection.html) [argument-injection](argument-injection.html) * [Other Injection Attacks](https://github.com/ossf/secure-sw-dev-fundamentals/blob/main/secure_software_development_fundamentals.md#other-injection-attacks) - PLANNED-2 (Dhananjay Arunesh via Vincent Danen, 2026-07-26) * Filenames (Including Path Traversal and Link Following) - PLANNED-2 UNASSIGNED * Calling Other Programs: Other Issues diff --git a/docs/labs/shell-argument-injection.html b/docs/labs/argument-injection.html similarity index 57% rename from docs/labs/shell-argument-injection.html rename to docs/labs/argument-injection.html index 9d52eccf..aafa4e69 100644 --- a/docs/labs/shell-argument-injection.html +++ b/docs/labs/argument-injection.html @@ -14,60 +14,123 @@ execFile('git', ['blame', '--', filePath], { shell: false }, (error, stdout, stderr) => { -