bugy / script-server

Web UI for your scripts with execution management
Other
1.61k stars 249 forks source link

Remote code execution on mariadb database doesn't stop when script is killed #484

Closed Nottt closed 3 years ago

Nottt commented 3 years ago

I don't know if this is expected, but running a bash script that runs the command using mariadb-client:

mariadb -N -h "$DBHOST" -P "$DBPORT" -D "$DBNAME" -e "ANY SQL QUERY" -u "$DBUSER" -p"$DBPASS"

If I kill the script with the web interface, the command keeps executing remotely. Is that expected at all ?

How does script-server kill scripts?

bugy commented 3 years ago

Hi @Nottt,

In linux it works the following way: when you do a stop in script server:

when you do a kill in script server:

In windows script server just stops the parent, I believe

Nottt commented 3 years ago

I has testing with SELECT SLEEP(300); and it seems after I kill the script with the interface, the query does indeed stop.

So I think maybe this issue is on the mysql side and not bash... I'll investigate further.

Is it possible to limit a script to only be allowed to run once ? This script for example shouldn't be run in many instances in parallel like using the + icon. So just trying to avoid users mess it up

bugy commented 3 years ago

Hi @Nottt, unfortunately there is no such feature in script server. I think you could implement a simple locking mechanism in your script (e.g. if an instance is running already, the script will just exit)

Nottt commented 3 years ago

Yeah good idea! Thanks