Fix Emacs CVEs on openSUSE forever. Bash script, AppArmor fallback & one book that solves all future flaws. No panic. Ever.
You run emacs every day – for code, notes, configs. Then an advisory appears: *“Use-after-free in Emacs before version 30.2‑8.1 on openSUSE Leap 15.5.”* Patches are rushed, servers rebooted, problems forgotten.
But that’s short‑term thinking. The real skill isn’t applying this fix – it’s building a repeatable system for every future CVE.
Below you’ll get the exact command to check if you’re vulnerable, a single script to patch it, and a no‑update fallback. Plus: one book that turns you from a patch‑applier into a CVE‑solver.
1. How to check if you are vulnerable (openSUSE)
zypper info emacs | grep -E "Version|Installed" rpm -q --changelog emacs | grep -i "CVE-20"
What to look for:
- If Version shows less than 30.2‑8.1 → vulnerable.
- If the changelog does not list your CVE ID → vulnerable.
- Example vulnerable output: Version: emacs-30.2-7.1
2. Automation script to apply the fix (bash for openSUSE)
#!/bin/bash # Evergreen CVE patcher for openSUSE – drop in any CVE number CVE_ID="CVE-2024-PLACEHOLDER" PATCHED_VERSION="30.2-8.1" echo "[+] Checking current emacs version..." CURRENT=$(rpm -q --queryformat "%{VERSION}-%{RELEASE}" emacs) if [[ "$CURRENT" == "$PATCHED_VERSION" ]]; then echo "[✓] Already patched. Exiting." exit 0 fi echo "[!] Vulnerable to $CVE_ID. Updating..." zypper refresh zypper update -y emacs echo "[+] Restarting emacs daemon if running..." systemctl --user stop emacs.service 2>/dev/null systemctl --user start emacs.service 2>/dev/null echo "[✓] Fixed. Verify with: rpm -q --changelog emacs | grep -i $CVE_ID"
/usr/bin/emacs {
# Allow normal use
owner /** rwk,
/usr/share/emacs/** r,
/etc/emacs/** r,
# Deny dangerous system calls (adjust to your CVE)
deny capability dac_override,
deny capability sys_ptrace,
deny /proc/*/mem w,
}

Nenhum comentário:
Postar um comentário