IT VL 6-7 Emails & Email Spam

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/17

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

18 Terms

1
New cards

E-Mails General Information

Two entities:

  • Mail user agents (MUAs)

  • Mail transfer agents / mail servers (MTAs)

Protocols

  • simple mail transfer protocol (SMTP)

  • Post Office Protocol (POP3)

  • Internet Message Access Protocol (IMAP)

<p>Two entities:</p><ul><li><p>Mail user agents (MUAs)</p></li><li><p>Mail transfer agents / mail servers (MTAs)</p></li></ul><p>Protocols</p><ul><li><p>simple mail transfer protocol (SMTP)</p></li><li><p>Post Office Protocol (POP3)</p></li><li><p>Internet Message Access Protocol (IMAP)</p></li></ul><p></p>
2
New cards

Mail Transfer Agent

MTA is a server that listens for incoming mail

MTA decides what to do with incoming mail:

  • save locally: for pickup by useres (e.g. in var/spool/mail/…)

  • forward to another MTA (via SMTP)

A forwarding MTA is known as a mail relay

An MTA does not deliver email to the MUA

  • MTA is not an IMAP or POP3 server

3
New cards

Mail User Agent

Mail software used to read an write mail

Local acess to mail (/var/spool/mail)

Access to mail server via IMAP or POP

Well known MUAs include: Thunderbird, Outlook, Mutt

4
New cards

SMTP (Simple MAil transfer Protocol)

Text Protocol

  • client sends commands (4 ASCII characters + parameters)

  • server responds with reply code (3 decimal digits)

SMTP Envelope (network protocol level)

  • e.g. SMTP commands: MAIL, RCPT, DATA

SMTP Content (message level)

  • Message headers + message body

Hard to transfer binary data like images and video

Internet Message Format (RFC 5322)

  • message Headers contain information about msg (e.g. To, From, Bcc, Date,…)

  • message Headers processed by Mail User Agents → independent from SMTP envelope

  • Message Body contains message itself and contains pure ASCII text

<p>Text Protocol</p><ul><li><p>client sends commands (4 ASCII characters + parameters)</p></li><li><p>server responds with reply code (3 decimal digits)</p></li></ul><p>SMTP Envelope (network protocol level)</p><ul><li><p>e.g. SMTP commands:  MAIL, RCPT, DATA</p></li></ul><p>SMTP Content (message level)</p><ul><li><p>Message headers + message body</p></li></ul><p>Hard to transfer binary data like images and video</p><p>Internet Message Format (RFC 5322)</p><ul><li><p>message Headers contain information about msg (e.g. To, From, Bcc, Date,…)</p></li><li><p>message Headers processed by Mail User Agents → independent from SMTP envelope</p></li><li><p>Message Body contains message itself and contains pure ASCII text</p></li></ul>
5
New cards

MIME (Multipurpose Internet Mail Extensions)

Purpose: messages with rich content

  • International languages, multimedia messages, multipart messages

Approach: Convert everything to RFC 5322 ASCII message

  • Only MUAs have to be modified, not the MTAs

replace non-ASCII characters with a special encoding

  • example Quoted Printable Transfer Encoding → ä in UTF8 = 0xC3 0xA4 → convert to quoted printable =C3=A4 → Universität = Universit=C3=A4t

  • Base64 transfer encoding e.g. Bild

MIME Content Types:

  • media Types: e.g. Type text subtype plain or richtext ; Type video subtype mpeg; …

  • Content Types: e.g. Type multipart subtype parallel; type message subtype external-body

6
New cards

Base 64 Encoding

Content is considered as binary data stream

Idea: Map each group of 24 bit (3 input bytes) to an output string of 4 ASCII characters

3x8 input bit rearranged to 4x6 output bit

Each of the 6 output bit is represented with one symbol

  • We use printable ASCII characters as symbols

  • Look up symbol from table of 2^6 = 64 characters

Base64 Padding

  • Problem: Base64 output is arranged in lines with 76 characters each → What if input data is not a multiple of 3 bytes (24 bit)

  • Solution fill data with zero bytes 0×00

  • Indicate the numer of padding bytes by append “=” to avoid changing the content with the zeros

<p>Content is considered as binary data stream </p><p>Idea: Map each group of 24 bit (3 input bytes) to an output string of 4 ASCII characters</p><p>3x8 input bit rearranged to 4x6 output bit</p><p>Each of the 6 output bit is represented with one symbol </p><ul><li><p>We use printable ASCII characters as symbols </p></li><li><p>Look up symbol from table of 2^6 = 64 characters</p></li></ul><p>Base64 Padding</p><ul><li><p>Problem: Base64 output is arranged in lines with 76 characters each → What if input data is not a multiple of 3 bytes (24 bit)</p></li><li><p>Solution fill data with zero bytes 0×00</p></li><li><p>Indicate the numer of padding bytes by append “=” to avoid changing the content with the zeros</p></li></ul>
7
New cards

POP3 (Post Office Protocol 3)

Recipient wants to read mail on local machine but mail is usally handled by mail server

→ POP 3 transfers mail from server to MUA

POP3 ist outdated → use IMAP instead

Features limited to

  • Retrieve a list of all mails

  • Download mails from server to local machine

  • Delete mails on server

provides different authentication mechanisms (Username/Password; Username/Digest(hashedPw); SASL;…)

Does not specify how to send mail

POP3 Problems:

  • No extensive manipulation operations (limited to ∘ List, Download, Delete)

  • Limmited Support for Concurrent access

8
New cards

IMAP (Internet Message Access Protocol)

Purpose: access mailbox remotely from Mail User Agent → Mailbox remains on a central mail server

Features:

  • Concurrent access from more than one computer (MUA)

  • Store messages in folders

  • Partial fetch (download only required parts)

  • Flagging of messages (e.g. as read or answered)

  • Server-side search

No functionality to send messages (realized with SMTP)

IMAP Network Protocol

  • ASCII Text Protocol

  • Staful protocol with sessions (1. Non Authenticated, 2. Authenticated,3. Selected, 4. Logout,Closed) → für diagram Folie 49

  • several commands are only valid in one stage

Client-Server Interaction

  • Client command begins with alphanumeric string (tag) e.g. ‘A001’ which is created for every new command

  • Server receives and works with the command

  • Returns the same tag with a response code (OK/NO/BAD)

  • Additional information begins with ‘*’ (untagged)

  • Tagging enables pipelining and re-ordering of server responses

<p>Purpose: access mailbox remotely from Mail User Agent → Mailbox remains on a central mail server</p><p>Features: </p><ul><li><p>Concurrent access from more than one computer (MUA) </p></li><li><p>Store messages in folders </p></li><li><p>Partial fetch (download only required parts) </p></li><li><p>Flagging of messages (e.g. as read or answered) </p></li><li><p>Server-side search</p></li></ul><p>No functionality to send messages (realized with SMTP)</p><p>IMAP Network Protocol</p><ul><li><p>ASCII Text Protocol</p></li><li><p>Staful protocol with sessions (1. Non Authenticated, 2. Authenticated,3. Selected, 4. Logout,Closed) → für diagram Folie 49</p></li><li><p>several commands are only valid in one stage</p></li></ul><p>Client-Server Interaction</p><ul><li><p>Client command begins with alphanumeric string (tag) e.g. ‘A001’ which is created for every new command</p></li><li><p>Server receives and works with the command</p></li><li><p>Returns the same tag with a response code (OK/NO/BAD)</p></li><li><p>Additional information begins with ‘*’ (untagged)</p></li><li><p>Tagging enables pipelining and re-ordering of server responses</p></li></ul>
9
New cards

Flags Message Attributes

List of tokens associated with the message (sent by the server)

A flag can be permanent or session-only

Types:

  • System flag: → Flag name that is pre-defined in the imap specification • All system flags begin with ‘\

  • Keywords: → A keyword is defined by the server implementation • Keywords do not begin with ‘\’

10
New cards

User Authentification

SMTP after POP

  • Authenticate via POP, save client IP address

  • Allow SMTP afterwards if IP address matches

TMTP Authentification

  • SMTP AUTH protocol extension → Requires Extended SMTP

  • Plaintext login

    ∘ Base64-encoded (for compatibility, not security)

    ∘ Secure only if SMTP connection encapsulated by TLS

  • Digest authentication (hashed password)

    ∘ Server sends challenge (arbitrary, unique string)

    ∘ Client „encrypts“ challenge with password, sends response

    ∘ Server checks response with known password

    ∘ Password hidden, but dictionary attacks on response possible

<p>SMTP after POP</p><ul><li><p>Authenticate via POP, save client IP address</p></li><li><p>Allow SMTP afterwards if IP address matches</p></li></ul><p>TMTP Authentification</p><ul><li><p>SMTP AUTH protocol extension → Requires Extended SMTP</p></li><li><p>Plaintext login </p><p>  ∘ Base64-encoded (for compatibility, not security) </p><p>  ∘ Secure only if SMTP connection encapsulated by TLS</p></li><li><p>Digest authentication (hashed password)</p><p>  ∘ Server sends challenge (arbitrary, unique string)</p><p>  ∘ Client „encrypts“ challenge with password, sends response </p><p>  ∘ Server checks response with known password </p><p>  ∘ Password hidden, but dictionary attacks on response possible</p></li></ul>
11
New cards

TLS Encryption

All email protocols support insecure cleartext transfers

Encapsulate connection with Transport Layer Security

  • TLS ensures server authenticity, encrypts data

  • Protects from passive surveillance and active man-in-the-middle attacks

Two approaches:

  1. Connect to extra port for secure SMTP (deprecated)

  2. Use STARTTLS command within ESMTP connection

<p>All email protocols support insecure cleartext transfers</p><p>Encapsulate connection with Transport Layer Security </p><ul><li><p>TLS ensures server authenticity, encrypts data </p></li><li><p>Protects from passive surveillance and active man-in-the-middle attacks</p></li></ul><p>Two approaches: </p><ol><li><p>Connect to extra port for secure SMTP (deprecated) </p></li><li><p>Use STARTTLS command within ESMTP connection</p></li></ol><p></p>
12
New cards

EMail Spam

Spam: undesired mass message

Ham: non-spam message

Unsolicited Bulk Email (UBE): spam

Unsolicited Commercial Email (UCE): commercial spam

False positive: ham message classified as spam

False negative: spam messages classified as ham

<p>Spam: undesired mass message </p><p>Ham: non-spam message </p><p>Unsolicited Bulk Email (UBE): spam </p><p>Unsolicited Commercial Email (UCE): commercial spam </p><p>False positive: ham message classified as spam </p><p>False negative: spam messages classified as ham</p><p></p>
13
New cards

Preventing Adress Harvesting

Adressing Munging

  • Spammer crawls the web to retrieve email addresses

  • Munge email address to dodge crawlers (Try not to annoy users)

  • Publish email address as image

  • Generate address with JavaScript

Disposable Adress

  • creating a temporary throw away address

14
New cards

Preventing Spam from leaving your network

Spam Relays:

  • Mail Transfer Agents (MTA) forward mails

  • Open relays forward mails for anyone → easy for Spammer

  • Today‘s mailservers are closed relays in default config → Require authentication

  • Open proxies also prone to abuse (if misconfigured)

  • Spam often originates from botnets

Port Blocking:

  • MTA listens always on TCP/25

  • Block outgoing connections from client computers → Force clients to use designated MTA for outgoing mails

  • Block incoming connections to client computers → Force remote MTA to use domain MTA for incoming mail

15
New cards

Sender Helping With Identifying legitimate email

Hashcash:

  • Idea: associate sending email with cost like a post stamp → Resource: computing power

  • Find hash = SHA1(date, receiver address, random) where hash ≤ 0x00000FFFFFFFFFFFFFF → Modify random value until you find a matching hash value

  • The result serves as proof-of-work → Finding 20 binary zeros requires on average 220 hash operations →Receiver can verify result with 1 hash operation

Sender Policy Framework

  • Publish IP addresses of authorized MTAs As TXT record in Domain Name System → example.net IN TXT "v=spf1 ip4:192.0.2.0/24 -all"

  • Receiver gets email from *@example.net →Looks up SPF/TXT record of example.net → IP address of sending MTA ≙ SPF definition?

  • ∙ Unauthorized SMTP sender indicates spoofing

DomainKeys Identified Mail (DKIM)

  • MTA signs outgoing mail → Puts signature in email header

  • Public key published in Domain name System → Again TXT record, but under particular name

  • Compared to SPF: Slighty more complex → survives SMTP relaying/forwarding

16
New cards

Slowing down Sender

Human Interaction Challange-Response

  • MTA receives email from unknown sender

  • MTA delays email and sends challenge (E.g. click URL or calculate 5+7)

  • User solves challenge and sends response ∘ Requires manual interaction of sender → Spammer is expected to ignore challenge

  • Mail is forwarded when response was correct

Greylisting

  • SMTP was built for robustness

  • MTA receives email from unknown sender

  • Save sender in greylist and reply with temporary error

  • If sender retries after ≥ 15 minutes, accept email → Spammer is not expected to retry later

Teergrube/ Tarpit

  • Spammers send many mails in short time

  • Idea: use your resources to slow down spammer

  • Delay SMTP responses to keep TCP connection open ∘ Send choked multiline response to avoid timeout trigger (e.g. 451-Well... 451-Give me a moment 451-Just a second 451-Or a minute 451-Or two 451 Error, closing connection)

  • Make sure you dont tarpit legitimate MTAs → wastes recources and annoys admins

17
New cards

Receiver-Side detection and filtering

Rule-based-Filtering:

  • ∙ Parse incoming mail for known spam patterns → Define rules with regular expressions

  • Key words and phrases → e.g. „fast viagra delivery overnight“

  • Disguise attempts ∘ „V.A.L.I.U.M“ ∘ Unnecessary URL encoding

  • Errors and patterns unusual for legitimate MUA ∘ Malformed headers ∘ HTML message without plaintext copy

Bayesian Filter:

  • Abbildung

DNS Blacklists (DNSBL)

  • Database of open relays and spammer IP addresses ∘ May include ranges of dialin hosts

  • Various different DNSBL providers ∘ Trust required: false listing can cut off your email traffic

  • DNS Whitelists also common for large email providers

Hash Value Databases

  • Database of email spam hash values ∘ e.g. Distributed Checksum Clearinghouse (DCC)

  • Calculate hash value over message body (not headers)

  • Query database via UDP or pipelined TCP connection

  • When a new email arrives, its hash value is compared against the hash values stored in the spam database

FIltering Actions

  • Use combination of different measures ∘ Calculate probability/score per email

  • Take actions, depending on score (e.g. Deny Email with error, move to spam folder, fall back to greylisting, challange/response or teergrube)

<p>Rule-based-Filtering:</p><ul><li><p>∙ Parse incoming mail for known spam patterns → Define rules with regular expressions</p></li><li><p>Key words and phrases → e.g. „fast viagra delivery overnight“</p></li><li><p>Disguise attempts ∘ „V.A.L.I.U.M“ ∘ Unnecessary URL encoding</p></li><li><p>Errors and patterns unusual for legitimate MUA ∘ Malformed headers ∘ HTML message without plaintext copy</p></li></ul><p>Bayesian Filter:</p><ul><li><p>Abbildung</p></li></ul><p>DNS Blacklists (DNSBL)</p><ul><li><p>Database of open relays and spammer IP addresses ∘ May include ranges of dialin hosts</p></li><li><p>Various different DNSBL providers ∘ Trust required: false listing can cut off your email traffic</p></li><li><p>DNS Whitelists also common for large email providers</p></li></ul><p>Hash Value Databases</p><ul><li><p>Database of email spam hash values ∘ e.g. Distributed Checksum Clearinghouse (DCC)</p></li><li><p>Calculate hash value over message body (not headers)</p></li><li><p>Query database via UDP or pipelined TCP connection</p></li><li><p>When a new email arrives, its hash value is compared against the hash values stored in the spam database</p></li></ul><p>FIltering Actions</p><ul><li><p>Use combination of different measures ∘ Calculate probability/score per email</p></li><li><p>Take actions, depending on score (e.g. Deny Email with error, move to spam folder, fall back to greylisting, challange/response or teergrube)</p></li></ul>
18
New cards

5 Types of ways to Prevent Spam

  1. Prevent address harvesting

  2. Prevent spam leaving your network

  3. Sender helps identifying legitimate email

  4. Slow down sender

  5. Receiver-side only detection and filtering