Lecture 2 Security
Lecture 2 Security
Carrier- Frames ( Data Link Layer carries frames instead of packets, While Layer 1 carries bits)
Multiplexing (Muxing of data, error checking, error correction performed on Data Link Layer)
Ethernet Protocol mostly used protocol (IEEE802.3) but not only protocol on Layer-2
ATM (Asynchronous Transfer Mode) and SDH (Synchronous Digital Hierarchy), SONET
(Synchronous Optical Network) SONET American Standard and SDN ITU Standard, Layer 2
had some interesting Issues,
Point-to-Point Protocol (PPP)
Ethernet
Originally a shared medium (10BASE5 coax)
•Developed at Xerox in 1973/4
•Competing with Token Ring and Token Bus
•Hubs – 'dumb' electrical repeaters (Hubs are dumb devices and works like electrical repeaters
for amplification of signals)
Then bridges
•...Then multi-port bridges (Switches)
•...Then nothing but switches – today
Ethernet Attacks
Shared medium – everyone sees your packets (like wireless) Only in Hubs
• Switches prevent this... but...
• Switches have a Content Addressable Memory (CAM) table, Store ethernet Media
Access Control addresses (MAC addresses) and what physical port they are on
• Fill the CAM table (by MAC spoofing or unknown bogus MAC addresses)
• Switch acts like a hub for new addresses
• Poisoning CAM table , which leads to MAC Flooding (by Over Flow MAC Table)
Interpretation of data
•Difficult – so much of it – and what does it mean?
Definition - Data analysis and interpretation is the process of assigning meaning to the collected
information and determining the conclusions, significance, and implications of the findings [1]
•You can't look at everything
•Automated systems might help … but ...
•Tuned too sensitive and you'll still be overwhelmed
•Tuned the other way, and you'll miss things
•Too many alerts means you'll ignore them [1]
•Bottom line - you need to know your network and know what is 'normal' before you know
what 'abnormal' is
•Monitoring and Detection (NIDS)
•Made worse when you take the output of automated systems and use them to block/allow
traffic
Preventing spoofing
•Everyone should “BCP38” http://tools.ietf.org/html/bcp38
•You should only let packet exit your network that have valid source addresses
•Might seem obvious but few do it
•Why?
Wi-Fi
IEEE Frequency/Medi Transmission Access
Speed Topology
Standard um Range Method
1 to Ad
802.11 2.4GHz RF 20 feet indoors. CSMA/CA
2Mbps hoc/infrastructure
25 to 75 feet
Up to Ad indoors; range can
802.11a 5GHz CSMA/CA
54Mbps hoc/infrastructure be affected by
building materials.
Up to 150 feet
Up to Ad indoors; range can
802.11b 2.4GHz CSMA/CA
11Mbps hoc/infrastructure be affected by
building materials.
Up to 150 feet
Up to Ad indoors; range can
802.11g 2.4GHz CSMA/CA
54Mbps hoc/infrastructure be affected by
building materials.
Up to 175+ feet
Up to Ad indoors; range can
802.11n 2.4GHz/5.4GHz CSMA/CA
600Mbps hoc/infrastructure be affected by
building materials.
. Wi-Fi is simply a trademarked term meaning IEEE 802.11x (x here means the specific standard
like 802.11ab, there is no 802.11x standard exist ☺ )
.Does not stands for “Wireless Fidelity”
. IEEE 802.11x Standards
WEP
•The first go at security - encrypts transmitted data
• WEP's major weakness is its use of static encryption keys.
•A 'broken' protocol
•With an 'active' attack
•Where packets are solicited from the access point
•104-bit WEP key, probability of being broken - 50%, with 40,000 captured packets
•95% of cases, 85,000 packets
•ie. Less than 60 seconds at 802.11g speeds
•Don't use it.
Rogue AP
•eg: I bring an access point into Swinburne's grounds
•Configure it with ssid `eduroam` (or 'freeWiFi')
•Attempt to lure Swinburne students to use it
•Sniff their packets as they go past
•802.1x will prevent this from working though (you will learn more about this in lecture 7)
•OR
•eg. I, a staff member, bring an access point into Swinburne
•Plug it into my desk port, because I want better wifi in my office
•I don't secure it
•Now anyone can connect to this AP and be 'inside' Swinburne's network
Detecting Rouge AP Attacks
Whitelist all legitimate access points by bssid and MAC address
• Evil Twin attack - Still attackers can spoof both bssid and MAC and become an Evil Twin of
the legitimate AP Detection - Hard
• In an Evil Twin scenario, pay attention to signal strength. Place wireless sniffer spread across
the network. Baseline signal strength between sniffer and legitimate AP.
• When Evil Twins are established, signal strength will deviate from baseline.
• Karma attack – Sophisticated Rouge AP attack
• Rouge AP listens for probe requests from nearby WiFi clients and responds to all probe
requests.
WiFi Client A: hey “Swin WiFi” are you there ?
Rouge AP: yes am here, am “Swin WiFi”
WiFi Client B: hey “Starbucks WiFi” are you there ?
Rouge AP: yes am here, am “Starbucks WiFi”
• De-authenticate legitimate WiFi network, While the clients are forced to Connect to the Rouge
AP
• Detection – Easy
• Send probe requests for a series of different ESSIDs. Single access point should not respond to
probe requests for multiple ESSIDs
• Legitimate access point receives huge traffic of De-authentication packets, Wireless Intrusion
Detection Systems (WIDS) will start alerting
Existing Soultions: Airwave (Aruba Networks), Fluke Networks (Analyzer Pro), Cisco
Aironet 600 series
How about Raspberry Pi with wireless Adapter?
Lecture 4 (Network Layer Security)
Layer 3 - the Internet starts here
Layer 3 and upwards, protocols are developed by IETF
• Internet Engineering Task Force [1] (part of the Internet Society (ISOC)) [2]
• (Do you remember who stand behind Ethernet?)
• Internet Protocol defined a packet switched network
• Original research ARPANET expanded into the Internet
• Defined in RFC791 – the document has still current status Internet Protocol, DARPA
INTERNET PROGRAM, Protocol Specification [1]
• Multiple independent interconnected networks
• The IP protocol implements two functions only
• addressing
• fragmentation
• Fully decentralized system
• Network operations are decentralized - neither central node nor network
Internetworking
• How to combine multiple networks together into one single
larger network?
• Connect a host on one network to another host on the other
network as though that was a single network
• Difficult as there are variety of data-link technologies
• IEEE 802.3 (Wired Ethernet), IEEE 802.11 (Wireless Ethernet),etc.
• Token-Ring, xDSL, etc.
• Frame-Relay, MPLS, etc.
• How they operate internally, e.g.:
• datagrams vs. virtual circuits (VCs)
• Addressing
• datagram size (MTU)
• Internet Protocol (IP) dominant solution for internetworking
• Exchange IP packets (datagrams) between hosts
otherwise we would have mandated a single layer2 technology
§ Routers connect networks and maintain routing tables
§ Network prefix
§ Next hop address, exit interface
§ Destination IP address matched against network prefix
§ Packets forwarded to the exit interface
IP addressing (IPv4)
(Recapitulation)
§ 32-bits per address
§ Written in dotted-decimal notation (common convention)
§ Four 8-bit decimal values separated by dots
123
01234567890123456789012345678901
aaaaaaaabbbbbbbbccccccccdddddddd (A.B.C.D)
11000000001100110110010000000001 (192.51.100.1)
IP prefixes (IPv4)
§ IP prefixes define blocks of addresses
§ Addresses in L-bit prefix have the same top L bits
§ There are 232-L addresses aligned on 232-L boundary
§ Written in address/length notation
§ Address is lowest IP address in the block, length is prefix bits
§ e.g. 192.51.100.0/24 represents a block from 192.51.100.0 to 192.51.100.255
Network portion Host portion
Prefix length = L bits 32 – L (bits) 32-bits
11111111111111111111111100000000
§ IP prefixes are useful for routing tables
§ Routers maintain routes in their routing tables
format: network prefix, next hop address and/or exit interface
§ IP addresses on one network belong to the same prefix
Packet forwarding
Packets are forwarded by routers
Routing tables determine where to forward each packet
Routing table contains routes:
Destination network prefix, next hop address/exit interface
Entries can be created by:
dynamic routing or static configuration
Internet IP addresses
§ Public addresses
§ Valid destination across the Internet (globally)
§ Must be assigned to before can be used (IANA - more in week 11)
§ Mostly exhausted, hence need for IPv6
§ Private addresses
§ Used freely on private networks (home or corporate)
§ Are separated from the Internet (good for security)
§ Require address translation (NAT) to access to the Internet
• 10.0.0.0/8
• 172.16.0.0/12
• 192.168.0.0/16
Spoofing packets
If one gains root access on a network host:
• can generate any packet
• even if it does not follow the protocol (makes no sense)
Details in the headers can be spoofed:
• packet's source IP address
• frame's source MAC address
Not effective when one wants to:
pretend to be another host (on the network)
pretend to be somewhere else (e.g. TCP)
Very effective to run Denial Of Service (DoS) attacks
Fragmentation
Layer 2 networks have different Maximum Transmission Unit
(largest packet size that can fit through the link)
Ethernet 1500bytes, WiFi 2300 bytes
§ Larger packet size results in greater efficiency
§ Host A does know the whole path to Host B
§ Routers fragment packet to fit through to the next hop
§ MF flag in IP header (if is set it says More Fragments to follow)
§ Routers in the path do not reassemble fragmented packets
§ Destination host needs to store them and wait for all
fragments before passing datagram on to the higher layer
§ What Host B will do one of the fragmented packets is lost?
§ What Host B do if one crafts a series of malformed packets with MF flag set?
Fragmentation as a security issue (1)
§ Host B needs to store fragments for a set time
§ It will take resource at the host (e.g. memory)
§ An attack can be mounted to exploit it
§ Linux Kernel has some ipv4 variables to control reassembly
§ ipfrag_time, ipfrag_high_thresh, ipfrag_low_thresh, ipfrag_max_dist
§ Examples of IP fragmentation exploits:
§ Tinny fragment attack
§ Fragment overlap attack
§ (research fragrouter toolkit for more details)
§ Also useful to penetrate firewalls, evade IDS/IPS
§ Best practise: drop all fragmented packets at the firewall…
§ and enforce connecting hosts to use MTU Path Discovery mechanism
Questions:
Internet Protocol (IP) provides two essential functions for internetworking: addressing and
fragmentation.
§ Explain why was it necessary to introduce packet fragmentation in this internetworking
protocol?
§ Outline how this mechanism in implemented in IP networks?
§ Explain: what particular security issue does this fragmentation mechanism introduce; and how
network hosts should be protected against attacks exploiting fragmentation?
§ Discuss what method has been implemented in modern operating systems to overcome
fragmentation mechanism?
Lecture -5
Ports
A port is a endpoint of communication, where a specific service/process can be identified
Port number is a 16 bit unsigned integer, ranging from 0 to 65535 (Source Port/Destination Port:
every application on application layer assigned a port for IP packet that traverse from application
layer to bottom layer)
Services
A network based application service/process that runs on a specific port can be client/server or
P2P. Well Known port numbers 0-1024
http: 80
https: 443
DNS: 53
SSH: 22
Can SSH server run on a different port ?
SSH is by default configured to listen to port 22 and only on port 22. You can configure your
SSH server to run on other ports, and extending the same method allows you to configure
your SSH server to run on more than one port.
Protocols
Protocols defines the rules/semantics of communication method in networks Layer 4 Protocols
• Transmission Control Protocol (TCP)
• User Datagram Protocol (UDP)
There are more protocols on other layers
• Routing
• File Transfer
• Bluetooth
• Automation
• …… and more
TCP
Connection oriented Protocol, 3 way handshake (SYN, SYN+ACK, ACK)
• Used where reliability, Order of packet arrival and error-check is important
• Email, File Transfer (Use TCP for transportation of Data)
(Sender node send SYN message to Received node to establish a connection, Received node
sends back SYN+ACK message to sender node in response and Sender node again sends ACK
message to Receiver node and connection is established)
Defense Against Protocol Security issues (Use Secure Protocols like HTTPS,
FTPS)
• Encrypted Protocol medium – SSl , SSH, VPN
• Use Cryptographically random ISNs
• Firewalling, ACLs
Still does not prevent against Denial-of-Service attacks
Firewalls (static)
•Bit-level rules applied to headers then...
•Allow
OR
•Deny (& log)
•Silently
or
•ICMP “Destination unreachable” sent to source
•Separate rules must be written for incoming and outgoing traffic flows.
Firewalls (dynamic)
•Bit-level rules applied to packets &
•Layer 4 (TCP, UDP) state taken into account
•For example
•An out-bound packet to a web server, from an internal client
•Return packets are automatically allowed
•(with a rule time-out)
•But an inbound packet without the corresponding outbound packet
•Block
Before DNS
•“host” file
•Transferred between machines [1]
•This did not scale
[1] L. Peter Deutsch, RFC606, "Host Names Online", Dec 1973
Now that we finally have an official list of host names, it seems about time to put an end to the
absurd situation where each site on the network must maintain a different, generally outofdate,
host list for the use of its own operating system or user programs.
For example, each of the TENEX
( SRIARC, BBNTENEX, USCISI,
different mapping between host sites to which and PARCMAXC) names and host
I have access has a slightly addresses: none
is complete, and I believe each one differs in some way from the official List. [1]
hosts.txt
•It is most likely you still have a hosts file on your device
•Can be used for your own entries
•Still operating systems check hosts file first before DNS.
•Also can be used to re-direct you unknowingly
•Some viruses modify your hosts file
•www.bank.com now maps to the wrong IP
(when you open a site, provides URL, system checks it own host.txt file for name resolution and
if not found then contact to DNS server. Some Viruses modify these host files and send you on
wrong website)
DNS
•1984/5 (continued development)
•Human-readable names to IP addresses (& vice-versa)
•Various record types can be returned
Field Description
A (Address) Maps host names to IP addresses, Identifies an IPv4 Host Address
CNAME (Canonical
An alias for an A record
Name)
MX (Mail
Identifies an Email server
Exchange)
PTR (Pointer) Maps IP addresses to host names.
AAAA Identifies an IPv6 Host Address
SRV Identifies a service in the domain
Conclusion:
•DNS is critical
•Control the DNS, control what people see
•It is still a shared delusion though
•You could setup your own root servers and start
your own system
•Put in any entries you want, pointing anywhere you want
•Would anyone use your servers?
•Who knows, but no one will stop you.
DNSSEC
•DNS responses digitally signed
•So a chain of trust can be created back to the root
•Note: not full encryption
•An interceptor can still see what you are querying for
•Still not widely deployed
•Fully defined, software exists
•So I suspect it will be soon
•There is the small issue of no indication of DNSSEC usage to the user in most applications, yet
•Remember
•One piece of the puzzle
•Does not stop any other exploits
•You can run DNSSEC but still have your website defaced... get infected...heartbleed… etc
•Partial deployment is possible
•You main DNS server could be doing secure
lookups externally
•Returning insecure responses to your DNSSEC
unaware clients inside your network
•Better than nothing?
•Partial deployment is possible
•You main DNS server could be doing secure
lookups externally
•Returning insecure responses to your DNSSEC
unaware clients inside your network
•Better than nothing?
Questions
• When an nmap scan for operating system detection is complete. Based on the scan
results how is it able to predict the target operating system ?
• Can Nmap scan detect a new operating system not commercially known ?
Forward proxy
• SSL offload:
• terminating secure connection (optionally opens new secure connection)
• clear-text connection between proxy and servers
• Encryption process not need to be done by servers
• Load balancing
• no need to separate sessions for each client (proxy multiplexing connections)
SOCKS (Proxy)
SOCKet Secure (SOCKS)
• Network protocol at Session Layer
• application neutral and terminate any TCP stream
• Client software need to support SOCKS
• any modern will support it
• Original SOCKS4 protocol had no authentication
• SOCKS Protocol 5 extends SOCKS4 protocol
• Includes authentication
• Supports IPv6
• Relays UDP packets (e.g. to perform DNS lookups)
Web applications
Software offering services on the Internet using
Web technologies (application layer):
• virtually any digital device has a web browser,
• users not need to install software on the client end,
• growing machine-to-machine communication;
Potential threats:
• Open to the Internet – inherently untrusted network
• Developer not following best coding techniques
They might be the cheapest for a reason
• Deliver an application full of what we have just discussed
How do we provide additional security...?
ModSecurity
• loadable module to Apache HTTP Server
• Provides an additional layer of security
• Acts as an application layer firewall
• Real-time web security monitoring and access control
• Full HTTP traffic logging
• Continuous passive security assessment
• Open source and Core Rule Set (CRS)
• Positive or Negative security model
• Negative : Don't allow X, Y and Z, allow all else
• Positive: Only allow A, B and C, deny all else
• Takes all input to an apache server and can block/allow/manipulate it based on your rules
• Signature based (can also do some basic threshold)
• The authors of the software suggested use:
a temporary fix for an exploit where there is no application patch yet
Can run in “reverse proxy” mode
A server “in front” of other web server(s) – 'protecting' them
A reverse proxy can be a good thing anyway
e.g.:
http://www.site.com/thing1/ -proxies through to
http://192.168.1.1
http://www.site.com/thing2/ -proxies through to
http://192.168.1.2
Scripts under /thing1/ get hacked – no problemsfor
192.168.1.2
•(But make sure the reverse proxy is not a
bottleneck, or a central point of failure)
DHCP
• Dynamic Host Configuration Protocol [1]
• Can be used for IPv4 or IPv6
• Originally not needed
• Computers never moved
• IPs manually, statically configured
• As number of hosts grow (and move)
• this does not scale
• Server / Client application
• Client gets a lease of an IP address for a period of time
• Can also transfer other useful information to hosts
• Default gateway
• DNS server
• NTP server
• Proxy server
• Works via broadcast frames
• Client: I'd like an address.
• Server: Here you go.
• DHCP relaying is possible
• A process picks up on the broadcast and relays it to
DHCP server as unicast
Benefits of Using DHCP
DHCP reduces the complexity and amount
of administrative work by using automatic IP configuration
Automatic IP Configuration Manual IP Configuration
IP addresses are supplied
IP addresses are entered manually
automatically
Correct configuration information is IP address could be entered
ensured incorrectly
Client configuration is updated Communication and network issues
automatically can result
A common source of network Frequent computer moves increase
problems is eliminated administrative effort
DORA
DHCP problems
• Protocol has no build-in authentication / security
• Security issues
• Rogue DHCP server
• Unauthorised client (mitigation: Lecture 7)
• Malicious client (mitigation: Lecture 7)
Questions
• How deep packet inspection is similar to WAF?
• What is the difference between them?
• Would you still implement Web Application
Firewalls if your network is protected by a firewall
and traffic is watched by an IDS?
Lecture-7 (Application Layer Security-2)
DHCP Snooping
• Problem Rogue DHCP Server
• DHCP Snooping Binding table is build by snooping the DHCP reply to the client
• Entries stay in table until DHCP lease time expires
• DHCP Snooping table can be written to bootflash, ftp, tftp in the event of failure
Layer 2 Firewall
• “Bump on the wire” or “stealth firewall”
• To introduce a layer 3 firewall on the network, needs resubnetting and operates on routed
packets
• Layer 2 transparent firewall does not require layer 3
separation between networks and operates on bridged
packets
• IP Packets that are embedded within these ports are
inspected as normal IP packets
Difference
Zone-Base Firewall Transparent Firewall
Operates at Layer 3 Operates at Layer 2
Two interfaces are in different Both the interfaces can belong
subnets to the same subnet
Since both the interface are
Packets are routed between bridged, packets are
interfaces forwarded after inspection
and ACL checks
• A zone based firewall can be configured in Transparent mode
Unauthorised client
•Any client will be given an IP, no questions asked
•No way to authenticate
•You can use MAC address to identify a client on theserver
• Return results based on this
•MAC addresses are easily changed though
•Mitigation:
Layer 2 authentication (i.e. 802.1x)
802.1x
•Uses central authentication server
•Good for when a shared key would not work
•Works over a wired, or wireless network
•Good for adding (an additional layer of) security to the physical Ethernet ports that are all
around a building 802.1x is called,
EAPoL when applied to 802.3 (Ethernet)
EAPoW for 802.11 link-layer (WiFi)
•Used at Swinburne for `eduroam`
• 802.1x is based on EAP (Extensible Authentication Protocol) to facilitate communication in
layer 2 between client and access point or switch.
• EAP is a framework protocol to provide authentication methods.
• EAP messages are exchanged between the client (Supplicant) and the authentication server
(e.g. RADIUS).
• APs and switches (Authenticator) forward those messages, while terminated the link-layer
exchange.
• RADIUS server (Authentication Server) maintains user credentials, and gives or reject access
to the network.
• The strongest security is achieved using cryptographic method incorporating TLS (Transport
Layer Security), where mutual authentication is achieved through a certificate exchange by
implementing PKI solution.
• Swinburne Eduroam has deployed a network of proxy RADIUS servers, while using
cryptographic method the supplicant submits username and password to RADIUS server at the
home institution via TLS tunnel.
Advantages
• Can prevent hosts that connect to network even before assigned an IP address
Limitation
• Not all of the Network Elements can support 802.1x
• Printers & copiers, AS-400, and other legacy equipment
• In those scenarios “MAC Sticky” or MAC based authentication is done, where MAC spoofing
is trivial
• Windows XP has major issues when the VLAN/IP address changes after 802.1X user
validation. Windows PE miss the EAP Host system (So no support for 802.1x)
• Implementing a solution based on 802.1x is high considering time, cost, resources,
infrastructure upgrade
• Inline Devices behind a NAT or Run a VM on top of a 802.1x authenticated host, simple
Malicious Client
• A client comes onto the network
• Takes all the IP addresses
Randomises it's MAC address
Make another request, accept
• 'IP address denial of resource attack'
• Not always bad for a client to want more
than one IP address (remember greynets)
• You would most likely configure your DHCP server
with 'knowledge' of your greynet addresses though
• Macof sends random source MAC and IP
addresses
• Macof -i eth1 2> /dev/null
• This will fill the CAM table on the switch, after which traffic
without CAM entry is flooded to every port on VLAN (hub)
• Also fills CAM tables of adjacent switches
• Port Security Limit Best Practice
• Allow only 1 MAC address per port
• Upon violation link should shutdown
• Upon link shutdown can send a SNMP trap
• Sticky port settings needs to set to survive
reboots
• Static MAC entries are favourable with
servers
Mitigation:
limit the MAC addresses per port ( port
security ) limit DHCP requests per port
Questions:
• Difference between forward and reverse proxy ?
• How does caching proxy help in a incident response situation ?
Lecture- 8 (Attacks)
DoS
“Denial of Service” attack
•Broad, fairly imprecise term
•Can mean:
•Stopping / crashing / degrading of a
service
•Buffer overflow
•Using up all of a server's limited resources
•RAM
•Disk space
•CPU
•Bandwidth
Crashing (stopping) a service
•Requires an exploit / vulnerability
•Buffer overflow
•Can be triggered by quite a small packet, or set of
packets
•Sent often enough, and the service will be
effectively off, even if it's set to restart
automatically
RAM exhaustion
•Layer 7
•Application specific (send through lots of requests you know take server RAM)
•Layer 4 – SYN flood
•Send through many TCP SYN packets (and nothing else)
•State created and kept on in the server's RAM for each of these pending connections
• It will eventually run out of space to keep all these 'hanging' connection attempts
•Randomise IP source address so they can't easily filter you
CPU
•Layer 7
•Application specific (Know that a site search takes the server a long time? Blast site with search
requests.)
•Disk
•Difficult
•Create many log entries? Probably not the best way.
•Layer 7
•Application specific
Bandwidth
•Not application specific
•Popular
•Note: You need to have more bandwidth than they do
Bandwidth amplification is possible
• Any situation where a single packet solicits a larger response
• Bandwidth amplification must be performed with IP spoofing (Attacker spoofs the
victim’s IP address)
•For example:
•DNS
•Game server discovery process
DDoS
Distributed Denial of Service attack
•Commander controls multiple sources of attack...and they might all use an amplification method
• Commander uses 'C&C' (command and control) channel to command infected ('zombie') hosts
to all send traffic at the same time
•C&C channel could be anything
•IRC chat room, SSH, sophisticated tunnel...
Reflected DDoS
Same as above, but zombies send packets to a 3rd party with a forged source address of
the victim (Spoofing)
•Hides the zombies locations from the victim – added layer of anonymity for the perpetrators
• Amplifies attack: 3rd party resends TCP SYN/ACK packet multiple times
(D)DoS Mitigation
Very difficult
•If they're doing it right, simple firewall rules wont work
•Make sure you have enough RAM, Disk space and CPU
•To prevent TCP SYN based attacks use 'SYN cookies'
•Allows a server to keep minimal state (and thus RAM usage) during the TCP three-way
handshake
•Available in most operating systems
Prevent bandwidth exhaustion by filtering
unwanted traffic “up stream”
•Very hard to do
•If it happens, who do you call? Will they even care?
•A protocol for “push back” signaling? [1]
•No wide implementation of any strategy
•Some companies provide a “scrubbing” service
•Your traffic goes to them and their well provisionednetwork first
•Only the 'clean' traffic comes to you via a VPN/tunnel
Clustering
More than one server, acting as one
•Load sharing
•All servers work at the same time
•Fail-over
•One (or more) servers active with one (or more) standing by
•Load sharing requires a device to share the load
•Allows for scaling, but the load sharing device will cost
money
•Fail-over is cheaper
•eg. The backup can just detect when the primary fails, and
take over
Load sharing
•Can be done through DNS
•Query can return multiple (randomised) answers
[wharrop3:~] wharrop% host google.com
google.com has address 74.125.224.68
google.com has address 74.125.224.70
google.com has address 74.125.224.66
google.com has address 74.125.224.73
google.com has address 74.125.224.69
google.com has address 74.125.224.65
google.com has address 74.125.224.64
google.com has address 74.125.224.67
google.com has address 74.125.224.78
google.com has address 74.125.224.72
google.com has address 74.125.224.71
google.com has IPv6 address 2001:4860:4001:801::1009
google.com mail is handled by 40
alt3.aspmx.l.google.com.
google.com mail is handled by 20
alt1.aspmx.l.google.com.
google.com mail is handled by 10 aspmx.l.google.com.
google.com mail is handled by 30
alt2.aspmx.l.google.com.
google.com mail is handled
Load sharing
•Also done through hardware load balancing
devices
•Keep track of flows and make sure that where required,
a client is always handled by the same back-end
machine
•Or software
•Squid (http://www.squid-cache.org/)
•Pound (http://www.apsis.ch/pound/)
•And more...
Fail-over
•There will be hardware to do this
•You could make your own though
•Backup machine pings (or attempts to connect to a
service on) the main server once a second (or so)
•If no ping comes through for a given time
•Backup machine adds IP of main server to its interface
•There are issues keeping the machines in sync
however...
•You don't want to fail-over to a machine who has
content out of date
“The cloud”
just on-demand servers in a data centre (somewhere)
•Good for rapidly scaling (up and down)
•But there can be:
•Management and security/privacy issues
Zero-day exploits
•Preferred exploit discovery process:
•White-hat discovers exploit
•Alert vendor
•Vendor releases patch
•Users are alerted (finder credited)
•Users update their software
•Exploit code created
•Only un-patched users potentially infected
•Another exploit discovery process:
•Black-hat discovers exploit
•Sells exploit
•Users get hacked – no warning
•Exploit is finally reverse engineered
•Patch release and announcement
•Worse if this is a remote (un-authenticated)
exploit (i.e. heartbleet)
•“Remote zero-day exploits”
IDS – signature
•Look for a known binary sequence, or events
•Issues:
•Signatures need to be updated
•Only known issues can be detected
IDS – anomaly
•Algorithms / Thresholds
•Trigger when values deviate from “normal”
•eg. Bandwidth, flows per second, hits on a http
server, number of VoIP calls to overseas ...
•Issues
• Tuning to “normal”
•Too sensitive and they produce too many alarms
•Not sensitive enough and you'll miss real problems
IDS – Darknet
Darknet
(or network telescope, internet motion sensor, black hole)
•Has been used for research
•Take a large unused contiguous group of public IP addresses
•/24 or more (the more the better for research purposes)
•Passively monitor inbound packets
•Why?
•All that traffic should not be heading there
•Traffic consists of:
•Directed attacks (i.e. nmap (SYN), viruses that perform network scanning)
•Backscatter (i.e. DoS attacks which employ spoofing)
•The bounce packet (i.e. SYN-ACK) from a victim when they are attacked with traffic that has
random source addresses set
IDS – Greynet
•A distributed enterprise darknet [1]
•Put the darknet inside your network .Can have a Graynet subnet, or a/few Graynet host(s) inside
every subnet (passively listen to traffic and don’t reply)
•Distribute 'dark' IPs amongst 'lit' IPs
•Makes the dark space harder to detect and avoid
•Any connection attempts to these IP addresses probably mean the source host is infected (or
nmap scanning)
•Simple and lightweight method compared to deep packet inspecting IDS
IDS – Honeypot
•Set a trap
•Instantiate unused 'hackable' servers/services (eg. An old Win2k machine called 'accounts',
running an exploitable IIS web server)
•Could be done with virtualisation
•Hope that intruders go for these first
•Set alarms on these services/files
2 Types
Low interaction
- Easy to deploy
- Low risk - simulation of real host
- Less control for attacker
High interaction
- difficult to deploy
- high risk - Involves real host
- more control for attacker
IDS – evasion
•Difficult, but if you know the IDS well enough...
•Hide actions through tunnels / encryption
•Go very slowly (threshold based)
•Go really fast
•Overwhelm the administrator with false positive alarms
•Then attack
•Change the meaning of “normal” activity on the network [1]
•Then attack
Encryption
•Use a secret key to scramble a message
•Highly improbable that anyone else can undo in a reasonable amount of time, without the key
•Symmetric
•We each need the key – it en- & de-crypts
•Examples: DES – Triple DES – AES
•Key distribution problem
•Asymmetric
•Also known as public & private key cryptography
•We each have a public, and a private key
•One decrypts messages encrypted with the other
•Can be used for authentication and encryption ( how?)
•Can't derive private key from public
•Mostly solved the key distribution problem
•Can occur at any layer
•Layer 2 - 802.1x
•Layer 3 - IPSEC
•Layer 6 - SSL/TLS
•Layer 7 – SSH
VPN
•Virtual Private Network
•Broad term covering a lot of technologies
•Commonly an encrypted connection created over the public Internet to allow two networks to
securely communicate
•Even more common – allow a single device secure access to a corporate network
•Usually IP over:
•IP
OR
•UDP or TCP (to get though restrictive firewalls)
•Results in a device with a pseudo Ethernet device
•With an IP from the corporate network
•We now send all packets to that interface
• Except packets for the VPN server!
Tunnels
•All ports closed on a network, except 80 and 443
•How could we use IMAP to check email? Tunnel.
• The protocol stack is only a suggestion...
•IP packet inside another IP packet? Sure.
•IP packet inside a UDP packet? Sure.
•Ethernet frame inside a UDP packet? Sure.
•TCP connection over a HTTP connection? Sure.
•NOTE! We need two parties to tunnel
•One at each end to en- & de-capsulate the traffic
•Examples:
•SSH – feature built in
• ssh L [local port]:[remote machine]:[remote port]
•httptunnel [1]
•Server: hts F server.test.com:23 80
•Client: htc F 23 server.test.com:80
•How will firewall react to this?
•Can you detect this? How?
•Is this much different to a VPN?
•Is it legal?
Defence-In-Depth
Buying all the security products in the market and using them is not defence-in-depth
Implementing/using layers of needed controls to reduce the impact of an attack is defence-in-
depth
• Every attack should be time-consuming and sophisticated for an attacker to perform, which
eventually makes to give up the attack
• Risk + Likelihood = Impact
What if its nation-state or state-sponsored, well funded attack
• Its war, All you can do is be prepared
• Cost($) of Damage and Risk – is the language the business teams will understand, not the
technicalities
File Permissions
*nix Systems:
• Each file has 3 sets of permissions
• Permissions for Everyone, Owning Group, Owning user
• Each of these permissions can be defined by rRead, w-Write, x-Execute
• Now roger needs access to the test file.
• Add roger and support to a new group and
change file ownership to new groups name.
• chgrp – to change ownership
• chmod – to change file persmission
Permission ---- Owner---- ---- Last Modified Time
--------- # of hard links1 root support File Size date
Filetype- rwx(user group other) User-group
• Windows took File permission to next level (NTFS and ReFS)
• FAT32 does not support Permissions at all
• Every file permission can be assigned to any number of users, groups or “Everyone”
using ACLs
• Everyone (built-in security group) in windows – encompass authenticated users, built-in
guest account and other special accounts .
• Fine-Grained permissions at folder level set for inheritance bysubfolders and children
• Any change to parent folder, replicates to child subfolders
• Security-Enhanced Linux(SELinux) enforced application-level and network-level
permissions
• Only certain applications can access specific folders
• Fine-grained application level permission can take time to harden a SOE image
• Windows dominates End-User technology and corporate domains, while *nix dominates
the Application server and datacentre world
• Business competitiveness is driving each product to other kernel’s dominant spaces too
Network Shares
• Samba – open source software implementation of networking protocol to share files
• Share files between *nix and windows machines
• Printer services
• Integration with windows AD
• Read only – controls the ability of not creating or modifying files
• Guest ok – no password needed to access file
• Writeable – write privileges
• Server Message Block (SMB)
• Windows Specific File share protocol running at application layer
• SMB v1 was also known as Common Internet File system (CIFS)
• Access to Files, Printers, serial ports and other communication in network
• SMB signing adds additional capability to digitally sign the SMB connections
• Security issues found so far mainly within the protocol itself, Other vulnerabilities
primarily around lack of support for newer authentication protocols like NTLMv2 and
Kerberos
• If you have accessed a files in your network share, then you have already used SMB protocol
• Eternal Blue Exploit – Affecting Older version of SMB and Samba
• Timeline
• 2012 or even earlier - NSA identifies the vulnerability and develops an exploit tools
based on it called EternalBlue. Tools is locked down only for use by NSA
• Early Mid 2016 – Hacking group “Shadow Brokers” gains access to NSA systems obtains
documents related to vulnerability and tools
• Jan 2017 – Shadow Brokers begin selling tools related to eternal blue
• Early Feb 2017 – NSA tells Microsoft about the vulnerability exploited by Eternal Blue
• Feb 14th 2017 – Microsoft announces Feb patch Tuesday updates will be postponed.
“We have discovered a last minute issue that could impact some customers”
• (Timeline Continued)
• What was the SMB exploit ?
• CVE-2017-0144
• 1st bug - in the process of converting File Extended Attributes from OS2 structure to NT
structure by SMB (srv.sys driver) lead to a buffer overflow in the non-paged kernel pool
• 2nd - Parsing bug between a word to Dword
• 3rd – with 1st bug that lets you allocate a memory in the kernel pool with specified size , now
by increasing the data size the data in adjacent memory can be overwritten
• Combining all 3 bugs, EternalBlue tool was built to exploit and gain access to systems via
SMB
• (Timeline Continued)
• Late Feb 2017 – SMB Vulnerability exploited by EternalBlue was publicly identified as
CVE-2017-0144
Defence-in-Depth : Intel
• At this point in time – if you have a threat intel team, or threat
subscription, the CVE description has highlighted there an SMB
specific vulnerability
• Which should allow you start gathering the SMB version in use,
and where it is being used within your oganisation
• March 14 2017 – Microsoft release patch for CVE-2017-0144, MS17-010 with Risk
rating CRITICAL (https://technet.microsoft.com/library/security/MS17-010)
Defence-in-Depth : Patching
• At this point in time – you should be ready to run the patch across all system without blockers
• Legacy/un-patchable systems must be segregated, added compensating controls and Monitoring
should be placed.
• (Timeline Continued)
• April 14, 2017 – Shadow Brokers released 300 MB of NSA tools in github, including
EternalBlue
Defence-in-Depth : Threat Monitoring
• At this point in time – Update your Security control’s by adding signatures for the released
tools, so when attacker uses it against your organisation, you get alerted and perform IR
Defence-in-Depth : Risk
• At this point in time – Calculate the Risk around the impact and likelihood of an attack, also
attribute it to cost.
• (Timeline Continued)
• May 12, 2017 – Exploitcode was used by Malware authors to create a ransomware that
was name “Wannacry”
Defence-in-Depth : Threat Monitoring
• At this point in time – Update your Security control’s by adding signatures for wannacry, so
when attacker uses it against your organisation, you get alerted and perform IR
• Monitor for new variants
Defence-in-Depth : Re-calculate Risk
• At this point in time – Calculate the Risk around the impact and likelihood of an wannacry
infection, also attribute it to cost.
• Employee plugs in an wannacry infected USB disk, how many systems can get locked
down ? Have you analysed ?
Defence-in-Depth : Pentest
• At this point in time – Once you have enough assurance that your network defences are good,
run a Penetration test exercise to see how good was the implementation to identify and harden
further.
• Did the patching go well, any system got missed ?
• Was there an implementation problem ?
• Legacy systems are good well guareded ?
• Can the monitoring team pickup your attack as per signatures ?
• (Timeline Continued)
• Mid May 2017 – CVE 2017-7494 was released, Eternal Blue Exploit for Samba
(SambaCry)
• There you go – Defence-in-depth lifecycle starts again !
• March 14 2017 (patch released) to May 12 2017 (first Etnernalblue ransomware). ~3
month window for patching
• Still systems are infected by wannacry and ransom payment is being made to the get
disks decrypted
• Last payment was on 14-02-2018 -
https://blockchain.info/address/13AM4VW2dhxYgXeQepoHkHSQuy6NgaEb94
• Does take a lot of effort to explain and get support from both Business and technical
Administration teams
User Accounts
•User account in business
• Naming conventions
• Password Policies
• Account Expiry
• Number of Password attempts
•Groups added for privileges
How the environment can be
monitored?
Bloodhound tool
How to trust the user from misuse privilege?!
•Internal Threats
• External Threats
Internal Threats
- User Access and Rights
- Issue: 3rd Party exposure
- Using IGP (Identity – Group – Permission) method
- Defence/Resolution: Contractual/compliance
- Using IGDLP or IGUDLP methods
- User Access and Rights
- Issue: Nesting Groups or high privilege group membership
- Privilege can slip via nested groups
- Compromising PDC by attacker and add
himself/herself to the high privilege groups
- Defence/Resolution: Recurring Auditing and Constant Monitoring
- Identifying Nesting by some tools like Bloodhound
Internal Threats
- User Access and Rights
- Issue: Nesting Groups or high privilege group membership
- Privilege can slip via nested groups
- Compromising PDC by attacker and add himself/herself to the high privilege groups
- Defence/Resolution: Recurring Auditing and Constant Monitoring
- Identifying Nesting by some tools like Bloodhound
External Threats
- User Access and Rights
- Issue: Losing the data on the hard drives of
desktop/mobile computers
- Defence/Resolution: BitLocker
- The entire drive could be encrypted and not allowing access to data without key when
unlocking the drive
- Make easier of retrieving of key for computers on the domain to recover data
Authentication
• Popular Term
AAA (Authentication, Authorisation, Accounting)
• Authentication
• A way of identifying a user
1. Typically by having the user enter a valid user name and valid password
2. AAA server or authentication server checks provided credentials and compare with defined
one in database
3. The user is granted access or prevent of access to a specific resource(s)
MFA (Multi-Factor Authentication)
• Method of identifying user via presenting two or more pieces of evidences (factors)
1. Typically by having the user enter a valid user name and valid password
2. User needs to present (an)other method(s) of factors to
AAA server or authentication server:
• Knowledge (Something the user knows)
• Possession (Something the user has)
• Inherence (something the user is)
3. The user is granted access or prevent of access to a specific resource(s)
Difference between 2SV and 2FA?
The main differences between these verification methods are:
Two-step verification (2SV) requires choosing a particular trusted device to be challenged, and
this will be the device that receives the code via SMS, email, etc.
Two-factor authentication (2FA) challenges all trusted devices. When a trusted device is
challenged with 2FA, it doesn't receive anything, it actually generates the code, such as yubikey,
Google Authentication, smartcard, etc.
Knowledge (Something the user knows)
The knowledge factor is the most common category of credentials used for authentication
• Password
• Personal Identification number (PIN)
• Pattern
Possession (Something the user has)
In a security context, is a category of user authentication credentials based on items that the user
has with them, such as a hardware device (yubikey – http://www.yubico.com)
• Security Token (Hardware or Software)
• Mobile phones (with Software Token)
• Smart card (or Virtual Smart Card)
Inherence (Something the user is)
Consisting of elements that are integral to the individual in question, in the form of biometric
data.
• DNA
• Fingerprints
• Eye retinas
• Voice Pattern
• Facial patterns
Password cracking
•John The Ripper (included in practical software)
•Take a password file line:
• lslowman:$1$fWl69cRs$gCB.nqb82/VG2BJkH3Qq7/:15592:0:99999:7:::
•We can not directly reverse the hash (red)
• BUT
•We can take common words and hash them
•Compare the hashes
•People :
•Use common words as passwords
•Use common methods to make them 'complicated'
GPUs
•Graphics Processing Unit (GPU)
•3D (and 2D) graphics
•Can do more than 3D though
•Video decompression
•Any “embarrassingly parallel” tasks
•Programming interfaces
•CUDA
•OpenCL
•Computation specific
GPUs – speed
•Massive speed increases
•md5 hashes (from a Linux password file) and john:
•CentOS VM ≈ 1,000 attempts/sec
•4 core Intel FreeBSD ≈ 34,000 attempts/sec
•1 CUDA device ≈ 731,000 attempts/sec
•Brute force with oclhashcat-plus
• 1 CUDA device ≈ 1,600,000,000 attempts/sec
Passwords
•You need to use strong passwords
•You need to use different passwords
•“Passwords: how to choose one and why we need them ” P. Branch
Lecture-11(The Internet)
The Internet
• Global network of networks
• Converged telecommunication system
• Based on the Internet Protocol specification
• Initially based on IP version 4
• Currently IP version 6 in the roll out
• Extremely lengthy process
• Initial specification in December 1995 (RFC 1883)
• Updated specification in December 1998 (RFC 2460)
• Approved specification in July 2017 (RFC 8200)
• Architecture based on layer 4
• Internet Layer of TCP/IP stack
• Allows connect networks together
• Applied global and universal addressing
• Abstracts underlaying networks and data transmission
• Provides end-to-end data transfer independently from network technologies and changes
• Often presented as hourglass architecture (image source: Wikipedia)
Security implications
• ICANN (IANA function) maintain policies regulating use of IP addressing space across the
Internet
• Remember: defense in depth security model? Policies form one on the security layers
• IANA Global Addressing Policies:
• Regulate how addressing space is delegated to RIRs
• https://www.icann.org/resources/pages/global-addressing- 2012-02-25-en
• RIRs, NIRs, LIRs define own policies
• e.g. APNIC Internet Number Resource Policies
https://www.apnic.net/community/policy/resources
Routing in networks
• Routing protocols
• implement algorithms for computing routes
• selecting a path for traffic across multiple networks
• construct routing tables to direct packet forwarding
• Routing tables
• record routes to various network destinations
• usually built with assistance of routing protocols
• entries can be specified manually
• large networks topology changes constantly
• manual construction of routing tables unfeasible
• Two broad categories of routing protocols
• Interior gateway protocols
• Exterior gateway protocols
• Interior gateway protocols
• Within a system managed according to one routing policy
• Dynamic protocols, core routing decisions computed
• Routing tables converge based on calculated path costs
• Implementations: RIP, EIGRP, OSPF, IS-IS
• Exterior gateway protocols
• Between independent systems (Autonomous Systems)
• path based, network policies, or rule-sets
• Network administrators make core routing decisions
BGP (2)
An example routing topology:
BGP is the sole routing protocol used for inter-AS peering (eBGP).
A single AS can be multi-homed within the same eBGP session (AS2-AS3 and AS3-AS4) or use
multiple eBGP sessions for the purpose (AS1-AS3/AS1-AS4 and AS4-AS3/AS4-AS1). Each AS
deploys its own IGP (RIPv2, IS-IS, OSPF) to route between internal subnets (not depicted) and
uses iBGP to connect the BGP boundary routers of the AS internally in a full mesh or using
Route Reflectors. [1]
BGP security
• So it appears we all just get together and we believe each other's rumours.
• So what is the method with which we prevent incorrect or malicious advertisements from being
propagated?
• Cryptography? Public, private keys?
• King of the Internet? Both?
• Protocol is simple, configuration complex
• Entire world can see your mistakes (and will be impacted)
• So what is the method with which we prevent incorrect or malicious advertisements from
being propagated?
• There is none.
BGP problems
• How do we talk? (Integrity)
The manner in which the BGP session between the BGP speakers is secured such that the
conversation is not altered, disrupted or hijacked and is protected from unauthorised
eavesdropping.
• Whom am I talking to?
Verifying the identity of the other party and verifying that they are authorised to speak for the
routing entity that they purport to represent.
• What are you saying?
Verifying the authenticity and completeness of the routing information being passed in the BGP
session.
• Should I believe you? (trust)
• Verifying that the routing information actually represents the state of the forwarding system.
• How recent is your information and is it still valid?
• Verifying for how long routing information is valid.
• Most of these can be considered open issues
• BGP has almost no security at all.
• This leads to the news stories...
IPv6
• Primary advantage:
• larger address space of 128bit (among other less pressing
features)
• IPv4: 232 = 4,294,967,296 ≈ 4.3 billion (1 billion = 109)
• IPv6: 2128 = 340,282,366,920,938,463,463,374,607,431,768,211,456 ≈
340 undecillion (1 undecillion = 1036) or 3.4x 1038
• to compare:
• estimated total human 7,442,000,000 = 7.442 billion [1]
• estimated human cell number is
37,200,000,000,000=3.72×1013=37.2 trillion [2]
• It shares many base concepts from IPv4
• But not compatible with IPv4 at all
• i.e. devices that support IPv4 only, do not work with IPv6
• Major security risk with IPv6:
• It is still new
• Very few have a clue what it is
• Many will deploy it with little understanding
• You mean I needed to have a firewall for IPv6 too?
IPv6 vulnerabilities
• Some issues still exist
• few examples – more reading here [1]
• Neighbor Discovery (ND) process to find MAC addresses[2]
• (ARP is not supported to convert IP to MAC any more in IPv6)
• using ICMPv6 Neighbor Solicitation to send to the link-local multicast address
• this packet will reach all active link-local addresses on the network
• multicast address FF02::1 can be used to send ICMPv6 Echo Request
• all active local hosts should reply to that from their link-local address
• DHCP6 + Router discovery (Man-in-the-Middle)
• ICMPv6 Router Discovery+ Router Advertisement
Modbus Protocol
• Serial communication protocol used with PLCs
• Maintained by Modbus Organization since 2004
• Originally published by Schneider Electric
• Common communication protocol
• Commonly used in industrial networks
• Connecting controllers (PLCs) to
• SCADA (supervisory systems)
• DCS (distributed control systems)
• Master/Slave protocol
• Master polls slave devices regularly to get information
• Each device assigned its unique address on a data-link
• One device designated as Master can send commands
• Address + Function Code + Data + Error Check
• Command types
• Read discrete inputs (1 bit – on/off)
• Force/write or read coil(s) (1 bit – on/off)
• Read input registers (measurements and statuses)
• Preset/write or read holding registers (configurations values)
What is BCP38?
BCP38 – also known as “Network Ingress Filtering” is concept where we filter incoming
packets from end customers and allow packets ONLY from IP's assigned to them. ... Now e.g IP
pool for User-1 is 192.168. 1.0/24 and is using 192.168. 1.2 out of it while IP pool for User-2 is
192.168.
CAM (Content Addressable Memory) MAC Address Memory, a Table in a switch that
contains IP Address against MAC Addresses.
Mac Flooding -Fill the CAM table (by MAC address spoofing) its mitigation is
Mitigation
•Limit the number of MAC addresses allowed per-port
•Detect and report
•VPN
•Virtual private network
•Encrypted tunnel between end points (most often created across the internet)
•Usually IP over IP
•or TCP/UDP (for firewall traversal)
Tunnels
•Encapsulate one protocol inside another on onehost
•Send across network
•De-encapsulate at other host
•Vice-versa for reverse direction
•Tunneled traffic appears to (stupid) intermediate hosts as the outer encapsulation
•Can be used to transfer data in and out of company in stealth
•RDDoS (Reflected DDoS)
•Reflected DDoS
•Zombies forge source address to be that of victim
•Send packets to other hosts on the internet
•Amplification if eg. TCP SYNs are used, as SYN/ACKs are retransmitted if there is no response