---------------------------------------------------------------------

modzeroÂ  Security Advisory:Â  BlackBerryÂ  Z 10Â  -Â  Storage andÂ  Access
File-Exchange Authentication By-Pass [MZ-13-04]

---------------------------------------------------------------------

---------------------------------------------------------------------

1. Timeline

---------------------------------------------------------------------

Â * 2013-06-23: Vendor has been contacted.
Â * 2013-06-24: Vendor response.
Â * 2013-06-27: Vendor meeting and information exchange.
Â * 2013-08-20: Advisory and more details sent to the vendor.
Â * 2013-10-15Â  or after patch-release: Advisory will be published.
Â * 2013-12-05: Vendor requested delay of release, until a high level
Â  Â  Â  Â  Â  Â  Â  Â of carrier uptake has been achieved.
Â * 2014-04-02: Vulnerabilities were fixed, but vendor requested delay
Â  Â  Â  Â  Â  Â  Â  Â of release, until a higher level of carrier uptake has
Â  Â  Â  Â  Â  Â  Â  Â been achieved.
Â * 2014-08-11: Vendor achieved sufficient customer availability for
Â  Â  Â  Â  Â  Â  Â  Â this issue and announced release on August 12th, 2014.
Â * 2014-08-12: Release of security advisory in cooperation with
Â  Â  Â  Â  Â  Â  Â  Â vendor.

---------------------------------------------------------------------

2. Summary

---------------------------------------------------------------------

Vendor: BlackBerry

Products known to be affected:
Â * Blackberry Z10 model STL100-2
Â  Â Software release: 10.1.0.2312
Â  Â OS version: 10.1.0.2354
Â  Â Build ID: 524717

Severity: Medium
Remote exploitable: Yes
CVE: CVE-2014-2388

The mobile phone offers aÂ  network service ("Storage and Access") for
adhoc file-exchange [1]Â  between the phone and aÂ  network client [2].
To achieve these goals, the mobile device deploys a Samba fileserver,
whichÂ  canÂ  be usedÂ  toÂ  uploadÂ  or downloadÂ  filesÂ  toÂ  or fromÂ  the
Blackberry phone. To enable fileserver access from wireless networks,
the user has to explicitly enableÂ  "Access using Wi-Fi" on the phone.
Afterwards,Â  the Z10Â  asksÂ  theÂ  user toÂ  enterÂ  aÂ  password thatÂ  is
requiredÂ  Â toÂ  getÂ  Â accessÂ  Â toÂ  theÂ  Â fileserver.Â  TheÂ  Â fileserver
implementation orÂ  the password handling thatÂ  is used on theÂ  Z10 is
affected byÂ  an authentication by-pass vulnerability:Â  The fileserver
failsÂ  to askÂ  for aÂ  passwordÂ  and allowsÂ  unauthenticated usersÂ  to
obtain read andÂ  write access to the offered shares.Â  The severity is
considered medium toÂ  high, as an attacker may beÂ  able to distribute
targetedÂ  Â  Â  malwareÂ  Â  Â  orÂ  Â  Â accessÂ  Â  Â  confidentialÂ  Â  Â  data.

---------------------------------------------------------------------

3. Details

---------------------------------------------------------------------

The problem occurs, when "Sharing viaÂ  Wi-Fi" has been enabled on the
Z10. The "Storage andÂ  Access" dialog of the Z10 asksÂ  the user for a
password that shallÂ  be used to access data onÂ  the fileserver. Under
certain circumstances, the fileserver fails to ask for a password and
allowsÂ  access evenÂ  without specifyingÂ  credentials. ThisÂ  behaviour
does not alwaysÂ  occur but is reproducible within atÂ  most one of ten
different tries via Wi-Fi.

TheÂ  followingÂ  lists describeÂ  theÂ  stepsÂ  of differentÂ  methodsÂ  to
reproduceÂ  theÂ  issue.Â  TheÂ  fistÂ  Â approachÂ  letÂ  usersÂ  accessÂ  the
fileserver via the wireless LAN interface without using the developer
mode, whichÂ  is the mostÂ  common scenario. The secondÂ  approach gives
access via USB cable. In thisÂ  second approach, the developer mode is
activated to enableÂ  TCP/IP communication via USB.Â  The second method
is more reliable for reproducing the effect and for tracking down the
root cause.

The root cause of the vulnerability isÂ  not known at the time of this
writing. TheÂ  test was performedÂ  with anÂ  Ubuntu Linux asÂ  a network
client. References to specific Linux tools are presented for the sake
of completeness.

3.1 Method 1

Prepare the phone:

1. Disconnect all cables
2. Open Settings / "Storage and Access" and make sure "Access using
Â  Â Wi-Fi" is turned off. This is not strictly necessary, but
Â  Â recommended to reproduce the effect.
3. Power down the phone.

The process to reproduce the problem:

1. Boot the phone.
2. Enter the PIN for the SIM card.
3. Enter the device password.
4. Open Settings
5. Open "Network Connections". Make sure that Wi-Fi is enabled and
Â  Â the phone is a client in a wireless LAN. In the test environment,
Â  Â the client IP address is 10.0.0.149.
6. For the tests, "Mobile Hotspot" is "Not Connected" and "Internet
Â  Â Tethering" is off. This setting is likely not critical.
7. Open "Storage and Access".
8. Enable "Access using Wi-Fi" on the phone. The phone will ask
Â  Â for a password. Use a password, which you never used before
Â  Â (for the server) to make sure, that credentials are not loaded
Â  Â from the Gnome keychain.
9. Open Nautilus with: nautilus smb://10.0.0.149
10. If Nautilus fails to display a lost of shares, close Nautilus and
Â  Â  open it again.
11. Try to access a share. If the server asks for a password, disable
Â  Â  "Access using Wi-Fi", reboot the phone and try again.

3.2 Method 2

Prepare the phone:

1. Connect phone to the PC via USB cable
2. Open Settings / "Storage and Access" and make sure "Access using
Â  Â Wi-Fi" is turned off.
3. Power down the phone.

The process to reproduce the problem:

1. Boot the phone.
2. Enter the PIN for the SIM card.
3. Enter the device password.
4. Open Settings
5. Open "Network Connections". Make sure that Wi-Fi is switched off,
Â  Â "Mobile Hotspot" is "Not Connected" and "Internet Tethering" is
Â  Â off.
6. Open "Development Mode" and enable it. The phone's IP address is
Â  Â set to 169.254.0.1.
7. Wait for the message: "Developer mode active ...".
8. Wait for the message: "Connected to PC ...".
9. Open "Storage and Access", make sure "Access using Wi-Fi" is
Â  Â disabled.
10. Open the Gnome file browser Nautilus from the command line with:
Â  Â  nautilus smb://169.254.0.1
11. If Nautilus does not show any share, close Nautilus and open it
Â  Â  again. If it is still empty, repeat the step.
12. Try to open a share: Nautilus will ask for a password. Click
Â  Â  cancel. Nautilus will just ask again, press Cancel, again. This
Â  Â  is expected behavior.
13. Close Nautilus
14. Open Nautilus, again, and leave the Nautilus window open.
15. Enable "Access using Wi-Fi" on the phone. The phone will ask for
Â  Â a password. Use a password, which you never used before (for the
Â  Â server) to make sure, that credentials are not stored in the Gnome
Â  Â keychain.
16. Click on a share, again. The share will be opened without asking
Â  Â  for a password.
17. Disconnect share and open Nautilus again with:
Â  Â  nautilus smb://169.254.0.1
18. Open a share. Nautilus will show the contents of the share.
19. Create a folder and create a file.

Shutdown process:

1. Disconnect shares
2. Disable "Access using Wi-Fi" in the phone's settings.
3. Shut down the phone.

A video of a demonstration is available at [3].

---------------------------------------------------------------------

4. Impact

---------------------------------------------------------------------

TheÂ  authenticationÂ  by-pass resultsÂ  inÂ  readÂ  and writeÂ  accessÂ  to
enabled shares. Thus, sensitive dataÂ  may be accessed by unauthorized
orÂ  malicious networkÂ  clientsÂ  orÂ  users. SinceÂ  theÂ  share isÂ  also
writable,Â  attackersÂ  areÂ  ableÂ  to distributeÂ  targetedÂ  malwareÂ  to
certain mobile-phone users.

---------------------------------------------------------------------

5. Workaround

---------------------------------------------------------------------

ToÂ  reduce theÂ  risks inÂ  public wirelessÂ  networks, disableÂ  "Access
usingÂ  Wi-Fi"Â  inÂ  theÂ  "SettingsÂ  Â /Â  StorageÂ  andÂ  Access"Â  dialog.

---------------------------------------------------------------------

6. Fix

---------------------------------------------------------------------

Vendor provided bugfix.

---------------------------------------------------------------------

7. Credits

---------------------------------------------------------------------

Â * David Gullasch (dagu (at) modzero (dot) ch [email concealed])
Â * Max Moser (mmo (at) modzero (dot) ch [email concealed])
Â * Martin Schobert (martin (at) modzero (dot) ch [email concealed])

---------------------------------------------------------------------

8. About modzero

---------------------------------------------------------------------

TheÂ  independentÂ  SwissÂ  companyÂ  modzeroÂ  AGÂ  assistsÂ  clientsÂ  with
security analysisÂ  in the complexÂ  areas of computerÂ  technology. The
focusÂ  liesÂ  onÂ  highlyÂ  detailedÂ  technicalÂ  analysisÂ  ofÂ  concepts,
softwareÂ  andÂ  hardware componentsÂ  asÂ  wellÂ  as theÂ  developmentÂ  of
individual solutions.Â  Colleagues atÂ  modzero AG workÂ  exclusively in
practical, highlyÂ  technical computer-security areas andÂ  can draw on
decadesÂ  of experienceÂ  inÂ  various platforms,Â  system concepts,Â  and
designs.

http://modzero.ch

contact (at) modzero (dot) ch [email concealed]

---------------------------------------------------------------------

9. Disclaimer

---------------------------------------------------------------------

The informationÂ  in the advisoryÂ  is believedÂ  to be accurateÂ  at the
time of publishingÂ  based on currently availableÂ  information. Use of
the information constitutes acceptance for use in an AS IS condition.
There are no warranties withÂ  regard to this information. Neither the
authorÂ  norÂ  the publisherÂ  acceptsÂ  anyÂ  liability forÂ  anyÂ  direct,
indirect, orÂ  consequential lossÂ  or damage arisingÂ  from useÂ  of, or
reliance on, this information.

---------------------------------------------------------------------

10. References

---------------------------------------------------------------------

[1] Moving or copying media files and documents:
Â  Â 
http://docs.blackberry.com/en/smartphone_users/deliverables/47561/als133
4683894417.jsp
[2] How to copy files to and from a BlackBerry Z10 over a Wi-Fi
Â  Â  network: http://helpblog.blackberry.com/2013/03/copy-z10-files-wifi/
[3] Proof-of-Concept video: http://modzero.ch/advisories/media/mz-13-04-poc.mp4

---------------------------------------------------------------------

See also:

http://www.modzero.ch/advisories/MZ-13-04-Blackberry_Z10-File-Exchange-A
uthentication-By-Pass.txt