makautnotes

1.8 Networking Basics for Security★★

Important2/4 recent papers3 other papersup to 5M⏱ 6 min
PYQs4
  • Which port number is usually the default port of web servers like Apache? → 80 (HTTP) 2024-25 1M recent
  • What port does Telnet use? a) 22 b) 80 c) 20 d) 23 → d) 23 2018-19 1M
  • What is a response code? List them. 2022-23 5M recent
  • LDAP stands for: a) Lightweight Directory Access Protocol b) Lightweight Data Access Protocol c) Lightweight Domain Access Protocol d) Lightweight DNS Access Protocol → a) Lightweight Directory Access Protocol 2014-15 2013-14 1M

What Happens When You Open a Website


OSI and TCP/IP Models

Protocols and layers

The OSI model (7 layers)

Layer Job Attacks at this layer
7 Application services for users: HTTP, DNS, email XSS, SQL injection, phishing
6 Presentation format, encryption, compression SSL stripping
5 Session starts and ends sessions session hijacking
4 Transport TCP/UDP, ports, reliable delivery SYN flood, port scanning
3 Network IP addresses, routing IP spoofing, ICMP flood
2 Data link MAC addresses, switches ARP spoofing, MAC flooding
1 Physical cables, signals, radio wiretapping, jamming

The TCP/IP model (4 layers)

  1. Application = OSI layers 5–7 (HTTP, DNS, SMTP).
  2. Transport = OSI layer 4 (TCP, UDP).
  3. Internet = OSI layer 3 (IP, ICMP).
  4. Network access (link) = OSI layers 1–2 (Ethernet, Wi-Fi).

TCP vs UDP

Basis TCP UDP
Connection connection set up first (handshake) no connection, just sends
Reliability lost data is resent no resending
Order data arrives in order may arrive out of order
Speed slower faster
Used for web, email, file transfer video calls, DNS, online games

The TCP three-way handshake

flowchart TD
    A["<b>Client → server: SYN</b><br>(let's connect)"]:::blue --> B["<b>Server → client: SYN-ACK</b><br>(ready, confirm?)"]:::blue
    B --> C["<b>Client → server: ACK</b><br>(confirmed)"]:::blue
    C --> D["<b>Connection open</b><br>(data can flow)"]:::green
    classDef blue fill:#5b84d424,stroke:#5b84d480
    classDef green fill:#52a86e24,stroke:#52a86e80

Ports and Services PYQ 1M

A port is a number (0–65535) that identifies a specific service on a computer, so one IP address can run many services at once.

Port Protocol Use
20, 21 FTP file transfer (20 data, 21 control)
22 SSH secure remote login
23 Telnet remote login, unencrypted
25 SMTP sending email
53 DNS name to IP lookup
80 HTTP web pages; default for web servers like Apache
110 POP3 downloading email
143 IMAP reading email on the server
389 LDAP directory lookups
443 HTTPS secure web pages
3389 RDP Windows remote desktop

Security points


HTTP Response Codes PYQ 5M

HTTP requests and responses

An HTTP response code (status code) is a three-digit number sent by a web server in reply to a request, telling whether the request succeeded and, if not, why.

The five classes

  1. 1xx Informational: request received, continuing.
  2. 2xx Success: request received, understood and accepted.
  3. 3xx Redirection: the browser must go somewhere else.
  4. 4xx Client error: the request has a problem (wrong address, no permission).
  5. 5xx Server error: the server failed to handle a valid request.

Common codes

Code Name Meaning
100 Continue send the rest of the request
200 OK success, page sent
201 Created new resource created (after POST)
204 No Content success, nothing to send back
301 Moved Permanently page has a new permanent address
302 Found temporary redirect
304 Not Modified use the copy in your cache
400 Bad Request request is malformed
401 Unauthorized login required
403 Forbidden logged in or not, access denied
404 Not Found page doesn't exist
429 Too Many Requests rate limit reached
500 Internal Server Error server-side failure
502 Bad Gateway bad reply from an upstream server
503 Service Unavailable server overloaded or down
504 Gateway Timeout upstream server too slow

Why they matter for security


IP, MAC, DNS and LDAP PYQ 1M · other

⚡ Quick recall
  • OSI 7 → 1? → application · presentation · session · transport · network · data link · physical (All People Seem To Need Data Processing)
  • TCP/IP? → application · transport · internet · network access
  • TCP vs UDP? → connection, reliable, ordered, slower vs connectionless, no resend, faster
  • Handshake? → SYN → SYN-ACK → ACK · SYN flood abuses it
  • Ports? → FTP 20/21 · SSH 22 · Telnet 23 · SMTP 25 · DNS 53 · HTTP 80 · POP3 110 · IMAP 143 · LDAP 389 · HTTPS 443 · RDP 3389
  • Response code? → three-digit server reply · 1xx info · 2xx success · 3xx redirect · 4xx client error · 5xx server error
  • Key codes? → 200 OK · 301/302 redirect · 304 not modified · 401 login · 403 forbidden · 404 not found · 500 server error · 503 unavailable
  • 1M: Apache default → 80 · Telnet → 23 · LDAP → Lightweight Directory Access Protocol
Unit 1 · 0/8