Network Security - Threats and Attacks
In questa pagina 4
See also: ICMP, Ping and TracerouteICMP adds to IP the error reporting and queries it lacks; its messages travel inside IP datagrams with Protocol 1 and are either errors (destination unreachable type 3, time exceeded 11, redirect 5, parameter problem 12), always sent to the original source with the original IP header plus 8 bytes of data, or queries (echo request 8 and reply 0, timestamp 13 and 14); ICMP only reports and never corrects errors, and it supports ping (RTT), path MTU discovery with the D bit (maximum payload 1500-20-8=1472 bytes) and traceroute (TTL increasing, n+1 probes for n routers), but also attacks such as smurf and fake redirects.ICMP, Ping and Traceroute →, ARP - Address Resolution ProtocolTo place an IP datagram in a frame a node needs the MAC address of the next hop, obtained with ARP: a broadcast request (destination MAC FF:FF:FF:FF:FF:FF, carrying the sender's IP and MAC and the wanted IP) and a unicast reply with the wanted MAC, stored in the ARP cache; ARP always resolves the next hop (destination host or router), never the final destination, and since broadcasts do not leave the subnet a router can answer with its own MAC (proxy ARP).ARP - Address Resolution Protocol →, ISO-OSI Model and TCP-IP StackCommunication between two computers is too varied a problem (signals, errors, medium access, routing, flow control, data representation) for a single protocol, so it is divided into layers. The ISO/OSI model has 7 layers (physical, data link, network, transport, session, presentation, application); the TCP/IP stack merges the top three into one application layer, so it has 5. Each layer offers a service to the one above and talks only to its peer layer through PDUs; going down a header (PCI) is added: encapsulation. Addresses: MAC (link, local), IP (network, global), port (transport).ISO-OSI Model and TCP-IP Stack →.
Threats, attacks and security goals
Definition (threat and attack). A threat in a communication network is any event or sequence of actions that can lead to the violation of one or more security goals. The realisation of a threat is an attack.
Example. A hacker breaking into a computer, the disclosure of e-mails in transit, a malicious entity modifying financial data: three attacks.
The goals depend on the application: a bank protects transactions from fraudulent modification and PINs from disclosure; a government protects sensitive information; an ISP limits access to authorised staff, protects subscribers' privacy and guarantees service quality.
| goal | meaning |
|---|---|
| Confidentiality | information is available only to the intended recipient |
| Integrity | information is received exactly as sent; if it changes, it must be possible to discover it |
| Availability | the service is always operational, even if someone tries to disturb the network |
| Accountability | it is always possible to identify who is responsible for each action |
| Privacy | information is used but not revealed to anyone except authorised entities |
Example. Home banking: confidentiality (nobody reads the balance), integrity (nobody changes a transfer amount), availability (the site answers even under attack), accountability (we know which user ordered the transfer).
Threats, services and mechanisms
| threat | aim |
|---|---|
| Eavesdropping | learn confidential information |
| Traffic analysis | learn origin, destination, length and frequency of communications (not the content) |
| Forgery | build a false message pretending somebody else sent it |
| Masquerade | claim to be somebody else in a single message |
| Repudiation | deny having sent or received a message |
| Profiling | collect information about a single user |
| Fingerprinting | identify the user associated with a message |
| Jamming | interfere with a communication |
Services protect communications and protocols against attacks: secrecy (message unintelligible to who intercepts), integrity protection, message authentication (detect forged messages), entity authentication (protect from masquerade), non-repudiation, anonymisation, key management, access control (protect from denial of service).
Mechanisms implement the services: encryption (the message is transformed and only the intended recipient can invert it), digital signature (a string only the legitimate source can create, which anyone can verify), intrusion detection (recognise the signature of malicious behaviour or anomalies), message authentication codes (MAC), randomisation, key agreement. Encryption is in Hash Functions and Symmetric CryptographyEncryption turns plaintext into ciphertext with a key; hash functions give a fixed-length one-way digest used for integrity and passwords; symmetric ciphers (Caesar, Vigenere, DES, AES with block modes) share one secret key, exchanged for example with Diffie-Hellman; MAC and HMAC authenticate messages with a shared key.Hash Functions and Symmetric Cryptography → and Public-Key Cryptography, RSA and TLSPublic-key cryptography uses a public key to encrypt and a private key to decrypt; certificates issued by a Certificate Authority bind identities to public keys; digital signatures give authenticity, integrity and non-repudiation; RSA relies on the difficulty of factoring; TLS combines certificates, a symmetric session key (derived with Diffie-Hellman since TLS 1.3) and MACs.Public-Key Cryptography, RSA and TLS →; access control is partly done by FirewallsA firewall blocks unauthorised traffic between networks using header information of layers 2-4: stateless packet filters apply ordered rules per packet, stateful firewalls track connections (NEW, ESTABLISHED, RELATED, INVALID), application firewalls act as proxies; in Linux netfilter provides five hooks and iptables organises rules in tables and chains.Firewalls →.
Definition (security protocol at layer N). A mechanism offering security services that protect the information in the PDUs of layer and of the layers above, but not of those below.
Example. Application layer: end-to-end encryption (as in WhatsApp) and HTTPS protect only the application data. Layer 3: all layer 3 and 4 devices (routers) must implement the protocol, e.g. IPsec (VPN and IPsecA VPN is a private network built over a public one: a VPN server admitted by the firewall authenticates outside users, and protected IP packets are encapsulated as the payload of other IP packets (IP tunnelling) using IPsec (AH, ESP, tunnel or transport mode, one-way Security Associations) or an SSL/TLS tunnel through TUN/TAP virtual interfaces.VPN and IPsec →).
Types of attack
- Physical attacks: replacing or cloning a node, physical damage, wrong measures (a lighter in front of a temperature sensor), obstructing a measure.
- Software attacks: viruses and worms, trojans, code injection, phishing e-mails, nodes configured with attacker-chosen user names and passwords.
- Network attacks: on the communication channel.
Sniffing and spoofing
Definition. Sniffing is intercepting traffic to read headers and data; it is not necessarily fraudulent and serves for diagnostics (Wireshark, see Emulating Networks with KatharàKatharà is a network emulator where every device is a Docker container joined to virtual collision domains; a lab is a folder with lab.conf (topology), one .startup file per machine and optional per-device folders; machines are configured with ifconfig, tested with ping and observed with tcpdump and Wireshark.Emulating Networks with Katharà →). Spoofing is the manipulation of (part of) the traffic, usually illegitimate.
They underlie the two most widespread attacks: Denial-of-Service (DoS) and Man-In-The-Middle (MITM).
Denial-of-Service
The attacker only wants to interrupt the service, hitting availability: saturating a wired channel, jamming a wireless one.
Smurf attack (ICMP).
- The attacker sends an ICMP echo request to the broadcast address of a network.
- The source IP in the packet is the victim's (spoofing).
- All hosts of the network send an echo reply to the forged address, i.e. to the victim.
- The victim is flooded with ICMP replies.
Numeric example. A ping has 56 bytes of data; with ICMP (8) and IP (20) headers the packet is bytes. With 200 hosts, one packet of 84 bytes yields bytes towards the victim: amplification factor . If the attacker sends Mbit/s, the victim receives Mbit/s, more than a Fast Ethernet link. Today it is rare since routers normally do not forward directed broadcasts.
Man-In-The-Middle
The MITM increases the damage by changing the information inside the intercepted packet; it can hit confidentiality, integrity, accountability and privacy. Typical example: cache poisoning of ARP tables (IP to MAC) and DNS caches (name to IP).
ICMP redirect. Routers keep routing information up to date, hosts do not. If H sends to T through R1 but R1 knows that R2 (same network as H) is now the better next hop, R1 sends H an ICMP redirect to update its table. The attacker can spoof redirects and divert the victim's packets to a malicious router.
ARP cache poisoning in a Telnet session. A (10.9.0.5) and B (10.9.0.6) have a Telnet session; attacker M (10.9.0.105) wants to change every s into Z. M poisons A's ARP cache (B's IP maps to M's MAC) and B's cache (A's IP maps to M's MAC). M must:
- keep sending false ARP replies, otherwise A and B correct their caches;
- turn off ICMP redirects, which would cancel the attack;
- turn off automatic IP forwarding, to have time to modify the packet (a sniffer saves a copy);
- recompute IP and TCP checksums, otherwise B discards the packets.
Other notable attacks
- Sinkhole (routing): a node claims exceptional resources and neighbours choose it as a hop; it can then drop, modify or analyse the traffic.
- Wormhole (routing): two malicious nodes claim to be one hop apart and connect through a private fast tunnel; neighbours route through it and the attackers can drop, alter or observe.
- Ping of death: malformed or oversized pings (more than 65 535 bytes, fragmented) crash the target when reassembled in a buffer.
- DDoS: a botnet of compromised devices floods the target. Families: volumetric (consume bandwidth), protocol (consume protocol resources, e.g. ping of death), application-layer (HTTP flood).
Numeric example (ping of death). The IP total length field has 16 bits, so the maximum is bytes; minus IP (20) and ICMP (8) headers leaves at most bytes of data. A ping with bytes of data has IP payload and total length , i.e. 3 bytes too many. On a link with MTU it is split into fragments of payload bytes: fragments (44 of and a last one of ).
Numeric example (DDoS). The 2018 attack on GitHub reached Tbit/s GB/s. With devices sending Mbit/s each, million devices are needed.
Common mistakes
- Confusing threat (possible event) and attack (realised threat).
- Saying sniffing is always illegal: it is also a diagnostic tool.
- Thinking MITM only serves to read: it mostly serves to modify.
- Forgetting that in Smurf the source address is the victim's.
- In the ARP example, forgetting to turn off redirects and forwarding and to recompute checksums.
- Believing a layer security protocol also protects the layers below.
Versione ripasso
- Threat and attack. A threat is any event that can violate a security goal; its realisation is an attack.
- Goals. Confidentiality, integrity, availability, accountability, privacy. Home banking: nobody reads the balance, nobody changes the amount, the site answers under attack, we know who ordered the transfer.
- Threats. Eavesdropping; traffic analysis (origin, destination, length, frequency); forgery; masquerade; repudiation; profiling; fingerprinting; jamming.
- Services. Secrecy, integrity protection, message and entity authentication, non-repudiation, anonymisation, key management, access control. Mechanisms: encryption, digital signature, intrusion detection, MAC, randomisation, key agreement. See Hash Functions and Symmetric CryptographyEncryption turns plaintext into ciphertext with a key; hash functions give a fixed-length one-way digest used for integrity and passwords; symmetric ciphers (Caesar, Vigenere, DES, AES with block modes) share one secret key, exchanged for example with Diffie-Hellman; MAC and HMAC authenticate messages with a shared key.Hash Functions and Symmetric Cryptography →, Public-Key Cryptography, RSA and TLSPublic-key cryptography uses a public key to encrypt and a private key to decrypt; certificates issued by a Certificate Authority bind identities to public keys; digital signatures give authenticity, integrity and non-repudiation; RSA relies on the difficulty of factoring; TLS combines certificates, a symmetric session key (derived with Diffie-Hellman since TLS 1.3) and MACs.Public-Key Cryptography, RSA and TLS →, FirewallsA firewall blocks unauthorised traffic between networks using header information of layers 2-4: stateless packet filters apply ordered rules per packet, stateful firewalls track connections (NEW, ESTABLISHED, RELATED, INVALID), application firewalls act as proxies; in Linux netfilter provides five hooks and iptables organises rules in tables and chains.Firewalls →.
- Layer N security protocol protects PDUs of layer and above, not below. Application layer: end-to-end encryption, HTTPS. Layer 3: IPsec (VPN and IPsecA VPN is a private network built over a public one: a VPN server admitted by the firewall authenticates outside users, and protected IP packets are encapsulated as the payload of other IP packets (IP tunnelling) using IPsec (AH, ESP, tunnel or transport mode, one-way Security Associations) or an SSL/TLS tunnel through TUN/TAP virtual interfaces.VPN and IPsec →).
- Attack families. Physical, software (virus, worm, trojan, injection, phishing), network.
- Sniffing reads traffic (also diagnostics, Wireshark, Emulating Networks with KatharàKatharà is a network emulator where every device is a Docker container joined to virtual collision domains; a lab is a folder with lab.conf (topology), one .startup file per machine and optional per-device folders; machines are configured with ifconfig, tested with ping and observed with tcpdump and Wireshark.Emulating Networks with Katharà →); spoofing manipulates it. They underlie DoS (availability) and MITM (changes data in the packet).
- Smurf. Echo request to the broadcast address, source forged to the victim, all hosts reply to the victim. Example: packet bytes, 200 hosts, bytes, amplification . Rare today: routers do not forward directed broadcasts.
- MITM and cache poisoning. ARP (IP to MAC) and DNS (name to IP) caches. ICMP redirect spoofed to divert the victim to a malicious router.
- Telnet example. A
10.9.0.5, B10.9.0.6, M10.9.0.105poisons both ARP caches and changessintoZ. M must keep poisoning, turn off ICMP redirects, turn off IP forwarding, sniff a copy, recompute IP and TCP checksums. Lab: Man-in-the-Middle Attack with ARP PoisoningLab 7 shows that Telnet sends user name and password in clear, so with a hub a tcpdump on the attacker is enough, while with a switch the attacker needs ARP poisoning (false ARP replies repeated every second) and IP forwarding to sit in the middle and read the session in Wireshark with Follow TCP stream.Man-in-the-Middle Attack with ARP Poisoning →. - Sinkhole: node claiming exceptional resources attracts routes. Wormhole: two nodes with a private tunnel claim to be one hop apart.
- Ping of death. Maximum IP packet , maximum ICMP data . With data bytes: IP payload , total (3 over); fragments.
- DDoS. Botnet; volumetric, protocol, application-layer (HTTP flood). GitHub 2018: Tbit/s GB/s, i.e. million devices at 1 Mbit/s.
- Mistakes: threat vs attack; sniffing always illegal; MITM only reads; Smurf reply goes to the victim; forgetting redirects, forwarding and checksums in the ARP example; layer protecting lower layers.