• Sonuç bulunamadı

İleri Düzey Bilgisayar Ağları

N/A
N/A
Protected

Academic year: 2022

Share "İleri Düzey Bilgisayar Ağları"

Copied!
76
0
0

Yükleniyor.... (view fulltext now)

Tam metin

(1)

İleri Düzey Bilgisayar Ağları

Ders 6

Ağ Güvenliği

Mehmet Demirci

(2)

İçerik

• Denial of Service saldırıları

• Saldırı tespiti ve önleme

• Güvenlik duvarları

• SSL/TLS, IPSec

• Kriptografinin temelleri

• Simetrik/asimetrik şifreleme, hash, e-imza

• DNS güvenliği

(3)

Denial-of-Service Attacks

• Denial-of-Service (DoS) attacks target availability.

• NIST definition of DoS: An action that prevents or impairs the

authorized use of networks, systems or applications by exhausting resources such as CPU, memory, bandwidth, and disk space.

(4)

Simple DoS Attacks

• Single attacker launches an attack such as ping flood.

• This has two major disadvantages for the attacker:

• The source is easy to detect.

• Responses will be sent to the source, so the attack will be reflected.

(5)

IP Address Spoofing

• IP Address Spoofing (or Source Address Spoofing) can be used by attackers in order to conceal themselves.

• The attacker has the ability to generate and use a different source IP address for each packet sent.

(6)

SYN Flood and Spoofing

Normal TCP operation:

SYN Flood:

(7)

Distributed DoS (DDoS) Attacks

• Usually, the attacker controls many bots or zombie systems.

• All of these attack the target together.

(8)

Defenses Against DoS Attacks

• Prevention: Backup resources, system modification, antispoofing

• Egress filtering: Do not allow outgoing packets with spoofed source address.

• Rate limiting: Limit the rate for certain packet types such as ICMP packets.

• Detection: Identifying suspicious patterns and filtering

• Source identification: Not very useful during the attack

• Reaction: Analyzing and learning lessons

(9)

Today

• Denial-of-Service Attacks

• Intrusion Detection

(10)

Intruder Types and Behavior

• Masquerader: Unauthorized user who gains control of a legitimate user’s account

• Misfeasor: Legitimate user who uses the system to do things for which she is not authorized.

Hacker

• White Hat: harmless

• Black Hat: harmful

(11)

Intruder Types and Behavior

Intruders can attack a software vulnerability to obtain access, or they can try to crack passwords. After gaining access, they can

• Copy critical data,

• Deface a web server,

• Capture usernames and passwords,

• Turn machines into bots,

• And do many more things.

(12)

Intrusion Detection: Concepts

Intrusion: Gaining unauthorized access (in short)

Intrusion detection: Finding attempts for unauthorized access IDS: Intrusion detection system

• Sensors collect data.

• Analyzers interpret the data and decide whether an intrusion has occurred.

• User interface communicates with the user.

(13)

Intrusion Detection: Principles

• Why do we want to detect intrusions?

• Let’s discuss.

• How are we able to detect intrusions?

• Intruders behave differently from legitimate users.

• IDS must be

• lightweight, configurable, adaptive, fault tolerant, robust, ...

(14)

Host-Based Intrusion Detection

A host-based IDS monitors the events within a single host to detect intrusions.

1. Anomaly detection

• Collect data for legitimate users.

• If new behavior is found to be “different” as a result of statistical tests, it is considered an anomaly.

• General thresholds or user profiles can be used.

(15)

Host-Based Intrusion Detection

A host-based IDS monitors the events within a single host to detect intrusions.

2. Signature detection

• Define a common pattern of behavior for attacks and attackers.

• Actions/users who fit this pattern are labeled as intrusions/intruders.

(16)

Network-Based Intrusion Detection

A network-based IDS monitors network traffic to detect intrusions.

• NIDS sensors may be deployed at different points.

• Outside the external firewall.

• Just inside the external firewall.

• In front of servers or workstation networks.

(17)

Network-Based Intrusion Detection

A network-based IDS monitors network traffic to detect intrusions.

• Similar to host-based ID, network-based ID uses anomaly and/or signature detection.

• Anomaly detection is useful against DoS attacks, worms etc.

• Signature detection is useful against password guessing, buffer overflows, scans for vulnerabilities etc.

(18)

Güvenlik Duvarı

Firewall

• Bilgi güvenliğinde kriptografinin çözüm olmadığı birçok alan vardır.

• Sistemlerde kriptografi ile çözülemeyecek açıklar ve zayıf noktalar varsa, kötü amaçlı yazılımlar bunları kullanırlar.

• Ağları zararlı trafikten korumak için yaygın olarak kullanılan yöntemlerden biri güvenllik duvarlarıdır.

(19)

Güvenlik Duvarı

Firewall

• Genellikle ağla İnternet’i ayıran bir noktada durup gelen-giden trafiği filtreleyen bir sistem.

• Ağı az güvenilir ve daha fazla güvenilir iki alana ayırmış olur.

• İki firewall ile üçe de ayrılabilir: İç ağ, DMZ (demilitarized zone – tampon bölge), İnternet.

• DMZ’de DNS, e-posta sunucuları gibi dışarıdan erişilebilmesi gereken servisler tutulur.

(20)

Güvenlik Duvarı

Firewall neye göre filtreler?

• IP, TCP, UDP gibi protokollere dair bilgiler (adres, port vs.)

• < Kaynak IP, Kaynak port, Varış IP, Varış port >

• Bazı kurallar engelleme, bazıları ise izin verme amaçlı olabilir.

• Bunları çelişmeyecek şekilde düzenlemek önemli ve zordur.

• Açıkça izinli olmayan bütün paketleri engellemek tutarlı bir yöntem olabilir. İhtiyaç duyuldukça yeni izinler eklenir.

(21)

Güvenlik Duvarı

Firewall neye göre filtreler?

• HTTP gibi protokollerin bilgilerine (URL) göre de filtreleme olabilir.

• Çoğu sunucu, istemciye cevap verirken dinamik port numarası kullanır. İstemci tarafındaki firewall bunu önceden bilemez.

• Firewall stateful (durum tutan) şekilde çalışırsa, istemci isteklerinin kaydını tutar. Gelen cevap kayıtlı bir istekle alakalıysa izin verir.

(22)

Güvenlik Duvarı

Firewall neye yarar?

• İstenen şekilde çalışırsa ağı İnternet’ten gelecek istenmeyen erişimlerden korur.

• Fakat iletişimin güvenliğini sağlamaz.

• Tek tarafta uygulanabilir olması, birtakım güvenlik kontrollerini tek noktada toplayıp ağın içindeki cihaz ve kullanıcıları bazı

endişelerden kurtarması avantajdır.

(23)

Güvenlik Duvarı

Firewall: Zayıf noktalar

• Ağın içinde herhangi bir etkisi yoktur. İçeriye normal erişim sağlayan kötü niyetli kullanıcıyı bu noktadan sonra durduramaz.

• Firewall’dan geçiş hakkı verilen her uzak sistem yeni bir güvenlik zaafı oluşturabilir.

(24)

SSL/TLS

• SSL ilk olarak Netscape tarafından geliştirildi ve IETF’in TLS standardına temel oldu.

• Webden alışverişin güvenliğine çözüm amacıyla önerildi.

• Gizlilik  Ödeme bilgilerinin başkasının eline geçmemesi

• Bütünlük  Alıcının isteği dışında işlem yapılmaması

• Kimlik doğrulama  Satıcının gerçek ve güvenilir olması

(25)

SSL/TLS

• SSL/TLS, uygulama katmanının altında çalışır ve uygulamaya güvenli bir taşıma katmanı olarak görünür.

• Ama TCP gibi taşıma protokollerinde bir değişiklik yapmaz yani onların üstünde çalışır ve TCP özelliklerinden faydalanır.

• HTTP, SSL/TLS üzerinde çalışında HTTPS olur.

(26)

SSL/TLS

• TLS’te iletişimin başlangıcında kripto bileşenleri seçilir.

• Bütünlük için hash türü

• Gizlilik için simetrik şifreleme türü

• Oturum anahtarı oluşturmak için yöntem

• Buna el sıkışma protokolü denir.

(27)

SSL/TLS

• Daha sonra kayıt protokolü (record protocol) taşımayı güvenli hale getirir. Uygulamadan gelen mesajlar

• Bloklara bölünür.

• HMAC ile bütünlük kazandırılmış hale getirilir.

• Simetrik anahtarlı algoritmayla şifrelenir.

• TCP’ye gönderim için iletilir.

(28)

IPsec

• Birçok protokolü barındıran bir çerçeve (framework)

• IPv4’da isteğe bağlı, IPv6’te zorunlu.

• Modüler: Kullanıcı/admin farklı algoritma ve protokollerden istediğini seçebilir.

• Özellik seçimi yapılabilir. Bütünlük, kimlik doğrulama vs.

• Etki kapsamı seçimi yapılabilir. Tek bir uçtan uca akış veya iki yönlendirici arasındaki tüm paketler gibi.

(29)

IPsec

• IPSec’te iki protokol vardır: Authentication Header (AH) ve Encapsulating Security Payload (ESP).

• AH pek kullanılmaz, ESP kullanılır.

• ESP’de erişim denetimi, mesaj bütünlüğü, kimlik doğrulama ve gizlilik vardır.

• Altta Security Association (SA) denen tek yönlü bir bağlantı vardır.

(30)

IPsec

Her SA iki moddan birinde çalışır.

1. Taşıma (transport) modu

• IP paketinin sadece payload kısmı şifrelenir/hashlenir.

• Başlık değişmez. ESP payloadu alıp üst protokole iletir.

2. Tünel (tunnel) modu

• IP paketinin bütünü şifrelenir/hashlenir ve başka bir IP paketi içine koyulur (encapsulation). VPN veya uzaktan kullanıcı erişimi gibi

(31)

Symmetric Key Cryptography

Symmetric key cryptography: Encryption key = Decryption key

• One secret key per user pair (or group)

• Also called “Secret key cryptography”

(32)

Symmetric Key Cryptography

Block ciphers vs. Stream ciphers

• Block ciphers encrypt plaintext in blocks (groups of bits).

• Stream ciphers encrypt plaintext bit-by-bit.

(33)

Block Ciphers vs. Stream Ciphers Summary

• Block ciphers are generally more popular than stream ciphers.

• Stream ciphers are suitable for low-power devices thanks to their simplicity.

• In stream ciphers, keystream generation must be done carefully to avoid vulnerabilities.

• In block ciphers, mode of operation must be chosen wisely.

(34)

Asymmetric Key Cryptography

Asymmetric key cryptography: Encryption key ≠ Decryption key

• Two keys, one secret (private), one public

• Also called “Public key cryptography”

(35)

Asymmetric Key Cryptography

Asymmetric key cryptography is significantly different from symmetric key cryptography. It represents a revolution in cryptography because

• It is not based on substitution-permutation networks like symmetric key algorithms, whose main goal is confusion.

• It is based on number theory.

(36)

Public Key Cryptosystem (PKC)

PKC Properties

• Given encryption key and algorithm, decryption key cannot be determined.

• We can use either key for encryption, and the other key for decryption.

(37)

Public Key Cryptosystem (PKC)

PKC Steps

• Each user generates a pair of keys.

• Makes one key public, keeps the other one secret (private).

• Bob encrypts a confidential message with Alice’s public key and sends her the resulting ciphertext to Alice.

• Alice decrypts the ciphertext with her own private key to get the message.

(38)

Public Key Cryptosystem (PKC)

PKC for Authentication

• Bob encrypts a message with his own private key and sends the resulting ciphertext to Alice (or broadcasts it).

• Alice decrypts the ciphertext with Bob’s public key to get the message.

• Anyone can decrypt the ciphertext and verify that Bob generated the message.

(39)

Public Key Cryptosystem (PKC)

PKC Requirements It must be

• Easy to generate the key pair.

• Easy to encrypt a plaintext message.

• Easy to decrypt a ciphertext if you know the decryption key.

• Computationally infeasible to obtain the private key given the public key.

• Computationally infeasible to obtain the plaintext given the ciphertext and the public key.

(40)

Public Key Cryptosystem (PKC)

PKC Requirements

How can we achieve these requirements?

• We need special functions: Trap-door one-way functions

(41)

Public Key Cryptosystem (PKC)

One-way functions

• 𝒀 = 𝒇(𝑿) easy

• 𝑿 = 𝒇−𝟏(𝒀) infeasible

Trap-door one-way functions

• 𝒀 = 𝒇𝒌(𝑿) easy, if 𝒌 and 𝑿 are known

• 𝑿 = 𝒇𝒌−𝟏(𝒀) easy, if 𝒌 and 𝒀 are known

infeasible, if 𝒀 is known but 𝒌 is not known.

(42)

Public Key Cryptosystem (PKC)

RSA Algorithm

• Published by Rivest, Shamir and Adleman in 1978.

• Encrypt in blocks, block size is 𝒊 bits, where 𝟐𝒊 < 𝒏 .

• Encryption: 𝑪 = 𝑴𝒆 (𝒎𝒐𝒅 𝒏)

• Decryption: 𝑴 = 𝑪𝒅 (𝒎𝒐𝒅 𝒏)

• 𝒏, 𝒆 are public.

(43)

RSA

How to set up RSA:

• Choose two primes 𝒑 and 𝒒 (private).

• Calculate 𝐧 = 𝒑𝒒 (public).

• Choose public 𝒆 < 𝝋(𝒏) such that 𝒈𝒄𝒅 𝝋 𝒏 , 𝒆 = 𝟏.

• Calculate private 𝒅 ≡ 𝒆−𝟏 𝒎𝒐𝒅 𝝋 𝒏 .

• Encryption: 𝑪 = 𝑴𝒆 (𝒎𝒐𝒅 𝒏)

• Decryption: 𝑴 = 𝑪𝒅 (𝒎𝒐𝒅 𝒏)

(44)

Security of RSA

• Brute force attacks → Use long keys, but this will make RSA slower.

• Mathematical attacks: Most of these focus on the factoring problem:

• Factor 𝐧 = 𝒑𝒒 to determine 𝒑 and 𝒒. Then 𝒅 can be found.

• Factoring is a hard problem, so this is not feasible, but factoring algorithms are getting better and computers are getting more powerful.

• So, RSA may not be safe forever.

• Plain RSA is vulnerable to a chosen-ciphertext attack.

(45)

Message Authentication

• Encryption protects against passive attacks.

• How do we protect data from active attacks?

• The answer lies in message authentication.

(46)

Message Authentication

What is message authentication?

• Verification of integrity plus authenticity (being authentic)

• Message (file, document etc.) authentication confirms that

• The message has not been changed in storage or transit,

• The message is real and it comes from the claimed source.

(47)

Message Authentication

Authentication is often separate from confidentiality.

• Broadcast messages

• Protecting program integrity

(48)

Message Authentication Code (MAC)

• Use symmetric key encryption to generate a small code from the message.

• 𝑴𝑨𝑪𝑴 = 𝑭(𝑲, 𝑴)

• Append it to the message and send the message.

(49)

Message Authentication Code (MAC)

• The receiver, who also has the key, produces the MAC from the received message.

• Compares this MAC to the MAC that came with the message.

(50)

Message Authentication Code (MAC)

A correct MAC ensures that

• The message has not been modified,

• The message really came from the claimed source,

• The sequence number has not been changed.

(51)

Cryptographic Hash Functions

• A hash function H takes a variable-size message and produces a fixed-size message digest.

• Hash function does not take a key as input.

(52)

Cryptographic Hash Function Requirements

Hash functions are used for providing integrity. They ensure that the message has not changed. They must have these properties:

• 𝑯 𝒙 must be easy to compute for any 𝒙.

• Given any 𝒉, it must be infeasible to find 𝒙 such that 𝑯 𝒙 = 𝒉.

• One-way

• Given any 𝒙, it must be infeasible to find 𝒚 such that 𝑯 𝒙 = 𝑯(𝒚).

• Weak collision resistant

• It must be infeasible to find any pair (𝐱, 𝒚) such that 𝑯 𝒙 = 𝑯(𝒚).

(53)

Cryptographic Hash Function Examples

Secure Hash Algorithm (SHA) series by NSA

• SHA-1, SHA-2 (SHA-256, SHA-384, SHA-512), SHA-3 Message Digest (MD) series by Ron Rivest

• MD2, MD4, MD5, MD6

(54)

Using Hashes for Authentication

• A hash function can be used for message integrity, but it cannot provide message authentication by itself.

• We can use hash functions along with keys to provide authentication.

(55)

Using Hashes for Authentication

With Encryption: Using symmetric or asymmetric key cryptography

(56)

Using Hashes for Authentication

Without Encryption: Keyed hash MAC

(57)

Other Uses of Hash Functions

• Passwords

• Hash function must be one-way and weak collision resistant.

• Intrusion Detection

• Take the hash of all files and keep them secure somewhere else.

• If attacker modifies files, it will be discovered if the hash function is weak collision resistant.

(58)

Today

• Message authentication and hash functions

• Digital signatures, public key certificates, key exchange and digital envelopes

(59)

Digital Signatures

An application of public-key cryptography

• Alice generates hash from message, encrypts hash with 𝒑𝒓𝒊𝑨 to obtain digital signature, sends message with digital signature attached.

• Bob receives message plus signature, calculates hash 𝒉′ from message, decrypts signature with 𝒑𝒖𝒃𝑨 to get 𝒉, compare 𝒉′ to 𝒉.

• If they are the same, message is authenticated.

(60)

Public Key Certificates

Another application of public-key cryptography

• Public keys are announced, but how do we know if the announcement is real?

• A user’s public key is signed by a trusted certificate authority (CA).

(61)

Key Exchange

Another application of public-key cryptography

• To use symmetric encryption, users must share a secret key.

• How is this key going to be generated by both parties?

• Diffie-Hellman key exchange algorithm is one solution.

(62)

Diffie-Hellman Key Exchange

• Allows users to select private keys and generate public keys from those private keys. Then they exchange the public keys.

• They use their own private keys along with the other user’s public key to generate a common secret key.

• How? Through magic (math).

(63)

Digital Envelopes

Yet another application of public-key cryptography

• Allows users to exchange confidential messages without agreeing on a shared secret key first.

• Alice encrypts the message using a random symmetric key 𝑲.

• Alice then encrypts 𝑲 with Bob’s public key.

• Alice sends the encrypted message plus the encrypted key to Bob.

(64)

Anahtarlar

• Güvenli iletişimde anahtarlar ömürleri bakımından uzun vadeli ve kısa vadeli olarak ikiye ayrılır.

• Long-term key vs. Session key

• Kısa vadeli oturum anahtarı, uzun vadeli anahtarlar kullanılarak güvenli biçimde oluşturulabilir.

(65)

Açık Anahtar Altyapısı

Public Key Infrastructure

• Açık anahtarlar ile kimlikler arasındaki bağı doğrulama imkanı verir.

• En basit senaryoda B, A ve C’yi tanıyor ve açık anahtarlarını biliyor olsun. Ama A ile C tanışmıyor.

• B, A’nın açık anahtarını kendi gizli anahtarıyla imzalar. C, B’ye

güveniyorsa imzayı doğrular ve A’nın açık anahtarına ulaşmış olur.

(66)

Açık Anahtar Altyapısı

Public Key Infrastructure

• B, güvenilir bir otoriteyse bu şekilde açık anahtar sertifikaları oluşturabilir.

• Bu durumda B’nin imzaladığı sertifikaları doğrulamak için tek gereken B’nin açık anahtarının bilinmesidir.

• B’ye sertifika otoritesi (CA) denir.

(67)

Açık Anahtar Altyapısı

X.509

• Yaygın bir sertifika standardı

• Sertifika şunları içermelidir:

• Sertifika verilenin (anahtarı onaylananın) kimliği ve açık anahtarı

• Sertifikayı verenin kimliği

• Sayısal imza

• Kullanılan hash ve şifreleme algoritmalarını gösteren belirteç

• Geçerlilik süresi (opsiyonel)

(68)

Açık Anahtar Altyapısı

CA’lerde güven zinciri

• A B’ye, B de C’ye sertifika onayı verdiyse C’nin sertifikasına güvenelim mi?

• Eğer A’nın açık anahtarını biliyor, A ve B’nin her ikisine de güveniyorsak, evet.

• Burada hiyerarşik bir ağaç yapısı vardır.

(69)

Açık Anahtar Altyapısı

CA’lerde güven zinciri

• Zincirde bir halka işini düzgün yapmazsa (mesela kimliği tam olarak doğrulamadan sertifika verirse) zincir oradan kopar.

• X.509’da ağacın üstündeki bir CA alttakilerden hangilerine güvendiğini de belirleyebilir.

(70)

Açık Anahtar Altyapısı

PKI’da Güven Ağı (Web of Trust)

• PGP’de kullanılır, CA yoktur.

• Herkes kime ve ne kadar güvendiğini belirler.

• Ayrıca sertifikayı sağlayan, sertifikadaki kişinin açık anahtarına ne kadar güvendiğini de sertifikada belirtebilir.

• Böylece her kullanıcı kararları kendisi verebilir.

(71)

Açık Anahtar Altyapısı

Sertifika iptali (revocation)

• Gizli anahtarınızı kaptırırsanız sertifikanızı iptal etmeniz gerekir.

• Her CA bir CRL tutar.

• Bir sertifika doğrulamak istediğimizde önce iptal olmuş mu diye CRL’e bakarız.

(72)

Uçtan Uca Güvenlik: PGP

• E-posta için CIA artı inkar edememe.

Adımlar:

• A, mesajı dijital olarak imzalar.

• Bir tek bu mesaj için bir oturum anahtarı hazırlar.

• İmzalı mesajı bu oturum anahtarıyla şifreler.

• Oturum anahtarını da B’nin açık anahtarıyla şifreleyerek ekler.

• ASCII formatına çevirerek yollar.

(73)

DNS Saldırıları

DNS Cache Poisoning

• DNS sunucusunun cache içerisinde yanlış kayıt tutmasına yol açmak

• Bunun için şunlar yapılabilir:

• İlgisiz veri (unrelated data) saldırısı - çözüldü

• İlgili veri (related data) saldırısı - çözüldü

• DNS Spoofing

(74)

DNS Saldırıları

DNS Spoofing

• Araya girip başka sunucuya giden sorguya cevap vermek

• Gerçek sunucunun IP adresi sahte paketin başlığına yazılır.

• Bir tek IP Spoofing yetmez, sorguyla birlikte giden ID numarasını da bilmesi gerekir.

(75)

DNS Saldırıları

DNS ID Hacking

Saldırgan ID’yi tespit etmek için

• Farklı ID’ler deneyebilir. Eğer gerçek sunucundan önce doğru cevabı verirse başarmış olur.

• Gerçek sunucuyu yavaşlatmak için ona flood yapabilir.

• Sunucu sıralı ID kullanıyorsa bundan faydalanabilir.

(76)

DNS Security Extensions (DNSSEC)

DNSSEC

• Kimlik doğrulama ve bütünlük sağlar.

• DNS cevapları dijital imza içerir.

• Evrensel kullanıma henüz ulaşmamıştır.

Referanslar

Benzer Belgeler

Onun, İngiliz edebiyatının kült eserlerinden biri olarak kabul edilen Harikalar Diyarında Alice’in Maceraları adlı romanında hem kendi döneminin sosyolojik ve

White (126) holds that that the experience of the sublime is closely related to the experience of the sacred; and he shows how even in Burke and Kant, the sublime is grasped as

Önce gözleriniz ve sonra tüm benliğinizle aşağı kayıp, kesit- teki 100 milyon yıl öncenin deniz taba- nına düşüverirsiniz; tıpkı ağaç kabuğun- da kaybolan Alice

‹stanbul Üniversitesi ‹stanbul T›p Fakültesi, ‹ç Hastal›klar› Anabilim Dal›, Romatoloji Bilim Dal›, ‹stanbul.. Amaç: TNF reseptörü ile iliflkili periyodik

Araştırma sonuçları incelendiğinde Alice programının programlama dili öğreniminde sağladığı yararlar ile ilgili öğrenciler en çok; kod mantığını

Nearly a century ago, a professor at Oxford , Charles Dodgson – better known as Lewis Caroll – wrote a simple, fascinating story , called Alice In Wonderland.. But , perhaps the

In the recently demonstrated technique of ablation cooled material processing [19], pulses with a few hundreds of nano joules have been used, and much faster material removal has

[r]