Skip to content

Add list capabilities to directories for interactive users#12189

Merged
michalpristas merged 11 commits intoelastic:mainfrom
michalpristas:fix/win-osq
Jan 26, 2026
Merged

Add list capabilities to directories for interactive users#12189
michalpristas merged 11 commits intoelastic:mainfrom
michalpristas:fix/win-osq

Conversation

@michalpristas
Copy link
Contributor

@michalpristas michalpristas commented Jan 9, 2026

This PR addresses a failure case where OSQuery breaks due to invalid permissions on the Extensions directory.

Per the OSQuery implementation, permissions on the directory are validated, and the check fails if any non-Administrator identity has write access. On Windows, this can occur as a side effect of how File Explorer operates.

When a user who is a member of the Administrators group but not elevated uses File Explorer, Explorer runs under a filtered token. If that user navigates to the Agent directory, which requires Administrator access, a UAC prompt is triggered. To avoid running whole explorer process with full administrative privileges, Windows applies a workaround that adds a copy of the Administrator ACE to the directory ACL, scoped to the user SID.

This behavior introduces an additional identity with write permissions, which causes the OSQuery validation to fail.

This PR works around the issue in a deliberately simple way. It adds an ACE for the INTERACTIVE (logged-in) user with List Directory and Traverse permissions only. This does not allow file reads, only directory listing, which is not sensitive. With this in place, no UAC prompt is raised and the DACL is not modified in a way that breaks OSQuery validation.

Downside of this is that user won't be prompted with UAC and when opening a log files they will run into access denied in their editor. They either need to change perms for log, run elevated editor and open it directly or use our tools like diagnostics or logs subcommand which is in my opinion preferred way.

Fixes #7260
Fixes: #6792

@michalpristas michalpristas self-assigned this Jan 9, 2026
@michalpristas michalpristas added the bug Something isn't working label Jan 9, 2026
@michalpristas michalpristas requested a review from a team as a code owner January 9, 2026 11:36
@mergify
Copy link
Contributor

mergify bot commented Jan 9, 2026

This pull request does not have a backport label. Could you fix it @michalpristas? 🙏
To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-./d./d is the label that automatically backports to the 8./d branch. /d is the digit
  • backport-active-all is the label that automatically backports to all active branches.
  • backport-active-8 is the label that automatically backports to all active minor branches for the 8 major.
  • backport-active-9 is the label that automatically backports to all active minor branches for the 9 major.
@michalpristas michalpristas requested review from bjmcnic and cmacknz and removed request for swiatekm January 9, 2026 14:30
@ebeahan
Copy link
Member

ebeahan commented Jan 15, 2026

@michalpristas how backport friendly is this fix? It'd be nice to have a fix land in past versions, if possible.

@michalpristas
Copy link
Contributor Author

michalpristas commented Jan 15, 2026

Should not be an issue. Let's do backport active and close prs that turns out problematic

@michalpristas michalpristas added backport-active-all Automated backport with mergify to all the active branches and removed backport-skip labels Jan 15, 2026
@cmacknz
Copy link
Member

cmacknz commented Jan 21, 2026

I am fine with this as the current best path we have to stop this problem from happening, I do this we need to document it a bit more.

Copy link
Contributor

@blakerouse blakerouse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, this is a really smart idea for this.

This PR has an updated beats submodule, did you mean for that?

@michalpristas
Copy link
Contributor Author

no i just hate submodules

@michalpristas michalpristas requested a review from cmacknz January 22, 2026 14:42
@elasticmachine
Copy link
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

History

cc @michalpristas

@michalpristas michalpristas merged commit 158d0d4 into elastic:main Jan 26, 2026
22 checks passed
@github-actions
Copy link
Contributor

@Mergifyio backport 8.19 9.2 9.3

@mergify
Copy link
Contributor

mergify bot commented Jan 26, 2026

mergify bot pushed a commit that referenced this pull request Jan 26, 2026
* Add list capabilities to directories for interactive users

* changelog

* changelog

* make test failures clear

* make test failures clear

* updated changelog

* beats

(cherry picked from commit 158d0d4)
mergify bot pushed a commit that referenced this pull request Jan 26, 2026
* Add list capabilities to directories for interactive users

* changelog

* changelog

* make test failures clear

* make test failures clear

* updated changelog

* beats

(cherry picked from commit 158d0d4)
mergify bot pushed a commit that referenced this pull request Jan 26, 2026
* Add list capabilities to directories for interactive users

* changelog

* changelog

* make test failures clear

* make test failures clear

* updated changelog

* beats

(cherry picked from commit 158d0d4)
ebeahan pushed a commit that referenced this pull request Jan 26, 2026
…12437)

* Add list capabilities to directories for interactive users

* changelog

* changelog

* make test failures clear

* make test failures clear

* updated changelog

* beats

(cherry picked from commit 158d0d4)

Co-authored-by: Michal Pristas <michal.pristas@elastic.co>
ebeahan pushed a commit that referenced this pull request Jan 26, 2026
…12435)

* Add list capabilities to directories for interactive users

* changelog

* changelog

* make test failures clear

* make test failures clear

* updated changelog

* beats

(cherry picked from commit 158d0d4)

Co-authored-by: Michal Pristas <michal.pristas@elastic.co>
ebeahan pushed a commit that referenced this pull request Jan 26, 2026
…12436)

* Add list capabilities to directories for interactive users

* changelog

* changelog

* make test failures clear

* make test failures clear

* updated changelog

* beats

(cherry picked from commit 158d0d4)

Co-authored-by: Michal Pristas <michal.pristas@elastic.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-active-all Automated backport with mergify to all the active branches bug Something isn't working

5 participants