Kestrel
대시보드로 돌아가기
CVE-2026-48790MEDIUM· 5.5GHSA대응게시일: 2026. 06. 26.수정일: 2026. 06. 26.

turso-cli persists Turso platform JWT with world-readable (0o644) file permissions

위협 신호 · CVSS · EPSS · KEV

정기 패치· 높은 악용 신호 없음
CVSS
5.5medium

이론적 심각도 점수

EPSS

예측 데이터 없음

KEV
미등재

실측 악용 기록 없음

권장 대응 기한차기 업그레이드 시CISA SSVC 기준

별도 긴급 패치 불필요 — 정기 시스템 업그레이드 주기에 맞춰 조치

· KEV 미등재 · 자동화 어려움 · 부분 영향 · 내부 한정

CVSS 벡터 · 메트릭

악용 경로
공격 벡터로컬
공격 복잡도낮음
필요 권한낮음
사용자 상호작용불필요
범위불변
영향
기밀성 영향높음
무결성 영향없음
가용성 영향없음
버전별 점수
CVSS 3.15.5MODERATE
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N

상세 설명

Summary

turso-cli persists the user's Turso platform JWT to settings.json using Viper's default configPermissions of 0o644, leaving the credential file world-readable on standard Linux and macOS systems. Any other local UID on the host can read the file and recover the platform JWT, which grants full Turso platform access scoped to the user's organizations.

Impact

The token in settings.json grants the holder full Turso platform access — create or destroy databases, rotate credentials, exfiltrate data, change billing settings — for any organization the user belongs to.

Because the file is world-readable, the credential is reachable by:

  • Cron jobs or daemons running as a different system user on the same host
  • Sandboxed CI runners with a mounted home directory
  • Containers with a bind-mounted host home
  • Co-tenants on a shared multi-user developer or jumpbox host

The file path resolves through configdir.LocalConfig("turso"):

  • macOS: ~/Library/Application Support/turso/settings.json
  • Linux: ~/.config/turso/settings.json (or $XDG_CONFIG_HOME/turso/settings.json)

It contains the platform JWT in plaintext JSON alongside organization and username fields.

Comparable CLIs (gh, aws, docker, gcloud, plus close peers planetscale, neon, upstash) write credential files at 0o600 explicitly, so this is a deviation from the cross-vendor baseline rather than a deliberate trade-off.

Details

The OAuth callback handler stores the platform JWT via the settings layer:

text
1// internal/cmd/auth.go:205-214
2jwt, err := callbackServer.Result()
3...
4settings.SetToken(jwt)

SetToken writes through Viper:

text
1// internal/settings/settings.go:124-127
2func (s *Settings) SetToken(token string) {
3 viper.Set("token", token)
4 s.changed = true
5}

Persistence runs through viper.WriteConfig:

text
1// internal/settings/settings.go:96-101
2func TryToPersistChanges() error {
3 if err := viper.WriteConfig(); err != nil {
4 return fmt.Errorf("failed to persist turso settings file: %w", err)
5 }
6 return nil
7}

Viper v1.21.0 (pinned in turso-cli go.mod) initializes configPermissions to os.FileMode(0o644) at viper.go:198 and passes that mode straight to os.OpenFile at viper.go:1688. Without a call to viper.SetConfigPermissions(0o600), the resulting settings.json is created at 0o644.

A grep over the auth-config write path under internal/ returns zero hits for Chmod, 0o600, or 0600, confirming there is no follow-up tightening of the file mode anywhere on the persistence path.

Proof of concept

Minimal reproducer using the same Viper version turso-cli pins (github.com/spf13/viper v1.21.0):

text
1package main
2
3import (
4 "fmt"
5 "os"
6 "path/filepath"
7
8 "github.com/spf13/viper"
9)
10
11func main() {
12 dir, _ := os.MkdirTemp("", "viperpoc-*")
13 defer os.RemoveAll(dir)
14
15 viper.SetConfigName("settings")
16 viper.SetConfigType("json")
17 viper.AddConfigPath(dir)
18
19 viper.Set("token", "FAKE_TURSO_JWT_xxxxxxxxxxxxxxxxxxxx")
20 viper.Set("organization", "exampleorg")
21 viper.SafeWriteConfig()
22
23 st, _ := os.Stat(filepath.Join(dir, "settings.json"))
24 fmt.Printf("mode: %o\n", st.Mode()&0o777)
25}

$ go run main.go mode: 644

The same SafeWriteConfig / WriteConfig calls turso-cli uses produce the same 0o644 mode in a real turso auth login flow.

Remediation

One-line fix at the existing Viper configuration site in internal/settings/settings.go (around lines 48-50):

text
1viper.SetConfigName("settings")
2viper.SetConfigType("json")
3viper.AddConfigPath(configPath)
4viper.SetConfigPermissions(0o600) // restrict settings.json to owner only

Defense in depth:

  • Add os.Chmod(configFile, 0o600) after TryToPersistChanges, or on read (as PlanetScale does in internal/config/config.go — they Stat the token file and self-heal if Mode() &^ 0o600 is nonzero). viper.SetConfigPermissions applies only on file creation, so an existing wider-mode file is not tightened otherwise.
  • Add os.Chmod(configPath, 0o700) after configdir.MakePath(configPath) (line 43) to close the equivalent gap on the enclosing directory, which is otherwise created under the default umask.

Patch: https://github.com/tursodatabase/turso-cli/commit/ffb914849216ef5a86353b3fa6cee66f33af3b66

Workarounds

Until upgraded, users can tighten the existing files manually:

bash
1# Linux
2chmod 600 ~/.config/turso/settings.json
3chmod 700 ~/.config/turso
4
5# macOS
6chmod 600 "$HOME/Library/Application Support/turso/settings.json"
7chmod 700 "$HOME/Library/Application Support/turso"

This must be repeated after any operation that recreates the file (e.g.
turso auth login) until the patched version is installed.

Resources

AI 심층 분석

공격 시나리오 · 재현 가능한 PoC 페이로드 · 즉시 적용 가능한 차단 패치를 한 번에 받아 보세요. 보안 운영팀이 그대로 점검·티켓팅에 쓸 수 있는 형태로 정리해 드립니다.