SEC: openLink 无 URL scheme 白名单(候选) #12

Closed
opened 2026-11-09 14:24:05 +00:00 by layue13 · 1 comment
Owner

调研编号:扫描 2026-11-09 / G4(存疑)

现象

FXUtils.openLink / DesktopUtils.openLink 把任意字符串交给系统 URL 处理器(Windows FileProtocolHandler / macOS open / Linux 浏览器),未见 scheme 白名单。Authlib 账号页等会把远端 links 点进该路径。file: 等其它 scheme 在各 OS 的实际危害需实测。

危害类与优先级

  • 危害类:SEC
  • 优先级:p3

证据(生效源码)

  • 载体:TDLM/HMCL + 分支 origin/main + pin/commit bdacd654734c3665995a8c779da34139b9bdf373
  • 位置:HMCL/.../FXUtils.java:600-618;HMCLBoot/.../DesktopUtils.java:44-60
  • 关键原文:
// FXUtils.java:600-618
public static void openLink(String link) {
    if (link == null)
        return;

    String url = NetworkUtils.encodeLocation(link);
    thread(() -> {
        try {
            if (OperatingSystem.CURRENT_OS == OperatingSystem.WINDOWS) {
                Runtime.getRuntime().exec(new String[]{"rundll32.exe", "url.dll,FileProtocolHandler", url});
                return;
            } else if (OperatingSystem.CURRENT_OS == OperatingSystem.MACOS) {
                Runtime.getRuntime().exec(new String[]{"open", url});
                return;
            } else {
                for (String browser : linuxBrowsers) {
                    Path path = SystemUtils.which(browser);
                    if (path != null) {
                        try {
                            Runtime.getRuntime().exec(new String[]{path.toString(), url});
                            return;
  • 上游状态:未修

触发与复现

  • 触发条件:用户点击来自远端元数据的链接;以用户点击为主。
  • 复现程度:未验证(仅形状相同——此时本 issue 是候选,别派单)
  • 包内相关性:模块 n/a/sides client/默认配置可达 否(需点击)

落点

  • 主仓:TDLM/HMCL → HMCL/.../FXUtils.java:600

范式

引证

  1. 生效源码 permalink — https://git.potatolab.uk/TDLM/HMCL/src/commit/bdacd654734c3665995a8c779da34139b9bdf373/HMCL/src/main/java/org/jackhuang/hmcl/ui/FXUtils.java#L600-L618
  2. 生效源码 permalink — https://git.potatolab.uk/TDLM/HMCL/src/commit/bdacd654734c3665995a8c779da34139b9bdf373/HMCLBoot/src/main/java/org/jackhuang/hmcl/DesktopUtils.java#L44-L60
  3. 范式 G4 — https://git.potatolab.uk/TDLM/mc-defect-patterns/raw/commit/12d2ebdc7a87175f936c2a67083be567e0e94301/sec/G4-信任边界.md

来源

  • 线索类型:内部代码审查(无外部报障)
  • 可解析指针:FXUtils.java:600-618;commit bdacd654734c3665995a8c779da34139b9bdf373
  • 来源标签:origin/scan
**调研编号**:扫描 2026-11-09 / G4(存疑) ## 现象 `FXUtils.openLink` / `DesktopUtils.openLink` 把任意字符串交给系统 URL 处理器(Windows `FileProtocolHandler` / macOS `open` / Linux 浏览器),未见 scheme 白名单。Authlib 账号页等会把远端 `links` 点进该路径。`file:` 等其它 scheme 在各 OS 的实际危害需实测。 ## 危害类与优先级 - 危害类:`SEC` - 优先级:`p3` ## 证据(生效源码) - 载体:`TDLM/HMCL` + 分支 `origin/main` + pin/commit `bdacd654734c3665995a8c779da34139b9bdf373` - 位置:`HMCL/.../FXUtils.java:600-618`;`HMCLBoot/.../DesktopUtils.java:44-60` - 关键原文: ```java // FXUtils.java:600-618 public static void openLink(String link) { if (link == null) return; String url = NetworkUtils.encodeLocation(link); thread(() -> { try { if (OperatingSystem.CURRENT_OS == OperatingSystem.WINDOWS) { Runtime.getRuntime().exec(new String[]{"rundll32.exe", "url.dll,FileProtocolHandler", url}); return; } else if (OperatingSystem.CURRENT_OS == OperatingSystem.MACOS) { Runtime.getRuntime().exec(new String[]{"open", url}); return; } else { for (String browser : linuxBrowsers) { Path path = SystemUtils.which(browser); if (path != null) { try { Runtime.getRuntime().exec(new String[]{path.toString(), url}); return; ``` - 上游状态:未修 ## 触发与复现 - 触发条件:用户点击来自远端元数据的链接;以用户点击为主。 - 复现程度:未验证(仅形状相同——此时本 issue 是候选,别派单) - 包内相关性:模块 n/a/sides `client`/默认配置可达 否(需点击) ## 落点 - 主仓:`TDLM/HMCL` → `HMCL/.../FXUtils.java:600` ## 范式 - 命中范式:G4 信任边界(https://git.potatolab.uk/TDLM/mc-defect-patterns/raw/commit/12d2ebdc7a87175f936c2a67083be567e0e94301/sec/G4-信任边界.md)——候选 ## 引证 1. 生效源码 permalink — https://git.potatolab.uk/TDLM/HMCL/src/commit/bdacd654734c3665995a8c779da34139b9bdf373/HMCL/src/main/java/org/jackhuang/hmcl/ui/FXUtils.java#L600-L618 2. 生效源码 permalink — https://git.potatolab.uk/TDLM/HMCL/src/commit/bdacd654734c3665995a8c779da34139b9bdf373/HMCLBoot/src/main/java/org/jackhuang/hmcl/DesktopUtils.java#L44-L60 3. 范式 G4 — https://git.potatolab.uk/TDLM/mc-defect-patterns/raw/commit/12d2ebdc7a87175f936c2a67083be567e0e94301/sec/G4-信任边界.md ## 来源 - 线索类型:内部代码审查(无外部报障) - 可解析指针:`FXUtils.java:600-618`;commit `bdacd654734c3665995a8c779da34139b9bdf373` - 来源标签:`origin/scan`
layue13 added the
priority
p3
area/security
type
security
origin/scan
labels 2026-11-09 14:24:05 +00:00
Author
Owner

Fixed on main via PR #14 — openLink / DesktopUtils allow only http/https/mailto schemes.

Merge: #14
Commit: c4240a24bf

Fixed on `main` via PR #14 — `openLink` / DesktopUtils allow only `http`/`https`/`mailto` schemes. Merge: https://git.nest.potatolab.uk:8443/TDLM/HMCL/pulls/14 Commit: c4240a24bf7635a26d6e45721c77b33d94bcb252
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: TDLM/HMCL#12