A. Remotely Stealing All Secrets (But With Good Intentions) : Disclaimer
A. Remotely Stealing All Secrets (But With Good Intentions) : Disclaimer
A. Remotely Stealing All Secrets (But With Good Intentions) : Disclaimer
At the end of these exercises you will be able to identify and deploy important security settings
on your domain controllers.
DISCLAIMER
These labs contain third-party tools. Please be aware of the following guidelines:
• These tools are for research purposes only. Microsoft does not own these tools nor
can it guarantee their behavior.
• These tools should only be run in a test lab environment.
• They are tools that are used by both hackers and penetration testers, and need to
be treated with caution and with clear policies and permissions.
• The trainer is authorized to describe in details how the tools work and to show
recorded videos of the tools to the attendees.
• The trainer is giving guidance to the attendees on how to better defend Active
Directory against those tools. This includes demonstration of the tools in the
workshop’s labs.
• The lab machines used in the offering have those tools pre-installed. Those
machines are not connected to any network else then the lab network. Those
machines are not connected to the Internet.
• The attendees cannot keep a copy of the lab machines. Through your agreement to
attend the training, Microsoft disclaims any liability for the misuse of these tools,
either accidentally or intentionally. Use of these tools in this environment is for
training purposes only.
Username CONTOSO\Administrator
Password Pa$$w0rd
2. Right-click on the start button and click Run. In the Run window, type powershell and
click OK.
3. In the PowerShell console, run the following commands:
PowerShell
Import-Module DSInternals ;
Get-ADReplAccount -All -Server DC01 -NamingContext "DC=contoso,DC=com"
| `
Test-PasswordQuality -WeakPasswords "p" -IncludeDisabledAccounts
This will look for users that have the password "p" and for other common things such as users
having the same hash (same password) and other security oriented settings.
If you are about to take a break make sure you save your labs before!
Username CONTOSO\Administrator
Password Pa$$w0rd
2. Right-click on the start button and click Run. In the Run window, type dsac.exe and
click OK.
Expand contoso (local), right-click on _Admins, click New, and then click Group.
4. In the Create Group window, enter the name RDP DC Exception, then scroll down and
in the Members section click Add…. Then click on the Object Types button, check
Computers and click OK. Then type SRV01 and click the Check Names button. Click
OK twice.
5. Right-click on the start button and click Run. In the Run window, type gpmc.msc and
click OK.
6. Expand Forest: contoso.com/Domains/contoso.com. Right-click on the Domain
Controllers OU and click Create a GPO in this domain, and Link it here…. In the
New GPO window, type the name RDP Firewall Restriction then click OK. Then
click OK and OK again to close the Group properties window.
7. Expand the Forest: contoso.com/Domains/contoso.com/Group Policy Objects
container. Right-click on RDP Firewall Restriction and click Edit.
8. Expand Computer Configuration/Policies/Windows Settings/Security
Settings/Windows Firewall with Advanced Security/Windows Firewall with
Advanced Security.
9. Right-click on Inbound Rules and click New Rules…. On the Rule Type window, select
the option Port and click Next. Leave the TCP option and in the Specific local ports
field, type 3389 and then click Next. Select Block the connection and click Next. Leave
all profiles checked and click Next. In the Name field, type Block RDP for everyone and
click Finish.
10. Right-click on Inbound Rules and click New Rule…. In the Rule Type window, select
the option Port and click Next. Leave the TCP option and in the Specific local ports
field, type 3389 and then click Next. Select Allow the connection if it is secure and
click Customize. In the Customize Allow if Secure Settings window, select the option
Allow the connection to use null encapsulation, check Override block rules and click
OK. Back in the Action window, click Next. In the Authorized users section, check Only
allow connections from these users and click Add. Type Domain Admins, click Check
Names and OK. Back in the Users window, click Next. In the Authorized computers
section, click Add. Type RDP DC Exception, click Check Names and OK. Back in the
Action window, click Next. Leave all profiles checked and click Next. In the Name field,
type Exception of specific servers and domain admins and click Finish.
11. Right-click on Connection Security Rules and click New Rule…. In the Rule Type
window, select the option Custom and click Next. In the Endpoint*s window, leave the
default settings and click Next. In the *Requirements window, select the second option
Require authentication for inbound and request authentication for outbound
connections and click Next. In the Authentication Method window, select the second
option Computer and user (Kerberos V5) and click Next. In the Protocol and Ports
window, in the Protocol type list, pick TCP, in the Endpoint 1 port, pick Specific ports
and enter the port 3389 then click Next. Leave all profiles checked and click Next. In the
Name field, type Secure RDP and click Finish. Close the Group Management Editor
console.
12. Right-click on the start button and click Run. In the Run window, type cmd /k gpupdate
/force and click OK.
13. Log on to CONTOSO - SRV01.
Username CONTOSO\Administrator
Password Pa$$w0rd
14. Right-click on the start button and click Run. In the Run window, type mstsc and click
OK.
15. In the Remote Desktop Connection window, type DC01 and click Connect. This should
try to initiate the connection but can't now that it is restricted.
Click OK and close the Remote Desktop Connection window.
16. Right-click on the start button and click Run. In the Run window, type wf.msc and click
OK.
17. In the Windows Firewall with Advanced Security console, right-click on Connection
Security Rules and click New rule. In the Rule Type window, select the option Custom
and click Next. In the Endpoints window, leave the default settings and click Next. In the
Requirements window, leave the first option Request authentication for inbound and
outbound connections and click Next. In the Authentication Method window, select the
second option Computer and user (Kerberos V5) and click Next. In the Protocol and
Ports window, in the Protocol type list, pick TCP, leave the Endpoint 1 part empty and
in the Endpoint 2 port, pick Specific ports and enter the port 3389 (this is different from
the rule we create for the DC, here we use endpoint 2) then click Next. Leave all profiles
checked and click Next. In the Name field, type Secure RDP to DCs and click Finish.
Close the Group Management Editor console.
18. Right-click on the start button and click Run. In the Run window, type mstsc and click
OK.
19. In the Remote Desktop Connection window, type DC01 and click Connect. And this…
…does not work Click OK and close the Remote Desktop Connection window.
You added SRV01 to the exception group, but you have not restarted! So, let's do that.
Username CONTOSO\Administrator
Password Pa$$w0rd
20. Right-click on the start button and click Run. In the Run window, type mstsc and click
OK.
21. In the Remote Desktop Connection window, type DC01 and click Connect. You will be
prompted for credentials. Which means it works! No need to enter credentials by the way.
You've just deployed an IPSec isolation policy for RDP. Pretty cool, eh? And simple!
If you want to do that in production for some of your critical servers, be very careful! For
example, if you RDP to a DC to configure the RDP restriction, you might just cut your access!
So scope the policy in such a way you can disable it if you made a mistake.
21. OPTIONAL: Right-click on the start button and click Run. In the Run window, type
wf.msc and click OK. In the Windows Firewall with Advanced Security console, browse
Monitoring/Security Associations and click on Main Mode. You can see the IPSec
security associations currently active on your machine. You can double-click on it to
have the details.
22. Close all windows and sign out of SRV01.
23. Switch back to CONTOSO - DC01. Close all windows and sign out of DC01.
If you are about to take a break, make sure you save your labs before!
Note that you do not see all users here because of the limitations of the SuperScan tool which
targets the Users containers only. Other tools don't have this limitation.
You are the domain administrator of Contoso. You heard Peter bragging about his scanning tools
and you want to make sure anonymous enumerations of groups and users are not possible in
Contoso.
Username CONTOSO\Administrator
Password Pa$$w0rd
5. Right-click on the start button and click Run. In the Run window, type dsa.msc.
6. In the Active Directory Users and Computers console, click the View menu and make
sure Advanced Features is enabled. Then expand
contoso.com/ForeignSecurityPrincipals and double-click on S-1-5-7.
7. In the S-1-5-7 Properties window, click the Member Of tab and remove all current
membership and click OK.
Peter was able to remotely list users anonymously because the ANONYMOUS LOGON security
principal was in the Pre-Windows 2000 Compatible Access group.
8. If necessary, log back on to CONTOSO - SRV01 using Peter's credentials (the session
should still be on).
9. On the SuperScan 4.1 window, click Enumerate. You should see that it returns
nothing…
If you are about to take a break, make sure you save your labs before!
D. Clear-text passwords
Scenario
You are Norma, the newest addition to the identity and security team of Contoso. A recent audit
revealed that some applications are sending clear-text passwords to authenticate over LDAP.
They all use a load balancer for which a DNS record was created back in the days:
ldap.contoso.com. It's not good. But you told your AD team and they don't seem to be too
concerned about it because they trust the network. The application servers are in a trusted and
secured physical location. It is hard to intercept these clear-text credentials unless you are able to
physically access the switches and capture the network there. It's time to gear up and show the
risks!
Username CONTOSO\NormaLuser
Password Pa$$w0rd
Make sure you typed the value of the ms-Mcs-AdmPwd before continuing.
4. Right-click on the start button and click Windows PowerShell (Admin) (the admin one).
When prompted, enter the following credentials:
Username WIN10\LocalAdmin
Password <LAPS>
netsh int portproxy is opening a local port (here TCP 389) on your machine and
sending the traffic it receives somewhere else (here back to the domain controller:
10.0.0.10).
7. In the PowerShell console not running as Admin, run nslookup ldap.contoso.com. This
returns the IP address of the domain controller.
8. In the same console, type and run C:\Tools\DNS\Steal-LDAPRecord.ps1. The output will
just be a bunch of numbers. Then run nslookup ldap.contoso.com. This returns the IP
address of WIN10.
This DNS record take over is possible only because the zone is enabled for both secure and
unsecure dynamic update. Big mistake here…
10. In the PowerShell console running as Admin, run & 'C:\Program Files\Microsoft
Network Monitor 3\netmon.exe'. This launches Netmon. In the Microsoft Update
Opt-In window, click No. Then click New capture. Click Capture Settings. In the
Current capture filter field, type tcp.port==389, then click on Apply and then Close.
Then click Start.
Here is a summary of the clicks:
11. Let it run for 5 minutes. In the meantime, you can talk about DNS security with your
instructor. As soon as you see this:
12. In the Frame summary section, select the LDAP Message:Bind Request, MessageID: 1.
Then in the Frame details section, browse LDAP Message:Bind Request, MessageID:
1/Bindrequest: Version 3,… you will see the password in the clear.
And because we are redirecting the traffic back to the DC, the application is not broken and did
not figure out we got the password. Sneaky…
Username CONTOSO\Administrator
Password Pa$$w0rd
2. Right-click on the start button and click Run. In the Run window, type gpmc.msc and
click OK.
Then click Back up and once the backup is over, click OK.
4. Open File Explorer and browse to D:\. Double-click on the executable PolicyAnalyzer.
5. Check the Local policy box and click Add…. In the Policy File Importer click File then
Add files from GPO(s). Browse to C:\Tools\GPO and click Select Folder. Then click
Import. Save the policy rule file under C:\Tools\GPO, call it Default DC Policy and
click Save.
6. Back in the Policy Analyzer window, click on the Policy Rule sets in path
C:\Users\Administrator.CONTOSO\Documents\PolicyAnalyzer (there is no button,
just click on the grey field where the path is written). Change the path to C:\Tools\GPO
and click Select Folder.
7. Click Add…. In the Policy File Importer click File then Add files from GPO(s). Browse
to D:\Baselines2016\GPOs\{37BBB33A-A159-427D-AD58-67B1BE126AD6} and click
Select Folder. Then click Import. Save the policy rule file under C:\Tools\GPO, call it
Baseline and click Save.
8. Back in the Policy Analyzer window, click the Default DC Policy on the list (both must
be checked now) and click View/Compare.
9. In the Policy Viewer window, click View then Show only Differences.
10. In the list, look for the Policy Setting called LDAPServerIntegrity. Look at the different
settings and discuss them with your instructor.