home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 8 Other / 08-Other.zip / mandsteg.zip / README < prev    next >
Text File  |  1994-03-12  |  10KB  |  232 lines

  1.  
  2.  
  3.         MandelSteg V1.0 and GIFExtract V1.0
  4.         -----------------------------------
  5.  
  6. These two programs allow you to hide confidential data in fractal GIF images,
  7. giving an increased level of security compared to sending PGP-encrypted
  8. email over the Internet. MandelSteg will create a Mandelbrot image (though
  9. it could easily be modified to produce other fractals), storing your data
  10. in the specified bit of the image pixels, after which GIFExtract can be
  11. used by the recipient to extract that bit-plane of the image.
  12.  
  13. MandelSteg is not intended to replace the standardised methods of using
  14. encryption (e.g. ASCII-armoured PGP email) ; in an ideal world we would
  15. all be able to send openly encrypted mail or files to each other with no 
  16. fear of reprisals, however there are often cases when this is not possible,
  17. either because the local government does not approve of encrypted 
  18. communication, or perhaps because you are working for a company that
  19. does not allow encrypted email but doesn't care about Mandelbrot
  20. GIFs. This is where steganography can come into play.
  21.  
  22. You will probably find that you also need to get hold of a copy of
  23. an interactive Mandelbrot viewer in order to determine suitable
  24. coordinates to use for images. There are numerous such viewers available
  25. on the Internet and BBS systems (e.g. xmandel).
  26.  
  27.  
  28. MandelSteg - 'Mandelbrot Steganography'
  29. ---------------------------------------
  30.  
  31. MandelSteg has numerous modes of operation, depending on the level of
  32. security you desire. With no command line options specified it will
  33. simply generate a 640x480 GIF of the default section of the set, and
  34. send it to stdout. With the -c option it will calculate how many bytes
  35. can be stored in the image and with -e will take the data fed to stdin
  36. and hide it in the image (specify a file name after the -e to write it
  37. to a file), and pad out the data with random bytes if neccesary if
  38. -r was specified. 
  39.  
  40. For the lowest security level, the data will simply be stored in the specified
  41. bit of each pixel, and a 128-color palette created such that the pixel looks
  42. the same regardless of whether there is data stored in it or not. This will
  43. be sufficient to survive a cursory examination, but will be obvious to anyone
  44. versed in the arts of steganography - in particular replacing the supplied
  45. palette for the image with another will show up the data bits hidden in areas
  46. of solid color.
  47.  
  48. To avoid this problem, you should specify the -ns flag, which will only store
  49. data in areas of non-solid color (note that this can greatly decrease the
  50. amount of data that you can store in the image). Another indication of a
  51. steg-ed image is the duplicated 128-color palette, which can be replaced
  52. with a 256-color palette with the -fp flag. Obviously if you specify -fp
  53. and don't specify -ns, you will produce a readily apparent steg-ed image.
  54.  
  55. If you don't have enough space for your data in the image, you can simply
  56. increase the size of the image by using the -sz flag, followed by the width
  57. and height in pixels. Alternatively, you can select a different area of the
  58. mandelbrot set by using -md followed by the start x, start y, width and
  59. height, specified with floating-point values.
  60.  
  61. Finally, you can specify the bit to store the data in using -b followed
  62. by the bit number, otherwise the program defaults to bit seven. Bit seven 
  63. gives the best performance, but bit zero should give the most security. You
  64. can also specify that a number of bytes in the image should be missed out 
  65. before the encrypted data with the -bp option, followed by the number of 
  66. bytes to miss out. If the -r option is specified, then random data will be
  67. placed in these bytes, and also appended to the input data to completely
  68. fill the specified bitplane.
  69.  
  70.  
  71. Compilation:
  72. ------------
  73.  
  74. On a BSD unix system you should be able to simply extract the source and
  75. run make to generate the executables. On a System V version of Unix you
  76. will need to edit the makefile to use one of the 'CFLAGS = ... -DSYSV ...'
  77. lines instead of the default. If you have plenty of memory, you can undefine 
  78. LOW_MEM, which will improve performance slightly.
  79.  
  80. On an MS-DOS machine with the Microsoft C compiler, simply execute
  81. COMP.BAT. This batch file will compile and link the source to build
  82. the executables. Sorry, but I was too lazy to create a proper DOS
  83. makefile !
  84.  
  85.  
  86. Examples of use:
  87. ----------------
  88.  
  89. [ Note : Due to file system limits, on MS-DOS the executable names are
  90.   mandsteg and gifextr rather than mandelsteg and gifextract. Also note
  91.   that unless you have an 80x87 coprocessor or are running on a 486DX+
  92.   processor, mandsteg will run VERY slowly due to the number of floating
  93.   point operations required ! ]
  94.  
  95. Store file in 640x480 mandel.gif :
  96.  
  97. mandelsteg -e mandel.gif < file.dat
  98.  
  99. Store file in 400x400 mandel.gif, using non-standard co-ordinates :
  100.  
  101. mandelsteg -sz 400 400 -md -0.5505 -0.5505 0.0001 0.0001 -e mandel.gif 
  102.     < file.dat
  103.  
  104. Encrypt file with PGP, strip headers with stealth, and store in bit 0 of 
  105. mandel.gif with non-standard coordinates, using 256-color palette and not 
  106. storing in solid colors, with 23 byte random prefix :
  107.  
  108. pgp -ef < secrets.dat | stealth | mandelsteg -sz 400 400 -md -1.0 -1.0 2.0 
  109.     2.0 -b 0 -ns -fp -bp 23 -r -e mandel.gif
  110.  
  111. Test non-standard coordinates for available space :
  112.  
  113. mandelsteg -ns -sz 400 400 -md -0.5505 -0.5505 0.0001 0.0001 -c > /dev/null
  114.  
  115. Generate image containing random data to annoy cryptanalysts :
  116.  
  117. mandelsteg -fp -r -ns -e annoying.gif < /dev/null
  118.  
  119.  
  120. Error messages:
  121. ---------------
  122.  
  123. The only likely error messages will indicate either invalid commands, or
  124. that the input data has been truncated (i.e. not all the data that was
  125. piped into the program could be stored in the GIF file). In the latter
  126. case, you should create a larger file to store the data.
  127.  
  128.  
  129. Security:
  130. ---------
  131.  
  132. Well, frankly, it's not that secure, even with -ns -fp -b ? -bp ? specified 
  133. on the command line. There are several main reasons :
  134.  
  135. 1. In essence, mandelsteg can be regarded as a one-time pad cipher using the
  136.    mandelbrot image as the pad. As a result, the 'key' to this cipher would
  137.    be the coordinates and size of the area you've generated, as with that
  138.    data the cryptanalyst would be able to generate the 'real' image and compare
  139.    it to the steg-ed image to find the data. Two important things to realise
  140.    here as a result are that a) you should *never* use the default coordinates
  141.    for secret data, and b) you should never use the same coordinates twice.
  142.  
  143. 2. Obviously, any cryptanalyst out there can just run 'gifextract' on the 
  144.    image, and your data will come out ! It may take sixteen or more attempts 
  145.    using the different bit values, -bp values and -ns options, but it will 
  146.    extract a valid copy of the data. And if the data has a PGP header or 
  147.    something, well, they've got you. This can be hindered by either using 
  148.    'Stealth' to produce headerless data, or by generating large numbers
  149.    of images containing random data to provide a cover for the real data.
  150.  
  151. 3. Typically, a mandelbrot image consists of about 55 % of one bits and
  152.    45 % of zero bits. If you have replaced this with a PGP-encrypted
  153.    messge, these frequencies will be more like 50% each. If you use
  154.    an image much larger than neccesary, and a large -bp value, this will be 
  155.    somewhat disguised.
  156.  
  157. 4. The standard random() function is used to generate random padding, and
  158.    the distribution of bits in the output wil therefore probably be
  159.    different to that expected for encrypted data. If you are attempting
  160.    to get data past a serious adversary, you should replace this with 
  161.    a cryptographically strong random number generator such as the
  162.    idea_rand() function used in PGP.
  163.  
  164. In most cases, none of these should be a real problem, as MandelSteg
  165. is not intended to provide foolproof security against cryptanalysis, but
  166. primarily to prevent cryptanalysis by disguising the fact that you are
  167. sending encrypted messages at all.
  168.  
  169. In addition, YOU SHOULD ALWAYS VIEW THE IMAGE BEFORE SENDING IN CASE YOUR
  170. CHOICE OF PARAMETERS HAS PRODUCED UNEXPECTED ARTIFACTS IN THE OUTPUT
  171. IMAGE !!!!!!!! Excuse the shouting, but ths is important... 8-). I
  172. haven't seen any strange results yet produced by the algorithm, but you 
  173. only need to accidentally miss out a command line parameter once and your 
  174. use of steganography will be obvious to anyone examining the image.
  175.  
  176.  
  177. GIFExtract
  178. ----------
  179.  
  180. GIFExtract is a very simple program, which simply extracts the specified
  181. bitplane from an image and sends the data to stdout. The program defaults
  182. to extracting bit 7 of each pixel, but the bit can be specified with the
  183. -b command line option, with -ns it will only extract data from non-solid 
  184. areas, -bp can be used to ignore the first specified number of bytes 
  185. extracted, and -a to analyse the distribution of zero and one bits in the
  186. image.
  187.  
  188.  
  189. Examples of use
  190. ---------------
  191.  
  192. Extract bit-plane 4 from foo.gif into secrets.pgp :
  193.  
  194. gifextract -b 4 foo.gif > secrets.pgp
  195.  
  196. or
  197.  
  198. gifextract -b 4 < foo.gif > secrets.pgp
  199.  
  200. Analyse bit plane 1 of foo.gif for one bit and zero bit frequencies prior
  201. to using it for steganography :
  202.  
  203. gifextract -a -b 1 foo.gif
  204.  
  205. Extract the secrets.dat file that was used in the mandelsteg example above,
  206. if your PGP key id is 23ffff :
  207.  
  208. gifextract -b 0 -bp 23 -ns mandel.gif | stealth -a 0x23ffff | 
  209.     pgp -f > secrets.dat
  210.  
  211.  
  212. Error messages
  213. --------------
  214.  
  215. The only likely error messages will be due to either failure to allocate
  216. the required memory for GIF decompression, or failure to open the input
  217. file.
  218.  
  219.  
  220. DISTRIBUTION NOTES
  221. ------------------
  222.  
  223. Either of these programs can be freely distributed, however you must
  224. take into account any prevailing cryptography import and export 
  225. regulations in international transfers. This program was written
  226. outside the US, and as such copies should be available from European
  227. ftp sites as well.
  228.  
  229.  
  230.                         Henry Hastur
  231.  
  232.