You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Query Issue]: Potential GPO 'Apply' misconfiguration (filtering out Admins does not work #40
MATCH p=(n:Base)-[:GenericAll|GenericWrite]->(g:GPO)
// Exclude Enterprise Admins and Domain Admins
WHERE NOT n.objectid =~ "-(519|512)$"
// Exclude unresolved SIDs
AND NOT (n.distinguishedname IS NULL)
// Asset description may reveal if it's a delegation group (false-positive) or a filter group (true-positive)
//AND n.description is not null
//AND n.description =~ "(?i)apply"
RETURN p
LIMIT 1000
Issue description
Issue
The query does not correctly exclude admins. When I run
MATCH p=(n:Base)-[:GenericAll|GenericWrite]->(g:GPO)
WHERE NOT n.objectid =~ "-(519|512)$"
AND NOT (n.distinguishedname IS NULL)
RETURN n.objectid
I get (sorry for bad formatting, but you get the point
╒═══════════════════════════════════════════════╕
│n.objectid │
╞═══════════════════════════════════════════════╡
│"S-1-5-21-1936219977-138304643-1546849883-519" │
├───────────────────────────────────────────────┤
│"S-1-5-21-1936219977-138304643-1546849883-512" │
├───────────────────────────────────────────────┤
│"S-1-5-21-1936219977-138304643-1546849883-512" │
├───────────────────────────────────────────────┤
│"S-1-5-21-1936219977-138304643-1546849883-519" │
├───────────────────────────────────────────────┤
[....]
Remediation
Changing the query to
MATCH p = (n:Base)-[:GenericAll|GenericWrite]->(g:GPO)
WHERE
NOT n.objectid =~ ".*-(519|512)$"
AND n.distinguishedname IS NOT NULL
RETURN n.objectid
(note the change in the NOT n.objectid =~ ".*-(519|512)$") fixed the issue for me.
Important notice
Thanks for your work! The community strives because of the hard work of amazing ppl like you do, we highly appreciate that!
Activity
Update Potential GPO 'Apply' misconfiguration.yml
martinsohn commentedon Jan 3, 2026
Hi @ig-masch, thank you for the report. You are correct, there should be a wildcard. This is fixed with #43
Query updates - bugfixes & improvements (#43)
fix: Query updates for owned clauses (#47)