Understanding Security in Windows Phone 7 Platform

Introduction

Unlike the Windows Mobile development platform, the new Windows Phone platform from Microsoft is completely different from its predecessor. Application developers targeting Windows Phone platform should be aware of the security model surrounding the platform so that they can develop applications that fit the guidelines.

Security Model

Windows Phone employs a resource capability-driven model. An example of a resource capability can be GPS, camera, microphone, SMS or sensor for which privacy and security concerns exists.

By privacy and security concern, we mean that the user should be aware of the use of the above mentioned resources by the application and the user must consent to the use.

This control is necessary to avoid rogue applications from conducting malicious activity like transmitting user data, which can be used for malicious purposes.

All Windows Phone application projects declare the capabilities the application wants in the application manifest file called WMAppManifest.xml. This file can be located under the properties note of the Solution file.

Solution Explorer
Figure 1: Solution Explorer

By default, the WMAppManifest.xml looks as under

<?xml version="1.0" encoding="utf-8"?>

<Deployment xmlns="http://schemas.microsoft.com/windowsphone/2009/deployment" AppPlatformVersion="7.0">
  <App xmlns="" ProductID="{d6527e1c-159b-49c4-9fb3-c75a5bff222f}" Title="WindowsPhoneSecurityDemo" RuntimeType="Silverlight" Version="1.0.0.0" Genre="apps.normal" Author="WindowsPhoneSecurityDemo
author" Description="Sample description" Publisher="WindowsPhoneSecurityDemo">
    <IconPath IsRelative="true" IsResource="false">ApplicationIcon.png</IconPath>
    <Capabilities>
      <Capability Name="ID_CAP_GAMERSERVICES"/>
      <Capability Name="ID_CAP_IDENTITY_DEVICE"/>
      <Capability Name="ID_CAP_IDENTITY_USER"/>
      <Capability Name="ID_CAP_LOCATION"/>
      <Capability Name="ID_CAP_MEDIALIB"/>
      <Capability Name="ID_CAP_MICROPHONE"/>
      <Capability Name="ID_CAP_NETWORKING"/>
      <Capability Name="ID_CAP_PHONEDIALER"/>
      <Capability Name="ID_CAP_PUSH_NOTIFICATION"/>
      <Capability Name="ID_CAP_SENSORS"/>
      <Capability Name="ID_CAP_WEBBROWSERCOMPONENT"/>
    </Capabilities>
    <Tasks>
      <DefaultTask Name ="_default" NavigationPage="MainPage.xaml"/>
    </Tasks>
    <Tokens>
      <PrimaryToken TokenID="WindowsPhoneSecurityDemoToken" TaskName="_default">
        <TemplateType5>
          <BackgroundImageURI IsRelative="true" IsResource="false">Background.png</BackgroundImageURI>
          <Count>0</Count>
          <Title>WindowsPhoneSecurityDemo</Title>
        </TemplateType5>
      </PrimaryToken>
    </Tokens>
  </App>
</Deployment>
 

We can see that by default, any application declares the following capabilities.

Capability ID

Capability description

ID_CAP_GAMERSERVICES

Access to Xbox live gamer services

ID_CAP_IDENTITY_DEVICE

Access to IMEI, Device phone number.

ID_CAP_IDENTITY_USER

Access to user information

ID_CAP_LOCATION

Access to user's location

ID_CAP_MEDIALIB

Access to media library

ID_CAP_MICROPHONE

Access to device microphone

ID_CAP_NETWORKING

Access to network services. This has to be disclosed since user can be charged if roaming

ID_CAP_PHONEDIALER

Access to the ability to place phone calls

ID_CAP_PUSH_NOTIFICATION

Access to push notifications from internet service

ID_CAP_SENSORS

Access to device sensors

ID_CAP_WEBBROWSERCOMPONENT

Access to browsing components.

Since by default, all capabilities are declared, it can make an application less desirable when it is available in the Marketplace. So application developers need to remove the capabilities the application does not need.

If you do not declare a capability and use it in the application, the application will crash with UnauthorizedAccessException when attempting to use that capability.

Capability Detection Tool

The Windows Phone SDK (with January update) ships with a useful utility, which can look into the code and determine which capabilities are needed by the application, so that the application manifest file only needs to declare the needed capability and not every capability available.

The Capability tool is located at %ProgramFiles (x86)%\Microsoft SDKs\Windows Phone\v7.0\Tools\CapDetect and is a file called CapabilityDetection.exe.

The syntax for the tool is

CapabilityDetection.exe Rules.xml PathtoXAPFile

The tool will list the capabilities the application needs and you can then update the projects's WMAppManifest.xml file to include only the tool listed capabilities.

Summary

In this article, we learned about the capability-driver security model of the Windows Phone platform. I hope you have found this information useful.



About the Author

Vipul Vipul Patel

Vipul Patel is a Software Engineer currently working at Microsoft Corporation, working in the Office Communications Group and has worked in the .NET team earlier in the Base Class libraries and the Debugging and Profiling team. He can be reached at vipul_d_patel@hotmail.com

Related Articles

Comments

  • Car Accessories

    Posted by tomorrowark on 06/14/2011 05:24am

    Online shopping for auto parts, Car Accessories, aftermarket car gadgets and LED light, free shipping for all orders. More information follow the link: http://www.tomtop.com/car-accessories

    Reply
Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • Live Event Date: May 7, 2014 @ 1:00 p.m. ET / 10:00 a.m. PT This eSeminar will explore three popular games engines and how they empower developers to create exciting, graphically rich, and high-performance games for Android® on Intel® Architecture. Join us for a deep dive as experts describe the features, tools, and common challenges using Marmalade, App Game Kit, and Havok game engines, as well as a discussion of the pros and cons of each engine and how they fit into your development …

  • The exponential growth of data, along with virtualization, is bringing a disruptive level of complexity to your IT infrastructure. Having multiple point solutions for data protection is not the answer, as it adds to the chaos and impedes on your ability to deliver consistent SLAs. Read this white paper to learn how a more holistic view of the infrastructure can help you to unify the data protection schemas by properly evaluating your business needs in order to gain a thorough understanding of the applications …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds