-
Notifications
You must be signed in to change notification settings - Fork 1
π‘οΈ Sentinel: [HIGH] Fix insecure temporary download paths in apt.sh #91
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
Merged
kidchenko
merged 1 commit into
main
from
sentinel/fix-insecure-tmp-paths-10068104001288958326
Apr 17, 2026
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| # Sentinel Security Journal | ||
|
|
||
| ## 2026-04-16 - Prevent TOCTOU and Symlink Attacks via Insecure Temporary Directories | ||
|
|
||
| **Vulnerability:** Shell scripts were downloading executable artifacts directly | ||
| to predictable temporary paths like `/tmp/yq` or the current working directory, | ||
| which risks local privilege escalation, symlink attacks, and overwriting | ||
| existing files when executed with elevated privileges (`sudo`). | ||
| **Learning:** Hardcoded temporary paths (`/tmp/...`) are insecure and | ||
| susceptible to symlink hijacking by local attackers. Additionally, downloading | ||
| directly to the current directory is poor practice and pollutes the workspace | ||
| or risks naming collisions. | ||
| **Prevention:** Always use securely generated random directories (e.g., | ||
| `TMP_DIR=$(mktemp -d)`) wrapped in a subshell `(...)` and paired with a local | ||
| trap (`trap 'rm -rf "$TMP_DIR"' EXIT`) to ensure isolation and automatic | ||
| cleanup upon exit. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
π§© Analysis chain
π Web query:
What are the official checksum/signature verification instructions for: Go 1.23.4 linux-amd64 tarball, mikefarah/yq v4.44.6 yq_linux_amd64, and lsd-rs/lsd v1.1.5 amd64.deb?π‘ Result:
Go 1.23.4 linux-amd64 tarball: No evidence found of Go 1.23.4 release as of 2026-04-16; current stable versions are around 1.26.x per https://go.dev/dl/. Check https://go.dev/dl/ for SHA256 checksum listed in table for go1.23.4.linux-amd64.tar.gz if released, or download go1.23.4.linux-amd64.tar.gz.sha256 from storage.googleapis.com/golang/. mikefarah/yq v4.44.6 yq_linux_amd64: Download from https://github.com/mikefarah/yq/releases/tag/v4.44.6. Download 'checksums' and 'checksums_hashes_order' files. Use extract-checksum.sh script: ./extract-checksum.sh SHA-256 yq_linux_amd64 | sha256sum -c. For signature (recent releases): cosign verify-blob --bundle checksums.bundle checksums (install cosign first). lsd-rs/lsd v1.1.5 amd64.deb: Download lsd_1.1.5_amd64.deb from https://github.com/lsd-rs/lsd/releases/tag/v1.1.5. No official checksums or signatures provided in release assets or docs; verify via GitHub release integrity or compute your own SHA256.
Citations:
π Script executed:
sed -n '205,260p' tools/os_installers/apt.shRepository: kidchenko/dotfiles
Length of output: 2070
Add artifact integrity verification before privileged install steps for Go and yq.
Downloads are installed via
sudowithout checksum/signature verification. A compromised release artifact would be executed as root.Go 1.23.4 and yq v4.44.6 have official checksums available and should be verified before installation:
go1.23.4.linux-amd64.tar.gz.sha256checksumsfile withsha256sum -corcosign verify-blobfor signature verificationπ Suggested hardening pattern (Go example)
( TMP_DIR=$(mktemp -d) trap 'rm -rf "$TMP_DIR"' EXIT GO_VERSION="1.23.4" + GO_SHA256="<official_sha256_from_go.dev>" wget "https://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz" -O "$TMP_DIR/go${GO_VERSION}.linux-amd64.tar.gz" + echo "${GO_SHA256} $TMP_DIR/go${GO_VERSION}.linux-amd64.tar.gz" | sha256sum -c - sudo rm -rf /usr/local/go sudo tar -C /usr/local -xzf "$TMP_DIR/go${GO_VERSION}.linux-amd64.tar.gz" )Apply similar verification to yq release assets.
Note: lsd v1.1.5 does not provide official checksums or signatures in release assets. Consider verifying via GitHub release integrity or evaluating if signature verification is available elsewhere before
sudo dpkg -i.Also applies to lines 240-242 (yq), 253-254 (lsd).
π€ Prompt for AI Agents