Windows PowerShell: Suspicious SslStream Client Certificate Validation in Script Block

Flags PowerShell scripts referencing SslStream and client-side certificate validation during SSL client authentication.

FreeReviewedSigma · Low · v2
Product
windows
Category
ps_script
Author
frack113 (SigmaHQ), DRL 1.1
Published
2022-01-23
Updated
2026-07-31
title: "Windows PowerShell: Suspicious SslStream Client Certificate Validation in Script Block"
id: ef26b1a4-ef4a-426f-ab74-fe75fe191c37
status: test
description: This rule flags PowerShell script blocks that use .NET SslStream client-side authentication with explicit remote certificate validation callbacks. Attackers can use these APIs to establish encrypted channels for command and control while handling certificates in code. The detection relies on PowerShell Script Block Logging and matches specific .NET method and callback strings within the logged script content.
references:
  - https://github.com/redcanaryco/atomic-red-team/blob/f339e7da7d05f6057fdfcdd3742bfcf365fee2a9/atomics/T1573/T1573.md#atomic-test-1---openssl-c2
  - https://medium.com/walmartglobaltech/openssl-server-reverse-shell-from-windows-client-aee2dbfa0926
  - https://github.com/SigmaHQ/sigma/blob/master/rules/windows/powershell/powershell_script/posh_ps_susp_ssl_keyword.yml
author: frack113, Huntrule Team
date: 2022-01-23
tags:
  - attack.command-and-control
  - attack.t1573
logsource:
  product: windows
  category: ps_script
  definition: "Requirements: Script Block Logging must be enabled"
detection:
  selection:
    ScriptBlockText|contains|all:
      - System.Net.Security.SslStream
      - Net.Security.RemoteCertificateValidationCallback
      - .AuthenticateAsClient
  condition: selection
falsepositives:
  - Legitimate administrative script
level: low
license: DRL-1.1
related:
  - id: 195626f3-5f1b-4403-93b7-e6cfd4d6a078
    type: derived