Skip to content
Tcl Source Code History Of Ticket 2f8bb4
Login

History Of Ticket 2f8bb4

Artifacts Associated With Ticket 2f8bb4

  1. Ticket change [5fdea9ff55] (rid 259544) by bef on 2026-10-20 18:16:26:

    1. assignee initialized to: "nobody"
    2. closer initialized to: "nobody"
    3. cmimetype initialized to: "text/x-markdown"
    4. comment initialized to:
      The locale path check added in msgcat 1.6.2 / 1.7.2 (regexp
      `{^[/\\]|^[a-z]+:|(?:^|[/\\])\.\.}`, from ticket 301613) does not reject a
      leading `~`. `[clock]` is aliased into safe interpreters and runs in the
      parent, and `msgcat::Load` does `file join $langdir $locale.msg` then
      `source`. On 8.6, `file join` tilde-expands, so a safe child can make the
      trusted parent `source` any `.msg` file reachable through `~`/`~user` — a full
      sandbox escape (arbitrary code in the parent). `mclocale` and clock's
      `-timezone` guard both reject such values; the `-locale` → `mcpackagelocale`
      path is weaker.
      
      PoC (Tcl 8.6 with msgcat 1.6.2):
      
      ```tcl
      file mkdir ~/tcldemo
      set fd [open ~/tcldemo/x.msg w]
      puts $fd {puts "PWNED issafe=[interp issafe] exec=[info commands exec]"}
      close $fd
      
      interp eval [interp create -safe] {clock format 0 -gmt 1 -locale ~/tcldemo/x}
      
      file delete ~/tcldemo/x.msg
      ```
      
      Output:
      
      ```
      PWNED issafe=0 exec=exec
      ```
      
      i.e. `x.msg` ran in the trusted parent (`issafe=0`, `exec` present), from a
      one-line call inside a safe child. 9.x is not escapable this way (there
      `file join` leaves a leading `~` literal), but it is still affected by the
      related bypass below.
      
      Fix: also reject a leading `~` (or reuse `mclocale`'s `$v eq [file tail $v]`
      test). A related gap on 9.x (msgcat 1.7.2): `mcpackagelocale preferences
      <locale>` sets the preference list straight from its args and calls `Load`
      without going through `getpreferences`, so the new regexp never runs and even
      an absolute path still loads — e.g. `mcpackagelocale preferences /abs/x` sources
      `/abs/x.msg` where `mcpackagelocale set /abs/x` is correctly rejected. (On 8.6
      `preferences` is read-only, so that route is 9.x-only.) Validating centrally in
      `msgcat::Load` would cover every route at once.
      
    5. foundin initialized to: "8.6.x"
    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: "30. msgcat Package"
    15. title initialized to:
      `clock -locale` escapes safe interp via `~` path (msgcat 1.6.2/1.7.2)
      
    16. type initialized to: "Bug"
  2. Ticket change [b4d592f930] (rid 259601) by jan.nijtmans on 2026-10-20 21:17:15:

    1. assignee changed to: "sebres"
    2. icomment:
      @sebres, this one is for you, since it's related to [a7fb3fdd6381c4f3|this] commit
      
    3. login: "jan.nijtmans"
    4. mimetype: "text/x-fossil-wiki"
  3. Ticket change [b14addeb2d] (rid 260082) by serhiy.storchaka on 2026-10-23 07:24:03:

    1. foundin changed to: "8.6.18, 9.0.5, 9.1.0"
    2. icomment:
      Confirmed. On main and 9.0, <tt>mcpackagelocale preferences</tt> loads its arguments without the locale check, so an absolute path is sourced; on 8.6 the leading <tt>~</tt> route works as described.
      
      Proposed fix in branch [/timeline?r=msgcat-unsafe-locale|msgcat-unsafe-locale] (for main and 9.0): one check for all routes, which also rejects a leading <tt>~</tt>, applied in <tt>getpreferences</tt>, to every argument of <tt>mcpackagelocale preferences</tt>, and in <tt>msgcat::Load</tt> before a catalog file is sourced, as suggested. Tests msgcat-12.13 to 12.15. 8.6 needs a separate change, since <tt>preferences</tt> is read-only there. The msgcat version is not bumped.
      
    3. login: "serhiy.storchaka"
    4. mimetype: "text/x-fossil-wiki"
  4. Ticket change [e2d6dedbd0] (rid 260083) by serhiy.storchaka on 2026-10-23 07:38:26:

    1. icomment:
      Proposed fix for 8.6 in branch [/timeline?r=msgcat-unsafe-locale-8-6|msgcat-unsafe-locale-8-6]: the same check, which rejects a leading <tt>~</tt>, in <tt>mclocale</tt>, <tt>mcpackagelocale set</tt> and <tt>msgcat::Load</tt>. Test msgcat-1.15 runs the example from this ticket in a safe interp, with <tt>HOME</tt> set to the temporary directory.
      
    2. login: "serhiy.storchaka"
    3. mimetype: "text/x-fossil-wiki"
  5. Ticket change [594bcbb902] (rid 260764) by jan.nijtmans on 2026-10-29 08:25:43:

    1. assignee changed to: "jan.nijtmans"
    2. closedate changed to: "2461342.8511985764"
    3. closer changed to: "jan.nijtmans"
    4. icomment:
      Fixed in [85a543ddd208f448|trunk], core-9-0-branch and 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"
  6. Ticket change [3c9b67c59d] (rid 260765) by jan.nijtmans on 2026-10-29 08:28:52:

    1. closedate changed to: "2461342.8533814121"
    2. icomment:
      > The msgcat version is not bumped
      
      There's no need to bump the msgcat version, because msgcat 1.6.2/1.7.2 were never released in a public Tcl release.
      
    3. login: "jan.nijtmans"
    4. mimetype: "text/x-fossil-wiki"