Páginas

sábado, 2 de maio de 2026

Kerberos (krb5) Security Update: NegoEx DoS Vulnerabilities Explained

 


Learn how to protect your Fedora Linux systems from NegoEx parsing vulnerabilities (CVE-2026-40355, CVE-2026-40356) in MIT Kerberos 5 (krb5). Includes manual checks, automation scripts, and firewall-based workarounds for unpatched systems. Practical guide for system administrators.


In May 2026, a security update for Fedora 44 addressed two denial-of-service (DoS) vulnerabilities in MIT Kerberos 5 (krb5). These flaws – officially tracked as CVE-2026-40355 and CVE-2026-40356 – affect the NegoEx negotiation mechanism used in Kerberos authentication. 

An unauthenticated remote attacker could trigger a NULL pointer dereference or an integer underflow, causing the affected service to crash. For system administrators running Kerberos-enabled services, this remains a critical security boundary to maintain regardless of when you read this article.

How to Check if You Are Vulnerable


Before applying any fix, verify whether your Fedora system is running a vulnerable version of krb5.

Step 1: Check Your Installed krb5 Version

bash
rpm -q krb5-libs krb5-workstation


If the version is below 1.22.3 (or 1.22.2-4 on Fedora 44), your system is vulnerable. The fixed version for Fedora 44 is 1.22.2-4.fc44


Step 2: Verify NegoEx Configuration


The vulnerability only applies if the NegoEx mechanism is registered on your system. Check whether the /etc/gss/mech directory contains a NegoEx entry:
bash
grep -i negoex /etc/gss/mech* 2>/dev/null || echo "No NegoEx mechanism found"


If a NegoEx mechanism is present, your system is exposed to the flaw.

Step 3: Test for NULL Pointer Dereference Crash (Optional – Use in Isolated Lab)

bash
# This is a safe test for a development environment only
kinit -k -t /etc/krb5.keytab ANY_SERVICE 2>&1 | grep -i "segmentation\|null\|parse_nego"

Automation Script to Apply the Fix


Save the following script as fix-krb5-negoex.sh and run it with root privileges.

bash
#!/bin/bash
# krb5 NegoEx DoS Vulnerability Fix Script for Fedora
# Compatible with: Fedora 39, 40, 41, 42, 43, 44, and later

set -euo pipefail

# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m'

echo -e "${YELLOW}[INFO] Checking current krb5 version...${NC}"
INSTALLED_VER=$(rpm -q krb5-libs --queryformat "%{VERSION}-%{RELEASE}" 2>/dev/null || echo "none")

if [[ "$INSTALLED_VER" == "none" ]]; then
    echo -e "${RED}[ERROR] krb5-libs package not found. Is Kerberos installed?${NC}"
    exit 1
fi

echo -e "${GREEN}[INFO] Current version: $INSTALLED_VER${NC}"

# Determine if update is needed
NEED_UPDATE=0
if [[ "$INSTALLED_VER" < "1.22.2-4.fc44" ]]; then
    NEED_UPDATE=1
fi

if [[ $NEED_UPDATE -eq 1 ]]; then
    echo -e "${YELLOW}[INFO] Vulnerable version detected. Applying update...${NC}"
    sudo dnf upgrade --refresh -y krb5-libs krb5-workstation krb5-server
    echo -e "${GREEN}[INFO] Update completed.${NC}"
else
    echo -e "${GREEN}[INFO] Your system already has a patched version of krb5.${NC}"
    exit 0
fi

# Post-update verification
NEW_VER=$(rpm -q krb5-libs --queryformat "%{VERSION}-%{RELEASE}")
echo -e "${GREEN}[INFO] New version: $NEW_VER${NC}"

# Check if NegoEx mechanism is still registered
if grep -qi negoex /etc/gss/mech* 2>/dev/null; then
    echo -e "${YELLOW}[WARNING] NegoEx mechanism still detected. Restart affected services.${NC}"
else
    echo -e "${GREEN}[OK] NegoEx mechanism not found. System is secure.${NC}"
fi

# Restart key Kerberos services if they are running
for svc in krb5kdc kadmin; do
    if systemctl is-active --quiet $svc; then
        echo -e "${YELLOW}[INFO] Restarting $svc...${NC}"
        sudo systemctl restart $svc
    fi
done

echo -e "${GREEN}[SUCCESS] krb5 DoS vulnerability mitigation complete.${NC}"


Usage:

bash
chmod +x fix-krb5-negoex.sh
sudo ./fix-krb5-negoex.sh
Lab Setup Suggestion: Test this script and all security configurations in an isolated lab environment before deploying to production. Use a Canakit Raspberry Pi  to build a low‑cost Kerberos testing lab: Shop Raspberry Pi Kits on Amazon

This post contains affiliate links. We may earn a commission on qualifying purchases.


Alternative Mitigation If You Can't Update Now


If an immediate update is not possible, use these workarounds to reduce risk.

Option 1: Block the NegoEx Mechanism

The simplest mitigation is to prevent the NegoEx mechanism from loading:
bash
# Backup existing configuration
sudo cp /etc/gss/mech /etc/gss/mech.backup

# Comment out or remove NegoEx lines
sudo sed -i '/negoex/ s/^/#/' /etc/gss/mech
sudo sed -i '/negoex/ s/^/#/' /etc/gss/mech.d/* 2>/dev/null


Option 2: Restrict Access to Kerberos Ports with iptables

If your Kerberos servers accept external connections, limit access to trusted networks only:

bash
# Flush existing rules (careful – test first)
sudo iptables -F INPUT

# Allow Kerberos (port 88) only from trusted subnet 192.168.1.0/24
sudo iptables -A INPUT -p tcp --dport 88 -s 192.168.1.0/24 -j ACCEPT
sudo iptables -A INPUT -p udp --dport 88 -s 192.168.1.0/24 -j ACCEPT

# Allow admin service (port 749) only from trusted subnet
sudo iptables -A INPUT -p tcp --dport 749 -s 192.168.1.0/24 -j ACCEPT

# Drop all other Kerberos traffic
sudo iptables -A INPUT -p tcp --dport 88 -j DROP
sudo iptables -A INPUT -p udp --dport 88 -j DROP
sudo iptables -A INPUT -p tcp --dport 749 -j DROP

# Save rules (persist after reboot)
sudo iptables-save > /etc/iptables/rules.v4


Option 3: Disable GSSAPI Negotiation in Applications


For applications using GSSAPI authentication, you can disable the vulnerable NegoEx path by forcing a specific mechanism:

bash
# In /etc/krb5.conf, add under [libdefaults]:
#   default_mech = krb5
# This forces use of the standard Kerberos mechanism instead of NegoEx.


Network‑Level Mitigation


Place Kerberos Key Distribution Centers (KDCs) and application servers behind a firewall that only permits Kerberos traffic from authenticated clients. Combine with fail2ban to temporarily block IPs that send malformed packets.


Conclusion


Kerberos remains the backbone of secure authentication in Linux environments. Vulnerabilities like CVE-2026-40355 and CVE-2026-40356 serve as reminders that active maintenance is essential – even for well‑established protocols. By following the steps in this guide – checking your version, applying the update script, or implementing firewall‑based workarounds – you protect your infrastructure from preventable denial‑of‑service attacks.

Your next move: Audit your Kerberos‑enabled systems today. Set up a dedicated test lab with a Raspberry Pi Kit to safely experiment with security patches before pushing them to production. Take 15 minutes to run the script above and verify your patches.










Nenhum comentário:

Postar um comentário