mongos killCursors checks auth against request namespace instead of cursor's namespace

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Major - P3
    • 8.2.12, 8.0.28, 7.0.39, 8.3.7
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Optimization
    • ALL
    • v9.0, v8.3, v8.2, v8.0, v7.0
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      The mongos killCursors command handler authorizes the killAnyCursor action against the client supplied request namespace from the killCursor command, instead of the cursor's actual associated namespace. This means that an authenticated user with killAnyCursor on one database can kill cursors belonging to a different database. Note that is only affects mongos only.

      Root cause

      cluster_killcursors_cmd.cpp builds an authChecker lambda capturing the nss from the killCursors command BSON and passes it to auth::checkAuthForKillCursors, which checks for killAnyCursor against that namespace. The cluster cursor manager looks up that cursor by cursorId only and the auth callback received just the user, never the cursors stored namespace. Note that the mongod is correct, it uses the namespace from the cursor to perform the authentication.

            Assignee:
            Ben Shteinfeld
            Reporter:
            Ben Shteinfeld
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: