I have an application which needs to be restarted at some defined places (say when the application is idle for a timeout threshold). I have a batch file to execute restart commands.Now I am checking out the batch file with the application itself and running the batch file when need occurs. Now I have found out that a malicious user can modify the batch file (Restart.cmd) and include a malicious payload (e.g executable file (.exe)). Whenever the batch file runs, the malicious payload will be executed as well.
I can run all the command one by one using system() call. But I thought of having the same batch file embedded with the code and run it without actually deploying it with the application. Is this possible? or are there any smarter ways to do so.
The batch file is as follows
echo Waiting for old instance to exit
timeout.exe /T 5
copy _download\* .
start %*
exit