Artifacts Associated With Ticket 2f8bb48009
Ticket change [5fdea9ff55] (rid 259544) by bef on 2026-10-20 18:16:26:
- assignee initialized to: "nobody"
- closer initialized to: "nobody"
- cmimetype initialized to: "text/x-markdown"
- 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. - foundin initialized to: "8.6.x"
- is_private initialized to: "0"
- login: "bef"
- priority initialized to: "5 Medium"
- private_contact initialized to: "37918056d323dc69a2f76cecc85476189094f3b8"
- resolution initialized to: "None"
- severity initialized to: "Severe"
- status initialized to: "Open"
- submitter initialized to: "bef"
- subsystem initialized to: "30. msgcat Package"
- title initialized to:
`clock -locale` escapes safe interp via `~` path (msgcat 1.6.2/1.7.2)
- type initialized to: "Bug"
Ticket change [b4d592f930] (rid 259601) by jan.nijtmans on 2026-10-20 21:17:15:
- assignee changed to: "sebres"
- icomment:
@sebres, this one is for you, since it's related to [a7fb3fdd6381c4f3|this] commit
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
Ticket change [b14addeb2d] (rid 260082) by serhiy.storchaka on 2026-10-23 07:24:03:
- foundin changed to: "8.6.18, 9.0.5, 9.1.0"
- 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.
- login: "serhiy.storchaka"
- mimetype: "text/x-fossil-wiki"
Ticket change [e2d6dedbd0] (rid 260083) by serhiy.storchaka on 2026-10-23 07:38:26:
- 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.
- login: "serhiy.storchaka"
- mimetype: "text/x-fossil-wiki"
- icomment:
Ticket change [594bcbb902] (rid 260764) by jan.nijtmans on 2026-10-29 08:25:43:
- assignee changed to: "jan.nijtmans"
- closedate changed to: "2461342.8511985764"
- closer changed to: "jan.nijtmans"
- icomment:
Fixed in [85a543ddd208f448|trunk], core-9-0-branch and core-8-6-branch Many thanks!
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
- resolution changed to: "Fixed"
- status changed to: "Closed"
Ticket change [3c9b67c59d] (rid 260765) by jan.nijtmans on 2026-10-29 08:28:52:
- closedate changed to: "2461342.8533814121"
- 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.
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"