-
Notifications
You must be signed in to change notification settings - Fork 1
π‘οΈ Sentinel: [CRITICAL] Fix predictable temp file and CWD download vulnerabilities #82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| ## 2025-04-07 - [Predictable Temp File & CWD Download Vulnerability in Installers] | ||
|
Check failure on line 1 in .jules/sentinel.md
|
||
| **Vulnerability:** Installation scripts (`apt.sh`) downloaded executables to predictable temporary paths (`/tmp/yq`) and directly to the current working directory. | ||
|
Check failure on line 2 in .jules/sentinel.md
|
||
| **Learning:** Using predictable paths like `/tmp/yq` without `mktemp` makes the script vulnerable to symlink attacks or pre-creation attacks, allowing an attacker to overwrite system files or escalate privileges when the script later calls `sudo mv`. Downloading directly to the CWD can lead to overwriting existing files or executing attacker-controlled binaries. | ||
|
Check failure on line 3 in .jules/sentinel.md
|
||
| **Prevention:** Always create isolated, randomly named temporary directories using `mktemp -d` inside a subshell `(...)` and clean them up automatically using a trap (e.g., `trap 'rm -rf "$TMP_DIR"' EXIT`). Download files strictly into this temporary directory. | ||
|
Check failure on line 4 in .jules/sentinel.md
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -204,12 +204,15 @@ fi | |||||||||||||||||||||
| # Install Go | ||||||||||||||||||||||
| echo "Installing Go..." | ||||||||||||||||||||||
| if ! command -v go &> /dev/null; then | ||||||||||||||||||||||
| GO_VERSION="1.23.4" | ||||||||||||||||||||||
| wget "https://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz" | ||||||||||||||||||||||
| sudo rm -rf /usr/local/go | ||||||||||||||||||||||
| sudo tar -C /usr/local -xzf "go${GO_VERSION}.linux-amd64.tar.gz" | ||||||||||||||||||||||
| rm "go${GO_VERSION}.linux-amd64.tar.gz" | ||||||||||||||||||||||
| echo "NOTE: Add 'export PATH=\$PATH:/usr/local/go/bin' to your shell profile" | ||||||||||||||||||||||
| ( | ||||||||||||||||||||||
| GO_VERSION="1.23.4" | ||||||||||||||||||||||
| TMP_DIR=$(mktemp -d) | ||||||||||||||||||||||
| trap 'rm -rf "$TMP_DIR"' EXIT | ||||||||||||||||||||||
| wget "https://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz" -O "$TMP_DIR/go.tar.gz" | ||||||||||||||||||||||
| sudo rm -rf /usr/local/go | ||||||||||||||||||||||
| sudo tar -C /usr/local -xzf "$TMP_DIR/go.tar.gz" | ||||||||||||||||||||||
| echo "NOTE: Add 'export PATH=\$PATH:/usr/local/go/bin' to your shell profile" | ||||||||||||||||||||||
|
Comment on lines
+211
to
+214
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. π§© Analysis chainπ Web query: `What are the official checksum/signature verification steps for:
π‘ Result: 1) Go 1.23.4
|
||||||||||||||||||||||
| wget "https://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz" -O "$TMP_DIR/go.tar.gz" | |
| sudo rm -rf /usr/local/go | |
| sudo tar -C /usr/local -xzf "$TMP_DIR/go.tar.gz" | |
| echo "NOTE: Add 'export PATH=\$PATH:/usr/local/go/bin' to your shell profile" | |
| wget "https://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz" -O "$TMP_DIR/go.tar.gz" | |
| wget "https://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz.sha256" -O "$TMP_DIR/go.tar.gz.sha256" | |
| (cd "$TMP_DIR" && sha256sum -c go.tar.gz.sha256) | |
| sudo rm -rf /usr/local/go | |
| sudo tar -C /usr/local -xzf "$TMP_DIR/go.tar.gz" | |
| echo "NOTE: Add 'export PATH=\$PATH:/usr/local/go/bin' to your shell profile" |
π€ Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@tools/os_installers/apt.sh` around lines 211 - 214, The installer downloads
and installs privileged artifacts (the Go tarball fetched with wget
"https://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz" and the yq and lsd
artifacts at the other download sites) without verifying integrity; update the
flow so each download is verified before running sudo install/extract: for the
Go download (variable GO_VERSION and "$TMP_DIR/go.tar.gz") fetch the
corresponding .asc GPG signature and/or SHA256 from the official page and verify
the tarball (import/verifying with the Go release GPG key or compare SHA256),
and only then run sudo tar -C /usr/local -xzf "$TMP_DIR/go.tar.gz"; do the same
for the yq and lsd downloads by obtaining their published checksums (or
hardcoding the expected SHA256 for lsd), verify the downloaded files in the
TMP_DIR before any sudo mv/tar/install steps, and fail the script with a clear
error if verification does not pass.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix markdownlint failures blocking docs checks.
Line 1 violates MD041/MD022, and Lines 2-4 violate MD013 (line length). This currently fails the docs lint job.
π Proposed markdownlint-compliant rewrite
π Committable suggestion
π§° Tools
πͺ GitHub Check: Lint Documentation
[failure] 4-4: Line length
.jules/sentinel.md:4:81 MD013/line-length Line length [Expected: 80; Actual: 261] https://github.com/DavidAnson/markdownlint/blob/v0.34.0/doc/md013.md
[failure] 3-3: Line length
.jules/sentinel.md:3:81 MD013/line-length Line length [Expected: 80; Actual: 364] https://github.com/DavidAnson/markdownlint/blob/v0.34.0/doc/md013.md
[failure] 2-2: Line length
.jules/sentinel.md:2:81 MD013/line-length Line length [Expected: 80; Actual: 163] https://github.com/DavidAnson/markdownlint/blob/v0.34.0/doc/md013.md
[failure] 1-1: First line in a file should be a top-level heading
.jules/sentinel.md:1 MD041/first-line-heading/first-line-h1 First line in a file should be a top-level heading [Context: "## 2025-04-07 - [Predictable T..."] https://github.com/DavidAnson/markdownlint/blob/v0.34.0/doc/md041.md
[failure] 1-1: Headings should be surrounded by blank lines
.jules/sentinel.md:1 MD022/blanks-around-headings Headings should be surrounded by blank lines [Expected: 1; Actual: 0; Below] [Context: "## 2025-04-07 - [Predictable Temp File & CWD Download Vulnerability in Installers]"] https://github.com/DavidAnson/markdownlint/blob/v0.34.0/doc/md022.md
π€ Prompt for AI Agents