Am I affected?

This record states its affected versions in a form that can't be compared automatically.

≥ 1.0.0 < 2.5.3 affected
every other version: unaffected

Description

Missing Authorization vulnerability in the device and deployment group pages in nerves-hub nerves_hub_web allows an authenticated organization member with the view role to change devices and deployment groups via LiveView events reserved for the manage role. The event handlers that add and delete device certificates, add and remove tags, overwrite or clear a device's manual location, remove a device from its deployment group, move matched devices into a deployment group or remove unmatched ones, import devices from a CSV, and start, retry or delete firmware delta builds carry out the change without calling authorized!/2, and the pages render the controls to every member.

A view member can add a certificate that lets whoever holds its key connect as the device, delete a certificate so the device can no longer authenticate with it, and change which deployment group, and so which firmware release, a device receives. Everything stays within the organizations the member belongs to.

This issue affects nerves_hub: from 1.0.0 before 2.5.3.

Technical analysis

The dashboard reads the member's role into current_scope when a page mounts, and each privileged event handler is expected to call authorized!/2 with the permission it needs, all of which resolve to the manage role in lib/nerves_hub_web/helpers/authorization.ex. These handlers never do:

Device settings tab (NervesHubWeb.Components.DevicePage.SettingsTab): hooked_event/3 for delete-certificate, and handle_progress/3 for the certificate upload, which should require device:update.

Device details tab (NervesHubWeb.Components.DevicePage.DetailsTab): hooked_event/3 for add-tag, remove-tag, save-location-changes and clear-manual-location-information (device:update), and remove-from-deployment-group (device:set-deployment-group).

Deployment group page (NervesHubWeb.Live.DeploymentGroups.Show and NervesHubWeb.Components.DeploymentGroupPage.Summary): handle_event/3 for move-matched-devices-to-deployment-group and remove-unmatched-devices-from-deployment-group, and handle_progress/3 for the device_csv upload (device:set-deployment-group), plus generate-firmware-deltas, retry_delta and delete_delta (deployment_group:update).

The pages show every one of these controls to view members, so each change takes a click, and a client can send the events directly over the LiveView socket regardless.

Proof of concept

  1. Create deployment group canary with conditions matching tag beta.
  2. Create device_outside_match in the same product with tag beta and no deployment group, and device_inside_mismatch in deployment group canary with tag foo.
  3. Sign in as a member of the organization with the view role and open /org/<org>/<product>/deployment_groups/canary.
  4. Click Move device(s): device_outside_match is now in canary. Click Remove device(s): device_inside_mismatch no longer has a deployment group.
  5. As the same member, open a device in the product and add a tag. The tag is saved.
  6. On the device's settings tab, delete a certificate, or upload a self-signed one. The change is saved, and a client presenting the uploaded certificate connects as the device.

Weaknesses & attack patterns

Weakness

CWE-862 · Missing Authorization in catalog → MITRE ↗

Attack patterns

CAPEC-1 · Accessing Functionality Not Properly Constrained by ACLs MITRE ↗

An organization member with the view role can add or delete a device's certificates, change its tags and location, and move devices into or out of deployment groups, which changes the firmware release they receive. An added certificate lets whoever holds its key connect as the device and persists after the member leaves. Everything stays within the organizations the member belongs to.

Affected — ghcr.io / nerves-hub/nerves-hub Container registry ↗

≥ 1.0.0 < 2.5.3 affected
every other version: unaffected
cpe cpe:2.3:a:nerves-hub:nerves_hub_web:*:*:*:*:*:*:*:*
version type other
modules · source files · routines
modules 'Elixir.NervesHubWeb.Components.DevicePage.SettingsTab' · 'Elixir.NervesHubWeb.Components.DevicePage.DetailsTab' · 'Elixir.NervesHubWeb.Live.DeploymentGroups.Show' · 'Elixir.NervesHubWeb.Components.DeploymentGroupPage.Summary'
source files lib/nerves_hub_web/components/device_page/settings_tab.ex · lib/nerves_hub_web/components/device_page/details_tab.ex · lib/nerves_hub_web/live/deployment_groups/show.ex · lib/nerves_hub_web/components/deployment_group_page/summary.ex
routines 'Elixir.NervesHubWeb.Components.DevicePage.SettingsTab':hooked_event/3 · 'Elixir.NervesHubWeb.Components.DevicePage.SettingsTab':handle_progress/3 · 'Elixir.NervesHubWeb.Components.DevicePage.DetailsTab':hooked_event/3 · 'Elixir.NervesHubWeb.Live.DeploymentGroups.Show':handle_event/3 · 'Elixir.NervesHubWeb.Components.DeploymentGroupPage.Summary':handle_event/3 · 'Elixir.NervesHubWeb.Components.DeploymentGroupPage.Summary':handle_progress/3

Affected — Nerves Hub Repository ↗

≥ 1.0.0 < 2.5.3 affected
every other version: unaffected
cpe cpe:2.3:a:nerves-hub:nerves_hub_web:*:*:*:*:*:*:*:*
version type semver
modules · source files · routines
modules 'Elixir.NervesHubWeb.Components.DevicePage.SettingsTab' · 'Elixir.NervesHubWeb.Components.DevicePage.DetailsTab' · 'Elixir.NervesHubWeb.Live.DeploymentGroups.Show' · 'Elixir.NervesHubWeb.Components.DeploymentGroupPage.Summary'
source files lib/nerves_hub_web/components/device_page/settings_tab.ex · lib/nerves_hub_web/components/device_page/details_tab.ex · lib/nerves_hub_web/live/deployment_groups/show.ex · lib/nerves_hub_web/components/deployment_group_page/summary.ex
routines 'Elixir.NervesHubWeb.Components.DevicePage.SettingsTab':hooked_event/3 · 'Elixir.NervesHubWeb.Components.DevicePage.SettingsTab':handle_progress/3 · 'Elixir.NervesHubWeb.Components.DevicePage.DetailsTab':hooked_event/3 · 'Elixir.NervesHubWeb.Live.DeploymentGroups.Show':handle_event/3 · 'Elixir.NervesHubWeb.Components.DeploymentGroupPage.Summary':handle_event/3 · 'Elixir.NervesHubWeb.Components.DeploymentGroupPage.Summary':handle_progress/3

Affected — GitHub / nerves-hub/nerves_hub_web Repository ↗

≥ 7b51176 < 34ea112 affected
every other version: unaffected
cpe cpe:2.3:a:nerves-hub:nerves_hub_web:*:*:*:*:*:*:*:*
version type git
modules · source files · routines
modules 'Elixir.NervesHubWeb.Components.DevicePage.SettingsTab' · 'Elixir.NervesHubWeb.Components.DevicePage.DetailsTab' · 'Elixir.NervesHubWeb.Live.DeploymentGroups.Show' · 'Elixir.NervesHubWeb.Components.DeploymentGroupPage.Summary'
source files lib/nerves_hub_web/components/device_page/settings_tab.ex · lib/nerves_hub_web/components/device_page/details_tab.ex · lib/nerves_hub_web/live/deployment_groups/show.ex · lib/nerves_hub_web/components/deployment_group_page/summary.ex
routines 'Elixir.NervesHubWeb.Components.DevicePage.SettingsTab':hooked_event/3 · 'Elixir.NervesHubWeb.Components.DevicePage.SettingsTab':handle_progress/3 · 'Elixir.NervesHubWeb.Components.DevicePage.DetailsTab':hooked_event/3 · 'Elixir.NervesHubWeb.Live.DeploymentGroups.Show':handle_event/3 · 'Elixir.NervesHubWeb.Components.DeploymentGroupPage.Summary':handle_event/3 · 'Elixir.NervesHubWeb.Components.DeploymentGroupPage.Summary':handle_progress/3

Workarounds

No configuration closes the hole. Until the upgrade, give the view role only to people you would trust with the manage role on that organization's devices.

Solutions

Upgrading does not remove a certificate that a view member already added. After upgrading, review each device's certificates and delete any you do not recognize.

References

Credits

arbor-s Finder Reporter
Josh Kalderimis Remediation developer
Jonatan Männchen / EEF Coordinator

CVSS breakdown

CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:L/VI:L/VA:L/SC:N/SI:L/SA:N
« All CVEs