• No results found

Communications security

N/A
N/A
Protected

Academic year: 2021

Share "Communications security"

Copied!
10
0
0

Loading.... (view fulltext now)

Full text

(1)

Andrea Baiocchi, DIET, Università di Roma “Sapienza” - “Sicurezza nelle Comunicazioni” - A.A. 2013-2014 1

Communications security

Communications security

Lecturer: Andrea Baiocchi

DIET - University of Roma “La Sapienza” E-mail: [email protected]

URL: http://net.infocom.uniroma1.it/corsi/index.htm

University of Roma “Sapienza” DIET

Lecture 12

Attacks on RSA

[Sti02], Cap. 5 (155-225)

About algorithms

About algorithms

and code

and code

Creati un esercito di servi perfetti, capaci di eseguire per tuo

conto compiti ingrati, e sarai il padrone del mondo.

[N. Tartaglia, Il general trattato di numeri et misure, 1556-1560]

Microprogramming an inefficient algorithm does not make it

efficient.

[Rausher’s law]

Question: what is the difference between c++ and c?

Answer: one.

(2)

Andrea Baiocchi, DIET, Università di Roma “Sapienza” - “Sicurezza nelle Comunicazioni” - A.A. 2013-2014 3

RSA

RSA

security

security

!

All public key cryptography can offer is

computational

security

!

We cover the following RSA security issues:

Choice of RSA algorithm parameters (exponents a and b);

RSA pitfalls tied to the mathematical structure of RSA algorithm;

Attacks on RSA algorithm based on factorization of the modulus n (key only attack);

Making RSA encryption semantically secure (OAEP = Optimal Asymmetric Encryptio Padding).

!

As with other cryptosystems, timing and/or power analysis

attacks on RSA implementations are possible.

The public

The public

exponent

exponent

b

b

!

Any number 1<b<

!

(n) is in principle acceptable, provided it can

be inverted modulo

!

(n), i.e. gcd(b,

!

(n))=1.

So, b must be odd and !3

!

It is possible to choose a fixed value of

b, then to generate

random primes p and q with the constraint gcd(b,(p–1)(q–1))=1

Possible good choices of b are 3, 5, 17= 24+1, 216+1

!

A fixed value of b=3 can be taken

Pros

Low complexity of encryption and signature verification Easier distribution of public key info

Cons

To make b prime with (p–1)(q–1), p and q have to be chosen so that p and q

are equal to 2 mod 3 (it can’t be p or q = 0 mod 3 !); this can be done by generating a random number x and testing if 6x+5 is prime

(3)

Andrea Baiocchi, DIET, Università di Roma “Sapienza” - “Sicurezza nelle Comunicazioni” - A.A. 2013-2014 5

Problems with

Problems with

public

public

exponent

exponent

b

b

!

“Low exponent attack”

The attack works if a message m is encrypted b times using b co-prime RSA moduli ni, 1"i"b; let ci=mb mod n

i, 1"i"b.

The attack proceeds as follows

Compute c satisfying c=ci mod ni, 1"i"b, and 0"c< n1·…· nb with the CRT The message m equals the b-th root of c in Z.

The attack works because c’=mb satisfies the same constraints as c and

the CRT solution is unique (mod n) and mb < n (why?); it is made possible

since m is the same for all recipients and it is practical if b is “low” (not the order of n)

!

It is essential that the public key be different for any different

instance and use of RSA

E.g. if RSA is used for signing messages and for encryption, two different values of b shall be chosen for these two functions

The private

The private

exponent

exponent

a

a

!

Given the public key (n,b), any one of p, q,

!

(n), a is sufficient to

recover all others

Given p (q) the other prime is found immediately as q=n/p (p=n/q); then !

(n) is trivially computed and a is found as the multiplicative inverse of b

modulo !(n)

Given !(n), we have n–!(n)+1=p+q=s; then it is easily seen that p and q

are the roots of the equation x2xs+n=0; a can be computed as above

Given a, a Las Vegas kind of algorithm can be conceived to attempt the factorization of n with average-case success probability at least 1/2 (see [STIN02] p. 197; [BUCH04] p. 172)

In practice, if b is a sufficiently low integer, since a<!(n), ab–1 is only a small factor times !(n); the attacker can just try to guess such small factor m, compute !(n) as (ab–1)/m and then proceed as in the previous case

(4)

Andrea Baiocchi, DIET, Università di Roma “Sapienza” - “Sicurezza nelle Comunicazioni” - A.A. 2013-2014 7

Problems with

Problems with

private

private

exponent

exponent

a

a

!

Given the decryption exponent of RSA, a, it is possible to factor

n by means of a randomized algorithm

This implies that computing a is essentially no easier than factoring n

More importantly, from the practical side this tells us that if a is ever compromised, it is NOT sufficient to define a different private key; also n

and hence the whole set of RSA parameters MUST be generated anew

!

M. Wiener has shown that a polynomial time algorithm can be

defined to factor an RSA modulus

n provided

a<n

1/4

/3 and

q<p<2q.

If the number of bits of n is k, this attack will succeed provided the binary representation of a has less than k/4–1 bit and p and q are not too far apart

RSA

RSA

pitfalls

pitfalls

!

A basic problem of RSA is mathematical structure, that lends

itself to a number of attacks

!

One problem is the

multiplicative property

of RSA: if c

i

(i=1,2)

is the ciphertext of the plaintext

m

i

, then the ciphertext of the

new plaintext m=m

1

m

2

is just c=c

1

c

2

.

We’ll see how this opens some possible avenues of attack specific of RSA

!

Another problem arises if

m

b

<n; then, no modulo reduction

takes place ever, so that the plaintext can be recovered by just

taking the b-th root of the ciphertext

If a 128 bit AES key is being encrypted with RSA and b=3, the resulting exponential is a 384 bit number, well below a typical choice of n

(5)

Andrea Baiocchi, DIET, Università di Roma “Sapienza” - “Sicurezza nelle Comunicazioni” - A.A. 2013-2014 9

Attacking

Attacking

RSA

RSA

algorithm

algorithm

!

Security of RSA algorithm relies on the fact that modular

exponentiation as used in RSA is

deemed to be a one-way

function

!

This ultimately relies on two facts:

computing a implies factoring n (i.e. no simpler means exist to recover a)

This is not proved!

there is no efficient algorithm for factoring integer n=pq.

Complexity of best known algorithms to date is subexponential, yet superpolynomial, i.e. O(elog(n)!·log(log(n))")

!

The main attack on RSA focuses on factoring n

To make this securely unfeasible with current and foreseeable technology and techniques, n should be at least a 1024 bit integer; therefore p and q must be at least 512 bit prime integers

Integer factoring

Integer factoring

!

By factoring of an integer

n we mean to find any factor of

n

(either prime or not)

Complete factorization can be obtained iteratively, if needed

Factorization can be trivially pursued by trial division with all primes

"# (n)

If n is not prime, n=p·q and one of the two factors must be no greater than

#(n), so that there must be at least one prime factor of n that is "#(n).

!

There are many algorithms to factor integers, none efficient,

except special characteristics of n are given.

!

Most used factoring algorithms are quadratic sieve and, more

recently, the number field sieve; their complexity is

Quadratic sieve : O(exp((1+o(1))·# ( log(n)·log(log(n)))))

(6)

Andrea Baiocchi, DIET, Università di Roma “Sapienza” - “Sicurezza nelle Comunicazioni” - A.A. 2013-2014 11

Pollard

Pollard

p

p

1

1

algorithm

algorithm

!

One of the simplest factoring algorithms

!

Assumes that

n has a prime divisor

p so that all prime powers

dividing p–1 are not greater than a given B

It is easily checked that then (p–1) | B!

We compute a=2B! (mod n), then a=2B!=2m(p–1)=1 (mod p) (first equality

since p is a factor of n; last one from little Fermat theorem)

Therefore p|(a–1) and p|n, hence p|d=gcd(a–1,n); d is clearly a non trivial factor of n

!

The algorithm just sets

B, computes

a=2

B!

(mod

n) and checks

whether gcd(a–1,n)>1; if that is the case, a factor of n is found

a# 2; for j=2:B do a# aj (mod n); endfor; d # gcd(a–1,n)

Practical issues

Practical issues

!

Computational complexity of Pollard p–1 algorithm

The algorithm requires B–1 modular exponentiations each requiring

O(log2B) modular moltiplications

The gcd can be computed in time O((log2n)3)

Overall complexity is O(B·log2B·(log2n)2 + (log

2n)3); if B is O((log2n)i) for

some i, the algorithm has polynomial time

!

The penalizing trade-off of the Pollard

p–1 algorithm is that for

“small” values of

B it can hardly succeed, whereas for

B in the

order of

#

(

n) its complexity is no more polynomial

!

It gives a useful indication though: an RSA modulus should not

have a prime factor p so that p–1 has only small prime factors

(7)

Andrea Baiocchi, DIET, Università di Roma “Sapienza” - “Sicurezza nelle Comunicazioni” - A.A. 2013-2014 13

Factoring

Factoring

in

in

practice

practice

! Early factoring:

By exploiting quadratic sieve, a 69-digit number was factored in 1983; A 106-digit number was factored in 1989 with distributed computations;

In 1994 RSA-129 was factored, requiring 5000 MIPS-year donated by over 600 researchers around the world.

! RSA factoring challenge (ended 2007) and beyond:

RSA-576, 174 decimal digita (December 2003); RSA-640, 193 decimal digits (November 2005); RSA-696, 210 decimal digits (September 2013); RSA-704, 212 decimal digits (July 2012);

RSA-768, 232 decimal digits (December 2009).

! 1024 bit integers can be expected to be factored before 2020

…unless quantum computing comes to reality first!

Semantic security

Semantic security

!

Attacks considered up to now aim at recovering the private key

!

The goal of the adversary can be less ambitious; still we would

like the cryptosystem not to leak any information

!

The following are examples

Total break: Oscar is able to determine Bob’s private key

Partial break: with some non negligible probability, Oscar is able to decrypt or gain some information about a previously unseen ciphered plaintext

Distinguishability of ciphertexts: with probability exceeding 1/2 Oscar is able to distinguish between the encryptions of two different plaintexts or between an enciphered plaintext and a random bit string

(8)

Andrea Baiocchi, DIET, Università di Roma “Sapienza” - “Sicurezza nelle Comunicazioni” - A.A. 2013-2014 15

Distinguishability

Distinguishability

!

Cyphertext distinguishability problem (CDP) statement

Let f be an encryption function on the plaintext set X, f: X $ X; a problem

instance is given by any two distinct plaintexts x1,x2%X and a cyphertext

y=f(xi), i %{1,2}.

The problem is: i=1?

!

A semantically secure cryptosystem is one for which the CDP is

unfeasible

This can be shown to be equivalent to complete semantic security, i.e. nothing can be inferred of the plaintext.

!

A deterministic cryptosystem f is clearly insufficient; we have to

include some randomization element

With a chosen plaintext attack CDP for a deterministic cipher is trivial

Semantically secure cryptosystem

Semantically secure cryptosystem

!

Let m and k be positive integers,

F

a family of one-way trapdoor

permutations on {0,1}

k

, G: {0,1}

k

$

{0,1}

m

be a random oracle.

!

Then

P

={0,1}

m

,

C

={0,1}

k

x{0,1}

m

and

K

={(f,f

–1

,G): f

%

F

}.

!

For K=(f,f

–1

,G), let r

%

{0,1}

k

be chosen randomly and let

e

K

(x) = (y

1

,y

2

) = (f(r),G(r)

&

x)

d

K

(y

1

,y

2

) = G(f

–1

(y

1

))

&

y

2

!

The private key is (f

–1

); the public key is (f,G).

!

Major drawback: overhead (m+k bit required for m bit plaintext)

(9)

Andrea Baiocchi, DIET, Università di Roma “Sapienza” - “Sicurezza nelle Comunicazioni” - A.A. 2013-2014 17

Semantic security proof concept

Semantic security proof concept

!

Intuition

The plaintext is “blinded” by means of a random oracle function applied to a random bitstring; since G is a random oracle function, full knowledge of its argument is required to evaluate it; on the other hand, this knowledge can be derived by inverting f, which is assumed to be unfeasible.

!

Proof approach by reduction

Assume there exists an algorithm DISTINGUISH, which can solve correctly the CDP with probability !1/2+' for '>0.

The random oracle function is simulated by a random generator SIMG. It can be shown that there exists an efficient algorithm, exploiting DISTINGUISH and SIMG, that can invert f for a randomly chosen y=f(x) with probability bounded away from 0.

Optimal Asymmetric Encryption Padding

Optimal Asymmetric Encryption Padding

!

Let

m and

k>m be positive integers,

s=k–m,

F

a family of

one-way trapdoor permutations on {0,1}

k

,

G: {0,1}

s

$

{0,1}

m

and

H:

{0,1}

m

$

{0,1}

s

be random functions.

!

Let

P

={0,1}

m

,

C

={0,1}

k

={0,1}

m+s

and

K

={(f,f

–1

,G,H): f

%

F

}.

!

For K=(f,f

–1

,G,H), let r

%

{0,1}

s

be chosen randomly and let

y=e

K

(x) = f(y

1

||y

2

)

with y

1

=x

&

G(r) and y

2

=r

&

H(x

&

G(r));

d

K

(y) = G(z

2

&

H(z

1

))

&

z

1

with f

–1

(y)=z

(10)

Andrea Baiocchi, DIET, Università di Roma “Sapienza” - “Sicurezza nelle Comunicazioni” - A.A. 2013-2014 19

Semantically secure

Semantically secure

RSA

RSA

!

Let

O(2

s

) the desired complexity for the attack and let

m=k–s–1>s, where k=floor(log

2

(n))

E.g. s=128 (to guarantee unfeasibility) and k=1024.

!

Let us define an expansion function

G: {0,1}

s

$

{0,1}

m

and a

compression function H: {0,1}

m

$

{0,1}

s

They may be constructed by using cryptographic hash functions

!

The plaintext

x is an

m-bit string and

r is an

s-bit random

number

Encryption: y = (2s·(x&G(r))+(r&H(x&G(r))))b mod n

Decryption: 2s·u+r&H(u) = ya mod n = z, hence u = z div 2s and r&H(u) =

References

Related documents

The Customer Experience Series™ includes informal learning tools that structure continued self-study, practice, and application of skills and concepts from the Core Sessions..

Write a function CountCity(DestCity) in Python which accepts the destination city as parameter, count and return number of travelers who are travelling to the given City which

We then present the results of a quantitative study based on a survey completed by 219 Mechanical Turk users, aiming to measure the usability of three popular 2F solutions:

A cutting-edge VoIP solution has been designed to facilitate inter/intra pavilion communication among countries and with EXPO staff members: the most advanced PaBX services

Miami Beach is situated a few kilometres south of the town and offers a lovely sandy beach, good for children, with refreshments and pedaloos available for hire.. via Novara,

[r]

We are also looking to the long-term with a 10 year plan to keep electricity rates as low as possible, and an Integrated Resource Plan (IRP) that outlines the actions that BC

Indeed, research from Demandware found that mobile devices made up a significantly higher share of US retail ecommerce site traffic in Q2 2015 than they did a year before.. But