You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Write-Warning-Message 'Firewall rules for the Network Policy Server (NPS) are disabled, while non-default RADIUS client addresses are specified. This is probably a mistake.'
@@ -1206,6 +1211,97 @@ It is located under Computer Configuration → Policies → Administrative Templ
1206
1211
> Value type: REG_DWORD
1207
1212
> Value data: 0
1208
1213
1214
+
### Port Scanning
1215
+
1216
+
One way of validating a domain controller host-based firewall configuration is performing a full port scan from a [client IP address](#identifying-management-traffic).
1217
+
While network administrators might prefer using Microsoft's [PortQry](https://www.microsoft.com/en-us/download/details.aspx?id=17148),
1218
+
penetration testers would most probably use the [Nmap](https://nmap.org/) tool to discover remotely available protocols:
1219
+
1220
+
```shell
1221
+
nmap -p 1-65535 adatum-dc.adatum.com
1222
+
```
1223
+
1224
+
```txt
1225
+
Starting Nmap 7.94SVN ( https://nmap.org ) at 2025-01-09 21:17 CET
1226
+
Nmap scan report for adatum-dc.adatum.com (10.213.0.8)
1227
+
Host is up (0.0027s latency).
1228
+
Not shown: 65518 filtered tcp ports (no-response)
1229
+
PORT STATE SERVICE
1230
+
53/tcp open domain
1231
+
88/tcp open kerberos-sec
1232
+
135/tcp open msrpc
1233
+
389/tcp open ldap
1234
+
445/tcp open microsoft-ds
1235
+
464/tcp open kpasswd5
1236
+
593/tcp open http-rpc-epmap
1237
+
636/tcp open ldapssl
1238
+
3268/tcp open globalcatLDAP
1239
+
3269/tcp open globalcatLDAPssl
1240
+
38901/tcp open unknown
1241
+
38902/tcp open unknown
1242
+
49664/tcp open unknown
1243
+
49667/tcp open unknown
1244
+
49668/tcp open unknown
1245
+
49672/tcp open unknown
1246
+
49679/tcp open unknown
1247
+
MAC Address: 00:17:FB:00:00:05 (FA)
1248
+
1249
+
Nmap done: 1 IP address (1 host up) scanned in 106.77 seconds
1250
+
```
1251
+
1252
+
This sample output mostly contains well-known TCP ports like DNS (`53/TCP`), Kerberos (`88/TCP` and `464/TCP`), LDAP (`389/TCP` and `3268/TCP`),
1253
+
LDAPS (`636/TCP` and `3269/TCP`), SMB (`445/TCP`), and RPC Endpoint Mapper (`135/TCP`),
1254
+
which [must be reachable by Windows clients](https://learn.microsoft.com/en-us/troubleshoot/windows-server/active-directory/config-firewall-for-ad-domains-and-trusts#windows-server-2008-and-later-versions).
1255
+
Ports `38901/TCP` and `38902/TCP` are organization-specific [static RPC ports](#static-rpc-ports) used by Active Directory.
1256
+
All protocols that directly allow remote command execution, including RDP (`3389/TCP` and `3389/UDP`), WinRM (`5985/TCP` and `5986/TCP`), and WMI (dynamic RPC port or `24158/TCP`), are properly blocked.
1257
+
1258
+
Port `593/TCP` (RPC Endpoint Mapper over HTTP) is unnecessarily exposed by the built-in [Active Directory Domain Controller (RPC-EPMAP)](#active-directory-domain-controller-rpc-epmap) rule,
1259
+
which is primarily used to open the core `135/TCP` port. Although we prefer not to modify this built-in rule, we typically block port `593/TCP` on firewall appliances, without any noticeable consequences.
1260
+
1261
+
There are 5 additional dynamic RPC ports present. An EPMAP query would have revealed more details about these ports:
[\[MS-RAA\]: Remote Authorization API Protocol]: https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-raa/98ab2e01-da37-4e76-bea5-8d4d83e66e1a
1275
+
1276
+
These ports are allowed by the built-in [Active Directory Domain Controller (RPC)](#active-directory-domain-controller-rpc) rule.
1277
+
The respective protocols are exposed through the `ncacn_np` RPC transport as well.
1278
+
As a matter of fact, Windows client components seem to be using the `\PIPE\lsass` named pipe exclusively when communicating over these RPC protocols.
1279
+
Consequently, the RPC dynamic port range (`49152/TCP` to `65535/TCP`) on domain controllers does not need to be accessible by member computers for AD to work properly. We therefore typically block this port range on firewall appliances.
1280
+
1281
+
A UDP port scan should yield far less interesting results:
1282
+
1283
+
```shell
1284
+
nmap -sU -p 1-65535 adatum-dc.adatum.com
1285
+
```
1286
+
1287
+
```txt
1288
+
Starting Nmap 7.94SVN ( https://nmap.org ) at 2025-01-09 21:18 CET
1289
+
Nmap scan report for adatum-dc.adatum.com (10.213.0.8)
1290
+
Host is up (0.0035s latency).
1291
+
Not shown: 65531 open|filtered udp ports (no-response)
1292
+
PORT STATE SERVICE
1293
+
53/udp open domain
1294
+
88/udp open kerberos-sec
1295
+
123/udp open ntp
1296
+
389/udp open ldap
1297
+
MAC Address: 00:17:FB:00:00:05 (FA)
1298
+
1299
+
Nmap done: 1 IP address (1 host up) scanned in 934.29 seconds
1300
+
```
1301
+
1302
+
Contrary to what the documentation says, the Kerberos password change (kpasswd) protocol does not seem to be listening on port `464/UDP`.
1303
+
More importantly, the firewall properly blocks the legacy NetBIOS protocol (ports `137/UDP`, `138/UDP`, and `139/TCP`).
1304
+
1209
1305
## DCFWTool Distribution Contents
1210
1306
1211
1307
Below is a list of all files that are part of the solution, with their respective paths and brief descriptions.
@@ -1275,6 +1371,14 @@ Below is a list of all files that are part of the solution, with their respectiv
1275
1371
1276
1372
: PowerShell script for reading Windows Firewall log files.
1277
1373
1374
+
`DCFWTool\Update-ADDSFirewallPolicy.bat`
1375
+
1376
+
: Batch script that locally applies all domain controller firewall policy settings, without requiring a DC reboot.
1377
+
1378
+
`DCFWTool\Undo-ADDSFirewallPolicy.bat`
1379
+
1380
+
: Batch script that locally resets the unmanaged domain controller policy settings to their default values.
0 commit comments