Am I affected?

type your livebook version to check

Description

Cross-Site Request Forgery (CSRF) vulnerability in livebook-dev livebook allows an attacker to authenticate a victim's browser session under the attacker's own Livebook Teams identity.

When Livebook is configured to use Livebook Teams for identity, Livebook.ZTA.LivebookTeams.handle_request/4 in lib/livebook/zta/livebook_teams.ex handles the OAuth-style callback carrying a teams_identity marker and a code parameter. The clause exchanges that code for an access token and writes the token into the browser session without verifying any value that ties the callback to the browser session that started the login. No state or nonce is generated when the flow is initiated: Livebook.Teams.Requests.create_auth_request/1 in lib/livebook/teams/requests.ex sends an empty request body, so no per-attempt value is ever registered, and the callback clause has nothing to compare against.

An attacker who holds membership in the same Livebook Teams organisation as the target instance can therefore begin the login flow themselves, retain the resulting authorization code without redeeming it, and induce a victim to open a crafted URL carrying that code. The victim's browser completes the exchange and the resulting session is bound to the attacker's identity rather than the victim's. The victim is not required to hold any particular privilege, and no credential belonging to the victim is involved. The vulnerability does not allow the attacker to authenticate as the victim.

The consequence is that a user believes they are working in their own authenticated session while they are in fact operating as another identity. Work performed in that session is attributed to the attacker's account, and secrets, uploaded data, or notebook results the victim produces are exposed to the attacker rather than kept in the victim's own account. The authorization code must be redeemed within a short window after the login flow begins, which constrains the timing of the attack but not its feasibility.

This issue affects livebook: from 0.15.0 before 0.18.7 and from 0.19.0 before 0.19.9.

Weaknesses & attack patterns

Weakness

CWE-352 · Cross-Site Request Forgery (CSRF) in catalog → MITRE ↗

Attack patterns

CAPEC-62 · Cross Site Request Forgery MITRE ↗

Affected — Hex / livebook Hex.pm ↗ Repository ↗

0.15.0 < 0.18.7 affected
0.19 series 0.19.0 < 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.ZTA.LivebookTeams · Elixir.Livebook.Teams.Requests
source files lib/livebook/zta/livebook_teams.ex · lib/livebook/teams/requests.ex
routines 'Elixir.Livebook.ZTA.LivebookTeams':handle_request/4 · 'Elixir.Livebook.Teams.Requests':create_auth_request/1

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

0.15.0 < 0.18.7 affected
0.19 series 0.19.0 < 0.19.9 affected
0.15.0-cuda12 < 0.18.7-cuda12 affected
0.19 series 0.19.0-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.ZTA.LivebookTeams · Elixir.Livebook.Teams.Requests
source files lib/livebook/zta/livebook_teams.ex · lib/livebook/teams/requests.ex
routines 'Elixir.Livebook.ZTA.LivebookTeams':handle_request/4 · 'Elixir.Livebook.Teams.Requests':create_auth_request/1

Affected — GitHub / livebook-dev/livebook Repository ↗

4380a41 and up affected
21c1616 not affected
33a052d not affected
6ed2e21 not affected
every other version: unaffected
default status unaffected
cpe cpe:2.3:a:livebook-dev:livebook:*:*:*:*:*:*:*:*
modules · source files · routines
modules Elixir.Livebook.ZTA.LivebookTeams · Elixir.Livebook.Teams.Requests
source files lib/livebook/zta/livebook_teams.ex · lib/livebook/teams/requests.ex
routines 'Elixir.Livebook.ZTA.LivebookTeams':handle_request/4 · 'Elixir.Livebook.Teams.Requests':create_auth_request/1

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:N/PR:L/UI:A/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N
« All CVEs