Nowadays for detecting a rooted device, some applications perform static checks such as for example the case of GoogleWallet https://www.joeyconway.com/blog/2014/03/29/android-detect-root-access-from-inside-an-app/.
The problem is that it is not that difficult to bypass such verifications. One of the many ways to do so is to get a temporary root shell for executing any commands we want. As an example, Towelroot embeds a kernel root exploit for getting local root privileges. This enables him to permanently root the device by installing the necessary binaries. The same way, one can use the same technique but just for returning a temporary root shell instead of permanently rooting the device. This way no additional files will be installed, static checks will fail.
How is it possible to detect such kind of scenario?