README 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. mfterm is a terminal interface for working with Mifare Classic tags.
  2. Tab completion on commands is available. Also, commands that have file
  3. name arguments provide tab completion on files. There is also a
  4. command history, like in most normal shells.
  5. Working with the mfterm program there are a few state variables that
  6. are used.
  7. Current Tag
  8. -----------
  9. The "current tag" is populated with the 'load' or 'read' commands. The
  10. 'read' command will read data from a physical tag and requires the
  11. "current keys" to be set to the keys of the tag. Clear the "current
  12. tag" by using the 'clear' command.
  13. Display the "current tag" by using the 'print' command. The keys of
  14. the "current tag" are displayed with the 'print keys' command. Note:
  15. the tag keys could be different from the "current keys" displayed by
  16. the 'keys print' command.
  17. The data of the "current tag" can be manipulated with the 'set'
  18. command.
  19. The "current tag" can be persisted by writing it to a file with the
  20. 'save' command. It can also be written to a physical tag with the
  21. 'write' command. For the 'write' command to succeed, the "current
  22. keys" have to be set to appropriate values. The 'write unlocked'
  23. command can be used to write to block 0 on some 1k pirate cards.
  24. If you are reading or loading a 1k tag, the mfterm program will still
  25. use a full 4k tag to represent it. The last 3k will be all
  26. zeroes. This is in analogy with the other libnfc tools.
  27. Current Keys
  28. ------------
  29. The "current keys" are used to authenticate when performing operations
  30. on a physical tag. They can be displayed using the 'keys'
  31. command. Clear the "current keys" by using the 'keys clear' command.
  32. The keys are stored just like a tag in a file using the 'keys save',
  33. but with all the data fields except the sector trailers cleared. The
  34. keys can be loaded from a file, either a real tag dump or a key tag
  35. dump, with the 'keys load' command.
  36. The "current keys" can be set to match the "current tag" by using the
  37. 'keys import' command. It is also possible to manually set a key using
  38. the 'keys set' command.
  39. Use the 'keys test' command to test if the "current keys" can be used
  40. to authenticate with a physical tag.
  41. Dictionary
  42. ----------
  43. A key dictionary can be imported from a file using the 'dict load'
  44. command. This dictionary can then be used to perform a dictionary
  45. attack on the sectors of a tag by using the 'dict attack' command.
  46. The format of the dictionary file is simple. One key (6 bytes, 12 hex
  47. characters) per line and # is a comment.
  48. Performing 'dict load' on several files will produce a dictionary that
  49. is the union of those files. Duplicates will be removed.
  50. To list all the keys in the dictionary, use the command 'dict'. To
  51. clear the dictionary use 'dict clear'.
  52. Other commands
  53. --------------
  54. Quit the mfterm program by issuing the 'quit' command.
  55. Help is available by writing 'help'
  56. MAC Computation
  57. ---------------
  58. The function 'mac compute' is used for computing DES MACs (message
  59. authentication codes). They require a 64 bit key that can be set using
  60. the command 'mac key'. The same command, without arguments, is used to
  61. display the current key.
  62. The input to the DES MAC is UID + 14 left most bytes of the specified
  63. block.
  64. Using the command 'mac update' is shorthand for a MAC computation and
  65. then setting the MAC of the same block.
  66. Specification Files
  67. -------------------
  68. A specification file defines names for parts of the tag data. See the
  69. file mfc-spec.txt for a sample specification.
  70. Specification files are loaded with the command 'spec load'. They can
  71. be cleared with 'spec clear'. To display the data structure loaded use
  72. the command 'spec'.
  73. Once a specification has been loaded, it can be used to access the
  74. data in the tag by using a specification path. In the sample
  75. specification, the path: '.sector_0.block_0.atqa', when entered in the
  76. terminal, will display the two bytes of data starting with byte 6.
  77. Building mfterm
  78. ---------------
  79. Standard: ./configure; make; make install
  80. See INSTALL file for details.
  81. WARNING:
  82. --------
  83. The mfterm software is neither thoroughly tested nor widely used. It
  84. likely contains a number of serious bugs that can be exploited to
  85. compromise your computer. Do NOT run the mfterm software as a
  86. privileged user (e.g. root), and ONLY load tag, dictionary and
  87. specification files that you get from people you trust.