CVE-2023-41913

9.8 CRITICAL

📋 TL;DR

This vulnerability in strongSwan allows unauthenticated remote attackers to execute arbitrary code via a buffer overflow in the charon-tkm DH proxy. Attackers can trigger this by sending a crafted IKE_SA_INIT message with an oversized DH public value. Any system running vulnerable strongSwan versions with charon-tkm enabled is affected.

💻 Affected Systems

Products:
  • strongSwan
Versions: 5.3.0 through 5.9.11
Operating Systems: Linux, Unix-like systems
Default Config Vulnerable: ✅ No
Notes: Only vulnerable when charon-tkm is enabled and configured. Most default installations use charon, not charon-tkm.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Remote code execution with root privileges leading to complete system compromise, data exfiltration, and persistent backdoor installation.

🟠

Likely Case

Remote code execution leading to VPN gateway compromise, network pivoting, and credential theft.

🟢

If Mitigated

Denial of service if exploit fails or system crashes before code execution.

🌐 Internet-Facing: HIGH - VPN gateways are typically internet-facing and the exploit requires no authentication.
🏢 Internal Only: MEDIUM - Internal VPN servers could be targeted by compromised internal hosts.

🎯 Exploit Status

Public PoC: ✅ No
Weaponized: UNKNOWN
Unauthenticated Exploit: ⚠️ Yes
Complexity: LOW

The vulnerability is in the IKE_SA_INIT handshake phase before authentication, making exploitation straightforward for attackers with network access.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 5.9.12 and later

Vendor Advisory: https://www.strongswan.org/blog/2023/11/20/strongswan-vulnerability-(cve-2023-41913).html

Restart Required: Yes

Instructions:

1. Download strongSwan 5.9.12 or later from strongswan.org or your distribution's repository. 2. Stop the strongSwan service. 3. Install the updated package. 4. Restart the strongSwan service.

🔧 Temporary Workarounds

Disable charon-tkm

linux

Switch from charon-tkm to standard charon daemon if charon-tkm is not required.

Edit strongSwan configuration to use charon instead of charon-tkm
Restart strongSwan service

Network filtering

linux

Block IKE traffic (UDP port 500 and 4500) from untrusted networks.

iptables -A INPUT -p udp --dport 500 -j DROP
iptables -A INPUT -p udp --dport 4500 -j DROP

🧯 If You Can't Patch

  • Disable charon-tkm and use standard charon daemon instead
  • Implement network segmentation to restrict VPN access to trusted sources only

🔍 How to Verify

Check if Vulnerable:

Check strongSwan version and if charon-tkm is enabled in configuration: strongswan --version and review ipsec.conf

Check Version:

strongswan --version

Verify Fix Applied:

Verify version is 5.9.12 or higher: strongswan --version | grep -E '5\.9\.1[2-9]|5\.1[0-9]\.[0-9]+'

📡 Detection & Monitoring

Log Indicators:

  • IKE_SA_INIT messages with unusually large DH public values
  • charon-tkm process crashes or abnormal termination

Network Indicators:

  • IKE_SA_INIT packets with oversized payloads
  • Multiple failed IKE handshakes from single source

SIEM Query:

source="strongswan" AND ("IKE_SA_INIT" AND "large" OR "buffer" OR "overflow") OR process="charon-tkm" AND event="crash"

🔗 References

📤 Share & Export