home *** CD-ROM | disk | FTP | other *** search
/ SuperHack / SuperHack CD.bin / Hack / MISC / ATTACK.ZIP / ATTACK.FAQ
Encoding:
Text File  |  1996-06-01  |  41.8 KB  |  965 lines

  1.  
  2.     --[Abstract]--
  3.  
  4.     PGP is the most widely used hybrid cryptosystem around today.  There 
  5. have been AMPLE rumours regarding it's security (or lack there of).  There 
  6. have been rumours ranging from PRZ was coerced by the Gov't into placing 
  7. backdoors into PGP, that the NSA has the ability to break RSA or IDEA in a 
  8. reasonable amount of time, and so on.  While I cannot confirm or deny these 
  9. rumours with 100% certianty, I really doubt that either is true.  This FAQ 
  10. while not in the 'traditional FAQ format' answers some questions about the 
  11. security of PGP, and should clear up some rumours...
  12.  
  13.     This FAQ is also available from the web:
  14.  
  15.     http://axion.physics.ubc.ca/pgp-attack.html
  16.     http://ucsu.colorado.edu/~cantrick/pgphafaq.html
  17.     http://www.lava.net/~jordy/PGPAttackFAQ.html    
  18.     http://www.stack.urc.tue.nl/~galactus/remailers/attack-faq.html
  19.     
  20.  
  21.  
  22.             [ The Feasibility of Breaking PGP ]
  23.                  [ The PGP attack FAQ ]
  24.         
  25.                 2/96         v. 2.0 
  26.  
  27.  
  28.           by infiNity [daemon9@netcom.com / route@infonexus.com]
  29.                 
  30.  
  31.             -- [Brief introduction] --
  32.  
  33.     There are a great many misconceptions out there about how 
  34.     vulnerable Pretty Good Privacy is to attack.  This FAQ is designed
  35.     to shed some light on the subject.  It is not an introduction to
  36.     PGP or cryptography.  If you are not at least conversationally 
  37.     versed in either topic, readers are directed to The Infinity Concept
  38.     issue 1, and the sci.crypt FAQ.  Both documents are available via
  39.     ftp from infonexus.com.  This document can be found there
  40.     as well:
  41. URL:ftp://ftp.infonexus.com/pub/Philes/Cryptography/PGP/PGPattackFAQ.gz 
  42.  
  43.     PGP is a hybrid cryptosystem.  It is made up of 4 cryptographic 
  44.     elements: It contains a symmetric cipher (IDEA), an asymmetric cipher 
  45.     (RSA), a one-way hash (MD5), and a random number generator (Which is 
  46.     two-headed, actually:  it samples entropy from the user and then
  47.     uses that to seed a PRNG).  Each is subject to a different form of 
  48.     attack.
  49.  
  50.     
  51.             1 -- [The Symmetric Cipher] -- 1
  52.  
  53.     IDEA, finalized in 1992 by Lai and Massey is a block cipher that
  54.     operates on 64-bit blocks of data.  There have been no advances
  55.     in the cryptanalysis of standard IDEA that are publically known.
  56.     (I know nothing of what the NSA has done, nor does most anyone.) 
  57.     The only method of attack, therefore, is brute force.  
  58.  
  59.     -- Brute Force of IDEA --       
  60.  
  61.     As we all know the keyspace of IDEA is 128-bits.  In base 10 
  62.     notation that is: 
  63.  
  64.         340,282,366,920,938,463,463,374,607,431,768,211,456.
  65.     
  66.     To recover a particular key, one must, on average, search half the 
  67.     keyspace.  That is 127 bits: 
  68.         
  69.         170,141,183,460,469,231,731,687,303715,884,105,728.  
  70.     
  71.     If you had 1,000,000,000 machines that could try 1,000,000,000 
  72.     keys/sec, it would still take all these machines longer than the 
  73.     universe as we know it has existed and then some, to find  the key.  
  74.     IDEA, as far as present technology is concerned, is not vulnerable to 
  75.     brute-force attack, pure and simple.
  76.  
  77.     -- Other attacks against IDEA --
  78.  
  79.     If we cannot crack the cipher, and we cannot brute force the 
  80.     key-space, what if we can find some weakness in the PRNG used
  81.     by PGP to generate the psuedo-random IDEA session keys?  This
  82.     topic is covered in more detail in section 4.
  83.  
  84.     
  85.     
  86.             2 -- [The Asymmetric Cipher] -- 2
  87.  
  88.     RSA, the first full fledged public key cryptosystem was designed
  89.     by Rivest, Shamir, and Adleman in 1977.  RSA gets it's security from
  90.     the apparent difficulty in factoring very large composites.
  91.     However, nothing has been proven with RSA.  It is not proved
  92.     that factoring the public modulous is the only (best) way to 
  93.     break RSA.  There may be an as yet undiscovered way to break it.
  94.     It is also not proven that factoring *has* to be as hard as it is.  
  95.     There exists the possiblity that an advance in number theory may lead
  96.     to the discovery of a polynomial time factoring algorithm.  But, none 
  97.     of these things has happened, and no current research points in that 
  98.     direction.  However, 3 things that are happening and will continue
  99.     to happen that take away from the security of RSA are: the advances 
  100.     in factoring technique, computing power and the decrease in the 
  101.     cost of computing hardware.  These things, especially the first one, 
  102.     work against the security of RSA.  However, as computing power 
  103.     increases, so does the ability to generate larger keys.  It is *much* 
  104.     easier to multiply very large primes than it is to factor the 
  105.     resulting composite (given today's understanding of number theory).
  106.     
  107.     -- The math of RSA in 7 fun-filled steps --
  108.  
  109.     To understand the attacks on RSA, it is  important to understand
  110.     how RSA works.  Briefly:
  111.     
  112.       - Find 2 very large primes, p and q.
  113.       - Find n=pq (the public modulous).
  114.       - Choose e, such that e<n and relatively prime to (p-1)(q-1).
  115.       - Compute d=e^-1 mod[(p1-)(q-1)]  OR  ed=1[mod (p-1)(q-1)].
  116.       - e is the public exponent and d is the private one.
  117.       - The public-key is (n,e), and the private key is (n,d).
  118.       - p and q should never be revealed, preferably destroyed (PGP
  119.         keeps p and q to speed operations by use of the Chinese Remainder
  120.         Theorem, but they are kept encrypted)
  121.  
  122.       Encryption is done by dividing the target message into blocks
  123.       smaller than n and by doing modular exponentiation:  
  124.  
  125.         c=m^e mod n
  126.     
  127.       Decryption is simply the inverse operation:
  128.       
  129.         m=c^d mod n 
  130.  
  131.  
  132.     -- Brute Force RSA Factoring --
  133.  
  134.     An attacker has access to the public-key.  In other words, the
  135.     attacker has e and n.  The attacker wants the private key.  In 
  136.     other words the attacker wants d.  To get d, n needs to be 
  137.     factored (which will yield p and q, which can then be used to
  138.     calculate d).  Factoring n is the best known attack against RSA to
  139.     date.  (Attacking RSA by trying to deduce (p-1)(q-1) is no easier 
  140.     than factoring n, and executing an exhaustive search for values of d
  141.     is harder than factoring n.)  Some of the algorithms used for 
  142.     factoring are as follows:
  143.  
  144.     - Trial division:  The oldest and least efficient.  Exponential 
  145.     running time.  Try all the prime numbers <= sqrt(n).
  146.  
  147.     - Quadratic Sieve (QS):  The fastest algorithm for numbers smaller 
  148.     than 110 digits.
  149.  
  150.     - Multiple Polynomial Quadratic Sieve (MPQS):  Faster version of QS.
  151.  
  152.     - Double Large Prime Variation of the MPQS:  Faster still.
  153.  
  154.     - Number Field Sieve (NFS):  Currently the fastest algorithm known for
  155.     numbers larger than 110 digits.  Was used to factor the ninth Fermat 
  156.     number.
  157.  
  158.     These algorithms represent the state of the art in warfare against
  159.     large composite numbers (therefore agianst RSA).  The best algorithms 
  160.     have a super-polynomial (sub-exponential) running time, with the NFS 
  161.     having an asypmtotic time estimate closest to polynomial behaivior.
  162.         
  163.     Still, factoring large numbers is hard.  However, with the advances 
  164.     in number theory and computing power, it is getting easier.  In 1977
  165.     Ron Rivest said that factoring a 125-digit number would take
  166.     40 quadrillion years.  In 1994 RSA129 was factored using about
  167.     5000 MIPS-years of effort from idle CPU cycles on computers across 
  168.     the Internet for eight months.  In 1995 the Blacknet key (116 digits) 
  169.     was factored using about 400 MIPS-years of effort (1 MIPS-year is
  170.     a 1,000,000 instruction per second computer running for one year)
  171.     from several dozen workstations and a MasPar for about three months.  
  172.     Given current trends the keysize that can be factored will only 
  173.     increase as time goes on.  The table below estimates the effort
  174.     required to factor some common PGP-based RSA public-key modulous
  175.     lengths using the General Number Field Sieve:
  176.  
  177.  
  178.         KeySize         MIPS-years required to factor
  179.     -----------------------------------------------------------------
  180.         512                     30,000
  181.         768                     200,000,000
  182.         1024                    300,000,000,000
  183.         2048                    300,000,000,000,000,000,000
  184.  
  185.     
  186.     The next chart shows some estimates for the equivalences in brute
  187.     force key searches of symmetric keys and brute force factoring 
  188.     of asymmetric keys, using the NFS.
  189.  
  190.  
  191.         Symmetric                       Asymmetric
  192.     ------------------------------------------------------------------
  193.         56-bits                         384-bits
  194.         64-bits                         512-bits
  195.         80-bits                         768-bits
  196.         112-bits                        1792-bits
  197.         128-bits                        2304-bits
  198.  
  199.  
  200.     It was said by the 4 men who factored the Blacknet key that 
  201.     "Organizations with 'more modest' resources can almost certainly
  202.     break 512-bit keys in secret right now."  This is not to say
  203.     that such an organization would be interested in devoting so
  204.     much computing power to break just anyone's messages.  However, most
  205.     people using cryptography do not rest comfortably knowing the
  206.     system they trust their secrets to can be broken...  
  207.  
  208.     My advice as always is to use the largest key allowable by the 
  209.     implementation.  If the implementation does not allow for large 
  210.     enough keys to satisfy your paranoia, do not use that implementation.
  211.  
  212.  
  213.     -- PGP's Handling of Prime Numbers --
  214.  
  215.  
  216.     RSA gets it's security from the presumed difficulty in factoring
  217.     large prime numbers.  So, PGP needs some way of generating large
  218.     prime numbers.  As it turns out, there is no way to feasibly 
  219.     generate large primes.  So, what PGP does,is generate large odd
  220.     numbers and test them for primality.  
  221.     By the way, there *are* in fact, an infinite amount of prime numbers.  
  222.     Probably more than you would first suspect.  The prime number theorem 
  223.     gives a useful approximation for the prime distribution function 
  224.     PI(n); which specifies the number of primes <=n:
  225.         
  226.           limit
  227.         n -->  infinity PI(n) / [ n / (ln (n) )] == 1
  228.  
  229.     So, the approximation n/ln n gives with reasonable accuracy, the
  230.     density of primes less than or equal to n:
  231.  
  232.         There are 17 prime numbers from 1-60.  
  233.  
  234.             60 / ln(60) = 14.65
  235.  
  236.         An error of about 8% (this is not linear, however).
  237.       
  238.  
  239.     To test a candidate number (n) for primality, one obvious and simple
  240.     method is to try trial divisions.  Try dividing n by each integer
  241.     2,3,...,sqrt(n).  If n is prime, none of the trial divisors will 
  242.     divide it.  Assuming each division takes constant time, this method 
  243.     has a worst case running time (if n is in fact prime) proportional to
  244.     exponential, in the length of n.  If n is non-trivial (which is the
  245.     case for the PGP's candidate numbers) this approach is not feasible
  246.     (this is also why trial division is not a viable method of attack
  247.     against RSA).  (Trial divsion has the one advantage of determining the
  248.     prime factorization of n, however.  But who wants to wait till the
  249.     Universe explodes (implodes)?) 
  250.     
  251.     -- Psuedo-Primality --
  252.  
  253.     In order to test non-trivial candidates, PGP uses psuedo-primality
  254.     testing.  Psuedo-primality tests take a candidate number and test
  255.     it for primality, returning with a certian degree of accuracy, whether
  256.     or not it's prime.  PGP uses the 4 Fermat Tests to test the numbers
  257.     for primality. 
  258.  
  259.     -- The Four Fermat Tests --
  260.  
  261.     - Candidate number to be tested for primality: n.
  262.     - Take the first 4 prime numbers b={2,3,5,7}
  263.     - Take b^(n-1) % n = w
  264.     - If w == 1; for all b, n is probably prime.  Any other number and n is 
  265.       definitely not prime.  
  266.  
  267.     
  268.     While it *is* possible for a number to be reported as being prime 
  269.     when it is in reality a composite, it is very unlikely.  After each 
  270.     successful test the likelyhood drops dramatically, after one test, 
  271.     the likelyhood is 1 in 10^13, after  two tests, the likelyhood is 
  272.     1 in 10^26, and if the number passes all four tests, the possibility
  273.     of it not being prime is 1 in 10^52.  The 4 Fermat Tests will *not* 
  274.     discard a prime number.
  275.     
  276.  
  277.     -- The Carmichael Numbers --
  278.     
  279.     Unfortunately, there are some numbers which are *not* prime, that
  280.     do satisfy the equation b^(n-1) % n.  These integers are known as
  281.     The Carmichael Numbers, and are quite rare (the reason being because
  282.     a Carmichael Number must not be divisable by the square of any prime
  283.     and must be the product of at least three primes).  The first 
  284.     three Carmichael Numbers are: 561, 1105, and 1729.  They are so rare,
  285.     in fact, there are only 255 of them less than 10^9.  The chance of
  286.     PGP generating a Carmichael Number is less than 1 in 10^50.  
  287.  
  288.     
  289.     -- Esoteric RSA attacks --      
  290.  
  291.     These attacks do not exhibit any profound weakness in RSA itself,
  292.     just in certian implementations of the protocol.  Most are not
  293.     issues in PGP.
  294.     
  295.     -- Choosen cipher-text attack --
  296.     
  297.     An attacker listens in on the insecure channel in which RSA
  298.     messages are passed.  The attacker collects an encrypted message
  299.     c, from the target (destined for some other party).  The attacker
  300.     wants to be able to read this message without having to mount a
  301.     serious factoring effort.  In other words, she wants m=c^d.
  302.  
  303.     To recover m, the attacker first chooses a random number, r<n.
  304.     (The attacker has the public-key (e,n).)  The attacker computes:
  305.  
  306.         x=r^e mod n (She encrypts r with the target's public-key)
  307.     
  308.         y=xc mod n (Multiplies the target ciphertext with the temp)
  309.     
  310.         t=r^-1 mod n (Multiplicative inverse of r mod n)
  311.     
  312.     The attacker counts on the fact property that:
  313.     
  314.         If x=r^e mod n, Then r=x^d mod n
  315.         
  316.     The attacker then gets the target to sign y with her private-key,
  317.     (which actually decrypts y) and sends u=y^d mod n to the
  318.     attacker.  The attacker simply computes:
  319.  
  320.     tu mod n = (r^-1)(y^d) mod n = (r^-1)(x^d)(c^d) mod n = (c^d) mod n 
  321.         
  322.                 = m
  323.  
  324.     To foil this attack do not sign some random document presented to 
  325.     you.  Sign a one-way hash of the message instead.
  326.  
  327.     -- Low encryption exponent e --
  328.  
  329.     As it turns out, e being a small number does not take away from the
  330.     security of RSA.  If the encryption exponent is small (common values
  331.     are 3,17, and 65537) then public-key operations are significantly
  332.     faster.  The only problem in using small values for e  as a public 
  333.     exponent is in encrypting small messages.  If we have 3 as our e
  334.     and we have an m smaller than the cubic root of n, then the message
  335.     can be recovered simply by taking the cubic root of m beacuse:  
  336.  
  337.         m [for m<= 3rdroot(n)]^3 mod n will be equivalent to m^3
  338.  
  339.         and therefore:
  340.  
  341.         3rdroot(m^3) = m.
  342.  
  343.     To defend against this attack, simply pad the message with a nonce
  344.     before encryption, such that m^3 will always be reduced mod n.  
  345.     
  346.     PGP uses a small e for the encryption exponent, by default it tries 
  347.     to use 17.  If it cannot compute d with e being 17, PGP will iterate
  348.     e to 19, and try again...  PGP also makes sure to pad m with a random 
  349.     value so m > n. 
  350.  
  351.  
  352.     -- Timing attack against RSA --
  353.  
  354.     A very new area of attack publically discovered by Paul Kocher deals 
  355.     with the fact that different cryptographic operations (in this case
  356.     the modular exponentiation operations in RSA) take discretely different
  357.     amounts of time to process.  If the RSA computations are done without
  358.     the Chinese Remainder theorem, the following applies:
  359.  
  360.     An attacker can exploit slight timing differences in RSA computations 
  361.     to, in many cases, recover d.  The attack is a passive one where the 
  362.     attacker sits on a network and is able to observe the RSA operations. 
  363.  
  364.     The attacker passively observes k operations measuring the time t
  365.     it takes to compute each modular exponentation operation:
  366.     m=c^d mod n.  The attacker also knows c and n.  The psuedo code of 
  367.     the attack:             
  368.  
  369.     Algorithm to compute m=c^d mod n:
  370.  
  371.     Let m0 = 1.
  372.     Let c0 = x.
  373.     For i=0 upto (bits in d-1):
  374.         If (bit i of d) is 1 then
  375.             Let mi+1 = (mi * ci) mod n.
  376.         Else
  377.             Let mi+1 = mi.
  378.         Let di+1 = di^2 mod n.
  379.     End.
  380.  
  381.     This is very new (the public announcement was made on 12/7/95) 
  382.     and intense scrutiny of the attack has not been possible.  However, 
  383.     Ron Rivest had this to say about countering it:
  384.  
  385. - -------------------------------------------BEGIN INCLUDED TEXT---------------
  386.  
  387. From: Ron Rivest <rivest>
  388. Newsgroups: sci.crypt
  389. Subject: Re: Announce: Timing cryptanalysis of RSA, DH, DSS
  390. Date: 11 Dec 1995 20:17:01 GMT
  391. Organization: MIT Laboratory for Computer Science
  392.  
  393. The simplest way to defeat Kocher's timing attack is to ensure that the
  394. cryptographic computations take an amount of time that does not depend on the
  395. data being operated on.  For example, for RSA it suffices to ensure that
  396. a modular multiplication always takes the same amount of time, independent of
  397. the operands.
  398.  
  399. A second way to defeat Kocher's attack is to use blinding: you "blind" the
  400. data beforehand, perform the cryptographic computation, and then unblind
  401. afterwards.  For RSA, this is quite simple to do.  (The blinding and 
  402. unblinding operations still need to take a fixed amount of time.) This doesn't
  403. give a fixed overall computation time, but the computation time is then a
  404. random variable that is independent of the operands.
  405. - - 
  406. ==============================================================================
  407. Ronald L. Rivest  617-253-5880  617-253-8682(Fax) rivest@theory.lcs.mit.edu
  408. ==============================================================================
  409.  
  410. - ---------------------------------------------END INCLUDED TEXT---------------
  411.  
  412.     The blinding Rivest speaks of simply introduces a random value into
  413.     the decryption process.  So, 
  414.  
  415.         m = c^d mod n
  416.  
  417.     becomes:
  418.  
  419.         m = r^-1(cr^e)^d mod n
  420.  
  421.     r is the random value, and r^-1 is it's inverse.
  422.     
  423.     PGP is not vulnerable to the timing attack as it uses the CRT to
  424.     speed RSA operations.  Also, since the timing attack requires an
  425.     attacker to observe the cryptographic operations in real time (ie:
  426.     snoop the decryption process from start to finish) and most people
  427.     encrypt and decrypt off-line, it is further made inpractical.
  428.  
  429.     While the attack is definitly something to be wary of, it is
  430.     theorectical in nature, and has not been done in practice as of
  431.     yet.  
  432.  
  433.     -- Other RSA attacks --
  434.  
  435.     There are other attacks against RSA, such as the common modulous
  436.     attack in which several users share n, but have different values
  437.     for e and d.  Sharing a common modulous with several users, can 
  438.     enable an attacker to recover a message without factoring n.  PGP 
  439.     does not share public-key modulous' among users.
  440.  
  441.     If d is up to one quarter the size of n and e is less than n, d
  442.     can be recovered without factoring.  PGP does not choose small
  443.     values for the decryption exponent.  (If d were too small it might 
  444.     make a brute force sweep of d values feasible which is obviously a 
  445.     bad thing.)
  446.  
  447.  
  448.     -- Keysizes --
  449.  
  450.     It is pointless to make predictions for recommended keysizes.  
  451.     The breakneck speed at which technology is advancing makes it
  452.     difficult and dangerous.  Respected cryptographers will not make 
  453.     predictions past 10 years and I won't embarass myself trying to 
  454.     make any.  For today's secrets, a 1024-bit is probably safe and
  455.     a 2048-bit key definitely is.  I wouldn't trust these numbers 
  456.     past the end of the century.  However, it is worth mentioning that
  457.     RSA would not have lastest this long if it was as fallible as some 
  458.     crackpots with middle initials would like you to believe.
  459.  
  460.  
  461.  
  462.             3 -- [The one-way hash] -- 3
  463.  
  464.  
  465.     MD5 is the one-way hash used to hash the passphrase into the IDEA 
  466.     key and to sign documents.  Message Digest 5 was designed by Rivest 
  467.     as a sucessor to MD4 (which was found to be weakened with reduced 
  468.     rounds).  It is slower but more secure.  Like all one-way hash 
  469.     functions, MD5 takes an arbitrary-length input and generates a unique 
  470.     output.  
  471.  
  472.     -- Brute Force of MD5 --
  473.  
  474.     The strength of any one-way hash is defined by how well it can 
  475.     randomize an arbitrary message and produce a unique output.  There
  476.     are two types of brute force attacks against a one-way hash 
  477.     function, pure brute force (my own terminolgy) and the birthday
  478.     attack.
  479.  
  480.  
  481.     -- Pure Brute Force Attack against MD5 --
  482.  
  483.  
  484.     The output of MD5 is 128-bits.  In a pure brute force attack, 
  485.     the attacker has access to the hash of message H(m).  She wants
  486.     to find another message m' such that:
  487.  
  488.             H(m) = H(m').  
  489.  
  490.     To find such message (assuming it exists) it would take a machine
  491.     that could try 1,000,000,000 messages per second about 1.07E22
  492.     years.  (To find m would require the same amount of time.)
  493.  
  494.     
  495.     -- The birthday attack against MD5 --
  496.  
  497.     Find two messages that hash to the same value is known as a collision 
  498.     and is exploited by the birthday attack.
  499.  
  500.     The birthday attack is a statistical probability problem.  Given
  501.     n inputs and k possible outputs, (MD5 being the function to take
  502.     n -> k) there are n(n-1)/2 pairs of inputs.  For each pair, there
  503.     is a probability of 1/k of both inputs producing the same output.
  504.     So, if you take k/2 pairs, the probability will be 50% that a
  505.     matching pair will be found.  If n > sqrt(k), there is a good chance
  506.     of finding a collision.  In MD5's case, 2^64 messages need to be
  507.     tryed.  This is not a feasible attack given today's technology.  If 
  508.     you could try 1,000,000 messages per second, it would take 584,942 
  509.     years to find a collision. (A machine that could try 1,000,000,000 
  510.     messages per second would take 585 years, on average.)
  511.  
  512.     For a successful account of the birthday against crypt(3), see:
  513.     url: 
  514.    
  515.    ftp://ftp.infonexus.com/pub/Philes/Cryptography/crypt3Collision.txt.gz
  516.  
  517.  
  518.     -- Other attacks against MD5 --
  519.         
  520.     Differential cryptanalysis has proven to be effective against one
  521.     round of MD5, but not against all 4 (differential cryptanalysis
  522.     looks at ciphertext pairs whose plaintexts has specfic differences
  523.     and analyzes these differences as they propagate through the cipher).
  524.     
  525.     There was successful attack at the compression function itself that
  526.     produces collsions, but this attack has no practical impact the
  527.     security.  If your copy of PGP has had the MD5 code altered to
  528.     cause these collisions, it would fail the message digest 
  529.     verification and you would reject it as altered... Right?
  530.  
  531.  
  532.     -- Passphrase Length and Information Theory --
  533.     
  534.     According to conventional information theory, the English language 
  535.     has about 1.3 bits of entropy (information) per 8-bit character.
  536.     If the pass phrase entered is long enough, the reuslting MD5 hash will
  537.     be statisically random.  For the 128-bit output of MD5, a pass phrase
  538.     of about 98 characters will provide a random key:
  539.  
  540.         (8/1.3) * (128/8) = (128/1.3) = 98.46 characters
  541.  
  542.     How many people use a 98 character passphrase for you secret-key
  543.     in PGP?  Below is 98 characters...
  544.  
  545.     123456789012345678901234567890123456789012356789012345678901234567\
  546.     \890123456789012345678
  547.  
  548.     1.3 comes from the fact that an arbitrary readable English sentence
  549.     is usually going to consist of certian letters, (e,r,s, and t are
  550.     statiscally very common) thereby reducing it's entropy.  If any of the 
  551.     26 letters in the Latin alphabet were equally possible and likely 
  552.     (which is seldom the case) the entropy increases.  The so-called 
  553.     absolute rate would, in this case, be:
  554.         
  555.         log(26) / log(2) = 4.7 bits
  556.  
  557.     In this case of increased entropy, a password with a truly random 
  558.     sequence of English characters will only need to be:
  559.  
  560.         (8/4.7) * (128/8) = (128/4.7) = 27.23 characters
  561.  
  562.  
  563.     For more info on passphrase length, see the PGP passphrase FAQ:
  564.     
  565.     http://www.stack.urc.tue.nl/~galactus/remailers/passphrase-faq.html
  566.     ftp://ftp.infonexus.com/pub/Philes/Cryptography/PGP/PGPpassphraseFAQ.gz 
  567.  
  568.             4 -- [The PRNG] -- 4
  569.  
  570.  
  571.     PGP employs 2 PRNG's to generate and manipulate (psuedo) random data.
  572.     The ANSI X9.17 generator and a function which measures the entropy
  573.     from the latency in a user's keystrokes.  The random pool (which is
  574.     the randseed.bin file) is used to seed the ANSI X9.17 PRNG (which uses 
  575.     IDEA, not 3DES).  Randseed.bin is initially generated from trueRand 
  576.     which is the keystroke timer.  The X9.17 generator is pre-washed with 
  577.     an MD5 hash of the plaintext and postwashed with some random data 
  578.     which is used to generate the next randseed.bin file.  The process is 
  579.     broken up and discussd below.
  580.  
  581.  
  582.     -- ANSI X9.17 (cryptRand) --
  583.  
  584.     The ANSI X9.17 is the method of key generation PGP uses. It is 
  585.     oficially specified using 3DES, but was easily converted to IDEA. 
  586.     X9.17 requires 24 bytes of random data from randseed.bin.  (PGP
  587.     keeps an extra 384 bytes of state information for other uses...)
  588.     When cryptRand starts, the randseed.bin file is washed (see below)
  589.     and the first 24-bytes are used to initialize X9.17.  It works as 
  590.     follows:
  591.  
  592.     E() = an IDEA encryption, with a reusable key used for key generation
  593.     T = timestamp (data from randseed.bin used in place of timestamp)
  594.     V = Initialization Vector, from randseed.bin    
  595.     R = random session key to be generated
  596.  
  597.     R = E[E(T) XOR V]
  598.     
  599.     the next V is generated thusly:
  600.  
  601.     V = E[E(T) XOR R]
  602.  
  603.     -- Latency Timer (trueRand) --
  604.  
  605.     The trueRand generator attempts to measure entropy from the latency
  606.     of a user's keystrokes every time the user types on the keyboard.  It
  607.     is used to generate the initial randseed.bin which is in turn used to
  608.     seed to X9.17 generator.
  609.     The quality of the output of trueRand is dependent upon it's input.
  610.     If the input has a low amount of entropy, the output will not be as
  611.     random as possible.  In order to maxmize the entropy, the keypresses
  612.     should be spaced as randomly as possible.
  613.  
  614.     
  615.     -- X9.17 Prewash with MD5 --
  616.  
  617.     In most situations, the attacker does not know the content of the 
  618.     plaintext being encrypted by PGP.  So, in most cases, washing the
  619.     X9.17 generator with an MD5 hash of the plaintext, simply adds to
  620.     security.  This is based on the assumption that this added unknown 
  621.     information will add to the entropy of the generator.
  622.     If, in the event that the attacker has some information about the
  623.     plaintext (perhaps the attacker knows which file was encrypted, and
  624.     wishes to prove this fact) the attacker may be able to execute a
  625.     known-plaintext attack against X9.17.  However, it is not likely
  626.     that, with all the other precautions taken, that this would weaken
  627.     the generator.
  628.  
  629.     -- Randseed.bin wash --
  630.  
  631.     The randseed is washed before and after each use.  In PGP's case
  632.     a wash is an IDEA encryption in cipher-feedback mode.  Since IDEA
  633.     is considered secure (see section 1), it should be just as hard to 
  634.     determine the 128-bit IDEA key as it is to glean any information from 
  635.     the wash.  The IDEA key used is the MD5 hash of the plaintext and an 
  636.     initialization vector of zero.  The IDEA session key is then generated
  637.     as is an IV.
  638.     The postwash is considered more secure.  More random bytes are 
  639.     generated to reinitialize randseed.bin.  These are encrypted with the
  640.     same key as the PGP encrypted message.  The reason for this is that if
  641.     the attacker knows the session key, she can decrypt the PGP message 
  642.     directly and would have no need to attack the randseed.bin.  (A note,
  643.     the attacker might be more interested in the state of the 
  644.     randseed.bin, if they were attacking all messages, or the message 
  645.     that the user is expected to send next).
  646.  
  647.  
  648.  
  649.             5 -- [Practical Attacks] -- 5
  650.  
  651.     Most of the attacks outlined above are either not possible or not
  652.     feasable by the average adversary.  So, what can the average cracker
  653.     do to subvert the otherwise stalwart security of PGP?  As it turns 
  654.     out,  there are several "doable" attacks that can be launched by the 
  655.     typical cracker.  They do not attack the cryptosystem protocols 
  656.     themselves, (which have shown to be secure) but rather system 
  657.     specific implementations of PGP.
  658.  
  659.  
  660.     -- Passive Attacks (Snooping) --
  661.  
  662.     These attacks do not do need to do anything proactive and can easily 
  663.     go undetected.
  664.  
  665.     -- Keypress Snooping  --
  666.  
  667.     Still a very effective method of attack, keypress snooping can subvert
  668.     the security of the strongest cryptosystem.  If an attacker can 
  669.     install a keylogger, and capture the passphrase of an unwary target,
  670.     then no cryptanalysis whatsoever is necessary.  The attacker has the
  671.     passphrase to unlock the RSA private key.  The system is completely
  672.     compromised.
  673.     The methods vary from system to system, but I would say DOS-based PGP 
  674.     would be the most vulnerable.  DOS is the easiest OS to subvert, and 
  675.     has the most key-press snooping tools that I am aware of.  All an 
  676.     attacker would have to do would be gain access to the machine for 
  677.     under 5 minutes on two seperate occasions and the attack would be 
  678.     complete.  The first time to install the snooping software, the second 
  679.     time, to remove it, and recover the goods. (If the machine is on a 
  680.     network, this can all be done *remotely* and the ease of the attack 
  681.     increases greatly.)  Even if the target boots clean, not loading any 
  682.     TSR's, a boot sector virus could still do the job, transparently.
  683.     Just recently, the author has discovered a key logging utility for
  684.     Windows, which expands this attack to work under Windows-based PGP
  685.     shells (this logger is available from the infonexus via ftp, BTW).
  686.     ftp://ftp.infonexus.com/pub/ToolsOfTheTrade/DOS/KeyLoggers/
  687.  
  688.     Keypress snooping under Unix is a bit more complicated, as root
  689.     access is needed, unless the target is entering her passphrase from
  690.     an X-Windows GUI.  There are numerous key loggers available to 
  691.     passively observe keypresses from an X-Windows session.  Check: 
  692.     ftp://ftp.infonexus.com/pub/SourceAndShell/Xwindows/
  693.  
  694.     -- Van Eck Snooping --
  695.     
  696.     The original invisible threat.  Below is a clip from a posting by
  697.     noted information warfare guru Winn Schwartau describing a Van Eck
  698.     attack:
  699.  
  700. - -------------------------------------------BEGIN INCLUDED TEXT---------------
  701.  
  702. Van Eck Radiation Helps Catch Spies 
  703.  
  704. "Winn Schwartau" < p00506@psilink.com > 
  705. Thu, 24 Feb 94 14:13:19 -0500 
  706.  
  707.  
  708. Van Eck in Action
  709.  
  710. Over the last several years, I have discussed in great detail how the
  711. electromagnetic emissions from personal computers (and electronic gear in
  712. general) can be remotely detected without a hard connection and the
  713. information on the computers reconstructed.  Electromagnetic eavesdropping is
  714. about insidious as you can get: the victim doesn't and can't know that anyone
  715. is 'listening' to his computer.  To the eavesdropper, this provides an ideal
  716. means of surveillance: he can place his eavesdropping equipment a fair
  717. distance away to avoid detection and get a clear representation of what is
  718. being processed on the computer in question.  (Please see previous issues of
  719. Security Insider Report for complete technical descriptions of the
  720. techniques.)
  721.  
  722. The problem, though, is that too many so called security experts, (some
  723. prominent ones who really should know better) pooh-pooh the whole concept,
  724. maintaining they've never seen it work.  Well, I'm sorry that none of them
  725. came to my demonstrations over the years, but Van Eck radiation IS real and
  726. does work.  In fact, the recent headline grabbing spy case illuminates the
  727. point.
  728.  
  729. Exploitation of Van Eck radiation appears to be responsible, at least in part,
  730. for the arrest of senior CIA intelligence officer Aldrich Hazen Ames on
  731. charges of being a Soviet/Russian mole.  According to the Affidavit in support
  732. of Arrest Warrant, the FBI used "electronic surveillance of Ames' personal
  733. computer and software within his residence," in their search for evidence
  734. against him.  On October 9, 1993, the FBI "placed an electronic monitor in his
  735. (Ames') computer," suggesting that a Van Eck receiver and transmitter was used
  736. to gather information on a real-time basis.  Obviously, then, this is an ideal
  737. tool for criminal investigation - one that apparently works quite well.  (From
  738. the Affidavit and from David Johnston, "Tailed Cars and Tapped Telephones: How
  739. US Drew Net on Spy Suspects," New York Times, February 24, 1994.)
  740.  
  741. >From what we can gather at this point, the FBI black-bagged Ames' house and
  742. installed a number of surveillance devices.  We have a high confidence factor
  743. that one of them was a small Van Eck detector which captured either CRT
  744. signals or keyboard strokes or both.  The device would work like this:
  745.  
  746. A small receiver operating in the 22MHz range (pixel frequency) would detect
  747. the video signals minus the horizontal and vertical sync signals.  Since the
  748. device would be inside the computer itself, the signal strength would be more
  749. than adequate to provide a quality source.  The little device would then
  750. retransmit the collected data in real-time to a remote surveillance vehicle or
  751. site where the video/keyboard data was stored on a video or digital storage
  752. medium.
  753.  
  754. At a forensic laboratory, technicians would recreate the original screens and
  755. data that Mr. Ames entered into his computer.  The technicians would add a
  756. vertical sync signal of about 59.94 Hz, and a horizontal sync signal of about
  757. 27KHz.  This would stabilize the roll of the picture. In addition, the
  758. captured data would be subject to "cleansing" - meaning that the spurious
  759. noise in the signal would be stripped using Fast Fourier Transform techniques
  760. in either hardware or software.  It is likely, though, that the FBI's device
  761. contained within it an FFT chip designed by the NSA a couple of years ago to
  762. make the laboratory process even easier.
  763.  
  764. I spoke to the FBI and US Attorney's Office about the technology used for
  765. this, and none of them would confirm or deny the technology used "on an active
  766. case."
  767.  
  768. Of course it is possible that the FBI did not place a monitoring device within
  769. the computer itself, but merely focused an external antenna at Mr. Ames'
  770. residence to "listen" to his computer from afar, but this presents additional
  771. complexities for law enforcement.
  772.  
  773.      1. The farther from the source the detection equipment sits means that
  774. the detected information is "noisier" and requires additional forensic
  775. analysis to derive usable information.
  776.  
  777.      2. Depending upon the electromagnetic sewage content of the immediate
  778. area around Mr. Ames' neighborhood, the FBI surveillance team would be limited
  779. as to what distances this technique would still be viable.  Distance squared
  780. attenuation holds true.
  781.  
  782.      3. The closer the surveillance team sits to the target, the more likely
  783. it is that their activities will be discovered.
  784.  
  785. In either case, the technology is real and was apparently used in this
  786. investigation.  But now, a few questions arise.
  787.  
  788.      1.  Does a court surveillance order include the right to remotely
  789. eavesdrop upon the unintentional emanations from a suspect's electronic
  790. equipment?  Did the warrants specify this technique or were they shrouded
  791. under a more general surveillance authorization?  Interesting question for the
  792. defense.
  793.  
  794.      2. Is the information garnered in this manner admissible in court?  I
  795. have read papers that claim defending against this method is illegal in the
  796. United States, but I have been unable to substantiate that supposition.
  797.  
  798.      3. If this case goes to court, it would seem that the investigators would
  799. have to admit HOW they intercepted signals, and a smart lawyer (contradictory
  800. allegory :-) would attempt to pry out the relevant details.  This is important
  801. because the techniques are generally classified within the intelligence
  802. community even though they are well understood and explained in open source
  803. materials.  How will the veil of national security be dropped here?
  804.  
  805. To the best of my knowledge, this is the first time that the Government had
  806. admitted the use of Van Eck (Tempest Busting etc.)  in public.  If anyone
  807. knows of any others, I would love to know about it.
  808.  
  809. - ---------------------------------------------END INCLUDED TEXT---------------
  810.  
  811.     The relevance to PGP is obvious, and the threat is real.  Snooping
  812.     the passphrase from the keyboard, and even whole messages from 
  813.     the screen are viable attacks.  This attack, however exotic it may 
  814.     seem, is not beyond the capability of anyone with some technical 
  815.     know-how and the desire to read PGP encrypted files.  
  816.  
  817.     -- Memory Space Snooping --
  818.  
  819.     In a multi-user system such as Unix, the physical memory of the 
  820.     machine can be examined by anyone with the proper privaleges (usally
  821.     root).  In comparsion with factoring a huge composite number, opening
  822.     up the virtual memory of the system (/dev/kmem) and seeking to a
  823.     user's page and directly reading it, is trivial.
  824.  
  825.     -- Disk Cache Snooping --
  826.  
  827.     In multitasking environments such as Windows, the OS has a nasty habit
  828.     of paging the contents of memory to disk, usally transparently to the
  829.     user, whenever it feels the need to free up some RAM.  This 
  830.     information can sit, in the clear, in the swapfile for varying lengths
  831.     of time, just waiting for some one to come along and recover it.
  832.     Again, in a networked environment where machine access can be done with 
  833.     relative impunity, this file can be stolen without the owner's consent
  834.     or knowledge.
  835.  
  836.     -- Packet Sniffing --
  837.  
  838.     If you use PGP on a host which you access remotely, you can be 
  839.     vulnerable to this attack.  Unless you use some sort of session
  840.     encrypting utility, such as SSH, DESlogin, or some sort of network
  841.     protocol stack encryption (end to end or link by link) you are sending
  842.     your passphrase, and messages across in the clear.  A packet sniffer
  843.     sitting at a intermediate point between your terminal can capture all 
  844.     this information quietly and efficiently.  Packet sniffers are 
  845.     available at the infonexus:  
  846.     ftp://ftp.infonexus.com/pub/SourceAndShell/Sniffers/
  847.  
  848.     -- Active Attacks --
  849.  
  850.     These attacks are more proactive in nature and tend to be a bit more
  851.     difficult to wage.
  852.  
  853.     -- Trojan Horse --
  854.  
  855.     The age old trojan horse attack is still a very effective means 
  856.     of compromise.  The concept of a trojan horse should not be foriegn
  857.     to anyone.  An apparently harmless program that in reality is evil
  858.     and does potentially malicious things to your computer.  How does
  859.     this sound...:
  860.     Some 31it3 coder has come up with a k3wl new Windows front-end to
  861.     PGP.  All the newbies run out and ftp a copy.  It works great, with
  862.     a host of buttons and scrollbars, and it even comes with a bunch
  863.     of *.wav files and support for a SB AWE 32 so you can have the
  864.     16-bit CD quality sound of a safe locking when you encrypt your
  865.     files.  It runs in a tiny amount of memory, coded such that nothing
  866.     leaks, it intercepts OS calls that would otherwise have it's contents
  867.     paged to disk and makes sure all the info stays in volatile memory.
  868.     It works great (the first Windows app thar does).  Trouble is, this
  869.     program actually has a few lines of malevolent code that record your
  870.     secret-key passphrase, and if it finds a modem (who doesn't have a
  871.     modem these days?) it 'atm0's the modem and dials up a hard coded 
  872.     number to some compromised computer or modem bank and sends the info
  873.     through.  
  874.     Possible?  Yes.  Likely?  No.
  875.     
  876.  
  877.     -- Reworked Code --
  878.  
  879.     The code to PGP is publically available.  Therefore it is easy to
  880.     modify.  If someone were to modify the sourcecode to PGP inserting
  881.     a sneaky backdoor and leave it at some distribution point, it could
  882.     be disasterous.  However, it is also very easy to detect.  Simply
  883.     verify the checksums.  Patching the MD5 module to report a false
  884.     checksum is also possible, so verify using a known good copy.
  885.     A more devious attack would be to modify the code, compile it and 
  886.     surreptitouly plant in the target system.  In a networked environment
  887.     this can be done without ever having physical access to the machine.
  888.  
  889.             6 -- [What if...] -- 6
  890.     
  891.     ...My secret key was comprimsed?
  892.         
  893.     A PGP secret key is kept conventionally encrypted with IDEA.  Assuming
  894.     your passphrase is secure enough (see section 3) the best method of
  895.     attack will be a brute force key-search.  If an attacker could test 
  896.     1,000,000,000,000 keys per second, it would take 1x10^17 years 
  897.     before odds will be in the attacker's favor...
  898.     
  899.     ...PGP ran outta primes?
  900.  
  901.     There are an infinite amount of prime numbers.  The approximate 
  902.     density of primes lesser than or equal to n is n/ln(n).  For a 
  903.     1024-bit key, this yields:
  904.  
  905.         1.8*10^308/ln(1.8*10^308) = 2.5*10^305
  906.  
  907.     There are about 2.5*10^228 times more prime numbers less than 
  908.     1024-bits than there are atoms in the universe...
  909.  
  910.     ...What if someone made a list of all these prime numbers?
  911.  
  912.     If you could store 1,000,000 terabytes of information of a device 
  913.     that weighs 1 gram, (and we figure each number fits in a space of 128 
  914.     bytes or less) we would need a device that weighs 3.2*10^289 grams or
  915.     7*10^286 pounds.  This is 1.6*10^256 times more massive than our sun.  
  916.     Nevermind the fact that we don't have enough matter to even concieve 
  917.     of building such a device, and if we could, it would collapse into
  918.     a black-hole...
  919.     
  920.     ...And used them in a brute force search?
  921.     
  922.     There are 2.5E305(2.5E305-1)/2 possible pairs.  This is 3.12*10^610 
  923.     combinations.  Absurd, isn't it?
  924.  
  925.     ...PGP chose composites instead of primes?
  926.     
  927.     The likelyhood of the Fermat Tests of passing a composite off as a 
  928.     prime is 1 in 10^52.  If PGP could generate 1,000,000,000,000 primes
  929.     per second, It would take about 1x10^32 years until odds are better 
  930.     than even for that to happen.
  931.  
  932.     
  933.             7 -- [Closing Comments] -- 7
  934.  
  935.     I have presented factual data, statistical data, and projected data.
  936.     Form your own conclusions.  Perhaps the NSA has found a polynomial-time 
  937.     (read: *fast*) factoring algorithm.  But we cannot dismiss an 
  938.     otherwise secure cryptosystem due to paranoia.  Of course, on the 
  939.     same token, we cannot trust cryptosystems on hearsay or assumptions of
  940.     security.  Bottom line is this: in the field of computer security, it 
  941.     pays to be cautious.  But it doens't pay to be un-informed or 
  942.     needlessly paranoid.  Know the facts.
  943.  
  944.  
  945.            -- [Thank You's (in no particular order)] --
  946.  
  947.     PRZ, Collin Plumb, Paul Kocher, Bruce Schneier, Paul Rubin, Stephen 
  948.     McCluskey, Adam Back, Bill Unruh, Ben Cantrick, Jordy, Galactus,
  949.     the readers of sci.crypt and the comp.security.* groups...
  950.  
  951. - -- 
  952. [ route@infonexus.com ] Guild member, Information enthusiast, Hacker, demon
  953.         ...this universe is MINE... I am *GOD* here...
  954.  
  955.  
  956. -----BEGIN PGP SIGNATURE-----
  957. Version: 2.6.2
  958.  
  959. iQCVAwUBMbCwcAtXkSokWGapAQHo0gP+MaL7fi3e7yRxfbUglOuFJdD06oL+nwHJ
  960. iRvDCvs20zfmatZW+Ya5bzdbEkAmxsDe4uJ8aL1ATu66CO5SnoChDHRfyXPdhgL1
  961. gZnEIZv7oFw4WOCPrIWw2QpvpegnIyvwIHCPTDzhiRhb3eV+H1GQ2gwHNjxRtfp5
  962. mp2XHOras20=
  963. =je1v
  964. -----END PGP SIGNATURE-----
  965.