home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 17 / CD_ASCQ_17_101194.iso / vrac / sfs110.zip / SFS2.DOC < prev    next >
Text File  |  1994-08-01  |  144KB  |  2,475 lines

  1. The Care and Feeding of Passwords
  2. ---------------------------------
  3.  
  4. With the inherent strength of an encryption system like the one used by SFS,
  5. the password used for encryption is becoming more the focus of attack than the
  6. encryption system itself.  The reason for this is that trying to guess an
  7. encryption password is far simpler than trying to break the encryption system.
  8.  
  9. SFS allows keys of up to 100 characters in length.  These keys can contain
  10. letters, numbers, spaces, punctuation, and most control and extended characters
  11. except backspace (which is used for editing), escape (which is used to abort
  12. the password entry), and carriage return or newline, which are used to signify
  13. the end of the password.  This fact should be made use of to the fullest, with
  14. preferred passwords being entire phrases rather than individual words (in fact
  15. since very few words are longer than the SFS absolute minimum password length
  16. of 10 characters, the complete set of these words can be checked in moments).
  17. There exist programs designed to allow high-speed password cracking of standard
  18. encryption algorithms which can, in a matter of hours (sometimes minutes, even
  19. seconds in the case of very weak algorithms), attempt to use the contents of a
  20. number of very large and complete dictionaries as sample passwords[1].  For
  21. example one recent study of passwords used on Unix systems[2] found 25% of all
  22. passwords simply by using sophisticated guessing techniques.  Of the 25% total,
  23. nearly 21% (or around 3,000 passwords) were found within the first week using
  24. only the spare processing power of a few low-end workstations.  368 were found
  25. within the first few minutes.  On an average system with 50 users, the first
  26. password could be found in under 2 minutes, with 5-15 passwords being found by
  27. the end of the first day[3].
  28.  
  29. Virtually all passwords composed of single words can be broken with ease in
  30. this manner, even in the case of encryption methods like the one which is used
  31. by SFS, which has been specially designed to be resistant to this form of
  32. attack (doing a test of all possible 10-letter passwords assuming a worst-case
  33. situation in which the password contains lowercase letters only, can be
  34. accomplished in 450,000 years on a fast workstation (DEC Alpha) if the attacker
  35. knows the contents of the encrypted volume in advance - or about 4 1/2 years on
  36. a network of 100,000 of these machines).  Of course no attacker would use this
  37. approach, as few people will use every possible combination of 10 letter
  38. passwords.  By using an intelligent dictionary-based cracking program, this
  39. time can be reduced to only a few months.  Complete programs which perform this
  40. task and libraries for incorporation into other software are already widely
  41. available[4].  This problem is especially apparent if the encryption algorithm
  42. used is very weak - the encryption used by the popular Pkzip archiver, for
  43. example, can usually be broken in this manner in a few seconds on a cheap
  44. personal computer using the standard wordlist supplied with all Unix
  45. systems[5].
  46.  
  47. Simple modifications to passwords should not be trusted.  Capitalizing some
  48. letters, spelling the words backwards, adding one or two digits to the end, and
  49. so on, present only a slightly more difficult challenge to the average
  50. password-cracker than plain unadorned passwords.  Any phrase which could be
  51. present in any kind of list (song lyrics, movie scripts, books, plays, poetry,
  52. famous sayings, and so on) should not be used - again, these can be easily and
  53. automatically checked by computers.  Using foreign languages offers no extra
  54. security, since it means an attacker merely has to switch to using
  55. foreign-language dictionaries (or phrase lists, song lyrics, and so on).
  56. Relying on an attacker not knowing that a foreign language is being used ("If I
  57. use Swahili they'll never think of checking for it" - the so-called "Security
  58. through obscurity" technique) offers no extra security, since the few extra
  59. days or months it will take to check every known language are only a minor
  60. inconvenience.
  61.  
  62. Probably the most difficult passwords to crack are ones comprising unusual
  63. phrases or sentences, since instead of searching a small body of text like the
  64. contents of a dictionary, book, or phrase list, the cracker must search a much
  65. larger corpus of data, namely all possible phrases in the language being used.
  66. Needless to say, the use of common phrases should be avoided, since these will
  67. be an obvious target for crackers.
  68.  
  69. Some sample bad passwords might be:
  70.  
  71.     misconception               Found in a standard dictionary
  72.     noitpecnocsim               Reversed standard dictionary word
  73.     miskonseption               Simple misspelling of a standard word
  74.     m1skon53pshun               Not-so-simple misspelling of a standard word
  75.     MiScONcepTiON               Standard word with strange capitalization
  76.     misconception1234           Standard word with simple numeric code appended
  77.     3016886726                  Simple numeric code, probably a US phone number
  78.     YKYBHTLWYS                  Simple mnemonic
  79.  
  80. In general coming up with a secure single-word password is virtually impossible
  81. unless you have a very good memory for things like unique 20-digit numbers.
  82.  
  83. Some sample bad passphrases might be:
  84.  
  85.     What has it got in its
  86.      pocketses?                 Found in a common book
  87.     Ph'n-glui mgl'w naf'h
  88.       Cthulhu R'yleh w'gah      Found in a somewhat less common book
  89.     For yesterday the word of
  90.       Caesar might have stood   Found in a theatrical work
  91.     modify the characteristics
  92.       of a directory            Found in a technical manual
  93.     T'was brillig, and the
  94.       slithy toves              Found in a book of poetry
  95.     I've travelled roads that
  96.       lead to wonder            Found in a list of music lyrics
  97.     azetylenoszilliert in
  98.       phaenomenaler kugelform   Found in an obscure foreign journal
  99.     Arl be back                 Found in several films
  100.     I don't recall              Associated with a famous person (although
  101.                                 it does make a good answer to the question
  102.                                 "What's the password?" during an
  103.                                 interrogation)
  104.  
  105. Needless to say, a passphrase should never be written down or recorded in any
  106. other way, or communicated to anyone else.
  107.  
  108. Footnote [1]: A large collection of dictionaries suitable for this kind of
  109.               attack can be found on black.ox.ac.uk in the `wordlists'
  110.               directory.  These dictionaries contain, among other things, 2MB
  111.               of Dutch words, 2MB of German words, 600KB of Italian words,
  112.               600KB of Norwegian words, 200KB of Swedish words, 3.3MB of
  113.               Finnish words, 1MB of Japanese words, 1.1MB of Polish words,
  114.               700KB of assorted names, and a very large collection of assorted
  115.               wordlists covering technical terms, jargon, the Koran, the works
  116.               of Lewis Carrol, characters, actors, and titles from movies,
  117.               plays, and television, Monty Python, Star Trek, US politics, US
  118.               postal areas, the CIA world fact book, the contents of several
  119.               large standard dictionaries and thesaurii, and common terms from
  120.               Australian, Chinese, Danish, Dutch, English, French, German,
  121.               Italian, Japanese, Latin, Norwegian, Polish, Russian, Spanish,
  122.               Swedish, Yiddish, computers, literature, places, religion, and
  123.               scientific terms.
  124.  
  125.               The black.ox.ac.uk site also contains, in the directory
  126.               /src/security, the file cracklib25.tar.Z, a word dictionary of
  127.               around 10MB, stored as a 6.4MB compressed tar file.
  128.  
  129.               A large dictionary of English words which also contains
  130.               abbreviations, hyphenations, and misspelled words, is available
  131.               from wocket.vantage.gte.com (131.131.98.182) in the
  132.               /pub/standard_dictionary directory as dic-0594.tar, an
  133.               uncompressed 16.1MB file, dic-0594.tar.Z, a compressed 7.6MB
  134.               file, dic-0594.tar.gz, a Gzip'ed 5.9MB file, and dic-0594.zip, a
  135.               Zipped 5.8MB file.  This contains around 1,520,000 entries.  In
  136.               combination with a Markov model for the English language built
  137.               from commonly-available texts, this wordlist provides a powerful
  138.               tool for attacking even full passphrases.
  139.  
  140.               A Unix password dictionary is available from ftp.spc.edu as
  141.               .unix/password-dictionary.txt.
  142.  
  143.               Grady Ward <grady@netcom.com> has collected very large
  144.               collections of words, phrases, and other items suitable for
  145.               dictionary attacks on cryptosystems.  Even the NSA has used his
  146.               lists in their work.
  147.  
  148. Footnote [2]: Daniel Klein, "Foiling the Cracker: A Survey of, and Improvements
  149.               to, Password Security", Software Engineering Institute, Carnegie
  150.               Mellon University.
  151.  
  152. Footnote [3]: An improved implementation is approximately 3 times faster on an
  153.               entry-level 386 system, 4 times faster on an entry-level 486
  154.               system, and up to 10 times faster on a more powerful workstation
  155.               such as a Sparcstation 10 or DEC 5000/260, meaning that the first
  156.               password would be found in just over 10 seconds on such a
  157.               machine.
  158.  
  159. Footnote [4]: One such program is "crack", currently at version 4.1 and
  160.               available from black.ox.ac.uk in the directory /src/security as
  161.               crack41.tar.Z.
  162.  
  163. Footnote [5]: Actual cryptanalysis of the algorithm, rather than just trying
  164.               passwords, takes a little longer, usually on the order of a few
  165.               minutes with a low-end workstation.
  166.  
  167.  
  168. Other Software
  169. --------------
  170.  
  171. There are a small number of other programs available which claim to provide
  172. disk security of the kind provided by SFS.  However by and large these tend to
  173. use badly or incorrectly implemented algorithms, or algorithms which are known
  174. to offer very little security.  One such example is Norton's Diskreet, which
  175. encrypts disks using either a fast proprietary cipher or the US Data Encryption
  176. Standard (DES).  The fast proprietary cipher is very simple to break (it can be
  177. done with pencil and paper), and offers protection only against a casual
  178. browser.  Certainly anyone with any programming or puzzle-solving skills won't
  179. be stopped for long by a system as simple as this.
  180.  
  181. The more secure DES algorithm is also available in Diskreet, but there are
  182. quite a number of implementation errors which greatly reduce the security it
  183. should provide.  Although accepting a password of up to 40 characters, it then
  184. converts this to uppercase-only characters and then reduces the total size to 8
  185. characters of which only a small portion are used for the encryption itself.
  186. This leads to a huge reduction in the number of possible encryption keys, so
  187. that not only are there a finite (and rather small) total number of possible
  188. passwords, there are also a large number of equivalent keys, any of which will
  189. decrypt a file (for example a file encrypted with the key 'xxxxxx' can be
  190. decrypted with 'xxxxxx', 'xxxxyy', 'yyyyxx', and a large collection of other
  191. keys, too many to list here).
  192.  
  193. These fatal flaws mean that a fast dictionary-based attack can be used to check
  194. virtually all possible passwords in a matter of hours in a standard PC.  In
  195. addition the CBC (cipher block chaining) encryption mode used employs a known,
  196. fixed initialisation vector (IV) and restarts the chaining every 512 bytes,
  197. which means that patterns in the encrypted data are not hidden by the
  198. encryption.  Using these two implementation errors, a program can be
  199. constructed which will examine a Diskreet-encrypted disk and produce the
  200. password used to encrypt it (or at least one of the many, many passwords
  201. capable of decrypting it) within moments.  In fact, for any data it encrypts,
  202. Diskreet writes a number of constant, fixed data blocks (one of which contains
  203. the name of the programmer who wrote the code, many others are simply runs of
  204. zero bytes) which can be used as the basis of an attack on the encryption.
  205. Even worse, the very weak proprietary scheme used by Diskreet gives away the
  206. encryption key used so that if any two pieces of data are encrypted with the
  207. same password, one with the proprietary scheme and the other with Diskreet's
  208. DES implementation, the proprietary-encrypted data will reveal the encryption
  209. key used for the DES-encrypted data.
  210.  
  211. These problems are in fact explicitly warned against in any of the documents
  212. covering DES and its modes of operation, such as ISO Standards 10116 and
  213. 10126-2, US Government FIPS Publication 81, or basic texts like Denning's
  214. "Cryptography and Data Security".  It appears that the authors of Diskreet
  215. never bothered to read any of the standard texts on encryption to make sure
  216. they were doing things right, or never really tested the finished version.  In
  217. addition the Diskreet encryption code is taken from a code library provided by
  218. another company rather than the people who sell Diskreet, with implementation
  219. problems in both the encryption code and the rest of Diskreet.
  220.  
  221. The DES routines used in Da Vinci, a popular groupware product, are similarly
  222. poorly implemented.  Not only is an 8-character password used directly as the
  223. DES key, but the DES encryption method used is the electronic codebook (ECB)
  224. mode, whose use is warned against in even the most basic cryptography texts
  225. and, in a milder form, in various international encryption standards.  For
  226. example, Annex A.1 of ISO 10116:1991 states "The ECB mode is in general not
  227. recommended".  ISO 10126-2:1991 doesn't even mention ECB as being useful for
  228. message encryption.  The combination of Da Vinci's very regular file structure
  229. (which provides an attacker with a large amount of known data in very file),
  230. the weak ECB encryption mode, and the extremely limited password range, makes a
  231. precomputed dictionary attack (which involves a single lookup in a pre-set
  232. table of plaintext-ciphertext pairs) very easy (even easier, in fact, than the
  233. previously-discussed attack on Unix system passwords).  In fact, as ECB mode
  234. has no pattern hiding ability whatsoever, all that is necessary is to encrypt a
  235. common pattern (such as a string of spaces) with all possible dictionary
  236. password values, and sort and store the result in a table.  Any password in the
  237. dictionary can then be broken just as fast as the value can be read out of the
  238. table.
  239.  
  240. PC Tools is another example of a software package which offers highly insecure
  241. encryption.  The DES implementation used in this package has had the number of
  242. rounds reduced from the normal 16 to a mere 2, making it trivial to break on
  243. any cheap personal computer.  This very weak implementation is distributed
  244. despite a wide body of research which documents just how insecure 2-round DES
  245. really is[1].
  246.  
  247. Even a correctly-implemented and applied DES encryption system offers only
  248. marginal security against a determined attacker.  It has long been rumoured
  249. that certain government agencies and large corporations (and, no doubt,
  250. criminal organizations) possessed specialized hardware which allowed them to
  251. break the DES encryption.  However only in August of 1993 have complete
  252. constructional details for such a device been published.  This device, for
  253. which the budget version can be built for around $100,000, can find a DES key
  254. in 3.5 hours for the somewhat more ambitious $1 million version (the budget
  255. version takes 1 1/2 days to perform the same task). The speed of this device
  256. scales linearly with cost, so that the time taken can be reduced to minutes or
  257. even seconds if enough money is invested.  This is a one-off cost, and once a
  258. DES-breaking machine of this type is built it can sit there day and night
  259. churning out a new DES key every few minutes, hours, or days (depending on the
  260. budget of the attacker).
  261.  
  262. In the 1980's, the East German company Robotron manufactured hundreds of
  263. thousands of DES chips for the former Soviet Union.  This means one of two
  264. things: Either the Soviet Union used the chips to build a DES cracker, or they
  265. used DES to encrypt their own communications, which means that the US built
  266. one.
  267.  
  268. The only way around the problem of fast DES crackers is to run DES more than
  269. once over the data to be encrypted, using so-called triple DES (using DES twice
  270. is as easy to attack as single DES, so in practice three iterations must be
  271. used).  DES is inherently slow.  Triple DES is twice as slow[2].  A hard drive
  272. which performs like a large-capacity floppy drive may give users a sense of
  273. security, but won't do much for their patience.
  274.  
  275. The continued use of DES, mainly in the US, has been due more to a lack of any
  276. replacement than to an ongoing belief in its security.  The National Bureau of
  277. Standards (now National Institute of Standards and Technology) has only
  278. relucatantly re-certified DES for further use every five years.  Interestingly
  279. enough, the Australian government, which recently developed its own replacement
  280. for DES called SENECA, now rates DES as being "inappropriate for protecting
  281. government and privacy information" (this includes things like taxation
  282. information and social security and other personal data).  Now that an
  283. alternative is available, the Australian government seems unwilling to even
  284. certify DES for information given under an "in confidence" classification,
  285. which is a relatively low security rating.
  286.  
  287. Finally, the add-on "encryption" capabilities offered by general software
  288. packages are usually laughable.  Various programs exist which will
  289. automatically break the "encryption" offered by software such as Arc, Arj,
  290. Lotus 123, Lotus Symphony, Microsoft Excel, Microsoft Word, Paradox, Pkzip 1.x,
  291. the "improved encryption" in Pkzip 2.x, Quattro Pro, Unix crypt(1), Wordperfect
  292. 5.x and ealier, the "improved" encryption in Wordperfect 6.x, and many
  293. others[3][4].  Indeed, these systems are often so simple to break that at least
  294. one package which does so adds several delay loops simply to make it look as if
  295. there were actually some work involved in the process. Although the manuals for
  296. these programs make claims such as "If you forget the password, there is
  297. absolutely no way to retrieve the document", the "encryption" used can often be
  298. broken with such time-honoured tools as a piece of paper, a pencil, and a small
  299. amount of thought.  Some programs which offer "password protection security"
  300. don't even try to perform any encryption, but simply do a password check to
  301. allow access to the data.  Two examples of this are Stacker and Fastback, both
  302. of which can either have their code patched or have a few bytes of data changed
  303. to ignore any password check before granting access to data.
  304.  
  305. Footnote [1]: A 2-round version is in fact so weak that most attackers never
  306.               bother with it.  Biham and Shamirs "Differential Cryptanalysis of
  307.               the Data Encryption Standard" only starts at 4 rounds, for which
  308.               16 encrypted data blocks are needed for a chosen-plaintext
  309.               attack.  A non-differential, ciphertext-only attack on a 3-round
  310.               version requires 20 encrypted data blocks.  A known-plaintext
  311.               attack requires "several" encrypted data blocks.  A 2-round
  312.               version will be significantly weaker than the 3-round version.
  313.               It has been reported that a university lecturer once gave his
  314.               students 2-round DES to break as a homework exercise.
  315.  
  316. Footnote [2]: There are some clever tricks which can be used to make a triple
  317.               DES implementation only twice as slow as single DES, rather than
  318.               three times as slow as would be expected.
  319.  
  320. Footnote [3]: A package which will break many of these schemes is sold by
  321.               Access Data, 125 South 1025 East, Lindon, Utah 84042, ph.
  322.               1-800-658-5199 or 1-801-785-0363, fax 1-801-224-6009.  They
  323.               provide a free demonstration disk which will decrypt files that
  324.               have a password of 10 characters or less.  Access Data also have
  325.               a UK distributor based in London called Key Exchange, ph.
  326.               071-498-9005.
  327.  
  328. Footnote [4]: A number of programs (too many to list here) which will break the
  329.               encryption of all manner of software packages are freely
  330.               available via the internet.  For example, a WordPerfect
  331.               encryption cracker is available from garbo.uwasa.fi in the
  332.               directory /pc/util as wppass2.zip.
  333.  
  334. Footnote [5]: Why are you reading this footnote?  Nowhere in the text is there
  335.               a [5] referring you to this note.  Go back to the start, and
  336.               don't read this footnote again!
  337.  
  338.  
  339. Data Security
  340. -------------
  341.  
  342. This section presents an overview of a range of security problems which are, in
  343. general, outside the reach of SFS.  These include relatively simple problems
  344. such as not-quite-deleted files and general computer security, through to
  345. sophisticated electronic monitoring and surveillance of a location in order to
  346. recover confidential data or encryption keys.  The coverage is by no means
  347. complete, and anyone seriously concerned about the possibility of such an
  348. attack should consult a qualified security expert for further advice.  It
  349. should be remembered when seeking advice that an attacker will use any
  350. available means of compromising the security of data, and will attack areas
  351. other than those in which the strongest defense mechanisms have been installed.
  352. All possible means of attack should be considered, since strengthening one area
  353. may merely make another area more appealing to an opponent.
  354.  
  355.  
  356. Information Leakage
  357.  
  358. There are several ways in which information can leak from an encrypted SFS
  359. volume onto other media.  The simplest kind is in the form of temporary files
  360. maintained by application software and operating systems, which are usually
  361. stored in a specific location and which, when recovered, may contain file
  362. fragments or entire files from an encrypted volume.  This is true not only for
  363. the traditional word processors, spreadsheets, editors, graphics packages, and
  364. so on which create temporary files on disk in which to save data, but also for
  365. operating systems such as OS/2, Windows NT, and Unix, which reserve a special
  366. area of a disk to store data which is swapped in and out of memory when more
  367. room is needed.
  368.  
  369. This information is usually deleted by the application after use, so that the
  370. user isn't even aware that it exists.  Unfortunately "deletion" generally
  371. consists of setting a flag which indicates that the file has been deleted,
  372. rather than overwriting the data in any secure way.  Any information which is
  373. "deleted" in this manner can be trivially recovered using a wide variety of
  374. tools[1].  In the case of a swap file there is no explicit deletion as the swap
  375. area is invisible to the user anyway. In a lightly-loaded system, data may
  376. linger in a swap area for a considerable amount of time.
  377.  
  378. The only real solution to this is to redirect all temporary files and swap
  379. files either to an encrypted volume or to a RAM disk whose contents will be
  380. lost when power is removed.  Most programs allow this redirection, either as
  381. part of the program configuration options or by setting the TMP or TEMP
  382. environment variables to point to the encrypted volume or RAM disk.
  383.  
  384. Unfortunately moving the swap area and temporary files to an encrypted volume
  385. results in a slowdown in speed as all data must now be encrypted.  One of the
  386. basic premises behind swapping data to disk is that very fast disk access is
  387. available.  By slowing down the speed of swapping, the overall speed of the
  388. system (once swapping becomes necessary) is reduced.  However once a system
  389. starts swapping there is a significant slowdown anyway (with or without
  390. encryption), so the decision as to whether the swap file should be encrypted or
  391. not is left to the individual user.
  392.  
  393. The other major form of information leakage with encrypted volumes is when
  394. backing up encrypted data.  Currently there is no generally available secure
  395. backup software (the few applications which offer "security" features are
  396. ridiculously easy to circumvent), so that all data stored on an encrypted
  397. volume will be backed up in unencrypted form.  Like the decision on where to
  398. store temporary data and swap files, this is a tradeoff between security and
  399. convenience.  If it were possible to back up an encrypted volume in its
  400. encrypted form, the entire volume would have to be backed up as one solid block
  401. every time a backup was made.  This could mean a daily five-hundred-megabyte
  402. backup instead of only the half megabyte which has changed recently.
  403. Incremental backups would be impossible.  Backing up or restoring individual
  404. files would be impossible.  Any data loss or errors in the middle of a large
  405. encrypted block could be catastrophic (in fact the encryption method used in
  406. SFS has been carefully selected to ensure that even a single encrypted data bit
  407. changed by an attacker will be noticeable when the data is decrypted[2]).
  408.  
  409. Since SFS volumes in their encrypted form are usually invisible to the
  410. operating system anyway, the only way in which an encrypted volume can be
  411. backed up is by accessing it through the SFS driver, which means the data is
  412. stored in its unencrypted form.  This has the advantage of allowing standard
  413. backup software and schedules to be used, and the disadvantage of making the
  414. unencrypted data available to anyone who has access to the backups.  User
  415. discretion is advised.
  416.  
  417. If it is absolutely essential that backups be encrypted, and the time (and
  418. storage space) is available to back up an entire encrypted volume, then the
  419. Rawdisk 1.1 driver, available as ftp.uni-duisburg.de:/pub/pc/misc/rawdsk11.zip,
  420. may be used to make the entire encrypted SFS volume appear as a file on a DOS
  421. drive which can be backed up using standard DOS backup software.  The
  422. instructions which come with Rawdisk give details on setting the driver up to
  423. allow non-DOS volumes to be backed up as standard DOS drives.  The SFS volume
  424. will appear as a single enormous file RAWDISK.DAT which entirely fills the DOS
  425. volume.
  426.  
  427. Footnote [1]: For example, more recent versions of MSDOS and DRDOS come with an
  428.               "undelete" program which will perform this task.
  429.  
  430. Footnote [2]: This is not a serious limitation, since it will only affect
  431.               deliberate changes in the data.  Any accidental corruption due to
  432.               disk errors will result in the drive hardware reporting the whole
  433.               sector the data is on as being unreadable.  If the data is
  434.               deliberately changed, the sector will be readable without errors,
  435.               but won't be able to be decrypted.
  436.  
  437.  
  438. Eavesdropping
  439.  
  440. The simplest form of eavesdropping consists of directly overwiewing the system
  441. on which confidential data is being processed.  The easiest defence is to
  442. ensure that no direct line-of-sight path exists from devices such as computer
  443. monitors and printers to any location from which an eavesdropper can view the
  444. equipment in question.  Copying of documents and the contents of computer
  445. monitors is generally possible at up to around 100 metres (300 feet) with
  446. relatively unsophisticated equipment, but is technically possible at greater
  447. distances.  The possibility of monitoring from locations such as
  448. office-corridor windows and nearby rooms should also be considered.  This
  449. problem is particularly acute in open-plan offices and homes.
  450.  
  451. The next simplest form of eavesdropping is remote eavesdropping, which does not
  452. require access to the building but uses techniques for information collection
  453. at a distance.  The techniques used include taking advantage of open windows or
  454. other noise conveying ducts such as air conditioning and chimneys, using
  455. long-range directional microphones, and using equipment capable of sensing
  456. vibrations from surfaces such as windows which are modulated by sound from the
  457. room they enclose.  By recording the sound of keystrokes when a password or
  458. sensitive data is entered, an attacker can later recreate the password or data,
  459. given either access to the keyboard itself or enough recorded keystrokes to
  460. reconstruct the individual key sound patterns.  Similar attacks are possible
  461. with some output devices such as impact printers.
  462.  
  463. Another form of eavesdropping involves the exploitation of existing equipment
  464. such as telephones and intercoms for audio monitoring purposes.  In general any
  465. device which handles audio signals and which can allow speech or other sounds
  466. to be transmitted from the place of interest, which can be modified to perform
  467. this task, or which can be used as a host to conceal a monitoring device and
  468. provide power and possibly microphone and transmission capabilites to it (such
  469. as, for example, a radio) can be the target for an attacker.  These devices can
  470. include closed-circuit television systems (which can allow direct overviewing
  471. of confidential information displayed on monitors and printers), office
  472. communication systems such as public address systems, telephones, and intercoms
  473. (which can either be used directly or modified to transmit sound from the
  474. location to be monitored), radios and televisions (which can be easily adapted
  475. to act as transmitters and which already contain power supplies, speakers (to
  476. act as microphones), and antennae), and general electrical and electronic
  477. equipment which can harbour a range of electronic eavesdropping devices and
  478. feed them with their own power.
  479.  
  480. Another eavesdropping possibility is the recovery of information from hardcopy
  481. and printing equipment.  The simplest form of this consists of searching
  482. through discarded printouts and other rubbish for information.  Even shredding
  483. a document offers only moderate protection against a determined enough
  484. attacker, especially if a low-cost shredder which may perform an inadequate job
  485. of shredding the paper is employed.  The recovery of text from the one-pass
  486. ribbon used in high-quality impact printers is relatively simple.  Recovery of
  487. text from multipass ribbons is also possible, albeit with somewhat more
  488. difficulty.  The last few pages printed on a laser printer can also be
  489. recovered from the drum used to transfer the image onto the paper.
  490.  
  491. Possibly the ultimate form of eavesdropping currently available, usually
  492. referred to as TEMPEST (or occasionally van Eck) monitoring, consists of
  493. monitoring the signals generated by all electrically-powered equipment.  These
  494. signals can be radiated in the same way as standard radio and television
  495. transmissions, or conducted along wiring or other metal work.  Some of these
  496. signals will be related to information being processed by the equipment, and
  497. can be easily intercepted (even at a significant distance) and used to
  498. reconstruct the information in question.  For example, the radiation from a
  499. typical VDU can be used to recover data with only a receiver at up to 25m (75
  500. feet), with a TV antenna at up to 40m (120 feet), with an antenna and
  501. amplification equipment at up to 80m (240 feet), and at even greater distances
  502. with the use of more specialised equipment[1].  Information can also be
  503. transmitted back through the power lines used to drive the equipment in
  504. question, with transmission distances of up to 100m (300 feet) being possible.
  505.  
  506. TEMPEST monitoring is usually relatively expensive in resources, difficult to
  507. mount, and unpredictable in outcome.  It is most likely to be carried out where
  508. other methods of eavesdropping are impractical and where general security
  509. measures are effective in stopping monitoring.  However, once in place, the
  510. amount of information available through this form of eavesdropping is immense.
  511. In general it allows the almost complete recovery of all data being processed
  512. by a certain device such as a monitor or printer, almost undetectably, and over
  513. a long period of time.  Protection against TEMPEST monitoring is difficult and
  514. expensive, and is best left to computer security experts[2][3].
  515.  
  516. However, some simple measures are still possible, such as paying attention to
  517. the orientation of VDU's (most of the signal radiated from a VDU is towards the
  518. sides, with very little being emitted to the front and rear), chosing equipment
  519. which already meets standards for low emissions (for example in the US the
  520. "quietest" standard for computers and peripherals is know as the FCC Class B
  521. standard), using well-shielded cable for all systems interconnections
  522. (unshielded cable such as ribbon cable acts as an antenna for broadcasting
  523. computer signals), using high-quality power line filters which block signals
  524. into the high radio frequency range, and other methods generally used to reduce
  525. or eliminate EMI (electromagnetic interference) from electronic equipment.
  526.  
  527. Footnote [1]: These figures are taken from "Schutzmassnahmen Gegen
  528.               Kompromittierende Elektromagnetische Emissionen von
  529.               Bildschirmsichtgeraeten", Erhard Moeller and Lutz Bernstein,
  530.               Labor fuer Nachrichtentechnik, Fachhochschule Aachen.
  531.  
  532. Footnote [2]: TEMPEST informatiom and shielding measures for protection against
  533.               TEMPEST monitoring are specified in standards like "Tempest
  534.               Fundamentals", NSA-82-89, NACSIM 5000, National Security Agency,
  535.               February 1, 1982, "Tempest Countermeasures for Facilities Within
  536.               the United States", National COMSEC Instruction, NACSI 5004,
  537.               January 1984, "Tempest Countermeasures for Facilities Outside the
  538.               United States", National COMSEC Instruction, NACSI 5005, January
  539.               1985, and MIL-STD 285 and 461B.  Unfortunately these
  540.               specifications have been classified by the organisations who are
  541.               most likely to make use of TEMPEST eavesdropping, and are not
  542.               available to the public.
  543.  
  544. Footnote [3]: A computer centre in Moscow had all its windows shielded with
  545.               reflective aluminium film, which was supposed to provide enough
  546.               protection to stop most forms of TEMPEST eavesdropping.  The
  547.               technique seems to have worked, because a KGB monitoring van
  548.               parked outside apparently didn't notice the fact that the
  549.               equipment had been diverted to printing out Strugatsky's novels.
  550.  
  551.  
  552. Trojan Horses
  553.  
  554. It may be possible for an attacker to replace the SFS software with a copy
  555. which seems to be identical but which has major weaknesses in it which make an
  556. attack much easier, for example by using only a few characters of the password
  557. to encrypt the disk.  The least likely target is mksfs, since changing the way
  558. this operates would require a similar change to mountsfs and the SFS driver
  559. which would be easily detectable by comparing them with and independant,
  560. original copy.  Since a changed mksfs would require the long-term use of a
  561. similarly changed mountsfs and driver, the changes of detection are greatly
  562. increased.
  563.  
  564. A much more subtle attack involves changing mountsfs.  By substituting a
  565. version which saves the user's password or encryption key to an unused portion
  566. of the disk and then replaces itself with an unmodified, original copy, an
  567. attacker can return at their leisure and read the password or key off the disk,
  568. with the user none the wiser that their encryption key has been compromised.
  569. The SFS driver may be modified to do this as well, although the task is slighly
  570. more difficult than changing mountsfs.
  571.  
  572. Detecting this type of attack is very difficult, since although it is possible
  573. to use security software which detects changes, this itself might be modified
  574. to give a false reading.  Software which checks the checking software may in
  575. turn be modified, and so on ad infinitum.  In general someone who is determined
  576. enough can plant an undetectable trojan[1], although precautions like using
  577. modification-detection programs, keeping physically separate copies of the SFS
  578. software, and occasionally checking the installed versions against other,
  579. original copies, may help reduce the risk somewhat.  The eventual creation of a
  580. hardware SFS encryption card will reduce the risk further, although it is still
  581. possible for an attacker to substitute their own fake encryption card.
  582.  
  583. Another possibility is the creation of a program unrelated to SFS which
  584. monitors the BIOS character write routines for the printing of the password
  585. prompt, or video RAM for the appearance of the prompt, or the BIOS keyboard
  586. handler, or any number of other possibilities, and then reads the password as
  587. it is typed in[2].  This is a generic attack against all types of encryption
  588. software, and doesn't rely on a compromised copy of the software itself.
  589.  
  590. The stealth features in SFS are one way of making this kind of monitoring much
  591. more difficult, and are explained in more detail in the section "Security
  592. Analysis" below.  However the only really failsafe way to defeat this kind of
  593. attack is to use custom hardware which performs its task before any user
  594. software has time to run, such as the hardware SFS version currently under
  595. development.
  596.  
  597. Footnote [1]: An attacker could employ, for example, what David Farber has
  598.               described as "supplemental functionality in the keyboard driver".
  599.  
  600. Footnote [2]: One program which performs this task is Phantom 2, available from
  601.               wuarchive.wustl.edu in the directory /pub/msdos/keyboard as
  602.               ptm228.zip, or from P2 Enterprises, P.O. Box 25, Ben Lomond,
  603.               California 95005-0025.  This program not only allows the
  604.               recording of all keystrokes but provides timing information down
  605.               to fractions of a second, allowing for detailed typing pattern
  606.               analysis by an attacker.
  607.  
  608.               Another keystroke recorder is Encore, also available from
  609.               wuarchive.wustl.edu in the directory /pub/msdos/keyboard as
  610.               encore.zip.
  611.  
  612.  
  613. Dangers of Encryption
  614.  
  615. The use of very secure encryption is not without its downsides.  Making the
  616. data completely inaccessible to anyone but the holder of the correct password
  617. can be hazardous if the data being protected consists of essential information
  618. such as the business records for a company which are needed in its day-to-day
  619. operation.  If the holder of the encryption password is killed in an accident
  620. (or even just rendered unconscious for a time), the potential complete loss of
  621. all business records is a serious concern.
  622.  
  623. Another problem is the question of who the holder of the password(s) should be.
  624. If the system administrator at a particular site routinely encrypts all the
  625. data held there for security purposes, then later access to the entire
  626. encrypted dataset is dependant on the administrator, who may forget the
  627. password, or die suddenly, or move on to another job and have little incentive
  628. to inform their previous employer of the encryption password (for example if
  629. they were fired from the previous job).  Although there are (as yet) no known
  630. cases of this happening, it could occur that the ex-administrator has forgotten
  631. the password used at his previous place of employment and might require a
  632. small, five-figure consideration to help jog his memory.  The difficulty in
  633. prosecuting such a case would be rather high, as proving that the encryption
  634. system wasn't really installed in good faith by the well-intentioned
  635. administrator to protect the company data and that the password wasn't
  636. genuinely forgotten would be well nigh impossible.
  637.  
  638.  
  639. Politics
  640. --------
  641.  
  642. Many governments throughout the world have an unofficial policy on cryptography
  643. which is to reserve all knowledge and use of encryption to the government in
  644. general and the elite in particular.  This means that encryption is to be used
  645. firstly (in the form of restrictions on its use) for intelligence-gathering,
  646. and secondly for protecting the secret communications of the government.
  647. The government therefore uses encryption to protect its own dealings, but
  648. denies its citizens the right to use it to protect their own privacy, and
  649. denies companies the right to use it to protect their business data.  Only a
  650. very small number of countries have laws guaranteeing citizens' rights to use
  651. encryption[1].
  652.  
  653. This policy is enforced in many ways.  In the US it is mainly through the use
  654. of the ITAR, the International Traffic in Arms Regulations, a law which was
  655. passed without public debate during the second world war.  This defines all
  656. encryption material (hardware and software) as "munitions", subject to special
  657. governmental control.  France also classifies encryption devices as
  658. munitions[2].  These "munitions" in fact have no violent use beyond perhaps
  659. beating someone to death with a box of disks.  Their only possible use is to
  660. protect personal privacy and the privacy of business data.
  661.  
  662. In limiting the use (and export) of encryption technology[3], the US (and many
  663. other countries which follow the lead of the US) are not only denying their
  664. citizens the means to ensure the privacy of personal information stored on
  665. computer, they are also placing businesses at risk.  With no easy way to
  666. protect their data, companies are losing billions of dollars a year to
  667. industrial espionage which even a simple measure like SFS would help to reduce.
  668. Some real-life examples of what the lack of secure encryption can do are:
  669.  
  670.     - The head of the French DGSE (Direction Generale de la Securite
  671.       Exterieure) secret service has publicly boasted that his organisation,
  672.       through industrial espionage, helped French companies acquire over a
  673.       billion dollars worth of business deals from foreign competitors
  674.       [4][5][6].
  675.  
  676.     - The book "Friendly Spies" by Peter Schweitzer, published by Atlantic
  677.       Monthly Press, gives many accounts about covert intelligence operations
  678.       directed against US corporations by cold war allies, with foreign
  679.       governments conspiring with foreign companies to steal US technology and
  680.       economic secrets[7].
  681.  
  682.     - A US company was being consistently underbid by a Japanese competitor
  683.       which was intercepting their electronic traffic.  When they started
  684.       encrypting their messages, the underbidding stopped.  A few days later
  685.       they were requested by the US government to stop using encryption in
  686.       their traffic[8].
  687.  
  688.     - A New Zealand computer dealer acquired 90 used disks which turned out to
  689.       contain sensitive financial records from a large bank.  The evening after
  690.       he turned them over to the bank (for a $15,000 cash "finders fee") he was
  691.       killed in a road accident.  The finders fee was never recovered[9].
  692.  
  693.       Despite this major security problem, the bank wouldn't learn from their
  694.       mistakes.  A few weeks later a large-capacity networked disk drive
  695.       originally used by them was supplied to another company as a supposedly
  696.       "new" replacement for a drive which had died.  This drive was found to
  697.       contain the complete financial records from one of their branches.  Not
  698.       wanting to be scraped off the side of the road one night, the system
  699.       manager decided to erase the contents of the drive[10].
  700.  
  701.       It isn't known how many more of their confidential financial records this
  702.       bank has handed out to the public over the years.
  703.  
  704.     - The New Zealand Securities Commission accidentally left a number of
  705.       sensitive files on the hard drive of one of a group of machines which was
  706.       later sold at auction for $100.  These files were stored without any
  707.       security measures, and related to Securities Commission and Serious Fraud
  708.       Office investigations.  At last report, the files had still not been
  709.       recovered[11].
  710.  
  711.     - The book "By Way of Deception" by Victor Ostrovsky and Claire Hoy,
  712.       published by St. Martins Press, New York, in 1990 (ISBN 0-312-05613-3),
  713.       reports in Appendix I that Mossad's computer services routinely monitor
  714.       VISA, AMEX, and Diner's Club transactions, as well as police computer
  715.       traffic.
  716.  
  717. In the latter case the lack of encryption not only had the potential to cause
  718. serious financial harm to the bank involved but resulted in the death of the
  719. main player.  The use of a program like SFS would have made the contents of the
  720. disks unreadable to anyone but the bank.
  721.  
  722. In 1991 the US Justice Department tried to introduce legislation that would
  723. require all US digital communications systems to be reengineered (at enormous
  724. cost) to support monitoring of message traffic by the FBI.  This measure was
  725. never passed into law.  The next year the FBI tried to introduce a similar
  726. measure, but could find no-one willing to back the bill.  In 1993, yet another
  727. attmempt was made, which is currently being fought by an unusual coalition of
  728. civil libertarians, computer users and companies, and communications providers.
  729. A poll carried out by Time/CNN in March 1994 indicated that 2/3 of Americans
  730. were opposed to the legislation[12].
  731.  
  732. In April 1993, the US government announced a piece of hardware called the
  733. Clipper Chip.  They proposed that this device, whose details are classified and
  734. which contains self-destruct mechanisms which are activated if attempts are
  735. made to examine it too closely, be built into all telephones.  Each chip has a
  736. special serial number which identifies all communications carried out with that
  737. phone.  At the beginning of each transmission, telephones equipped with a
  738. Clipper Chip negotiate a connection which involves sending identifying
  739. information across the phone network, and setting up a common key to use for
  740. encrypting the conversation.
  741.  
  742. Built into this setup is a special back door which allows the government, and
  743. anyone who works for the government, and anyone who has a friend who works for
  744. the government, and anyone with enough money or force to bribe or coerce the
  745. aforementioned people, to monitor the conversation[13].  The job is made much
  746. easier by the extra identification information which the Clipper Chip attaches
  747. to the data stream.  The Clipper Chip allows monitoring on a scale even George
  748. Orwell couldn't have imagined when he wrote his novel "1984"[14].  The Time/CNN
  749. poll mentioned above found that 80% of Americans were opposed to the Clipper
  750. Chip[12].
  751.  
  752. A somewhat less blatant attempt to bypass communications privacy is gradually
  753. appearing in the rest of the world.  The GSM digital telephone system uses a
  754. special encryption algorithm called A5X which is a modified form of a stronger
  755. system called A5.  A5X exists solely as a deliberately crippled A5, and is
  756. relatively easy to bypass for electronic monitoring purposes.  Although the
  757. details of A5 are classified "for national security purposes"[15], various
  758. sources have commented that even the original unmodified A5 probably provides
  759. only limited security against a determined attack, and the actual
  760. implementation exhibits some fundamental flaws (such as a 3-hour key rollover)
  761. which can greatly aid an attacker[16][17].
  762.  
  763. It is against this worrying background that SFS was created.  Right from the
  764. start, the idea behind SFS was to provide the strongest possible cryptographic
  765. security.  No compromises were made, there are no back doors or weaknesses
  766. designed into the system, nor will there ever be the deliberate crippling of
  767. the system or undermining of its integrity which some organizations would like.
  768. The algorithms and methods used in SFS have been selected specifically for
  769. their acknowledged strength and general acceptance by the worldwide
  770. cryptographic community, and conform to a wide variety of national and
  771. international standards for secure encryption.  As new algorithms and
  772. cryptographic processes appear, SFS will be updated to always provide the best
  773. possible security available.
  774.  
  775. Footnote [1]: One of these is Japan.  Article 21 of the Japanese Consitution
  776.               states:  "Freedom of assembly and association as well as speech,
  777.               press, and all other forms of expression are guaranteed.  No
  778.               censorship shall be maintained, nor shall the secrecy of any
  779.               means of communication be violated".
  780.  
  781. Footnote [2]: The "decret du 18 avril 1939" defines 8 categories of arms and
  782.               munitions from the most dangerous (1st category) to the least
  783.               dangerous (8th category).  The "decret 73-364 du 12 mars 1973"
  784.               specifies that encryption equipment belongs to the second
  785.               category.  Any usage of such equipment requires authorization
  786.               from the Prime Minister.  The "decret 86-250 du 18 fev 1986"
  787.               extends the definition of encryption equipment to include
  788.               software.  It specifies that each request for authorization for
  789.               business or private usage of the equipment must be sent to the
  790.               Minister of Telecommunications.  The request must include a
  791.               complete and detailed description of the "cryptologic process",
  792.               and if this is materially possible, of two copies of the
  793.               envisaged equipment (see also Footnote 6).  The "loi 90-1170 du
  794.               29 decembre 1990" states that export or use of encryption
  795.               equipment must be previously declared when used only for
  796.               authentication, and previously authorized by the Prime Minister
  797.               in all other cases, with penalties of fines of up to 500 000F and
  798.               three months in jail.  Import of encryption equipment (but not
  799.               encrypted data) is prohibited by the "decret du 18 avril 1939",
  800.               article 11.  However the "loi du 29 dec 1990" only restricts use
  801.               or export, not import, of encryption equipment.  There are no
  802.               restrictions on the import of encrypted data.
  803.  
  804.               However these laws appear not to be enforced, with encryption
  805.               software being freely imported, exported, available, and used in
  806.               France.
  807.  
  808. Footnote [3]: The reasoning behind this, as stated by the Permanent Select
  809.               Committee on Intelligence in its commentary of 16 June 1994 on
  810.               the HR.3937 Omnibus Export Administration Act is that "the
  811.               intelligence community's cryptologic success depends in part on
  812.               controlling the use of encryption [...] controlling the
  813.               dissemination of sophisticated encryption has been and will
  814.               continue to be critical to those successes [of the US
  815.               intelligence community] and US national security interests".
  816.  
  817. Footnote [4]  This was reported by cryptographer Martin Hellman at the 1993 RSA
  818.               Data Security conference on 14-15 January 1993.
  819.  
  820. Footnote [5]  Some quotes from FBI Director Louis Freeh from a talk given to
  821.               the Executives' Club of Chicago on 17 March 1994:
  822.  
  823.               "A nation's power is increasingly measured by economic prosperity
  824.                at home and competitiveness abroad.  And in some ways, the
  825.                United States is a sitting duck for countries and individuals
  826.                who want to take a short cut to power".
  827.  
  828.                [At least 20 nations are] "actively engaged in economic
  829.                espionage".
  830.  
  831.               "This kind of information [cost and price structure, research and
  832.                development results, marketing plans, bids and customer lists]
  833.                can be intercepted from fax and satellite communications.  It
  834.                can be monitored from cellular and microwave telephone links.
  835.                It can be retrieved from inadequately protected computer
  836.                systems".
  837.  
  838. Footnote [6]: "Powerful computers scan telephone, fax, and computer data
  839.                traffic for information from certain sources, to certain
  840.                destinations, or containing certain keywords, and store any
  841.                interesting communications for later analysys.  The fear that
  842.                such monitoring stations will, after the end of the cold war, be
  843.                used for industrial espionage, has been expressed by DP managers
  844.                and tacitly confirmed by US security agencies" - Markt und
  845.                Technik, 18/94, page 49.
  846.  
  847. Footnote [7]: "France and Germany and many other countries require US companies
  848.                to `register' the encryption key for reasons of national
  849.                security.  All of the American transmissions are monitored and
  850.                the data is passed on to the local competitors.  Companies like
  851.                IBM finally began to routinely transmit false information to
  852.                their French subsidiary just to thwart the French Secret Service
  853.                and by transitive property of economic nationalism, French
  854.                computer companies" - RISKS-Forum Digest, 22 February 1993,
  855.                Volume 14, Issue 34
  856.  
  857. Footnote [8]: Private communications from one of the people involved.
  858.  
  859. Footnote [9]: This event received nationwide TV, radio, and newspaper coverage
  860.               at the time.  For example, any New Zealand paper published on 7
  861.               September 1992 should provide more information.
  862.  
  863. Footnote [10]: Private communications from the system manager involved.
  864.  
  865. Footnote [11]: This event received nationwide TV, radio, and newspaper coverage
  866.                at the time.  Most New Zealand papers published on 13 August
  867.                1994 contain coverage of the story.
  868.  
  869. Footnote [12]: "In a Time/CNN poll of 1,000 Americans conducted last week by
  870.                 Yankelovich Partners, two thirds said it was more important to
  871.                 protect the privacy of phone calls than to preserve the ability
  872.                 of police to conduct wiretaps.  When informed about the Clipper
  873.                 Chip, 80% said they opposed it" - Philip Elmer-Dewitt, "Who
  874.                 Should Keep the Keys", TIME, 14 March 1994.
  875.  
  876. Footnote [13]: In June 1994, an AT&T researcher discovered a means of bypassing
  877.                this monitoring using about 28 minutes of computation time on
  878.                easily-available mass-market Tessera cards.  By precomputing the
  879.                values or employing many such devices running in parallel, the
  880.                time can be reduced to virtually nothing.  This attack also
  881.                opened up a number of other interesting possibilities for
  882.                generally bypassing many of the perceived undesirable "features"
  883.                of Clipper.
  884.  
  885. Footnote [14]: It has been claimed that the Clipper proposal is an example of
  886.                the government servicing the people in the sense of the term
  887.                used in the sentence "The farmer got a bull to service his
  888.                cows".
  889.  
  890. Footnote [15]: In June 1994, the statement that A5 was too strong to disclose
  891.                was suddenly changed so that it now became too weak to disclose,
  892.                and that discussing the details might harm export sales.  This
  893.                is an interesting contrast to the position taken in 1993 that
  894.                sales to the Middle East might end up providing A5-capable
  895.                equipment to the likes of Saddam Hussein.  Apparently there was
  896.                a major debate among the NATO signal agencies in the 1980's over
  897.                whether the GSM encryption should be strong or weak, with the
  898.                weak encryption side eventually winning.
  899.  
  900. Footnote [16]: It has been reported that GCHQ, the UK intelligence agency which
  901.                requested the A5X changes, regards as "strong encryption" (and
  902.                therefore not suitable for use by the public) anything which
  903.                can't be broken in real time.
  904.  
  905. Footnote [17]: UK cryptographer Ross Anderson has charecterised A5 as being
  906.                "not much good".  A simple brute-force attack which searches all
  907.                2^40 key combinations will break the system in about a week on a
  908.                standard PC, with much faster attacks being possible using
  909.                either better algorithms, custom hardware, or both.
  910.                Interestingly, the low upper limit on the number of possible
  911.                keys would also seem to meet the US government requirements for
  912.                weak exportable encryption.
  913.  
  914.                Attacks faster than the basic brute-force one are also possible,
  915.                and one such attack was to be presented by Dr Simon Shepherd at
  916.                an IEE colloquium in London on 3rd June 1994.  However the talk
  917.                was canceled at the last minute by GCHQ.
  918.  
  919.  
  920. An Introduction to Encryption Systems
  921. -------------------------------------
  922.  
  923. For space reasons the following introduction to encryption systems is very
  924. brief.  Anyone requiring more in-depth coverage is urged to consult the texts
  925. mentioned in the references at the end of this document.
  926.  
  927. Encryption algorithms (ciphers) are generally one of two types, block ciphers
  928. and stream ciphers.  A block cipher takes a block of plaintext and converts the
  929. entire block into ciphertext.  A stream cipher takes a single bit or byte of
  930. plaintext at a time and converts it into ciphertext.  There also exist means of
  931. converting block ciphers to stream ciphers, and vice versa.  Usually a stream
  932. cipher is preferred, as it doesn't require data to be quantised to the block
  933. size of the cipher in use.  Unfortunately, stream ciphers, although more
  934. convenient, are usually harder to get right than block ciphers.  Many practical
  935. stream ciphers are in fact simply block ciphers pretending to be stream
  936. ciphers.
  937.  
  938. Virtually all good conventional-key ciphers are so-called product ciphers, in
  939. which several (relatively) weak transformations such as substitution,
  940. transposition, modular addition/multiplication, and linear transformation are
  941. iterated over a piece of data, gaining more and more strength with each
  942. iteration (usually referred to as a round).  These types of ciphers have been
  943. extensively studied and are reasonably well understood.  The following table
  944. compares the main parameters of several product ciphers.  Lucifer is the
  945. immediate precursor to the US Data Encryption Standard (DES).  Loki is a
  946. proposed alternative to DES.  FEAL is a fast block cipher designed in Japan.
  947. IDEA is a relatively new Swiss block cipher which has been proposed as a
  948. successor to DES and which has (so far) proven more resistant to attack then
  949. DES.  MDC/SHS is a cipher based on the SHS one-way hash function (more on this
  950. later).
  951.  
  952.    +-----------+------------+----------+-----------+---------------+
  953.    |  Cipher   | Block size | Key size | Number of | Complexity of |
  954.    |           |            |  (bits)  |   rounds  |  Best Attack  |
  955.    +-----------+------------+----------+-----------+---------------+
  956.    |  Lucifer  |    128     |    128   |     16    |     2^21      |
  957.    |    DES    |     64     |     56   |     16    |     2^43      |
  958.    |  Loki91   |     64     |     64   |     16    |     2^48      |
  959.    |  FEAL-8   |     64     |    128   |      8    |    10,000     |
  960.    |   IDEA    |     64     |    128   |      8    |     2^128     |
  961.    |  MDC/SHS  |    160     |    512   |     80    |     2^512     |
  962.    +-----------+------------+----------+-----------+---------------+
  963.  
  964. The complexity of the best known attack is the number of operations necessary
  965. to allow the cipher to be broken.  Note how the block size, key size, and
  966. number of rounds don't necessarily give a good indication of how secure the
  967. algorithm itself is.  Lucifer, although it has twice the block size and over
  968. twice the key size of DES, is rather simple to break (the key size of DES is
  969. discussed later on in the section on insecurities).  DES is the result of
  970. several years of work on improvements to Lucifer.  FEAL has been continually
  971. changed every year or so when the previous version was broken.  Due to this,
  972. current versions are treated with some scepticism.  Both IDEA and MDC have so
  973. far resisted all forms of attack, although recently a class of weak keys have
  974. been discovered in IDEA (and a simple change in the algorithm will eliminate
  975. these weak keys).  Note that in the case of the last two algorithms the given
  976. complexity is for a brute-force attack (explained below), which is the most
  977. pessimistic kind possible.  There may be much better attacks available,
  978. although if anyone knows of any they're not saying anything.  Of the algorithms
  979. listed above, DES has been attacked the hardest, and IDEA and MDC the least,
  980. which may go some way toward explaining the fact that brute force is the best
  981. known attack.
  982.  
  983. There are a large number of modes of operation in which these block ciphers can
  984. be used.  The simplest is the electronic codebook (ECB) mode, in which the data
  985. to be encrypted is broken up into seperate subblocks which correspond to the
  986. size of the block cipher being used, and each subblock is encrypted
  987. individually.  Unfortunately ECB has a number of weaknesses (some of which are
  988. outlined below), and should never be used in a well-designed cryptosystem.
  989. Using P[] to denote a plaintext block, C[] to denote a ciphertext block, e() to
  990. denote encryption, d() to denote decryption, and ^ for the exclusive-or
  991. operation, ECB mode encryption can be given as:
  992.  
  993.     C[ n ] = e( P[ n ] )
  994.  
  995. with decryption being:
  996.  
  997.     P[ n ] = d( C[ n ] )
  998.  
  999. A better encryption mode is cipher block chaining (CBC), in which the first
  1000. data subblock is exclusive-ored with an initialization vector (IV) and then
  1001. encrypted.  The resulting ciphertext is exclusive-ored with the next data
  1002. subblock, and the result encrypted.  This process is repeated until all the
  1003. data has been encrypted.  Because the ciphertext form of each subblock is a
  1004. function of the IV and all preceding subblocks, many of the problems inherent
  1005. in the ECB encryption mode are avoided.  CBC-mode encryption is:
  1006.  
  1007.     C[ 1 ] = e( P[ 1 ] ^ IV )
  1008.     C[ n ] = e( P[ n ] ^ C[ n-1 ] )
  1009.  
  1010. and decryption is:
  1011.  
  1012.     P[ 1 ] = d( C[ 1 ] ) ^ IV
  1013.     P[ n ] = d( C[ n ] ) ^ C[ n-1 ]
  1014.  
  1015. Another encryption mode is cipher feedback (CFB), in which the IV is encrypted
  1016. and then exclusive-ored with the first data subblock to provide the ciphertext.
  1017. The resulting ciphertext is then encrypted and exclusive-ored with the next
  1018. data subblock to provide the next ciphertext block.  This process is repeated
  1019. until all the data has been encrypted.  Because the ciphertext form of each
  1020. subblock is a function of the IV and all preceding subblocks (as is also the
  1021. case for CBC-mode encryption), many of the problems inherent in the ECB
  1022. encryption mode are avoided.  CFB-mode encryption is:
  1023.  
  1024.     C[ 1 ] = P[ 1 ] ^ e( IV )
  1025.     C[ n ] = P[ n ] ^ e( C[ n-1 ] )
  1026.  
  1027. and decryption is:
  1028.  
  1029.     P[ 1 ] = C[ 1 ] ^ e( IV )
  1030.     P[ n ] = C[ n ] ^ e( C[ n-1 ] )
  1031.  
  1032. There are several other modes of operation which are not covered here.  More
  1033. details can be found in the texts given in the references.
  1034.  
  1035. One point worth noting is that by using a different IV for each message in CBC
  1036. and CFB mode, the ciphertext will be different each time, even if the same
  1037. piece of data is encrypted with the same key.  This can't be done in ECB mode,
  1038. and is one of its many weaknesses.
  1039.  
  1040. There are several standard types of attack which can be performed on a
  1041. cryptosystem.  The most restricted of these is a ciphertext-only attack, in
  1042. which the contents of the message are unknown.  This kind of attack virtually
  1043. never occurs, as there is always some regularity or known data in the message
  1044. which can be exploited by an attacker.
  1045.  
  1046. This leads to the next kind of attack, the known-plaintext attack.  In this
  1047. case some (or all) of the plaintext of the message is known.  This type of
  1048. attack is fairly easy to mount, since most data consists of well-known,
  1049. fixed-format messages containing standard headers, a fixed layout, or data
  1050. conforming to a certain probability distribution such as ASCII text.
  1051.  
  1052. Finally, in a chosen-plaintext attack the attacker is able to select plaintext
  1053. and obtain the corresponding ciphertext.  This attack is also moderately easy
  1054. to mount, since it simply involves fooling the victim into transmitting a
  1055. message or encrypting a piece of data chosen by the attacker.  This kind of
  1056. attack was used to help break the Japanese "Purple" cipher during WWII by
  1057. including in a news release a certain piece of information which it was known
  1058. the Japanese would encrypt and transmit to their superiors.
  1059.  
  1060. However attacks of this kind are usually entirely unnecessary.  Too many
  1061. cryptosystems in everyday use today are very easy to break, either because the
  1062. algorithms themselves are weak, because the implementations are incorrect, or
  1063. because the way they are used is incorrect.  Often amateurs think they can
  1064. design secure systems, and are not aware of what an expert cryptanalyst could
  1065. do.  Sometimes there is insufficient motivation for anybody to invest the work
  1066. needed to produce a secure system.  Many implementations contain flaws which
  1067. aren't immediately obvious to a non-expert.  Some of the possible problems
  1068. include:
  1069.  
  1070. - Use of easily-searched keyspaces.  Some algorithms depend for their security
  1071.   on the fact that a search of all possible encryption keys (a so-called brute
  1072.   force attack) would take too long to be practical.  Or at least, it took too
  1073.   long to be practical when the algorithm was designed.  The Unix password
  1074.   encryption algorithm is a prime example of this.  The DES key space is
  1075.   another example.  Recent research has indicated that the DES was not in fact
  1076.   weakened by having only 56 bits of key material (as has often been claimed),
  1077.   since the inherent strength of the algorithm itself only provides this many
  1078.   bits of security (that is, that increasing the key size would have no effect
  1079.   since other attacks which don't involve knowing the key can be used to break
  1080.   the encryption in far less than 2^56 operations).  The encryption used in the
  1081.   Pkzip archiver can usually be broken automatically in less time than it takes
  1082.   to type the password in for authorized access to the data since, although it
  1083.   allows longer keys than DES, it makes the check for valid decryption keys
  1084.   exceedingly easy for an attacker.
  1085.  
  1086. - Use of insecure algorithms designed by amateurs.  This covers the algorithms
  1087.   used in the majority of commercial database, spreadsheet, and wordprocessing
  1088.   programs such as Lotus 123, Lotus Symphony, Microsoft Excel, Microsoft Word,
  1089.   Paradox, Quattro Pro, WordPerfect, and many others.  These systems are so
  1090.   simple to break that the author of at least one package which does so added
  1091.   several delay loops to his code simply to make it look as if there was
  1092.   actually some work involved.
  1093.  
  1094. - Use of insecure algorithms designed by experts.  An example is the standard
  1095.   Unix crypt command, which is an implementation of a rotor machine much like
  1096.   the German Enigma cipher which was broken during WWII.  There is a program
  1097.   called cbw (for `crypt breakers workbench') which can automatically decrypt
  1098.   data encrypted with crypt[1].  After the war, the US government even sold
  1099.   Enigma cipher machines to third-world governments without telling them that
  1100.   they knew how to break this form of encryption.
  1101.  
  1102. - Use of incorrectly-implemented algorithms.  Some encryption programs use the
  1103.   DES algorithm, which consists of a series of complicated and arbitrary-
  1104.   seeming bit transformations controlled by complex lookup tables.  These
  1105.   transformations and tables are very easy to get wrong.
  1106.  
  1107.   A well-known fact about the DES algorithm is that even the slightest
  1108.   deviation from the correct implementation significantly weakens the algorithm
  1109.   itself.  In other words any implementation which doesn't conform 100% to the
  1110.   standard may encrypt and decrypt data perfectly, but is in practice rather
  1111.   easier to break than the real thing.
  1112.  
  1113.   The US National Bureau of Standards (now the National Institute of Standards
  1114.   and Technology) provides a reference standard for DES encryption.  A
  1115.   disappointingly large number of commercial implementations fail this test.
  1116.  
  1117. - Use of badly-implemented algorithms.  This is another problem which besets
  1118.   many DES implementations.  DES can be used in several modes of operation,
  1119.   some of them better than others.  The simplest of these is the Electronic
  1120.   Codebook (ECB) mode, in which a block of data is broken up into seperate
  1121.   subblocks which correspond to the unit of data which DES can encrypt or
  1122.   decrypt in one operation, and each subblock is then encrypted seperately.
  1123.  
  1124.   There also exist other modes such as CBC in which one block of encrypted data
  1125.   is chained to the next (such that the ciphertext block n depends not only on
  1126.   the corresponding plaintext but also on all preceding ciphertext blocks
  1127.   0..n-1), and CFB, which is a means of converting a block cipher to a stream
  1128.   cipher with similar chaining properties.
  1129.  
  1130.   There are several forms of attack which can be used when an encrypted message
  1131.   consists of a large number of completely independant message blocks.  It is
  1132.   often possible to identify by inspection repeated blocks of data, which may
  1133.   correspond to patterns like long strings of spaces in text.  This can be used
  1134.   as the basis for a known-plaintext attack.
  1135.  
  1136.   ECB mode is also open to so-called message modification attacks.  Lets assume
  1137.   that Bob asks his bank to deposit $10,000 in account number 12-3456-789012-3.
  1138.   The bank encrypts the message `Deposit $10,000 in account number
  1139.   12-3456-789012-3' and sends it to its central office.  Encrypted in ECB mode
  1140.   this looks as follows:
  1141.  
  1142.     E( Deposit $10,000 in acct. number 12-3456-789012-3 )
  1143.  
  1144.   Bob intercepts this message, and records it.  The encrypted message looks as
  1145.   follows:
  1146.  
  1147.     H+2nx/GHEKgvldSbqGQHbrUfotYFtUk6gS4CpMIuH7e2MPZCe
  1148.  
  1149.   Later on in the day, he intercepts the following a message:
  1150.  
  1151.     H+2nx/GHEKgvldSbqGQHbrUfotYFtUk61Pts2LtOHa8oaNWpj
  1152.  
  1153.   Since each block of text is completely independant of any surrounding block,
  1154.   he can simply insert the blocks corresponding to his account number:
  1155.  
  1156.     ................................gS4CpMIuH7e2MPZCe
  1157.  
  1158.   in place of the existing blocks, and thus alter the encrypted data without
  1159.   any knowledge of the encryption key used.  Bob has since gone on to early
  1160.   retirement in his new Hawaiian villa.
  1161.  
  1162.   ECB mode, and the more secure modes such as CBC and CFB are described in
  1163.   several standards.  Some of these standards make a reference to the
  1164.   insecurity of ECB mode, and recommend the use of the stronger CBC or CFB
  1165.   modes.  Usually implementors stop reading at the section on ECB, with the
  1166.   result being that many commercial packages which use DES and which do manage
  1167.   to get it correct end up using it in ECB mode.
  1168.  
  1169. - Protocol errors.  Even if a more secure encryption mode such as CBC or CFB
  1170.   mode is used, there can still be problems.  If a standard message format
  1171.   (such as the one shown above) is used, modification is still possible, except
  1172.   that now instead of changing individual parts of a message the entire message
  1173.   must be altered, since each piece of data is dependant on all previous parts.
  1174.   This can be avoided by prepending a random initialisation vector (IV) to each
  1175.   message, which propagates through the message itself to generate a completely
  1176.   different ciphertext each time the same message is encrypted.  The use of the
  1177.   salt in Unix password encryption is an example of an IV, although the range
  1178.   of only 4096 values is too small to provide real security.
  1179.  
  1180. In some ways, cryptography is like pharmaceuticals.  Its integrity is
  1181. important.  Bad penicillin looks just the same as good penicillin.  Determining
  1182. whether most software is correct or not is simple - just look at the output.
  1183. However the ciphertext produced by a weak encryption algorithm looks no
  1184. different from the ciphertext produced by a strong algorithm.... until an
  1185. opponent starts using your supposedly secure data against you, or you find your
  1186. money transfers are ending up in an account somewhere in Switzerland, or
  1187. financing Hawaiian villas.
  1188.  
  1189. Footnote [1]: Available from black.ox.ac.uk in the directory /src/security as
  1190.               cbw.tar.Z.
  1191.  
  1192.  
  1193. Security Analysis
  1194. -----------------
  1195.  
  1196. This section attempts to analyse some of the possible failure modes of SFS and
  1197. indicate which strategies have been used to minimise problems.
  1198.  
  1199.  
  1200. Incorrect Encryption Algorithm Implementations
  1201.  
  1202. When implementing something as complex as most encryption algorithms, it is
  1203. very simple to make a minor mistake which greatly weakens the implementation.
  1204. It is a well-known fact that making even the smallest change to the DES
  1205. algorithm reduces its strength considerably.  There is a body of test data
  1206. available as US National Bureau of Standards (NBS) special publication 500-20
  1207. which can be used to validate DES implementations.  Unfortunately the
  1208. programmers who produce many commercial DES implementations either don't know
  1209. it exists or have never bothered using it to verify their code (see the section
  1210. "Other Software" above), leading to the distribution of programs which perform
  1211. some sort of encryption which is probably quite close to DES but which
  1212. nevertheless has none of the security of the real DES.
  1213.  
  1214. In order to avoid this problem, the SHS code used in SFS has a self-test
  1215. feature which can be used to test conformance with the data given in Federal
  1216. Information Processing Standards (FIPS) publication 180 and ANSI X9.30 part 2,
  1217. which are the specifications for the SHS algorithm[1].  This self-test can be
  1218. invoked in the mksfs program by giving it the option `-t' for `test':
  1219.  
  1220.     mksfs -t
  1221.  
  1222. mountsfs and the SFS driver itself use exactly the same code, so testing it in
  1223. mksfs is enough to ensure correctness of the other two programs.  The following
  1224. tests can take a minute or so to run to completion.
  1225.  
  1226. The self-test, when run, produces the following output:
  1227.  
  1228.   Running SHS test 1 ... passed, result=0164B8A914CD2A5E74C4F7FF082C4D97F1EDF880
  1229.   Running SHS test 2 ... passed, result=D2516EE1ACFA5BAF33DFC1C471E438449EF134C8
  1230.   Running SHS test 3 ... passed, result=3232AFFA48628A26653B5AAA44541FD90D690603
  1231.  
  1232. The test values can be compared for correctness with the values given in
  1233. Appendix 1 of the FIPS publication.  If any of the tests fail, mksfs will exit
  1234. with an error message.  Otherwise it will perform a speed test and display a
  1235. message along the lines of:
  1236.  
  1237.   Testing speed for 10MB data... done.  Time = 31 seconds, 323 kbytes/second
  1238.  
  1239.   All SHS tests passed
  1240.  
  1241. Note that the speed given in this test is only vaguely representative of the
  1242. actual speed, as the test code used slows the implementation down somewhat.  In
  1243. practice the overall speed should be higher than the figure given, while the
  1244. actual disk encryption speed will be lower due to the extra overhead of disk
  1245. reading and writing.
  1246.  
  1247. Footnote [1]: The FIPS 180 publication is available from the National Technical
  1248.               Information Service, Springfield, Virginia 22161, for $22.50 + $3
  1249.               shipping and handling within the US.  NTIS will take telephone
  1250.               orders on +1 (703) 487-4650 (8:30 AM to 5:30 PM Eastern Time),
  1251.               fax +1 (703) 321-8547.  For assistance, call +1 (703) 487-4679.
  1252.  
  1253.  
  1254. Weak passwords
  1255.  
  1256. Despite the best efforts of security specialists to educate users about the
  1257. need to chose good keys, people persist in using very weak passwords to protect
  1258. critical data.  SFS attempts to ameliorate this problem by forcing a minimum
  1259. key length of 10 characters and making a few simple checks for insecure
  1260. passwords such as single words (since the number of words of length 10 or more
  1261. characters is rather small, it would allow a very fast dictionary check on all
  1262. possible values).  The checking is only rudimentary, but in combination with
  1263. the minimum password length should succeed in weeding out most weak passwords.
  1264.  
  1265. Another possible option is to force a key to contain at least one punctuation
  1266. character, or at least one digit as some Unix systems do.  Unfortunately this
  1267. tends to lead people to simply append a single punctuation character or a fixed
  1268. digit to the end of an existing key, with little increase in security.
  1269.  
  1270. More password issues are discussed in the section "The Care and Feeding of
  1271. Passwords" above.
  1272.  
  1273.  
  1274. Data left in program memory by SFS programs
  1275.  
  1276. Various SFS utilities make use of critical keying information which can be used
  1277. to access an SFS volume.  Great care has been taken to ensure that all critical
  1278. information stored by these programs is erased from memory at the earliest
  1279. possible moment.  All encryption-related information is stored in static
  1280. buffers which are accessed through pointers passed to various routines, and is
  1281. overwritten as soon as it is no longer needed.  All programs take great care to
  1282. acquire keying information from the user at the last possible moment, and
  1283. destroy this information as soon as either the disk volume has been encrypted
  1284. or the keying information has been passed to the SFS driver.  In addition, they
  1285. install default exit handlers on startup which systematically erase all data
  1286. areas used by the program, both for normal exits and for error or
  1287. special-condition exits such as the user interrupting the programs execution.
  1288.  
  1289.  
  1290. Data left in program memory by the SFS driver
  1291.  
  1292. The SFS driver, in order to transparently encrypt and decrypt a volume, must
  1293. at all times store the keying information needed to encrypt and decrypt the
  1294. volume.  It is essential that this information be destroyed as soon as the
  1295. encrypted volume is unmounted.  SFS does this by erasing all encryption-related
  1296. information held by the driver as soon as it receives an unmount command.  In
  1297. addition, the driver's use of a unique disk key for each disk ensures that even
  1298. if a complete running SFS system is captured by an opponent, only the keys for
  1299. the volumes currently mounted will be compromised, even if several volumes are
  1300. encrypted with the same user password (see the section "Controlled Disclosure
  1301. of Encrypted Information" below for more details on this).
  1302.  
  1303.  
  1304. Data left in system buffers by mksfs
  1305.  
  1306. mksfs must, when encrypting a volume, read and write data via standard system
  1307. disk routines.  This data, consisting of raw disk sectors in either plaintext
  1308. or encrypted form, can linger inside system buffers and operating system or
  1309. hard disk caches for some time afterwards.  However since none of the
  1310. information is critical (the plaintext was available anyway moments before
  1311. mksfs was run, and at worst knowledge of the plaintext form of a disk sector
  1312. leads to a known plaintext attack, which is possible anyway with the highly
  1313. regular disk layout used by most operating systems), and since accessing any of
  1314. this information in order to erase it is highly nontrivial, this is not
  1315. regarded as a weakness.
  1316.  
  1317.  
  1318. Data left in system buffers by mountsfs
  1319.  
  1320. As part of its normal operation, mountsfs must pass certain keying information
  1321. to the SFS driver through a DOS system call.  DOS itself does not copy the
  1322. information, but simply passes a pointer to it to the SFS driver.  After the
  1323. driver has been initialised, mountsfs destroys the information as outlined
  1324. above.  This is the only time any keying information is passed outside the
  1325. control of mountsfs, and the value is only passed by reference.
  1326.  
  1327.  
  1328. Data left in system buffers by the SFS driver
  1329.  
  1330. Like mksfs, the SFS driver reads and writes data via standard system disk
  1331. routines.  This data, consisting of raw disk sectors in either plaintext or
  1332. encrypted form, can linger inside system buffers and operating system or hard
  1333. disk caches for some time afterwards.  Once the encrypted volume is unmounted,
  1334. it is essential that any plaintext information still held in system buffers be
  1335. destroyed.
  1336.  
  1337. In order to accomplish this, mountsfs, when issuing an unmount command,
  1338. performs two actions intended to destroy any buffered information.  First, it
  1339. issues a cache flush command followed by a cache reset command to any DOS drive
  1340. cacheing software it recognizes, such as older versions of Microsoft's
  1341. SmartDrive (with IOCTL commands), newer versions of SmartDrive (version 4.0 and
  1342. up), the PCTools 5.x cache, Central Point Software's PC-Cache 6.0 and up, the
  1343. more recent PC-Cache 8.x, Norton Utilities' NCache-F, NCache-S, and the newer
  1344. NCache 6.0 and up, the Super PC-Kwik cache 3.0 and up, and Qualitas' QCache 4.0
  1345. and up.  Some other cacheing software can be detected but doesn't support
  1346. external cache flushing.  This step is handled by mountsfs rather than the
  1347. driver due to the rather complex nature of the procedures necessary to handle
  1348. the large variety of cacheing software, and the fact that most cacheing
  1349. software can't be accessed from a device drvier.
  1350.  
  1351. After this the SFS driver itself issues a disk reset command which has the
  1352. effect of flushing all buffered and cached data scheduled to be written to a
  1353. disk, and of marking those cache and buffer entries as being available for
  1354. immediate use.  In addition to the explicit flushing performed by the mountsfs
  1355. program, many cacheing programs will recognise this as a signal to flush their
  1356. internal buffers (quite apart from the automatic flushing performed by the
  1357. operating system and the drive controller).
  1358.  
  1359. Any subsequent disk accesses will therefore overwrite any data still held in
  1360. the cache and system buffers.  While this does not provide a complete guarantee
  1361. that the data has gone (some software disk caches will only support a cache
  1362. flush, not a complete cache reset), it is the best which can be achieved
  1363. without using highly hardware and system-specific code.
  1364.  
  1365.  
  1366. SFS volumes left mounted
  1367.  
  1368. It is possible that an SFS volume may be unintentionally left mounted on an
  1369. unattended system, allowing free access to both the in-memory keying
  1370. information and the encrypted volume.  In order to lessen this problem
  1371. somewhat, a fast-unmount hotkey has been incorporated into the SFS driver which
  1372. allows an unmount command to be issued instantly from the keyboard (see the
  1373. sections "Mounting an SFS Volume" and "Advanced SFS Driver Options" above).
  1374. The ease of use of this command (a single keystroke) is intended to encourage
  1375. the unmounting of encrypted volumes as soon as they are no longer needed,
  1376. rather than whenever the system is next powered down.
  1377.  
  1378. As an extra precaution, the driver's use of a unique disk key for each disk
  1379. ensures that even if a complete running SFS system with encrypted volumes still
  1380. mounted is captured by an opponent, only the keys for the volumes currently
  1381. mounted will be compromised, even if several volumes are encrypted with the
  1382. same user password (see the section "Controlled Disclosure of Encrypted
  1383. Information" below for more details on this).
  1384.  
  1385. Finally, a facility for an automatic timed unmount of volumes left mounted is
  1386. provided, so that volumes mistakenly left mounted while the system is
  1387. unattended may be automatically unmounted after a given period of time.  This
  1388. ensures that, when the inevitable distractions occur, encrypted volumes are
  1389. safely unmounted at some point rather than being left indefinitely accessible
  1390. to anyone with access to the system.
  1391.  
  1392.  
  1393. Controlled disclosure of encrypted information
  1394.  
  1395. To date there are no known laws which can be used to enforce disclosure of
  1396. encrypted information, a field which is usually covered by safeguards against
  1397. self-incrimination.  However there have been moves in both the US and the UK to
  1398. pass legislation which would compromise the integrity of encrypted information,
  1399. or which would remove protection against self-incrimination.  In either case
  1400. this would allow agencies to compel users of cryptographic software to reveal
  1401. the very information they are trying to protect, often without the users even
  1402. being aware that their privacy is being compromised.
  1403.  
  1404. The approach taken in the US, in the form of the Clipper initiative, is to have
  1405. all encryption keys held by the government.  If disclosure of the information
  1406. is required, the key is retrieved from storage and used to decrypt the
  1407. information.  A side effect of this is that any data which has ever been
  1408. encrypted with the key, and any data which will ever be encrypted in the
  1409. future, has now been rendered unsafe.  This system is best viewed as
  1410. uncontrolled disclosure.
  1411.  
  1412. SFS includes a built-in mechanism for controlled disclosure so that, if
  1413. disclosure is ever required by law, only the information for which access is
  1414. authorized may be revealed.  All other encrypted data remains as secure as it
  1415. was previously.
  1416.  
  1417. This is achieved by encrypting each disk volume with a unique disk key which is
  1418. completely unrelated to the users passphrase.  When the passphrase is entered,
  1419. it is transformed by iterating a one-way hash function over it several hundred
  1420. times to create an intermediate key which is used to decrypt the disk key
  1421. itself.  The disk volume is then en/decrypted with the disk key rather than the
  1422. unmodified encryption key supplied by the user.  There is no correlation
  1423. between the user/intermediate key and the disk key
  1424.  
  1425. If disclosure of the encrypted information is required, the disk key can be
  1426. revealed without compromising the security of the user key (since it is
  1427. unrelated to the user key), or the integrity of any other data encrypted with
  1428. the user key (since the disk key is unique for each disk volume, so that
  1429. knowledge of a particular disk key allows only the one volume it corresponds to
  1430. to be decrypted).
  1431.  
  1432. The controlled disclosure option is handled by the two mountsfs options `-d'
  1433. and `-c'.  The `-d' option will disclose the unique key for a given disk
  1434. volume, and the `-c' option will accept this key instead of the usual password.
  1435. For example to disclose the disk key for the SFS volume "Data", the command
  1436. would be:
  1437.  
  1438.   mountsfs -d vol=data
  1439.  
  1440. mountsfs will then ask for the password in the usual manner and prompt:
  1441.  
  1442.   You are about to disclose the encryption key for this SFS volume.
  1443.   Are you sure you want to do this [y/n]
  1444.  
  1445. At this point a response of 'Y' will continue and a response of 'N' will exit
  1446. the program without disclosing the disk key.  A response of 'Y' will print the
  1447. disk key in the following format:
  1448.  
  1449.   Disk key is
  1450.  
  1451.       2D 96 B1 06 6D E8 30 21 D5 DB 1B CC 3E 0E C7 CF D6 D1 0C 97 75 DC
  1452.       06 74 BC 2F E6 A0 3C 56 80 5F 0D 30 DA 54 D3 0D 28 F3 14 DE 79 67
  1453.       6E 1A 75 DC 33 87 86 29 BA A5 B1 64 5B 79 67 8C 8A 1B D1 27 5B 79
  1454.       73 6B 45 7B DA 54 43 6C C1 AB 06 67 7E 94 86 F2 50 22 09 8D 21 D5
  1455.       E7 3A 80 5F 0D 30 DA 54 D3 0D 28 FF 6D E8 30 21 33 87 86 29 C0 ED
  1456.       4A 22 96 B1 06 6D E8 30 21 D5 1C 2D E6 A0 3C 56 DA 54 43 6C 56 80
  1457.  
  1458. This is the unique key needed to access the particular encrypted volume.
  1459.  
  1460. To use this key instead of the usual one with mountsfs, the command would be:
  1461.  
  1462.   mountsfs -c vol=data
  1463.  
  1464. mountsfs will then ask for this disk key instead of the usual password:
  1465.  
  1466.   Please enter 264-digit disk key, [ESC] to exit:
  1467.  
  1468. At this point the disk key should be entered.  mountsfs will automatically
  1469. format the data as it is entered to conform to the above layout.  The ESC key
  1470. can be used at any point to exit the process.
  1471.  
  1472. Once the key has been entered, the program will perform a validity check on the
  1473. key.  If this test fails, mountsfs will display the message:
  1474.  
  1475.   Error: Incorrect disk key entered
  1476.  
  1477. and exit.  Otherwise it will mount the volume as usual.  Since each volume has
  1478. its own unique disk key, revealing the key for one volume gives access to that
  1479. volume and no others.  Even if 20 volumes are all encrypted with the same user
  1480. password, only one volume can be accessed using a given disk key.
  1481.  
  1482.  
  1483. Password Lifetimes and Scope
  1484.  
  1485. An SFS password which is used over a long period of time makes a very tempting
  1486. target for an attacker.  The longer a particular password is used, the greater
  1487. the chance that it has been compromised.  A password used for a year has a far
  1488. greater chance of being compromised than one used for a day.  If a password is
  1489. used for a long period of time, the temptation for an attacker to spend the
  1490. effort necessary to break it is far greater than if the password is only a
  1491. short-term one.
  1492.  
  1493. The scope of a password is also important.  If a password is used to encrypt a
  1494. single drive containing business correspondence, it's compromise is only mildly
  1495. serious.  If it is employed to protect dozens of disk volumes or a large file
  1496. server holding considerable amounts of confidential information, the compromise
  1497. of the password could be devastating.  Again, the temptation to attack the
  1498. master password for an entire file server is far greater than for the password
  1499. protecting data contained on a single floppy disk.
  1500.  
  1501. SFS attacks this problem in two ways.  First, it uses unique disk keys to
  1502. protect each SFS volume.  The disk key is a 1024-bit cryptographically strong
  1503. random key generated from nondeterministic values acquired from system
  1504. hardware, system software, and user input (see the subsection "Generating
  1505. Random Numbers" below).  The data on each disk volume is encrypted using this
  1506. unique disk key, which is stored in encrypted form in the SFS volume header
  1507. (this works somewhat like session keys in PEM or PGP, except that a
  1508. conventional-key algorithm is used instead of a public-key one).  To access the
  1509. disk, the encrypted disk key is first decrypted with the user password, and the
  1510. disk key itself is used to access the disk.  This denies an attacker any known
  1511. plaintext to work with (as the plaintext consists of the random disk key).  To
  1512. check whether a given password is valid, an attacker must use it to decrypt the
  1513. disk key, rekey the encryption system with the decrypted disk key, and try to
  1514. decrypt the disk data.  Only then will they know whether their password guess
  1515. was correct or not.  This moves the target of an attack from a (possibly
  1516. simple) user password to a 1024-bit random disk key[1].
  1517.  
  1518. The other way in which SFS tries to ameliorate the problem of password
  1519. lifetimes and scope is by making the changing of a password a very simple
  1520. operation.  Since the only thing which needs to be changed when a password
  1521. change is made is the encryption on the disk key, the entire password change
  1522. operation can be made in a matter of seconds, rather than the many minutes it
  1523. would take to decrypt and re-encrypt an entire disk.  It is hoped that the ease
  1524. with which passwords can be changed will encourage the frequent changing of
  1525. passwords by users.
  1526.  
  1527. Footnote [1]: SFS may not use the entire 1024 bits - the exact usage depends on
  1528.               the encryption algorithm being used.
  1529.  
  1530.  
  1531. Trojan Horses
  1532.  
  1533. The general problem of trojan horses is discussed in the section "Data
  1534. Security" above.  In general, by planting a program in the target machine which
  1535. monitors the password as it is entered or the data as it is read from or
  1536. written to disk, an attacker can spare themselves the effort of attacking the
  1537. encryption system itself.  In an attempt to remove the threat of password
  1538. interception, SFS takes direct control of the keyboard and various other pieces
  1539. of system hardware which may be used to help intercept keyboard access, making
  1540. it significantly more difficult for any monitoring software to detect passwords
  1541. as they are entered.  If any keystroke recording or monitoring routines are
  1542. running, the SFS password entry process is entirely invisible to them.  This
  1543. feature has been tested by a computer security firm who examined SFS, and found
  1544. it was the only program they had encountered (including one rated as secure for
  1545. military use) which withstood this form of attack.
  1546.  
  1547. Similarly, the fast disk access modes used by SFS can be used to bypass any
  1548. monitoring software, as SFS takes direct control of the drive controller
  1549. hardware rather than using the easily-intercepted BIOS or DOS disk access
  1550. routines.
  1551.  
  1552. Although these measures can still be worked around by an attacker, the methods
  1553. required are by no means trivial and will probably be highly system-dependant,
  1554. making a general encryption-defeating trojan horse difficult to achieve.
  1555.  
  1556.  
  1557. Design Details
  1558. --------------
  1559.  
  1560. This section goes into a few of the more obscure details not covered in the
  1561. section on security analysis, such as the encryption algorithm used by SFS, the
  1562. generation of random numbers, the handling of initialization vectors (IV's),
  1563. and a brief overview on the deletion of sensitive information retained in
  1564. memory after a program has terminated (this is covered in more detail in the
  1565. section "Security Analysis" above).
  1566.  
  1567.  
  1568. The Encryption Algorithm used in SFS
  1569.  
  1570. Great care must be taken when choosing an encryption algorithm for use in
  1571. security software.  For example, the standard Unix crypt(1) command is based on
  1572. a software implementation of a rotor machine encryption device of the kind
  1573. which was broken by mathematicians using pencil and paper (and, later on, some
  1574. of the first electronic computers) in the late 1930's[1].  Indeed, there exists
  1575. a program called `crypt breaker's workbench' which allows the automated
  1576. breaking of data encrypted using the crypt(1) command[2].  The insecurity of
  1577. various other programs has been mentioned elsewhere.  It is therefore
  1578. imperative that a reliable encryption system, based on world-wide security
  1579. standards, and easily verifiable by consulting these standards, be used.
  1580.  
  1581. When a block cipher is used as a stream cipher by running it in CFB (cipher
  1582. feedback) mode, there is no need for the cipher's block transformation to be a
  1583. reversible one as it is only ever run in one direction (generally
  1584. encrypt-only).  Therefore the use of a reversible cipher such as DES or IDEA is
  1585. unnecessary, and any secure one-way block transformation can be substituted.
  1586. This fact allows the use of one-way hash functions, which have much larger
  1587. block sizes (128 or more bits) and key spaces (512 or more bits) than most
  1588. reversible block ciphers in use today.
  1589.  
  1590. The transformation involved in a one-way hash function takes an initial hash
  1591. value H and a data block D, and hashes it to create a new hash value H':
  1592.  
  1593.     hash( H, D ) -> H'
  1594.  
  1595. or, more specifically, in the function used in SFS:
  1596.  
  1597.     H + hash( D ) -> H'
  1598.  
  1599. This operation is explained in more detail in FIPS Publication 180 and ANSI
  1600. X9.30 part 2, which define the Secure Hash Standard.  By using H as the data
  1601. block to be encrypted and D as the key, we can make the output value H'
  1602. dependant on a user-supplied key. That is, when H is the plaintext, D is the
  1603. encryption key, and H' is the ciphertext:
  1604.  
  1605.      plaintext H
  1606.          |
  1607.          v
  1608.     +---------+
  1609.     |   SHS   |<- key D
  1610.     +---------+
  1611.          |
  1612.          v
  1613.     ciphertext H'
  1614.  
  1615. If we regard it as a block cipher, the above becomes:
  1616.  
  1617.     H' = SHS( H )
  1618.  
  1619. which is actually:
  1620.  
  1621.     C  =   e( P )
  1622.  
  1623. Since we can only ever "encrypt" using a one-way hash function, we need to run
  1624. the "cipher" in cipher feedback mode, which doesn't require a reversible
  1625. encryption algorithm.
  1626.  
  1627. By the properties of the hash function, it is computationally infeasible to
  1628. either recover the key D or to control the transformation H -> H' (in other
  1629. words given a value for H' we cannot predict the H which generated it, and
  1630. given control over the value H we cannot generate an arbitrary H' from it).
  1631.  
  1632. The MDC encryption algorithm is a general encryption system which will take any
  1633. one-way hash function and turn it into a stream cipher running in CFB mode. The
  1634. recommended one-way hash function for MDC is the Secure Hash Standard as
  1635. specified in Federal Information Processing Standards (FIPS) Publication 180
  1636. and ANSI X9.30 part 2.  SHS is used as the block transformation in a block
  1637. cipher run in CFB mode as detailed in AS 2805.5.2 section 8 and ISO 10116:1991
  1638. section 6, with the two parameters (the size of the feedback and plaintext
  1639. variables) j and k both being set to the SHS block size of 160 bits.  The
  1640. properties of this mode of operation are given in Appendix A3 of AS 2805.5.2
  1641. and Annex A.3 of ISO 10116:1991.  The CFB mode of operation is also detailed in
  1642. a number of other standards such as FIPS Publication 81 and USSR Government
  1643. Standard GOST 28147-89, Section 4.  The use of an initialization vector (IV) is
  1644. as given in ISO 10126-2:1991 section 4.2, except that the size of the IV is
  1645. increased to 160 bits from the 48 or 64 bits value given in the standard. This
  1646. is again detailed in a number of other standards such as GOST 28147-89 Section
  1647. 3.1.2. The derivation of the IV is given in the section "Encryption
  1648. Considerations" below.
  1649.  
  1650. The key setup for the MDC encryption algorithm is performed by running the
  1651. cipher over the encryption key (in effect encrypting the key with MDC using
  1652. itself as the key) and using the encrypted value as the new encryption key.
  1653. This procedure is then repeated a number of times to make a "brute-force"
  1654. decryption attack more difficult, as per the recommendation in the Public-Key
  1655. Cryptography Standard (PKCS), part 1.  This reduces any input key, even one
  1656. which contains regular data patterns, to a block of white noise equal in size
  1657. to the MDC key data.
  1658.  
  1659. The exact key scheduling process for MDC is as follows:
  1660.  
  1661.  Initialization:
  1662.  
  1663.  - The SHS hash value H is set to the key IV[3].
  1664.  - The SHS data block D is set to all zeroes.
  1665.  - The key data of length 2048 bits is set to a 16-bit big-endian value
  1666.    containing the length of the user key in bytes, followed by up to 2032 bits
  1667.    of user key.
  1668.  
  1669.    SHS hash value H = key IV;
  1670.    SHS data block D = zeroes;
  1671.    key_data [0:15] = length of user key in bytes;
  1672.    key_data [16:2047] = user key, zero-padded;
  1673.  
  1674.  Key schedule:
  1675.  
  1676.  - The following process is iterated a number of times:
  1677.  
  1678.    - The 2048-bit key data block is encrypted using MDC.
  1679.    - Enough of the encrypted key data is copied from the start of the key data
  1680.      block into the SHS data block D to fill it.
  1681.  
  1682.    for i = 1 to 200 do
  1683.        encrypted_key = encrypt( key_data );
  1684.        D = encrypted_key;
  1685.  
  1686. During the repeated encryptions, the IV is never reset.  This means that the IV
  1687. from the end of the n-1 th data block is re-injected into the start of the n th
  1688. data block.  After 200 iterations, the "randomness" present in the key has been
  1689. diffused throughout the entire key data block.
  1690.  
  1691. Although the full length of the key data block is 2048 bits, the SHS algorithm
  1692. only uses 512 bits of this (corresponding to the SHS data block D) per
  1693. iteration.  The remaining 1536 bits take part in the computation (by being
  1694. carried along via the IV) but are not used directly.  By current estimates
  1695. there are around 2^256 atoms in the universe.  Compiling a table of all 2^512
  1696. possible keys which would be necessary for a brute-force attack on MDC would
  1697. therefore be a considerable challenge to an attacker, requiring, at least, the
  1698. creation of another 512 * 2^256 universes to hold all the keys.  Even allowing
  1699. for the current best-case estimate of a creation time of 7 days per universe,
  1700. the mere creation of storage space for all the keys would take an unimaginably
  1701. large amount of time.
  1702.  
  1703. The SFS key schedule operation has been deliberately designed to slow down
  1704. special hardware implementations, since the encryption algorithm is rekeyed
  1705. after each iteration.  Normal high-speed password-cracking hardware would (for
  1706. example, with DES) have 16 separate key schedules in a circular buffer, each
  1707. being applied to a different stage of a 16-stage pipeline (one stage per DES
  1708. round) allowing a new result to be obtained in every clock cycle once the
  1709. pipeline is filled.  In MDC the key data is reused multiple times during the 80
  1710. rounds of SHS, requiring 80 separate key schedules for the same performance as
  1711. the 16 DES ones.  However since the algorithm is rekeyed after every iteration
  1712. for a total of 200 iterations, this process must either be repeated 200 times
  1713. (for a corresponding slowdown factor of 200), or the full pipeline must be
  1714. extended to 16,000 stages to allow the one-result-per-cycle performance which
  1715. the 16-stage DES pipeline can deliver (assuming the rekeying operation can be
  1716. performed in a single cycle).  Changing the iteration count to a higher value
  1717. will further slow down this process.
  1718.  
  1719. The number of iterations of key encryption is controlled by the user, and is
  1720. generally done some hundreds of times.  The setup process in SFS has been tuned
  1721. to take approximately half a second on a workstation rated at around 15 MIPS
  1722. (corresponding to 200 iterations of the encryption process), making a
  1723. brute-force password attack very time-consuming.  Note that the key IV is
  1724. injected at the earliest possible moment in the key schedule rather than at the
  1725. very end, making the use of a precomputed data attack impossible.  The standard
  1726. method of injecting the encryption IV at the end of the key schedule process
  1727. offers very little protection against an attack using precomputed data, as it
  1728. is still possible to precompute the key schedules and simply drop in the
  1729. encryption IV at the last possible moment.
  1730.  
  1731. Footnote [1]: This is covered in a number of books, for example Welchman's "The
  1732.               Hut Six Story: Breaking the Enigma Codes", New York, McGraw-Hill
  1733.               1982, and Kahns "Seizing the Enigma", Boston, Houghton-Mifflin
  1734.               1991.
  1735.  
  1736. Footnote [2]: Available from black.ox.ac.uk in the directory /src/security as
  1737.               cbw.tar.Z.
  1738.  
  1739. Footnote [3]: Some sources would refer to this value as a `salt'.  The term
  1740.               `key IV' is used here as this is probably a more accurate
  1741.               description of its function.
  1742.  
  1743.  
  1744. Generating Random Numbers
  1745.  
  1746. One thing which cryptosystems consume in large quantities are random numbers.
  1747. Not just any old random value, but cryptographically strong random numbers.  A
  1748. cryptographically strong random value is one which cannot be predicted by an
  1749. attacker (if the attacker can predict the values which are used to set up
  1750. encryption keys, then they can make a guess at the encryption key itself).
  1751. This automatically rules out all software means of generating random values,
  1752. and means specialised hardware must be used.
  1753.  
  1754. Very few PC's are currently equipped with this type of hardware.  However SFS
  1755. requires 1024 random bits for each encrypted disk, in the form of the disk key
  1756. (see the section "Password Lifetimes and Scope" above).  SFS therefore uses a
  1757. number of sources of random numbers, both ones present in the hardware of the
  1758. PC and one external source:
  1759.  
  1760.   - Various hardware timers which are read occasionally when the program is
  1761.     running (generally after operations which are long and complex and will be
  1762.     heavily affected by external influences such as interrupts, video, screen,
  1763.     and disk I/O, and other factors.
  1764.  
  1765.   - The contents and status information of the keyboard buffer
  1766.  
  1767.   - Disk driver controller and status information
  1768.  
  1769.   - Mouse data and information
  1770.  
  1771.   - Video controller registers and status information
  1772.  
  1773. [ - The clock skew between two hardware clocks available on the PC.  Due to
  1774.     background system activity such as interrupt servicing, disk activity, and
  1775.     variable-length instruction execution times, these clocks run out-of-phase.
  1776.     SFS uses this phase difference as a source of random numbers.  NB: Not
  1777.     implemented yet].
  1778.  
  1779.   - The timing of keystrokes when the password is entered.  SFS reads the
  1780.     high-speed 1.19 MHz hardware timer after each keystroke and uses the timer
  1781.     values as a source of random numbers.  This timer is used both to measure
  1782.     keystroke latency when the password is entered and read at random times
  1783.     during program execution.  Trials have shown that this 16-bit counter
  1784.     yields around 8 bits of random information (the exact information content
  1785.     is difficult to gauge as background interrupts, video updates, disk
  1786.     operations, protected-mode supervisor software, and other factors greatly
  1787.     affect any accesses to this counter, but an estimate of 8 bits is probably
  1788.     close enough[1]).
  1789.  
  1790.   - The timing of disk access latency for random disk reads.  The exact
  1791.     operation is as follows:
  1792.  
  1793.         Read a timer-based random disk sector
  1794.         Add its contents (8 bits)
  1795.         Read the high-speed 1.19 MHz hardware timer (13 bits)
  1796.         Use the two values for the next random sector
  1797.  
  1798.     This is repeated as often as required (in the case of SFS this is 10
  1799.     times).  Assuming a (currently rather optimistic) maximum of 5ms to acquire
  1800.     a sector this provides about 13 bits of randomness per disk operation.  The
  1801.     number of factors which influence this value is rather high, and includes
  1802.     among other things the time it takes the BIOS to process the request, the
  1803.     time it takes the controller to process the request, time to seek to the
  1804.     track on the disk, time to read the data (or, if disk cacheing is used,
  1805.     time for the occasional cache hit), time to send it to the PC, time to
  1806.     switch in and out of protected mode when putting it in the cache, and of
  1807.     course the constant 3-degree background radiation of other interrupts and
  1808.     system activity happening at the same time.  If a solid-state disk were
  1809.     being used, the hardware latency would be significantly reduced, but
  1810.     currently virtually no 386-class PC's have solid-state disks (they're
  1811.     reserved for palmtops and the like), so this isn't a major concern.
  1812.  
  1813. An estimate of the number of random bits available from each source is as
  1814. follows:
  1815.  
  1816.     Keystroke latency, 8 bits per key      80 bits for minimum 10-char key
  1817.     Second password entry for encryption   80 bits for minimum 10-char key
  1818.     Disk access latency, 13 bits per read 130 bits for 10 reads
  1819.     Disk sector data, 8 bits               80 bits for 10 reads
  1820.     System clocks and timers                3 bits
  1821.     Video controller information            4 bits
  1822.     Keyboard buffer information             4 bits
  1823.     Disk status information                 4 bits
  1824.     General system status                   4 bits
  1825.     Random high-speed timer reads         120 bits for 15 reads
  1826.                                           --------
  1827.     Total                                 509 bits
  1828.  
  1829. These figures are very conservative estimates only, and are based on timing
  1830. experiments with typed-in passwords and a careful scrutiny of the PC's hardware
  1831. and system status data.  For example, although the time to access a disk sector
  1832. for a particular drive may be 10ms or more, the actual variation on that 10ms
  1833. may only be +/- 2ms.  The figures given above were taken by averaging the
  1834. variation in times for large numbers of tests.  In practice (especially with
  1835. longer passwords) the number of random bits is increased somewhat (for example
  1836. with a 30-character password the total may be as high as 829 bits of random
  1837. information).  However even the minimal estimate of 509 bits is adequate for
  1838. the 512-bit key required by MDC.
  1839.  
  1840. Each quantum of semi-random information is exclusive-ored into a 1024-bit
  1841. buffer which is initially set to all zeroes.  Once 1024 bits of buffer have
  1842. been filled, the data is encrypted with MDC to distribute the information, and
  1843. the first 512 bits of the 1024-bit buffer is used as the key for the next MDC
  1844. encyrption pass.  Then more data is added until, again, 1024 bits of buffer
  1845. have been filled, whereupon the data is again mixed by encrypting it with MDC.
  1846. This process is repeated several times, with the amount of "randomness" in the
  1847. buffer increasing with each iteration.
  1848.  
  1849. Before being used, this data is encrypted 10 times over with MDC to ensure a
  1850. complete diffusion of randomness.  Since the IV for the encryption is reused
  1851. for the next pass through the buffer, any information from the end of the
  1852. buffer is thus reinjected at the start of the buffer on the next encryption
  1853. pass.
  1854.  
  1855. Although this method of generating random numbers is not perfect, it seems to
  1856. be the best available using the existing hardware.  General estimates of the
  1857. exact amount of truly random information which can be acquired in this manner
  1858. are in the vicinity of several hundred bits.  Proposed attacks all make the
  1859. assumption that an attacker is in possession of what amounts to a complete
  1860. hardware trace of events on the machine in question.  Allowing for a reasonable
  1861. amount of physical system security, it can be assumed that the random data used
  1862. in SFS is unpredictable enough to provide an adequate amount of security
  1863. against all but the most determined attacker.
  1864.  
  1865. Footnote [1]: If an opponent can obtain several hours of keystroke timings and
  1866.               can come up with a good model including serial correlations, they
  1867.               may be able to reduce the likely inputs to the random number
  1868.               accumulator to a somewhat smaller value, or at least bias their
  1869.               guesses to fall within the range of likely values.
  1870.  
  1871.  
  1872. Encryption Considerations
  1873.  
  1874. When a block cipher is converted to handle units of data larger than its
  1875. intrinsic block size, a number of weaknesses can be introduced, depending on
  1876. the mode of operation which is chosen for the block cipher.  For example, if
  1877. two identical ciphertext blocks are present in different locations in a file,
  1878. this may be used to determine the plaintext.  If we can find two identical
  1879. blocks of ciphertext when cipher block chaining (CBC) is used, then we know
  1880. that:
  1881.  
  1882.     P[ i ] = d( C[ i ] ) ^ C[ i-1 ]
  1883.     P[ j ] = d( C[ j ] ) ^ C[ j-1 ]
  1884.  
  1885. where C is the ciphertext, P is the plaintext, and e() and d() are encryption
  1886. and decryption respectively.  Now if C[ i ] = C[ j ], then d( C[ i ] ) =
  1887. d( C[ j ] ), which cancel out when xor'd so that:
  1888.  
  1889.     P[ i ] ^ C[ i-1 ] = P[ j ] ^ C[ j-1 ]
  1890.  
  1891. or:
  1892.  
  1893.      P[ j ] = P[ i ] ^ C[ i-1 ] ^ C[ j-1 ]
  1894.  
  1895. Knowing C[ i ] and C[ j ] we can determine P[ i ] and P[ j ], and knowing
  1896. either P[ i ] or P[ j ] we can determine the other.
  1897.  
  1898. Something similar holds when cipher feedback (CFB) mode is used, except that
  1899. now the decryption operation is:
  1900.  
  1901.     P[ i ] = e( C[ i-1 ] ) ^ C[ i ]
  1902.     P[ j ] = e( C[ j-1 ] ) ^ C[ j ]
  1903.  
  1904. Now if C[ i ] = C[ j ] then e( C[ i ] ) = e( C[ j ] ) (recall that in CFB mode
  1905. the block cipher is only ever used for encryption), so that they again cancel
  1906. out, so:
  1907.  
  1908.     P[ i ] ^ e( C[ i-1 ] ) = P[ j ] ^ e( C[ j-1 ] )
  1909.  
  1910. or:
  1911.  
  1912.     P[ i ] = P[ j ] ^ e( C[ i-1 ] ) ^ e( C[ j-1 ] )
  1913.  
  1914. In general this problem is of little consequence since the probability of
  1915. finding two equal blocks of ciphertext when using a 160-bit block cipher on a
  1916. dataset of any practical size is negligible.  More esoteric modes of operation
  1917. such as plaintext feedback (PFB) and ones whose acronyms have more letters than
  1918. Welsh place names tend to have their own special problems and aren't considered
  1919. here.
  1920.  
  1921. The problem does become serious, however, in the case of sector-level
  1922. encryption, where the initialization vector cannot be varied.  Although the IV
  1923. may be unique for each sector, it remains constant unless special measures such
  1924. as reserving extra storage for sector IV's which are updated with each sector
  1925. write are taken.  If a sector is read from disk, a small change made to part of
  1926. it (for example changing a word in a text file), and the sector written out to
  1927. disk again, several unchanged ciphertext/plaintext pairs will be present,
  1928. allowing the above attack to be applied.  However, there are cases in which
  1929. this can be a problem.  For example, running a program such as a disk
  1930. defragmenter will rewrite a large number of sectors while leaving the IV
  1931. unchanged, allowing an opponent access to large quantities of XOR'd plaintext
  1932. blocks simply by recording the disk contents before and after the
  1933. defragmentation process.  Normally this problem would be avoided by using a
  1934. different IV for each encrypted message, but most disk systems don't have the
  1935. room to store an entire sectors worth of data as well as the IV needed to
  1936. en/decrypt it.
  1937.  
  1938. An additional disadvantage of the CFB encryption mode is that the data in the
  1939. last block of a dataset may be altered by an attacker to give different
  1940. plaintext without it affecting the rest of the block, since the altered
  1941. ciphertext in the last block never enters the feedback loop.  This type of
  1942. attack requires that an opponent possess at least two copies of the ciphertext,
  1943. and that they differ only in the contents of the last block.  In this case the
  1944. last ciphertext block from one copy can be subsituted for the last ciphertext
  1945. block in the other copy, allowing a subtle form of message modification attack.
  1946. In fact in combination with the previously mentioned weakness of CFB, an
  1947. attacker can determine the XOR of the plaintexts in the last block and
  1948. substitute an arbitrary piece of "encrypted" plaintext to replace the existing
  1949. data.
  1950.  
  1951. There are several approaches to tackling this problem.  The most simplistic one
  1952. is to permute the plaintext in a key-dependant manner before encryption and
  1953. after decryption.  This solution is unsatisfactory as it simply shuffles the
  1954. data around without necessarily affecting any particular plaintext or
  1955. ciphertext block.  The desired goal of a change in any part of the plaintext
  1956. affecting the entire dataset is not achieved.
  1957.  
  1958. A better solution is to encrypt data twice, once from front to back and then
  1959. from back to front[1].  The front-to-back pass propagates any dependencies to
  1960. the back of the dataset, and the back-to-front pass propagates dependencies
  1961. back to the front again.  In this way a single change in any part of the
  1962. plaintext affects the entire dataset.  The disadvantage of this approach is
  1963. that it at least halves the speed of the encryption, as all data must be
  1964. encrypted twice. If the encryption is done in software, this may create an
  1965. unacceptable loss of throughput.  Even with hardware assistance there is a
  1966. noticeable slowdown, as no hardware implementations easily support backwards
  1967. encryption, requiring the data to be reversed in software before the second
  1968. pass is possible.
  1969.  
  1970. The best solution is probably to use a word-wise scrambler polynomial like the
  1971. one used in SHA.  With a block of plaintext P this is:
  1972.  
  1973.     P[ i ] ^= P[ i-K1 ] ^ P[ i-K2 ]
  1974.  
  1975. with suitable values for the constants K1 and K2.  If K2 is chosen to be 5 (the
  1976. SHA block size in words) then the initial values of the 5 words (which can be
  1977. thought of as as P[ -5 ]...P[ -1 ]) are simply the sectorIV.  The value of K1
  1978. is arbitrary, SFS uses a value of 4.
  1979.  
  1980. This technique is used by first setting the initial values of the 5 words to
  1981. the sectorIV.  The scrambler function is then run over the entire data block,
  1982. propagating all dependencies to the last 5 words in the block.  These last 5
  1983. words are then used as the IV for the CFB encryption of the entire block.  In
  1984. this way the encryption IV depends on all the bits in the block, and the
  1985. scrambling does a moderately good job of breaking up statistical patterns in
  1986. the plaintext.  No information is lost, so no randomness in the sectorIV is
  1987. misplaced.
  1988.  
  1989. This also provides resistance to the selective-modification attack which allows
  1990. an attacker to change selected bits in the last block of a CFB-encrypted
  1991. dataset without damage.  By destroying the IV used in the CFB encryption, the
  1992. first block is completely corrupted, which is unlikely to go unnoticed.
  1993.  
  1994. To decrypt a dataset encrypted in this manner, the first 5 words of ciphertext
  1995. are shifted into the feedback path, and the remainder of the dataset is
  1996. decrypted in the standard manner.  The last 5 decrypted words are then used as
  1997. the IV to decrypt the first encrypted block.  Finally, the scrambler is run
  1998. over the recovered plaintext to undo the changes made during the encryption
  1999. scrambling.
  2000.  
  2001. The overall en/decryption process used by SFS, in the case of 512-byte sectors
  2002. and 32-bit words (so that each sector contains 128 words), is:
  2003.  
  2004.     Encryption:
  2005.  
  2006.         using sectorIV[ 0 ]...sectorIV[ 4 ] as the scrambler IV
  2007.             scramble data[ 0 ]...data[ 127 ]
  2008.         using data[ 127-5 ]...data[ 127-1 ] as the encryption IV
  2009.             encrypt data[ 0 ]...data[ 127 ]
  2010.  
  2011.     Decryption:
  2012.  
  2013.         using data[ 0 ]...data[ 4 ] as the encryption IV
  2014.             decrypt data[ 5 ]...data[ 127 ]
  2015.         using data[ 127-5 ]...data[ 127-1 ] as the encryption IV
  2016.             decrypt data[ 0 ]...data[ 4 ]
  2017.         using sectorIV[ 0 ]...sectorIV[ 4 ] as the scrambler IV
  2018.             scramble data[ 0 ]...data[ 127 ]
  2019.  
  2020. where the scrambling operation is:
  2021.  
  2022.         data[ i ] ^= data[ i-4 ] ^ data[ i-5 ]
  2023.  
  2024. as outlined above.  Note that the i-4 and i-5 th values referred to here are
  2025. the original, scrambled values, not the descrambled values.  The easiest way to
  2026. implement this is to cache the last 5 scrambled values and cyclically overwrite
  2027. them as each word in the data buffer is processed.
  2028.  
  2029. Footnote [1]:  To be precise, you need some sort of feedback from the end of
  2030.                a block on the first encryption pass to the start of the block
  2031.                on the next encryption pass.  A block can be encrypted forwards
  2032.                twice as long as the IV is wrapped back to the start of the
  2033.                block for the second encryption pass.
  2034.  
  2035.  
  2036. A Discussion of the MDC Encryption Algorithm[1]
  2037.  
  2038. (A word on notation:  The notation {0,1}^k is used to mean the set of all bit
  2039. strings of length k, and {0,1}* means the set of all bit strings, including the
  2040. empty string.  Any message can be viewed as a bit string by means of a suitable
  2041. encoding).
  2042.  
  2043. The encryption method used by SFS is somewhat unusual, and in some respects is
  2044. similar to Merkle's "Meta Method" for obtaining cryptosystems[2].  The method
  2045. relies on the existence of secure one-way hash functions.  A hash function is a
  2046. function that takes as input an arbitrary number of bits and produces a
  2047. fixed-sized output called the "message digest".  In other words, hash functions
  2048. have the form
  2049.  
  2050.     h : {0,1}* --> {0,1}^k              for some fixed k,
  2051.  
  2052. and the hash of a message M is defined to be h( M ).  A secure one-way hash
  2053. function is a hash function with the following properties:
  2054.  
  2055.     1. For each message M, it is easy to compute h( M ).
  2056.  
  2057.     2. Given M, it is computationally infeasible to compute M' with
  2058.        h( M ) = h( M' ) (secure against forgery).
  2059.  
  2060.     3. It is computationally infeasible to compute M and M' with
  2061.        h( M ) = h( M' ) (secure against collisions).
  2062.  
  2063. For a good, but rather technical, discussion of hash functions, see
  2064. "Contemporary Cryptology. The Science of Information Integrity" edited by
  2065. Gustavus Simmons, IEEE Press, 1992 (ISBN 0-87942-277-7).
  2066.  
  2067. The terms "easy to compute" and "infeasible to compute" can be given more
  2068. precise definitions, but we'll settle for this informal terminology for now.
  2069. Roughly speaking, "easy to compute" means that it will take a tolerable amount
  2070. of time to compute the answer, even on a rather small machine; "infeasible to
  2071. compute" means that it should take eons to find out a particular result, even
  2072. when using millions of computers of the fastest conceivable technology in
  2073. parallel.
  2074.  
  2075. Examples of hash functions include the MD2, MD4, and MD5 hash functions,
  2076. developed by Ron Rivest of RSA Data Security, Inc., which have been (at least
  2077. in the case of MD4 and MD5) placed in the public domain, and the Secure Hash
  2078. Standard SHS, developed by NIST (with significant input from the NSA).  The
  2079. existence of secure one-way hash functions has not been proven, although there
  2080. exist some strong candidates, including MD5 and SHS.
  2081.  
  2082. The reference implementations of the above hashing functions include one
  2083. interesting aspect which makes it possible to use them as encryption functions.
  2084. Since the hashing of a very large amount of data in one sweep is not desirable
  2085. (because all the data would have to be in memory at the time of hashing), most
  2086. hashing algorithms allow data to be hashed incrementally.  This is made
  2087. possible by augmenting the definition of a hash function to include the state
  2088. of the last hashing operation.  In other words, a hash function now has the
  2089. form
  2090.  
  2091.     h : {0,1}^k x {0,1}* --> {0,1}^k,
  2092.  
  2093. where the first argument is the previous hash value, and the hash of a message
  2094. M = ( M1, M2, ..., Mn ) is defined to be
  2095.  
  2096.     h( h( ...( h( h0, M1 ), M2 ), ... ), Mn ).
  2097.  
  2098. (The value of all the h evaluations must not change if the message is broken up
  2099. into blocks of different lengths, but all of the previously mentioned hash
  2100. functions have that property).  Here, h0 is a fixed, known initial value that
  2101. is used in all hashing calculations.
  2102.  
  2103. This is not the way "real" hash functions behave, but it is close enough.  For
  2104. example, the MD5 hashing function has "initialization", "updating", and
  2105. "finalization" parts, where the finalization part appends the number of hashed
  2106. bytes to the message, hashes one final time, and returns the final hash value.
  2107. This means that the hashing "context" must include the number of bytes hashed
  2108. so far, without it being a part of the hash value.  The hash function can be
  2109. said to have "memory".
  2110.  
  2111. If we assume that h is a secure one-way hashing function, we can now use such
  2112. an h as a scrambling device.  For example, if we set E( M ) = h( h0, M ) for
  2113. every message M, M will not be recoverable from E( M ), because h is secure by
  2114. definition.  Another method would be to supply M to any standard MSDOS or UNIX
  2115. utility and use the resulting error message as the ciphertext (remembering that
  2116. a computer is a device for turning input into error messages).  However, there
  2117. are still two problems to be solved before we can use hash functions as
  2118. encryption functions:
  2119.  
  2120.     1. The scrambling process is not controlled by a key.
  2121.  
  2122.     2. The scrambling process is not invertible, so there is no way to
  2123.        decrypt the ciphertext.
  2124.  
  2125. Both problems can be solved by interchanging the roles of hash and data and by
  2126. using CFB mode in the encryption process.  In other words, let K be an
  2127. arbitrarily long key, let M = ( M1, ..., Mn ) be a message, broken up into
  2128. chunks of k bits, let IV be an initialization vector, and set
  2129.  
  2130.     C1 = M1 xor h( IV, K )
  2131.     Ci = Mi xor h( C( i-1 ), K )        for 1 < i <= n.
  2132.  
  2133. This is sent to the recipient, who easily recovers the plaintext by
  2134.  
  2135.     P1 = C1 xor h( IV, K )
  2136.     Pi = Ci xor h( C( i-1 ), K )                for 1 < i <= n,
  2137.  
  2138. since we have
  2139.  
  2140.     P1 = ( M1 xor h( IV, K ) ) xor h( IV, K )
  2141.        = M1 xor ( h( IV, K ) xor h( IV,K ) )    because xor is associative,
  2142.        = M1 xor 0,                              because x xor x = 0,
  2143.        = M1,                                    because x xor 0 = x,
  2144.  
  2145. and similarly for the Pi's.  This method of encryption also offers more
  2146. security than using ECB mode, assuming that this were possible with hash
  2147. functions, since the plaintext is diffused over the entire ciphertext,
  2148. destroying plaintext statistics, and thus foiling straightforward ciphertext
  2149. correlation attacks.
  2150.  
  2151. This method can clearly be used for any hash function which can hash
  2152. incrementally.  Thus, it is a "Meta Method" for turning hash functions into
  2153. encryption functions.  This is called the Message Digest Cipher (MDC) method of
  2154. encryption.  Specific instances of the method have the name of the hash
  2155. function added as a suffix.  For example, the MDC method applied to the MD5
  2156. hash function would be referred to as MDC/MD5.  SFS uses MDC/SHS.
  2157.  
  2158. Having analysed the inner workings of MDC, at least one theoretical attack on
  2159. the algorithm should be mentioned.  There are certain properties of hash
  2160. functions which may make them unsuitable for use as encryption algorithms.  For
  2161. example suppose knowledge of a 160-bit input/output pair to SHS leaks a
  2162. fraction of a bit of information about the data being hashed, maybe a quarter
  2163. of a bit.  This allows a search of 2^159.75 data blocks to find another data
  2164. block that causes the given input-output transformation, and thus finds a
  2165. second message which produces the same hash value.  This problem is not
  2166. significant when SHS is used as a cryptographic hash function, since it only
  2167. reduces the search space by 16% from the full 2^160 possibilities.  However
  2168. when SHS is used for encryption, it may be possible to accumulate these quarter
  2169. bits, so that after 2560 blocks (50K) of known plaintext, enough bits have been
  2170. accumulated to compute the encryption key.  This is because multiple
  2171. input/output pairs are available for a given data block, and each one puts more
  2172. constraints on the block until eventually you have the actual value can be
  2173. determined.
  2174.  
  2175. If a hash function is has the properties given above and no such information is
  2176. leaked, it can serve to create a strong encryption algorithm, but a serious
  2177. weakness in the encryption algorithm is not necessarily a serious weakness in
  2178. the hash function.  To date noone has ever demonstrated such a weakness, and
  2179. there are a number of similar "what if" arguments which can be used against
  2180. most encryption schemes.  For example if it were possible to build a quantum
  2181. computer then it could be used to break many of the most popular public-key
  2182. encryption schemes in use today.  The reason that these schemes aren't being
  2183. abandoned is that it is very unlikely that any computer of this form will be
  2184. built, and that if someone does manage it then the implications will be far
  2185. more serious than just the breaking of a number of encryption schemes.
  2186.  
  2187. Footnote [1]: Most of this analysis was contributed by Stephan Neuhaus,
  2188.               <neuhaus@informatik.uni-kl.de>
  2189.  
  2190. Footnote [2]: This is discussed further in Ralph Merkle's paper "One Way Hash
  2191.               Functions and DES", Crypto '89 Proceedings, Springer-Verlag,
  2192.               1989 (volume 435 of the Lecture Notes in Computer Science
  2193.               series).
  2194.  
  2195.  
  2196. Deletion of SFS Volumes
  2197.  
  2198. Truly deleting data from magnetic media is very difficult.  The problem lies in
  2199. the fact that when data is written to the medium, the write head sets the
  2200. polarity of most, but not all, of the magnetic domains.  This is partially due
  2201. to the inability of the writing device to write in exactly the same location
  2202. each time, and partially due to the variations in media sensitivity and field
  2203. strength over time and among devices.
  2204.  
  2205. In general terms, when a one is written to disk, the media records a one, and
  2206. when a zero is written, the media records a zero.  However the actual effect is
  2207. closer to obtaining something like 0.95 when a zero is overwritten with a one,
  2208. and 1.05 when a one is overwritten with a one.  Normal disk circuitry is set up
  2209. so that both these values are read as ones, but using specialized circuitry it
  2210. is possible to work out what previous `layers' contained (in fact on some
  2211. systems it may be possible to recover previous data with a simple software
  2212. modification to the hardware control code).
  2213.  
  2214. This problem is further complicated by the fact that the heads might not pass
  2215. exactly over the same track position when data is rewritten, leaving a trace of
  2216. the old data still intact.  Current-generation drives reduce this problem
  2217. somewhat as track and linear densities have now become so high that the
  2218. traditional optical methods of extracting information from the disk platters
  2219. has become much more difficult, and in some cases impossible, as the linear bit
  2220. cell is below the optical diffraction limit for visible light.  While some data
  2221. patterns can still be discerned, recognizing others would be limited to some
  2222. subset of patterns.
  2223.  
  2224. Despite this small respite, when all the above factors are combined it turns
  2225. out that each track on a piece of media contains an image of everything ever
  2226. written to it, but that the contribution from each `layer' gets progressively
  2227. smaller the further back it was made.  Using techniques like low energy
  2228. electron scattering, ferrofluid with optical tracers, or related methods,
  2229. followed by the same signal-processing technology which is used to clean up
  2230. satellite images, low-level recorded speech, and other data, it is possible to
  2231. recover previous data with a remarkable degree of accuracy, to a level limited
  2232. only by the sensitivity of the equipment and the amount of expertise of the
  2233. organisation attempting the recovery.  Intelligence organisations have a *lot*
  2234. of expertise in this field.
  2235.  
  2236. The basic concept behind the overwriting scheme used by SFS is to flip each
  2237. magnetic domain on the disk back and forth as much as possible (this is the
  2238. basic idea behind degaussing - magnetic media are limited in their ability to
  2239. store high-frequency oscillations, so we try to flip the bits as rapidly as
  2240. possible).  This means that the disk head should be run at the highest possible
  2241. frequency, and the same pattern should not be written twice in a row.  If the
  2242. data was encoded directly, that would mean a an alternating pattern of ones and
  2243. zeroes.  However, disks always use a NRZI encoding scheme in which a 1 bit
  2244. signifies an inversion, making the desired pattern a series of one bits.  This
  2245. leads to a further complication as all disks use some form of run-length
  2246. limited (RLL) encoding, so that the adjacent ones won't be written.  This
  2247. encoding is used so that transitions aren't placed too closely together, or too
  2248. far apart, which would mean the drive would lose track of where it was in the
  2249. data.
  2250.  
  2251. The basic limitation on disks is the proximity of 1 bits.  Floppies (which are
  2252. a more primitive form of the technology used in hard disks) like to keep the 1
  2253. bits 4us apart.  However they can't be kept too far apart or the read clock
  2254. loses synchronisation.  This "too far" figure depends a lot on the technology
  2255. in the drive, it doesn't depend on the magnetic media much (unlike the "too
  2256. close" figure, which depends a lot on the media involved).  The first
  2257. single-density encoding wrote one user data bit, then one "1" clock bit, taking
  2258. a total of 8us.  This was called FM, since a 1 bit was encoded as two
  2259. transitions (1 wavelength) per 8 us, while a 0 bit was encoded as one
  2260. transition (1/2 wavelength).
  2261.  
  2262. Then it was discovered that it was possible to have two 0 bits between adjacent
  2263. 1s.  The resulting encoding of 4 bits into 5 was called group code recording
  2264. (GCR) which was (0,2) RLL.  This allowed 4 user data bits to be written in
  2265. 5 * 4us = 20 us, for an effective time per user bit of 5 us, which was a big
  2266. improvement over 8 us.
  2267.  
  2268. But GCR encoding was somewhat complex.  A different approach was taken in
  2269. modified FM (MFM), which suppressed the 1 clock bit except between adjacent
  2270. 0's.  Thus, 0000 turned into 0(1)0(1)0(1)0 (where the ()s are the inserted
  2271. clock bits), 1111 turned into 1(0)1(0)1(0)1, and 1010 turned into
  2272. 1(0)0(0)1(0)0.  The maximum time between 1 bits was now three 0 bits.  However,
  2273. there was at least one 0 bit, so it became possible to clock the bits at
  2274. 2us/bit and not have more than one 1 bit every 4us.  This achieved one user bit
  2275. per 4 us, a result which was better than GCR and obtainable with simpler
  2276. circuitry.  As can be seen, the effective data rate depends on the bit rate
  2277. (which has been 4 us, 4 us and 2 us in these examples) and the encoding rate, a
  2278. measure of the encoding efficiency. The encoding rates have been 1/2, 4/5 and
  2279. 1/2.
  2280.  
  2281. There is a (2,7) RLL code with rate 1/2, meaning that 1 user bit goes to 2
  2282. encoded bits (although the mapping involves multi-bit groups and is somewhat
  2283. complex), but there are always at least two 0 bits between 1 bits, so 1 bits
  2284. happen at most every 3 bit times.  This allows the clock to be reduced to
  2285. 1.3333 us (this 2/1.33333 = 6/4 = 3/2 is the source of the added capacity gain
  2286. of RLL hard drive controllers over equivalent MFM controllers).  The time per
  2287. user bit is now 2.6666 = 2 2/3 us.
  2288.  
  2289. However, the faster clock is finicky.  It is also possible to use a (1,7) RLL
  2290. encoding.  Since this is (1,x), the clock rate is 2 us/bit, but the encoding
  2291. efficiency improves from 1/2 to 2/3.  This allows 2 effective user bits per 6
  2292. us, or 3 us per user bit.  For hard drives, it is easier to increase the clock
  2293. rate by an extra 9/8 than to fiddle with a clock 50% faster, so this is very
  2294. popular with more recent disk drives.
  2295.  
  2296. The three most common RLL codes are (1,3) RLL (usually known as MFM), (2,7) RLL
  2297. (the original "RLL" format), and (1,7) RLL (which is popular in newer drives).
  2298. The origins of these codes are explained in more details below.  Fortunately,
  2299. each of these three have commonly-used encoding tables.  A knowledge of these
  2300. tables can be used to design overwrite patterns with lots of transitions after
  2301. being encoded with whatever encoding technique the drive uses.
  2302.  
  2303. For MFM, the patterns to write to produce this are 0000 and 1111.  So a couple
  2304. of rounds of this should be included in the overwrite pattern. MFM drives are
  2305. the oldest, lowest-density drives around (this is especially true for the
  2306. very-low-density floppy drives).  As such, they're the easiest to recover data
  2307. from with modern equipment and we need to take the most care with them.
  2308.  
  2309. For (1,7) RLL, the patterns to write are 0011 and 1100, or 0x33 and 0xCC when
  2310. expressed as bytes.  To provide some security against bit misalignment, the
  2311. values 0x99 and 0x66 should be included as well (although drive manufacturers
  2312. like to keep things byte-aligned, so this sort of bit misalignment is unlikely
  2313. to happen).
  2314.  
  2315. For (2,7) RLL drives, three patterns are necessary, and the problem of byte
  2316. endianness question rears its head.  The previous two cases are not
  2317. significantly affected by shifting the bytes around, but this one is.
  2318. Fortunately, thanks to the strong influence of IBM mainframe drives, everything
  2319. seems to be uniformly big-endian within bytes (that is, the most significant
  2320. bit is written to the disk first).
  2321.  
  2322. For (2,7) RLL using the standard tables:
  2323.  
  2324.   10   -> 0100
  2325.   11   -> 1000
  2326.   000  -> 00100
  2327.   010  -> 100100
  2328.   011  -> 001000
  2329.   0010 -> 00100100
  2330.   0011 -> 00001000
  2331.  
  2332. the bit patterns 100100100..., 010010010... and 001001001... will encode into
  2333. the maximum-frequency encoded strings 010010010010... (0x49, 0x24, 0x92),
  2334. 100100100100... (0x92, 0x49, 0x24), and 001001001001.... (0x24, 0x92, 0x49).
  2335. Writing all three of these patterns will cover all the bases.
  2336.  
  2337. For the latest crop of high-density drives which use methods like Partial-
  2338. Response Maximum-Likelihood (PRML) methods which may be roughly equated to the
  2339. trellis encoding done by V.32 modems in that it is effective but
  2340. computationally expensive, all we can do is write a variety of random patterns,
  2341. because the processing inside the drive is too complex to second-guess.
  2342. Fortunately, these drives push the limits of the magnetic media much more than
  2343. the old MFM drives ever did by encoding data with much smaller magnetic
  2344. domains, closer to the physical capacity of the magnetic media.  If these
  2345. drives require sophisticated signal processing just to read the most recently
  2346. written data, reading overwritten layers is also correspondingly more
  2347. difficult.  A good scrubbing with random data will do about as well as can be
  2348. expected.
  2349.  
  2350. To deal with all these types of drives in one overwrite pattern, SFS uses the
  2351. following sequence of 30 consecutive writes to erase data:
  2352.  
  2353.    1.  Random
  2354.    2.  0000..., MFM encoded to 01010101...
  2355.    3.  1111..., MFM encoded to 10101010...
  2356.    4.  Random
  2357.    5.  010010..., (2,7) RLL encoded to 100100100100...
  2358.    6.  100100..., (2,7) RLL encoded to 010010010010...
  2359.    7.  001001..., (2,7) RLL encoded to 001001001001...
  2360.    8.  Random
  2361.    9.  00110011..., (1,7) RLL encoded to 010101010101...
  2362.   10.  11001100..., (1,7) RLL encoded to 101010101010...
  2363.   11.  01100110..., (1,7) misaligned RLL encoded to 010101010101...
  2364.   12.  10011001..., (1,7) misaligned RLL encoded to 101010101010...
  2365.   13.  Random
  2366.   14.  1111..., MFM encoded to 10101010...
  2367.   15.  0000..., MFM encoded to 01010101...
  2368.   16.  Random
  2369.   17.  001001..., (2,7) RLL encoded to 001001001001...
  2370.   18.  100100..., (2,7) RLL encoded to 010010010010...
  2371.   19.  010010..., (2,7) RLL encoded to 100100100100...
  2372.   20.  Random
  2373.   21.  11001100..., (1,7) RLL encoded to 101010101010...
  2374.   22.  00110011..., (1,7) RLL encoded to 010101010101...
  2375.   23.  10011001..., (1,7) misaligned RLL encoded to 101010101010...
  2376.   24.  01100110..., (1,7) misaligned RLL encoded to 010101010101...
  2377.   25.  Random
  2378.   26.  0000..., MFM encoded to 01010101...
  2379.   27.  1111..., MFM encoded to 10101010...
  2380.   28.  Random
  2381.   29.  Random
  2382.   30.  Random
  2383.  
  2384. All patterns are repeated twice, once in each order, and MFM is repeated three
  2385. times, because MFM drives are generally the lowest density, and thus
  2386. particularly easy to examine.  If the device being written to supports cacheing
  2387. or buffering of data, SFS will attempt to disable the buffering of data to
  2388. ensure physical disk writes are performed (for example by setting the Force
  2389. Unit Access bit during SCSI-2 Group 1 write commands).
  2390.  
  2391. There is a commonly-held belief that there is a US government standard for
  2392. declassifying magnetic media which simply involves overwriting data on it three
  2393. times.  There are in fact a number of standards[1] which contain simple phrases
  2394. such as "Magnetic disks, drums, and other similar rigid storage devices shall
  2395. be sanitized by overwriting all storage locations with any character, then the
  2396. complement of the character (e.g., binary ones and binary zeros) alternately a
  2397. minimum of three times".  However this simple description is usually
  2398. reinterpreted by the appropriate government agencies to a level which often
  2399. makes physical destruction of the media and its replacement with new media
  2400. preferable to attempting any declassification by overwriting the data (the
  2401. (classified) standards for truly declassifying magnetic media probably involve
  2402. concentrated acid, furnaces, belt sanders, or any combination of the above[2]).
  2403.  
  2404. The use of such extreme measures is necessary not only because data recovery
  2405. from the actual tracks itself may (with some effort) be possible, but because
  2406. of factors like intelligent drives which keep so-called "alternative cylinders"
  2407. on a disk free to allow dynamic re-allocation of data to one of these tracks in
  2408. case a disk block develops errors.  The original block is no longer accessible
  2409. through any sort of normal access mechanism, and the data on it can't be
  2410. destroyed without going through some unusual contortions which tend to be
  2411. highly hardware-dependant.  Other complications include the use of journaling
  2412. filesystems which keep track of previous generations of data, and disk
  2413. compression software or hardware which will compress a simple repeated
  2414. overwrite pattern to nothing and leave the original data intact on the disk[3].
  2415. Therefore if "overwriting all storage locations" is interpreted to mean
  2416. "exposing the entire reading surface to a magnetic field having a strength at
  2417. the recording surface greater than the field intensity at which it was
  2418. recorded", the method does have merit.  Unfortunately it is virtually
  2419. impossible to get at all storage locations, and simple-minded methods such as
  2420. trying to write patterns to the storage allocated to a file in order to erase
  2421. it don't even come close to this target.  The overwrite method used by SFS does
  2422. come reasonably close by attempting to create a rapidly-fluctuating magnetic
  2423. field over all physically accessible sectors which make up a disk volume,
  2424. creating the same effect as a degaussing tool used to erase magnetic fields.
  2425.  
  2426. Another consideration which needs to be taken into account when trying to erase
  2427. data through software is that drives conforming to some of the higher-level
  2428. protocols such as the various SCSI standards are relatively free to interpret
  2429. commands sent to them in whichever way they choose (as long as they still
  2430. conform to the SCSI specification).  Thus some drives, if sent a FORMAT UNIT
  2431. command may return immediately without performing any action, may simply
  2432. perform a read test on the entire disk (the most common option), or may
  2433. actually write data to the disk[4][5].  This is rather common among newer
  2434. drives which can't directly be low-level formatted, unlike older ST-412 and
  2435. ST-506 MFM or RLL drives.  For example trying to format an IDE drive generally
  2436. has little effect - a low-level format generally isn't possible, and the
  2437. standard DOS `format' command simply writes a boot record, FAT, and root
  2438. directory, performs a quick scan for bad sectors, and exits.
  2439.  
  2440. Therefore if the data is very sensitive and is stored on floppy disk, it can
  2441. best be destroyed by removing the media from the disk liner and burning it.
  2442. Disks are relatively cheap, and can easily be replaced.  Permanently destroying
  2443. data on fixed disks is less simple, but the multiple-overwrite option used by
  2444. SFS at least makes it quite challenging (and expensive) to recover any
  2445. information.
  2446.  
  2447. Footnote [1]: Among others there is the Department of Defense standard DoD
  2448.               5200.28-M, Army standard AR 380-19, Navy standards OPNAVINST
  2449.               5510.1H and NAVSO P-5239-26, Air Force standard AFSSI-5020, and
  2450.               Department of Energy standard DOE 5637.1.
  2451.  
  2452. Footnote [2]: The UK Ministry of Defence grinds down disk platters and then
  2453.               supposedly stores the (still-classified) dust for a decade or
  2454.               more.  Rumours that they remove programmers brains for storage in
  2455.               order to erase the classified information they contain are
  2456.               probably unfounded.
  2457.  
  2458. Footnote [3]: From a posting to the usenet alt.security newsgroup on 1 August
  2459.               1994, article-ID <31c75s$pa8@search01.news.aol.com>: "I got fired
  2460.               from my job and told to clean my desk, so I immediately went to
  2461.               my office and ran Norton WipeDisk on my hard drive, which
  2462.               contained much of the work I had done and also my contact list,
  2463.               letters, games, and so on.  Unfortunately, I had DoubleSpaced it
  2464.               and the files were easily recovered".
  2465.  
  2466. Footnote [4]: Again it may be possible to bypass this using highly hardware-
  2467.               specific methods.  For example Quantum SCSI drives manufactured a
  2468.               few years ago could be forced to write data to disk during a
  2469.               format by changing the sector filler byte before the format
  2470.               command was issued.
  2471.  
  2472. Footnote [5]: The SCSI-2 standard includes an initialization pattern (IP)
  2473.               option for the FORMAT UNIT command (Section 8.2.1.2), however it
  2474.               is not clear how well this is supported by existing drives.
  2475.