Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ESC1 Report Flag Pre-requisites - False / True Positive #241

Open
heartburn-dev opened this issue Nov 28, 2024 · 0 comments
Open

ESC1 Report Flag Pre-requisites - False / True Positive #241

heartburn-dev opened this issue Nov 28, 2024 · 0 comments

Comments

@heartburn-dev
Copy link

heartburn-dev commented Nov 28, 2024

Hi all,

Little bit of a weird one, that I can't quite confirm myself yet, and don't want to give poor information in a remediation suggestion. I have an engagement where ESC1 and ESC4 are reported. ESC4 is self explanatory, due to the ACLs, but the ESC1 doesn't appear to be part of the eligible enrollment groups.

    Permissions
      Enrollment Permissions
        Enrollment Rights               : TEST.NET\EXAMPLE_MACHINE
                                          TEST.NET\Enterprise Admins
      Object Control Permissions
        Owner                           : TEST.NET\User_DA
        Full Control Principals         : TEST.NET\Domain Admins
                                          TEST.NET\Authenticated Users
        Write Owner Principals          : TEST.NET\Enterprise Admins
                                          TEST.NET\User_DA
                                          TEST.NET\Domain Admins
                                          TEST.NET\Authenticated Users
        Write Dacl Principals           : TEST.NET\Enterprise Admins
                                          TEST.NET\User_DA
                                          TEST.NET\Domain Admins
                                          TEST.NET\Authenticated Users
        Write Property Principals       : TEST.NET\Enterprise Admins
                                          TEST.NET\User_DA
                                          TEST.NET\Domain Admins
                                          TEST.NET\Authenticated Users
    [!] Vulnerabilities
      ESC1                              : 'TEST.NET\\Authenticated Users' can enroll, enrollee supplies subject and template allows client authentication
      ESC4                              : 'TEST.NET\\Authenticated Users' has dangerous permissions

Surprisingly, ESC1 still worked without me making modifications to the certificate via ESC4, but I'm keen to understand where the logic check is in the code. Is it simply that FullControl is akin to allowing enrollment? I note #226 but this seems slightly different, as it wasn't a FP, but isn't listed in enrollment rights.

It looks like the decision to include/not include a user in the Enrollment Rights section is here:

def can_user_enroll_in_template(self, template: LDAPEntry):

Where one of these then, must be evaluating to true:

            if (
                EXTENDED_RIGHTS_NAME_MAP["All-Extended-Rights"]
                in rights["extended_rights"]
                or EXTENDED_RIGHTS_NAME_MAP["Enroll"] in rights["extended_rights"]
                or CERTIFICATE_RIGHTS.GENERIC_ALL in rights["rights"]
            ):

So my guess is that the CERTIFICATE_RIGHTS.GENERIC_ALL in rights["rights"] is true due to:

class CERTIFICATE_RIGHTS(IntFlag):
    GENERIC_ALL = 983551
    WRITE_OWNER = 524288
    WRITE_DACL = 262144
    WRITE_PROPERTY = 32

    def to_list(self):
        cls = self.__class__

        if self._value_ == self.GENERIC_ALL:
            return [CERTIFICATE_RIGHTS(self.GENERIC_ALL)]

Which causes the vulnerability to flag (due to FullControl), but no "Authenticated Users" to show in the enroll field.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant