Description
ipfire
2020-12-30 22:03:16 UTC
Thank you for reporting this vulnerability. It helps us a lot to make IPFire more secure. I will have a look at this and submit patches to this ticket. So far I can confirm it and I have marked this ticket at security-sensitive so that it won't be visible on the bug tracker. I will remove that mark as soon as a patch has been submitted and has been approved. I have now come up with various fixes for these vulnerabilities which I would like to post here and I am asking for a review of them. If you agree with the changes, I will post them to the mailing list. The lauch-ether-wake binary has been dropped and I have given etherwake CAP_NET_RAW. Therefore the web UI can now call it without need for the helper. I have removed that commands that are composed from input variables are executed using a shell. Therefore the entire class of shell command injection should be removed. I have changed safe_system() so that it is a wrapper for the new function and not all of the code has to be changed. After these changes, all vulnerabilities should be fixed. Please let me know if you find anything that I overlooked. Thank you again for your help to make IPFire better software :) Created attachment 831 [details]
0001-Drop-launch-ether-wake.patch
Created attachment 832 [details]
0002-core154-Manually-set-capabilites-for-etherwake.patch
Created attachment 833 [details]
0003-misc-progs-Introduce-run.patch
Created attachment 834 [details]
0004-misc-progs-backupctrl-Use-new-run-function.patch
Created attachment 835 [details]
0005-misc-progs-pakfire-Use-new-run-function.patch
Created attachment 836 [details]
0006-misc-progs-Add-functions-to-sanitise-input-arguments.patch
Created attachment 837 [details]
0007-misc-progs-addonctrl-Sanitise-add-on-names-before-us.patch
Created attachment 838 [details]
0008-misc-progs-extrahdctrl-Use-new-run-function.patch
Created attachment 839 [details]
0009-misc-progs-mpfirectrl-Use-new-run-function.patch
Created attachment 840 [details]
0010-misc-progs-smartctrl-Sanitise-device-name.patch
Created attachment 841 [details]
0011-misc-progs-sshctrl-Sanitise-runtime-for-tempstart.patch
Created attachment 842 [details]
0012-misc-progs-sambactrl-Remove-unused-smbsafeconfpdc-co.patch
Created attachment 843 [details]
0013-misc-progs-sambactrl-Sanitise-username.patch
Created attachment 844 [details]
0014-samba-Remove-option-to-chose-user-group-and-shell.patch
Created attachment 845 [details]
0015-samba-Add-helper-script-to-pipe-password.patch
Hi Michael, Currently, I only have time for a quick review. Patch 1: OK Patch 2: OK Patch 4: OK Patch 5: OK Patch 7: I personally would prefer calling run() instead of safe_system(), just as a matter of principle, since you only execute a single command here. Similarly, I would prefer snprintf() over sprintf(), even though you did check for overflows before. This way, people attention is not taken by these calls to sprintf() and analyzer will not produce warnings. Patch 8: OK Patch 9: OK I'll have to check the rest once I have more time. To be clear, the "OK" only refers to this bug. So if the setuid binary calls a perl script, I did not check whether the perl script deals properly with the arguments or whether it has other bugs. Regards, Albert Created attachment 846 [details] 0001-misc-progs-addonctrl-Replace-all-sprintf-with-snprin.patch Thanks for looking into this so far. (In reply to ipfire from comment #18) > Patch 7: I personally would prefer calling run() instead of safe_system(), > just as a matter of principle, since you only execute a single command here. > Similarly, I would prefer snprintf() over sprintf(), even though you did > check for overflows before. This way, people attention is not taken by these > calls to sprintf() and analyzer will not produce warnings. I replaced all of those calls with snprintf(). See the attached patch. > I'll have to check the rest once I have more time. To be clear, the "OK" > only refers to this bug. So if the setuid binary calls a perl script, I did > not check whether the perl script deals properly with the arguments or > whether it has other bugs. This is what this ticket is about. I would like to release these fixes as soon as possible. If there is anything else in any of the scripts that are being called, that would be a new ticket and I would like to work on that after this. One at a time. Hello Albert, I would like to close the development cycle very soon and I would like these patches to be included to patch the problem as soon as possible for our users. Did you have some more time to review them or do you need a little bit longer? I have merged all patches into "next" and they are scheduled for release soon. This bug report is also public again now. Thank you for your help and your valuable contribution to IPFire. |