Saturday, November 28, 2009

Net Bios Null Sessions

The null session is often refereed to as the Holy Grail of Windows hacking. Null Sessions take advantage of flaws in the CIFS/SMB (Common Internet File System/ Server Messaging Block).
You can establish a Null Session with a Windows (NT/2000/XP) host by logging on with a null user name and password.
Using these null connections allows you to gather the following information from the host:
List of users and groups
List of machines
List of shares
Users and host SIDs (Security Identifiers)
Anyone with a NetBIOS connection to your computer can easily get a full dump of all your usernames, groups, shares, permissions, policies, services and more using the Null user.
The above syntax connects to the hidden Inter Process Communication 'share' (IPC$) at IP address 192.34.34.2 with the built- in anonymous user (/u:'''') with ('''') null password.
The attacker now has a channel over which to attempt various techniques.
The CIFS/SMB and NetBIOS standards in Windows 2000 include APIs that return rich information about a machine via TCP port 139 - even to unauthenticated users.
C: \>net use \\192.34.34.2 \IPC$ '''' /u: '''‘
Null sessions require access to TCP 139 and/ or TCP 445 ports.
You could also disable SMB services entirely on individual hosts by unbinding WINS Client TCP/IP from the interface.
Edit the registry to restrict the anonymous user.
1. Open regedt32, navigate to HKLM\SYSTEM\CurrentControlSet\LSA
2. Choose edit | add value
value name: ResticAnonymous
Data Type: REG_WORD
Value: 2
NBTscan is a program for scanning IP networks for NetBIOS name information.
For each responded host it lists IP address, NetBIOS computer name, logged-in user name and MAC address.
The first thing a remote attacker will try on a Windows 2000 network is to get list of hosts attached to the wire.
1. net view / domain,
2. nbstat -A
DumpSec reveals shares over a null session with the target computer.
The NetBIOS Auditing Tool (NAT) is designed to explore the NetBIOS file-sharing services offered by the target system.
It implements a stepwise approach to gather information and attempt to obtain file system-level access as though it were a legitimate local client.
If a NETBIOS session can be established at all via TCP port 139, the target is declared "vulnerable“.
Once the session is fully set up, transactions are performed to collect more information about the server including any file system "shares" it offers.
SNMP is simple. Managers send requests to agents, and the agents send back replies.
The requests and replies refer to variables accessible to agent software.
Managers can also send requests to set values for certain variables.
Traps let the manager know that something significant has happened at the agent's end of things:
a reboot
an interface failure,
or that something else that is potentially bad has happened.
Enumerating NT users via SNMP protocol is easy using snmputil
Simplest way to prevent such activity is to remove the SNMP agent or turn off the SNMP service.
If shutting off SNMP is not an option, then change the default 'public' community name.
Implement the Group Policy security option called Additional restrictions for anonymous connections.
Access to null session pipes and null session shares, and IPSec filtering should also be restricted.
For clients to locate Win 2k domain services such as Ad and kerberos, Win 2k relies on DNS SRV records.
Simple zone transfer (nslookup, ls -d ) can enumerate lot of interesting network information.
An attacker would look at the following records closely:
1. Global Catalog Service (_gc._tcp_)
2. Domain Controllers (_ldap._tcp)
3. Kerberos Authentication (_kerberos._tcp)
You can easily block zone transfers using the DNS property sheet as shown here.

TRACERROUTE

Traceroute works by exploiting a feature of the Internet Protocol called TTL, or Time To Live.
Traceroute reveals the path IP packets travel between two systems by sending out consecutive UDP packets with ever-increasing TTLs .
As each router processes a IP packet, it decrements the TTL. When the TTL reaches zero, it sends back a "TTL exceeded" message (using ICMP) to the originator.
Routers with DNS entries reveal the name of routers, network affiliation and geographic location.

Locate the Network Range

Commonly includes:
Finding the range of IP addresses
Discerning the subnet mask
Information Sources:
ARIN (American Registry of Internet Numbers)
Traceroute
Hacking Tool:
NeoTrace
Visual Route

NSLOOKUP

Nslookup is a program to query Internet domain name servers. Displays information that can be used to diagnose Domain Name System (DNS) infrastructure.
Helps find additional IP addresses if authoritative DNS is known from whois.
MX record reveals the IP of the mail server.
Both Unix and Windows come with a Nslookup client.
Third party clients are also available – E.g. Sam Spade

Information Gathering Methodology

Unearth initial information
Locate the network range
Ascertain active machines
Discover open ports / access points
Detect operating systems
Uncover services on ports
Map the Network

Defining Footprinting

Footprinting is the blueprinting of the security profile of an organization, undertaken in a methodological manner.
Footprinting is one of the three pre-attack phases. The others are scanning and enumeration.
Footprinting results in a unique organization profile with respect to networks (Internet / Intranet / Extranet / Wireless) and systems involved.

RECONNAISSANCE


Reconnaissance refers to the preparatory phase where an attacker seeks to gather as much information as possible about a target of evaluation prior to launching an attack.
It involves network scanning either external or internal without authorization.

ETHICAL HACKING INTRODUCTION


¤Reconnaissance
Active / passive
¤Scanning
¤Gaining access
Operating system level / application level
Network level
Denial of service
¤Maintaining access
Uploading / altering / downloading programs or data
Covering tracks