Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions .github/workflows/ruby2shell-linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: ruby2shell bash detector (Linux)

on:
push:
paths:
- "CVE-2026-132825/linux/**"
- ".github/workflows/ruby2shell-linux.yml"
pull_request:
paths:
- "CVE-2026-132825/linux/**"
- ".github/workflows/ruby2shell-linux.yml"
workflow_dispatch:

permissions:
contents: read

jobs:
shellcheck:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: shellcheck
run: >-
shellcheck -S warning
CVE-2026-132825/linux/detect-ruby2shell.sh CVE-2026-132825/linux/tests/run-tests.sh
CVE-2026-132825/linux/tests/run-tests-host.sh
CVE-2026-132825/linux/ssh-ruby2shell.sh CVE-2026-132825/linux/k8s-exec-ruby2shell.sh

test:
name: bash on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, ubuntu-22.04]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

# The harness pulls the official ruby 3.4.12-slim and 3.4.13-slim images,
# pinned by digest inside run-tests.sh, and debian:stable-slim.
- name: Run tests (Docker)
run: bash ./CVE-2026-132825/linux/tests/run-tests.sh

# Decision logic against the runner's own Ruby; skips itself if that
# Ruby is already patched.
- name: Run tests (host Ruby)
run: bash ./CVE-2026-132825/linux/tests/run-tests-host.sh

# macOS ships bash 3.2 and an unpatched Ruby 2.6 in /usr/bin. This job is the
# only test of the detector's macOS process scan (ps and lsof instead of /proc).
test-macos:
name: bash 3.2 on macos-latest
runs-on: macos-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Run tests (host Ruby)
run: /bin/bash ./CVE-2026-132825/linux/tests/run-tests-host.sh
36 changes: 36 additions & 0 deletions .github/workflows/ruby2shell-windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: ruby2shell PowerShell detector (Windows)

on:
push:
paths:
- "CVE-2026-132825/windows/**"
- ".github/workflows/ruby2shell-windows.yml"
pull_request:
paths:
- "CVE-2026-132825/windows/**"
- ".github/workflows/ruby2shell-windows.yml"
workflow_dispatch:

permissions:
contents: read

jobs:
test:
name: ${{ matrix.shell }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
os: [windows-latest]
shell: [powershell.exe, pwsh.exe]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

# Run-Tests.ps1 builds tests/FakeRuby.cs into ruby.exe stand-ins with the
# .NET Framework C# compiler; no Ruby is installed or needed.
- name: Run tests
shell: pwsh
run: ./CVE-2026-132825/windows/tests/Run-Tests.ps1 -Shell '${{ matrix.shell }}'
424 changes: 424 additions & 0 deletions CVE-2026-132825/README.md

Large diffs are not rendered by default.

89 changes: 89 additions & 0 deletions CVE-2026-132825/linux/ansible-ruby2shell.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
---
# ansible-ruby2shell.yml
#
# Run the Ruby2Shell (CVE-2026-132825) host detector on every Linux/macOS host in the inventory
# and collect each host's verdict on the control node.
#
# Self-contained: it drives this repo's own detect-ruby2shell.sh and nothing
# else. No agent is installed on the targets. ansible.builtin.script copies the
# detector to a temp path, runs it, and removes it. The detector is read-only:
# it reads /proc and runs `ruby -e` only on installed interpreters; it changes nothing.
#
# Usage:
# ansible-playbook -i inventory ansible-ruby2shell.yml
# ansible-playbook -i inventory ansible-ruby2shell.yml -e detect_args="-q"
# ansible-playbook -i inventory ansible-ruby2shell.yml -e detect_args="--no-disk"
#
# Exit-code contract (from the detector; this is the fleet signal):
# 0 not impacted 1 impacted 2 unknown 3 usage error
# Codes 1 and 2 are verdicts, not failures, so they do not fail the play; 3 does.
#
# Output:
# - each host's full detector output is saved to ./results/<host>.txt
# - a per-verdict host summary prints at the end
#
# Run as root (become) for full coverage of other users' processes and
# containers, matching the detector's own guidance.

- name: Ruby2Shell (CVE-2026-132825) host detection
hosts: all
gather_facts: false
become: true
vars:
detect_script: "{{ playbook_dir }}/detect-ruby2shell.sh"
detect_args: ""
results_dir: "{{ playbook_dir }}/results"

tasks:
- name: Run the detector (copied, run, and removed by Ansible; nothing installed)
ansible.builtin.script: "{{ detect_script }} {{ detect_args }}"
args:
executable: bash
register: detect
changed_when: false
failed_when: detect.rc not in [0, 1, 2]

- name: Derive this host's verdict from the exit code
ansible.builtin.set_fact:
ruby2shell_verdict: "{{ 'impacted' if detect.rc == 1 else ('unknown' if detect.rc == 2 else 'not impacted') }}"

- name: Create the results folder on the control node
ansible.builtin.file:
path: "{{ results_dir }}"
state: directory
mode: "0755"
delegate_to: localhost
become: false
run_once: true

- name: Save this host's detector output on the control node
ansible.builtin.copy:
content: "{{ detect.stdout }}"
dest: "{{ results_dir }}/{{ inventory_hostname }}.txt"
mode: "0644"
delegate_to: localhost
become: false
changed_when: false

- name: Print the fleet summary
run_once: true
delegate_to: localhost
become: false
vars:
# [host, verdict] pairs. Hosts that failed or were unreachable have no
# fact set, so extract yields Undefined, mapped to "no result".
pairs: >-
{{ ansible_play_hosts_all
| zip(ansible_play_hosts_all
| map('extract', hostvars, 'ruby2shell_verdict')
| map('default', 'no result')
| list)
| list }}
ansible.builtin.debug:
msg:
- "Ruby2Shell fleet detection (CVE-2026-132825 and six sibling Ruby advisories)"
- "impacted: {{ pairs | selectattr('1', 'equalto', 'impacted') | map(attribute='0') | list }}"
- "unknown: {{ pairs | selectattr('1', 'equalto', 'unknown') | map(attribute='0') | list }}"
- "not impacted: {{ pairs | selectattr('1', 'equalto', 'not impacted') | map(attribute='0') | list }}"
- "no result: {{ pairs | selectattr('1', 'equalto', 'no result') | map(attribute='0') | list }}"
- "per-host output saved under {{ results_dir }}/"
Loading
Loading