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

adding discrimination between DC and MS #355

Merged
merged 6 commits into from
Feb 29, 2024
Merged

Conversation

schnipschnap
Copy link
Contributor

No description provided.

This comment has been minimized.

This comment has been minimized.

Copy link
Contributor

@mm-weber mm-weber left a comment

Choose a reason for hiding this comment

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

Great improvement @schnipschnap !

My suggestion would be to re-write this as a variants: query:

  - uid: mondoo-windows-security-network-access-named-pipes-that-can-be-accessed-anonymously-is-set-to-none
    title: 'Ensure ''Network access: Named Pipes that can be accessed anonymously'' is set to ''None'''
    impact: 100
    variants:
      - uid: mondoo-windows-security-network-access-named-pipes-that-can-be-accessed-anonymously-is-set-to-none-dc
      - uid: mondoo-windows-security-network-access-named-pipes-that-can-be-accessed-anonymously-is-set-to-none-server
    docs:
      desc: |-
        This policy setting determines which communication sessions, or pipes, will have attributes and permissions that allow anonymous access.

        The recommended state for this setting is: `<blank>` (i.e. None).
      remediation:
        - id: default
          desc: |-
            #### Group Policy Approach

            To establish the recommended configuration via GP, set the following UI path to `<blank>` (i.e. None):

            ```
            Computer Configuration\\Policies\\Windows Settings\\Security Settings\\Local Policies\\Security Options\\Network access: Named Pipes that can be accessed anonymously
            ```

            **Impact:**

            This configuration will disable null session access over named pipes, and applications that rely on this feature or on unauthenticated access to named pipes will no longer function.
        - id: powershell
          desc: |
            #### PowerShell Approach

            To establish the recommended configuration via PowerShell, run the following commands:

            ```powershell
            $RegistryPath = 'HKLM:\SYSTEM\CurrentControlSet\Services\LanManServer\Parameters'
            $Name         = 'NullSessionPipes'
            $Value        = ''

            # Create the key if it does not exist
            If (-NOT (Test-Path $RegistryPath)) {
                New-Item -Path $RegistryPath -Force | Out-Null
            }

            # Now set the value
            New-ItemProperty -Path $RegistryPath -Name $Name -Value $Value -PropertyType MultiString -Force
            ```
  - uid: mondoo-windows-security-network-access-named-pipes-that-can-be-accessed-anonymously-is-set-to-none-dc
    filters: |
      windows.computerInfo.OsProductType == 2
    mql: |
        registrykey.property( path: 'HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanManServer\Parameters', name: 'NullSessionPipes' ).value.downcase == /lsarpc|netlogon|samr/
  - uid: mondoo-windows-security-network-access-named-pipes-that-can-be-accessed-anonymously-is-set-to-none-server
    filters: |
      windows.computerInfo.OsProductType != 2
    mql: |
        registrykey.property( path: 'HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanManServer\Parameters', name: 'NullSessionPipes' ).value == ""

@schnipschnap
Copy link
Contributor Author

@mm-weber I thought about that but it would be inconsistent with other checks in the same file. I would suggest leaving this for now and then upgrading the whole policy later. What do you think?

@mm-weber
Copy link
Contributor

Hey @schnipschnap,

we should try to establish new patterns where we can.
It's not an issue if the whole policy doesn't consist of all variants:, yet.
Bit by bit :)

@schnipschnap
Copy link
Contributor Author

@mm-weber Variants changes applied. Thank you for the assistance!

Copy link
Contributor

@mm-weber mm-weber left a comment

Choose a reason for hiding this comment

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

Hey @schnipschnap , just as we discussed yesterday, for now we should keep the -uid in line with the current policy.
Will look for a solution on how to sync variants: better in the future.

core/mondoo-windows-security.mql.yaml Outdated Show resolved Hide resolved
core/mondoo-windows-security.mql.yaml Outdated Show resolved Hide resolved
core/mondoo-windows-security.mql.yaml Outdated Show resolved Hide resolved
schnipschnap and others added 4 commits February 28, 2024 17:31
Co-authored-by: Manuel Weber <112621871+mm-weber@users.noreply.github.com>
Signed-off-by: Christian Gross <cgross@mondoo.com>
Co-authored-by: Manuel Weber <112621871+mm-weber@users.noreply.github.com>
Signed-off-by: Christian Gross <cgross@mondoo.com>
Co-authored-by: Manuel Weber <112621871+mm-weber@users.noreply.github.com>
Signed-off-by: Christian Gross <cgross@mondoo.com>
@schnipschnap
Copy link
Contributor Author

@mm-weber Every query needs to have a title github complains?

Copy link
Contributor

@mm-weber mm-weber left a comment

Choose a reason for hiding this comment

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

LGTM

@mm-weber mm-weber merged commit 73f97f0 into main Feb 29, 2024
7 checks passed
@mm-weber mm-weber deleted the cg/namedpipesdcpublic branch February 29, 2024 13:29
@github-actions github-actions bot locked and limited conversation to collaborators Feb 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants