Coturn TURN server vulnerability? Patch it now or learn why chasing CVEs is a losing game. Get Fedora-specific commands, automation scripts, iptables mitigations, and two books that teach you to analyze the malware that exploits security holes. Subscribe for more practical Linux security.
- A clear breakdown of what's actually broken in coturn.
- A simple command to check if your box is vulnerable (Fedora‑specific).
- A working automation script to apply the fix across your fleet.
- Immediate mitigation techniques if you can't reboot or update right now.
- Two books that teach you to build your own tools for binary analysis and malware dissection – so you stop being a patch jockey and become a real defender.
What's Actually Broken?
The coturn update (version 4.11.0) addresses multiple issues, but two deserve your immediate attention:
1. Format‑string injection in the Redis DB driver
Improper handling of format strings can allow an attacker to read from or write to arbitrary memory locations. In worst‑case scenarios, this leads to remote code execution.
2. Memory leak in Prometheus response handling (introduced in 4.10.0)
Under sustained load, the leaked memory accumulates until the server runs out of resources. The end result? A denial‑of‑service condition that takes your TURN server offline.
dnf list installed coturn
rpm -q coturn
systemctl status coturn
ps aux | grep -E "(turnserver|coturn)"
#!/bin/bash # coturn-security-updater.sh # Updates coturn to 4.11.0 and restarts the service. # Uses Fedora's DNF package manager. set -euo pipefail # Colors for output GREEN='\033[0;32m' RED='\033[0;31m' YELLOW='\033[1;33m' NC='\033[0m' log() { echo -e "${GREEN}[INFO]${NC} $1"; } warn() { echo -e "${YELLOW}[WARN]${NC} $1"; } error() { echo -e "${RED}[ERROR]${NC} $1"; exit 1; } log "Starting coturn security update..." # Check if running as root if [[ $EUID -ne 0 ]]; then error "This script must be run as root (use sudo)." fi # Backup current config if it exists if [[ -f /etc/coturn/turnserver.conf ]]; then backup_dir="/root/coturn_backup_$(date +%Y%m%d_%H%M%S)" mkdir -p "$backup_dir" cp -r /etc/coturn "$backup_dir/" log "Configuration backed up to $backup_dir" fi # Update package cache log "Updating DNF cache..." dnf makecache --refresh || warn "Cache refresh failed, continuing..." # Perform the update log "Upgrading coturn to 4.11.0..." if dnf update -y coturn; then log "Coturn successfully upgraded." else error "Failed to upgrade coturn. Check your network or repository configuration." fi # Verify the new version new_version=$(rpm -q coturn) log "Installed version: $new_version" if ! echo "$new_version" | grep -q "4.11.0"; then warn "Version check shows $new_version, but 4.11.0 was expected." fi # Restart the service if systemctl is-active --quiet coturn; then log "Restarting coturn service..." systemctl restart coturn sleep 2 if systemctl is-active --quiet coturn; then log "Coturn service restarted successfully." else error "Coturn service failed to restart. Check logs with: journalctl -u coturn" fi else log "Coturn service was not running. Enable and start it manually if needed." fi log "Update complete. Consider testing your TURN/STUN functionality."
chmod +x coturn-security-updater.sh sudo ./coturn-security-updater.sh
sudo systemctl stop coturn sudo systemctl disable coturn
sudo systemctl enable coturn sudo systemctl start coturn
# Block UDP and TCP on port 3478 sudo iptables -A INPUT -p udp --dport 3478 -j DROP sudo iptables -A INPUT -p tcp --dport 3478 -j DROP # Block port 5349 for TLS traffic sudo iptables -A INPUT -p tcp --dport 5349 -j DROP # Block the UDP relay port range (commonly 49152-65535, adjust to your config) sudo iptables -A INPUT -p udp --dport 49152:65535 -j DROP
sudo iptables-save > /etc/iptables/rules.v4
getenforce
sudo setenforce 1
ps -Z | grep turnserver
sudo semanage permissive -a turnserver_t # to test # After testing, remove permissive mode: sudo semanage permissive -d turnserver_t

Nenhum comentário:
Postar um comentário