Package: asterisk Version: 1:22.10.1+dfsg+~cs6.17.60671434-1 Severity: important Tags: security X-Debbugs-CC: [email protected]
asterisk.postinst and asterisk-config.postinst follow symlinks that the asterisk service account places in /etc/asterisk. When an administrator upgrades or reinstalls asterisk or asterisk-config, root follows the link and changes the target file's owner to asterisk. This was reported privately to the Debian security team, with a reproducer. I am filing it publicly at their request. Details (line numbers from asterisk 1:22.10.1+dfsg+~cs6.17.60671434-1): debian/asterisk.postinst:49-50 changes /etc/asterisk to owner asterisk unless a dpkg-statoverride pins it. debian/asterisk.postinst:81-84 and debian/asterisk-config.postinst:20-24 then run "chown asterisk:" on each conffile without refusing symlinks. Because the asterisk account owns /etc/asterisk, it can replace a conffile with a symlink to a root-owned file. When an administrator upgrades or reinstalls the package and dpkg keeps the local conffile (either because the packaged conffile did not change or with --force-confold), the postinst chown follows the link and changes the target's owner to asterisk. No timing race is required. Tested on Debian 13 with packages asterisk and asterisk-config 1:22.10.1+dfsg+~cs6.17.60671434-1, using a root-owned 0600 test file and replacing /etc/asterisk/acl.conf with a symlink before running apt-get --reinstall with --force-confold. In 10 of 10 attempts, the test file became asterisk:asterisk 600 (exit status 0). In 3 of 3 controls with a regular conffile, the test file stayed root:root 600. Escalation beyond the ownership change was not tested. Source inspection found the same postinst lines in experimental (1:22.11.0-rc2+dfsg+~cs6.17.60671434-1). The fix should not let root follow an asterisk-owned symlink when setting conffile ownership, and should avoid a check-then-chown race. Reported by Hasnain Naeem and Ryan Henry (University of Calgary).

