Commit e1fdeb24 authored by Terje Rosten's avatar Terje Rosten

Bug#27919254 MYSQL USER ESCALATES ITS PRIVILEGE BY PLACING ARBITRARY PIDS INTO ITS PID FILES

Shutdown server as mysql user to avoid accidentally sending signal to
wrong process.
parent cad692f9
...@@ -159,7 +159,7 @@ stop(){ ...@@ -159,7 +159,7 @@ stop(){
fi fi
MYSQLPID=`cat "$mypidfile"` MYSQLPID=`cat "$mypidfile"`
if [ -n "$MYSQLPID" ]; then if [ -n "$MYSQLPID" ]; then
/bin/kill "$MYSQLPID" >/dev/null 2>&1 /bin/su - mysql -s /bin/bash -c "/bin/kill $MYSQLPID" >/dev/null 2>&1
ret=$? ret=$?
if [ $ret -eq 0 ]; then if [ $ret -eq 0 ]; then
TIMEOUT="$STOPTIMEOUT" TIMEOUT="$STOPTIMEOUT"
......
...@@ -163,7 +163,7 @@ stop () { ...@@ -163,7 +163,7 @@ stop () {
# We use a signal to avoid having to know the root password # We use a signal to avoid having to know the root password
# Send single kill command and then wait # Send single kill command and then wait
if kill $pid >/dev/null 2>&1; then if su - mysql -s /bin/bash -c "kill $pid" >/dev/null 2>&1; then
timer=$STOPTIMEOUT timer=$STOPTIMEOUT
while [ $timer -gt 0 ]; do while [ $timer -gt 0 ]; do
kill -0 $pid >/dev/null 2>&1 || break kill -0 $pid >/dev/null 2>&1 || break
...@@ -196,7 +196,7 @@ reload () { ...@@ -196,7 +196,7 @@ reload () {
ret=0 ret=0
if chk_running && mysqladmin --no-defaults --socket="$socket" ping >/dev/null 2>&1 ; then if chk_running && mysqladmin --no-defaults --socket="$socket" ping >/dev/null 2>&1 ; then
pid=$(cat "$pidfile") pid=$(cat "$pidfile")
kill -HUP $pid >/dev/null 2>&1 su - mysql -s /bin/bash -c "kill -HUP $pid" >/dev/null 2>&1
echo -n "Reloading service MySQL:" echo -n "Reloading service MySQL:"
rc_reset rc_reset
else else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment