Security fixes for v2026.11.18 #77

Merged
jcoffey-dev merged 4 commits from sec/batch-6-2026 into release/2026 2026-11-18 01:13:50 +00:00
Owner

Security fixes for v2026.11.18: INSTALLER-1 (install and move parts), -3, -4 and -5 from the v27.1-rc.15 set, backported to release/2026 (no relay or cluster join here). Each test was shown failing on this branch first.

  • Host server: root steps no longer follow links in the server's own directory. (advisory)
  • Install: no fixed names in /tmp. (advisory)
  • Host server: setup credentials go only to the server's own listener. (advisory)
  • Install: Caddy pinned by digest.

Tests: gofmt, go vet (amd64, arm64), go test and govulncheck pass locally with Go 1.26.11.

Security fixes for v2026.11.18: INSTALLER-1 (install and move parts), -3, -4 and -5 from the v27.1-rc.15 set, backported to release/2026 (no relay or cluster join here). Each test was shown failing on this branch first. - Host server: root steps no longer follow links in the server's own directory. (advisory) - Install: no fixed names in /tmp. (advisory) - Host server: setup credentials go only to the server's own listener. (advisory) - Install: Caddy pinned by digest. Tests: gofmt, go vet (amd64, arm64), go test and govulncheck pass locally with Go 1.26.11.
jcoffey-dev added 4 commits 2026-11-18 01:12:30 +00:00
The server's home (<dir>/server) belongs to its user, and the server
runs as that user with write access there. Install and move then worked
on paths inside it as root in ways that follow symbolic links. Code
running as the server's user (a compromised server, for example) could
put a link at data/ or config.json, and the next install, converge or
move would chown the link's target to that user, write over it, or copy
a root-only file into an inbuxa-owned rollback copy: the server's user
became root.

Now install refuses a data/ that is not a plain directory and changes
ownership with chown -h and no trailing slash. A move reads config.json
without following a link and replaces it by a rename, and refuses a
data/ that is a link before emptying it.

Backport to the 2026 line. The cluster join part of the original change
is left out: the 2026 line has no cluster join.

Test: TestServerDirsRefusesALinkedDataDir and TestRewriteDataPathRefusesALink
failed before (the link was chowned or written through) and now pass.

(cherry picked from commit 82771a7ed7)
First boot wrote its two compose overrides to /tmp/inbuxa-bootstrap.yaml
and /tmp/inbuxa-basic-auth.yaml, and a host webmail install downloaded
Node to /tmp/inbuxa-node.tar.xz(.part), all opened by root with no
O_EXCL and following links. A local user could create those names
first: with fs.protected_regular off, root then wrote into the user's
own file, which the user could rewrite before docker compose read it
(an override that mounts / into the server) or before tar unpacked it
as root (after the checksum had passed), or a link made root overwrite
another file. With the sysctl on, it made the install fail. The Node
tarball was also never removed.

Each override now goes in a new directory from os.MkdirTemp (0700),
created with O_EXCL and removed with its directory when the step ends.
Node is downloaded the same way and removed once unpacked. A download's
.part file is always created new: anything already at the name is
removed first, and a link there is never written through.

Test: TestSetupOverrideIsNotAtAFixedNameInTmp,
TestNodeTarballIsNotAtAFixedNameInTmp and
TestFetchVerifiedDoesNotWriteThroughAPartLink failed before (a planted
link was written through) and now pass.

(cherry picked from commit c734ebd4b2)
A host first boot restarts the server and then sends the bootstrap
credential, then the administrator's password, then the setup's API
key to 127.0.0.1:8080 and later :8081; a move to the host does the same
with the operator's API key. Those are unprivileged ports, and nothing
checked who answered there. A local user who bound one while the
server restarted was sent the password or the key.

Before each such request, the installer now checks that every socket
listening on that port belongs to the server unit's main process
(systemctl show -p MainPID), reading /proc as the port survey already
does; otherwise nothing is sent, and the step waits or fails naming
what holds the port. The jmap client gained a Guard hook for this. A
server in a container is not checked: the runtime publishes its port.

Backport to the 2026 line, by hand where the code differs: the 2026
line has no name-router or log-file steps after a move, so the three
first-boot clients and the move's are the ones guarded, and host.go gains
only PortHeldBy.

Test: TestSetupCredentialsGoOnlyToTheServersOwnListener failed before
(a listener that wasn't the server's received "Basic ..." and "Bearer
the-api-key") and now passes; TestSetupCredentialsGoToTheServer and
TestSetupCredentialsCheckTheClientsCurrentAddress are new.

(backported from commit d647a78d8a)
Install: pin Caddy by digest
ci / test (pull_request) Successful in 51s
fabffd5161
The proxy in front of the console and the webmail, which holds their
TLS keys (and runs on the host network beside a host server), was
docker.io/library/caddy:2-alpine: a floating tag on Docker Hub, so
every install and converge ran whatever that tag named that day, and
whoever could push it chose what ran as the proxy. Everything else
the installer downloads is checked against a checksum in its source.

Caddy is now pinned in internal/release by the digest of its image
index (2.11.9-alpine, the same digest as on main), and compose.yaml
names it by digest. The comment that called the suite's own tags
immutable is corrected: they can be pushed again.

Backport to the 2026 line, by hand where the code differs: this line
has no pin-check, so that part is left out and the pin is moved by
hand like the other pins here; the image test also accepts the
webmail's version-and-commit tags.

Test: TestCaddyIsPinnedByDigest failed before (DefaultCaddyImage was
"docker.io/library/caddy:2-alpine") and now passes;
TestSuiteImagesNameAnExactRelease is new.

(backported from commit 71ec74be74)
jcoffey-dev merged commit 9d0f57d182 into release/2026 2026-11-18 01:13:50 +00:00
jcoffey-dev deleted branch sec/batch-6-2026 2026-11-18 01:13:51 +00:00
Sign in to join this conversation.