CVE-2021-41157: Missing Authentication for Critical Function (CWE-306)
value: FreeSWITCH is a Software Defined Telecom Stack enabling the digital transformation from proprietary telecom switches to a software implementation that runs on any commodity hardware. By default, SIP requests of the type SUBSCRIBE are not authenticated in the affected versions of FreeSWITCH. Abuse of this security issue allows attackers to subscribe to user agent event notifications without the need to authenticate. This abuse poses privacy concerns and might lead to social engineering or similar attacks. For example, attackers may be able to monitor the status of target SIP extensions. Although this issue was fixed in version v1.10.6, installations upgraded to the fixed version of FreeSWITCH from an older version, may still be vulnerable if the configuration is not updated accordingly. Software upgrades do not update the configuration by default. SIP SUBSCRIBE messages should be authenticated by default so that FreeSWITCH administrators do not need to explicitly set the `auth-subscriptions` parameter. When following such a recommendation, a new parameter can be introduced to explicitly disable authentication.
CWE description: The product does not perform any authentication for functionality that requires a provable user identity or consumes a significant amount of resources.
CVSS v3 base score: 5.3
Published: 2021-10-26T14:15Z
Repository: https://github.com/signalwire/freeswitch
Language: XML
Files changed: conf/insideout/sip_profiles/internal.xml, conf/minimal/sip_profiles/internal.xml, conf/testing/sip_profiles/internal.xml, conf/vanilla/sip_profiles/internal.xml
Commit date: 2020-09-03 21:27:02 +0400
Commit message: [Default-Configuration] Force sip subscription requests to require authentication.


Diff: diff --git a/conf/insideout/sip_profiles/internal.xml b/conf/insideout/sip_profiles/internal.xml
index 158d5974a7..b64b5cea86 100644
--- a/conf/insideout/sip_profiles/internal.xml
+++ b/conf/insideout/sip_profiles/internal.xml
@@ -127,10 +127,12 @@
     <!-- Used for when phones respond to a challenged ACK with method INVITE in the hash -->
     <!--<param name="NDLB-broken-auth-hash" value="true"/>-->
     <!-- add a ;received="<ip>:<port>" to the contact when replying to register for nat handling -->
     <!--<param name="NDLB-received-in-nat-reg-contact" value="true"/>-->
     <param name="auth-calls" value="$${internal_auth_calls}"/>
+    <!-- Force subscription requests to require authentication -->
+    <param name="auth-subscriptions" value="true"/>
     <!-- Force the user and auth-user to match. -->
     <param name="inbound-reg-force-matching-username" value="true"/>
     <!-- on authed calls, authenticate *all* the packets not just invite -->
     <param name="auth-all-packets" value="false"/>
     <!-- <param name="ext-rtp-ip" value="$${external_rtp_ip}"/> -->
diff --git a/conf/minimal/sip_profiles/internal.xml b/conf/minimal/sip_profiles/internal.xml
index f9d1f56338..8ac59684fc 100644
--- a/conf/minimal/sip_profiles/internal.xml
+++ b/conf/minimal/sip_profiles/internal.xml
@@ -1,8 +1,10 @@
 <profile name="internal">
   <settings>
     <param name="auth-calls" value="true"/>
+    <!-- Force subscription requests to require authentication -->
+    <param name="auth-subscriptions" value="true"/>
     <param name="apply-nat-acl" value="nat.auto"/>
 
     <param name="debug" value="0"/>
     <param name="sip-trace" value="yes"/>
 
diff --git a/conf/testing/sip_profiles/internal.xml b/conf/testing/sip_profiles/internal.xml
index a5749324c5..2a3564ebb4 100644
--- a/conf/testing/sip_profiles/internal.xml
+++ b/conf/testing/sip_profiles/internal.xml
@@ -265,10 +265,12 @@
     <!-- Used for when phones respond to a challenged ACK with method INVITE in the hash -->
     <!--<param name="NDLB-broken-auth-hash" value="true"/>-->
     <!-- add a ;received="<ip>:<port>" to the contact when replying to register for nat handling -->
     <!--<param name="NDLB-received-in-nat-reg-contact" value="true"/>-->
     <param name="auth-calls" value="$${internal_auth_calls}"/>
+    <!-- Force subscription requests to require authentication -->
+    <param name="auth-subscriptions" value="true"/>
     <!-- Force the user and auth-user to match. -->
     <param name="inbound-reg-force-matching-username" value="true"/>
     <!-- on authed calls, authenticate *all* the packets not just invite -->
     <param name="auth-all-packets" value="false"/>
 
diff --git a/conf/vanilla/sip_profiles/internal.xml b/conf/vanilla/sip_profiles/internal.xml
index da7abc07a6..58350e827b 100644
--- a/conf/vanilla/sip_profiles/internal.xml
+++ b/conf/vanilla/sip_profiles/internal.xml
@@ -265,10 +265,12 @@
     <!-- Used for when phones respond to a challenged ACK with method INVITE in the hash -->
     <!--<param name="NDLB-broken-auth-hash" value="true"/>-->
     <!-- add a ;received="<ip>:<port>" to the contact when replying to register for nat handling -->
     <!--<param name="NDLB-received-in-nat-reg-contact" value="true"/>-->
     <param name="auth-calls" value="$${internal_auth_calls}"/>
+    <!-- Force subscription requests to require authentication -->
+    <param name="auth-subscriptions" value="true"/>
     <!-- Force the user and auth-user to match. -->
     <param name="inbound-reg-force-matching-username" value="true"/>
     <!-- on authed calls, authenticate *all* the packets not just invite -->
     <param name="auth-all-packets" value="false"/>
 

Fixed code:     <!-- Force subscription requests to require authentication -->
    <param name="auth-subscriptions" value="true"/>
    <!-- Force subscription requests to require authentication -->
    <param name="auth-subscriptions" value="true"/>
    <!-- Force subscription requests to require authentication -->
    <param name="auth-subscriptions" value="true"/>
    <!-- Force subscription requests to require authentication -->
    <param name="auth-subscriptions" value="true"/>