File Browser’s insecure JWT handling can lead to session replay attacks after logout

描述

Summary

File Browser’s authentication system issues long-lived JWT tokens that remain valid even after the user logs out. Please refer to the CWE's listed in this report for further reference and system standards. In summary, the main issue is:

  • Tokens remain valid after logout (session replay attacks)

In this report, I used docker as the documentation instruct:

docker run \
    -v filebrowser_data:/srv \
    -v filebrowser_database:/database \
    -v filebrowser_config:/config \
    -p 8080:80 \
    filebrowser/filebrowser

Details

Issue: Tokens remain valid after logout (session replay attacks)

After logging in and receiving a JWT token, the user can explicitly "log out." However, this action does not invalidate the issued JWT. Any captured token can be replayed post-logout until it expires naturally. The backend does not track active sessions or invalidate existing tokens on logout. Login request:

POST /api/login HTTP/1.1
Host: machine.local:8090
Content-Length: 69

{"username":"admin","password":"password-here","recaptcha":""}

The check found in the code https://github.com/filebrowser/filebrowser/blob/master/http/auth.go is not enough. There is no server-side blacklist or token invalidation on logout. Token renewal and validity only depends on expiry and user store timestamps:

expired := !tk.VerifyExpiresAt(time.Now().Add(time.Hour), true)
updated := tk.IssuedAt != nil && tk.IssuedAt.Unix() < d.store.Users.LastUpdate(tk.User.ID)

PoC

Issue: Tokens remain valid after logout (session replay attacks)

  • Login and capture the generate JWT. Eg. the http request:
POST /api/login HTTP/1.1
Host: machine.local:8090
Content-Length: 69

{"username":"admin","password":"password-here","recaptcha":""}
  • Logout in the dashboard. And then try to use the old generated JWT to access any authenticated endpoint eg:
GET /api/resources HTTP/1.1
Host: machine.local:8090
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36
X-Auth: Old-JWT-token-here
Content-Length: 173
Accept: */*
Referer: http://machine.local:8090/files/
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.9
Content-Length: 26

Connection: keep-alive

Impact

  • A valid JWT remains active after user logout.
  • If stolen, tokens persist access indefinitely until expiry.
  • Violates OWASP Top 10 A2:2021 - Broken Authentication.

Recommendations

  • Read all CWE's attached in this report
  • Invalidate JWTs on logout via session store / token blacklist.
  • Reduce JWT ExpiresAt where possible or use short-lived + refresh tokens.

基本資訊

類型
reviewed
嚴重度
high
GitHub 上的公告
開啟公告 ↗
儲存庫公告
開啟儲存庫公告 ↗
原始碼
瀏覽原始碼 ↗
公開(公告)
2025-07-16 14:09:28 UTC
更新時間
2025-07-29 23:17:57 UTC
GitHub 審核
2025-07-16 14:09:28 UTC
NVD 公開
2025-07-15 18:15:24 UTC

EPSS Score

Score Percentile
0.31% 53.91%

CVSS Scores

Base score Version Severity Vector
7.7 4.0
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:H/VA:N/SC:N/SI:N/SA:N/E:P 點擊展開
攻擊向量 (AV:N)
可經網際網路或企業可路由網段遠端觸達,攻擊者不必在裝置旁邊。
攻擊複雜度 (AC:L)
步驟短、路徑清楚,重現成本低。
攻擊要件 (AT:N)
除網路可達外,不必額外湊齊罕見基礎設施或資料形態。
權限需求 (PR:N)
匿名或一般工作階段即可起步,不必事先提權。
使用者互動 (UI:N)
不必受害者點連結、放行巨集或安裝軟體,攻擊鏈可自動走完。
受影響系統的機密性影響 (VC:N)
從被攻破的元件幾乎讀不走有價值的機密資料。
受影響系統的完整性影響 (VI:H)
可竄改稽核鏈、植入後門或大面積偽造業務資料,動搖信任根基。
受影響系統的可用性影響 (VA:N)
不至於出現業務意義上的長時間停擺或災難性效能崩塌。
後續系統的機密性影響 (SC:N)
經脆弱點波及下游後,幾乎讀不走有價值的機密資料。
後續系統的完整性影響 (SI:N)
下游紀錄與業務規則幾乎不被撼動。
後續系統的可用性影響 (SA:N)
下游不至於被拖到長時間癱瘓。
利用成熟度(Threat) (E:P)
PoC、指令稿或示範已公開,但未見成規模的實戰濫用與工具化。

Identifiers

CWEs

CWE id Name
CWE-305 Authentication Bypass by Primary Weakness
CWE-384 Session Fixation
CWE-613 Insufficient Session Expiration

Credits

  • maen08 (reporter)
  • hacdias (analyst)

Affected packages (2)

Vulnerable version ranges and first patched releases as published by GitHub.

Ecosystem Package Vulnerable range First patched Vulnerable functions
go github.com/filebrowser/filebrowser <= 2.39.0
go github.com/filebrowser/filebrowser/v2 <= 2.39.0

References

cvelogic Threat Intelligence