Re: [PATCH BlueZ 0/3] Per-device option to enable/disable internal profiles

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Luiz,

On Mon, Jul 13, 2020 at 3:59 PM Luiz Augusto von Dentz
<luiz.dentz@xxxxxxxxx> wrote:
>
> Hi Sonny,
>
> On Mon, Jul 13, 2020 at 3:04 PM Sonny Sasaka <sonnysasaka@xxxxxxxxxxxx> wrote:
> >
> > Hi Luiz,
> >
> > I considered having such an approach that gives exception to some
> > profile to not claim exclusive access. However, I think that this
> > approach has a drawback that it can only be guaranteed to work
> > correctly for profiles that contain only read-only attributes. Any
> > profile that contains writable attributes, naturally, cannot be
> > guaranteed to always work correctly (as is the case with the Battery
> > profile). Therefore, the usefulness of that feature will be very
> > limited.
> >
> > I also considered the benefits of the AllowInternalProfiles approach:
> > * Applications can also have control over any profile, not just
> > Battery profile. For example, if in the future BlueZ has more internal
> > profiles, like (Blood Pressure Profile or any other profile that may
> > contain writable attributes), we can guarantee that applications can
> > still opt to have access to that profile, without relying on a profile
> > being "safe" to be shared by both BlueZ's internal and external
> > handlers.
> > * This has an added security benefit: applications which operate on a
> > specific GATT profile will not unintentionally activate internal
> > profiles such as HOG (which is able to hijack input control of the
> > host). This is the correct and expected behavior of Android apps that
> > connect over GATT and get access to a GATT profile.
>
> Not sure I follow these arguments, it seems AllowInternalProfiles may
> actually enable hijacking the profiles so I wonder if you got this
> backwards as we can't let things like HoG be controlled by
> applications directly it would be too easy to implement something like
> a keylogger, or perhaps you are suggesting that there is another layer
> for implementing the profiles? Note that it is intended that plugins
> shall be used for profiles that need to be integrated system wide,
> D-Bus interface shall be restricted to only application specific
> profiles.

I think you misunderstood my point about HOG hijacking. Consider the
following case:
1. A legit application (not System UI) on a host computer scans and
connects to a nearby peer. It makes a guess about the peer device
based on its advertising data. It intends to operate on a specific
GATT profile (not necessarily Battery).
2. The peer device turns out to be malicious. It runs HOG GATT server
and triggers the host's HOG profile to be active.
3. The malicious peer device's HOG GATT server can now maliciously
make mouse movements or enter keystrokes to the host.

In this case the user is considered being attacked, because he/she
doesn't consciously interact with the System UI to connect to a nearby
mouse/keyboard.
My example doesn't have to be HOG. It just happens to be a profile
which is attackable at the moment. My point is that, for applications
it's always safest to turn off all internal profiles to avoid such
incident. There is no use case where applications want to trigger
internal profiles.

Note 1: By "applications", I mean things like Android apps or
JavaScript apps which are not considered System's Bluetooth UI.

>
> Note that we do allow external profiles to be registered with use of:
>
> https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc/profile-api.txt
>
> And for GATT:
>
> https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc/gatt-api.txt#n366
>
> We could perhaps make the assumption that once an application
> registers itself as supporting a given profile we check if against a
> blacklist of profiles that may have security implications, which
> perhaps could be defined via main.conf or some other file, if that is
> not the case the internal profile can be disabled and the D-Bus object
> would be accessible over D-Bus. Also note that we do offer clients the
> ability to have exclusive access with AcquireWrite and AcquireNotify.
>
> > Therefore I think that this approach, although more complex, has
> > longer lasting benefits. Let me know if you have any objection to
> > having such a feature.
> >
> >
> > On Mon, Jul 13, 2020 at 1:35 PM Luiz Augusto von Dentz
> > <luiz.dentz@xxxxxxxxx> wrote:
> > >
> > > Hi Sonny,
> > >
> > > On Mon, Jul 13, 2020 at 1:18 PM Sonny Sasaka <sonnysasaka@xxxxxxxxxxxx> wrote:
> > > >
> > > > This patch series adds a mechanism for clients to choose whether to
> > > > enable BlueZ internal profiles (e.g. A2DP, Battery) for specific
> > > > devices.
> > > >
> > > > The motivation behind this feature is that some applications (e.g. Web
> > > > Bluetooth or Android apps) need to have control over all remove GATT
> > > > services, like Battery service. With "battery" plugin being enabled on
> > > > BlueZ, it becomes not possible for those apps to work properly because
> > > > BlueZ "hides" the Battery-related attributes from its GATT Client API.
> > > > Disabling the "battery" plugin won't solve the problem either, since we
> > > > do also need to enable the plugin so that we can use org.bluez.Battery1
> > > > API.
> > > >
> > > > The solution that we propose is that clients can choose whether to
> > > > enable internal profiles for each device. Clients know when to enable
> > > > internal profiles (such as when a user chooses to pair/connect via a UI)
> > > > and when to disable internal profiles (such as when the connection is
> > > > initiated by a generic application).
> > >
> > > I wonder if it is not better to just have a flag indicating if the
> > > profile shall claim exclusive access (such as GAP and GATT services),
> > > so profiles that don't set that will have the services exposed so for
> > > battery we can probably just have it exposed by default since it
> > > doesn't appear to would be any conflicts on having it exposed.
> > >
> > > > Sonny Sasaka (3):
> > > >   doc: Add "AllowInternalProfiles" property to org.bluez.Device1
> > > >   device: Add "AllowInternalProfiles" property to org.bluez.Device1
> > > >   client: Add set-allow-internal-profiles command
> > > >
> > > >  client/main.c      | 38 ++++++++++++++++++
> > > >  doc/device-api.txt | 13 +++++++
> > > >  src/device.c       | 96 ++++++++++++++++++++++++++++++++++++++++++++++
> > > >  src/hcid.h         |  2 +
> > > >  src/main.c         | 10 +++++
> > > >  src/main.conf      |  4 ++
> > > >  6 files changed, 163 insertions(+)
> > > >
> > > > --
> > > > 2.26.2
> > > >
> > >
> > >
> > > --
> > > Luiz Augusto von Dentz
>
>
>
> --
> Luiz Augusto von Dentz



[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux