home *** CD-ROM | disk | FTP | other *** search
/ The Hacker's Encyclopedia 1998 / hackers_encyclopedia.iso / pc / crack / crack1.ibm < prev    next >
Encoding:
Text File  |  2003-06-11  |  8.0 KB  |  251 lines

  1. ****************************************
  2. *     B U C K A R O O  B A N Z A I     *
  3. *         aka the Reset Vector         *
  4. *                                      *
  5. *              presents                *
  6. *                                      *
  7. *        Cracking On the IBMpc         *
  8. *               Part I                 *
  9. *                                      *
  10. ****************************************
  11.  
  12. Introduction
  13. ------------
  14.   For years, I have seen cracking
  15. tutorials for the APPLE computers, but
  16. never have I seen one for the PC.  I
  17. have decided to try to write this series
  18. to help that pirate move up a level to a
  19. crackest.
  20.  
  21.   In this part, I will cover what
  22. happens with INT 13 and how most copy
  23. protection schemes will use it.  I
  24. strongly suggest a knowledge of
  25. Assembler (M/L) and how to use DEBUG.
  26. These will be an important figure in
  27. cracking anything.
  28.  
  29. INT-13 - An overview
  30. --------------------
  31.   Many copy protection schemes use the
  32. disk interrupt (INT-13).  INT-13 is
  33. often use to either try to read in a
  34. illegaly formated track/sector or to
  35. write/format a track/sector that has
  36. been damaged in some way.
  37.   INT-13 is called like any normal
  38. interupt with the assembler command
  39. INT 13 (CD 13).  [AH] is used to select
  40. which command to be used, with most of
  41. the other registers used for data.
  42.  
  43. INT-13 Cracking Collage
  44. -----------------------
  45.   Although, INT-13 is used in almost all
  46. protection schemes, the easiest to crack
  47. is the DOS file.  Now the protected
  48. program might use INT-13 to load some
  49. other data from a normal track/sector on
  50. a disk, so it is important to determine
  51. which tracks/sectors are inportant to
  52. the protection scheme.  I have found the
  53. best way to do this is to use
  54. LOCKSMITH/pc (what, you don't have LS.
  55. Contact your local pirate for it.)
  56.   Use LS to to analyze the diskette.
  57. Write down any track/sector that seems
  58. abnormal.  These track are must likely
  59. are part of the protection routine.
  60.   Now, we must enter debug. Load in the
  61. file execute a search for CD 13.  Record
  62. any address show.  If no address are
  63. picked up, this mean 1 or 2 things, the
  64. program is not copy protected (bullshit)
  65. or that the check is in an other part of
  66. the program not yet loaded.  The latter
  67. being a real bitch to find, so I'll
  68. cover it in part II.  There is another
  69. choice.  The CD 13 might be hidden in
  70. self changing code.  Here is what a
  71. sector of hidden code might look like
  72.  
  73. -U CS:0000
  74. 1B00:0000 31DB     XOR    BX,BX
  75. 1B00:0002 8EDB     MOV    DS,BX
  76. 1B00:0004 BB0D00   MOV    BX,000D
  77. 1B00:0007 8A07     MOV    AL,[BX]
  78. 1B00:0009 3412     XOR    AL,12
  79. 1B00:000B 8807     MOV    [BX],AL
  80. 1B00:000D DF13            FIST   WORD...
  81.  
  82.   In this section of code, [AL] is set
  83. to DF at location 1B00:0007.  When you
  84. XOR DF and 12, you would get a CD(hex)
  85. for the INT opcode which is placed right
  86. next to a 13 ie, giving you CD13 or INT-
  87. 13.  This type of code cann't and will
  88. not be found using debug's [S]earch
  89. command.
  90.  
  91. Finding Hidden INT-13s
  92. ----------------------
  93.   The way I find best to find hidden
  94. INT-13s, is to use a program called
  95. PC-WATCH (TRAP13 works well also).  This
  96. program traps the interrupts and will
  97. print where they were called from.  Once
  98. running this, you can just disassemble
  99. around the address until you find code
  100. that look like it is setting up the disk
  101. interupt.
  102.   An other way to decode the INT-13 is
  103. to use debug's [G]o command.  Just set a
  104. breakpoint at the address give by
  105. PC-WATCH (both programs give the return
  106. address).  Ie, -G CS:000F (see code
  107. above).  When debug stops, you will have
  108. encoded not only the INT-13 but anything
  109. else leading up to it.
  110.  
  111. What to do once you find INT-13
  112. -------------------------------
  113.   Once you find the INT-13, the hard
  114. part for the most part is over.  All
  115. that is left to do is to fool the
  116. computer in to thinking the protection
  117. has been found.  To find out what the
  118. computer is looking for, examine the
  119. code right after the INT-13.  Look for
  120. any branches having to do with the CARRY
  121. FLAG or any CMP to the AH register.
  122.   If a JNE or JC (etc) occurs, then
  123. [U]nassembe the address listed with the
  124. jump.  If it is a CMP then just read on.
  125.   Here you must decide if the program
  126. was looking for a protected track or
  127. just a normal track.  If it has a
  128. CMP AH,0 and it has read in a protected
  129. track, it can be assumed that it was
  130. looking to see if the program had
  131. successfully complete the READ/FORMAT of
  132. that track and that the disk had been
  133. copied thus JMPing back to DOS
  134. (usually).  If this is the case, Just
  135. NOP the bytes for the CMP and the
  136. corrisponding JMP.
  137.   If the program just checked for the
  138. carry flag to be set, and it isn't, then
  139. the program usually assumes that the
  140. disk has been copied. Examine the
  141. following code
  142.  
  143.       INT 13      <-- Read in the Sector
  144.       JC 1B00     <-- Protection found
  145.       INT 19      <-- Reboot
  146. 1B00  (rest of program)
  147.  
  148.   The program carries out the INT and
  149. find an error (the illegaly formatted
  150. sector) so the carry flag is set.  The
  151. computer, at the next instruction, see
  152. that the carry flag is set and know that
  153. the protection has not been breached.
  154. In this case, to fool the computer, just
  155. change the "JC 1B00" to a "JMP 1B00"
  156. thus defeating the protection scheme.
  157.  
  158.  
  159. NOTE: the PROTECTION ROUTINE might be
  160.      found in more than just 1 part of
  161.      the program
  162.  
  163. Handling EXE files
  164. ------------------
  165.   As we all know, Debug can read .EXE
  166. files but cannot write them.  To get
  167. around this, load and go about cracking
  168. the program as usual.  When the
  169. protection scheme has been found and
  170. tested, record (use the debug [D]ump
  171. command) to save + & - 10 bytes of the
  172. code around the INT 13.
  173.   Exit back to dos and rename the file
  174. to a .ZAP (any extention but .EXE will
  175. do) and reloading with debug.
  176.   Search the program for the 20+ bytes
  177. surrounding the code and record the
  178. address found.  Then just load this
  179. section and edit it like normal.
  180.   Save the file and exit back to dos.
  181. Rename it back to the .EXE file and it
  182. should be cracked.  ***NOTE: Sometimes
  183. you have to fuck around for a while to
  184. make it work.
  185.  
  186. DISK I/O (INT-13)
  187. -----------------
  188.   This interrupt uses the AH resister to
  189. select the function to be used.  Here is
  190. a chart describing the interrupt.
  191.  
  192. AH=0    Reset Disk
  193. AH=1    Read the Status of the Disk
  194.         system in to AL
  195.  
  196.     AL          Error
  197.   ----------------------------
  198.     00   - Successful
  199.     01   - Bad command given to INT
  200.    *02   - Address mark not found
  201.     03   - write attempted on write prot
  202.    *04   - request sector not found
  203.     08   - DMA overrun
  204.     09   - attempt to cross DMA boundry
  205.    *10   - bad CRC on disk read
  206.     20   - controller has failed
  207.     40   - seek operation failed
  208.     80   - attachment failed
  209. (* denotes most used in copy protection)
  210. AH=2    Read Sectors
  211.  
  212.   input
  213.      DL = Drive number (0-3)
  214.      DH = Head number (0or1)
  215.      CH = Track number
  216.      CL = Sector number
  217.      AL = # of sectors to read
  218.   ES:BX = load address
  219.   output
  220.       AH =error number (see above)
  221.           [Carry Flag Set]
  222.       AL = # of sectors read
  223.  
  224. AH=3 Write (params. as above)
  225. AH=4 Verify (params. as above -ES:BX)
  226. AH=5 Format (params. as above -CL,AL
  227.              ES:BX points to format
  228.              Table)
  229.  
  230.   For more infomation on INT-13 see the
  231. IBM Techinal Reference Manuals.
  232.  
  233. Comming Soon
  234. ------------
  235.   In part II, I will cover CALLs to
  236. INT-13 and INT-13 that is located in
  237. diffrents overlays of the program
  238.  
  239.  
  240. Happy Cracking.....
  241.         Buckaroo Banzai
  242.        <-------+------->
  243.  
  244. PS: This Phile can be Upload in it's
  245. unmodified FORM ONLY.
  246.  
  247. PPS: Any suggestion, corrections,
  248. comment on this Phile are accepted and
  249. incouraged.....
  250.                                                                                                                                                                                                                                                                
  251.