100% found this document useful (1 vote)
117 views2 pages

Pivoting Techniques in Network Security

Uploaded by

arthurquamena
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
117 views2 pages

Pivoting Techniques in Network Security

Uploaded by

arthurquamena
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Pivoting

Overview
Pivoting basically means moving from one network to another network through a
box/machine we have already compromised, a network that was previously not available to
us.
Let's say we compromise a machine with the IP [Link] but when we open an
interface we notice the machine has another IP [Link] which means there is another
network the machine is on.
What can do here is setup a proxy which we can pivot to get into the network.
There are several tools that can help us with this.

Lab
Proxy Chain
So, for Proxy Chains, the first thing we have to do is open the configuration file

$ cat /etc/[Link]

At the very end it shows an IP and a port number, and this is the port we are going to bind
to.
Points to note, you can always update the port number, for instance once you have a pivot
and you want to establish another pivot or if your port breaks, you can just update it.

To start with the pivoting, we use this command

$ ssh -f -N -D 9050 -i pivot root@[Link]

Let's break it down:

ssh : This is the command-line utility for securely connecting to a remote server or
computer. It's widely used for logging into and executing commands on a remote
machine.
-f : This flag tells SSH to go into the background just before it executes the command.
It's often used when you want to run SSH in the background without having it take over
your terminal.
-N : This flag tells SSH not to execute any remote commands. It's used when all you
want to do is set up port forwarding, without running any commands on the remote
server.
-D 9050 : This specifies dynamic port forwarding. It tells SSH to listen on port 9050 on
the local machine and forward all traffic through the SSH connection to the remote
server. This effectively sets up a SOCKS proxy on port 9050 .
-i pivot : This specifies the identity (private key) file to use for authentication. In this
case, it's using a private key file named pivot to authenticate with the remote server.
This is typically used instead of password authentication for better security.
root@[Link] : This is the username ( root ) and hostname ( [Link] ) of the
remote server you're connecting to. It's the server where the SSH tunnel will terminate.
Here, root is the username, and [Link] is the IP address of the server

Once you've been able to establish ssh you can do all sorts of things using proxy chains

$ proxychains nmap -p88 [Link] - This is to scan Kerberos port 88 on the DC


$ proxychains nmap [Link] - This is to scan for the 1st 1000 open ports
$ proxychains nmap [Link] -sT - To run a TCP connect scan instead of SYN
scan
$ proxychains [Link] [Link]/fcastle:Password1 -dc -ip
[Link] -request - This is a classic Kerberos attack with proxy chains
$ proxychains xfreerdp /u:administrator /p:'Hacker321!' /v:[Link] -
We can use this to rdp into the domain controller! Amazing!
$ proxychains firefox - You can start firefox in proxy chain! Amazing!

Sshuttle
We can install this tool with

$ sudo pip install sshuttle

After installation we can initialize it with

$ sshuttle -r root@[Link] [Link]/24 -ssh-cmd "ssh -i pivot"

Once we are connected to the server, we can run any command

Common questions

Powered by AI

ProxyChains contributes to network exploration by allowing the redirection of network traffic through multiple proxy servers, thus concealing the origin of the traffic and bypassing network restrictions. It requires configuration by editing the proxychains configuration file with the desired IP and port settings. Commands using ProxyChains, such as 'proxychains nmap' for network scanning or 'proxychains xfreerdp' for remote desktop sessions, leverage its capabilities to penetrate deeper into the network via the established proxies .

Using both sshuttle and proxy chains together would be recommended in scenarios requiring versatile and stealthy network exploration. Sshuttle can be employed to establish a VPN-like connection to a remote subnet, allowing transparent access to services, while ProxyChains can further tunnel specific applications through additional proxies, enhancing anonymity and bypassing more layered security measures. This combination is ideal for complex network penetration tests where both broad and granular access control, as well as the ability to switch easily between direct and proxied connections, is essential .

Sshuttle acts like a VPN, allowing for transparent proxying of TCP connections to a targeted network, effectively routing all traffic for specified IP ranges over an SSH connection. Unlike ProxyChains, which requires manual configuration of proxy settings for each application, sshuttle automatically captures sockets and redirects traffic without additional app-level configuration. It offers simplicity and ease of use by managing the SSH connection and traffic routing under a single command .

Leaving proxy chains or SSH tunnels open and unattended poses significant security risks, as they can be exploited by unauthorized users to gain access to internal networks or sensitive information without detection. Attackers could hijack the open sessions to launch further attacks, exfiltrate data, or establish persistent access. Additionally, these unsecured connections might unintentionally expose critical network resources to external threats, compromising the integrity and security of the entire infrastructure .

Using RDP over proxy chains allows secure remote access to systems within a restricted network environment, providing the ability to administer or extract data from a remote machine. This method is practical for bypassing firewalls and maintaining anonymity. However, limitations include increased latency due to traffic routing through multiple proxies, potential instability in connection quality, and the necessity of proper configuration to ensure secure and reliable sessions, which can become complex and resource-intensive .

A Kerberos attack using proxy chains involves exploiting the Kerberos authentication protocol to obtain sensitive data such as Service Principal Names (SPNs) from a target domain. This is done using tools like GetUserSPNs.py, which extracts SPNs and credentials from the domain over a proxied connection, as in 'proxychains GetUserSPNs.py MARVEL.local/fcastle:Password1 -dc -ip 10.10.10.225 -request'. The implications of such an attack include unauthorized access to network services and potential privilege escalation within the domain, leading to a compromise of the entire network infrastructure .

SSH enhances security by encrypting the connection between the client and server, preventing eavesdropping and man-in-the-middle attacks. In the context of establishing a pivot, specific SSH options that are critical include '-f' for running in the background, '-N' to not execute remote commands and only set up the tunnel, '-D 9050' for dynamic port forwarding, and '-i pivot' to specify the private key for authentication, ensuring secure, authenticated communication without revealing passwords .

The primary purpose of pivoting in network security is to move laterally from one compromised network or host to another, which was previously inaccessible. This technique is often used by attackers to extend their access and explore deeper into a network. Tools that facilitate this process include using SSH for secure connections and port forwarding, ProxyChains for routing network traffic through a series of proxies, and Sshuttle for creating VPN-like connections on the fly .

Dynamic port forwarding in SSH, specified by the '-D' option, supports network pivoting by creating a SOCKS proxy on the specified local port. This proxy can route traffic dynamically to any desired IP address through the SSH connection, facilitating access to internal network services or devices not directly accessible from the attacker's point. Its advantages include automatic adaptation to different network environments, reducing the need for manual setup of each connection, and improving flexibility and security in network exploration .

Changing port numbers can impact the effectiveness of proxy chains by potentially bypassing network firewalls or security policies that monitor or restrict traffic on certain ports. However, this requires careful consideration of network architecture and security measures, ensuring that the chosen ports are not blocked or explicitly monitored for suspicious activity. Additionally, the new configuration must be compatible with both the client application and network environment, maintaining the integrity and security of the proxy chain .

You might also like