brave / brave-browser

Brave browser for Android, iOS, Linux, macOS, Windows.
https://brave.com
Mozilla Public License 2.0
17.55k stars 2.27k forks source link

Remove or randomize serial numbers from WebUSB-accessible devices #28146

Closed pes10k closed 1 year ago

pes10k commented 1 year ago

Currently sites can use WebUSB to try and get access to users USB devices. This is permission gated, so its a rare occurrence on the web, but must happen somewhere.

If you give a site access to a USB device, the site can learn the serial number for that USB device, which in some cases will be a fixed global identifier for your machine. We should probably remove, randomize or farble these serial numbers.

LaurenWags commented 1 year ago

@pes10k @pilgrim-brave could we please get a test plan for this one since it's labeled QA/Yes?

Marking as QA/Blocked until the above is sorted.

pes10k commented 1 year ago

okie i'll add one now, hope to have it done by the all hands

pes10k commented 1 year ago

@LaurenWags here ya go https://dev-pages.brave.software/fingerprinting/devices.html (the second test on the page)

LaurenWags commented 1 year ago

Thanks for the quick assistance @pes10k!

MadhaviSeelam commented 1 year ago

Verification PASSED using

Brave | 1.51.79 Chromium: 112.0.5615.49 (Official Build) beta (64-bit)
-- | --
Revision | bd2a7bcb881c11e8cfe3078709382934e3916914-refs/branch-heads/5615@{#936}
OS | Windows 11 Version 22H2 (Build 22621.1413)

Case 1: Shields Enabled (Default) - PASSED

  1. Install 1.51.79
  2. launch Brave
  3. attached/inserted couple of USB devices to the laptop (keyboard, docking station)
  4. visited https://dev-pages.brave.software/fingerprinting/devices.html in a new tab
  5. keep the Shileds Up in the Shields panel
  6. clicked on Query new device button in the WebUSB Serial number
  7. selected Unknown device from Via Labs., Inc. and clicked connect
  8. selected Unknown device from Chicony Electronics Co. Ltd. and clicked connect
  9. selected ERGOKEY USB keyboard and clicked connect
  10. clicked Query previously connected devices for the list of devices that are paired

Confirmed serial numbers are randomized for selected USB devices

Confirmed different serial numbers are shown on both test domains (Site 1 & Site 2)

Site 1: https://dev-pages.brave.software/fingerprinting/devices.html

ex ex ex ex ex
image image image image image

Site 2: https://dev-pages.bravesoftware.com/fingerprinting/devices.html

ex ex ex ex
image image image image

Case 2: Shields Down (Disabled) - PASSED

  1. toggle Off in the Shields
  2. click Other site for Disabled
  3. follow steps from 5-9 steps Case 1

Confirmed serial numbers same on both test domains

Site 1: https://dev-pages.brave.software/fingerprinting/devices.html

ex ex ex
image image image
Site 2: https://dev-pages.bravesoftware.com/fingerprinting/devices.html ex ex
image image
pes10k commented 1 year ago

This is an issue in the test, not the implementation. I'll fix the test but what your seeing reflects the feature working as expected. Please do not let this block the QA process

pes10k commented 1 year ago

(btw, the test should be fixed now)

MadhaviSeelam commented 1 year ago

@pes10k: thanks for the fix on test site (figured that could be). However, I have a question on Disabled scenario. Where would I disable them? I see Blocked setting but NOT Disable brave://settings/content/siteDetails?site=https%3A%2F%2Fdev-pages.brave.software. Is there a different place where I should be disabling?

ex ex ex
image image image
pes10k commented 1 year ago

@MadhaviSeelam if you want to remove access for these devices to this site, I think the only open you have in the "reset permission" button (or to clear all site storage for the site).

But for the test, by disabled, i mean shields disabled, not the USB devices disabled

MadhaviSeelam commented 1 year ago

@pes10k thank you! Didn't test with Shields Down but looked at Allow Finger printing while Shields Up. Wasn't sure that was the scenario to be tested. Now I see Allow Finger printing and Shields Disabled have same values. Please review my verification notes if you don't mind.

pes10k commented 1 year ago

That all looks good and correct and expected. Thanks!

stephendonner commented 1 year ago

Sorry - tried to find a USB device which has/emits a serial #, but out of the only 6 I've tried and found at home so far, none have 🤷‍♂️ - @LaurenWags mind trying?

LaurenWags commented 1 year ago

Verified with

Brave | 1.51.87 Chromium: 112.0.5615.49 (Official Build) beta (x86_64)
-- | --
Revision | bd2a7bcb881c11e8cfe3078709382934e3916914-refs/branch-heads/5615@{#936}
OS | macOS Version 13.3.1 (Build 22E261)

Reproduced the issue using 1.50.114 on Release channel. Saw same serial number for webcam on both test sites listed below with default shield settings.

1 50 x

Case 1: Shields Enabled (Default) - InProgress

  1. Install 1.51.x
  2. launch Brave
  3. attached/inserted couple of USB devices to the laptop (keyboard, docking station)
  4. visited https://dev-pages.brave.software/fingerprinting/devices.html in a new tab
  5. keep the Shields Up in the Shields panel
  6. clicked on "Query new device" button in the WebUSB Serial number
  7. selected my webcam and clicked connect

Confirmed serial numbers are randomized for selected USB devices

Confirmed different serial numbers are shown on both test domains (Site 1 & Site 2)

Site 1: https://dev-pages.brave.software/fingerprinting/devices.html Site 2: https://dev-pages.bravesoftware.com/fingerprinting/devices.html

Site 1 Site 2
site 1a site 1b

Case 2: Shields Down (Disabled) - PASSED

  1. toggled Shields Off for both Site 1
  2. clicked on "Query new device" button in the WebUSB Serial number
  3. selected my webcam and clicked connect
  4. repeated above steps for Site 2

Confirmed serial numbers same on both test domains

Site 1 Site 2
1 2

Verification passed on

Brave 1.51.107 Chromium: 113.0.5672.63 (Official Build) (64-bit)
Revision 0e1a4471d5ae5bf128b1bd8f4d627c8cbd55f70c-refs/branch-heads/5672@{#912}
OS Ubuntu 18.04 LTS

Case 1: Shields Enabled (Default) - PASSED

1. Install 1.51.x 2. launch Brave 3. attached/inserted couple of USB devices to the laptop (keyboard, docking station) 4. visited https://dev-pages.brave.software/fingerprinting/devices.html in a new tab 5. keep the `Shields` Up in the Shields panel 6. clicked on "Query new device" button in the WebUSB Serial number 7. selected my webcam and clicked connect #### Confirmed serial numbers are randomized for selected USB devices #### Confirmed different serial numbers are shown on both test domains (Site 1 & Site 2) Site 1: https://dev-pages.brave.software/fingerprinting/devices.html Site 2: https://dev-pages.bravesoftware.com/fingerprinting/devices.html ![Screenshot from 2023-05-03 09-41-21](https://user-images.githubusercontent.com/34715963/235861460-ee3d1da1-6ebb-469c-96a6-ecd0907f9164.png)|![Screenshot from 2023-05-03 09-43-08](https://user-images.githubusercontent.com/34715963/235861484-7ae3df58-6813-418c-97cf-15daedac9849.png) --|-- ![Screenshot from 2023-05-03 09-44-48](https://user-images.githubusercontent.com/34715963/235863474-d52d59e6-ccc7-43aa-b522-fbcd29bccdbb.png)|![Screenshot from 2023-05-03 09-45-07](https://user-images.githubusercontent.com/34715963/235863502-f9acf7ab-0d9b-42e2-a964-51bb2cc892da.png) --|--

Case 2: Shields Down (Disabled) - PASSED

1. toggled Shields `Off` for both Site 1 2. clicked on "Query new device" button in the WebUSB Serial number 3. selected my webcam and clicked connect 4. repeated above steps for Site 2 #### Confirmed serial numbers same on both test domains ![Screenshot from 2023-05-03 09-46-11](https://user-images.githubusercontent.com/34715963/235863749-3ad63284-f5b4-404c-8b49-dd79c8029455.png)|![Screenshot from 2023-05-03 09-46-35](https://user-images.githubusercontent.com/34715963/235863759-d2285a32-65d4-45d4-b3f6-6639cea5e119.png) --|-- ![Screenshot from 2023-05-03 09-47-35](https://user-images.githubusercontent.com/34715963/235863835-9cf52e4a-9c19-44a2-8f63-1250fa2971ef.png)|![Screenshot from 2023-05-03 09-47-51](https://user-images.githubusercontent.com/34715963/235863845-7cdce1ad-7cd5-42fb-9fe1-1dc953bd601b.png) --|--
hffvld commented 1 year ago

Verified on Google Pixel 6 and Galaxy Tab S8 using version(s):

Device/OS: 
- Google Pixel 6 [oriole-user 13 TQ2A.230405.003.E1 release-keys]
- SM-X700 Galaxy Tab S8 [gts8wifixx-user 13 TP1A.220624.014 release-keys]
Brave build: 1.51.109 Chromium: 113.0.5672.63 (Official Build) (64-bit)

Shields ON - PASS **STEPS:** 1. Launch Brave 2. Connect USB device (I have USB-C earphones) to the phone 3. Open https://dev-pages.brave.software/fingerprinting/devices.html in a new tab 4. Keep the Shields ON in the Shields panel 5. In the "WebUSB Serial Number" section tap on the "Query new device" button 6. Select attached device > Connect 7. In the pop-up message "Allow Brave to access ?" tap OK 8. Repeat steps 3 - 7, but this time open https://dev-pages.bravesoftware.com/fingerprinting/devices.html **ACTUAL RESULTS:** - Verified that the Serial number for the attached device is randomized for both URLs when Shields turned ON |Phone 1|Phone 2|Tab 1|Tab 2| |:-:|:-:|:-:|:-:| | ![1](https://user-images.githubusercontent.com/128532965/235499433-91b581a0-497d-4f8a-8427-79489f13429b.png) | ![2](https://user-images.githubusercontent.com/128532965/235499593-76dc1bd0-4d5f-4c11-a267-31e605a1f06d.png) | ![3](https://user-images.githubusercontent.com/128532965/235770024-3b7a9a88-f7bf-45f3-8d45-12888900b64b.png) | ![4](https://user-images.githubusercontent.com/128532965/235770041-571ed2c9-713c-485f-816e-6cdb830a58ef.png) |
Shields OFF - PASS **STEPS:** 1. Launch Brave 2. Connect USB device (I have USB-C earphones) to the phone 3. Open https://dev-pages.brave.software/fingerprinting/devices.html in a new tab 4. Turn OFF the Shields in the Shields panel 5. In the "WebUSB Serial Number" section tap on the "Query new device" button 6. Select attached device > Connect 7. In the pop-up message "Allow Brave to access ?" tap OK 8. Repeat steps 3 - 7, but this time open https://dev-pages.bravesoftware.com/fingerprinting/devices.html **ACTUAL RESULTS:** - Verified that the Serial number for the attached device is the same for both URLs when Shields turned OFF |Phone 1|Phone 2|Tab 1|Tab 2| |:-:|:-:|:-:|:-:| | ![1](https://user-images.githubusercontent.com/128532965/235500445-de1b7069-219b-4d44-8c5d-b7071b2d044a.png) | ![2](https://user-images.githubusercontent.com/128532965/235500632-bcba4bb0-6e20-47c0-99e9-765e954963fb.png) | ![3](https://user-images.githubusercontent.com/128532965/235770582-1ecb6f18-43f8-44d7-8f4b-20280680749e.png) | ![4](https://user-images.githubusercontent.com/128532965/235770593-7d68d3a1-2b31-472b-b162-177a9205316c.png) |