A strange vulnerability has surfaced online that affects Apple iPhones. This weird bug can disable the WiFi functionality of an iPhone when triggered.
iPhone WiFi Functionality Bug
A researcher Carl Schou recently caught a weird bug that breaks the WiFi functionality of an iPhone when triggered. Triggering the bug is also quite easy as it merely requires connecting to a hotspot with an unusual SSID.
The researcher first disclosed the glitch in his tweet.
After joining my personal WiFi with the SSID “%p%s%s%s%s%n”, my iPhone permanently disabled it’s WiFi functionality. Neither rebooting nor changing SSID fixes it :~) pic.twitter.com/2eue90JFu3
— Carl Schou (@vm_call) June 18, 2021
It turns out that the problem exists because of the printf()-style string format specifiers in C language. According to this analysis by another researcher with alias CodeColorist, and the explanations from security researcher Alex Skalozub, the bug exists because of how iOS handles the “%” sign in the SSID.
As Skalozub explained to The Register, iOS basically recognizes the third “%s” in the SSID as a referenced string, which doesn’t actually exist. Hence, the glitch crashes the code and disrupts the WiFi functionality.
The “%s” tells the software to use a referenced string, which likely doesn’t actually exist, causing the code to crash. Indeed, it appears to cause a strlen() function call to trigger a memory access fault.
Skalozub demonstrated the same as he tried to connect to a WiFi with SSID “%Free %Coffee at %Starbucks”. Again, the third “%” sign with “s” (in %Starbucks) triggered the crash.
So, that’s why Schou faced the problem. Upon attempting to connect to the WiFi named “%p%s%s%s%s%n”, the iPhone WiFi crashed.
Is it dangerous?
According to Amichai Shulman, co-founder and CTO of AirEye, this bug can potentially lead to RCE attacks. As stated in a blog post,
While it is easy to use the vulnerability to simply disable the Wi-Fi capabilities of an attacked machine, the nature of format string vulnerabilities is that when carefully crafted they can be used to write arbitrary code into random, or chosen, parts of a machine’s memory – and even eventually inject and execute code. Since the device is on the corporate network, this code can eventually be used for lateral movement.
Also, given that the glitch also affects macOS, can trigger remotely, and remains out of the scope of network security solutions, this bug is more of a potential security threat.
Despite being unpatched, the other security researchers ruled out such a possibility. According to Skalozub,
I don’t believe it is exploitable. The CFString format string syntax doesn’t have %n format modifier, so writing into memory at the pointer on stack is impossible. Also, the attacker doesn’t have control of the pointers on stack, because the format string is located on the heap.
Besides, even upon admitting the bug as a security risk, there won’t be much risks since a user can easily identity the SSID of the WiFi to avoid.
Likewise, Schou also told the same to The Register,
This bug would be quite complicated to fully exploit, as you are limited by the length of the SSID and the functionality of the format string. You could potentially turn this into an information disclosure, but to use it for anything remotely useful (besides crashing the Wi-Fi daemon) you would need another exploit.
No Patch Yet; But Here’s How To Fix It Yourself
For now, no fix is available from Apple for this iPhone bug. Therefore, the users should watch out for weird SSIDs before connecting their devices to WiFi. (This applies to the Mac users as well.)
Nonetheless, if the bug accidentally triggers on the device, users can fix it after resetting the device.
For this, go to Settings > General > Reset > Reset Network Settings. This will restart the iPhone after which, users can configure the WiFi settings as required.
Let us know your thoughts in the comments.