Conversation
In mo_jupe() all privilege checks lived inside the "if (target)" block. The four-parameter form omits <target>, defaults to a local jupe (JUPE_LOCAL), and fell through to jupe_add()/jupe_activate() with no HasPriv() check. An oper whose Operator block or class explicitly revokes local_jupe could therefore still create, activate and deactivate local jupes by omitting the target parameter: JUPE +evil.server 3600 :reason (was ungated) JUPE +evil.server my.server.name 3600 :reason (required PRIV_LOCAL_JUPE) On a hub an active local jupe refuses the named server at link time and squits it if introduced, so this granted real operational power contrary to explicit configuration. Only opers reach mo_jupe(), CONFIG_OPERCMDS (default off) gates the whole path, and LOCAL_JUPE is in the default privilege set, so it only bit where an admin had deliberately removed the privilege. Gate the implicit-local branch with PRIV_LOCAL_JUPE, mirroring mo_gline()'s unconditional PRIV_LOCAL_GLINE check on its local path. Closes UndernetIRC#106.
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.
Fixes #106.
Summary
In
mo_jupe()all privilege checks lived inside theif (target)block.The four-parameter form omits
<target>, defaults to a local jupe(
JUPE_LOCAL), and fell straight through tojupe_add()/jupe_activate()with noHasPriv()check. So these did the same thingbut only the second was gated:
An oper whose Operator block or class explicitly revokes
local_jupecould still create, activate and deactivate local jupes by omitting the
target. On a hub an active local jupe refuses the named server at link
time and squits it if introduced, so this granted real operational power
contrary to explicit configuration.
Mitigating factors (from the issue): only opers reach
mo_jupe(),CONFIG_OPERCMDS(default off) gates the whole path, andLOCAL_JUPEisin the default privilege set — so it only bit where an admin had
deliberately removed the privilege.
Fix
Gate the implicit-local branch with
PRIV_LOCAL_JUPE, mirroringmo_gline()'s unconditionalPRIV_LOCAL_GLINEcheck on its local path.Two lines, no behaviour change for anyone who has the privilege.
Enforcement audit
I traced every path in
mo_jupe()and confirmed eachjupe_*callhonours the flag its privilege is paired with, so a local privilege
cannot produce a global effect:
*propagate_jupe()returns early onJupeIsLocal, so aJUPE_LOCALjupenever leaves the server; a
PRIV_LOCAL_JUPE-only oper acting on anexisting global jupe only toggles the local
JUPE_LDEACTstate withoutpropagating.
ms_jupe()(server-to-server) is trusted and correctly hasno privilege check.
Tests
Verified by inspection and a clean
-Wallcompile. A behaviouralregression test (an oper with
local_juperevoked gettingERR_NOPRIVILEGESon the implicit-local form) needs the integrationharness and can follow.