From Windows VPN + Kali VPN + DC

In this scenario, I will demonstrate how I can get connectivity to the Domain Controller via a local Windows machine + access a KALI with VPN and finally the Domain Controller.

Scenario

We have the following scenario in a red teaming assessment:

  • Windows local machine (e.g., CommandoVM) authenticated with VPN into the target infrastructure.

  • A kali machine is accessible through VPN on the target infrastructure. This machine talks with the Domain Controller. We can use the Windows VM to execute programs and Powershell commands within the context of a domain user.

In sum, we can authenticate with the Windows VM into the Kali and forward all the traffic to the Domain Controller. Using an openvpn on the Kali, we can achieve this goal in a highly restricted environment.

Windows VM - Connecting via VPN

Install OpenVPN Kali Linux

After the installation, ensure that all the certificates were generated and are in place:

After generating all the files, the "ca.crt", "client.crt" and "client.key" must be zipped and copied into the Windows VM to add them to the ovpn config file as follows:

Windows OpenVPN

Install the OpenVPN. Before connecting ensure that:

  • Connection to the target environment was achieved (Windows VM Connecting via VPN above)

  • Create an SSH tunnel on port: 1194 from the Kali machine available on the internal network

Configurations Kali

On the kali through SSH connection above ensure that IP tables are in place, e.g.:

This command configures network address translation (NAT) using iptables, a utility for configuring the Linux kernel's firewall. Let's break down the command:

  • iptables: This is the command-line utility used to configure the Linux kernel's firewall.

  • -t nat: This option specifies the table within iptables that we are working with. In this case, it's the NAT table, which is responsible for Network Address Translation.

  • -A POSTROUTING: This option appends a rule to the end of the POSTROUTING chain. This chain is used for packets that are about to be sent out of the system.

  • -s 10.8.0.0/24: This specifies the source IP addresses that match the rule. Here, it's set to the subnet 10.8.0.0/24, meaning all IP addresses from 10.8.0.1 to 10.8.0.254.

  • -o eth0: This specifies the outgoing network interface. In this case, it's eth0, which is a common network interface name on Linux systems.

  • -j MASQUERADE: This is the action to take if the packet matches the rule. Here, it's set to MASQUERADE, which means that the source IP address of the packet will be replaced with the IP address of the outgoing interface (eth0). This is commonly used for NAT when sharing internet access with multiple devices in a private network.

and

  • net.ipv4.ip_forward: This kernel parameter determines whether the system forwards IPv4 packets between network interfaces. When set to 1, it enables IP forwarding, allowing the Linux system to act as a router, forwarding packets between different network interfaces.

Finally, start the openvpn server as follows:

Server config is something like this:

Connecting OpenVPN Windows

ovpn file can be imported into the OpenVPN client by doing: Import > Import File > (select file)

and ... gotcha!

Test Connection

If we can't reach it, we need to adjust probably the Windows routes to connect with the Domain Controller:

Last updated

Was this helpful?