Overview
Thefirewall action enumerates Windows Firewall rules and open TCP ports on remote systems. It queries the MSFT_NetFirewallRule and MSFT_NetProtocolPortFilter WMI classes in the ROOT\StandardCIMV2 namespace.
This action is available on Windows Server 2012+ and Windows 8+ systems that support the StandardCIMV2 namespace.
Syntax
Parameters
| Parameter | Required | Description |
|---|---|---|
action | Yes | Must be firewall |
computername | Yes | Target host(s), comma-separated |
username | No | Username for authentication |
password | No | Password for authentication |
Usage Examples
Example Output
Understanding Output
Action Values
| Value | Meaning |
|---|---|
| 2 | Allow |
| 3 | AllowBypass |
| 4 | Block |
Direction Values
| Value | Meaning |
|---|---|
| 1 | Inbound |
| 2 | Outbound |
Operational Use Cases
Scenario 1: Identify Remote Access Vectors
- Port 3389 (RDP)
- Port 5985/5986 (WinRM)
- Port 22 (SSH)
- Port 445 (SMB)
Scenario 2: Lateral Movement Planning
- Permissive firewall rules
- Management ports open
- Custom application ports
- Outbound restrictions
Scenario 3: Egress Filtering Detection
Check for outbound rules that might block C2 traffic:- Blocked outbound ports
- Restricted protocols
- Application-specific blocks
Scenario 4: Defense Evasion Planning
Identify allowed services and ports for blending in:Remote Only
This is a remote-only action. For local firewall enumeration, use:Detection Considerations
WMI Detection
WMI Detection
- WMI queries to
ROOT\StandardCIMV2namespace - Queries for
MSFT_NetFirewallRuleclass - Queries for
MSFT_NetProtocolPortFilterclass - Event ID 5857: WMI activity
Reconnaissance Indicators
Reconnaissance Indicators
- Firewall enumeration across multiple systems
- Queries originating from non-administrative systems
- Bulk firewall queries in short timeframe
- Correlation with other enumeration activities
Network Detection
Network Detection
- WMI/DCOM traffic on port 135
- Multiple connections to various systems
- Queries from single source IP
Best Practices
Target Selection
- Prioritize high-value targets (DCs, servers)
- Focus on potential pivot points
- Identify perimeter systems
- Map DMZ configurations
Operational Security
- Limit query frequency
- Blend with legitimate admin activity
- Avoid bulk queries
- Use during business hours
Troubleshooting
Invalid Namespace Error
Invalid Namespace Error
Cause: System doesn’t support StandardCIMV2 namespaceSolution:
- Verify Windows version (8+ or Server 2012+)
- Check WMI namespace exists:
- Use alternative query methods for older systems
Access Denied
Access Denied
Cause: Insufficient privilegesSolution:
- Verify admin credentials
- Use
usernameandpasswordparameters - Check UAC remote restrictions
No Results Returned
No Results Returned
Cause: No firewall rules or query issueSolution:
- Verify firewall service is running
- Check if firewall is enabled
- Test with manual WMI query
Related Actions
query
Custom firewall queries
loggedon
User enumeration
ps
Process enumeration
exec
Execute commands
Alternative Queries
All Firewall Rules
All Firewall Rules
Inbound Allow Rules Only
Inbound Allow Rules Only
Blocked Ports
Blocked Ports