home *** CD-ROM | disk | FTP | other *** search
/ The Hacker's Encyclopedia 1998 / hackers_encyclopedia.iso / zines / phrack2 / p49_10.txt < prev    next >
Encoding:
Text File  |  2003-06-11  |  5.2 KB  |  90 lines

  1.                               .oO Phrack 49 Oo.
  2.  
  3.                         Volume Seven, Issue Forty-Nine
  4.  
  5.                                   10 of 16
  6.   
  7.     
  8.               A Steganography Implementation Improvement Proposal
  9.  
  10.                 by: cjm1@concentric.net 
  11.  
  12. [     For those of you who do not know, steganography is cryptographic
  13. technique that simply hides messages inside of messages.  The sender composes
  14. an innocuous message and then, using one of many tactics, injects the secret
  15. message into it.  Some techniques involve: invisible inks, character 
  16. distortion, handwriting differences, word/letter frequency doping, bit 
  17. flipping, etc...  The method the author discusses hinges upon a well known
  18. steganographic implementation, low-order bit flipping in graphic images. -d9 ]
  19.  
  20.     Steganography is a technique for hiding data in other data.  The 
  21. general method is to flip bits so that reading the low-order bit of each of
  22. 8-bytes gets one a character.  This allows one to use a picture or a sound
  23. file and hide data, resulting in a small bit of hopefully unnoticeable noise 
  24. in the data and a safely hidden cache of data that can later be extracted.
  25. This paper details a method for making steganographically hidden data more
  26. safe, by using pseudo-random dispersion.
  27.     
  28.     Ordinarily, if someone suspects that you have data hidden in, say, a
  29. GIF file, they can simply run the appropriate extractor and find the data.  If
  30. the data is not encrypted, it will be plain for anyone to see.   This can be
  31. ameliorated by using a simple password protection scheme, hiding the password
  32. in the GIF as a header, encrypting it first with itself.  If someone does not
  33. know the password, they cannot extract the data.  This is of course reasonably
  34. safe, depending on the encryption scheme used, and I recommend it.  But, the
  35. hidden data can be made even safer.
  36.     
  37.     Pseudo-random dispersion works by hiding a password, and a seed for a
  38. random-number-generator in the encrypted header.  then, a random number of bytes
  39. are passed by, before a low-order bit is flipped. 
  40.     
  41.     To do this, one must first calculate how many bytes a bit can take up 
  42. for itself.  For instance, to hide an 800 character message in a GIF would 
  43. mean each character needs 8 bytes (8 bits per character, 1 byte per low-order 
  44. bit), so you need 6,400 bytes of data to hide the message in, 8 bytes per 
  45. character.  Let's say we have a GIF that is 10 times this size: 64,000 bytes.
  46. Thus we have 80 bytes per character to hide data in.  Since each bit takes a 
  47. byte, we have 10 bytes per bit to hide data in!  Therefore, if we take a 
  48. pseudo-random number between 1 and 10, and use that byte to hide our low-order
  49. bit in, we have achieved a message dispersed through the GIF in a pseudo-random
  50. fashion, much harder to extract.  A message in which each byte has a bit which
  51. is significant to the steganographically hidden message can be extracted with 
  52. ease relative to a message in which there are 10 possible bytes for each bit
  53. of each character.  The later is exponentially harder to extract, given no
  54. esoteric knowledge.
  55.     
  56.     A slight improvement can be made to this algorithm.  By re-calculating
  57. the number of available bytes left for each bit after each bit is hidden, the 
  58. data is dispersed more evenly throughout the file, instead of being bunched up
  59. at the start, which would be a normal occurrence.  If you use pseudo-random
  60. number generator, picking numbers from 0-9, over time, the values will smooth 
  61. to 5.  This will cause the hidden message to be clustered at the beginning
  62. of the GIF.  By re-calculating each time the number of available bytes left
  63. we spread the data out throughout the file, with the added bonus that later 
  64. bits will be further spread apart than earlier ones, resulting in possible
  65. search spaces of 20, 30, 100, or even 1,000 possible bytes per bit.  This too
  66. serves to make the data much harder to extract.
  67.     
  68.     I recommend a header large enough for an 8 character ASCII password,
  69. an integral random-number seed, an integral version number, and an place 
  70. holder left for future uses.  The version number allows us to tweak the 
  71. algorithm and still be able to be compatible with past versions of the 
  72. program.  The header should be encrypted and undispersed (ie: 1 byte per 
  73. bit of data) since we haven't seeded the random-number generator yet for 
  74. dispersion purposes.
  75.     
  76.     It is useful to make the extractor in such a way that it always 
  77. extracts something, regardless of the password being correct or not.  Doing
  78. this means that it is impossible to tell if you have guessed a correct password
  79. and gotten encrypted data out, or merely gotten out garbage that looks like
  80. encrypted data.  Use of a password can also be made optional, so that none is
  81. necessary for extraction.  A simple default password can be used in these 
  82. cases.  When hiding encrypted data, there is no difference to the naked 
  83. eye between what is extracted and what is garbage, so no password is 
  84. strictly necessary.  This means no password has to be remembered, or 
  85. transmitted to other parties.  A third party cannot tell if a real password 
  86. has been used or not.  It is important for safety purposes to not hide the 
  87. default password in the header if no password is used.  Otherwise, a simple 
  88. match can be made by anyone who knows the default password.
  89.  
  90.