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

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