HTB CAPE study materials
HTB CAPE study resources

The Dual-Homed Server With Only WinRM Open

HTB CAPE · Put your knowledge to work in context.

All case studies

The Dual-Homed Server With Only WinRM Open

You have local administrator on APP01, a dual-homed Windows Server 2019 host. NIC1 is on 10.10.10.0/24, the compromised staging network; NIC2 is on 10.20.20.0/24, a restricted server VLAN. Your Linux attack host can reach only APP01 at 10.10.10.15 and cannot route to 10.20.20.0/24. From APP01, TCP 445 and 3389 are blocked outbound to the server VLAN, but TCP 5985 (WinRM) and 443 are allowed. You have the local administrator NTLM hash for APP01 and a domain user CORP\appsvc whose password you know. appsvc is a member of Remote Management Users on SQL01 in the server VLAN but is not a local admin there. EDR on all servers alerts on service creation and named-pipe creation. You need to reach SQL01 and run commands without deploying a commercial C2. You have three hours and cannot modify firewall rules.

1. Compare three pivots: netsh portproxy, an SSH tunnel, and WinRM from APP01. Which do you choose and why?

Read the worked answer

I would choose WinRM from APP01. The firewall already permits 5985 from APP01 to the server VLAN, and appsvc is in Remote Management Users on SQL01, so a native PowerShell remoting or winrs session from APP01 to SQL01 uses an existing service and an allowed protocol. A netsh portproxy on APP01 would also work technically, but it changes host configuration and may be logged; it is unnecessary because I do not need to expose SQL01 back to the Linux attack host. An SSH tunnel would require an SSH server on APP01 and a listener, which adds attack surface and likely fails because no SSH service is mentioned. I would not use a commercial C2 because of the explicit constraint and EDR. The decision is driven by permitted egress, the existing WinRM authorization for appsvc, and the requirement to avoid service creation. If WinRM from APP01 is blocked by local policy, portproxy is the fallback, not the first move.

2. How do you execute commands on SQL01 without triggering service-creation or named-pipe alerts?

Read the worked answer

Use WinRM's native remoting rather than psexec, smbexec, or wmiexec, because those create services or named pipes that EDR is watching for. From APP01, start a session to SQL01 as appsvc with Enter-PSSession or Invoke-Command over 5985. Keep the commands simple and native: whoami, hostname, net localgroup administrators, and file listings. Avoid uploading binaries and avoid invoking encoded PowerShell. If PowerShell remoting is restricted, use winrs with the same credentials; winrs still uses WinRM and does not create a service. Do not attempt SMB or RDP because they are blocked and would generate failed-connection noise. If appsvc is not a local admin on SQL01, the session will be low-integrity; that is acceptable for the first step. Use it to enumerate local configuration and look for a controlled escalation path, rather than immediately attempting privileged operations that EDR may flag.

3. What if appsvc can authenticate but SQL01 denies the WinRM session? What is your fallback and what should you not do?

Read the worked answer

If authentication succeeds but the session is denied, I would check whether appsvc is actually in Remote Management Users on SQL01, whether WinRM has an explicit allow list, and whether the WinRM listener is bound to the expected IP. A domain account is not subject to the local-account UAC remote restriction, so that is not the first suspect. The fallback is a limited netsh portproxy on APP01 using the local admin context, forwarding a high local port to SQL01:5985, then connecting from the Linux host to APP01 on that port. That preserves the allowed protocol but changes APP01 configuration, so it should be time-boxed and documented. I would not attempt SMB or RDP scans; they are blocked and noisy. I would not create a service or scheduled task on SQL01 to bypass WinRM, because EDR explicitly alerts on service creation and it violates the low-noise constraint. If no allowed path works, report the blocker rather than escalating noise.