File tree Expand file tree Collapse file tree 1 file changed +6
-16
lines changed
Expand file tree Collapse file tree 1 file changed +6
-16
lines changed Original file line number Diff line number Diff line change @@ -112,27 +112,17 @@ get_providers() {
112112}
113113
114114set_init_action () {
115- local name=" $1 " action=" $2 " cmd
116-
117- # SECURITY FIX: Validate name parameter to prevent command injection
118- # CVE-202X-XXXXX: Privilege Escalation via unsanitized 'name' parameter
119- # Fix by: Ahmet Mersin (ahmetmersin.com)
120- # Only allow the expected package name
121- if [ " $name " != " $packageName " ]; then
122- logger " SECURITY: Rejected invalid name parameter: $name "
123- print_json_bool " result" ' 0'
124- return 1
125- fi
126-
127- case $action in
115+ local action=" $2 " cmd
116+ [ " $( basename " $1 " ) " = " $packageName " ] || { print_json_bool ' result' ' 0' ; return 1; }
117+ case $action in
128118 enable|disable|start|stop|restart)
129- cmd=" /etc/init.d/${name } ${action} "
119+ cmd=" /etc/init.d/${packageName } ${action} "
130120 ;;
131121 esac
132122 if [ -n " $cmd " ] && eval " $cmd " > /dev/null 2>&1 ; then
133- print_json_bool " result" ' 1'
123+ print_json_bool ' result' ' 1'
134124 else
135- print_json_bool " result" ' 0'
125+ print_json_bool ' result' ' 0'
136126 fi
137127}
138128
You can’t perform that action at this time.
0 commit comments