Giter VIP home page Giter VIP logo

Comments (4)

vletoux avatar vletoux commented on May 30, 2024

it is displayed below in the user & computer section will all the users / computers impacted.

from pingcastle.

cnotin avatar cnotin commented on May 30, 2024

I see the concerned user in this example:
image

But I don't see which abnormal primary group ID/name it has.

from pingcastle.

An-dir avatar An-dir commented on May 30, 2024

@cnotin is there any need to know what the primary group was? did you notice any wrong detection or were you able to change the primary group just to be "domain-users". Reading the text you could user PowerShell.... later more about that.

i would add the following questions:

  1. how about a user that is ONLY a member in a self created group "service accounts" or something like that.
  2. Am i wrong with that assumption that you should focus on admins here? The detection rule and the PowerShell search example should be more detailed or it should be split in two RuleIDs.
    2.1. One rule (the existing one) could validate the critical objects (any admincount=1 user & DomainController) and add a total of 15 points
    2.2. Second rule (a new one) could validate any non critical object and add a total of 0 Points just to make someone aware of that uncommon configuration.
  3. The Powershell Example only is for users and misses Computers and DomainController!

Regarding the Powershell check:
i was just doing the following that lists users not having the common primary group
Get-ADUser -Properties PrimaryGroupID -Filter 'PrimaryGroupID -ne 512 -and PrimaryGroupID -ne 513 -and PrimaryGroupID -ne 514'
But you might need some more complex query for user check like that:

$DefaultUserMemberOfGroupsDNs = @()
$DomainSID = (Get-ADDomain).DomainSID
foreach ($ID in "512","513","514") {
$WellKnownSid = $DomainSID.value + '-' + $ID
$DefaultUserMemberOfGroupsDNs += (Get-ADGroup -Filter 'SID -eq $WellKnownSid').DistinguishedName
}
Write-Host -ForegroundColor Green "Default Groups detected:"
$DefaultUserMemberOfGroupsDNs
""
$NonDefaultUsers = Get-ADUser -Properties PrimaryGroupID,MemberOf -Filter 'PrimaryGroupID -ne 512 -and PrimaryGroupID -ne 513 -and PrimaryGroupID -ne 514'  

Write-Host -ForegroundColor Green "Listing all Users not having one of the three memberships as default"
$NonDefaultUsers
Write-Host -ForegroundColor Green "Listing all Users not having one of the three memberships as default that could be corrected"
$NonDefaultUsers | where {@(Compare-Object $_.memberof $DefaultUserMemberOfGroupsDNs -ExcludeDifferent -IncludeEqual).count -gt 0} 
Write-Host -ForegroundColor Green "Listing all Users not having one of the three memberships as default but that might be normal for these"
$NonDefaultUsers | where {@(Compare-Object $_.memberof $DefaultUserMemberOfGroupsDNs -ExcludeDifferent -IncludeEqual).count -eq 0} 

if you are interested i might do one for computer/domaincontroller too

from pingcastle.

An-dir avatar An-dir commented on May 30, 2024

Extending Pingcastle would mean to edit / duplicate this function to have "PrimaryGroup" (DistinguishedName) included here:
https://github.com/vletoux/pingcastle/blob/master/Healthcheck/HealthcheckAnalyzer.cs#L608

use the new function here https://github.com/vletoux/pingcastle/blob/master/Healthcheck/Healthcheck.cs#L411
...and here https://github.com/vletoux/pingcastle/blob/master/Healthcheck/Healthcheck.cs#L428

and for the output need a if query if "id" is "sectionbadprimarygroup" then add "PrimaryGroup" data to https://github.com/vletoux/pingcastle/blob/master/Report/ReportHealthCheckSingle.cs#L1098

as c# is not my native language ;D cannot go more into detail without having to waste a lot of hours.

if @vletoux wants to expand the table, but make it very wide this data might help.

from pingcastle.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.