Am I affected?

type your livebook version to check

Description

Not Failing Securely ('Failing Open') vulnerability in livebook-dev livebook allows an unauthenticated network client to obtain full access to a Livebook server that enforces identity through Livebook Teams.

A Livebook Agent or App Server connected to Livebook Teams caches the identifier of the deployment group it belongs to, and resolves that identifier against a locally cached list of deployment groups on every request in order to decide whether Teams identity enforcement is active. Livebook.Hubs.TeamClient.handle_call/3 in lib/livebook/hubs/team_client.ex does not distinguish a deployment group that could not be resolved from one that was resolved with identity enforcement switched off: the clause matches only the case where a group was found with enforcement enabled, and falls through to a catch-all that reports enforcement as switched off for everything else. The two neighbouring functions that decide user and application access resolve the same identifier and treat the same unresolved result as a denial.

When the identity status is reported as switched off, Livebook.ZTA.LivebookTeams.authenticate/3 in lib/livebook/zta/livebook_teams.ex returns empty identity metadata and allows the request to continue instead of halting it. LivebookWeb.UserPlug.build_current_user/3 merges that empty metadata into a newly built user, whose access type defaults to full access, and LivebookWeb.AuthPlug.authorized?/1 grants access to any user holding full access.

The cached identifier becomes unresolvable when the deployment group it refers to is deleted while the agent is not connected to receive the change, most concretely when a deployment group is deleted during the window in which an agent is disconnected or reconnecting. The client removes the group from its cached list without clearing the identifier that refers to it. Any client able to reach the affected server over the network is then granted the same access as a fully privileged member of the organisation, including the ability to read notebooks and configured secrets, execute code on the server's runtime, and disrupt its operation.

This issue affects livebook: from 0.19.7 before 0.19.9.

Weaknesses & attack patterns

Weakness

CWE-636 · Not Failing Securely ('Failing Open') in catalog → MITRE ↗

Attack patterns

CAPEC-115 · Authentication Bypass MITRE ↗

Affected — Hex / livebook Hex.pm ↗ Repository ↗

0.19.7 < 0.19.9 affected
every other version: unaffected
default status unaffected
cpe cpe:2.3:a:livebook-dev:livebook:*:*:*:*:*:*:*:*
modules · source files · routines
modules Elixir.Livebook.Hubs.TeamClient · Elixir.Livebook.ZTA.LivebookTeams · Elixir.LivebookWeb.AuthPlug
source files lib/livebook/hubs/team_client.ex · lib/livebook/zta/livebook_teams.ex · lib/livebook_web/plugs/auth_plug.ex
routines 'Elixir.Livebook.Hubs.TeamClient':handle_call/3 · 'Elixir.Livebook.Hubs.TeamClient':remove_deployment_group/2 · 'Elixir.Livebook.Hubs.TeamClient':fetch_entry/3 · 'Elixir.Livebook.ZTA.LivebookTeams':authenticate/3 · 'Elixir.LivebookWeb.AuthPlug':authorized?/1

Affected — ghcr.io / livebook-dev/livebook Container registry ↗

0.19 series 0.19.7 < 0.19.9 affected
0.19 series 0.19.7-cuda12 < 0.19.9-cuda12 affected
every other version: unaffected
default status unaffected
cpe cpe:2.3:a:livebook-dev:livebook:*:*:*:*:*:*:*:*
modules · source files · routines
modules Elixir.Livebook.Hubs.TeamClient · Elixir.Livebook.ZTA.LivebookTeams · Elixir.LivebookWeb.AuthPlug
source files lib/livebook/hubs/team_client.ex · lib/livebook/zta/livebook_teams.ex · lib/livebook_web/plugs/auth_plug.ex
routines 'Elixir.Livebook.Hubs.TeamClient':handle_call/3 · 'Elixir.Livebook.Hubs.TeamClient':remove_deployment_group/2 · 'Elixir.Livebook.Hubs.TeamClient':fetch_entry/3 · 'Elixir.Livebook.ZTA.LivebookTeams':authenticate/3 · 'Elixir.LivebookWeb.AuthPlug':authorized?/1

Affected — GitHub / livebook-dev/livebook Repository ↗

fc2c87c and up affected
d374e90 not affected
d6d0dfa not affected
2d3a2c7 not affected
every other version: unaffected
default status unaffected
cpe cpe:2.3:a:livebook-dev:livebook:*:*:*:*:*:*:*:*
modules · source files · routines
modules Elixir.Livebook.Hubs.TeamClient · Elixir.Livebook.ZTA.LivebookTeams · Elixir.LivebookWeb.AuthPlug
source files lib/livebook/hubs/team_client.ex · lib/livebook/zta/livebook_teams.ex · lib/livebook_web/plugs/auth_plug.ex
routines 'Elixir.Livebook.Hubs.TeamClient':handle_call/3 · 'Elixir.Livebook.Hubs.TeamClient':remove_deployment_group/2 · 'Elixir.Livebook.Hubs.TeamClient':fetch_entry/3 · 'Elixir.Livebook.ZTA.LivebookTeams':authenticate/3 · 'Elixir.LivebookWeb.AuthPlug':authorized?/1

Configurations

This vulnerability affects Livebook servers that enforce identity through Livebook Teams. Servers not connected to Livebook Teams, or connected without a deployment group, are not affected.

Livebook Teams has also been changed to reject deletion of a deployment group while agents belonging to it are connected, which removes the most direct route into the vulnerable state. A connected agent may still reach an unresolvable cached deployment group as a result of connection failures or network errors.

References

Credits

Nguyễn Công Tú Finder
Jonatan Kłosko Remediation developer
José Valim Remediation reviewer
Hugo Baraúna Remediation reviewer

CVSS breakdown

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