id: windows-administrative-shares-enabled

info:
  name: Administrative Shares Enabled
  author: princechaddha
  severity: high
  description: Checks if administrative shares (C$, D$, etc.) are enabled, which can pose a security risk.
  impact: |
    Enabling administrative shares can provide attackers with remote access to the system drives.
  remediation: |
    Disable administrative shares to minimize exposure to remote attacks.
  tags: windows,shares,administrative,code,windows-audit

self-contained: true

code:
  - pre-condition: |
      IsWindows();
    engine:
      - powershell
      - powershell.exe
    args:
      - -ExecutionPolicy
      - Bypass
    pattern: "*.ps1"
    source: |
      $Share = Get-SmbShare -Name C$
      Write-Host "Administrative Share Found: $($Share.Name)"

    matchers:
      - type: word
        words:
          - "Administrative Share Found: C$"
# digest: 4b0a00483046022100f1dbb7ab0ef7ff97bc57411ac7ecb79736e6d972c57bf4f7f0ff37e65be212ec0221009cd94ed2f21da4f7ddb5ff120eab8ff9ef6b20c1de07f0a04e27bb97b41740d0:922c64590222798bb761d5b6d8e72950