Network Attacks
Authentication Cracking
A similar approach to cracking a password can be used for every service requiring network authentication as: ssh
, telnet
, remote desktop, HTTP authentication, etc.
Brute Force vs Dictionary Attacks
Performing pure brute force attacks over a network are very impractical because of the time needed to run each probe:
Network latency.
Delays on the attacked service.
Processing time on the attacked server.
Network authentication cracking relies almost entirely on dictionary-based attacks, using dictionaries of common and default usernames and passwords
Hydra
Fast, parallelized, network authentication cracker that supports different protocols: Cisco auth, FTP
, HTTP
, IMAP
, RDP
, SMB
, SSH
, Telnet
...
Windows Shares
Ability to:
Enumerate network resources.
Attack Windows sessions.
Obtain unauthorized access to Windows resources.
Windows' filesharing can be exploited via NetBIOS (Network Basic Input Output System):
Allows servers and clients to view network shares on a local area network.
It can supply some of the following information while querying computers: Hostname, NetBIOS name, Domain, Network shares.
NetBIOS sits between the application layer and the IP layer (NetBIOS over TCP/IP).
UDP is used to perform name resolution and to carry other one-to-many datagram-based communications (like send small messages to the rest of the other hosts).
TCP is used for heavy traffic, as copying files over the network, using NetBIOS sessions.
MS Windows browses the network using NetBIOS to:
Datagrams to list the shares and the machines.
Names to find workgroups.
Sessions to transmit data to and from a Windows share.
Shares
An authorized user can access shares by using UNC Paths (Universal Naming Connection Paths:
Badly configured shares exploitation can lead to:
Information disclosure.
Unauthorized file access.
Information leakage used to mount a targeted attack.
Null Sessions
Null session attacks can be used to enumerate a lot of information: Passwords, System users, System groups, Running system processes.
Remotely exploitable.
Nowadays Windows is configured to be immune to this kind of attack.
Applicable to legacy systems.
Exploits an authentication vulnerability for Windows Administrative Shares, lets an attacker connect to a local or remote share without authentication.
Enumerating shares is the first step needed to exploit a Windows machine vulnerable to null sessions.
Tools
nbstat
: windows cmd tool that can display info about the target.nbstat -A <IP>
: displays info about a target.
ELS-WINXP
: name<00>
: workstationUNIQUE
: this computer must have only one IP address assigned<20>
: file sharing service is up and running on the machineOnce an attacker knows that a machine has a 'File Server' service running, they can enumerate the shares by using
net view
:
Share enumeration from a Linux Machine is provided by the Samba suite.
nmblookup -A <target ip address>
gets the same results asNET VIEW <target_IP>
.
smbclient
also displays shares that are hidden when using Windows standard tools:
Once we have detected that the File and Printer Sharing service is active and we have enumerated the available shares on a target, it's time to check if a null session attack is possible. We can exploit IPC$
administrative share by trying to connect to it without valid credentials.
Checking for Null Sessions with Windows
To connect:
Exploiting Null Sessions with Enum
Checking password policies before running an authentication attack lets you fin-tune an attack tool to:
Prevent accounts locking
Prevent false positives
Choose your dictionary or your bruteforcer configuration (as knowing the min and max lengh of a password helps to save time)
Exploiting Null Session with Winfo
Automates null session exploitation.
Use with -n
to tell the tool to use null sessions
Exploiting Null sessions with Enum4linux
A PERL script that can perform the same operations of enum
and winfo
, supplying some other features:
User enumeration
Share enumeration
Group and member enumeration
Password policy extraction
OS info detection
A nmblookup run
Printer information extraction
Use samba in Kali:
ARP Poisoning
If an attacker finds a way to manipulate the ARP cache, then the attacker will also be able to receive traffic destined to other IP addresses.
Goals
Perform MITM attacks.
Mount advanced attacks.
Sniff traffic on a switched network.
The attacker can manipulate other hosts' ARP cache tables by sending gratuitous ARP replies.
Gratuitous ARP replies = ARP reply messages.
The attacker exploits gratuitous ARP messages to tell the victims that they can reach a specific IP address at the attacker's machine MAC address.
The operation is performed on every victim.
As soon as the ARP cache table contains fake info, every packet of every communication between the poisoned nodes will be sent to the attacker's machine.
The attacker can prevent the poisoned entry from expiring by sending gratuitous ARP replies every 30 seconds or so.
This kind of attack can be used on an entire network and against a router, letting the attacker intercept the communication between a LAN and the internet.
Dsniff Arpspoof
Collection of tools for network auditing and penetration testing, including arpspoof
, designed to intercept traffic on a switched LAN. arpspoof
redirects packets from a target host (or all hosts) on the LAN intended for another host on the LAN by forging ARP replies.
Before running the tool, you have to enable the Linux Kernel IP Forwarding, a feature that transforms a Linux box into a router. By enabling IP forwarding, you tell your machine to forward the packets you interecept to the real destination host:
Metasploit
Metasploit is an open-source framework used for penetration testing and exploit development, giving a wide array of community contributed exploits and attack vectors that can be used against various systems. Extensible.
Basic workflow:
Identifying a vulnerable service.
Searching for a proper exploit for that service.
Loading and configuring the exploit.
Loading and configuring the payload you want to use.
Running the exploit code and getting access to the vulnerable machine.
A payload is used by an attacker to get:
An OS Shell.
A VNC or RDP connection.
A Meterpreter shell.
The execution of an attacker-supplied application.
A special payload, with many useful features under the penetration testing point of view is meterpreter
.
Meterpreter
Goals
Get a powerful shell on an exploited machine
Take control over an exploited machine
Install backdoors
Provides advanced features to:
Gather information.
Transfer files between the attacker and victim machines.
Install backdoors and more.
meterpreter
can both wait for a connection on the target machine or connect back to the attacker machine.A Meterpreter session is an advanced shell on the target machine.
Most used configurations are:
bind_tcp: runs a server process on the target machine that waits for connections from the attacker machine.
reverse_tcp: performs a TCP connection back to the attacker machine (helping to evade firewall rules).
Inside a msfconsole
:
Shells
Simple php shell:
Reverse Shell is the most common one we'll use:
msfvenom
Last updated