Skip to content
KitploitKITPLOIT
ToolsExploitsBlog
Log in
Submit
ToolsExploitsBlog
Submit

Hacking, PenTest, and Cybersecurity Tools for Your Security Arsenal!

Kitploit is a directory of hacking, cybersecurity, and pentesting tools. Discover the latest project updates to find vulnerabilities, analyze systems, automate testing, and strengthen your security.

FeedsContactPrivacy© 2026 Kitploit

Tool Directory

Categories

View all categories
Loading categories
cortex9-trivy-action-envfile-source-injection-model — Offline educational model of CVE-2026-26189 (trivy-action envfile source injection) | Kitploit
Tools/GitHubGitHub/federiconbaez/cortex9-trivy-action-envfile-source-injection-model
Static AnalysisVulnerability AnalysisCode AnalysisShellcodeDevSecOpsSupply Chain SecurityPapers & ResearchLearning & EducationLabs & Practice
GitHubfedericonbaez/cortex9-trivy-action-envfile-source-injection-model

cortex9-trivy-action-envfile-source-injection-model

Offline educational model of CVE-2026-26189 (trivy-action envfile source injection)

View Repository
6 days agoNot yet reviewed

Most Popular

View all →

Discover the most used tools by our community.

Explore all tools

Browse our collection of tools

View all tools →
Share

cortex9-trivy-action-envfile-source-injection-model

Offline model of CVE-2026-26189 (GHSA-9p44-j4g5-cfx5): the composite action aquasecurity/trivy-action wrote each input as export NAME=<input> into trivy_envs.txt with echo and no shell quoting, and entrypoint.sh then ran source ./trivy_envs.txt, so shell syntax inside an input was read by bash. The sink came with 7aca5acc9500; the fix, bc61dc55704e (trivy-action 0.34.0), writes the line with printf 'export %s=%q\n'. Educational, deterministic, C11 checked with ASan/UBSan. No action, workflow, runner or Trivy is run; no trivy_envs.txt is written and nothing is sourced or evaluated. The model builds the line as a string and a static reader says what bash would do with it.

Spanish: README.es.md. Exercises: PRACTICE.md.

What is modelled (tied to the diffs)

Diff lineCodeModel
7aca5acc9500 action.yaml ctx 151/159shell: bash for "Set Trivy environment variables"the writer is bash (echo without -e)
bc61dc55704e old 186 / new 186[ ! -z "$input_value" ] -> [ -n "$input_value" ], != "$default_value"NOT_WRITTEN (same answer before and after)
7aca5acc9500 new 184 = bc61dc55704e old 188echo "export $var_name=$input_value" >> trivy_envs.txtpre line
bc61dc55704e new 189printf 'export %s=%q\n' "$var_name" "$input_value" >> trivy_envs.txtpost line, src/bash_q.c
7aca5acc9500 entrypoint.sh new 8-9if [ -f ./trivy_envs.txt ]; then source ./trivy_envs.txtsrc/bread.c reads the line

The GHSA names the same call sites (action.yaml:188, entrypoint.sh:9). How each action input reaches $2 of set_env_var_if_provided, and which inputs and defaults exist, is not in the diffs; the variable names in the fixtures come from test/test.bats in 7aca5acc9500 (new 158-161) and the defaults are synthetic.

Labels, in priority order: NOT_WRITTEN, BAD_INPUT, SYNTAX_ERROR, CMD_SUBST, CONTROL_OP (; & | ( ) or a further line), REDIRECT, EXPANSION ($name, ${..}, $[..]), TILDE, BRACE, WORD_SPLIT, VALUE_CHANGED (one word, but not the input), LITERAL.

Differential evidence (results/)

Inputprepost
trivy-$(id).sarif (the GHSA's PR-title pattern), trivy-`id`.sarifCMD_SUBSTLITERAL
a;id, a\nid, a|id, a&&idCONTROL_OPLITERAL
a>f, a<fREDIRECTLITERAL
$HOME, x${PATH}, $[1]EXPANSIONLITERAL
~, a:~/x / {a,b}, x{1..3}TILDE / BRACELITERAL
a b, a\tb / a 'b, ' / "a", a\b, a #cWORD_SPLIT / SYNTAX_ERROR / VALUE_CHANGEDLITERAL
image.sarif, CRITICAL,HIGH, knqyf263/vuln-image:1.2.3, a=~, a*LITERALLITERAL
empty, or equal to the defaultNOT_WRITTENNOT_WRITTEN

results/sweep.csv tries every byte 0x01-0x7f alone and between a and b: before the fix 15 bytes leave LITERAL in each position; after it, none do and the dequoted value always equals the input. In the tests every 1- and 2-byte ASCII value, every 3-byte value over a 40-symbol special alphabet and 60,000 generated values give LITERAL after the fix.

How %q was pinned

src/bash_q.c restates what the local GNU bash 5.2.37 prints for printf %q, ASCII only: '' for empty; if any byte is a control byte the whole value becomes $'...' (\a \b \t \n \v \f \r \E, \\, \', other control bytes as three-digit octal); otherwise a backslash before space ! " $ & ' ( ) * , ; < > ? [ \ ] ^ ` { | }, before ~ at the start or after = or :, and before # at the start. scripts/crosscheck_bash.sh (local, not in CI) compares the C and Python versions with that bash on 4,051 inputs (0 differences) by passing the value only as an argument to printf %q, and runs bash -n (parse only) on the lines.

Run

sh scripts/build.sh test              # -Wall -Wextra -Werror, ASan + UBSan
python3 scripts/derive_expected.py | diff - fixtures/expected.tsv
sh scripts/build.sh results /tmp/r && diff -r results /tmp/r
./build/trvenv case pre TRIVY_OUTPUT 'a;id'   # prints the line; runs nothing
python3 scripts/crosscheck_labels.py build/trvenv   # C vs Python, 4,051 inputs

fixtures/cases.tsv holds positive, negative, edge and out-of-domain cases with labels derived by hand. fixtures/expected.tsv comes from scripts/derive_expected.py, a separate Python implementation of %q and of the reader; the C tests compare against both.

A model is not a finding: see LIMITATIONS.md and SOURCES.md. License: Apache-2.0.

Download Tool