Files
ARTEX/server
BaaRai 4fa45eb449 security(agent): ask_operator staging refuses symlinks and never overwrites
The staged copy of an ask_operator image was written by the server with
os.Create under a name built from the second, in an uploads directory made
with MkdirAll. An agent that can write in uploads/ (a task directory from
before the run-directory layout) could prepare that name as a symlink, and a
symlinked uploads/ was followed.

- uploads/ is created with Mkdir and checked with Lstat: a symlink or a
  file in its place is refused.
- The name is ask-operator-<unixnano>-<8 random hex>.<ext>, created with
  O_CREATE|O_EXCL, mode 0640. A taken name is never opened: another name is
  tried, five at most.
- The source is opened only when it is still the regular file Lstat saw
  (os.SameFile on the Lstat and the Stat of the open file), which refuses a
  file swapped for a symlink between the EvalSymlinks check and the open.
  The run-directory confinement is unchanged.

Not closed: a directory inside the run directory swapped for a symlink
between the check and the open still leads both Lstat and the open to the
same file elsewhere.
2026-11-20 05:35:56 +01:00
..
2026-07-26 04:27:45 -04:00
2026-07-26 04:27:45 -04:00
2026-08-24 14:14:15 +08:00
2026-10-23 18:12:38 -03:00
2026-08-25 12:05:26 +08:00
2026-08-25 12:05:26 +08:00