-
Notifications
You must be signed in to change notification settings - Fork 0
Add PolinRider malware guard workflow #6
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
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,149 @@ | ||
| name: PolinRider malware guard | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: | ||
| - '**' | ||
| push: | ||
| branches: | ||
| - '**' | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| scan: | ||
| name: Static malware indicator scan | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v6 | ||
|
|
||
| - name: Scan for known PolinRider indicators | ||
| shell: bash | ||
| run: | | ||
| set -euo pipefail | ||
|
|
||
| failed=0 | ||
|
|
||
| join_parts() { | ||
| local IFS="" | ||
| printf "%s" "$*" | ||
| } | ||
|
|
||
| echo "Checking forbidden malware-related paths..." | ||
|
|
||
| font_payload_path="$(join_parts "public/fonts/fa-solid-" "400.woff2")" | ||
| branch_manifest="$(join_parts "branch_" "structure.json")" | ||
| auto_push_bat="$(join_parts "temp_auto_" "push.bat")" | ||
| interactive_push_bat="$(join_parts "temp_interactive_" "push.bat")" | ||
| auto_push_sh="$(join_parts "temp_auto_" "push.sh")" | ||
| interactive_push_sh="$(join_parts "temp_interactive_" "push.sh")" | ||
| branch_script="$(join_parts "branch_" "structure.sh")" | ||
|
|
||
| forbidden_paths=( | ||
| ".vscode/tasks.json" | ||
| ".vscode/settings.json" | ||
| "$font_payload_path" | ||
| "$branch_manifest" | ||
| "$auto_push_bat" | ||
| "$interactive_push_bat" | ||
| "$auto_push_sh" | ||
| "$interactive_push_sh" | ||
| "auto_push.sh" | ||
| "interactive_push.sh" | ||
| "$branch_script" | ||
| "config.bat" | ||
| "config.sh" | ||
| ) | ||
|
|
||
| for path in "${forbidden_paths[@]}"; do | ||
| if git ls-files --error-unmatch "$path" >/dev/null 2>&1; then | ||
| echo "::error file=$path::Forbidden PolinRider-related path is tracked." | ||
| failed=1 | ||
| fi | ||
| done | ||
|
|
||
| echo "Scanning tracked text files for high-confidence indicators..." | ||
|
|
||
| global_single="$(join_parts "global" "\\['!'\\]")" | ||
| global_double="$(join_parts "global" "\\[\"!\"\\]")" | ||
| marker="$(join_parts "wuqktamceigynz" "bosdctpusocrjhrflovnxrt")" | ||
| node_font="$(join_parts "node ./public/" "fonts")" | ||
| task_auto="$(join_parts "task.allow" "AutomaticTasks")" | ||
| folder_open="$(join_parts "\"folder" "Open\"")" | ||
| run_on="$(join_parts "\"run" "On\"[[:space:]]*:")" | ||
| font_payload_name="$(join_parts "fa-solid-" "400\\.woff2")" | ||
| auto_push_bat_pattern="$(join_parts "temp_auto_" "push\\.bat")" | ||
| interactive_push_bat_pattern="$(join_parts "temp_interactive_" "push\\.bat")" | ||
| auto_push_sh_pattern="$(join_parts "temp_auto_" "push\\.sh")" | ||
| interactive_push_sh_pattern="$(join_parts "temp_interactive_" "push\\.sh")" | ||
| branch_manifest_pattern="$(join_parts "branch_" "structure\\.json")" | ||
|
|
||
| high_confidence_pattern="${global_single}|${global_double}|${marker}|${node_font}|${task_auto}|${run_on}|${folder_open}|${font_payload_name}|${auto_push_bat_pattern}|${interactive_push_bat_pattern}|${auto_push_sh_pattern}|${interactive_push_sh_pattern}|${branch_manifest_pattern}" | ||
|
|
||
| if git grep -n -I -E "$high_confidence_pattern" -- .; then | ||
| echo "::error::Known PolinRider malware indicator found in tracked files." | ||
| failed=1 | ||
| fi | ||
|
|
||
| echo "Checking font asset files for embedded JS/shell payloads..." | ||
|
|
||
| asset_polinrider_pattern="$high_confidence_pattern" | ||
| font_payload_pattern="${asset_polinrider_pattern}|require\\(|module|Function\\(|eval\\(|child_process|exec\\(|spawn\\(|powershell|curl|wget" | ||
|
|
||
| while IFS= read -r -d '' file; do | ||
| if grep -aE "$font_payload_pattern" "$file" >/dev/null 2>&1; then | ||
| echo "::error file=$file::Suspicious JS/shell indicator found inside font asset." | ||
| failed=1 | ||
| fi | ||
| done < <(git ls-files -z '*.woff' '*.woff2' '*.ttf') | ||
|
|
||
| echo "Checking image asset files for high-confidence PolinRider markers..." | ||
|
|
||
| while IFS= read -r -d '' file; do | ||
| if grep -aE "$asset_polinrider_pattern" "$file" >/dev/null 2>&1; then | ||
| echo "::error file=$file::Known PolinRider indicator found inside image asset." | ||
| failed=1 | ||
| fi | ||
| done < <(git ls-files -z '*.png' '*.jpg' '*.jpeg' '*.ico' '*.icns') | ||
|
|
||
| echo "Checking SVG assets for high-confidence PolinRider markers..." | ||
|
|
||
| while IFS= read -r -d '' file; do | ||
| if grep -aE "$asset_polinrider_pattern" "$file" >/dev/null 2>&1; then | ||
| echo "::error file=$file::Known PolinRider indicator found inside SVG asset." | ||
| failed=1 | ||
| fi | ||
| done < <(git ls-files -z '*.svg') | ||
|
|
||
| echo "Checking shell scripts for Git propagation behavior..." | ||
|
|
||
| shell_propagation_pattern="$(join_parts "git push.*(--force|-f|--mirror)|git commit --amend|git for-each-ref|git rev-list|git branch --all|git tag --list|temp_auto_" "push|temp_interactive_" "push|branch_" "structure")" | ||
|
|
||
| if git ls-files '*.sh' | grep -q .; then | ||
| if git grep -n -I -E "$shell_propagation_pattern" -- '*.sh'; then | ||
| echo "::error::Suspicious Git propagation behavior found in shell script." | ||
| failed=1 | ||
| fi | ||
| fi | ||
|
|
||
| echo "Checking batch scripts for Git propagation behavior..." | ||
|
|
||
| windows_propagation_pattern="$(join_parts "git push.*(--force|-f|--mirror)|git commit --amend|git for-each-ref|git rev-list|git branch --all|git tag --list|powershell|curl|wget|temp_auto_" "push|temp_interactive_" "push|branch_" "structure")" | ||
|
|
||
| if git ls-files '*.bat' '*.cmd' '*.ps1' | grep -q .; then | ||
| if git grep -n -I -E "$windows_propagation_pattern" -- '*.bat' '*.cmd' '*.ps1'; then | ||
| echo "::error::Suspicious Git propagation behavior found in Windows script." | ||
| failed=1 | ||
| fi | ||
| fi | ||
|
|
||
| if [ "$failed" -ne 0 ]; then | ||
| echo "PolinRider guard failed." | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "PolinRider guard passed." | ||
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.
Uh oh!
There was an error while loading. Please reload this page.