Repository navigation
Conversation
Confining configuration writes to ${karaf.etc} is not enough: the files
reserved to admin (users.properties, the JMX and command ACLs) live in
etc too. A manager-level user could create a new PID and point its
felix.fileinstall.filename at etc/users.properties, or abuse the storage
type (--type) so the generated name resolves to a reserved file, and
overwrite it with an added admin account - a manager-to-admin escalation.
This completes the containment added in apache#2867.
checkConfigFile now requires the target to be inside ${karaf.etc}, use a
configuration extension (cfg, config or the JSON one) and be named after
the PID (or the factory PID for factory configurations), so a config can
only ever be written to its own file. The canonical path is resolved
first, which also rejects a case-only variant of a reserved name on
case-insensitive file systems, where the regex ACLs would not match.
Factory creation also rejects an unsupported storage type.
Existing configurations given a custom file name keep working: the name
check only runs when a configuration has no backing file yet, which is
the attack path.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Confining configuration writes to
${karaf.etc}(added in #2867) is not sufficient, because the files reserved toadminlive insideetctoo:users.properties, and the JMX / command ACLs.A
manager-level user, who is allowed to edit ordinary PIDs but not those reserved files, can still overwrite them throughConfigRepositoryImpl:felix.fileinstall.filename— create a new PID and set itsfelix.fileinstall.filenametofile:${karaf.etc}/users.properties, with properties that add an admin account. On the "new PID" branch the value is honored and the file is overwritten (an existing PID reuses its stored file, so that path was already safe).config:edit --type acl.org.apache.karaf.config.cfgon PIDjmxbuilds the file namejmx.acl.org.apache.karaf.config.cfg, i.e. the JMX ACL file.Either way a manager escalates to admin. This is reachable from
config:property-set/config:updateand from theConfigMBean(setProperty,update,create, factory creation) — the whole manager-reachable surface routes throughConfigRepository.update/createFactoryConfiguration.Fix
checkConfigFilenow requires the target to:${karaf.etc}(as before);cfg,config, or the configured JSON one; andSo a configuration can only ever be written to its own file, and can no longer clobber another PID's file or a non-config file such as
users.properties. The canonical path is resolved before the name check, which also rejects a case-only variant of a reserved name (e.g.JMX.ACL...vsjmx.acl...) on case-insensitive file systems, where the regex-based ACLs would not match. Factory creation additionally rejects an unsupported storage type.Existing configurations that were deliberately given a custom file name keep working: the name check only runs when a configuration has no backing file yet, which is exactly the attack path.
Tests
ConfigRepositoryImplContainmentTestis extended to 13 cases: the reportedfelix.fileinstall.filenameattack and the--typevariant against bothusers.propertiesand an ACL file, the case-only bypass, and unsupported suffixes, plus non-regression checks that ordinary updates, JSON storage and factory aliases still write correctly. The six attack tests fail on the current code and pass with this change;config/coreandconfig/commandbuild green on JDK 17.Note
This is a sibling of CVE-2026-91012 (same
manager→adminboundary and the same #2867 fix), so it may warrant handling through the security list rather than purely as a public change.