This code creates a sandbox escape vulnerability by allowing an attacker to execute arbitrary JavaScript code through the SpeechRecognition API. When the startButton is clicked, the triggerSpeechRecognitionUAF() function is called, which creates multiple SpeechRecognition instances and injects a command execution vulnerability into the onresult event handler.
To exploit this vulnerability, an attacker could speak a command that is then executed on the client-side using the eval() function. This could lead to remote code execution in a sandboxed environment.
Please note that this code is for educational purposes and should not be used in production environments without proper security measures. The attacker would need to find a way to control the transcript and ensure that the injected code is properly formatted and does not break the sandbox.
apt update && apt install -y snapd
snap install core
snap install chromium
chromium "http://localhost/speech_rce.html" &
apt update && apt install -y firefox-esr
firefox-esr "http://localhost/speech_rce.html" &
sudo bash poc.sh
Open the URL http://localhost/speech_rce.html in Firefox. Click "Start Speech Recognition" and speak commands like console.log("Hacked!"); alert("RCE simulated!"); Observe the command execution in the browser's console (Ctrl+Shift+I).