I would like to chime in on this as well. I did some testing with the following AppArmor profile for FreeSWITCH:
File:
/etc/apparmor.d/usr.bin.freeswitch
Code:
#include <tunables/global>
/usr/bin/freeswitch {
#
# Allow everything by default
#
allow all,
#
# FreeSWITCH should not start external programs.
#
audit deny /** x,
}
Then test and reload the profile:
apparmor_parser -Q /etc/apparmor.d/usr.bin.freeswitch && apparmor_parser -r /etc/apparmor.d/usr.bin.freeswitch
This adds and activates the profile to block the
/usr/bin/freeswitch binary from executing shell commands.
This is not a fix for upgrading your FreeSWITCH to the newest version, but it should
help with attacks that try and execute programs on the command line beyond the currently discovered attack vector.
The idea here is to allow the process to do what is needed but block shell execute access.
Test the deny:
aa-exec -p /usr/bin/freeswitch -- /bin/sh -c '/usr/bin/touch /tmp/apparmor-test'
You should get a result similar to:
aa-exec: ERROR: failed to execute '/usr/bin/touch': Permission denied
Depending on how your system is configured, an event in your journal logs would be created but I was not able to get that part working. (If you know how, please share as it would be a valuable notification.)
I think this could be useful in the future as well to help denying the ability of FreeSWITCH to execute commands. I don't run a full production system, but I thought it was worth sharing as this idea could be built upon with someone that has a lot more experience with AppArmor and it's policies.
Tested on Debian 13 with AppArmor 4.