🇰🇷 한글 설명
Livebook의 임포트 경로가 .livemd 노트북의 file_entries 메타데이터에 있는 파일명을 검증 없이 받아들여, URL 타입 파일 엔트리를 캐시할 때 경로 순회(../)를 통해 임의 경로에 공격자가 지정한 내용의 파일을 쓸 수 있는 취약점입니다. 피해자가 악성 노트북을 열고 해당 엔트리를 가져오게 하면 피해자의 인증된 세션 권한으로 파일이 작성됩니다.
💡 쉬운 설명
악성 노트북 파일을 열고 특정 항목을 불러오면, 공격자가 정한 위치에 공격자가 정한 내용의 파일이 저장될 수 있습니다. 이 과정에서 사용자의 별도 계정 없이도 공격이 이루어질 수 있습니다.
🇺🇸 원문 (English)
Relative Path Traversal vulnerability in livebook-dev livebook allows an attacker-authored notebook to write a file with attacker-controlled content to an arbitrary path.
A .livemd notebook can declare file_entries metadata, each entry carrying a name. Every path that creates a file entry through the user interface validates that name with Livebook.Notebook.validate_file_entry_name/2, which requires a flat filename of alphanumerics, dashes, underscores and dots, ending in an extension. The import path does not: Livebook.LiveMarkdown.Import.file_entry_metadata_to_attrs/1 in lib/livebook/live_markdown/import.ex takes the name verbatim from the notebook source.
For a URL-type file entry, Livebook.Session.file_entry_cache_file/2 in lib/livebook/session.ex resolves that name beneath the session's temporary directory without checking that the result stays inside it, and Livebook.FileSystem.Utils.resolve_unix_like_path/2 collapses parent-directory segments while clamping only at the filesystem root. When the entry's content is requested and no cached copy exists, Livebook fetches the entry's URL and writes the response body to the resolved path, creating parent directories as needed. The attacker therefore controls both the destination and the contents of the written file, which may land anywhere the Livebook process can write. The same missing containment check is present in Livebook.Session.to_attachment_file_entry/2.
A victim who opens an attacker-supplied notebook and causes the entry to be fetched triggers the write within their own authenticated session; the attacker needs no account on the target instance. URL-type entries are also not placed under notebook stamping quarantine on import, so no warning is shown.
This issue affects livebook: from 0.11.0 before 0.18.7 and from 0.19.0 before 0.19.9.
📍 영향받는 시스템
Livebook 0.11.0 이상 0.18.7 미만, 0.19.0 이상 0.19.9 미만
⚔️ 공격 벡터
공격자가 파일명에 ../ 경로 순회 문자를 넣은 .livemd 노트북을 만들어 피해자가 열고 엔트리를 가져오도록 유도
🛡️ 대응 방법
Livebook을 0.18.7 이상 또는 0.19.9 이상으로 업그레이드하고, 신뢰할 수 없는 노트북은 열지 않습니다.
🔧 검증 코드
출력된 버전이 0.11.0 이상 0.18.7 미만 또는 0.19.0 이상 0.19.9 미만이면 취약하며, 그 외 버전이거나 Livebook이 설치되지 않았다면 영향을 받지 않습니다.
mix deps.get >/dev/null 2>&1; elixir -e 'IO.puts(Application.spec(:livebook, :vsn))' 2>/dev/null || (livebook --version 2>/dev/null || docker ps --format '{{.Image}}' | grep -i livebook)