Skip to content
Tcl Source Code History Of Ticket 3d978e0a84
Login

History Of Ticket 3d978e0a84

Artifacts Associated With Ticket 3d978e0a84

  1. Ticket change [0e8fecddd5] (rid 261093) by bef on 2026-11-03 11:05:41:

    1. assignee initialized to: "nobody"
    2. closer initialized to: "nobody"
    3. cmimetype initialized to: "text/x-markdown"
    4. comment initialized to:
      Follow-up to [2f8bb48009](https://core.tcl-lang.org/tcl/tktview/2f8bb48009). That fix added `~` to msgcat's locale check, but
      clock's own guard in `LoadTimeZoneFile` (and `LoadZoneinfoFile`) still uses
      `{^[/\\]|^[a-zA-Z]+:|(?:^|[/\\])\.\.}`, which does not reject a leading `~`.
      `[clock]` is aliased into safe interpreters and runs in the parent; on 8.6,
      `file join $DataDir ~/x` returns `~/x` and `source` expands it. So a safe
      child can make the parent `source` any file below a home directory. No
      `.msg` suffix is appended and the name is not lowercased.
      
      PoC (Tcl 8.6.18, core-8-6-branch head 52a3c1d31a):
      
      ```tcl
      file mkdir ~/tcldemo
      set fd [open ~/tcldemo/tz w]
      puts $fd {puts "PWNED issafe=[interp issafe] ns=[namespace current] exec=[info commands exec]"}
      close $fd
      
      catch {interp eval [interp create -safe] {clock format 0 -timezone :~/tcldemo/tz}}
      
      file delete ~/tcldemo/tz
      ```
      
      Output:
      
      ```
      PWNED issafe=0 ns=::tcl::clock exec=exec
      ```
      
      `-timezone ~/tcldemo/tz` (without colon), `-t`, and `clock scan` / `clock add`
      reach the same code. 9.0 and 9.1 are not affected (`file join` leaves `~`
      literal there).
      
      This is a regression from [67e7522bd1](https://core.tcl-lang.org/tcl/info/67e7522bd1) (fix for
      [2c237beffbace823](https://core.tcl-lang.org/tcl/tktview/2c237beffbace823), `Etc/GMT±n`), first
      released in 8.6.16. Before that, the guard was the
      allowlist `^[[.-.][:alpha:]_]+(?:/[[.-.][:alpha:]_]+)*$`, which rejected `~`.
      The `clock-1.5.1-*` tests cover `..`, `//`, `zipfs:` and `C:`, but not `~`.
      
      Fix: add `~` to both guards (`{^[/\\~]|^[a-zA-Z]+:|(?:^|[/\\])\.\.}`), or
      return to an allowlist that also admits digits and `+`, e.g.
      `^[A-Za-z0-9_+-]+(?:/[A-Za-z0-9_+-]+)*$`. Sharing one helper with
      `msgcat::UnsafeLocale` would keep the two checks from drifting apart again.
      A safe-interp test along the lines of msgcat-1.15 (HOME set to a temp dir)
      would cover it.
      
    5. foundin initialized to:
      8.6.16, 8.6.17, 8.6.18 (core-8-6-branch as of 2026-11-03)
      
    6. is_private initialized to: "0"
    7. login: "bef"
    8. priority initialized to: "5 Medium"
    9. private_contact initialized to: "37918056d323dc69a2f76cecc85476189094f3b8"
    10. resolution initialized to: "None"
    11. severity initialized to: "Severe"
    12. status initialized to: "Open"
    13. submitter initialized to: "bef"
    14. subsystem initialized to: "16. Commands A-H"
    15. title initialized to:
      `clock -timezone` escapes safe interp via `~` path (8.6.16+, same gap as [2f8bb48009])
      
    16. type initialized to: "Bug"
  2. Ticket change [0ee44b0692] (rid 261097) by serhiy.storchaka on 2026-11-03 14:21:30:

    1. icomment:
      Reproduced on core-8-6-branch and 8.6.16, not on 8.6.15.
      
      Proposed fix in branch [/timeline?r=clock-unsafe-timezone-8-6|clock-unsafe-timezone-8-6]: both guards also reject a leading "~". Only a leading "~" matters: on 8.6 a "~" later in the path stays inside the data directory.
      
      9.0 and later are not affected, since "~" is not expanded there, although adding "~" to the guards there would be harmless.
      
    2. login: "serhiy.storchaka"
    3. mimetype: "text/x-fossil-wiki"
  3. Ticket change [0adf0466a5] (rid 261100) by jan.nijtmans on 2026-11-03 15:58:43:

    1. assignee changed to: "jan.nijtmans"
    2. closedate changed to: "2461348.1657848842"
    3. closer changed to: "jan.nijtmans"
    4. icomment:
      Fixed in [ee4f07c809|core-8-6-branch]
      
      Many thanks!
      
    5. login: "jan.nijtmans"
    6. mimetype: "text/x-fossil-wiki"
    7. resolution changed to: "Fixed"
    8. status changed to: "Closed"
  4. Ticket change [b4693c4f5c] (rid 261105) by bef on 2026-11-04 08:59:45:

    1. closedate changed to: "2461348.8748320369"
    2. closer changed to: "bef"
    3. icomment:
      Advisory write-up as I consider safe interp escape to be a security issue: [https://sektioneins.de/en/advisories/advisory-012026-tcl-clock-safe-interp-escape.html](https://sektioneins.de/en/advisories/advisory-012026-tcl-clock-safe-interp-escape.html)
      
    4. login: "bef"
    5. mimetype: "text/x-markdown"