You are on page 1of 64

Encryption

What is Security?
• Security:
◦ Free from danger, damage, loss or threats
• Information Security:
◦ Protecting information from access, use, disclosure, disruption,
modification, inspection, recording or destruction
• Cyber Security:
◦ Securing things that are vulnerable through ICT

2
Basic Components of Security
• CIA Triad
◦ Confidentiality: Who is authorized to use data? I
C
◦ Integrity: Is data good? S
◦ Availability: Can access data whenever need it?
A

3
Confidentiality
• Prevention the disclosure of information to
unauthorized individuals or systems
• Confidentiality involves in:
◦ Data Protection
◦ Providing access for those who are allowed
◦ Disallowing others from learning anything

C I
S

4
How to achieve Confidentiality
• Encrpytion
◦ Cryptography
• Access Control
◦ Rules and policies that limit access to confidential information
• Authentication
◦ Determination of the identity
• Authorization
◦ Determination if person is allowed to access

5
Technical view of Cryptography

6
Integrity
• The property that information has not be altered in an
unauthorized way
• Integrity is loss when data is modified undetectably

C I
S

7
How to achieve Integrity
• Backups
• Checksums
• Data correcting codes

8
Availability
• The property that information is accessible and
modifiable in a timely fashion by those authorized to
do so
• Other meaning
◦ Present in a usable form
◦ Enough capacity to meet the service’s needs
◦ Completed services in an acceptable period of time

9
How to achieve Availability
• Physical protections
◦ Infrastructure meant to keep information available even in the
event of physical challenges
◦ Fault tolerance (graceful cessation instead of crash or abrupt)
• System Redundancy
◦ System that serve as fallbacks in the case of failures

C I
S

10
How do we measure availability?

Nine % Availability Downtime/year Downtime/month Downtime/Week


One nine 90% 36.5 days 72 hours 16.8 hours
Two nines 99% 3.65 days 7.2 hours 1.68 hours
Three nines 99.9% 8.76 hours 43.2 minutes 10.1 minutes
Four nines 99.99% 52.56 minutes 4.32 minutes 1.01 minutes
Five nines 99.999% 5.26 minutes 25.9 seconds 6.05 seconds
Six nines 99.9999% 31.6 seconds 2.59 seconds 0.605 seconds

11
World Economic Forum

12
Growth of Cybercrime Costs

13
ผลจากการถูกจารกรรมข้อมูล
• การสืบสวนทางเทคนิค
• การแจ้งเตือนการละเมิดกับลูกค้า
• การปฏิบัติตามข้อบังคับ
• ค่าธรรมเนียมทนายความและการดําเนินคดี
• การคุ้มครองผู้บริโภคหลังการละเมิด
• การประชาสัมพันธ์
• การปรับปรุงความมั่นคงปลอดภัยทางไซเบอร์
• เสียชื่อทางการค้า, ความสัมพันธ์ลูกค้า

14
สิ่งที่ช่วยลดภัยคุกคาม
• คน (People)
◦ เป็นจุดเริ่มต้นของภัยคุกคามทั้งตั้งใจและไม่ตั้งใจ

• กระบวนการ (Process)
◦ นโยบาย ระเบียบ ข้อบังคับ
◦ พระราชบัญญัติการรักษาความมั่นคงปลอดภัยไซเบอร์
◦ พระราชบัญญัติว่าด้วยการกระทําความผิดเกี่ยวกับคอมพิวเตอร์
◦ พระราชบัญญัติคุ้มครองข้อมูลส่วนบุคคล

• เทคโนโลยี (Technology)
◦ OS license, Antivirus
◦ Cyber Insurance

15
Hypertext Transfer Protocol (HTTP)
• Foundation of web technology
• Enable client (web browsers) to request from an HTTP
server
• TCP connection with well-known port 80

https://blog.cloudhm.co.th/what-is-ssl-and-tls/

16
Locks and Combinations
• We buy a lock and set up the combination
• No one else knows the combination
• Forgetting the combination, opening the lock by:
◦ Breaking the lock
◦ Trying every combination

• Cryptography involves the lock and the


combinations (key)
• A variety of locks (method)
• A combination of keys

• Critical factors: The lock strength and


Fewer possible More possible
number of possible keys
combinations combinations
• The lock should be secure against the force
• Take an intruder long time to try all possible
combinations

17
The Problem
• Why secret message?
◦ Untrusted unsecure channel
◦ Channel access by a malicious third party

Private Message

Bob Alice
Eavesdropping

Eve

18
The Solution

Private Message Private Message

Encryption Decryption
Scrambled Message

Bob Alice
Eavesdropping

Eve

19
The Solution

• Encryption with symmetric cipher


• Eve obtains only ciphertext, that looks like random bits
Encryption key Decryption key

Message
(plaintext, Encryption Ciphertext Decryption
cleartext) (Encipherment) (cryptogram) (Decipherment) plaintext

20
Defining Cryptographic Terms (I)
• Plaintext: original message to be encrypted
• Ciphertext: the encrypted message
• Enciphering or encryption: the process of converting
plaintext into ciphertext
• Encryption algorithm: performs encryption
◦ Two inputs: a plaintext and a secret key

21
Defining Cryptographic Terms (II)
• Deciphering or decryption: recovering plaintext from
ciphertext
• Decryption algorithm: performs decryption
◦ Two inputs: ciphertext and secret key
• Secret key: info known only to sender/receiver for
encryption and decryption
◦ Also referred to as a symmetric key

22
Encryption and Decryption Model
Eve
(bad guy)

y
Unsecure channel
(e.g. Internet)
Alice Encryption Decryption Bob
(good) x e () y d () x (good)

K K

Key Generator Key Generator

Secure Channel

• x is the. plaintext
• y is the ciphertext
• K is the key

23
Taxonomy of Cryptology

Cryptology

Cryptography Cryptanalysis

Symmetric Ciphers Asymmetric Ciphers Protocols

Cryptography - study of encryption


Block Ciphers Stream Ciphers principles/methods
Cryptanalysis (codebreaking) - the study of
principles/ methods of deciphering ciphertext
without knowing key
Cryptology - the study of both cryptography and
cryptanalysis

24
Cryptanalysis: Attacking

• Classical Attacks: Analysis and trying possible key until solved


• Implementation Attack: Try to extract key through reverse engineering or
power measurement, e.g., for a banking smart card.
• Social Engineering: E.g., trick a user into giving up her password

25
Brute-Force Attack
• Also known as Exhaustive Key Search
• Treats the cipher as a black box
• Requires (at least) 1 plaintext-ciphertext pair (𝑥!, 𝑦!)
• Check all possible keys until condition is fulfilled:

𝑑" 𝑦! = 𝑥!

26
How many keys do we need?
• An adversary only needs to succeed with one attack
• A long key space does not help if other attacks
(e.g., social engineering) are possible

Key space Security life time


(assuming brute-force as best possible attack)
64 264 Short term (few days or less)
128 2128 Long-term (several decades in the absence
of quantum computers)
256 2256 Long-term (also resistant against
quantum computers – note that QC do
not exist at the moment and might never
exist)

27
Classical Ciphers Algorithm
• Give a good illustration of several of the
important ideas of the cryptography

Shift Cipher Substitution Cipher Transposition Cipher

replacing each element replacing each element rearranging the order


of the plaintext by of the plaintext with of the elements of
another element another element the plaintext
corresponding to a
certain number of
position shifting

28
Caesar’s Cipher

Replacing each element of the plaintext by


another element corresponding to a certain
number of position shifting

29
Caesar’s Cipher
• Ancient cipher, allegedly used by
Julius Caesar (Born: 100 BC)
• Also known as Shift cipher, Caesar's
code or Caesar shift
• Rule: Replacing each plaintext letter
by another one by shift its k
positions further down the alphabet
• Caesar cipher: A shift of 3
characters
Example: FIVE AM => ILYH DP

Plaintext A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Ciphertext D E F G H I J K L M N O P Q R S T U V W X Y Z A B C

30
Caesar’s Disk
• Also known as a rot-N encoder A construction
• Encryption of “FIVE AM” with different of two rotating
keys disks with a
Caesar Cipher

1 3 6

GJWF BN ILYH DP LOBK GS

31
More Mathematical

Encryption: Shift k Decryption: inverse shift k

• Additive Cipher: the plaintext, ciphertext, and key are integers


◦ A modulo 26 (which is the length of the standard alphabet)
◦ Note A=0, B=1, ..., Z=25, and add a constant (the shift)

32
Encryption Example:

• Encrypt the message “FIVE AM” with key = 3


A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25

Plaintext Encryption Ciphertext


F=5 ( 5 + 3) mod 26 8=I
I =8 ( 8 + 3) mod 26 11 = L
V = 21 (21+ 3) mod 26 24 = Y
E=4 (4 + 3) mod 26 7=H
A=0 (0 + 3) mod 26 3=D

M =12 (12+ 3) mod 26 15 = P

33
Decryption Example:

• Decrypt the message “ILYHDP” with key = 3


A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25

Ciphertext Encryption Plaintext


I=8 (8 - 3) mod 26 5=F
L = 11 (11 - 3) mod 26 8=I
Y = 24 ( 24 - 3) mod 26 21 = V
H= 7 ( 7 - 3) mod 26 4=E
D= 3 ( 3 - 3) mod 26 0=A
P = 15 ( 15 - 3) mod 26 12 = M

34
Cryptanalysis of Caesar’s Cipher
• If it is known that a Given the intercepted ciphertext ”ILYHDP”
shift cipher has been
used, but the key is +1
I
J
L
M
Y
Z
H
I
D
E
P
Q
unknown: +2
+3
K
L
N
O
A
B
J
K
F
G
R
S
◦ The main weakness: Only +4 M P C L H T

limited number of 25 …
+17

Z

C

P

Y

U

G
possible keys +18 A D Q Z V H
+19 B E R A W I
◦ Fairly simple to break the +20 C F S B X J
code by a simple brute force +21 D G T C Y K
attack +22
+23
E
F
H
I
U
V
D
E
Z
A
L
M
+24 G J W F B N
+25 H K X G C O

35
Substitution Cipher

Replacing each element of the


plaintext with another element

36
Substitution Cipher
• Adding more complexity: Substituting each plaintext
character by a fixed jumbled other character
• Much easier to remember when using leading keyword
compared to a random jumble of 26 characters
• An example key: warlordz
◦ plaintext: abcdefghijklmnopqrstuvwxyz
◦ ciphertext: warlodzbcefghijkmnpqstuvxy

• Encryption example:
◦ plaintext : defend the east wall of the castle
◦ ciphertext: lodoil qbo owpq uwgg jd qbo rwpqgo

37
Let’s solve it!
• Here is a secret message bkfgamdazje. Decode it using
paper and pencil. (hint a=o, e=s)

38
Brute-Force Attack: Letter Frequency
Analysis
• Letters have very different
frequencies in the English
language Letter frequencies in English

• Moreover: the frequency of 14.00

plaintext letters is preserved 00

in the ciphertext. 12.00


00

• For instance “e” is the most


10.00
00

Frequency in%
8.000

common letter in English; 0

6.000

almost 13% of all letters in a


0

4.000

typical English text are “e”.


0

2.000


0

The next most common one 0.000


0

is ‘t“ with about 9%.


E T A O I N S H R D L C U W F G Y P B V K J X Q Z
Le tter
M
s

39
Breaking the Substitution Cipher with Letter Frequency
Attack
• Let‘s solve the ciphertext with the most frequent letters:
yvn xct ck hoxtynl cw htwqhnm, jt

In T C H N W X Y , J K L M O Q V
Count 4 3 3 3 2 2 2 1 1 1 1 1 1 1 1

• We replace the ciphertext letter t by A, c by I and obtain:


yvn xIA Ik hoxAynl Iw hAwqhnm, jA

• By further guessing based on the frequency of the remaining letters


we obtain the plaintext:
THE CIA IS LOCATED IN LANGLEY, VA

40
Let’s solve it!
rtpgld vmpjr vzp svm, sfa dapkzlq tqar z bgnfap kzbfgla
bzjjar sfa algdkz. gs bmtjr qalr zlr pabagua kaqqzdaq
otgbijx zlr qabpasjx.

Analysis tools: https://bit.ly/2SbXCdA

41
Secure Sockets Layer/Transport Layer
Security (SSL/TLS)
• TLS was developed from SSL
• Works in between Application and Transport layer
• HTTPS (TCP port 443), IMAPS, POPS
• Symmetric key, Asymmetric key
• Digital certificate issued by Certificate authority (CA)

42
Basic Encryption

https://blog.cloudhm.co.th/what-is-ssl-and-tls/

43
Symmetric vs Asymmetric

44
Symmetric: Limitations
• Key distribution problem:
◦ Require mechanisms to securely pass the key
◦ Potential for eavesdropping
◦ Key Management n(n-1)/2

45
Comparison

Embedded System design with implementation of a cryptographic algorithm for the development of Nadjibi's Pay As You Go platform

46
SSL/TLS Explanation

47
PGP (Pretty Good Privacy)

48
ปกป้องข้อมูลเบื้องต้น
• เปิดโหมดใช้งานไม่ระบุตัวตน (Incognito Mode)
• ใช้ Search Engine ที่รักษาความเป็นส่วนตัว
◦ Ex. Duckduckgo
• ตั้งรหัสผ่านที่ปลอดภัย
◦ อย่างน้อย 8 ตัวอักษร
◦ รหัสผ่านต้องไม่ใช่คําที่อยู่ใน Dictionary
◦ ไม่ควรใช้รหัสเดียวกันทุกระบบ
◦ ไม่ควรใช้คําซํ้า
◦ Admin ควรกําหนดอายุรหัสผ่าน

49
2 Factor Authentication (or more)
• Factors
◦ Something you know (such as a password)
◦ Something you have (such as a smart card)
◦ Something you are (such as a fingerprint)
◦ Something you do (such as making a signature)
◦ Somewhere you are (such as using a mobile device with
location services
• Single-factor and multifactor systems
◦ Two-factor
◦ Multifactor

50
Something You Have
• Smart card or token-based access
• Digital cerfificates
• Card readers (Contact-based, less)
• One-time password (OTPs)

51
Something You Are
• Something you are:
◦ Fingerprint patterns, iris or retina recognition, or facial
recognition
• Something you do:
◦ Behavioral recognition

52
Somewhere You Are
• Geographic location or logical network address
• Global Positioning System (GPS), Indoor Positioning
System (IPS)

53
หายนะทางไซเบอร์
สายการบินระดับชาติ (มิ.ย. 2018)
• หน้า Website มีการเปลี่ยนแปลง เส้นทางไป
Website หลอก
• ข้อมูลรั่วลูกค้ารั่วประมาณ 500,000 ราย
• ชื่อ, นามสกุล, เลขบัตรเครดิต, CVV
• The Information Commissioner’s Office: ICO
• เกิดหลังจากประกาศ GDPR (25 พ.ค. 2018)
• ค่าปรับ £183m (7,500 ล้านบาท)

55
โรงแรมขนาดใหญ่ (ม.ค. 2020)
• 2016 เกิดการเข้าซื้อกิจการในเครือโรงแรม
มูลค่า 13.6 พันล้านดอลลาร์
• โรงแรมเก็บข้อมูลบัตรเครดิต, ข้อมูลเข้าพัก
• แท้จริงแล้ว ระบบจองที่พักโดนเจาะตั้งแต่ปี
2014
• ข้อมูลแขกที่เข้าพักในเครือกว่า 500 ล้านราย
• ICO แจ้งค่าปรับ £99m (4 พันล้านบาท)

56
Google ละเมิดข้อมูลส่วนตัว
• เหตุการณ์ที่ 1 – GDPR ปรับ 50 ล้านยูโร
◦ ขอคํายินยอมที่ไม่ชัดเจนพอ ไม่ได้บอกว่าข้อมูลที่ขอ จะเอาไปใช้กับบริการใด
ของ Google บ้าง

• เหตุการณ์ที่ 2 – FTC ปรับ 22.5 ล้านดอลลาร์


◦ แอบติดตามพฤติกรรมการใช้งานของผู้ใช้ผ่าน Cookie ของ Web browser
Safari เพื่อเสนอบริการจาก Google ให้ผู้ใช้งาน

• เหตุการณ์ที่ 3 – FTC ปรับ 170 ล้านดอลลาร์


◦ ผิดข้อว่าด้วยความคุ้มครองข้อมูลส่วนบุคคลทางอินเทอร์เน็ตของเด็ก
◦ เก็บข้อมูลส่วนบุคคล YouTube ของเด็กตํ่ากว่า 13 ปี โดยไม่ได้รับอนุญาตจาก
ผู้ปกครอง

57
Uber ถูกเจาะระบบ (2017)
• สั่งปรับ 148 ล้าน USD
• จงใจปิดข้อมูลที่บริษัทโดนเจาะระบบ
• โดนเจาะปี 2016 ขโมยข้อมูลลูกค้าและผู้ขับรถ
57 ล้านราย
• Bloomberg รายงานว่า Hacker 2 คน เข้าถึง
Github source code
• Uber ยอมจ่ายเงิน 100,000 USD ให้แก่
Hacker เพื่อกู้ข้อมูลกลับมา และห้ามเผยแพร่ต่อ
สาธารณะ
• แจ้งต่อลูกค้าช้ามาก (1 ปีหลังจากถูกเจาะ)

58
Twitter ทําข้อมูลหลุด
• คณะกรรมการคุ้มครองข้อมูลส่วนบุคคลของ
Ireland สั่งปรับ 550K USD
• เกิดจาก Bug ของ Twitter บน Android ทําให้
ข้อความกลายเป็น Public
• นอกจากนี้ ไม่แจ้งเหตุระเมิดภายใน 72 ชั่วโมง
ผิด GDPR มาตรา 33 (1) ซึ่งเท่ากับ PDPA
มาตรา 37 (4) ของไทย

59
หมอชนะ (Privacy or Security)
• Contact Tracing
• การคุ้มครองข้อมูลส่วนบุคคล (Personal Data
Protection)
• หมอชนะเก็บข้อมูลขึ้น AWS
• เหตุการณ์ส่วนใหญ่เกิดจากการตั้งค่าผิด
• เอาข้อมูลของเราไปทําอะไร ?

60
กรุงไทย AXA
• แฮกเกอร์ Avaddon ประกาศว่าขโมย
ข้อมูลลูกค้ากลุ่มประกันสุขภาพ
• ข้อมูลการยื่นเคลมประกัน (ไทย, มาเลเซีย,
ฮ่องกง, ฟิลิปปินส์)
• Inter Partners Assistance (IPA) เป็น
บริษัทให้ความช่วยเหลือรถเสีย หรือ
ช่วยเหลือด้านสุขภาพ ในประเทศไทยถูก
แฮก
• ต้องให้ความร่วมมือภายใน 240 ชั่วโมง
หากไม่ร่วมมือจะเปิดเผยเอกสารออกมา

61
ค่ายมือถือทําข้อมูลลูกค้าหลุด
• เมษายน 2018 เจ้าหน้าที่ตั้งค่า AWS S3
ผิดพลาด ข้อมูลลูกค้าหลุดกว่า 46,000
ราย
• Niall Merrigan เป็นผู้แจ้ง และพบว่าเก็บ
บัตรประชาชนสแกนไว้ใน S3 โดยไม่มีการ
รักษาความปลอดภัยใดๆ (ดาวน์โหลดได้
โดยใช้ URL)
• S3 ถูกตั้งค่าเป็น Public (Default คือ
Private)
• PDPA ยังไม่ถูกใช้ในขณะนั้น

62
Many more..

63
References

64

You might also like