Salta al contenuto
Note per Studenti Network Security - Threats and Attacks Report

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 NN 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).

  1. The attacker sends an ICMP echo request to the broadcast address of a network.
  2. The source IP in the packet is the victim's (spoofing).
  3. All hosts of the network send an echo reply to the forged address, i.e. to the victim.
  4. 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 56+8+20=8456+8+20=84 bytes. With 200 hosts, one packet of 84 bytes yields 200⋅84=16 800200\cdot84=16\,800 bytes towards the victim: amplification factor 200⋅8484=200\dfrac{200\cdot84}{84}=200. If the attacker sends 11 Mbit/s, the victim receives 200200 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.

The laboratory version is in 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 →.

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 216−1=65 5352^{16}-1=65\,535 bytes; minus IP (20) and ICMP (8) headers leaves at most 65 50765\,507 bytes of data. A ping with 65 51065\,510 bytes of data has IP payload 65 51865\,518 and total length 65 53865\,538, i.e. 3 bytes too many. On a link with MTU 15001500 it is split into fragments of 14801480 payload bytes: ⌈65 518/1480⌉=45\lceil65\,518/1480\rceil=45 fragments (44 of 14801480 and a last one of 398398).

Numeric example (DDoS). The 2018 attack on GitHub reached 1.351.35 Tbit/s =1.35⋅1012/8=168.75=1.35\cdot10^{12}/8=168.75 GB/s. With devices sending 11 Mbit/s each, 1.35⋅1012/106=1.351.35\cdot10^{12}/10^{6}=1.35 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 NN security protocol also protects the layers below.

Versione ripasso

Teoria collegata